Subversion Repositories Kolibri OS

Rev

Rev 267 | Rev 297 | 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.15
  4. ; memory to compile: 2.0/7.0 MBytes (without/with size optimizations)
  5. ; version:           4.0.4 pre
  6. ; last update:       2007-01-18 (Jan 18, 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 (FOR 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. ;   - other bug-fixes and speed/size optimizations
  18. ;   - save settings to ini file, not to executable
  19. ;
  20. ; TODO (4.0.4, PLANNED FOR 2007-01-21):
  21. ;   normal:
  22. ;     - finish tabbed interface (tab switching, Ctrl+F4)
  23. ;     - reduce flickering (introduce changes checker)
  24. ;     - compile default file if selected
  25. ;   low:
  26. ;     - add prompt to save file before closing/opening
  27. ;
  28. ; HISTORY:
  29. ; 4.0.4 pre (mike.dld)
  30. ;   bug-fixes:
  31. ;     - statusbar contained hint after dialog operation cancelled
  32. ;     - small drawing fix for gutter and line saved/modified markers
  33. ;     - incorrect lines marking on Ctrl+V
  34. ;   changes:
  35. ;     - editor and other modifications to ease parts placement changing,
  36. ;       including changes in look
  37. ;     - modified/saved colors now match those in MSVS
  38. ;     - function 70 for *all* file operations (including diamond's fixes)
  39. ;     - use memory manager instead of statically allocated region
  40. ;     - case-insensitive filenames input, to be able to open/save files with
  41. ;       non-latin chars in name (russian etc.)
  42. ;     - overall code cleanup
  43. ;   new features:
  44. ;     - recode tables between CP866, CP1251 and KOI8-R (suggested by Victor)
  45. ;     - tabbed interface, ability to open several files in one app instance
  46. ;       (thanks IRC guys for ideas and testing
  47. ;     - make any tab default to compile it disregarding currently active tab
  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 pre'
  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.   RGB(  0,  0,  0) ; RGB(  0,  0,  0) ; RGB(  0,  0,  0) ; text
  189.   RGB(  0,144,  0) ; RGB(  0,160,  0) ; RGB(  0,144,  0) ; numbers
  190.   RGB(176,  0,  0) ; RGB(  0,128,255) ; RGB(160,  0,  0) ; strings
  191.   RGB(128,128,128) ; RGB(160,160,160) ; RGB(144,144,144) ; comments
  192.   RGB( 48, 48,240) ; RGB(255,  0,  0) ; RGB( 48, 48,240) ; symbols
  193.   RGB(255,255,255) ; RGB(255,255,255) ; RGB(224,224,224) ; background
  194.   RGB(255,255,255) ; RGB(255,255,255) ; RGB(255,255,255) ; selection text
  195.   RGB( 10, 36,106) ; RGB(  0, 64,128) ; RGB(  0,  0,128) ; selection background
  196.   RGB(255,238, 98) ; modified line marker
  197.   RGB(108,226,108) ; saved line marker
  198.  
  199. ins_mode db 1
  200.  
  201. options  db OPTS_AUTOINDENT+OPTS_OPTIMSAVE+OPTS_SMARTTAB
  202.  
  203. mainwnd_pos:
  204.   .x dd 250
  205.   .y dd 75
  206.   .w dd 6*80+6+SCRLW+5  ;- 220
  207.   .h dd 402             ;- 220
  208.  
  209. ;-----------------------------------------------------------------------------
  210. section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  211. ;-----------------------------------------------------------------------------
  212.  
  213. ;       fninit
  214.  
  215. ;       stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_left,50
  216. ;       mov     [mainwnd_pos.x],eax
  217. ;       stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_top,50
  218. ;       mov     [mainwnd_pos.y],eax
  219. ;       stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_right,350
  220. ;       sub     eax,[mainwnd_pos.x]
  221. ;       mov     [mainwnd_pos.w],eax
  222. ;       stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_bottom,450
  223. ;       sub     eax,[mainwnd_pos.y]
  224. ;       mov     [mainwnd_pos.h],eax
  225.  
  226.         cld
  227.         mov     edi,@UDATA
  228.         mov     ecx,@PARAMS-@UDATA
  229.         mov     al,0
  230.         rep     stosb
  231.  
  232.         mov     [tab_bar.Style],2
  233.  
  234.         mcall   68,11
  235.         or      eax,eax
  236.         jz      key.alt_x.close
  237.  
  238.         mov     eax,65536
  239.         call    mem.Alloc
  240.         mov     [temp_buf],eax
  241.  
  242.         inc     [do_not_draw]
  243.  
  244.         mov     esi,s_example
  245.         mov     edi,tb_opensave.text
  246.         mov     ecx,s_example.size
  247.         mov     [tb_opensave.length],cl
  248.         rep     movsb
  249.  
  250.         mov     esi,s_still
  251.         mov     edi,s_search
  252.         mov     ecx,s_still.size
  253.         mov     [s_search.size],ecx
  254.         rep     movsb
  255.  
  256. ;       DEBUGF  1,"params: '%s'\n",@PARAMS
  257.  
  258.         cmp     byte[@PARAMS],0
  259.         jz      no_params
  260.  
  261. ;// Willow's code to support DOCPAK [
  262.  
  263.         cmp     byte[@PARAMS],'*'
  264.         jne     .noipc
  265.  
  266. ;       DEBUGF  1,"  started by DOCPAK\n"
  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. ;       DEBUGF  1,"  data size (+20) = %d\n",edx
  285.  
  286.         mov     eax,edx
  287.         call    mem.Alloc
  288.         mov     ebp,eax
  289.         push    eax
  290.  
  291. ;       DEBUGF  1,"  mem.Alloc() returned 0x%x, allocated size = %d\n",eax,[eax-4]
  292.  
  293. ;!      mcall   60,1,AREA_TEMP-16 ; 0x10000-16
  294. ;!      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
  298.         mcall   40,1000000b
  299.  
  300. ;       DEBUGF  1,"  got IPC message within 2 secs? "
  301.         mcall   23,200
  302. ;       DEBUGF  1,"%b\n",eax == 7
  303.  
  304.         cmp     eax,7
  305.         jne     key.alt_x.close
  306. ;!      mov     esi,AREA_TEMP-16 ; 0x10000-16
  307. ;!      mov     byte[esi],1
  308. ;!      mov     eax,[esi+12]
  309.         mov     byte[ebp],1
  310. ;!      mov     eax,[ebp+12]
  311. ;!      inc     eax
  312. ;!      call    load_file.file_found
  313.  
  314. ;       DEBUGF  1,"  creating new document\n"
  315.  
  316.         mov     ecx,[ebp+12]
  317.         lea     esi,[ebp+16]
  318.         call    create_tab
  319.         call    load_from_memory
  320.  
  321.         pop     ebp
  322.         mov     eax,ebp
  323.         call    mem.Free
  324.  
  325. ;       DEBUGF  1,"  mem.Free(0x%x) returned %d\n",ebp,eax
  326.  
  327.         jmp     @f
  328.   .noipc:
  329.  
  330. ;// Willow's code to support DOCPAK ]
  331.  
  332.     ; parameters are at @PARAMS
  333.         mov     esi,@PARAMS
  334.         mov     edi,tb_opensave.text
  335.         mov     ecx,PATHL
  336.         rep     movsb
  337.         mov     edi,tb_opensave.text
  338.         mov     ecx,PATHL
  339.         xor     al,al
  340.         repne   scasb
  341.         jne     key.alt_x.close
  342.         lea     eax,[edi-tb_opensave.text-1]
  343.         mov     [tb_opensave.length],al
  344.         call    btn.load_file
  345.         jnc     @f
  346.  
  347.   no_params:
  348.         call    create_tab
  349.  
  350.     @@:
  351.         mov     [s_status],0
  352.         dec     [do_not_draw]
  353.         mcall   66,1,1
  354.         mcall   40,00100111b
  355. red:
  356.         call    drawwindow
  357.         call    check_inv_all.skip_check
  358.  
  359. ;-----------------------------------------------------------------------------
  360.  
  361. still:
  362.        call    draw_statusbar ; write current position & number of strings
  363.  
  364.   .skip_write:
  365.         mcall   10;23,50; wait here until event
  366.         cmp     [main_closed],0
  367.         jne     key.alt_x
  368.         dec     eax     ; redraw ?
  369.         jz      red
  370.         dec     eax     ; key ?
  371.         jz      key
  372.         dec     eax     ; button ?
  373.         jz      button
  374.         sub     eax,3   ; mouse ?
  375.         jz      mouse
  376.  
  377.         jmp     still.skip_write
  378.  
  379. ;-----------------------------------------------------------------------------
  380. func start_fasm ;/////////////////////////////////////////////////////////////
  381. ;-----------------------------------------------------------------------------
  382. ; BL = run after compile
  383. ;-----------------------------------------------------------------------------
  384.         cmp     [cur_editor.AsmMode],0 ;! [asm_mode],0
  385.         jne     @f
  386.         ret
  387.     @@: mov     esi,f_info.path ; s_fname
  388.         mov     edi,fasm_parameters
  389.  
  390.         cmp     byte[esi],'/'
  391.         je      .yes_systree
  392.  
  393.         mov     ecx,[f_info.length] ; [s_fname.size]
  394.         rep     movsb
  395.  
  396.         mov     al,','
  397.         stosb
  398.  
  399.         mov     ecx,[f_info.length] ; [s_fname.size]
  400.         add     ecx,-4
  401.         mov     esi,f_info.path ; s_fname
  402.         rep     movsb
  403.  
  404.         mov     al,','
  405.         stosb
  406.  
  407.         mov     dword[edi],'/RD/'
  408.         mov     word[edi+4],'1/'
  409.         add     edi,6
  410.  
  411.         mov     al,0
  412.         stosb
  413.  
  414.         jmp     .run
  415.  
  416.  .yes_systree:
  417.         mov     eax,[f_info.length]
  418.         add     esi,eax ; [s_fname.size]
  419.         dec     esi
  420.  
  421.         xor     ecx,ecx
  422.         mov     al,'/'
  423.     @@: cmp     [esi],al
  424.         je      @f
  425.         dec     esi
  426.         inc     ecx
  427.         jmp     @b
  428.     @@: inc     esi
  429.  
  430.         push    esi esi ecx
  431.  
  432.         rep     movsb
  433.  
  434.         mov     al,','
  435.         stosb
  436.  
  437.         pop     ecx esi
  438.  
  439.         add     ecx,-4
  440.         rep     movsb
  441.  
  442.         mov     al,','
  443.         stosb
  444.  
  445.         pop     ecx
  446.         sub     ecx,f_info.path ; s_fname
  447.         mov     esi,f_info.path ; s_fname
  448.  
  449.         rep     movsb
  450.  
  451.         mov     al,0
  452.         stosb
  453.  
  454.  .run:
  455.         cmp     bl,0 ; run outfile ?
  456.         je      @f
  457.         mov     dword[edi-1],',run'
  458.         mov     byte[edi+3],0
  459.     @@:
  460.         mov     ebx, fasm_start
  461. start_ret:
  462.         mov     eax, 70
  463.         int     0x40
  464.         ret
  465. endf
  466.  
  467. ;-----------------------------------------------------------------------------
  468. func open_debug_board ;///////////////////////////////////////////////////////
  469. ;-----------------------------------------------------------------------------
  470.         mov     ebx, board_start
  471.         jmp     start_ret
  472. endf
  473.  
  474. ;-----------------------------------------------------------------------------
  475. func open_sysfuncs_txt ;//////////////////////////////////////////////////////
  476. ;-----------------------------------------------------------------------------
  477.         mov     ebx, docpak_start
  478.         call    start_ret
  479.         cmp     eax,0xfffffff0
  480.         jb      @f
  481.         mov     ebx, tinypad_start
  482.         mov     dword [ebx+8], sysfuncs_filename
  483.         call    start_ret
  484.     @@: ret
  485. endf
  486.  
  487. ;-----------------------------------------------------------------------------
  488. ;func layout  ;///// change keyboard layout ///////////////////////////////////
  489. ;-----------------------------------------------------------------------------
  490. ;        mcall   19,setup,param_setup
  491. ;        mcall   5,eax
  492. ;;       call    activate_me
  493. ;;       ret
  494. ;;endf
  495.  
  496. ;;func activate_me
  497. ;        mcall   9,p_info,-1
  498. ;        inc     eax
  499. ;        inc     eax
  500. ;        mov     ecx,eax
  501. ;        mov     edi,[p_info.PID]
  502. ;        mov     ebx,p_info
  503. ;    @@: dec     ecx
  504. ;        jz      @f    ; counter=0 => not found? => return
  505. ;        mcall   9
  506. ;        cmp     edi,[p_info.PID]
  507. ;        jne     @b
  508. ;        mcall   18,3
  509. ;        mcall   5,eax
  510. ;    @@: ret
  511. ;endf
  512.  
  513. set_opt:
  514.  
  515.   .line_numbers:
  516.         mov     al,OPTS_LINENUMS
  517.         jmp     .main
  518.   .optimal_fill:
  519.         mov     al,OPTS_OPTIMSAVE
  520.         jmp     .main
  521.   .auto_indents:
  522.         mov     al,OPTS_AUTOINDENT
  523.         jmp     .main
  524.   .auto_braces:
  525.         mov     al,OPTS_AUTOBRACES
  526.         jmp     .main
  527.   .secure_sel:
  528.         mov     al,OPTS_SECURESEL
  529.  
  530.   .main:
  531.         xor     [options],al
  532.         ret
  533.  
  534. ;-----------------------------------------------------------------------------
  535.  
  536. include 'tp-defines.inc'
  537.  
  538. include 'tp-draw.asm'
  539. include 'tp-key.asm'
  540. include 'tp-button.asm'
  541. include 'tp-mouse.asm'
  542. include 'tp-files.asm'
  543. include 'tp-common.asm'
  544. include 'tp-dialog.asm'
  545. include 'tp-popup.asm'
  546. include 'tp-tbox.asm'
  547. include 'tp-tabctl.asm'
  548. include 'tp-editor.asm'
  549. include 'tp-recode.asm'
  550.  
  551. ;include 'lib-ini.asm'
  552.  
  553. ;-----------------------------------------------------------------------------
  554. section @DATA ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  555. ;-----------------------------------------------------------------------------
  556.  
  557. ;addr       dd s_fname  ; address of input string
  558. ;temp       dd 0xABCD   ; used in read_string
  559. vscrl_capt dd -1
  560. hscrl_capt dd -1
  561. body_capt  dd -1
  562.  
  563. key0 db \
  564.   0x00,0x00,0x02,0x03,0x04,0x05,0x06,0x07,\
  565.   0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x00,0x00,\
  566.   0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,\
  567.   0x18,0x19,0x1A,0x1B,0x00,0x00,0x1E,0x1F,\
  568.   0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,\
  569.   0x28,0x29,0x00,0x2B,0x2C,0x2D,0x2E,0x2F,\
  570.   0x30,0x31,0x32,0x33,0x34,0x35,0x00,0x00,\
  571.   0x00,0x39,0x00,0x00,0x00,0x00,0x00,0x00
  572.   times 12*16 db 0x00
  573.  
  574. accel_table_main dd                 \
  575.   0x0000000E,key.bkspace           ,\ ; BackSpace
  576.   0x0000000F,key.tab               ,\ ; Tab
  577.   0x0000001C,key.return            ,\ ; Return
  578.   0x0000003D,key.f3                ,\ ; F3
  579.   0x00000043,key.f9                ,\ ; F9
  580.   0x00000147,key.home              ,\ ; Home
  581.   0x00000148,key.up                ,\ ; Up
  582.   0x00000149,key.pgup              ,\ ; PageUp
  583.   0x0000014B,key.left              ,\ ; Left
  584.   0x0000014D,key.right             ,\ ; Right
  585.   0x0000014F,key.end               ,\ ; End
  586.   0x00000150,key.down              ,\ ; Down
  587.   0x00000151,key.pgdn              ,\ ; PageDown
  588.   0x00000152,key.ins               ,\ ; Insert
  589.   0x00000153,key.del               ,\ ; Delete
  590.   0x00010043,key.shift_f9          ,\ ; Shift+F9
  591.   0x00010147,key.shift_home        ,\ ; Shift+Home
  592.   0x00010148,key.shift_up          ,\ ; Shift+Up
  593.   0x00010149,key.shift_pgup        ,\ ; Shift+PageUp
  594.   0x0001014B,key.shift_left        ,\ ; Shift+Left
  595.   0x0001014D,key.shift_right       ,\ ; Shift+Right
  596.   0x0001014F,key.shift_end         ,\ ; Shift+End
  597.   0x00010150,key.shift_down        ,\ ; Shift+Down
  598.   0x00010151,key.shift_pgdn        ,\ ; Shift+PageDown
  599.   0x00010153,key.del               ,\ ; Shift+Delete
  600.   0x0002000F,key.ctrl_tab          ,\ ; Ctrl+Tab
  601.   0x00020015,key.ctrl_y            ,\ ; Ctrl+Y
  602.   0x00020018,key.ctrl_o            ,\ ; Ctrl+O
  603.   0x0002001E,key.ctrl_a            ,\ ; Ctrl+A
  604.   0x0002001F,key.ctrl_s            ,\ ; Ctrl+S
  605.   0x00020020,key.ctrl_d            ,\ ; Ctrl+D
  606.   0x00020021,key.ctrl_f            ,\ ; Ctrl+F
  607.   0x00020022,key.ctrl_g            ,\ ; Ctrl+G
  608.   0x00020023,key.ctrl_h            ,\ ; Ctrl+H
  609. \;0x00020026,key.ctrl_l            ,\ ; Ctrl+L
  610.   0x0002002D,key.ctrl_x            ,\ ; Ctrl+X
  611.   0x0002002E,key.ctrl_c            ,\ ; Ctrl+C
  612.   0x0002002F,key.ctrl_v            ,\ ; Ctrl+V
  613.   0x00020031,key.ctrl_n            ,\ ; Ctrl+N
  614.   0x0002003E,key.ctrl_f4           ,\ ; Ctrl+F4
  615.   0x00020043,key.ctrl_f9           ,\ ; Ctrl+F9
  616.   0x00020147,key.ctrl_home         ,\ ; Ctrl+Home
  617. \;0x00020148,key.ctrl_up           ,\ ; Ctrl+Up
  618.   0x00020149,key.ctrl_pgup         ,\ ; Ctrl+PageUp
  619.   0x0002014B,key.ctrl_left         ,\ ; Ctrl+Left
  620.   0x0002014D,key.ctrl_right        ,\ ; Ctrl+Right
  621.   0x0002014F,key.ctrl_end          ,\ ; Ctrl+End
  622. \;0x00020150,key.ctrl_down         ,\ ; Ctrl+Down
  623.   0x00020151,key.ctrl_pgdn         ,\ ; Ctrl+PageDown
  624.   0x00020153,key.del               ,\ ; Ctrl+Del
  625.   0x0003000F,key.shift_ctrl_tab    ,\ ; Shift+Ctrl+Tab
  626.   0x0003001F,key.shift_ctrl_s      ,\ ; Shift+Ctrl+S
  627.   0x00030147,key.shift_ctrl_home   ,\ ; Shift+Ctrl+Home
  628. \;0x00030148,key.shift_ctrl_up     ,\ ; Shift+Ctrl+Up
  629.   0x00030149,key.shift_ctrl_pgup   ,\ ; Shift+Ctrl+PageUp
  630.   0x0003014B,key.shift_ctrl_left   ,\ ; Shift+Ctrl+Left
  631.   0x0003014D,key.shift_ctrl_right  ,\ ; Shift+Ctrl+Right
  632.   0x0003014F,key.shift_ctrl_end    ,\ ; Shift+Ctrl+End
  633. \;0x00030150,key.shift_ctrl_down   ,\ ; Shift+Ctrl+Down
  634.   0x00030151,key.shift_ctrl_pgdn   ,\ ; Shift+Ctrl+PageDown
  635.   0x0004002D,key.alt_x             ,\ ; Alt+X
  636.   0
  637.  
  638. accel_table_textbox dd              \
  639. \;0x00000001,key.tb.escape         ,\ ; Escape
  640.   0x0000000E,key.tb.bkspace        ,\ ; BackSpace
  641. \;0x0000000F,key.tb.tab            ,\ ; Tab
  642. \;0x0000001C,key.tb.return         ,\ ; Return
  643.   0x00000147,key.tb.home           ,\ ; Home
  644.   0x0000014B,key.tb.left           ,\ ; Left
  645.   0x0000014D,key.tb.right          ,\ ; Right
  646.   0x0000014F,key.tb.end            ,\ ; End
  647.   0x00000153,key.tb.del            ,\ ; Delete
  648.   0x00010147,key.tb.shift_home     ,\ ; Shift+Home
  649.   0x0001014B,key.tb.shift_left     ,\ ; Shift+Left
  650.   0x0001014D,key.tb.shift_right    ,\ ; Shift+Right
  651.   0x0001014F,key.tb.shift_end      ,\ ; Shift+End
  652.   0x00010153,key.tb.del            ,\ ; Shift+Del
  653.   0
  654.  
  655. accel_table2 dd            \
  656.   1,btn.close_main_window ,\
  657.   'VSL',btn.vscroll_up   ,\
  658.   'VSG',btn.vscroll_down ,\
  659.   'HSL',btn.hscroll_up   ,\
  660.   'HSG',btn.hscroll_down ,\
  661.   'TBL',btn.tabctl_right ,\
  662.   'TBG',btn.tabctl_left  ,\
  663.   0
  664.  
  665. accel_table2_botdlg dd     \
  666.   1,btn.close_main_window ,\
  667.   20001,btn.bot.cancel    ,\
  668.   20002,btn.bot.opensave  ,\
  669.   20003,btn.bot.find      ,\
  670.   0
  671.  
  672. add_table:
  673.   times $1A db -$20
  674.   times $25 db -$00
  675.   times $10 db -$20
  676.   times $30 db -$00
  677.   times $10 db -$50
  678.   times $04 db -$00,-$01
  679.   times $08 db -$00
  680.  
  681. s_status dd 0
  682.  
  683. fasm_start:
  684.         dd      7
  685.         dd      0
  686.         dd      fasm_parameters
  687.         dd      0
  688.         dd      0
  689.         db      '/RD/1/DEVELOP/FASM',0
  690. board_start:
  691.         dd      7
  692.         dd      0
  693.         dd      0
  694.         dd      0
  695.         dd      0
  696.         db      '/RD/1/BOARD',0
  697. tinypad_start:
  698.         dd      7
  699.         dd      0
  700.         dd      ?
  701.         dd      0
  702.         dd      0
  703.         db      '/RD/1/TINYPAD',0
  704. docpak_start:
  705.         dd      7
  706.         dd      0
  707.         dd      sysfuncs_param
  708.         dd      0
  709.         dd      0
  710.         db      '/RD/1/DOCPAK',0
  711.  
  712. sz sysfuncs_param,'g',0
  713.  
  714. include 'tp-locale.inc'
  715.  
  716. sz symbols_ex,';?.%"',"'"
  717. sz symbols   ,'#&*\:/<>|{}()[]=+-, '
  718.  
  719. sz ini_sec_window   ,'Window',0
  720. sz ini_window_top   ,'Top',0
  721. sz ini_window_left  ,'Left',0
  722. sz ini_window_right ,'Right',0
  723. sz ini_window_bottom,'Bottom',0
  724.  
  725. ;include_debug_strings
  726.  
  727. TINYPAD_END:     ; end of file
  728.  
  729. self_path rb PATHL
  730.  
  731. ;-----------------------------------------------------------------------------
  732. section @UDATA ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  733. ;-----------------------------------------------------------------------------
  734.  
  735. f_info.length dd ?
  736. f_info.path:
  737.     times PATHL+1 db ?
  738. f_info70 rd 7
  739.  
  740. file_info FILEINFO
  741.  
  742. tab_bar      TABCTL
  743. virtual at tab_bar.Current
  744.   cur_tab      TABITEM
  745. end virtual
  746. virtual at tab_bar.Current.Editor
  747.   cur_editor   EDITOR
  748. end virtual
  749.  
  750. lines.scr     dd ?    ; number of lines on the screen
  751. columns.scr   dd ?    ; number of columns on the screen
  752. top_ofs       dd ?    ; height occupied by top buttons
  753. bot_ofs       dd ?    ; height occupied by bottom buttons
  754.               dw ?
  755. left_ofs      dd ?    ;
  756. __rc          dd ?,?,?,?
  757. copy_count    dd ?    ; number of lines for copying (Ctrl+E)
  758. copy_size     dd ?    ; size of data to copy
  759. s_title.size  dd ?    ; caption length
  760.  
  761. cur_line_len  dd ?
  762. h_popup       dd ?
  763. bot_dlg_handler dd ?
  764.  
  765. sel.begin.x   dd ?
  766. sel.begin.y   dd ?
  767. sel.end.x     dd ?
  768. sel.end.y     dd ?
  769. sel.selected  db ?
  770.  
  771. in_sel        db ?
  772.  
  773. do_not_draw   db ?    ; draw top and bottom buttons?
  774. main_closed   db ?    ; main window closed?
  775. tb_casesen    db ?    ; focused textbox is case-sensitive?
  776.  
  777. align 4
  778. s_fname.size  dd ?
  779. s_fname       rb PATHL+1
  780. align 4
  781. s_search.size dd ?
  782. s_search      rb PATHL+1
  783.  
  784. s_title       rb PATHL+11  ; window caption
  785.  
  786. chr db ?
  787. ext db ?
  788. shi dd ?
  789.  
  790. align 4
  791. cl_3d_normal dd ?
  792. cl_3d_pushed dd ?
  793. cl_3d_outset dd ?
  794. cl_3d_inset  dd ?
  795. cl_3d_grayed dd ?
  796.  
  797. tb_opensave  TBOX
  798. tb_find      TBOX
  799. tb_replace   TBOX
  800. tb_gotorow   TBOX
  801. tb_gotocol   TBOX
  802.  
  803. focused_tb   dd ?
  804.  
  805. key1 rb 256
  806.  
  807. mst  db ?
  808. mst2 db ?
  809. mev  db ?
  810. mouse_captured  db ?
  811. just_from_popup db ?
  812.  
  813. bot_mode db ?
  814.  
  815. align 4
  816.  
  817. bot_dlg_height dd ?
  818. bot_dlg_mode2  db ?
  819.  
  820. temp_buf dd ?
  821. copy_buf dd ?
  822.  
  823. ;-----------------------------------------------------------------------------
  824. section @PARAMS ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  825. ;-----------------------------------------------------------------------------
  826.  
  827. fasm_parameters:
  828.  
  829. p_info  process_information
  830. p_info2 process_information
  831. sc      system_colors
  832.  
  833. ;store dword '/hd/' at tb_opensave.text+4*0
  834. ;store dword '1/tp' at tb_opensave.text+4*1
  835. ;store dword 'ad4/' at tb_opensave.text+4*2
  836. ;store dword 'tiny' at tb_opensave.text+4*3
  837. ;store dword 'pad.' at tb_opensave.text+4*4
  838. ;store dword 'asm'  at tb_opensave.text+4*5
  839. ;store byte  23     at tb_opensave.length
  840.  
  841. ;rb 1024*36
  842. rb 1024*4
  843. MAIN_STACK:
  844. rb 1024*4
  845. POPUP_STACK:
  846.  
  847. STATIC_MEM_END:
  848.  
  849. diff10 'Main memory size',0,$
  850.