Subversion Repositories Kolibri OS

Rev

Rev 1815 | Rev 1829 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1815 Rev 1816
Line 1... Line 1...
1
;
1
;
2
;   MyKey. Version 0.1.
2
;   MyKey. Version 0.2.
3
;
3
;
4
;   Author:         Asper
4
;   Author:         Asper
5
;   Date of issue:  04.12.2009
5
;   Date of issue:  29.12.2009
6
;   Compiler:       FASM
6
;   Compiler:       FASM
7
;   Target:         KolibriOS
7
;   Target:         KolibriOS
8
;
8
;
Line 9... Line 9...
9
 
9
 
10
use32
10
use32
Line 11... Line 11...
11
	org	0x0
11
	org	0x0
12
 
12
 
13
	db	'MENUET00'	; 8 byte id
13
	db	'MENUET01'	; 8 byte id
14
	dd	38		; required os
14
	dd	38		; required os
15
	dd	STARTAPP	; program start
15
	dd	STARTAPP	; program start
16
	dd	I_END		; program image size
16
	dd	I_END		; program image size
-
 
17
	dd	0x1000000	; required amount of memory
-
 
18
	dd	0x1000000	; stack heap
Line 17... Line 19...
17
	dd	0x1000000	 ; required amount of memory
19
	dd	0x0
-
 
20
	dd	app_path
18
	dd	0x00000000	; reserved=no extended header
21
 
19
 
22
include 'aspAPI.inc'
20
include "aspAPI.inc"
23
include 'string.inc'
-
 
24
include 'macros.inc'
Line 21... Line 25...
21
include 'macros.inc'
25
include 'editbox_ex.mac'
22
include 'editbox_ex.mac'
26
include 'load_lib.mac'
Line 23... Line 27...
23
include 'load_lib.mac'
27
include 'dll.inc'
24
 
28
 
25
include 'debug.inc'
29
include 'debug.inc'
26
DEBUG	 equ 0;1
30
DEBUG	 equ 0;1
27
 
31
 
-
 
32
N_KEYCOLOR    equ 0x00EEEEEE ; Normal button color
Line 28... Line 33...
28
N_KEYCOLOR    equ 0x00EEEEEE ; Normal button color
33
C_KEYCOLOR    equ 0x00CBE1E1 ; Control button color
29
C_KEYCOLOR    equ 0x00CBE1E1 ; Control button color
34
A_KEYCOLOR    equ 0x00FF6400;258778 ; Active button color
30
A_KEYCOLOR    equ 0x000099BB;258778 ; Active button color
35
C_TEXTCOLOR   equ 0x80000000 ; Button caption color
31
C_TEXTCOLOR   equ 0x80000000 ; Button caption color
36
CA_TEXTCOLOR  equ 0x80FFFFFF ; Active button caption color
32
CA_TEXTCOLOR  equ 0x80FFFFFF ; Active button caption color
37
A_TEXTCOLOR   equ 0x00FFFFFF ; Active text color
Line 33... Line 38...
33
 
38
 
-
 
39
WIN_X	      equ 265
-
 
40
WIN_Y	      equ 50;175
-
 
41
WIN_W	      equ 595
-
 
42
WIN_H	      equ 415 ;570
34
WIN_X	   equ 265
43
WIN_COLOR     equ 0x040099BB;0x04EEEEEE
35
WIN_Y	   equ 50;175
44
 
Line 36... Line 45...
36
WIN_W	   equ 595
45
ITEM_BUTTON_W	      equ 192;100
37
WIN_H	   equ 415 ;570
46
ITEM_BUTTON_H	      equ 23
Line 38... Line 47...
38
WIN_COLOR  equ 0x04EEEEEE
47
ITEM_BUTTON_SPACE     equ 0
Line 39... Line 48...
39
 
48
FIRST_ITEM_BUTTON_ID  equ 7
-
 
49
 
-
 
50
BUT_W	      equ 80
-
 
51
BUT_H	      equ 20
-
 
52
 
-
 
53
MAX_HOTKEYS_NUM equ 15 ;  Bad bounding :/. Until we have normal listbox control.
40
BUT_W	   equ 192;100
54
PATH_MAX_CHARS equ 255
41
BUT_H	   equ 23
55
 
42
BUT_SPACE  equ 0
56
@use_library
43
 
57
 
44
MAX_HOTKEYS_NUM equ 15 ;  Bad bounding :/. Until we have normal listbox control.
58
STARTAPP:
45
PATH_MAX_CHARS equ 255
59
	; Initialize memory
-
 
60
	mcall	68, 11
-
 
61
	or	eax,eax
-
 
62
	jz	close_app
-
 
63
	; Import libraries
-
 
64
	sys_load_library  boxlib_name, sys_path, boxlib_name, system_dir0, err_message_found_lib, head_f_l, myimport,err_message_import, head_f_i
-
 
65
	cmp	eax,-1
-
 
66
	jz	close_app
-
 
67
	stdcall dll.Load,importTable
-
 
68
	test	eax, eax
-
 
69
	jnz	close_app
-
 
70
 
-
 
71
	; Get memory for editboxes text
-
 
72
	mcall	68, 12, MAX_HOTKEYS_NUM*PATH_MAX_CHARS
Line 46... Line 73...
46
 
73
	mov	dword [buf_cmd_line], eax
47
@use_library
74
	mov	dword [edit1.text],   eax
Line 48... Line 75...
48
 
75
	mcall	68, 12, MAX_HOTKEYS_NUM*PATH_MAX_CHARS
49
STARTAPP:
76
	mov	dword [buf_cmd_params], eax
50
	sys_load_library  boxlib_name, sys_path, boxlib_name, system_dir0, err_message_found_lib, head_f_l, myimport,err_message_import, head_f_i
77
	mov	dword [edit2.text],	eax
51
	cmp	eax,-1
78
	mcall	68, 12, MAX_HOTKEYS_NUM*32
Line 52... Line 79...
52
	jz	close_app
79
	mov	dword [it_buf_cmd_line], eax
53
	;mcall 68,11
80
	mov	dword [it_edit.text],	 eax
Line 54... Line 81...
54
	;or eax,eax
81
 
55
	;jz close_app
82
	call	Load_HotkeyList
-
 
83
 
56
 
84
	mcall	66, 1, 1  ; Set keyboard mode to get scancodes.
-
 
85
	mcall	26, 2, 1, ascii_keymap
-
 
86
 
-
 
87
get_mykey_window_slot_number:
57
	mcall	66, 1, 1  ; Set keyboard mode to get scancodes.
88
	call	draw_window
58
	mcall	26, 2, 1, ascii_keymap
89
	mcall	18, 7
59
 
-
 
-
 
90
	mov	[mykey_window], eax
60
;get_mykey_window_slot_number:
91
 
61
;        mcall   5,  10 ;wait
92
set_event_mask:
-
 
93
	mcall	 40, 39
-
 
94
 
62
;        mcall   18, 7
95
red:
-
 
96
      .test_slot:
63
;        mov     [mykey_window], eax
97
	mcall	18, 7
