Subversion Repositories Kolibri OS

Rev

Rev 1918 | Rev 3628 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1919 Albom 1
; Keyboard indicators v0.2
2
; by Albom and IgorA
1918 Albom 3
 
4
use32
1919 Albom 5
 org 0
6
 db 'MENUET01'
7
 dd 1
8
 dd _start
9
 dd _end
10
 dd _memory
11
 dd stacktop
12
 dd 0
13
 dd sys_path
1918 Albom 14
 
1919 Albom 15
include '../../macros.inc'
16
include '../../proc32.inc'
17
include '../../develop/libraries/box_lib/load_lib.mac'
18
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
19
;include 'mem.inc'
20
;include 'dll.inc'
1918 Albom 21
 
1919 Albom 22
@use_library ;_mem mem.Alloc,mem.Free,mem.ReAlloc, dll.Load
23
 
24
align 4
1918 Albom 25
_start:
1919 Albom 26
 load_libraries l_libs_start,l_libs_end
27
 mcall 48,3,sc,sizeof.system_colors
28
 mcall 40,0x27
1918 Albom 29
 
1919 Albom 30
 init_checkboxes2 check_boxes,check_boxes_end
31
 check_boxes_set_sys_color2 check_boxes,check_boxes_end,sc
32
 call _key_set
1918 Albom 33
 
1919 Albom 34
align 4
35
red_win:
36
 call draw_window
1918 Albom 37
 
38
 
1919 Albom 39
align 4
40
still:
41
 mcall 10
1918 Albom 42
 
1919 Albom 43
 cmp al,1 ;изм. положение окна
44
 jz red_win
45
 cmp al,2
46
 jz key
47
 cmp al,3
48
 jz button
1918 Albom 49
 
1919 Albom 50
 ;stdcall [check_box_mouse], ch1
51
 ;stdcall [check_box_mouse], ch2
52
 ;stdcall [check_box_mouse], ch3
1918 Albom 53
 
1919 Albom 54
 jmp still
1918 Albom 55
 
1919 Albom 56
;установить общесистемные "горячие клавиши"
57
align 4
1918 Albom 58
_key_set:
59
mov eax, 66
1919 Albom 60
mov ebx, 4
1918 Albom 61
mov edx, 0
62
mov cl, 69
63
int 0x40
64
 
65
mov eax, 66
1919 Albom 66
mov ebx, 4
1918 Albom 67
mov edx, 0
68
mov cl, 58
69
int 0x40
70
 
71
mov eax, 66
1919 Albom 72
mov ebx, 4
1918 Albom 73
mov edx, 0
74
mov cl, 70
75
int 0x40
76
 
77
ret
78
 
1919 Albom 79
align 4
80
draw_window:
81
pushad
82
 mcall 12,1
83
 xor eax,eax
84
 mov ebx,(10 shl 16)+100
85
 mov ecx,(10 shl 16)+75
86
 mov edx,[sc.work]
87
 or edx,(2 shl 24)+0x10000000+0x20000000
88
 mov edi,[sc.grab] ;[sc.frame]
89
 mov esi,[sc.grab]
90
 int 0x40
1918 Albom 91
 
1919 Albom 92
 mov eax,8
93
 mov ebx,(80 shl 16)+10
94
 mov cx,-15
95
 shl ecx,16
96
 mov cx,10
97
 mov edx,1
98
 mov esi,[sc.grab_button]
99
 int 0x40
1918 Albom 100
 
1919 Albom 101
 stdcall [check_box_draw], ch1
102
 stdcall [check_box_draw], ch2
103
 stdcall [check_box_draw], ch3
104
 mcall 12,2
105
popad
106
 ret
1918 Albom 107
 
1919 Albom 108
align 4
109
key:
110
 mcall 2
111
 call _indicators_check
112
 jmp still
1918 Albom 113
 
1919 Albom 114
align 4
1918 Albom 115
_indicators_check:
116
pusha
1919 Albom 117
 mov eax, 66
118
 mov ebx, 3
119
 int 40h
1918 Albom 120
 
121
test_ins:
1919 Albom 122
 test eax, 0x80
123
 jz @f
124
 bts dword[ch1.flags],1
125
 jmp test_caps
1918 Albom 126
@@:
1919 Albom 127
 btr dword[ch1.flags],1
1918 Albom 128
 
129
test_caps:
1919 Albom 130
 test eax, 0x40
131
 jz @f
132
 bts dword[ch2.flags],1
133
 jmp test_scroll
134
@@:
135
 btr dword[ch2.flags],1
1918 Albom 136
 
137
test_scroll:
1919 Albom 138
 test eax, 0x100
139
 jz @f
140
 bts dword[ch3.flags],1
141
 jmp test_ok
1918 Albom 142
@@:
1919 Albom 143
 btr dword[ch3.flags],1
1918 Albom 144
 
145
test_ok:
1919 Albom 146
 call draw_window
1918 Albom 147
popa
148
ret
149
 
1919 Albom 150
align 4
151
button:
152
 mcall 17
153
 cmp ah,1
154
 jne still
155
.exit:
156
 mcall -1
1918 Albom 157
 
158
 
1919 Albom 159
check_boxes:
160
ch1 check_box2 (5 shl 16)+15,(5 shl 16)+10,5, 0xffffff,0x8000,0xff,\
161
 txt_160,0+ch_flag_middle
162
ch2 check_box2 (5 shl 16)+15,(17 shl 16)+10,5, 0xffffff,0x8000,0xff,\
163
 txt_159,0+ch_flag_middle
164
ch3 check_box2 (5 shl 16)+15,(29 shl 16)+10,5, 0xffffff,0x8000,0xff,\
165
 txt_158,0+ch_flag_middle
166
check_boxes_end:
167
 
168
txt_160 db 'Num',0
169
txt_159 db 'Caps',0
170
txt_158 db 'Scroll',0
171
 
172
head_f_i:
173
head_f_l db 'Системная ошибка',0
174
 
175
system_dir_0 db '/sys/lib/'
176
lib_name_0 db 'box_lib.obj',0
177
err_msg_found_lib_0 db 'Не найдена библиотека box_lib.obj',0
178
err_msg_import_0 db 'Ошибка при импорте библиотеки box_lib',0
179
 
180
l_libs_start:
181
 lib_0 l_libs lib_name_0, sys_path, library_path, system_dir_0,\
182
 err_msg_found_lib_0,head_f_l,import_box_lib,err_msg_import_0,head_f_i
183
l_libs_end:
184
 
185
align 4
186
import_box_lib:
187
 ;init dd sz_init
188
 init_checkbox dd sz_init_checkbox
189
 check_box_draw dd sz_check_box_draw
190
 check_box_mouse dd sz_check_box_mouse
191
 dd 0,0
192
 ;sz_init db 'lib_init',0
193
 sz_init_checkbox db 'init_checkbox2',0
194
 sz_check_box_draw db 'check_box_draw2',0
195
 sz_check_box_mouse db 'check_box_mouse2',0
196
 
197
;mouse_dd dd 0x0
198
sc system_colors
199
 
1918 Albom 200
_end:
201
align 32
1919 Albom 202
 rb 2048
203
stacktop:
204
 sys_path rb 1024
205
 library_path rb 1024
1918 Albom 206
_memory: