Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 1337 → Rev 1338

/programs/other/t_edit/build.bat
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
/programs/other/t_edit/info/asm.syn
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/other/t_edit/info/cpp_kol_cla.syn
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/other/t_edit/info/cpp_kol_dar.syn
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/other/t_edit/info/cpp_kol_def.syn
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/other/t_edit/info/cpp_win_dar.syn
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/other/t_edit/info/default.syn
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/other/t_edit/info/html.syn
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/other/t_edit/info/voc_eng_rus.syn
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/other/t_edit/info/win_const.syn
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/other/t_edit/info
Property changes:
Added: tsvn:logminsize
+5
\ No newline at end of property
/programs/other/t_edit/load_lib.mac
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
;
}
/programs/other/t_edit/msgbox.obj
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/other/t_edit/readme.htm
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>
/programs/other/t_edit/strlen.inc
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
 
/programs/other/t_edit/t_button.inc
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
/programs/other/t_edit/t_data.inc
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. à¨ ¥£® á®åà ­¥­¨¨ ¡ã¤ãâ ¯®â¥àï­ë "­¥ ®âªàë¢è¨¥áï" ᨬ¢®«ë.',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 '¥ á®åà ­ïâì',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,\
'®â®¬ã ¢ë¤¥«¥­¨¥ á«®¢ 梥⮬ ­¥ ¢®§¬®¦­®.',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 '¥ á®åà ­ïâì',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,\
'®¯à®¡ã©â¥ ¯¥à¥©â¨ ¢ ­ ç «® ¤®ªã¬¥­â ',13,\
'¨«¨ ¨§¬¥­¨âì § ¯à®á ¨ ¯®¢â®à¨âì ¯®¨áª.',0
db '‡ ªàëâì',0
db 0
msgbox_8:
db 3,0
db '‚­¨¬ ­¨¥',0 ;+2 = +MB_TEXT_OFFSET
db '„«ï ¢ë室  § ¢¥àè¨â¥ à ¡®âã á ä ©«®¬.',13,\
'®¯à®¡ã©â¥ á®åà ­¨âì ¨§¬¥­¥­¨ï ¢ ä ©«¥',13,\
'¨«¨ ­ ç âì ­®¢ë© ¯ãá⮩.',0
db 'Žâ¬¥­ ',0
db 0
 
txtFindCapt db '®¨áª',0
txtFindNext db ' ©â¨ ¤ «¥¥',0
txtFormatCapt db '”®à¬ â',0
txtFormatApply db 'à¨¬¥­¨âì',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
 
/programs/other/t_edit/t_draw.inc
0,0 → 1,1291
mouse_wnd_main:
push eax ebx ecx
mcall 37,2 ;get mouse buttons
 
cmp al,1
jne @f
mcall 37,1 ;get mouse coords
mov ebx,[wndMain.top]
add ebx,[recMain.top]
cmp ax,bx
jl @f ;y_mouse<y_wnd
 
sub ebx,[recMain.top]
add ebx,[wndMain.height]
cmp bx,ax
jl @f ;y_mouse>y_wnd
 
mov ebx,[wndMain.left]
add ebx,[recMain.left]
mov ecx,eax
shr ecx,16
cmp cx,bx
jl @f ;x_mouse<x_wnd
 
sub ebx,[recMain.left]
add ebx,[wndMain.width]
cmp bx,cx
jl @f ;x_mouse>x_wnd
 
call draw_cursor_sumb
call wnd_main_click
;call draw_main_cursor ;???
jmp .no_in_wnd
@@:
call wnd_main_mouse_scroll
cmp [dragm],0
je .no_in_wnd
mov [dragm],0
call draw_but_toolbar
call draw_main_win
.no_in_wnd:
pop ecx ebx eax
ret
 
; input:
; eax->(x,y)
wnd_main_click:
push ecx edx
 
push eax
shr eax,16
and eax,0xffff
sub eax,[wndMain.left]
sub eax,[recMain.left]
 
xor edx,edx
mov ecx,[recMain.width]
div cx
;inc eax
cmp eax,[hScr.cur_area]
jle @f
mov eax,[hScr.cur_area]
@@:
;dec eax
mov [cur_x],eax
pop eax
 
push eax
and eax,0xffff
sub eax,[wndMain.top]
sub eax,[recMain.top]
 
xor edx,edx
mov ecx,[recMain.height]
div cx
inc eax
cmp eax,[wScr.cur_area]
jle @f
mov eax,[wScr.cur_area]
@@:
dec eax
mov [cur_y],eax
pop eax
 
cmp [dragm],0
je @f
call SelMove
jmp .sel_move
@@:
mov [dragm],1
call SelStart
.sel_move:
pop edx ecx
ret
 
wnd_main_mouse_scroll:
push eax ebx
mcall 37,7
cmp ax,0
je .no_scroll
mov ebx,dword[wScr.position] ;copy old scroll position
and eax,0xffff
btr ax,15
jae @f
or eax,0xffff8000
@@:
add dword[wScr.position],eax
 
mov eax,[wScr.position]
cmp eax,[wScr.max_area]
jb @f
mov dword[wScr.position],ebx ;if scroll position out of range
jmp .no_scroll
@@:
call draw_main_win
.no_scroll:
pop ebx eax
ret
 
draw_but_toolbar:
 
push ebx ecx edx
mov ecx,0x40000000
; mov edx,5*65536+25
mov edx,85*65536+2
call draw_but_icon
 
inc cx
; mov edx,30*65536+25
mov edx,110*65536+2
call draw_but_icon
 
call CanSave
cmp al,1
je @f
and ecx,0xffff
@@:
inc cx
; mov edx,55*65536+25
mov edx,135*65536+2
call draw_but_icon
or ecx,0x40000000
 
inc cx
mov edx,85*65536+25
call draw_but_icon
 
call IsSel
cmp al,0
jne @f
and ecx,0xffff
@@:
inc cx ; Cut
mov edx,110*65536+25
call draw_but_icon
 
inc cx ; Copy
mov edx,135*65536+25
call draw_but_icon
 
mov cx,10 ; Upper
mov edx,265*65536+25
call draw_but_icon
 
inc cx ; Lower
mov edx,290*65536+25
call draw_but_icon
 
inc cx ; Reverse
mov edx,315*65536+25
call draw_but_icon
or ecx,0x40000000
 
cmp byte[buf],0
jne @f
and ecx,0xffff
@@:
mov cx,6 ; Paste
mov edx,160*65536+25
call draw_but_icon
or ecx,0x40000000
 
inc cx
mov edx,185*65536+25
call draw_but_icon
 
inc cx
mov edx,210*65536+25
call draw_but_icon
 
inc cx
mov edx,235*65536+25
call draw_but_icon
 
mov ebx,[tim_Undo]
cmp [ch_tim],ebx
jg @f
and ecx,0xffff
@@:
mov cx,13
mov edx,345*65536+25
call draw_but_icon
or ecx,0x40000000
 
cmp [tim_Undo],1
jge @f
and ecx,0xffff
@@:
inc cx
mov edx,370*65536+25
call draw_but_icon
or ecx,0x40000000
 
inc cx
mov edx,400*65536+25
call draw_but_icon
 
inc cx
mov edx,425*65536+25
call draw_but_icon
 
mov cx,17
mov edx,450*65536+25
call draw_but_icon
 
pop edx ecx ebx
ret
 
 
;input:
; ebx = x*2^16+y coords to left up point clear line
; esi = 0 clear all rows
; edi - number text line
clear_line_before_draw:
push eax ebx ecx edx
sub ebx,0x10001 ;îòíèìàåì îòñòóïû äëÿ âûðàâíèâàíèÿ áóêâû ïî öåíòðó
cmp esi,0
jne @f
add bx,word[recMain.height]
inc edi ; ???
ror ebx,16
mov bx,word[wndMain.left]
add bx,word[recMain.left]
ror ebx,16
@@:
 
mov ax,word[wndMain.height]
add ax,word[wndMain.top]
cmp ax,bx
jl .no_clear
sub ax,bx
 
mov cx,bx
shl ecx,16
 
mov bx,word[wndMain.width]
sub bx,word[recMain.left]
mov cx,word[recMain.height]
mov edx,[WND_WORK_COLOR]
 
cmp esi,0
je .pusto
cmp ax,cx
jge @f
.pusto:
mov cx,ax
@@:
 
call IsSel
cmp al,0
je @f
cmp [seln.y0],edi
jg @f
cmp [seln.y1],edi
jl @f
mov edx,[SELECT_COLOR] ;draw selected line
@@:
 
mov eax,13 ;rect
int 0x40
 
call IsSel
cmp al,0
je .no_clear
 
mov al,13 ;rect
mov cx,word[recMain.height]
cmp [seln.y0],edi
jne @f
push bx
mov edx,[seln.x0] ; âåðõíÿÿ ïîëîñà (çàòèðàåò ñëåâà)
cmp edx,[hScr.position]
jle .in_wnd
sub edx,[hScr.position]
imul edx,[recMain.width]
mov bx,dx
jmp .no_wnd
.in_wnd:
mov bx,0
.no_wnd:
mov edx,[WND_WORK_COLOR]
int 0x40
pop bx
@@:
cmp [seln.y1],edi
jne @f
mov edx,[seln.x1] ; íèæíÿÿ ïîëîñà (çàòèðàåò ñïðàâà)
cmp edx,[hScr.position]
jle .in_wnd2
sub edx,[hScr.position]
imul edx,[recMain.width]
sub bx,dx
shl edx,16
add ebx,edx
.in_wnd2:
 
mov edx,[WND_WORK_COLOR]
int 0x40
@@:
 
.no_clear:
pop edx ecx ebx eax
ret
 