64
 
98
	mov	ebx, [mykey_window]
65
set_event_mask:
99
	cmp	eax, ebx
Line 66... Line 100...
66
	mcall	 40, 39
100
	jne	@f
67
 
101
 
Line 68... Line 102...
68
red:
102
	mov	ecx, [it_window]
69
;      .test_slot:
-
 
Line 70... Line 103...
70
;        mov     eax, [mykey_window]              ; Test is receiver MyKey window
103
	cmp	ebx, ecx
71
;        mov     ecx, [it_window]
104
	je	@f
72
;        cmp     eax, ecx
105
      .activate_it_window:
73
;        je      @f;still                           ; if yes still.
106
	mov	al,  byte [it_alive]
Line 94... Line 127...
94
	jz	mouse
127
	jz	mouse
Line 95... Line 128...
95
 
128
 
Line 96... Line 129...
96
	jmp	still
129
	jmp	still
97
 
130
 
98
key:
-
 
Line 99... Line 131...
99
	mov	eax, 2
131
key:
100
	int	0x40
132
	mcall	2
101
 
-
 
102
	push	eax
-
 
103
	mcall	66, 3
133
 
104
	mov	edx, eax
134
	push	eax
Line 105... Line 135...
105
	and	edx, 0x00000FFF
135
	mcall	66, 3
106
	mov	dword [modifiers], edx
136
	mov	dword [modifiers], eax
107
	pop	eax
137
	pop	eax
108
 
138
 
109
	test	word [edit1.flags], 10b;ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
139
	test	word [edit1.flags], 10b
110
	jnz	.editbox_input
140
	jnz	.editbox_input
111
	test	word [edit2.flags], 10b;ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
141
	test	word [edit2.flags], 10b
112
	jz	@f
142
	jz	@f
Line 122... Line 152...
122
	cmp	ah, 29 ;Ctrl
152
	cmp	ah, 29 ;Ctrl
123
	je	still
153
	je	still
124
	cmp	ah, 69 ;Pause/Break
154
	cmp	ah, 69 ;Pause/Break
125
	je	still
155
	je	still
Line 126... Line 156...
126
 
156
 
127
;    cmp [keyUpr],0
-
 
128
;    jne still
-
 
129
 
157
       mov     esi, ascii_keymap
Line 130... Line 158...
130
    call Scan2ASCII
158
       call    Scan2ASCII
131
 
159
 
Line 141... Line 169...
141
	mov	cl, byte [hotkeys_num]
169
	mov	cl, byte [hotkeys_num]
142
      .test_next_hotkey:
170
     .test_next_hotkey:
143
	dec	cl
171
	dec	cl
144
	mov	bl, cl
172
	mov	bl, cl
145
	and	ebx, 0xFF
173
	and	ebx, 0xFF
146
	shl	ebx, 5
174
	shl	ebx, 2
147
	mov	esi, ebx
-
 
148
	add	ebx, dword Hotkeys.codes
175
	add	ebx, dword Hotkeys.codes
Line 149... Line 176...
149
 
176
 
-
 
177
	mov	edx, dword [ebx]
150
	cmp	ah, byte [ebx]
178
	cmp	ah, dl
Line 151... Line -...
151
	jne	@f
-
 
152
 
179
	jne	@f
153
	mov	edx, dword [ebx]
180
 
154
	shr	edx, 8
181
	shr	edx, 8
Line 155... Line 182...
155
	cmp	edx, dword [modifiers]
182
	cmp	edx, dword [modifiers]
156
	jne	@f
183
	jne	@f
157
 
184
 
158
	push	eax
185
	push	eax
159
	mov	eax, PATH_MAX_CHARS
186
	mov	eax, PATH_MAX_CHARS
160
	mul	cl
187
	mul	cl
161
	mov	edx, eax
188
	mov	edx, eax
162
	add	edx, dword buf_cmd_params
189
	add	edx, dword [buf_cmd_params]
163
	add	eax, dword buf_cmd_line
190
	add	eax, dword [buf_cmd_line]
164
	mov	esi, eax
191
	mov	esi, eax
165
	pop	eax
192
	pop	eax
166
	call	RunProgram
193
	call	RunProgram
167
	jmp	.end_test
194
	jmp	.end_test
168
      @@:
195
     @@:
169
	or	cl, cl ;cmp     cl, 0
196
	or	cl, cl
Line 170... Line 197...
170
	jnz	.test_next_hotkey ;jge     .test_next_hotkey
197
	jnz	.test_next_hotkey
Line 171... Line 198...
171
      .end_test:
198
     .end_test:
172
      ;------------------------
199
      ;------------------------
173
 
-
 
174
	jmp	still
200
 
175
 
201
	jmp	still
Line 176... Line 202...
176
button:
202
 
177
	mov	eax, 17 	    ; Get pressed button code
203
button:
178
	int	0x40
204
	mcall	17	       ; Get pressed button code
179
	cmp	ah, 1		    ; Test x button
205
	cmp	ah, 1		    ; Test x button
180
	je	close_app
206
	je	close_app
-
 
207
 
-
 
208
	cmp	ah, 2
-
 
209
	jne	@f
-
 
210
	call	AddHotKey
-
 
211
	jmp	red
-
 
212
       @@:
-
 
213
	cmp	ah, 5
-
 
214
	jne	@f
-
 
215
	call	Load_HotkeyList
-
 
216
	jmp	red
-
 
217
       @@:
-
 
218
	cmp	ah, 6
Line 181... Line 219...
181
 
219
	jne	@f
182
	cmp	ah, 2
220
	call	WriteIni
183
	jne	@f
221
	xor	edx, edx
184
	call	AddHotKey
222
	mov	esi, aRamSaver
185
	jmp	red
223
	call	RunProgram
186
       @@:
224
       @@:
Line 187... Line 225...
187
 
225
 
188
	cmp	ah, 5		    ; Test if pressed buttons
226
	cmp	ah, FIRST_ITEM_BUTTON_ID     ; Test if pressed buttons
189
	jb	still		     ; is a HotKey button...
-
 
190
	mov	al, ah
-
 
191
	sub	al, 5
-
 
192
	cmp	al, byte [hotkeys_num]
-
 
193
	jnb	still		     ; ...so, if not then still,
227
	jb	still			     ; is a HotKey button...
194
 
228
	mov	al, ah
195
 
-
 
196
	mov	byte [butt], ah 	  ; if yes then save pressed button ID
-
 
197
	and	eax, 0xFF;shr     ax, 8
-
 
198
	if DEBUG
-
 
199
	   dps	"Button = "
229
	sub	al, FIRST_ITEM_BUTTON_ID
200
	   dph	eax
230
	cmp	al, byte [hotkeys_num]
201
	end if
231
	jnb	still			     ; ...so, if not then still,
Line 202... Line 232...
202
	mov	cl, byte PATH_MAX_CHARS
232
 
203
	mul	cl
233
 
Line 204... Line 234...
204
	if DEBUG
234
	mov	byte [butt], ah 	  ; if yes then save pressed button ID
205
	   dps	"  offset = "
