Subversion Repositories Kolibri OS

Rev

Rev 1309 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1309 Rev 1328
1
; ìàêðîñ äëÿ ñèñòåìíîé áèáëèîòåêè box_lib.obj
1
; ìàêðîñ äëÿ ñèñòåìíîé áèáëèîòåêè box_lib.obj
2
; ýëåìåíò TreeList äëÿ Kolibri OS
2
; ýëåìåíò TreeList äëÿ Kolibri OS
3
; ôàéë ïîñëåäíèé ðàç èçìåíÿëñÿ 8.12.2009 IgorA
3
; ôàéë ïîñëåäíèé ðàç èçìåíÿëñÿ 23.12.2009 IgorA
4
; íà êîä ïðèìåíåíà GPL2 ëèöåíçèÿ
4
; íà êîä ïðèìåíåíà GPL2 ëèöåíçèÿ
5
 
5
 
6
 
6
 
7
sizeof.TreeList equ 20
7
sizeof.TreeList equ 20
8
;struct TreeList
8
;struct TreeList
9
;  type dw ? ;+ 0 òèï ýëåìåíòà, èëè èíäåêñ èêîíêè äëÿ óçëà
9
;  type dw ? ;+ 0 òèï ýëåìåíòà, èëè èíäåêñ èêîíêè äëÿ óçëà
10
;  lev db ?  ;+ 2 óðîâåíü ýëåìåíòà
10
;  lev db ?  ;+ 2 óðîâåíü ýëåìåíòà
11
;  clo db ?  ;+ 3 ôëàã çàêðûòèÿ, èëè îòêðûòèÿ (èìååò ñìûñë äëÿ ðîäèòåëüñêîãî óçëà)
11
;  clo db ?  ;+ 3 ôëàã çàêðûòèÿ, èëè îòêðûòèÿ (èìååò ñìûñë äëÿ ðîäèòåëüñêîãî óçëà)
12
;  perv dd ? ;+ 4 èíäåêñ ïðåäûäóùåãî ýëåìåíòà
12
;  perv dd ? ;+ 4 èíäåêñ ïðåäûäóùåãî ýëåìåíòà
13
;  next dd ? ;+ 8 èíäåêñ ïîñëåäóþùåãî ýëåìåíòà
13
;  next dd ? ;+ 8 èíäåêñ ïîñëåäóþùåãî ýëåìåíòà
14
;  tc dd ?   ;+12 âðåì. ñîçäàíèÿ
14
;  tc dd ?   ;+12 âðåì. ñîçäàíèÿ
15
;  td dd ?   ;+16 âðåì. óäàëåíèÿ
15
;  td dd ?   ;+16 âðåì. óäàëåíèÿ
16
;ends
16
;ends
17
 
17
 
18
tl_info_size  equ  word[edi +4] ;ðàçìåð äàííûõ âûäåëÿåìûõ äëÿ êàæäîãî óçëà (ïîëüçîâàòåëüñüêèå äàííûå + òåêñò äëÿ ïîäïèñè)
18
tl_info_size  equ  word[edi +4] ;ðàçìåð äàííûõ âûäåëÿåìûõ äëÿ êàæäîãî óçëà (ïîëüçîâàòåëüñüêèå äàííûå + òåêñò äëÿ ïîäïèñè)
19
tl_style      equ dword[edi+10] ;ñòèëè ýëåìåíòà
19
tl_style      equ dword[edi+10] ;ñòèëè ýëåìåíòà
20
tl_data_nodes equ dword[edi+14] ;óêàçàòåëü íà ñòðóêòóðû óçëîâ
20
tl_data_nodes equ dword[edi+14] ;óêàçàòåëü íà ñòðóêòóðû óçëîâ
21
tl_img_cx     equ  word[edi+22] ;øèðèíà èêîíîê
21
tl_img_cx     equ  word[edi+22] ;øèðèíà èêîíîê
22
tl_img_cy     equ  word[edi+24] ;âûñîòà èêîíîê
22
tl_img_cy     equ  word[edi+24] ;âûñîòà èêîíîê
23
tl_data_img_sys equ dword[edi+26] ;óêàçàòåëü íà ñèñòåìíûå èçîáðàæåíèÿ (ñòðåëêè, ïëþñèêè)
23
tl_data_img_sys equ dword[edi+26] ;óêàçàòåëü íà ñèñòåìíûå èçîáðàæåíèÿ (ñòðåëêè, ïëþñèêè)
24
tl_ch_tim     equ dword[edi+30] ;êîëè÷åñòâî èçìåíåíèé â ôàéëå
24
tl_ch_tim     equ dword[edi+30] ;êîëè÷åñòâî èçìåíåíèé â ôàéëå
25
tl_tim_undo   equ dword[edi+38] ;êîëè÷åñòâî îòìåíåííûõ äåéñòâèé
25
tl_tim_undo   equ dword[edi+38] ;êîëè÷åñòâî îòìåíåííûõ äåéñòâèé
26
tl_cur_pos    equ dword[edi+42] ;ïîçèöèÿ êóðñîðà
26
tl_cur_pos    equ dword[edi+42] ;ïîçèöèÿ êóðñîðà
27
tl_col_bkg    equ dword[edi+46] ;öâåò ôîíà
27
tl_col_bkg    equ dword[edi+46] ;öâåò ôîíà
28
tl_col_zag    equ dword[edi+50] ;öâåò çàãîëîâêà
28
tl_col_zag    equ dword[edi+50] ;öâåò çàãîëîâêà
29
tl_col_txt    equ dword[edi+54] ;öâåò òåêñòà
29
tl_col_txt    equ dword[edi+54] ;öâåò òåêñòà
30
tl_box_left   equ dword[edi+58]
30
tl_box_left   equ dword[edi+58]
31
tl_box_top    equ dword[edi+62]
31
tl_box_top    equ dword[edi+62]
32
tl_box_width  equ dword[edi+66]
32
tl_box_width  equ dword[edi+66]
33
tl_box_height equ dword[edi+70]
33
tl_box_height equ dword[edi+70]
34
tl_capt_cy    equ  word[edi+74] ;âûñîòà ïîäïèñè
34
tl_capt_cy    equ  word[edi+74] ;âûñîòà ïîäïèñè
35
tl_info_capt_offs equ word[edi+76] ;ñäâèã äëÿ íà÷àëà òåêñòà (ïîäïèñè óçëà)
35
tl_info_capt_offs equ word[edi+76] ;ñäâèã äëÿ íà÷àëà òåêñòà (ïîäïèñè óçëà)
36
tl_info_capt_len equ word[edi+78] ;äëèííà òåêñòà ïîäïèñè óçëà (åñëè = 0 òî äî êîíöà ñòðóêòóðû)
36
tl_info_capt_len equ word[edi+78] ;äëèííà òåêñòà ïîäïèñè óçëà (åñëè = 0 òî äî êîíöà ñòðóêòóðû)
37
tl_el_focus   equ dword[edi+80] ;óêàçàòåëü íà ñòðóêòóðó ýëåìåíòà â ôîêóñå
37
tl_el_focus   equ dword[edi+80] ;óêàçàòåëü íà ñòðóêòóðó ýëåìåíòà â ôîêóñå
38
tl_p_scrol    equ dword[edi+84] ;óêàçàòåëü íà ñòðóêòóðó ñêðîëëèíãà
38
tl_p_scrol    equ dword[edi+84] ;óêàçàòåëü íà ñòðóêòóðó ñêðîëëèíãà
39
tl_on_press   equ dword[edi+96] ;óêàçàòåëü íà ôóíêöèþ, êîòîðàÿ âûçûâàåòñÿ ïðè íàæàòèè Enter
39
tl_on_press   equ dword[edi+96] ;óêàçàòåëü íà ôóíêöèþ, êîòîðàÿ âûçûâàåòñÿ ïðè íàæàòèè Enter
40
 
40
 
41
;êîíñòàíòû ñòèëÿ
41
;êîíñòàíòû ñòèëÿ
42
tl_key_no_edit   equ   1b ;ýëåìåíò íåëüçÿ ðåäàêòèðîâàòü íà êëàâèàòóðå (èçìåíÿòü óðîâíè, óäàëÿòü)
42
tl_key_no_edit   equ   1b ;ýëåìåíò íåëüçÿ ðåäàêòèðîâàòü íà êëàâèàòóðå (èçìåíÿòü óðîâíè, óäàëÿòü)
43
tl_draw_par_line equ  10b ;ðèñîâàòü ëèíèè ê ðîäèòåëüñêîìó óçëó
43
tl_draw_par_line equ  10b ;ðèñîâàòü ëèíèè ê ðîäèòåëüñêîìó óçëó
44
tl_list_box_mode equ 100b ;ñòèëü íå îòîáðàæàåò óðîâíè (êàê â ListBox âñå îäíîãî óðîâíÿ)
44
tl_list_box_mode equ 100b ;ñòèëü íå îòîáðàæàåò óðîâíè (êàê â ListBox âñå îäíîãî óðîâíÿ)
45
 
45
 
46
;êîíñòàíòû äëÿ ôóíêöèé
46
;êîíñòàíòû äëÿ ôóíêöèé
47
tl_err_save_memory_size equ  10b ;íå õâàòàåò ïàìÿòè äëÿ ñîõðàíåíèÿ ýëåìåíòà
47
tl_err_save_memory_size equ  10b ;íå õâàòàåò ïàìÿòè äëÿ ñîõðàíåíèÿ ýëåìåíòà
48
tl_err_load_caption     equ   1b ;â ïàìÿòè íåò çàãîëîâêà 'tree'
48
tl_err_load_caption     equ   1b ;â ïàìÿòè íåò çàãîëîâêà 'tree'
49
tl_err_load_info_size   equ 100b ;íå ñîâïàäàåò ðàçìåð èíôîðìàöèîííîé ñòðóêòóðû ïðè îòêðûòèè
49
tl_err_load_info_size   equ 100b ;íå ñîâïàäàåò ðàçìåð èíôîðìàöèîííîé ñòðóêòóðû ïðè îòêðûòèè
50
tl_load_mode_add        equ 0x20000 ;îïöèÿ ñ÷èòûâàíèÿ â ðåæèìå äîáàâëåíèÿ èíôîðìàöèè
50
tl_load_mode_add        equ 0x20000 ;îïöèÿ ñ÷èòûâàíèÿ â ðåæèìå äîáàâëåíèÿ èíôîðìàöèè
51
tl_save_load_heder_size equ 26 ;ðàçìåð çàãîëîâêà äëÿ çàïèñè/÷òåíèÿ ýëåìåíòîâ
51
tl_save_load_heder_size equ 26 ;ðàçìåð çàãîëîâêà äëÿ çàïèñè/÷òåíèÿ ýëåìåíòîâ
52
 
52
 
53
;data_info	 dd ? ;+ 0 óêàçàòåëü íà îñíîâíûå äàíûå
53
;data_info	 dd ? ;+ 0 óêàçàòåëü íà îñíîâíûå äàíûå
54
;info_max_count dd ? ;+ 6 ìàêñèìàëüíîå êîëëè÷åñòâî ñòðóêòóð
54
;info_max_count dd ? ;+ 6 ìàêñèìàëüíîå êîëëè÷åñòâî ñòðóêòóð
55
;data_img	 dd ? ;+18 óêàçàòåëü íà èçîáðàæåíèÿ
55
;data_img	 dd ? ;+18 óêàçàòåëü íà èçîáðàæåíèÿ
56
;ls_tim		dd ? ;+34 âðåìÿ ïîñëåäíåãî ñîõðàíåíèÿ
56
;ls_tim		dd ? ;+34 âðåìÿ ïîñëåäíåãî ñîõðàíåíèÿ
57
;on_activate dd ? ;+92 óêàçàòåëü íà ôóíêöèþ ïðè àêòèâèðîâàíèè óçëà
57
;on_activate dd ? ;+92 óêàçàòåëü íà ôóíêöèþ ïðè àêòèâèðîâàíèè óçëà
58
 
58
 
59
struc tree_list info_size,info_max_count,style, img_cx,img_cy,\
59
struc tree_list info_size,info_max_count,style, img_cx,img_cy,\
60
    col_bkg,col_zag,col_txt, box_l,box_t,box_w,box_h, capt_cy,info_capt_offs,\
60
    col_bkg,col_zag,col_txt, box_l,box_t,box_w,box_h, capt_cy,info_capt_offs,\
61
    info_capt_len,el_focus, p_scrol,on_press {
61
    info_capt_len,el_focus, p_scrol,on_press {
62
  .data_info	dd 0
62
  .data_info	dd 0
63
  .info_size	dw info_size
63
  .info_size	dw info_size
64
  .info_max_count dd info_max_count
64
  .info_max_count dd info_max_count
65
  .style	    dd style
65
  .style	    dd style
66
  .data_nodes	dd 0
66
  .data_nodes	dd 0
67
  .data_img	 dd 0
67
  .data_img	 dd 0
68
  .img_cx	   dw img_cx
68
  .img_cx	   dw img_cx
69
  .img_cy	   dw img_cy
69
  .img_cy	   dw img_cy
70
  .data_img_sys	 dd 0
70
  .data_img_sys	 dd 0
71
  .ch_tim		  dd 0
71
  .ch_tim		  dd 0
72
  .ls_tim		  dd 0
72
  .ls_tim		  dd 0
73
  .tim_undo	 dd 0
73
  .tim_undo	 dd 0
74
  .cur_pos	  dd 0
74
  .cur_pos	  dd 0
75
  .col_bkg	  dd col_bkg
75
  .col_bkg	  dd col_bkg
76
  .col_zag	  dd col_zag
76
  .col_zag	  dd col_zag
77
  .col_txt	  dd col_txt
77
  .col_txt	  dd col_txt
78
  .box_left   dd box_l
78
  .box_left   dd box_l
79
  .box_top    dd box_t
79
  .box_top    dd box_t
80
  .box_width  dd box_w
80
  .box_width  dd box_w
81
  .box_height dd box_h
81
  .box_height dd box_h
82
  .capt_cy	   dw capt_cy
82
  .capt_cy	   dw capt_cy
83
  .info_capt_offs dw info_capt_offs
83
  .info_capt_offs dw info_capt_offs
84
  .info_capt_len dw info_capt_len
84
  .info_capt_len dw info_capt_len
85
  .el_focus dd el_focus
85
  .el_focus dd el_focus
86
  .p_scrol  dd p_scrol
86
  .p_scrol  dd p_scrol
87
  rb 4
87
  rb 4
88
  .on_activate dd 0
88
  .on_activate dd 0
89
  .on_press dd on_press
89
  .on_press dd on_press
90
}
90
}
91
 
91
 
92
;-----------------------------------------------------------------------------
92
;-----------------------------------------------------------------------------
93
;ôóíêöèÿ äëÿ âûäåëåíèÿ ïàìÿòè
93
;ôóíêöèÿ äëÿ âûäåëåíèÿ ïàìÿòè
94
;input:
94
;input:
95
; ecx = size data
95
; ecx = size data
96
;otput:
96
;otput:
97
; eax = pointer to memory
97
; eax = pointer to memory
98
align 4
98
align 4
99
mem_Alloc:
99
mem_Alloc:
100
  push ebx
100
  push ebx
101
  mov eax,68
101
  mov eax,68
102
  mov ebx,12
102
  mov ebx,12
103
  int 0x40
103
  int 0x40
104
  pop ebx
104
  pop ebx
105
  ret
105
  ret
106
;-----------------------------------------------------------------------------
106
;-----------------------------------------------------------------------------
107
;ôóíêöèÿ äëÿ îñâîáîæäåíèÿ ïàìÿòè
107
;ôóíêöèÿ äëÿ îñâîáîæäåíèÿ ïàìÿòè
108
;input:
108
;input:
109
; ecx = pointer to memory
109
; ecx = pointer to memory
110
align 4
110
align 4
111
mem_Free:
111
mem_Free:
112
  push eax ebx
112
  push eax ebx
113
  cmp ecx,0
113
  cmp ecx,0
114
  jz @f
114
  jz @f
115
    mov eax,68
115
    mov eax,68
116
    mov ebx,13
116
    mov ebx,13
117
    int 0x40
117
    int 0x40
118
  @@:
118
  @@:
119
  pop ebx eax
119
  pop ebx eax
120
  ret
120
  ret
121
 
121
 
