forked from KolibriOS/kolibrios
software_widget: ability to use keyboard
other apps small update git-svn-id: svn://kolibrios.org@7493 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
b3decd834b
commit
98a4aa1070
@ -19,12 +19,12 @@
|
|||||||
// //
|
// //
|
||||||
//===================================================//
|
//===================================================//
|
||||||
|
|
||||||
?define WINDOW_HEADER "Clipboard Viewer v1.02"
|
?define WINDOW_HEADER "Clipboard Viewer v1.03"
|
||||||
?define T_DELETE_LAST_SLOT "Delete last slot"
|
?define T_DELETE_LAST_SLOT "Delete last slot"
|
||||||
?define T_DELETE_ALL_SLOTS "Delete all slots"
|
?define T_DELETE_ALL_SLOTS "Delete all slots"
|
||||||
?define T_RESET_BUFFER_LOCK "Reset the lock buffer"
|
?define T_RESET_BUFFER_LOCK "Reset the lock buffer"
|
||||||
?define T_COLUMNS_TITLE "# | Data size | Data type | Contents"
|
?define T_COLUMNS_TITLE "# | Data size | Data type | Contents"
|
||||||
?define T_COLUMN_VIEW "View"
|
?define T_COLUMN_VIEW "| View"
|
||||||
?define T_VIEW_OPTIONS "TEXT HEX"
|
?define T_VIEW_OPTIONS "TEXT HEX"
|
||||||
?define DEFAULT_SAVE_PATH "/tmp0/1/clipview.tmp"
|
?define DEFAULT_SAVE_PATH "/tmp0/1/clipview.tmp"
|
||||||
char *data_type[] = { "Text", "Image", "RAW", "Unknown" };
|
char *data_type[] = { "Text", "Image", "RAW", "Unknown" };
|
||||||
@ -110,7 +110,7 @@ void DrawWindowContent()
|
|||||||
button_x += DrawStandartCaptButton(button_x, select_list.y + select_list.h + 8, BT_DELETE_ALL_SLOTS, T_DELETE_ALL_SLOTS);
|
button_x += DrawStandartCaptButton(button_x, select_list.y + select_list.h + 8, BT_DELETE_ALL_SLOTS, T_DELETE_ALL_SLOTS);
|
||||||
button_x += DrawStandartCaptButton(button_x, select_list.y + select_list.h + 8, BT_UNLOCK, T_RESET_BUFFER_LOCK);
|
button_x += DrawStandartCaptButton(button_x, select_list.y + select_list.h + 8, BT_UNLOCK, T_RESET_BUFFER_LOCK);
|
||||||
WriteText(select_list.x+12, select_list.y - 23, select_list.font_type, system.color.work_text, T_COLUMNS_TITLE);
|
WriteText(select_list.x+12, select_list.y - 23, select_list.font_type, system.color.work_text, T_COLUMNS_TITLE);
|
||||||
WriteText(select_list.x+select_list.w-68, select_list.y - 23, select_list.font_type, system.color.work_text, T_COLUMN_VIEW);
|
WriteText(select_list.x+select_list.w - 88-14, select_list.y - 23, select_list.font_type, system.color.work_text, T_COLUMN_VIEW);
|
||||||
ClipViewSelectListDraw();
|
ClipViewSelectListDraw();
|
||||||
SelectList_DrawBorder();
|
SelectList_DrawBorder();
|
||||||
}
|
}
|
||||||
@ -131,6 +131,8 @@ void SelectList_DrawLine(dword i)
|
|||||||
dword line_text[2048];
|
dword line_text[2048];
|
||||||
dword size_kb;
|
dword size_kb;
|
||||||
dword text_color = 0;
|
dword text_color = 0;
|
||||||
|
dword bgcol = 0xFFFfff;
|
||||||
|
if (i%2) bgcol = 0xF1F1F1;
|
||||||
|
|
||||||
slot_data = Clipboard__GetSlotData(select_list.first + i);
|
slot_data = Clipboard__GetSlotData(select_list.first + i);
|
||||||
cdata.size = ESDWORD[slot_data];
|
cdata.size = ESDWORD[slot_data];
|
||||||
@ -142,6 +144,7 @@ void SelectList_DrawLine(dword i)
|
|||||||
cdata.content = slot_data + cdata.content_offset;
|
cdata.content = slot_data + cdata.content_offset;
|
||||||
|
|
||||||
yyy = i*select_list.item_h+select_list.y;
|
yyy = i*select_list.item_h+select_list.y;
|
||||||
|
DrawBar(select_list.x+1, yyy, select_list.w-1, select_list.item_h, bgcol);
|
||||||
WriteText(select_list.x+12, yyy+select_list.text_y, select_list.font_type, text_color, itoa(select_list.first + i));
|
WriteText(select_list.x+12, yyy+select_list.text_y, select_list.font_type, text_color, itoa(select_list.first + i));
|
||||||
size_kb = ConvertSizeToKb(cdata.size);
|
size_kb = ConvertSizeToKb(cdata.size);
|
||||||
WriteText(select_list.x+44, yyy+select_list.text_y, select_list.font_type, text_color, size_kb);
|
WriteText(select_list.x+44, yyy+select_list.text_y, select_list.font_type, text_color, size_kb);
|
||||||
|
@ -33,6 +33,8 @@ char window_title[128],
|
|||||||
|
|
||||||
#define LIST_BACKGROUND_COLOR 0xF3F3F3
|
#define LIST_BACKGROUND_COLOR 0xF3F3F3
|
||||||
|
|
||||||
|
block ipos[128];
|
||||||
|
|
||||||
void load_config()
|
void load_config()
|
||||||
{
|
{
|
||||||
ini_get_str stdcall (#settings_ini_path, "Config", "window_title", #window_title, sizeof(window_title), "Software widget");
|
ini_get_str stdcall (#settings_ini_path, "Config", "window_title", #window_title, sizeof(window_title), "Software widget");
|
||||||
@ -78,10 +80,13 @@ void main()
|
|||||||
|
|
||||||
loop() switch(WaitEvent())
|
loop() switch(WaitEvent())
|
||||||
{
|
{
|
||||||
// case evKey:
|
case evKey:
|
||||||
// GetKeys();
|
GetKeys();
|
||||||
// if (list.ProcessKey(key_scancode)) DrawList();
|
if (SCAN_CODE_LEFT == key_scancode) key_scancode = SCAN_CODE_UP;
|
||||||
// break;
|
if (SCAN_CODE_RIGHT == key_scancode) key_scancode = SCAN_CODE_DOWN;
|
||||||
|
if (list.ProcessKey(key_scancode)) DrawSelection();
|
||||||
|
if (SCAN_CODE_ENTER == key_scancode) EventRunApp(list.cur_y);
|
||||||
|
break;
|
||||||
|
|
||||||
case evButton:
|
case evButton:
|
||||||
id=GetButtonID();
|
id=GetButtonID();
|
||||||
@ -97,6 +102,8 @@ void main()
|
|||||||
draw_top_bar();
|
draw_top_bar();
|
||||||
DrawList();
|
DrawList();
|
||||||
DrawBar(0, row +1 * list.item_h + list_pos, Form.cwidth, -row - 1 * list.item_h - list_pos + Form.cheight, LIST_BACKGROUND_COLOR);
|
DrawBar(0, row +1 * list.item_h + list_pos, Form.cwidth, -row - 1 * list.item_h - list_pos + Form.cheight, LIST_BACKGROUND_COLOR);
|
||||||
|
//if (list.cur_y == list.count)
|
||||||
|
DrawSelection();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,6 +123,7 @@ byte draw_icons_from_section(dword key_value, key_name, sec_name, f_name)
|
|||||||
int tmp,
|
int tmp,
|
||||||
icon_id,
|
icon_id,
|
||||||
icon_char_pos;
|
icon_char_pos;
|
||||||
|
int text_w;
|
||||||
|
|
||||||
//do not show items located in /kolibrios/ if this directory not mounted
|
//do not show items located in /kolibrios/ if this directory not mounted
|
||||||
if (!strncmp(key_value, "/kolibrios/", 11)) || (!strncmp(key_value, "/k/", 3))
|
if (!strncmp(key_value, "/kolibrios/", 11)) || (!strncmp(key_value, "/k/", 3))
|
||||||
@ -136,8 +144,10 @@ byte draw_icons_from_section(dword key_value, key_name, sec_name, f_name)
|
|||||||
if (icon_char_pos) ESBYTE[icon_char_pos] = '\0'; //delete icon from string
|
if (icon_char_pos) ESBYTE[icon_char_pos] = '\0'; //delete icon from string
|
||||||
app_path_collection.add(key_value);
|
app_path_collection.add(key_value);
|
||||||
//kfont.WriteIntoWindowCenter(col*list.item_w+7,row*list.item_h+47 + list_pos, list.item_w,0, LIST_BACKGROUND_COLOR, 0xDCDCDC, 12, key_name);
|
//kfont.WriteIntoWindowCenter(col*list.item_w+7,row*list.item_h+47 + list_pos, list.item_w,0, LIST_BACKGROUND_COLOR, 0xDCDCDC, 12, key_name);
|
||||||
kfont.WriteIntoWindowCenter(col*list.item_w+5,row*list.item_h+46 + list_pos, list.item_w,0, LIST_BACKGROUND_COLOR, 0x000000, 12, key_name);
|
text_w = kfont.WriteIntoWindowCenter(col*list.item_w+5,row*list.item_h+46 + list_pos, list.item_w,0, LIST_BACKGROUND_COLOR, 0x000000, 12, key_name);
|
||||||
if (list.cur_y == list.count) DrawWideRectangle(col*list.item_w+6, row*list.item_h + list_pos,list.item_w,list.item_h-5, 2, 0x0080FF);
|
ipos[list.count].x = list.item_w-text_w/2+calc(col*list.item_w)+5;
|
||||||
|
ipos[list.count].y = row*list.item_h+46 + list_pos + 16;
|
||||||
|
ipos[list.count].w = text_w;
|
||||||
list.count++;
|
list.count++;
|
||||||
col++;
|
col++;
|
||||||
return true;
|
return true;
|
||||||
@ -211,9 +221,17 @@ void EventRunApp(dword appid)
|
|||||||
{
|
{
|
||||||
notify("'Application not found' -E");
|
notify("'Application not found' -E");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawSelection()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
dword col;
|
||||||
|
for (i=0; i<list.count; i++) {
|
||||||
|
if (i==list.cur_y) col=0x0080FF; else col=LIST_BACKGROUND_COLOR;
|
||||||
|
DrawBar(ipos[i].x, ipos[i].y, ipos[i].w+2, 3, col);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
stop:
|
stop:
|
||||||
|
@ -4,7 +4,7 @@ void LoadIniSettings()
|
|||||||
{
|
{
|
||||||
kfont.size.pt = ini.GetInt("FontSize", 14);
|
kfont.size.pt = ini.GetInt("FontSize", 14);
|
||||||
encoding = ini.GetInt("Encoding", CH_CP866);
|
encoding = ini.GetInt("Encoding", CH_CP866);
|
||||||
curcol_scheme = ini.GetInt("ColorScheme", 1);
|
curcol_scheme = ini.GetInt("ColorScheme", 2);
|
||||||
Form.left = ini.GetInt("WinX", 150);
|
Form.left = ini.GetInt("WinX", 150);
|
||||||
Form.top = ini.GetInt("WinY", 50);
|
Form.top = ini.GetInt("WinY", 50);
|
||||||
Form.width = ini.GetInt("WinW", 640);
|
Form.width = ini.GetInt("WinW", 640);
|
||||||
|
@ -49,10 +49,9 @@ Press any key..."
|
|||||||
dword color_schemes[] = {
|
dword color_schemes[] = {
|
||||||
0xFFFfff, 0,
|
0xFFFfff, 0,
|
||||||
0xF0F0F0, 0,
|
0xF0F0F0, 0,
|
||||||
0xE9E5DA, 0,
|
|
||||||
0xF0F0C7, 0,
|
|
||||||
0xFCF0DA, 0x171501,
|
|
||||||
0xFDF6E3, 0x101A21,
|
0xFDF6E3, 0x101A21,
|
||||||
|
0xFCF0DA, 0x171501,
|
||||||
|
0xF0F0C7, 0,
|
||||||
0x282C34, 0xABB2BF,
|
0x282C34, 0xABB2BF,
|
||||||
0x282923, 0xD8D8D2
|
0x282923, 0xD8D8D2
|
||||||
};
|
};
|
||||||
@ -60,10 +59,9 @@ dword color_schemes[] = {
|
|||||||
char color_scheme_names[] =
|
char color_scheme_names[] =
|
||||||
"White & Black
|
"White & Black
|
||||||
Grey & Black RtfRead
|
Grey & Black RtfRead
|
||||||
Khaki & Black QNX
|
|
||||||
Lemon & Black Fb2Read
|
|
||||||
Antique & Black Pocket
|
|
||||||
Linen & Black Horst
|
Linen & Black Horst
|
||||||
|
Antique & Black Pocket
|
||||||
|
Lemon & Black Fb2Read
|
||||||
DarkGrey & Grey Godot
|
DarkGrey & Grey Godot
|
||||||
DarkGrey & Grey Monokai";
|
DarkGrey & Grey Monokai";
|
||||||
|
|
||||||
|
@ -61,7 +61,9 @@ void kos_Main()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EM_BUTTON_CLICK: // button pressed; we have only one button, close
|
case EM_BUTTON_CLICK: // button pressed; we have only one button, close
|
||||||
OnExit();
|
if (kos_GetButtonID(btn_id)) {
|
||||||
|
if (btn_id == 1) OnExit();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case EM_MOUSE_EVENT: // ñîáûòèå îò ìûøè (íàæàòèå íà êíîïêó ìûøè èëè ïåðåìåùåíèå; ñáðàñûâàåòñÿ ïðè ïðî÷òåíèè)
|
case EM_MOUSE_EVENT: // ñîáûòèå îò ìûøè (íàæàòèå íà êíîïêó ìûøè èëè ïåðåìåùåíèå; ñáðàñûâàåòñÿ ïðè ïðî÷òåíèè)
|
||||||
OnMouseMove();
|
OnMouseMove();
|
||||||
@ -70,8 +72,7 @@ void kos_Main()
|
|||||||
OnLMBClick();
|
OnLMBClick();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
default:
|
||||||
if (kos_GetButtonID(btn_id)) OnExit();
|
|
||||||
DrawBombs();
|
DrawBombs();
|
||||||
DrawRocketsAndCrosses();
|
DrawRocketsAndCrosses();
|
||||||
DrawExplodes();
|
DrawExplodes();
|
||||||
@ -86,6 +87,7 @@ void kos_Main()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DrawWindow()
|
void DrawWindow()
|
||||||
{
|
{
|
||||||
@ -373,7 +375,7 @@ void OnExit()
|
|||||||
{
|
{
|
||||||
kos_WriteTextToWindow(WINDOW_WIDTH / 2 - 35, WINDOW_HEIGHT / 2 - 10, 0, TEXT_COLOR, "Game Over", 9);
|
kos_WriteTextToWindow(WINDOW_WIDTH / 2 - 35, WINDOW_HEIGHT / 2 - 10, 0, TEXT_COLOR, "Game Over", 9);
|
||||||
|
|
||||||
kos_Pause(200);
|
kos_Pause(150);
|
||||||
|
|
||||||
kos_ExitApp();
|
kos_ExitApp();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user