235
	and	eax, 0xFF
206
	   dph	eax
-
 
207
	end if
-
 
208
	mov	ebx, eax
-
 
209
	add	ebx, dword buf_cmd_params
-
 
210
	add	eax, dword buf_cmd_line
-
 
211
 
236
	mov	cl, byte PATH_MAX_CHARS
212
	mov	dword [edit1.text], eax
237
	mul	cl
Line 213... Line 238...
213
	mov	dword [edit2.text], ebx
238
	mov	ebx, eax
214
 
239
	add	ebx, dword [buf_cmd_params]
215
	mov	esi, eax
240
	add	eax, dword [buf_cmd_line]
216
	call	strlen
241
 
Line 217... Line 242...
217
	if DEBUG
242
	mov	dword [edit1.text], eax
Line 218... Line 243...
218
	   dps	"  len = "
243
	mov	dword [edit2.text], ebx
219
	   dph	ecx
244
 
220
	   newline
245
	mov	esi, eax
221
	end if
-
 
222
	mov	dword [edit1.size], ecx
246
	call	strlen
223
	mov	dword [edit1.pos], ecx
247
	mov	dword [edit1.size], ecx
Line 224... Line -...
224
 
-
 
225
	mov	esi, ebx
-
 
226
	call	strlen
248
	mov	dword [edit1.pos], ecx
Line 227... Line 249...
227
	mov	dword [edit2.size], ecx
249
 
228
	mov	dword [edit2.pos], ecx
250
	mov	esi, ebx
Line 247... Line 269...
247
 
269
 
248
 
270
 
Line -... Line 271...
-
 
271
draw_window:
-
 
272
	start_draw_window WIN_X,WIN_Y,WIN_W,WIN_H,WIN_COLOR,labelt, 11;labellen-labelt
-
 
273
 
-
 
274
	;bar         5, 24, 585, 385, 0x800000 or 0x90D2
-
 
275
	;rectangle2  6, 25, 585, 385, 0xFFFFFF, 0
-
 
276
 
-
 
277
	;bar         5, 24, BUT_W+4, 350, 0x008C00D2;0x800000 or A_KEYCOLOR
249
draw_window:
278
	;rectangle2  6, 25, BUT_W+4, 350, 0xFFFFFF, 0
250
  start_draw_window WIN_X,WIN_Y,WIN_W,WIN_H,WIN_COLOR,labelt, 11;labellen-labelt
279
 
251
 
-
 
252
  push dword edit1
280
 
253
  call [edit_box_draw]
281
	push	dword edit1
Line 254... Line 282...
254
 
282
	call	[edit_box_draw]
255
  push dword edit2
283
	push	dword edit2
256
  call [edit_box_draw]
284
	call	[edit_box_draw]
257
 
285
 
258
  stdcall draw_button,	 7,WIN_H-30,80,20,2,C_KEYCOLOR,AddKeyText,   0,C_TEXTCOLOR    ; Add Hot key.
286
	stdcall draw_button,   7,WIN_H-BUT_H-10,BUT_W,BUT_H,2,0x0050D250,AddKeyText,   0,C_TEXTCOLOR	; Add Hotkey.
-
 
287
    if 0
-
 
288
	stdcall draw_button,  90,WIN_H-BUT_H-10,BUT_W,BUT_H,3,C_KEYCOLOR,DeleteKeyText,0,C_TEXTCOLOR	; Delete Hotkey.
Line 259... Line 289...
259
 if 0
289
	stdcall draw_button, 173,WIN_H-BUT_H-10,BUT_W,BUT_H,4,C_KEYCOLOR,ManageKeyText,0,C_TEXTCOLOR	; Manage Hotkey.
260
  stdcall draw_button,	90,WIN_H-30,80,20,3,C_KEYCOLOR,DeleteKeyText,0,C_TEXTCOLOR    ; Delete Hot key.
290
    end if
261
  stdcall draw_button, 173,WIN_H-30,80,20,4,C_KEYCOLOR,ManageKeyText,0,C_TEXTCOLOR    ; Manage Hot key.
291
	stdcall draw_button,   WIN_W-BUT_W*2-14,WIN_H-BUT_H-10,BUT_W,BUT_H,5,0x0050D250,ReloadKeyText,	 0,C_TEXTCOLOR	  ; Save Hotkeys list.
262
 end if
292
	stdcall draw_button,   WIN_W-BUT_W-7,WIN_H-BUT_H-10,BUT_W,BUT_H,6,0x0050D250,SaveKeyText,   0,C_TEXTCOLOR    ; Save Hotkeys list.
263
 
293
 
264
  movzx ecx, byte [hotkeys_num]
294
	movzx	ecx, byte [hotkeys_num]
265
  cmp	ecx, MAX_HOTKEYS_NUM
295
	cmp	ecx, MAX_HOTKEYS_NUM
266
  jng	@f
296
	jng	@f
267
  mov	ecx, MAX_HOTKEYS_NUM
297
	mov	ecx, MAX_HOTKEYS_NUM
268
 @@:
298
     @@:
Line 269... Line 299...
269
  mov	eax, 30
299
	mov	eax, 30
270
  mov	ebx, 5
300
	mov	ebx, FIRST_ITEM_BUTTON_ID
271
 @@:
301
     @@:
272
  or	cl, cl
302
	or	cl, cl
Line 273... Line 303...
273
  jz	@f
303
	jz	@f
274
 
304
 
275
  mov	edx, ebx
305
	mov	edx, ebx
-
 
306
	sub	edx, FIRST_ITEM_BUTTON_ID
-
 
307
	shl	edx, 5; edx=edx*32
-
 
308
	add	edx, dword Hotkeys
-
 
309
 
-
 
310
	cmp	bl, byte [butt]
-
 
311
	jne	.l1
-
 
312
	stdcall draw_button, 7,eax,ITEM_BUTTON_W,ITEM_BUTTON_H,ebx,A_KEYCOLOR  ,edx,0,CA_TEXTCOLOR
276
  sub	edx, 5
313
	bar	    220, 70, 350, 30, 0x00C8E1F0 ;0x800000 or A_KEYCOLOR
277
  shl	edx, 5; edx=edx*32
314
	rectangle2  221, 71, 350, 30, 0xFFFFFF, 0
278
  add	edx, dword Hotkeys
315
	mov	esi, Hotkeys.code_names
279
 
316
	sub	edx, dword Hotkeys
Line 280... Line 317...
280
  cmp	bl, byte [butt]
317
	shl	edx, 1
281
  jne	.l1
318
	add	esi, edx
282
  stdcall draw_button, 7,eax,BUT_W,BUT_H,ebx,A_KEYCOLOR,edx,0,CA_TEXTCOLOR ; F5
319
	stdcall outtextxy, 225, 80, esi, 64, C_TEXTCOLOR
283
  jmp	.l2
320
	jmp	.l2
284
 .l1:
321
     .l1:
285
  stdcall draw_button, 7,eax,BUT_W,BUT_H,ebx,N_KEYCOLOR,edx,0,C_TEXTCOLOR ; F5
