Another small changes to Tinypad on the way to 4.1.0, added support for mouse wheel

git-svn-id: svn://kolibrios.org@617 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Mihail Semenyako (mike.dld) 2007-09-01 21:38:00 +00:00
parent f23fc38433
commit 6b39363987
24 changed files with 1511 additions and 828 deletions

View File

@ -0,0 +1,86 @@
vscrl_capt dd -1
hscrl_capt dd -1
body_capt dd -1
s_status dd 0
sz app_fasm ,'/RD/1/DEVELOP/FASM',0
sz app_board ,'/RD/1/BOARD',0
sz app_tinypad ,'/RD/1/TINYPAD',0
sz app_docpak ,'/RD/1/DOCPAK',0
sz sysfuncs_param,'g',0
include 'tp-tables.inc'
include 'tp-locale.inc'
;// options dialog data [
label optsdlg_editor at $-EDITOR.Bounds
; rb PATHL ; FilePath db PATHL dup(?)
; dd 0 ; FileName dd ?
dd ?,?,?,? ; Bounds RECT
dd @f ; Lines dd ?
dd ? ; Lines.Size dd ?
dd 9 ; Lines.Count dd ?
dd 21 ; Columns.Count dd ?
dd 0,4 ; Caret POINT
dd 100,4 ; SelStart POINT
dd 0,0 ; TopLeft POINT
dd 0,0 ; VScroll SCROLLBAR
dd 0,0 ; HScroll SCROLLBAR
dd 0 ; Gutter.Width dd ?
db 0 ; Gutter.Visible db ?
db 1 ; AsmMode db ?
db 0 ; Modified db ?
@@:
dd 0x00000000+1
db ' '
dd 0x00010000+9
db ' org 100h'
dd 0x00000000+1
db ' '
dd 0x00000000+20
db ' mov ah,09h ; write'
dd 0x00000000+12
db ' mov dx,text'
dd 0x00000000+8
db ' int 21h'
dd 0x00030000+8
db ' int 20h'
dd 0x00000000+1
db ' '
dd 0x00000000+21
db ' text db "Hello!",24h'
dd 0
optsdlg_editor_parts: ; left,top,right,bottom,type
db 0, 12, 13, 29, 22
db 0, 12, 33, 47, 42
db 0, 12, 53, 29, 72
db 0, 12, 83, 53, 92
db 2, 12, 43, 77, 52
db 3, 4, 43,148, 52
db 4, 48, 33, 53, 42
db 4,108, 83,113, 92
db 5, 36, 13, 59, 22
db 5, 54, 33, 71, 42
db 5, 36, 53, 53, 72
db 5,114, 83,131, 92
db 6, 60, 83,107, 92
db 7, 84, 33,125, 42
db 8, 1, 13, 5, 22
db 9, 1, 63, 5, 72
db 1, 1, 1,148,105
db -1
;// ]
sz symbols_ex,';?.%"',"'"
sz symbols ,'#&*\:/<>|{}()[]=+-, '
sz ini_sec_window ,'Window',0
sz ini_window_top ,'Top',0
sz ini_window_left ,'Left',0
sz ini_window_right ,'Right',0
sz ini_window_bottom,'Bottom',0

View File

@ -0,0 +1,189 @@
align 4
key0 db \
0x00,0x00,0x02,0x03,0x04,0x05,0x06,0x07,\
0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x00,0x00,\
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,\
0x18,0x19,0x1A,0x1B,0x00,0x00,0x1E,0x1F,\
0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,\
0x28,0x29,0x00,0x2B,0x2C,0x2D,0x2E,0x2F,\
0x30,0x31,0x32,0x33,0x34,0x35,0x00,0x00,\
0x00,0x39,0x00,0x00,0x00,0x00,0x00,0x00
times 12*16 db 0x00
align 4
accel_table_main dd \
0x0000000E,key.bkspace ,\ ; BackSpace
0x0000000F,key.tab ,\ ; Tab
0x0000001C,key.return ,\ ; Return
0x0000003D,key.f3 ,\ ; F3
0x00000043,key.f9 ,\ ; F9
0x00000147,key.home ,\ ; Home
0x00000148,key.up ,\ ; Up
0x00000149,key.pgup ,\ ; PageUp
0x0000014B,key.left ,\ ; Left
0x0000014D,key.right ,\ ; Right
0x0000014F,key.end ,\ ; End
0x00000150,key.down ,\ ; Down
0x00000151,key.pgdn ,\ ; PageDown
0x00000152,key.ins ,\ ; Insert
0x00000153,key.del ,\ ; Delete
0x00010043,key.shift_f9 ,\ ; Shift+F9
0x00010147,key.shift_home ,\ ; Shift+Home
0x00010148,key.shift_up ,\ ; Shift+Up
0x00010149,key.shift_pgup ,\ ; Shift+PageUp
0x0001014B,key.shift_left ,\ ; Shift+Left
0x0001014D,key.shift_right ,\ ; Shift+Right
0x0001014F,key.shift_end ,\ ; Shift+End
0x00010150,key.shift_down ,\ ; Shift+Down
0x00010151,key.shift_pgdn ,\ ; Shift+PageDown
0x00010153,key.del ,\ ; Shift+Delete
0x0002000F,key.ctrl_tab ,\ ; Ctrl+Tab
0x00020015,key.ctrl_y ,\ ; Ctrl+Y
0x00020018,key.ctrl_o ,\ ; Ctrl+O
0x0002001E,key.ctrl_a ,\ ; Ctrl+A
0x0002001F,key.ctrl_s ,\ ; Ctrl+S
0x00020020,key.ctrl_d ,\ ; Ctrl+D
0x00020021,key.ctrl_f ,\ ; Ctrl+F
0x00020022,key.ctrl_g ,\ ; Ctrl+G
0x00020023,key.ctrl_h ,\ ; Ctrl+H
\;0x00020026,key.ctrl_l ,\ ; Ctrl+L
0x0002002D,key.ctrl_x ,\ ; Ctrl+X
0x0002002E,key.ctrl_c ,\ ; Ctrl+C
0x0002002F,key.ctrl_v ,\ ; Ctrl+V
0x00020031,key.ctrl_n ,\ ; Ctrl+N
0x0002003E,key.ctrl_f4 ,\ ; Ctrl+F4
0x00020043,key.ctrl_f9 ,\ ; Ctrl+F9
0x00020147,key.ctrl_home ,\ ; Ctrl+Home
\;0x00020148,key.ctrl_up ,\ ; Ctrl+Up
0x00020149,key.ctrl_pgup ,\ ; Ctrl+PageUp
0x0002014B,key.ctrl_left ,\ ; Ctrl+Left
0x0002014D,key.ctrl_right ,\ ; Ctrl+Right
0x0002014F,key.ctrl_end ,\ ; Ctrl+End
\;0x00020150,key.ctrl_down ,\ ; Ctrl+Down
0x00020151,key.ctrl_pgdn ,\ ; Ctrl+PageDown
0x00020153,key.del ,\ ; Ctrl+Del
0x0003000F,key.shift_ctrl_tab ,\ ; Shift+Ctrl+Tab
0x0003001F,key.shift_ctrl_s ,\ ; Shift+Ctrl+S
0x00030147,key.shift_ctrl_home ,\ ; Shift+Ctrl+Home
\;0x00030148,key.shift_ctrl_up ,\ ; Shift+Ctrl+Up
0x00030149,key.shift_ctrl_pgup ,\ ; Shift+Ctrl+PageUp
0x0003014B,key.shift_ctrl_left ,\ ; Shift+Ctrl+Left
0x0003014D,key.shift_ctrl_right ,\ ; Shift+Ctrl+Right
0x0003014F,key.shift_ctrl_end ,\ ; Shift+Ctrl+End
\;0x00030150,key.shift_ctrl_down ,\ ; Shift+Ctrl+Down
0x00030151,key.shift_ctrl_pgdn ,\ ; Shift+Ctrl+PageDown
0x0004002D,key.alt_x ,\ ; Alt+X
0
align 4
accel_table_textbox dd \
\;0x00000001,key.tb.escape ,\ ; Escape
0x0000000E,key.tb.bkspace ,\ ; BackSpace
\;0x0000000F,key.tb.tab ,\ ; Tab
\;0x0000001C,key.tb.return ,\ ; Return
0x00000147,key.tb.home ,\ ; Home
0x0000014B,key.tb.left ,\ ; Left
0x0000014D,key.tb.right ,\ ; Right
0x0000014F,key.tb.end ,\ ; End
0x00000153,key.tb.del ,\ ; Delete
0x00010147,key.tb.shift_home ,\ ; Shift+Home
0x0001014B,key.tb.shift_left ,\ ; Shift+Left
0x0001014D,key.tb.shift_right ,\ ; Shift+Right
0x0001014F,key.tb.shift_end ,\ ; Shift+End
0x00010153,key.tb.del ,\ ; Shift+Del
0
align 4
accel_table2 dd \
1 ,key.alt_x ,\
'VSL',btn.vscroll_up ,\
'VSG',btn.vscroll_down ,\
'HSL',btn.hscroll_up ,\
'HSG',btn.hscroll_down ,\
'TBL',btn.tabctl_right ,\
'TBG',btn.tabctl_left ,\
0
align 4
accel_table2_botdlg dd \
1 ,key.alt_x ,\
20001,btn.bot.cancel ,\
20002,btn.bot.opensave ,\
20003,btn.bot.find ,\
20004,btn.bot.appearance,\
21001,btn.bot.tabpos ,\
0
align 4
add_table:
times $1A db -$20
times $25 db -$00
times $10 db -$20
times $30 db -$00
times $10 db -$50
times $04 db -$00,-$01
times $08 db -$00
align 4
table.866.1251 db \
$C0,$C1,$C2,$C3,$C4,$C5,$C6,$C7 , $C8,$C9,$CA,$CB,$CC,$CD,$CE,$CF,\
$D0,$D1,$D2,$D3,$D4,$D5,$D6,$D7 , $D8,$D9,$DA,$DB,$DC,$DD,$DE,$DF,\
$E0,$E1,$E2,$E3,$E4,$E5,$E6,$E7 , $E8,$E9,$EA,$EB,$EC,$ED,$EE,$EF,\
$00,$00,$00,$00,$00,$00,$00,$00 , $00,$00,$00,$00,$00,$00,$00,$00,\
$00,$00,$00,$00,$00,$00,$00,$00 , $00,$00,$00,$00,$00,$00,$00,$00,\
$00,$00,$00,$00,$00,$00,$00,$00 , $00,$00,$00,$00,$00,$00,$00,$00,\
$F0,$F1,$F2,$F3,$F4,$F5,$F6,$F7 , $F8,$F9,$FA,$FB,$FC,$FD,$FE,$FF,\
$A8,$B8,$AA,$BA,$AF,$BF,$A1,$A2 , $B0,$95,$B7,$00,$B9,$A4,$00,$00
table.1251.866 db \
$00,$00,$00,$00,$00,$00,$00,$00 , $00,$00,$00,$00,$00,$00,$00,$00,\
$00,$00,$00,$00,$00,$F9,$00,$00 , $00,$00,$00,$00,$00,$00,$00,$00,\
$00,$F6,$F7,$00,$FD,$00,$00,$00 , $F0,$00,$F2,$00,$00,$00,$00,$F4,\
$F8,$00,$00,$00,$00,$00,$00,$FA , $F1,$FC,$F3,$00,$00,$00,$00,$F5,\
$80,$81,$82,$83,$84,$85,$86,$87 , $88,$89,$8A,$8B,$8C,$8D,$8E,$8F,\
$90,$91,$92,$93,$94,$95,$96,$97 , $98,$99,$9A,$9B,$9C,$9D,$9E,$9F,\
$A0,$A1,$A2,$A3,$A4,$A5,$A6,$A7 , $A8,$A9,$AA,$AB,$AC,$AD,$AE,$AF,\
$E0,$E1,$E2,$E3,$E4,$E5,$E6,$E7 , $E8,$E9,$EA,$EB,$EC,$ED,$EE,$EF
table.866.koi db \
$E1,$E2,$F7,$E7,$E4,$E5,$F6,$FA , $E9,$EA,$EB,$EC,$ED,$EE,$EF,$F0,\
$F2,$F3,$F4,$F5,$E6,$E8,$E3,$FE , $FB,$FD,$FF,$F9,$F8,$FC,$E0,$F1,\
$C1,$C2,$D7,$C7,$C4,$C5,$D6,$DA , $C9,$CA,$CB,$CC,$CD,$CE,$CF,$D0,\
$90,$00,$00,$81,$87,$00,$00,$00 , $00,$00,$00,$00,$00,$00,$00,$83,\
$84,$89,$88,$86,$80,$8A,$00,$00 , $00,$00,$00,$00,$00,$00,$00,$00,\
$00,$00,$00,$00,$00,$00,$00,$00 , $00,$85,$82,$8D,$8C,$8E,$8F,$8B,\
$D2,$D3,$D4,$D5,$C6,$C8,$C3,$DE , $DB,$DD,$DF,$D9,$D8,$DC,$C0,$D1,\
$B3,$A3,$B4,$A4,$B7,$A7,$BE,$AE , $00,$95,$9E,$00,$B0,$9F,$00,$A0
table.koi.866 db \
$C4,$B3,$DA,$BF,$C0,$D9,$C3,$B4 , $C2,$C1,$C5,$DF,$DC,$DB,$DD,$DE,\
$B0,$00,$00,$00,$00,$F9,$00,$00 , $00,$00,$00,$00,$00,$00,$FA,$FD,\
$FF,$00,$00,$F1,$F3,$00,$00,$F5 , $00,$00,$00,$00,$00,$00,$F7,$00,\
$FC,$00,$00,$F0,$F2,$00,$00,$F4 , $00,$00,$00,$00,$00,$00,$F6,$00,\
$EE,$A0,$A1,$E6,$A4,$A5,$E4,$A3 , $E5,$A8,$A9,$AA,$AB,$AC,$AD,$AE,\
$AF,$EF,$E0,$E1,$E2,$E3,$A6,$A2 , $EC,$EB,$A7,$E8,$ED,$E9,$E7,$EA,\
$9E,$80,$81,$96,$84,$85,$94,$83 , $95,$88,$89,$8A,$8B,$8C,$8D,$8E,\
$8F,$9F,$90,$91,$92,$93,$86,$82 , $9C,$9B,$87,$98,$9D,$99,$97,$9A
table.1251.koi db \
$B1,$B2,$00,$A2,$00,$00,$00,$00 , $00,$00,$B9,$00,$BA,$BC,$BB,$BF,\
$A1,$91,$92,$93,$94,$95,$96,$97 , $00,$99,$A9,$00,$AA,$AC,$AB,$AF,\
$A0,$BE,$AE,$B8,$9F,$BD,$00,$00 , $B3,$98,$B4,$9D,$00,$00,$9C,$B7,\
$00,$00,$B6,$A6,$AD,$00,$00,$9E , $A3,$B0,$A4,$9B,$A8,$B5,$A5,$A7,\
$E1,$E2,$F7,$E7,$E4,$E5,$F6,$FA , $E9,$EA,$EB,$EC,$ED,$EE,$EF,$F0,\
$F2,$F3,$F4,$F5,$E6,$E8,$E3,$FE , $FB,$FD,$FF,$F9,$F8,$FC,$E0,$F1,\
$C1,$C2,$D7,$C7,$C4,$C5,$D6,$DA , $C9,$CA,$CB,$CC,$CD,$CE,$CF,$D0,\
$D2,$D3,$D4,$D5,$C6,$C8,$C3,$DE , $DB,$DD,$DF,$D9,$D8,$DC,$C0,$D1
table.koi.1251 db \
$00,$00,$00,$00,$00,$00,$00,$00 , $00,$00,$00,$00,$00,$00,$00,$00,\
$00,$91,$92,$93,$94,$95,$96,$97 , $00,$99,$00,$BB,$AE,$AB,$B7,$A4,\
$A0,$90,$83,$B8,$BA,$BE,$B3,$BF , $BC,$9A,$9C,$9E,$9D,$B4,$A2,$9F,\
$B9,$80,$81,$A8,$AA,$BD,$B2,$AF , $A3,$8A,$8C,$8E,$8D,$A5,$A1,$8F,\
$FE,$E0,$E1,$F6,$E4,$E5,$F4,$E3 , $F5,$E8,$E9,$EA,$EB,$EC,$ED,$EE,\
$EF,$FF,$F0,$F1,$F2,$F3,$E6,$E2 , $FC,$FB,$E7,$F8,$FD,$F9,$F7,$FA,\
$DE,$C0,$C1,$D6,$C4,$C5,$D4,$C3 , $D5,$C8,$C9,$CA,$CB,$CC,$CD,$CE,\
$CF,$DF,$D0,$D1,$D2,$D3,$C6,$C2 , $DC,$DB,$C7,$D8,$DD,$D9,$D7,$DA

