Subversion Repositories Kolibri OS

Rev

Rev 539 | Rev 595 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;-----------------------------------------------------------------------------
  2. ; project name:      TINYPAD
  3. ; compiler:          flat assembler 1.67.18
  4. ; memory to compile: 3.0/9.0 MBytes (without/with size optimizations)
  5. ; version:           4.0.4
  6. ; last update:       2007-02-08 (Feb 08, 2007)
  7. ; minimal kernel:    revision #270 (svn://kolibrios.org/kernel)
  8. ;-----------------------------------------------------------------------------
  9. ; originally by:     Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi
  10. ; maintained by:     Mike Semenyako          >> mike.dld@gmail.com
  11. ;                    Ivan Poddubny           >> ivan-yar@bk.ru
  12. ;-----------------------------------------------------------------------------
  13. ; TODO (4.1.0):
  14. ;   - optimize drawing (reduce flickering)
  15. ;   - add vertical selection, undo, goto position, overwrite mode
  16. ;   - improve window drawing with small dimensions
  17. ;   - save settings to ini file, not to executable
  18. ;   - add prompt to save file before closing/opening
  19. ;   - other bug-fixes and speed/size optimizations
  20. ;
  21. ; HISTORY:
  22. ; 4.0.5 (mike.dld and Rus)
  23. ;   bug-fixes:
  24. ;     - a new tab is created when opening a file from folder of tinypad
  25. ; 4.0.4 (mike.dld)
  26. ;   bug-fixes:
  27. ;     - statusbar contained hint after dialog operation cancelled
  28. ;     - small drawing fix for gutter and line saved/modified markers
  29. ;       (incorrect calculations)
  30. ;     - incorrect lines marking on Ctrl+V
  31. ;     - put filename of current tab into open/save dialog (noticed by Maxxxx32)
  32. ;   changes:
  33. ;     - editor and other modifications to ease parts placement changing,
  34. ;       including changes in look
  35. ;     - modified/saved colors now match those in MSVS
  36. ;     - function 70 for *all* file operations (including diamond's fixes)
  37. ;     - use memory manager instead of statically allocated region
  38. ;     - case-insensitive filenames input, to be able to open/save files with
  39. ;       non-latin chars in name (russian etc.)
  40. ;     - reduced flickering (changes checker)
  41. ;     - overall code cleanup
  42. ;   new features:
  43. ;     - recode tables between CP866, CP1251 and KOI8-R (suggested by Victor)
  44. ;     - tabbed interface, ability to open several files in one app instance
  45. ;       (thanks IRC guys for ideas and testing)
  46. ;     - make any tab default to compile it disregarding currently active tab
  47. ;     - configuration dialog (colors, tabs positioning)
  48. ; 4.0.3 (mike.dld)
  49. ;   bug-fixes:
  50. ;     - 1-char selection if pressing <BS> out of real line length
  51. ;     - fault in `writepos`, added call to function 9
  52. ;     - main menu items weren't highlighted if popup opened and cursor
  53. ;       isn't in main menu item's area
  54. ;     - statusbar and textboxes drawing fixes (wrong colors)
  55. ;     - perform no redraw while pressing Shift, Ctrl, Alt keys
  56. ;     - data length from DOCPAK in string representation (fixed by diamond)
  57. ;     - compare file extension case-insensitively (fixed by diamond)
  58. ;   changes:
  59. ;     - function 70 instead of 58 for files loading/saving
  60. ;     - clientarea-relative drawing (less code)
  61. ;     - every line's dword is now splitted into 2 words;
  62. ;       low word - line block length, so max line length is 65535 now
  63. ;       high word - various flags. for now, only 2 of 16 bits are used:
  64. ;         if bit #0 is set, line was modified since file open
  65. ;         if bit #1 is set, line was saved after last modification
  66. ;       high word could also be further used for code collapsing and different
  67. ;         line marking features (breakpoints, errors, bookmarks, etc.)
  68. ;   new features:
  69. ;     - line markers for modified and saved lines
  70. ;     - status messages for various actions
  71. ; 4.0.2 (mike.dld)
  72. ;   bug-fixes:
  73. ;     - program terminates if started with parameters (fine for DOCPAK)
  74. ; 4.0.1 (mike.dld)
  75. ;   bug-fixes:
  76. ;     - unable to run program after exiting from main menu (Alt+X)
  77. ;   new features:
  78. ;     - integration with DOCPAK
  79. ; 4.0 (mike.dld)
  80. ;   bug-fixes:
  81. ;     - main menu popups' "on show" was called only for first shown popup
  82. ;     - clear selection on left/right arrow keys
  83. ;   new features:
  84. ;     - "replace" dialog (w/o "skip", "replace all")
  85. ;     - line numbers display
  86. ;     - options (except "appearance" and "smart tabulation")
  87. ;     - options saving (colors, window position, "Options" popup triggers)
  88. ; 4.0 beta 2 (mike.dld)
  89. ;   bug-fixes:
  90. ;     - unable to start if /rd/1/example.asm is missing (from Halyavin)
  91. ;     - clicking on menu items draws main window in popup (from Rohan)
  92. ;     - passed parameters aren't taken into account (from Mario79)
  93. ;     - background isn't erased if text lines < screen lines after
  94. ;       selection deletion (from Rohan)
  95. ; 4.0 beta 1 (mike.dld)
  96. ;   menu bar and popup menu;
  97. ;     removed buttons from the top and input fields from the bottom since
  98. ;     now they're accesible through main/popup menu;
  99. ;   improved keyboard handling (using 66th function);
  100. ;     support for almost all FASMW keyboard shourtcuts;
  101. ;   added text selection ability, standard selection operations
  102. ;     (copy,cut,paste);
  103. ;   new integrated dialogs (open, save, find)
  104. ;   fix to collapse SPACEs into TABs only for *.asm and *.inc files
  105. ; 3.78a (mike.dld)
  106. ;   fixed termination while typing in x positions higher than (line_length+10);
  107. ;   improved drawing on small heights
  108. ;     don't draw window while its height = 0 (Kolibri "minimize" support)
  109. ; 3.78 (mike.dld)
  110. ;   now lines may be of ANY length;
  111. ;     optimized memory usage (less memory for internal file representation)
  112. ;       after loading file, it's internal size equals to its real size
  113. ;       plus 14 bytes for each line (4 bytes for line length
  114. ;         and 10 spaced to the end - to reduce data relocations count);
  115. ;     completely rewritten keyboard handling;
  116. ;     added horizontal scrollbar;
  117. ;   all line feed formats are supported: WIN(CRLF),*NIX(LF),MAC(CR);
  118. ;   etc.
  119. ; 3.77 (mike.dld)
  120. ;   changed save_string to collapse SPACEs into TABs;
  121. ;   rewrote drawfile from scratch (speed++)
  122. ;     through some drawing improvements  needed
  123. ;     (some checkups to reduce flickering);
  124. ;   writepos (size--);
  125. ;   fixed drawing window while height < 100px, and for non-asm files;
  126. ;   several small fixes; speed/size optimizations
  127. ; 3.76 (mike.dld)
  128. ;   changed loadfile/loadhdfile to expand TABs into SPACEs;
  129. ;   changed TAB,ENTER,DELETE,BSPACE keys behaviour (rewritten from scratch);
  130. ;   vertical scrollbar;
  131. ;   extra window resizing capabilities (added a couple of constants);
  132. ;   completely new text cursor management & moving text cursor with mouse;
  133. ;   improved search function, moving cursor to beginning of text found;
  134. ;   adjustable max line width (change LINE_WIDTH & recompile) // (obsolet)
  135. ; 3.75a
  136. ;   fixed converting char to upper case in read_string
  137. ; 3.75
  138. ;   rewrote save_file from scratch; bugfix in loadfile;
  139. ; 3.74
  140. ;   optimisation
  141. ; 3.73
  142. ;   completly new load_file function
  143. ; 3.72
  144. ;   speed++
  145. ; 3.71
  146. ;   error beep
  147. ; 3.6,3.7:
  148. ;   many bugs fixed
  149. ;   simple toolbar
  150. ;   compile, run applications from TINYPAD, all fasm output is in debug board
  151. ;   TAB button
  152. ;   auto-indent
  153. ;   Ctrl+L - insert comment string
  154. ;-----------------------------------------------------------------------------
  155.  
  156. include 'lang.inc'
  157. include '..\..\..\macros.inc' ; useful stuff
  158. ;include 'proc32.inc'
  159. include 'tinypad.inc'
  160. ;purge mov,add,sub            ;  SPEED
  161.  
  162. header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,self_path
  163.  
  164. APP_VERSION equ '4.0.4'
  165.  
  166. ;include 'debug.inc'
  167. ;define __DEBUG__ 1
  168. ;define __DEBUG_LEVEL__ 1
  169. ;include 'debug-fdo.inc'
  170.  
  171. ASEPC = '-'  ; separator character (char)
  172. ATOPH = 19   ; menu bar height (pixels)
  173. SCRLW = 16   ; scrollbar widht/height (pixels)
  174. ATABW = 8    ; tab key indent width (chars)
  175. LINEH = 10   ; line height (pixels)
  176. PATHL = 256  ; maximum path length (chars) !!! don't change !!!
  177. AMINS = 8    ; minimal scroll thumb size (pixels)
  178. LCHGW = 3    ; changed/saved marker width (pixels)
  179.  
  180. STATH = 16   ; status bar height (pixels)
  181. TBARH = 18   ; tab bar height (pixels)
  182.  
  183. ;-----------------------------------------------------------------------------
  184. section @OPTIONS ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  185. ;-----------------------------------------------------------------------------
  186.  
  187. label color_tbl dword
  188.   .text:       RGB(  0,  0,  0)
  189.   .back:       RGB(255,255,255)
  190.   .text.sel:   RGB(255,255,255)
  191.   .back.sel:   RGB( 10, 36,106)
  192.   .symbol:     RGB( 48, 48,240)
  193.   .number:     RGB(  0,144,  0)
  194.   .string:     RGB(176,  0,  0)
  195.   .comment:    RGB(128,128,128)
  196.   .line.moded: RGB(255,238, 98)
  197.   .line.saved: RGB(108,226,108)
  198.  
  199. ins_mode db 1
  200. tab_pos  db 2
  201.  
  202. options  db OPTS_AUTOINDENT+OPTS_OPTIMSAVE+OPTS_SMARTTAB
  203.  
  204. mainwnd_pos:
  205.   .x dd 250
  206.   .y dd 75
  207.   .w dd 6*80+6+SCRLW+5  ;- 220
  208.   .h dd 402             ;- 220
  209.  
  210. ;-----------------------------------------------------------------------------
  211. section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  212. ;-----------------------------------------------------------------------------
  213.  
  214. ;       fninit
  215.  
  216. ;       stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_left,50
  217. ;       mov     [mainwnd_pos.x],eax
  218. ;       stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_top,50
  219. ;       mov     [mainwnd_pos.y],eax
  220. ;       stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_right,350
  221. ;       sub     eax,[mainwnd_pos.x]
  222. ;       mov     [mainwnd_pos.w],eax
  223. ;       stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_bottom,450
  224. ;       sub     eax,[mainwnd_pos.y]
  225. ;       mov     [mainwnd_pos.h],eax
  226.  
  227.         cld
  228.         mov     edi,@UDATA
  229.         mov     ecx,@PARAMS-@UDATA
  230.         mov     al,0
  231.         rep     stosb
  232.  
  233.         mov     al,[tab_pos]
  234.         mov     [tab_bar.Style],al
  235.  
  236.         mcall   68,11
  237.         or      eax,eax
  238.         jz      key.alt_x.close
  239.  
  240.         mov     eax,65536
  241.         call    mem.Alloc
  242.         mov     [temp_buf],eax
  243.  
  244.         inc     [do_not_draw]
  245.  
  246.         mov     dword[app_start],7
  247.  
  248.         mov     esi,s_example
  249.         mov     edi,tb_opensave.text
  250.         mov     ecx,s_example.size
  251.         mov     [tb_opensave.length],cl
  252.         rep     movsb
  253.  
  254.         mov     esi,s_still
  255.         mov     edi,s_search
  256.         mov     ecx,s_still.size
  257.         mov     [s_search.size],ecx
  258.         rep     movsb
  259.  
  260.         cmp     byte[@PARAMS],0
  261.         jz      no_params
  262.  
  263. ;// Willow's code to support DOCPAK [
  264.  
  265.         cmp     byte[@PARAMS],'*'
  266.         jne     .noipc
  267.  
  268. ;// diamond [ (convert size from decimal representation to dword)
  269. ;--     mov     edx,dword[@PARAMS+1]
  270.         mov     esi,@PARAMS+1
  271.         xor     edx,edx
  272.         xor     eax,eax
  273.     @@: lodsb
  274.         test    al,al
  275.         jz      @f
  276.         lea     edx,[edx*4+edx]
  277.         lea     edx,[edx*2+eax-'0']
  278.         jmp     @b
  279.     @@:
  280. ;// diamond ]
  281.  
  282.         add     edx,20
  283.  
  284.         mov     eax,edx
  285.         call    mem.Alloc
  286.         mov     ebp,eax
  287.         push    eax
  288.  
  289.         mov     dword[ebp+0],0
  290.         mov     dword[ebp+4],8
  291.         mcall   60,1,ebp
  292.         mcall   40,1000000b
  293.  
  294.         mcall   23,200
  295.  
  296.         cmp     eax,7
  297.         jne     key.alt_x.close
  298.         mov     byte[ebp],1
  299.  
  300.         mov     ecx,[ebp+12]
  301.         lea     esi,[ebp+16]
  302.         call    create_tab
  303.         call    load_from_memory
  304.  
  305.         pop     ebp
  306.         mov     eax,ebp
  307.         call    mem.Free
  308.  
  309.         jmp     @f
  310.   .noipc:
  311.  
  312. ;// Willow's code to support DOCPAK ]
  313.  
  314.         mov     esi,@PARAMS
  315.         mov     edi,tb_opensave.text
  316.         mov     ecx,PATHL
  317.         rep     movsb
  318.         mov     edi,tb_opensave.text
  319.         mov     ecx,PATHL
  320.         xor     al,al
  321.         repne   scasb
  322.         jne     key.alt_x.close
  323.         lea     eax,[edi-tb_opensave.text-1]
  324.         mov     [tb_opensave.length],al
  325.         call    load_file
  326.         jnc     @f
  327.  
  328.   no_params:
  329.         call    create_tab
  330.  
  331.     @@:
  332.         mov     [s_status],0
  333.         dec     [do_not_draw]
  334.         mcall   66,1,1
  335.         mcall   40,00100111b
  336. red:
  337.         call    drawwindow
  338.  
  339. ;-----------------------------------------------------------------------------
  340.  
  341. still:
  342.         call    draw_statusbar ; write current position & number of strings
  343.  
  344.   .skip_write:
  345.         mcall   10      ; wait here until event
  346.         cmp     [main_closed],0
  347.         jne     key.alt_x
  348.         dec     eax     ; redraw ?
  349.         jz      red
  350.         dec     eax     ; key ?
  351.         jz      key
  352.         dec     eax     ; button ?
  353.         jz      button
  354.         sub     eax,3   ; mouse ?
  355.         jz      mouse
  356.  
  357.         jmp     still.skip_write
  358.  
  359. ;-----------------------------------------------------------------------------
  360. func start_fasm ;/////////////////////////////////////////////////////////////
  361. ;-----------------------------------------------------------------------------
  362. ; BL = run after compile
  363. ;-----------------------------------------------------------------------------
  364. ; FASM infile,outfile,/path/to/files[,run]
  365. ;-----------------------------------------------------------------------------
  366.         cmp     [cur_editor.AsmMode],0
  367.         jne     @f
  368.         ret
  369.     @@:
  370.         mov     eax,[tab_bar.Default.Ptr]
  371.         or      eax,eax
  372.         jnz     @f
  373.         mov     eax,[tab_bar.Current.Ptr]
  374.     @@: cmp     byte[eax+TABITEM.Editor.FilePath],'/'
  375.         je      @f
  376.         ret
  377.     @@:
  378.         mov     edi,fasm_parameters
  379.         push    eax
  380.  
  381.         cld
  382.  
  383.         lea     esi,[eax+TABITEM.Editor.FilePath]
  384.         add     esi,[eax+TABITEM.Editor.FileName]
  385.         push    esi esi
  386.     @@: lodsb
  387.         cmp     al,0
  388.         je      @f
  389.         stosb
  390.         cmp     al,'.'
  391.         jne     @b
  392.         mov     ecx,esi
  393.         jmp     @b
  394.     @@:
  395.         mov     al,','
  396.         stosb
  397.  
  398.         pop     esi
  399.         sub     ecx,esi
  400.         dec     ecx
  401.         jz      @f
  402.         rep     movsb
  403.     @@:
  404.         mov     al,','
  405.         stosb
  406.  
  407.         pop     ecx esi
  408.         add     esi,TABITEM.Editor.FilePath
  409.         sub     ecx,esi
  410.         rep     movsb
  411.  
  412.         cmp     bl,0 ; run outfile ?
  413.         je      @f
  414.         mov     dword[edi],',run'
  415.         add     edi,4
  416.     @@:
  417.         mov     al,0
  418.         stosb
  419.  
  420.         mov     [app_start.filename],app_fasm
  421.         mov     [app_start.params],fasm_parameters
  422. start_ret:
  423.         mcall   70,app_start
  424.         ret
  425. endf
  426.  
  427. ;-----------------------------------------------------------------------------
  428. func open_debug_board ;///////////////////////////////////////////////////////
  429. ;-----------------------------------------------------------------------------
  430.         mov     [app_start.filename],app_board
  431.         mov     [app_start.params],0
  432.         jmp     start_ret
  433. endf
  434.  
  435. ;-----------------------------------------------------------------------------
  436. func open_sysfuncs_txt ;//////////////////////////////////////////////////////
  437. ;-----------------------------------------------------------------------------
  438.         mov     [app_start.filename],app_docpak
  439.         mov     [app_start.params],sysfuncs_param
  440.         call    start_ret
  441.         cmp     eax,0xfffffff0
  442.         jb      @f
  443.         mov     [app_start.filename],app_tinypad
  444.         mov     [app_start.params],sysfuncs_filename
  445.         call    start_ret
  446.     @@: ret
  447. endf
  448.  
  449. set_opt:
  450.  
  451.   .dialog:
  452.         mov     [bot_mode],1
  453.         mov     [bot_dlg_height],128
  454.         mov     [bot_dlg_handler],optsdlg_handler
  455.         mov     [focused_tb],tb_color
  456.         mov     al,[tb_color.length]
  457.         mov     [tb_color.pos.x],al
  458.         mov     [tb_color.sel.x],0
  459.         mov     [tb_casesen],1
  460.         mov     [cur_part],0
  461.         m2m     [cur_color],dword[color_tbl.text]
  462.         mov     esi,color_tbl
  463.         mov     edi,cur_colors
  464.         mov     ecx,10
  465.         cld
  466.         rep     movsd
  467.         call    drawwindow
  468.         ret
  469.  
  470.   .line_numbers:
  471.         mov     al,OPTS_LINENUMS
  472.         jmp     .main
  473.   .optimal_fill:
  474.         mov     al,OPTS_OPTIMSAVE
  475.         jmp     .main
  476.   .auto_indents:
  477.         mov     al,OPTS_AUTOINDENT
  478.         jmp     .main
  479.   .auto_braces:
  480.         mov     al,OPTS_AUTOBRACES
  481.         jmp     .main
  482.   .secure_sel:
  483.         mov     al,OPTS_SECURESEL
  484.  
  485.   .main:
  486.         xor     [options],al
  487.         ret
  488.  
  489. ;-----------------------------------------------------------------------------
  490.  
  491. include 'tp-defines.inc'
  492.  
  493. include 'tp-draw.asm'
  494. include 'tp-key.asm'
  495. include 'tp-button.asm'
  496. include 'tp-mouse.asm'
  497. include 'tp-files.asm'
  498. include 'tp-common.asm'
  499. include 'tp-dialog.asm'
  500. include 'tp-popup.asm'
  501. include 'tp-tbox.asm'
  502. include 'tp-tabctl.asm'
  503. include 'tp-editor.asm'
  504. include 'tp-recode.asm'
  505.  
  506. ;include 'lib-ini.asm'
  507.  
  508. ;-----------------------------------------------------------------------------
  509. section @DATA ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  510. ;-----------------------------------------------------------------------------
  511.  
  512. vscrl_capt dd -1
  513. hscrl_capt dd -1
  514. body_capt  dd -1
  515.  
  516. key0 db \
  517.   0x00,0x00,0x02,0x03,0x04,0x05,0x06,0x07,\
  518.   0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x00,0x00,\
  519.   0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,\
  520.   0x18,0x19,0x1A,0x1B,0x00,0x00,0x1E,0x1F,\
  521.   0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,\
  522.   0x28,0x29,0x00,0x2B,0x2C,0x2D,0x2E,0x2F,\
  523.   0x30,0x31,0x32,0x33,0x34,0x35,0x00,0x00,\
  524.   0x00,0x39,0x00,0x00,0x00,0x00,0x00,0x00
  525.   times 12*16 db 0x00
  526.  
  527. accel_table_main dd                 \
  528.   0x0000000E,key.bkspace           ,\ ; BackSpace
  529.   0x0000000F,key.tab               ,\ ; Tab
  530.   0x0000001C,key.return            ,\ ; Return
  531.   0x0000003D,key.f3                ,\ ; F3
  532.   0x00000043,key.f9                ,\ ; F9
  533.   0x00000147,key.home              ,\ ; Home
  534.   0x00000148,key.up                ,\ ; Up
  535.   0x00000149,key.pgup              ,\ ; PageUp
  536.   0x0000014B,key.left              ,\ ; Left
  537.   0x0000014D,key.right             ,\ ; Right
  538.   0x0000014F,key.end               ,\ ; End
  539.   0x00000150,key.down              ,\ ; Down
  540.   0x00000151,key.pgdn              ,\ ; PageDown
  541.   0x00000152,key.ins               ,\ ; Insert
  542.   0x00000153,key.del               ,\ ; Delete
  543.   0x00010043,key.shift_f9          ,\ ; Shift+F9
  544.   0x00010147,key.shift_home        ,\ ; Shift+Home
  545.   0x00010148,key.shift_up          ,\ ; Shift+Up
  546.   0x00010149,key.shift_pgup        ,\ ; Shift+PageUp
  547.   0x0001014B,key.shift_left        ,\ ; Shift+Left
  548.   0x0001014D,key.shift_right       ,\ ; Shift+Right
  549.   0x0001014F,key.shift_end         ,\ ; Shift+End
  550.   0x00010150,key.shift_down        ,\ ; Shift+Down
  551.   0x00010151,key.shift_pgdn        ,\ ; Shift+PageDown
  552.   0x00010153,key.del               ,\ ; Shift+Delete
  553.   0x0002000F,key.ctrl_tab          ,\ ; Ctrl+Tab
  554.   0x00020015,key.ctrl_y            ,\ ; Ctrl+Y
  555.   0x00020018,key.ctrl_o            ,\ ; Ctrl+O
  556.   0x0002001E,key.ctrl_a            ,\ ; Ctrl+A
  557.   0x0002001F,key.ctrl_s            ,\ ; Ctrl+S
  558.   0x00020020,key.ctrl_d            ,\ ; Ctrl+D
  559.   0x00020021,key.ctrl_f            ,\ ; Ctrl+F
  560.   0x00020022,key.ctrl_g            ,\ ; Ctrl+G
  561.   0x00020023,key.ctrl_h            ,\ ; Ctrl+H
  562. \;0x00020026,key.ctrl_l            ,\ ; Ctrl+L
  563.   0x0002002D,key.ctrl_x            ,\ ; Ctrl+X
  564.   0x0002002E,key.ctrl_c            ,\ ; Ctrl+C
  565.   0x0002002F,key.ctrl_v            ,\ ; Ctrl+V
  566.   0x00020031,key.ctrl_n            ,\ ; Ctrl+N
  567.   0x0002003E,key.ctrl_f4           ,\ ; Ctrl+F4
  568.   0x00020043,key.ctrl_f9           ,\ ; Ctrl+F9
  569.   0x00020147,key.ctrl_home         ,\ ; Ctrl+Home
  570. \;0x00020148,key.ctrl_up           ,\ ; Ctrl+Up
  571.   0x00020149,key.ctrl_pgup         ,\ ; Ctrl+PageUp
  572.   0x0002014B,key.ctrl_left         ,\ ; Ctrl+Left
  573.   0x0002014D,key.ctrl_right        ,\ ; Ctrl+Right
  574.   0x0002014F,key.ctrl_end          ,\ ; Ctrl+End
  575. \;0x00020150,key.ctrl_down         ,\ ; Ctrl+Down
  576.   0x00020151,key.ctrl_pgdn         ,\ ; Ctrl+PageDown
  577.   0x00020153,key.del               ,\ ; Ctrl+Del
  578.   0x0003000F,key.shift_ctrl_tab    ,\ ; Shift+Ctrl+Tab
  579.   0x0003001F,key.shift_ctrl_s      ,\ ; Shift+Ctrl+S
  580.   0x00030147,key.shift_ctrl_home   ,\ ; Shift+Ctrl+Home
  581. \;0x00030148,key.shift_ctrl_up     ,\ ; Shift+Ctrl+Up
  582.   0x00030149,key.shift_ctrl_pgup   ,\ ; Shift+Ctrl+PageUp
  583.   0x0003014B,key.shift_ctrl_left   ,\ ; Shift+Ctrl+Left
  584.   0x0003014D,key.shift_ctrl_right  ,\ ; Shift+Ctrl+Right
  585.   0x0003014F,key.shift_ctrl_end    ,\ ; Shift+Ctrl+End
  586. \;0x00030150,key.shift_ctrl_down   ,\ ; Shift+Ctrl+Down
  587.   0x00030151,key.shift_ctrl_pgdn   ,\ ; Shift+Ctrl+PageDown
  588.   0x0004002D,key.alt_x             ,\ ; Alt+X
  589.   0
  590.  
  591. accel_table_textbox dd              \
  592. \;0x00000001,key.tb.escape         ,\ ; Escape
  593.   0x0000000E,key.tb.bkspace        ,\ ; BackSpace
  594. \;0x0000000F,key.tb.tab            ,\ ; Tab
  595. \;0x0000001C,key.tb.return         ,\ ; Return
  596.   0x00000147,key.tb.home           ,\ ; Home
  597.   0x0000014B,key.tb.left           ,\ ; Left
  598.   0x0000014D,key.tb.right          ,\ ; Right
  599.   0x0000014F,key.tb.end            ,\ ; End
  600.   0x00000153,key.tb.del            ,\ ; Delete
  601.   0x00010147,key.tb.shift_home     ,\ ; Shift+Home
  602.   0x0001014B,key.tb.shift_left     ,\ ; Shift+Left
  603.   0x0001014D,key.tb.shift_right    ,\ ; Shift+Right
  604.   0x0001014F,key.tb.shift_end      ,\ ; Shift+End
  605.   0x00010153,key.tb.del            ,\ ; Shift+Del
  606.   0
  607.  
  608. accel_table2 dd           \
  609.   1    ,key.alt_x        ,\
  610.   'VSL',btn.vscroll_up   ,\
  611.   'VSG',btn.vscroll_down ,\
  612.   'HSL',btn.hscroll_up   ,\
  613.   'HSG',btn.hscroll_down ,\
  614.   'TBL',btn.tabctl_right ,\
  615.   'TBG',btn.tabctl_left  ,\
  616.   0
  617.  
  618. accel_table2_botdlg dd     \
  619.   1    ,key.alt_x         ,\
  620.   20001,btn.bot.cancel    ,\
  621.   20002,btn.bot.opensave  ,\
  622.   20003,btn.bot.find      ,\
  623.   20004,btn.bot.appearance,\
  624.   21001,btn.bot.tabpos    ,\
  625.   0
  626.  
  627. add_table:
  628.   times $1A db -$20
  629.   times $25 db -$00
  630.   times $10 db -$20
  631.   times $30 db -$00
  632.   times $10 db -$50
  633.   times $04 db -$00,-$01
  634.   times $08 db -$00
  635.  
  636. s_status dd 0
  637.  
  638. @^
  639. fasm_start:
  640.         dd      7
  641.         dd      0
  642.         dd      fasm_parameters
  643.         dd      0
  644.         dd      0
  645.         db      '/sys/DEVELOP/FASM',0
  646. board_start:
  647.         dd      7
  648.         dd      0
  649.         dd      0
  650.         dd      0
  651.         dd      0
  652.         db      '/sys/DEVELOP/BOARD',0
  653. tinypad_start:
  654.         dd      7
  655.         dd      0
  656.         dd      ?
  657.         dd      0
  658.         dd      0
  659.         db      '/sys/TINYPAD',0
  660. docpak_start:
  661.         dd      7
  662.         dd      0
  663.         dd      sysfuncs_param
  664.         dd      0
  665.         dd      0
  666.         db      '/sys/DOCPAK',0
  667. ^@
  668.  
  669. sz app_fasm    ,'/sys/DEVELOP/FASM',0
  670. sz app_board   ,'/sys/DEVELOP/BOARD',0
  671. sz app_tinypad ,'/sys/TINYPAD',0
  672. sz app_docpak  ,'/sys/DOCPAK',0
  673.  
  674. sz sysfuncs_param,'g',0
  675.  
  676. include 'tp-locale.inc'
  677.  
  678. ;// options dialog data [
  679. label optsdlg_editor at $-EDITOR.Bounds
  680. ; rb PATHL     ; FilePath       db PATHL dup(?)
  681. ; dd 0         ; FileName       dd ?
  682.   dd ?,?,?,?   ; Bounds         RECT
  683.   dd @f        ; Lines          dd ?
  684.   dd ?         ; Lines.Size     dd ?
  685.   dd 9         ; Lines.Count    dd ?
  686.   dd 21        ; Columns.Count  dd ?
  687.   dd 0,4       ; Caret          POINT
  688.   dd 100,4     ; SelStart       POINT
  689.   dd 0,0       ; TopLeft        POINT
  690.   dd 0,0       ; VScroll        SCROLLBAR
  691.   dd 0,0       ; HScroll        SCROLLBAR
  692.   dd 0         ; Gutter.Width   dd ?
  693.   db 0         ; Gutter.Visible db ?
  694.   db 1         ; AsmMode        db ?
  695.   db 0         ; Modified       db ?
  696.  
  697. @@:
  698.   dd 0x00000000+1
  699.   db ' '
  700.   dd 0x00010000+9
  701.   db ' org 100h'
  702.   dd 0x00000000+1
  703.   db ' '
  704.   dd 0x00000000+20
  705.   db ' mov ah,09h  ; write'
  706.   dd 0x00000000+12
  707.   db ' mov dx,text'
  708.   dd 0x00000000+8
  709.   db ' int 21h'
  710.   dd 0x00030000+8
  711.   db ' int 20h'
  712.   dd 0x00000000+1
  713.   db ' '
  714.   dd 0x00000000+21
  715.   db ' text db "Hello!",24h'
  716.   dd 0
  717.  
  718. optsdlg_editor_parts:   ; left,top,right,bottom,type
  719.   db 0, 12, 13, 29, 22
  720.   db 0, 12, 33, 47, 42
  721.   db 0, 12, 53, 29, 72
  722.   db 0, 12, 83, 53, 92
  723.   db 2, 12, 43, 77, 52
  724.   db 3,  4, 43,148, 52
  725.   db 4, 48, 33, 53, 42
  726.   db 4,108, 83,113, 92
  727.   db 5, 36, 13, 59, 22
  728.   db 5, 54, 33, 71, 42
  729.   db 5, 36, 53, 53, 72
  730.   db 5,114, 83,131, 92
  731.   db 6, 60, 83,107, 92
  732.   db 7, 84, 33,125, 42
  733.   db 8,  1, 13,  5, 22
  734.   db 9,  1, 63,  5, 72
  735.   db 1,  1,  1,148,105
  736.   db -1
  737. ;// ]
  738.  
  739. sz symbols_ex,';?.%"',"'"
  740. sz symbols   ,'#&*\:/<>|{}()[]=+-, '
  741.  
  742. sz ini_sec_window   ,'Window',0
  743. sz ini_window_top   ,'Top',0
  744. sz ini_window_left  ,'Left',0
  745. sz ini_window_right ,'Right',0
  746. sz ini_window_bottom,'Bottom',0
  747.  
  748. TINYPAD_END:     ; end of file
  749.  
  750. self_path rb PATHL
  751.  
  752. ;-----------------------------------------------------------------------------
  753. section @UDATA ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  754. ;-----------------------------------------------------------------------------
  755.  
  756. app_start:
  757.            dd ?,?
  758.  .params   dd ?
  759.            dd ?,?
  760.            db ?
  761.  .filename dd ?
  762.  
  763. f_info.length dd ?
  764. f_info.path:
  765.     times PATHL+1 db ?
  766. f_info70 rd 7
  767.  
  768. file_info FILEINFO
  769.  
  770. checker_ed    EDITOR
  771. checker_ed_ll dd ?
  772.  
  773. tab_bar      TABCTL
  774. virtual at tab_bar.Current
  775.   cur_tab      TABITEM
  776. end virtual
  777. virtual at tab_bar.Current.Editor
  778.   cur_editor   EDITOR
  779. end virtual
  780.  
  781. lines.scr     dd ?    ; number of lines on the screen
  782. columns.scr   dd ?    ; number of columns on the screen
  783. top_ofs       dd ?    ; height occupied by top buttons
  784. bot_ofs       dd ?    ; height occupied by bottom buttons
  785.               dw ?
  786. left_ofs      dd ?    ;
  787. __rc          dd ?,?,?,?
  788. copy_count    dd ?    ; number of lines for copying (Ctrl+E)
  789. copy_size     dd ?    ; size of data to copy
  790. s_title.size  dd ?    ; caption length
  791.  
  792. cur_line_len  dd ?
  793. h_popup       dd ?
  794. bot_dlg_handler dd ?
  795.  
  796. sel.begin.x   dd ?
  797. sel.begin.y   dd ?
  798. sel.end.x     dd ?
  799. sel.end.y     dd ?
  800. sel.selected  db ?
  801.  
  802. in_sel        db ?
  803.  
  804. do_not_draw   db ?    ; draw top and bottom buttons?
  805. main_closed   db ?    ; main window closed?
  806. tb_casesen    db ?    ; focused textbox is case-sensitive?
  807.  
  808. draw_blines   db ?
  809.  
  810. align 4
  811. s_fname.size  dd ?
  812. s_fname       rb PATHL+1
  813. align 4
  814. s_search.size dd ?
  815. s_search      rb PATHL+1
  816.  
  817. s_title       rb PATHL+11  ; window caption
  818.  
  819. chr db ?
  820. ext db ?
  821. shi dd ?
  822.  
  823. align 4
  824. cl_3d_normal dd ?
  825. cl_3d_pushed dd ?
  826. cl_3d_outset dd ?
  827. cl_3d_inset  dd ?
  828. cl_3d_grayed dd ?
  829.  
  830. tb_color     TBOX
  831. tb_opensave  TBOX
  832. tb_find      TBOX
  833. tb_replace   TBOX
  834. tb_gotorow   TBOX
  835. tb_gotocol   TBOX
  836.  
  837. focused_tb   dd ?
  838.  
  839. key1 rb 256
  840.  
  841. mst  db ?
  842. mst2 db ?
  843. mev  db ?
  844. mouse_captured  db ?
  845. just_from_popup db ?
  846.  
  847. bot_mode db ?
  848.  
  849. align 4
  850.  
  851. bot_dlg_height dd ?
  852. bot_dlg_mode2  db ?
  853.  
  854. temp_buf dd ?
  855. copy_buf dd ?
  856.  
  857. ;-----------------------------------------------------------------------------
  858. section @PARAMS ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  859. ;-----------------------------------------------------------------------------
  860.  
  861. fasm_parameters:
  862.  
  863. p_info  process_information
  864. p_info2 process_information
  865. sc      system_colors
  866.  
  867. rb 1024*4
  868. MAIN_STACK:
  869. rb 1024*4
  870. POPUP_STACK:
  871.  
  872. STATIC_MEM_END:
  873.  
  874. diff10 'Main memory size',0,$
  875.