322
	stdcall draw_button, 7,eax,ITEM_BUTTON_W,ITEM_BUTTON_H,ebx,N_KEYCOLOR,edx,0,C_TEXTCOLOR
Line 299... Line 336...
299
	cmp	al, MAX_HOTKEYS_NUM
336
	cmp	al, MAX_HOTKEYS_NUM
300
	jge	.end
337
	jge	.end
301
	inc	al
338
	inc	al
302
	mov	byte [hotkeys_num], al
339
	mov	byte [hotkeys_num], al
Line 303... Line -...
303
 
-
 
304
	mov  eax, 51
-
 
305
	mov  ebx, 1
-
 
306
	mov  ecx, start_input_thread
340
 
307
	mov  edx, dword input_thread_stack_top
-
 
308
	mcall
-
 
309
 
341
	mcall	51, 1, dword start_input_thread, dword input_thread_stack_top
310
    .end:
342
    .end:
Line -... Line 343...
-
 
343
ret
-
 
344
 
-
 
345
 
-
 
346
Load_HotkeyList:
-
 
347
	call	ReadIni
-
 
348
 
-
 
349
	mov	al, byte [butt]
-
 
350
	mov	ah, byte [hotkeys_num]
-
 
351
	cmp	al, ah
-
 
352
	jle	@f
-
 
353
	mov	al, ah
-
 
354
      @@:
-
 
355
	and	eax, 0xFF
-
 
356
	sub	al, FIRST_ITEM_BUTTON_ID
-
 
357
	mov	cl, byte PATH_MAX_CHARS
-
 
358
	mul	cl
-
 
359
	mov	ebx, eax
-
 
360
	add	eax, dword [buf_cmd_line]
-
 
361
	add	ebx, dword [buf_cmd_params]
-
 
362
 
-
 
363
 
-
 
364
	mov	esi, eax
-
 
365
	call	strlen
-
 
366
	mov	dword [edit1.size], ecx
-
 
367
	mov	dword [edit1.pos], ecx
-
 
368
 
-
 
369
	mov	esi, ebx
-
 
370
	call	strlen
-
 
371
	mov	dword [edit2.size], ecx
-
 
372
	mov	dword [edit2.pos], ecx
311
  ret
373
ret
312
 
374
 
313
 
375
 
314
reset_modifiers:
376
reset_modifiers:
315
	pusha
377
	pusha
Line 316... Line 378...
316
	mov	esi, dword [it_hotkey_addr]
378
	mov	esi, dword [it_hotkey_addr]
Line -... Line 379...
-
 
379
	test	esi, esi
317
	test	esi, esi
380
	jz	.end_set_mods
318
	jz	.end_set_mods
381
 
Line 319... Line 382...
319
 
382
	lodsd
320
	lodsd
383
 
321
 
384
	; Set new hotkey for the main thread
Line 352... Line 415...
352
	and    dx, 0x0F0
415
	and    dx, 0x0F0
353
	or     dx, bx
416
	or     dx, bx
354
	pop    cx
417
	pop    cx
Line 355... Line 418...
355
 
418
 
-
 
419
	mcall	66, 4
356
	mcall	66, 4
420
	mov	dword [it_hotkey_addr], 0
357
     .end_set_mods:
421
     .end_set_mods:
358
     popa
422
	popa
Line 359... Line 423...
359
ret
423
ret
Line 360... Line 424...
360
 
424
 
361
 
-
 
362
;######################## Input Thread code start  ##########################
-
 
363
 
-
 
364
start_input_thread:
-
 
365
 
-
 
366
;get_it_window_slot_number:
425
 
367
;        mcall   5,  10 ;wait
426
;######################## Input Thread code start  ##########################
368
;        mcall   18, 7
427
 
369
;        mov     [it_window], eax
-
 
370
	mov	ecx, 1	   ; to get scancodes.
-
 
371
	  mov	  eax, 66
428
start_input_thread:
372
	  mov	  ebx, 1     ; Set keyboard mode
-
 
373
	  int	  0x40
429
	mov	ecx, 1	   ; to get scancodes.
374
	  mcall   26, 2, 1, ascii_keymap
430
	mcall	26, 2, 1, it_ascii_keymap
375
	mov	dword [it_hotkey_addr], 0
431
	mcall	66, 1	   ; Set keyboard mode
376
 
432
	mov	dword [it_hotkey_addr], 0
377
it_set_editbox:
433
it_set_editbox:
Line 384... Line 440...
384
 
440
 
385
	mov	esi, eax
441
	mov	esi, eax
386
	call	strlen
442
	call	strlen
387
	mov	dword [it_edit.size], ecx
443
	mov	dword [it_edit.size], ecx
-
 
444
	mov	dword [it_edit.pos], ecx
-
 
445
get_it_window_slot_number:
388
	mov	dword [it_edit.pos], ecx
446
	call	it_draw_window
-
 
447
	mcall	18, 7
Line 389... Line 448...
389
 
448
	mov	[it_window], eax
390
 
449
 
391
it_set_event_mask:
450
it_set_event_mask:
392
	mcall	40, 39
451
	mcall	40, 39
Line 393... Line 452...
393
it_red:
452
it_red:
394
	call	it_draw_window
453
	call	it_draw_window
395
 
-
 
Line 396... Line 454...
396
it_still:
454
 
397
	mov	eax, 10 	      ; Wait for an event in the queue.
455
it_still:
398
	int	0x40
456
	mcall	10		 ; Wait for an event in the queue.
399
 
457
 
400
	cmp	al,1		      ; redraw request ?
458
	cmp	al,1		      ; redraw request ?
401
	jz	it_red
459
	jz	it_red
402
	cmp	al,2		      ; key in buffer ?
460
	cmp	al,2		      ; key in buffer ?
403
	jz	it_key
461
	jz	it_key
Line 404... Line 462...
404
	cmp	al,3		      ; button in buffer ?
462
	cmp	al,3		      ; button in buffer ?
Line 405... Line 463...
405
	jz	button
463
	jz	it_button
406
	cmp	al,6
464
	cmp	al,6
407
	jz	it_mouse
-
 
Line 408... Line 465...
408
 
465
	jz	it_mouse
409
	jmp	it_still
466
 
-
 
467
	jmp	it_still
-
 
468
 
-
 
469
it_key:
-
 
470
	mcall	2
-
 
471
 
-
 
472
	mov	byte [it_keycode], 0
-
 
473
	stdcall outtextxy, 10, 100, ctrl_key_names, 35, 0
410
 
474
 
411
it_key:
475
	cmp	ah, 1 ;Esc
412
	mov	eax, 2
476
	jne	@f
413
	int	0x40
477
	dec	byte [hotkeys_num]
414
 
478
	jmp	close_app
Line 425... Line 489...
425
	cmp	ah, 29 ;[Ctrl]
489
	cmp	ah, 29 ;[Ctrl]
426
	je	.end
490
	je	.end
427
	cmp	ah, 69 ;[Pause Break]
491
	cmp	ah, 69 ;[Pause Break]
428
	je	.end
