Rev 7041 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7041 | Rev 7043 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | //Calypte 0.3 - Leency |
1 | //Calypte 0.35 - Leency |
2 | //Calypte 0.15 - Punk Joker |
2 | //Calypte 0.15 - Punk Joker |
Line 3... | Line 3... | ||
3 | 3 | ||
Line 4... | Line 4... | ||
4 | #define MEMSIZE 1024*80 |
4 | #define MEMSIZE 1024*100 |
5 | 5 | ||
6 | #ifndef AUTOBUILD |
6 | #ifndef AUTOBUILD |
Line 17... | Line 17... | ||
17 | #include "../lib/kolibri.h" |
17 | #include "../lib/kolibri.h" |
18 | #include "../lib/file_system.h" |
18 | #include "../lib/file_system.h" |
19 | #include "../lib/gui.h" |
19 | #include "../lib/gui.h" |
20 | #include "../lib/list_box.h" |
20 | #include "../lib/list_box.h" |
21 | #include "../lib/menu.h" |
21 | #include "../lib/menu.h" |
- | 22 | //#include "../lib/collection.h" |
|
- | 23 | ||
Line 22... | Line 24... | ||
22 | 24 | ||
- | 25 | #include "../lib/obj/iconv.h" |
|
23 | #include "../lib/obj/iconv.h" |
26 | #include "../lib/obj/box_lib.h" |
24 | //#include "../lib/obj/box_lib.h" //TO CHECK: boxlib doesn't work well with opendial |
27 | #include "../lib/obj/libio_lib.h" //TO CHECK: why opendial is a peace of shit! |
25 | #include "../lib/obj/proc_lib.h" |
- | |
Line 26... | Line 28... | ||
26 | #include "../lib/obj/libio_lib.h" |
28 | #include "../lib/obj/proc_lib.h" |
Line -... | Line 29... | ||
- | 29 | ||
27 | 30 | #include "../lib/patterns/simple_open_dialog.h" |
|
28 | #include "../lib/patterns/simple_open_dialog.h" |
31 | |
Line 29... | Line 32... | ||
29 | 32 | ||
30 | char default_dir[] = "/rd/1"; |
33 | char default_dir[] = "/rd/1"; |
Line 91... | Line 94... | ||
91 | 94 | ||
92 | #define TOPPANELH 23 |
95 | #define TOPPANELH 23 |
93 | #define BOTPANELH 10 |
96 | #define BOTPANELH 10 |
94 | #define WIN_W 750 |
97 | #define WIN_W 750 |
- | 98 | #define WIN_H 550 |
|
Line 95... | Line 99... | ||
95 | #define WIN_H 550 |
99 | #define SCROLL_SIZE 15 |
96 | 100 | ||
Line 97... | Line 101... | ||
97 | proc_info Form; |
101 | proc_info Form; |
Line 103... | Line 107... | ||
103 | 107 | ||
104 | dword bufpointer; |
108 | dword bufpointer; |
105 | dword bufsize; |
109 | dword bufsize; |
Line -... | Line 110... | ||
- | 110 | dword draw_sruct; |
|
- | 111 | ||
- | 112 | scroll_bar scroll_v = { SCROLL_SIZE,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
|
- | 113 | scroll_bar scroll_h = { SCROLL_SIZE,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
|
- | 114 | ||
106 | dword draw_sruct; |
115 | //collection s; |
107 | 116 | ||
108 | //===================================================// |
117 | //===================================================// |
109 | // // |
118 | // // |
110 | // CODE // |
119 | // CODE // |
Line 111... | Line 120... | ||
111 | // // |
120 | // // |
112 | //===================================================// |
121 | //===================================================// |
113 | 122 | ||
114 | void InitDlls() |
123 | void InitDlls() |
115 | { |
124 | { |
116 | //load_dll(boxlib, #box_lib_init, 0); |
125 | load_dll(boxlib, #box_lib_init, 0); |
117 | load_dll(libio, #libio_init, 1); |
126 | load_dll(libio, #libio_init, 1); |
118 | load_dll(iconv_lib, #iconv_open, 0); |
127 | load_dll(iconv_lib, #iconv_open, 0); |
Line 141... | Line 150... | ||
141 | break; |
150 | break; |
Line 142... | Line 151... | ||
142 | 151 | ||
143 | case evButton: |
152 | case evButton: |
144 | id=GetButtonID(); |
153 | id=GetButtonID(); |
145 | if (id==1) ExitProcess(); |
154 | if (id==1) ExitProcess(); |
146 | if (id==MENU_ID_FILE) menu.show( |
155 | if (id==MENU_ID_FILE) |
147 | Form.left+5 + menu_file_x, |
- | |
148 | Form.top+skin_height + TOPPANELH, |
- | |
149 | 140, |
- | |
150 | #menu_file_list, |
- | |
151 | MENU_ID_FILE); |
- | |
152 | 156 | EventShowMenu(menu_file_x, #menu_file_list, MENU_ID_FILE, NULL); |
|
153 | if (id==MENU_ID_ENCODING) menu.show( |
157 | if (id==MENU_ID_ENCODING) |
154 | Form.left+5 + menu_encoding_x, |
- | |
155 | Form.top+skin_height + TOPPANELH, |
- | |
156 | 120, |
- | |
157 | #menu_encoding_list, |
- | |
158 | MENU_ID_ENCODING); |
- | |
159 | 158 | EventShowMenu(menu_encoding_x, #menu_encoding_list, MENU_ID_ENCODING, encoding+1); |
|
160 | if (id==MENU_ID_REOPEN) menu.show( |
159 | if (id==MENU_ID_REOPEN) |
161 | Form.left+5 + menu_reopen_x, |
- | |
162 | Form.top+skin_height + TOPPANELH, |
- | |
163 | 120, |
- | |
164 | #menu_reopen_list, |
- | |
165 | MENU_ID_REOPEN); |
160 | EventShowMenu(menu_reopen_x, #menu_reopen_list, MENU_ID_REOPEN, NULL); |
Line 166... | Line 161... | ||
166 | break; |
161 | break; |
167 | 162 | ||
168 | case evKey: |
163 | case evKey: |
Line 199... | Line 194... | ||
199 | break; |
194 | break; |
200 | } |
195 | } |
201 | } |
196 | } |
202 | } |
197 | } |
Line 203... | Line 198... | ||
203 | 198 | ||
- | 199 | void ReopenFileIn(dword _app) |
|
- | 200 | { |
|
- | 201 | RunProgram(_app, #param); |
|
- | 202 | } |
|
- | 203 | ||
204 | void ReopenFileIn(dword app) |
204 | void EventShowMenu(dword _menu_item_x, _menu_list, _id, _selected) |
205 | { |
205 | { |
- | 206 | menu.selected = _selected; |
|
- | 207 | menu.show( |
|
- | 208 | Form.left+5 + _menu_item_x, |
|
- | 209 | Form.top+skin_height + TOPPANELH, |
|
- | 210 | 140, |
|
- | 211 | _menu_list, |
|
206 | RunProgram(app, #param); |
212 | _id); |
Line 207... | Line 213... | ||
207 | } |
213 | } |
208 | 214 | ||
209 | void EventOpenFile() |
215 | void EventOpenFile() |
- | 216 | { |
|
210 | { |
217 | OpenDialog_start stdcall (#o_dialog); |
211 | OpenDialog_start stdcall (#o_dialog); |
218 | if (!o_dialog.status) return; |
212 | OpenFile(#openfile_path); |
219 | OpenFile(#openfile_path); |
213 | Prepare(); |
220 | Prepare(); |
Line 214... | Line 221... | ||
214 | draw_window(); |
221 | draw_window(); |
215 | } |
222 | } |
- | 223 | ||
216 | 224 | void EventCloseFile() |
|
217 | void EventCloseFile() |
225 | { |
218 | { |
226 | if (!bufpointer) return; |
219 | strcpy(#win_title, TITLE); |
227 | strcpy(#win_title, TITLE); |
Line 264... | Line 272... | ||
264 | old_width = Form.width; |
272 | old_width = Form.width; |
265 | old_height = Form.height; |
273 | old_height = Form.height; |
Line 266... | Line 274... | ||
266 | 274 | ||
267 | rows.no_selection = true; |
275 | rows.no_selection = true; |
268 | rows.SetFont(8, 14, 0x90); |
276 | rows.SetFont(8, 14, 0x90); |
269 | rows.SetSizes(0, TOPPANELH, Form.cwidth, Form.cheight - TOPPANELH - BOTPANELH, 20); |
277 | rows.SetSizes(0, TOPPANELH, Form.cwidth - SCROLL_SIZE, Form.cheight - TOPPANELH - BOTPANELH, 20); |
Line 270... | Line 278... | ||
270 | rows.column_max = rows.w / rows.font_w; |
278 | rows.column_max = rows.w / rows.font_w; |
271 | 279 | ||
272 | if (bufpointer) Prepare(); |
280 | if (bufpointer) Prepare(); |
273 | rows.CheckDoesValuesOkey(); |
281 | rows.CheckDoesValuesOkey(); |
274 | } |
- | |
275 | if (bufpointer) |
282 | } |
276 | { |
283 | DrawRectangle(rows.x+rows.w-1, rows.y, SCROLL_SIZE, rows.h-1, 0xEEEeee); |
277 | DrawText(); |
- | |
278 | } |
- | |
Line 279... | Line 284... | ||
279 | else DrawBar(0, TOPPANELH, Form.cwidth, Form.cheight-BOTPANELH-TOPPANELH, 0xFFFFFF); |
284 | DrawText(); |
280 | } |
285 | } |
281 | 286 | ||
282 | void OpenFile(dword _path) |
287 | void OpenFile(dword _path) |
Line 299... | Line 304... | ||
299 | } |
304 | } |
Line 300... | Line 305... | ||
300 | 305 | ||
301 | void FreeBuf() |
306 | void FreeBuf() |
302 | { |
307 | { |
- | 308 | int i; |
|
303 | int i; |
309 | if (!bufpointer) return; |
304 | for (i=0; i |
310 | for (i=0; i |
305 | { |
311 | { |
306 | mem_Free(DSDWORD[i*4+draw_sruct]); |
312 | mem_Free(DSDWORD[i*4+draw_sruct]); |
307 | } |
313 | } |
Line 372... | Line 378... | ||
372 | Parse(PARSE_CALCULATE_ROWS_COUNT); |
378 | Parse(PARSE_CALCULATE_ROWS_COUNT); |
373 | } |
379 | } |
Line 374... | Line 380... | ||
374 | 380 | ||
375 | void DrawText() |
381 | void DrawText() |
376 | { |
382 | { |
Line 377... | Line 383... | ||
377 | int i, top; |
383 | int i=0, top; |
378 | 384 | ||
379 | if (rows.count |
385 | if (rows.count |
380 | else |
386 | else |
381 | { |
387 | { |
382 | if (rows.count-rows.first<=rows.visible) top = rows.count-rows.first-1; |
388 | if (rows.count-rows.first<=rows.visible) top = rows.count-rows.first-1; |
Line 383... | Line 389... | ||
383 | else top = rows.visible; |
389 | else top = rows.visible; |
384 | } |
390 | } |
385 | 391 | ||
386 | for (i=0; i |
392 | if (bufpointer) for (i=0; i |
387 | { |
393 | { |
388 | DrawBar(0, i*rows.item_h+TOPPANELH, Form.cwidth, rows.item_h, 0xFFFFFF); |
394 | DrawBar(0, i*rows.item_h+TOPPANELH, rows.w, rows.item_h, 0xFFFFFF); |
- | 395 | WriteText(2, i*rows.item_h+TOPPANELH, 0x90, 0x000000, DSDWORD[i+rows.first*4+draw_sruct]); |
|
- | 396 | } |
|
- | 397 | DrawBar(0, i*rows.item_h+rows.y, rows.w, -i*rows.item_h + rows.h, 0xFFFfff); |
|
- | 398 | DrawVerticalScroll(); |
|
- | 399 | } |
|
- | 400 | ||
- | 401 | void DrawVerticalScroll() |
|
- | 402 | { |
|
- | 403 | scroll_v.max_area = rows.count; |
|
- | 404 | scroll_v.cur_area = rows.visible; |
|
- | 405 | scroll_v.position = rows.first; |
|
- | 406 | scroll_v.start_y = rows.y; |
|
- | 407 | scroll_v.size_y = rows.h; |
|
389 | WriteText(2, i*rows.item_h+TOPPANELH, 0x90, 0x000000, DSDWORD[i+rows.first*4+draw_sruct]); |
408 | scroll_v.start_x = rows.w + rows.x -1; |
Line 390... | Line 409... | ||
390 | } |
409 | scroll_v.all_redraw = 0; |
391 | DrawBar(0, i*rows.item_h+rows.y, rows.w, -i*rows.item_h + rows.h, 0xFFFfff); |
410 | scrollbar_v_draw(#scroll_v); |