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:
Kirill Lipatov (Leency) 2018-04-03 12:45:08 +00:00
parent c559c585db
commit 1d22e52024
5 changed files with 43 additions and 17 deletions

View File

@ -191,10 +191,9 @@
if (ESI.edit_box.flags & 100000000000b) bg = 0xCACACA; else bg = 0xFFFfff;
edit_box_draw stdcall (edit_box_pointer);
h = 22;
DrawRectangle(x-1, y-1, w+1, h+1, bg);
DrawRectangle3D(x-2, y-2, w+3, h+3, 0xDDDddd, bg);
DrawRectangle(x-3, y-3, w+5, h+5, system.color.work_graph);
DrawRectangle3D(x-4, y-4, w+7, h+7, system.color.work_dark, system.color.work_light);
DrawRectangle3D(x-1, y-1, w+1, h+1, 0xE7E7E7, bg);
DrawRectangle(x-2, y-2, w+3, h+3, system.color.work_graph);
DrawRectangle3D(x-3, y-3, w+5, h+5, 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)

View File

@ -40,7 +40,10 @@
#define SCAN_CODE_MINUS 012
#define SCAN_CODE_PLUS 013
#define SCAN_CODE_F1 059
#define SCAN_CODE_KEY_C 046
#define SCAN_CODE_KEY_E 018
#define SCAN_CODE_KEY_F 033
#define SCAN_CODE_KEY_I 023
#define SCAN_CODE_KEY_L 038

View File

@ -1,7 +1,7 @@
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);
img_draw stdcall(skin.image, x, 6, TOOLBAR_ICON_WIDTH, TOOLBAR_ICON_HEIGHT, 0, image_id*TOOLBAR_ICON_HEIGHT);
DefineButton(x+1, 6, TOOLBAR_ICON_WIDTH-2, TOOLBAR_ICON_HEIGHT-2, 10+image_id + BT_HIDE, 0);
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

View File

@ -19,12 +19,13 @@
#define DEFAULT_EDITOR "/sys/tinypad"
#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
Code: Leency, Veliant, KolibriOS Team
Hotkeys:
Ctrl+O - open file
Ctrl+I - show file properties
Ctrl+Up - bigger font
Ctrl+Down - smaller font
Ctrl+Tab - select charset
@ -41,7 +42,8 @@ llist list;
proc_info Form;
char title[4196];
byte help_opened = false;
bool help_opened = false;
int charsets_menu_left = 0;
enum {
OPEN_FILE,
@ -50,6 +52,7 @@ enum {
CHANGE_ENCODING,
RUN_EDIT,
SHOW_INFO,
SHOW_FILE_PROPERTIES
};
int encoding;
@ -120,6 +123,9 @@ void HandleButtonEvent()
case OPEN_FILE:
EventOpenFile();
break;
case SHOW_FILE_PROPERTIES:
EventShowFileProperties();
break;
case MAGNIFY_PLUS:
EventMagnifyPlus();
break;
@ -147,23 +153,26 @@ void HandleKeyEvent()
return;
}
GetKeys();
if (key_scancode==059) {
if (key_scancode == SCAN_CODE_F1) {
EventShowInfo();
return;
}
if (key_modifier & KEY_LCTRL) || (key_modifier & KEY_RCTRL) {
switch (key_scancode)
{
case 024:
case SCAN_CODE_KEY_O:
EventOpenFile();
break;
case SCAN_CODE_KEY_I:
EventShowFileProperties();
break;
case SCAN_CODE_UP:
EventMagnifyPlus();
break;
case SCAN_CODE_DOWN:
EventMagnifyMinus();
break;
case 018:
case SCAN_CODE_KEY_E:
EventRunEdit();
break;
case SCAN_CODE_TAB:
@ -202,6 +211,14 @@ void EventOpenFile()
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()
{
kfont.size.pt++;
@ -228,7 +245,8 @@ void EventRunEdit()
void EventChangeEncoding()
{
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() {
@ -262,6 +280,9 @@ void OpenFile(dword f_path)
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);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) return;
@ -272,11 +293,14 @@ void draw_window()
DrawBar(0, 0, Form.cwidth, TOOLBAR_H - 1, 0xe1e1e1);
DrawBar(0, TOOLBAR_H - 1, Form.cwidth, 1, 0x7F7F7F);
DrawToolbarButton(OPEN_FILE, 8);
DrawToolbarButton(MAGNIFY_PLUS, 42);
DrawToolbarButton(MAGNIFY_MINUS, 67);
DrawToolbarButton(CHANGE_ENCODING, 101);
DrawToolbarButton(RUN_EDIT, 135);
x.n = 0;
DrawToolbarButton(OPEN_FILE, x.inc(8));
DrawToolbarButton(SHOW_FILE_PROPERTIES, x.inc(TOOLBAR_BUTTON_WIDTH + PADDING));
DrawToolbarButton(MAGNIFY_PLUS, x.inc(TOOLBAR_BUTTON_WIDTH + PADDING + PADDING));
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);