add program 'TextEditor' version 29.12.09
git-svn-id: svn://kolibrios.org@1338 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
db3d073d65
commit
c65339bd59
13
programs/other/t_edit/build.bat
Normal file
13
programs/other/t_edit/build.bat
Normal file
@ -0,0 +1,13 @@
|
||||
if not exist bin mkdir bin
|
||||
@fasm.exe -m 16384 ..\..\develop\libraries\box_lib\trunk\box_lib.asm bin\box_lib.obj
|
||||
@kpack bin\box_lib.obj
|
||||
|
||||
@fasm.exe -m 16384 t_edit.asm bin\t_edit.kex
|
||||
@kpack bin\t_edit.kex
|
||||
@copy ..\..\develop\libraries\box_lib\trunk\tl_sys_16.bmp bin\tl_sys_16.bmp
|
||||
@copy ..\..\develop\libraries\box_lib\trunk\tl_nod_16.bmp bin\tl_nod_16.bmp
|
||||
@copy msgbox.obj bin\msgbox.obj
|
||||
@copy te_icon.bmp bin\te_icon.bmp
|
||||
if not exist bin\info mkdir bin\info
|
||||
copy info\* bin\info\*
|
||||
pause
|
BIN
programs/other/t_edit/info/asm.syn
Normal file
BIN
programs/other/t_edit/info/asm.syn
Normal file
Binary file not shown.
BIN
programs/other/t_edit/info/cpp_kol_cla.syn
Normal file
BIN
programs/other/t_edit/info/cpp_kol_cla.syn
Normal file
Binary file not shown.
BIN
programs/other/t_edit/info/cpp_kol_dar.syn
Normal file
BIN
programs/other/t_edit/info/cpp_kol_dar.syn
Normal file
Binary file not shown.
BIN
programs/other/t_edit/info/cpp_kol_def.syn
Normal file
BIN
programs/other/t_edit/info/cpp_kol_def.syn
Normal file
Binary file not shown.
BIN
programs/other/t_edit/info/cpp_win_dar.syn
Normal file
BIN
programs/other/t_edit/info/cpp_win_dar.syn
Normal file
Binary file not shown.
BIN
programs/other/t_edit/info/default.syn
Normal file
BIN
programs/other/t_edit/info/default.syn
Normal file
Binary file not shown.
BIN
programs/other/t_edit/info/html.syn
Normal file
BIN
programs/other/t_edit/info/html.syn
Normal file
Binary file not shown.
BIN
programs/other/t_edit/info/voc_eng_rus.syn
Normal file
BIN
programs/other/t_edit/info/voc_eng_rus.syn
Normal file
Binary file not shown.
BIN
programs/other/t_edit/info/win_const.syn
Normal file
BIN
programs/other/t_edit/info/win_const.syn
Normal file
Binary file not shown.
634
programs/other/t_edit/load_lib.mac
Normal file
634
programs/other/t_edit/load_lib.mac
Normal file
@ -0,0 +1,634 @@
|
||||
;08.05.2009 - bugfix
|
||||
;14.04.2009 - a macros for code load library the box_lib.obj from '/sys/lib/' or current dirrectory.
|
||||
; The macros for load any library/libraries:
|
||||
; Copyright (c) 2009, <Lrz>
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions are met:
|
||||
; * Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
; * Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
; * Neither the name of the <organization> nor the
|
||||
; names of its contributors may be used to endorse or promote products
|
||||
; derived from this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov aka <Lrz> ''AS IS'' AND ANY
|
||||
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
;*****************************************************************************
|
||||
; This macros based on source code:
|
||||
; <Lrz> - Alexey Teplov / Àëåêñåé Òåïëîâ
|
||||
; Mario79, Mario - Marat Zakiyanov / Ìàðàò Çàêèÿíîâ
|
||||
; Diamondz - Evgeny Grechnikov / Åâãåíèé Ãðå÷íèêîâ
|
||||
;------------------------
|
||||
; DESCRIPTION
|
||||
; Macro load_library
|
||||
; Logick of work.
|
||||
; A first time we must to check system path, where I belive find a system library. System path is "/sys/lib/".
|
||||
; If I cannot found my library, i must to check second way. Second way is current dirrectory.
|
||||
; If we cannot load library, we must show the error message:
|
||||
; "I'm sorry,the programm cannot found system library box_lib.obj."
|
||||
; "The find was make on 2 ways: /sys/lib/ and current dirrectory."
|
||||
;
|
||||
;
|
||||
;---------------------------------------------------------------------
|
||||
; Macro sys_load_library
|
||||
; A first time we must to check own path in current dirrectory the program, where I belive find a system library.
|
||||
; If I cannot found my library, i must to check second way. Second way is system path a "/sys/lib/".
|
||||
; If we cannot load library, we must show the error message:
|
||||
; "I'm sorry,the programm cannot found system library box_lib.obj."
|
||||
; "The find was make on 2 ways: /sys/lib/ and current dirrectory."
|
||||
;
|
||||
;---------------------------------------------------------------------
|
||||
; How can I use it?
|
||||
;---------------------------------------------------------------------
|
||||
;-Example using single load library
|
||||
;-universal load library/librarys
|
||||
;load_library library_name__, cur_dir_path__, library_path__, system_path__, \
|
||||
;err_message_found_lib__, head_f_l__, myimport, err_message_import__, head_f_i__
|
||||
;-if return code =-1 then exit, else normally work
|
||||
; cmp eax,-1
|
||||
; jz exit
|
||||
;- Well, if you get
|
||||
;
|
||||
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
;DATA äàííûå
|
||||
;Âñåãäà ñîáëþäàòü ïîñëåäîâàòåëüíîñòü â èìåíè.
|
||||
;system_path__ db '/sys/lib/'
|
||||
;library_name__ db 'box_lib.obj',0
|
||||
; Åñëè åñòü æåëàíèå ðàçúåäèíèòü, òî íóæíî èñïîëüçîâàòü ñëåäóþùèþ êîíñòðóêöèþ
|
||||
;system_path__ db '/sys/lib/box_lib.obj',0
|
||||
;... ëþáàÿ ïîñëåäîâàòåëüíîñòü äðóãèõ êîìàíä è îïðåäåëåíèé.
|
||||
;library_name__ db 'box_lib.obj',0
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;err_message_found_lib__ db 'Sorry I cannot found library box_lib.obj',0
|
||||
;head_f_i__:
|
||||
;head_f_l__ db 'System error',0
|
||||
;err_message_import__ db 'Error on load import library box_lib.obj',0
|
||||
|
||||
;myimport:
|
||||
;
|
||||
;edit_box_draw dd aEdit_box_draw
|
||||
;edit_box_key dd aEdit_box_key
|
||||
;edit_box_mouse dd aEdit_box_mouse
|
||||
;version_ed dd aVersion_ed
|
||||
;
|
||||
;check_box_draw dd aCheck_box_draw
|
||||
;check_box_mouse dd aCheck_box_mouse
|
||||
;version_ch dd aVersion_ch
|
||||
;
|
||||
;option_box_draw dd aOption_box_draw
|
||||
;option_box_mouse dd aOption_box_mouse
|
||||
;version_op dd aVersion_op
|
||||
|
||||
; dd 0
|
||||
; dd 0
|
||||
;
|
||||
;aEdit_box_draw db 'edit_box',0
|
||||
;aEdit_box_key db 'edit_box_key',0
|
||||
;aEdit_box_mouse db 'edit_box_mouse',0
|
||||
;aVersion_ed db 'version_ed',0
|
||||
|
||||
;aCheck_box_draw db 'check_box_draw',0
|
||||
;aCheck_box_mouse db 'check_box_mouse',0
|
||||
;aVersion_ch db 'version_ch',0
|
||||
|
||||
;aOption_box_draw db 'option_box_draw',0
|
||||
;aOption_box_mouse db 'option_box_mouse',0
|
||||
;aVersion_op db 'version_op',0
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
macro @use_library
|
||||
{
|
||||
|
||||
local __sc
|
||||
local lp
|
||||
local lp1
|
||||
local correction
|
||||
;local end_tr
|
||||
local exit_
|
||||
;/equ
|
||||
err_message1 equ dword [esp+8]
|
||||
head1 equ dword [esp+4]
|
||||
|
||||
|
||||
__sc.frame equ dword [__sc+0]
|
||||
__sc.grab equ dword [__sc+4]
|
||||
__sc.grab_button equ dword [__sc+8]
|
||||
__sc.grab_button_text equ dword [__sc+12]
|
||||
__sc.grab_text equ dword [__sc+16]
|
||||
__sc.work equ dword [__sc+20]
|
||||
__sc.work_button equ dword [__sc+24]
|
||||
__sc.work_button_text equ dword [__sc+28]
|
||||
__sc.work_text equ dword [__sc+32]
|
||||
__sc.work_graph equ dword [__sc+36]
|
||||
|
||||
;;;;;;;;;;;CALC WIDTH & HIGHT WINDOW & CENTER MONITOR POSITION;;;;;;;;;;
|
||||
show_err_:
|
||||
;check memory
|
||||
push dword [arrea_xx]
|
||||
pop eax
|
||||
test eax,eax
|
||||
jnz @f
|
||||
|
||||
mcall 68,11
|
||||
mcall 68,12,4096
|
||||
push eax
|
||||
pop dword [arrea_xx]
|
||||
|
||||
push head1
|
||||
pop dword[eax]
|
||||
|
||||
push 0x0
|
||||
pop dword[eax+4]
|
||||
|
||||
@@:
|
||||
mov eax,48 ;get system color
|
||||
mov ebx,3
|
||||
mov ecx,__sc
|
||||
mov edx,sizeof.system_colors
|
||||
mcall
|
||||
;-----------------------------------
|
||||
xor eax,eax
|
||||
mov esi,err_message1
|
||||
mov ecx,30
|
||||
align 4
|
||||
lp: add ecx,7
|
||||
lodsb
|
||||
test eax,eax
|
||||
jnz lp
|
||||
|
||||
push dword [arrea_xx]
|
||||
pop ebp
|
||||
|
||||
align 4
|
||||
@@: add ebp,4
|
||||
mov eax,dword [ebp]
|
||||
|
||||
test eax,eax
|
||||
jnz @b
|
||||
|
||||
push err_message1
|
||||
pop dword[ebp]
|
||||
|
||||
mov dword [ebp+4],eax
|
||||
|
||||
mcall 48,5 ;get system window
|
||||
cmp word[on_x],cx
|
||||
jae @f; íå íóæíî îáíîâëÿòü
|
||||
|
||||
sub eax,ecx
|
||||
shl eax,15
|
||||
mov ax,cx
|
||||
mov dword [on_x],eax
|
||||
|
||||
@@:
|
||||
add word [on_y],12
|
||||
sub bx,word [on_y]
|
||||
shl ebx,15
|
||||
mov bx,word [on_y]
|
||||
mov dword [on_y],ebx
|
||||
|
||||
ret
|
||||
|
||||
|
||||
;;;;;;;;;;;DRAW WINDOW;;;;;;;;;;;;;;
|
||||
align 4
|
||||
start__:
|
||||
mcall 40,0x5 ;set mask on events rewraw window and get id button.
|
||||
.red_win:
|
||||
;draw_window:
|
||||
mcall 12,1
|
||||
|
||||
xor eax,eax
|
||||
mov ebp,dword [arrea_xx] ; set point
|
||||
mov ebx,dword [on_x]
|
||||
mov ecx,dword [on_y]
|
||||
mov edx,__sc.work
|
||||
or edx,0x33000000
|
||||
mov esi,__sc.grab_text
|
||||
xor edi,edi
|
||||
mov edi,dword [ebp] ;head1
|
||||
mcall
|
||||
|
||||
mov ebx,(10*65536+25-12)
|
||||
add ebp,4 ;inc index
|
||||
|
||||
@@:
|
||||
mov eax,4
|
||||
add bx,12
|
||||
mov ecx,__sc.grab_text
|
||||
or ecx,0x90000000
|
||||
mov edx,dword [ebp] ;err_message1
|
||||
mcall
|
||||
|
||||
add ebp,4 ;inc index
|
||||
|
||||
mov eax,dword [ebp]
|
||||
test eax,eax
|
||||
jnz @b
|
||||
|
||||
mcall 12,2
|
||||
align 4
|
||||
|
||||
.still: ;main loop
|
||||
mcall 10 ;wait event
|
||||
dec eax
|
||||
jz .red_win
|
||||
sub eax,2
|
||||
jnz .still ;go to main loop
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
.button:
|
||||
mcall 17 ;get id button
|
||||
test ah,ah ;if in ah 0, then go to still
|
||||
jz .still
|
||||
mcall -1
|
||||
ret
|
||||
|
||||
align 4
|
||||
__sc system_colors
|
||||
on_x dd 0x0
|
||||
on_y dd 0x0000004E
|
||||
arrea_xx dd 0x0
|
||||
rb 0x50
|
||||
end_tr:
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
@library_name equ dword [esp+12]
|
||||
@cur_dir_path equ dword [esp+8]
|
||||
@library_path equ dword [esp+4]
|
||||
|
||||
align 4
|
||||
@copy_path:
|
||||
mov ebx,@library_name
|
||||
mov esi,@cur_dir_path
|
||||
mov edi,@library_path
|
||||
|
||||
xor eax,eax
|
||||
cld
|
||||
.lp1:
|
||||
lodsb
|
||||
stosb
|
||||
test eax,eax
|
||||
jnz .lp1
|
||||
mov esi,edi
|
||||
|
||||
std
|
||||
.lp2:
|
||||
lodsb
|
||||
cmp al,'/'
|
||||
jnz .lp2
|
||||
mov edi,esi
|
||||
mov esi,ebx
|
||||
add edi,2
|
||||
|
||||
|
||||
cld
|
||||
.lp3:
|
||||
lodsb
|
||||
stosb
|
||||
test eax,eax
|
||||
jnz .lp3
|
||||
;---------------------------------------------------------------------
|
||||
ret
|
||||
}
|
||||
|
||||
|
||||
|
||||
macro sys_load_library library_name__, cur_dir_path__, library_path__, system_path__, err_message_found_lib__, head_f_l__, myimport, err_message_import__, head_f_i__
|
||||
{
|
||||
local end_steep
|
||||
local exit
|
||||
;---------------------------------------------------------------------
|
||||
; loading Box_Lib library
|
||||
|
||||
mcall 68,19,system_path__ ; load of sys directory
|
||||
test eax,eax
|
||||
jnz end_steep
|
||||
|
||||
copy_path library_name__, cur_dir_path__, library_path__ ;the macros making way /current pach a program/+ name system library
|
||||
|
||||
mcall 68,19,library_path__ ; load of alternative
|
||||
test eax,eax
|
||||
jnz end_steep
|
||||
show_error_window err_message_found_lib__, head_f_l__ ;show error message /create window
|
||||
jmp exit
|
||||
|
||||
|
||||
align 4
|
||||
end_steep:
|
||||
|
||||
import_boxlib myimport, err_message_import__, head_f_i__ ;import
|
||||
exit:
|
||||
test eax,eax
|
||||
jz @f
|
||||
|
||||
mcall 51,1,start__,end_tr ; ñîçäàåì íîâûé ïîòîê ïî øàáëîíó
|
||||
or eax,-1
|
||||
@@:
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
}
|
||||
|
||||
|
||||
macro load_library library_name__, cur_dir_path__, library_path__, system_path__, err_message_found_lib__, head_f_l__, myimport, err_message_import__, head_f_i__
|
||||
{
|
||||
local end_steep
|
||||
local exit
|
||||
;---------------------------------------------------------------------
|
||||
; loading Box_Lib library
|
||||
|
||||
copy_path library_name__, cur_dir_path__, library_path__ ;the macros making way /current pach a program/+ name system library
|
||||
|
||||
mcall 68,19,library_path__ ; load of alternative
|
||||
test eax,eax
|
||||
jnz end_steep
|
||||
|
||||
mcall 68,19,system_path__ ; load of sys directory
|
||||
test eax,eax
|
||||
jnz end_steep
|
||||
|
||||
show_error_window err_message_found_lib__, head_f_l__ ;show error message /create window
|
||||
jmp exit
|
||||
|
||||
align 4
|
||||
end_steep:
|
||||
|
||||
import_boxlib myimport, err_message_import__, head_f_i__ ;import
|
||||
exit:
|
||||
test eax,eax
|
||||
jz @f
|
||||
|
||||
mcall 51,1,start__,end_tr ; ñîçäàåì íîâûé ïîòîê ïî øàáëîíó
|
||||
or eax,-1
|
||||
@@:
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
}
|
||||
macro sys_load_libraries _start,_end
|
||||
{
|
||||
local exit_lp2
|
||||
local lp2
|
||||
local lp
|
||||
local end_steep
|
||||
local next
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
library_name__ equ [ebp]
|
||||
cur_dir_path__ equ [ebp+4]
|
||||
library_path__ equ [ebp+8]
|
||||
system_path__ equ [ebp+12]
|
||||
err_message_found_lib__ equ [ebp+16]
|
||||
head_f_l__ equ [ebp+20]
|
||||
my_import equ [ebp+24]
|
||||
err_message_import__ equ [ebp+28]
|
||||
head_f_i__ equ [ebp+32]
|
||||
adr_load_lib equ dword [ebp+36]
|
||||
status_lib equ dword [ebp+40]
|
||||
|
||||
mov ebp,_start
|
||||
mov ecx,((_end-_start)/ll_struc_size)
|
||||
|
||||
align 4
|
||||
lp: push ecx
|
||||
mcall 68,19,system_path__ ; load of sys directory
|
||||
test eax,eax
|
||||
jnz end_steep
|
||||
|
||||
copy_path library_name__, cur_dir_path__, library_path__ ;the macros making way /current pach a program/+ name system library
|
||||
|
||||
mcall 68,19,library_path__ ; load of alternative
|
||||
test eax,eax
|
||||
jnz end_steep
|
||||
|
||||
or status_lib,0x1 ; status of code - enable error - not found library
|
||||
|
||||
show_error_window err_message_found_lib__, head_f_l__ ;show error message /create window
|
||||
jmp next
|
||||
|
||||
align 4
|
||||
end_steep:
|
||||
mov adr_load_lib,eax ;save adr lib in memory
|
||||
import_boxlib my_import, err_message_import__, head_f_i__ ;import
|
||||
|
||||
test eax,eax
|
||||
jz next
|
||||
|
||||
or status_lib,0x2 ; status of code - enable error - import error
|
||||
|
||||
next:
|
||||
pop ecx
|
||||
add ebp,ll_struc_size
|
||||
dec ecx
|
||||
jnz lp
|
||||
|
||||
;----------------------------------
|
||||
mov ebp,_start
|
||||
mov ecx,((_end-_start)/ll_struc_size)
|
||||
|
||||
align 4
|
||||
lp2:
|
||||
mov eax,status_lib
|
||||
test eax,eax
|
||||
jz @f
|
||||
|
||||
mcall 51,1,start__,end_tr ; ñîçäàåì íîâûé ïîòîê ïî øàáëîíó
|
||||
or eax,-1
|
||||
jmp exit_lp2
|
||||
|
||||
@@:
|
||||
add ebp,ll_struc_size
|
||||
dec ecx
|
||||
jnz lp2
|
||||
exit_lp2:
|
||||
}
|
||||
|
||||
macro load_libraries _start,_end
|
||||
{
|
||||
local lp2
|
||||
local exit_lp2
|
||||
local lp
|
||||
local end_steep
|
||||
local next
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
library_name__ equ [ebp]
|
||||
cur_dir_path__ equ [ebp+4]
|
||||
library_path__ equ [ebp+8]
|
||||
system_path__ equ [ebp+12]
|
||||
err_message_found_lib__ equ [ebp+16]
|
||||
head_f_l__ equ [ebp+20]
|
||||
my_import equ [ebp+24]
|
||||
err_message_import__ equ [ebp+28]
|
||||
head_f_i__ equ [ebp+32]
|
||||
adr_load_lib equ dword [ebp+36]
|
||||
status_lib equ dword [ebp+40]
|
||||
|
||||
mov ebp,_start
|
||||
mov ecx,((_end-_start)/ll_struc_size)
|
||||
|
||||
align 4
|
||||
lp: push ecx
|
||||
|
||||
copy_path library_name__, cur_dir_path__, library_path__ ;the macros making way /current pach a program/+ name system library
|
||||
|
||||
mcall 68,19,library_path__ ; load of alternative
|
||||
test eax,eax
|
||||
jnz end_steep
|
||||
|
||||
mcall 68,19,system_path__ ; load of sys directory
|
||||
test eax,eax
|
||||
jnz end_steep
|
||||
|
||||
or status_lib,0x1 ; status of code - enable error - not found library
|
||||
|
||||
show_error_window err_message_found_lib__, head_f_l__ ;show error message /create window
|
||||
jmp next
|
||||
|
||||
align 4
|
||||
end_steep:
|
||||
mov adr_load_lib,eax ;save adr lib in memory
|
||||
|
||||
import_boxlib my_import, err_message_import__, head_f_i__ ;import
|
||||
|
||||
test eax,eax
|
||||
jz next
|
||||
|
||||
or status_lib,0x2 ; status of code - enable error - import error
|
||||
|
||||
next:
|
||||
pop ecx
|
||||
add ebp,ll_struc_size
|
||||
dec ecx
|
||||
jnz lp
|
||||
|
||||
;-----------------------------------------------
|
||||
mov ebp,_start
|
||||
mov ecx,((_end-_start)/ll_struc_size)
|
||||
|
||||
align 4
|
||||
lp2:
|
||||
mov eax,status_lib
|
||||
test eax,eax
|
||||
jz @f
|
||||
|
||||
mcall 51,1,start__,end_tr ; ñîçäàåì íîâûé ïîòîê ïî øàáëîíó
|
||||
or eax,-1
|
||||
jmp exit_lp2
|
||||
|
||||
@@:
|
||||
add ebp,ll_struc_size
|
||||
dec ecx
|
||||
jnz lp2
|
||||
exit_lp2:
|
||||
|
||||
}
|
||||
|
||||
|
||||
macro copy_path lib_name,dir_path,lib_path
|
||||
{
|
||||
pushad ;save all registers
|
||||
push dword lib_name
|
||||
push dword dir_path
|
||||
push dword lib_path
|
||||
|
||||
call @copy_path
|
||||
|
||||
add esp,12
|
||||
popad ;restore all registers
|
||||
}
|
||||
|
||||
macro show_error_window err_message, head
|
||||
{ pushad ;save all registers
|
||||
push dword err_message
|
||||
push dword head
|
||||
|
||||
call show_err_
|
||||
|
||||
add esp,8
|
||||
popad ;restore all registers
|
||||
or eax,-1 ;óâû
|
||||
}
|
||||
|
||||
|
||||
macro import_boxlib myimport, err_message_import__, head_f_i__
|
||||
{
|
||||
local import_loop
|
||||
local import_find
|
||||
local lp
|
||||
local import_find_next
|
||||
local import_found
|
||||
local import_done
|
||||
local exit
|
||||
local e.exit
|
||||
local import_not_found
|
||||
; initialize import
|
||||
|
||||
mov edx, eax
|
||||
mov esi,myimport
|
||||
import_loop:
|
||||
lodsd
|
||||
test eax, eax
|
||||
jz import_done
|
||||
push edx
|
||||
import_find:
|
||||
mov ebx, [ds:edx]
|
||||
test ebx, ebx
|
||||
jz import_not_found
|
||||
push eax
|
||||
lp:
|
||||
mov cl, [ds:eax]
|
||||
cmp cl, [ds:ebx]
|
||||
jnz import_find_next
|
||||
test cl, cl
|
||||
jz import_found
|
||||
inc eax
|
||||
inc ebx
|
||||
jmp lp
|
||||
import_find_next:
|
||||
pop eax
|
||||
add edx, 8
|
||||
jmp import_find
|
||||
import_found:
|
||||
pop eax
|
||||
mov eax, [ds:edx+4]
|
||||
mov [esi-4], eax
|
||||
pop edx
|
||||
jmp import_loop
|
||||
import_not_found:
|
||||
add esp,4
|
||||
show_error_window err_message_import__, head_f_i__ ;show error message /create window
|
||||
jmp e.exit
|
||||
import_done:
|
||||
xor eax,eax
|
||||
e.exit:
|
||||
;---------------------------------------------------------------------
|
||||
}
|
||||
ll_struc_size = 44;($-library_name__) ; constant size of struct
|
||||
struc l_libs library_name__, cur_dir_path__, library_path__, system_path__, err_message_found_lib__, head_f_l__, my_import, err_message_import__, head_f_i__; struct for loading libraries
|
||||
{
|
||||
.library_name__ dd library_name__ ; èìÿ çàãðóæàåìîé áèáëèîòåêè
|
||||
.cur_dir_path__ dd cur_dir_path__ ; óêàçàòåëü íà áóôåð â êîòîðîì ñîäåðæèòüñÿ ïóòü îò êóäà áûëà çàïóùåíà ïðîãðàììà
|
||||
|
||||
.library_path__ dd library_path__ ; óêàçàòåëü íà áóôåð â êîòîðîì áóäåò ñîôîðèìèðîâàí ïóòü ê áèáëèîòåêè, åñëè íóæíî âû÷èñëèòü ïóòü äî ëèáû ñ ìåñòà çàïóñêà ïðîãðàììû, îáû÷íî íóæíî, â ñëó÷àÿõ, åñëè ëèáà ðàñïîëîæåíà â òîé æå ïàïêå
|
||||
.complete_path dd system_path__ ; ïóòü êîòîðûé ÷åòêî ñîäåðæèò ïóòü
|
||||
|
||||
.err_message_found_lib__ dd err_message_found_lib__
|
||||
.head_f_l__ dd head_f_l__
|
||||
.my_import dd my_import
|
||||
.err_message_import__ dd err_message_import__
|
||||
.head_f_i__ dd head_f_i__
|
||||
|
||||
.adr_load_lib dd 0x0
|
||||
.status_lib dd 0x0 ;status of load library
|
||||
;
|
||||
}
|
BIN
programs/other/t_edit/msgbox.obj
Normal file
BIN
programs/other/t_edit/msgbox.obj
Normal file
Binary file not shown.
170
programs/other/t_edit/readme.htm
Normal file
170
programs/other/t_edit/readme.htm
Normal file
@ -0,0 +1,170 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Оглавление</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=WINDOWS-1251">
|
||||
<style>
|
||||
body
|
||||
{
|
||||
font-size: 15px;
|
||||
font-family: "Bookman Old Style";
|
||||
color: black;
|
||||
text-align: justify;
|
||||
}
|
||||
h1 { color: green; font-size: 23px; }
|
||||
h2 { color: green; font-size: 21px; }
|
||||
h3 { color: green; font-size: 19px; }
|
||||
h4 { color: #803f00; font-size: 17px; }
|
||||
i { color: #0099cc; }
|
||||
b { color: #0099cc; }
|
||||
p {
|
||||
text-indent: 1em;
|
||||
margin-top: 3px;
|
||||
margin-bottom: 2px;
|
||||
margin-left: 0px;
|
||||
margin-right: 0px;
|
||||
}
|
||||
ol, ul, dl{
|
||||
margin-top: 3px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
pre
|
||||
{
|
||||
padding: 2px;
|
||||
padding-left: 20px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
margin-left: 0px;
|
||||
margin-right: 0px;
|
||||
font-family: "Courier New";
|
||||
font-size: 15px;
|
||||
color: #004000;
|
||||
background-color: #ffd0ff;
|
||||
}
|
||||
table
|
||||
{
|
||||
font-size: 15px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>TextEditor версия от 29.12.2009</h1>
|
||||
<h2>О программе</h2>
|
||||
<p>Программа для работы с текстовыми файлами.
|
||||
Лицензия свободная.</p>
|
||||
<p><img src="t_edit.png"></p>
|
||||
<p>Внешний вид программы, с открытым текстовым файлом.</p>
|
||||
<p>Обсуждение программы здесь: <a href="http://board.kolibrios.org/viewtopic.php?f=9&t=1222">http://board.kolibrios.org/viewtopic.php?f=9&t=1222</a></p>
|
||||
|
||||
<h2>Возможности</h2>
|
||||
<ul>
|
||||
<li>Открытие (Ctrl+O)/Сохранение файла.</li>
|
||||
<li>Редактирование: Повтор/Отмена действия (Ctrl+Z), Вырезать/Копировать (Ctrl+C)/Вставить (Ctrl+V), Поиск (Ctrl+F, F3).</li>
|
||||
<li>Выделение цветом слов, заданных в файле синтаксиса. Вывод справки по ним, если она есть (нажатием F1 когда курсор на слове).</li>
|
||||
</ul>
|
||||
|
||||
<p>После создания программы TextEditor в Kolibri стало 2 программы для работы с текстом,
|
||||
у каждой из них есть свои сильные и слабые стороны.
|
||||
Проведу (не полное) сравнение программ TinyPad и TextEditor:</p>
|
||||
<table border=1>
|
||||
<tr><th>Действия</th><th>TinyPad</th><th>TextEditor</th><th>Комментарий</th></tr>
|
||||
<tr><td>Работа с несколькими документами</td>
|
||||
<td>есть</td><td>нет</td><td>пока не планирую сделать</td></tr>
|
||||
<tr><td>Поддержка кодировок KOI8M, OEM</td>
|
||||
<td>есть</td><td>нет</td><td>хотелось-бы сделать</td></tr>
|
||||
<tr><td>Подсветка синтаксиса</td>
|
||||
<td>подсветка заранее зашита в программу</td><td>подсветка берется из файлов, которые может указать пользователь. Также есть возможность получать справку по подсвечиваемым словам (если она есть в файлах подсветки, навести курсор на слово и нажать F1).</td><td></td></tr>
|
||||
<tr><td>Многократная отмена/повтор действий</td>
|
||||
<td>нет</td><td>есть</td><td></td></tr>
|
||||
<tr><td>Ограничения на размер файлов</td>
|
||||
<td>нет</td><td>есть</td><td></td></tr>
|
||||
</table>
|
||||
|
||||
<h2>Некоторые недоработки</h2>
|
||||
<ul>
|
||||
<li>Если открыть большой файл, размер которого больше чем:
|
||||
maxChars equ 100002 ;(...+2)
|
||||
он откроется не весь, а первые maxChars-2 символов из файла
|
||||
(о чем выдается сообщение).</li>
|
||||
<li>При сохранении программа не спрашивает о замене существ. файла.</li>
|
||||
<li>Срабатывали кнопки под меню, потому я их сдвинул влево.</li>
|
||||
</ul>
|
||||
|
||||
<h2>О работе программы</h2>
|
||||
<p>Раздел для программистов (и интересующихся людей), в котором расказаны
|
||||
некоторые идеи, на которых построена данная программа.</p>
|
||||
|
||||
<p>Для работы с текстом программа использует структуры:</p>
|
||||
<pre>struct symbol
|
||||
c db ? ; +0 символ
|
||||
col db ? ; +1 цвет
|
||||
perv dd ? ; +2
|
||||
next dd ? ; +6 указатели
|
||||
tc dd ? ; +10 врем. создания
|
||||
td dd ? ; +14 врем. удаления
|
||||
ends</pre>
|
||||
<p>Каждая из таких структур сохраняет один символ в переменной 'c'. Переменные
|
||||
'perv' и 'next' хранят индексы первого и следующего символов. Благодаря чему
|
||||
текст создается в виде цепочки символов (двунаправленный список).</p>
|
||||
<p><b>'tc'</b> - время создания символа, при отмене действия текстовый редактор "знает"
|
||||
какие символы отображать, а какие нет (хотя все символы "висят" в памяти).</p>
|
||||
<p><b>'td'</b> - время удаления символа, заполняется при удалении, при отмене действия
|
||||
удаления символов, текст может быть восстановлен.</p>
|
||||
<p><b>'col'</b> - используется для цветовой разметки.</p>
|
||||
|
||||
<p>Теперь немного о функциях:</p>
|
||||
<p><b>GetTexPervPos</b> - переход на предыдущий символ в цепи (через указатель 'perv')</p>
|
||||
<p><b>GetTexNextPos</b> - переход на следующий символ в цепи (через указатель 'next')</p>
|
||||
<p><b>SymbNotVis</b> - определяет видимый ли указанный символ на экране (в зависимости
|
||||
от значений 'tc' и 'td')</p>
|
||||
<p><b>IteratNext</b> - переход на следующий видимый символ в цепи. Использует для
|
||||
работы функции GetTexNextPos и SymbNotVis.</p>
|
||||
<p><b>IteratPerv</b> - переход на предедущий видимый символ в цепи.</p>
|
||||
|
||||
<p><b>ItPoNextUc</b> - найти следующую позицию указанного символа (edx-поз. начала
|
||||
поиска, bl->код искомого символа)</p>
|
||||
<p><b>GetPosByParam</b> - берет позицию символа по координатам (esi->коорд. x, знак;
|
||||
ecx->коорд. y, строка)</p>
|
||||
<p><b>GoToPos</b> - переставляет курсор в указанную позицию, если указанная позиция
|
||||
находится вне экрана, то также переставляются скролинги (ecx->коорд. x, знак; edx->коорд. y, строка)</p>
|
||||
|
||||
<h3>Формат файла подсветки *.syn</h3>
|
||||
<table>
|
||||
<tr><th>Элемент</th><th>Размер (байт)</th></tr>
|
||||
<tr><td>Количество цветов текста</td>
|
||||
<td><pre>4</pre></td></tr>
|
||||
<tr><td>Количество подсвечиваемых слов</td>
|
||||
<td><pre>4</pre></td></tr>
|
||||
<tr><td>Цвета интерфейса</td>
|
||||
<td><pre>4*6</pre></td></tr>
|
||||
<tr><td>Цвета для текста</td>
|
||||
<td><pre>4*(кол. цв. текста)</pre></td></tr>
|
||||
<tr><td>Структуры со свойствами и описаниями слов</td>
|
||||
<td><pre>sizeof(TexColViv)*(кол. слов)</pre></td></tr>
|
||||
<tr><td>Разделительный символ, означающий начало описаний слов (всегда равен 0)</td>
|
||||
<td><pre>1 байт</pre></td></tr>
|
||||
<tr><td>Описания слов (строки текста с 0-ми в конце)</td>
|
||||
<td><pre>(длинна справочного текста + 1)</pre></td></tr>
|
||||
</table>
|
||||
<h4>Замечания.</h4>
|
||||
<ul>
|
||||
<li>Все слова должны быть расположены в порядке следования их ASCII кодов.
|
||||
Возможно в будущих версиях формат файлов подсветки будет изменен.</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
<h2>Автор</h2>
|
||||
<p>Игорь А. (IgorA) - разработка программы.</p>
|
||||
|
||||
<h2>Спасибо</h2>
|
||||
<ul>
|
||||
<li>Евтихов Максим (Maxxxx32) - элемент EditBox.</li>
|
||||
<li>Алексей Теплов (Lrz) - элемент EditBox, макрос load_library.</li>
|
||||
<li>Mario79 - элемент скроллинг.</li>
|
||||
<li>Diamond - за программу KlbrInWin, и помощь при написании программы.</li>
|
||||
<li>Insolor - за тестирование программы на ошибки.</li>
|
||||
<li>Leency и другим, кто помогал на форуме советами.</li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
71
programs/other/t_edit/strlen.inc
Normal file
71
programs/other/t_edit/strlen.inc
Normal file
@ -0,0 +1,71 @@
|
||||
; strlen function
|
||||
;
|
||||
; Copyright (c) 2003 Thomas Mathys
|
||||
; killer@vantage.ch
|
||||
;
|
||||
; This program is free software; you can redistribute it and/or modify
|
||||
; it under the terms of the GNU General Public License as published by
|
||||
; the Free Software Foundation; either version 2 of the License, or
|
||||
; (at your option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program; if not, write to the Free Software
|
||||
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
;
|
||||
;%ifndef _STRLEN_INC
|
||||
;%define _STRLEN_INC
|
||||
|
||||
|
||||
;********************************************************************
|
||||
; returns the length of an asciiz string
|
||||
; input : esi = pointer to string
|
||||
; output : eax = string length
|
||||
; destroys : nothing
|
||||
;********************************************************************
|
||||
strlen:
|
||||
push ecx
|
||||
push edi
|
||||
pushfd
|
||||
cld ; !
|
||||
mov ecx,-1
|
||||
mov edi,esi ; find terminating zero
|
||||
xor al,al
|
||||
repne scasb
|
||||
mov eax,edi ; calculate string length
|
||||
sub eax,esi
|
||||
dec eax
|
||||
popfd
|
||||
pop edi
|
||||
pop ecx
|
||||
ret
|
||||
|
||||
|
||||
|
||||
; linlen function
|
||||
;
|
||||
; Copyright (c) 2009 Igor Afanasiev
|
||||
|
||||
linlen:
|
||||
push ecx
|
||||
push edi
|
||||
pushfd
|
||||
cld ; !
|
||||
mov ecx,eax
|
||||
inc ecx
|
||||
mov edi,esi ; find terminating zero
|
||||
mov al,13
|
||||
repne scasb
|
||||
mov eax,edi ; calculate string length
|
||||
sub eax,esi
|
||||
dec eax
|
||||
popfd
|
||||
pop edi
|
||||
pop ecx
|
||||
ret
|
||||
;%endif
|
||||
|
601
programs/other/t_edit/t_button.inc
Normal file
601
programs/other/t_edit/t_button.inc
Normal file
@ -0,0 +1,601 @@
|
||||
but_NewFile:
|
||||
push eax ebx
|
||||
call CanSave
|
||||
cmp al,1
|
||||
jne @f
|
||||
push thread
|
||||
push msgbox_2
|
||||
call [mb_create] ;message: save changes in file?
|
||||
;mov eax,5
|
||||
;mov ebx,50
|
||||
;int 0x40
|
||||
push msgbox_2_funct
|
||||
call [mb_setfunctions]
|
||||
jmp .ret_f
|
||||
@@:
|
||||
call On_NewFile
|
||||
.ret_f:
|
||||
pop ebx eax
|
||||
ret
|
||||
|
||||
On_NewFile:
|
||||
push eax
|
||||
mov al,1
|
||||
call Clear
|
||||
call draw_but_toolbar
|
||||
call draw_main_win
|
||||
pop eax
|
||||
ret
|
||||
|
||||
On_SaveAndNewFile:
|
||||
call but_SaveFile
|
||||
cmp byte[err_sav],0
|
||||
jne @f
|
||||
call On_NewFile
|
||||
@@:
|
||||
ret
|
||||
|
||||
but_OpenFile:
|
||||
push eax
|
||||
call CanSave
|
||||
cmp al,1
|
||||
jne @f
|
||||
push thread
|
||||
push msgbox_5
|
||||
call [mb_create] ;message: save changes in file?
|
||||
push msgbox_5_funct
|
||||
call [mb_setfunctions]
|
||||
jmp .ret_f
|
||||
@@:
|
||||
call On_OpenFile
|
||||
.ret_f:
|
||||
pop eax
|
||||
ret
|
||||
|
||||
On_OpenFile:
|
||||
push eax ebx
|
||||
mov eax,70
|
||||
mov [run_file_70.func_n], 0
|
||||
mov [run_file_70.param1], 0
|
||||
mov [run_file_70.param2], 0
|
||||
mov [run_file_70.param3], maxChars-2 ;sizeof.symbol
|
||||
m2m [run_file_70.param4], [tex]
|
||||
mov [run_file_70.rezerv], 0
|
||||
push dword[edit1.text]
|
||||
pop dword[run_file_70.name]
|
||||
mov ebx,run_file_70
|
||||
int 0x40
|
||||
|
||||
cmp eax,0
|
||||
je @f
|
||||
cmp eax,6
|
||||
je @f
|
||||
cmp ax,10
|
||||
jl .zifra_0_9
|
||||
mov al,'?'
|
||||
sub ax,48
|
||||
.zifra_0_9:
|
||||
add ax,48
|
||||
|
||||
mov byte[msgbox_4.err],al
|
||||
push thread
|
||||
push msgbox_4
|
||||
call [mb_create] ;message: Can-t open text file!
|
||||
jmp .ret_f
|
||||
@@:
|
||||
mov [err_opn],1
|
||||
cmp ebx,-1
|
||||
je .ret_f
|
||||
;if open file
|
||||
call OpenFile
|
||||
call draw_but_toolbar
|
||||
call draw_main_win
|
||||
cmp ebx,maxChars-2
|
||||
jl .ret_f
|
||||
push thread
|
||||
push msgbox_1
|
||||
call [mb_create]
|
||||
.ret_f:
|
||||
pop ebx eax
|
||||
ret
|
||||
|
||||
but_SaveFile:
|
||||
push eax ebx ecx edx
|
||||
call CanSave
|
||||
cmp al,0
|
||||
je .no_save
|
||||
|
||||
mov ecx,maxChars
|
||||
call mem_Alloc
|
||||
push eax
|
||||
|
||||
mov edx,[tex]
|
||||
xor ecx,ecx
|
||||
@@:
|
||||
call IteratNext
|
||||
cmp edx,[tex_1]
|
||||
jle @f ;edx = [tex] or edx = [tex]+sizeof.symbol
|
||||
mov bl,[edx]
|
||||
mov byte[eax],bl
|
||||
inc eax
|
||||
inc ecx
|
||||
jmp @b
|
||||
@@:
|
||||
|
||||
cmp ecx,0
|
||||
je @f
|
||||
pop eax
|
||||
mov [run_file_70.param4],eax
|
||||
push eax
|
||||
mov eax,70
|
||||
mov [run_file_70.func_n], 2
|
||||
mov [run_file_70.param1], 0
|
||||
mov [run_file_70.param2], 0
|
||||
mov [run_file_70.param3], ecx
|
||||
mov [run_file_70.rezerv], 0
|
||||
push [edit1.text]
|
||||
pop [run_file_70.name]
|
||||
mov ebx,run_file_70
|
||||
int 0x40
|
||||
|
||||
mov [err_sav],al
|
||||
|
||||
cmp eax,0
|
||||
je .no_msg
|
||||
; cmp eax,6
|
||||
; je @f
|
||||
cmp ax,10
|
||||
jl .zifra_0_9
|
||||
mov al,'?'
|
||||
sub ax,48
|
||||
.zifra_0_9:
|
||||
add ax,48
|
||||
|
||||
mov byte[msgbox_6.err],al
|
||||
push thread
|
||||
push msgbox_6
|
||||
call [mb_create] ;message: Can-t save text file!
|
||||
jmp @f
|
||||
.no_msg:
|
||||
m2m [ls_tim],[ch_tim]
|
||||
@@:
|
||||
|
||||
pop ecx
|
||||
call mem_Free
|
||||
.no_save:
|
||||
pop edx ecx ebx eax
|
||||
ret
|
||||
|
||||
but_FindText:
|
||||
push eax ebx ecx edx edi
|
||||
call GetPos
|
||||
mov eax,[edit2.text]
|
||||
mov bl,byte[eax]
|
||||
@@:
|
||||
call GetFindRezult
|
||||
cmp bh,1
|
||||
je @f ; find
|
||||
|
||||
call IteratNext
|
||||
cmp edx,[tex_1]
|
||||
jle @f
|
||||
jmp @b
|
||||
@@:
|
||||
cmp bh,0
|
||||
je @f
|
||||
call GetTexCoords
|
||||
inc ebx ;move cursor right
|
||||
mov [sel.x1],ebx
|
||||
mov [sel.y1],eax
|
||||
mov edx,eax
|
||||
mov ecx,ebx
|
||||
call GoToPos
|
||||
mov edx,edi
|
||||
call GetTexCoords
|
||||
mov [sel.x0],ebx
|
||||
mov [sel.y0],eax
|
||||
call draw_main_win
|
||||
jmp .end_find
|
||||
@@:
|
||||
push thread
|
||||
push msgbox_7
|
||||
call [mb_create] ;message: Can not find text
|
||||
.end_find:
|
||||
pop edi edx ecx ebx eax
|
||||
ret
|
||||
|
||||
;input:
|
||||
; eax - text need find
|
||||
; bl - first symbol to find
|
||||
; edx - first symbol pointer
|
||||
;output:
|
||||
; bh - rezult
|
||||
; edx - last text position (if find sucess)
|
||||
; edi - first symbol pointer
|
||||
GetFindRezult:
|
||||
push eax
|
||||
mov bh,1
|
||||
mov edi,edx ;copy edx
|
||||
@@:
|
||||
cmp byte[edx],bl
|
||||
jne .no_text
|
||||
|
||||
inc eax ;*** get next symbol (in find text) ***
|
||||
mov bl,byte[eax]
|
||||
cmp bl,0
|
||||
je @f ;end of find text
|
||||
|
||||
call IteratNext ;*** get next symbol (in editor text) ***
|
||||
cmp edx,[tex_1]
|
||||
jle @f ;end of editor text
|
||||
|
||||
jmp @b
|
||||
.no_text:
|
||||
xor bh,bh
|
||||
mov edx,edi ;restore edx
|
||||
@@:
|
||||
pop eax
|
||||
mov bl,byte[eax] ;restore bl
|
||||
ret
|
||||
|
||||
but_OpenSyntax:
|
||||
cmp byte[panel_id],TE_PANEL_SYNTAX
|
||||
jne @f
|
||||
push dword tree1
|
||||
call dword [tl_node_get_data]
|
||||
pop dword [fn_col_option]
|
||||
call InitColText
|
||||
call CmColored
|
||||
call draw_main_win
|
||||
@@:
|
||||
ret
|
||||
|
||||
but_select_word:
|
||||
push eax ebx ecx edx
|
||||
|
||||
call GetPos
|
||||
push edx
|
||||
call ItPervColorTag
|
||||
cmp edx,[tex_1]
|
||||
jle @f
|
||||
call GetTexCoords
|
||||
mov [sel.x0],ebx
|
||||
mov [sel.y0],eax
|
||||
@@:
|
||||
pop edx
|
||||
call ItNextColorTag
|
||||
cmp edx,[tex_1]
|
||||
jle @f
|
||||
call GetTexCoords
|
||||
mov [sel.x1],ebx
|
||||
mov [sel.y1],eax
|
||||
@@:
|
||||
pop edx ecx ebx eax
|
||||
call draw_but_toolbar
|
||||
call draw_main_win
|
||||
jmp still
|
||||
|
||||
but_cut:
|
||||
call but_Copy
|
||||
call SetUndo
|
||||
push bx
|
||||
mov bl,1
|
||||
call SelTextDel
|
||||
pop bx
|
||||
cmp al,1
|
||||
jne @f
|
||||
call draw_but_toolbar
|
||||
call draw_main_win
|
||||
@@:
|
||||
jmp still
|
||||
|
||||
;output:
|
||||
; al = 1 if copy text
|
||||
but_Copy:
|
||||
push ax
|
||||
call IsSel
|
||||
cmp al,0
|
||||
jne @f
|
||||
pop ax
|
||||
ret ;if not selected text
|
||||
@@:
|
||||
call SelNormalize
|
||||
|
||||
push ebx ecx edx esi
|
||||
mov esi,[seln.x1]
|
||||
mov ecx,[seln.y1]
|
||||
call GetPosByParam
|
||||
mov ebx,edx
|
||||
mov esi,[seln.x0]
|
||||
mov ecx,[seln.y0]
|
||||
call GetPosByParam
|
||||
mov esi,ebx
|
||||
|
||||
xor ecx,ecx
|
||||
mov ebx,buf
|
||||
;mov edx,[tex]
|
||||
@@:
|
||||
cmp edx,[tex_1] ;end of file
|
||||
jle @f
|
||||
cmp edx,esi ;end of select
|
||||
je @f
|
||||
inc ecx
|
||||
cmp ecx,BUF_SIZE ;owerflow bufer
|
||||
je @f
|
||||
|
||||
mov al,byte[edx]
|
||||
mov byte[ebx],al
|
||||
inc ebx
|
||||
|
||||
call IteratNext
|
||||
jmp @b
|
||||
@@:
|
||||
add ecx,buf
|
||||
mov byte[ebx],0
|
||||
|
||||
cmp ecx,0
|
||||
je @f
|
||||
call draw_but_toolbar
|
||||
call draw_bufer
|
||||
@@:
|
||||
pop esi edx ecx ebx ax
|
||||
ret
|
||||
|
||||
but_paste:
|
||||
push eax bx esi edi
|
||||
mov esi,buf
|
||||
call strlen
|
||||
cmp eax,1
|
||||
jl @f
|
||||
call SetUndo
|
||||
mov esi,eax
|
||||
mov bx,0x0101
|
||||
call SelTextDel
|
||||
mov edi,buf
|
||||
call TextAdd
|
||||
call draw_but_toolbar
|
||||
call draw_main_win
|
||||
@@:
|
||||
pop edi esi bx eax
|
||||
jmp still
|
||||
|
||||
but_find:
|
||||
cmp byte[panel_id],TE_PANEL_NULL
|
||||
je @f
|
||||
mov byte[panel_id],TE_PANEL_NULL
|
||||
mov word[wndMain.left],0
|
||||
jmp .e_if
|
||||
@@:
|
||||
mov byte[panel_id],TE_PANEL_FIND
|
||||
mov word[wndMain.left],TE_PANEL_WIDTH
|
||||
.e_if:
|
||||
call EvSize
|
||||
call draw_main_win
|
||||
jmp still
|
||||
|
||||
but_replace:
|
||||
jmp still
|
||||
|
||||
but_find_key_w:
|
||||
jmp still
|
||||
|
||||
but_sumb_upper:
|
||||
push edi
|
||||
mov [conv_table],EvUpper
|
||||
call ConvertSelText
|
||||
cmp edi,0
|
||||
je @f
|
||||
call draw_main_win
|
||||
@@:
|
||||
pop edi
|
||||
jmp still
|
||||
|
||||
but_sumb_lover:
|
||||
push edi
|
||||
mov [conv_table],EvLover
|
||||
call ConvertSelText
|
||||
cmp edi,0
|
||||
je @f
|
||||
call draw_main_win
|
||||
@@:
|
||||
pop edi
|
||||
jmp still
|
||||
|
||||
but_reverse:
|
||||
push eax ebx
|
||||
call IsSel
|
||||
cmp al,0
|
||||
je @f
|
||||
call SelNormalize
|
||||
push esi ecx edx
|
||||
mov esi,[seln.x0]
|
||||
mov ecx,[seln.y0]
|
||||
call GetPosByParam
|
||||
mov eax,edx
|
||||
mov esi,[seln.x1]
|
||||
cmp esi,0
|
||||
je .beg_str
|
||||
dec esi
|
||||
.beg_str:
|
||||
mov ecx,[seln.y1]
|
||||
call GetPosByParam
|
||||
;call GetTexPervPos
|
||||
mov ebx,edx
|
||||
pop edx ecx esi
|
||||
;cmp eax,...
|
||||
;je @f
|
||||
call Revers
|
||||
@@:
|
||||
pop ebx eax
|
||||
call draw_main_win
|
||||
jmp still
|
||||
|
||||
but_undo:
|
||||
mov eax,[tim_Undo]
|
||||
cmp [ch_tim],eax
|
||||
jbe still
|
||||
inc [tim_Undo]
|
||||
;call CmColored
|
||||
jmp red_win
|
||||
|
||||
but_redo:
|
||||
cmp [tim_Undo],1
|
||||
jb still
|
||||
dec [tim_Undo]
|
||||
;call CmColored
|
||||
jmp red_win
|
||||
|
||||
|
||||
but_sumb_invis:
|
||||
xor [invis],1
|
||||
jmp red_win
|
||||
|
||||
but_k_words_show:
|
||||
xor byte[mode_colored],1
|
||||
cmp byte[mode_colored],0
|
||||
je red_win
|
||||
call CmColored
|
||||
|
||||
; push eax ebx ecx esi edi
|
||||
; mov eax,dword[cur_x]
|
||||
; ColToIndexOffset eax,edx
|
||||
; mov eax,4
|
||||
; mov ebx,50*65536+75
|
||||
; mov ecx,0x40ffffff
|
||||
; mov edi,0x404040
|
||||
; mov esi,10
|
||||
; int 0x40
|
||||
;
|
||||
; mov eax,47
|
||||
; mov ecx,250
|
||||
; mov esi,0xffff80
|
||||
; mov edx,50*65536+80
|
||||
; mov esi,FkPos;[keyW]
|
||||
; @@:
|
||||
; mov ebx,0x30001
|
||||
; cmp dx,300
|
||||
; jl .no_br
|
||||
; mov dx,80
|
||||
; add edx,0x200000
|
||||
; .no_br:
|
||||
; add dx,10
|
||||
; push ecx esi
|
||||
; mov ecx,esi
|
||||
; cmp dword[ecx],-1
|
||||
; jne .no_minus
|
||||
; mov ebx,0x10000
|
||||
; mov ecx,1
|
||||
; .no_minus:
|
||||
; mov esi,0xffff00
|
||||
; int 0x40
|
||||
; pop esi ecx
|
||||
; add esi,4
|
||||
; loop @b
|
||||
; pop edi esi ecx ebx eax
|
||||
jmp red_win
|
||||
|
||||
but_CtrlHome:
|
||||
mov [cur_x],0
|
||||
mov [cur_y],0
|
||||
mov [wScr.position],0
|
||||
mov [hScr.position],0
|
||||
|
||||
call draw_but_toolbar
|
||||
call draw_main_win
|
||||
ret
|
||||
|
||||
but_synt_show:
|
||||
cmp byte[panel_id],TE_PANEL_NULL
|
||||
je @f
|
||||
mov byte[panel_id],TE_PANEL_NULL
|
||||
mov word[wndMain.left],0
|
||||
jmp .e_if
|
||||
@@:
|
||||
mov byte[panel_id],TE_PANEL_SYNTAX
|
||||
mov word[wndMain.left],TE_PANEL_WIDTH
|
||||
.e_if:
|
||||
call EvSize
|
||||
call draw_main_win
|
||||
jmp still
|
||||
|
||||
sel_KeyUp:
|
||||
cmp [dragk],1
|
||||
je @f
|
||||
call SelStart
|
||||
mov [dragk],1
|
||||
@@:
|
||||
push dx
|
||||
call CurMoveUp
|
||||
cmp dl,8
|
||||
jne @f
|
||||
call OnInitialUpdate
|
||||
@@:
|
||||
pop dx
|
||||
call SelMove
|
||||
call draw_main_win
|
||||
ret
|
||||
|
||||
sel_KeyDown:
|
||||
cmp [dragk],1
|
||||
je @f
|
||||
call SelStart
|
||||
mov [dragk],1
|
||||
@@:
|
||||
push dx
|
||||
call CurMoveDown
|
||||
cmp dl,8
|
||||
jne @f
|
||||
call OnInitialUpdate
|
||||
@@:
|
||||
pop dx
|
||||
call SelMove
|
||||
call draw_main_win
|
||||
ret
|
||||
|
||||
sel_KeyLeft:
|
||||
cmp [dragk],1
|
||||
je @f
|
||||
call SelStart
|
||||
@@:
|
||||
push dx
|
||||
call CurMoveLeft
|
||||
call SelMove
|
||||
cmp [dragk],1
|
||||
je @f
|
||||
mov [dragk],1
|
||||
mov dl,8
|
||||
@@:
|
||||
cmp dl,8
|
||||
jne @f
|
||||
call OnInitialUpdate
|
||||
call draw_main_win
|
||||
jmp .end_f
|
||||
@@:
|
||||
call draw_cur_line
|
||||
.end_f:
|
||||
pop dx
|
||||
ret
|
||||
|
||||
sel_KeyRight:
|
||||
cmp [dragk],1
|
||||
je @f
|
||||
call SelStart
|
||||
@@:
|
||||
push dx
|
||||
call CurMoveRight
|
||||
call SelMove
|
||||
cmp [dragk],1
|
||||
je @f
|
||||
mov [dragk],1
|
||||
mov dl,8
|
||||
@@:
|
||||
cmp dl,8
|
||||
jne @f
|
||||
call OnInitialUpdate
|
||||
call draw_main_win
|
||||
jmp .end_f
|
||||
@@:
|
||||
call draw_cur_line
|
||||
.end_f:
|
||||
pop dx
|
||||
ret
|
461
programs/other/t_edit/t_data.inc
Normal file
461
programs/other/t_edit/t_data.inc
Normal file
@ -0,0 +1,461 @@
|
||||
;--- äàííûå ïðîãðàììû ----------------------------------------------
|
||||
fn_col_option dd def_col_file
|
||||
fn_syntax_dir db 'info/',0
|
||||
def_col_file db 'default.syn',0
|
||||
|
||||
system_dir0 db '/sys/lib/'
|
||||
boxlib_name db 'box_lib.obj',0
|
||||
|
||||
system_dir1 db '/sys/lib/'
|
||||
msgbox_name db 'msgbox.obj',0
|
||||
|
||||
fn_icon_tl_sys db 'tl_sys_16.bmp',0
|
||||
fn_icon_tl_nod db 'tl_nod_16.bmp',0
|
||||
;---------------------------------------------------------------------
|
||||
fileinfo:
|
||||
dd 5
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd file_info
|
||||
string:
|
||||
db 0
|
||||
dd file_name
|
||||
|
||||
;plugin dd 0
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
myimport:
|
||||
edit_box_draw dd aEdit_box_draw
|
||||
edit_box_key dd aEdit_box_key
|
||||
edit_box_mouse dd aEdit_box_mouse
|
||||
version_ed dd aVersion_ed
|
||||
|
||||
check_box_draw dd aCheck_box_draw
|
||||
check_box_mouse dd aCheck_box_mouse
|
||||
version_ch dd aVersion_ch
|
||||
|
||||
option_box_draw dd aOption_box_draw
|
||||
option_box_mouse dd aOption_box_mouse
|
||||
version_op dd aVersion_op
|
||||
|
||||
scrollbar_ver_draw dd aScrollbar_ver_draw
|
||||
scrollbar_ver_mouse dd aScrollbar_ver_mouse
|
||||
scrollbar_hor_draw dd aScrollbar_hor_draw
|
||||
scrollbar_hor_mouse dd aScrollbar_hor_mouse
|
||||
version_scrollbar dd aVersion_scrollbar
|
||||
|
||||
dinamic_button_draw dd aDbutton_draw
|
||||
dinamic_button_mouse dd aDbutton_mouse
|
||||
version_dbutton dd aVersion_dbutton
|
||||
|
||||
menu_bar_draw dd aMenu_bar_draw
|
||||
menu_bar_mouse dd aMenu_bar_mouse
|
||||
version_menu_bar dd aVersion_menu_bar
|
||||
|
||||
tl_data_init dd sz_tl_data_init
|
||||
tl_data_clear dd sz_tl_data_clear
|
||||
tl_info_clear dd sz_tl_info_clear
|
||||
tl_key dd sz_tl_key
|
||||
tl_mouse dd sz_tl_mouse
|
||||
tl_draw dd sz_tl_draw
|
||||
tl_info_undo dd sz_tl_info_undo
|
||||
tl_info_redo dd sz_tl_info_redo
|
||||
tl_node_add dd sz_tl_node_add
|
||||
tl_node_set_data dd sz_tl_node_set_data
|
||||
tl_node_get_data dd sz_tl_node_get_data
|
||||
tl_node_delete dd sz_tl_node_delete
|
||||
tl_cur_beg dd sz_tl_cur_beg
|
||||
tl_cur_next dd sz_tl_cur_next
|
||||
tl_cur_perv dd sz_tl_cur_perv
|
||||
tl_node_close_open dd sz_tl_node_close_open
|
||||
tl_node_lev_inc dd sz_tl_node_lev_inc
|
||||
tl_node_lev_dec dd sz_tl_node_lev_dec
|
||||
dd 0,0
|
||||
|
||||
aEdit_box_draw db 'edit_box',0
|
||||
aEdit_box_key db 'edit_box_key',0
|
||||
aEdit_box_mouse db 'edit_box_mouse',0
|
||||
aVersion_ed db 'version_ed',0
|
||||
|
||||
aCheck_box_draw db 'check_box_draw',0
|
||||
aCheck_box_mouse db 'check_box_mouse',0
|
||||
aVersion_ch db 'version_ch',0
|
||||
|
||||
aOption_box_draw db 'option_box_draw',0
|
||||
aOption_box_mouse db 'option_box_mouse',0
|
||||
aVersion_op db 'version_op',0
|
||||
|
||||
aScrollbar_ver_draw db 'scrollbar_v_draw',0
|
||||
aScrollbar_ver_mouse db 'scrollbar_v_mouse',0
|
||||
aScrollbar_hor_draw db 'scrollbar_h_draw',0
|
||||
aScrollbar_hor_mouse db 'scrollbar_h_mouse',0
|
||||
aVersion_scrollbar db 'version_scrollbar',0
|
||||
|
||||
aDbutton_draw db 'dbutton_draw',0
|
||||
aDbutton_mouse db 'dbutton_mouse',0
|
||||
aVersion_dbutton db 'version_dbutton',0
|
||||
|
||||
aMenu_bar_draw db 'menu_bar_draw',0
|
||||
aMenu_bar_mouse db 'menu_bar_mouse',0
|
||||
aVersion_menu_bar db 'version_menu_bar',0
|
||||
|
||||
sz_tl_data_init db 'tl_data_init',0
|
||||
sz_tl_data_clear db 'tl_data_clear',0
|
||||
sz_tl_info_clear db 'tl_info_clear',0
|
||||
sz_tl_key db 'tl_key',0
|
||||
sz_tl_mouse db 'tl_mouse',0
|
||||
sz_tl_draw db 'tl_draw',0
|
||||
sz_tl_info_undo db 'tl_info_undo',0
|
||||
sz_tl_info_redo db 'tl_info_redo',0
|
||||
sz_tl_node_add db 'tl_node_add',0
|
||||
sz_tl_node_set_data db 'tl_node_set_data',0
|
||||
sz_tl_node_get_data db 'tl_node_get_data',0
|
||||
sz_tl_node_delete db 'tl_node_delete',0
|
||||
sz_tl_cur_beg db 'tl_cur_beg',0
|
||||
sz_tl_cur_next db 'tl_cur_next',0
|
||||
sz_tl_cur_perv db 'tl_cur_perv',0
|
||||
sz_tl_node_close_open db 'tl_node_close_open',0
|
||||
sz_tl_node_lev_inc db 'tl_node_lev_inc',0
|
||||
sz_tl_node_lev_dec db 'tl_node_lev_dec',0
|
||||
;--------------------------------------------------
|
||||
align 4
|
||||
msgbox_lib_import:
|
||||
mb_create dd amb_create
|
||||
mb_reinit dd amb_reinit
|
||||
mb_setfunctions dd amb_setfunctions
|
||||
dd 0,0
|
||||
amb_create db 'mb_create',0
|
||||
amb_reinit db 'mb_reinit',0
|
||||
amb_setfunctions db 'mb_setfunctions',0
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
wScr:
|
||||
.x:
|
||||
.size_x dw 16 ;+0
|
||||
.start_x dw 50 ;+2
|
||||
.y:
|
||||
.size_y dw 300 ;+4
|
||||
.start_y dw 50 ;+6
|
||||
.btn_high dd 15 ;+8
|
||||
.type dd 1 ;+12
|
||||
.max_area dd 100 ;+16
|
||||
.cur_area dd 30 ;+20
|
||||
.position dd 0 ;+24
|
||||
.bckg_col dd 0xeeeeee ;+28
|
||||
.frnt_col dd 0xbbddff ;+32
|
||||
.line_col dd 0 ;+36
|
||||
.redraw dd 0 ;+40
|
||||
.delta dw 0 ;+44
|
||||
.delta2 dw 0 ;+46
|
||||
.run_x:
|
||||
.r_size_x dw 0 ;+48
|
||||
.r_start_x dw 0 ;+50
|
||||
.run_y:
|
||||
.r_size_y dw 0 ;+52
|
||||
.r_start_y dw 0 ;+54
|
||||
.m_pos dd 0 ;+56
|
||||
.m_pos_2 dd 0 ;+60
|
||||
.m_keys dd 0 ;+64
|
||||
.run_size dd 0 ;+68
|
||||
.position2 dd 0 ;+72
|
||||
.work_size dd 0 ;+76
|
||||
.all_redraw dd 0 ;+80
|
||||
.ar_offset dd 1 ;+84
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
hScr:
|
||||
.x:
|
||||
.size_x dw 150 ;+0
|
||||
.start_x dw 0 ;+2
|
||||
.y:
|
||||
.size_y dw 16 ;+4
|
||||
.start_y dw 50 ;+6
|
||||
.btn_high dd 15 ;+8
|
||||
.type dd 1 ;+12
|
||||
.max_area dd 100 ;+16
|
||||
.cur_area dd 30 ;+20
|
||||
.position dd 0 ;+24
|
||||
.bckg_col dd 0xeeeeee ;+28
|
||||
.frnt_col dd 0xbbddff ;+32
|
||||
.line_col dd 0 ;+36
|
||||
.redraw dd 0 ;+40
|
||||
.delta dw 0 ;+44
|
||||
.delta2 dw 0 ;+46
|
||||
.run_x:
|
||||
.r_size_x dw 0 ;+48
|
||||
.r_start_x dw 0 ;+50
|
||||
.run_y:
|
||||
.r_size_y dw 0 ;+52
|
||||
.r_start_y dw 0 ;+54
|
||||
.m_pos dd 0 ;+56
|
||||
.m_pos_2 dd 0 ;+60
|
||||
.m_keys dd 0 ;+64
|
||||
.run_size dd 0 ;+68
|
||||
.position2 dd 0 ;+72
|
||||
.work_size dd 0 ;+76
|
||||
.all_redraw dd 0 ;+80
|
||||
.ar_offset dd 1 ;+84
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
ws_dir_lbox: ;äî÷åðíèé ñêðîëëèíã äëÿ ýëåìåíòà ListBox
|
||||
.x:
|
||||
.size_x dw 16 ;+0
|
||||
.start_x dw 0 ;+2
|
||||
.y:
|
||||
.size_y dw 30 ;+4
|
||||
.start_y dw 70 ;+6
|
||||
.btn_high dd 15 ;+8
|
||||
.type dd 1 ;+12
|
||||
.max_area dd 100 ;+16
|
||||
.cur_area dd 30 ;+20
|
||||
.position dd 0 ;+24
|
||||
.bckg_col dd 0xeeeeee ;+28
|
||||
.frnt_col dd 0xbbddff ;+32
|
||||
.line_col dd 0 ;+36
|
||||
.redraw dd 0 ;+40
|
||||
.delta dw 0 ;+44
|
||||
.delta2 dw 0 ;+46
|
||||
.run_x:
|
||||
.r_size_x dw 0 ;+48
|
||||
.r_start_x dw 0 ;+50
|
||||
.run_y:
|
||||
.r_size_y dw 0 ;+52
|
||||
.r_start_y dw 0 ;+54
|
||||
.m_pos dd 0 ;+56
|
||||
.m_pos_2 dd 0 ;+60
|
||||
.m_keys dd 0 ;+64
|
||||
.run_size dd 0 ;+68
|
||||
.position2 dd 0 ;+72
|
||||
.work_size dd 0 ;+76
|
||||
.all_redraw dd 0 ;+80
|
||||
.ar_offset dd 1 ;+84;---------------------------------------------------------------------
|
||||
|
||||
align 4
|
||||
menu_data_1:
|
||||
.type: dd 0 ;+0
|
||||
.x:
|
||||
.size_x dw 35 ;+4
|
||||
.start_x dw 5 ;+6
|
||||
.y:
|
||||
.size_y dw 15 ;+8
|
||||
.start_y dw 5 ;+10
|
||||
.text_pointer: dd menu_text_area ;0 ;+12
|
||||
.pos_pointer: dd menu_text_area.1 ;0 ;+16
|
||||
.text_end dd menu_text_area.end ;0 ;+20
|
||||
.mouse_pos dd 0 ;+24
|
||||
.mouse_keys dd 0 ;+28
|
||||
.x1:
|
||||
.size_x1 dw 70 ;+32
|
||||
.start_x1 dw 5 ;+34
|
||||
.y1:
|
||||
.size_y1 dw 15 ;+36
|
||||
.start_y1 dw 20 ;+38
|
||||
.bckg_col dd 0xeeeeee ;+40
|
||||
.frnt_col dd 0xff ;+44
|
||||
.menu_col dd 0xffffff ;+48
|
||||
.select dd 0 ;+52
|
||||
.out_select dd 0 ;+56
|
||||
.buf_adress dd 0 ;+60
|
||||
.procinfo dd procinfo ;0 ;+64
|
||||
.click dd 0 ;+68
|
||||
.cursor dd 0 ;+72
|
||||
.cursor_old dd 0 ;+76
|
||||
.interval dd 16 ;+80
|
||||
.cursor_max dd 0 ;+84
|
||||
.extended_key dd 0 ;+88
|
||||
.menu_sel_col dd 0x00cc00 ;+92
|
||||
.bckg_text_col dd 0 ; +96
|
||||
.frnt_text_col dd 0xffffff ;+100
|
||||
.mouse_keys_old dd 0 ;+104
|
||||
.font_height dd 8 ;+108
|
||||
.cursor_out dd 0 ;+112
|
||||
.get_mouse_flag dd 0 ;+116
|
||||
;-------------------------
|
||||
|
||||
TE_PANEL_NULL equ 0
|
||||
TE_PANEL_FIND equ 1
|
||||
TE_PANEL_SYNTAX equ 2
|
||||
TE_PANEL_WIDTH equ 150 ;øèðèíà ïàíåëè
|
||||
|
||||
count_of_dir_list_files equ 15
|
||||
|
||||
el_focus dd 0
|
||||
mouse_dd dd 0
|
||||
tree1 tree_list 264,count_of_dir_list_files+2, tl_key_no_edit+tl_draw_par_line+tl_list_box_mode,\
|
||||
16,16, 0x8080ff,0x0000ff,0xffffff, 0,70,TE_PANEL_WIDTH-17,120, 0,0,0, el_focus,\
|
||||
ws_dir_lbox,0
|
||||
|
||||
;dir_list memory
|
||||
tree_file_struct:
|
||||
dd 1
|
||||
dd 0,0,count_of_dir_list_files
|
||||
dd dir_mem
|
||||
db 0
|
||||
dd file_name ;sys_path
|
||||
|
||||
dir_mem rb 32+304*count_of_dir_list_files
|
||||
|
||||
|
||||
menu_text_area:
|
||||
db '” ©«',0
|
||||
.1:
|
||||
db '‘®§¤ âì',0
|
||||
db 'Žâªàëâì',0
|
||||
db '‘®åà ¨âì',0
|
||||
db '‚ë室',0
|
||||
.end:
|
||||
db 0
|
||||
|
||||
;--------
|
||||
msgbox_1:
|
||||
dw 0
|
||||
db '‚¨¬ ¨¥',0 ;+2 = +MB_TEXT_OFFSET
|
||||
db '” ©« ¡®«ì让, ¯®â®¬ã ®âªàëâ ¥ ¢¥áì.',13
|
||||
db ' 1. <20>ਠ¥£® á®åà ¥¨¨ ¡ã¤ãâ ¯®â¥àïë "¥ ®âªàë¢è¨¥áï" ᨬ¢®«ë.',13
|
||||
db ' 2. ‚ ¤®ªã¬¥â ¥«ì§ï ¤®¡ ¢«ïâì ⥪áâ, â. ª. ¯ ¬ïâì § ïâ .',0
|
||||
db 'Ÿ ¯®ï«( )',0 ;button1
|
||||
db 0
|
||||
msgbox_2:
|
||||
db 3,0
|
||||
db '‚¨¬ ¨¥',0 ;+2 = +MB_TEXT_OFFSET
|
||||
db '‘®åà ¨âì ¨§¬¥¥¨ï ¢ ä ©«¥?',0
|
||||
db '‘®åà ¨âì',0
|
||||
db '<27>¥ á®åà ïâì',0
|
||||
db 'Žâ¬¥ ',0
|
||||
db 0
|
||||
msgbox_2_funct:
|
||||
dd On_SaveAndNewFile
|
||||
dd On_NewFile
|
||||
dd 0
|
||||
|
||||
msgbox_3:
|
||||
db 1,0
|
||||
db '‚¨¬ ¨¥',0 ;+2 = +MB_TEXT_OFFSET
|
||||
db 'Žè¨¡ª ¯à¨ ®âªàë⨨ ä ©« á 梥⮢묨 áâனª ¬¨!',13,\
|
||||
'<27>®â®¬ã ¢ë¤¥«¥¨¥ á«®¢ 梥⮬ ¥ ¢®§¬®¦®.',13,\
|
||||
' (ª®¤ ®è¨¡ª¨='
|
||||
.err: db '?'
|
||||
db ')',0
|
||||
db '‡ ªàëâì',0
|
||||
db 0
|
||||
|
||||
msgbox_4:
|
||||
db 1,0
|
||||
db '‚¨¬ ¨¥',0 ;+2 = +MB_TEXT_OFFSET
|
||||
db 'Žè¨¡ª ¯à¨ ®âªàë⨨ ä ©« !',13,\
|
||||
'‚®§¬®¦® ¨¬ï ä ©« ¢¢¥¤¥® ¥ ¯à ¢¨«ì®.',13,\
|
||||
' (ª®¤ ®è¨¡ª¨='
|
||||
.err: db '?'
|
||||
db ')',0
|
||||
db '‡ ªàëâì',0
|
||||
db 0
|
||||
|
||||
msgbox_5:
|
||||
db 3,0
|
||||
db '‚¨¬ ¨¥',0 ;+2 = +MB_TEXT_OFFSET
|
||||
db '‘®åà ¨âì ¨§¬¥¥¨ï ¢ ä ©«¥?',0
|
||||
db '<27>¥ á®åà ïâì',0
|
||||
db 'Žâ¬¥ ',0
|
||||
db 0
|
||||
msgbox_5_funct:
|
||||
; dd but_SaveFile
|
||||
dd On_OpenFile
|
||||
dd 0
|
||||
|
||||
msgbox_6:
|
||||
db 1,0
|
||||
db '‚¨¬ ¨¥',0 ;+2 = +MB_TEXT_OFFSET
|
||||
db 'Žè¨¡ª ¯à¨ á®åà ¥¨¨ ä ©« !',13,\
|
||||
'‚®§¬®¦® ¨¬ï ä ©« ¢¢¥¤¥® ¥ ¯à ¢¨«ì®.',13,\
|
||||
' (ª®¤ ®è¨¡ª¨='
|
||||
.err: db '?'
|
||||
db ')',0
|
||||
db '‡ ªàëâì',0
|
||||
db 0
|
||||
msgbox_7:
|
||||
db 1,0
|
||||
db '’¥ªáâ ¥ ©¤¥',0 ;+2 = +MB_TEXT_OFFSET
|
||||
db '„®á⨣ãâ ª®¥æ ¤®ªã¬¥â .',13,\
|
||||
'<27>®¯à®¡ã©â¥ ¯¥à¥©â¨ ¢ ç «® ¤®ªã¬¥â ',13,\
|
||||
'¨«¨ ¨§¬¥¨âì § ¯à®á ¨ ¯®¢â®à¨âì ¯®¨áª.',0
|
||||
db '‡ ªàëâì',0
|
||||
db 0
|
||||
msgbox_8:
|
||||
db 3,0
|
||||
db '‚¨¬ ¨¥',0 ;+2 = +MB_TEXT_OFFSET
|
||||
db '„«ï ¢ë室 § ¢¥àè¨â¥ à ¡®âã á ä ©«®¬.',13,\
|
||||
'<27>®¯à®¡ã©â¥ á®åà ¨âì ¨§¬¥¥¨ï ¢ ä ©«¥',13,\
|
||||
'¨«¨ ç âì ®¢ë© ¯ãá⮩.',0
|
||||
db 'Žâ¬¥ ',0
|
||||
db 0
|
||||
|
||||
txtFindCapt db '<27>®¨áª',0
|
||||
txtFindNext db '<27> ©â¨ ¤ «¥¥',0
|
||||
txtFormatCapt db '”®à¬ â',0
|
||||
txtFormatApply db '<27>ਬ¥¨âì',0
|
||||
;------
|
||||
align 4
|
||||
EvChar db 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0
|
||||
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
|
||||
EvUpper db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79
|
||||
db 80,81,82,83,84,85,86,87,88,89,90,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
EvLover db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111
|
||||
db 112,113,114,115,116,117,118,119,120,121,122,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
conv_table dd 0
|
||||
|
||||
|
||||
KM_SHIFT equ 0x00010000
|
||||
KM_CTRL equ 0x00020000
|
||||
KM_ALT equ 0x00040000
|
||||
KM_NUMLOCK equ 0x00080000
|
||||
|
||||
; KEY CODES
|
||||
KEY_F1 equ 0x0000003B
|
||||
KEY_F2 equ 0x0000003C
|
||||
KEY_F3 equ 0x0000003D
|
||||
|
1291
programs/other/t_edit/t_draw.inc
Normal file
1291
programs/other/t_edit/t_draw.inc
Normal file
File diff suppressed because it is too large
Load Diff
875
programs/other/t_edit/t_edit.asm
Normal file
875
programs/other/t_edit/t_edit.asm
Normal file
@ -0,0 +1,875 @@
|
||||
;Îãðîìíàÿ áëàãîäàðíîñòü Maxxxx32, Diamond, Heavyiron
|
||||
;è äðóãèì ïðîãðàììèñòàì, à òàêæå
|
||||
;Òåïëîâó Àëåêñåþ (<Lrz> www.lrz.land.ru)
|
||||
|
||||
|
||||
use32
|
||||
org 0x0
|
||||
db 'MENUET01' ;èäåíòèô. èñïîëíÿåìîãî ôàéëà âñåãäà 8 áàéò
|
||||
dd 0x01
|
||||
dd start
|
||||
dd i_end ; ðàçìåð ïðèëîæåíèÿ
|
||||
dd mem
|
||||
dd stacktop
|
||||
dd file_name;buf_cmd_lin
|
||||
dd sys_path
|
||||
|
||||
MAX_COLOR_WORD_LEN equ 40
|
||||
maxChars equ 100002 ;(...+2)
|
||||
BUF_SIZE equ 1000 ;bufer for copy|paste
|
||||
maxColWords equ 10000
|
||||
|
||||
|
||||
include '../../macros.inc'
|
||||
;include '../../develop/libraries/box_lib/load_lib.mac'
|
||||
include 'load_lib.mac' ;include old file
|
||||
include '../../develop/libraries/box_lib/trunk/tree_list.mac'
|
||||
include '../../develop/libraries/box_lib/trunk/editbox_ex.mac'
|
||||
|
||||
include 't_data.inc'
|
||||
include 'strlen.inc'
|
||||
include 't_work.inc' ;text work functions
|
||||
include 't_draw.inc' ;draw main window functions
|
||||
include 't_button.inc'
|
||||
|
||||
@use_library
|
||||
|
||||
start:
|
||||
mov eax,48
|
||||
mov ebx,3
|
||||
mov ecx,sc
|
||||
mov edx,sizeof.system_colors
|
||||
mcall
|
||||
|
||||
m2m [wScr.bckg_col],[sc.work]
|
||||
m2m [wScr.frnt_col],[sc.work_button]
|
||||
m2m [wScr.line_col],[sc.work_button_text]
|
||||
|
||||
m2m [hScr.bckg_col],[sc.work]
|
||||
m2m [hScr.frnt_col],[sc.work_button]
|
||||
m2m [hScr.line_col],[sc.work_button_text]
|
||||
|
||||
|
||||
mcall 68,11
|
||||
or eax,eax
|
||||
jz button.exit
|
||||
|
||||
mcall 66,1,1 ;scan code
|
||||
;mcall 26,2,1,conv_tabl
|
||||
|
||||
mov ecx,sizeof.symbol*maxChars
|
||||
call mem_Alloc
|
||||
mov [tex],eax
|
||||
mov [tex_1],eax
|
||||
add [tex_1],sizeof.symbol
|
||||
mov [tex_end],eax
|
||||
add [tex_end],sizeof.symbol*maxChars
|
||||
|
||||
mcall 40,0x27
|
||||
|
||||
call Clear
|
||||
|
||||
;-------------------------------------------------
|
||||
mov ecx,maxColWords*sizeof.TexColViv
|
||||
add ecx,40
|
||||
call mem_Alloc
|
||||
mov [options_file],eax
|
||||
mov [options_file_end],eax
|
||||
add [options_file_end],maxColWords*sizeof.TexColViv
|
||||
add [options_file_end],40
|
||||
|
||||
;-------------------------------------------------
|
||||
; init bmp file
|
||||
mov ecx,1200*18
|
||||
call mem_Alloc
|
||||
mov [bmp_icon],eax
|
||||
|
||||
mov esi,file_name
|
||||
call strlen
|
||||
mov ecx,eax
|
||||
mov edi,buf_cmd_lin
|
||||
rep movsb
|
||||
|
||||
copy_path fn_icon,sys_path,file_name
|
||||
|
||||
mov eax,70 ;load icon file
|
||||
mov [run_file_70.func_n], 0
|
||||
mov [run_file_70.param1], 54
|
||||
mov [run_file_70.param2], 0
|
||||
mov [run_file_70.param3], 1200*18
|
||||
m2m [run_file_70.param4], [bmp_icon]
|
||||
mov [run_file_70.rezerv], 0
|
||||
mov [run_file_70.name], file_name
|
||||
mov ebx,run_file_70
|
||||
int 0x40
|
||||
|
||||
cmp ebx,-1
|
||||
mov [err_ini0],1
|
||||
je @f ;if open file
|
||||
mov [err_ini0],0
|
||||
@@:
|
||||
|
||||
load_libraries l_libs_start,load_lib_end
|
||||
|
||||
;¯à®¢¥àª ᪮«ìª® ã¤ ç® § £ã§¨« áì è «¨¡
|
||||
mov ebp,lib0
|
||||
cmp dword [ebp+ll_struc_size-4],0
|
||||
jz @f
|
||||
mcall -1 ;exit not correct
|
||||
@@:
|
||||
mov ebp,lib1 ;
|
||||
cmp dword [ebp+ll_struc_size-4],0
|
||||
jz @f
|
||||
mcall -1 ;exit not correct
|
||||
@@:
|
||||
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
push dword tree1
|
||||
call dword[tl_data_init]
|
||||
;---------------------------------------------------------------------
|
||||
; ÷èòàåì bmp ôàéë ñ êóðñîðàìè è ëèíèÿìè
|
||||
copy_path fn_icon_tl_sys,sys_path,file_name
|
||||
|
||||
mov ecx,3*256*13
|
||||
call mem_Alloc
|
||||
mov dword[tree1.data_img_sys],eax
|
||||
|
||||
mov [run_file_70.func_n], 0
|
||||
mov [run_file_70.param1], 54
|
||||
mov [run_file_70.param2], 0
|
||||
mov [run_file_70.param3], 3*256*13
|
||||
mov [run_file_70.param4], eax
|
||||
mov [run_file_70.rezerv], 0
|
||||
mov [run_file_70.name], file_name
|
||||
|
||||
mov eax,70 ;load icon file
|
||||
mov ebx,run_file_70
|
||||
int 0x40
|
||||
cmp ebx,0
|
||||
jg @f
|
||||
mov dword[tree1.data_img_sys],0
|
||||
@@:
|
||||
;---------------------------------------------------------------------
|
||||
; ÷èòàåì bmp ôàéë ñ èêîíêàìè óçëîâ
|
||||
copy_path fn_icon_tl_nod,sys_path,file_name
|
||||
|
||||
mov ecx,3*256*2
|
||||
call mem_Alloc
|
||||
mov dword[tree1.data_img],eax
|
||||
|
||||
; mov [run_file_70.func_n], 0
|
||||
; mov [run_file_70.param1], 54
|
||||
; mov [run_file_70.param2], 0
|
||||
mov [run_file_70.param3], 3*256*2
|
||||
mov [run_file_70.param4], eax
|
||||
; mov [run_file_70.rezerv], 0
|
||||
; mov [run_file_70.name], file_name
|
||||
|
||||
mov eax,70 ;load icon file
|
||||
mov ebx,run_file_70
|
||||
int 0x40
|
||||
cmp ebx,0
|
||||
jg @f
|
||||
mov dword[tree1.data_img],0
|
||||
@@:
|
||||
;------------------------------------------------------------------------------
|
||||
copy_path fn_syntax_dir,sys_path,file_name ;áåðåì ïóòü ê ïàïêå ñ ôàéëàìè ñèíòàêñèñà
|
||||
mov eax,70
|
||||
mov ebx,tree_file_struct
|
||||
int 0x40
|
||||
|
||||
cmp ebx,-1
|
||||
je .end_dir_init
|
||||
|
||||
mov eax,dir_mem
|
||||
add eax,32+4+1+3+4*6+8
|
||||
mov ecx,ebx
|
||||
@@:
|
||||
cmp byte[eax],'.' ;ôèëüòðóåì ôàéëû ñ èìåíàìè '.' è '..'
|
||||
je .filter
|
||||
push dword tree1
|
||||
push dword 0x10000 ;1*2^16 - ãäå 1 íîìåð èêîíêè ñ êíèãîé
|
||||
push dword eax
|
||||
call dword[tl_node_add]
|
||||
|
||||
push dword tree1
|
||||
call dword[tl_cur_next]
|
||||
.filter:
|
||||
add eax,304
|
||||
loop @b
|
||||
.end_dir_init:
|
||||
|
||||
; push dword tree1
|
||||
; push dword 0
|
||||
; push dword file_name
|
||||
; call dword[tl_node_add]
|
||||
|
||||
|
||||
;--- load color option file ---
|
||||
call InitColText
|
||||
|
||||
;--- get cmd line ---
|
||||
cmp byte[buf_cmd_lin+3],0 ;buf_cmd_lin
|
||||
je @f ;if file names exist
|
||||
mov esi,buf_cmd_lin
|
||||
call strlen ;eax=strlen
|
||||
mov [edit1.size],eax
|
||||
call but_OpenFile
|
||||
@@:
|
||||
|
||||
|
||||
red_win:
|
||||
mov eax,12
|
||||
mov ebx,1
|
||||
mcall
|
||||
|
||||
xor eax,eax
|
||||
mov ebx,10*65536+485
|
||||
mov ecx,10*65536+280
|
||||
mov edx,[sc.work]
|
||||
or edx,0x73000000
|
||||
mov edi,hed
|
||||
mcall
|
||||
|
||||
mcall 9,procinfo,-1
|
||||
call EvSize
|
||||
|
||||
mov eax,13 ;rect
|
||||
xor ebx,ebx
|
||||
xor ecx,ecx
|
||||
mov bx,word [procinfo.client_box.width]
|
||||
inc bx
|
||||
mov cx,word [wndMain.top]
|
||||
mcall
|
||||
|
||||
push dword edit1
|
||||
call [edit_box_draw]
|
||||
|
||||
; draw for Menu 1
|
||||
push dword menu_data_1
|
||||
call [menu_bar_draw]
|
||||
|
||||
call draw_but_toolbar
|
||||
|
||||
cmp [err_ini0],1
|
||||
jne @f
|
||||
mov eax,4
|
||||
mov ebx,[wndMain.left]
|
||||
add ebx,[recMain.left]
|
||||
shl ebx,16
|
||||
add ebx,[wndMain.top]
|
||||
add ebx,[recMain.top]
|
||||
mov ecx,0x80ff0000
|
||||
mov edx,txtErrIni0
|
||||
int 0x40
|
||||
|
||||
add ebx,10 ;move <--y-->
|
||||
mov ecx,0x80ff0080
|
||||
mov edx,file_name
|
||||
int 0x40
|
||||
@@:
|
||||
|
||||
cmp [err_ini0],1
|
||||
je @f
|
||||
call draw_main_win
|
||||
@@:
|
||||
|
||||
cmp [err_opn],1
|
||||
jne @f
|
||||
;mov eax,4
|
||||
mov ebx,10*65536+35
|
||||
mov ecx,0x80ff0000
|
||||
mov edx,txtErrOpen
|
||||
mcall
|
||||
@@:
|
||||
|
||||
mov eax,12
|
||||
mov ebx,2
|
||||
mcall
|
||||
|
||||
still:
|
||||
mov eax,10
|
||||
mcall
|
||||
|
||||
cmp al,1 ;èçì. ïîëîæåíèå îêíà
|
||||
jz red_win
|
||||
cmp al,2
|
||||
jz key
|
||||
cmp al,3
|
||||
jz button
|
||||
cmp al,6
|
||||
jz mouse
|
||||
|
||||
jmp still
|
||||
|
||||
|
||||
|
||||
mouse:
|
||||
push dword edit1
|
||||
call [edit_box_mouse]
|
||||
|
||||
test word [edit1.flags],10b;ed_focus ; ¥á«¨ ¥ ¢ 䮪ãá¥, ¢ë室¨¬
|
||||
jne still
|
||||
|
||||
;-----------------------------------------------
|
||||
cmp [hScr.delta2],0
|
||||
jne .horizontal
|
||||
.vertical:
|
||||
mov eax,[wScr.max_area]
|
||||
cmp eax,[wScr.cur_area]
|
||||
jbe .horizontal
|
||||
; mouse event for Vertical ScrollBar
|
||||
push dword wScr
|
||||
call [scrollbar_ver_mouse]
|
||||
mov eax,wScr.redraw
|
||||
xor ebx,ebx
|
||||
cmp [eax],ebx
|
||||
je @f
|
||||
mov [eax],ebx
|
||||
|
||||
call draw_main_win
|
||||
;call mouse_wnd_main
|
||||
jmp still
|
||||
@@:
|
||||
cmp [wScr.delta2],0
|
||||
jne still
|
||||
.horizontal:
|
||||
mov eax,[hScr.max_area]
|
||||
cmp eax,[hScr.cur_area]
|
||||
jbe .other
|
||||
; mouse event for Horizontal ScrollBar
|
||||
push dword hScr
|
||||
call [scrollbar_hor_mouse]
|
||||
mov eax,hScr.redraw
|
||||
xor ebx,ebx
|
||||
cmp [eax],ebx
|
||||
je .other
|
||||
mov [eax],ebx
|
||||
call draw_main_win
|
||||
jmp still
|
||||
.other:
|
||||
cmp [wScr.delta2],0
|
||||
jne still
|
||||
cmp [hScr.delta2],0
|
||||
jne still
|
||||
|
||||
call mouse_wnd_main
|
||||
|
||||
cmp byte[panel_id],TE_PANEL_FIND ;if not panel
|
||||
jne @f
|
||||
push dword edit2
|
||||
call [edit_box_mouse]
|
||||
@@:
|
||||
cmp byte[panel_id],TE_PANEL_SYNTAX ;if not panel
|
||||
jne .menu_bar_1 ;@f
|
||||
push dword tree1
|
||||
call [tl_mouse]
|
||||
;-----------------------------------------------
|
||||
.menu_bar_1:
|
||||
mov [menu_data_1.get_mouse_flag],1
|
||||
; mouse event for Menu 1
|
||||
push dword menu_data_1
|
||||
call [menu_bar_mouse]
|
||||
cmp [menu_data_1.click],dword 1
|
||||
jne .mnu_1
|
||||
cmp [menu_data_1.cursor_out],dword 4
|
||||
je button.exit
|
||||
cmp [menu_data_1.cursor_out],dword 3
|
||||
jne @f
|
||||
call but_SaveFile
|
||||
@@:
|
||||
cmp [menu_data_1.cursor_out],dword 2
|
||||
jne @f
|
||||
call but_OpenFile
|
||||
@@:
|
||||
cmp [menu_data_1.cursor_out],dword 1
|
||||
jne @f
|
||||
call but_NewFile
|
||||
@@:
|
||||
;cmp [menu_data_1.cursor_out],dword 0
|
||||
;jne @f
|
||||
.mnu_1:
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
KeyConvertToASCII:
|
||||
mov ebx,conv_tabl ;convert scan to ascii
|
||||
ror ax,8
|
||||
xor ah,ah
|
||||
add bx,ax
|
||||
mov ah,byte[ebx]
|
||||
ret
|
||||
|
||||
key:
|
||||
mov ecx,1
|
||||
mcall 66,3
|
||||
xor ebx,ebx
|
||||
test al,0x03 ;[Shift]
|
||||
jz @f
|
||||
inc cl
|
||||
or ebx,KM_SHIFT
|
||||
@@:
|
||||
test al,0x0c ;[Ctrl]
|
||||
jz @f
|
||||
or ebx,KM_CTRL
|
||||
@@:
|
||||
test al,0x30 ;[Alt]
|
||||
jz @f
|
||||
or ebx,KM_ALT
|
||||
@@:
|
||||
test al,0x80 ;[NumLock]
|
||||
jz @f
|
||||
or ebx,KM_NUMLOCK
|
||||
@@:
|
||||
|
||||
mov [keyUpr],ebx
|
||||
mcall 26,2,,conv_tabl
|
||||
mcall 2
|
||||
|
||||
; push dword tree1 ;???
|
||||
; call [tl_key] ;???
|
||||
|
||||
test word [edit1.flags],10b;ed_focus ; ¥á«¨ ¥ ¢ 䮪ãá¥, ¢ë室¨¬
|
||||
je @f
|
||||
cmp ah,0x80 ;if key up
|
||||
ja still
|
||||
cmp ah,42 ;[Shift] (left)
|
||||
je still
|
||||
cmp ah,54 ;[Shift] (right)
|
||||
je still
|
||||
cmp ah,56 ;[Alt]
|
||||
je still
|
||||
cmp ah,29 ;[Ctrl]
|
||||
je still
|
||||
cmp ah,69 ;[Pause Break]
|
||||
je still
|
||||
; cmp [keyUpr],0
|
||||
; jne still
|
||||
|
||||
call KeyConvertToASCII
|
||||
|
||||
push dword edit1
|
||||
call [edit_box_key]
|
||||
jmp still
|
||||
@@:
|
||||
|
||||
test word [edit2.flags],10b;ed_focus ; ¥á«¨ ¥ ¢ 䮪ãá¥, ¢ë室¨¬
|
||||
je @f
|
||||
cmp ah,0x80 ;if key up
|
||||
ja still
|
||||
cmp ah,42 ;[Shift] (left)
|
||||
je still
|
||||
cmp ah,54 ;[Shift] (right)
|
||||
je still
|
||||
cmp ah,56 ;[Alt]
|
||||
je still
|
||||
cmp ah,29 ;[Ctrl]
|
||||
je still
|
||||
cmp ah,69 ;[Pause Break]
|
||||
je still
|
||||
; cmp [keyUpr],0
|
||||
; jne still
|
||||
|
||||
call KeyConvertToASCII
|
||||
push dword edit2
|
||||
call [edit_box_key]
|
||||
jmp still
|
||||
@@:
|
||||
|
||||
cmp ah,KEY_F1 ;[F1]
|
||||
jne @f
|
||||
call ShowHelpF1
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,KEY_F3 ;[F3]
|
||||
jne @f
|
||||
call but_FindText
|
||||
jmp still
|
||||
@@:
|
||||
|
||||
test [keyUpr],KM_CTRL ;Ctrl+...
|
||||
jz .key_Ctrl
|
||||
|
||||
cmp ah,24 ;Ctrl+O
|
||||
jne @f
|
||||
call but_OpenFile
|
||||
@@:
|
||||
cmp ah,33 ;Ctrl+F
|
||||
jne @f
|
||||
cmp byte[panel_id],TE_PANEL_FIND
|
||||
je @f
|
||||
call but_find
|
||||
@@:
|
||||
cmp ah,44 ;Ctrl+Z
|
||||
je but_undo
|
||||
cmp ah,46 ;Ctrl+C
|
||||
jne @f
|
||||
call but_Copy
|
||||
@@:
|
||||
cmp ah,47 ;Ctrl+V
|
||||
je but_paste
|
||||
cmp ah,49 ;Ctrl+N
|
||||
jne @f
|
||||
call but_NewFile
|
||||
@@:
|
||||
cmp ah,199 ;Ctrl+Home
|
||||
jne @f
|
||||
call but_CtrlHome
|
||||
@@:
|
||||
;jmp still
|
||||
.key_Ctrl:
|
||||
|
||||
test [keyUpr],KM_SHIFT ;Shift+...
|
||||
jz .key_Shift
|
||||
cmp ah,72 ;Shift+Up
|
||||
jne @f
|
||||
call sel_KeyUp
|
||||
@@:
|
||||
cmp ah,75 ;Shift+Left
|
||||
jne @f
|
||||
call sel_KeyLeft
|
||||
@@:
|
||||
cmp ah,77 ;Shift+Right
|
||||
jne @f
|
||||
call sel_KeyRight
|
||||
@@:
|
||||
cmp ah,80 ;Shift+Down
|
||||
jne @f
|
||||
call sel_KeyDown
|
||||
@@:
|
||||
;mov [dragk],1 ;íà÷èíàåì âûäåëåíèå îò êëàâèàòóðû
|
||||
jmp .key_MoveCur
|
||||
.key_Shift:
|
||||
;-------------------------------------------------
|
||||
cmp ah,72 ;178 ;Up
|
||||
jne @f
|
||||
push dx
|
||||
call draw_cursor_sumb
|
||||
call CurMoveUp
|
||||
cmp dl,8
|
||||
jne .no_red_0
|
||||
call OnInitialUpdate
|
||||
call draw_main_win
|
||||
pop dx
|
||||
jmp @f
|
||||
.no_red_0:
|
||||
call draw_main_cursor
|
||||
pop dx
|
||||
mov [dragk],0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
|
||||
@@:
|
||||
cmp ah,80 ;177 ;Down
|
||||
jne @f
|
||||
push dx
|
||||
call draw_cursor_sumb
|
||||
call CurMoveDown
|
||||
cmp dl,8
|
||||
jne .no_red_1
|
||||
call OnInitialUpdate
|
||||
call draw_main_win
|
||||
pop dx
|
||||
jmp @f
|
||||
.no_red_1:
|
||||
call draw_main_cursor
|
||||
pop dx
|
||||
mov [dragk],0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
|
||||
@@:
|
||||
cmp ah,75 ;176 ;Left
|
||||
jne @f
|
||||
push dx
|
||||
call draw_cursor_sumb
|
||||
call CurMoveLeft
|
||||
cmp dl,8
|
||||
jne .no_red_2
|
||||
call OnInitialUpdate
|
||||
call draw_main_win
|
||||
pop dx
|
||||
jmp @f
|
||||
.no_red_2:
|
||||
call draw_main_cursor
|
||||
pop dx
|
||||
mov [dragk],0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
|
||||
@@:
|
||||
cmp ah,77 ;179 ;Right
|
||||
jne @f
|
||||
push dx
|
||||
call draw_cursor_sumb
|
||||
call CurMoveRight
|
||||
cmp dl,8
|
||||
jne .no_red_3
|
||||
call OnInitialUpdate
|
||||
call draw_main_win
|
||||
pop dx
|
||||
jmp @f
|
||||
.no_red_3:
|
||||
call draw_main_cursor
|
||||
pop dx
|
||||
mov [dragk],0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
|
||||
@@:
|
||||
cmp ah,71 ;180 ;Home
|
||||
jne @f
|
||||
push dx
|
||||
call draw_cursor_sumb
|
||||
call CurMoveX_FirstChar
|
||||
cmp dl,8
|
||||
jne .no_red_4
|
||||
call OnInitialUpdate
|
||||
call draw_main_win
|
||||
pop dx
|
||||
jmp @f
|
||||
.no_red_4:
|
||||
call draw_main_cursor
|
||||
pop dx
|
||||
mov [dragk],0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
|
||||
@@:
|
||||
cmp ah,79 ;181 ;End
|
||||
jne @f
|
||||
push dx
|
||||
call draw_cursor_sumb
|
||||
call CurMoveX_LastChar
|
||||
cmp dl,8
|
||||
jne .no_red_5
|
||||
call OnInitialUpdate
|
||||
call draw_main_win
|
||||
pop dx
|
||||
jmp @f
|
||||
.no_red_5:
|
||||
call draw_main_cursor
|
||||
pop dx
|
||||
mov [dragk],0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
|
||||
@@:
|
||||
cmp ah,73 ;184 ;PageUp
|
||||
jne @f
|
||||
push dx
|
||||
call CurMovePageUp
|
||||
cmp dl,0
|
||||
pop dx
|
||||
je @f
|
||||
call OnInitialUpdate
|
||||
call draw_main_win
|
||||
@@:
|
||||
cmp ah,81 ;183 ;PageDown
|
||||
jne @f
|
||||
push dx
|
||||
call CurMovePageDown
|
||||
cmp dl,0
|
||||
pop dx
|
||||
je @f
|
||||
call OnInitialUpdate
|
||||
call draw_main_win
|
||||
mov [dragk],0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
|
||||
@@:
|
||||
;-------------------------------------------------
|
||||
cmp [keyUpr],0
|
||||
jne still
|
||||
.key_MoveCur:
|
||||
|
||||
cmp ah,69 ;[Pause Break]
|
||||
je still
|
||||
cmp ah,120 ;[Fn]
|
||||
je still
|
||||
cmp ah,0x80 ;if key up
|
||||
ja still
|
||||
call KeyConvertToASCII
|
||||
|
||||
;mov [dragk],0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
|
||||
|
||||
push ebx
|
||||
xor ebx,ebx
|
||||
mov bl,ah
|
||||
add ebx,EvChar ;add char to text
|
||||
cmp byte [ebx],1
|
||||
jne @f
|
||||
push esi edi
|
||||
call SetUndo
|
||||
mov bx,0x0101
|
||||
call SelTextDel
|
||||
mov esi,1
|
||||
mov byte [key_new],ah
|
||||
mov edi,dword key_new
|
||||
cmp [curMod],1
|
||||
je .no_ins_mod
|
||||
call TextDel
|
||||
xor bl,1
|
||||
.no_ins_mod:
|
||||
call TextAdd
|
||||
call draw_but_toolbar
|
||||
cmp byte [key_new],13
|
||||
jne .dr_m_win
|
||||
call draw_main_win
|
||||
jmp .dr_cur_l
|
||||
.dr_m_win:
|
||||
call draw_cur_line
|
||||
.dr_cur_l:
|
||||
pop edi esi
|
||||
@@:
|
||||
pop ebx
|
||||
|
||||
cmp ah,8 ;[<-]
|
||||
jne @f
|
||||
push ax bx
|
||||
call SetUndo
|
||||
|
||||
mov bx,0x0001
|
||||
call SelTextDel
|
||||
cmp al,1
|
||||
je .del_one_b
|
||||
call TextDel
|
||||
.del_one_b:
|
||||
call draw_but_toolbar
|
||||
call draw_main_win
|
||||
pop bx ax
|
||||
@@:
|
||||
|
||||
cmp ah,182 ;Delete
|
||||
jne @f
|
||||
push ax bx
|
||||
call SetUndo
|
||||
|
||||
mov bx,0x0101
|
||||
call SelTextDel
|
||||
cmp al,1
|
||||
je .del_one_d
|
||||
call TextDel
|
||||
.del_one_d:
|
||||
call draw_but_toolbar
|
||||
call draw_main_win
|
||||
pop bx ax
|
||||
@@:
|
||||
|
||||
cmp ah,185 ;Ins
|
||||
jne @f
|
||||
call draw_cursor_sumb
|
||||
xor [curMod],1
|
||||
call draw_main_cursor
|
||||
@@:
|
||||
|
||||
jmp still
|
||||
|
||||
button:
|
||||
; cmp [menu_active],1 ;åñëè íàæàëè ìåíþ, òî ñíà÷àëà ðåàêöèÿ íà ìåíþ
|
||||
; jne @f ;mouse.menu_bar_1
|
||||
; mov [menu_active],0
|
||||
; jmp still
|
||||
; @@:
|
||||
|
||||
mcall 17 ;ïîëó÷èòü êîä íàæàòîé êíîïêè
|
||||
cmp ah,3
|
||||
jne @f
|
||||
call but_NewFile
|
||||
@@:
|
||||
cmp ah,4
|
||||
jne @f
|
||||
call but_OpenFile
|
||||
@@:
|
||||
cmp ah,5
|
||||
jne @f
|
||||
call but_SaveFile
|
||||
@@:
|
||||
cmp ah,6
|
||||
jz but_select_word
|
||||
cmp ah,7
|
||||
jz but_cut
|
||||
cmp ah,8
|
||||
jne @f
|
||||
call but_Copy
|
||||
@@:
|
||||
cmp ah,9
|
||||
jz but_paste
|
||||
cmp ah,10
|
||||
jz but_find
|
||||
cmp ah,11
|
||||
jz but_replace
|
||||
cmp ah,12
|
||||
jz but_find_key_w
|
||||
cmp ah,13
|
||||
jz but_sumb_upper
|
||||
cmp ah,14
|
||||
jz but_sumb_lover
|
||||
cmp ah,15
|
||||
jz but_reverse
|
||||
cmp ah,16
|
||||
jz but_undo
|
||||
cmp ah,17
|
||||
jz but_redo
|
||||
cmp ah,18
|
||||
jz but_sumb_invis
|
||||
cmp ah,19
|
||||
jz but_k_words_show
|
||||
cmp ah,20
|
||||
jz but_synt_show
|
||||
|
||||
cmp ah,200
|
||||
jne @f
|
||||
call but_OpenSyntax
|
||||
@@:
|
||||
cmp ah,201
|
||||
jne @f
|
||||
call but_FindText
|
||||
@@:
|
||||
|
||||
cmp ah,1
|
||||
jne still
|
||||
.exit:
|
||||
;push eax
|
||||
call CanSave
|
||||
cmp al,1
|
||||
jne @f
|
||||
push thread
|
||||
push msgbox_8
|
||||
call [mb_create] ;message: save changes in file?
|
||||
jmp still
|
||||
@@:
|
||||
mov ecx,[tex]
|
||||
call mem_Free
|
||||
mov ecx,[bmp_icon]
|
||||
call mem_Free
|
||||
mov ecx,[options_file]
|
||||
call mem_Free
|
||||
push dword tree1
|
||||
call dword[tl_data_clear]
|
||||
mcall -1 ;âûõîä èç ïðîãðàììû
|
||||
|
||||
|
||||
|
||||
txtErrOpen db '<27>¥ ©¤¥ ä ©«, ¯à®¢¥àì⥠¯à ¢¨«ì®áâì ¨¬¥¨',0
|
||||
txtErrIni0 db '<27>¥ ®âªàë«áï ä ©« á ¨ª®ª ¬¨',0
|
||||
err_ini0 db 0
|
||||
|
||||
edit1 edit_box 250, 220, 5, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_cmd_lin, mouse_dd, 0
|
||||
edit2 edit_box TE_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_find, mouse_dd, 0
|
||||
|
||||
buf_cmd_lin db 302 dup(0)
|
||||
buf_find db 302 dup(0)
|
||||
|
||||
err_message_found_lib0 db 'Sorry I cannot found library box_lib.obj',0
|
||||
head_f_i0:
|
||||
head_f_l0 db 'System error',0
|
||||
err_message_import0 db 'Error on load import library box_lib.obj',0
|
||||
err_message_found_lib1 db 'Sorry I cannot found library msgbox.obj',0
|
||||
;head_f_i1:
|
||||
;head_f_l1 db 'System error',0
|
||||
err_message_import1 db 'Error on load import library msgbox.obj',0
|
||||
|
||||
;library structures
|
||||
l_libs_start:
|
||||
lib0 l_libs boxlib_name, sys_path, file_name, system_dir0, err_message_found_lib0, head_f_l0, myimport,err_message_import0, head_f_i0
|
||||
lib1 l_libs msgbox_name, sys_path, file_name, system_dir1, err_message_found_lib1, head_f_l0, msgbox_lib_import, err_message_import1, head_f_i0
|
||||
load_lib_end:
|
||||
|
||||
|
||||
i_end:
|
||||
align 16
|
||||
procinfo process_information
|
||||
thread:
|
||||
rb 1024
|
||||
stacktop:
|
||||
sys_path:
|
||||
rb 4096
|
||||
file_name:
|
||||
rb 4096
|
||||
file_name_rez:
|
||||
rb 4096
|
||||
file_info:
|
||||
rb 40
|
||||
mem:
|
BIN
programs/other/t_edit/t_edit.png
Normal file
BIN
programs/other/t_edit/t_edit.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
1759
programs/other/t_edit/t_work.inc
Normal file
1759
programs/other/t_edit/t_work.inc
Normal file
File diff suppressed because it is too large
Load Diff
BIN
programs/other/t_edit/te_icon.bmp
Normal file
BIN
programs/other/t_edit/te_icon.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
Loading…
Reference in New Issue
Block a user