492
	je	.end
Line 429... Line -...
429
 
-
 
430
 
-
 
431
      ;------------------------
-
 
432
	mov	cl, byte [hotkeys_num]
-
 
433
      .test_next_hotkey:
-
 
434
	mov	bl, cl
-
 
435
	and	ebx, 0xFF
-
 
436
	shl	ebx, 5
-
 
437
	mov	esi, ebx
-
 
438
	add	ebx, dword Hotkeys.codes
-
 
439
	cmp	ah, byte [ebx]
-
 
440
	jne	@f
-
 
441
 
-
 
442
	push	eax
-
 
443
	mov	eax, PATH_MAX_CHARS
-
 
444
	mul	cl
-
 
445
	add	eax, dword buf_cmd_line
-
 
446
	mov	esi, eax
-
 
447
	pop	eax
-
 
448
	mov	edx, 0 ; no parametrs yet <- change it!
-
 
449
	call	RunProgram
-
 
450
	jmp	.end_test
-
 
451
      @@:
-
 
452
	dec	cl
-
 
453
	cmp	cl, 0
-
 
454
	jge	.test_next_hotkey
-
 
455
      .end_test:
-
 
456
      ;------------------------
-
 
457
 
493
 
-
 
494
	mov	byte [it_keycode], ah
458
	mov	byte [it_keycode], ah
495
	mov	esi, it_ascii_keymap
Line 459... Line 496...
459
	call	Scan2ASCII
496
	call	Scan2ASCII
460
 
497
 
461
	test	word [it_edit.flags], 10b;ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
498
	test	word [it_edit.flags], 10b
462
	jz	.end
499
	jz	.end
463
	push	dword it_edit
500
	push	dword it_edit
464
	call	[edit_box_key]
501
	call	[edit_box_key]
Line -... Line 502...
-
 
502
	jmp	it_still
465
	jmp	it_still
503
      .end:
-
 
504
 
-
 
505
	mcall	26, 2, 1, it_ascii_keymap
-
 
506
	call	it_test_key_modifiers
-
 
507
	test	dl, 3
-
 
508
	jz	@f
-
 
509
	push	edx
-
 
510
	mcall	26, 2, 2, it_ascii_keymap
466
      .end:
511
	pop	edx
467
 
512
      @@:
468
	call	it_test_key_modifiers
513
 
469
	mov	al, byte [it_keycode]
514
	mov	al, byte [it_keycode]
470
	test	al, al
515
	test	al, al
Line 471... Line 516...
471
	jz	@f
516
	jz	@f
472
	shl	edx, 8
517
	shl	edx, 8
473
	mov	dl, al
518
	mov	dl, al
-
 
519
 
-
 
520
	mov	eax, dword [it_hotkey_addr]
-
 
521
	test	eax, eax
474
 
522
	jnz	@f
475
	mov	eax, dword [it_hotkey_addr]
523
 
476
	test	eax, eax
524
	call	it_set_keycode_name
477
	jnz	@f
525
 
478
	mov	al, byte [hotkeys_num]
526
	mov	al, byte [hotkeys_num]
479
	sub	al, 1
527
	dec	al
480
	and	eax, 0xFF
528
	and	eax, 0xFF
Line 481... Line 529...
481
	shl	eax, 5
529
	shl	eax, 2;5
Line 493... Line 541...
493
 
541
 
494
it_test_key_modifiers:
542
it_test_key_modifiers:
495
	push	eax
543
	push	eax
496
	mcall	66, 3 ;get control keys state
544
	mcall	66, 3 ;get control keys state
497
	mov	edx,  eax
-
 
498
	and	edx,  0x00000FFF
545
	mov	edx,  eax
499
      .lshift:
546
      .lshift:
500
	test	al, 1  ; LShift ?
547
	test	al, 1  ; LShift ?
501
	jz	.rshift
548
	jz	.rshift
502
	stdcall outtextxy, 10, 100, ctrl_key_names, 6, 0x00FF0000
549
	stdcall outtextxy, 10, 100, ctrl_key_names, 6, A_TEXTCOLOR
503
      .rshift:
550
      .rshift:
504
	test	al, 2  ; RShift ?
551
	test	al, 2  ; RShift ?
505
	jz	.lctrl
552
	jz	.lctrl
506
	stdcall outtextxy, 184, 100, ctrl_key_names+29, 6, 0x00FF0000
553
	stdcall outtextxy, 184, 100, ctrl_key_names+29, 6, A_TEXTCOLOR
507
      .lctrl:
554
      .lctrl:
508
	test	al, 4  ; LCtrl ?
555
	test	al, 4  ; LCtrl ?
509
	jz	.rctrl
556
	jz	.rctrl
510
	stdcall outtextxy, 52, 100, ctrl_key_names+7, 5, 0x00FF0000
557
	stdcall outtextxy, 52, 100, ctrl_key_names+7, 5, A_TEXTCOLOR
511
      .rctrl:
558
      .rctrl:
512
	test	al, 8  ; RCtrl ?
559
	test	al, 8  ; RCtrl ?
513
	jz	.lalt
560
	jz	.lalt
514
	stdcall outtextxy, 148, 100, ctrl_key_names+23, 5, 0x00FF0000
561
	stdcall outtextxy, 148, 100, ctrl_key_names+23, 5, A_TEXTCOLOR
515
      .lalt:
562
      .lalt:
516
	test	al, 0x10  ; LAlt ?
563
	test	al, 0x10  ; LAlt ?
517
	jz	.ralt
564
	jz	.ralt
518
	stdcall outtextxy, 88, 100, ctrl_key_names+13, 4, 0x00FF0000
565
	stdcall outtextxy, 88, 100, ctrl_key_names+13, 4, A_TEXTCOLOR
519
      .ralt:
566
      .ralt:
520
	test	al, 0x20  ; RAlt ?
567
	test	al, 0x20  ; RAlt ?
521
	jz	@f
568
	jz	@f
522
	stdcall outtextxy, 118, 100, ctrl_key_names+18, 4, 0x00FF0000
569
	stdcall outtextxy, 118, 100, ctrl_key_names+18, 4, A_TEXTCOLOR
523
      @@:
570
      @@:
524
	pop	eax
571
	pop	eax
Line -... Line 572...
-
 
572
ret
-
 
573
 
-
 
574
 
-
 
575
it_set_keycode_name:
-
 
576
	pusha
-
 
577
	mov	al, byte [hotkeys_num]
-
 
578
	dec	al
-
 
579
	and	eax, 0xFF
-
 
580
	shl	eax, 6
-
 
581
	mov	edi, Hotkeys.code_names
-
 
582
	add	edi, eax
-
 
583
 
-
 
584
	mov	ecx, 64
-
 
585
	xor	ax, ax
-
 
586
	call	strnset
-
 
587
	mcall	66, 3 ;get control keys state
-
 
588
      .lshift:
-
 
589
	test	al, 1  ; LShift ?
-
 
590
	jz	.rshift
-
 
591
	mov	esi, ctrl_key_names
-
 
592
	mov	ecx, 6
-
 
593
	call	strncat
-
 
594
 
-
 
595
	mov	esi, aPlus
-
 
596
	mov	ecx, 3
-
 
597
	call	strncat
-
 
598
      .rshift:
-
 
599
	test	al, 2  ; RShift ?
-
 
600
	jz	.lctrl
-
 
601
	mov	esi, ctrl_key_names+29
-
 
602
	mov	ecx, 6
-
 
603
	call	strncat
-
 
604
 
-
 
605
	mov	esi, aPlus
-
 
606
	mov	ecx, 3
-
 
607
	call	strncat
-
 
608
      .lctrl:
-
 
609
	test	al, 4  ; LCtrl ?
-
 
610
	jz	.rctrl
-
 
611
	mov	esi, ctrl_key_names+7
-
 
612
	mov	ecx, 5
-
 
613
	call	strncat
-
 
614
 
-
 
615
	mov	esi, aPlus
-
 
616
	mov	ecx, 3
-
 
617
	call	strncat
-
 
618
      .rctrl:
-
 
619
	test	al, 8  ; RCtrl ?
-
 
620
	jz	.lalt
-
 
621
	mov	esi, ctrl_key_names+23
-
 
622
	mov	ecx, 5
-
 
623
	call	strncat
-
 
624
 
-
 
625
	mov	esi, aPlus
-
 
626
	mov	ecx, 3
-
 
627
	call	strncat
-
 
628
      .lalt:
-
 
629
	test	al, 0x10  ; LAlt ?
-
 
630
	jz	.ralt
-
 
631
	mov	esi, ctrl_key_names+13
-
 
632
	mov	ecx, 4
-
 
633
	call	strncat
-
 
634
 
-
 
635
	mov	esi, aPlus
-
 
636
	mov	ecx, 3
-
 
637
	call	strncat
-
 
638
      .ralt:
-
 
639
	test	al, 0x20  ; RAlt ?
-
 
640
	jz	@f
-
 
641
	mov	esi, ctrl_key_names+18
-
 
642
	mov	ecx, 4
-
 
643
	call	strncat
-
 
644
 
-
 
645
	mov	esi, aPlus
-
 
646
	mov	ecx, 3
-
 
647
	call	strncat
-
 
648
      @@:
-
 
649
	mov	esi, it_ascii_keymap
-
 
650
	and	edx, 0xFF
-
 
651
	add	esi, edx
-
 
652
	mov	ecx, 1
-
 
653
	call	strncat
-
 
654
 
-
 
655
	popa
-
 
656
ret
-
 
657
 
-
 
658
 
-
 
659
it_button:
-
 
660
	mcall	17	       ; Get pressed button code
-
 
661
	cmp	ah, 1	       ; Test x button
-
 
662
	jne	@f
-
 
663
	jmp	close_app
-
 
664
      @@:
525
ret
665
	jmp	it_still
Line 526... Line 666...
526
 
666
 
527
it_mouse:
667
it_mouse:
Line 528... Line 668...
528
 
668
 
Line 529... Line 669...
529
	push	dword it_edit
669
	push	dword it_edit
530
	call	[edit_box_mouse]
670
	call	[edit_box_mouse]
Line 531... Line 671...
531
 
671
 
532
	jmp	it_still
672
	jmp	it_still
Line -... Line 673...
-
 
673
 
533
 
674
it_draw_window:
534
it_draw_window:
675
	start_draw_window 450,WIN_Y+250,225,70,WIN_COLOR,it_labelt, 26;labellen-labelt
535
  start_draw_window WIN_X,WIN_Y+250,225,70,WIN_COLOR,it_labelt, 26;labellen-labelt
676
 
-
 
677
	push	dword it_edit
536
 
678
	call	[edit_box_draw]
Line 537... Line -...
537
  push dword it_edit
-
 
538
  call [edit_box_draw]
679
 
Line -... Line 680...
-
 
680
	stdcall outtextxy, 43, 50, it_hint, 0, 0x323232
-
 
681
	stdcall outtextxy, 10, 100, ctrl_key_names, 0, 0
-
 
682
	;stdcall draw_button,   7,WIN_H-30,80,20,2,C_KEYCOLOR,AddKeyText,   0,C_TEXTCOLOR    ; Add Hot key.
-
 
683
	end_draw_window
-
 
684
	mov	byte [it_alive], 1
-
 
685
ret
-
 
686
 
-
 
687
;######################## Input Thread code end ##########################
-
 
688
 
-
 
689
 
-
 
690
; Read configuration file
-
 
691
ReadIni:
-
 
692
	; Get path
-
 
693
	mov	edi, ini_path
-
 
694
	mov	esi, app_path
-
 
695
	call	strlen
-
 
696
 
-
 
697
      .get_path:
-
 
698
	cmp	byte [app_path+ecx-1], '/'
-
 
699
	je	@f
-
 
700
	loop	.get_path
-
 
701
      @@:
-
 
702
	call	strncpy
-
 
703
	mov	byte [ini_path+ecx], 0
-
 
704
	mov	esi, aIni
-
 
705
	call	strlen
-
 
706
	call	strncat
-
 
707
 
-
 
708
	; Get hotkey number
-
 
709
	invoke	ini_get_int, ini_path, aMain, aKeynum, 0
-
 
710
 
-
 
711
	and	eax, 0xFF
-
 
712
	test	al, al
-
 
713
	jz	.end
-
 
714
	cmp	al, MAX_HOTKEYS_NUM
-
 
715
	jle	@f
-
 
716
	mov	al, MAX_HOTKEYS_NUM
-
 
717
      @@:
-
 
718
	mov	byte [hotkeys_num], al
-
 
719
 
-
 
720
	mov	ecx, eax
-
 
721
	xor	eax, eax
-
 
722
      .get_next_hotkey_values:
-
 
723
	call	set_next_hotkey_section_name
-
 
724
	; Get hotkey name
-
 
725
	mov	edi, eax
-
 
726
	shl	edi, 5 ; edi=eax*32
-
 
727
	add	edi, dword Hotkeys
-
 
728
	push	eax ecx
-
 
729
	invoke	ini_get_str, ini_path, aHotkey, aName, edi, 32, 0
-
 
730
	pop	ecx eax
-
 
731
	; Get hotkey code
-
 
732
	mov	edi, eax
-
 
733
	shl	edi, 2 ; edi=eax*4
-
 
734
	add	edi, dword Hotkeys.codes
-
 
735
	push	eax ecx edx
-
 
736
	invoke	ini_get_int, ini_path, aHotkey, aKeycode, 0
-
 
737
	mov	dword [it_hotkey_addr], edi
-
 
738
	stosd
-
 
739
	; set hotkey
-
 
740
	call	reset_modifiers
-
 
741
	pop	edx ecx eax
-
 
742
	; Get hotkey code_name
-
 
743
	mov	edi, eax
-
 
744
	shl	edi, 6 ; edi=eax*64
-
 
745
	add	edi, dword Hotkeys.code_names
-
 
746
	push	eax ecx
-
 