View File

@ -0,0 +1,105 @@
self_path rb PATHL
app_start:
dd ?,?
.params dd ?
dd ?,?
db ?
.filename dd ?
f_info.length dd ?
f_info.path:
times PATHL+1 db ?
f_info70 rd 7
file_info FILEINFO
checker_ed EDITOR
checker_ed_ll dd ?
tab_bar TABCTL
virtual at tab_bar.Current
cur_tab TABITEM
end virtual
virtual at tab_bar.Current.Editor
cur_editor EDITOR
end virtual
ctx dd ?
lines.scr dd ? ; number of lines on the screen
columns.scr dd ? ; number of columns on the screen
top_ofs dd ? ; height occupied by top buttons
bot_ofs dd ? ; height occupied by bottom buttons
dw ?
left_ofs dd ? ;
__rc dd ?,?,?,?
copy_count dd ? ; number of lines for copying (Ctrl+E)
copy_size dd ? ; size of data to copy
s_title.size dd ? ; caption length
cur_line_len dd ?
h_popup dd ?
bot_dlg_handler dd ?
sel.begin.x dd ?
sel.begin.y dd ?
sel.end.x dd ?
sel.end.y dd ?
sel.selected db ?
in_sel db ?
do_not_draw db ? ; draw top and bottom buttons?
main_closed db ? ; main window closed?
tb_casesen db ? ; focused textbox is case-sensitive?
draw_blines db ?
align 4
s_fname.size dd ?
s_fname rb PATHL+1
align 4
s_search.size dd ?
s_search rb PATHL+1
s_title rb PATHL+11 ; window caption
chr db ?
ext db ?
shi dd ?
align 4
cl_3d_normal dd ?
cl_3d_pushed dd ?
cl_3d_outset dd ?
cl_3d_inset dd ?
cl_3d_grayed dd ?
tb_color TBOX
tb_opensave TBOX
tb_find TBOX
tb_replace TBOX
tb_gotorow TBOX
tb_gotocol TBOX
focused_tb dd ?
key1 rb 256
mst rd 2
mst2 rd 2
mev db ?
mouse_captured db ?
just_from_popup db ?
bot_mode db ?
align 4
bot_dlg_height dd ?
bot_dlg_mode2 db ?
temp_buf dd ?
copy_buf dd ?

View File

@ -0,0 +1,92 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
or eax,eax
jz .fail
stdcall dll.Init,[eax+4]
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
.next: xor eax,eax
test edx,edx
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
s_libdir db '/rd/1/lib/'
s_libdir.fname rb 32

View File

@ -0,0 +1,91 @@
;-----------------------------------------------------------------------------
; Copyright (c) 2006-2007, mike.dld
;-----------------------------------------------------------------------------
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
; DEALINGS IN THE SOFTWARE.
;-----------------------------------------------------------------------------
O_READ = 00000001b
O_WRITE = 00000010b
O_CREATE = 00000100b
O_SHARE = 00001000b
SEEK_SET = 0
SEEK_CUR = 1
SEEK_END = 2
struct DateTime
union
time dd ?
struct
sec db ?
min db ?
hour db ?
ends
ends
union
date dd ?
struct
day db ?
month db ?
year dw ?
ends
ends
ends
struct FileInfoBlock
Function dd ?
Position dd ?
Flags dd ?
Count dd ?
Buffer dd ?
db ?
FileName dd ?
ends
struct FileInfoHeader
Version dd ?
FilesRead dd ?
FilesCount dd ?
rd 5
ends
struct FileInfoA
Attributes dd ?
Flags dd ?
DateCreate DateTime
DateAccess DateTime
DateModify DateTime
FileSize dd ?
FileSizeHigh dd ?
FileName rb 264
ends
struct FileInfoW
Attributes dd ?
Flags dd ?
DateCreate DateTime
DateAccess DateTime
DateModify DateTime
FileSize dd ?
FileSizeHigh dd ?
FileName rw 260
ends
virtual at 0
FileInfo FileInfoA
FileInfo fix FileInfoA
sizeof.FileInfo fix sizeof.FileInfoA
end virtual
FA_READONLY = 00000001b
FA_HIDDEN = 00000010b
FA_SYSTEM = 00000100b
FA_LABEL = 00001000b
FA_FOLDER = 00010000b
FA_ARCHIVED = 00100000b

View File

