forked from KolibriOS/kolibrios
txtread: add show file properties button,
cmm gui EditBox: 1px smaller border git-svn-id: svn://kolibrios.org@7218 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
c559c585db
commit
1d22e52024
@ -191,10 +191,9 @@
|
|||||||
if (ESI.edit_box.flags & 100000000000b) bg = 0xCACACA; else bg = 0xFFFfff;
|
if (ESI.edit_box.flags & 100000000000b) bg = 0xCACACA; else bg = 0xFFFfff;
|
||||||
edit_box_draw stdcall (edit_box_pointer);
|
edit_box_draw stdcall (edit_box_pointer);
|
||||||
h = 22;
|
h = 22;
|
||||||
DrawRectangle(x-1, y-1, w+1, h+1, bg);
|
DrawRectangle3D(x-1, y-1, w+1, h+1, 0xE7E7E7, bg);
|
||||||
DrawRectangle3D(x-2, y-2, w+3, h+3, 0xDDDddd, bg);
|
DrawRectangle(x-2, y-2, w+3, h+3, system.color.work_graph);
|
||||||
DrawRectangle(x-3, y-3, w+5, h+5, system.color.work_graph);
|
DrawRectangle3D(x-3, y-3, w+5, h+5, system.color.work_dark, system.color.work_light);
|
||||||
DrawRectangle3D(x-4, y-4, w+7, h+7, system.color.work_dark, system.color.work_light);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:void DrawProgressBar(dword st_x, st_y, st_w, st_h, col_fon, col_border, col_fill, col_text, progress_percent)
|
:void DrawProgressBar(dword st_x, st_y, st_w, st_h, col_fon, col_border, col_fill, col_text, progress_percent)
|
||||||
|
@ -40,7 +40,10 @@
|
|||||||
#define SCAN_CODE_MINUS 012
|
#define SCAN_CODE_MINUS 012
|
||||||
#define SCAN_CODE_PLUS 013
|
#define SCAN_CODE_PLUS 013
|
||||||
|
|
||||||
|
#define SCAN_CODE_F1 059
|
||||||
|
|
||||||
#define SCAN_CODE_KEY_C 046
|
#define SCAN_CODE_KEY_C 046
|
||||||
|
#define SCAN_CODE_KEY_E 018
|
||||||
#define SCAN_CODE_KEY_F 033
|
#define SCAN_CODE_KEY_F 033
|
||||||
#define SCAN_CODE_KEY_I 023
|
#define SCAN_CODE_KEY_I 023
|
||||||
#define SCAN_CODE_KEY_L 038
|
#define SCAN_CODE_KEY_L 038
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
void DrawToolbarButton(char image_id, int x)
|
void DrawToolbarButton(char image_id, int x)
|
||||||
{
|
{
|
||||||
DefineButton(x+1, 7, TOOLBAR_ICON_WIDTH-2, TOOLBAR_ICON_HEIGHT-2, 10+image_id + BT_HIDE, 0);
|
DefineButton(x+1, 6, TOOLBAR_ICON_WIDTH-2, TOOLBAR_ICON_HEIGHT-2, 10+image_id + BT_HIDE, 0);
|
||||||
img_draw stdcall(skin.image, x, 6, TOOLBAR_ICON_WIDTH, TOOLBAR_ICON_HEIGHT, 0, image_id*TOOLBAR_ICON_HEIGHT);
|
img_draw stdcall(skin.image, x, 5, TOOLBAR_ICON_WIDTH, TOOLBAR_ICON_HEIGHT, 0, image_id*TOOLBAR_ICON_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 566 B After Width: | Height: | Size: 576 B |
@ -19,12 +19,13 @@
|
|||||||
#define DEFAULT_EDITOR "/sys/tinypad"
|
#define DEFAULT_EDITOR "/sys/tinypad"
|
||||||
|
|
||||||
#define INTRO_TEXT "This is a plain Text Reader.\nTry to open some text file."
|
#define INTRO_TEXT "This is a plain Text Reader.\nTry to open some text file."
|
||||||
#define VERSION "Text Reader v1.2"
|
#define VERSION "Text Reader v1.21"
|
||||||
#define ABOUT "Idea: Leency, punk_joker
|
#define ABOUT "Idea: Leency, punk_joker
|
||||||
Code: Leency, Veliant, KolibriOS Team
|
Code: Leency, Veliant, KolibriOS Team
|
||||||
|
|
||||||
Hotkeys:
|
Hotkeys:
|
||||||
Ctrl+O - open file
|
Ctrl+O - open file
|
||||||
|
Ctrl+I - show file properties
|
||||||
Ctrl+Up - bigger font
|
Ctrl+Up - bigger font
|
||||||
Ctrl+Down - smaller font
|
Ctrl+Down - smaller font
|
||||||
Ctrl+Tab - select charset
|
Ctrl+Tab - select charset
|
||||||
@ -41,7 +42,8 @@ llist list;
|
|||||||
proc_info Form;
|
proc_info Form;
|
||||||
char title[4196];
|
char title[4196];
|
||||||
|
|
||||||
byte help_opened = false;
|
bool help_opened = false;
|
||||||
|
int charsets_menu_left = 0;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
OPEN_FILE,
|
OPEN_FILE,
|
||||||
@ -50,6 +52,7 @@ enum {
|
|||||||
CHANGE_ENCODING,
|
CHANGE_ENCODING,
|
||||||
RUN_EDIT,
|
RUN_EDIT,
|
||||||
SHOW_INFO,
|
SHOW_INFO,
|
||||||
|
SHOW_FILE_PROPERTIES
|
||||||
};
|
};
|
||||||
|
|
||||||
int encoding;
|
int encoding;
|
||||||
@ -120,6 +123,9 @@ void HandleButtonEvent()
|
|||||||
case OPEN_FILE:
|
case OPEN_FILE:
|
||||||
EventOpenFile();
|
EventOpenFile();
|
||||||
break;
|
break;
|
||||||
|
case SHOW_FILE_PROPERTIES:
|
||||||
|
EventShowFileProperties();
|
||||||
|
break;
|
||||||
case MAGNIFY_PLUS:
|
case MAGNIFY_PLUS:
|
||||||
EventMagnifyPlus();
|
EventMagnifyPlus();
|
||||||
break;
|
break;
|
||||||
@ -147,23 +153,26 @@ void HandleKeyEvent()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GetKeys();
|
GetKeys();
|
||||||
if (key_scancode==059) {
|
if (key_scancode == SCAN_CODE_F1) {
|
||||||
EventShowInfo();
|
EventShowInfo();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (key_modifier & KEY_LCTRL) || (key_modifier & KEY_RCTRL) {
|
if (key_modifier & KEY_LCTRL) || (key_modifier & KEY_RCTRL) {
|
||||||
switch (key_scancode)
|
switch (key_scancode)
|
||||||
{
|
{
|
||||||
case 024:
|
case SCAN_CODE_KEY_O:
|
||||||
EventOpenFile();
|
EventOpenFile();
|
||||||
break;
|
break;
|
||||||
|
case SCAN_CODE_KEY_I:
|
||||||
|
EventShowFileProperties();
|
||||||
|
break;
|
||||||
case SCAN_CODE_UP:
|
case SCAN_CODE_UP:
|
||||||
EventMagnifyPlus();
|
EventMagnifyPlus();
|
||||||
break;
|
break;
|
||||||
case SCAN_CODE_DOWN:
|
case SCAN_CODE_DOWN:
|
||||||
EventMagnifyMinus();
|
EventMagnifyMinus();
|
||||||
break;
|
break;
|
||||||
case 018:
|
case SCAN_CODE_KEY_E:
|
||||||
EventRunEdit();
|
EventRunEdit();
|
||||||
break;
|
break;
|
||||||
case SCAN_CODE_TAB:
|
case SCAN_CODE_TAB:
|
||||||
@ -202,6 +211,14 @@ void EventOpenFile()
|
|||||||
PreparePage();
|
PreparePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EventShowFileProperties()
|
||||||
|
{
|
||||||
|
char ss_param[4096];
|
||||||
|
if (!param) return;
|
||||||
|
sprintf(#ss_param, "-p %s", #param);
|
||||||
|
io.run("/sys/File managers/Eolite", #ss_param);
|
||||||
|
}
|
||||||
|
|
||||||
void EventMagnifyPlus()
|
void EventMagnifyPlus()
|
||||||
{
|
{
|
||||||
kfont.size.pt++;
|
kfont.size.pt++;
|
||||||
@ -228,7 +245,8 @@ void EventRunEdit()
|
|||||||
void EventChangeEncoding()
|
void EventChangeEncoding()
|
||||||
{
|
{
|
||||||
menu.selected = encoding + 1;
|
menu.selected = encoding + 1;
|
||||||
menu.show(Form.left+104, Form.top+29+skin_height, 130, "UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866", 10);
|
menu.show(Form.left+5 + charsets_menu_left, Form.top+29+skin_height, 130,
|
||||||
|
"UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866", 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventShowInfo() {
|
void EventShowInfo() {
|
||||||
@ -262,6 +280,9 @@ void OpenFile(dword f_path)
|
|||||||
|
|
||||||
void draw_window()
|
void draw_window()
|
||||||
{
|
{
|
||||||
|
#define PADDING 6
|
||||||
|
#define TOOLBAR_BUTTON_WIDTH 26
|
||||||
|
incn x;
|
||||||
DefineAndDrawWindow(Form.left,Form.top,Form.width,Form.height,0x73,0,#title,0);
|
DefineAndDrawWindow(Form.left,Form.top,Form.width,Form.height,0x73,0,#title,0);
|
||||||
GetProcessInfo(#Form, SelfInfo);
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
if (Form.status_window>2) return;
|
if (Form.status_window>2) return;
|
||||||
@ -272,11 +293,14 @@ void draw_window()
|
|||||||
DrawBar(0, 0, Form.cwidth, TOOLBAR_H - 1, 0xe1e1e1);
|
DrawBar(0, 0, Form.cwidth, TOOLBAR_H - 1, 0xe1e1e1);
|
||||||
DrawBar(0, TOOLBAR_H - 1, Form.cwidth, 1, 0x7F7F7F);
|
DrawBar(0, TOOLBAR_H - 1, Form.cwidth, 1, 0x7F7F7F);
|
||||||
|
|
||||||
DrawToolbarButton(OPEN_FILE, 8);
|
x.n = 0;
|
||||||
DrawToolbarButton(MAGNIFY_PLUS, 42);
|
DrawToolbarButton(OPEN_FILE, x.inc(8));
|
||||||
DrawToolbarButton(MAGNIFY_MINUS, 67);
|
DrawToolbarButton(SHOW_FILE_PROPERTIES, x.inc(TOOLBAR_BUTTON_WIDTH + PADDING));
|
||||||
DrawToolbarButton(CHANGE_ENCODING, 101);
|
DrawToolbarButton(MAGNIFY_PLUS, x.inc(TOOLBAR_BUTTON_WIDTH + PADDING + PADDING));
|
||||||
DrawToolbarButton(RUN_EDIT, 135);
|
DrawToolbarButton(MAGNIFY_MINUS, x.inc(TOOLBAR_BUTTON_WIDTH - 1));
|
||||||
|
DrawToolbarButton(CHANGE_ENCODING, x.inc(TOOLBAR_BUTTON_WIDTH + PADDING + PADDING));
|
||||||
|
charsets_menu_left = x.n;
|
||||||
|
DrawToolbarButton(RUN_EDIT, x.inc(TOOLBAR_BUTTON_WIDTH + PADDING));
|
||||||
DrawToolbarButton(SHOW_INFO, Form.cwidth - 34);
|
DrawToolbarButton(SHOW_INFO, Form.cwidth - 34);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user