cmm gui: simplier api, text shadow for capt button

git-svn-id: svn://kolibrios.org@6176 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-02-09 01:43:58 +00:00
parent 1c3a46e4d1
commit dcbcccc75e
10 changed files with 75 additions and 108 deletions

View File

@ -50,10 +50,13 @@ void DrawFlatButton(dword x,y,width,height,id,text)
PutPixel(x+width-1, y+1, col_padding);
DrawFilledBar(x+2, y+2, width-3, height-3);
if (id) DefineButton(x+1,y+1,width-2,height-2,id+BT_HIDE,0xEFEBEF);
if (height<18)
WriteText(-strlen(text)*6+width/2+x+1,height/2+y-3,0x80,system.color.work_text,text);
else
WriteText(-strlen(text)*8+width/2+x+1,height/2+y-6,0x90,system.color.work_text,text);
if (height<18) {
WriteText(-strlen(text)*6+width/2+x+1,height/2+y-3,0x80,MixColors(system.color.work_text,0xFFFfff,210),text);
}
else {
DrawRectangle3D(x-1,y-1,width+2,height+2,system.color.work,MixColors(system.color.work,system.color.work_graph,200));
WriteText(-strlen(text)*8+width/2+x+1,height/2+y-6,0x90,MixColors(system.color.work_text,0xFFFfff,210),text);
}
}
void DrawFilledBar(dword x, y, w, h)

View File

@ -373,7 +373,7 @@ void DrawPropertiesWindow()
void DrawPropertiesCheckBoxes()
{
CheckBox2(22, flags_frame.start_y + 14, 20, PR_T_ONLY_READ, atr_readonly);
CheckBox2(22, flags_frame.start_y + 36, 21, PR_T_HIDDEN, atr_hidden);
CheckBox2(22, flags_frame.start_y + 58, 22, PR_T_SYSTEM, atr_system);
CheckBox(22, flags_frame.start_y + 14, 20, PR_T_ONLY_READ, atr_readonly);
CheckBox(22, flags_frame.start_y + 36, 21, PR_T_HIDDEN, atr_hidden);
CheckBox(22, flags_frame.start_y + 58, 22, PR_T_SYSTEM, atr_system);
}

View File

@ -82,12 +82,12 @@ void ExitSettings()
void DrawSettingsCheckBoxes()
{
CheckBox2(10, 11, 20, SHOW_DEVICE_CLASS, show_dev_name);
CheckBox2(10, 33, 21, SHOW_REAL_NAMES, real_files_names_case);
CheckBox2(10, 55, 22, NOTIFY_COPY_END, info_after_copy);
CheckBox2(10, 77, 24, USE_TWO_PANELS, two_panels);
MoreLessBox(10, 105, 18, 25, 26, #system.color, files.item_h, LIST_LINE_HEIGHT);
if (label.font) MoreLessBox(10, 132, 18, 30, 31, #system.color, label.size.pt, FONT_SIZE_LABEL);
CheckBox(10, 11, 20, SHOW_DEVICE_CLASS, show_dev_name);
CheckBox(10, 33, 21, SHOW_REAL_NAMES, real_files_names_case);
CheckBox(10, 55, 22, NOTIFY_COPY_END, info_after_copy);
CheckBox(10, 77, 24, USE_TWO_PANELS, two_panels);
MoreLessBox(10, 105, 25, 26, files.item_h, LIST_LINE_HEIGHT);
if (label.font) MoreLessBox(10, 132, 30, 31, label.size.pt, FONT_SIZE_LABEL);
}
@ -147,8 +147,8 @@ void SetAppColors()
{
system.color.work = 0xE4DFE1;
system.color.work_text = 0;
system.color.work_graph = 0x9098B0; //A0A0B8; //0x819FC5;
system.color.work_button = 0xD2D3D3;
system.color.work_graph = 0x7E87A3; //A0A0B8;
system.color.work_button = 0x7E87A3;
system.color.work_button_text = 0x000000;
col_padding = 0xC8C9C9;
col_selec = 0x94AECE;
@ -162,8 +162,3 @@ void BigFontsChange()
if (files.item_h<18) files.item_h = 18;
files_active.item_h = files_inactive.item_h = files.item_h;
}
void CheckBox2(dword x, y, id, text, byte value) {
CheckBox(x, y, 14, 14, id, text, system.color.work_graph, system.color.work_text, value);
}

View File

@ -31,9 +31,9 @@ void main()
if (Form.status_window>2) break;
_DRAW_WINDOW_CONTENT:
DrawBar(0, 0, Form.cwidth, PANELH, 0xCCCccc);
CheckBox2(10, 8, 2, "Bold", label.bold);
CheckBox2(70, 8, 3, "Italic", label.italic);
CheckBox2(140, 8, 4, "Smooth", label.smooth);
CheckBox(10, 8, 2, "Bold", label.bold);
CheckBox(70, 8, 3, "Italic", label.italic);
CheckBox(140, 8, 4, "Smooth", label.smooth);
label.raw_size = free(label.raw);
if (!label.font)
{
@ -50,7 +50,3 @@ void main()
}
}
}
void CheckBox2(dword x, y, id, text, byte value) {
CheckBox(x, y, 14, 14, id, text, system.color.work_graph, system.color.work_text, value);
}