;include 't_debug.inc'
draw_main_win:
push eax ebx ecx edx edi esi
;---debug---
;mov ecx,0
;@@:
;call DebugSymb
;inc ecx
;cmp ecx,10
;jge @f
;jmp @b
;@@:
;ret
;---debug---
 
mov eax,4 ;draw text
mov esi,1
mov ecx,[tex_colors]
push dword[ecx]
pop ecx
 
mov ebx,[wndMain.left]
add ebx,[recMain.left]
inc ebx
shl ebx,16
add ebx,[wndMain.top]
add ebx,[recMain.top]
inc ebx
 
call SelNormalize ;need before draw select
mov edi,[wScr.position]
 
call clear_line_before_draw
call GetFirstVisiblePos
cmp edx,0
je .no_draw_text
@@:
call IteratNext
cmp edx,[tex_1]
jle .no_draw_text
 
;--- debug
;cmp dword[edx+6],maxChars
;jge .no_draw_text
;--- debug
 
; *** öâåòîâàÿ ðàçìåòêà
cmp byte[mode_colored],0
je .no_col_change
cmp byte[edx+1],0
je .no_col_change
call GetSymbColor
.no_col_change:
 
cmp byte [edx],13
jne .no_13
cmp [invis],1
jne .no_invis
push edx
mov edx,symbol_new_line
int 0x40
pop edx
.no_invis:
add bx,word [recMain.height]
;optimized output \/
mov ax,word [wndMain.height]
add ax,word [wndMain.top]
cmp bx,ax
jg .no_draw_text
mov ax,4
;optimized output /\
ror ebx,16
mov bx,word [wndMain.left]
add bx,word [recMain.left]
inc ebx
ror ebx,16
inc edi ;increment line number
call clear_line_before_draw
call OptDrawLineLeft
jmp @b
.no_13:
 
int 0x40
ror ebx,16
add bx,word [recMain.width]
mov si,word [wndMain.left]
add si,word [wndMain.width]
cmp bx,si
jl .no_opt
call OptDrawLineRight
.no_opt:
mov si,1
ror ebx,16
jmp @b
.no_draw_text:
xor esi,esi
call clear_line_before_draw
 
 
mov eax,13
;top panel with caption
mov ebx,[wndMain.left]
; add ebx,[recMain.left]
shl ebx,16
add ebx,[wndMain.width]
; sub ebx,[recMain.left]
mov edx,[WND_WORK_COLOR]
mov ecx,[wndMain.top] ;draw caption
shl ecx,16
add ecx,[recMain.top]
mov edx,[WND_CAPT_COLOR]
int 0x40
;left panel with numbers
; mov ebx,[wndMain.left]
; shl ebx,16
; add ebx,[recMain.left]
;mov cx,word[wndMain.height]
; mov cx,word[recMain.top]
; int 0x40
 
call draw_line_numbers
call draw_main_cursor
 
;---------------------------------------------
; set all_redraw flag for draw all ScrollBar
; In some cases it is necessity to draw only the area
; of moving of a "runner", for acceleration of output -
; in this case the flag needs to be reset to 0 (zero).
xor eax,eax
inc eax
mov [wScr.all_redraw],eax
mov [hScr.all_redraw],eax
 
; draw for Vertical ScrollBar
push dword wScr
call [scrollbar_ver_draw]
push dword hScr
call [scrollbar_hor_draw]
; reset all_redraw flag
xor eax,eax
mov [wScr.all_redraw],eax
mov [hScr.all_redraw],eax
;---------------------------------------------
 
mov eax,13
;left-bottom square
mov bx,word[wndMain.left]
shl ebx,16
mov bx,word[recMain.left]
mov ecx,[wndMain.top]
add ecx,[wndMain.height]
shl ecx,16
mov cx,word[hScr.size_y]
inc cx
mov edx,[sc.work]
int 0x40
 
;right-bottom square
mov ebx,[wndMain.left]
add ebx,[wndMain.width]
shl ebx,16
mov bx,word[wScr.size_x]
inc bx
int 0x40
 
pop esi edi edx ecx ebx eax
call draw_panel_find
call draw_panel_syntax
ret
 
;txtBUp db 24
;txtBDn db 25
;txtBRi db 26
;txtBLe db 27
draw_panel_find:
cmp byte[panel_id],TE_PANEL_FIND ;if not panel
jne @f
push eax ebx ecx edx
 
mov eax,13 ;ðèñîâàíèå ïðÿìîóãîëüíèêà
mov ebx,TE_PANEL_WIDTH
mov cx,word[wndMain.top]
shl ecx,16
mov cx,20
mov edx,[sc.work]
int 0x40
 
mov eax,4 ;ðèñîâàíèå òåêñòà
mov ebx,30*65536+5
add bx,word[wndMain.top]
mov ecx,[sc.work_text]
or ecx,0x80000000
mov edx,txtFindCapt
int 0x40
 
push dword edit2
call [edit_box_draw]
 
mov eax,13 ;ðèñîâàíèå ïðÿìîóãîëüíèêà
mov ebx,TE_PANEL_WIDTH
mov cx,word[wndMain.top]
add cx,20+15 ; 15 - height text box
shl ecx,16
mov cx,word[wndMain.height]
add cx,word[hScr.size_y]
sub cx,20+15-1 ; 15 - height text box
mov edx,[sc.work]
int 0x40
 
mov eax,8 ;êíîïêà
mov ebx,5*65536+85
mov cx,word[wndMain.top]
add cx,20+15+5
shl ecx,16
mov cx,20
mov edx,201 ;button id
mov esi,[sc.work_button]
int 0x40
 
mov eax,4 ;ðèñîâàíèå òåêñòà
mov ebx,15*65536+(20+15+10)
add bx,word[wndMain.top]
mov ecx,[sc.work_text]
or ecx,0x80000000
mov edx,txtFindNext
int 0x40
 
pop edx ecx ebx eax
ret
@@:
push eax edx
mov eax,8
mov edx,201
or edx,0x80000000
int 0x40
pop edx eax
ret
 
draw_panel_syntax:
cmp byte[panel_id],TE_PANEL_SYNTAX ;if not panel
jne @f
push eax ebx ecx edx
 
mov eax,13 ;ðèñîâàíèå ïðÿìîóãîëüíèêà
mov ebx,TE_PANEL_WIDTH
mov cx,word[wndMain.top]
shl ecx,16
mov cx,20
mov edx,[sc.work]
int 0x40
 
push dword tree1
call dword[tl_draw]
 
mov [ws_dir_lbox.all_redraw],1
push dword ws_dir_lbox
call dword[scrollbar_ver_draw]
 
ror ecx,16
add ecx,dword[tree1.box_height]
add ecx,20
ror ecx,16
mov cx,word[wndMain.height]
add cx,word[hScr.size_y]
sub cx,20
sub ecx,dword[tree1.box_height]
inc cx
int 0x40
 
mov eax,8 ;êíîïêà
mov ebx,5*65536+65
mov cx,word[wndMain.top]
add cx,25
add ecx,dword[tree1.box_height]
shl ecx,16
mov cx,20
mov edx,200 ;button id
mov esi,[sc.work_button]
int 0x40
 
mov eax,4 ;ðèñîâàíèå òåêñòà
mov ebx,30*65536+5
add bx,word[wndMain.top]
mov ecx,[sc.work_text]
or ecx,0x80000000
mov edx,txtFormatCapt
int 0x40
 
mov ebx,10*65536+30
add ebx,dword[tree1.box_height]
add bx,word[wndMain.top]
mov edx,txtFormatApply
int 0x40
 
pop edx ecx ebx eax
ret
@@:
push eax edx
mov eax,8
mov edx,200
or edx,0x80000000
int 0x40
pop edx eax
ret
 
draw_cur_line:
push eax ebx ecx edx esi edi
 
mov edi,[cur_y]
 
mov ebx,[wndMain.left]
add ebx,[recMain.left]
inc ebx
shl ebx,16
add ebx,edi
imul bx,word[recMain.height]
add ebx,[wndMain.top]
add ebx,[recMain.top]
inc ebx
 
add edi,[wScr.position]
mov esi,1
call SelNormalize ;need before draw select
call clear_line_before_draw
 
mov esi,[hScr.position]
mov ecx,edi
call GetPosByParam
 
cmp [gpOpt],2
jne .no_draw_text
; mov eax,4 ;draw text
call GetSymbColor
mov esi,1 ;draw 1 symbol
@@:
;call IteratNext
cmp edx,[tex_1]
jle .no_draw_text
 
; *** öâåòîâàÿ ðàçìåòêà
cmp byte[mode_colored],0
je .no_col_change
cmp byte[edx+1],0
je .no_col_change
call GetSymbColor
.no_col_change:
 
mov eax,4 ;draw text
cmp byte [edx],13
jne .no_13
cmp [invis],1
jne .no_draw_text
push edx
mov edx,symbol_new_line
int 0x40
pop edx
jmp .no_draw_text
.no_13:
 
int 0x40
ror ebx,16
add bx,word[recMain.width]
; cmp bx,word[wndMain.width]
mov ax,word[wndMain.width]
add ax,word[wndMain.left] ;ax = îòñòóï ïî îñè x
cmp bx,ax
jge .no_draw_text ;Opt
ror ebx,16
call IteratNext
jmp @b
.no_draw_text:
 
pop edi esi edx ecx ebx eax
call draw_main_cursor
ret
 
MIN_M_WND_H equ 100
MIN_W_SCRL_ARE equ 3
MIN_H_SCRL_ARE equ 3
EvSize:
push eax ecx edx edi
m2m [wndMain.width],[procinfo.client_box.width]
mov ax,word[wndMain.left]
sub word[wndMain.width],ax
mov eax,[wScr] ;+0 size_x
sub word[wndMain.width],ax
 