@ -0,0 +1,159 @@
HISTORY:
4.0.5 (Rus, mike.dld)
bug-fixes:
- new tab is created when opening a file from Tinypad's home folder
(was opening in current tab if there was a new file, even modified)
- show "save file" dialog for new files or files from Tinypad's home folder
new features:
- prompt to save modified file before closing
- button to close current tab
- mouse scroll wheel support
4.0.4 (mike.dld)
bug-fixes:
- statusbar contained hint after dialog operation cancelled
- small drawing fix for gutter and line saved/modified markers
(incorrect calculations)
- incorrect lines marking on Ctrl+V
- put filename of current tab into open/save dialog (noticed by Maxxxx32)
changes:
- editor and other modifications to ease parts placement changing,
including changes in look
- modified/saved colors now match those in MSVS
- function 70 for *all* file operations (including diamond's fixes)
- use memory manager instead of statically allocated region
- case-insensitive filenames input, to be able to open/save files with
non-latin chars in name (russian etc.)
- reduced flickering (changes checker)
- overall code cleanup
new features:
- recode tables between CP866, CP1251 and KOI8-R (suggested by Victor)
- tabbed interface, ability to open several files in one app instance
(thanks IRC guys for ideas and testing)
- make any tab default to compile it disregarding currently active tab
- configuration dialog (colors, tabs positioning)
4.0.3 (mike.dld)
bug-fixes:
- 1-char selection if pressing <BS> out of real line length
- fault in `writepos`, added call to function 9
- main menu items weren't highlighted if popup opened and cursor
isn't in main menu item's area
- statusbar and textboxes drawing fixes (wrong colors)
- perform no redraw while pressing Shift, Ctrl, Alt keys
- data length from DOCPAK in string representation (fixed by diamond)
- compare file extension case-insensitively (fixed by diamond)
changes:
- function 70 instead of 58 for files loading/saving
- clientarea-relative drawing (less code)
- every line's dword is now splitted into 2 words;
low word - line block length, so max line length is 65535 now
high word - various flags. for now, only 2 of 16 bits are used:
if bit #0 is set, line was modified since file open
if bit #1 is set, line was saved after last modification
high word could also be further used for code collapsing and different
line marking features (breakpoints, errors, bookmarks, etc.)
new features:
- line markers for modified and saved lines
- status messages for various actions
4.0.2 (mike.dld)
bug-fixes:
- program terminates if started with parameters (fine for DOCPAK)
4.0.1 (mike.dld)
bug-fixes:
- unable to run program after exiting from main menu (Alt+X)
new features:
- integration with DOCPAK
4.0 (mike.dld)
bug-fixes:
- main menu popups' "on show" was called only for first shown popup
- clear selection on left/right arrow keys
new features:
- "replace" dialog (w/o "skip", "replace all")
- line numbers display
- options (except "appearance" and "smart tabulation")
- options saving (colors, window position, "Options" popup triggers)
4.0 beta 2 (mike.dld)
bug-fixes:
- unable to start if /rd/1/example.asm is missing (from Halyavin)
- clicking on menu items draws main window in popup (from Rohan)
- passed parameters aren't taken into account (from Mario79)
- background isn't erased if text lines < screen lines after
selection deletion (from Rohan)
4.0 beta 1 (mike.dld)
menu bar and popup menu;
removed buttons from the top and input fields from the bottom since
now they're accesible through main/popup menu;
improved keyboard handling (using 66th function);
support for almost all FASMW keyboard shourtcuts;
added text selection ability, standard selection operations
(copy,cut,paste);
new integrated dialogs (open, save, find)
fix to collapse SPACEs into TABs only for *.asm and *.inc files
3.78a (mike.dld)
fixed termination while typing in x positions higher than (line_length+10);
improved drawing on small heights
don't draw window while its height = 0 (Kolibri "minimize" support)
3.78 (mike.dld)
now lines may be of ANY length;
optimized memory usage (less memory for internal file representation)
after loading file, it's internal size equals to its real size
plus 14 bytes for each line (4 bytes for line length
and 10 spaced to the end - to reduce data relocations count);
completely rewritten keyboard handling;
added horizontal scrollbar;
all line feed formats are supported: WIN(CRLF),*NIX(LF),MAC(CR);
etc.
3.77 (mike.dld)
changed save_string to collapse SPACEs into TABs;
rewrote drawfile from scratch (speed++)
through some drawing improvements needed
(some checkups to reduce flickering);
writepos (size--);
fixed drawing window while height < 100px, and for non-asm files;
several small fixes; speed/size optimizations
3.76 (mike.dld)
changed loadfile/loadhdfile to expand TABs into SPACEs;
changed TAB,ENTER,DELETE,BSPACE keys behaviour (rewritten from scratch);
vertical scrollbar;
extra window resizing capabilities (added a couple of constants);
completely new text cursor management & moving text cursor with mouse;
improved search function, moving cursor to beginning of text found;
adjustable max line width (change LINE_WIDTH & recompile) // (obsolet)
3.75a
fixed converting char to upper case in read_string
3.75
rewrote save_file from scratch; bugfix in loadfile;
3.74
optimisation
3.73
completly new load_file function
3.72
speed++
3.71
error beep
3.6,3.7:
many bugs fixed
simple toolbar
compile, run applications from TINYPAD, all fasm output is in debug board
TAB button
auto-indent
Ctrl+L - insert comment string

View File

@ -4,169 +4,41 @@
; memory to compile: 3.0/9.0 MBytes (without/with size optimizations)
; version: 4.0.4
; last update: 2007-02-08 (Feb 08, 2007)
; minimal kernel: revision #270 (svn://kolibrios.org/kernel)
; minimal kernel: revision #270 (svn://kolibrios.org/kernel/trunk)
;-----------------------------------------------------------------------------
; originally by: Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi
; maintained by: Mike Semenyako >> mike.dld@gmail.com
; Ivan Poddubny >> ivan-yar@bk.ru
;-----------------------------------------------------------------------------
; TODO (4.1.0):
; - optimize drawing (reduce flickering)
; - add vertical selection, undo, goto position, overwrite mode
; - add vertical selection, undo, goto position, overwrite mode, smart tabulation
; - improve window drawing with small dimensions
; - save settings to ini file, not to executable
; - add prompt to save file before closing/opening
; - save/load settings to/from ini file, not executable
; - path autocompletion for open/save dialogs
; - other bug-fixes and speed/size optimizations
;
; HISTORY:
; 4.0.5 (mike.dld and Rus)
; bug-fixes:
; - a new tab is created when opening a file from folder of tinypad
; - correct call save-dialog for saving new files or files from folder of tinypad
; new features:
; - added prompt to save file before closing
; - added close tab button
; 4.0.4 (mike.dld)
; bug-fixes:
; - statusbar contained hint after dialog operation cancelled
; - small drawing fix for gutter and line saved/modified markers
; (incorrect calculations)
; - incorrect lines marking on Ctrl+V
; - put filename of current tab into open/save dialog (noticed by Maxxxx32)
; changes:
; - editor and other modifications to ease parts placement changing,
; including changes in look
; - modified/saved colors now match those in MSVS
; - function 70 for *all* file operations (including diamond's fixes)
; - use memory manager instead of statically allocated region
; - case-insensitive filenames input, to be able to open/save files with
; non-latin chars in name (russian etc.)
; - reduced flickering (changes checker)
; - overall code cleanup
; new features:
; - recode tables between CP866, CP1251 and KOI8-R (suggested by Victor)
; - tabbed interface, ability to open several files in one app instance
; (thanks IRC guys for ideas and testing)
; - make any tab default to compile it disregarding currently active tab
; - configuration dialog (colors, tabs positioning)
; 4.0.3 (mike.dld)
; bug-fixes:
; - 1-char selection if pressing <BS> out of real line length
; - fault in `writepos`, added call to function 9
; - main menu items weren't highlighted if popup opened and cursor
; isn't in main menu item's area
; - statusbar and textboxes drawing fixes (wrong colors)
; - perform no redraw while pressing Shift, Ctrl, Alt keys
; - data length from DOCPAK in string representation (fixed by diamond)
; - compare file extension case-insensitively (fixed by diamond)
; changes:
; - function 70 instead of 58 for files loading/saving
; - clientarea-relative drawing (less code)
; - every line's dword is now splitted into 2 words;
; low word - line block length, so max line length is 65535 now
; high word - various flags. for now, only 2 of 16 bits are used:
; if bit #0 is set, line was modified since file open
; if bit #1 is set, line was saved after last modification
; high word could also be further used for code collapsing and different
; line marking features (breakpoints, errors, bookmarks, etc.)
; new features:
; - line markers for modified and saved lines
; - status messages for various actions
; 4.0.2 (mike.dld)
; bug-fixes:
; - program terminates if started with parameters (fine for DOCPAK)
; 4.0.1 (mike.dld)
; bug-fixes:
; - unable to run program after exiting from main menu (Alt+X)
; new features:
; - integration with DOCPAK
; 4.0 (mike.dld)
; bug-fixes:
; - main menu popups' "on show" was called only for first shown popup
; - clear selection on left/right arrow keys
; new features:
; - "replace" dialog (w/o "skip", "replace all")
; - line numbers display
; - options (except "appearance" and "smart tabulation")
; - options saving (colors, window position, "Options" popup triggers)
; 4.0 beta 2 (mike.dld)
; bug-fixes:
; - unable to start if /rd/1/example.asm is missing (from Halyavin)
; - clicking on menu items draws main window in popup (from Rohan)
; - passed parameters aren't taken into account (from Mario79)
; - background isn't erased if text lines < screen lines after
; selection deletion (from Rohan)
; 4.0 beta 1 (mike.dld)
; menu bar and popup menu;
; removed buttons from the top and input fields from the bottom since
; now they're accesible through main/popup menu;
; improved keyboard handling (using 66th function);
; support for almost all FASMW keyboard shourtcuts;
; added text selection ability, standard selection operations
; (copy,cut,paste);
; new integrated dialogs (open, save, find)
; fix to collapse SPACEs into TABs only for *.asm and *.inc files
; 3.78a (mike.dld)
; fixed termination while typing in x positions higher than (line_length+10);
; improved drawing on small heights
; don't draw window while its height = 0 (Kolibri "minimize" support)
; 3.78 (mike.dld)
; now lines may be of ANY length;
; optimized memory usage (less memory for internal file representation)
; after loading file, it's internal size equals to its real size
; plus 14 bytes for each line (4 bytes for line length
; and 10 spaced to the end - to reduce data relocations count);
; completely rewritten keyboard handling;
; added horizontal scrollbar;
; all line feed formats are supported: WIN(CRLF),*NIX(LF),MAC(CR);
; etc.
; 3.77 (mike.dld)
; changed save_string to collapse SPACEs into TABs;
; rewrote drawfile from scratch (speed++)
; through some drawing improvements needed
; (some checkups to reduce flickering);
; writepos (size--);
; fixed drawing window while height < 100px, and for non-asm files;
; several small fixes; speed/size optimizations
; 3.76 (mike.dld)
; changed loadfile/loadhdfile to expand TABs into SPACEs;
; changed TAB,ENTER,DELETE,BSPACE keys behaviour (rewritten from scratch);
; vertical scrollbar;
; extra window resizing capabilities (added a couple of constants);
; completely new text cursor management & moving text cursor with mouse;
; improved search function, moving cursor to beginning of text found;
; adjustable max line width (change LINE_WIDTH & recompile) // (obsolet)
; 3.75a
; fixed converting char to upper case in read_string
; 3.75
; rewrote save_file from scratch; bugfix in loadfile;
; 3.74
; optimisation
; 3.73
; completly new load_file function
; 3.72
; speed++
; 3.71
; error beep
; 3.6,3.7:
; many bugs fixed
; simple toolbar
; compile, run applications from TINYPAD, all fasm output is in debug board
; TAB button
; auto-indent
; Ctrl+L - insert comment string
;-----------------------------------------------------------------------------
; See history.txt for complete changelog
;-----------------------------------------------------------------------------
include 'lang.inc'
include '..\..\..\macros.inc' ; useful stuff
;include 'proc32.inc'
include '../../../macros.inc' ; useful stuff
include '../../../struct.inc'
include '../../../proc32.inc'
include 'external/libio.inc'
include 'tinypad.inc'
;purge mov,add,sub ;  SPEED
header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,self_path
APP_VERSION equ '4.0.4'
TRUE = 1
FALSE = 0
;include 'debug.inc'
;define __DEBUG__ 1
;define __DEBUG_LEVEL__ 1
@ -241,8 +113,11 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
or eax,eax
jz key.alt_x.close
mov eax,65536
call mem.Alloc
stdcall dll.Load,@IMPORT
or eax,eax
jnz key.alt_x.close
stdcall mem.Alloc,65536
mov [temp_buf],eax
inc [do_not_draw]
@ -285,8 +160,7 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
add edx,20
mov eax,edx
call mem.Alloc
stdcall mem.Alloc,edx
mov ebp,eax
push eax
@ -307,8 +181,7 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
call load_from_memory
pop ebp
mov eax,ebp
call mem.Free
stdcall mem.Free,ebp
jmp @f
.noipc:
@ -361,7 +234,70 @@ still:
jmp still.skip_write
;-----------------------------------------------------------------------------
func start_fasm ;/////////////////////////////////////////////////////////////
proc get_event ctx ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mcall 10
dec eax ; redraw ?
jz .redraw
dec eax ; key ?
jz .key
dec eax ; button ?
jz .button
sub eax,2 ; background ?
jz .background
dec eax ; mouse ?
jz .mouse
dec eax ; ipc ?
jz .ipc
dec eax ; network ?
jz .network
dec eax ; debug ?
jz .debug
sub eax,7 ; irq ?
js .nothing
cmp eax,15
jg .nothing
jmp .irq
.nothing:
mov eax,EV_IDLE
ret
.redraw:
mov eax,EV_REDRAW
ret
.key:
mov eax,EV_KEY
ret
.button:
mov eax,EV_BUTTON
ret
.background:
mov eax,EV_BACKGROUND
ret
.mouse:
mov eax,EV_MOUSE
ret
.ipc:
mov eax,EV_IPC
ret
.network:
mov eax,EV_NETWORK
ret
.debug:
mov eax,EV_DEBUG
ret
endp
;-----------------------------------------------------------------------------
proc start_fasm ;/////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; BL = run after compile
;-----------------------------------------------------------------------------
@ -426,18 +362,18 @@ func start_fasm ;/////////////////////////////////////////////////////////////
start_ret:
mcall 70,app_start
ret
endf
endp
;-----------------------------------------------------------------------------
func open_debug_board ;///////////////////////////////////////////////////////
proc open_debug_board ;///////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov [app_start.filename],app_board
mov [app_start.params],0
jmp start_ret
endf
endp
;-----------------------------------------------------------------------------
func open_sysfuncs_txt ;//////////////////////////////////////////////////////
proc open_sysfuncs_txt ;//////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov [app_start.filename],app_docpak
mov [app_start.params],sysfuncs_param
@ -448,7 +384,7 @@ func open_sysfuncs_txt ;//////////////////////////////////////////////////////
mov [app_start.params],sysfuncs_filename
call start_ret
@@: ret
endf
endp
set_opt:
@ -492,7 +428,7 @@ set_opt:
;-----------------------------------------------------------------------------
include 'tp-defines.inc'
include 'data/tp-defines.inc'
include 'tp-draw.asm'
include 'tp-key.asm'
@ -507,358 +443,70 @@ include 'tp-tabctl.asm'
include 'tp-editor.asm'
include 'tp-recode.asm'
;include 'lib-ini.asm'
include 'external/dll.inc'
;-----------------------------------------------------------------------------
section @DATA ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;-----------------------------------------------------------------------------
vscrl_capt dd -1
hscrl_capt dd -1
body_capt dd -1
include 'data/tp-idata.inc'
key0 db \
0x00,0x00,0x02,0x03,0x04,0x05,0x06,0x07,\
0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x00,0x00,\
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,\
0x18,0x19,0x1A,0x1B,0x00,0x00,0x1E,0x1F,\
0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,\
0x28,0x29,0x00,0x2B,0x2C,0x2D,0x2E,0x2F,\
0x30,0x31,0x32,0x33,0x34,0x35,0x00,0x00,\
0x00,0x39,0x00,0x00,0x00,0x00,0x00,0x00
times 12*16 db 0x00
;-----------------------------------------------------------------------------
section @IMPORT ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;-----------------------------------------------------------------------------
;align 16
;@IMPORT:
accel_table_main dd \
0x0000000E,key.bkspace ,\ ; BackSpace
0x0000000F,key.tab ,\ ; Tab
0x0000001C,key.return ,\ ; Return
0x0000003D,key.f3 ,\ ; F3
0x00000043,key.f9 ,\ ; F9
0x00000147,key.home ,\ ; Home
0x00000148,key.up ,\ ; Up
0x00000149,key.pgup ,\ ; PageUp
0x0000014B,key.left ,\ ; Left
0x0000014D,key.right ,\ ; Right
0x0000014F,key.end ,\ ; End
0x00000150,key.down ,\ ; Down
0x00000151,key.pgdn ,\ ; PageDown
0x00000152,key.ins ,\ ; Insert
0x00000153,key.del ,\ ; Delete
0x00010043,key.shift_f9 ,\ ; Shift+F9
0x00010147,key.shift_home ,\ ; Shift+Home
0x00010148,key.shift_up ,\ ; Shift+Up
0x00010149,key.shift_pgup ,\ ; Shift+PageUp
0x0001014B,key.shift_left ,\ ; Shift+Left
0x0001014D,key.shift_right ,\ ; Shift+Right
0x0001014F,key.shift_end ,\ ; Shift+End
0x00010150,key.shift_down ,\ ; Shift+Down
0x00010151,key.shift_pgdn ,\ ; Shift+PageDown
0x00010153,key.del ,\ ; Shift+Delete
0x0002000F,key.ctrl_tab ,\ ; Ctrl+Tab
0x00020015,key.ctrl_y ,\ ; Ctrl+Y
0x00020018,key.ctrl_o ,\ ; Ctrl+O
0x0002001E,key.ctrl_a ,\ ; Ctrl+A
0x0002001F,key.ctrl_s ,\ ; Ctrl+S
0x00020020,key.ctrl_d ,\ ; Ctrl+D
0x00020021,key.ctrl_f ,\ ; Ctrl+F
0x00020022,key.ctrl_g ,\ ; Ctrl+G
0x00020023,key.ctrl_h ,\ ; Ctrl+H
\;0x00020026,key.ctrl_l ,\ ; Ctrl+L
0x0002002D,key.ctrl_x ,\ ; Ctrl+X
0x0002002E,key.ctrl_c ,\ ; Ctrl+C
0x0002002F,key.ctrl_v ,\ ; Ctrl+V
0x00020031,key.ctrl_n ,\ ; Ctrl+N
0x0002003E,key.ctrl_f4 ,\ ; Ctrl+F4
0x00020043,key.ctrl_f9 ,\ ; Ctrl+F9
0x00020147,key.ctrl_home ,\ ; Ctrl+Home
\;0x00020148,key.ctrl_up ,\ ; Ctrl+Up
0x00020149,key.ctrl_pgup ,\ ; Ctrl+PageUp
0x0002014B,key.ctrl_left ,\ ; Ctrl+Left
0x0002014D,key.ctrl_right ,\ ; Ctrl+Right
0x0002014F,key.ctrl_end ,\ ; Ctrl+End
\;0x00020150,key.ctrl_down ,\ ; Ctrl+Down
0x00020151,key.ctrl_pgdn ,\ ; Ctrl+PageDown
0x00020153,key.del ,\ ; Ctrl+Del
0x0003000F,key.shift_ctrl_tab ,\ ; Shift+Ctrl+Tab
0x0003001F,key.shift_ctrl_s ,\ ; Shift+Ctrl+S
0x00030147,key.shift_ctrl_home ,\ ; Shift+Ctrl+Home
\;0x00030148,key.shift_ctrl_up ,\ ; Shift+Ctrl+Up
0x00030149,key.shift_ctrl_pgup ,\ ; Shift+Ctrl+PageUp
0x0003014B,key.shift_ctrl_left ,\ ; Shift+Ctrl+Left
0x0003014D,key.shift_ctrl_right ,\ ; Shift+Ctrl+Right
0x0003014F,key.shift_ctrl_end ,\ ; Shift+Ctrl+End
\;0x00030150,key.shift_ctrl_down ,\ ; Shift+Ctrl+Down
0x00030151,key.shift_ctrl_pgdn ,\ ; Shift+Ctrl+PageDown
0x0004002D,key.alt_x ,\ ; Alt+X
0
library \
libini,'libini.obj',\
libio,'libio.obj',\
libgfx,'libgfx.obj'
accel_table_textbox dd \
\;0x00000001,key.tb.escape ,\ ; Escape
0x0000000E,key.tb.bkspace ,\ ; BackSpace
\;0x0000000F,key.tb.tab ,\ ; Tab
\;0x0000001C,key.tb.return ,\ ; Return
0x00000147,key.tb.home ,\ ; Home
0x0000014B,key.tb.left ,\ ; Left
0x0000014D,key.tb.right ,\ ; Right
0x0000014F,key.tb.end ,\ ; End
0x00000153,key.tb.del ,\ ; Delete
0x00010147,key.tb.shift_home ,\ ; Shift+Home
0x0001014B,key.tb.shift_left ,\ ; Shift+Left
0x0001014D,key.tb.shift_right ,\ ; Shift+Right
0x0001014F,key.tb.shift_end ,\ ; Shift+End
0x00010153,key.tb.del ,\ ; Shift+Del
0
import libini, \
ini.get_str,'ini.get_str',\
ini.set_str,'ini.set_str',\
ini.get_int,'ini.get_int',\
ini.set_int,'ini.set_int'
accel_table2 dd \
1 ,key.alt_x ,\
'VSL',btn.vscroll_up ,\
'VSG',btn.vscroll_down ,\
'HSL',btn.hscroll_up ,\
'HSG',btn.hscroll_down ,\
'TBL',btn.tabctl_right ,\
'TBG',btn.tabctl_left ,\
177 , key.ctrl_f4 ,\ ; close current tab button
0
import libio, \
file.find_first,'file.find_first',\
file.find_next ,'file.find_next',\
file.find_close,'file.find_close',\
file.size ,'file.size',\
file.open ,'file.open',\
file.read ,'file.read',\
file.write ,'file.write',\
file.seek ,'file.seek',\
file.tell ,'file.tell',\
file.eof? ,'file.eof?',\
file.truncate ,'file.truncate',\
file.close ,'file.close'
accel_table2_botdlg dd \
1 ,key.alt_x ,\
20001,btn.bot.cancel ,\
20002,btn.bot.opensave ,\
20003,btn.bot.find ,\
20004,btn.bot.appearance,\
20007, btn.bot.no ,\
21001,btn.bot.tabpos ,\
0
add_table:
times $1A db -$20
times $25 db -$00
times $10 db -$20
times $30 db -$00
times $10 db -$50
times $04 db -$00,-$01
times $08 db -$00
s_status dd 0
@^
fasm_start:
dd 7
dd 0
dd fasm_parameters
dd 0
dd 0
db '/sys/DEVELOP/FASM',0
board_start:
dd 7
dd 0
dd 0
dd 0
dd 0
db '/sys/DEVELOP/BOARD',0
tinypad_start:
dd 7
dd 0
dd ?
dd 0
dd 0
db '/sys/TINYPAD',0
docpak_start:
dd 7
dd 0
dd sysfuncs_param
dd 0
dd 0
db '/sys/DOCPAK',0
^@
sz app_fasm ,'/sys/DEVELOP/FASM',0
sz app_board ,'/sys/DEVELOP/BOARD',0
sz app_tinypad ,'/sys/TINYPAD',0
sz app_docpak ,'/sys/DOCPAK',0
sz sysfuncs_param,'g',0
include 'tp-locale.inc'
;// options dialog data [
label optsdlg_editor at $-EDITOR.Bounds
; rb PATHL ; FilePath db PATHL dup(?)
; dd 0 ; FileName dd ?
dd ?,?,?,? ; Bounds RECT
dd @f ; Lines dd ?
dd ? ; Lines.Size dd ?
dd 9 ; Lines.Count dd ?
dd 21 ; Columns.Count dd ?
dd 0,4 ; Caret POINT
dd 100,4 ; SelStart POINT
dd 0,0 ; TopLeft POINT
dd 0,0 ; VScroll SCROLLBAR
dd 0,0 ; HScroll SCROLLBAR
dd 0 ; Gutter.Width dd ?
db 0 ; Gutter.Visible db ?
db 1 ; AsmMode db ?
db 0 ; Modified db ?
@@:
dd 0x00000000+1
db ' '
dd 0x00010000+9
db ' org 100h'
dd 0x00000000+1
db ' '
dd 0x00000000+20
db ' mov ah,09h ; write'
dd 0x00000000+12
db ' mov dx,text'
dd 0x00000000+8
db ' int 21h'
dd 0x00030000+8
db ' int 20h'
dd 0x00000000+1
db ' '
dd 0x00000000+21
db ' text db "Hello!",24h'
dd 0
optsdlg_editor_parts: ; left,top,right,bottom,type
db 0, 12, 13, 29, 22
db 0, 12, 33, 47, 42
db 0, 12, 53, 29, 72
db 0, 12, 83, 53, 92
db 2, 12, 43, 77, 52
db 3, 4, 43,148, 52
db 4, 48, 33, 53, 42
db 4,108, 83,113, 92
db 5, 36, 13, 59, 22
db 5, 54, 33, 71, 42
db 5, 36, 53, 53, 72
db 5,114, 83,131, 92
db 6, 60, 83,107, 92
db 7, 84, 33,125, 42
db 8, 1, 13, 5, 22
db 9, 1, 63, 5, 72
db 1, 1, 1,148,105
db -1
;// ]
sz symbols_ex,';?.%"',"'"
sz symbols ,'#&*\:/<>|{}()[]=+-, '
sz ini_sec_window ,'Window',0
sz ini_window_top ,'Top',0
sz ini_window_left ,'Left',0
sz ini_window_right ,'Right',0
sz ini_window_bottom,'Bottom',0
import libgfx, \
gfx.open ,'gfx.open',\
gfx.close ,'gfx.close',\
gfx.pen.color ,'gfx.pen.color',\
gfx.brush.color ,'gfx.brush.color',\
gfx.pixel ,'gfx.pixel',\
gfx.move.to ,'gfx.move.to',\
gfx.line.to ,'gfx.line.to',\
gfx.line ,'gfx.line',\
gfx.polyline ,'gfx.polyline',\
gfx.polyline.to ,'gfx.polyline.to',\
gfx.fillrect ,'gfx.fillrect',\
gfx.fillrect.ex ,'gfx.fillrect.ex',\
gfx.framerect ,'gfx.framerect',\
gfx.framerect.ex,'gfx.framerect.ex',\
gfx.rectangle ,'gfx.rectangle',\
gfx.rectangle.ex,'gfx.rectangle.ex'
TINYPAD_END: ; end of file
self_path rb PATHL
;-----------------------------------------------------------------------------
section @UDATA ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;-----------------------------------------------------------------------------
app_start:
dd ?,?
.params dd ?
dd ?,?
db ?
.filename dd ?
f_info.length dd ?
f_info.path:
times PATHL+1 db ?
f_info70 rd 7
file_info FILEINFO
checker_ed EDITOR
checker_ed_ll dd ?
tab_bar TABCTL
virtual at tab_bar.Current
cur_tab TABITEM
end virtual
virtual at tab_bar.Current.Editor
cur_editor EDITOR
end virtual
lines.scr dd ? ; number of lines on the screen
columns.scr dd ? ; number of columns on the screen
top_ofs dd ? ; height occupied by top buttons
bot_ofs dd ? ; height occupied by bottom buttons
dw ?
left_ofs dd ? ;
__rc dd ?,?,?,?
copy_count dd ? ; number of lines for copying (Ctrl+E)
copy_size dd ? ; size of data to copy
s_title.size dd ? ; caption length
cur_line_len dd ?
h_popup dd ?
bot_dlg_handler dd ?
sel.begin.x dd ?
sel.begin.y dd ?
sel.end.x dd ?
sel.end.y dd ?
sel.selected db ?
in_sel db ?
do_not_draw db ? ; draw top and bottom buttons?
main_closed db ? ; main window closed?
tb_casesen db ? ; focused textbox is case-sensitive?
draw_blines db ?
align 4
s_fname.size dd ?
s_fname rb PATHL+1
align 4
s_search.size dd ?
s_search rb PATHL+1
s_title rb PATHL+11 ; window caption
chr db ?
ext db ?
shi dd ?
align 4
cl_3d_normal dd ?
cl_3d_pushed dd ?
cl_3d_outset dd ?
cl_3d_inset dd ?
cl_3d_grayed dd ?
tb_color TBOX
tb_opensave TBOX
tb_find TBOX
tb_replace TBOX
tb_gotorow TBOX
tb_gotocol TBOX
focused_tb dd ?
key1 rb 256
mst db ?
mst2 db ?
mev db ?
mouse_captured db ?
just_from_popup db ?
bot_mode db ?
align 4
bot_dlg_height dd ?
bot_dlg_mode2 db ?
temp_buf dd ?
copy_buf dd ?
include 'data/tp-udata.inc'
;-----------------------------------------------------------------------------
section @PARAMS ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

View File

@ -150,7 +150,7 @@ macro popup_res _name,[_lang,_title,_accel,_action]
m2 = -2
end if
store word (m1*6+m2*6+6*8) at _name+POPUP.width
store word (c1*POP_IHEIGHT+c2*4+4) at _name+POPUP.height
store word (c1*POP_IHEIGHT+c2*POP_SHEIGHT+3) at _name+POPUP.height
store dword (((m1+2)*6-1)*65536) at _name+POPUP.acc_ofs
end if
}
@ -216,7 +216,8 @@ MEV_LDOWN = 1
MEV_LUP = 2
MEV_RDOWN = 3
MEV_RUP = 4
MEV_MOVE = 5
MEV_WHEEL = 5
MEV_MOVE = 6
;// KEY MODIFIERS

View File

@ -101,7 +101,7 @@ button:
call open_sysfuncs_txt
ret
func search
proc search
cld
mov ecx,[cur_editor.Caret.Y]
mov edx,ecx
@ -179,4 +179,4 @@ func search
mov [s_status],s_text_not_found
stc
ret
endf
endp

View File

@ -1,5 +1,5 @@
;-----------------------------------------------------------------------------
func clear_selection ;////////////////////////////////////////////////////////
proc clear_selection ;////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push eax ebx
mov eax,[cur_editor.SelStart.Y]
@ -11,10 +11,10 @@ func clear_selection ;////////////////////////////////////////////////////////
pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X]
pop ebx eax
ret
endf
endp
;-----------------------------------------------------------------------------
func pt_in_rect ;/////////////////////////////////////////////////////////////
proc pt_in_rect ;/////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
cmp eax,[ecx+0x0]
jl @f
@ -28,14 +28,18 @@ func pt_in_rect ;/////////////////////////////////////////////////////////////
ret
@@: clc
ret
endf
endp
;-----------------------------------------------------------------------------
func check_bottom_right ;/////////////////////////////////////////////////////
proc check_bottom_right ;/////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push eax
mov eax,[cur_editor.TopLeft.Y]
add eax,[lines.scr]
or eax,eax
jns @f
xor eax,eax
mov [cur_editor.TopLeft.Y],eax
@@: add eax,[lines.scr]
cmp eax,[cur_editor.Lines.Count]
jbe .lp1
mov eax,[cur_editor.Lines.Count]
@ -44,7 +48,11 @@ func check_bottom_right ;/////////////////////////////////////////////////////
xor eax,eax
@@: mov [cur_editor.TopLeft.Y],eax
.lp1: mov eax,[cur_editor.TopLeft.X]
add eax,[columns.scr]
or eax,eax
jns @f
xor eax,eax
mov [cur_editor.TopLeft.X],eax
@@: add eax,[columns.scr]
cmp eax,[cur_editor.Columns.Count]
jbe .exit
mov eax,[cur_editor.Columns.Count]
@ -55,10 +63,10 @@ func check_bottom_right ;/////////////////////////////////////////////////////
.exit:
pop eax
ret
endf
endp
;-----------------------------------------------------------------------------
func get_real_length ;////////////////////////////////////////////////////////
proc get_real_length ;////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
movzx eax,word[esi]
@@: cmp byte[esi+eax+4-1],' '
@ -66,10 +74,10 @@ func get_real_length ;////////////////////////////////////////////////////////
dec eax
jnz @b
@@: ret
endf
endp
;-----------------------------------------------------------------------------
func get_line_offset ;////////////////////////////////////////////////////////
proc get_line_offset ;////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; Input:
; ECX = line number
@ -86,10 +94,10 @@ func get_line_offset ;////////////////////////////////////////////////////////
.exit:
pop ecx eax
ret
endf
endp
;-----------------------------------------------------------------------------
func init_sel_vars ;//////////////////////////////////////////////////////////
proc init_sel_vars ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
pushad
mov [sel.selected],1
@ -113,10 +121,10 @@ func init_sel_vars ;//////////////////////////////////////////////////////////
mov [sel.end.y],edx
popad
ret
endf
endp
;-----------------------------------------------------------------------------
func get_scroll_vars ;////////////////////////////////////////////////////////
proc get_scroll_vars ;////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; Input:
; EAX = maximum data size (units)
@ -159,10 +167,10 @@ func get_scroll_vars ;////////////////////////////////////////////////////////
mov dword[esp+4],0
mov dword[esp+8],0
jmp @b
endf
endp
;-----------------------------------------------------------------------------
func uint2strz ;//////////////////////////////////////////////////////////////
proc uint2strz ;//////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
dec ebx
jz @f
@ -176,10 +184,10 @@ func uint2strz ;//////////////////////////////////////////////////////////////
das
stosb
ret
endf
endp
;-----------------------------------------------------------------------------
func uint2str ;///////////////////////////////////////////////////////////////
proc uint2str ;///////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
cmp eax,ecx
jb @f
@ -193,10 +201,10 @@ func uint2str ;///////////////////////////////////////////////////////////////
das
stosb
ret
endf
endp
;-----------------------------------------------------------------------------
func strlen ;/////////////////////////////////////////////////////////////////
proc strlen ;/////////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx
mov ebx,eax
@ -207,10 +215,10 @@ func strlen ;/////////////////////////////////////////////////////////////////
jmp @b
@@: pop ebx
ret
endf
endp
;-----------------------------------------------------------------------------
func rgb_to_gray ;////////////////////////////////////////////////////////////
proc rgb_to_gray ;////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push 0 eax
and dword[esp],0x000000FF
@ -235,14 +243,14 @@ func rgb_to_gray ;////////////////////////////////////////////////////////////
pop eax
add esp,4
ret
endf
endp
;float_gray_r dd 0.30f
;float_gray_g dd 0.59f
;float_gray_b dd 0.11f
;-----------------------------------------------------------------------------
func get_active_menu_item ;///////////////////////////////////////////////////
proc get_active_menu_item ;///////////////////////////////////////////////////
;-----------------------------------------------------------------------------
pushad
mov [mi_cur],0
@ -276,10 +284,10 @@ func get_active_menu_item ;///////////////////////////////////////////////////
or [mi_cur],-1
@@: popad
ret
endf
endp
;-----------------------------------------------------------------------------
func get_active_popup_item ;//////////////////////////////////////////////////
proc get_active_popup_item ;//////////////////////////////////////////////////
;-----------------------------------------------------------------------------
pushad
mov [pi_cur],0
@ -296,9 +304,9 @@ func get_active_popup_item ;//////////////////////////////////////////////////
call pt_in_rect
jnc .outside_window
inc dword[ecx+0x0]
mov dword[ecx+0x4],3
mov dword[ecx+0x4],2
dec dword[ecx+0x8]
mov dword[ecx+0xC],3+POP_IHEIGHT-1
mov dword[ecx+0xC],2+POP_IHEIGHT-1
mov edx,[ebp+POPUP.data]
@@: inc [pi_cur]
inc edx
@ -306,12 +314,12 @@ func get_active_popup_item ;//////////////////////////////////////////////////
cmp byte[edx],'-'
jne .lp1
pushd [ecx+0xC]
sub dword[ecx+0xC],POP_IHEIGHT-4
sub dword[ecx+0xC],POP_IHEIGHT-POP_SHEIGHT
call pt_in_rect
popd [ecx+0xC]
jc .separator
add dword[ecx+0x4],4
add dword[ecx+0xC],4
add dword[ecx+0x4],POP_SHEIGHT
add dword[ecx+0xC],POP_SHEIGHT
jmp .lp3
.lp1: call pt_in_rect
jnc .lp2
@ -335,10 +343,10 @@ func get_active_popup_item ;//////////////////////////////////////////////////
.outside_window:
or [pi_cur],-1
jmp .exit
endf
endp
;-----------------------------------------------------------------------------
func line_add_spaces ;////////////////////////////////////////////////////////
proc line_add_spaces ;////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; Input:
; ESI = line offset
@ -378,10 +386,10 @@ func line_add_spaces ;////////////////////////////////////////////////////////
.exit:
popad
ret
endf
endp
;-----------------------------------------------------------------------------
func delete_selection ;///////////////////////////////////////////////////////
proc delete_selection ;///////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; call init_sel_vars
@ -470,10 +478,10 @@ func delete_selection ;///////////////////////////////////////////////////////
.exit.2:
stc
ret
endf
endp
;-----------------------------------------------------------------------------
func get_selection_size ;/////////////////////////////////////////////////////
proc get_selection_size ;/////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ecx esi
mov ecx,[sel.end.y]
@ -485,10 +493,10 @@ func get_selection_size ;/////////////////////////////////////////////////////
sub eax,esi
pop esi ecx
ret
endf
endp
;-----------------------------------------------------------------------------
func get_lines_in_file ;//////////////////////////////////////////////////////
proc get_lines_in_file ;//////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; Input:
; ESI = data pointer
@ -528,10 +536,10 @@ func get_lines_in_file ;//////////////////////////////////////////////////////
sub [esp],edx
xor edx,edx
jmp .lp1
endf
endp
;-----------------------------------------------------------------------------
func update_caption ;/////////////////////////////////////////////////////////
proc update_caption ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
lea esi,[cur_editor.FilePath]
mov edi,s_title
@ -572,12 +580,13 @@ func update_caption ;/////////////////////////////////////////////////////////
add esp,4
clc
ret
endf
endp
;-----------------------------------------------------------------------------
func mem.Alloc ;//////////////////////////////////////////////////////////////
proc mem.Alloc,size ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov eax,[size]
lea ecx,[eax+4+4095]
and ecx,not 4095
mcall 68,12
@ -586,12 +595,20 @@ func mem.Alloc ;//////////////////////////////////////////////////////////////
add eax,4
pop ecx ebx
ret
endf
@^
push ebx ecx
mcall 68,12,[size]
pop ecx ebx
ret
^@
endp
;-----------------------------------------------------------------------------
func mem.ReAlloc ;////////////////////////////////////////////////////////////
proc mem.ReAlloc,mptr,size ;//////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx esi edi eax
mov eax,[mptr]
mov ebx,[size]
or eax,eax
jz @f
lea ecx,[ebx+4+4095]
@ -599,8 +616,7 @@ func mem.ReAlloc ;////////////////////////////////////////////////////////////
add ecx,-4
cmp ecx,[eax-4]
je .exit
@@: mov eax,ebx
call mem.Alloc
@@: stdcall mem.Alloc,ebx
xchg eax,[esp]
or eax,eax
jz .exit
@ -616,18 +632,31 @@ func mem.ReAlloc ;////////////////////////////////////////////////////////////
cld
rep movsd
xchg eax,[esp]
call mem.Free
stdcall mem.Free,eax
.exit:
pop eax edi esi ecx ebx
ret
endf
@^
push ebx ecx edx
mcall 68,20,[size],[mptr]
pop edx ecx ebx
ret
^@
endp
;-----------------------------------------------------------------------------
func mem.Free ;///////////////////////////////////////////////////////////////
proc mem.Free,mptr ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov eax,[mptr]
lea ecx,[eax-4]
mcall 68,13
pop ecx ebx
ret
endf
@^
push ebx ecx
mcall 68,13,[mptr]
pop ecx ebx
ret
^@
endp

View File

@ -1,5 +1,5 @@
;-----------------------------------------------------------------------------
func define_3d_button ;///////////////////////////////////////////////////////
proc define_3d_button ;///////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; ebx = <x,width>
; ecx = <y,height>
@ -26,7 +26,7 @@ func define_3d_button ;///////////////////////////////////////////////////////
mcall 4,,[sc.work_text],[esp+4*8+4*2],[esp+4*8+4*1]
popad
ret 4*3
endf
endp
finddlg_handler:
cmp al,1
@ -641,7 +641,7 @@ botdlg.button:
movzx eax,[tb_replace.length]
add eax,10
call mem.Alloc
stdcall mem.Alloc,eax
mov [copy_buf],eax
movzx eax,[tb_replace.length]
@ -661,8 +661,7 @@ botdlg.button:
call key.ctrl_v
pop [cur_editor.SelStart.X]
mov eax,[copy_buf]
call mem.Free
stdcall mem.Free,[copy_buf]
pop [copy_buf] [copy_count] [copy_size]

View File

@ -1,5 +1,5 @@
;-----------------------------------------------------------------------------
func drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
proc drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
;-----------------------------------------------------------------------------
cmp [just_from_popup],1
@ -10,9 +10,11 @@ func drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
mcall 48,3,sc,sizeof.system_colors
call calc_3d_colors
mcall 12,1
;mcall 12,1
invoke gfx.open,TRUE
mov [ctx],eax
m2m [sc.work],dword[color_tbl.back]
;m2m [sc.work],dword[color_tbl.back]
mov edx,[sc.work]
add edx,0x73000000
@ -110,42 +112,52 @@ func drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
call draw_editor
call draw_tabctl
.exit.2:
mcall 12,2
;mcall 12,2
invoke gfx.close,[ctx]
ret
endf
endp
;-----------------------------------------------------------------------------
func draw_bottom_dialog ;/////////////////////////////////////////////////////
proc draw_bottom_dialog ;/////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
cmp [bot_dlg_height],0
je .exit
pushad
mov ebx,[p_info.client_box.width]
invoke gfx.pen.color,[ctx],[cl_3d_inset]
mov ecx,[bot_ofs]
dec ecx
push cx
shl ecx,16
pop cx
mcall 38,,,[cl_3d_inset]
mov ecx,[bot_ofs-2]
mov cx,word[bot_dlg_height]
dec ecx
mov ebx,[p_info.client_box.width]
inc ebx
mcall 13,,,[cl_3d_normal]
invoke gfx.line,[ctx],0,ecx,[p_info.client_box.width],ecx
invoke gfx.brush.color,[ctx],[cl_3d_normal]
inc ecx
mov eax,ecx
add eax,[bot_dlg_height]
invoke gfx.fillrect,[ctx],0,ecx,[p_info.client_box.width],eax
;mov ebx,[p_info.client_box.width]
;mov ecx,[bot_ofs]
;dec ecx
;push cx
;shl ecx,16
;pop cx
;mcall 38,,,[cl_3d_inset]
;mov ecx,[bot_ofs-2]
;mov cx,word[bot_dlg_height]
;dec ecx
;mov ebx,[p_info.client_box.width]
;inc ebx
;mcall 13,,,[cl_3d_normal]
mov al,1
call [bot_dlg_handler]
popad
.exit:
ret
endf
endp
mi_sel dd ?
mi_cur dd -1
;-----------------------------------------------------------------------------
func draw_main_menu ;/////////////////////////////////////////////////////////
proc draw_main_menu ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov ebx,[p_info.client_box.width]
inc ebx
@ -221,10 +233,10 @@ func draw_main_menu ;/////////////////////////////////////////////////////////
cross:
db 'X'
endf
endp
;-----------------------------------------------------------------------------
func draw_statusbar ;///// DRAW POSITION, MODIFIED STATE, HINT ///////////////
proc draw_statusbar ;///// DRAW POSITION, MODIFIED STATE, HINT ///////////////
;-----------------------------------------------------------------------------
cmp [do_not_draw],1 ; return if drawing is not permitted
jae .exit
@ -298,9 +310,9 @@ func draw_statusbar ;///// DRAW POSITION, MODIFIED STATE, HINT ///////////////
.exit:
ret
endf
endp
func draw_fillrect ; ebx,ecx,edx
proc draw_fillrect ; ebx,ecx,edx
; ebx = <left,width>
; ecx = <top,height>
push ebx ecx edx
@ -310,9 +322,9 @@ func draw_fillrect ; ebx,ecx,edx
mcall 13,,,esi
pop edx ecx ebx
ret
endf
endp
func draw_framerect ; ebx,ecx,edx
proc draw_framerect ; ebx,ecx,edx
; ebx = <left,width>
; ecx = <top,height>
push ebx ecx
@ -341,9 +353,9 @@ func draw_framerect ; ebx,ecx,edx
pop ecx ebx
ret
endf
endp
func draw_check
proc draw_check
push bx
shl ebx,16
pop bx
@ -361,18 +373,18 @@ func draw_check
sub ecx,0x00010001
mcall
ret
endf
endp
func calc_middle
proc calc_middle
shr eax,1
shr ebx,1
and eax,0x007F7F7F
and ebx,0x007F7F7F
add eax,ebx
ret
endf
endp
func calc_3d_colors
proc calc_3d_colors
pushad
m2m [cl_3d_normal],[sc.work]
m2m [cl_3d_inset],[sc.work_graph]
@ -399,9 +411,9 @@ func calc_3d_colors
mov [cl_3d_grayed],eax
popad
ret
endf
endp
func draw_3d_panel ; x,y,w,h
proc draw_3d_panel ; x,y,w,h
push eax ebx ecx edx
cmp dword[esp+16+8],4
jl .exit
@ -447,4 +459,4 @@ func draw_3d_panel ; x,y,w,h
.exit:
pop edx ecx ebx eax
ret 4*4
endf
endp