122
macro use_tree_list
122
macro use_tree_list
123
{
123
{
124
align 4
124
align 4
125
tl_data_init: ;âûäåëíèå ïàìÿòè äëÿ ñòðóêòóð ñïèñêà è îñíîâíîé èíôîðìàöèè (êîíñòðóêòîð)
125
tl_data_init: ;âûäåëíèå ïàìÿòè äëÿ ñòðóêòóð ñïèñêà è îñíîâíîé èíôîðìàöèè (êîíñòðóêòîð)
126
  push ebp
126
  push ebp
127
  mov ebp,esp
127
  mov ebp,esp
128
  push eax ecx edi
128
  push eax ecx edi
129
    mov edi,dword[ebp+8]
129
    mov edi,dword[ebp+8]
130
 
130
 
131
    xor ecx,ecx
131
    xor ecx,ecx
132
    mov cx,tl_info_size
132
    mov cx,tl_info_size
133
    imul ecx,dword[edi+6]
133
    imul ecx,dword[edi+6]
134
    call mem_Alloc
134
    call mem_Alloc
135
    mov dword[edi],eax ;êîïèðóåì óêàçàòåëü íà ïîëó÷åíóþ ïàìÿòü â ñòðóêòóðó
135
    mov dword[edi],eax ;êîïèðóåì óêàçàòåëü íà ïîëó÷åíóþ ïàìÿòü â ñòðóêòóðó
136
    mov dword[edi+18],0 ;îáíóëÿåì óêàçàòåëü 'data_img'
136
    mov dword[edi+18],0 ;îáíóëÿåì óêàçàòåëü 'data_img'
137
    mov tl_data_img_sys,0 ;îáíóëÿåì óêàçàòåëü 'data_img_sys'
137
    mov tl_data_img_sys,0 ;îáíóëÿåì óêàçàòåëü 'data_img_sys'
138
 
138
 
139
    mov ecx,sizeof.TreeList
139
    mov ecx,sizeof.TreeList
140
    imul ecx,dword[edi+6]
140
    imul ecx,dword[edi+6]
141
    call mem_Alloc
141
    call mem_Alloc
142
    mov tl_data_nodes,eax ;êîïèðóåì óêàçàòåëü íà ïîëó÷åíóþ ïàìÿòü â ñòðóêòóðó
142
    mov tl_data_nodes,eax ;êîïèðóåì óêàçàòåëü íà ïîëó÷åíóþ ïàìÿòü â ñòðóêòóðó
143
 
143
 
144
    push dword edi
144
    push dword edi
145
    call tl_info_clear
145
    call tl_info_clear
146
 
146
 
147
    ;íàñòðîéêè äî÷åðíåãî ñêðîëëèíãà
147
    ;íàñòðîéêè äî÷åðíåãî ñêðîëëèíãà
148
    cmp tl_p_scrol,0
148
    cmp tl_p_scrol,0
149
    je @f
149
    je @f
150
      mov eax,tl_p_scrol
150
      mov eax,tl_p_scrol
151
      ;*** öâåòîâûå íàñòðîéêè ***
151
      ;*** öâåòîâûå íàñòðîéêè ***
152
      mov ecx,tl_col_bkg
152
      mov ecx,tl_col_bkg
153
      mov dword[eax+28],ecx ;+28 .bckg_col
153
      mov dword[eax+28],ecx ;+28 .bckg_col
154
      mov ecx,tl_col_zag
154
      mov ecx,tl_col_zag
155
      mov dword[eax+32],ecx ;+32 .frnt_col
155
      mov dword[eax+32],ecx ;+32 .frnt_col
156
      mov ecx,tl_col_txt
156
      mov ecx,tl_col_txt
157
      mov dword[eax+36],ecx ;+32 .line_col
157
      mov dword[eax+36],ecx ;+32 .line_col
158
      ;*** íàñòðîéêè ðàçìåðîâ ***
158
      ;*** íàñòðîéêè ðàçìåðîâ ***
159
      mov ecx,tl_box_left
159
      mov ecx,tl_box_left
160
      add ecx,tl_box_width
160
      add ecx,tl_box_width
161
      mov word[eax+2],cx
161
      mov word[eax+2],cx
162
      mov ecx,tl_box_height
162
      mov ecx,tl_box_height
163
      mov word[eax+4],cx
163
      mov word[eax+4],cx
164
      mov ecx,tl_box_top
164
      mov ecx,tl_box_top
165
      mov word[eax+6],cx
165
      mov word[eax+6],cx
166
    @@:
166
    @@:
167
  pop edi ecx eax
167
  pop edi ecx eax
168
  pop ebp
168
  pop ebp
169
  ret 4
169
  ret 4
170
 
170
 
171
align 4
171
align 4
172
tl_data_clear: ;î÷èñòêà ïàìÿòè ýëåìåíòà (äåñòðóêòîð)
172
tl_data_clear: ;î÷èñòêà ïàìÿòè ýëåìåíòà (äåñòðóêòîð)
173
  push ebp
173
  push ebp
174
  mov ebp,esp
174
  mov ebp,esp
175
    push ecx edi
175
    push ecx edi
176
    mov edi,dword[ebp+8]
176
    mov edi,dword[ebp+8]
177
    cmp dword[edi+18],0 ;data_img
177
    cmp dword[edi+18],0 ;data_img
178
    je @f
178
    je @f
179
      mov ecx,dword[edi+18]
179
      mov ecx,dword[edi+18]
180
      call mem_Free ;÷èñòêà ñèñòåìíûõ èêîíîê
180
      call mem_Free ;÷èñòêà ñèñòåìíûõ èêîíîê
181
    @@:
181
    @@:
182
    cmp tl_data_img_sys,0
182
    cmp tl_data_img_sys,0
183
    je @f
183
    je @f
184
      mov ecx,tl_data_img_sys
184
      mov ecx,tl_data_img_sys
185
      call mem_Free ;÷èñòêà ñèñòåìíûõ èêîíîê
185
      call mem_Free ;÷èñòêà ñèñòåìíûõ èêîíîê
186
    @@:
186
    @@:
187
    mov ecx,dword[edi]
187
    mov ecx,dword[edi]
188
    call mem_Free
188
    call mem_Free
189
 
189
 
190
    mov ecx,tl_data_nodes
190
    mov ecx,tl_data_nodes
191
    call mem_Free
191
    call mem_Free
192
    pop edi ecx
192
    pop edi ecx
193
  pop ebp
193
  pop ebp
194
  ret 4
194
  ret 4
195
 
195
 
196
align 4
196
align 4
197
tl_info_clear: ;î÷èñòêà ñïèñêà (èíôîðìàöèè)
197
tl_info_clear: ;î÷èñòêà ñïèñêà (èíôîðìàöèè)
198
  push ebp
198
  push ebp
199
  mov ebp,esp
199
  mov ebp,esp
200
    push eax ecx edi
200
    push eax ecx edi
201
    mov edi,dword[ebp+8]
201
    mov edi,dword[ebp+8]
202
    mov tl_ch_tim,0
202
    mov tl_ch_tim,0
203
    mov dword[edi+34],0 ;ls_tim
203
    mov dword[edi+34],0 ;ls_tim
204
    mov tl_tim_undo,0
204
    mov tl_tim_undo,0
205
    mov tl_cur_pos,0
205
    mov tl_cur_pos,0
206
    ;xor ecx,ecx
206
    ;xor ecx,ecx
207
    mov ecx,sizeof.TreeList
207
    mov ecx,sizeof.TreeList
208
    imul ecx,dword[edi+6]
208
    imul ecx,dword[edi+6]
209
    mov eax,tl_data_nodes
209
    mov eax,tl_data_nodes
210
    @@:
210
    @@:
211
      mov byte[eax],0 ;÷èñòèì óçëû 0-ìè
211
      mov byte[eax],0 ;÷èñòèì óçëû 0-ìè
212
      inc eax
212
      inc eax
213
      loop @b
213
      loop @b
214
    mov eax,tl_data_nodes ;óêàçàòåëü íà 0-é óçåë
214
    mov eax,tl_data_nodes ;óêàçàòåëü íà 0-é óçåë
215
    mov dword[eax+8],1 ;óêàçàòåëü next â 0-ì óçëå ïðèðàâíèâàåì ê 1
215
    mov dword[eax+8],1 ;óêàçàòåëü next â 0-ì óçëå ïðèðàâíèâàåì ê 1
216
 
216
 
217
    cmp tl_p_scrol,0 ;îáðàáîòêà ñêðîëëèíãà
217
    cmp tl_p_scrol,0 ;îáðàáîòêà ñêðîëëèíãà
218
    je @f
218
    je @f
219
      mov eax,tl_p_scrol
219
      mov eax,tl_p_scrol
220
      mov dword[eax+24],0 ;+24 .position
220
      mov dword[eax+24],0 ;+24 .position
221
      call tb_scrol_resize
221
      call tb_scrol_resize
222
    @@:
222
    @@:
223
    pop edi ecx eax
223
    pop edi ecx eax
224
  pop ebp
224
  pop ebp
225
  ret 4
225
  ret 4
226
 
226
 
227
 
227
 
228
align 4
228
align 4
229
tl_key: ;ðåàêöèÿ íà êëàâèàòóðó
229
tl_key: ;ðåàêöèÿ íà êëàâèàòóðó
230
  push ebp
230
  push ebp
231
  mov ebp,esp
231
  mov ebp,esp
232
    push ebx ecx edi
232
    push ebx ecx edi
233
    mov edi,dword[ebp+8]
233
    mov edi,dword[ebp+8]
234
 
234
 
235
    mov ebx,tl_el_focus
235
    mov ebx,tl_el_focus
236
    cmp dword[ebx],edi
236
    cmp dword[ebx],edi
237
    jne .no_focus ;ýëåìåíò íå â ôîêóñå
237
    jne .no_focus ;ýëåìåíò íå â ôîêóñå
238
 
238
 
239
    push eax
239
    push eax
240
    mov eax,66
240
    mov eax,66
241
    mov ebx,2
241
    mov ebx,2
242
    int 0x40  ;ïîëó÷èòü ðåæèì ââîäà ñ êëàâèàòóðû
242
    int 0x40  ;ïîëó÷èòü ðåæèì ââîäà ñ êëàâèàòóðû
243
 
243
 
244
    lea ecx,[tl_key_scan]
244
    lea ecx,[tl_key_scan]
245
    cmp eax,1 ;1 = ñêàíêîäû
245
    cmp eax,1 ;1 = ñêàíêîäû
246
    je @f
246
    je @f
247
      lea ecx,[tl_key_ascii]
247
      lea ecx,[tl_key_ascii]
248
    @@:
248
    @@:
249
    pop eax
249
    pop eax
250
 
250
 
251
    xor bx,bx
251
    xor bx,bx
252
    cmp ah,byte[ecx] ;Enter
252
    cmp ah,byte[ecx] ;Enter
253
    jne @f
253
    jne @f
254
      cmp tl_on_press,0
254
      cmp tl_on_press,0
255
      je @f
255
      je @f
256
        call tl_on_press
256
        call tl_on_press
257
    @@:
257
    @@:
258
    cmp ah,byte[ecx+1] ;Space
258
    cmp ah,byte[ecx+1] ;Space
259
    jne @f
259
    jne @f
260
      push dword edi
260
      push dword edi
261
      call tl_node_close_open
261
      call tl_node_close_open
262
    @@:
262
    @@:
263
    cmp ah,byte[ecx+2] ;Up
263
    cmp ah,byte[ecx+2] ;Up
264
    jne @f
264
    jne @f
265
      push dword edi
265
      push dword edi
266
      call tl_cur_perv
266
      call tl_cur_perv
267
    @@:
267
    @@:
268
    cmp ah,byte[ecx+3] ;Down
268
    cmp ah,byte[ecx+3] ;Down
269
    jne @f
269
    jne @f
270
      push dword edi
270
      push dword edi
271
      call tl_cur_next
271
      call tl_cur_next
272
    @@:
272
    @@:
273
    cmp ah,byte[ecx+7] ;Page Up
273
    cmp ah,byte[ecx+7] ;Page Up
274
    jne @f
274
    jne @f
275
      push dword edi
275
      push dword edi
276
      call tl_cur_page_up
276
      call tl_cur_page_up
277
    @@:
277
    @@:
278
    cmp ah,byte[ecx+8] ;Page Down
278
    cmp ah,byte[ecx+8] ;Page Down
279
    jne @f
279
    jne @f
280
      push dword edi
280
      push dword edi
281
      call tl_cur_page_down
281
      call tl_cur_page_down
282
    @@:
282
    @@:
283
 
283
 
284
    bt tl_style,0 ;tl_key_no_edit
284
    bt tl_style,0 ;tl_key_no_edit
285
    jc .no_edit
285
    jc .no_edit
286
      cmp ah,byte[ecx+4] ;Left
286
      cmp ah,byte[ecx+4] ;Left
287
      jne @f
287
      jne @f
288
	push dword edi
288
	push dword edi
289
	call tl_node_lev_dec
289
	call tl_node_lev_dec
290
	mov bx,1
290
	mov bx,1
291
      @@:
291
      @@:
292
      cmp ah,byte[ecx+5] ;Right
292
      cmp ah,byte[ecx+5] ;Right
293
      jne @f
293
      jne @f
294
	push dword edi
294
	push dword edi
295
	call tl_node_lev_inc
295
	call tl_node_lev_inc
296
	mov bx,1
296
	mov bx,1
297
      @@:
297
      @@:
298
      cmp ah,byte[ecx+6] ;Delete
298
      cmp ah,byte[ecx+6] ;Delete
299
      jne @f
299
      jne @f
300
	push dword edi
300
	push dword edi
301
	call tl_node_delete
301
	call tl_node_delete
302
	mov bx,1
302
	mov bx,1
303
      @@:
303
      @@:
304
    .no_edit:
304
    .no_edit:
305
 
305
 
306
    cmp bx,1
306
    cmp bx,1
307
    jne .no_focus
307
    jne .no_focus
308
      push dword edi
308
      push dword edi
309
      call tl_draw
309
      call tl_draw
310
    .no_focus:
310
    .no_focus:
311
 
311
 
312
    pop edi ecx ebx
312
    pop edi ecx ebx
313
  pop ebp
313
  pop ebp
314
  ret 4
314
  ret 4
315
 
315
 
316
align 4
316
align 4
317
tl_mouse: ;ðåàêöèÿ íà ìûøü
317
tl_mouse: ;ðåàêöèÿ íà ìûøü
318
  push ebp
318
  push ebp
319
  mov ebp,esp
319
  mov ebp,esp
320
    push eax ebx ecx edx edi esi
320
    push eax ebx ecx edx edi esi
321
    mov edi,dword[ebp+8]
321
    mov edi,dword[ebp+8]
322
 
322
 
323
    mov eax,37
323
    mov eax,37
324
    mov ebx,2
324
    mov ebx,2
325
    int 0x40
325
    int 0x40
326
 
326
 
327
    bt eax,0 ;left mouse button press
327
    bt eax,0 ;left mouse button press
328
    jae .no_draw
328
    jae .no_draw
329
 
329
 
330
    mov eax,37
330
    mov eax,37
331
    mov ebx,1
331
    mov ebx,1
332
    int 0x40
332
    int 0x40
333
 
333
 
334
    mov ebx,tl_box_left
334
    mov ebx,tl_box_left
335
    shl ebx,16
335
    shl ebx,16
336
    cmp eax,ebx ;ëåâàÿ ãðàíèöà îêíà
336
    cmp eax,ebx ;ëåâàÿ ãðàíèöà îêíà
337
    jl .no_in_wnd
337
    jl .no_in_wnd
338
 
338
 
339
    mov ebx,tl_box_left
339
    mov ebx,tl_box_left
340
    add ebx,tl_box_width
340
    add ebx,tl_box_width
341
    shl ebx,16
341
    shl ebx,16
342
    cmp eax,ebx ;ïðàâàÿ ãðàíèöà îêíà
342
    cmp eax,ebx ;ïðàâàÿ ãðàíèöà îêíà
343
    jg .test_scroll ;.no_in_wnd
343
    jg .test_scroll ;.no_in_wnd
344
 
344
 
345
    mov ebx,tl_box_top
345
    mov ebx,tl_box_top
346
    add ebx,tl_box_height
346
    add ebx,tl_box_height
347
    cmp ax,bx ;íèæíÿÿ ãðàíèöà îêíà
347
    cmp ax,bx ;íèæíÿÿ ãðàíèöà îêíà
348
    jg .no_in_wnd
348
    jg .no_in_wnd
349
 
349
 
350
    sub ebx,tl_box_height
350
    sub ebx,tl_box_height
351
    add bx,tl_capt_cy
351
    add bx,tl_capt_cy
352
    cmp ax,bx ;âåðõíÿÿ ãðàíèöà îêíà + âûñîòà ïîäïèñè
352
    cmp ax,bx ;âåðõíÿÿ ãðàíèöà îêíà + âûñîòà ïîäïèñè
353
    jl .no_in_wnd
353
    jl .no_in_wnd
354
 
354
 
355
    mov esi,tl_el_focus
355
    mov esi,tl_el_focus
356
    mov dword[esi],edi ;set focus
356
    mov dword[esi],edi ;set focus
357
 
357
 
358
    ; if '+' or '-' press
358
    ; if '+' or '-' press
359
    mov esi,eax
359
    mov esi,eax
360
    shr esi,16
360
    shr esi,16
361
    sub esi,tl_box_left ;esi = mouse x coord in element window
361
    sub esi,tl_box_left ;esi = mouse x coord in element window
362
 
362
 
363
    and eax,0xffff
363
    and eax,0xffff
364
    sub ax,bx
364
    sub ax,bx
365
    xor edx,edx
365
    xor edx,edx
366
    xor ecx,ecx
366
    xor ecx,ecx
367
    mov cx,tl_img_cy
367
    mov cx,tl_img_cy
368
    div ecx
368
    div ecx
369
    cmp tl_p_scrol,0 ;ó÷èòûâàåì ñêðîëëèíã
369
    cmp tl_p_scrol,0 ;ó÷èòûâàåì ñêðîëëèíã
370
    je @f
370
    je @f
371
      mov edx,tl_p_scrol
371
      mov edx,tl_p_scrol
372
      add eax,dword[edx+24] ;äîáàâëÿåì ñêðîëëèíã íà âåðõó
372
      add eax,dword[edx+24] ;äîáàâëÿåì ñêðîëëèíã íà âåðõó
373
    @@:
373
    @@:
374
 
374
 
375
    mov ecx,eax
375
    mov ecx,eax
376
    call tl_get_node_count ;eax = node count
376
    call tl_get_node_count ;eax = node count
377
    cmp eax,ecx
377
    cmp eax,ecx
378
    jl @f
378
    jl @f
379
      mov eax,ecx ;åñëè êóðñîð íå âûøåë çà ïðåäåëû óçëîâ, âîññòàíàâëèâàåì ñòàðîå çíà÷åíèå eax
379
      mov eax,ecx ;åñëè êóðñîð íå âûøåë çà ïðåäåëû óçëîâ, âîññòàíàâëèâàåì ñòàðîå çíà÷åíèå eax
380
    @@:
380
    @@:
381
 
381
 
382
    cmp eax,tl_cur_pos ;åñëè íîâîå çíà÷åíèå êóðñîðà ñîâïàëî ñ ïðåäûäóùèì
382
    cmp eax,tl_cur_pos ;åñëè íîâîå çíà÷åíèå êóðñîðà ñîâïàëî ñ ïðåäûäóùèì
383
    je @f ;òî íå ñòèðàåì êóðñîð
383
    je @f ;òî íå ñòèðàåì êóðñîð
384
    push esi
384
    push esi
385
      mov esi,tl_box_top
385
      mov esi,tl_box_top
386
      add esi,tl_box_height ;esi = coord bottom border
386
      add esi,tl_box_height ;esi = coord bottom border
387
      call tl_draw_null_cursor ;ñòèðàåì êóðñîð
387
      call tl_draw_null_cursor ;ñòèðàåì êóðñîð
388
    pop esi
388
    pop esi
389
    @@:
389
    @@:
390
 
390
 
391
    mov tl_cur_pos,eax
391
    mov tl_cur_pos,eax
392
 
392
 
393
    ; if '+' or '-' press
393
    ; if '+' or '-' press
394
    call tl_get_cur_node_index ;eax = node index
394
    call tl_get_cur_node_index ;eax = node index
395
    cmp eax,2
395
    cmp eax,2
396
    jl .no_open_close ;êóðñîð ñòîèò íà ïóñòîì ìåñòå, áåç óçëîâ
396
    jl .no_open_close ;êóðñîð ñòîèò íà ïóñòîì ìåñòå, áåç óçëîâ
397
    imul eax,sizeof.TreeList
397
    imul eax,sizeof.TreeList
398
    add eax,tl_data_nodes
398
    add eax,tl_data_nodes
399
    xor bx,bx
399
    xor bx,bx
400
    mov bl,byte[eax+2] ;+2 lev ñîõðàíÿåì óðîâåíü òåêóùåãî óçëà
400
    mov bl,byte[eax+2] ;+2 lev ñîõðàíÿåì óðîâåíü òåêóùåãî óçëà
401
    inc bx ;+ ïîëå äëÿ êóðñîðà
401
    inc bx ;+ ïîëå äëÿ êóðñîðà
402
 
402
 
403
    cmp si,tl_img_cx
403
    cmp si,tl_img_cx
404
    jl .no_open_close ;ìûøåé ïîïàëè íà ëåâîå ïîëå äëÿ êóðñîðà, ãäå òî÷íî íåò '+' è '-'
404
    jl .no_open_close ;ìûøåé ïîïàëè íà ëåâîå ïîëå äëÿ êóðñîðà, ãäå òî÷íî íåò '+' è '-'
405
      mov eax,esi
405
      mov eax,esi
406
      xor edx,edx
406
      xor edx,edx
407
      xor ecx,ecx
407
      xor ecx,ecx
408
      mov cx,tl_img_cx
408
      mov cx,tl_img_cx
409
      div ecx
409
      div ecx
410
 
410
 
411
      cmp ax,bx
411
      cmp ax,bx
412
      jne .no_open_close
412
      jne .no_open_close
413
 
413
 
414
      push dword edi
414
      push dword edi
415
      call tl_node_close_open
415
      call tl_node_close_open
416
    .no_open_close:
416
    .no_open_close:
417
 
417
 
418
      mov esi,tl_box_top
418
      mov esi,tl_box_top
419
      add esi,tl_box_height ;esi = coord bottom border
419
      add esi,tl_box_height ;esi = coord bottom border
420
      call tl_draw_cursor ;ïåðåðèñîâêà êóðñîðà
420
      call tl_draw_cursor ;ïåðåðèñîâêà êóðñîðà
421
      call tl_draw_caption_cur_pos
421
      call tl_draw_caption_cur_pos
422
      jmp .no_draw
422
      jmp .no_draw
423
;--- mouse event for children scrollbar ----------------------------------------
423
;--- mouse event for children scrollbar ----------------------------------------
424
.test_scroll:
424
.test_scroll:
425
  mov edx,tl_p_scrol
425
  mov edx,tl_p_scrol
426
  cmp edx,0
426
  cmp edx,0
427
  je .no_in_wnd ;ïîëüçîâàòåëü íå ñîçäàë äî÷åðíåãî ñêðîëëèíãà
427
  je .no_in_wnd ;ïîëüçîâàòåëü íå ñîçäàë äî÷åðíåãî ñêðîëëèíãà
428
    shr ebx,16
428
    shr ebx,16
429
    add bx,word[edx] ;+0 .size_x
429
    add bx,word[edx] ;+0 .size_x
430
    shl ebx,16
430
    shl ebx,16
431
    cmp eax,ebx ;ïðàâàÿ ãðàíèöà îêíà
431
    cmp eax,ebx ;ïðàâàÿ ãðàíèöà îêíà
432
    jg .no_in_wnd
432
    jg .no_in_wnd
433
 
433
 
434
    mov eax,dword[edx+16] ;+16 .max_area
434
    mov eax,dword[edx+16] ;+16 .max_area
435
    cmp eax,dword[edx+20] ;+20 .cur_area
435
    cmp eax,dword[edx+20] ;+20 .cur_area
436
    jbe .no_in_wnd ;âñå óçëû ïîïàäàþò â îêíî ñêðîëëèíãà
436
    jbe .no_in_wnd ;âñå óçëû ïîïàäàþò â îêíî ñêðîëëèíãà
437
      push dword edx
437
      push dword edx
438
      call scroll_bar_vertical.mouse ;scrollbar_ver_mouse
438
      call scroll_bar_vertical.mouse ;scrollbar_ver_mouse
439
 
439
 
440
      cmp dword[edx+40],0 ;+40 .redraw
440
      cmp dword[edx+40],0 ;+40 .redraw
441
      je  @f
441
      je  @f
442
        mov dword[edx+40],0 ;+40 .redraw
442
        mov dword[edx+40],0 ;+40 .redraw
443
        push dword edi
443
        push dword edi
444
        call tl_draw ;ïðîèçîøëè èçìåíåíèÿ ñêðîëëèíãà
444
        call tl_draw ;ïðîèçîøëè èçìåíåíèÿ ñêðîëëèíãà
445
      @@:
445
      @@:
446
      cmp dword[edx+46],0 ;+46 .delta2
446
      cmp dword[edx+46],0 ;+46 .delta2
447
      jne .no_draw ;ïîïàëè íà ñêðîëëèíã - íå ñíèìàåì ôîêóñ ñ TreeList
447
      jne .no_draw ;ïîïàëè íà ñêðîëëèíã - íå ñíèìàåì ôîêóñ ñ TreeList
448
;-------------------------------------------------------------------------------
448
;-------------------------------------------------------------------------------
449
    .no_in_wnd: ;íå ïîïàëè â îêíî - ïîòåðÿ ôîêóñà (ïðè óñëîâèè ÷òî ôîêóñ áûë íà äàííîì ýåëåìåíòå)
449
    .no_in_wnd: ;íå ïîïàëè â îêíî - ïîòåðÿ ôîêóñà (ïðè óñëîâèè ÷òî ôîêóñ áûë íà äàííîì ýåëåìåíòå)
450
      mov ebx,tl_el_focus
450
      mov ebx,tl_el_focus
451
      cmp dword[ebx],edi
451
      cmp dword[ebx],edi
452
      jne .no_draw ;ýëåìåíò íå â ôîêóñå
452
      jne .no_draw ;ýëåìåíò íå â ôîêóñå
453
        mov dword[ebx],0 ;reset focus
453
        mov dword[ebx],0 ;reset focus
454
        mov esi,tl_box_top
454
        mov esi,tl_box_top
455
        add esi,tl_box_height ;esi = coord bottom border
455
        add esi,tl_box_height ;esi = coord bottom border
456
        call tl_draw_cursor ;ðèñóåì êóðñîð ñ ïîòåðÿíûì ôîêóñîì
456
        call tl_draw_cursor ;ðèñóåì êóðñîð ñ ïîòåðÿíûì ôîêóñîì
457
    .no_draw:
457
    .no_draw:
458
 
458
 
459
    pop esi edi edx ecx ebx eax
459
    pop esi edi edx ecx ebx eax
460
  pop ebp
460
  pop ebp
461
  ret 4
461
  ret 4
462
 
462
 
463
align 4
463
align 4
464
tl_info_undo: ;îòìåíà äåéñòâèÿ
464
tl_info_undo: ;îòìåíà äåéñòâèÿ
465
  push ebp
465
  push ebp
466
  mov ebp,esp
466
  mov ebp,esp
467
  push eax edi
467
  push eax edi
468
    mov edi,dword[ebp+8]
468
    mov edi,dword[ebp+8]
469
    mov eax,tl_tim_undo
469
    mov eax,tl_tim_undo
470
    cmp tl_ch_tim,eax
470
    cmp tl_ch_tim,eax
471
    jbe @f
471
    jbe @f
472
      inc tl_tim_undo
472
      inc tl_tim_undo
473
      call tb_scrol_resize ;îáðàáîòêà ñêðîëëèíãà
473
      call tb_scrol_resize ;îáðàáîòêà ñêðîëëèíãà
474
    @@:
474
    @@:
475
  pop edi eax
475
  pop edi eax
476
  pop ebp
476
  pop ebp
477
  ret 4
477
  ret 4
478
 
478
 
479
align 4
479
align 4
480
tl_info_redo: ;ïîâòîð äåéñòâèÿ
480
tl_info_redo: ;ïîâòîð äåéñòâèÿ
481
  push ebp
481
  push ebp
482
  mov ebp,esp
482
  mov ebp,esp
483
  push edi
483
  push edi
484
    mov edi,dword[ebp+8]
484
    mov edi,dword[ebp+8]
485
    cmp tl_tim_undo,1
485
    cmp tl_tim_undo,1
486
    jl @f
486
    jl @f
487
      dec tl_tim_undo
487
      dec tl_tim_undo
488
      call tb_scrol_resize ;îáðàáîòêà ñêðîëëèíãà
488
      call tb_scrol_resize ;îáðàáîòêà ñêðîëëèíãà
489
    @@:
489
    @@:
490
  pop edi
490
  pop edi
491
  pop ebp
491
  pop ebp
492
  ret 4
492
  ret 4
493
 
493
 
494
align 4
494
align 4
495
tl_info_set_undo: ;óäàëåíèå îòìåíåííûõ äåéñòâèé
495
tl_info_set_undo: ;óäàëåíèå îòìåíåííûõ äåéñòâèé
496
;  push ebp
496
;  push ebp
497
;  mov ebp,esp
497
;  mov ebp,esp
498
;  push edi
498
;  push edi
499
;    mov edi,dword[ebp+8]
499
;    mov edi,dword[ebp+8]
500
 
500
 
501
;  mov [dragk],0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
501
;  mov [dragk],0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
502
  cmp tl_tim_undo,1
502
  cmp tl_tim_undo,1
503
  jl .no_work
503
  jl .no_work
504
 
504
 
505
  push eax ebx ecx edx
505
  push eax ebx ecx edx
506
  mov edx,tl_data_nodes
506
  mov edx,tl_data_nodes
507
  mov ecx,edx
507
  mov ecx,edx
508
  add ecx,sizeof.TreeList
508
  add ecx,sizeof.TreeList
509
  call tl_move_next ;long i=node[0].next;
509
  call tl_move_next ;long i=node[0].next;
510
  mov eax,tl_tim_undo
510
  mov eax,tl_tim_undo
511
  sub tl_ch_tim,eax ;ch_tim-=tim_undo;
511
  sub tl_ch_tim,eax ;ch_tim-=tim_undo;
512
  mov eax,tl_ch_tim
512
  mov eax,tl_ch_tim
513
  cmp [edi+34],eax ;if(ls_tim>ch_tim)
513
  cmp [edi+34],eax ;if(ls_tim>ch_tim)
514
  jle @f
514
  jle @f
515
    mov dword[edi+34],0 ;ls_tim=0
515
    mov dword[edi+34],0 ;ls_tim=0
516
  @@:
516
  @@:
517
    cmp edx,ecx
517
    cmp edx,ecx
518
    jle @f
518
    jle @f
519
 
519
 
520
    ;if(node[i].tc>ch_tim){ // åñëè ñîçäàíèå ñèìâîëà áûëî îòìåíåíî
520
    ;if(node[i].tc>ch_tim){ // åñëè ñîçäàíèå ñèìâîëà áûëî îòìåíåíî
521
    cmp dword[edx+12],eax
521
    cmp dword[edx+12],eax
522
    jle .no_u1
522
    jle .no_u1
523
      mov dword[edx+12],0
523
      mov dword[edx+12],0
524
      mov dword[edx+16],0
524
      mov dword[edx+16],0
525
 
525
 
526
      mov ebx, dword[edx+4]
526
      mov ebx, dword[edx+4]
527
      imul ebx,sizeof.TreeList
527
      imul ebx,sizeof.TreeList
528
      add ebx, tl_data_nodes ;.next
528
      add ebx, tl_data_nodes ;.next
529
      push dword[edx+8] ;node[node[i].perv].next=node[i].next;
529
      push dword[edx+8] ;node[node[i].perv].next=node[i].next;
530
      pop dword[ebx+8]
530
      pop dword[ebx+8]
531
 
531
 
532
      mov ebx, dword[edx+8]
532
      mov ebx, dword[edx+8]
533
      imul ebx,sizeof.TreeList
533
      imul ebx,sizeof.TreeList
534
      add ebx, tl_data_nodes ;.perv
534
      add ebx, tl_data_nodes ;.perv
535
      push dword[edx+4] ;node[node[i].next].perv=node[i].perv;
535
      push dword[edx+4] ;node[node[i].next].perv=node[i].perv;
536
      pop dword[ebx+4]
536
      pop dword[ebx+4]
537
 
537
 
538
    .no_u1:
538
    .no_u1:
539
 
539
 
540
    ;else if(node[i].td>ch_tim) node[i].td=0; // åñëè óäàëåíèå ñèìâîëà áûëî îòìåíåíî
540
    ;else if(node[i].td>ch_tim) node[i].td=0; // åñëè óäàëåíèå ñèìâîëà áûëî îòìåíåíî
541
    cmp dword[edx+16],eax
541
    cmp dword[edx+16],eax
542
    jle .no_u2
542
    jle .no_u2
543
      mov dword[edx+16],0
543
      mov dword[edx+16],0
544
    .no_u2:
544
    .no_u2:
545
 
545
 
546
    call tl_move_next
546
    call tl_move_next
547
    jmp @b
547
    jmp @b
548
  @@:
548
  @@:
549
  mov tl_tim_undo,0
549
  mov tl_tim_undo,0
550
;  mov eax,[edi+?] ;co_tim
550
;  mov eax,[edi+?] ;co_tim
551
;  cmp tl_ch_tim,eax ;ch_tim
551
;  cmp tl_ch_tim,eax ;ch_tim
552
;  jge @f
552
;  jge @f
553
;    mov [edi+?],0 ;co_tim
553
;    mov [edi+?],0 ;co_tim
554
;  @@:
554
;  @@:
555
  pop edx ecx ebx eax
555
  pop edx ecx ebx eax
556
  .no_work:
556
  .no_work:
557
 
557
 
558
;  pop edi
558
;  pop edi
559
;  pop ebp
559
;  pop ebp
560
;  ret 4
560
;  ret 4
561
  ret
561
  ret
562
 
562
 
563
align 4
563
align 4
564
tl_draw: ;âûâîä ñïèñêà íà ýêðàí
564
tl_draw: ;âûâîä ñïèñêà íà ýêðàí
565
  push ebp
565
  push ebp
566
  mov ebp,esp
566
  mov ebp,esp
567
    push eax ebx ecx edx edi esi
567
    push eax ebx ecx edx edi esi
568
    ;draw dir_list main rect
568
    ;draw dir_list main rect
569
    mov edi,dword[ebp+8]
569
    mov edi,dword[ebp+8]
570
    mov ebx,tl_box_left
570
    mov ebx,tl_box_left
571
    shl ebx,16
571
    shl ebx,16
572
    add ebx,tl_box_width
572
    add ebx,tl_box_width
573
    mov ecx,tl_box_top
573
    mov ecx,tl_box_top
574
    shl ecx,16
574
    shl ecx,16
575
    mov cx,tl_capt_cy
575
    mov cx,tl_capt_cy
576
    mov edx,tl_col_zag
576
    mov edx,tl_col_zag
577
    mov eax,13
577
    mov eax,13
578
    int 0x40 ;draw window caption
578
    int 0x40 ;draw window caption
579
 
579
 
580
    add ecx,tl_box_top
580
    add ecx,tl_box_top
581
    shl ecx,16
581
    shl ecx,16
582
    add ecx,tl_box_height
582
    add ecx,tl_box_height
583
    sub cx,tl_capt_cy
583
    sub cx,tl_capt_cy
584
    mov edx,tl_col_bkg
584
    mov edx,tl_col_bkg
585
    int 0x40 ;draw window client rect
585
    int 0x40 ;draw window client rect
586
 
586
 
587
    cmp tl_capt_cy,9 ;9 - minimum caption height
587
    cmp tl_capt_cy,9 ;9 - minimum caption height
588
    jl @f
588
    jl @f
589
    mov ebx,edi ;calculate cursor position
589
    mov ebx,edi ;calculate cursor position
590
    mov eax,tl_cur_pos
590
    mov eax,tl_cur_pos
591
    inc eax
591
    inc eax
592
    lea edi,[txt_capt_cur]
592
    lea edi,[txt_capt_cur]
593
    add edi,7
593
    add edi,7
594
    call tl_convert_to_str
594
    call tl_convert_to_str
595
 
595
 
596
    mov edi,ebx
596
    mov edi,ebx
597
    mov eax,tl_tim_undo
597
    mov eax,tl_tim_undo
598
    lea edi,[txt_capt_otm]
598
    lea edi,[txt_capt_otm]
599
    add edi,7
599
    add edi,7
600
    call tl_convert_to_str
600
    call tl_convert_to_str
601
    mov edi,ebx ;restore edi
601
    mov edi,ebx ;restore edi
602
 
602
 
603
    mov eax,4 ;draw text captions
603
    mov eax,4 ;draw text captions
604
    mov ebx,tl_box_left
604
    mov ebx,tl_box_left
605
    shl ebx,16
605
    shl ebx,16
606
    add ebx,5*65536+3
606
    add ebx,5*65536+3
607
    add ebx,tl_box_top
607
    add ebx,tl_box_top
608
    mov ecx,tl_col_txt
608
    mov ecx,tl_col_txt
609
    or	ecx,0x80000000
609
    or	ecx,0x80000000
610
    lea edx,[txt_capt_cur]
610
    lea edx,[txt_capt_cur]
611
    int 0x40
611
    int 0x40
612
 
612
 
613
    mov ebx,tl_box_left
613
    mov ebx,tl_box_left
614
    shl ebx,16
614
    shl ebx,16
615
    add ebx,100*65536+3
615
    add ebx,100*65536+3
616
    add ebx,tl_box_top
616
    add ebx,tl_box_top
617
    lea edx,[txt_capt_otm]
617
    lea edx,[txt_capt_otm]
618
    int 0x40
618
    int 0x40
619
    @@:
619
    @@:
620
 
620
 
621
    ;cycle to nodes
621
    ;cycle to nodes
622
    xor eax,eax
622
    xor eax,eax
623
    mov edx,tl_data_nodes
623
    mov edx,tl_data_nodes
624
    mov ecx,edx
624
    mov ecx,edx
625
    add ecx,sizeof.TreeList
625
    add ecx,sizeof.TreeList
626
 
626
 
627
    ;*** ïðîïóñê óçëîâ, êîòîðûå ïðîìîòàíû ñêðîëëèíãîì ***
627
    ;*** ïðîïóñê óçëîâ, êîòîðûå ïðîìîòàíû ñêðîëëèíãîì ***
628
    cmp tl_p_scrol,0 ;åñëè åñòü óêàçàòåëü íà ñêðîëëèíã
628
    cmp tl_p_scrol,0 ;åñëè åñòü óêàçàòåëü íà ñêðîëëèíã
629
    je .end_c1
629
    je .end_c1
630
    mov esi,tl_p_scrol
630
    mov esi,tl_p_scrol
631
    cmp dword[esi+24],0 ;åñëè ñêðîëëèíã íà âåðõó, âûõîäèì
631
    cmp dword[esi+24],0 ;åñëè ñêðîëëèíã íà âåðõó, âûõîäèì
632
    je .end_c1
632
    je .end_c1
633
      @@:
633
      @@:
634
	call tl_iterat_next
634
	call tl_iterat_next
635
	cmp edx,ecx
635
	cmp edx,ecx
636
	jle .end_draw
636
	jle .end_draw
637
	inc eax
637
	inc eax
638
	cmp eax,dword[esi+24]
638
	cmp eax,dword[esi+24]
639
	jge .end_c1
639
	jge .end_c1
640
	jmp @b
640
	jmp @b
641
    .end_c1:
641
    .end_c1:
642
 
642
 
643
    xor eax,eax
643
    xor eax,eax
644
    mov esi,tl_box_top
644
    mov esi,tl_box_top
645
    add esi,tl_box_height ;esi = coord bottom border
645
    add esi,tl_box_height ;esi = coord bottom border
646
    @@:
646
    @@:
647
      call tl_iterat_next
647
      call tl_iterat_next
648
      cmp edx,ecx
648
      cmp edx,ecx
649
      jle @f
649
      jle @f
650
      call tl_draw_node
650
      call tl_draw_node
651
      inc eax
651
      inc eax
652
      jmp @b
652
      jmp @b
653
    @@:
653
    @@:
654
 
654
 
655
    call tl_draw_cursor
655
    call tl_draw_cursor
656
    .end_draw:
656
    .end_draw:
657
    pop esi edi edx ecx ebx eax
657
    pop esi edi edx ecx ebx eax
658
  pop ebp
658
  pop ebp
659
  ret 4
659
  ret 4
660
 
660
 
661
;input:
661
;input:
662
; ecx = pointer to 1 node struct
662
; ecx = pointer to 1 node struct
663
; edx = pointer to some node struct
663
; edx = pointer to some node struct
664
; edi = pointer to 'TreeList' struct
664
; edi = pointer to 'TreeList' struct
665
;output:
665
;output:
666
; edx = pointer to next node struct
666
; edx = pointer to next node struct
667
align 4
667
align 4
668
tl_iterat_next:
668
tl_iterat_next:
669
  push bx
669
  push bx
670
  mov bl,0x7f
670
  mov bl,0x7f
671
  cmp byte[edx+3],1
671
  cmp byte[edx+3],1
672
  jne @f
672
  jne @f
673
    mov bl,byte[edx+2]
673
    mov bl,byte[edx+2]
674
  @@:
674
  @@:
675
 
675
 
676
  cmp tl_tim_undo,0
676
  cmp tl_tim_undo,0
677
  je .else
677
  je .else
678
 
678
 
679
  push eax
679
  push eax
680
  .beg0:
680
  .beg0:
681
    call tl_move_next
681
    call tl_move_next
682
    cmp edx,ecx
682
    cmp edx,ecx
683
    jle @f
683
    jle @f
684
    call tl_node_not_vis ;ïðîïóñê óäàëåííûõ è îòìåíåííûõ
684
    call tl_node_not_vis ;ïðîïóñê óäàëåííûõ è îòìåíåííûõ
685
    cmp al,1
685
    cmp al,1
686
    je .beg0
686
    je .beg0
687
    cmp bl,byte[edx+2] ;ïðîïóñê çàêðûòûõ
687
    cmp bl,byte[edx+2] ;ïðîïóñê çàêðûòûõ
688
    jl .beg0
688
    jl .beg0
689
  @@:
689
  @@:
690
  pop eax
690
  pop eax
691
  pop bx
691
  pop bx
692
  ret
692
  ret
693
 
693
 
694
  .else:
694
  .else:
695
    call tl_move_next
695
    call tl_move_next
696
    cmp edx,ecx
696
    cmp edx,ecx
697
    jle .endif
697
    jle .endif
698
    cmp dword[edx+16],0 ;td = 'time delete' -> ïðîïóñê óäàëåííûõ
698
    cmp dword[edx+16],0 ;td = 'time delete' -> ïðîïóñê óäàëåííûõ
699
    jne .else
699
    jne .else
700
    cmp bl,byte[edx+2] ;ïðîïóñê çàêðûòûõ
700
    cmp bl,byte[edx+2] ;ïðîïóñê çàêðûòûõ
701
    jl .else
701
    jl .else
702
  .endif:
702
  .endif:
703
  pop bx
703
  pop bx
704
  ret
704
  ret
705
 
705
 
706
;input:
706
;input:
707
; ecx = pointer to 1 node struct
707
; ecx = pointer to 1 node struct
708
; edx = pointer to some node struct
708
; edx = pointer to some node struct
709
; edi = pointer to 'TreeList' struct
709
; edi = pointer to 'TreeList' struct
710
align 4
710
align 4
711
tl_iterat_next_all:
711
tl_iterat_next_all:
712
  cmp tl_tim_undo,0
712
  cmp tl_tim_undo,0
713
  je .else
713
  je .else
714
 
714
 
715
  push eax
715
  push eax
716
  @@:
716
  @@:
717
    call tl_move_next
717
    call tl_move_next
718
    cmp edx,ecx
718
    cmp edx,ecx
719
    jle @f
719
    jle @f
720
    call tl_node_not_vis
720
    call tl_node_not_vis
721
    cmp al,1
721
    cmp al,1
722
    je @b
722
    je @b
723
  @@:
723
  @@:
724
  pop eax
724
  pop eax
725
  ret
725
  ret
726
  .else:
726
  .else:
727
    call tl_move_next
727
    call tl_move_next
728
    cmp edx,ecx
728
    cmp edx,ecx
729
    jle .endif
729
    jle .endif
730
    cmp dword[edx+16],0 ;td -> time delete
730
    cmp dword[edx+16],0 ;td -> time delete
731
    jne .else
731
    jne .else
732
  .endif:
732
  .endif:
733
  ret
733
  ret
734
 
734
 
735
;input:
735
;input:
736
; ecx = pointer to 1 node struct
736
; ecx = pointer to 1 node struct
737
; edx = pointer to some node struct
737
; edx = pointer to some node struct
738
; edi = pointer to 'TreeList' struct
738
; edi = pointer to 'TreeList' struct
739
align 4
739
align 4
740
tl_iterat_perv:
740
tl_iterat_perv:
741
  push eax
741
  push eax
742
 
742
 
743
;  mov bl,byte[edx+2]
743
;  mov bl,byte[edx+2]
744
 
744
 
745
  cmp tl_tim_undo,0
745
  cmp tl_tim_undo,0
746
  je .beg1
746
  je .beg1
747
 
747
 
748
  push eax
748
  push eax
749
  .beg0:
749
  .beg0:
750
    call tl_move_perv
750
    call tl_move_perv
751
    cmp edx,ecx
751
    cmp edx,ecx
752
    jle @f
752
    jle @f
753
    call tl_node_not_vis ;ïðîïóñê óäàëåííûõ è îòìåíåííûõ
753
    call tl_node_not_vis ;ïðîïóñê óäàëåííûõ è îòìåíåííûõ
754
    cmp al,1
754
    cmp al,1
755
    je .beg0
755
    je .beg0
756
 
756
 
757
  .beg1:
757
  .beg1:
758
    call tl_move_perv
758
    call tl_move_perv
759
    cmp edx,ecx
759
    cmp edx,ecx
760
    jle @f
760
    jle @f
761
    cmp dword[edx+16],0 ;td = 'time delete' -> ïðîïóñê óäàëåííûõ
761
    cmp dword[edx+16],0 ;td = 'time delete' -> ïðîïóñê óäàëåííûõ
762
    jne .beg1
762
    jne .beg1
763
 
763
 
764
  @@:
764
  @@:
765
    call tl_move_max_clo_par
765
    call tl_move_max_clo_par
766
  pop eax
766
  pop eax
767
  ret
767
  ret
768
 
768
 
769
 
769
 
770
;input:
770
;input:
771
; edx = pointer to some node struct
771
; edx = pointer to some node struct
772
; edi = pointer to 'TreeList' struct
772
; edi = pointer to 'TreeList' struct
773
;output:
773
;output:
774
; edx = pointer closed parent node with maximum level
774
; edx = pointer closed parent node with maximum level
775
align 4
775
align 4
776
tl_move_max_clo_par: ;íàõîäèò ðîäèòåëüñêèé çàêðûòûé óçåë ìàêñèìàëüíîãî óðîâíÿ
776
tl_move_max_clo_par: ;íàõîäèò ðîäèòåëüñêèé çàêðûòûé óçåë ìàêñèìàëüíîãî óðîâíÿ
777
  push eax ebx
777
  push eax ebx
778
  mov eax,edx
778
  mov eax,edx
779
  xor ebx,ebx
779
  xor ebx,ebx
780
  .beg:
780
  .beg:
781
    call tl_move_par
781
    call tl_move_par
782
    cmp byte[edx+3],1 ;ðîäèòåëüñêèé óçåë çàêðûò ?
782
    cmp byte[edx+3],1 ;ðîäèòåëüñêèé óçåë çàêðûò ?
783
    jne @f
783
    jne @f
784
      mov eax,edx
784
      mov eax,edx
785
    @@:
785
    @@:
786
    cmp ebx,edx
786
    cmp ebx,edx
787
    je .end_f
787
    je .end_f
788
      mov ebx,edx
788
      mov ebx,edx
789
    jmp .beg
789
    jmp .beg
790
  .end_f:
790
  .end_f:
791
  mov edx,eax
791
  mov edx,eax
792
  pop ebx eax
792
  pop ebx eax
793
  ret
793
  ret
794
 
794
 
795
;input:
795
;input:
796
; edx = pointer to some node struct
796
; edx = pointer to some node struct
797
; edi = pointer to 'TreeList' struct
797
; edi = pointer to 'TreeList' struct
798
;output:
798
;output:
799
; edx = pointer to next node struct
799
; edx = pointer to next node struct
800
align 4
800
align 4
801
tl_move_next:
801
tl_move_next:
802
  mov edx,dword[edx+8]
802
  mov edx,dword[edx+8]
803
  imul edx,sizeof.TreeList
803
  imul edx,sizeof.TreeList
804
  add edx,tl_data_nodes
804
  add edx,tl_data_nodes
805
  ret
805
  ret
806
 
806
 
807
;input:
807
;input:
808
; edx = pointer to some node struct
808
; edx = pointer to some node struct
809
; edi = pointer to 'TreeList' struct
809
; edi = pointer to 'TreeList' struct
810
;output:
810
;output:
811
; edx = pointer to perv node struct
811
; edx = pointer to perv node struct
812
align 4
812
align 4
813
tl_move_perv:
813
tl_move_perv:
814
  mov edx,dword[edx+4]
814
  mov edx,dword[edx+4]
815
  imul edx,sizeof.TreeList
815
  imul edx,sizeof.TreeList
816
  add edx,tl_data_nodes
816
  add edx,tl_data_nodes
817
  ret
817
  ret
818
 
818
 
819
;input:
819
;input:
820
; ecx =
820
; ecx =
821
; edx = pointer to some node struct
821
; edx = pointer to some node struct
822
; edi = pointer to 'TreeList' struct
822
; edi = pointer to 'TreeList' struct
823
;output:
823
;output:
824
; edx = pointer to parent node struct
824
; edx = pointer to parent node struct
825
align 4
825
align 4
826
tl_move_par: ;ïåðåäâèãàåìñÿ íà ðîäèòåëüñêèé óçåë, åñëè òàêîãî íåò, òî îñòàâëÿåì ñòàðîå çíà÷åíèå óêàçàòåëÿ
826
tl_move_par: ;ïåðåäâèãàåìñÿ íà ðîäèòåëüñêèé óçåë, åñëè òàêîãî íåò, òî îñòàâëÿåì ñòàðîå çíà÷åíèå óêàçàòåëÿ
827
 cmp byte[edx+2],0
827
 cmp byte[edx+2],0
828
 je .end_f ;óçåë 0-ãî óðîâíÿ íå ìîæåò áûòü äî÷åðíèì
828
 je .end_f ;óçåë 0-ãî óðîâíÿ íå ìîæåò áûòü äî÷åðíèì
829
 push eax ebx esi
829
 push eax ebx esi
830
 mov esi,edx ;copy node pointer (edx)
830
 mov esi,edx ;copy node pointer (edx)
831
 mov bl,byte[edx+2]
831
 mov bl,byte[edx+2]
832
 @@:
832
 @@:
833
   call tl_move_perv
833
   call tl_move_perv
834
   cmp edx,ecx
834
   cmp edx,ecx
835
   jle @f ;âñå âûøå ñòîÿùèå óçëû íå ðîäèòåëüñêèå
835
   jle @f ;âñå âûøå ñòîÿùèå óçëû íå ðîäèòåëüñêèå
836
   call tl_node_not_vis ;ïðîïóñê óäàëåííûõ è îòìåíåííûõ
836
   call tl_node_not_vis ;ïðîïóñê óäàëåííûõ è îòìåíåííûõ
837
   cmp al,1
837
   cmp al,1
838
   je @b
838
   je @b
839
   cmp byte[edx+2],bl
839
   cmp byte[edx+2],bl
840
   jl .end_0 ;óäà÷íî íàøëè ðîäèòåëüñêèé óçåë
840
   jl .end_0 ;óäà÷íî íàøëè ðîäèòåëüñêèé óçåë
841
   jmp @b
841
   jmp @b
842
 @@:
842
 @@:
843
   mov esi,ebx ;restore node pointer
843
   mov esi,ebx ;restore node pointer
844
 .end_0:
844
 .end_0:
845
 pop esi ebx eax
845
 pop esi ebx eax
846
 .end_f:
846
 .end_f:
847
 ret
847
 ret
848
 
848
 
849
;input:
849
;input:
850
; edx = pointer to symbol struct
850
; edx = pointer to symbol struct
851
; edi = pointer to 'TreeList' struct
851
; edi = pointer to 'TreeList' struct
852
;output:
852
;output:
853
; al = 1 if sumbol not visible
853
; al = 1 if sumbol not visible
854
; (node[i].td+tim_Undo<=ch_tim && node[i].td) || (node[i].tc>ch_tim-tim_Undo)
854
; (node[i].td+tim_Undo<=ch_tim && node[i].td) || (node[i].tc>ch_tim-tim_Undo)
855
align 4
855
align 4
856
tl_node_not_vis:
856
tl_node_not_vis:
857
  cmp dword[edx+16],0
857
  cmp dword[edx+16],0
858
  je @f
858
  je @f
859
  mov eax,dword[edx+16] ;eax=node[i].td
859
  mov eax,dword[edx+16] ;eax=node[i].td
860
  add eax,tl_tim_undo
860
  add eax,tl_tim_undo
861
  cmp eax,tl_ch_tim
861
  cmp eax,tl_ch_tim
862
  jg @f
862
  jg @f
863
    mov al,1
863
    mov al,1
864
    ret
864
    ret
865
  @@:
865
  @@:
866
 
866
 
867
  mov eax,tl_ch_tim
867
  mov eax,tl_ch_tim
868
  sub eax,tl_tim_undo
868
  sub eax,tl_tim_undo
869
  cmp dword[edx+12],eax ;tc -> time create
869
  cmp dword[edx+12],eax ;tc -> time create
870
  jle @f
870
  jle @f
871
    mov al,1
871
    mov al,1
872
    ret
872
    ret
873
  @@:
873
  @@:
874
  xor al,al
874
  xor al,al
875
  ret
875
  ret
876
 
876
 
877
 
877
 
878
;input:
878
;input:
879
; edi = pointer to TreeInfo struct
879
; edi = pointer to TreeInfo struct
880
; esi = coord bottom border
880
; esi = coord bottom border
881
align 4
881
align 4
882
tl_draw_cursor: ;ðèñóåì êóðñîð íà ýêðàíå
882
tl_draw_cursor: ;ðèñóåì êóðñîð íà ýêðàíå
883
  push eax ebx ecx edx esi
883
  push eax ebx ecx edx esi
884
    call tl_get_display_cur_pos ;eax = cursor pos in screen
884
    call tl_get_display_cur_pos ;eax = cursor pos in screen
885
    cmp eax,0
885
    cmp eax,0
886
    jl .end_f ;êóðñîð íàõîäèòñÿ âûøå îêíà, â îáëàñòè ïðîêðó÷åííîé ñêðîëëèíãîì
886
    jl .end_f ;êóðñîð íàõîäèòñÿ âûøå îêíà, â îáëàñòè ïðîêðó÷åííîé ñêðîëëèíãîì
887
 
887
 
888
    cmp tl_data_img_sys,0 ;ñìîòðèì åñòü ëè óêàçàòåëü íà êàðòèíêó ñèñòåìíûõ èêîíîê
888
    cmp tl_data_img_sys,0 ;ñìîòðèì åñòü ëè óêàçàòåëü íà êàðòèíêó ñèñòåìíûõ èêîíîê
889
    jne @f
889
    jne @f
890
      mov ebx,tl_box_left
890
      mov ebx,tl_box_left
891
      shl ebx,16
891
      shl ebx,16
892
      mov bx,tl_img_cx
892
      mov bx,tl_img_cx
893
      xor ecx,ecx
893
      xor ecx,ecx
894
      mov cx,tl_img_cy
894
      mov cx,tl_img_cy
895
      imul ecx,eax
895
      imul ecx,eax
896
      add ecx,tl_box_top
896
      add ecx,tl_box_top
897
      add cx,tl_capt_cy
897
      add cx,tl_capt_cy
898
 
898
 
899
      ;crop image if on the border
899
      ;crop image if on the border
900
      cmp esi,ecx ;åñëè êóðñîð âíèçó è åãî âîîáùå íå âèäíî
900
      cmp esi,ecx ;åñëè êóðñîð âíèçó è åãî âîîáùå íå âèäíî
901
      jl .end_f
901
      jl .end_f
902
 
902
 
903
      sub esi,ecx
903
      sub esi,ecx
904
      shl ecx,16
904
      shl ecx,16
905
      mov cx,tl_img_cy
905
      mov cx,tl_img_cy
906
      cmp si,tl_img_cy
906
      cmp si,tl_img_cy
907
      jge .crop0
907
      jge .crop0
908
        mov cx,si ;åñëè êóðñîð âèäåí ÷àñòè÷íî (ïîïàë íà íèæíþþ ãðàíèöó)
908
        mov cx,si ;åñëè êóðñîð âèäåí ÷àñòè÷íî (ïîïàë íà íèæíþþ ãðàíèöó)
909
      .crop0:
909
      .crop0:
910
 
910
 
911
      mov edx,tl_col_txt
911
      mov edx,tl_col_txt
912
      mov eax,13
912
      mov eax,13
913
      int 0x40 ;ðèñóåì ïðîñòîé ïðÿìîóãîëüíèê, ò.ê. íåò ñèñòåìíûõ èêîíîê
913
      int 0x40 ;ðèñóåì ïðîñòîé ïðÿìîóãîëüíèê, ò.ê. íåò ñèñòåìíûõ èêîíîê
914
      jmp .end_f
914
      jmp .end_f
915
    @@:
915
    @@:
916
      mov ebx,tl_data_img_sys
916
      mov ebx,tl_data_img_sys
917
      imul ax,tl_img_cy
917
      imul ax,tl_img_cy
918
      mov edx,tl_box_left
918
      mov edx,tl_box_left
919
      shl edx,16
919
      shl edx,16
920
      mov dx,ax
920
      mov dx,ax
921
      add edx,tl_box_top
921
      add edx,tl_box_top
922
      add dx,tl_capt_cy
922
      add dx,tl_capt_cy
923
 
923
 
924
      mov ecx,tl_el_focus ;ïðîâåðÿåì â ôîêóñå ýëåìåíò èëè íåò
924
      mov ecx,tl_el_focus ;ïðîâåðÿåì â ôîêóñå ýëåìåíò èëè íåò
925
      cmp dword[ecx],edi
925
      cmp dword[ecx],edi
926
      je .focus
926
      je .focus
927
        xor eax,eax
927
        xor eax,eax
928
        xor ecx,ecx
928
        xor ecx,ecx
929
        mov cx,tl_img_cx
929
        mov cx,tl_img_cx
930
        mov ax,tl_img_cy
930
        mov ax,tl_img_cy
931
        imul eax,ecx
931
        imul eax,ecx
932
        imul eax,4*3 ;4=icon index 3=rgb
932
        imul eax,4*3 ;4=icon index 3=rgb
933
        add ebx,eax
933
        add ebx,eax
934
      .focus:
934
      .focus:
935
 
935
 
936
      mov cx,tl_img_cx
936
      mov cx,tl_img_cx
937
      shl ecx,16
937
      shl ecx,16
938
      mov cx,tl_img_cy
938
      mov cx,tl_img_cy
939
 
939
 
940
      ;crop image if on the border
940
      ;crop image if on the border
941
      cmp si,dx ;åñëè êóðñîð âíèçó è åãî âîîáùå íå âèäíî
941
      cmp si,dx ;åñëè êóðñîð âíèçó è åãî âîîáùå íå âèäíî
942
      jl .end_f
942
      jl .end_f
943
 
943
 
944
      sub si,dx
944
      sub si,dx
945
      cmp si,tl_img_cy
945
      cmp si,tl_img_cy
946
      jge .crop1
946
      jge .crop1
947
	mov cx,si ;åñëè êóðñîð âèäåí ÷àñòè÷íî (ïîïàë íà íèæíþþ ãðàíèöó)
947
	mov cx,si ;åñëè êóðñîð âèäåí ÷àñòè÷íî (ïîïàë íà íèæíþþ ãðàíèöó)
948
      .crop1:
948
      .crop1:
949
 
949
 
950
      mov eax,7
950
      mov eax,7
951
      int 0x40 ;ðèñóåì èêîíêó êóðñîðà
951
      int 0x40 ;ðèñóåì èêîíêó êóðñîðà
952
    .end_f:
952
    .end_f:
953
  pop esi edx ecx ebx eax
953
  pop esi edx ecx ebx eax
954
  ret
954
  ret
955
 
955
 
956
;input:
956
;input:
957
; edi = pointer to TreeInfo struct
957
; edi = pointer to TreeInfo struct
958
; esi = coord bottom border
958
; esi = coord bottom border
959
align 4
959
align 4
960
tl_draw_null_cursor: ;ñòèðàåì êóðñîð íà ýêðàíå
960
tl_draw_null_cursor: ;ñòèðàåì êóðñîð íà ýêðàíå
961
  push eax ebx ecx edx esi
961
  push eax ebx ecx edx esi
962
    call tl_get_display_cur_pos ;eax = cursor pos in screen
962
    call tl_get_display_cur_pos ;eax = cursor pos in screen
963
    cmp eax,0
963
    cmp eax,0
964
    jl .end_f ;êóðñîð íàõîäèòñÿ âûøå îêíà, â îáëàñòè ïðîêðó÷åííîé ñêðîëëèíãîì
964
    jl .end_f ;êóðñîð íàõîäèòñÿ âûøå îêíà, â îáëàñòè ïðîêðó÷åííîé ñêðîëëèíãîì
965
 
965
 
966
    mov ebx,tl_box_left
966
    mov ebx,tl_box_left
967
    shl ebx,16
967
    shl ebx,16
968
    mov bx,tl_img_cx
968
    mov bx,tl_img_cx
969
    xor ecx,ecx
969
    xor ecx,ecx
970
    mov cx,tl_img_cy
970
    mov cx,tl_img_cy
971
    imul ecx,eax
971
    imul ecx,eax
972
    add ecx,tl_box_top
972
    add ecx,tl_box_top
973
    add cx,tl_capt_cy
973
    add cx,tl_capt_cy
974
 
974
 
975
    ;crop image if on the border
975
    ;crop image if on the border
976
    cmp esi,ecx ;åñëè êóðñîð âíèçó è åãî âîîáùå íå âèäíî
976
    cmp esi,ecx ;åñëè êóðñîð âíèçó è åãî âîîáùå íå âèäíî
977
    jl .end_f
977
    jl .end_f
978
 
978
 
979
    sub esi,ecx
979
    sub esi,ecx
980
    shl ecx,16
980
    shl ecx,16
981
    mov cx,tl_img_cy
981
    mov cx,tl_img_cy
982
    cmp si,tl_img_cy
982
    cmp si,tl_img_cy
983
    jge @f
983
    jge @f
984
      mov cx,si ;åñëè êóðñîð âèäåí ÷àñòè÷íî (ïîïàë íà íèæíþþ ãðàíèöó)
984
      mov cx,si ;åñëè êóðñîð âèäåí ÷àñòè÷íî (ïîïàë íà íèæíþþ ãðàíèöó)
985
    @@:
985
    @@:
986
 
986
 
987
    mov edx,tl_col_bkg
987
    mov edx,tl_col_bkg
988
    mov eax,13
988
    mov eax,13
989
    int 0x40 ;ðèñóåì ïðîñòîé ïðÿìîóãîëüíèê ñ ôîíîâûì öâåòîì
989
    int 0x40 ;ðèñóåì ïðîñòîé ïðÿìîóãîëüíèê ñ ôîíîâûì öâåòîì
990
 
990
 
991
    .end_f:
991
    .end_f:
992
  pop esi edx ecx ebx eax
992
  pop esi edx ecx ebx eax
993
  ret
993
  ret
994
 
994
 
995
;input:
995
;input:
996
; edi = pointer to TreeInfo struct
996
; edi = pointer to TreeInfo struct
997
;output:
997
;output:
998
; eax = index
998
; eax = index
999
align 4
999
align 4
1000
tl_get_display_cur_pos: ;áåðåò ïîçèöèþ êóðñîðà, îòíîñèòåëüíî ýêðàíà
1000
tl_get_display_cur_pos: ;áåðåò ïîçèöèþ êóðñîðà, îòíîñèòåëüíî ýêðàíà
1001
   mov eax,tl_cur_pos
1001
   mov eax,tl_cur_pos
1002
   cmp tl_p_scrol,0
1002
   cmp tl_p_scrol,0
1003
   je @f
1003
   je @f
1004
     push ebx
1004
     push ebx
1005
       mov ebx,tl_p_scrol
1005
       mov ebx,tl_p_scrol
1006
       mov ebx,dword[ebx+24]
1006
       mov ebx,dword[ebx+24]
1007
       sub eax,ebx ;îòíèìàåì ïîçèöèþ ñêðîëëèíãà
1007
       sub eax,ebx ;îòíèìàåì ïîçèöèþ ñêðîëëèíãà
1008
     pop ebx
1008
     pop ebx
1009
  @@:
1009
  @@:
1010
  ret
1010
  ret
1011
 
1011
 
1012
;input:
1012
;input:
1013
; eax = node position
1013
; eax = node position
1014
; edx = pointer to some node struct
1014
; edx = pointer to some node struct
1015
; edi = pointer to TreeInfo struct
1015
; edi = pointer to TreeInfo struct
1016
; esi = coord of bottom border
1016
; esi = coord of bottom border
1017
align 4
1017
align 4
1018
tl_draw_node:
1018
tl_draw_node:
1019
  push eax ebx ecx edx esi
1019
  push eax ebx ecx edx esi
1020
 
1020
 
1021
    mov ebx,1 ;1 - ìåñòî ïîä êóðñîð è ïîä çíàê +,-
1021
    mov ebx,1 ;1 - ìåñòî ïîä êóðñîð è ïîä çíàê +,-
1022
    bt tl_style,2 ;tl_list_box_mode
1022
    bt tl_style,2 ;tl_list_box_mode
1023
    jc @f
1023
    jc @f
1024
      inc ebx ;+1 - ìåñòî ïîä çíàê +,-
1024
      inc ebx ;+1 - ìåñòî ïîä çíàê +,-
1025
    @@:
1025
    @@:
1026
    add bl,byte[edx+2];get level
1026
    add bl,byte[edx+2];get level
1027
    imul bx,tl_img_cx
1027
    imul bx,tl_img_cx
1028
    add ebx,tl_box_left
1028
    add ebx,tl_box_left
1029
 
1029
 
1030
    shl ebx,16
1030
    shl ebx,16
1031
    mov bx,tl_img_cx
1031
    mov bx,tl_img_cx
1032
    xor ecx,ecx
1032
    xor ecx,ecx
1033
    mov cx,tl_img_cy
1033
    mov cx,tl_img_cy
1034
    imul ecx,eax
1034
    imul ecx,eax
1035
    add ecx,tl_box_top
1035
    add ecx,tl_box_top
1036
    add cx,tl_capt_cy
1036
    add cx,tl_capt_cy
1037
 
1037
 
1038
    ;crop image if on the border
1038
    ;crop image if on the border
1039
    cmp esi,ecx ;åñëè óçåë âíèçó è åãî âîîáùå íå âèäíî
1039
    cmp esi,ecx ;åñëè óçåë âíèçó è åãî âîîáùå íå âèäíî
1040
    jl .end_draw
1040
    jl .end_draw
1041
 
1041
 
1042
    sub esi,ecx
1042
    sub esi,ecx
1043
    shl ecx,16
1043
    shl ecx,16
1044
    mov cx,tl_img_cy
1044
    mov cx,tl_img_cy
1045
    cmp si,tl_img_cy
1045
    cmp si,tl_img_cy
1046
    jge @f
1046
    jge @f
1047
      mov cx,si ;åñëè óçåë âèäåí ÷àñòè÷íî (ïîïàë íà íèæíþþ ãðàíèöó)
1047
      mov cx,si ;åñëè óçåë âèäåí ÷àñòè÷íî (ïîïàë íà íèæíþþ ãðàíèöó)
1048
      jmp .crop ;ïðîïóñêàåì ðèñîâàíèå íàäïèñè, êîòîðàÿ ñêîðåå âñåãî òîæå âûëåçåò çà íèæíþþ ãðàíèöó
1048
      jmp .crop ;ïðîïóñêàåì ðèñîâàíèå íàäïèñè, êîòîðàÿ ñêîðåå âñåãî òîæå âûëåçåò çà íèæíþþ ãðàíèöó
1049
    @@:
1049
    @@:
1050
      call tl_draw_node_caption
1050
      call tl_draw_node_caption
1051
    .crop:
1051
    .crop:
1052
    mov esi,ecx ;save ecx
1052
    mov esi,ecx ;save ecx
1053
 
1053
 
1054
    cmp dword[edi+18],0 ;data_img
1054
    cmp dword[edi+18],0 ;data_img
1055
    jne .draw_img_n
1055
    jne .draw_img_n
1056
    push edx
1056
    push edx
1057
      mov edx,tl_col_txt
1057
      mov edx,tl_col_txt
1058
      mov eax,13
1058
      mov eax,13
1059
      int 0x40 ;draw node rect
1059
      int 0x40 ;draw node rect
1060
    pop edx
1060
    pop edx
1061
    jmp @f
1061
    jmp @f
1062
    .draw_img_n:
1062
    .draw_img_n:
1063
    push ebx edx esi
1063
    push ebx edx esi
1064
      xor esi,esi
1064
      xor esi,esi
1065
      mov si,word[edx] ;get icon type
1065
      mov si,word[edx] ;get icon type
1066
      mov edx,ebx
1066
      mov edx,ebx
1067
      ror ecx,16
1067
      ror ecx,16
1068
      mov dx,cx
1068
      mov dx,cx
1069
      mov cx,bx
1069
      mov cx,bx
1070
      ror ecx,16
1070
      ror ecx,16
1071
      mov ebx,3 ;rgb = 3 bytes
1071
      mov ebx,3 ;rgb = 3 bytes
1072
      imul bx,tl_img_cx
1072
      imul bx,tl_img_cx
1073
      imul bx,tl_img_cy
1073
      imul bx,tl_img_cy
1074
      imul ebx,esi ;esi = icon index
1074
      imul ebx,esi ;esi = icon index
1075
      add ebx,dword[edi+18] ;data_img
1075
      add ebx,dword[edi+18] ;data_img
1076
 
1076
 
1077
      mov eax,7
1077
      mov eax,7
1078
      int 0x40 ;draw node icon '-'
1078
      int 0x40 ;draw node icon '-'
1079
    pop esi edx ebx
1079
    pop esi edx ebx
1080
    @@:
1080
    @@:
1081
 
1081
 
1082
    mov al,byte[edx+2] ;draw minus '-'
1082
    mov al,byte[edx+2] ;draw minus '-'
1083
    mov ecx,tl_data_nodes
1083
    mov ecx,tl_data_nodes
1084
    add ecx,sizeof.TreeList
1084
    add ecx,sizeof.TreeList
1085
 
1085
 
1086
    mov ah,10 ;get icon index '+' or '-' ?
1086
    mov ah,10 ;get icon index '+' or '-' ?
1087
    cmp byte[edx+3],1
1087
    cmp byte[edx+3],1
1088
    jne .close
1088
    jne .close
1089
      dec ah
1089
      dec ah
1090
    .close:
1090
    .close:
1091
 
1091
 
1092
    call tl_draw_node_icon_opn_clo
1092
    call tl_draw_node_icon_opn_clo
1093
    bt tl_style,1
1093
    bt tl_style,1
1094
    jae .end_draw
1094
    jae .end_draw
1095
      call tl_draw_node_icon_par_lin
1095
      call tl_draw_node_icon_par_lin
1096
      call tl_draw_node_icon_par_lin_up
1096
      call tl_draw_node_icon_par_lin_up
1097
    .end_draw:
1097
    .end_draw:
1098
  pop esi edx ecx ebx eax
1098
  pop esi edx ecx ebx eax
1099
  ret
1099
  ret
1100
 
1100
 
1101
;input:
1101
;input:
1102
; ecx = pointer to 1 node struct
1102
; ecx = pointer to 1 node struct
1103
;...
1103
;...
1104
align 4
1104
align 4
1105
tl_draw_node_icon_opn_clo: ;ðèñóåò èêîíêè îòêðûòîãî èëè çàêðûòîãî óçëà (îáû÷íî + èëè -)
1105
tl_draw_node_icon_opn_clo: ;ðèñóåò èêîíêè îòêðûòîãî èëè çàêðûòîãî óçëà (îáû÷íî + èëè -)
1106
  push eax ebx ecx edx esi
1106
  push eax ebx ecx edx esi
1107
    inc al
1107
    inc al
1108
    call tl_iterat_next_all ;get next visible item
1108
    call tl_iterat_next_all ;get next visible item
1109
    cmp edx,ecx
1109
    cmp edx,ecx
1110
    jle @f
1110
    jle @f
1111
      mov ecx,esi ;load ecx
1111
      mov ecx,esi ;load ecx
1112
      cmp al,byte[edx+2]
1112
      cmp al,byte[edx+2]
1113
      jne @f
1113
      jne @f
1114
      ror ebx,16
1114
      ror ebx,16
1115
      sub bx,tl_img_cx
1115
      sub bx,tl_img_cx
1116
      ror ebx,16
1116
      ror ebx,16
1117
      cmp tl_data_img_sys,0
1117
      cmp tl_data_img_sys,0
1118
      jne .draw_img_s
1118
      jne .draw_img_s
1119
	mov edx,tl_col_txt
1119
	mov edx,tl_col_txt
1120
	mov eax,13
1120
	mov eax,13
1121
	int 0x40 ;draw minus rect, if not system icons
1121
	int 0x40 ;draw minus rect, if not system icons
1122
	jmp @f
1122
	jmp @f
1123
      .draw_img_s:
1123
      .draw_img_s:
1124
      mov ecx,esi ;load ecx
1124
      mov ecx,esi ;load ecx
1125
      mov edx,ebx
1125
      mov edx,ebx
1126
      ror ecx,16
1126
      ror ecx,16
1127
      mov dx,cx
1127
      mov dx,cx
1128
      mov cx,bx
1128
      mov cx,bx
1129
      ror ecx,16
1129
      ror ecx,16
1130
      mov ebx,3 ;rgb = 3 bytes
1130
      mov ebx,3 ;rgb = 3 bytes
1131
      imul bx,tl_img_cx
1131
      imul bx,tl_img_cx
1132
      imul bx,tl_img_cy
1132
      imul bx,tl_img_cy
1133
      shr eax,8
1133
      shr eax,8
1134
      and eax,0xff
1134
      and eax,0xff
1135
      imul ebx,eax ;eax = icon index
1135
      imul ebx,eax ;eax = icon index
1136
      add ebx,tl_data_img_sys
1136
      add ebx,tl_data_img_sys
1137
      mov eax,7
1137
      mov eax,7
1138
      int 0x40 ;draw minus icon '-'
1138
      int 0x40 ;draw minus icon '-'
1139
    @@:
1139
    @@:
1140
  pop esi edx ecx ebx eax
1140
  pop esi edx ecx ebx eax
1141
  ret
1141
  ret
1142
 
1142
 
1143
;input:
1143
;input:
1144
; al = óðîâåíü ýëåìåíòà
1144
; al = óðîâåíü ýëåìåíòà
1145
;...
1145
;...
1146
align 4
1146
align 4
1147
tl_draw_node_icon_par_lin:
1147
tl_draw_node_icon_par_lin:
1148
  cmp byte[edx+3],1
1148
  cmp byte[edx+3],1
1149
  je .close
1149
  je .close
1150
  push eax ebx ecx edx esi
1150
  push eax ebx ecx edx esi
1151
    cmp al,0
1151
    cmp al,0
1152
    je @f
1152
    je @f
1153
;    dec al
1153
;    dec al
1154
;    call tl_iterat_perv ;get perv visible item
1154
;    call tl_iterat_perv ;get perv visible item
1155
 
1155
 
1156
    call tl_iterat_next_all ;get next visible item
1156
    call tl_iterat_next_all ;get next visible item
1157
    cmp edx,ecx
1157
    cmp edx,ecx
1158
    jle .line3 ;if end of list
1158
    jle .line3 ;if end of list
1159
      cmp al,byte[edx+2]
1159
      cmp al,byte[edx+2]
1160
      jne .line3 ;jg ???
1160
      jne .line3 ;jg ???
1161
      mov eax,3 ;line in middle element
1161
      mov eax,3 ;line in middle element
1162
      jmp .line2
1162
      jmp .line2
1163
    .line3:
1163
    .line3:
1164
      mov eax,6 ;line in end element
1164
      mov eax,6 ;line in end element
1165
    .line2:
1165
    .line2:
1166
 
1166
 
1167
      mov ecx,esi ;load ecx
1167
      mov ecx,esi ;load ecx
1168
      ror ebx,16
1168
      ror ebx,16
1169
      sub bx,tl_img_cx
1169
      sub bx,tl_img_cx
1170
      ror ebx,16
1170
      ror ebx,16
1171
      cmp tl_data_img_sys,0
1171
      cmp tl_data_img_sys,0
1172
      jne .draw_img_s
1172
      jne .draw_img_s
1173
	mov edx,tl_col_txt
1173
	mov edx,tl_col_txt
1174
	mov eax,13
1174
	mov eax,13
1175
	int 0x40 ;draw minus rect, if not system icons
1175
	int 0x40 ;draw minus rect, if not system icons
1176
	jmp @f
1176
	jmp @f
1177
      .draw_img_s:
1177
      .draw_img_s:
1178
;      mov ecx,esi ;load ecx
1178
;      mov ecx,esi ;load ecx
1179
      mov edx,ebx
1179
      mov edx,ebx
1180
      ror ecx,16
1180
      ror ecx,16
1181
      mov dx,cx
1181
      mov dx,cx
1182
      mov cx,bx
1182
      mov cx,bx
1183
      ror ecx,16
1183
      ror ecx,16
1184
      mov ebx,3 ;rgb = 3 bytes
1184
      mov ebx,3 ;rgb = 3 bytes
1185
      imul bx,tl_img_cx
1185
      imul bx,tl_img_cx
1186
      imul bx,tl_img_cy
1186
      imul bx,tl_img_cy
1187
 
1187
 
1188
;      shr eax,8
1188
;      shr eax,8
1189
;      and eax,0xff
1189
;      and eax,0xff
1190
      imul ebx,eax ;eax = icon index
1190
      imul ebx,eax ;eax = icon index
1191
      add ebx,tl_data_img_sys
1191
      add ebx,tl_data_img_sys
1192
      mov eax,7
1192
      mov eax,7
1193
      int 0x40 ;draw line icon
1193
      int 0x40 ;draw line icon
1194
    @@:
1194
    @@:
1195
  pop esi edx ecx ebx eax
1195
  pop esi edx ecx ebx eax
1196
  .close:
1196
  .close:
1197
  ret
1197
  ret
1198
 
1198
 
1199
 
1199
 
1200
 
1200
 
1201
;icon:
1201
;icon:
1202
; al = óðîâåíü ýëåìåíòà
1202
; al = óðîâåíü ýëåìåíòà
1203
;...
1203
;...
1204
align 4
1204
align 4
1205
tl_draw_node_icon_par_lin_up:
1205
tl_draw_node_icon_par_lin_up:
1206
  push eax ebx ecx edx esi
1206
  push eax ebx ecx edx esi
1207
    cmp tl_data_img_sys,0 ;if not image
1207
    cmp tl_data_img_sys,0 ;if not image
1208
    je @f
1208
    je @f
1209
    cmp al,0
1209
    cmp al,0
1210
    je @f
1210
    je @f
1211
 
1211
 
1212
;---------
1212
;---------
1213
    xor esi,esi ;â si áóäåì íàñ÷èòûâàòü êîë-âî èêîíîê, íóæíûõ äëÿ ïðîðèñîâêè ëèíèè
1213
    xor esi,esi ;â si áóäåì íàñ÷èòûâàòü êîë-âî èêîíîê, íóæíûõ äëÿ ïðîðèñîâêè ëèíèè
1214
    .cycle0:
1214
    .cycle0:
1215
      call tl_iterat_perv ;get perv visible item
1215
      call tl_iterat_perv ;get perv visible item
1216
      cmp edx,ecx
1216
      cmp edx,ecx
1217
      jle .cycle1 ;if begin of list
1217
      jle .cycle1 ;if begin of list
1218
 
1218
 
1219
      cmp byte[edx+2],al
1219
      cmp byte[edx+2],al
1220
      jle .cycle1 ;óðîâåíü âåðõíåãî ýëåìåíòà íå òðåáóåò ïðîðèñîâêè
1220
      jle .cycle1 ;óðîâåíü âåðõíåãî ýëåìåíòà íå òðåáóåò ïðîðèñîâêè
1221
      inc si
1221
      inc si
1222
      jmp .cycle0
1222
      jmp .cycle0
1223
    .cycle1:
1223
    .cycle1:
1224
      cmp si,0 ;si = êîë-âî èêîíîê ëèíèè êîòîðûå íóæíî íàðèñîâàòü ñâåðõó
1224
      cmp si,0 ;si = êîë-âî èêîíîê ëèíèè êîòîðûå íóæíî íàðèñîâàòü ñâåðõó
1225
      je @f
1225
      je @f
1226
      shl esi,16
1226
      shl esi,16
1227
 
1227
 
1228
      pop ecx ;esi->ecx
1228
      pop ecx ;esi->ecx
1229
      push ecx ;save esi
1229
      push ecx ;save esi
1230
 
1230
 
1231
      ror ebx,16
1231
      ror ebx,16
1232
      sub bx,tl_img_cx
1232
      sub bx,tl_img_cx
1233
      ror ebx,16
1233
      ror ebx,16
1234
 
1234
 
1235
      mov edx,ebx
1235
      mov edx,ebx
1236
      ror ecx,16
1236
      ror ecx,16
1237
      mov dx,cx
1237
      mov dx,cx
1238
      mov cx,bx
1238
      mov cx,bx
1239
      ror ecx,16
1239
      ror ecx,16
1240
      mov cx,tl_img_cy ;restore size y (if crop)
1240
      mov cx,tl_img_cy ;restore size y (if crop)
1241
      mov ebx,3 ;rgb = 3 bytes
1241
      mov ebx,3 ;rgb = 3 bytes
1242
      imul bx,tl_img_cx
1242
      imul bx,tl_img_cx
1243
      imul bx,tl_img_cy
1243
      imul bx,tl_img_cy
1244
      ;imul ebx,1
1244
      ;imul ebx,1
1245
      add ebx,tl_data_img_sys
1245
      add ebx,tl_data_img_sys
1246
 
1246
 
1247
      add esi,tl_box_top
1247
      add esi,tl_box_top
1248
      add si,tl_capt_cy ;si = âåðõíÿÿ ãðàíèöà îêíà
1248
      add si,tl_capt_cy ;si = âåðõíÿÿ ãðàíèöà îêíà
1249
      mov eax,7
1249
      mov eax,7
1250
;---------
1250
;---------
1251
      .cycle2:
1251
      .cycle2:
1252
      sub dx,tl_img_cy ;ïîäíèìàåì êîîðäèíàòó y ââåðõ
1252
      sub dx,tl_img_cy ;ïîäíèìàåì êîîðäèíàòó y ââåðõ
1253
      cmp dx,si
1253
      cmp dx,si
1254
      jl @f
1254
      jl @f
1255
;        int 0x40 ;draw line icon
1255
;        int 0x40 ;draw line icon
1256
        cmp esi,0x10000
1256
        cmp esi,0x10000
1257
        jl @f
1257
        jl @f
1258
        int 0x40 ;draw line icon
1258
        int 0x40 ;draw line icon
1259
        sub esi,0x10000 ;óìåíüøàåì ñ÷åò÷èê èêîíîê
1259
        sub esi,0x10000 ;óìåíüøàåì ñ÷åò÷èê èêîíîê
1260
      jmp .cycle2
1260
      jmp .cycle2
1261
    @@:
1261
    @@:
1262
  pop esi edx ecx ebx eax
1262
  pop esi edx ecx ebx eax
1263
  ret
1263
  ret
1264
 
1264
 
1265
;input:
1265
;input:
1266
; edi = pointer to TreeInfo struct
1266
; edi = pointer to TreeInfo struct
1267
;output:
1267
;output:
1268
; eax = rows
1268
; eax = rows
1269
align 4
1269
align 4
1270
tl_get_rows_count:
1270
tl_get_rows_count:
1271
  push ecx edx
1271
  push ecx edx
1272
    mov eax,tl_box_height
1272
    mov eax,tl_box_height
1273
    sub ax,tl_capt_cy
1273
    sub ax,tl_capt_cy
1274
    xor ecx,ecx
1274
    xor ecx,ecx
1275
    mov cx,tl_img_cy
1275
    mov cx,tl_img_cy
1276
    xor edx,edx
1276
    xor edx,edx
1277
    div ecx
1277
    div ecx
1278
  pop edx ecx
1278
  pop edx ecx
1279
  ret
1279
  ret
1280
 
1280
 
1281
;input:
1281
;input:
1282
; eax = node position
1282
; eax = node position
1283
; ebx = [êîîðäèíàòà ïî îñè x]*65536 + [img_cx]
1283
; ebx = [êîîðäèíàòà ïî îñè x]*65536 + [img_cx]
1284
; ecx = [êîîðäèíàòà ïî îñè y]*65536 + [img_cy]
1284
; ecx = [êîîðäèíàòà ïî îñè y]*65536 + [img_cy]
1285
; edx = pointer to some node struct
1285
; edx = pointer to some node struct
1286
; edi = pointer to TreeInfo struct
1286
; edi = pointer to TreeInfo struct
1287
align 4
1287
align 4
1288
tl_draw_node_caption:
1288
tl_draw_node_caption:
1289
    push ebx ecx edx esi
1289
    push ebx ecx edx esi
1290
 
1290
 
1291
    xor esi,esi
1291
    xor esi,esi
1292
    mov si,tl_info_size
1292
    mov si,tl_info_size
1293
    cmp si,tl_info_capt_offs
1293
    cmp si,tl_info_capt_offs
1294
    jle @f ;if caption size <= 0
1294
    jle @f ;if caption size <= 0
1295
 
1295
 
1296
    push eax
1296
    push eax
1297
      call tl_get_node_index ;eax = node index
1297
      call tl_get_node_index ;eax = node index
1298
      imul esi,eax
1298
      imul esi,eax
1299
    pop eax
1299
    pop eax
1300
      add si,tl_info_capt_offs
1300
      add si,tl_info_capt_offs
1301
      add esi,dword[edi]
1301
      add esi,dword[edi]
1302
      mov edx,esi
1302
      mov edx,esi
1303
 
1303
 
1304
      shr ebx,16
1304
      shr ebx,16
1305
      add bx,tl_img_cx ;ñäâèãàåì íàäïèñü ïî ãîðèçîíòàëè --->
1305
      add bx,tl_img_cx ;ñäâèãàåì íàäïèñü ïî ãîðèçîíòàëè --->
1306
      add bx,3 ;îòñòóï
1306
      add bx,3 ;îòñòóï
1307
      ;bx = coord. x
1307
      ;bx = coord. x
1308
      call tl_strlen ;eax = strlen
1308
      call tl_strlen ;eax = strlen
1309
      call tl_get_draw_text_len
1309
      call tl_get_draw_text_len
1310
      mov cx,bx
1310
      mov cx,bx
1311
      ror ecx,16
1311
      ror ecx,16
1312
      mov ebx,ecx
1312
      mov ebx,ecx
1313
      add bx,tl_img_cy ;âûðàâíèâèíèå ïî íèæíåé ãðàíèöå èêîíêè
1313
      add bx,tl_img_cy ;âûðàâíèâèíèå ïî íèæíåé ãðàíèöå èêîíêè
1314
      sub bx,9 ;îòíèìàåì âûñîòó òåêñòà
1314
      sub bx,9 ;îòíèìàåì âûñîòó òåêñòà
1315
      mov ecx,tl_col_txt
1315
      mov ecx,tl_col_txt
1316
      and ecx,0xffffff
1316
      and ecx,0xffffff
1317
;      or ecx,0x80000000 ;text is ASCIIZ
1317
;      or ecx,0x80000000 ;text is ASCIIZ
1318
      mov eax,4
1318
      mov eax,4
1319
      int 0x40
1319
      int 0x40
1320
    @@:
1320
    @@:
1321
    pop esi edx ecx ebx
1321
    pop esi edx ecx ebx
1322
  ret
1322
  ret
1323
 
1323
 
1324
;input:
1324
;input:
1325
; eax = strlen
1325
; eax = strlen
1326
; ebx = text coord x
1326
; ebx = text coord x
1327
;output:
1327
;output:
1328
; esi = text len
1328
; esi = text len
1329
align 4
1329
align 4
1330
tl_get_draw_text_len:
1330
tl_get_draw_text_len:
1331
  push eax ecx edx
1331
  push eax ecx edx
1332
    mov esi,eax ;áåðåì äëèííó ñòðîêè
1332
    mov esi,eax ;áåðåì äëèííó ñòðîêè
1333
 
1333
 
1334
    mov eax,tl_box_left
1334
    mov eax,tl_box_left
1335
    add eax,tl_box_width
1335
    add eax,tl_box_width
1336
    cmp eax,ebx
1336
    cmp eax,ebx
1337
    jle .text_null ;åñëè ïîäïèñü ïîëíîñòüþ âñÿ çà ýêðàíîì
1337
    jle .text_null ;åñëè ïîäïèñü ïîëíîñòüþ âñÿ çà ýêðàíîì
1338
    sub eax,ebx
1338
    sub eax,ebx
1339
    xor edx,edx
1339
    xor edx,edx
1340
    mov ecx,6 ;øèðèíà ñèñòåìíîãî øðèôòà
1340
    mov ecx,6 ;øèðèíà ñèñòåìíîãî øðèôòà
1341
    div ecx ;ñìîòðèì ñêîëüêî ñèìâîëîâ ìîæåò ïîìåñòèòüñÿ íà ýêðàíå
1341
    div ecx ;ñìîòðèì ñêîëüêî ñèìâîëîâ ìîæåò ïîìåñòèòüñÿ íà ýêðàíå
1342
 
1342
 
1343
    cmp esi,eax
1343
    cmp esi,eax
1344
    jl @f
1344
    jl @f
1345
      mov esi,eax ;åñëè äëèííà òåêñòà ìåíüøå, ÷åì âñå ìåñòî ïîä ñòðîêó
1345
      mov esi,eax ;åñëè äëèííà òåêñòà ìåíüøå, ÷åì âñå ìåñòî ïîä ñòðîêó
1346
    jmp @f
1346
    jmp @f
1347
    .text_null:
1347
    .text_null:
1348
      xor esi,esi
1348
      xor esi,esi
1349
    @@:
1349
    @@:
1350
  pop edx ecx eax
1350
  pop edx ecx eax
1351
  ret
1351
  ret
1352
 
1352
 
1353
;input:
1353
;input:
1354
; esi = pointer to string
1354
; esi = pointer to string
1355
;output:
1355
;output:
1356
; eax = strlen
1356
; eax = strlen
1357
align 4
1357
align 4
1358
tl_strlen:
1358
tl_strlen:
1359
  mov eax,esi
1359
  mov eax,esi
1360
  @@:
1360
  @@:
1361
    cmp byte[eax],0
1361
    cmp byte[eax],0
1362
    je @f
1362
    je @f
1363
    inc eax
1363
    inc eax
1364
    loop @b
1364
    loop @b
1365
  @@:
1365
  @@:
1366
  sub eax,esi
1366
  sub eax,esi
1367
  ret
1367
  ret
1368
 
1368
 
1369
;input:
1369
;input:
1370
;dword[ebp+ 8] - pointer to node info
1370
;dword[ebp+ 8] - pointer to node info
1371
;dword[ebp+12] - options
1371
;dword[ebp+12] - options
1372
;dword[ebp+16] - pointer to 'TreeList' struct
1372
;dword[ebp+16] - pointer to 'TreeList' struct
1373
align 4
1373
align 4
1374
tl_node_add: ;äîáàâèòü óçåë
1374
tl_node_add: ;äîáàâèòü óçåë
1375
  push ebp
1375
  push ebp
1376
  mov ebp,esp
1376
  mov ebp,esp
1377
  push eax ebx ecx edx edi
1377
  push eax ebx ecx edx edi
1378
    mov edi,dword[ebp+16]
1378
    mov edi,dword[ebp+16]
1379
 
1379
 
1380
    call tl_info_set_undo
1380
    call tl_info_set_undo
1381
 
1381
 
1382
    mov ebx,sizeof.TreeList
1382
    mov ebx,sizeof.TreeList
1383
    imul ebx,dword[edi+6] ;+6 ìàêñ. êîëè÷åñòâî óçëîâ
1383
    imul ebx,dword[edi+6] ;+6 ìàêñ. êîëè÷åñòâî óçëîâ
1384
    add ebx,tl_data_nodes
1384
    add ebx,tl_data_nodes
1385
;--
1385
;--
1386
    call tl_get_cur_node_index ;eax=po_t
1386
    call tl_get_cur_node_index ;eax=po_t
1387
    imul eax,sizeof.TreeList
1387
    imul eax,sizeof.TreeList
1388
    add eax,tl_data_nodes
1388
    add eax,tl_data_nodes
1389
    mov edx,eax
1389
    mov edx,eax
1390
    call tl_move_perv
1390
    call tl_move_perv
1391
    call tl_get_node_index ;eax = index of pointer [edx]
1391
    call tl_get_node_index ;eax = index of pointer [edx]
1392
;--
1392
;--
1393
    mov edx,sizeof.TreeList
1393
    mov edx,sizeof.TreeList
1394
    shl edx,1
1394
    shl edx,1
1395
    add edx,tl_data_nodes
1395
    add edx,tl_data_nodes
1396
    @@: ;for(i=2;i
1396
    @@: ;for(i=2;i
1397
      cmp dword [edx+12],0
1397
      cmp dword [edx+12],0
1398
      jne .u0
1398
      jne .u0
1399
      cmp dword [edx+16],0
1399
      cmp dword [edx+16],0
1400
      jne .u0
1400
      jne .u0
1401
 
1401
 
1402
	inc  tl_ch_tim
1402
	inc  tl_ch_tim
1403
	mov cx,word[ebp+14] ;get type
1403
	mov cx,word[ebp+14] ;get type
1404
	mov word[edx],cx
1404
	mov word[edx],cx
1405
 mov cl,byte[ebp+13]
1405
 mov cl,byte[ebp+13]
1406
 mov byte[edx+3],cl  ;node[i].clo
1406
 mov byte[edx+3],cl  ;node[i].clo
1407
	mov   byte[edx+2], 0 ;node[i].lev=0
1407
	mov   byte[edx+2], 0 ;node[i].lev=0
1408
  bt tl_style,2 ;tl_list_box_mode
1408
  bt tl_style,2 ;tl_list_box_mode
1409
  jc .l_box_m
1409
  jc .l_box_m
1410
    mov cl,byte[ebp+12]
1410
    mov cl,byte[ebp+12]
1411
    mov byte[edx+2],cl  ;node[i].lev
1411
    mov byte[edx+2],cl  ;node[i].lev
1412
  .l_box_m:
1412
  .l_box_m:
1413
	push tl_ch_tim       ;node[i].tc=ch_tim;
1413
	push tl_ch_tim       ;node[i].tc=ch_tim;
1414
	pop  dword[edx+12]
1414
	pop  dword[edx+12]
1415
	mov  dword[edx+4], eax ;node[i].perv=po_t;
1415
	mov  dword[edx+4], eax ;node[i].perv=po_t;
1416
	;*** copy node data ***
1416
	;*** copy node data ***
1417
	push esi
1417
	push esi
1418
	xor ecx,ecx
1418
	xor ecx,ecx
1419
	mov cx,tl_info_size
1419
	mov cx,tl_info_size
1420
	mov esi,ecx
1420
	mov esi,ecx
1421
 
1421
 
1422
	push eax
1422
	push eax
1423
	  call tl_get_node_index ;eax = node index
1423
	  call tl_get_node_index ;eax = node index
1424
	  imul esi,eax
1424
	  imul esi,eax
1425
	pop eax
1425
	pop eax
1426
	add esi,dword[edi]
1426
	add esi,dword[edi]
1427
	mov edi,dword[ebp+8] ;pointer to node data
1427
	mov edi,dword[ebp+8] ;pointer to node data
1428
	xchg edi,esi
1428
	xchg edi,esi
1429
	rep movsb
1429
	rep movsb
1430
 
1430
 
1431
	mov esi,edi
1431
	mov esi,edi
1432
	mov edi,dword[ebp+16] ;restore edi
1432
	mov edi,dword[ebp+16] ;restore edi
1433
	mov cx,tl_info_capt_offs
1433
	mov cx,tl_info_capt_offs
1434
	cmp cx,tl_info_size
1434
	cmp cx,tl_info_size
1435
	jge .no_text_data
1435
	jge .no_text_data
1436
 cmp tl_info_capt_len,0 ;ïðîâåðÿåì åñòü ëè îãðàíè÷åíèå íà äëèííó ñòðîêè
1436
 cmp tl_info_capt_len,0 ;ïðîâåðÿåì åñòü ëè îãðàíè÷åíèå íà äëèííó ñòðîêè
1437
 je .no_len_ogran
1437
 je .no_len_ogran
1438
   add cx,tl_info_capt_len
1438
   add cx,tl_info_capt_len
1439
   and ecx,0xffff
1439
   and ecx,0xffff
1440
   add esi,ecx
1440
   add esi,ecx
1441
   mov cx,tl_info_size
1441
   mov cx,tl_info_size
1442
   sub esi,ecx
1442
   sub esi,ecx
1443
 .no_len_ogran:
1443
 .no_len_ogran:
1444
	  dec esi
1444
	  dec esi
1445
	  mov byte[esi],0
1445
	  mov byte[esi],0
1446
	.no_text_data:
1446
	.no_text_data:
1447
	pop esi ;restore esi
1447
	pop esi ;restore esi
1448
 
1448
 
1449
	mov ecx,eax
1449
	mov ecx,eax
1450
	imul ecx,sizeof.TreeList
1450
	imul ecx,sizeof.TreeList
1451
	add ecx,tl_data_nodes ; *** ecx = node[po_t] ***
1451
	add ecx,tl_data_nodes ; *** ecx = node[po_t] ***
1452
	add ecx,8   ; *** ecx = node[po_t].next ***
1452
	add ecx,8   ; *** ecx = node[po_t].next ***
1453
	push dword [ecx] ;node[i].next=node[po_t].next;
1453
	push dword [ecx] ;node[i].next=node[po_t].next;
1454
	pop dword [edx+8]
1454
	pop dword [edx+8]
1455
 
1455
 
1456
	call tl_get_node_index ;*** eax = i ***
1456
	call tl_get_node_index ;*** eax = i ***
1457
	cmp eax,dword[edi+6] ;info_max_count
1457
	cmp eax,dword[edi+6] ;info_max_count
1458
	jge .u0
1458
	jge .u0
1459
 
1459
 
1460
	mov [ecx],eax ;node[po_t].next=i; // ññûëêè ïåðåíàïðàâëÿåì
1460
	mov [ecx],eax ;node[po_t].next=i; // ññûëêè ïåðåíàïðàâëÿåì
1461
	mov ecx,[edx+8] ; *** ecx = node[i].next ***
1461
	mov ecx,[edx+8] ; *** ecx = node[i].next ***
1462
	imul ecx,sizeof.TreeList
1462
	imul ecx,sizeof.TreeList
1463
	add ecx,tl_data_nodes ; *** ecx = node[node[i].next] ***
1463
	add ecx,tl_data_nodes ; *** ecx = node[node[i].next] ***
1464
	mov [ecx+4],eax ;node[node[i].next].perv=i;
1464
	mov [ecx+4],eax ;node[node[i].next].perv=i;
1465
 
1465
 
1466
	call tb_scrol_resize ;îáðàáîòêà ñêðîëëèíãà
1466
	call tb_scrol_resize ;îáðàáîòêà ñêðîëëèíãà
1467
    jmp @f
1467
    jmp @f
1468
      .u0:
1468
      .u0:
1469
      add edx,sizeof.TreeList
1469
      add edx,sizeof.TreeList
1470
      cmp edx,ebx ;enf of node memory ?
1470
      cmp edx,ebx ;enf of node memory ?
1471
      jle @b
1471
      jle @b
1472
    @@:
1472
    @@:
1473
  pop edi edx ecx ebx eax
1473
  pop edi edx ecx ebx eax
1474
  pop ebp
1474
  pop ebp
1475
  ret 12
1475
  ret 12
1476
 
1476
 
1477
;input:
1477
;input:
1478
; edi = pointer to TreeInfo struct
1478
; edi = pointer to TreeInfo struct
1479
align 4
1479
align 4
1480
tb_scrol_resize:
1480
tb_scrol_resize:
1481
  push eax ecx edx
1481
  push eax ecx edx
1482
  cmp tl_p_scrol,0 ;îáðàáîòêà ñêðîëëèíãà
1482
  cmp tl_p_scrol,0 ;îáðàáîòêà ñêðîëëèíãà
1483
  je @f
1483
  je @f
1484
    call tl_get_node_count ;eax = node count
1484
    call tl_get_node_count ;eax = node count
1485
    mov ecx,eax
1485
    mov ecx,eax
1486
    call tl_get_rows_count
1486
    call tl_get_rows_count
1487
    cmp ecx,eax
1487
    cmp ecx,eax
1488
    jg .ye_sb
1488
    jg .ye_sb
1489
      xor ecx,ecx
1489
      xor ecx,ecx
1490
    .ye_sb:
1490
    .ye_sb:
1491
 
1491
 
1492
    mov edx,tl_p_scrol
1492
    mov edx,tl_p_scrol
1493
    mov dword[edx+20],eax ;+20 .cur_area
1493
    mov dword[edx+20],eax ;+20 .cur_area
1494
    mov dword[edx+16],ecx ;+16 .max_area
1494
    mov dword[edx+16],ecx ;+16 .max_area
1495
    push dword edx ;pointer to scroll struct
1495
    push dword edx ;pointer to scroll struct
1496
    call scroll_bar_vertical.draw
1496
    call scroll_bar_vertical.draw
1497
  @@:
1497
  @@:
1498
  pop edx ecx eax
1498
  pop edx ecx eax
1499
ret
1499
ret
1500
 
1500
 
1501
;input:
1501
;input:
1502
;dword[ebp+ 8] - pointer to node info
1502
;dword[ebp+ 8] - pointer to node info
1503
;dword[ebp+12] - pointer to 'TreeList' struct
1503
;dword[ebp+12] - pointer to 'TreeList' struct
1504
align 4
1504
align 4
1505
tl_node_set_data:
1505
tl_node_set_data:
1506
  push ebp
1506
  push ebp
1507
  mov ebp,esp
1507
  mov ebp,esp
1508
  push eax ecx edx edi esi
1508
  push eax ecx edx edi esi
1509
    mov edi,dword[ebp+12]
1509
    mov edi,dword[ebp+12]
1510
    call tl_get_cur_node_index ;eax=po_t
1510
    call tl_get_cur_node_index ;eax=po_t
1511
    cmp eax,2
1511
    cmp eax,2
1512
    jl @f
1512
    jl @f
1513
      xor ecx,ecx
1513
      xor ecx,ecx
1514
      mov cx,tl_info_size
1514
      mov cx,tl_info_size
1515
      imul eax,ecx
1515
      imul eax,ecx
1516
      add eax,dword[edi]
1516
      add eax,dword[edi]
1517
      mov edi,eax
1517
      mov edi,eax
1518
      mov esi,dword[ebp+8] ;pointer to node data
1518
      mov esi,dword[ebp+8] ;pointer to node data
1519
      rep movsb
1519
      rep movsb
1520
 
1520
 
1521
      mov esi,edi
1521
      mov esi,edi
1522
      mov edi,dword[ebp+12] ;restore edi
1522
      mov edi,dword[ebp+12] ;restore edi
1523
      mov cx,tl_info_capt_offs
1523
      mov cx,tl_info_capt_offs
1524
      cmp cx,tl_info_size
1524
      cmp cx,tl_info_size
1525
      jge .no_text_data
1525
      jge .no_text_data
1526
        mov ax,tl_info_capt_len ;ïðîâåðÿåì åñòü ëè îãðàíè÷åíèå íà äëèííó òåêñòà
1526
        mov ax,tl_info_capt_len ;ïðîâåðÿåì åñòü ëè îãðàíè÷åíèå íà äëèííó òåêñòà
1527
        cmp ax,0
1527
        cmp ax,0
1528
        je .no_limit
1528
        je .no_limit
1529
        add cx,ax ;cx = tl_info_capt_offs + tl_info_capt_len
1529
        add cx,ax ;cx = tl_info_capt_offs + tl_info_capt_len
1530
        and ecx,0xffff
1530
        and ecx,0xffff
1531
        xor eax,eax
1531
        xor eax,eax
1532
        mov ax,tl_info_size
1532
        mov ax,tl_info_size
1533
        cmp eax,ecx
1533
        cmp eax,ecx
1534
        jl .no_limit ;ïîëüçîâàòåëü çàäàë ñëèøêîì áîëüøóþ äëèííó òåêñòà
1534
        jl .no_limit ;ïîëüçîâàòåëü çàäàë ñëèøêîì áîëüøóþ äëèííó òåêñòà
1535
        add esi,ecx
1535
        add esi,ecx
1536
        sub esi,eax
1536
        sub esi,eax
1537
        .no_limit:
1537
        .no_limit:
1538
          dec esi
1538
          dec esi
1539
          mov byte[esi],0 ;îáíóëÿåì ïîñëåäíèé ñèìâîë ïîäïèñè, ÷òî-áû íå ãëþ÷èëî åñëè ïîëüçîâàòåëü çàäàë íåïðàâèëüíóþ ñòðóêòóðó
1539
          mov byte[esi],0 ;îáíóëÿåì ïîñëåäíèé ñèìâîë ïîäïèñè, ÷òî-áû íå ãëþ÷èëî åñëè ïîëüçîâàòåëü çàäàë íåïðàâèëüíóþ ñòðóêòóðó
1540
      .no_text_data:
1540
      .no_text_data:
1541
 
1541
 
1542
    @@:
1542
    @@:
1543
  pop esi edi edx ecx eax
1543
  pop esi edi edx ecx eax
1544
  pop ebp
1544
  pop ebp
1545
  ret 8
1545
  ret 8
1546
 
1546
 
1547
;input:
1547
;input:
1548
;dword[ebp+ 8] - pointer to 'TreeList' struct
1548
;dword[ebp+ 8] - pointer to 'TreeList' struct
1549
align 4
1549
align 4
1550
tl_node_get_data: ;âçÿòü óêàçàòåëü íà äàííûå óçëà ïîä êóðñîðîì
1550
tl_node_get_data: ;âçÿòü óêàçàòåëü íà äàííûå óçëà ïîä êóðñîðîì
1551
  push ebp
1551
  push ebp
1552
  mov ebp,esp
1552
  mov ebp,esp
1553
  push eax ecx edi
1553
  push eax ecx edi
1554
    mov edi,dword[ebp+8]
1554
    mov edi,dword[ebp+8]
1555
    call tl_get_cur_node_index ;eax=po_t
1555
    call tl_get_cur_node_index ;eax=po_t
1556
    mov dword[ebp+8],0 ;if return 0 pointer
1556
    mov dword[ebp+8],0 ;if return 0 pointer
1557
    cmp eax,2
1557
    cmp eax,2
1558
    jl @f
1558
    jl @f
1559
      xor ecx,ecx
1559
      xor ecx,ecx
1560
      mov cx,tl_info_size
1560
      mov cx,tl_info_size
1561
      imul eax,ecx
1561
      imul eax,ecx
1562
      add eax,dword[edi]
1562
      add eax,dword[edi]
1563
      mov dword[ebp+8],eax ;return node data pointer
1563
      mov dword[ebp+8],eax ;return node data pointer
1564
    @@:
1564
    @@:
1565
  pop edi ecx eax
1565
  pop edi ecx eax
1566
  pop ebp
1566
  pop ebp
1567
  ret
1567
  ret
1568
 
1568
 
1569
;input:
1569
;input:
1570
;dword[ebp+ 8] - node index
1570
;dword[ebp+ 8] - node index
1571
;dword[ebp+12] - pointer to 'TreeList' struct
1571
;dword[ebp+12] - pointer to 'TreeList' struct
1572
align 4
1572
align 4
1573
tl_node_poi_get_info: ;âçÿòü óêàçàòåëü íà ñòðóêòóðó óçëà â óêàçàííîé ïîçèöèè
1573
tl_node_poi_get_info: ;âçÿòü óêàçàòåëü íà ñòðóêòóðó óçëà â óêàçàííîé ïîçèöèè
1574
  push ebp
1574
  push ebp
1575
  mov ebp,esp
1575
  mov ebp,esp
1576
  push eax ecx edx edi
1576
  push eax ecx edx edi
1577
    mov edi,dword[ebp+12]
1577
    mov edi,dword[ebp+12]
1578
    mov eax,dword[ebp+8]
1578
    mov eax,dword[ebp+8]
1579
 
1579
 
1580
    ;cycle to nodes
1580
    ;cycle to nodes
1581
    mov edx,tl_data_nodes
1581
    mov edx,tl_data_nodes
1582
    mov ecx,edx
1582
    mov ecx,edx
1583
    add ecx,sizeof.TreeList
1583
    add ecx,sizeof.TreeList
1584
    @@:
1584
    @@:
1585
      call tl_iterat_next_all
1585
      call tl_iterat_next_all
1586
      cmp edx,ecx
1586
      cmp edx,ecx
1587
      jle @f
1587
      jle @f
1588
      dec eax
1588
      dec eax
1589
      cmp eax,0
1589
      cmp eax,0
1590
      jg @b
1590
      jg @b
1591
      jmp .find
1591
      jmp .find
1592
    @@:
1592
    @@:
1593
      xor edx,edx
1593
      xor edx,edx
1594
    .find:
1594
    .find:
1595
    mov dword[ebp+12],edx
1595
    mov dword[ebp+12],edx
1596
  pop edi edx ecx eax
1596
  pop edi edx ecx eax
1597
  pop ebp
1597
  pop ebp
1598
  ret 4
1598
  ret 4
1599
 
1599
 
1600
;input:
1600
;input:
1601
;dword[ebp+ 8] - node param struct
1601
;dword[ebp+ 8] - node param struct
1602
;dword[ebp+12] - pointer to 'TreeList' struct
1602
;dword[ebp+12] - pointer to 'TreeList' struct
1603
align 4
1603
align 4
1604
tl_node_poi_get_next_info: ;âçÿòü óêàçàòåëü íà ñëåäóùóþ ñòðóêòóðó óçëà
1604
tl_node_poi_get_next_info: ;âçÿòü óêàçàòåëü íà ñëåäóùóþ ñòðóêòóðó óçëà
1605
  push ebp
1605
  push ebp
1606
  mov ebp,esp
1606
  mov ebp,esp
1607
  push ecx edx edi
1607
  push ecx edx edi
1608
    mov edi,dword[ebp+12]
1608
    mov edi,dword[ebp+12]
1609
    mov edx,dword[ebp+8]
1609
    mov edx,dword[ebp+8]
1610
 
1610
 
1611
    mov ecx,tl_data_nodes
1611
    mov ecx,tl_data_nodes
1612
    add ecx,sizeof.TreeList
1612
    add ecx,sizeof.TreeList
1613
 
1613
 
1614
    call tl_iterat_next_all
1614
    call tl_iterat_next_all
1615
    cmp edx,ecx
1615
    cmp edx,ecx
1616
    jg @f
1616
    jg @f
1617
      xor edx,edx
1617
      xor edx,edx
1618
    @@:
1618
    @@:
1619
 
1619
 
1620
    mov dword[ebp+12],edx
1620
    mov dword[ebp+12],edx
1621
  pop edi edx ecx
1621
  pop edi edx ecx
1622
  pop ebp
1622
  pop ebp
1623
  ret 4
1623
  ret 4
1624
 
1624
 
1625
;input:
1625
;input:
1626
;dword[ebp+ 8] - node param struct
1626
;dword[ebp+ 8] - node param struct
1627
;dword[ebp+12] - pointer to 'TreeList' struct
1627
;dword[ebp+12] - pointer to 'TreeList' struct
1628
align 4
1628
align 4
1629
tl_node_poi_get_data: ;âçÿòü óêàçàòåëü íà äàííûå óçëà
1629
tl_node_poi_get_data: ;âçÿòü óêàçàòåëü íà äàííûå óçëà
1630
  push ebp
1630
  push ebp
1631
  mov ebp,esp
1631
  mov ebp,esp
1632
  push eax ecx edi
1632
  push eax ecx edi
1633
    mov edi,dword[ebp+12]
1633
    mov edi,dword[ebp+12]
1634
    mov edx,dword[ebp+8]
1634
    mov edx,dword[ebp+8]
1635
 
1635
 
1636
    mov dword[ebp+12],0
1636
    mov dword[ebp+12],0
1637
    call tl_get_node_index ;eax = node index
1637
    call tl_get_node_index ;eax = node index
1638
    cmp eax,2
1638
    cmp eax,2
1639
    jl @f
1639
    jl @f
1640
      xor ecx,ecx
1640
      xor ecx,ecx
1641
      mov cx,tl_info_size
1641
      mov cx,tl_info_size
1642
      imul eax,ecx
1642
      imul eax,ecx
1643
      add eax,dword[edi]
1643
      add eax,dword[edi]
1644
      mov dword[ebp+12],eax ;return node data pointer
1644
      mov dword[ebp+12],eax ;return node data pointer
1645
    @@:
1645
    @@:
1646
  pop edi ecx eax
1646
  pop edi ecx eax
1647
  pop ebp
1647
  pop ebp
1648
  ret 4
1648
  ret 4
1649
 
1649
 
1650
;input:
1650
;input:
1651
; edi = pointer 'tl' struct
1651
; edi = pointer 'tl' struct
1652
;output:
1652
;output:
1653
; eax = index of current node
1653
; eax = index of current node
1654
align 4
1654
align 4
1655
tl_get_cur_node_index: ;áåðåò ïîçèöèþ ïîä êóðñîðîì
1655
tl_get_cur_node_index: ;áåðåò ïîçèöèþ ïîä êóðñîðîì
1656
  push ecx edx
1656
  push ecx edx
1657
    ;cycle to nodes
1657
    ;cycle to nodes
1658
    xor eax,eax
1658
    xor eax,eax
1659
    mov edx,tl_data_nodes
1659
    mov edx,tl_data_nodes
1660
    mov ecx,edx
1660
    mov ecx,edx
1661
    add ecx,sizeof.TreeList
1661
    add ecx,sizeof.TreeList
1662
    @@:
1662
    @@:
1663
      call tl_iterat_next
1663
      call tl_iterat_next
1664
      cmp edx,ecx
1664
      cmp edx,ecx
1665
      jle @f
1665
      jle @f
1666
      cmp eax,tl_cur_pos
1666
      cmp eax,tl_cur_pos
1667
      je @f
1667
      je @f
1668
      inc eax
1668
      inc eax
1669
      jmp @b
1669
      jmp @b
1670
    @@:
1670
    @@:
1671
  mov eax,edx
1671
  mov eax,edx
1672
  sub eax,tl_data_nodes
1672
  sub eax,tl_data_nodes
1673
  xor edx,edx
1673
  xor edx,edx
1674
  mov ecx,sizeof.TreeList
1674
  mov ecx,sizeof.TreeList
1675
  div ecx
1675
  div ecx
1676
  pop edx ecx
1676
  pop edx ecx
1677
  ret
1677
  ret
1678
 
1678
 
1679
;input:
1679
;input:
1680
; edx = pointer node memory
1680
; edx = pointer node memory
1681
; edi = pointer 'tl' struct
1681
; edi = pointer 'tl' struct
1682
;output:
1682
;output:
1683
; eax = struct index of current node
1683
; eax = struct index of current node
1684
align 4
1684
align 4
1685
tl_get_node_index: ;áåðåò ïîçèöèþ óêàçàííîãî ñèìâîëà
1685
tl_get_node_index: ;áåðåò ïîçèöèþ óêàçàííîãî ñèìâîëà
1686
  push ecx edx
1686
  push ecx edx
1687
  mov eax,edx
1687
  mov eax,edx
1688
  sub eax,tl_data_nodes
1688
  sub eax,tl_data_nodes
1689
  xor edx,edx
1689
  xor edx,edx
1690
  mov ecx,sizeof.TreeList
1690
  mov ecx,sizeof.TreeList
1691
  div ecx
1691
  div ecx
1692
  pop edx ecx
1692
  pop edx ecx
1693
  ret
1693
  ret
1694
 
1694
 
1695
align 4
1695
align 4
1696
tl_node_delete: ;óäàëèòü óçåë
1696
tl_node_delete: ;óäàëèòü óçåë
1697
  push ebp
1697
  push ebp
1698
  mov ebp,esp
1698
  mov ebp,esp
1699
  push eax edx edi
1699
  push eax edx edi
1700
    mov edi,dword[ebp+8]
1700
    mov edi,dword[ebp+8]
1701
    call tl_get_cur_node_index ;eax=po_t
1701
    call tl_get_cur_node_index ;eax=po_t
1702
    cmp eax,2
1702
    cmp eax,2
1703
    jl @f
1703
    jl @f
1704
      imul eax,sizeof.TreeList
1704
      imul eax,sizeof.TreeList
1705
      add eax,tl_data_nodes
1705
      add eax,tl_data_nodes
1706
      mov edx,eax
1706
      mov edx,eax
1707
      inc tl_ch_tim
1707
      inc tl_ch_tim
1708
      mov eax,tl_ch_tim
1708
      mov eax,tl_ch_tim
1709
      mov dword[edx+16],eax
1709
      mov dword[edx+16],eax
1710
      call tb_scrol_resize ;îáðàáîòêà ñêðîëëèíãà
1710
      call tb_scrol_resize ;îáðàáîòêà ñêðîëëèíãà
1711
    @@:
1711
    @@:
1712
  pop edi edx eax
1712
  pop edi edx eax
1713
  pop ebp
1713
  pop ebp
1714
  ret 4
1714
  ret 4
1715
 
1715
 
1716
align 4
1716
align 4
1717
tl_cur_beg: ;ïîñòàâèòü êóðñîð íà ïåðâûé óçåë
1717
tl_cur_beg: ;ïîñòàâèòü êóðñîð íà ïåðâûé óçåë
1718
  push ebp
1718
  push ebp
1719
  mov ebp,esp
1719
  mov ebp,esp
1720
  push edi
1720
  push edi
1721
    mov edi,dword[ebp+8]
1721
    mov edi,dword[ebp+8]
1722
    mov tl_cur_pos,0
1722
    mov tl_cur_pos,0
1723
    cmp tl_p_scrol,0
1723
    cmp tl_p_scrol,0
1724
    je @f
1724
    je @f
1725
      mov edi,tl_p_scrol
1725
      mov edi,tl_p_scrol
1726
      mov dword[edi+24],0
1726
      mov dword[edi+24],0
1727
      push dword edi
1727
      push dword edi
1728
      mov edi,dword[ebp+8]
1728
      mov edi,dword[ebp+8]
1729
      call scroll_bar_vertical.draw
1729
      call scroll_bar_vertical.draw
1730
    @@:
1730
    @@:
1731
  pop edi
1731
  pop edi
1732
 
1732
 
1733
  pop ebp
1733
  pop ebp
1734
  ret 4
1734
  ret 4
1735
 
1735
 
1736
align 4
1736
align 4
1737
tl_cur_next: ;ïåðåíåñòè êóðñîð íà 1 ïîçèöèþ íèæå
1737
tl_cur_next: ;ïåðåíåñòè êóðñîð íà 1 ïîçèöèþ íèæå
1738
  push ebp
1738
  push ebp
1739
  mov ebp,esp
1739
  mov ebp,esp
1740
  push eax ebx edi esi
1740
  push eax ebx edi esi
1741
    mov edi,dword[ebp+8]
1741
    mov edi,dword[ebp+8]
1742
    call tl_get_node_count ;eax = node count
1742
    call tl_get_node_count ;eax = node count
1743
    ;inc eax
1743
    ;inc eax
1744
    cmp tl_cur_pos,eax
1744
    cmp tl_cur_pos,eax
1745
    jge .no_redraw
1745
    jge .no_redraw
1746
      mov esi,tl_box_top
1746
      mov esi,tl_box_top
1747
      add esi,tl_box_height ;esi = coord bottom border
1747
      add esi,tl_box_height ;esi = coord bottom border
1748
      call tl_draw_null_cursor ;ñòèðàåì êóðñîð
1748
      call tl_draw_null_cursor ;ñòèðàåì êóðñîð
1749
      inc tl_cur_pos
1749
      inc tl_cur_pos
1750
 
1750
 
1751
    cmp tl_p_scrol,0 ;if not scrol struct
1751
    cmp tl_p_scrol,0 ;if not scrol struct
1752
    je @f
1752
    je @f
1753
    call tl_get_rows_count ;eax = rows count
1753
    call tl_get_rows_count ;eax = rows count
1754
    mov ebx,tl_p_scrol
1754
    mov ebx,tl_p_scrol
1755
    add eax,dword[ebx+24] ;.position +24
1755
    add eax,dword[ebx+24] ;.position +24
1756
    cmp tl_cur_pos,eax
1756
    cmp tl_cur_pos,eax
1757
    jl @f
1757
    jl @f
1758
      inc dword[ebx+24] ;.position +24
1758
      inc dword[ebx+24] ;.position +24
1759
      push dword ebx
1759
      push dword ebx
1760
      call scroll_bar_vertical.draw
1760
      call scroll_bar_vertical.draw
1761
 
1761
 
1762
      mov edi,dword[ebp+8] ;restore edi
1762
      mov edi,dword[ebp+8] ;restore edi
1763
      push dword edi
1763
      push dword edi
1764
      call tl_draw ;ïîëíàÿ ïåðåðèñîâêà îêíà
1764
      call tl_draw ;ïîëíàÿ ïåðåðèñîâêà îêíà
1765
      jmp .no_redraw
1765
      jmp .no_redraw
1766
    @@:
1766
    @@:
1767
      mov edi,dword[ebp+8] ;restore edi
1767
      mov edi,dword[ebp+8] ;restore edi
1768
      call tl_draw_cursor ;ïåðåðèñîâêà êóðñîðà
1768
      call tl_draw_cursor ;ïåðåðèñîâêà êóðñîðà
1769
      call tl_draw_caption_cur_pos
1769
      call tl_draw_caption_cur_pos
1770
    .no_redraw:
1770
    .no_redraw:
1771
  pop esi edi ebx eax
1771
  pop esi edi ebx eax
1772
  pop ebp
1772
  pop ebp
1773
  ret 4
1773
  ret 4
1774
 
1774
 
1775
 
1775
 
1776
;input:
1776
;input:
1777
; edi = pointer 'tl' struct
1777
; edi = pointer 'tl' struct
1778
;output:
1778
;output:
1779
; eax = struct index of current node
1779
; eax = struct index of current node
1780
align 4
1780
align 4
1781
tl_get_node_count: ;áåðåò ÷èñëî âñåõ âèäèìûõ óçëîâ (íå ñ÷èòàÿ çàêðûòûõ äî÷åðíèõ)
1781
tl_get_node_count: ;áåðåò ÷èñëî âñåõ âèäèìûõ óçëîâ (íå ñ÷èòàÿ çàêðûòûõ äî÷åðíèõ)
1782
  push ecx edx
1782
  push ecx edx
1783
    ;cycle to nodes
1783
    ;cycle to nodes
1784
    xor eax,eax
1784
    xor eax,eax
1785
    mov edx,tl_data_nodes
1785
    mov edx,tl_data_nodes
1786
    mov ecx,edx
1786
    mov ecx,edx
1787
    add ecx,sizeof.TreeList
1787
    add ecx,sizeof.TreeList
1788
    @@:
1788
    @@:
1789
      call tl_iterat_next
1789
      call tl_iterat_next
1790
      cmp edx,ecx
1790
      cmp edx,ecx
1791
      jle @f
1791
      jle @f
1792
      inc eax
1792
      inc eax
1793
      jmp @b
1793
      jmp @b
1794
    @@:
1794
    @@:
1795
  pop edx ecx
1795
  pop edx ecx
1796
  ret
1796
  ret
1797
 
1797
 
1798
;input:
1798
;input:
1799
; edi = pointer 'tl' struct
1799
; edi = pointer 'tl' struct
1800
;output:
1800
;output:
1801
; eax = struct index of current node
1801
; eax = struct index of current node
1802
align 4
1802
align 4
1803
tl_get_node_count_all: ;áåðåò ÷èñëî âñåõ âèäèìûõ óçëîâ (ñ÷èòàÿ çàêðûòûå äî÷åðíèå)
1803
tl_get_node_count_all: ;áåðåò ÷èñëî âñåõ âèäèìûõ óçëîâ (ñ÷èòàÿ çàêðûòûå äî÷åðíèå)
1804
  push ecx edx
1804
  push ecx edx
1805
    ;cycle to nodes
1805
    ;cycle to nodes
1806
    xor eax,eax
1806
    xor eax,eax
1807
    mov edx,tl_data_nodes
1807
    mov edx,tl_data_nodes
1808
    mov ecx,edx
1808
    mov ecx,edx
1809
    add ecx,sizeof.TreeList
1809
    add ecx,sizeof.TreeList
1810
    @@:
1810
    @@:
1811
      call tl_iterat_next_all
1811
      call tl_iterat_next_all
1812
      cmp edx,ecx
1812
      cmp edx,ecx
1813
      jle @f
1813
      jle @f
1814
      inc eax
1814
      inc eax
1815
      jmp @b
1815
      jmp @b
1816
    @@:
1816
    @@:
1817
  pop edx ecx
1817
  pop edx ecx
1818
  ret
1818
  ret
1819
 
1819
 
1820
align 4
1820
align 4
1821
tl_cur_perv: ;ïåðåíåñòè êóðñîð íà 1 ïîçèöèþ âûøå
1821
tl_cur_perv: ;ïåðåíåñòè êóðñîð íà 1 ïîçèöèþ âûøå
1822
  push ebp
1822
  push ebp
1823
  mov ebp,esp
1823
  mov ebp,esp
1824
  push eax edi esi
1824
  push eax edi esi
1825
    mov edi,dword[ebp+8]
1825
    mov edi,dword[ebp+8]
1826
    cmp tl_cur_pos,0
1826
    cmp tl_cur_pos,0
1827
    je .no_redraw
1827
    je .no_redraw
1828
      mov esi,tl_box_top
1828
      mov esi,tl_box_top
1829
      add esi,tl_box_height ;esi = coord bottom border
1829
      add esi,tl_box_height ;esi = coord bottom border
1830
      call tl_draw_null_cursor ;ñòèðàåì êóðñîð
1830
      call tl_draw_null_cursor ;ñòèðàåì êóðñîð
1831
      dec tl_cur_pos ;äâèãàåì êóðñîð ââåðõ
1831
      dec tl_cur_pos ;äâèãàåì êóðñîð ââåðõ
1832
 
1832
 
1833
    cmp tl_p_scrol,0 ;åñëè åñòü óêàçàòåëü íà ñêðîëëèíã
1833
    cmp tl_p_scrol,0 ;åñëè åñòü óêàçàòåëü íà ñêðîëëèíã
1834
    je @f
1834
    je @f
1835
    mov eax,tl_p_scrol
1835
    mov eax,tl_p_scrol
1836
    cmp dword[eax+24],0 ;åñëè ñêðîëëèíã íà âåðõó, âûõîäèì
1836
    cmp dword[eax+24],0 ;åñëè ñêðîëëèíã íà âåðõó, âûõîäèì
1837
    je @f
1837
    je @f
1838
    mov edi,tl_cur_pos
1838
    mov edi,tl_cur_pos
1839
    cmp edi,dword[eax+24] ;åñëè êóðñîð óøåë âûøå ñêðîëëèíãà, òîãäà îïóñêàåì ñêðîëëèíã
1839
    cmp edi,dword[eax+24] ;åñëè êóðñîð óøåë âûøå ñêðîëëèíãà, òîãäà îïóñêàåì ñêðîëëèíã
1840
    jge @f
1840
    jge @f
1841
      dec dword[eax+24]
1841
      dec dword[eax+24]
1842
      push dword eax
1842
      push dword eax
1843
      mov edi,dword[ebp+8]
1843
      mov edi,dword[ebp+8]
1844
      call scroll_bar_vertical.draw
1844
      call scroll_bar_vertical.draw
1845
      mov edi,dword[ebp+8] ;restore edi
1845
      mov edi,dword[ebp+8] ;restore edi
1846
      push dword edi
1846
      push dword edi
1847
      call tl_draw ;ïîëíàÿ ïåðåðèñîâêà îêíà
1847
      call tl_draw ;ïîëíàÿ ïåðåðèñîâêà îêíà
1848
      jmp .no_redraw
1848
      jmp .no_redraw
1849
    @@:
1849
    @@:
1850
      mov edi,dword[ebp+8] ;restore edi
1850
      mov edi,dword[ebp+8] ;restore edi
1851
      ;mov esi,tl_box_top
1851
      ;mov esi,tl_box_top
1852
      ;add esi,tl_box_height ;esi = coord bottom border
1852
      ;add esi,tl_box_height ;esi = coord bottom border
1853
      call tl_draw_cursor ;ïåðåðèñîâêà êóðñîðà
1853
      call tl_draw_cursor ;ïåðåðèñîâêà êóðñîðà
1854
      call tl_draw_caption_cur_pos
1854
      call tl_draw_caption_cur_pos
1855
    .no_redraw:
1855
    .no_redraw:
1856
  pop esi edi eax
1856
  pop esi edi eax
1857
  pop ebp
1857
  pop ebp
1858
  ret 4
1858
  ret 4
1859
 
1859
 
1860
align 4
1860
align 4
1861
tl_cur_page_up: ;ïåðåíåñòè êóðñîð íà 1 ñòðàíèöó âûøå
1861
tl_cur_page_up: ;ïåðåíåñòè êóðñîð íà 1 ñòðàíèöó âûøå
1862
  push ebp
1862
  push ebp
1863
  mov ebp,esp
1863
  mov ebp,esp
1864
  push eax edi esi
1864
  push eax edi esi
1865
    mov edi,dword[ebp+8]
1865
    mov edi,dword[ebp+8]
1866
 
1866
 
1867
    cmp tl_p_scrol,0 ;åñëè åñòü óêàçàòåëü íà ñêðîëëèíã
1867
    cmp tl_p_scrol,0 ;åñëè åñòü óêàçàòåëü íà ñêðîëëèíã
1868
    je .no_redraw
1868
    je .no_redraw
1869
 
1869
 
1870
    mov esi,tl_p_scrol
1870
    mov esi,tl_p_scrol
1871
    call tl_get_rows_count ;eax = rows count
1871
    call tl_get_rows_count ;eax = rows count
1872
 
1872
 
1873
    cmp tl_cur_pos,0
1873
    cmp tl_cur_pos,0
1874
    jne @f
1874
    jne @f
1875
    cmp dword[esi+24],0 ;åñëè ñêðîëëèíã íà âåðõó, âûõîäèì
1875
    cmp dword[esi+24],0 ;åñëè ñêðîëëèíã íà âåðõó, âûõîäèì
1876
    jne @f
1876
    jne @f
1877
      jmp .no_redraw
1877
      jmp .no_redraw
1878
    @@:
1878
    @@:
1879
      cmp tl_cur_pos,eax ;ïðîâåðÿåì ïîçèöèþ êóðñîðà è êîë-âî ñòîê íà ñòðàíèöå
1879
      cmp tl_cur_pos,eax ;ïðîâåðÿåì ïîçèöèþ êóðñîðà è êîë-âî ñòîê íà ñòðàíèöå
1880
      jl @f ;åñëè ìåíüøå, òî ïðèðàâíèâàåì ê 0, ÷òî-áû íå îòíÿòü áîëüøå ÷åì íàäî
1880
      jl @f ;åñëè ìåíüøå, òî ïðèðàâíèâàåì ê 0, ÷òî-áû íå îòíÿòü áîëüøå ÷åì íàäî
1881
        sub tl_cur_pos,eax
1881
        sub tl_cur_pos,eax
1882
        jmp .cursor
1882
        jmp .cursor
1883
      @@:
1883
      @@:
1884
        mov tl_cur_pos,0
1884
        mov tl_cur_pos,0
1885
      .cursor:
1885
      .cursor:
1886
      cmp dword[esi+24],eax
1886
      cmp dword[esi+24],eax
1887
      jl @f
1887
      jl @f
1888
        sub dword[esi+24],eax
1888
        sub dword[esi+24],eax
1889
        jmp .scroll
1889
        jmp .scroll
1890
      @@:
1890
      @@:
1891
        mov dword[esi+24],0
1891
        mov dword[esi+24],0
1892
      .scroll:
1892
      .scroll:
1893
      ;ïåðåðèñîâêè îêíà è ñêðîëëèíãà
1893
      ;ïåðåðèñîâêè îêíà è ñêðîëëèíãà
1894
      push dword edi
1894
      push dword edi
1895
      call tl_draw ;draw window
1895
      call tl_draw ;draw window
1896
      push dword esi
1896
      push dword esi
1897
      call scroll_bar_vertical.draw
1897
      call scroll_bar_vertical.draw
1898
    .no_redraw:
1898
    .no_redraw:
1899
  pop esi edi eax
1899
  pop esi edi eax
1900
  pop ebp
1900
  pop ebp
1901
  ret 4
1901
  ret 4
1902
 
1902
 
1903
align 4
1903
align 4
1904
tl_cur_page_down: ;ïåðåíåñòè êóðñîð íà 1 ñòðàíèöó íèæå
1904
tl_cur_page_down: ;ïåðåíåñòè êóðñîð íà 1 ñòðàíèöó íèæå
1905
  push ebp
1905
  push ebp
1906
  mov ebp,esp
1906
  mov ebp,esp
1907
  push eax ebx ecx edi esi
1907
  push eax ebx ecx edi esi
1908
;eax - êîë-âî ñòðîê íà ñòðàíèöå
1908
;eax - êîë-âî ñòðîê íà ñòðàíèöå
1909
;ebx - ìàêñ. ïîçèöèÿ êóðñîðà
1909
;ebx - ìàêñ. ïîçèöèÿ êóðñîðà
1910
;ecx - ìàêñ. ïîçèöèÿ ñêðîëëèíãà
1910
;ecx - ìàêñ. ïîçèöèÿ ñêðîëëèíãà
1911
    mov edi,dword[ebp+8]
1911
    mov edi,dword[ebp+8]
1912
 
1912
 
1913
    cmp tl_p_scrol,0 ;åñëè åñòü óêàçàòåëü íà ñêðîëëèíã
1913
    cmp tl_p_scrol,0 ;åñëè åñòü óêàçàòåëü íà ñêðîëëèíã
1914
    je .no_redraw
1914
    je .no_redraw
1915
 
1915
 
1916
    mov esi,tl_p_scrol
1916
    mov esi,tl_p_scrol
1917
    call tl_get_node_count ;eax = node count
1917
    call tl_get_node_count ;eax = node count
1918
    mov ebx,eax
1918
    mov ebx,eax
1919
    call tl_get_rows_count ;eax = rows count
1919
    call tl_get_rows_count ;eax = rows count
1920
 
1920
 
1921
    mov ecx,ebx
1921
    mov ecx,ebx
1922
    inc ecx ;åñëè íèæíèé óçåë âèäåí íà ïîëîâèíó
1922
    inc ecx ;åñëè íèæíèé óçåë âèäåí íà ïîëîâèíó
1923
    cmp ecx,eax ;if (ecx>eax) { ecx=ecx-eax } else { ecx=0 }
1923
    cmp ecx,eax ;if (ecx>eax) { ecx=ecx-eax } else { ecx=0 }
1924
    jl @f
1924
    jl @f
1925
      sub ecx,eax ;óìåíüøàåì ìàêñèìàëüíóþ ïîçèöèþ ñêðîëëèíãà, òàê ÷òî-áû áûëè âèäíû ïîñëåäíèå óçëû
1925
      sub ecx,eax ;óìåíüøàåì ìàêñèìàëüíóþ ïîçèöèþ ñêðîëëèíãà, òàê ÷òî-áû áûëè âèäíû ïîñëåäíèå óçëû
1926
      jmp .control
1926
      jmp .control
1927
    @@:
1927
    @@:
1928
      xor ecx,ecx ;ecx=0 - âñå óçëû âëàçÿò â ýêðàí, ñêðîëëèíã íå íóæåí
1928
      xor ecx,ecx ;ecx=0 - âñå óçëû âëàçÿò â ýêðàí, ñêðîëëèíã íå íóæåí
1929
    .control:
1929
    .control:
1930
 
1930
 
1931
    cmp tl_cur_pos,ebx ;êóðñîð âíèçó ?
1931
    cmp tl_cur_pos,ebx ;êóðñîð âíèçó ?
1932
    jl @f
1932
    jl @f
1933
    cmp dword[esi+24],ecx ;ñêðîëëèíã âíèçó ?
1933
    cmp dword[esi+24],ecx ;ñêðîëëèíã âíèçó ?
1934
    jl @f
1934
    jl @f
1935
      jmp .no_redraw
1935
      jmp .no_redraw
1936
    @@:
1936
    @@:
1937
 
1937
 
1938
      add tl_cur_pos,eax ;ïåðåìåùàåì êóðñîð
1938
      add tl_cur_pos,eax ;ïåðåìåùàåì êóðñîð
1939
      cmp tl_cur_pos,ebx
1939
      cmp tl_cur_pos,ebx
1940
      jl @f
1940
      jl @f
1941
        mov tl_cur_pos,ebx
1941
        mov tl_cur_pos,ebx
1942
      @@:
1942
      @@:
1943
 
1943
 
1944
      add dword[esi+24],eax ;ïåðåìåùàåì ñêðîëëèíã
1944
      add dword[esi+24],eax ;ïåðåìåùàåì ñêðîëëèíã
1945
      cmp dword[esi+24],ecx
1945
      cmp dword[esi+24],ecx
1946
      jl @f
1946
      jl @f
1947
        mov dword[esi+24],ecx
1947
        mov dword[esi+24],ecx
1948
      @@:
1948
      @@:
1949
 
1949
 
1950
      ;ïåðåðèñîâêè îêíà è ñêðîëëèíãà
1950
      ;ïåðåðèñîâêè îêíà è ñêðîëëèíãà
1951
      push dword edi
1951
      push dword edi
1952
      call tl_draw ;draw window
1952
      call tl_draw ;draw window
1953
      push dword esi
1953
      push dword esi
1954
      call scroll_bar_vertical.draw
1954
      call scroll_bar_vertical.draw
1955
    .no_redraw:
1955
    .no_redraw:
1956
  pop esi edi ecx ebx eax
1956
  pop esi edi ecx ebx eax
1957
  pop ebp
1957
  pop ebp
1958
  ret 4
1958
  ret 4
1959
 
1959
 
1960
align 4
1960
align 4
1961
tl_node_close_open: ;îòêðûòü/çàêðûòü óçåë (ðàáîòàåò ñ óçëàìè êîòîðûå èìåþò äî÷åðíèå óçëû)
1961
tl_node_close_open: ;îòêðûòü/çàêðûòü óçåë (ðàáîòàåò ñ óçëàìè êîòîðûå èìåþò äî÷åðíèå óçëû)
1962
  push ebp
1962
  push ebp
1963
  mov ebp,esp
1963
  mov ebp,esp
1964
  push eax edx edi
1964
  push eax edx edi
1965
    mov edi,dword[ebp+8]
1965
    mov edi,dword[ebp+8]
1966
    call tl_get_cur_node_index ;eax = ïîçèöèÿ óçëà íà êîòîðîì ñòîèò êóðñîð
1966
    call tl_get_cur_node_index ;eax = ïîçèöèÿ óçëà íà êîòîðîì ñòîèò êóðñîð
1967
    cmp eax,2 ;êóðñîð ñòîèò íà óçëå ?
1967
    cmp eax,2 ;êóðñîð ñòîèò íà óçëå ?
1968
    jl @f
1968
    jl @f
1969
      imul eax,sizeof.TreeList
1969
      imul eax,sizeof.TreeList
1970
      add eax,tl_data_nodes
1970
      add eax,tl_data_nodes
1971
      ;eax = óêàçàòåëü íà ñòðóêòóðó óçëà âûáðàííîãî êóðñîðîì
1971
      ;eax = óêàçàòåëü íà ñòðóêòóðó óçëà âûáðàííîãî êóðñîðîì
1972
      push dword edi
1972
      push dword edi
1973
      push dword eax
1973
      push dword eax
1974
      call tl_node_poi_get_next_info
1974
      call tl_node_poi_get_next_info
1975
      pop dword edx ;edx = óêàçàòåëü íà ñòðóêòóðó óçëà êîòîðûé èäåò ïîñëå óçëà eax
1975
      pop dword edx ;edx = óêàçàòåëü íà ñòðóêòóðó óçëà êîòîðûé èäåò ïîñëå óçëà eax
1976
      cmp edx,0 ;åñòü ëè óçëû íèæå âûáðàííîãî íàìè ?
1976
      cmp edx,0 ;åñòü ëè óçëû íèæå âûáðàííîãî íàìè ?
1977
      je @f
1977
      je @f
1978
	mov dl,byte[edx+2] ;áåðåì óðîâåíü íèæíåãî óçëà
1978
	mov dl,byte[edx+2] ;áåðåì óðîâåíü íèæíåãî óçëà
1979
	cmp byte[eax+2],dl ;+2 = .lev
1979
	cmp byte[eax+2],dl ;+2 = .lev
1980
	jge @f ;åñëè íèæíèå óçëû ìåíüøåãî óðîâíÿ, çíà÷èò îíè íå äî÷åðíèå, êîíåö ôóíêöèè
1980
	jge @f ;åñëè íèæíèå óçëû ìåíüøåãî óðîâíÿ, çíà÷èò îíè íå äî÷åðíèå, êîíåö ôóíêöèè
1981
	  xor byte[eax+3],1 ;+3 = .clo *** îòêðûòèå/çàêðûòèå óçëà ***
1981
	  xor byte[eax+3],1 ;+3 = .clo *** îòêðûòèå/çàêðûòèå óçëà ***
1982
	  call tb_scrol_resize ;îáðàáîòêà ñêðîëëèíãà
1982
	  call tb_scrol_resize ;îáðàáîòêà ñêðîëëèíãà
1983
 
1983
 
1984
	  push dword edi
1984
	  push dword edi
1985
	  call tl_draw ;îáíîâëåíèå îêíà
1985
	  call tl_draw ;îáíîâëåíèå îêíà
1986
    @@:
1986
    @@:
1987
  pop edi edx eax
1987
  pop edi edx eax
1988
  pop ebp
1988
  pop ebp
1989
  ret 4
1989
  ret 4
1990
 
1990
 
1991
align 4
1991
align 4
1992
tl_node_lev_inc: ;óâåëè÷èòü óðîâåíü
1992
tl_node_lev_inc: ;óâåëè÷èòü óðîâåíü
1993
  push ebp
1993
  push ebp
1994
  mov ebp,esp
1994
  mov ebp,esp
1995
  push eax edx edi
1995
  push eax edx edi
1996
    mov edi,dword[ebp+8]
1996
    mov edi,dword[ebp+8]
1997
    bt tl_style,2 ;tl_list_box_mode
1997
    bt tl_style,2 ;tl_list_box_mode
1998
    jc @f
1998
    jc @f
1999
    call tl_get_cur_node_index ;eax=po_t
1999
    call tl_get_cur_node_index ;eax=po_t
2000
    cmp eax,2
2000
    cmp eax,2
2001
    jl @f
2001
    jl @f
2002
      imul eax,sizeof.TreeList
2002
      imul eax,sizeof.TreeList
2003
      add eax,tl_data_nodes
2003
      add eax,tl_data_nodes
2004
      mov edx,eax
2004
      mov edx,eax
2005
      inc word[edx+2]
2005
      inc word[edx+2]
2006
    @@:
2006
    @@:
2007
  pop edi edx eax
2007
  pop edi edx eax
2008
  pop ebp
2008
  pop ebp
2009
  ret 4
2009
  ret 4
2010
 
2010
 
2011
align 4
2011
align 4
2012
tl_node_lev_dec: ;óìåíüøèòü óðîâåíü
2012
tl_node_lev_dec: ;óìåíüøèòü óðîâåíü
2013
  push ebp
2013
  push ebp
2014
  mov ebp,esp
2014
  mov ebp,esp
2015
  push eax edx edi
2015
  push eax edx edi
2016
    mov edi,dword[ebp+8]
2016
    mov edi,dword[ebp+8]
2017
    call tl_get_cur_node_index ;eax=po_t
2017
    call tl_get_cur_node_index ;eax=po_t
2018
    cmp eax,2
2018
    cmp eax,2
2019
    jl @f
2019
    jl @f
2020
      imul eax,sizeof.TreeList
2020
      imul eax,sizeof.TreeList
2021
      add eax,tl_data_nodes
2021
      add eax,tl_data_nodes
2022
      mov edx,eax
2022
      mov edx,eax
2023
      cmp word[edx+2],0
2023
      cmp word[edx+2],0
2024
      je @f
2024
      je @f
2025
      dec word[edx+2]
2025
      dec word[edx+2]
2026
    @@:
2026
    @@:
2027
  pop edi edx eax
2027
  pop edi edx eax
2028
  pop ebp
2028
  pop ebp
2029
  ret 4
2029
  ret 4
2030
 
2030
 
2031
align 4
2031
align 4
2032
tl_node_move_up: ;ïåðåìåùàåì óçåë ââåðõ
2032
tl_node_move_up: ;ïåðåìåùàåì óçåë ââåðõ
2033
  push ebp
2033
  push ebp
2034
  mov ebp,esp
2034
  mov ebp,esp
2035
  push eax ebx ecx edx edi esi
2035
  push eax ebx ecx edx edi esi
2036
    mov edi,dword[ebp+8]
2036
    mov edi,dword[ebp+8]
2037
    call tl_get_cur_node_index ;eax=po_t
2037
    call tl_get_cur_node_index ;eax=po_t
2038
    cmp eax,2
2038
    cmp eax,2
2039
    jl @f
2039
    jl @f
2040
      mov ebx,eax ;copy index of node struct
2040
      mov ebx,eax ;copy index of node struct
2041
      mov edx,tl_data_nodes
2041
      mov edx,tl_data_nodes
2042
      mov ecx,edx
2042
      mov ecx,edx
2043
      add ecx,sizeof.TreeList
2043
      add ecx,sizeof.TreeList
2044
      imul eax,sizeof.TreeList
2044
      imul eax,sizeof.TreeList
2045
      add eax,edx ;eax = pointer to 2 node struct
2045
      add eax,edx ;eax = pointer to 2 node struct
2046
      mov edx,eax ;edx = pointer to 2 node struct
2046
      mov edx,eax ;edx = pointer to 2 node struct
2047
      mov esi,eax ;esi = pointer to 2 node struct
2047
      mov esi,eax ;esi = pointer to 2 node struct
2048
      call tl_iterat_perv ;edx = pointer to 1 node struct
2048
      call tl_iterat_perv ;edx = pointer to 1 node struct
2049
      call tl_get_node_index ;eax = index of 1 node struct
2049
      call tl_get_node_index ;eax = index of 1 node struct
2050
      cmp edx,ecx
2050
      cmp edx,ecx
2051
      jle @f
2051
      jle @f
2052
        cmp dword[edx+8],ebx ;+8 next
2052
        cmp dword[edx+8],ebx ;+8 next
2053
        jne .po8
2053
        jne .po8
2054
          call tl_node_move_po6 ;óçëû èäóò ïîäðÿä ìåíÿåì 6 ññûëîê
2054
          call tl_node_move_po6 ;óçëû èäóò ïîäðÿä ìåíÿåì 6 ññûëîê
2055
          jmp .cur_mov
2055
          jmp .cur_mov
2056
        .po8:
2056
        .po8:
2057
          call tl_node_move_po8 ;óçëû èäóò íå ïîäðÿä ìåíÿåì 8 ññûëîê
2057
          call tl_node_move_po8 ;óçëû èäóò íå ïîäðÿä ìåíÿåì 8 ññûëîê
2058
        .cur_mov:
2058
        .cur_mov:
2059
          push dword edi
2059
          push dword edi
2060
          call tl_cur_perv
2060
          call tl_cur_perv
2061
          push dword edi
2061
          push dword edi
2062
          call tl_draw
2062
          call tl_draw
2063
    @@:
2063
    @@:
2064
  pop esi edi edx ecx ebx eax
2064
  pop esi edi edx ecx ebx eax
2065
  pop ebp
2065
  pop ebp
2066
  ret 4
2066
  ret 4
2067
 
2067
 
2068
align 4
2068
align 4
2069
tl_node_move_down: ;ïåðåìåùàåì óçåë âíèç
2069
tl_node_move_down: ;ïåðåìåùàåì óçåë âíèç
2070
  push ebp
2070
  push ebp
2071
  mov ebp,esp
2071
  mov ebp,esp
2072
  push eax ebx ecx edx edi esi
2072
  push eax ebx ecx edx edi esi
2073
    mov edi,dword[ebp+8]
2073
    mov edi,dword[ebp+8]
2074
    call tl_get_cur_node_index ;eax=po_t
2074
    call tl_get_cur_node_index ;eax=po_t
2075
    cmp eax,2
2075
    cmp eax,2
2076
    jl @f
2076
    jl @f
2077
      mov ebx,eax ;copy index of node struct
2077
      mov ebx,eax ;copy index of node struct
2078
      mov edx,tl_data_nodes
2078
      mov edx,tl_data_nodes
2079
      mov ecx,edx
2079
      mov ecx,edx
2080
      add ecx,sizeof.TreeList
2080
      add ecx,sizeof.TreeList
2081
      imul eax,sizeof.TreeList
2081
      imul eax,sizeof.TreeList
2082
      add eax,edx ;eax = pointer to 1 node struct
2082
      add eax,edx ;eax = pointer to 1 node struct
2083
      mov edx,eax ;edx = pointer to 1 node struct
2083
      mov edx,eax ;edx = pointer to 1 node struct
2084
      mov esi,eax ;esi = pointer to 1 node struct
2084
      mov esi,eax ;esi = pointer to 1 node struct
2085
      call tl_iterat_next ;edx = pointer to 2 node struct
2085
      call tl_iterat_next ;edx = pointer to 2 node struct
2086
      call tl_get_node_index ;eax = index of 2 node struct
2086
      call tl_get_node_index ;eax = index of 2 node struct
2087
      cmp edx,ecx
2087
      cmp edx,ecx
2088
      jle @f
2088
      jle @f
2089
        cmp dword[esi+8],eax ;+8 next
2089
        cmp dword[esi+8],eax ;+8 next
2090
        jne .po8
2090
        jne .po8
2091
          xchg eax,ebx ;ìåíÿå ïîðÿäîê ñëåäîâàíèÿ çàìåíÿåìûõ óçëîâ
2091
          xchg eax,ebx ;ìåíÿå ïîðÿäîê ñëåäîâàíèÿ çàìåíÿåìûõ óçëîâ
2092
          xchg edx,esi
2092
          xchg edx,esi
2093
          call tl_node_move_po6 ;óçëû èäóò ïîäðÿä ìåíÿåì 6 ññûëîê
2093
          call tl_node_move_po6 ;óçëû èäóò ïîäðÿä ìåíÿåì 6 ññûëîê
2094
          jmp .cur_mov
2094
          jmp .cur_mov
2095
        .po8: ;à òóò ïîðÿäîê ñëåäîâàíèÿ óçëîâ íå ìåíÿåì
2095
        .po8: ;à òóò ïîðÿäîê ñëåäîâàíèÿ óçëîâ íå ìåíÿåì
2096
          call tl_node_move_po8 ;óçëû èäóò íå ïîäðÿä ìåíÿåì 8 ññûëîê
2096
          call tl_node_move_po8 ;óçëû èäóò íå ïîäðÿä ìåíÿåì 8 ññûëîê
2097
        .cur_mov:
2097
        .cur_mov:
2098
          push dword edi
2098
          push dword edi
2099
          call tl_cur_next
2099
          call tl_cur_next
2100
          push dword edi
2100
          push dword edi
2101
          call tl_draw
2101
          call tl_draw
2102
    @@:
2102
    @@:
2103
  pop esi edi edx ecx ebx eax
2103
  pop esi edi edx ecx ebx eax
2104
  pop ebp
2104
  pop ebp
2105
  ret 4
2105
  ret 4
2106
 
2106
 
2107
align 4
2107
align 4
2108
tl_node_move_po6:
2108
tl_node_move_po6:
2109
  mov ecx,edx ;save node pointer
2109
  mov ecx,edx ;save node pointer
2110
  call tl_move_perv
2110
  call tl_move_perv
2111
  mov dword[edx+8],ebx
2111
  mov dword[edx+8],ebx
2112
 
2112
 
2113
  mov edx,esi
2113
  mov edx,esi
2114
  call tl_move_next
2114
  call tl_move_next
2115
  mov dword[edx+4],eax
2115
  mov dword[edx+4],eax
2116
  mov edx,ecx ;restore node pointer
2116
  mov edx,ecx ;restore node pointer
2117
 
2117
 
2118
  ;+4 perv
2118
  ;+4 perv
2119
  mov ecx,dword[edx+4]
2119
  mov ecx,dword[edx+4]
2120
  mov dword[esi+4],ecx
2120
  mov dword[esi+4],ecx
2121
  ;+8 next
2121
  ;+8 next
2122
  mov ecx,dword[esi+8]
2122
  mov ecx,dword[esi+8]
2123
  mov dword[edx+8],ecx
2123
  mov dword[edx+8],ecx
2124
 
2124
 
2125
  mov dword[edx+4],ebx
2125
  mov dword[edx+4],ebx
2126
  mov dword[esi+8],eax
2126
  mov dword[esi+8],eax
2127
  ret
2127
  ret
2128
 
2128
 
2129
;input
2129
;input
2130
;eax = index 1 node struct
2130
;eax = index 1 node struct
2131
;ebx = index 2 node struct
2131
;ebx = index 2 node struct
2132
;edx = pointer 1 node struct
2132
;edx = pointer 1 node struct
2133
;esi = pointer 2 node struct
2133
;esi = pointer 2 node struct
2134
;edi = pointer to 'TreeList' struct
2134
;edi = pointer to 'TreeList' struct
2135
;output:
2135
;output:
2136
;eax = ?
2136
;eax = ?
2137
;ebx = ?
2137
;ebx = ?
2138
;ecx = ?
2138
;ecx = ?
2139
align 4
2139
align 4
2140
tl_node_move_po8:
2140
tl_node_move_po8:
2141
;  push ecx
2141
;  push ecx
2142
  mov ecx,edx ;save node pointer
2142
  mov ecx,edx ;save node pointer
2143
  call tl_move_perv
2143
  call tl_move_perv
2144
  mov dword[edx+8],ebx
2144
  mov dword[edx+8],ebx
2145
  mov edx,ecx
2145
  mov edx,ecx
2146
  call tl_move_next
2146
  call tl_move_next
2147
  mov dword[edx+4],ebx
2147
  mov dword[edx+4],ebx
2148
  mov edx,esi
2148
  mov edx,esi
2149
  call tl_move_perv
2149
  call tl_move_perv
2150
  mov dword[edx+8],eax
2150
  mov dword[edx+8],eax
2151
  mov edx,esi
2151
  mov edx,esi
2152
  call tl_move_next
2152
  call tl_move_next
2153
  mov dword[edx+4],eax
2153
  mov dword[edx+4],eax
2154
  mov edx,ecx ;restore node pointer
2154
  mov edx,ecx ;restore node pointer
2155
;  pop ecx
2155
;  pop ecx
2156
 
2156
 
2157
  ;+4 perv
2157
  ;+4 perv
2158
  mov eax,dword[edx+4]
2158
  mov eax,dword[edx+4]
2159
  mov ebx,dword[esi+4]
2159
  mov ebx,dword[esi+4]
2160
  xchg eax,ebx
2160
  xchg eax,ebx
2161
  mov dword[edx+4],eax
2161
  mov dword[edx+4],eax
2162
  mov dword[esi+4],ebx
2162
  mov dword[esi+4],ebx
2163
  ;+8 next
2163
  ;+8 next
2164
  mov eax,dword[edx+8]
2164
  mov eax,dword[edx+8]
2165
  mov ebx,dword[esi+8]
2165
  mov ebx,dword[esi+8]
2166
  xchg eax,ebx
2166
  xchg eax,ebx
2167
  mov dword[edx+8],eax
2167
  mov dword[edx+8],eax
2168
  mov dword[esi+8],ebx
2168
  mov dword[esi+8],ebx
2169
  ret
2169
  ret
2170
 
2170
 
2171
;input:
2171
;input:
2172
; edi = pointer to 'TreeList' struct
2172
; edi = pointer to 'TreeList' struct
2173
align 4
2173
align 4
2174
tl_draw_caption_cur_pos:
2174
tl_draw_caption_cur_pos:
2175
  cmp tl_capt_cy,9 ;9 - minimum caption height
2175
  cmp tl_capt_cy,9 ;9 - minimum caption height
2176
  jl @f
2176
  jl @f
2177
  push eax ebx ecx edx edi esi
2177
  push eax ebx ecx edx edi esi
2178
    mov ebx,edi ;calculate cursor position
2178
    mov ebx,edi ;calculate cursor position
2179
    mov eax,tl_cur_pos
2179
    mov eax,tl_cur_pos
2180
    inc eax
2180
    inc eax
2181
    lea edi,[txt_capt_cur]
2181
    lea edi,[txt_capt_cur]
2182
    add edi,7
2182
    add edi,7
2183
    call tl_convert_to_str
2183
    call tl_convert_to_str
2184
    mov edi,ebx
2184
    mov edi,ebx
2185
 
2185
 
2186
    mov eax,4 ;draw text captions
2186
    mov eax,4 ;draw text captions
2187
    mov ebx,tl_box_left
2187
    mov ebx,tl_box_left
2188
    shl ebx,16
2188
    shl ebx,16
2189
    add ebx,5*65536+3
2189
    add ebx,5*65536+3
2190
    add ebx,tl_box_top
2190
    add ebx,tl_box_top
2191
    mov ecx,tl_col_txt
2191
    mov ecx,tl_col_txt
2192
    or	ecx,0xc0000000 ;0x40000000 çàêðàøèâàòü ôîí öâåòîì edi
2192
    or	ecx,0xc0000000 ;0x40000000 çàêðàøèâàòü ôîí öâåòîì edi
2193
    lea edx,[txt_capt_cur]
2193
    lea edx,[txt_capt_cur]
2194
    mov edi,tl_col_zag
2194
    mov edi,tl_col_zag
2195
    int 0x40
2195
    int 0x40
2196
 
2196
 
2197
  pop esi edi edx ecx ebx eax
2197
  pop esi edi edx ecx ebx eax
2198
  @@:
2198
  @@:
2199
  ret
2199
  ret
2200
 
2200
 
2201
;input:
2201
;input:
2202
;dword[ebp+ 8] - memory size
2202
;dword[ebp+ 8] - memory size
2203
;dword[ebp+12] - pointer to memory
2203
;dword[ebp+12] - pointer to memory
2204
;dword[ebp+16] - options: 0 - first element, 1 - add next element
2204
;dword[ebp+16] - options: 0 - first element, 1 - add next element
2205
;dword[ebp+20] - pointer to 'TreeList' struct
2205
;dword[ebp+20] - pointer to 'TreeList' struct
2206
;output:
2206
;output:
2207
;dword[ebp+ 8] - error code
2207
;dword[ebp+ 8] - error code
2208
align 4
2208
align 4
2209
tl_save_mem:
2209
tl_save_mem:
2210
  push ebp
2210
  push ebp
2211
  mov ebp,esp
2211
  mov ebp,esp
2212
    push eax ebx ecx edx edi esi
2212
    push eax ebx ecx edx edi esi
2213
    mov esi,dword[ebp+12]
2213
    mov esi,dword[ebp+12]
2214
    mov edi,dword[ebp+20]
2214
    mov edi,dword[ebp+20]
2215
 
2215
 
2216
    cmp dword[ebp+16],0 ;add mode
2216
    cmp dword[ebp+16],0 ;add mode
2217
    je @f
2217
    je @f
2218
      .beg_cycle:
2218
      push dword edi
2219
      cmp dword[esi],0x65657274 ;0x65657274 = 'tree'
-
 
2220
      jne @f
2219
      push dword esi
-
 
2220
      call tl_get_mem_size ;áåðåì ðàçìåð ðàíåå ñîõðàí¸ííûõ äàííûõ
2221
      xor ebx,ebx
2221
      pop ebx
2222
      mov bx,word[esi+4]
-
 
2223
      imul ebx,dword[esi+6]
-
 
2224
      add ebx,tl_save_load_heder_size
-
 
2225
      add esi,ebx
2222
      add esi,ebx
2226
      jmp .beg_cycle
-
 
2227
    @@:
2223
    @@:
2228
 
2224
 
2229
    xor ebx,ebx
2225
    xor ebx,ebx
2230
    mov bx,tl_info_size
2226
    mov bx,tl_info_size
2231
 
2227
 
2232
    call tl_get_node_count_all ;eax = all node count
2228
    call tl_get_node_count_all ;eax = all node count
2233
 
2229
 
2234
    mov ecx,eax  ;âû÷èñëÿåì ñêîëüêî ïàìÿòè äîëæíî áûòü çàïîëíåíî
2230
    mov ecx,eax  ;âû÷èñëÿåì ñêîëüêî ïàìÿòè äîëæíî áûòü çàïîëíåíî
2235
    imul ecx,ebx ;óìíîæàåì íà ðàçìåð ñòðóêòóðû óçëà
2231
    imul ecx,ebx ;óìíîæàåì íà ðàçìåð ñòðóêòóðû óçëà
2236
    add ecx,tl_save_load_heder_size+1 ;element header +1 end element sumbol
2232
    add ecx,tl_save_load_heder_size+1 ;element header +1 end element sumbol
2237
    add ecx,esi  ;äîáàâëÿåì óêàçàòåëü íà íà÷àëî ïàìÿòè (ñ ó÷åòîì ðàíåå çàïèñàííûõ ñòðóêòóð)
2233
    add ecx,esi  ;äîáàâëÿåì óêàçàòåëü íà íà÷àëî ïàìÿòè (ñ ó÷åòîì ðàíåå çàïèñàííûõ ñòðóêòóð)
2238
    sub ecx,dword[ebp+12] ;îòíèìàåì óêàçàòåëü íà íà÷àëî ïàìÿòè (áåç ðàíåå çàïèñàííûõ ñòðóêòóð)
2234
    sub ecx,dword[ebp+12] ;îòíèìàåì óêàçàòåëü íà íà÷àëî ïàìÿòè (áåç ðàíåå çàïèñàííûõ ñòðóêòóð)
2239
    cmp ecx,dword[ebp+8]  ;ecx = element memory size
2235
    cmp ecx,dword[ebp+8]  ;ecx = element memory size
2240
    jg .err_mem_size
2236
    jg .err_mem_size
2241
 
2237
 
2242
    ;save tree params (in header)
2238
    ;save tree params (in header)
2243
    mov dword[esi],0x65657274 ;0x65657274 = 'tree'
2239
    mov dword[esi],0x65657274 ;0x65657274 = 'tree'
2244
    mov word[esi+4],bx
2240
    mov word[esi+4],bx
2245
    mov dword[esi+6],eax ;element count
2241
    mov dword[esi+6],eax ;element count
2246
 
2242
 
2247
    mov eax,tl_style
2243
    mov eax,tl_style
2248
    mov dword[esi+10],eax
2244
    mov dword[esi+10],eax
2249
 
2245
 
2250
    mov eax,tl_cur_pos
2246
    mov eax,tl_cur_pos
2251
    mov dword[esi+14],eax
2247
    mov dword[esi+14],eax
2252
 
2248
 
2253
    mov ax,tl_info_capt_offs
2249
    mov ax,tl_info_capt_offs
2254
    mov word[esi+18],ax
2250
    mov word[esi+18],ax
2255
 
2251
 
2256
    mov ax,tl_info_capt_len
2252
    mov ax,tl_info_capt_len
2257
    mov word[esi+20],ax
2253
    mov word[esi+20],ax
2258
 
2254
 
2259
    ;copy scroll position
2255
    ;copy scroll position
2260
    mov edx,tl_p_scrol
2256
    mov edx,tl_p_scrol
2261
    mov eax,dword[edx+24] ;+24 .position
2257
    mov eax,dword[edx+24] ;+24 .position
2262
    mov dword[esi+22],eax
2258
    mov dword[esi+22],eax
2263
 
2259
 
2264
    add esi,tl_save_load_heder_size ;add header size
2260
    add esi,tl_save_load_heder_size ;add header size
2265
 
2261
 
2266
    ;cycle to nodes
2262
    ;cycle to nodes
2267
    mov edx,tl_data_nodes
2263
    mov edx,tl_data_nodes
2268
    mov ecx,edx
2264
    mov ecx,edx
2269
    add ecx,sizeof.TreeList
2265
    add ecx,sizeof.TreeList
2270
    @@:
2266
    @@:
2271
      call tl_iterat_next_all
2267
      call tl_iterat_next_all
2272
      cmp edx,ecx
2268
      cmp edx,ecx
2273
      jle @f
2269
      jle @f
2274
;save node params
2270
;save node params
2275
call tl_get_node_index ;eax = index of pointer [edx]
2271
call tl_get_node_index ;eax = index of pointer [edx]
2276
mov dword[esi],eax
2272
mov dword[esi],eax
2277
 
2273
 
2278
add esi,4
2274
add esi,4
2279
mov eax,dword[edx] ;eax = (type; lev; clo)
2275
mov eax,dword[edx] ;eax = (type; lev; clo)
2280
mov dword[esi],eax
2276
mov dword[esi],eax
2281
add esi,4
2277
add esi,4
2282
 
2278
 
2283
push dword edi
2279
push dword edi
2284
push dword edx
2280
push dword edx
2285
call tl_node_poi_get_data
2281
call tl_node_poi_get_data
2286
pop dword eax
2282
pop dword eax
2287
 
2283
 
2288
;call tl_node_copy_data
2284
;call tl_node_copy_data
2289
push ecx edi
2285
push ecx edi
2290
  mov edi,eax
2286
  mov edi,eax
2291
  mov ecx,ebx
2287
  mov ecx,ebx
2292
  xchg esi,edi
2288
  xchg esi,edi
2293
  rep movsb
2289
  rep movsb
2294
  mov esi,edi
2290
  mov esi,edi
2295
pop edi ecx
2291
pop edi ecx
2296
;add esi,ebx
2292
;add esi,ebx
2297
      jmp @b
2293
      jmp @b
2298
    @@:
2294
    @@:
2299
    mov byte[esi],0 ;end of 'treelist'
2295
    mov byte[esi],0 ;end of 'treelist'
2300
    mov dword[ebp+20],0 ;return error code
2296
    mov dword[ebp+20],0 ;return error code
2301
    jmp @f
2297
    jmp @f
2302
      .err_mem_size:
2298
      .err_mem_size:
2303
      or dword[ebp+20],tl_err_save_memory_size
2299
      or dword[ebp+20],tl_err_save_memory_size
2304
    @@:
2300
    @@:
2305
    pop esi edi edx ecx ebx eax
2301
    pop esi edi edx ecx ebx eax
2306
  pop ebp
2302
  pop ebp
2307
  ret 12
2303
  ret 12
2308
 
2304
 
2309
;input:
2305
;input:
2310
;dword[ebp+ 8] - memory size
2306
;dword[ebp+ 8] - memory size
2311
;dword[ebp+12] - pointer to memory
2307
;dword[ebp+12] - pointer to memory
2312
;word[ebp+16] - options: element index
2308
;word[ebp+16] - options: element index
2313
;word[ebp+18] - options: 2*(add mode)+(init mode)
2309
;word[ebp+18] - options: 2*(add mode)+(init mode)
2314
;dword[ebp+20] - pointer to 'TreeList' struct
2310
;dword[ebp+20] - pointer to 'TreeList' struct
2315
;output:
2311
;output:
2316
;dword[ebp+ 8] - error code
2312
;dword[ebp+ 8] - error code
2317
align 4
2313
align 4
2318
tl_load_mem:
2314
tl_load_mem:
2319
  push ebp
2315
  push ebp
2320
  mov ebp,esp
2316
  mov ebp,esp
2321
    push eax ebx ecx edx edi esi
2317
    push eax ebx ecx edx edi esi
2322
    mov esi,dword[ebp+12]
2318
    mov esi,dword[ebp+12]
2323
    mov edi,dword[ebp+20]
2319
    mov edi,dword[ebp+20]
2324
 
2320
 
2325
    mov dword[ebp+20],0 ;return error code
2321
    mov dword[ebp+20],0 ;return error code
2326
 
2322
 
2327
    xor ecx,ecx
2323
    xor ecx,ecx
2328
    mov cx,word[ebp+16]
2324
    mov cx,word[ebp+16]
2329
    cmp cx,0 ;load in array mode
2325
    cmp cx,0 ;load in array mode
2330
    je @f
2326
    je @f
-
 
2327
;      push dword edi
-
 
2328
;      push dword esi
-
 
2329
;      call tl_get_mem_size ;áåðåì ðàçìåð ðàíåå ñîõðàí¸ííûõ äàííûõ
-
 
2330
;      pop ebx
-
 
2331
;      add esi,ebx
2331
      .beg_cycle:
2332
      .beg_cycle:
2332
      cmp dword[esi],0x65657274 ;0x65657274 = 'tree'
2333
      cmp dword[esi],0x65657274 ;0x65657274 = 'tree'
2333
      jne .no_tree
2334
      jne .no_tree
2334
      xor ebx,ebx
2335
      xor ebx,ebx
2335
      mov bx,word[esi+4]
2336
      mov bx,word[esi+4]
-
 
2337
      add bx,8
2336
      imul ebx,dword[esi+6]
2338
      imul ebx,dword[esi+6]
2337
      add ebx,tl_save_load_heder_size
2339
      add ebx,tl_save_load_heder_size
2338
      add esi,ebx
2340
      add esi,ebx
2339
      loop .beg_cycle
2341
      loop .beg_cycle
2340
    @@:
2342
    @@:
2341
 
2343
 
2342
    cmp dword[esi],0x65657274 ;0x65657274 = 'tree'
2344
    cmp dword[esi],0x65657274 ;0x65657274 = 'tree'
2343
    jne .no_tree
2345
    jne .no_tree
2344
      bt word[ebp+18],1 ;load in add mode
2346
      bt word[ebp+18],1 ;load in add mode
2345
      jc @f
2347
      jc @f
2346
        push dword edi
2348
        push dword edi
2347
        call tl_info_clear
2349
        call tl_info_clear
2348
      @@:
2350
      @@:
2349
 
2351
 
2350
      xor ebx,ebx
2352
      xor ebx,ebx
2351
      mov bx,word[esi+4] ;info_size
2353
      mov bx,word[esi+4] ;info_size
2352
      cmp bx,tl_info_size
2354
      cmp bx,tl_info_size
2353
      je @f
2355
      je @f
2354
        or dword[ebp+20],tl_err_load_info_size
2356
        or dword[ebp+20],tl_err_load_info_size
2355
      @@:
2357
      @@:
2356
      mov ecx,dword[esi+6] ;count nodes
2358
      mov ecx,dword[esi+6] ;count nodes
2357
      cmp ecx,1
2359
      cmp ecx,1
2358
      jl .end_f
2360
      jl .end_f
2359
      mov edx,esi ;save header pointer
2361
      mov edx,esi ;save header pointer
2360
      add esi,tl_save_load_heder_size
2362
      add esi,tl_save_load_heder_size
2361
 
2363
 
2362
      @@:
2364
      @@:
2363
;load node params
2365
;load node params
2364
push dword edi
2366
push dword edi
2365
mov eax,dword[esi+4]
2367
mov eax,dword[esi+4]
2366
ror eax,16
2368
ror eax,16
2367
push dword eax ;options (type; lev; clo)
2369
push dword eax ;options (type; lev; clo)
2368
add esi,8
2370
add esi,8
2369
push dword esi
2371
push dword esi
2370
call tl_node_add
2372
call tl_node_add
2371
 
2373
 
2372
push dword edi
2374
push dword edi
2373
call tl_cur_next
2375
call tl_cur_next
2374
;...
2376
;...
2375
add esi,ebx
2377
add esi,ebx
2376
        loop @b
2378
        loop @b
2377
 
2379
 
2378
      bt word[ebp+18],1 ;load in add mode
2380
      bt word[ebp+18],1 ;load in add mode
2379
      jc .no_tree
2381
      jc .no_tree
2380
        mov eax,dword[edx+14] ;set cursor pos
2382
        mov eax,dword[edx+14] ;set cursor pos
2381
        mov tl_cur_pos,eax
2383
        mov tl_cur_pos,eax
2382
        mov eax,dword[edx+22] ;set scroll pos
2384
        mov eax,dword[edx+22] ;set scroll pos
2383
        mov ebx,tl_p_scrol
2385
        mov ebx,tl_p_scrol
2384
        cmp ebx,0
2386
        cmp ebx,0
2385
        je .end_f
2387
        je .end_f
2386
          mov dword[ebx+24],eax ;+24 .position
2388
          mov dword[ebx+24],eax ;+24 .position
2387
          push dword ebx ;pointer to scroll struct
2389
          push dword ebx ;pointer to scroll struct
2388
          call scroll_bar_vertical.draw
2390
          call scroll_bar_vertical.draw
2389
 
2391
 
2390
      jmp .end_f
2392
      jmp .end_f
2391
    .no_tree:
2393
    .no_tree:
2392
      mov dword[ebp+20],tl_err_load_caption
2394
      mov dword[ebp+20],tl_err_load_caption
2393
    .end_f:
2395
    .end_f:
2394
    pop esi edi edx ecx ebx eax
2396
    pop esi edi edx ecx ebx eax
2395
  pop ebp
2397
  pop ebp
2396
  ret 12
2398
  ret 12
-
 
2399
 
-
 
2400
;input:
-
 
2401
;dword[ebp+ 8] - pointer to memory
-
 
2402
;dword[ebp+12] - pointer to 'TreeList' struct
-
 
2403
;output:
-
 
2404
;dword[ebp+ 8] - error code
-
 
2405
align 4
-
 
2406
tl_get_mem_size: ;áåðåò ðàçìåð ïàìÿòè çàíÿòîé ôóíêöèåé tl_save_mem ïðè ñîõðàíåíèè ýëåìåíòîâ
-
 
2407
  push ebp
-
 
2408
  mov ebp,esp
-
 
2409
    push ebx edi esi
-
 
2410
    mov esi,dword[ebp+ 8]
-
 
2411
    mov edi,dword[ebp+12]
-
 
2412
    @@:
-
 
2413
      cmp dword[esi],0x65657274 ;0x65657274 = 'tree'
-
 
2414
      jne @f
-
 
2415
      xor ebx,ebx
-
 
2416
      mov bx,word[esi+4]
-
 
2417
      add bx,8 ;ðàçìåð äîïîëíèòåëüíîé èíôîðìàöèè îá óçëå (èíäåêñ çàïèñè; èíäåêñ èêîíêè, óðîâåíü, ...)
-
 
2418
      imul ebx,dword[esi+6]
-
 
2419
      add ebx,tl_save_load_heder_size
-
 
2420
      add esi,ebx
-
 
2421
      jmp @b
-
 
2422
    @@:
-
 
2423
    sub esi,dword[ebp+ 8]
-
 
2424
    mov dword[ebp+12],esi ;âîçâðàùàåì ðàçìåð áëîêà ïàìÿòè
-
 
2425
    pop esi edi edx
-
 
2426
  pop ebp
-
 
2427
  ret 4
-
 
2428
 
2397
 
2429
 
2398
;ascii scan key
2430
;ascii scan key
2399
;  13    28 Enter
2431
;  13    28 Enter
2400
;  32    57 Space
2432
;  32    57 Space
2401
; 178    72 Up
2433
; 178    72 Up
2402
; 177    80 Down
2434
; 177    80 Down
2403
; 176    75 Left
2435
; 176    75 Left
2404
; 179    77 Right
2436
; 179    77 Right
2405
; 182    83 Delete
2437
; 182    83 Delete
2406
; 184    73 Pg Up
2438
; 184    73 Pg Up
2407
; 183    81 Pg Dn
2439
; 183    81 Pg Dn
2408
 
2440
 
2409
tl_key_ascii db 13,32,178,177,176,179,182,184,183
2441
tl_key_ascii db 13,32,178,177,176,179,182,184,183
2410
tl_key_scan  db 28,57, 72, 80, 75, 77, 83, 73, 81
2442
tl_key_scan  db 28,57, 72, 80, 75, 77, 83, 73, 81
2411
 
2443
 
2412
txt_capt_cur db '‘âப       ',0
2444
txt_capt_cur db '‘âப       ',0
2413
txt_capt_otm db 'Žâ¬¥­ë      ',0
2445
txt_capt_otm db 'Žâ¬¥­ë      ',0
2414
 
2446
 
2415
;ýòîò êîä íå ìîé, îí ïðåîáðàçóåò ÷èñëî â ñòðîêó
2447
;ýòîò êîä íå ìîé, îí ïðåîáðàçóåò ÷èñëî â ñòðîêó
2416
;input:
2448
;input:
2417
; eax = value
2449
; eax = value
2418
; edi = string buffer
2450
; edi = string buffer
2419
;output:
2451
;output:
2420
; edi =
2452
; edi =
2421
align 4
2453
align 4
2422
tl_convert_to_str:
2454
tl_convert_to_str:
2423
  pushad
2455
  pushad
2424
    mov dword[edi+1],0x20202020
2456
    mov dword[edi+1],0x20202020
2425
    call .str
2457
    call .str
2426
  popad
2458
  popad
2427
  ret
2459
  ret
2428
 
2460
 
2429
align 4
2461
align 4
2430
.str:
2462
.str:
2431
  mov ecx,0x0a ;çàäàåòñÿ ñèñòåìà ñ÷èñëåíèÿ èçìåíÿþòñÿ ðåãèñòðû ebx,eax,ecx,edx âõîäíûå ïàðàìåòðû eax - ÷èñëî
2463
  mov ecx,0x0a ;çàäàåòñÿ ñèñòåìà ñ÷èñëåíèÿ èçìåíÿþòñÿ ðåãèñòðû ebx,eax,ecx,edx âõîäíûå ïàðàìåòðû eax - ÷èñëî
2432
    ;ïðåðåâîä ÷èñëà â ASCII ñòðîêó âçîäíûå äàííûå ecx=ñèñòåìà ñ÷èñëåíÿ edi àäðåñ êóäà çàïèñûâàòü, áóäåì ñòðîêó, ïðè÷åì êîíåö ïåðåìåííîé 
2464
    ;ïðåðåâîä ÷èñëà â ASCII ñòðîêó âçîäíûå äàííûå ecx=ñèñòåìà ñ÷èñëåíÿ edi àäðåñ êóäà çàïèñûâàòü, áóäåì ñòðîêó, ïðè÷åì êîíåö ïåðåìåííîé 
2433
  cmp eax,ecx  ;ñðàâíèòü åñëè â eax ìåíüøå ÷åì â ecx òî ïåðåéòè íà @@-1 ò.å. íà pop eax
2465
  cmp eax,ecx  ;ñðàâíèòü åñëè â eax ìåíüøå ÷åì â ecx òî ïåðåéòè íà @@-1 ò.å. íà pop eax
2434
  jb @f
2466
  jb @f
2435
  xor edx,edx  ;î÷èñòèòü edx
2467
  xor edx,edx  ;î÷èñòèòü edx
2436
  div ecx      ;ðàçäåëèòü - îñòàòîê â edx
2468
  div ecx      ;ðàçäåëèòü - îñòàòîê â edx
2437
  push edx     ;ïîëîæèòü â ñòåê
2469
  push edx     ;ïîëîæèòü â ñòåê
2438
  ;dec edi             ;ñìåùåíèå íåîáõîäèìîå äëÿ çàïèñè ñ êîíöà ñòðîêè
2470
  ;dec edi             ;ñìåùåíèå íåîáõîäèìîå äëÿ çàïèñè ñ êîíöà ñòðîêè
2439
  call .str;ïåðåéòè íà ñàìó ñåáÿ ò.å. âûçâàòü ñàìó ñåáÿ è òàê äî òîãî ìîìåíòà ïîêà â eax íå ñòàíåò ìåíüøå ÷åì â ecx
2471
  call .str;ïåðåéòè íà ñàìó ñåáÿ ò.å. âûçâàòü ñàìó ñåáÿ è òàê äî òîãî ìîìåíòà ïîêà â eax íå ñòàíåò ìåíüøå ÷åì â ecx
2440
  pop eax
2472
  pop eax
2441
  @@: ;cmp al,10 ;ïðîâåðèòü íå ìåíüøå ëè çíà÷åíèå â al ÷åì 10 (äëÿ ñèñòåìû ñ÷èñëåíÿ 10 äàííàÿ êîìàíäà - ëèøíàÿ))
2473
  @@: ;cmp al,10 ;ïðîâåðèòü íå ìåíüøå ëè çíà÷åíèå â al ÷åì 10 (äëÿ ñèñòåìû ñ÷èñëåíÿ 10 äàííàÿ êîìàíäà - ëèøíàÿ))
2442
  ;sbb al,$69  ;- ÷åñòíî äàííàÿ èíñòðóêöèÿ ìåíÿ çàñòàâëÿåò çàäóìàòüñÿ ò.å. ÿ íå çíàþ êàê ýòî ðàáîòàåò
2474
  ;sbb al,$69  ;- ÷åñòíî äàííàÿ èíñòðóêöèÿ ìåíÿ çàñòàâëÿåò çàäóìàòüñÿ ò.å. ÿ íå çíàþ êàê ýòî ðàáîòàåò
2443
  ;das        ;ïîñëå äàííîé êîìàíäû êàê áû ïðîèñõîäèò óìåíüøåíèå al íà 66h  (â êíèãå íàïèñàíî äðóãîå)
2475
  ;das        ;ïîñëå äàííîé êîìàíäû êàê áû ïðîèñõîäèò óìåíüøåíèå al íà 66h  (â êíèãå íàïèñàíî äðóãîå)
2444
  or al,0x30  ;äàííàÿ êîìàíäà êîðî÷å  ÷åì äâå âûøå 
2476
  or al,0x30  ;äàííàÿ êîìàíäà êîðî÷å  ÷åì äâå âûøå 
2445
  stosb       ;çàïèñàòü ýëåìåíò èç ðåãèñòðà al â ÿ÷åêó ïàìÿòè es:edi
2477
  stosb       ;çàïèñàòü ýëåìåíò èç ðåãèñòðà al â ÿ÷åêó ïàìÿòè es:edi
2446
  ret         ;âåðíóòüñÿ ÷åíü èíòåðåñíûé õîä ò.ê. ïîêà â ñòåêå õðàíèòüñÿ êîë-âî âûçîâîâ òî ñòîëüêî ðàç ìû è áóäåì âûçûâàòüñÿ
2478
  ret         ;âåðíóòüñÿ ÷åíü èíòåðåñíûé õîä ò.ê. ïîêà â ñòåêå õðàíèòüñÿ êîë-âî âûçîâîâ òî ñòîëüêî ðàç ìû è áóäåì âûçûâàòüñÿ
2447
}
2479
}
2448
>
2480
>