m2m [wndMain.height],[procinfo.client_box.height]
cmp [wndMain.height],MIN_M_WND_H
jg @f
mov [wndMain.height],MIN_M_WND_H
@@:
 
mov ax,word[hScr.size_y]
sub word[wndMain.height],ax
mov eax,[wndMain.height] ;.height = .top+.height
mov word[hScr.start_y],ax
mov eax,[wndMain.top]
sub word[wndMain.height],ax
 
m2m word[wScr.start_x],word[wndMain.width]
mov ax,word[wndMain.left]
add [wScr.start_x],ax
m2m word[wScr.size_y],word[wndMain.height]
 
m2m word[hScr.start_x],word[recMain.left]
add [hScr.start_x],ax ;ax=[wndMain.left]
mov eax,[wndMain.width]
sub ax,word[recMain.left]
mov word[hScr.size_x],ax
 
mov eax,[wndMain.height] ;calculate lines in page
sub eax,[recMain.top]
xor edx,edx
mov ecx,[recMain.height]
div ecx
cmp eax,MIN_W_SCRL_ARE
jg @f
mov eax,MIN_W_SCRL_ARE
@@:
mov [wScr.cur_area],eax
 
mov eax,[wndMain.width] ;calculate cols in page
sub eax,[recMain.left]
xor edx,edx
mov ecx,[recMain.width]
div ecx
cmp eax,MIN_H_SCRL_ARE
jg @f
mov eax,MIN_H_SCRL_ARE
@@:
dec eax ; ???
mov [hScr.cur_area],eax
 
mov edi,dword tree1
m2m tl_box_top,dword[wndMain.top]
add tl_box_top,20
 
m2m dword[edit2.top],dword[wndMain.top]
add dword[edit2.top],20
 
pop edi edx ecx eax
call OnInitialUpdate
ret
 
OnInitialUpdate:
mov [wScr.redraw],1
mov [hScr.redraw],1
ret
 
;output:
; edx = pointer to symbol
; edx = 0 if text not in screen
GetFirstVisiblePos:
push ecx
mov edx,[tex]
xor ecx,ecx
@@:
cmp ecx,[wScr.position]
je @f
call IteratNext
cmp edx,[tex_1]
jle @f
cmp byte [edx],13
jne @b
inc ecx
jmp @b
@@:
 
cmp ecx,[wScr.position]
je @f
xor edx,edx
@@:
cmp ecx,[wScr.max_area]
jle @f
mov [wScr.max_area],ecx
@@:
pop ecx
call OptDrawLineLeft
ret
 
 
 
;input:
; edx = pointer to symbol
;output:
; edx = pointer to first left symbol
OptDrawLineLeft:
push ecx
mov ecx,[hScr.position]
cmp ecx,0
je .ret_f
push eax
mov eax,edx
 
cmp edx,[tex]
jne @f
call IteratNext
jmp .beg_cycle
@@:
 
cmp ecx,0
je @f
 
cmp byte[edx],13
jne @f
call IteratNext
.beg_cycle:
@@:
cmp edx,[tex_1]
jle @f
cmp byte[edx],13
je @f
cmp ecx,0
je @f
mov eax,edx
call IteratNext
dec ecx
jmp @b
@@:
mov edx,eax
pop eax
.ret_f:
pop ecx
call GetSymbColor
ret
 
;input:
; edx = pointer to symbol
;output:
; edx = pointer to 13 symbol
OptDrawLineRight:
push eax
mov eax,edx
@@:
cmp edx,[tex_1]
jle @f
cmp byte[edx],13
je @f
mov eax,edx
call IteratNext
jmp @b
@@:
mov edx,eax ;perv sumbol
pop eax
call GetSymbColor
ret
 
txtRow db '‘âப ',0
txtCol db '‡­ ª',0
txtOtm db 'Žâ¬¥­ë',0
 
draw_main_cursor:
push eax ebx ecx edx edi esi
 
mov eax,13 ;draw cursor
mov ecx,[wndMain.top] ;calc rect -> y0,y1
add ecx,[recMain.top]
mov edx,[cur_y]
imul edx,[recMain.height]
add ecx,edx
 
cmp [curMod],1
jne @f
mov edx,[recMain.height]
inc edx ; 1->1, 3->2, 5->3, ...
shr edx,1
add ecx,edx
@@:
shl ecx,16
add ecx,[recMain.height]
cmp [curMod],1
jne @f
shr cx,1
@@:
 
mov ebx,[wndMain.left] ;calc rect -> x0,x1
add ebx,[recMain.left]
mov edx,[cur_x]
imul edx,[recMain.width]
add ebx,edx
shl ebx,16
add ebx,[recMain.width]
 
mov edx,[CURSOR_COLOR]
int 0x40
 
call GetPos
cmp [gpOpt],2
jne @f
mov eax,4 ;draw text
mov esi,1
ror ecx,16
mov bx,cx
add ebx,0x10001
cmp [curMod],1
jne .no_up_tetx
mov cx,word[recMain.height]
inc cx ; 1->1, 3->2, 5->3, ...
shr cx,1
sub bx,cx
.no_up_tetx:
mov ecx,[CUR_TEXT_COLOR]
call ConvertInvisSymb
int 0x40
@@:
 
 
 
mov eax,4
mov ebx,[wndMain.left]
add ebx,[recMain.left]
shl ebx,16
add ebx,[wndMain.top]
add ebx,3
mov ecx,[WND_BORD_COLOR]
or ecx,0x80000000
mov edx,txtRow
int 0x40
 
add ebx,0x500000
mov edx,txtCol
int 0x40
 
cmp [tim_Undo],0
je @f
add ebx,0x500000
mov edx,txtOtm
int 0x40
sub ebx,0x500000
@@:
 
call draw_bufer
call draw_help_f1
 
mov eax,47 ;draw cursor coords
mov esi,[WND_BORD_COLOR]
or esi,0x40000000
mov edi,[WND_WORK_COLOR]
 
mov edx,ebx
ror edx,16
sub edx,35
ror edx,16
;add edx,3
mov ebx,0x40000 ;Row=...
mov ecx,[cur_y]
inc ecx
add ecx,[wScr.position]
int 0x40
 
;mov ebx,0x40000 ;Col=...
mov ecx,[cur_x]
inc ecx
add ecx,[hScr.position]
add edx,0x500000
int 0x40
 
cmp [tim_Undo],0
je @f
mov ecx,[tim_Undo]
add edx,0x500000
int 0x40
@@:
 
pop esi edi edx ecx ebx eax
ret
 
 
draw_bufer:
push eax ebx ecx edx esi edi
cmp byte[buf],0
je @f
mov ebx,[wndMain.left]
add ebx,[recMain.left]
add bx,250
shl ebx,16
add ebx,[wndMain.top]
add ebx,3
mov ecx,[WND_BORD_COLOR]
or ecx,0x40000000
mov edi,[WND_WORK_COLOR]
mov edx,txtBuf
mov esi,buf
call strlen
cmp eax,15
jle .crop_buf
mov eax,15
.crop_buf:
mov esi,7
add esi,eax
 
mov eax,4
int 0x40
@@:
pop edi esi edx ecx ebx eax
ret
 
draw_help_f1:
push eax ebx ecx edx edi
mov eax,13 ;clear place before draw help
mov ebx,[wndMain.left]
add ebx,[recMain.left]
shl ebx,16
add ebx,[wndMain.width]
sub ebx,[recMain.left]
mov ecx,[wndMain.top]
add ecx,13
shl ecx,16
add ecx,[recMain.height]
mov edx,[WND_CAPT_COLOR]
int 0x40
 
cmp [help_id],-1
je @f;.no_help
mov eax,[help_id]
ColToIndexOffset eax,edx
 
;SetCoordinates
mov ebx,[wndMain.left]
add ebx,[recMain.left]
shl ebx,16
add ebx,[wndMain.top]
add ebx,13 ;=3+10
 
;SetTextColor
xor eax,eax
mov al,byte[edx+MAX_COLOR_WORD_LEN+6]
shl ax,2
mov ecx,[tex_colors]
add ecx,eax
push dword[ecx]
pop ecx
or ecx,0xc0000000 ;SetTextStyles
mov edi,[WND_WORK_COLOR]
 
mov eax,4
int 0x40
 
;*** draw help string ***
mov ecx,[WND_BORD_COLOR]
or ecx,0x80000000
mov edi,dword[edx+MAX_COLOR_WORD_LEN]
cmp edi,0
je @f
add edi,dword[tex_help_f1]
mov edx,edi
add ebx,0x500000
int 0x40
@@:
;.no_help:
pop edi edx ecx ebx eax
ret
 
draw_line_numbers:
push eax ebx ecx edx esi ;edi
;line numbers
mov eax,47
mov esi,[WND_BORD_COLOR]
;or esi,0x40000000
;mov edi,[WND_WORK_COLOR]
mov ebx,0x40000 ;format
 
mov ecx,[wScr.position]
inc ecx
mov dx,3
add dx,word[wndMain.left]
shl edx,16
mov dx,word[wndMain.top]
add dx,word[recMain.top]
@@:
 
push eax ebx ecx edx
mov eax,13
;left panel with numbers
mov ebx,[wndMain.left]
shl ebx,16
add ebx,[recMain.left]
mov cx,dx
; mov ecx,[wndMain.top] ;draw caption
; add ecx,[recMain.top]
shl ecx,16
mov cx,word [recMain.height]
mov edx,[WND_CAPT_COLOR]
int 0x40
pop edx ecx ebx eax
 
int 0x40
inc ecx
add dx,word[recMain.height]
sub dx,word[wndMain.top]
cmp dx,word[wndMain.height]
jge @f
add dx,word[wndMain.top]
jmp @b
@@:
 