View File

@ -1,6 +1,6 @@
;-----------------------------------------------------------------------------
func draw_editor ;///// DRAW EDITOR //////////////////////////////////////////
proc draw_editor ;///// DRAW EDITOR //////////////////////////////////////////
;-----------------------------------------------------------------------------
mov ebx,[cur_editor.Bounds.Left-2]
@ -61,10 +61,10 @@ func draw_editor ;///// DRAW EDITOR //////////////////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func draw_editor_gutter ;///// DRAW EDITOR GUTTER (LEFT PANEL) ///////////////
proc draw_editor_gutter ;///// DRAW EDITOR GUTTER (LEFT PANEL) ///////////////
;-----------------------------------------------------------------------------
cmp [cur_editor.Gutter.Visible],0
je .exit
@ -121,10 +121,10 @@ func draw_editor_gutter ;///// DRAW EDITOR GUTTER (LEFT PANEL) ///////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func draw_editor_vscroll ;///// DRAW EDITOR VERTICAL SCROLL BAR //////////////
proc draw_editor_vscroll ;///// DRAW EDITOR VERTICAL SCROLL BAR //////////////
;-----------------------------------------------------------------------------
mov ebx,[cur_editor.Bounds.Right]
shl ebx,16
@ -230,10 +230,10 @@ func draw_editor_vscroll ;///// DRAW EDITOR VERTICAL SCROLL BAR //////////////
mcall 38,,,[cl_3d_inset]
ret
endf
endp
;-----------------------------------------------------------------------------
func draw_editor_hscroll ;///// DRAW EDITOR HORIZONTAL SCROLL BAR ////////////
proc draw_editor_hscroll ;///// DRAW EDITOR HORIZONTAL SCROLL BAR ////////////
;-----------------------------------------------------------------------------
mov ebx,[cur_editor.Bounds.Left-2]
mov bx,SCRLW
@ -338,10 +338,10 @@ func draw_editor_hscroll ;///// DRAW EDITOR HORIZONTAL SCROLL BAR ////////////
mcall 38,,,[cl_3d_inset]
ret
endf
endp
;-----------------------------------------------------------------------------
func draw_editor_text.part ;///// DRAW EDITOR TEXT (PARTLY) //////////////////
proc draw_editor_text.part ;///// DRAW EDITOR TEXT (PARTLY) //////////////////
;-----------------------------------------------------------------------------
; EAX = start line
; EBX = end line
@ -414,10 +414,10 @@ func draw_editor_text.part ;///// DRAW EDITOR TEXT (PARTLY) //////////////////
.exit:
popad
ret
endf
endp
;-----------------------------------------------------------------------------
func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
proc draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
;-----------------------------------------------------------------------------
cmp [cur_editor.Lines],0
jne @f
@ -808,10 +808,10 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
popad
add esp,4
ret
endf
endp
;-----------------------------------------------------------------------------
func draw_editor_text.get_next_part ;/////////////////////////////////////////
proc draw_editor_text.get_next_part ;/////////////////////////////////////////
;-----------------------------------------------------------------------------
; Input:
; ECX = current letter
@ -926,10 +926,10 @@ func draw_editor_text.get_next_part ;/////////////////////////////////////////
mov ecx,[cur_line_len]
mov eax,[color_tbl.text]
ret
endf
endp
;-----------------------------------------------------------------------------
func draw_editor_caret ;///// DRAW EDITOR TEXT CARET /////////////////////////
proc draw_editor_caret ;///// DRAW EDITOR TEXT CARET /////////////////////////
;-----------------------------------------------------------------------------
cmp [bot_mode],0
jne @f
@ -966,10 +966,10 @@ func draw_editor_caret ;///// DRAW EDITOR TEXT CARET /////////////////////////
loop .lp8
@@:
ret
endf
endp
;-----------------------------------------------------------------------------
func editor_realloc_lines ;///// ADD $DELTA$ TO LINES SIZE ///////////////////
proc editor_realloc_lines ;///// ADD $DELTA$ TO LINES SIZE ///////////////////
;-----------------------------------------------------------------------------
; EAX = delta
;-----------------------------------------------------------------------------
@ -979,12 +979,12 @@ func editor_realloc_lines ;///// ADD $DELTA$ TO LINES SIZE ///////////////////
mov eax,[cur_editor.Lines]
mov [cur_editor.Lines.Size],ebx
mov ecx,eax
call mem.ReAlloc
stdcall mem.ReAlloc,eax,ebx
mov [cur_editor.Lines],eax
sub eax,ecx
pop ecx ebx
ret
endf
endp
REDRAW_TEXT = 00000001b
REDRAW_HSCROLL = 00000010b
@ -993,7 +993,7 @@ REDRAW_ONELINE = 00001000b
REDRAW_TWOLINES = 00010000b
;-----------------------------------------------------------------------------
func editor_check_for_changes ;///// EDITOR CHANGES CHECKER //////////////////
proc editor_check_for_changes ;///// EDITOR CHANGES CHECKER //////////////////
;-----------------------------------------------------------------------------
call .check_cursor_visibility
.direct:
@ -1181,4 +1181,4 @@ func editor_check_for_changes ;///// EDITOR CHANGES CHECKER //////////////////
pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X]
@@: pop ebx eax
ret
endf
endp

View File

