CMM: GetKeys() function

git-svn-id: svn://kolibrios.org@5706 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2015-08-10 10:47:21 +00:00
parent 070569f1e1
commit b24c17580f
5 changed files with 56 additions and 79 deletions

View File

@ -112,8 +112,6 @@ menu_data menudata1 = {0, 40, 2, 15, 2, #menu_text_area1.menu, #menu_text_area1.
void main()
{
int id;
word key_ascii, key_scancode;
dword status_key;
strcpy(#filter2.ext1, "TXT");
//strcpy(#filter2.ext2, "ASM");
@ -185,13 +183,9 @@ void main()
case evKey:
if (Form.status_window>2) break;
GetFullKey();
key_ascii = AH;
$shr eax,16
key_scancode = AL;
status_key = GetStatusKey();
GetKeys();
if (tview.ProcessKey(key_scancode)) DrawText();
if (TestBit(status_key, 2))
if (TestBit(key_modifier, 2))
{
switch(key_scancode)
{

View File

@ -146,8 +146,6 @@ OpenFile()
void main()
{
int id, mouse_clicked;
word key_ascii, key_scancode;
dword status_key;
SetEventMask(0x27);
load_dll(boxlib, #box_lib_init,0);
@ -195,11 +193,7 @@ void main()
break;
case evKey:
GetFullKey();
key_ascii = AH;
$shr eax,16
key_scancode = AL;
status_key = GetStatusKey();
GetKeys();
if (list[SKINS].active) && (list[SKINS].ProcessKey(key_scancode)) Apply();
if (list[WALLPAPERS].active) && (list[WALLPAPERS].ProcessKey(key_scancode)) Apply();
IF (key_scancode==SCAN_CODE_ENTER) OpenFile();

View File

@ -105,8 +105,7 @@ byte cmd_free=0;
void main()
{
word key, key2, id;
dword status_key;
word id;
char can_show, can_select, stats;
dword selected_offset;
dword IPC_LEN,IPC_ID;
@ -330,44 +329,40 @@ void main()
break;
//Key pressed-----------------------------------------------------------------------------
case evKey:
GetFullKey();
key = AH;
$shr eax,16
key2 = AL;
status_key = GetStatusKey();
GetKeys();
if (Form.status_window>2) break;
if (del_active)
{
if (key2 == SCAN_CODE_ENTER) Del_File(true);
if (key2 == SCAN_CODE_ESC) Del_File(false);
if (key_scancode == SCAN_CODE_ENTER) Del_File(true);
if (key_scancode == SCAN_CODE_ESC) Del_File(false);
break;
}
if (new_element_active)
{
if (key2 == SCAN_CODE_ESC) NewElement(0);
if (key2 == SCAN_CODE_ENTER) NewElement(1);
EAX=key<<8;
if (key_scancode == SCAN_CODE_ESC) NewElement(0);
if (key_scancode == SCAN_CODE_ENTER) NewElement(1);
EAX= key_ascii << 8;
edit_box_key stdcall (#new_file_ed);
break;
}
if (files.ProcessKey(key2))
if (files.ProcessKey(key_scancode))
{
List_ReDraw();
break;
}
if (TestBit(status_key, 2))
if (TestBit(key_modifier, 2))
{
switch(key2)
switch(key_scancode)
{
case 059...068:
key2 -= 59;
if (key2<disc_num)
key_scancode -= 59;
if (key_scancode<disc_num)
{
DrawRectangle(17,key2*16+74,159,16, 0); //display click
DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click
pause(7);
ClickOnDisk(key2);
ClickOnDisk(key_scancode);
}
break;
case 45: //Ctrl+X
@ -415,7 +410,7 @@ void main()
break;
}
switch (key2)
switch (key_scancode)
{
case 041:
two_panels ^= 1;
@ -453,13 +448,13 @@ void main()
if (files.KeyDown()) List_ReDraw();
break;
case 059...068: //F1-F10
FnProcess(key2-58);
FnProcess(key_scancode-58);
break;
default:
for (i=files.current+1; i<files.count; i++)
{
strcpy(#temp, file_mas[i]*304+buf+72);
if (temp[0]==key) || (temp[0]==key-32)
if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
{
files.current = i - 1;
files.KeyDown();

View File

@ -84,6 +84,41 @@ char program_path[4096];
#define SCAN_CODE_PGDN 081
#define SCAN_CODE_PGUP 073
inline fastcall word GetKey() //+Gluk fix
{
$push edx
GETKEY:
$mov eax,2
$int 0x40
$cmp eax,1
$jne GETKEYI
$mov ah,dh
$jmp GETKEYII //jz?
GETKEYI:
$mov dh,ah
$jmp GETKEY
GETKEYII:
$pop edx
$shr eax,8
}
unsigned char key_ascii;
dword key_scancode, key_modifier;
int GetKeys()
{
$mov eax,2
$int 0x40
key_ascii = AH;
$shr eax,16
key_scancode = AL;
//get alt/shift/ctrl key status
$mov eax,66
$mov ebx,3
$int 0x40
key_modifier = EAX;
}
//allow event mask
#define EVENT_MASK_REDRAW 000000001b
#define EVENT_MASK_KEYBOARD 000000010b
@ -141,43 +176,6 @@ inline fastcall SetEventMask(EBX)
$int 0x40
}
inline fastcall ScancodesGeting(){
$mov eax,66
$mov ebx,1
$mov ecx,1 //᪠­ª®¤ë
$int 0x40
}
inline fastcall GetStatusKey(){
$mov eax,66
$mov ebx,3
$int 0x40
}
inline fastcall word GetKey() //+Gluk fix
{
$push edx
GETKEY:
$mov eax,2
$int 0x40
$cmp eax,1
$jne GETKEYI
$mov ah,dh
$jmp GETKEYII //jz?
GETKEYI:
$mov dh,ah
$jmp GETKEY
GETKEYII:
$pop edx
$shr eax,8
}
inline fastcall int GetFullKey()
{
$mov eax,2
$int 0x40
}
inline fastcall pause(EBX)
{

View File

@ -74,7 +74,6 @@ char work_folder[4096],
void main()
{
int id;
word key_ascii, key_scancode;
byte mouse_clicked;
dword tmp_x,tmp_y;
@ -231,10 +230,7 @@ void main()
break;
case evKey:
GetFullKey();
key_ascii = AH;
$shr eax,16
key_scancode = AL;
GetKeys();
if (key_scancode==003) SetColorThemeLight();
if (key_scancode==004) SetColorThemeDark();