pop esi edx ecx ebx eax
ret
 
 
draw_cursor_sumb: ;this function need to optimize output
push eax ecx edx
mov eax,13 ;rect
mov ebx,[wndMain.left]
add ebx,[recMain.left]
mov edx,[cur_x]
imul edx,[recMain.width]
add ebx,edx
shl ebx,16
add ebx,[recMain.width]
 
mov ecx,[wndMain.top] ;calc rect -> y0,y1
add ecx,[recMain.top]
mov edx,[cur_y]
imul edx,[recMain.height]
add ecx,edx
shl ecx,16
add ecx,[recMain.height]
 
mov edx,[WND_WORK_COLOR]
push ecx
call SelNormalize
 
mov ecx,[wScr.position]
sub [seln.y0],ecx
sub [seln.y1],ecx
 
mov ecx,[cur_y]
cmp ecx,[seln.y0]
jl .no_cur_sel
cmp ecx,[seln.y1]
jg .no_cur_sel
mov edx,[SELECT_COLOR]
cmp ecx,[seln.y0]
jne @f
mov ecx,[cur_x]
add ecx,[hScr.position]
cmp ecx,[seln.x0]
jge @f
mov edx,[WND_WORK_COLOR]
@@:
 
mov ecx,[cur_y]
cmp ecx,[seln.y1]
jne .no_cur_sel
mov ecx,[cur_x]
add ecx,[hScr.position]
cmp ecx,[seln.x1]
jl .no_cur_sel
mov edx,[WND_WORK_COLOR]
 
.no_cur_sel:
pop ecx
int 0x40
 
call GetPos
cmp [gpOpt],2
jne @f
push esi
mov eax,4 ;draw text
mov esi,1
ror ecx,16
mov bx,cx
add ebx,0x10001
;mov ecx,[WND_TEXT_COLOR]
call GetSymbColor
call ConvertInvisSymb
int 0x40
pop esi
@@:
 
pop edx ecx eax
ret
 
 
 
;input:
; edx = pointer to text
;output:
; ecx = color
; if mode_colored=0 then ecx=WND_TEXT_COLOR
GetSymbColor:
mov ecx,[WND_TEXT_COLOR]
 
push eax edx
cmp byte[mode_colored],0
je .exit
jmp .on_first
@@:
call IteratPerv
cmp edx,[tex_1]
jle .exit
.on_first:
xor eax,eax
mov al,byte[edx+1]
cmp al,0
je @b
 
;cmp al,0xff
;je .exit
cmp eax,[ColColor]
jge .exit
 
shl ax,2 ;*4
mov ecx,[tex_colors]
add ecx,eax
push dword[ecx]
pop ecx
.exit:
pop edx eax
ret
 
;input:
; edx = pointer to text
ConvertInvisSymb:
cmp [invis],1
jne @f
cmp byte [edx],13
jne @f
mov edx,symbol_new_line
@@:
ret
 
;input:
; ecx = 0x4000____
; cx = icon index
; edx = x*2^16+y
draw_but_icon:
push eax ebx
 
mov eax,8 ;êíîïêà
push ecx edx esi
mov ebx,edx
mov edx,ecx
add edx,3
mov cx,bx
shl ecx,16
mov cx,19 ;=20-1
mov bx,19 ;=20-1
mov esi,[sc.work_button]
int 0x40
pop esi edx ecx
 
mov ebx,ecx
ror ebx,16
cmp bx,0x4000
jne @f
 
mov eax,7 ;bmp
mov ebx,[bmp_icon]
push ecx
and ecx,0xffff
imul ecx,1200
add ebx,ecx
mov ecx,20
shl ecx,16
add ecx,20
int 0x40
pop ecx
 
@@:
pop ebx eax
ret
 
/programs/other/t_edit/t_edit.asm
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 '¥ ­ ©¤¥­ ä ©«, ¯à®¢¥àì⥠¯à ¢¨«ì­®áâì ¨¬¥­¨',0
txtErrIni0 db '¥ ®âªàë«áï ä ©« á ¨ª®­ª ¬¨',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:
/programs/other/t_edit/t_edit.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/other/t_edit/t_work.inc
0,0 → 1,1759
struct f70
func_n dd ?
param1 dd ?
param2 dd ?
param3 dd ?
param4 dd ?
rezerv db ?
name dd ?
ends
 
struct TexSelect
x0 dd ?
y0 dd ?
x1 dd ?
y1 dd ?
ends
 
struct TexColViv
Text rb MAX_COLOR_WORD_LEN; // ñëîâî
f1 dd 0
wwo db ? ; whole words only
endc db ? ; ñèìâîë êîíöà âûäåëåíèÿ (wwo&4)
color db ? ; íîìåð öâåòà
ends
 
struct symbol
c db ? ; +0 ñèìâîë
col db ? ; +1 öâåò
perv dd ? ; +2
next dd ? ; +6 óêàçàòåëè
tc dd ? ; +10 âðåì. ñîçäàíèÿ
td dd ? ; +14 âðåì. óäàëåíèÿ
ends
 
ColColor dd 1
ColWords dd 0
CURSOR_COLOR dd 0x808080
WND_CAPT_COLOR dd 0x80
WND_WORK_COLOR dd 0x0
WND_BORD_COLOR dd 0xd0d0d0
SELECT_COLOR dd 0x208080
CUR_TEXT_COLOR dd 0xff0000
WND_TEXT_COLOR dd 0xffff00
 
options_file dd 0
options_file_end dd 0
tex_colors dd 0
tex_help_f1 dd 0
 
FkPos: rd 256
Col dd 0 ;óêàçàòåëü íà ñòðóêòóðû êëþ÷åâûõ ñëîâ TexColViv
 
conv_tabl rb 128 ; òàáëèöà äëÿ êîíâåðòèðîâàíèÿ scan-êîäà â ascii-êîä
keyUpr dd 0
err_opn db 0 ;îøèáêà îòêðûòèÿ ôàéëà
err_sav db 0 ;îøèáêà ñîõðàíåíèÿ ôàéëà
panel_id db 0 ;íîìåð îòêðûòîé ïàíåëè
 
ch_tim dd ? ; êîëè÷åñòâî èçìåíåíèé â ôàéëå
ls_tim dd ? ; âðåìÿ ïîñëåäíåãî ñîõðàíåíèÿ
co_tim dd ? ; âðåìÿ ïîñëåäíåé öâåòîâîé ðàçìåòêè
tim_Undo dd ? ; êîëè÷åñòâî îòìåíåííûõ äåéñòâèé
gpOpt db 0
mode_colored db 1 ; ðåæèì âûäåëåíèÿ ñëîâ öâåòîì (0-âûêë. 1-âêë.)
 
txtBuf db 'ãä¥à: '
buf db BUF_SIZE dup(0)
key_new db 0 ; ñèìâîë, êîòîðûé áóäåò äîáàâëÿòñÿ ñ êëàâèàòóðû
tex dd 0
tex_1 dd 0
tex_end dd 0
 
hed db 'TextEditor 29.12.09',0 ;ïîäïèñü îêíà
sc system_colors
 
wndMain BOX 0,50,440,150
recMain BOX 30,23,7,10
 
curMod db 1
cur_x dd 0
cur_y dd 0
invis db 0 ;ðåæèì ïîêàçà íåïå÷àòàåìûõ ñèìâîëîâ
symbol_new_line db 20 ;ñèìâîë çàâåðøåíèÿ ñòðîêè
dragm db 0 ;âûäåëåíèå îò ìûøè
dragk db 0 ;âûäåëåíèå îò êëàâèàòóðû
sel TexSelect 0,0,0,0 ;ñòðóêòóðà âûäåëåíèÿ
seln TexSelect ;äîïîëíèòåëüíàÿ ñòðóêòóðà âûäåëåíèÿ
help_id dd -1 ;èäåíòèôèêàòîð äëÿ ñïðàâêè
 
fn_icon db 'te_icon.bmp',0
bmp_icon dd 0
run_file_70 f70
 
 
;input:
; reg = index
;output:
; reg = pointer to 'tex' struct
macro ConvertIndexToPointer reg {
imul reg,sizeof.symbol
add reg,[tex]
}
 
 
;output:
; al = 1 - can save
CanSave:
push ecx
mov ecx,[ch_tim]
sub ecx,[tim_Undo]
mov al,1
cmp [ls_tim],ecx
jne @f
dec al
@@:
pop ecx
ret
 
 
;output:
; al = 1 - selected
IsSel:
push ebx
xor al,al
cmp [dragm],1
je @f
mov al,1
mov ebx,[sel.x0]
cmp ebx,[sel.x1]
jne @f
mov ebx,[sel.y0]
cmp ebx,[sel.y1]
jne @f
xor al,al
@@:
pop ebx
ret
 
SelNormalize:
push ecx esi edi
mov esi,sel
mov edi,seln
mov ecx,sizeof.TexSelect
rep movsb
 
jmp @f
.swp_f:
mov ecx,[seln.x0]
m2m [seln.x0],[seln.x1]
mov [seln.x1],ecx
 
mov ecx,[seln.y0]
cmp ecx,[seln.y1] ;(sel.y0>sel.y1)
jle .end_f
m2m [seln.y0],[seln.y1]
mov [seln.y1],ecx
 
jmp .end_f
@@:
 
mov ecx,[seln.y0]
cmp ecx,[seln.y1] ;(sel.y0>sel.y1)
jg .swp_f
 
cmp ecx,[seln.y1] ;(sel.y0==sel.y1)
jne .end_f
mov ecx,[seln.x0]
cmp ecx,[seln.x1] ;(sel.x0>sel.x1)
jg .swp_f
 
.end_f:
pop edi esi ecx
ret
 
SelStart:
push ecx
mov ecx,[cur_x]
add ecx,[hScr.position]
mov [sel.x0],ecx
mov [sel.x1],ecx
 
mov ecx,[cur_y]
add ecx,[wScr.position]
mov [sel.y0],ecx
mov [sel.y1],ecx
pop ecx
ret
 
SelMove:
push ecx
mov ecx,[cur_x]
add ecx,[hScr.position]
mov [sel.x1],ecx
 
mov ecx,[cur_y]
add ecx,[wScr.position]
mov [sel.y1],ecx
pop ecx
ret
 
;input:
; al = 1 - clear all memory
Clear:
mov [cur_x],0
mov [cur_y],0
mov [ch_tim],0
mov [ls_tim],0
mov [co_tim],0
mov [tim_Undo],0
mov [help_id],-1
 
mov [wScr.position],0
mov [wScr.max_area],100
mov [wScr.redraw],1
mov [hScr.position],0
mov [hScr.max_area],100
 
mov [sel.x0],0
mov [sel.y0],0
mov [sel.x1],0
mov [sel.y1],0
 
cmp al,0
je .exit
 
push ecx edx
mov ecx,sizeof.symbol*maxChars
mov edx,[tex]
@@:
mov byte [edx],0
inc edx
loop @b
mov edx,[tex]
mov dword [edx+6],1
pop edx ecx
 
.exit:
ret
 
 
;--- out_reg = Col[keyw[ind_reg]].Text[0] ---
macro ColToIndexOffset ind_reg,out_reg {
mov out_reg,ind_reg
imul out_reg,sizeof.TexColViv
add out_reg,[Col]
}
 
 
 
InitColText:
push eax ebx ecx esi edi
 
; mov ebx,fn_col_option
; mov esi,sys_path
; mov edi,file_name
mov ebx,dword[fn_col_option]
copy_path ebx,fn_syntax_dir,file_name_rez
copy_path file_name_rez,sys_path,file_name
 
mov eax,70
mov [run_file_70.func_n], 0
mov [run_file_70.param1], 0
mov [run_file_70.param2], 0
mov ebx,[options_file_end]
sub ebx,[options_file]
mov [run_file_70.param3], ebx
m2m [run_file_70.param4], [options_file]
mov [run_file_70.rezerv], 0
mov [run_file_70.name], file_name
mov ebx,run_file_70
int 0x40
 
mov ecx,0x100
mov edi,FkPos
@@:
mov dword[edi],-1
add edi,4
loop @b
 
 
;init: ColColor, ColWords, ...
mov dword[ColColor],1
mov dword[ColWords],0
mov dword[tex_help_f1],0
mov [help_id],-1 ;èäåíòèôèêàòîð ñëîâà äëÿ ñïðàâêè
 
cmp eax,6
je @f
cmp eax,0
je @f
cmp ax,10
jl .zifra_0_9
mov al,'?'
sub ax,48
.zifra_0_9:
add ax,48
 
mov byte[msgbox_3.err],al
push thread
push msgbox_3
call [mb_create] ;message: Can-t open color options file!
jmp .no_colors
@@:
 
mov esi,[options_file]
mov edi,ColColor
mov ecx,9*4
rep movsb
 
mov eax,[options_file]
add eax,32
mov dword[tex_colors],eax
 
mov eax,dword[ColColor] ;init: Col (offset to key words)
add eax,8
shl eax,2
add eax,[options_file]
mov dword[Col],eax
 
mov ecx,dword[ColWords] ;init: FkPos (first key positions)
xor eax,eax
@@:
ColToIndexOffset eax,edi
xor ebx,ebx
mov bl,byte[edi]
shl bx,2
mov esi,FkPos
add esi,ebx
cmp dword[esi],-1
jne .no_ch_key
mov dword[esi],eax
.no_ch_key:
inc eax
loop @b
 
;init: tex_help_f1
mov ecx,dword[ColWords]
imul ecx,sizeof.TexColViv
add ecx,dword[Col]
mov dword[tex_help_f1],ecx
 
;copy new colors in dir_list
; m2m dword[eax+28],dword[WND_WORK_COLOR]
; m2m dword[eax+32],dword[SELECT_COLOR]
; m2m dword[eax+36],dword[WND_CAPT_COLOR]
; m2m dword[eax+40],dword[WND_TEXT_COLOR]
; m2m dword[eax+44],dword[CUR_TEXT_COLOR]
.no_colors:
pop edi esi ecx ebx eax
ret
 
 
;input:
; ebx = file size
OpenFile:
mov [err_opn],0
push eax ;destination
push ecx ;for cycle
push edx ;source
 
xor al,al
call Clear
mov eax,ebx
mov ecx,ebx
add eax,2
ConvertIndexToPointer eax
mov edx,[tex]
add edx,ebx
push ebx
@@:
mov ebx,[edx]
mov byte [eax],bl
mov dword [eax+2],ecx
inc dword [eax+2]
mov dword [eax+6],ecx
add dword [eax+6],3
;mov byte[eax+1],0 ;col=0
mov dword [eax+10],-1 ;tc=-1
mov dword [eax+14],0 ;td=0
 
cmp ecx,0
je @f
dec ecx
dec edx
sub eax,sizeof.symbol
jmp @b
@@:
pop ebx
add eax,2
mov dword [eax],0 ; first sumbol 'perv=0'
 
mov edx,[tex]
; begining sumbol 'perv=0' 'next=2'
mov dword [edx+2],0
mov dword [edx+6],2
 
add edx,sizeof.symbol
mov dword [edx+6],0 ; last sumbol 'next=0'
mov dword [edx+2],ebx ; last sumbol 'perv=last'
inc dword [edx+2]
 
mov edx,ebx
inc edx ;2 = rezerv sumbols
imul edx,sizeof.symbol
add edx,[tex]
mov dword [edx+6],1 ; last sumbol 'next=1'
 
@@: ;clear memory, need if before was open big file
add edx,sizeof.symbol
cmp edx,[tex_end]
jge @f
mov dword[edx+10],0
mov dword[edx+14],0
jmp @b
@@:
 
call GetNumLines
cmp eax,100
jge @f
mov eax,100
@@:
mov [wScr.max_area],eax
; mov [wScr.redraw],1
pop edx ecx eax
call CmColored
ret
 
;input:
; edx = pointer to symbol struct
;output:
; edx = pointer to 'perv' visible symbol struct
IteratPerv:
cmp [tim_Undo],0
je .else
push ebx
@@:
call GetTexPervPos
cmp edx,[tex]
je @f
call SymbNotVis
cmp bl,1
je @b
cmp byte[edx],10 ;ïðîïóñê ñèìâîëà ñ êîäîì 10
je @b
@@:
pop ebx
ret
.else:
call GetTexPervPos
cmp edx,[tex]
je .endif
cmp dword [edx+14],0
jne .else
cmp byte[edx],10 ;ïðîïóñê ñèìâîëà ñ êîäîì 10
je .else
.endif:
ret
 
 
;input:
; edx = pointer to symbol struct
;output:
; edx = pointer to 'next' visible symbol struct
IteratNext:
cmp [tim_Undo],0
je .else
push ebx
@@:
call GetTexNextPos
cmp edx,[tex_1]
jle @f
call SymbNotVis
cmp bl,1
je @b
cmp byte[edx],10 ;ïðîïóñê ñèìâîëà ñ êîäîì 10
je @b
@@:
pop ebx
ret
.else:
call GetTexNextPos
cmp edx,[tex_1]
jle .endif
cmp dword [edx+14],0
jne .else
cmp byte[edx],10 ;ïðîïóñê ñèìâîëà ñ êîäîì 10
je .else
.endif:
ret
 
;input:
; edx = pointer to symbol struct
; bl = symbol end of select
ItPoNextUc:
@@:
cmp bl,byte[edx]
je @f
cmp edx,[tex_1]
jle @f
call IteratNext
jmp @b
@@:
call IteratNext
ret
 
;input:
; edx = pointer to symbol struct
ItPervColorTag:
@@:
cmp byte[edx+1],0
jne @f
call IteratPerv
cmp edx,[tex_1]
jle @f
jmp @b
@@:
ret
 
;input:
; edx = pointer to symbol struct
ItNextColorTag:
@@:
call IteratNext
cmp byte[edx+1],0
jne @f
cmp edx,[tex_1]
jle @f
jmp @b
@@:
;call IteratNext
ret
 
;input:
; edx = pointer to symbol struct
;output:
; bl = 1 if sumbol not visible
; (tex[i].td+tim_Undo<=ch_tim && tex[i].td) || (tex[i].tc>ch_tim-tim_Undo)
SymbNotVis:
push eax
 
xor bl,bl
 
cmp dword [edx+14],0
je @f
mov eax,[edx+14] ;eax=tex[i].td
add eax,[tim_Undo]
cmp eax,[ch_tim]
jg @f
mov bl,1
pop eax
ret
@@:
 
mov eax,[ch_tim]
sub eax,[tim_Undo]
cmp [edx+10],eax
jle @f
or bl,1
@@:
 
pop eax
ret
 
 
;input:
; bh = 1 - move cursor after text add
; bl = 1 - change time when text add
; esi = add text len
; edi = pointer to text string
TextAdd:
push ebp
mov ebp,esp
sub esp,4*2
 
push eax ;po_t
push ecx edx edi
 
call GetPos
call GetTexPervPos
call GetTexArrIndex ;eax=po_t
 
mov dword[ebp-4],0 ;count new spaces
cmp [gpOpt],2
je @f
push eax ebx ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos);
mov eax,[cur_x]
add eax,[hScr.position]
mov dword[ebp-4],eax
 
mov eax,[cur_y]
add eax,[wScr.position]
call StrLen
sub dword[ebp-4],ebx
pop ebx eax
@@:
 
mov dword[ebp-8],0 ;count new lines
cmp [gpOpt],0
jne @f
push eax
mov eax,[cur_y]
add eax,[wScr.position]
inc eax
mov dword[ebp-8],eax
 
call GetNumLines
sub dword[ebp-8],eax
pop eax
@@:
 
mov edx,sizeof.symbol
shl edx,1
add edx,[tex]
@@: ;for(i=2;i<texMax;i++)
cmp dword [edx+10],0 ;if(!tex[i].tc && !tex[i].td)
jne .u1f
cmp dword [edx+14],0
jne .u1f
cmp bl,0 ;if(n_tim) ch_tim++;
je .no_tim
inc [ch_tim]
.no_tim:
cmp bh,0
je .no_cur_mov
cmp dword[ebp-8],0 ;åñëè åñòü äîáàâî÷íûå ñòðîêè, òî êóðñîð åùå íå äâèãàåì
jg .no_cur_mov
cmp dword[ebp-4],0 ;åñëè íåò äîáàâî÷íûõ ïðîáåëîâ, òî êóðñîð òîæå íå äâèãàåì
jg .no_cur_mov
inc [cur_x] ;move cursor
;call GoToPos
cmp byte [edi],13
jne .no_cur_mov
mov [cur_x],0
inc [cur_y]
.no_cur_mov:
 
xor bl,bl ;n_tim=false;
 
mov cl,byte [edi] ;tex[i].c=ta[ns];
mov byte [edx],cl
m2m dword [edx+10],dword [ch_tim] ;tex[i].tc=ch_tim;
mov [edx+2],eax ;tex[i].perv=po_t;
 
mov ecx,eax
imul ecx,sizeof.symbol
add ecx,[tex] ; *** ecx = tex[po_t] ***
add ecx,6 ; *** ecx = tex[po_t].next ***
m2m dword [edx+6],dword [ecx] ;tex[i].next=tex[po_t].next;
 
call GetTexArrIndex ;*** eax = i ***
cmp eax,maxChars
jge @f
mov [ecx],eax ;tex[po_t].next=i; // ññûëêè ïåðåíàïðàâëÿåì
mov ecx,[edx+6] ; *** ecx = tex[i].next ***
imul ecx,sizeof.symbol
add ecx,[tex] ; *** ecx = tex[tex[i].next] ***
mov [ecx+2],eax ;tex[tex[i].next].perv=i;
 
cmp dword[ebp-8],0 ;add lines or text
jle .spc_add
dec dword[ebp-8]
mov byte [edx],13
jmp .u1f
.spc_add:
cmp dword[ebp-4],0 ;add spaces or text
jle .tex_add
dec dword[ebp-4]
mov byte [edx],' '
jmp .u1f
.tex_add:
inc edi
dec esi
.u1f:
add edx,sizeof.symbol
cmp edx,[tex_end]
jge @f ;out of memory
cmp esi,0
jne @b
@@:
 
pop edi edx ecx eax
mov esp,ebp ; âîññòàíàâëèâàåì ñòåê
pop ebp
call CmColored
ret
 
 
 
;input:
; ecx = position to free insert cell
; edx = pointer to sumbol, when insert
; esi = pointer to added symbol
;output:
; ecx = position to inserted cell
CharAdd:
 
.loop_b:
cmp ecx,[tex_end]
jge .end_f
cmp dword[ecx+10],0
jne @f
cmp dword[ecx+14],0
je .loop_e
@@:
add ecx,sizeof.symbol
jmp .loop_b
.loop_e:
 
push eax ebx
mov eax,[ch_tim]
mov dword[ecx+10],eax
mov al,byte[esi]
mov byte[ecx],al
 
call GetTexArrIndex ; *** eax=pos ***
mov [ecx+2],eax ;tex[i].perv=pos;
m2m dword[ecx+6],dword[edx+6] ;tex[i].next=tex[pos].next;
 
push edx
mov edx,ecx
call GetTexArrIndex ; *** eax=i ***
pop edx
 
mov [edx+6],eax ;tex[pos].next=i; // ññûëêè ïåðåíàïðàâëÿåì
mov ebx,[ecx+6]
ConvertIndexToPointer ebx
mov [ebx+2],eax ;tex[tex[i].next].perv=i; // ...
pop ebx eax
 
.end_f:
call CmColored
ret
 
 
;input:
; conv_table = pointert to convert table
;output:
; edi = count converted symbols
ConvertSelText:
xor edi,edi
push eax ebx ecx edx esi
call IsSel
cmp al,0
je .end_f
call SetUndo
call SelNormalize
 
mov esi,[seln.x0]
mov ecx,[seln.y0]
call GetPosByParam
mov eax,edx
mov esi,[seln.x1]
mov ecx,[seln.y1]
call GetPosByParam
;call GetTexPervPos
mov ebx,edx
 
cmp eax,ebx
je .end_f
 
inc [ch_tim]
mov edx,eax ;i=p0;
mov ecx,2
ConvertIndexToPointer ecx
@@:
mov esi,[edx]
and esi,0xff
add esi,[conv_table] ;EvUpper
cmp byte [esi],0
je .no_change
m2m dword [edx+14],dword [ch_tim]
call CharAdd ;b_pos=CharAdd(tex[i].c^32,i,false,b_pos);
call GetTexNextPos ;go to added symbol
inc edi
.no_change:
 
call IteratNext
cmp edx,[tex]
je @f
cmp edx,ebx
je @f
 
jmp @b
@@:
cmp edi,0
jne @f
dec [ch_tim]
@@:
.end_f:
pop esi edx ecx ebx eax
 
ret
 
;input:
; bh = (0-backspace, 1-delete)
; bl = 1 - change time
;output:
; bl = 0 - no delete
; bl = 1 - delete
TextDel:
push edx cx
xor cl,cl
cmp bh,1
je @f
call CurMoveLeft
cmp dl,0
je .no_del
@@:
call GetPos
cmp [gpOpt],1
je .no_del
cmp bl,0
je @f
inc [ch_tim]
@@:
m2m dword [edx+14], dword [ch_tim]
mov cl,1
.no_del:
mov bl,cl
pop cx edx
ret
 
 
 
;input:
; eax = pointer to begin select
; ebx = pointer to end select
Revers:
cmp eax,ebx
jne @f
ret
@@:
 
push ecx edx
 
mov edx,[tex_1]
cmp edx,ebx ;if(p1==1)p1=tex[1].perv;
jne @f
call GetTexPervPos
mov ebx,edx
@@:
 
push esi
mov edx,[eax+2] ; *** edx = tex[p0].perv ***
ConvertIndexToPointer edx
add edx,6
mov ecx,[edx] ;tmp = tex[tex[p0].perv].next;
 
mov esi,[ebx+6] ; *** esi = tex[p1].next ***
ConvertIndexToPointer esi
add esi,2
m2m dword[edx],dword[esi] ;tex[tex[p0].perv].next = tex[tex[p1].next].perv;
 
mov [esi],ecx ;tex[tex[p1].next].perv = tmp;
pop esi
 
mov ecx,[eax+2] ;tmp = tex[p0].perv;
m2m dword[eax+2],dword[ebx+6] ;tex[p0].perv = tex[p1].next;
mov [ebx+6],ecx ;tex[p1].next = tmp;
 
mov edx,eax ;i=p0;
@@:
mov ecx,[edx+6] ;tmp = tex[i].next;
m2m dword[edx+6],dword[edx+2] ;tex[i].next = tex[i].perv;
mov [edx+2],ecx ;tex[i].perv = tmp;
cmp edx,ebx ;if(i==p1)break;
je @f
; ---
;cmp edx,[tex]
;je @f
; ---
mov edx,ecx ;i = tmp;
ConvertIndexToPointer edx
jmp @b
@@:
pop edx ecx
call CmColored
ret
 
 
;output:
; dl = 0 not move
; dl = 2 if move up
; dl = 8 if scroll move up
CurMoveUp:
cmp [cur_y],0
je @f
dec [cur_y]
mov dl,2
ret
@@:
cmp [wScr.position],0
je @f
dec [wScr.position]
mov dl,8
ret
@@:
mov dl,0
ret
 
;output:
; dl = 0 not move
; dl = 2 if move down
; dl = 8 if scroll move down
CurMoveDown:
push eax
mov dl,0
mov eax,[wScr.cur_area]
dec eax
cmp [cur_y],eax
jge @f
inc [cur_y]
mov dl,2
jmp .ret_f
@@:
mov eax,[cur_y]
add eax,[wScr.position]
inc eax
cmp [wScr.max_area],eax
jle @f
inc [wScr.position]
mov dl,8
@@:
.ret_f:
pop eax
ret
 
 
;output:
; dl = 0 not move
; dl = 1 if move up
CurMovePageUp:
push eax
mov eax,[wScr.cur_area]
xor dl,dl
cmp eax,[wScr.position]
jg @f
sub [wScr.position],eax
mov dl,1
@@:
cmp [wScr.position],0
je @f
cmp dl,1
je @f
mov [wScr.position],0
mov dl,1
@@:
pop eax
ret
 
CurMovePageDown:
push eax ebx
xor dl,dl
mov eax,[wScr.max_area]
sub eax,[wScr.cur_area]
cmp [wScr.position],eax
jge @f
mov ebx,[wScr.cur_area]
add [wScr.position],ebx
mov dl,1
mov [wScr.redraw],1
cmp [wScr.position],eax
jle @f
mov [wScr.position],eax
@@:
pop ebx eax
ret
 
;output:
; dl = 0 not move
; dl = 1 if move left
; dl = 3 if move left and up
; dl = 8 if scroll move up
CurMoveLeft:
cmp [cur_x],0
je @f
dec [cur_x]
mov dl,1
ret
@@:
cmp [hScr.position],0
je @f
dec [hScr.position]
mov dl,8
ret
@@:
cmp [cur_y],0
jne @f
mov dl,0
cmp [wScr.position],0
je .ret_f
dec [wScr.position]
call OnInitialUpdate
call CurMoveX_LastChar
mov dl,8
jmp .ret_f
@@:
cmp [cur_y],0
je @f
dec [cur_y]
call CurMoveX_LastChar
cmp dl,8
je .ret_f
mov dl,3
ret
@@:
mov dl,0
.ret_f:
ret
 
CurMoveRight:
push eax
xor dl,dl
mov eax,[hScr.cur_area]
cmp [cur_x],eax
jge @f
inc [cur_x]
mov dl,1
jmp .ret_f
@@:
inc [hScr.position]
mov dl,8
.ret_f:
pop eax
ret
 
CurMoveX_LastChar:
;[hScr.position]
;[hScr.cur_area]
;dl-???
push eax ebx
mov eax,[cur_y]
add eax,[wScr.position]
call StrLen
xor dl,dl
 
cmp ebx,[hScr.position]
jge @f
mov dl,8
mov [hScr.position],ebx
@@:
sub ebx,[hScr.position]
 
cmp ebx,[hScr.cur_area]
jle @f ; b---[---]---e
add [hScr.position],ebx
mov ebx,[hScr.cur_area]
sub [hScr.position],ebx
mov dl,8
@@:
mov [cur_x],ebx
pop ebx eax
ret
 
;output:
; dl = 0 not move
; dl = 1 move cursor
; dl = 8 move cursor and scroll
CurMoveX_FirstChar:
xor dl,dl
cmp [cur_x],0
je @f
mov [cur_x],0
mov dl,1
@@:
cmp [hScr.position],0
je @f
mov [hScr.position],0
mov dl,8
@@:
ret
 
;input:
; edx = pointer to symbol struct
;output:
; eax = array index
GetTexArrIndex:
push ecx edx
 
mov eax,edx
sub eax,[tex]
xor edx,edx
mov ecx,sizeof.symbol
div ecx
 
pop edx ecx
ret
 
;input:
; edx = pointer to symbol struct
;output:
; edx = pointer to 'perv' struct
GetTexPervPos:
push dword [edx+2]
pop edx
imul edx,sizeof.symbol
add edx,[tex]
ret
 
;input:
; edx = pointer to symbol struct
;output:
; edx = pointer to 'next' symbol struct
GetTexNextPos:
push dword [edx+6]
pop edx
imul edx,sizeof.symbol
add edx,[tex]
ret
 
 
;output:
; edx = symbol under cursor
; gpOpt = 1,2
; edx = tex[1].perv if error
; gpOpt = 0
GetPos:
push esi ecx
mov esi,[cur_x]
add esi,[hScr.position]
mov ecx,[cur_y]
add ecx,[wScr.position]
call GetPosByParam
pop ecx esi
ret
 
 
;input:
; esi = XPos
; ecx = YPos
;output:
; edx = symbol under cursor
; gpOpt = 1 if found text line
; gpOpt = 2 if found text line and column
; edx = tex[1] if error
; gpOpt = 0 if text no found
GetPosByParam:
push eax ;Row
push ebx ;Col
 
xor eax,eax
xor ebx,ebx
mov [gpOpt],0
mov edx,[tex]
@@:
call IteratNext
cmp edx,[tex_1]
jle @f
cmp ebx,esi
jne .u1_0 ;Col <> cur_x
mov [gpOpt],1
cmp eax,ecx
jge @f ; Row >= cur_y
.u1_0:
mov [gpOpt],0
inc ebx
cmp byte [edx],13
jne @b
cmp eax,ecx
jge @f ; Row >= cur_y
inc eax
xor ebx,ebx
jmp @b
@@:
cmp eax,ecx
jne @f ; Row = cur_y
inc [gpOpt]
@@:
cmp [gpOpt],0
jne @f
mov edx,[tex_1]
;call GetTexPervPos
@@:
pop ebx eax
ret
 
 
;input:
; eax = Row
;output:
; ebx = str len
StrLen:
push edx ecx
;ecx = Row, from cycle
 
xor ebx,ebx
xor ecx,ecx
mov edx,[tex]
@@:
call IteratNext
cmp edx,[tex_1]
jle @f
inc ebx
cmp byte [edx],13
jne @b
dec ebx ;lenght minus 1 sumbol to paragraph
cmp eax,ecx
je @f
xor ebx,ebx
inc ecx
jmp @b
@@:
 
cmp eax,ecx
je @f
xor ebx,ebx
@@:
 
pop ecx edx
ret
 
 
;output:
; edx = symbol position
;output:
; eax = number of line
; ebx = symbol position in line
GetTexCoords:
push edx
xor eax,eax
xor ebx,ebx
@@:
call IteratPerv
 
cmp eax,0
jne .no_col_mov
inc ebx
.no_col_mov:
 
cmp edx,[tex_1]
jle @f
cmp byte [edx],13
jne @b
inc eax
jmp @b
@@:
dec ebx
pop edx
ret
 
;output:
; eax = num lines
GetNumLines:
push edx
mov eax,1
mov edx,[tex]
@@:
call IteratNext
cmp edx,[tex_1]
jle @f
cmp byte [edx],13
jne @b
inc eax
jmp @b
@@:
;...
;dec eax
pop edx
ret
 
SetUndo:
mov [dragk],0 ;çàêàí÷èâàåì âûäåëåíèå îò êëàâèàòóðû
cmp [tim_Undo],1
jl .no_work
 
push eax ebx edx
mov edx,[tex]
call GetTexNextPos ;long i=tex[0].next;
mov eax,[tim_Undo]
sub [ch_tim],eax ;ch_tim-=tim_Undo;
mov eax,[ch_tim]
cmp [ls_tim],eax ;if(ls_tim>ch_tim)
jle @f
mov dword [ls_tim],0
@@:
cmp edx,[tex]
je @f
 