@ -1,5 +1,5 @@
;-----------------------------------------------------------------------------
func save_file ;//////////////////////////////////////////////////////////////
proc save_file ;//////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov esi,tb_opensave.text
mov edi,f_info.path
@ -21,7 +21,7 @@ func save_file ;//////////////////////////////////////////////////////////////
mov eax,[cur_editor.Lines.Count]
shl eax,1
lea eax,[eax+ebx+1024]
call mem.Alloc
stdcall mem.Alloc,eax
push eax
mov esi,[cur_editor.Lines]
mov edi,eax
@ -55,10 +55,10 @@ func save_file ;//////////////////////////////////////////////////////////////
.exit.2:
stc
ret
endf
endp
;-----------------------------------------------------------------------------
func save_string ;////////////////////////////////////////////////////////////
proc save_string ;////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
movzx ecx,word[esi]
test dword[esi],0x00010000
@ -126,9 +126,9 @@ func save_string ;////////////////////////////////////////////////////////////
movzx eax,word[esi-4]
add esi,eax;[esi-4]
ret
endf
endp
func set_status_fs_error
proc set_status_fs_error
push eax
mov esi,s_fs_error
@@: dec eax
@ -141,10 +141,10 @@ func set_status_fs_error
pop eax
call draw_statusbar
ret
endf
endp
;-----------------------------------------------------------------------------
func load_file ;//////////////////////////////////////////////////////////////
proc load_file ;//////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
cmp [tb_opensave.length],0
jne @f
@ -171,7 +171,7 @@ func load_file ;//////////////////////////////////////////////////////////////
mov [f_info70+0],0
mov eax,dword[file_info.Size]
mov [f_info70+12],eax
call mem.Alloc
stdcall mem.Alloc,eax
mov [f_info70+16],eax
mcall 70,f_info70
@ -185,8 +185,7 @@ func load_file ;//////////////////////////////////////////////////////////////
cmp ebx,6 ;// ATV driver fix (6 instead of 5)
je .file_found
mov eax,[f_info70+16]
call mem.Free
stdcall mem.Free,[f_info70+16]
stc
ret
@ -221,8 +220,7 @@ func load_file ;//////////////////////////////////////////////////////////////
call flush_cur_tab
pop edi esi ecx
call load_from_memory
mov eax,[f_info70+16]
call mem.Free
stdcall mem.Free,[f_info70+16]
xor eax,eax
mov [cur_editor.TopLeft.Y],eax
@ -251,10 +249,10 @@ func load_file ;//////////////////////////////////////////////////////////////
clc
ret
endf
endp
;-----------------------------------------------------------------------------
func load_from_memory ;///////////////////////////////////////////////////////
proc load_from_memory ;///////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; ECX = data length
; ESI = data pointer
@ -265,9 +263,8 @@ func load_from_memory ;///////////////////////////////////////////////////////
lea edx,[ebx+ecx]
imul ebx,eax,14
add ebx,edx
mov eax,[ebp+EDITOR.Lines]
mov [ebp+EDITOR.Lines.Size],ebx
call mem.ReAlloc
stdcall mem.ReAlloc,[ebp+EDITOR.Lines],ebx
mov [ebp+EDITOR.Lines],eax
mov [ebp+EDITOR.Columns.Count],0
@ -335,4 +332,4 @@ func load_from_memory ;///////////////////////////////////////////////////////
mov al,' '
rep stosb
jmp .next_char
endf
endp

View File

@ -109,7 +109,7 @@ key:
jmp key.tab.direct
;-----------------------------------------------------------------------------
func key.ctrl_a ;///// SELECT ALL DOCUMENT ///////////////////////////////////
proc key.ctrl_a ;///// SELECT ALL DOCUMENT ///////////////////////////////////
;-----------------------------------------------------------------------------
xor eax,eax
mov [cur_editor.SelStart.X],eax
@ -122,10 +122,10 @@ func key.ctrl_a ;///// SELECT ALL DOCUMENT ///////////////////////////////////
mov [cur_editor.Caret.X],eax
call draw_editor
ret
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_o ;///// ENTER OPEN FILENAME ///////////////////////////////////
proc key.ctrl_o ;///// ENTER OPEN FILENAME ///////////////////////////////////
;-----------------------------------------------------------------------------
mov [bot_dlg_mode2],0
@ -149,10 +149,10 @@ func key.ctrl_o ;///// ENTER OPEN FILENAME ///////////////////////////////////
mov [tb_casesen],0;1
call drawwindow
ret
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_s ;///// ENTER SAVE FILENAME ///////////////////////////////////
proc key.ctrl_s ;///// ENTER SAVE FILENAME ///////////////////////////////////
;-----------------------------------------------------------------------------
cmp [cur_editor.FilePath], 0
je key.shift_ctrl_s
@ -166,17 +166,17 @@ func key.ctrl_s ;///// ENTER SAVE FILENAME ///////////////////////////////////
key.shift_ctrl_s:
mov [bot_dlg_mode2],1
jmp key.ctrl_o.direct
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_n ;///// CREATE NEW FILE (TAB) /////////////////////////////////
proc key.ctrl_n ;///// CREATE NEW FILE (TAB) /////////////////////////////////
;-----------------------------------------------------------------------------
call create_tab
ret
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_f ;///// ENTER KEYWORD TO FIND /////////////////////////////////
proc key.ctrl_f ;///// ENTER KEYWORD TO FIND /////////////////////////////////
;-----------------------------------------------------------------------------
mov [bot_dlg_mode2],0
mov [bot_dlg_height],16*2+4*2-1
@ -202,18 +202,18 @@ func key.ctrl_f ;///// ENTER KEYWORD TO FIND /////////////////////////////////
mov [tb_casesen],0
call drawwindow
ret
endf
endp
func key.ctrl_h
proc key.ctrl_h
mov [bot_dlg_mode2],1
mov [bot_dlg_height],16*3+4*2+1
mov [s_status],s_enter_text_to_replace
jmp key.ctrl_f.direct
endf
endp
func key.ctrl_g
proc key.ctrl_g
ret
@^
mov [bot_dlg_mode2],0
@ -230,10 +230,10 @@ func key.ctrl_g
call drawwindow
ret
^@
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_left ;///// GO TO PREVIOUS WORD ////////////////////////////////
proc key.ctrl_left ;///// GO TO PREVIOUS WORD ////////////////////////////////
;-----------------------------------------------------------------------------
call clear_selection
@ -323,10 +323,10 @@ func key.ctrl_left ;///// GO TO PREVIOUS WORD ////////////////////////////////
call editor_check_for_changes
.exit.2:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_right ;///// GO TO NEXT WORD ///////////////////////////////////
proc key.ctrl_right ;///// GO TO NEXT WORD ///////////////////////////////////
;-----------------------------------------------------------------------------
call clear_selection
@ -412,28 +412,26 @@ func key.ctrl_right ;///// GO TO NEXT WORD ///////////////////////////////////
call editor_check_for_changes
.exit.2:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_x
proc key.ctrl_x
cmp [sel.selected],0
je @f
call key.ctrl_c
call key.del
mov [cur_editor.Modified],1
@@: ret
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_c
proc key.ctrl_c
mov [copy_size],0
cmp [sel.selected],0
je .exit
call get_selection_size
mov ebx,eax
mov eax,[copy_buf]
call mem.ReAlloc
stdcall mem.ReAlloc,[copy_buf],eax
mov [copy_buf],eax
cld
@ -518,10 +516,10 @@ func key.ctrl_c
jecxz @b
rep stosb
jmp @b
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_v
proc key.ctrl_v
cmp [copy_size],0
je .exit
@ -530,11 +528,10 @@ func key.ctrl_v
mov eax,[copy_size]
call editor_realloc_lines
mov eax,[cur_editor.Lines]
mov ebx,[cur_editor.Lines.Size]
add ebx,[copy_size]
mov [cur_editor.Lines.Size],ebx
call mem.ReAlloc
stdcall mem.ReAlloc,[cur_editor.Lines],ebx
mov [cur_editor.Lines],eax
mov ecx,[cur_editor.Caret.Y]
@ -635,10 +632,10 @@ func key.ctrl_v
mov [cur_editor.Columns.Count],eax
@@: pop eax
ret
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
proc key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
;-----------------------------------------------------------------------------
mov eax,94
call editor_realloc_lines
@ -674,10 +671,10 @@ func key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_y ;///// DELETE CURRENT LINE ///////////////////////////////////
proc key.ctrl_y ;///// DELETE CURRENT LINE ///////////////////////////////////
;-----------------------------------------------------------------------------
mov eax,[cur_editor.Caret.Y]
inc eax
@ -712,10 +709,10 @@ func key.ctrl_y ;///// DELETE CURRENT LINE ///////////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.up ;///// GO TO PREVIOUS LINE ///////////////////////////////////////
proc key.up ;///// GO TO PREVIOUS LINE ///////////////////////////////////////
;-----------------------------------------------------------------------------
call clear_selection
@ -740,10 +737,10 @@ func key.up ;///// GO TO PREVIOUS LINE ///////////////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.down ;///// GO TO NEXT LINE /////////////////////////////////////////
proc key.down ;///// GO TO NEXT LINE /////////////////////////////////////////
;-----------------------------------------------------------------------------
call clear_selection
@ -770,10 +767,10 @@ func key.down ;///// GO TO NEXT LINE /////////////////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.left ;///// GO TO PREVIOUS CHAR /////////////////////////////////////
proc key.left ;///// GO TO PREVIOUS CHAR /////////////////////////////////////
;-----------------------------------------------------------------------------
call clear_selection
@ -791,10 +788,10 @@ func key.left ;///// GO TO PREVIOUS CHAR /////////////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.right ;///// GO TO NEXT CHAR ////////////////////////////////////////
proc key.right ;///// GO TO NEXT CHAR ////////////////////////////////////////
;-----------------------------------------------------------------------------
call clear_selection
@ -813,10 +810,10 @@ func key.right ;///// GO TO NEXT CHAR ////////////////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.pgup ;///// GO TO PREVIOUS PAGE /////////////////////////////////////
proc key.pgup ;///// GO TO PREVIOUS PAGE /////////////////////////////////////
;-----------------------------------------------------------------------------
call clear_selection
@ -841,10 +838,10 @@ func key.pgup ;///// GO TO PREVIOUS PAGE /////////////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.pgdn ;///// GO TO NEXT PAGE /////////////////////////////////////////
proc key.pgdn ;///// GO TO NEXT PAGE /////////////////////////////////////////
;-----------------------------------------------------------------------------
call clear_selection
@ -869,10 +866,10 @@ func key.pgdn ;///// GO TO NEXT PAGE /////////////////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.home ;///// GO TO LINE START ////////////////////////////////////////
proc key.home ;///// GO TO LINE START ////////////////////////////////////////
;-----------------------------------------------------------------------------
call clear_selection
@ -887,10 +884,10 @@ func key.home ;///// GO TO LINE START ////////////////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.end ;///// GO TO LINE END ///////////////////////////////////////////
proc key.end ;///// GO TO LINE END ///////////////////////////////////////////
;-----------------------------------------------------------------------------
call clear_selection
@ -908,10 +905,10 @@ func key.end ;///// GO TO LINE END ///////////////////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_home ;///// GO TO PAGE START ///////////////////////////////////
proc key.ctrl_home ;///// GO TO PAGE START ///////////////////////////////////
;-----------------------------------------------------------------------------
call clear_selection
@ -928,10 +925,10 @@ func key.ctrl_home ;///// GO TO PAGE START ///////////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_end ;///// GO TO PAGE END //////////////////////////////////////
proc key.ctrl_end ;///// GO TO PAGE END //////////////////////////////////////
;-----------------------------------------------------------------------------
call clear_selection
@ -953,10 +950,10 @@ func key.ctrl_end ;///// GO TO PAGE END //////////////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_pgup ;///// GO TO DOCUMENT START ///////////////////////////////
proc key.ctrl_pgup ;///// GO TO DOCUMENT START ///////////////////////////////
;-----------------------------------------------------------------------------
call clear_selection
@ -973,10 +970,10 @@ func key.ctrl_pgup ;///// GO TO DOCUMENT START ///////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_pgdn ;///// GO TO DOCUMENT END /////////////////////////////////
proc key.ctrl_pgdn ;///// GO TO DOCUMENT END /////////////////////////////////
;-----------------------------------------------------------------------------
call clear_selection
@ -997,10 +994,10 @@ func key.ctrl_pgdn ;///// GO TO DOCUMENT END /////////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
proc key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
;-----------------------------------------------------------------------------
call delete_selection
jnc .exit
@ -1139,20 +1136,21 @@ func key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
key.ins:
;// ... toggle insert/overwrite mode here ...
proc key.ins ;///// TOGGLE INSERT/OVERWRITE MODE /////////////////////////////
;-----------------------------------------------------------------------------
xor [ins_mode],1
mov eax,[cur_editor.Caret.Y]
mov ebx,eax
call draw_editor_text.part
call draw_editor_caret
ret
endp
;-----------------------------------------------------------------------------
func key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION ////////////////////
proc key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION ////////////////////
;-----------------------------------------------------------------------------
call delete_selection
jnc key.del.exit
@ -1212,10 +1210,10 @@ func key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION ////////////////////
dec [cur_editor.Caret.Y]
cld
jmp key.del.line_up
endf
endp
;-----------------------------------------------------------------------------
func key.tab ;///// TABULATE /////////////////////////////////////////////////
proc key.tab ;///// TABULATE /////////////////////////////////////////////////
;-----------------------------------------------------------------------------
call delete_selection
mov eax,[cur_editor.Caret.X]
@ -1297,10 +1295,10 @@ func key.tab ;///// TABULATE /////////////////////////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
proc key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
;-----------------------------------------------------------------------------
call delete_selection
@ -1432,10 +1430,10 @@ func key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_tab ;///// SWITCH TO NEXT TAB //////////////////////////////////
proc key.ctrl_tab ;///// SWITCH TO NEXT TAB //////////////////////////////////
;-----------------------------------------------------------------------------
cmp [tab_bar.Items.Count],1
je .exit
@ -1459,10 +1457,10 @@ func key.ctrl_tab ;///// SWITCH TO NEXT TAB //////////////////////////////////
call update_caption
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.shift_ctrl_tab ;///// SWITCH TO PREVIOUS TAB ////////////////////////
proc key.shift_ctrl_tab ;///// SWITCH TO PREVIOUS TAB ////////////////////////
;-----------------------------------------------------------------------------
cmp [tab_bar.Items.Count],1
je .exit
@ -1487,10 +1485,10 @@ func key.shift_ctrl_tab ;///// SWITCH TO PREVIOUS TAB ////////////////////////
call update_caption
.exit:
ret
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_f4 ;///// CLOSE CURRENT TAB ////////////////////////////////////
proc key.ctrl_f4 ;///// CLOSE CURRENT TAB ////////////////////////////////////
;-----------------------------------------------------------------------------
cmp [cur_editor.Modified], 0
je .close
@ -1511,10 +1509,10 @@ func key.ctrl_f4 ;///// CLOSE CURRENT TAB ////////////////////////////////////
call draw_tabctl
call draw_statusbar
ret
endf
endp
;-----------------------------------------------------------------------------
func key.shift_f9 ;///// SET DEFAULT TAB /////////////////////////////////////
proc key.shift_f9 ;///// SET DEFAULT TAB /////////////////////////////////////
;-----------------------------------------------------------------------------
mov eax,[tab_bar.Current.Ptr]
cmp eax,[tab_bar.Default.Ptr]
@ -1529,34 +1527,34 @@ func key.shift_f9 ;///// SET DEFAULT TAB /////////////////////////////////////
call draw_editor
@@: call draw_tabctl
ret
endf
endp
;-----------------------------------------------------------------------------
func key.f3 ;///// FIND NEXT MATCH ///////////////////////////////////////////
proc key.f3 ;///// FIND NEXT MATCH ///////////////////////////////////////////
;-----------------------------------------------------------------------------
call search
jc @f
@@: ret
endf
endp
;-----------------------------------------------------------------------------
func key.f9 ;///// COMPILE AND RUN ///////////////////////////////////////////
proc key.f9 ;///// COMPILE AND RUN ///////////////////////////////////////////
;-----------------------------------------------------------------------------
mov bl,1
call start_fasm
ret
endf
endp
;-----------------------------------------------------------------------------
func key.ctrl_f9 ;///// COMPILE //////////////////////////////////////////////
proc key.ctrl_f9 ;///// COMPILE //////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov bl,0
call start_fasm
ret
endf
endp
;-----------------------------------------------------------------------------
func key.alt_x ;///// EXIT PROGRAM ///////////////////////////////////////////
proc key.alt_x ;///// EXIT PROGRAM ///////////////////////////////////////////
;-----------------------------------------------------------------------------
mov esi,self_path
mov byte[esi+PATHL-1],0
@ -1583,4 +1581,4 @@ func key.alt_x ;///// EXIT PROGRAM ///////////////////////////////////////////
jne .bgn_rp
mov [main_closed],1
mcall -1
endf
endp

