Rev 5614 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5614 | Rev 5615 | ||
---|---|---|---|
1 | #ifndef AUTOBUILD |
1 | #ifndef AUTOBUILD |
2 | #include "lang.h--" |
2 | #include "lang.h--" |
3 | #endif |
3 | #endif |
4 | 4 | ||
5 | #define MEMSIZE 0x100000 |
5 | #define MEMSIZE 0x100000 |
6 | #include "..\lib\kolibri.h" |
6 | #include "..\lib\kolibri.h" |
7 | #include "..\lib\strings.h" |
7 | #include "..\lib\strings.h" |
8 | #include "..\lib\mem.h" |
8 | #include "..\lib\mem.h" |
9 | #include "..\lib\file_system.h" |
9 | #include "..\lib\file_system.h" |
10 | #include "..\lib\dll.h" |
10 | #include "..\lib\dll.h" |
11 | #include "..\lib\gui.h" |
11 | #include "..\lib\gui.h" |
- | 12 | #include "..\lib\list_box.h" |
|
- | 13 | ||
12 | #include "..\lib\obj\box_lib.h" |
14 | #include "..\lib\obj\box_lib.h" |
13 | #include "..\lib\obj\proc_lib.h" |
15 | #include "..\lib\obj\proc_lib.h" |
14 | #include "..\lib\obj\libio_lib.h" |
16 | #include "..\lib\obj\libio_lib.h" |
15 | 17 | ||
16 | #ifdef LANG_RUS |
18 | #ifdef LANG_RUS |
17 | ?define T_FILE " ©«" |
19 | ?define T_FILE " ©«" |
18 | ?define T_TYPE "¨¯" |
20 | ?define T_TYPE "¨¯" |
19 | ?define T_SIZE " §¬¥à" |
21 | ?define T_SIZE " §¬¥à" |
20 | ?define MENU1 " ©«" |
22 | ?define MENU1 " ©«" |
21 | ?define MENU1_SUBMENU1 "âªàëâì" |
23 | ?define MENU1_SUBMENU1 "âªàëâì" |
22 | ?define MENU1_SUBMENU2 " ªàëâì" |
24 | ?define MENU1_SUBMENU2 " ªàëâì" |
23 | ?define MENU1_SUBMENU3 "¢®©á⢠" |
25 | ?define MENU1_SUBMENU3 "¢®©á⢠" |
24 | ?define MENU1_SUBMENU4 "ë室" |
26 | ?define MENU1_SUBMENU4 "ë室" |
25 | ?define ERROR_LOAD_BOX_LIB "訡ª ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ - box_lib.obj" |
27 | ?define ERROR_LOAD_BOX_LIB "訡ª ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ - box_lib.obj" |
26 | ?define ERROR_LOAD_LIBIO "訡ª ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ - libio.obj" |
28 | ?define ERROR_LOAD_LIBIO "訡ª ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ - libio.obj" |
27 | ?define ERROR_LOAD_PROC_LIB "訡ª ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ - proc_lib.obj" |
29 | ?define ERROR_LOAD_PROC_LIB "訡ª ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ - proc_lib.obj" |
28 | #else |
30 | #else |
29 | ?define T_FILE "File" |
31 | ?define T_FILE "File" |
30 | ?define T_TYPE "Type" |
32 | ?define T_TYPE "Type" |
31 | ?define T_SIZE "Size" |
33 | ?define T_SIZE "Size" |
32 | ?define MENU1 "File" |
34 | ?define MENU1 "File" |
33 | ?define MENU1_SUBMENU1 "Open" |
35 | ?define MENU1_SUBMENU1 "Open" |
34 | ?define MENU1_SUBMENU2 "Close" |
36 | ?define MENU1_SUBMENU2 "Close" |
35 | ?define MENU1_SUBMENU3 "Properties" |
37 | ?define MENU1_SUBMENU3 "Properties" |
36 | ?define MENU1_SUBMENU4 "Exit" |
38 | ?define MENU1_SUBMENU4 "Exit" |
37 | ?define ERROR_LOAD_BOX_LIB "Error while loading library - box_lib.obj" |
39 | ?define ERROR_LOAD_BOX_LIB "Error while loading library - box_lib.obj" |
38 | ?define ERROR_LOAD_LIBIO "Error while loading library - libio.obj" |
40 | ?define ERROR_LOAD_LIBIO "Error while loading library - libio.obj" |
39 | ?define ERROR_LOAD_PROC_LIB "Error while loading library - proc_lib.obj" |
41 | ?define ERROR_LOAD_PROC_LIB "Error while loading library - proc_lib.obj" |
40 | #endif |
42 | #endif |
41 | 43 | ||
42 | #ifdef LANG_RUS |
44 | #ifdef LANG_RUS |
43 | struct menu_text_struct |
45 | struct menu_text_struct |
44 | { |
46 | { |
45 | char menu[5]; |
47 | char menu[5]; |
46 | char sub_menu1[8]; |
48 | char sub_menu1[8]; |
47 | char sub_menu2[8]; |
49 | char sub_menu2[8]; |
48 | //char sub_menu3[9]; |
50 | //char sub_menu3[9]; |
49 | char sub_menu4[6]; |
51 | char sub_menu4[6]; |
50 | byte end; |
52 | byte end; |
51 | }; |
53 | }; |
52 | #else |
54 | #else |
53 | struct menu_text_struct |
55 | struct menu_text_struct |
54 | { |
56 | { |
55 | char menu[5]; |
57 | char menu[5]; |
56 | char sub_menu1[5]; |
58 | char sub_menu1[5]; |
57 | char sub_menu2[6]; |
59 | char sub_menu2[6]; |
58 | //char sub_menu3[11]; |
60 | //char sub_menu3[11]; |
59 | char sub_menu4[5]; |
61 | char sub_menu4[5]; |
60 | byte end; |
62 | byte end; |
61 | }; |
63 | }; |
62 | #endif |
64 | #endif |
63 | - | ||
64 | #define TITLE "Calypte v0.11" |
- | |
65 | 65 | ||
66 | #define TOPPANELH 19 |
66 | #define TOPPANELH 19 |
67 | #define BOTPANELH 10 |
67 | #define BOTPANELH 10 |
68 | #define WIN_W 600 |
68 | #define WIN_W 600 |
69 | #define WIN_H 400 |
69 | #define WIN_H 400 |
- | 70 | ||
- | 71 | #define TITLE "Calypte v0.12" |
|
70 | 72 | char win_title[4096] = TITLE; |
|
71 | proc_info Form; |
73 | proc_info Form; |
- | 74 | system_colors sc; |
|
- | 75 | dword old_width,old_height; |
|
72 | system_colors sc; |
76 | llist tview; |
73 | 77 | ||
74 | byte active_properties = 0; |
78 | byte active_properties = 0; |
75 | dword properties_window; |
79 | dword properties_window; |
76 | 80 | ||
77 | #include "include\gui.h" |
81 | #include "include\gui.h" |
78 | #include "include\properties.h" |
82 | #include "include\properties.h" |
- | 83 | // #include "include\top_menu.h" |
|
- | 84 | // #include "include\open_dial.h" |
|
79 | 85 | ||
80 | struct filter |
86 | struct filter |
81 | { |
87 | { |
82 | dword size; |
88 | dword size; |
83 | char ext1[4]; |
89 | char ext1[4]; |
84 | //char ext2[4]; |
90 | //char ext2[4]; |
85 | //char ext3[4]; |
91 | //char ext3[4]; |
86 | //char ext4[4]; |
92 | //char ext4[4]; |
87 | byte end; |
93 | byte end; |
88 | }; |
94 | }; |
89 | 95 | ||
90 | filter filter2; |
96 | filter filter2; |
91 | menu_text_struct menu_text_area1; |
97 | menu_text_struct menu_text_area1; |
92 | 98 | ||
93 | char win_title[4096] = "Calypte v0.11"; |
- | |
94 | - | ||
95 | int |
- | |
96 | cur_row=0, |
- | |
97 | read=0, |
- | |
98 | pos=0, |
- | |
99 | row_num=0, |
- | |
100 | col_count=0, |
- | |
101 | row_count=0; |
- | |
102 | 99 | int read=0; |
|
103 | dword old_width,old_height; |
100 | |
104 | 101 | ||
105 | proc_info pr_inf; |
102 | proc_info pr_inf; |
106 | char communication_area_name[] = "FFFFFFFF_open_dialog"; |
103 | char communication_area_name[] = "FFFFFFFF_open_dialog"; |
107 | byte plugin_path[4096]; |
104 | byte plugin_path[4096]; |
108 | char default_dir[] = "/rd/1"; |
105 | char default_dir[] = "/rd/1"; |
109 | char open_dialog_path[] = "/rd/1/File managers/opendial"; //opendial |
106 | char open_dialog_path[] = "/rd/1/File managers/opendial"; //opendial |
110 | byte openfile_path[2048]; |
107 | byte openfile_path[2048]; |
111 | byte filename_area[4096]; |
108 | byte filename_area[4096]; |
112 | 109 | ||
113 | opendialog o_dialog = {0, #pr_inf, #communication_area_name, 0, #plugin_path, #default_dir, #open_dialog_path, #draw_window, 0, #openfile_path, #filename_area, #filter2, 420, 200, 320, 120}; |
110 | opendialog o_dialog = {0, #pr_inf, #communication_area_name, 0, #plugin_path, #default_dir, #open_dialog_path, #draw_window, 0, #openfile_path, #filename_area, #filter2, 420, 200, 320, 120}; |
114 | 111 | ||
115 | dword bufpointer; |
112 | dword bufpointer; |
116 | dword bufsize; |
113 | dword bufsize; |
117 | dword draw_sruct; |
114 | dword draw_sruct; |
118 | 115 | ||
119 | menu_data menudata1 = {0, 40, 2, 15, 2, #menu_text_area1.menu, #menu_text_area1.sub_menu1, #menu_text_area1.end, 0, 0, 80, 2, 100, 18, 0xEEEEEE, 0xFF, 0xEEEEEE, 0, 0, 0, #Form, 0, 0, 0, 16, 0, 0, 0x00CC00, 0, 0xFFFFFF, 0, 8, 0, 0}; |
116 | menu_data menudata1 = {0, 40, 2, 15, 2, #menu_text_area1.menu, #menu_text_area1.sub_menu1, #menu_text_area1.end, 0, 0, 80, 2, 100, 18, 0xEEEEEE, 0xFF, 0xEEEEEE, 0, 0, 0, #Form, 0, 0, 0, 16, 0, 0, 0x00CC00, 0, 0xFFFFFF, 0, 8, 0, 0}; |
120 | 117 | ||
121 | void main() |
118 | void main() |
122 | { |
119 | { |
123 | int id, key; |
120 | int id, key; |
- | 121 | mouse m; |
|
124 | 122 | ||
125 | strcpy(#filter2.ext1, "TXT"); |
123 | strcpy(#filter2.ext1, "TXT"); |
126 | //strcpy(#filter2.ext2, "ASM"); |
124 | //strcpy(#filter2.ext2, "ASM"); |
127 | //strcpy(#filter2.ext3, "INC\0"); |
125 | //strcpy(#filter2.ext3, "INC\0"); |
128 | //strcpy(#filter2.ext4, "\0"); |
126 | //strcpy(#filter2.ext4, "\0"); |
129 | filter2.size = 8; |
127 | filter2.size = 8; |
130 | filter2.end = 0; |
128 | filter2.end = 0; |
131 | 129 | ||
132 | strcpy(#menu_text_area1.menu, MENU1); |
130 | strcpy(#menu_text_area1.menu, MENU1); |
133 | strcpy(#menu_text_area1.sub_menu1, MENU1_SUBMENU1); |
131 | strcpy(#menu_text_area1.sub_menu1, MENU1_SUBMENU1); |
134 | strcpy(#menu_text_area1.sub_menu2, MENU1_SUBMENU2); |
132 | strcpy(#menu_text_area1.sub_menu2, MENU1_SUBMENU2); |
135 | //strcpy(#menu_text_area1.sub_menu3, MENU1_SUBMENU3); |
133 | //strcpy(#menu_text_area1.sub_menu3, MENU1_SUBMENU3); |
136 | strcpy(#menu_text_area1.sub_menu4, MENU1_SUBMENU4); |
134 | strcpy(#menu_text_area1.sub_menu4, MENU1_SUBMENU4); |
137 | menu_text_area1.end = 0; |
135 | menu_text_area1.end = 0; |
138 | 136 | ||
139 | mem_Init(); |
137 | mem_Init(); |
140 | if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(ERROR_LOAD_BOX_LIB); |
138 | if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(ERROR_LOAD_BOX_LIB); |
141 | if (load_dll2(libio, #libio_init,1)!=0) notify(ERROR_LOAD_LIBIO); |
139 | if (load_dll2(libio, #libio_init,1)!=0) notify(ERROR_LOAD_LIBIO); |
142 | if (load_dll2(Proc_lib, #OpenDialog_init,0)!=0) notify(ERROR_LOAD_PROC_LIB); |
140 | if (load_dll2(Proc_lib, #OpenDialog_init,0)!=0) notify(ERROR_LOAD_PROC_LIB); |
143 | OpenDialog_init stdcall (#o_dialog); |
141 | OpenDialog_init stdcall (#o_dialog); |
144 | - | ||
145 | SetEventMask(0x27); |
142 | SetEventMask(0x27); |
146 | loop() |
143 | loop() |
147 | { |
144 | { |
148 | switch(WaitEvent()) |
145 | switch(WaitEvent()) |
149 | { |
146 | { |
150 | case evMouse: |
147 | case evMouse: |
- | 148 | m.get(); |
|
- | 149 | if (tview.MouseScrollNoSelection(m.vert)) DrawText(); |
|
- | 150 | ||
151 | menu_bar_mouse stdcall (#menudata1); |
151 | menu_bar_mouse stdcall (#menudata1); |
152 | if (menudata1.click==1) |
152 | if (menudata1.click) |
153 | { |
153 | { |
154 | switch(menudata1.cursor_out) |
154 | switch(menudata1.cursor_out) |
155 | { |
155 | { |
156 | case 1: |
156 | case 1: |
157 | OpenDialog_start stdcall (#o_dialog); |
157 | OpenDialog_start stdcall (#o_dialog); |
158 | OpenFile(#openfile_path); |
158 | OpenFile(#openfile_path); |
159 | Prepare(); |
159 | Prepare(); |
160 | draw_window(); |
160 | draw_window(); |
161 | break; |
161 | break; |
162 | case 2: |
162 | case 2: |
163 | read = 0; |
163 | read = 0; |
164 | strcpy(#win_title, TITLE); |
164 | strcpy(#win_title, TITLE); |
165 | FreeBuf(); |
165 | FreeBuf(); |
166 | draw_window(); |
166 | draw_window(); |
167 | break; |
167 | break; |
168 | case 3: |
168 | case 3: |
169 | if (!active_properties) |
169 | if (!active_properties) |
170 | { |
170 | { |
171 | SwitchToAnotherThread(); |
171 | SwitchToAnotherThread(); |
172 | properties_window = CreateThread(#properties_dialog, #properties_stak+4092); |
172 | properties_window = CreateThread(#properties_dialog, #properties_stak+4092); |
173 | break; |
173 | break; |
174 | } |
174 | } |
175 | else |
175 | else |
176 | { |
176 | { |
177 | ActivateWindow(GetProcessSlot(properties_window)); |
177 | ActivateWindow(GetProcessSlot(properties_window)); |
178 | } |
178 | } |
179 | break; |
179 | break; |
180 | case 4: |
180 | case 4: |
181 | ExitProcess(); |
181 | ExitProcess(); |
182 | } |
182 | } |
183 | } |
183 | } |
184 | break; |
184 | break; |
185 | 185 | ||
186 | case evButton: |
186 | case evButton: |
187 | id=GetButtonID(); |
187 | id=GetButtonID(); |
188 | if (id==1) || (id==10) ExitProcess(); |
188 | if (id==1) ExitProcess(); |
189 | break; |
189 | break; |
190 | 190 | ||
191 | case evKey: |
191 | case evKey: |
- | 192 | if (Form.status_window>2) break; |
|
192 | key = GetKey(); |
193 | key = GetKey(); |
193 | switch (key) |
194 | switch (key) |
194 | { |
195 | { |
195 | if (Form.status_window>2) break; |
- | |
196 | case 015: //Ctrl+O |
196 | case 015: //Ctrl+O |
197 | OpenDialog_start stdcall (#o_dialog); |
197 | OpenDialog_start stdcall (#o_dialog); |
198 | OpenFile(#openfile_path); |
198 | OpenFile(#openfile_path); |
199 | Prepare(); |
199 | Prepare(); |
200 | draw_window(); |
200 | draw_window(); |
201 | break; |
201 | break; |
202 | case ASCII_KEY_HOME: |
202 | case ASCII_KEY_HOME: |
203 | cur_row = 0; |
- | |
204 | DrawText(); |
- | |
205 | break; |
- | |
206 | case ASCII_KEY_END: |
203 | case ASCII_KEY_END: |
207 | cur_row = row_num - row_count - 1; |
- | |
208 | DrawText(); |
- | |
209 | break; |
- | |
210 | case ASCII_KEY_UP: |
204 | case ASCII_KEY_UP: |
211 | if (!cur_row) break; |
- | |
212 | else cur_row = cur_row-1; |
- | |
213 | DrawText(); |
- | |
214 | break; |
- | |
215 | case ASCII_KEY_DOWN: |
205 | case ASCII_KEY_DOWN: |
216 | if (cur_row+row_count>=row_num) break; |
206 | if (tview.ProcessKey(key)) DrawText(); |
217 | cur_row = cur_row+1; |
- | |
218 | DrawText(); |
- | |
219 | break; |
207 | break; |
220 | case ASCII_KEY_PGUP: |
208 | case ASCII_KEY_PGUP: |
221 | if (!cur_row) break; |
209 | if (!tview.current) break; |
222 | if (cur_row |
210 | if (tview.current |
223 | else cur_row = cur_row-row_count; |
211 | else tview.current = tview.current-tview.visible; |
224 | DrawText(); |
212 | DrawText(); |
225 | break; |
213 | break; |
226 | case ASCII_KEY_PGDN: |
214 | case ASCII_KEY_PGDN: |
227 | if (cur_row+row_count>row_num) break; |
215 | if (tview.current+tview.visible>tview.count) break; |
228 | cur_row = cur_row+row_count; |
216 | tview.current = tview.current+tview.visible; |
229 | DrawText(); |
217 | DrawText(); |
230 | break; |
218 | break; |
231 | } |
219 | } |
232 | break; |
220 | break; |
233 | 221 | ||
234 | case evReDraw: |
222 | case evReDraw: |
235 | draw_window(); |
223 | draw_window(); |
236 | break; |
224 | break; |
237 | } |
225 | } |
238 | } |
226 | } |
239 | } |
227 | } |
240 | 228 | ||
241 | 229 | ||
242 | void draw_window() |
230 | void draw_window() |
243 | { |
231 | { |
244 | sc.get(); |
232 | sc.get(); |
245 | DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2,WIN_W,WIN_H,0x73,0xFFFFFF,#win_title); |
233 | DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2,WIN_W,WIN_H,0x73,0xFFFFFF,#win_title); |
246 | GetProcessInfo(#Form, SelfInfo); |
234 | GetProcessInfo(#Form, SelfInfo); |
- | 235 | if (Form.status_window>2) return; |
|
- | 236 | tview.SetSizes(0, TOPPANELH, Form.cwidth, Form.cheight-BOTPANELH-TOPPANELH, 200, 12); |
|
247 | DrawBar(0, 0, Form.cwidth, TOPPANELH, sc.work); |
237 | DrawBar(0, 0, Form.cwidth, TOPPANELH, sc.work); |
248 | DrawBar(0, Form.cheight-BOTPANELH, Form.cwidth, BOTPANELH, sc.work); |
238 | DrawBar(0, Form.cheight-BOTPANELH, Form.cwidth, BOTPANELH, sc.work); |
249 | 239 | ||
250 | menudata1.bckg_col = sc.work; |
240 | menudata1.bckg_col = sc.work; |
251 | menu_bar_draw stdcall (#menudata1); |
241 | menu_bar_draw stdcall (#menudata1); |
252 | 242 | ||
253 | if (old_width!=Form.width) || (old_height!=Form.height) |
243 | if (old_width!=Form.width) || (old_height!=Form.height) |
254 | { |
244 | { |
255 | old_width = Form.width; |
245 | old_width = Form.width; |
256 | old_height = Form.height; |
246 | old_height = Form.height; |
257 | - | ||
258 | col_count = Form.cwidth/6; |
- | |
259 | row_count = Form.cheight-BOTPANELH-TOPPANELH-2; |
- | |
260 | row_count = row_count/10; |
- | |
261 | - | ||
262 | if (read==1) Prepare(); |
247 | if (read==1) Prepare(); |
- | 248 | tview.debug_values(); |
|
263 | } |
249 | } |
264 | if (read==1) |
250 | if (read==1) |
265 | { |
251 | { |
266 | DrawText(); |
252 | DrawText(); |
267 | } |
253 | } |
268 | else DrawBar(0, TOPPANELH, Form.cwidth, Form.cheight-BOTPANELH-TOPPANELH, 0xFFFFFF); |
254 | else DrawBar(tview.x, tview.y, tview.w, tview.h, 0xFFFFFF); |
269 | } |
255 | } |
270 | 256 | ||
271 | void OpenFile(dword path) |
257 | void OpenFile(dword path) |
272 | { |
258 | { |
273 | strcpy(#win_title, TITLE); |
259 | strcpy(#win_title, TITLE); |
274 | strcat(#win_title, " - "); |
260 | strcat(#win_title, " - "); |
275 | strcat(#win_title, path); |
261 | strcat(#win_title, path); |
276 | file_size stdcall (path); |
262 | file_size stdcall (path); |
277 | bufsize = EBX; |
263 | bufsize = EBX; |
278 | if (bufsize) |
264 | if (bufsize) |
279 | { |
265 | { |
280 | mem_Free(bufpointer); |
266 | mem_Free(bufpointer); |
281 | bufpointer = mem_Alloc(bufsize); |
267 | bufpointer = mem_Alloc(bufsize); |
282 | ReadFile(0, bufsize, bufpointer, path); |
268 | ReadFile(0, bufsize, bufpointer, path); |
283 | read=1; |
269 | read=1; |
284 | } |
270 | } |
285 | } |
271 | } |
286 | 272 | ||
287 | void FreeBuf() |
273 | void FreeBuf() |
288 | { |
274 | { |
289 | int i; |
275 | int i; |
290 | for (i=0; i |
276 | for (i=0; i |
291 | { |
277 | { |
292 | mem_Free(DSDWORD[i*4+draw_sruct]); |
278 | mem_Free(DSDWORD[i*4+draw_sruct]); |
293 | } |
279 | } |
294 | mem_Free(draw_sruct); |
280 | mem_Free(draw_sruct); |
295 | mem_Free(bufpointer); |
281 | mem_Free(bufpointer); |
296 | } |
282 | } |
297 | 283 | ||
298 | void Prepare() |
284 | void Prepare() |
299 | { |
285 | { |
300 | int i, sub_pos; |
286 | int i, sub_pos; |
- | 287 | static int cur_pos; |
|
301 | int len_str = 0; |
288 | int len_str = 0; |
302 | byte do_eof = 0; |
289 | byte do_eof = 0; |
303 | word bukva[2]; |
290 | word bukva[2]; |
304 | dword address; |
291 | dword address; |
305 | row_num = 0; |
292 | tview.count = 0; |
306 | while(1) |
293 | while(1) |
307 | { |
294 | { |
308 | while(1) |
295 | while(1) |
309 | { |
296 | { |
310 | bukva = DSBYTE[bufpointer+pos+len_str]; |
297 | bukva = DSBYTE[bufpointer+cur_pos+len_str]; |
311 | if (bukva=='\0') |
298 | if (bukva=='\0') |
312 | { |
299 | { |
313 | do_eof = 1; |
300 | do_eof = 1; |
314 | break; |
301 | break; |
315 | } |
302 | } |
316 | if (bukva==0x0a) break; |
303 | if (bukva==0x0a) break; |
317 | else len_str++; |
304 | else len_str++; |
318 | } |
305 | } |
319 | if (len_str<=col_count) |
306 | if (len_str<=tview.column_max) |
320 | { |
307 | { |
321 | pos=pos+len_str+1; |
308 | cur_pos=cur_pos+len_str+1; |
322 | row_num++; |
309 | tview.count++; |
323 | } |
310 | } |
324 | else |
311 | else |
325 | { |
312 | { |
326 | pos=pos+col_count; |
313 | cur_pos=cur_pos+tview.column_max; |
327 | row_num++; |
314 | tview.count++; |
328 | } |
315 | } |
329 | len_str = 0; |
316 | len_str = 0; |
330 | if (do_eof) break; |
317 | if (do_eof) break; |
331 | } |
318 | } |
332 | mem_Free(draw_sruct); |
319 | mem_Free(draw_sruct); |
333 | draw_sruct = mem_Alloc(row_num*4); |
320 | draw_sruct = mem_Alloc(tview.count*4); |
334 | pos=0; |
321 | cur_pos=0; |
335 | sub_pos=0; |
322 | sub_pos=0; |
336 | len_str = 0; |
323 | len_str = 0; |
337 | do_eof = 0; |
324 | do_eof = 0; |
338 | while(1) |
325 | while(1) |
339 | { |
326 | { |
340 | while(1) |
327 | while(1) |
341 | { |
328 | { |
342 | bukva = DSBYTE[bufpointer+pos+len_str]; |
329 | bukva = DSBYTE[bufpointer+cur_pos+len_str]; |
343 | if (bukva=='\0') |
330 | if (bukva=='\0') |
344 | { |
331 | { |
345 | do_eof = 1; |
332 | do_eof = 1; |
346 | break; |
333 | break; |
347 | } |
334 | } |
348 | if (bukva==0x0a) break; |
335 | if (bukva==0x0a) break; |
349 | else len_str++; |
336 | else len_str++; |
350 | } |
337 | } |
351 | if (len_str<=col_count) |
338 | if (len_str<=tview.column_max) |
352 | { |
339 | { |
353 | address = mem_Alloc(len_str+1); |
340 | address = mem_Alloc(len_str+1); |
354 | ESDWORD[sub_pos*4+draw_sruct] = address; |
341 | ESDWORD[sub_pos*4+draw_sruct] = address; |
355 | strlcpy(DSDWORD[sub_pos*4+draw_sruct], bufpointer+pos, len_str); |
342 | strlcpy(DSDWORD[sub_pos*4+draw_sruct], bufpointer+cur_pos, len_str); |
356 | pos=pos+len_str+1; |
343 | cur_pos=cur_pos+len_str+1; |
357 | sub_pos++; |
344 | sub_pos++; |
358 | } |
345 | } |
359 | else |
346 | else |
360 | { |
347 | { |
361 | address = mem_Alloc(len_str+1); |
348 | address = mem_Alloc(len_str+1); |
362 | ESDWORD[sub_pos*4+draw_sruct] = address; |
349 | ESDWORD[sub_pos*4+draw_sruct] = address; |
363 | strlcpy(DSDWORD[sub_pos*4+draw_sruct], bufpointer+pos, col_count); |
350 | strlcpy(DSDWORD[sub_pos*4+draw_sruct], bufpointer+cur_pos, tview.column_max); |
364 | pos=pos+col_count; |
351 | cur_pos=cur_pos+tview.column_max; |
365 | sub_pos++; |
352 | sub_pos++; |
366 | } |
353 | } |
367 | len_str = 0; |
354 | len_str = 0; |
368 | if (pos>=bufsize-1) break; |
355 | if (cur_pos>=bufsize-1) break; |
369 | } |
356 | } |
370 | pos=0; |
357 | cur_pos=0; |
371 | } |
358 | } |
372 | 359 | ||
373 | void DrawText() |
360 | void DrawText() |
374 | { |
361 | { |
375 | int i, top, num_line; |
362 | int i, top, num_line; |
376 | if (row_num |
363 | if (tview.count |
377 | else |
364 | else |
378 | { |
365 | { |
379 | if (row_num-cur_row<=row_count) top = row_num-cur_row-1; |
366 | if (tview.count-tview.current<=tview.visible) top = tview.count-tview.current-1; |
380 | else top = row_count; |
367 | else top = tview.visible; |
381 | } |
368 | } |
382 | DrawBar(0, TOPPANELH, Form.cwidth, 3, 0xFFFFFF); |
369 | DrawBar(tview.x, tview.y, tview.w, 3, 0xFFFFFF); |
383 | for (i=0, num_line = cur_row; i |
370 | for (i=0, num_line = tview.current; i |
384 | { |
371 | { |
385 | DrawBar(0, i*10+TOPPANELH+3, Form.cwidth, 10, 0xFFFFFF); |
372 | DrawBar(tview.x, i * tview.line_h + tview.y + 3, tview.w, tview.line_h, 0xFFFFFF); |
386 | WriteText(2, i*10+TOPPANELH+3, 0x80, 0x000000, DSDWORD[num_line*4+draw_sruct]); |
373 | WriteText(tview.x + 2, i * tview.line_h + tview.y + 3, 0x80, 0x000000, DSDWORD[num_line*4+draw_sruct]); |
387 | } |
374 | } |
388 | DrawBar(0, i*10+TOPPANELH+3, Form.cwidth, -i*10-TOPPANELH-BOTPANELH+Form.cheight, 0xFFFFFF); |
375 | DrawBar(0, i * tview.line_h + tview.y + 3, tview.w, -i* tview.line_h + tview.h, 0xFFFFFF); |
389 | } |
376 | } |
390 | 377 | ||
391 | stop: |
378 | stop: |
392 | char properties_stak[4096];=row_count)>=col_count) |
379 | char properties_stak[4096];=tview.visible)>=tview.column_max) |
393 | >=col_count) |
380 | >=tview.column_max) |
394 | > |
381 | > |