View File

@ -10,6 +10,10 @@
#include "../lib/strings.h"
#endif
#ifndef INCLUDE_RGB_H
#include "../lib/patterns/rgb.h"
#endif
:void DrawRectangle(dword x,y,w,h,color1)
{
if (w<=0) || (h<=0) return;
@ -39,8 +43,11 @@
:void DrawCaptButton(dword x,y,w,h,id,color_b, color_t,text)
{
word tx = -strlen(text)*6+w/2+x+1;
word ty = h/2-3+y;
if (id>0) DefineButton(x,y,w,h,id,color_b);
WriteText(-strlen(text)*6+w/2+x+1,h/2-3+y,0x80,color_t,text);
WriteText(tx+1,ty+1,0x80,MixColors(color_b,0,200),text);
WriteText(tx,ty,0x80,color_t,text);
}
:void WriteTextCenter(dword x,y,w,color_t,text)
@ -60,11 +67,12 @@
}
}
:void CheckBox(dword x,y,w,h, bt_id, text, graph_color, text_color, is_checked)
:void CheckBox(dword x,y,bt_id, text, is_checked)
{
DefineButton(x-1, y-1, strlen(text)*6 + w + 17, h+2, bt_id+BT_HIDE+BT_NOFRAME, graph_color);
WriteText(x+w+8, h / 2 + y -3, 0x80, text_color, text);
DrawRectangle(x, y, w, h, graph_color);
byte w=14, h=14;
DefineButton(x-1, y-1, strlen(text)*6 + w + 17, h+2, bt_id+BT_HIDE+BT_NOFRAME, 0);
WriteText(x+w+8, h / 2 + y -3, 0x80, system.color.work_text, text);
DrawRectangle(x, y, w, h, system.color.work_graph);
if (is_checked == 0)
{
DrawRectangle3D(x+1, y+1, w-2, h-2, 0xDDDddd, 0xffffff);
@ -72,35 +80,29 @@
}
else if (is_checked == 1)
{
DrawRectangle(x+1, y+1, w-2, h-2, 0xffffff);
DrawRectangle(x+2, y+2, w-4, h-4, 0xffffff);
DrawBar(x+3, y+3, w-5, h-5, graph_color);
DrawWideRectangle(x+1, y+1, w-1, h-1, 2, 0xffffff);
DrawBar(x+3, y+3, w-5, h-5, system.color.work_button); //0x13A113
}
else if (is_checked == 2) //not active
{
DrawRectangle(x+1, y+1, w-2, h-2, 0xffffff);
DrawRectangle(x+2, y+2, w-4, h-4, 0xffffff);
DrawWideRectangle(x+1, y+1, w-1, h-1, 2, 0xffffff);
DrawBar(x+3, y+3, w-5, h-5, 0x888888);
}
}
:void MoreLessBox(dword x,y,s, bt_id_more, bt_id_less, colors_pointer, value, text)
:void MoreLessBox(dword x,y, bt_id_more, bt_id_less, value, text)
{
#define VALUE_FIELD_W 26;
ESI = colors_pointer;
system.color.work_graph = ESI.COLORS.work_graph;
system.color.work_text = ESI.COLORS.work_text;
system.color.work_button = ESI.COLORS.work_button;
system.color.work_button_text = ESI.COLORS.work_button_text;
#define VALUE_FIELD_W 26
#define SIZE 18
DrawRectangle(x, y, VALUE_FIELD_W, s, system.color.work_graph);
DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, s-2, 0xDDDddd, 0xffffff);
DrawBar(x+2, y+2, VALUE_FIELD_W-3, s-3, 0xffffff);
WriteText(x+6, s / 2 + y -3, 0x80, 0x000000, itoa(value));
DrawRectangle(x, y, VALUE_FIELD_W, 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(x+6, SIZE / 2 + y -3, 0x80, 0x000000, itoa(value));
DrawCaptButton(VALUE_FIELD_W + x + 1, y, s, s, bt_id_more, system.color.work_button, system.color.work_button_text, "+");
DrawCaptButton(VALUE_FIELD_W + x + s + 2, y, s, s, bt_id_less, system.color.work_button, system.color.work_button_text, "-");
WriteText(x+VALUE_FIELD_W+s+s+10, s / 2 + y -3, 0x80, system.color.work_text, 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 + 2, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-");
WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -3, 0x80, system.color.work_text, text);
}
:void DrawProgressBar(dword st_x, st_y, st_w, st_h, col_fon, col_border, col_fill, col_text, progress_percent)
@ -177,21 +179,6 @@
}
}
:dword ShadowPixel(dword dwColor, strength)
{
dword iB, iG, iR;
strength = 10 - strength;
iB = dwColor & 0xFF; dwColor >>= 8;
iG = dwColor & 0xFF; dwColor >>= 8;
iR = dwColor & 0xFF; dwColor >>= 8;
iB = strength * iB / 10 << 16;
iG = strength * iG / 10 << 8;
iR = strength * iR / 10;
return iR + iG + iB;
}
:void ShadowImage(dword color_image, w, h, strength)
{
dword col, to;

View File

@ -1,3 +1,6 @@
#ifndef INCLUDE_RGB_H
#define INCLUDE_RGB_H
#print "[include <rgb.h>]\n"
struct _rgb
{
@ -37,3 +40,5 @@ dword _rgb::RgbToDword()
return rgb_final.RgbToDword();
}
#endif

View File

@ -198,10 +198,10 @@ void DrawLoginScreen()
if (!aim)
{
DrawCaptButton(panel_x,panel_y+90,100,20,11,system.color.work_button, system.color.work_button_text,"Settings");
DrawCaptButton(panel_x+120,panel_y+90,100,20,12,system.color.work_button, system.color.work_button_text,"Enter >");
DrawCaptButton(panel_x,panel_y+90,100,22,11,system.color.work_button, system.color.work_button_text,"Settings");
DrawCaptButton(panel_x+120,panel_y+90,100,22,12,system.color.work_button, system.color.work_button_text,"Enter >");
}
else DrawCaptButton(panel_x+120,panel_y+90,100,20,12,system.color.work_button, system.color.work_button_text,"Stop");
else DrawCaptButton(panel_x+120,panel_y+90,100,22,12,system.color.work_button, system.color.work_button_text,"Stop");
SetLoginStatus(cur_st_text);
}