747
	invoke	ini_get_str, ini_path, aHotkey, aKeycodeName, edi, 64, 0
-
 
748
	pop	ecx eax
-
 
749
	; Get hotkey path and param
-
 
750
	push	eax ecx
-
 
751
	mov	cl, byte PATH_MAX_CHARS
-
 
752
	mul	cl
-
 
753
	mov	edi, eax
-
 
754
	push	edi
-
 
755
	add	edi, dword [buf_cmd_line]
-
 
756
	invoke	ini_get_str, ini_path, aHotkey, aPath, edi, 32, 0
-
 
757
	pop	edi
-
 
758
	add	edi, dword [buf_cmd_params]
-
 
759
	invoke	ini_get_str, ini_path, aHotkey, aParam, edi, 32, 0
-
 
760
	pop	ecx eax
-
 
761
 
-
 
762
	inc	al
-
 
763
	dec	ecx
-
 
764
	test	ecx, ecx
-
 
765
	jnz    .get_next_hotkey_values
-
 
766
    .end:
-
 
767
ret
-
 
768
 
-
 
769
 
-
 
770
; Write configuration file
-
 
771
WriteIni:
-
 
772
	mov	edi, ini_path
-
 
773
	; Set hotkey number
-
 
774
	movzx	ecx, byte [hotkeys_num]
-
 
775
	invoke	ini_set_int, ini_path, aMain, aKeynum, ecx
-
 
776
 
-
 
777
	xor	eax, eax
-
 
778
      .get_next_hotkey_values:
-
 
779
	call	set_next_hotkey_section_name
-
 
780
	; Set hotkey name
-
 
781
	push	eax ecx
-
 
782
	mov	esi, eax
-
 
783
	shl	esi, 5 ; edi=eax*32
-
 
784
	add	esi, dword Hotkeys
-
 
785
	call	strlen
-
 
786
	invoke	ini_set_str, ini_path, aHotkey, aName, esi, ecx
-
 
787
	pop	ecx eax
-
 
788
	; Set hotkey code
-
 
789
	mov	esi, eax
-
 
790
	shl	esi, 2 ; edi=eax*4
-
 
791
	add	esi, dword Hotkeys.codes
-
 
792
	push	eax ecx edx
-
 
793
	invoke	ini_set_int, ini_path, aHotkey, aKeycode, dword [esi]
-
 
794
	pop	edx ecx eax
-
 
795
	; Set hotkey code_name
-
 
796
	mov	esi, eax
-
 
797
	shl	esi, 6 ; edi=eax*64
-
 
798
	add	esi, dword Hotkeys.code_names
-
 
799
	push	eax ecx
-
 
800
	call	strlen
-
 
801
	invoke	ini_set_str, ini_path, aHotkey, aKeycodeName, esi, ecx
-
 
802
	pop	ecx eax
-
 
803
	; Set hotkey path and param
-
 
804
	push	eax ecx
-
 
805
	;inc     al
-
 
806
	mov	cl, byte PATH_MAX_CHARS
-
 
807
	mul	cl
-
 
808
	mov	esi, eax
-
 
809
	push	esi
-
 
810
	add	esi, dword [buf_cmd_line]
-
 
811
	call	strlen
-
 
812
	invoke	ini_set_str, ini_path, aHotkey, aPath, esi, ecx
-
 
813
	pop	esi
-
 
814
	add	esi, dword [buf_cmd_params]
-
 
815
	call	strlen
-
 
816
	invoke	ini_set_str, ini_path, aHotkey, aParam, esi, ecx
-
 
817
	pop	ecx eax
-
 
818
 
-
 
819
	inc	al
-
 
820
	dec	ecx
-
 
821
	test	ecx, ecx
-
 
822
	jnz    .get_next_hotkey_values
-
 
823
    .end:
-
 
824
ret
-
 
825
 
-
 
826
 
-
 
827
set_next_hotkey_section_name:		;(eax - num)
-
 
828
; this code mainly from debug.inc
-
 
829
	push	eax ecx edi
-
 
830
	mov	edi, aHotkey
-
 
831
	add	edi, 6 ; + strlen("hotkey")
-
 
832
	mov	ecx, 10
-
 
833
	push	-'0'
-
 
834
    .l0:
-
 
835
	xor	edx, edx
-
 
836
	div	ecx
-
 
837
	push	edx
-
 
838
	test	eax, eax
-
 
839
	jnz	.l0
-
 
840
    .l1:
-
 
841
	pop	eax
-
 
842
	add	al, '0'
-
 
843
	;call   debug_outchar
-
 
844
	stosb
539
 
845
	jnz	.l1
540
  stdcall outtextxy, 10, 100, ctrl_key_names, 35, 0
846
	pop	edi ecx eax
541
  ;stdcall draw_button,   7,WIN_H-30,80,20,2,C_KEYCOLOR,AddKeyText,   0,C_TEXTCOLOR    ; Add Hot key.
-
 
542
  end_draw_window
847
ret
543
ret
848
 
544
 
849
 
545
 
850
;****************************************
546
;######################## Input Thread code end ##########################
851
;*  input:  esi = pointer to keymap     *
547
 
852
;*           ah  = scan code            *
Line 548... Line -...
548
 
-
 
549
Scan2ASCII:
-
 
550
	push	esi
-
 
551
	mov	esi, ascii_keymap
-
 
552
	shr	eax, 8
-
 
553
	add	esi, eax
-
 
554
	lodsb
-
 
555
	shl	eax, 8
-
 
556
	pop	esi
-
 
557
ret
-
 
558
 
-
 
559
 
-
 
560
;****************************************
-
 
561
;*  input:  esi = pointer to string     *
-
 
562
;*  output: ecx = length of the string  *
-
 
563
;****************************************
-
 
Line 564... Line 853...
564
strlen:
853
;*  output:  ah  = ascii code           *
565
      push	eax
854
;****************************************
566
      xor	ecx, ecx
855
Scan2ASCII:
567
      @@:
856
	push	esi
Line 586... Line 875...
586
    mov      dword [InfoStructure+8],  edx ; pointer to the parametrs
875
    mov      dword [InfoStructure+8],  edx ; pointer to the parametrs
587
    mov      dword [InfoStructure+12], 0   ; reserved
876
    mov      dword [InfoStructure+12], 0   ; reserved
588
    mov      dword [InfoStructure+16], 0   ; reserved
877
    mov      dword [InfoStructure+16], 0   ; reserved
589
    mov      dword [InfoStructure+20], 0   ; reserved
878
    mov      dword [InfoStructure+20], 0   ; reserved
590
    mov      dword [InfoStructure+21], esi ; pointer to the file name
879
    mov      dword [InfoStructure+21], esi ; pointer to the file name
591
    mov      eax, 70
-
 
592
    mov      ebx, InfoStructure
880
    mcall    70, InfoStructure
593
    int      0x40
-
 
594
    cmp      eax, 0
881
    cmp      eax, 0
595
    jl	     .err_out
882
    jl	     .err_out
596
  .out:
883
  .out:
597
    popa
884
    popa
598
    clc
885
    clc
