forked from KolibriOS/kolibrios
1) some fixes in functions 'tl_mouse'
2) added documentation for the 'scrollbar' 3) small improvements 't_edit' git-svn-id: svn://kolibrios.org@1390 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
2038403213
commit
e79fad8794
@ -20,7 +20,7 @@
|
||||
<li><a href="editbox\info_editbox.htm">editbox</a></li>
|
||||
<li><a href="checkbox\info_checkbox.htm">checkbox</a></li>
|
||||
<li>optionbox</li>
|
||||
<li>scrollbar</li>
|
||||
<li><a href="scrollbar\scrollbar.htm">scrollbar</a></li>
|
||||
<li>d_button</li>
|
||||
<li>menubar</li>
|
||||
<li>filebrowser</li>
|
||||
@ -36,6 +36,6 @@
|
||||
<p>Èãîðü Àôàíàñüåâ aka IgorA</p>
|
||||
|
||||
<hr>
|
||||
<p>Документация обновлялась последний раз 10.01.10.</p>
|
||||
<p>Äîêóìåíòàöèÿ îáíîâëÿëàñü ïîñëåäíèé ðàç 05.02.10.</p>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,93 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>элемент Scroll Bar</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=WINDOWS-1251">
|
||||
<link href="../style.css" type=text/css rel=stylesheet>
|
||||
</head>
|
||||
<body>
|
||||
<p><a href="../box_lib.htm">На главную ↑</a></p>
|
||||
<h1>Оглавление</h1>
|
||||
<p><a href="#vveden">Введение</a></p>
|
||||
<p><a href="#funct">Функции</a></p>
|
||||
<ul>
|
||||
<li><a href="#fun_v_draw">scrollbar_v_draw</a></li>
|
||||
<li><a href="#fun_v_mouse">scrollbar_v_mouse</a></li>
|
||||
<li><a href="#fun_h_draw">scrollbar_h_draw</a></li>
|
||||
<li><a href="#fun_h_mouse">scrollbar_h_mouse</a></li>
|
||||
<li><a href="#version">version_ch</a></li>
|
||||
</ul>
|
||||
<p><a href="#struc_scrollbar">Структура scrollbar</a></p>
|
||||
|
||||
<h1><a name="vveden">Введение</a></h1>
|
||||
<p>Скроллбар, используется при выводе информации, не помещающейся в окно. Может быть вертикальным и горизонтальным.</p>
|
||||
|
||||
<h1><a name="funct">Функции</a></h1>
|
||||
|
||||
<h2><a name="fun_v_draw">scrollbar_v_draw</a></h2>
|
||||
<p>Рисование вертикального скроллинга.</p>
|
||||
|
||||
<h2><a name="fun_v_mouse">scrollbar_v_mouse</a></h2>
|
||||
<p>Эта функция должна вызыватся для вертикального скроллинга при движении мышей.</p>
|
||||
|
||||
<h2><a name="fun_h_draw">scrollbar_h_draw</a></h2>
|
||||
<p>Рисование горизонтального скроллинга.</p>
|
||||
|
||||
<h2><a name="fun_h_mouse">scrollbar_h_mouse</a></h2>
|
||||
<p>Эта функция должна вызыватся для горизонтального скроллинга при движении мышей.</p>
|
||||
|
||||
<h2><a name="version">version_ch</a></h2>
|
||||
<p>Версия элемента</p>
|
||||
|
||||
<h1><a name="struc_scrollbar">Структура scrollbar</a></h1>
|
||||
<p>Макроса для создания структуры для скроллбара нет. Потому данные для нее задаются вручную.
|
||||
Есть макрос use_scroll_bar он дает возможность понять какие данные нужны для скроллинга.</p>
|
||||
<pre>macro use_scroll_bar
|
||||
{
|
||||
scroll_bar:
|
||||
sb_size_x equ [edi]
|
||||
sb_start_x equ [edi+ 2]
|
||||
sb_size_y equ [edi+ 4]
|
||||
sb_start_y equ [edi+ 6]
|
||||
sb_btn_high equ [edi+ 8]
|
||||
sb_type equ [edi+12]
|
||||
sb_max_area equ [edi+16]
|
||||
sb_cur_area equ [edi+20]
|
||||
sb_position equ [edi+24]
|
||||
sb_bckg_col equ [edi+28]
|
||||
sb_frnt_col equ [edi+32]
|
||||
sb_line_col equ [edi+36]
|
||||
sb_redraw equ [edi+40]
|
||||
sb_delta equ [edi+44]
|
||||
sb_delta2 equ [edi+46]
|
||||
sb_r_size_x equ [edi+48]
|
||||
sb_r_start_x equ [edi+50]
|
||||
sb_r_size_y equ [edi+52]
|
||||
sb_r_start_y equ [edi+54]
|
||||
sb_m_pos equ [edi+56]
|
||||
sb_m_pos_2 equ [edi+60]
|
||||
sb_m_keys equ [edi+64]
|
||||
sb_run_size equ [edi+68]
|
||||
sb_position2 equ [edi+72]
|
||||
sb_work_size equ [edi+76]
|
||||
sb_all_redraw equ [edi+80]
|
||||
sb_ar_offset equ [edi+84]
|
||||
}</pre>
|
||||
|
||||
<p><b>sb_btn_high</b> - высота боковых кнопок (левая и правая для гориз. и верхняя и нижняя для верт.)</p>
|
||||
<p><b>sb_type</b> - зарезервировано для будущих типов, если скроллбар будет дорабатываться.</p>
|
||||
<p><b>sb_max_area</b> - область максимальная, актуально когда не влазит в
|
||||
отображаемую область, т.е. случай активности компонента (весь максимальный размер документа)</p>
|
||||
<p><b>sb_cur_area</b> - область отображаемая (какая часть документа влазит в экран)</p>
|
||||
<p><b>sb_position</b> - позиция бегунка изменяемая от 0 до значения (sb_max_area-sb_cur_area)</p>
|
||||
<p><b>sb_bckg_col</b> - цвет внутренний, применяется для областей между бегунком и кноками</p>
|
||||
<p><b>sb_frnt_col</b> - цвет наружный, применяется для областей отличных от применяемых в sb_bckg_col</p>
|
||||
<p><b>sb_line_col</b> - цвет линий и стрелок на кнопках</p>
|
||||
<p><b>sb_redraw</b> - индикатор необходимости перерисовки управляемой области учитывая изменение sb_position и sb_cur_area</p>
|
||||
<p><b>sb_delta2</b> - индикатор захвата фокуса скроллбаром (удержание бегунка)</p>
|
||||
<p><b>sb_all_redraw</b> - флаг устанавливаемый в 1 для перерисовки всего компонента, если поставить 0, то перерисовка происходит только для области бегунка. Введено для ускорения отрисовки, поскольку не во всех случаях требуется принудитеьно отрисовывать все части компонента. Когда вызывается по событию мыши всегда отрисовывается самим компонентом со значением 0.</p>
|
||||
<p><b>sb_ar_offset</b> - величина смещения при однократном нажатии боковой кнопки.</p>
|
||||
|
||||
<hr>
|
||||
<p>Документация обновлялась последний раз 05.02.10.</p>
|
||||
</body>
|
||||
</html>
|
@ -1,6 +1,6 @@
|
||||
; ìàêðîñ äëÿ ñèñòåìíîé áèáëèîòåêè box_lib.obj
|
||||
; ýëåìåíò TreeList äëÿ Kolibri OS
|
||||
; ôàéë ïîñëåäíèé ðàç èçìåíÿëñÿ 23.12.2009 IgorA
|
||||
; файл последний раз изменялся 05.02.2010 IgorA
|
||||
; íà êîä ïðèìåíåíà GPL2 ëèöåíçèÿ
|
||||
|
||||
|
||||
@ -317,16 +317,9 @@ align 4
|
||||
tl_mouse: ;ðåàêöèÿ íà ìûøü
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
push eax ebx ecx edx edi esi
|
||||
pushad
|
||||
mov edi,dword[ebp+8]
|
||||
|
||||
mov eax,37
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
|
||||
bt eax,0 ;left mouse button press
|
||||
jae .no_draw
|
||||
|
||||
mov eax,37
|
||||
mov ebx,1
|
||||
int 0x40
|
||||
@ -334,23 +327,33 @@ tl_mouse: ;
|
||||
mov ebx,tl_box_left
|
||||
shl ebx,16
|
||||
cmp eax,ebx ;ëåâàÿ ãðàíèöà îêíà
|
||||
jl .no_in_wnd
|
||||
jl .test_scroll
|
||||
|
||||
mov ebx,tl_box_left
|
||||
add ebx,tl_box_width
|
||||
shl ebx,16
|
||||
cmp eax,ebx ;ïðàâàÿ ãðàíèöà îêíà
|
||||
jg .test_scroll ;.no_in_wnd
|
||||
jg .test_scroll
|
||||
|
||||
mov ebx,tl_box_top
|
||||
add ebx,tl_box_height
|
||||
cmp ax,bx ;íèæíÿÿ ãðàíèöà îêíà
|
||||
jg .no_in_wnd
|
||||
jg .test_scroll
|
||||
|
||||
sub ebx,tl_box_height
|
||||
add bx,tl_capt_cy
|
||||
cmp ax,bx ;âåðõíÿÿ ãðàíèöà îêíà + âûñîòà ïîäïèñè
|
||||
jl .no_in_wnd
|
||||
jl .test_scroll
|
||||
|
||||
push eax ebx
|
||||
mov eax,37
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
|
||||
bt eax,0 ;left mouse button press
|
||||
pop ebx eax
|
||||
jae .no_draw
|
||||
|
||||
|
||||
mov esi,tl_el_focus
|
||||
mov dword[esi],edi ;set focus
|
||||
@ -446,7 +449,13 @@ tl_mouse: ;
|
||||
cmp dword[edx+46],0 ;+46 .delta2
|
||||
jne .no_draw ;ïîïàëè íà ñêðîëëèíã - íå ñíèìàåì ôîêóñ ñ TreeList
|
||||
;-------------------------------------------------------------------------------
|
||||
.no_in_wnd: ;íå ïîïàëè â îêíî - ïîòåðÿ ôîêóñà (ïðè óñëîâèè ÷òî ôîêóñ áûë íà äàííîì ýåëåìåíòå)
|
||||
.no_in_wnd: ;не попали в окно - потеря фокуса (при условии что фокус был на данном эелементе)
|
||||
mov eax,37 ;проверяем нажатость любых кнопок
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
cmp eax,0 ;ниче не нажали eax=0
|
||||
je .no_draw
|
||||
|
||||
mov ebx,tl_el_focus
|
||||
cmp dword[ebx],edi
|
||||
jne .no_draw ;ýëåìåíò íå â ôîêóñå
|
||||
@ -456,7 +465,7 @@ tl_mouse: ;
|
||||
call tl_draw_cursor ;ðèñóåì êóðñîð ñ ïîòåðÿíûì ôîêóñîì
|
||||
.no_draw:
|
||||
|
||||
pop esi edi edx ecx ebx eax
|
||||
popad
|
||||
pop ebp
|
||||
ret 4
|
||||
|
||||
@ -653,6 +662,13 @@ tl_draw: ;
|
||||
@@:
|
||||
|
||||
call tl_draw_cursor
|
||||
|
||||
mov edi,tl_p_scrol ;рисуем дочерний скроллинг
|
||||
cmp edi,0 ;для того что-бы его не пришлось рисовать в пользовательской программе
|
||||
je .end_draw ;если нет скроллинга выходим
|
||||
push dword edi
|
||||
call scroll_bar_vertical.draw
|
||||
|
||||
.end_draw:
|
||||
pop esi edi edx ecx ebx eax
|
||||
pop ebp
|
||||
@ -2330,7 +2346,7 @@ tl_load_mem:
|
||||
; pop ebx
|
||||
; add esi,ebx
|
||||
.beg_cycle:
|
||||
cmp dword[esi],0x65657274 ;0x65657274 = 'tree'
|
||||
cmp dword[esi],'tree'
|
||||
jne .no_tree
|
||||
xor ebx,ebx
|
||||
mov bx,word[esi+4]
|
||||
@ -2341,7 +2357,7 @@ tl_load_mem:
|
||||
loop .beg_cycle
|
||||
@@:
|
||||
|
||||
cmp dword[esi],0x65657274 ;0x65657274 = 'tree'
|
||||
cmp dword[esi],'tree'
|
||||
jne .no_tree
|
||||
bt word[ebp+18],1 ;load in add mode
|
||||
jc @f
|
||||
@ -2410,7 +2426,7 @@ tl_get_mem_size: ;
|
||||
mov esi,dword[ebp+ 8]
|
||||
mov edi,dword[ebp+12]
|
||||
@@:
|
||||
cmp dword[esi],0x65657274 ;0x65657274 = 'tree'
|
||||
cmp dword[esi],'tree'
|
||||
jne @f
|
||||
xor ebx,ebx
|
||||
mov bx,word[esi+4]
|
||||
|
@ -1,634 +0,0 @@
|
||||
;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
|
||||
;
|
||||
}
|
@ -21,8 +21,7 @@ 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/load_lib.mac'
|
||||
include '../../develop/libraries/box_lib/trunk/tree_list.mac'
|
||||
include '../../develop/libraries/box_lib/trunk/editbox.mac'
|
||||
|
||||
@ -71,8 +70,8 @@ start:
|
||||
call Clear
|
||||
|
||||
;-------------------------------------------------
|
||||
mov ecx,maxColWords*sizeof.TexColViv
|
||||
add ecx,40
|
||||
mov ecx,maxColWords*sizeof.TexColViv+40
|
||||
;add ecx,40
|
||||
call mem_Alloc
|
||||
mov [options_file],eax
|
||||
mov [options_file_end],eax
|
||||
@ -91,7 +90,7 @@ start:
|
||||
mov edi,buf_cmd_lin
|
||||
rep movsb
|
||||
|
||||
copy_path fn_icon,sys_path,file_name
|
||||
copy_path fn_icon,sys_path,file_name,0x0
|
||||
|
||||
mov eax,70 ;load icon file
|
||||
mov [run_file_70.func_n], 0
|
||||
@ -130,7 +129,7 @@ load_libraries l_libs_start,load_lib_end
|
||||
call dword[tl_data_init]
|
||||
;---------------------------------------------------------------------
|
||||
; ÷èòàåì bmp ôàéë ñ êóðñîðàìè è ëèíèÿìè
|
||||
copy_path fn_icon_tl_sys,sys_path,file_name
|
||||
copy_path fn_icon_tl_sys,sys_path,file_name,0x0
|
||||
|
||||
mov ecx,3*256*13
|
||||
call mem_Alloc
|
||||
@ -153,7 +152,7 @@ load_libraries l_libs_start,load_lib_end
|
||||
@@:
|
||||
;---------------------------------------------------------------------
|
||||
; ÷èòàåì bmp ôàéë ñ èêîíêàìè óçëîâ
|
||||
copy_path fn_icon_tl_nod,sys_path,file_name
|
||||
copy_path fn_icon_tl_nod,sys_path,file_name,0x0
|
||||
|
||||
mov ecx,3*256*2
|
||||
call mem_Alloc
|
||||
@ -175,7 +174,7 @@ load_libraries l_libs_start,load_lib_end
|
||||
mov dword[tree1.data_img],0
|
||||
@@:
|
||||
;------------------------------------------------------------------------------
|
||||
copy_path fn_syntax_dir,sys_path,file_name ;áåðåì ïóòü ê ïàïêå ñ ôàéëàìè ñèíòàêñèñà
|
||||
copy_path fn_syntax_dir,sys_path,file_name,0x0 ;áåðåì ïóòü ê ïàïêå ñ ôàéëàìè ñèíòàêñèñà
|
||||
mov eax,70
|
||||
mov ebx,tree_file_struct
|
||||
int 0x40
|
||||
|
@ -64,11 +64,11 @@ gpOpt db 0
|
||||
mode_colored db 1 ; ðåæèì âûäåëåíèÿ ñëîâ öâåòîì (0-âûêë. 1-âêë.)
|
||||
|
||||
key_new db 0 ; ñèìâîë, êîòîðûé áóäåò äîáàâëÿòñÿ ñ êëàâèàòóðû
|
||||
tex dd 0 ;text memory pointer
|
||||
tex_1 dd 0 ;text first symbol pointer
|
||||
tex dd 0 ;text memory pointer
|
||||
tex_1 dd 0 ;text first symbol pointer
|
||||
tex_end dd 0 ;text end memory pointer
|
||||
|
||||
hed db 'TextEditor 30.12.09',0 ;ïîäïèñü îêíà
|
||||
hed db 'TextEditor 05.02.10',0 ;ïîäïèñü îêíà
|
||||
sc system_colors
|
||||
|
||||
wndMain BOX 0,50,440,150
|
||||
@ -250,12 +250,9 @@ macro ColToIndexOffset ind_reg,out_reg {
|
||||
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
|
||||
copy_path ebx,fn_syntax_dir,file_name_rez,0x0
|
||||
copy_path file_name_rez,sys_path,file_name,0x0
|
||||
|
||||
mov eax,70
|
||||
mov [run_file_70.func_n], 0
|
||||
@ -277,7 +274,6 @@ InitColText:
|
||||
add edi,4
|
||||
loop @b
|
||||
|
||||
|
||||
;init: ColColor, ColWords, ...
|
||||
mov dword[ColColor],1
|
||||
mov dword[ColWords],0
|
||||
@ -339,13 +335,6 @@ InitColText:
|
||||
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
|
||||
@ -1757,3 +1746,32 @@ FindHelpId:
|
||||
pop ecx ebx
|
||||
ret
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
;ôóíêöèÿ äëÿ âûäåëåíèÿ ïàìÿòè
|
||||
;input:
|
||||
; ecx = size data
|
||||
;otput:
|
||||
; eax = pointer to memory
|
||||
align 4
|
||||
mem_Alloc:
|
||||
push ebx
|
||||
mov eax,68
|
||||
mov ebx,12
|
||||
int 0x40
|
||||
pop ebx
|
||||
ret
|
||||
;-----------------------------------------------------------------------------
|
||||
;ôóíêöèÿ äëÿ îñâîáîæäåíèÿ ïàìÿòè
|
||||
;input:
|
||||
; ecx = pointer to memory
|
||||
align 4
|
||||
mem_Free:
|
||||
push eax ebx
|
||||
cmp ecx,0
|
||||
jz @f
|
||||
mov eax,68
|
||||
mov ebx,13
|
||||
int 0x40
|
||||
@@:
|
||||
pop ebx eax
|
||||
ret
|
||||
|
Loading…
Reference in New Issue
Block a user