View File

@ -102,8 +102,8 @@ void OptionsWindow()
DrawCaptButton(Form.cwidth-79, Form.cheight-32, 70, 25, 19, system.color.work_button, system.color.work_button_text,"Apply");
WriteTextB(ELEM_X, 20, 0x90, system.color.work_text, "Network settings");
CheckBox(ELEM_X, 45, 12, 12, 17, "Use custom settings", system.color.work_graph, system.color.work_text, checked[0]);
CheckBox(ELEM_X, 65, 12, 12, 18, "Manual configuration", system.color.work_graph, system.color.work_text, checked[1]);
CheckBox(ELEM_X, 45, 17, "Use custom settings", checked[0]);
CheckBox(ELEM_X, 65, 18, "Manual configuration", checked[1]);
for (i=0; i<4; i++)
{
WriteText(ELEM_X+40, i*25+4+POP_server_box.top, 0x80, system.color.work_text, text1[i]);

View File

@ -163,11 +163,11 @@ void DrawMouseImage() {
void DrawControls() {
DrawBar(pos_x, mouse_frame.start_y + 142, Form.cwidth - pos_x, 120, system.color.work);
PanelCfg_MoreLessBox(pos_x, mouse_frame.start_y + 142, 120, 121, mouse_cfg.pointer_speed, POINTER_SPEED);
PanelCfg_MoreLessBox(pos_x, mouse_frame.start_y + 170, 122, 123, mouse_cfg.acceleration, ACCELERATION_TEXT);
PanelCfg_MoreLessBox(pos_x, mouse_frame.start_y + 198, 124, 125, mouse_cfg.double_click_delay, DOUBLE_CLICK_TEXT);
PanelCfg_CheckBox(pos_x, mouse_frame.start_y + 230, 100, MOUSE_EMULATION, mouse_cfg.emulation);
PanelCfg_CheckBox(pos_x, mouse_frame.start_y + 254, 101, MADMOUSE, mouse_cfg.madmouse);
MoreLessBox(pos_x, mouse_frame.start_y + 142, 120, 121, mouse_cfg.pointer_speed, POINTER_SPEED);
MoreLessBox(pos_x, mouse_frame.start_y + 170, 122, 123, mouse_cfg.acceleration, ACCELERATION_TEXT);
MoreLessBox(pos_x, mouse_frame.start_y + 198, 124, 125, mouse_cfg.double_click_delay, DOUBLE_CLICK_TEXT);
CheckBox(pos_x, mouse_frame.start_y + 230, 100, MOUSE_EMULATION, mouse_cfg.emulation);
CheckBox(pos_x, mouse_frame.start_y + 254, 101, MADMOUSE, mouse_cfg.madmouse);
}
void SetFrameColors() {
@ -193,15 +193,5 @@ void ExitApp() {
}
void PanelCfg_CheckBox(dword x, y, id, text, byte value) {
CheckBox(x, y, 14, 14, id, text, system.color.work_graph, system.color.work_text, value);
}
void PanelCfg_MoreLessBox(dword x, y, id_more, id_less; word value; dword text) {
MoreLessBox(x, y, 18, id_more, id_less, #system.color, value, text);
}
stop:

View File

@ -175,26 +175,26 @@ void DrawWindowContent(byte panel_type)
DefineButton(22, taskbar_frame.start_y + 12, panels_img.w-1, 27-1, 100 + BT_HIDE, 0);
_PutImage(22, taskbar_frame.start_y + 12, 37, 27, taskbar_cfg.Attachment * 37 * 27 * 3 + panels_img.data);
WriteText(68, taskbar_frame.start_y + 20, 0x80, system.color.work_text, CHANGE_POS);
PanelCfg_CheckBox(22, taskbar_frame.start_y + 48, 105, SOFTEN_UP, taskbar_cfg.SoftenUp);
PanelCfg_CheckBox(22, taskbar_frame.start_y + 68, 106, SOFTEN_DOWN, taskbar_cfg.SoftenDown);
PanelCfg_CheckBox(22, taskbar_frame.start_y + 88, 107, MIN_LEFT_BUTTON, taskbar_cfg.MinLeftButton);
PanelCfg_CheckBox(22, taskbar_frame.start_y + 108, 108, MIN_RIGHT_BUTTON, taskbar_cfg.MinRightButton);
CheckBox(22, taskbar_frame.start_y + 48, 105, SOFTEN_UP, taskbar_cfg.SoftenUp);
CheckBox(22, taskbar_frame.start_y + 68, 106, SOFTEN_DOWN, taskbar_cfg.SoftenDown);
CheckBox(22, taskbar_frame.start_y + 88, 107, MIN_LEFT_BUTTON, taskbar_cfg.MinLeftButton);
CheckBox(22, taskbar_frame.start_y + 108, 108, MIN_RIGHT_BUTTON, taskbar_cfg.MinRightButton);
win_center_x = Form.cwidth / 2;
PanelCfg_CheckBox(win_center_x, taskbar_frame.start_y + 48, 111, CLOCK, taskbar_cfg.Clock);
PanelCfg_CheckBox(win_center_x, taskbar_frame.start_y + 68, 112, CPU_USAGE, taskbar_cfg.CpuUsage);
PanelCfg_CheckBox(win_center_x, taskbar_frame.start_y + 88, 113, CHANGE_LANG, taskbar_cfg.ChangeLang);
PanelCfg_CheckBox(win_center_x, taskbar_frame.start_y + 108, 114, MENU_BUTTON, taskbar_cfg.MenuButton);
PanelCfg_MoreLessBox(22, taskbar_frame.start_y + 131, 120, 121, taskbar_cfg.PanelHeight, PANEL_HEIGHT);
PanelCfg_MoreLessBox(win_center_x, taskbar_frame.start_y + 131, 122, 123, taskbar_cfg.SoftenHeight, SOFTEN_HEIGHT);
PanelCfg_MoreLessBox(22, taskbar_frame.start_y + 159, 124, 125, taskbar_cfg.ButtonOffset, BUTTON_OFFSET);
CheckBox(win_center_x, taskbar_frame.start_y + 48, 111, CLOCK, taskbar_cfg.Clock);
CheckBox(win_center_x, taskbar_frame.start_y + 68, 112, CPU_USAGE, taskbar_cfg.CpuUsage);
CheckBox(win_center_x, taskbar_frame.start_y + 88, 113, CHANGE_LANG, taskbar_cfg.ChangeLang);
CheckBox(win_center_x, taskbar_frame.start_y + 108, 114, MENU_BUTTON, taskbar_cfg.MenuButton);
MoreLessBox(22, taskbar_frame.start_y + 131, 120, 121, taskbar_cfg.PanelHeight, PANEL_HEIGHT);
MoreLessBox(win_center_x, taskbar_frame.start_y + 131, 122, 123, taskbar_cfg.SoftenHeight, SOFTEN_HEIGHT);
MoreLessBox(22, taskbar_frame.start_y + 159, 124, 125, taskbar_cfg.ButtonOffset, BUTTON_OFFSET);
}
if (panel_type==ALL) || (panel_type==DOCKY)
{
DefineButton(22, docky_frame.start_y + 12, panels_img.w-1, 27-1, 200 + BT_HIDE, 0);
_PutImage(22, docky_frame.start_y + 12, 37, 27, docky_cfg.location + 1 * 37 * 27 * 3 + panels_img.data);
WriteText(68, docky_frame.start_y + 20, 0x80, system.color.work_text, CHANGE_POS);
PanelCfg_CheckBox(22, docky_frame.start_y + 48, 201, FSIZE, docky_cfg.fsize);
PanelCfg_CheckBox(win_center_x, docky_frame.start_y + 48, 202, ASHOW, docky_cfg.ashow);
CheckBox(22, docky_frame.start_y + 48, 201, FSIZE, docky_cfg.fsize);
CheckBox(win_center_x, docky_frame.start_y + 48, 202, ASHOW, docky_cfg.ashow);
}
}
@ -265,13 +265,4 @@ void RestartProcess(byte panel_type)
void PanelCfg_CheckBox(dword x, y, id, text, byte value) {
CheckBox(x, y, 14, 14, id, text, system.color.work_graph, system.color.work_text, value);
}
void PanelCfg_MoreLessBox(dword x, y, id_more, id_less; byte value; dword text) {
MoreLessBox(x, y, 18, id_more, id_less, #system.color, value, text);
}
stop: