Rev 267 | Rev 297 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 267 | Rev 280 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;----------------------------------------------------------------------------- |
1 | ;----------------------------------------------------------------------------- |
2 | ; project name: TINYPAD |
2 | ; project name: TINYPAD |
3 | ; compiler: flat assembler 1.67.15 |
3 | ; compiler: flat assembler 1.67.15 |
4 | ; memory to compile: 2.0/7.0 MBytes (without/with size optimizations) |
4 | ; memory to compile: 2.0/7.0 MBytes (without/with size optimizations) |
5 | ; version: 4.0.4 pre |
5 | ; version: 4.0.4 pre |
6 | ; last update: 2007-01-07 (Jan 7, 2007) |
6 | ; last update: 2007-01-18 (Jan 18, 2007) |
7 | ; minimal kernel: revision #138 (svn://kolibrios.org/kernel) |
7 | ; minimal kernel: revision #270 (svn://kolibrios.org/kernel) |
8 | ;----------------------------------------------------------------------------- |
8 | ;----------------------------------------------------------------------------- |
9 | ; originally by: Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi |
9 | ; originally by: Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi |
10 | ; maintained by: Mike Semenyako >> mike.dld@gmail.com |
10 | ; maintained by: Mike Semenyako >> mike.dld@gmail.com |
11 | ; Ivan Poddubny >> ivan-yar@bk.ru |
11 | ; Ivan Poddubny >> ivan-yar@bk.ru |
12 | ;----------------------------------------------------------------------------- |
12 | ;----------------------------------------------------------------------------- |
Line 15... | Line 15... | ||
15 | ; - add vertical selection, undo, goto position, overwrite mode |
15 | ; - add vertical selection, undo, goto position, overwrite mode |
16 | ; - improve window drawing with small dimensions |
16 | ; - improve window drawing with small dimensions |
17 | ; - other bug-fixes and speed/size optimizations |
17 | ; - other bug-fixes and speed/size optimizations |
18 | ; - save settings to ini file, not to executable |
18 | ; - save settings to ini file, not to executable |
19 | ; |
19 | ; |
20 | ; TODO (FOR 4.0.4, PLANNED FOR 2007-01-21): |
20 | ; TODO (4.0.4, PLANNED FOR 2007-01-21): |
- | 21 | ; normal: |
|
21 | ; - finish tabbed interface (some bug with tab switching) [critical] |
22 | ; - finish tabbed interface (tab switching, Ctrl+F4) |
22 | ; - add memory reallocation to keys handler [critical] |
- | |
23 | ; - rework save_file (memory manager) [critical] |
- | |
24 | ; - fix scrollbars dragging coordinates calculation [critical] |
- | |
25 | ; - fix parameters parsing (incl. DOCPAK) [average] |
- | |
26 | ; - reduce flickering (introduce changes checker) [normal] |
23 | ; - reduce flickering (introduce changes checker) |
27 | ; - fix incorrect saved/modified lines flags on copy/paste [normal] |
24 | ; - compile default file if selected |
- | 25 | ; low: |
|
28 | ; - add prompt to save file before closing/opening [low] |
26 | ; - add prompt to save file before closing/opening |
29 | ; |
27 | ; |
30 | ; HISTORY: |
28 | ; HISTORY: |
31 | ; 4.0.4 pre (mike.dld) |
29 | ; 4.0.4 pre (mike.dld) |
32 | ; bug-fixes: |
30 | ; bug-fixes: |
33 | ; - statusbar contained hint after dialog operation cancelled |
31 | ; - statusbar contained hint after dialog operation cancelled |
34 | ; - small drawing fix for gutter and line saved/modified markers |
32 | ; - small drawing fix for gutter and line saved/modified markers |
- | 33 | ; - incorrect lines marking on Ctrl+V |
|
35 | ; changes: |
34 | ; changes: |
36 | ; - editor and other modifications to ease parts placement changing |
35 | ; - editor and other modifications to ease parts placement changing, |
- | 36 | ; including changes in look |
|
37 | ; - modified/saved colors now match those in MSVS |
37 | ; - modified/saved colors now match those in MSVS |
38 | ; - function 70 for *all* file operations (including diamond's fixes) |
38 | ; - function 70 for *all* file operations (including diamond's fixes) |
39 | ; - use memory manager instead of statically allocated region |
39 | ; - use memory manager instead of statically allocated region |
40 | ; - case-insensitive filenames input, to be able to open/save files with |
40 | ; - case-insensitive filenames input, to be able to open/save files with |
41 | ; non-latin chars in name (russian etc.) |
41 | ; non-latin chars in name (russian etc.) |
42 | ; - overall code cleanup |
42 | ; - overall code cleanup |
43 | ; new features: |
43 | ; new features: |
44 | ; - recode tables between CP866, CP1251 and KOI8-R (suggested by Victor) |
44 | ; - recode tables between CP866, CP1251 and KOI8-R (suggested by Victor) |
45 | ; - tabbed interface, ability to open several files in one app instance |
45 | ; - tabbed interface, ability to open several files in one app instance |
46 | ; (thanks IRC guys for ideas and testing) |
46 | ; (thanks IRC guys for ideas and testing |
- | 47 | ; - make any tab default to compile it disregarding currently active tab |
|
47 | ; 4.0.3 (mike.dld) |
48 | ; 4.0.3 (mike.dld) |
48 | ; bug-fixes: |
49 | ; bug-fixes: |
49 | ; - 1-char selection if pressing |
50 | ; - 1-char selection if pressing |
50 | ; - fault in `writepos`, added call to function 9 |
51 | ; - fault in `writepos`, added call to function 9 |
51 | ; - main menu items weren't highlighted if popup opened and cursor |
52 | ; - main menu items weren't highlighted if popup opened and cursor |
Line 161... | Line 162... | ||
161 | header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,self_path |
162 | header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,self_path |
Line 162... | Line 163... | ||
162 | 163 | ||
Line 163... | Line 164... | ||
163 | APP_VERSION equ '4.0.4 pre' |
164 | APP_VERSION equ '4.0.4 pre' |
- | 165 | ||
- | 166 | ;include 'debug.inc' |
|
- | 167 | ;define __DEBUG__ 1 |
|
Line 164... | Line 168... | ||
164 | 168 | ;define __DEBUG_LEVEL__ 1 |
|
165 | ;include 'debug.inc' |
169 | ;include 'debug-fdo.inc' |
166 | 170 | ||
167 | ASEPC = '-' ; separator character (char) |
171 | ASEPC = '-' ; separator character (char) |
168 | ATOPH = POP_IHEIGHT+2 ; menu bar height (pixels) |
172 | ATOPH = 19 ; menu bar height (pixels) |
169 | SCRLW = 16 ; scrollbar widht/height (pixels) |
173 | SCRLW = 16 ; scrollbar widht/height (pixels) |
170 | ATABW = 8 ; tab width (chars) |
174 | ATABW = 8 ; tab key indent width (chars) |
171 | LINEH = 10 ; line height (pixels) |
175 | LINEH = 10 ; line height (pixels) |
Line 172... | Line 176... | ||
172 | PATHL = 256 ; maximum path length (chars) !!! don't change !!! |
176 | PATHL = 256 ; maximum path length (chars) !!! don't change !!! |
173 | AMINS = 8 ; minimal scroll thumb size (pixels) |
177 | AMINS = 8 ; minimal scroll thumb size (pixels) |
Line 174... | Line 178... | ||
174 | LCHGW = 3 ; changed/saved marker width |
178 | LCHGW = 3 ; changed/saved marker width (pixels) |
175 | 179 | ||
176 | STATH = 16 ; status bar height |
180 | STATH = 16 ; status bar height (pixels) |
Line 197... | Line 201... | ||
197 | options db OPTS_AUTOINDENT+OPTS_OPTIMSAVE+OPTS_SMARTTAB |
201 | options db OPTS_AUTOINDENT+OPTS_OPTIMSAVE+OPTS_SMARTTAB |
Line 198... | Line 202... | ||
198 | 202 | ||
199 | mainwnd_pos: |
203 | mainwnd_pos: |
200 | .x dd 250 |
204 | .x dd 250 |
201 | .y dd 75 |
205 | .y dd 75 |
202 | .w dd 6*80+6+SCRLW+5 |
206 | .w dd 6*80+6+SCRLW+5 ;- 220 |
Line 203... | Line 207... | ||
203 | .h dd 402 |
207 | .h dd 402 ;- 220 |
204 | 208 | ||
205 | ;----------------------------------------------------------------------------- |
209 | ;----------------------------------------------------------------------------- |
Line 233... | Line 237... | ||
233 | 237 | ||
234 | mov eax,65536 |
238 | mov eax,65536 |
235 | call mem.Alloc |
239 | call mem.Alloc |
Line 236... | Line -... | ||
236 | mov [temp_buf],eax |
- | |
237 | - | ||
238 | mov eax,65536 |
- | |
239 | call mem.Alloc |
- | |
240 | mov [cur_editor.Lines],eax |
240 | mov [temp_buf],eax |
Line 241... | Line -... | ||
241 | - | ||
242 | inc [do_not_draw] |
- | |
243 | - | ||
244 | mov [left_ofs],40+1 |
- | |
245 | ; mov [f_info+4],0 |
- | |
246 | ; mov [f_info+12],AREA_TEMP |
241 | |
247 | ; mov [f_info+16],AREA_EDIT-AREA_TEMP |
242 | inc [do_not_draw] |
248 | 243 | ||
249 | mov esi,s_example |
244 | mov esi,s_example |
250 | mov edi,tb_opensave.text |
245 | mov edi,tb_opensave.text |
Line 256... | Line 251... | ||
256 | mov edi,s_search |
251 | mov edi,s_search |
257 | mov ecx,s_still.size |
252 | mov ecx,s_still.size |
258 | mov [s_search.size],ecx |
253 | mov [s_search.size],ecx |
259 | rep movsb |
254 | rep movsb |
Line -... | Line 255... | ||
- | 255 | ||
- | 256 | ; DEBUGF 1,"params: '%s'\n",@PARAMS |
|
260 | 257 | ||
261 | cmp byte[@PARAMS],0 |
258 | cmp byte[@PARAMS],0 |
Line 262... | Line 259... | ||
262 | jz no_params |
259 | jz no_params |
Line 263... | Line 260... | ||
263 | 260 | ||
264 | ;// Willow's code to support DOCPAK [ |
261 | ;// Willow's code to support DOCPAK [ |
Line -... | Line 262... | ||
- | 262 | ||
- | 263 | cmp byte[@PARAMS],'*' |
|
265 | 264 | jne .noipc |
|
266 | cmp byte[@PARAMS],'*' |
265 | |
267 | jne .noipc |
266 | ; DEBUGF 1," started by DOCPAK\n" |
268 | 267 | ||
269 | ;// diamond [ (convert size from decimal representation to dword) |
268 | ;// diamond [ (convert size from decimal representation to dword) |
Line 280... | Line 279... | ||
280 | @@: |
279 | @@: |
281 | ;// diamond ] |
280 | ;// diamond ] |
Line 282... | Line 281... | ||
282 | 281 | ||
Line -... | Line 282... | ||
- | 282 | add edx,20 |
|
- | 283 | ||
283 | add edx,20 |
284 | ; DEBUGF 1," data size (+20) = %d\n",edx |
284 | 285 | ||
285 | mov eax,edx |
286 | mov eax,edx |
- | 287 | call mem.Alloc |
|
- | 288 | mov ebp,eax |
|
- | 289 | push eax |
|
Line 286... | Line 290... | ||
286 | call mem.Alloc |
290 | |
287 | mov ebp,eax |
291 | ; DEBUGF 1," mem.Alloc() returned 0x%x, allocated size = %d\n",eax,[eax-4] |
288 | 292 | ||
289 | ;! mcall 60,1,AREA_TEMP-16 ; 0x10000-16 |
293 | ;! mcall 60,1,AREA_TEMP-16 ; 0x10000-16 |
- | 294 | ;! mov dword[AREA_TEMP-16+4],8 ; [0x10000-16+4],8 |
|
290 | ;! mov dword[AREA_TEMP-16+4],8 ; [0x10000-16+4],8 |
295 | mov dword[ebp+0],0 |
- | 296 | mov dword[ebp+4],8 |
|
- | 297 | mcall 60,1,ebp |
|
291 | mcall 60,1,ebp |
298 | mcall 40,1000000b |
- | 299 | ||
- | 300 | ; DEBUGF 1," got IPC message within 2 secs? " |
|
292 | mov dword[ebp+4],8 |
301 | mcall 23,200 |
293 | mcall 40,1000000b |
302 | ; DEBUGF 1,"%b\n",eax == 7 |
294 | mcall 23,200 |
303 | |
295 | cmp eax,7 |
304 | cmp eax,7 |
296 | jne key.alt_x.close |
305 | jne key.alt_x.close |
297 | ;! mov esi,AREA_TEMP-16 ; 0x10000-16 |
306 | ;! mov esi,AREA_TEMP-16 ; 0x10000-16 |
298 | ;! mov byte[esi],1 |
307 | ;! mov byte[esi],1 |
299 | ;! mov eax,[esi+12] |
308 | ;! mov eax,[esi+12] |
300 | mov byte[ebp],1 |
309 | mov byte[ebp],1 |
Line -... | Line 310... | ||
- | 310 | ;! mov eax,[ebp+12] |
|
- | 311 | ;! inc eax |
|
301 | ;! mov eax,[ebp+12] |
312 | ;! call load_file.file_found |
302 | ;! inc eax |
313 | |
303 | ;! call load_file.file_found |
314 | ; DEBUGF 1," creating new document\n" |
304 | 315 | ||
Line -... | Line 316... | ||
- | 316 | mov ecx,[ebp+12] |
|
305 | mov ecx,[ebp+12] |
317 | lea esi,[ebp+16] |
306 | mov esi,ebp |
318 | call create_tab |
Line -... | Line 319... | ||
- | 319 | call load_from_memory |
|
- | 320 | ||
307 | call create_tab |
321 | pop ebp |
308 | call load_from_memory |
322 | mov eax,ebp |
Line 309... | Line 323... | ||
309 | 323 | call mem.Free |
|
Line 325... | Line 339... | ||
325 | xor al,al |
339 | xor al,al |
326 | repne scasb |
340 | repne scasb |
327 | jne key.alt_x.close |
341 | jne key.alt_x.close |
328 | lea eax,[edi-tb_opensave.text-1] |
342 | lea eax,[edi-tb_opensave.text-1] |
329 | mov [tb_opensave.length],al |
343 | mov [tb_opensave.length],al |
- | 344 | call btn.load_file |
|
- | 345 | jnc @f |
|
Line 330... | Line 346... | ||
330 | 346 | ||
331 | no_params: |
- | |
332 | ;call btn.load_file;do_load_file |
- | |
333 | ;jnc @f |
347 | no_params: |
Line 334... | Line 348... | ||
334 | call create_tab |
348 | call create_tab |
- | 349 | ||
335 | 350 | @@: |
|
336 | @@: |
351 | mov [s_status],0 |
337 | dec [do_not_draw] |
352 | dec [do_not_draw] |
338 | mcall 66,1,1 |
353 | mcall 66,1,1 |
339 | mcall 40,00100111b |
354 | mcall 40,00100111b |
Line 512... | Line 527... | ||
512 | .secure_sel: |
527 | .secure_sel: |
513 | mov al,OPTS_SECURESEL |
528 | mov al,OPTS_SECURESEL |
Line 514... | Line 529... | ||
514 | 529 | ||
515 | .main: |
530 | .main: |
516 | xor [options],al |
- | |
517 | ; test [options],al |
- | |
518 | ; je @f |
- | |
519 | ; not al |
- | |
520 | ; and [options],al |
- | |
521 | ; ret |
- | |
522 | ; @@: or [options],al |
531 | xor [options],al |
Line 523... | Line 532... | ||
523 | ret |
532 | ret |
Line 524... | Line 533... | ||
524 | 533 | ||
Line 576... | Line 585... | ||
576 | 0x0000014F,key.end ,\ ; End |
585 | 0x0000014F,key.end ,\ ; End |
577 | 0x00000150,key.down ,\ ; Down |
586 | 0x00000150,key.down ,\ ; Down |
578 | 0x00000151,key.pgdn ,\ ; PageDown |
587 | 0x00000151,key.pgdn ,\ ; PageDown |
579 | 0x00000152,key.ins ,\ ; Insert |
588 | 0x00000152,key.ins ,\ ; Insert |
580 | 0x00000153,key.del ,\ ; Delete |
589 | 0x00000153,key.del ,\ ; Delete |
- | 590 | 0x00010043,key.shift_f9 ,\ ; Shift+F9 |
|
581 | 0x00010147,key.shift_home ,\ ; Shift+Home |
591 | 0x00010147,key.shift_home ,\ ; Shift+Home |
582 | 0x00010148,key.shift_up ,\ ; Shift+Up |
592 | 0x00010148,key.shift_up ,\ ; Shift+Up |
583 | 0x00010149,key.shift_pgup ,\ ; Shift+PageUp |
593 | 0x00010149,key.shift_pgup ,\ ; Shift+PageUp |
584 | 0x0001014B,key.shift_left ,\ ; Shift+Left |
594 | 0x0001014B,key.shift_left ,\ ; Shift+Left |
585 | 0x0001014D,key.shift_right ,\ ; Shift+Right |
595 | 0x0001014D,key.shift_right ,\ ; Shift+Right |
Line 710... | Line 720... | ||
710 | sz ini_window_top ,'Top',0 |
720 | sz ini_window_top ,'Top',0 |
711 | sz ini_window_left ,'Left',0 |
721 | sz ini_window_left ,'Left',0 |
712 | sz ini_window_right ,'Right',0 |
722 | sz ini_window_right ,'Right',0 |
713 | sz ini_window_bottom,'Bottom',0 |
723 | sz ini_window_bottom,'Bottom',0 |
Line -... | Line 724... | ||
- | 724 | ||
- | 725 | ;include_debug_strings |
|
714 | 726 | ||
Line 715... | Line 727... | ||
715 | TINYPAD_END: ; end of file |
727 | TINYPAD_END: ; end of file |
Line 716... | Line 728... | ||
716 | 728 | ||
Line 744... | Line 756... | ||
744 | __rc dd ?,?,?,? |
756 | __rc dd ?,?,?,? |
745 | copy_count dd ? ; number of lines for copying (Ctrl+E) |
757 | copy_count dd ? ; number of lines for copying (Ctrl+E) |
746 | copy_size dd ? ; size of data to copy |
758 | copy_size dd ? ; size of data to copy |
747 | s_title.size dd ? ; caption length |
759 | s_title.size dd ? ; caption length |
Line 748... | Line -... | ||
748 | - | ||
749 | draw_blines dd ? ; last line to draw |
- | |
750 | 760 | ||
751 | cur_line_len dd ? |
761 | cur_line_len dd ? |
752 | h_popup dd ? |
762 | h_popup dd ? |
Line 753... | Line 763... | ||
753 | bot_dlg_handler dd ? |
763 | bot_dlg_handler dd ? |