View File

@ -1,4 +1,4 @@
func check_mouse_in_edit_area
proc check_mouse_in_edit_area
mcall 37,1
mov ebx,eax
and ebx,0x0000FFFF
@ -16,16 +16,24 @@ func check_mouse_in_edit_area
mov ecx,__rc
call pt_in_rect
ret
endf
endp
func get_mouse_event
proc get_mouse_event
mcall 37,2
and al,3
mov bl,[ecx]
cmp [ecx],al
mov [ecx],al
jne @f
mov eax,MEV_MOVE
mcall 37,7
or eax,eax
jz .mv
add [ecx+6],ax
shr eax,16
add [ecx+4],ax
mov eax,MEV_WHEEL
ret
.mv: mov eax,MEV_MOVE
ret
@@: mov bh,al
and ebx,0x0101
@ -43,9 +51,9 @@ func get_mouse_event
ret
@@: mov eax,MEV_RUP
ret
endf
endp
mouse_ev dd mouse.l_down,mouse.l_up,mouse.r_down,mouse.r_up,mouse.move
mouse_ev dd mouse.l_down,mouse.l_up,mouse.r_down,mouse.r_up,mouse.wheel,mouse.move
mouse:
mov ecx,mst
@ -76,6 +84,19 @@ mouse:
@@: mov [mev],al
jmp [mouse_ev+eax*4-4]
.wheel:
movsx eax,word[mst+4]
lea eax,[eax*3]
add [cur_editor.TopLeft.X],eax
movsx eax,word[mst+6]
lea eax,[eax*3]
add [cur_editor.TopLeft.Y],eax
xor eax,eax
mov [mst+4],eax
call check_bottom_right
call draw_editor
jmp still.skip_write
.move:
mcall 37,1
movsx ebx,ax

View File

@ -1,6 +1,7 @@
;POP_WIDTH = (popup_text.max_title+popup_text.max_accel+6)*6
POP_IHEIGHT = 16
POP_SHEIGHT = 3
;POP_HEIGHT = popup_text.cnt_item*POP_IHEIGHT+popup_text.cnt_sep*4+4
popup_thread_start:

View File

@ -37,58 +37,4 @@ recode:
jmp @b
.exit:
ret
table.866.1251 db \
$C0,$C1,$C2,$C3,$C4,$C5,$C6,$C7 , $C8,$C9,$CA,$CB,$CC,$CD,$CE,$CF,\
$D0,$D1,$D2,$D3,$D4,$D5,$D6,$D7 , $D8,$D9,$DA,$DB,$DC,$DD,$DE,$DF,\
$E0,$E1,$E2,$E3,$E4,$E5,$E6,$E7 , $E8,$E9,$EA,$EB,$EC,$ED,$EE,$EF,\
$00,$00,$00,$00,$00,$00,$00,$00 , $00,$00,$00,$00,$00,$00,$00,$00,\
$00,$00,$00,$00,$00,$00,$00,$00 , $00,$00,$00,$00,$00,$00,$00,$00,\
$00,$00,$00,$00,$00,$00,$00,$00 , $00,$00,$00,$00,$00,$00,$00,$00,\
$F0,$F1,$F2,$F3,$F4,$F5,$F6,$F7 , $F8,$F9,$FA,$FB,$FC,$FD,$FE,$FF,\
$A8,$B8,$AA,$BA,$AF,$BF,$A1,$A2 , $B0,$95,$B7,$00,$B9,$A4,$00,$00
table.1251.866 db \
$00,$00,$00,$00,$00,$00,$00,$00 , $00,$00,$00,$00,$00,$00,$00,$00,\
$00,$00,$00,$00,$00,$F9,$00,$00 , $00,$00,$00,$00,$00,$00,$00,$00,\
$00,$F6,$F7,$00,$FD,$00,$00,$00 , $F0,$00,$F2,$00,$00,$00,$00,$F4,\
$F8,$00,$00,$00,$00,$00,$00,$FA , $F1,$FC,$F3,$00,$00,$00,$00,$F5,\
$80,$81,$82,$83,$84,$85,$86,$87 , $88,$89,$8A,$8B,$8C,$8D,$8E,$8F,\
$90,$91,$92,$93,$94,$95,$96,$97 , $98,$99,$9A,$9B,$9C,$9D,$9E,$9F,\
$A0,$A1,$A2,$A3,$A4,$A5,$A6,$A7 , $A8,$A9,$AA,$AB,$AC,$AD,$AE,$AF,\
$E0,$E1,$E2,$E3,$E4,$E5,$E6,$E7 , $E8,$E9,$EA,$EB,$EC,$ED,$EE,$EF
table.866.koi db \
$E1,$E2,$F7,$E7,$E4,$E5,$F6,$FA , $E9,$EA,$EB,$EC,$ED,$EE,$EF,$F0,\
$F2,$F3,$F4,$F5,$E6,$E8,$E3,$FE , $FB,$FD,$FF,$F9,$F8,$FC,$E0,$F1,\
$C1,$C2,$D7,$C7,$C4,$C5,$D6,$DA , $C9,$CA,$CB,$CC,$CD,$CE,$CF,$D0,\
$90,$00,$00,$81,$87,$00,$00,$00 , $00,$00,$00,$00,$00,$00,$00,$83,\
$84,$89,$88,$86,$80,$8A,$00,$00 , $00,$00,$00,$00,$00,$00,$00,$00,\
$00,$00,$00,$00,$00,$00,$00,$00 , $00,$85,$82,$8D,$8C,$8E,$8F,$8B,\
$D2,$D3,$D4,$D5,$C6,$C8,$C3,$DE , $DB,$DD,$DF,$D9,$D8,$DC,$C0,$D1,\
$B3,$A3,$B4,$A4,$B7,$A7,$BE,$AE , $00,$95,$9E,$00,$B0,$9F,$00,$A0
table.koi.866 db \
$C4,$B3,$DA,$BF,$C0,$D9,$C3,$B4 , $C2,$C1,$C5,$DF,$DC,$DB,$DD,$DE,\
$B0,$00,$00,$00,$00,$F9,$00,$00 , $00,$00,$00,$00,$00,$00,$FA,$FD,\
$FF,$00,$00,$F1,$F3,$00,$00,$F5 , $00,$00,$00,$00,$00,$00,$F7,$00,\
$FC,$00,$00,$F0,$F2,$00,$00,$F4 , $00,$00,$00,$00,$00,$00,$F6,$00,\
$EE,$A0,$A1,$E6,$A4,$A5,$E4,$A3 , $E5,$A8,$A9,$AA,$AB,$AC,$AD,$AE,\
$AF,$EF,$E0,$E1,$E2,$E3,$A6,$A2 , $EC,$EB,$A7,$E8,$ED,$E9,$E7,$EA,\
$9E,$80,$81,$96,$84,$85,$94,$83 , $95,$88,$89,$8A,$8B,$8C,$8D,$8E,\
$8F,$9F,$90,$91,$92,$93,$86,$82 , $9C,$9B,$87,$98,$9D,$99,$97,$9A
table.1251.koi db \
$B1,$B2,$00,$A2,$00,$00,$00,$00 , $00,$00,$B9,$00,$BA,$BC,$BB,$BF,\
$A1,$91,$92,$93,$94,$95,$96,$97 , $00,$99,$A9,$00,$AA,$AC,$AB,$AF,\
$A0,$BE,$AE,$B8,$9F,$BD,$00,$00 , $B3,$98,$B4,$9D,$00,$00,$9C,$B7,\
$00,$00,$B6,$A6,$AD,$00,$00,$9E , $A3,$B0,$A4,$9B,$A8,$B5,$A5,$A7,\
$E1,$E2,$F7,$E7,$E4,$E5,$F6,$FA , $E9,$EA,$EB,$EC,$ED,$EE,$EF,$F0,\
$F2,$F3,$F4,$F5,$E6,$E8,$E3,$FE , $FB,$FD,$FF,$F9,$F8,$FC,$E0,$F1,\
$C1,$C2,$D7,$C7,$C4,$C5,$D6,$DA , $C9,$CA,$CB,$CC,$CD,$CE,$CF,$D0,\
$D2,$D3,$D4,$D5,$C6,$C8,$C3,$DE , $DB,$DD,$DF,$D9,$D8,$DC,$C0,$D1
table.koi.1251 db \
$00,$00,$00,$00,$00,$00,$00,$00 , $00,$00,$00,$00,$00,$00,$00,$00,\
$00,$91,$92,$93,$94,$95,$96,$97 , $00,$99,$00,$BB,$AE,$AB,$B7,$A4,\
$A0,$90,$83,$B8,$BA,$BE,$B3,$BF , $BC,$9A,$9C,$9E,$9D,$B4,$A2,$9F,\
$B9,$80,$81,$A8,$AA,$BD,$B2,$AF , $A3,$8A,$8C,$8E,$8D,$A5,$A1,$8F,\
$FE,$E0,$E1,$F6,$E4,$E5,$F4,$E3 , $F5,$E8,$E9,$EA,$EB,$EC,$ED,$EE,\
$EF,$FF,$F0,$F1,$F2,$F3,$E6,$E2 , $FC,$FB,$E7,$F8,$FD,$F9,$F7,$FA,\
$DE,$C0,$C1,$D6,$C4,$C5,$D4,$C3 , $D5,$C8,$C9,$CA,$CB,$CC,$CD,$CE,\
$CF,$DF,$D0,$D1,$D2,$D3,$C6,$C2 , $DC,$DB,$C7,$D8,$DD,$D9,$D7,$DA

View File

@ -1,5 +1,5 @@
;-----------------------------------------------------------------------------
func flush_cur_tab ;///// SAVE CURRENT TAB DATA TO CONTROL ///////////////////
proc flush_cur_tab ;///// SAVE CURRENT TAB DATA TO CONTROL ///////////////////
;-----------------------------------------------------------------------------
; EBP = TABITEM*
;-----------------------------------------------------------------------------
@ -11,10 +11,10 @@ func flush_cur_tab ;///// SAVE CURRENT TAB DATA TO CONTROL ///////////////////
rep movsd
pop edi esi ecx
ret
endf
endp
;-----------------------------------------------------------------------------
func set_cur_tab ;///// SET SPECIFIED TAB CURRENT (FOCUS IT) /////////////////
proc set_cur_tab ;///// SET SPECIFIED TAB CURRENT (FOCUS IT) /////////////////
;-----------------------------------------------------------------------------
; EBP = TABITEM*
;-----------------------------------------------------------------------------
@ -30,10 +30,10 @@ func set_cur_tab ;///// SET SPECIFIED TAB CURRENT (FOCUS IT) /////////////////
; call update_caption
pop edi esi ecx
ret
endf
endp
;-----------------------------------------------------------------------------
func make_tab_visible ;///// MAKE SPECIFIED TAB VISIBLE IF IT'S OFFSCREEN ////
proc make_tab_visible ;///// MAKE SPECIFIED TAB VISIBLE IF IT'S OFFSCREEN ////
;-----------------------------------------------------------------------------
call flush_cur_tab
imul eax,[tab_bar.Items.Left],sizeof.TABITEM
@ -64,10 +64,10 @@ func make_tab_visible ;///// MAKE SPECIFIED TAB VISIBLE IF IT'S OFFSCREEN ////
div ebx
@@: mov [tab_bar.Items.Left],eax
ret
endf
endp
;-----------------------------------------------------------------------------
func create_tab ;///// ADD TAB TO THE END ////////////////////////////////////
proc create_tab ;///// ADD TAB TO THE END ////////////////////////////////////
;-----------------------------------------------------------------------------
push eax ecx esi edi
@ -75,7 +75,7 @@ func create_tab ;///// ADD TAB TO THE END ////////////////////////////////////
imul ebx,[tab_bar.Items.Count],sizeof.TABITEM
mov eax,[tab_bar.Items]
mov ecx,eax
call mem.ReAlloc
stdcall mem.ReAlloc,eax,ebx
mov [tab_bar.Items],eax
sub ecx,eax
sub [tab_bar.Current.Ptr],ecx
@ -87,7 +87,7 @@ func create_tab ;///// ADD TAB TO THE END ////////////////////////////////////
mov eax,1024
mov [cur_editor.Lines.Size],eax
call mem.Alloc
stdcall mem.Alloc,eax
mov [cur_editor.Lines],eax
mov [cur_editor.Lines.Count],1
mov [cur_editor.Columns.Count],1
@ -131,10 +131,10 @@ func create_tab ;///// ADD TAB TO THE END ////////////////////////////////////
mov ebp,cur_tab
pop edi esi ecx eax
ret
endf
endp
;-----------------------------------------------------------------------------
func delete_tab ;///// DELETE SPECIFIED TAB //////////////////////////////////
proc delete_tab ;///// DELETE SPECIFIED TAB //////////////////////////////////
;-----------------------------------------------------------------------------
cmp [tab_bar.Default.Ptr],0
je @f
@ -146,8 +146,7 @@ func delete_tab ;///// DELETE SPECIFIED TAB //////////////////////////////////
.lp1:
mov [tab_bar.Default.Ptr],0
@@: mov eax,[ebp+TABITEM.Editor.Lines]
call mem.Free
@@: stdcall mem.Free,[ebp+TABITEM.Editor.Lines]
imul ecx,[tab_bar.Items.Count],sizeof.TABITEM
add ecx,[tab_bar.Items]
sub ecx,ebp
@ -164,7 +163,7 @@ func delete_tab ;///// DELETE SPECIFIED TAB //////////////////////////////////
push ebx
mov eax,[tab_bar.Items]
mov ecx,eax
call mem.ReAlloc
stdcall mem.ReAlloc,eax,ebx
mov [tab_bar.Items],eax
sub ecx,eax
sub ebp,ecx
@ -188,17 +187,16 @@ func delete_tab ;///// DELETE SPECIFIED TAB //////////////////////////////////
ret
.no_tabs:
mov eax,[tab_bar.Items]
call mem.Free
stdcall mem.Free,[tab_bar.Items]
xor eax,eax
mov [tab_bar.Items],eax
mov [tab_bar.Current.Ptr],eax
mov [tab_bar.Default.Ptr],eax
ret
endf
endp
;-----------------------------------------------------------------------------
func draw_tabctl ;///// DRAW TAB CONTROL /////////////////////////////////////
proc draw_tabctl ;///// DRAW TAB CONTROL /////////////////////////////////////
;-----------------------------------------------------------------------------
dec [tab_bar.Items.Left]
@ -374,7 +372,7 @@ func draw_tabctl ;///// DRAW TAB CONTROL /////////////////////////////////////
call dword[esp+(8+4)+8+8]
mcall 13,,,[sc.work]
pop ecx ebx
mov edx,[color_tbl.text]
mov edx,[sc.work_text];[color_tbl.text]
.draw_tabs.inactive:
cmp ebp,[tab_bar.Default.Ptr]
@ -562,10 +560,10 @@ func draw_tabctl ;///// DRAW TAB CONTROL /////////////////////////////////////
movzx ecx,cx
lea edi,[edi+ecx+1]
ret
endf
endp
;-----------------------------------------------------------------------------
func get_tab_size ;///// GET TAB WIDTH ///////////////////////////////////////
proc get_tab_size ;///// GET TAB WIDTH ///////////////////////////////////////
;-----------------------------------------------------------------------------
; EBP = TABITEM*
;-----------------------------------------------------------------------------
@ -586,10 +584,10 @@ func get_tab_size ;///// GET TAB WIDTH ///////////////////////////////////////
.lp2: mov ecx,TBARH-1
pop eax
ret
endf
endp
;-----------------------------------------------------------------------------
func get_max_tab_width ;///// GET WIDTH OF LONGEST TAB ///////////////////////
proc get_max_tab_width ;///// GET WIDTH OF LONGEST TAB ///////////////////////
;-----------------------------------------------------------------------------
push ebx ecx ebp
mov ecx,[tab_bar.Items.Count]
@ -618,10 +616,10 @@ func get_max_tab_width ;///// GET WIDTH OF LONGEST TAB ///////////////////////
add eax,13
@@: pop ebp ecx ebx
ret
endf
endp
;-----------------------------------------------------------------------------
func get_hidden_tabitems_number ;/////////////////////////////////////////////
proc get_hidden_tabitems_number ;/////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov al,[tab_bar.Style]
dec al
@ -676,10 +674,10 @@ func get_hidden_tabitems_number ;/////////////////////////////////////////////
@@: pop ecx
mov eax,ecx
ret 8
endf
endp
;-----------------------------------------------------------------------------
func align_editor_in_tab ;///// ADJUST EDITOR POSITION TO FIT IN TAB /////////
proc align_editor_in_tab ;///// ADJUST EDITOR POSITION TO FIT IN TAB /////////
;-----------------------------------------------------------------------------
m2m [cur_editor.Bounds.Left],[tab_bar.Bounds.Left]
m2m [cur_editor.Bounds.Top],[tab_bar.Bounds.Top]
@ -720,4 +718,4 @@ func align_editor_in_tab ;///// ADJUST EDITOR POSITION TO FIT IN TAB /////////
.tabs_on_right:
sub [cur_editor.Bounds.Right],ebx
ret
endf
endp