;if(tex[i].tc>ch_tim){ // åñëè ñîçäàíèå ñèìâîëà áûëî îòìåíåíî
cmp [edx+10],eax
jle .no_u1
mov dword [edx+10],0
mov dword [edx+14],0
 
mov ebx,[edx+2]
imul ebx,sizeof.symbol
add ebx,[tex];.next
m2m dword [ebx+6],dword [edx+6] ;tex[tex[i].perv].next=tex[i].next;
 
mov ebx,[edx+6]
imul ebx,sizeof.symbol
add ebx,[tex];.perv
m2m dword [ebx+2],dword [edx+2] ;tex[tex[i].next].perv=tex[i].perv;
 
.no_u1:
 
;else if(tex[i].td>ch_tim) tex[i].td=0; // åñëè óäàëåíèå ñèìâîëà áûëî îòìåíåíî
cmp [edx+14],eax
jle .no_u2
mov dword [edx+14],0
.no_u2:
 
call GetTexNextPos
jmp @b
@@:
mov dword [tim_Undo],0
mov eax,[co_tim]
cmp [ch_tim],eax
jge @f
mov [co_tim],0
@@:
pop edx ebx eax
.no_work:
ret
 
;input:
; ecx = Col
; edx = Row
GoToPos:
mov [cur_x],ecx
sub edx,[wScr.position]
 
cmp edx,[wScr.cur_area] ;[cur_y] > [.cur_area]
jl @f
push ebx
mov ebx,edx
sub ebx,[wScr.cur_area]
inc ebx
add [wScr.position],ebx
sub edx,ebx
pop ebx
; ??? redrav
@@:
mov [cur_y],edx
ret
 
;input:
; bl = 1 change time when delete text
;output:
; al = 1 if delete
SelTextDel:
call IsSel
cmp al,0
jne @f
ret
@@:
;call SelEnd
call SelNormalize
push esi edi ecx edx
mov esi,[seln.x1]
mov ecx,[seln.y1]
call GetPosByParam
mov edi,edx
 
mov esi,[seln.x0]
mov ecx,[seln.y0]
call GetPosByParam
 
cmp bl,0
je @f
inc [ch_tim]
 
@@:
cmp edx,[tex]
je @f
cmp edx,edi ;if(i==te)break;
je @f
m2m dword[edx+14],dword[ch_tim]
xor bl,bl ;n_tim=false;
call IteratNext
jmp @b
@@:
cmp bl,0
je @f
dec [ch_tim]
xor al,al
@@:
cmp bl,0
jne @f
mov ecx,[seln.x0]
mov edx,[seln.y0]
call GoToPos
mov [sel.x0],0
mov [sel.y0],0
mov [sel.x1],0
mov [sel.y1],0
@@:
pop edx ecx edi esi
 
ret
 
 
CmColored:
push eax edx
mov eax,[ch_tim]
sub eax,[tim_Undo]
mov dword[co_tim],eax
mov edx,[tex]
@@:
call IteratNext
cmp edx,[tex_1]
jle @f
mov byte[edx+1],0
jmp @b
@@:
 
cmp dword[ColWords],1
jl .no_colors
mov edx,[tex]
@@:
call TextFSColor
cmp edx,[tex_1]
jle .no_colors
jmp @b
.no_colors:
pop edx eax
ret
 
 
 
;input:
; edx = pointer to start symbol
;output:
; edx = pointer to next symbol
TextFSColor:
;eax = word_n
;ecx = l_pos
push ebp
mov ebp,esp
sub esp,10 ;2*4+2*1
;bP = dword[ebp-4]
;eP = dword[ebp-8]
;fnd = byte[ebp-12]
;f_color = byte[ebp-13]
 
push eax ebx ecx esi edi
mov dword[ebp-4],1
mov dword[ebp-4],1
mov byte[ebp-12],0
mov byte[ebp-13],1
@@:
call IteratNext
cmp edx,[tex_1]
jle @f
 
xor ebx,ebx
mov bl,byte[edx]
;mov byte[buf],bl
;mov byte[buf+1],0
shl bx,2 ;ebx*=4
add ebx,FkPos
mov eax,dword[ebx]
cmp eax,0
jl @b ;if( (word_n=FkPos[(unsigned char)tex[i].c])>-1 ){
 
mov ecx,eax
;while(l_pos<ColWords && Col[keyw[l_pos]].Text[0]==Col[keyw[word_n]].Text[0])
.wh_1b:
cmp ecx,dword[ColWords]
jge .wh_1e
ColToIndexOffset ecx,esi
mov bh,byte[esi]
ColToIndexOffset eax,esi
mov bl,byte[esi]
cmp bh,bl
jne .wh_1e
inc ecx
jmp .wh_1b
.wh_1e:
 
mov dword[ebp-4],edx ;bP=i;
mov edi,1
 
.wh_2b: ;while(1){
call IteratNext
 
;while(l_pos>word_n && Col[keyw[l_pos-1]].Text[pos]!=tex[i].c)
.wh_3b:
cmp ecx,eax
jle .wh_3e
dec ecx
ColToIndexOffset ecx,ebx
inc ecx
;cmp byte[ebx+edi],byte[edx]
push ax
mov al,byte[ebx+edi]
mov bl,al
pop ax
cmp bl,byte[edx]
je .wh_3e
dec ecx
jmp .wh_3b
.wh_3e:
 
ColToIndexOffset eax,ebx
cmp byte[ebx+edi],0
jne .if_0 ;if(Col[keyw[word_n]].Text[pos]==0){
mov dword[ebp-8],edx ;eP=i;
ColToIndexOffset eax,esi
mov bl,byte[esi+MAX_COLOR_WORD_LEN+6]
mov byte[ebp-13],bl ;f_color=Col[keyw[word_n]].color;
 
mov byte[ebp-12],1
;... esi = Col[keyw[word_n]]
mov bl,byte[esi+MAX_COLOR_WORD_LEN+4]
cmp bl,0 ;if(Col[keyw[word_n]].wwo)
je .if_2n
push edx
mov edx,dword[ebp-4]
call IteratPerv
; mov bh,bl
 
btr bx,0 ;1-1
jae .if_3e ;if(Col[keyw[word_n]].wwo&1)
;u1= !(isalnum(cont_s)||cont_s=='_')
call isalnum
jae .if_3e
mov byte[ebp-12],0
.if_3e:
 
btr bx,3 ;4-1
jae .if_4e ;if(Col[keyw[word_n]].wwo&8)
;u1= !isalpha(cont_s);
call isalpha
jae .if_4e
mov byte[ebp-12],0
.if_4e:
 
 
mov edx,dword[ebp-8]
; call IteratNext
 
btr bx,1 ;2-1
jae .if_5e ;if(Col[keyw[word_n]].wwo&2)
;u1= !(isalnum(cont_s)||cont_s=='_')
call isalnum
jae .if_5e
mov byte[ebp-12],0
.if_5e:
 
btr bx,4 ;5-1
jae .if_6e ;if(Col[keyw[word_n]].wwo&16)
;u1= !isalpha(cont_s);
call isalpha
jae .if_6e
mov byte[ebp-12],0
.if_6e:
 
btr bx,2 ;3-1
jae .if_7e ;if(Col[keyw[word_n]].wwo&4)
mov bl,byte[esi+MAX_COLOR_WORD_LEN+5]
call ItPoNextUc
cmp edx,[tex_1]
jle .if_7e
mov dword[ebp-8],edx
.if_7e:
 
pop edx
.if_2n:
; if(i!=1){ // íå êîíåö äîêóìåíòà
; cont_s=tex[eP].c;
; if(Col[keyw[word_n]].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_'); // íå áóêâ.-÷èñë. ñèìâîë
; if(u2 && Col[keyw[word_n]].wwo&16) u2= !isalpha(cont_s); // íå ÷èñë. ñèìâîë
; if(Col[keyw[word_n]].wwo&4) eP=ItPoNextUc(eP,Col[keyw[word_n]].endc);
 
cmp eax,ecx
je .wh_2e ;if(word_n==l_pos) break; // do double - åñëè ñëîâî òî÷íî ïîñëåäíåå
.if_0:
 
cmp edx,[tex_1]
jle .wh_2e ;if(i==1) break;
 
;while(l_pos>word_n && Col[keyw[word_n]].Text[pos]!=tex[i].c)
.wh_4b:
cmp ecx,eax
jle .wh_4e
ColToIndexOffset eax,ebx
;cmp byte[ebx+edi],byte[edx]
push ax
mov al,byte[ebx+edi]
mov bl,al
pop ax
cmp bl,byte[edx]
je .wh_4e
inc eax
jmp .wh_4b
.wh_4e:
 
cmp eax,ecx
je .wh_2e;if(word_n==l_pos) break;
inc edi ;pos++;
jmp .wh_2b
.wh_2e:
 
cmp byte[ebp-12],1 ;if(fnd)break;
je @f
mov edx,dword[ebp-4];i=bP;
jmp @b
@@:
 
cmp byte[ebp-12],1
jne .if_1e ;if(fnd){ // âûäåëåíèå íàéäåíîãî òåêñòà
; if(!mode_sf1 || (mode_sf1 && strlen(Col[keyw[word_n]].f1->c_str())>0)){
mov eax,dword[ebp-4]
mov bl,byte[ebp-13]
mov byte[eax+1],bl ;tex[bP].col=f_color;
mov eax,dword[ebp-8]
mov byte[eax+1],0xff ;tex[eP].col=255;
; return ItPoPerv(eP); // âîçâðàùàåì ïîçèöèþ êîíöà âõîæäåíèÿ
mov edx,dword[ebp-8]
call GetTexPervPos
jmp @f
.if_1e:
mov edx,[tex]
@@:
 
pop edi esi ecx ebx eax
mov esp,ebp
pop ebp
ret
 
 
;input:
; edx = pointer to char (byte)
;output:
; cf=1 if symbol is...
tab_all_num db 0,0,0,0,0,0,11111111b,11b,11111110b,0xff,0xff,111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0,0,0;,0,0,0,0,0,0 - tab_alpha_0,0,0,0,0,0
tab_alpha db 0,0,0,0,0,0,0,0,11111110b,0xff,0xff,111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
;db 0,0,0,0,0,0,11111111b,11b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
isalnum:
push eax ebx
mov al,byte[edx] ;al=offset
shr al,3
and eax,11111b
mov ebx,tab_all_num
add ebx,eax
mov ah,byte[ebx]
mov al,byte[edx] ;al=bit
and ax,111b
m2m bx,word[ebx]
btr bx,ax
pop ebx eax
ret
isalpha:
push eax ebx
mov al,byte[edx] ;al=offset
shr al,3
and eax,11111b
mov ebx,tab_alpha
add ebx,eax
mov ah,byte[ebx]
mov al,byte[edx] ;al=bit
and ax,111b
m2m bx,word[ebx]
btr bx,ax
pop ebx eax
ret
 
 
ShowHelpF1:
push eax edx
 
call GetPos
push edx
call ItNextColorTag
mov eax,edx
pop edx
call ItPervColorTag
 
cmp eax,[tex]
jle @f
cmp edx,[tex_1]
jle @f
call FindHelpId
@@:
pop edx eax
;call draw_main_cursor
call draw_help_f1
ret
 
;input:
; edx = position begin 'symbol' struct
; eax = position end 'symbol' struct
FindHelpId:
; ecx = word_n
; ebx = l_pos
mov [help_id],-1
 
push ebx ecx
xor ebx,ebx
mov bl,byte[edx]
shl bx,2 ;ebx*=4
add ebx,FkPos
mov ecx,dword[ebx]
cmp ecx,0
jl .if_0e ;if( (word_n=FkPos[(unsigned char)tf[0]])>-1 ){
push esi edi
mov ebx,ecx ;l_pos=word_n;
ColToIndexOffset ecx,esi
push cx
mov cl,byte[esi]
@@:
cmp ebx,dword[ColWords] ;while(l_pos<ColWords
jge @f
;ColToIndexOffset ecx,esi
ColToIndexOffset ebx,edi
cmp cl,byte[edi] ;&& Col[keyw[l_pos]].Text[0]==Col[keyw[word_n]].Text[0])
jne @f
inc ebx ;l_pos++;
jmp @b
@@:
pop cx
call IteratNext ;pos=1;
mov esi,1
@@:
push dx
push word[edx]
pop dx
.wh_0b:
cmp ebx,ecx ;while(l_pos>word_n
jle .wh_0e
dec ebx
ColToIndexOffset ebx,edi
inc ebx
cmp byte[edi+esi],dl ;&& Col[keyw[l_pos-1]].Text[pos]!=tf[i])
je .wh_0e
dec ebx ;l_pos--;
jmp .wh_0b
.wh_0e:
 
.wh_1b:
cmp ebx,ecx ;while(l_pos>word_n
jle .wh_1e
ColToIndexOffset ecx,edi
cmp byte[edi+esi],dl
je .wh_1e
inc ecx ;word_n++;
jmp .wh_1b
.wh_1e:
pop dx
 
cmp ecx,ebx ;if(word_n==l_pos) break;
je @f
call IteratNext ;pos++;
cmp edx,eax ;for(...;i<strlen;...)
je @f ;jge
inc esi
jmp @b
@@:
pop edi esi
 
mov dword[help_id],ecx
;return keyw[word_n];
 
.if_0e:
pop ecx ebx
ret
 
/programs/other/t_edit/te_icon.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/other/t_edit
Property changes:
Added: tsvn:logminsize
+5
\ No newline at end of property