2011-01-30 16:54:21 +01:00
|
|
|
;
|
2011-01-30 17:12:10 +01:00
|
|
|
; MyKey. Version 0.2.
|
2011-01-30 16:54:21 +01:00
|
|
|
;
|
|
|
|
; Author: Asper
|
2011-01-30 17:12:10 +01:00
|
|
|
; Date of issue: 29.12.2009
|
2011-01-30 16:54:21 +01:00
|
|
|
; Compiler: FASM
|
|
|
|
; Target: KolibriOS
|
|
|
|
;
|
|
|
|
|
|
|
|
use32
|
|
|
|
org 0x0
|
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
db 'MENUET01' ; 8 byte id
|
2011-01-30 16:54:21 +01:00
|
|
|
dd 38 ; required os
|
|
|
|
dd STARTAPP ; program start
|
|
|
|
dd I_END ; program image size
|
2011-01-30 17:12:10 +01:00
|
|
|
dd 0x1000000 ; required amount of memory
|
|
|
|
dd 0x1000000 ; stack heap
|
|
|
|
dd 0x0
|
|
|
|
dd app_path
|
2011-01-30 16:54:21 +01:00
|
|
|
|
2013-06-09 08:40:31 +02:00
|
|
|
include 'lang.inc' ;language support
|
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
include 'string.inc'
|
2013-10-10 00:29:50 +02:00
|
|
|
;include 'macros.inc'
|
|
|
|
include '../../../macros.inc'
|
|
|
|
include 'ASPAPI.INC'
|
|
|
|
;include 'editbox_ex.mac'
|
|
|
|
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
|
|
|
|
;include 'load_lib.mac'
|
|
|
|
include '../../../develop/libraries/box_lib/load_lib.mac'
|
2012-11-09 11:42:30 +01:00
|
|
|
include '../../../dll.inc'
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
include 'debug.inc'
|
|
|
|
DEBUG equ 0;1
|
|
|
|
|
|
|
|
N_KEYCOLOR equ 0x00EEEEEE ; Normal button color
|
|
|
|
C_KEYCOLOR equ 0x00CBE1E1 ; Control button color
|
2011-01-30 17:12:10 +01:00
|
|
|
A_KEYCOLOR equ 0x00FF6400;258778 ; Active button color
|
2011-01-30 16:54:21 +01:00
|
|
|
C_TEXTCOLOR equ 0x80000000 ; Button caption color
|
|
|
|
CA_TEXTCOLOR equ 0x80FFFFFF ; Active button caption color
|
2011-01-30 17:12:10 +01:00
|
|
|
A_TEXTCOLOR equ 0x00FFFFFF ; Active text color
|
2011-01-30 16:54:21 +01:00
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
WIN_X equ 265
|
|
|
|
WIN_Y equ 50;175
|
|
|
|
WIN_W equ 595
|
|
|
|
WIN_H equ 415 ;570
|
|
|
|
WIN_COLOR equ 0x040099BB;0x04EEEEEE
|
2011-01-30 16:54:21 +01:00
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
ITEM_BUTTON_W equ 192;100
|
|
|
|
ITEM_BUTTON_H equ 23
|
|
|
|
ITEM_BUTTON_SPACE equ 0
|
|
|
|
FIRST_ITEM_BUTTON_ID equ 7
|
|
|
|
|
|
|
|
BUT_W equ 80
|
|
|
|
BUT_H equ 20
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
MAX_HOTKEYS_NUM equ 15 ; Bad bounding :/. Until we have normal listbox control.
|
|
|
|
PATH_MAX_CHARS equ 255
|
|
|
|
|
|
|
|
@use_library
|
|
|
|
|
|
|
|
STARTAPP:
|
2011-01-30 17:12:10 +01:00
|
|
|
; Initialize memory
|
|
|
|
mcall 68, 11
|
|
|
|
or eax,eax
|
|
|
|
jz close_app
|
|
|
|
; Import libraries
|
2011-01-30 16:54:21 +01:00
|
|
|
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
|
|
|
|
cmp eax,-1
|
|
|
|
jz close_app
|
2011-01-30 17:12:10 +01:00
|
|
|
stdcall dll.Load,importTable
|
|
|
|
test eax, eax
|
|
|
|
jnz close_app
|
|
|
|
|
2011-03-05 19:32:56 +01:00
|
|
|
mcall 68, 12, MAX_HOTKEYS_NUM*PATH_MAX_CHARS ; Get memory for editboxes text
|
2011-01-30 17:12:10 +01:00
|
|
|
mov dword [buf_cmd_line], eax
|
|
|
|
mov dword [edit1.text], eax
|
|
|
|
mcall 68, 12, MAX_HOTKEYS_NUM*PATH_MAX_CHARS
|
|
|
|
mov dword [buf_cmd_params], eax
|
|
|
|
mov dword [edit2.text], eax
|
|
|
|
mcall 68, 12, MAX_HOTKEYS_NUM*32
|
|
|
|
mov dword [it_buf_cmd_line], eax
|
|
|
|
mov dword [it_edit.text], eax
|
|
|
|
|
|
|
|
call Load_HotkeyList
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
mcall 66, 1, 1 ; Set keyboard mode to get scancodes.
|
|
|
|
mcall 26, 2, 1, ascii_keymap
|
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
get_mykey_window_slot_number:
|
|
|
|
call draw_window
|
|
|
|
mcall 18, 7
|
|
|
|
mov [mykey_window], eax
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
set_event_mask:
|
2013-10-05 07:22:55 +02:00
|
|
|
mcall 40, 0xC0000027
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
red:
|
2011-01-30 17:12:10 +01:00
|
|
|
.test_slot:
|
|
|
|
mcall 18, 7
|
|
|
|
mov ebx, [mykey_window]
|
|
|
|
cmp eax, ebx
|
|
|
|
jne @f
|
|
|
|
|
|
|
|
mov ecx, [it_window]
|
|
|
|
cmp ebx, ecx
|
|
|
|
je @f
|
|
|
|
.activate_it_window:
|
|
|
|
mov al, byte [it_alive]
|
|
|
|
test al, al
|
|
|
|
jz @f
|
|
|
|
mov byte [it_alive], 0
|
|
|
|
|
2011-03-05 19:32:56 +01:00
|
|
|
mcall 18, 3 ; Activate input thread window
|
2011-01-30 17:12:10 +01:00
|
|
|
@@:
|
2011-01-30 16:54:21 +01:00
|
|
|
call draw_window
|
|
|
|
|
|
|
|
still:
|
|
|
|
call reset_modifiers
|
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
mcall 10 ; Wait for an event in the queue.
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
cmp al,1 ; redraw request ?
|
|
|
|
jz red
|
|
|
|
cmp al,2 ; key in buffer ?
|
|
|
|
jz key
|
|
|
|
cmp al,3 ; button in buffer ?
|
|
|
|
jz button
|
|
|
|
cmp al,6
|
|
|
|
jz mouse
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
key:
|
2011-01-30 17:12:10 +01:00
|
|
|
mcall 2
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
push eax
|
|
|
|
mcall 66, 3
|
2011-03-05 19:32:56 +01:00
|
|
|
;mov edx, eax
|
|
|
|
;and edx, 0x00000FF;F
|
|
|
|
mov dword [modifiers], eax;edx
|
2011-01-30 16:54:21 +01:00
|
|
|
pop eax
|
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
test word [edit1.flags], 10b
|
2011-01-30 16:54:21 +01:00
|
|
|
jnz .editbox_input
|
2011-01-30 17:12:10 +01:00
|
|
|
test word [edit2.flags], 10b
|
2011-01-30 16:54:21 +01:00
|
|
|
jz @f
|
|
|
|
.editbox_input:
|
|
|
|
cmp ah, 0x80 ;if key up
|
|
|
|
ja still
|
|
|
|
cmp ah, 42 ;LShift
|
|
|
|
je still
|
|
|
|
cmp ah, 54 ;RShift
|
|
|
|
je still
|
|
|
|
cmp ah, 56 ;Alt
|
|
|
|
je still
|
|
|
|
cmp ah, 29 ;Ctrl
|
|
|
|
je still
|
|
|
|
cmp ah, 69 ;Pause/Break
|
|
|
|
je still
|
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
mov esi, ascii_keymap
|
|
|
|
call Scan2ASCII
|
2011-01-30 16:54:21 +01:00
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
push dword edit1
|
|
|
|
call [edit_box_key]
|
2011-01-30 16:54:21 +01:00
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
push dword edit2
|
|
|
|
call [edit_box_key]
|
|
|
|
jmp still
|
|
|
|
@@:
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
;------------------------
|
|
|
|
mov cl, byte [hotkeys_num]
|
2011-01-30 17:12:10 +01:00
|
|
|
.test_next_hotkey:
|
2011-01-30 16:54:21 +01:00
|
|
|
dec cl
|
|
|
|
mov bl, cl
|
|
|
|
and ebx, 0xFF
|
2011-03-05 19:32:56 +01:00
|
|
|
shl ebx, 2;5
|
|
|
|
; mov esi, ebx
|
2011-01-30 16:54:21 +01:00
|
|
|
add ebx, dword Hotkeys.codes
|
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
mov edx, dword [ebx]
|
|
|
|
cmp ah, dl
|
2011-01-30 16:54:21 +01:00
|
|
|
jne @f
|
|
|
|
|
|
|
|
shr edx, 8
|
|
|
|
cmp edx, dword [modifiers]
|
|
|
|
jne @f
|
|
|
|
|
|
|
|
push eax
|
|
|
|
mov eax, PATH_MAX_CHARS
|
|
|
|
mul cl
|
|
|
|
mov edx, eax
|
2011-01-30 17:12:10 +01:00
|
|
|
add edx, dword [buf_cmd_params]
|
|
|
|
add eax, dword [buf_cmd_line]
|
2011-01-30 16:54:21 +01:00
|
|
|
mov esi, eax
|
|
|
|
pop eax
|
|
|
|
call RunProgram
|
|
|
|
jmp .end_test
|
2011-01-30 17:12:10 +01:00
|
|
|
@@:
|
|
|
|
or cl, cl
|
|
|
|
jnz .test_next_hotkey
|
|
|
|
.end_test:
|
2011-01-30 16:54:21 +01:00
|
|
|
;------------------------
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
button:
|
2011-01-30 17:12:10 +01:00
|
|
|
mcall 17 ; Get pressed button code
|
2011-01-30 16:54:21 +01:00
|
|
|
cmp ah, 1 ; Test x button
|
|
|
|
je close_app
|
|
|
|
|
|
|
|
cmp ah, 2
|
|
|
|
jne @f
|
|
|
|
call AddHotKey
|
|
|
|
jmp red
|
|
|
|
@@:
|
2011-01-30 17:12:10 +01:00
|
|
|
cmp ah, 5
|
|
|
|
jne @f
|
|
|
|
call Load_HotkeyList
|
|
|
|
jmp red
|
|
|
|
@@:
|
|
|
|
cmp ah, 6
|
|
|
|
jne @f
|
|
|
|
call WriteIni
|
|
|
|
xor edx, edx
|
|
|
|
mov esi, aRamSaver
|
|
|
|
call RunProgram
|
|
|
|
@@:
|
2011-01-30 16:54:21 +01:00
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
cmp ah, FIRST_ITEM_BUTTON_ID ; Test if pressed buttons
|
|
|
|
jb still ; is a HotKey button...
|
2011-01-30 16:54:21 +01:00
|
|
|
mov al, ah
|
2011-01-30 17:12:10 +01:00
|
|
|
sub al, FIRST_ITEM_BUTTON_ID
|
2011-01-30 16:54:21 +01:00
|
|
|
cmp al, byte [hotkeys_num]
|
2011-01-30 17:12:10 +01:00
|
|
|
jnb still ; ...so, if not then still,
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
|
|
|
|
mov byte [butt], ah ; if yes then save pressed button ID
|
2011-01-30 17:12:10 +01:00
|
|
|
and eax, 0xFF
|
2011-01-30 16:54:21 +01:00
|
|
|
mov cl, byte PATH_MAX_CHARS
|
|
|
|
mul cl
|
|
|
|
mov ebx, eax
|
2011-01-30 17:12:10 +01:00
|
|
|
add ebx, dword [buf_cmd_params]
|
|
|
|
add eax, dword [buf_cmd_line]
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
mov dword [edit1.text], eax
|
|
|
|
mov dword [edit2.text], ebx
|
|
|
|
|
|
|
|
mov esi, eax
|
|
|
|
call strlen
|
|
|
|
mov dword [edit1.size], ecx
|
|
|
|
mov dword [edit1.pos], ecx
|
|
|
|
|
|
|
|
mov esi, ebx
|
|
|
|
call strlen
|
|
|
|
mov dword [edit2.size], ecx
|
|
|
|
mov dword [edit2.pos], ecx
|
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
jmp red
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
mouse:
|
|
|
|
push dword edit1
|
|
|
|
call [edit_box_mouse]
|
|
|
|
push dword edit2
|
|
|
|
call [edit_box_mouse]
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
|
|
close_app:
|
2011-01-30 17:12:10 +01:00
|
|
|
mov eax,-1 ; close this program
|
|
|
|
int 0x40
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
|
|
|
|
draw_window:
|
2011-01-30 17:12:10 +01:00
|
|
|
start_draw_window WIN_X,WIN_Y,WIN_W,WIN_H,WIN_COLOR,labelt, 11;labellen-labelt
|
|
|
|
|
|
|
|
;bar 5, 24, 585, 385, 0x800000 or 0x90D2
|
|
|
|
;rectangle2 6, 25, 585, 385, 0xFFFFFF, 0
|
|
|
|
|
|
|
|
;bar 5, 24, BUT_W+4, 350, 0x008C00D2;0x800000 or A_KEYCOLOR
|
|
|
|
;rectangle2 6, 25, BUT_W+4, 350, 0xFFFFFF, 0
|
|
|
|
|
|
|
|
|
|
|
|
push dword edit1
|
|
|
|
call [edit_box_draw]
|
|
|
|
push dword edit2
|
|
|
|
call [edit_box_draw]
|
|
|
|
|
|
|
|
stdcall draw_button, 7,WIN_H-BUT_H-10,BUT_W,BUT_H,2,0x0050D250,AddKeyText, 0,C_TEXTCOLOR ; Add Hotkey.
|
|
|
|
if 0
|
|
|
|
stdcall draw_button, 90,WIN_H-BUT_H-10,BUT_W,BUT_H,3,C_KEYCOLOR,DeleteKeyText,0,C_TEXTCOLOR ; Delete Hotkey.
|
|
|
|
stdcall draw_button, 173,WIN_H-BUT_H-10,BUT_W,BUT_H,4,C_KEYCOLOR,ManageKeyText,0,C_TEXTCOLOR ; Manage Hotkey.
|
|
|
|
end if
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
|
|
|
|
movzx ecx, byte [hotkeys_num]
|
|
|
|
cmp ecx, MAX_HOTKEYS_NUM
|
|
|
|
jng @f
|
|
|
|
mov ecx, MAX_HOTKEYS_NUM
|
|
|
|
@@:
|
|
|
|
mov eax, 30
|
|
|
|
mov ebx, FIRST_ITEM_BUTTON_ID
|
|
|
|
@@:
|
|
|
|
or cl, cl
|
|
|
|
jz @f
|
|
|
|
|
|
|
|
mov edx, ebx
|
|
|
|
sub edx, FIRST_ITEM_BUTTON_ID
|
|
|
|
shl edx, 5; edx=edx*32
|
|
|
|
add edx, dword Hotkeys
|
|
|
|
|
|
|
|
cmp bl, byte [butt]
|
|
|
|
jne .l1
|
|
|
|
stdcall draw_button, 7,eax,ITEM_BUTTON_W,ITEM_BUTTON_H,ebx,A_KEYCOLOR ,edx,0,CA_TEXTCOLOR
|
|
|
|
bar 220, 70, 350, 30, 0x00C8E1F0 ;0x800000 or A_KEYCOLOR
|
|
|
|
rectangle2 221, 71, 350, 30, 0xFFFFFF, 0
|
|
|
|
mov esi, Hotkeys.code_names
|
|
|
|
sub edx, dword Hotkeys
|
|
|
|
shl edx, 1
|
|
|
|
add esi, edx
|
|
|
|
stdcall outtextxy, 225, 80, esi, 64, C_TEXTCOLOR
|
|
|
|
jmp .l2
|
|
|
|
.l1:
|
|
|
|
stdcall draw_button, 7,eax,ITEM_BUTTON_W,ITEM_BUTTON_H,ebx,N_KEYCOLOR,edx,0,C_TEXTCOLOR
|
|
|
|
.l2:
|
|
|
|
|
|
|
|
add eax, ITEM_BUTTON_H+ITEM_BUTTON_SPACE
|
|
|
|
inc ebx
|
|
|
|
dec cl
|
|
|
|
jmp @b
|
|
|
|
@@:
|
|
|
|
end_draw_window
|
2011-01-30 16:54:21 +01:00
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
AddHotKey:
|
|
|
|
mov al, byte [hotkeys_num]
|
|
|
|
cmp al, MAX_HOTKEYS_NUM
|
|
|
|
jge .end
|
|
|
|
inc al
|
|
|
|
mov byte [hotkeys_num], al
|
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
mcall 51, 1, dword start_input_thread, dword input_thread_stack_top
|
2011-01-30 16:54:21 +01:00
|
|
|
.end:
|
2011-01-30 17:12:10 +01:00
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
Load_HotkeyList:
|
|
|
|
call ReadIni
|
|
|
|
|
|
|
|
mov al, byte [butt]
|
|
|
|
and eax, 0xFF
|
|
|
|
sub al, FIRST_ITEM_BUTTON_ID
|
|
|
|
mov cl, byte PATH_MAX_CHARS
|
|
|
|
mul cl
|
|
|
|
mov ebx, eax
|
|
|
|
add eax, dword [buf_cmd_line]
|
|
|
|
add ebx, dword [buf_cmd_params]
|
|
|
|
|
|
|
|
|
2011-03-05 19:32:56 +01:00
|
|
|
;mov [butt], FIRST_ITEM_BUTTON_ID
|
2011-01-30 17:12:10 +01:00
|
|
|
mov esi, eax
|
|
|
|
call strlen
|
|
|
|
mov dword [edit1.size], ecx
|
|
|
|
mov dword [edit1.pos], ecx
|
|
|
|
|
|
|
|
mov esi, ebx
|
|
|
|
call strlen
|
|
|
|
mov dword [edit2.size], ecx
|
|
|
|
mov dword [edit2.pos], ecx
|
|
|
|
ret
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
|
|
|
|
reset_modifiers:
|
|
|
|
pusha
|
|
|
|
mov esi, dword [it_hotkey_addr]
|
|
|
|
test esi, esi
|
|
|
|
jz .end_set_mods
|
|
|
|
|
|
|
|
lodsd
|
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
; Set new hotkey for the main thread
|
|
|
|
mov cl, al
|
2011-01-30 16:54:21 +01:00
|
|
|
shr eax, 8
|
|
|
|
|
|
|
|
xor edx, edx
|
|
|
|
push cx
|
|
|
|
mov cl, 3
|
|
|
|
.next_pair:
|
|
|
|
shl edx, 4
|
|
|
|
mov bl, al
|
|
|
|
and bl, 3
|
|
|
|
|
|
|
|
or bl, bl
|
|
|
|
jz .l1
|
|
|
|
|
|
|
|
cmp bl, 3 ; both?
|
|
|
|
jne @f
|
|
|
|
or dl, 2
|
|
|
|
jmp .l1
|
|
|
|
@@:
|
|
|
|
add bl, 2
|
|
|
|
or dl, bl
|
|
|
|
.l1:
|
|
|
|
shr eax, 2
|
|
|
|
dec cl
|
|
|
|
test cl, cl
|
|
|
|
jnz .next_pair
|
|
|
|
|
|
|
|
mov bx, dx
|
|
|
|
and bx, 0xF0F
|
|
|
|
xchg bl, bh
|
|
|
|
and dx, 0x0F0
|
|
|
|
or dx, bx
|
|
|
|
pop cx
|
|
|
|
|
|
|
|
mcall 66, 4
|
2011-01-30 17:12:10 +01:00
|
|
|
mov dword [it_hotkey_addr], 0
|
2011-01-30 16:54:21 +01:00
|
|
|
.end_set_mods:
|
2011-01-30 17:12:10 +01:00
|
|
|
popa
|
2011-01-30 16:54:21 +01:00
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
;######################## Input Thread code start ##########################
|
|
|
|
|
|
|
|
start_input_thread:
|
|
|
|
mov ecx, 1 ; to get scancodes.
|
2011-01-30 17:12:10 +01:00
|
|
|
mcall 26, 2, 1, it_ascii_keymap
|
|
|
|
mcall 66, 1 ; Set keyboard mode
|
2011-01-30 16:54:21 +01:00
|
|
|
mov dword [it_hotkey_addr], 0
|
|
|
|
it_set_editbox:
|
|
|
|
mov al, byte [hotkeys_num]
|
|
|
|
sub al, 1
|
|
|
|
and eax, 0xFF
|
|
|
|
shl eax, 5
|
|
|
|
add eax, dword Hotkeys.names
|
|
|
|
mov dword [it_edit.text], eax
|
|
|
|
|
|
|
|
mov esi, eax
|
|
|
|
call strlen
|
|
|
|
mov dword [it_edit.size], ecx
|
|
|
|
mov dword [it_edit.pos], ecx
|
2011-01-30 17:12:10 +01:00
|
|
|
get_it_window_slot_number:
|
|
|
|
call it_draw_window
|
|
|
|
mcall 18, 7
|
|
|
|
mov [it_window], eax
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
it_set_event_mask:
|
|
|
|
mcall 40, 39
|
|
|
|
it_red:
|
|
|
|
call it_draw_window
|
|
|
|
|
|
|
|
it_still:
|
2011-01-30 17:12:10 +01:00
|
|
|
mcall 10 ; Wait for an event in the queue.
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
cmp al,1 ; redraw request ?
|
|
|
|
jz it_red
|
|
|
|
cmp al,2 ; key in buffer ?
|
|
|
|
jz it_key
|
|
|
|
cmp al,3 ; button in buffer ?
|
2011-01-30 17:12:10 +01:00
|
|
|
jz it_button
|
2011-01-30 16:54:21 +01:00
|
|
|
cmp al,6
|
|
|
|
jz it_mouse
|
|
|
|
|
|
|
|
jmp it_still
|
|
|
|
|
|
|
|
it_key:
|
2011-01-30 17:12:10 +01:00
|
|
|
mcall 2
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
mov byte [it_keycode], 0
|
|
|
|
stdcall outtextxy, 10, 100, ctrl_key_names, 35, 0
|
2011-01-30 17:12:10 +01:00
|
|
|
|
|
|
|
cmp ah, 1 ;Esc
|
|
|
|
jne @f
|
|
|
|
dec byte [hotkeys_num]
|
|
|
|
jmp close_app
|
|
|
|
@@:
|
|
|
|
|
2011-01-30 16:54:21 +01:00
|
|
|
cmp ah, 0x80 ;if key up
|
|
|
|
ja .end
|
|
|
|
cmp ah, 42 ;[Shift] (left)
|
|
|
|
je .end
|
|
|
|
cmp ah, 54 ;[Shift] (right)
|
|
|
|
je .end
|
|
|
|
cmp ah, 56 ;[Alt]
|
|
|
|
je .end
|
|
|
|
cmp ah, 29 ;[Ctrl]
|
|
|
|
je .end
|
|
|
|
cmp ah, 69 ;[Pause Break]
|
|
|
|
je .end
|
|
|
|
|
|
|
|
mov byte [it_keycode], ah
|
2011-01-30 17:12:10 +01:00
|
|
|
mov esi, it_ascii_keymap
|
2011-01-30 16:54:21 +01:00
|
|
|
call Scan2ASCII
|
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
test word [it_edit.flags], 10b
|
2011-01-30 16:54:21 +01:00
|
|
|
jz .end
|
|
|
|
push dword it_edit
|
|
|
|
call [edit_box_key]
|
|
|
|
jmp it_still
|
|
|
|
.end:
|
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
mcall 26, 2, 1, it_ascii_keymap
|
2011-01-30 16:54:21 +01:00
|
|
|
call it_test_key_modifiers
|
2011-01-30 17:12:10 +01:00
|
|
|
test dl, 3
|
|
|
|
jz @f
|
|
|
|
push edx
|
|
|
|
mcall 26, 2, 2, it_ascii_keymap
|
|
|
|
pop edx
|
|
|
|
@@:
|
|
|
|
|
2011-01-30 16:54:21 +01:00
|
|
|
mov al, byte [it_keycode]
|
|
|
|
test al, al
|
|
|
|
jz @f
|
|
|
|
shl edx, 8
|
|
|
|
mov dl, al
|
|
|
|
|
|
|
|
mov eax, dword [it_hotkey_addr]
|
|
|
|
test eax, eax
|
|
|
|
jnz @f
|
2011-01-30 17:12:10 +01:00
|
|
|
|
|
|
|
call it_set_keycode_name
|
|
|
|
|
2011-01-30 16:54:21 +01:00
|
|
|
mov al, byte [hotkeys_num]
|
2011-01-30 17:12:10 +01:00
|
|
|
dec al
|
2011-01-30 16:54:21 +01:00
|
|
|
and eax, 0xFF
|
2011-01-30 17:12:10 +01:00
|
|
|
shl eax, 2;5
|
2011-01-30 16:54:21 +01:00
|
|
|
add eax, dword Hotkeys.codes
|
|
|
|
mov dword [eax], edx
|
|
|
|
mov dword [it_hotkey_addr], eax
|
|
|
|
|
|
|
|
mov cl, dl ; finally set hotkey
|
|
|
|
shr edx, 8
|
|
|
|
mcall 66, 4
|
|
|
|
@@:
|
|
|
|
|
|
|
|
jmp it_still
|
|
|
|
|
|
|
|
|
|
|
|
it_test_key_modifiers:
|
|
|
|
push eax
|
|
|
|
mcall 66, 3 ;get control keys state
|
|
|
|
mov edx, eax
|
2011-03-05 19:32:56 +01:00
|
|
|
;and edx, 0x00000FFF
|
2011-01-30 16:54:21 +01:00
|
|
|
.lshift:
|
|
|
|
test al, 1 ; LShift ?
|
|
|
|
jz .rshift
|
2011-01-30 17:12:10 +01:00
|
|
|
stdcall outtextxy, 10, 100, ctrl_key_names, 6, A_TEXTCOLOR
|
2011-01-30 16:54:21 +01:00
|
|
|
.rshift:
|
|
|
|
test al, 2 ; RShift ?
|
|
|
|
jz .lctrl
|
2011-01-30 17:12:10 +01:00
|
|
|
stdcall outtextxy, 184, 100, ctrl_key_names+29, 6, A_TEXTCOLOR
|
2011-01-30 16:54:21 +01:00
|
|
|
.lctrl:
|
|
|
|
test al, 4 ; LCtrl ?
|
|
|
|
jz .rctrl
|
2011-01-30 17:12:10 +01:00
|
|
|
stdcall outtextxy, 52, 100, ctrl_key_names+7, 5, A_TEXTCOLOR
|
2011-01-30 16:54:21 +01:00
|
|
|
.rctrl:
|
|
|
|
test al, 8 ; RCtrl ?
|
|
|
|
jz .lalt
|
2011-01-30 17:12:10 +01:00
|
|
|
stdcall outtextxy, 148, 100, ctrl_key_names+23, 5, A_TEXTCOLOR
|
2011-01-30 16:54:21 +01:00
|
|
|
.lalt:
|
|
|
|
test al, 0x10 ; LAlt ?
|
|
|
|
jz .ralt
|
2011-01-30 17:12:10 +01:00
|
|
|
stdcall outtextxy, 88, 100, ctrl_key_names+13, 4, A_TEXTCOLOR
|
2011-01-30 16:54:21 +01:00
|
|
|
.ralt:
|
|
|
|
test al, 0x20 ; RAlt ?
|
|
|
|
jz @f
|
2011-01-30 17:12:10 +01:00
|
|
|
stdcall outtextxy, 118, 100, ctrl_key_names+18, 4, A_TEXTCOLOR
|
2011-01-30 16:54:21 +01:00
|
|
|
@@:
|
|
|
|
pop eax
|
|
|
|
ret
|
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
|
|
|
|
it_set_keycode_name:
|
|
|
|
pusha
|
|
|
|
mov al, byte [hotkeys_num]
|
|
|
|
dec al
|
|
|
|
and eax, 0xFF
|
|
|
|
shl eax, 6
|
|
|
|
mov edi, Hotkeys.code_names
|
|
|
|
add edi, eax
|
|
|
|
|
|
|
|
mov ecx, 64
|
|
|
|
xor ax, ax
|
|
|
|
call strnset
|
|
|
|
mcall 66, 3 ;get control keys state
|
|
|
|
.lshift:
|
|
|
|
test al, 1 ; LShift ?
|
|
|
|
jz .rshift
|
|
|
|
mov esi, ctrl_key_names
|
|
|
|
mov ecx, 6
|
|
|
|
call strncat
|
|
|
|
|
|
|
|
mov esi, aPlus
|
|
|
|
mov ecx, 3
|
|
|
|
call strncat
|
2011-03-05 19:32:56 +01:00
|
|
|
;stdcall outtextxy, 10, 100, ctrl_key_names, 6, 0x00FF0000
|
2011-01-30 17:12:10 +01:00
|
|
|
.rshift:
|
|
|
|
test al, 2 ; RShift ?
|
|
|
|
jz .lctrl
|
|
|
|
mov esi, ctrl_key_names+29
|
|
|
|
mov ecx, 6
|
|
|
|
call strncat
|
|
|
|
|
|
|
|
mov esi, aPlus
|
|
|
|
mov ecx, 3
|
|
|
|
call strncat
|
2011-03-05 19:32:56 +01:00
|
|
|
;stdcall outtextxy, 184, 100, ctrl_key_names+29, 6, 0x00FF0000
|
2011-01-30 17:12:10 +01:00
|
|
|
.lctrl:
|
|
|
|
test al, 4 ; LCtrl ?
|
|
|
|
jz .rctrl
|
|
|
|
mov esi, ctrl_key_names+7
|
|
|
|
mov ecx, 5
|
|
|
|
call strncat
|
|
|
|
|
|
|
|
mov esi, aPlus
|
|
|
|
mov ecx, 3
|
|
|
|
call strncat
|
2011-03-05 19:32:56 +01:00
|
|
|
;stdcall outtextxy, 52, 100, ctrl_key_names+7, 5, 0x00FF0000
|
2011-01-30 17:12:10 +01:00
|
|
|
.rctrl:
|
|
|
|
test al, 8 ; RCtrl ?
|
|
|
|
jz .lalt
|
|
|
|
mov esi, ctrl_key_names+23
|
|
|
|
mov ecx, 5
|
|
|
|
call strncat
|
|
|
|
|
|
|
|
mov esi, aPlus
|
|
|
|
mov ecx, 3
|
|
|
|
call strncat
|
2011-03-05 19:32:56 +01:00
|
|
|
;stdcall outtextxy, 148, 100, ctrl_key_names+23, 5, 0x00FF0000
|
2011-01-30 17:12:10 +01:00
|
|
|
.lalt:
|
|
|
|
test al, 0x10 ; LAlt ?
|
|
|
|
jz .ralt
|
|
|
|
mov esi, ctrl_key_names+13
|
|
|
|
mov ecx, 4
|
|
|
|
call strncat
|
|
|
|
|
|
|
|
mov esi, aPlus
|
|
|
|
mov ecx, 3
|
|
|
|
call strncat
|
2011-03-05 19:32:56 +01:00
|
|
|
;stdcall outtextxy, 88, 100, ctrl_key_names+13, 4, 0x00FF0000
|
2011-01-30 17:12:10 +01:00
|
|
|
.ralt:
|
|
|
|
test al, 0x20 ; RAlt ?
|
|
|
|
jz @f
|
|
|
|
mov esi, ctrl_key_names+18
|
|
|
|
mov ecx, 4
|
|
|
|
call strncat
|
|
|
|
|
|
|
|
mov esi, aPlus
|
|
|
|
mov ecx, 3
|
|
|
|
call strncat
|
2011-03-05 19:32:56 +01:00
|
|
|
;stdcall outtextxy, 118, 100, ctrl_key_names+18, 4, 0x00FF0000
|
2011-01-30 17:12:10 +01:00
|
|
|
@@:
|
|
|
|
mov esi, it_ascii_keymap
|
|
|
|
and edx, 0xFF
|
|
|
|
add esi, edx
|
|
|
|
mov ecx, 1
|
|
|
|
call strncat
|
|
|
|
|
2011-03-05 19:32:56 +01:00
|
|
|
if 1;DEBUG
|
|
|
|
mov esi, edi;Hotkeys.code_names
|
|
|
|
call SysMsgBoardStr
|
|
|
|
newline
|
|
|
|
end if
|
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
popa
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
it_button:
|
|
|
|
mcall 17 ; Get pressed button code
|
2011-03-05 19:32:56 +01:00
|
|
|
cmp ah, 1 ; Test x button
|
2011-01-30 17:12:10 +01:00
|
|
|
jne @f
|
|
|
|
jmp close_app
|
|
|
|
@@:
|
|
|
|
jmp it_still
|
|
|
|
|
2011-01-30 16:54:21 +01:00
|
|
|
it_mouse:
|
|
|
|
|
|
|
|
push dword it_edit
|
|
|
|
call [edit_box_mouse]
|
|
|
|
|
|
|
|
jmp it_still
|
|
|
|
|
|
|
|
it_draw_window:
|
2011-01-30 17:12:10 +01:00
|
|
|
start_draw_window 450,WIN_Y+250,225,70,WIN_COLOR,it_labelt, 26;labellen-labelt
|
2011-01-30 16:54:21 +01:00
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
push dword it_edit
|
|
|
|
call [edit_box_draw]
|
2011-01-30 16:54:21 +01:00
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
stdcall outtextxy, 43, 50, it_hint, 0, 0x323232
|
|
|
|
stdcall outtextxy, 10, 100, ctrl_key_names, 0, 0
|
|
|
|
;stdcall draw_button, 7,WIN_H-30,80,20,2,C_KEYCOLOR,AddKeyText, 0,C_TEXTCOLOR ; Add Hot key.
|
|
|
|
end_draw_window
|
|
|
|
mov byte [it_alive], 1
|
2011-01-30 16:54:21 +01:00
|
|
|
ret
|
|
|
|
|
|
|
|
;######################## Input Thread code end ##########################
|
|
|
|
|
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
; Read configuration file
|
|
|
|
ReadIni:
|
|
|
|
; Get path
|
|
|
|
mov edi, ini_path
|
|
|
|
mov esi, app_path
|
|
|
|
call strlen
|
|
|
|
|
|
|
|
.get_path:
|
|
|
|
cmp byte [app_path+ecx-1], '/'
|
|
|
|
je @f
|
|
|
|
loop .get_path
|
|
|
|
@@:
|
|
|
|
call strncpy
|
|
|
|
mov byte [ini_path+ecx], 0
|
|
|
|
mov esi, aIni
|
|
|
|
call strlen
|
|
|
|
call strncat
|
|
|
|
|
|
|
|
; Get hotkey number
|
|
|
|
invoke ini_get_int, ini_path, aMain, aKeynum, 0
|
|
|
|
|
|
|
|
and eax, 0xFF
|
|
|
|
test al, al
|
|
|
|
jz .end
|
|
|
|
cmp al, MAX_HOTKEYS_NUM
|
|
|
|
jle @f
|
|
|
|
mov al, MAX_HOTKEYS_NUM
|
|
|
|
@@:
|
|
|
|
mov byte [hotkeys_num], al
|
|
|
|
|
|
|
|
mov ecx, eax
|
|
|
|
xor eax, eax
|
|
|
|
.get_next_hotkey_values:
|
|
|
|
call set_next_hotkey_section_name
|
|
|
|
; Get hotkey name
|
|
|
|
mov edi, eax
|
|
|
|
shl edi, 5 ; edi=eax*32
|
|
|
|
add edi, dword Hotkeys
|
|
|
|
push eax ecx
|
|
|
|
invoke ini_get_str, ini_path, aHotkey, aName, edi, 32, 0
|
|
|
|
pop ecx eax
|
|
|
|
; Get hotkey code
|
|
|
|
mov edi, eax
|
|
|
|
shl edi, 2 ; edi=eax*4
|
|
|
|
add edi, dword Hotkeys.codes
|
|
|
|
push eax ecx edx
|
|
|
|
invoke ini_get_int, ini_path, aHotkey, aKeycode, 0
|
|
|
|
mov dword [it_hotkey_addr], edi
|
|
|
|
stosd
|
|
|
|
; set hotkey
|
|
|
|
call reset_modifiers
|
|
|
|
pop edx ecx eax
|
|
|
|
; Get hotkey code_name
|
|
|
|
mov edi, eax
|
|
|
|
shl edi, 6 ; edi=eax*64
|
|
|
|
add edi, dword Hotkeys.code_names
|
|
|
|
push eax ecx
|
|
|
|
invoke ini_get_str, ini_path, aHotkey, aKeycodeName, edi, 64, 0
|
|
|
|
pop ecx eax
|
|
|
|
; Get hotkey path and param
|
|
|
|
push eax ecx
|
|
|
|
mov cl, byte PATH_MAX_CHARS
|
|
|
|
mul cl
|
|
|
|
mov edi, eax
|
|
|
|
push edi
|
|
|
|
add edi, dword [buf_cmd_line]
|
|
|
|
invoke ini_get_str, ini_path, aHotkey, aPath, edi, 32, 0
|
|
|
|
pop edi
|
|
|
|
add edi, dword [buf_cmd_params]
|
|
|
|
invoke ini_get_str, ini_path, aHotkey, aParam, edi, 32, 0
|
|
|
|
pop ecx eax
|
|
|
|
|
|
|
|
inc al
|
|
|
|
dec ecx
|
|
|
|
test ecx, ecx
|
|
|
|
jnz .get_next_hotkey_values
|
|
|
|
.end:
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
; Write configuration file
|
|
|
|
WriteIni:
|
|
|
|
mov edi, ini_path
|
|
|
|
; Set hotkey number
|
|
|
|
movzx ecx, byte [hotkeys_num]
|
|
|
|
invoke ini_set_int, ini_path, aMain, aKeynum, ecx
|
|
|
|
|
|
|
|
xor eax, eax
|
|
|
|
.get_next_hotkey_values:
|
|
|
|
call set_next_hotkey_section_name
|
|
|
|
; Set hotkey name
|
|
|
|
push eax ecx
|
|
|
|
mov esi, eax
|
|
|
|
shl esi, 5 ; edi=eax*32
|
|
|
|
add esi, dword Hotkeys
|
|
|
|
call strlen
|
|
|
|
invoke ini_set_str, ini_path, aHotkey, aName, esi, ecx
|
|
|
|
pop ecx eax
|
|
|
|
; Set hotkey code
|
|
|
|
mov esi, eax
|
|
|
|
shl esi, 2 ; edi=eax*4
|
|
|
|
add esi, dword Hotkeys.codes
|
|
|
|
push eax ecx edx
|
|
|
|
invoke ini_set_int, ini_path, aHotkey, aKeycode, dword [esi]
|
|
|
|
pop edx ecx eax
|
|
|
|
; Set hotkey code_name
|
|
|
|
mov esi, eax
|
|
|
|
shl esi, 6 ; edi=eax*64
|
|
|
|
add esi, dword Hotkeys.code_names
|
|
|
|
push eax ecx
|
|
|
|
call strlen
|
|
|
|
invoke ini_set_str, ini_path, aHotkey, aKeycodeName, esi, ecx
|
|
|
|
pop ecx eax
|
|
|
|
; Set hotkey path and param
|
|
|
|
push eax ecx
|
|
|
|
;inc al
|
|
|
|
mov cl, byte PATH_MAX_CHARS
|
|
|
|
mul cl
|
|
|
|
mov esi, eax
|
|
|
|
push esi
|
|
|
|
add esi, dword [buf_cmd_line]
|
|
|
|
call strlen
|
|
|
|
invoke ini_set_str, ini_path, aHotkey, aPath, esi, ecx
|
|
|
|
pop esi
|
|
|
|
add esi, dword [buf_cmd_params]
|
|
|
|
call strlen
|
|
|
|
invoke ini_set_str, ini_path, aHotkey, aParam, esi, ecx
|
|
|
|
pop ecx eax
|
|
|
|
|
|
|
|
inc al
|
|
|
|
dec ecx
|
|
|
|
test ecx, ecx
|
|
|
|
jnz .get_next_hotkey_values
|
|
|
|
.end:
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
set_next_hotkey_section_name: ;(eax - num)
|
|
|
|
; this code mainly from debug.inc
|
|
|
|
push eax ecx edi
|
|
|
|
mov edi, aHotkey
|
|
|
|
add edi, 6 ; + strlen("hotkey")
|
|
|
|
mov ecx, 10
|
|
|
|
push -'0'
|
|
|
|
.l0:
|
|
|
|
xor edx, edx
|
|
|
|
div ecx
|
|
|
|
push edx
|
|
|
|
test eax, eax
|
|
|
|
jnz .l0
|
|
|
|
.l1:
|
|
|
|
pop eax
|
|
|
|
add al, '0'
|
|
|
|
;call debug_outchar
|
|
|
|
stosb
|
|
|
|
jnz .l1
|
|
|
|
pop edi ecx eax
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
;****************************************
|
|
|
|
;* input: esi = pointer to keymap *
|
|
|
|
;* ah = scan code *
|
|
|
|
;* output: ah = ascii code *
|
|
|
|
;****************************************
|
2011-01-30 16:54:21 +01:00
|
|
|
Scan2ASCII:
|
|
|
|
push esi
|
|
|
|
shr eax, 8
|
|
|
|
add esi, eax
|
|
|
|
lodsb
|
|
|
|
shl eax, 8
|
|
|
|
pop esi
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;********************************************
|
|
|
|
;* input: esi = pointer to the file name *
|
|
|
|
;* edx = pointer to the parametrs *
|
|
|
|
;********************************************
|
|
|
|
|
|
|
|
RunProgram:
|
|
|
|
pusha
|
|
|
|
mov dword [InfoStructure], 7 ; run program
|
|
|
|
mov dword [InfoStructure+4], 0 ; flags
|
|
|
|
mov dword [InfoStructure+8], edx ; pointer to the parametrs
|
|
|
|
mov dword [InfoStructure+12], 0 ; reserved
|
|
|
|
mov dword [InfoStructure+16], 0 ; reserved
|
|
|
|
mov dword [InfoStructure+20], 0 ; reserved
|
|
|
|
mov dword [InfoStructure+21], esi ; pointer to the file name
|
2011-01-30 17:12:10 +01:00
|
|
|
mcall 70, InfoStructure
|
2011-01-30 16:54:21 +01:00
|
|
|
cmp eax, 0
|
|
|
|
jl .err_out
|
|
|
|
.out:
|
|
|
|
popa
|
|
|
|
clc
|
|
|
|
ret
|
|
|
|
.err_out:
|
2013-06-09 08:40:31 +02:00
|
|
|
if lang eq it
|
2013-10-05 07:22:55 +02:00
|
|
|
print "Impossibile caricare il programma"
|
2013-10-09 23:33:15 +02:00
|
|
|
;--------------------------------------
|
2013-06-09 08:40:31 +02:00
|
|
|
else
|
2013-10-05 07:22:55 +02:00
|
|
|
print "Can't load program"
|
2013-10-09 23:25:18 +02:00
|
|
|
|
2013-06-09 08:40:31 +02:00
|
|
|
end if
|
2011-01-30 16:54:21 +01:00
|
|
|
popa
|
|
|
|
stc
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
; DATA AREA
|
|
|
|
|
|
|
|
; Application Title
|
2011-01-30 17:12:10 +01:00
|
|
|
labelt db 'MyKey v.0.2'
|
2011-03-05 19:32:56 +01:00
|
|
|
mykey_window dd 0 ; Slot number of MyKey
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
|
|
|
|
;########### Input Thread data start ############
|
|
|
|
|
|
|
|
; Input Thread Title
|
2013-06-09 08:40:31 +02:00
|
|
|
if lang eq it
|
|
|
|
it_labelt db "Inserisci hotkey e nome "
|
2013-10-09 23:33:15 +02:00
|
|
|
;--------------------------------------
|
2013-06-09 08:40:31 +02:00
|
|
|
else
|
|
|
|
it_labelt db "Input hotkey and it's name"
|
2013-10-09 23:25:18 +02:00
|
|
|
|
2013-06-09 08:40:31 +02:00
|
|
|
end if
|
2011-01-30 16:54:21 +01:00
|
|
|
;labellen:
|
|
|
|
it_edit edit_box 180, 20, 30, 0xffffff, 0xAA80, 0x0000ff, 0x0, 0x0, 31, it_buf_cmd_line, 0, 0
|
2011-01-30 17:12:10 +01:00
|
|
|
it_buf_cmd_line dd 0 ;db MAX_HOTKEYS_NUM*32 dup(0) ; !Make it dynamic!!!
|
|
|
|
it_window dd 0 ; Slot number of the input thread
|
|
|
|
it_alive db 0 ; Flag of the input thread existance
|
2011-01-30 16:54:21 +01:00
|
|
|
it_keycode db 0
|
|
|
|
it_hotkey_addr dd 0
|
2013-06-09 08:40:31 +02:00
|
|
|
if lang eq it
|
|
|
|
it_hint db 'o premi Esc per cancellare',0
|
2013-10-09 23:33:15 +02:00
|
|
|
;--------------------------------------
|
2013-06-09 08:40:31 +02:00
|
|
|
else
|
|
|
|
it_hint db 'or press Esc to cancel',0
|
2013-10-09 23:25:18 +02:00
|
|
|
|
2013-06-09 08:40:31 +02:00
|
|
|
end if
|
2011-01-30 16:54:21 +01:00
|
|
|
;########### Input Thread data end ############
|
|
|
|
|
|
|
|
;Button names
|
2013-06-09 08:40:31 +02:00
|
|
|
if lang eq it
|
|
|
|
AddKeyText db 'Aggiungi',0
|
|
|
|
ReloadKeyText db 'Ricarica',0
|
|
|
|
SaveKeyText db 'Salva',0
|
|
|
|
;DeleteKeyText db 'Delete',0
|
|
|
|
;ManageKeyText db 'Manage',0
|
2013-10-09 23:33:15 +02:00
|
|
|
;--------------------------------------
|
2013-06-09 08:40:31 +02:00
|
|
|
else
|
|
|
|
AddKeyText db 'Add',0
|
|
|
|
ReloadKeyText db 'Reload',0
|
|
|
|
SaveKeyText db 'Save',0
|
|
|
|
;DeleteKeyText db 'Delete',0
|
|
|
|
;ManageKeyText db 'Manage',0
|
2013-10-09 23:25:18 +02:00
|
|
|
|
2013-06-09 08:40:31 +02:00
|
|
|
end if
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
hotkeys_num db 0;15
|
2011-03-05 19:32:56 +01:00
|
|
|
;keyboard_mode db 0 ; Scan or ASCII keys to send ? 0 - ASCII , 1 - Scan
|
2011-01-30 17:12:10 +01:00
|
|
|
butt db FIRST_ITEM_BUTTON_ID ; Pressed button ID
|
2011-01-30 16:54:21 +01:00
|
|
|
modifiers dd 0
|
|
|
|
|
|
|
|
;Data structures for loadlib.mac and editbox_ex.mac [
|
|
|
|
edit1 edit_box 350, 220, 30, 0xffffff, 0xAA80, 0x0000ff, 0x0, 0x0, PATH_MAX_CHARS+1, buf_cmd_line, 0, 0
|
|
|
|
edit2 edit_box 350, 220, 50, 0xffffff, 0xAA80, 0x0000ff, 0x0, 0x0, PATH_MAX_CHARS+1, buf_cmd_params, 0, 0
|
|
|
|
|
2011-03-05 19:32:56 +01:00
|
|
|
buf_cmd_line dd 0 ;db MAX_HOTKEYS_NUM*PATH_MAX_CHARS dup(0) ; !Make it dynamic!!!
|
|
|
|
buf_cmd_params dd 0 ;db MAX_HOTKEYS_NUM*PATH_MAX_CHARS dup(0) ; !Make it dynamic!!!
|
2011-01-30 16:54:21 +01:00
|
|
|
|
|
|
|
sys_path:
|
|
|
|
system_dir0 db '/sys/lib/'
|
|
|
|
boxlib_name db 'box_lib.obj',0
|
|
|
|
|
2013-06-09 08:40:31 +02:00
|
|
|
if lang eq it
|
|
|
|
err_message_found_lib db "Non trovo box_lib.obj",0
|
|
|
|
head_f_i:
|
|
|
|
head_f_l db 'Errore di sistema',0
|
|
|
|
err_message_import db 'Error di importazione di box_lib.obj',0
|
2013-10-09 23:33:15 +02:00
|
|
|
;--------------------------------------
|
2013-06-09 08:40:31 +02:00
|
|
|
else
|
|
|
|
err_message_found_lib db "Can't find box_lib.obj",0
|
|
|
|
head_f_i:
|
|
|
|
head_f_l db 'System error',0
|
|
|
|
err_message_import db 'Error on import box_lib.obj',0
|
2013-10-09 23:25:18 +02:00
|
|
|
|
2013-06-09 08:40:31 +02:00
|
|
|
end if
|
2011-01-30 16:54:21 +01:00
|
|
|
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
|
|
|
|
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
|
|
|
|
|
2011-01-30 17:12:10 +01:00
|
|
|
align 16
|
|
|
|
importTable:
|
|
|
|
library \
|
|
|
|
libini, 'libini.obj';, \
|
2011-03-05 19:32:56 +01:00
|
|
|
; boxlib, 'boxlib.obj', \
|
|
|
|
; libio, 'libio.obj', \
|
2011-01-30 17:12:10 +01:00
|
|
|
|
|
|
|
;import boxlib, \
|
|
|
|
;edit_box_draw , 'edit_box', \
|
|
|
|
;edit_box_key , 'edit_box_key', \
|
|
|
|
;edit_box_mouse , 'edit_box_mouse', \
|
|
|
|
;version_ed , 'version_ed'
|
|
|
|
|
|
|
|
|
|
|
|
import libini, \
|
|
|
|
ini_get_str ,'ini_get_str', \
|
|
|
|
ini_set_str ,'ini_set_str', \
|
|
|
|
ini_get_int ,'ini_get_int', \
|
|
|
|
ini_set_int ,'ini_set_int';, \
|
|
|
|
; ini_get_color,'ini_get_color', \
|
|
|
|
; ini_set_color,'ini_set_color'
|
|
|
|
|
|
|
|
|
2011-01-30 16:54:21 +01:00
|
|
|
;] Data structures for loadlib.mac and editbox_ex.mac
|
|
|
|
|
|
|
|
InfoStructure:
|
|
|
|
dd 0x0 ; subfunction number
|
|
|
|
dd 0x0 ; position in the file in bytes
|
|
|
|
dd 0x0 ; upper part of the position address
|
|
|
|
dd 0x0 ; number of bytes to read
|
|
|
|
dd 0x0 ; pointer to the buffer to write data
|
|
|
|
db 0
|
|
|
|
dd 0 ; pointer to the filename
|
|
|
|
|
|
|
|
|
|
|
|
I_END: ; End of application code and data marker
|
|
|
|
|
|
|
|
rb 300 ;input thread stack size
|
|
|
|
input_thread_stack_top:
|
|
|
|
|
|
|
|
ascii_keymap:
|
|
|
|
db 128 dup(?)
|
|
|
|
ctrl_key_names db 'LShift LCtrl LAlt RAlt RCtrl RShift',0
|
2011-01-30 17:12:10 +01:00
|
|
|
aPlus db ' + ',0
|
2013-10-26 00:44:35 +02:00
|
|
|
aIni db 'settings/mykey.ini',0
|
2011-01-30 17:12:10 +01:00
|
|
|
aMain db 'main',0
|
|
|
|
aKeynum db 'keynum',0
|
|
|
|
aHotkey db 'hotkey',0,0,0
|
|
|
|
aName db 'name',0
|
|
|
|
aKeycode db 'keycode',0
|
|
|
|
aKeycodeName db 'keycode_name',0
|
|
|
|
aPath db 'path',0
|
|
|
|
aParam db 'param',0
|
|
|
|
aRamSaver db '/sys/rdsave',0
|
|
|
|
|
|
|
|
app_path rb 255
|
|
|
|
ini_path rb 255
|
|
|
|
|
2011-03-05 19:32:56 +01:00
|
|
|
Hotkeys: ;(name = 32 b) + (modifiers = 3 b) + (keycode = 1 b) = 36 byte for 1 hotkey
|
2011-01-30 16:54:21 +01:00
|
|
|
.names:
|
2011-01-30 17:12:10 +01:00
|
|
|
db 'My1',0
|
|
|
|
rb 28
|
|
|
|
db 'My2',0
|
|
|
|
rb 28
|
|
|
|
db 'My3',0
|
|
|
|
rb 28
|
2011-01-30 16:54:21 +01:00
|
|
|
rb MAX_HOTKEYS_NUM*32-3
|
|
|
|
.codes:
|
|
|
|
dd MAX_HOTKEYS_NUM dup (0)
|
2011-01-30 17:12:10 +01:00
|
|
|
.code_names:
|
|
|
|
rb MAX_HOTKEYS_NUM*64
|
|
|
|
|
|
|
|
it_ascii_keymap:
|