CMM: use single click instead of double in Eolite, add math.min() and math.max() functions, add more_less_box component

git-svn-id: svn://kolibrios.org@7086 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2017-10-10 22:26:56 +00:00
parent 824c13ffef
commit c103cab861
5 changed files with 73 additions and 10 deletions

View File

@ -153,7 +153,7 @@ void main()
Libimg_LoadImage(#icons16_default, "/sys/icons16.png"); Libimg_LoadImage(#icons16_default, "/sys/icons16.png");
Libimg_LoadImage(#icons16_selected, "/sys/icons16.png"); Libimg_LoadImage(#icons16_selected, "/sys/icons16.png");
Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffFFFfff, 0xFF94AECE); Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffFFFfff, 0xFF94AECE);
Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffCACBD6, 0xFF94AECE); Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffCACBD6, 0xFF7692B5);
//-p just show file/folder properties dialog //-p just show file/folder properties dialog
if (param) && (param[0]=='-') && (param[1]=='p') if (param) && (param[0]=='-') && (param[1]=='p')
@ -241,8 +241,7 @@ void main()
//select file //select file
if (mouse.key&MOUSE_LEFT) && (mouse.up) if (mouse.key&MOUSE_LEFT) && (mouse.up)
{ {
if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); else Open(0);
else if (mouse.dblclick) Open(0);
} }
//file menu //file menu
if (mouse.key&MOUSE_RIGHT) if (mouse.key&MOUSE_RIGHT)

View File

@ -358,7 +358,7 @@ void DrawPropertiesWindow()
if (selected_count) if (selected_count)
{ {
PropertiesDrawIcon(NULL, NULL); PropertiesDrawIcon(NULL, "<lot>");
sprintf(#folder_info,"%s%d%s%d",SET_6,file_count,SET_7,dir_count); sprintf(#folder_info,"%s%d%s%d",SET_6,file_count,SET_7,dir_count);
WriteText(file_name_ed.left+4, 30, 0x90, system.color.work_text, #folder_info); WriteText(file_name_ed.left+4, 30, 0x90, system.color.work_text, #folder_info);
sprintf(#element_size_label,"%s (%d %s)",ConvertSize64(size_dir, NULL),size_dir,SET_BYTE_LANG); sprintf(#element_size_label,"%s (%d %s)",ConvertSize64(size_dir, NULL),size_dir,SET_BYTE_LANG);

View File

@ -13,6 +13,10 @@
#include "../lib/patterns/rgb.h" #include "../lib/patterns/rgb.h"
#endif #endif
#ifndef INCLUDE_MATH_H
#include "../lib/math.h"
#endif
:void DrawRectangle(dword x,y,w,h,color1) :void DrawRectangle(dword x,y,w,h,color1)
{ {
if (w<=0) || (h<=0) return; if (w<=0) || (h<=0) return;
@ -401,6 +405,47 @@ dword incn::inc(dword _addition)
return true; return true;
} }
/*=========================================================
==
== MORE LESS BOX
==
/========================================================*/
struct more_less_box
{
signed x,y;
unsigned value, min, max;
unsigned bt_id_more, bt_id_less;
dword text;
void click();
void draw();
};
void more_less_box::click(unsigned id)
{
if (id==bt_id_less) { value = math.max(value-1, min); draw(); }
if (id==bt_id_more) { value = math.min(value+1, max); draw(); }
}
void more_less_box::draw()
{
#define VALUE_FIELD_W 34
#define SIZE 18
dword value_text = itoa(value);
DrawRectangle(x, y, VALUE_FIELD_W+1, SIZE, system.color.work_graph);
DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, SIZE-2, 0xDDDddd, 0xffffff);
DrawBar(x+2, y+2, VALUE_FIELD_W-3, SIZE-3, 0xffffff);
WriteText( -strlen(value_text)+3*8 + x+6, SIZE / 2 + y -6, 0x90, 0x333333, value_text);
DrawCaptButton(VALUE_FIELD_W + x + 1, y, SIZE, SIZE, bt_id_more, system.color.work_button, system.color.work_button_text, "+");
DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-");
EDI = system.color.work;
WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text);
DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light);
}
#endif #endif

View File

@ -18,7 +18,10 @@
float floor(float x); float floor(float x);
signed round(float x); signed round(float x);
signed ceil(float x); signed ceil(float x);
signed min(signed i1, i2);
signed max(signed i1, i2);
}math; }math;
:signed MATH::round(float x) :signed MATH::round(float x)
{ {
x+=0.6; x+=0.6;
@ -92,4 +95,18 @@
} }
return r; return r;
} }
:signed MATH::min(signed i1, i2)
{
if (i1 < i2)
return i1;
else
return i2;
}
:signed MATH::max(signed i1, i2)
{
if (i1 > i2)
return i1;
else
return i2;
}
#endif #endif

View File

@ -18,6 +18,7 @@ dword box_lib_init = #aboxlib_init;
dword edit_box_draw = #aEdit_box_draw; dword edit_box_draw = #aEdit_box_draw;
dword edit_box_key = #aEdit_box_key; dword edit_box_key = #aEdit_box_key;
dword edit_box_mouse = #aEdit_box_mouse; dword edit_box_mouse = #aEdit_box_mouse;
dword edit_box_set_text = #aEdit_box_set_text;
dword version_ed = #aVersion_ed; dword version_ed = #aVersion_ed;
dword scrollbar_v_draw = #aScrollbar_v_draw; dword scrollbar_v_draw = #aScrollbar_v_draw;
@ -39,6 +40,7 @@ $DD 2 dup 0
char aEdit_box_draw [] = "edit_box"; char aEdit_box_draw [] = "edit_box";
char aEdit_box_key [] = "edit_box_key"; char aEdit_box_key [] = "edit_box_key";
char aEdit_box_mouse[] = "edit_box_mouse"; char aEdit_box_mouse[] = "edit_box_mouse";
char aEdit_box_set_text[] = "edit_box_set_text";
char aVersion_ed [] = "version_ed"; char aVersion_ed [] = "version_ed";
char aboxlib_init[] = "lib_init"; char aboxlib_init[] = "lib_init";