View File

@ -6,7 +6,7 @@ tb.pos.x db ?
tb.sel.x db ?
tb.sel.selected db ?
func textbox.get_width
proc textbox.get_width
push ebx edx
movzx eax,[tbox.width]
add eax,-6
@ -19,9 +19,9 @@ func textbox.get_width
mov eax,ebx
@@: pop edx ebx
ret
endf
endp
func textbox.delete_selection
proc textbox.delete_selection
cmp [tb.sel.selected],0
je .exit.2
pushad
@ -49,9 +49,9 @@ func textbox.delete_selection
.exit.2:
stc
ret
endf
endp
func textbox.draw ; TBOX* ebp
proc textbox.draw ; TBOX* ebp
call textbox.get_width
movzx ebx,[tbox.pos.x]
sub bl,[tbox.ofs.x]
@ -196,9 +196,9 @@ func textbox.draw ; TBOX* ebp
add ebx,0x00010001
mcall
ret
endf
endp
func textbox.key
proc textbox.key
mov ebp,[focused_tb]
mov esi,accel_table_textbox
.acc: cmp ebx,[esi]
@ -243,12 +243,12 @@ func textbox.key
call textbox.draw
.exit:
ret
endf
endp
textbox.mouse:
ret
func key.tb.bkspace
proc key.tb.bkspace
call textbox.delete_selection
jnc @f
@ -258,17 +258,17 @@ func key.tb.bkspace
jmp key.tb.del.direct
@@: ret
endf
endp
func key.tb.home
proc key.tb.home
xor al,al
mov [tbox.pos.x],al
mov [tbox.sel.x],al
mov [tbox.ofs.x],al
ret
endf
endp
func key.tb.left
proc key.tb.left
mov al,[tbox.pos.x]
mov [tbox.sel.x],al
dec al
@ -281,9 +281,9 @@ func key.tb.left
jge @f
mov [tbox.ofs.x],0
@@: ret
endf
endp
func key.tb.right
proc key.tb.right
call textbox.get_width
mov bl,[tbox.pos.x]
mov [tbox.sel.x],bl
@ -297,9 +297,9 @@ func key.tb.right
jbe @f
inc [tbox.ofs.x]
@@: ret
endf
endp
func key.tb.end
proc key.tb.end
call textbox.get_width
movzx ebx,[tbox.length]
mov [tbox.pos.x],bl
@ -309,9 +309,9 @@ func key.tb.end
xor bl,bl
@@: mov [tbox.ofs.x],bl
ret
endf
endp
func key.tb.del
proc key.tb.del
call textbox.delete_selection
jnc @f
.direct:
@ -327,16 +327,16 @@ func key.tb.del
rep movsb
@@: ret
endf
endp
func key.tb.shift_home
proc key.tb.shift_home
xor al,al
mov [tbox.pos.x],al
mov [tbox.ofs.x],al
ret
endf
endp
func key.tb.shift_left
proc key.tb.shift_left
mov al,[tbox.pos.x]
dec al
js @f
@ -347,9 +347,9 @@ func key.tb.shift_left
jge @f
mov [tbox.ofs.x],0
@@: ret
endf
endp
func key.tb.shift_right
proc key.tb.shift_right
call textbox.get_width
mov bl,[tbox.pos.x]
inc bl
@ -361,9 +361,9 @@ func key.tb.shift_right
jbe @f
inc [tbox.ofs.x]
@@: ret
endf
endp
func key.tb.shift_end
proc key.tb.shift_end
call textbox.get_width
movzx ebx,[tbox.length]
mov [tbox.pos.x],bl
@ -372,4 +372,4 @@ func key.tb.shift_end
xor bl,bl
@@: mov [tbox.ofs.x],bl
ret
endf
endp

View File

@ -1,6 +1,47 @@
@^ fix macro comment {
^@ fix }
; -------------------------
macro library [lname,fname]
{
forward
dd __#lname#_library_table__,__#lname#_library_name__
common
dd 0
forward
align 4
__#lname#_library_name__ db fname,0
}
macro import lname,[name,sname]
{
common
align 4
__#lname#_library_table__:
forward
if used name
name dd __#name#_import_name__
end if
common
dd 0
forward
if used name
align 4
__#name#_import_name__ db sname,0
end if
}
macro export [name,sname]
{
forward
dd __#name#_export_name__,name
common
dd 0
forward
align 4
__#name#_export_name__ db sname,0
}
; -------------------------
macro m2m dest,src {
push src
@ -499,4 +540,4 @@ EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
EVM_STACK = 10000000b

270
programs/proc32.inc Normal file
View File

@ -0,0 +1,270 @@
; Macroinstructions for defining and calling procedures
macro stdcall proc,[arg] ; directly call STDCALL procedure
{ common
if ~ arg eq
reverse
pushd arg
common
end if
call proc }
macro invoke proc,[arg] ; indirectly call STDCALL procedure
{ common
if ~ arg eq
reverse
pushd arg
common
end if
call [proc] }
macro ccall proc,[arg] ; directly call CDECL procedure
{ common
size@ccall = 0
if ~ arg eq
reverse
pushd arg
size@ccall = size@ccall+4
common
end if
call proc
if size@ccall
add esp,size@ccall
end if }
macro cinvoke proc,[arg] ; indirectly call CDECL procedure
{ common
size@ccall = 0
if ~ arg eq
reverse
pushd arg
size@ccall = size@ccall+4
common
end if
call [proc]
if size@ccall
add esp,size@ccall
end if }
macro proc [args] ; define procedure
{ common
match name params, args>
\{ define@proc name,<params \} }
prologue@proc equ prologuedef
macro prologuedef procname,flag,parmbytes,localbytes,reglist
{ if parmbytes | localbytes
push ebp
mov ebp,esp
if localbytes
sub esp,localbytes
end if
end if
irps reg, reglist \{ push reg \} }
epilogue@proc equ epiloguedef
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
{ irps reg, reglist \{ reverse pop reg \}
if parmbytes | localbytes
leave
end if
if flag and 10000b
retn
else
retn parmbytes
end if }
macro define@proc name,statement
{ local params,flag,regs,parmbytes,localbytes,current
if used name
name:
match =stdcall args, statement \{ params equ args
flag = 11b \}
match =stdcall, statement \{ params equ
flag = 11b \}
match =c args, statement \{ params equ args
flag = 10001b \}
match =c, statement \{ params equ
flag = 10001b \}
match =params, params \{ params equ statement
flag = 0 \}
virtual at ebp+8
match =uses reglist=,args, params \{ regs equ reglist
params equ args \}
match =regs =uses reglist, regs params \{ regs equ reglist
params equ \}
match =regs, regs \{ regs equ \}
match =,args, params \{ defargs@proc args \}
match =args@proc args, args@proc params \{ defargs@proc args \}
parmbytes = $ - (ebp+8)
end virtual
name # % = parmbytes/4
all@vars equ
current = 0
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
macro locals
\{ virtual at ebp-localbytes+current
macro label def \\{ match . type,def> \\\{ deflocal@proc .,label,<type \\\} \\}
struc db [val] \\{ \common deflocal@proc .,db,val \\}
struc du [val] \\{ \common deflocal@proc .,du,val \\}
struc dw [val] \\{ \common deflocal@proc .,dw,val \\}
struc dp [val] \\{ \common deflocal@proc .,dp,val \\}
struc dd [val] \\{ \common deflocal@proc .,dd,val \\}
struc dt [val] \\{ \common deflocal@proc .,dt,val \\}
struc dq [val] \\{ \common deflocal@proc .,dq,val \\}
struc rb cnt \\{ deflocal@proc .,rb cnt, \\}
struc rw cnt \\{ deflocal@proc .,rw cnt, \\}
struc rp cnt \\{ deflocal@proc .,rp cnt, \\}
struc rd cnt \\{ deflocal@proc .,rd cnt, \\}
struc rt cnt \\{ deflocal@proc .,rt cnt, \\}
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \}
macro endl
\{ purge label
restruc db,du,dw,dp,dd,dt,dq
restruc rb,rw,rp,rd,rt,rq
current = $-(ebp-localbytes)
end virtual \}
macro ret operand
\{ match any, operand \\{ retn operand \\}
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs>
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2
end if \} }
macro defargs@proc [arg]
{ common
if ~ arg eq
forward
local ..arg,current@arg
match argname:type, arg
\{ current@arg equ argname
label ..arg type
argname equ ..arg
if dqword eq type
dd ?,?,?,?
else if tbyte eq type
dd ?,?,?
else if qword eq type | pword eq type
dd ?,?
else
dd ?
end if \}
match =current@arg,current@arg
\{ current@arg equ arg
arg equ ..arg
..arg dd ? \}
common
args@proc equ current@arg
forward
restore current@arg
common
end if }
macro deflocal@proc name,def,[val]
{ common
match vars, all@vars \{ all@vars equ all@vars, \}
all@vars equ all@vars name
forward
local ..var,..tmp
match =label,def \{ ..tmp equ \}
match tmp,..tmp \{ ..var def val \}
match ,..tmp \{ label ..var val \}
match =?, val \{ ..tmp equ \}
match any =dup (=?), val \{ ..tmp equ \}
match tmp : value, ..tmp : val
\{ tmp: end virtual
initlocal@proc ..var,def value
virtual at tmp\}
common
match first rest, ..var, \{ name equ first \} }
macro initlocal@proc name,def
{ virtual at name
def
size@initlocal = $ - name
end virtual
position@initlocal = 0
while size@initlocal > position@initlocal
virtual at name
def
if size@initlocal - position@initlocal < 2
current@initlocal = 1
load byte@initlocal byte from name+position@initlocal
else if size@initlocal - position@initlocal < 4
current@initlocal = 2
load word@initlocal word from name+position@initlocal
else
current@initlocal = 4
load dword@initlocal dword from name+position@initlocal
end if
end virtual
if current@initlocal = 1
mov byte [name+position@initlocal],byte@initlocal
else if current@initlocal = 2
mov word [name+position@initlocal],word@initlocal
else
mov dword [name+position@initlocal],dword@initlocal
end if
position@initlocal = position@initlocal + current@initlocal
end while }
macro endp
{ purge ret,locals,endl
finish@proc
purge finish@proc
restore regs@proc
match all,args@proc \{ restore all \}
restore args@proc
match all,all@vars \{ restore all \} }
macro local [var]
{ common
locals
forward done@local equ
match varname[count]:vartype, var
\{ match =BYTE, vartype \\{ varname rb count
restore done@local \\}
match =WORD, vartype \\{ varname rw count
restore done@local \\}
match =DWORD, vartype \\{ varname rd count
restore done@local \\}
match =PWORD, vartype \\{ varname rp count
restore done@local \\}
match =QWORD, vartype \\{ varname rq count
restore done@local \\}
match =TBYTE, vartype \\{ varname rt count
restore done@local \\}
match =DQWORD, vartype \\{ label varname dqword
rq count+count
restore done@local \\}
match , done@local \\{ virtual
varname vartype
end virtual
rb count*sizeof.\#vartype
restore done@local \\} \}
match :varname:vartype, done@local:var
\{ match =BYTE, vartype \\{ varname db ?
restore done@local \\}
match =WORD, vartype \\{ varname dw ?
restore done@local \\}
match =DWORD, vartype \\{ varname dd ?
restore done@local \\}
match =PWORD, vartype \\{ varname dp ?
restore done@local \\}
match =QWORD, vartype \\{ varname dq ?
restore done@local \\}
match =TBYTE, vartype \\{ varname dt ?
restore done@local \\}
match =DQWORD, vartype \\{ label varname dqword
dq ?,?
restore done@local \\}
match , done@local \\{ varname vartype
restore done@local \\} \}
match ,done@local
\{ var
restore done@local \}
common
endl }