Line 605... Line 892...
605
 
892
 
Line 606... Line 893...
606
 
893
 
607
; DATA AREA
894
; DATA AREA
608
 
895
 
Line 609... Line 896...
609
; Application Title
896
; Application Title
Line 610... Line 897...
610
labelt		db	'MyKey v.0.1'
897
labelt		db	'MyKey v.0.2'
611
;mykey_window    dd      0          ; Slot number of MyKey
898
mykey_window	dd	0	   ; Slot number of MyKey main thread
612
 
899
 
613
 
900
 
614
;########### Input Thread data start ############
901
;########### Input Thread data start ############
615
 
902
 
-
 
903
; Input Thread Title
616
; Input Thread Title
904
it_labelt	db	"Input hotkey and it's name"
617
it_labelt	db	"Input hotkey and it's name"
905
;labellen:
-
 
906
it_edit edit_box 180, 20, 30, 0xffffff, 0xAA80, 0x0000ff, 0x0, 0x0, 31, it_buf_cmd_line, 0, 0
618
;labellen:
907
it_buf_cmd_line   dd	  0 ;db MAX_HOTKEYS_NUM*32 dup(0)  ; !Make it dynamic!!!
Line 619... Line 908...
619
it_edit edit_box 180, 20, 30, 0xffffff, 0xAA80, 0x0000ff, 0x0, 0x0, 31, it_buf_cmd_line, 0, 0
908
it_window	  dd	  0	     ; Slot number of the input thread
620
it_buf_cmd_line   db MAX_HOTKEYS_NUM*32 dup(0)	; !Make it dinamyc!!!
909
it_alive	  db	  0	     ; Flag of the input thread existance
-
 
910
it_keycode	  db	  0
-
 
911
it_hotkey_addr	  dd	  0
621
;it_window        dd      0          ; Slot number of Input thread
912
it_hint 	  db	  'or press Esc to cancel',0
622
it_keycode	  db	  0
913
;########### Input Thread data end   ############
Line 623... Line 914...
623
it_hotkey_addr	  dd	  0
914
 
624
;########### Input Thread data end   ############
-
 
625
 
915
;Button names
626
;Button names
916
AddKeyText	db 'Add',0
Line 627... Line 917...
627
AddKeyText     db 'Add',0
917
ReloadKeyText	db 'Reload',0
628
DeleteKeyText  db 'Delete',0
918
SaveKeyText	db 'Save',0
629
ManageKeyText  db 'Manage',0
919
;DeleteKeyText   db 'Delete',0
Line 630... Line 920...
630
 
920
;ManageKeyText   db 'Manage',0
631
 
921
 
Line 632... Line 922...
632
hotkeys_num   db 0;15
922
 
633
;keyboard_mode db 0       ; Scan or ASCII keys to send ?  0 - ASCII , 1 - Scan
923
hotkeys_num   db 0;15
634
butt	      db 5	  ; Pressed button ID
924
butt	      db FIRST_ITEM_BUTTON_ID	    ; Pressed button ID
Line 661... Line 951...
661
aEdit_box_draw	db 'edit_box',0
951
aEdit_box_draw	db 'edit_box',0
662
aEdit_box_key	db 'edit_box_key',0
952
aEdit_box_key	db 'edit_box_key',0
663
aEdit_box_mouse db 'edit_box_mouse',0
953
aEdit_box_mouse db 'edit_box_mouse',0
664
aVersion_ed	db 'version_ed',0
954
aVersion_ed	db 'version_ed',0
Line -... Line 955...
-
 
955
 
-
 
956
align 16
-
 
957
importTable:
-
 
958
library 						\
-
 
959
	libini, 'libini.obj';,                           \
-
 
960
;        boxlib, 'boxlib.obj'                            \
-
 
961
 
-
 
962
;import  boxlib, \
-
 
963
;edit_box_draw  , 'edit_box', \
-
 
964
;edit_box_key   , 'edit_box_key', \
-
 
965
;edit_box_mouse , 'edit_box_mouse', \
-
 
966
;version_ed     , 'version_ed'
-
 
967
 
-
 
968
 
-
 
969
import	libini, \
-
 
970
	ini_get_str  ,'ini_get_str', \
-
 
971
	ini_set_str  ,'ini_set_str', \
-
 
972
	ini_get_int  ,'ini_get_int', \
-
 
973
	ini_set_int  ,'ini_set_int';, \
-
 
974
;        ini_get_color,'ini_get_color', \
-
 
975
;        ini_set_color,'ini_set_color'
-
 
976
 
665
 
977
 
Line 666... Line 978...
666
;] Data structures for loadlib.mac and editbox_ex.mac
978
;] Data structures for loadlib.mac and editbox_ex.mac
667
 
979
 
668
InfoStructure:
980
InfoStructure:
Line 681... Line 993...
681
input_thread_stack_top:
993
input_thread_stack_top:
Line 682... Line 994...
682
 
994
 
683
ascii_keymap:
995
ascii_keymap:
684
	     db 128 dup(?)
996
	     db 128 dup(?)
-
 
997
ctrl_key_names db  'LShift LCtrl LAlt RAlt RCtrl RShift',0
-
 
998
aPlus	       db  ' + ',0
-
 
999
aIni	       db  'mykey.ini',0
-
 
1000
aMain	       db  'main',0
-
 
1001
aKeynum        db  'keynum',0
-
 
1002
aHotkey        db  'hotkey',0,0,0
-
 
1003
aName	       db  'name',0
-
 
1004
aKeycode       db  'keycode',0
-
 
1005
aKeycodeName   db  'keycode_name',0
-
 
1006
aPath	       db  'path',0
-
 
1007
aParam	       db  'param',0
-
 
1008
aRamSaver      db  '/sys/rdsave',0
-
 
1009
 
-
 
1010
app_path       rb  255
Line 685... Line 1011...
685
ctrl_key_names db  'LShift LCtrl LAlt RAlt RCtrl RShift',0
1011
ini_path       rb  255
686
 
1012
 
687
Hotkeys:  ;(name = 32 b) + (modifiers = 3 b) + (keycode = 1 b) = 36 byte for 1 hotkey
1013
Hotkeys:  ;(name = 32 b) + (modifiers = 3 b) + (keycode = 1 b) + (keycode_name = 64 b) = 100 bytes for 1 hotkey
688
    .names:
1014
    .names:
689
	     db 'My Favorite 1',0
1015
	     db 'My1',0
690
	     rb 18
1016
	     rb 28
691
	     db 'My Favorite 2',0
1017
	     db 'My2',0
692
	     rb 18
1018
	     rb 28
693
	     db 'My Favorite 3',0
1019
	     db 'My3',0
694
	     rb 18
1020
	     rb 28
695
	     rb MAX_HOTKEYS_NUM*32-3
1021
	     rb MAX_HOTKEYS_NUM*32-3
-
 
1022
    .codes:
-
 
1023
	     dd MAX_HOTKEYS_NUM dup (0)
-
 
1024
    .code_names:
-
 
1025
	     rb MAX_HOTKEYS_NUM*64