forked from KolibriOS/kolibrios
CMM: create pattern select_list (Yeah!), use in clipview, appearance; Blueberries skin small fixes
git-svn-id: svn://kolibrios.org@6651 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
595fd9817d
commit
e35a30e7cd
@ -13,6 +13,7 @@
|
|||||||
#include "..\lib\menu.h"
|
#include "..\lib\menu.h"
|
||||||
#include "..\lib\gui.h"
|
#include "..\lib\gui.h"
|
||||||
#include "..\lib\obj\box_lib.h"
|
#include "..\lib\obj\box_lib.h"
|
||||||
|
#include "..\lib\patterns\select_list.h"
|
||||||
|
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
@ -36,7 +37,6 @@
|
|||||||
#define SKINS_STANDART_PATH "/kolibrios/res/skins"
|
#define SKINS_STANDART_PATH "/kolibrios/res/skins"
|
||||||
#define WALP_STANDART_PATH "/kolibrios/res/wallpapers"
|
#define WALP_STANDART_PATH "/kolibrios/res/wallpapers"
|
||||||
|
|
||||||
llist list;
|
|
||||||
signed int active_skin=-1, active_wallpaper=-1;
|
signed int active_skin=-1, active_wallpaper=-1;
|
||||||
enum { SKINS=2, WALLPAPERS };
|
enum { SKINS=2, WALLPAPERS };
|
||||||
|
|
||||||
@ -49,9 +49,6 @@ int cur;
|
|||||||
|
|
||||||
proc_info Form;
|
proc_info Form;
|
||||||
|
|
||||||
scroll_bar scroll1 = { 18,200,398, 44,18,0,115,15,0,0xeeeeee,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
|
|
||||||
|
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
// //
|
// //
|
||||||
// CODE //
|
// CODE //
|
||||||
@ -71,25 +68,25 @@ void main()
|
|||||||
if (!CheckActiveProcess(Form.ID)) break;
|
if (!CheckActiveProcess(Form.ID)) break;
|
||||||
mouse.get();
|
mouse.get();
|
||||||
scrollbar_v_mouse (#scroll1);
|
scrollbar_v_mouse (#scroll1);
|
||||||
if (list.first != scroll1.position)
|
if (select_list.first != scroll1.position)
|
||||||
{
|
{
|
||||||
list.first = scroll1.position;
|
select_list.first = scroll1.position;
|
||||||
Draw_List();
|
DrawSelectList(select_list.count);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mouse.vert) && (list.MouseScroll(mouse.vert)) Draw_List();
|
if (mouse.vert) && (select_list.MouseScroll(mouse.vert)) DrawSelectList(select_list.count);
|
||||||
|
|
||||||
if (mouse.up)&&(mouse_clicked)
|
if (mouse.up)&&(mouse_clicked)
|
||||||
{
|
{
|
||||||
if (mouse.lkm) && (list.ProcessMouse(mouse.x, mouse.y)) EventApply();
|
if (mouse.lkm) && (select_list.ProcessMouse(mouse.x, mouse.y)) EventApply();
|
||||||
mouse_clicked=false;
|
mouse_clicked=false;
|
||||||
}
|
}
|
||||||
else if (mouse.down)&&(mouse.lkm) && (list.MouseOver(mouse.x, mouse.y)) mouse_clicked=true;
|
else if (mouse.down)&&(mouse.lkm) && (select_list.MouseOver(mouse.x, mouse.y)) mouse_clicked=true;
|
||||||
|
|
||||||
if (mouse.down)&&(mouse.pkm) {
|
if (mouse.down)&&(mouse.pkm) {
|
||||||
list.ProcessMouse(mouse.x, mouse.y);
|
select_list.ProcessMouse(mouse.x, mouse.y);
|
||||||
Draw_List();
|
DrawSelectList(select_list.count);
|
||||||
menu.show(Form.left+mouse.x, Form.top+mouse.y+skin_height, 136, "Open file Enter\nDelete Del", 10);
|
menu.show(Form.left+mouse.x, Form.top+mouse.y+skin_height, 136, "Open file Enter\nDelete Del", 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,17 +102,17 @@ void main()
|
|||||||
|
|
||||||
case evKey:
|
case evKey:
|
||||||
GetKeys();
|
GetKeys();
|
||||||
if (list.ProcessKey(key_scancode)) EventApply();
|
if (select_list.ProcessKey(key_scancode)) EventApply();
|
||||||
if (key_scancode==SCAN_CODE_ENTER) EventOpenFile();
|
if (key_scancode==SCAN_CODE_ENTER) EventOpenFile();
|
||||||
if (key_scancode==SCAN_CODE_TAB) if (tabs.active_tab==SKINS) EventTabClick(WALLPAPERS); else EventTabClick(SKINS);
|
if (key_scancode==SCAN_CODE_TAB) if (tabs.active_tab==SKINS) EventTabClick(WALLPAPERS); else EventTabClick(SKINS);
|
||||||
if (key_scancode==SCAN_CODE_DEL) EventDeleteFile();
|
if (key_scancode==SCAN_CODE_DEL) EventDeleteFile();
|
||||||
for (id=list.cur_y+1; id<list.count; id++)
|
for (id=select_list.cur_y+1; id<select_list.count; id++)
|
||||||
{
|
{
|
||||||
strcpy(#temp_filename, io.dir.position(files_mas[id]));
|
strcpy(#temp_filename, io.dir.position(files_mas[id]));
|
||||||
if (temp_filename[0]==key_ascii) || (temp_filename[0]==key_ascii-32)
|
if (temp_filename[0]==key_ascii) || (temp_filename[0]==key_ascii-32)
|
||||||
{
|
{
|
||||||
list.cur_y = id - 1;
|
select_list.cur_y = id - 1;
|
||||||
list.KeyDown();
|
select_list.KeyDown();
|
||||||
EventApply();
|
EventApply();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -139,43 +136,26 @@ void main()
|
|||||||
void DrawWindowContent()
|
void DrawWindowContent()
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
list.SetFont(8, 14, 0x90);
|
id = select_list.cur_y;
|
||||||
id = list.cur_y;
|
InitSelectList(LIST_PADDING, PANEL_H, Form.cwidth-scroll1.size_x-LIST_PADDING-LIST_PADDING, Form.cheight-PANEL_H-LIST_PADDING, false);
|
||||||
list.SetSizes(LIST_PADDING, PANEL_H, Form.cwidth-scroll1.size_x-LIST_PADDING-LIST_PADDING, Form.cheight-PANEL_H-LIST_PADDING, 20);
|
select_list.cur_y = id;
|
||||||
list.cur_y = id;
|
|
||||||
|
|
||||||
DrawBar(0,0, Form.cwidth, PANEL_H-LIST_PADDING, system.color.work);
|
DrawBar(0,0, Form.cwidth, PANEL_H-LIST_PADDING, system.color.work);
|
||||||
DrawRectangle3D(list.x-2, list.y-2, list.w+3+scroll1.size_x, list.h+3, system.color.work_dark, system.color.work_light);
|
DrawRectangle3D(select_list.x-2, select_list.y-2, select_list.w+3+scroll1.size_x, select_list.h+3, system.color.work_dark, system.color.work_light);
|
||||||
DrawWideRectangle(list.x-LIST_PADDING, list.y-LIST_PADDING, LIST_PADDING*2+list.w+scroll1.size_x, LIST_PADDING*2+list.h, LIST_PADDING-2, system.color.work);
|
DrawWideRectangle(select_list.x-LIST_PADDING, select_list.y-LIST_PADDING, LIST_PADDING*2+select_list.w+scroll1.size_x, LIST_PADDING*2+select_list.h, LIST_PADDING-2, system.color.work);
|
||||||
tabs.draw(list.x+10, list.y, SKINS, T_SKINS);
|
tabs.draw(select_list.x+10, select_list.y, SKINS, T_SKINS);
|
||||||
if (dir_exists(WALP_STANDART_PATH)) tabs.draw(strlen(T_SKINS)*8+TAB_PADDING+list.x+21, list.y, WALLPAPERS, T_WALLPAPERS);
|
if (dir_exists(WALP_STANDART_PATH)) tabs.draw(strlen(T_SKINS)*8+TAB_PADDING+select_list.x+21, select_list.y, WALLPAPERS, T_WALLPAPERS);
|
||||||
DrawRectangle(list.x-1, list.y-1, list.w+1+scroll1.size_x, list.h+1, system.color.work_graph);
|
DrawRectangle(select_list.x-1, select_list.y-1, select_list.w+1+scroll1.size_x, select_list.h+1, system.color.work_graph);
|
||||||
|
|
||||||
Draw_List();
|
DrawSelectList(select_list.count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawScroller()
|
|
||||||
{
|
|
||||||
scroll1.bckg_col = MixColors(system.color.work, 0xBBBbbb, 80);
|
|
||||||
scroll1.frnt_col = MixColors(system.color.work,0xFFFfff,120);
|
|
||||||
scroll1.line_col = system.color.work_graph;
|
|
||||||
|
|
||||||
scroll1.max_area = list.count;
|
|
||||||
scroll1.cur_area = list.visible;
|
|
||||||
scroll1.position = list.first;
|
|
||||||
|
|
||||||
scroll1.all_redraw=1;
|
|
||||||
scroll1.start_x = list.x + list.w;
|
|
||||||
scroll1.start_y = list.y-1;
|
|
||||||
scroll1.size_y = list.h+2;
|
|
||||||
|
|
||||||
scrollbar_v_draw(#scroll1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Open_Dir()
|
void Open_Dir()
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
list.count = 0;
|
select_list.count = 0;
|
||||||
if(io.dir.buffer)free(io.dir.buffer);
|
if(io.dir.buffer)free(io.dir.buffer);
|
||||||
io.dir.load(#folder_path,DIR_ONLYREAL);
|
io.dir.load(#folder_path,DIR_ONLYREAL);
|
||||||
for (j=0; j<io.dir.count; j++)
|
for (j=0; j<io.dir.count; j++)
|
||||||
@ -184,39 +164,32 @@ void Open_Dir()
|
|||||||
strlwr(#temp_filename);
|
strlwr(#temp_filename);
|
||||||
if (tabs.active_tab==SKINS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue;
|
if (tabs.active_tab==SKINS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue;
|
||||||
if (tabs.active_tab==WALLPAPERS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".txt")==0) continue;
|
if (tabs.active_tab==WALLPAPERS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".txt")==0) continue;
|
||||||
cur = list.count;
|
cur = select_list.count;
|
||||||
files_mas[cur]=j;
|
files_mas[cur]=j;
|
||||||
if (!strcmpi("default.skn",#temp_filename)) files_mas[0]><files_mas[list.count];
|
if (!strcmpi("default.skn",#temp_filename)) files_mas[0]><files_mas[select_list.count];
|
||||||
list.count++;
|
select_list.count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw_List()
|
void DrawSelectList_Line(dword i)
|
||||||
{
|
{
|
||||||
int i, yyy, list_last;
|
int yyy, list_last;
|
||||||
|
|
||||||
if (list.count > list.visible) list_last = list.visible; else list_last = list.count;
|
cur = select_list.first + i;
|
||||||
|
strcpy(#temp_filename, io.dir.position(files_mas[cur]));
|
||||||
for (i=0; (i<list_last); i++;)
|
temp_filename[strlen(#temp_filename)-4] = 0;
|
||||||
|
yyy = i*select_list.item_h+select_list.y;
|
||||||
|
|
||||||
|
if (select_list.cur_y-select_list.first==i)
|
||||||
{
|
{
|
||||||
cur = list.first + i;
|
DrawBar(select_list.x, yyy, select_list.w, select_list.item_h, system.color.work_button);
|
||||||
strcpy(#temp_filename, io.dir.position(files_mas[cur]));
|
WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,system.color.work_button_text, #temp_filename);
|
||||||
temp_filename[strlen(#temp_filename)-4] = 0;
|
}
|
||||||
yyy = i*list.item_h+list.y;
|
else
|
||||||
|
{
|
||||||
if (list.cur_y-list.first==i)
|
DrawBar(select_list.x,yyy,select_list.w, select_list.item_h, 0xFFFfff);
|
||||||
{
|
WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,0, #temp_filename);
|
||||||
DrawBar(list.x, yyy, list.w, list.item_h, system.color.work_button);
|
|
||||||
WriteText(list.x+12,yyy+list.text_y,list.font_type,system.color.work_button_text, #temp_filename);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DrawBar(list.x,yyy,list.w, list.item_h, 0xFFFfff);
|
|
||||||
WriteText(list.x+12,yyy+list.text_y,list.font_type,0, #temp_filename);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
DrawBar(list.x,i*list.item_h+list.y, list.w, -i*list.item_h+ list.h, 0xFFFfff);
|
|
||||||
DrawScroller();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
@ -230,24 +203,24 @@ void EventTabClick(int N)
|
|||||||
tabs.click(N);
|
tabs.click(N);
|
||||||
if (tabs.active_tab == SKINS)
|
if (tabs.active_tab == SKINS)
|
||||||
{
|
{
|
||||||
active_wallpaper = list.cur_y;
|
active_wallpaper = select_list.cur_y;
|
||||||
strcpy(#folder_path, SKINS_STANDART_PATH);
|
strcpy(#folder_path, SKINS_STANDART_PATH);
|
||||||
list.ClearList();
|
select_list.ClearList();
|
||||||
Open_Dir();
|
Open_Dir();
|
||||||
if (!list.count) notify("'No skins were found' -E");
|
if (!select_list.count) notify("'No skins were found' -E");
|
||||||
list.cur_y = active_skin;
|
select_list.cur_y = active_skin;
|
||||||
}
|
}
|
||||||
if (tabs.active_tab == WALLPAPERS)
|
if (tabs.active_tab == WALLPAPERS)
|
||||||
{
|
{
|
||||||
active_skin = list.cur_y;
|
active_skin = select_list.cur_y;
|
||||||
strcpy(#folder_path, WALP_STANDART_PATH);
|
strcpy(#folder_path, WALP_STANDART_PATH);
|
||||||
list.ClearList();
|
select_list.ClearList();
|
||||||
Open_Dir();
|
Open_Dir();
|
||||||
if (!list.count) notify("'No wallpapers were found' -E");
|
if (!select_list.count) notify("'No wallpapers were found' -E");
|
||||||
list.cur_y = active_wallpaper;
|
select_list.cur_y = active_wallpaper;
|
||||||
}
|
}
|
||||||
if (list.cur_y>list.visible) list.first=list.cur_y; list.CheckDoesValuesOkey();
|
if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y; select_list.CheckDoesValuesOkey();
|
||||||
if (list.w) DrawWindowContent();
|
if (select_list.w) DrawWindowContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventDeleteFile()
|
void EventDeleteFile()
|
||||||
@ -261,16 +234,16 @@ void EventApply()
|
|||||||
{
|
{
|
||||||
if (tabs.active_tab==SKINS)
|
if (tabs.active_tab==SKINS)
|
||||||
{
|
{
|
||||||
cur = list.cur_y;
|
cur = select_list.cur_y;
|
||||||
sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur]));
|
sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur]));
|
||||||
SetSystemSkin(#cur_file_path);
|
SetSystemSkin(#cur_file_path);
|
||||||
}
|
}
|
||||||
if (tabs.active_tab==WALLPAPERS)
|
if (tabs.active_tab==WALLPAPERS)
|
||||||
{
|
{
|
||||||
cur = list.cur_y;
|
cur = select_list.cur_y;
|
||||||
sprintf(#cur_file_path,"\\S__%s/%s",#folder_path,io.dir.position(files_mas[cur]));
|
sprintf(#cur_file_path,"\\S__%s/%s",#folder_path,io.dir.position(files_mas[cur]));
|
||||||
RunProgram("/sys/media/kiv", #cur_file_path);
|
RunProgram("/sys/media/kiv", #cur_file_path);
|
||||||
Draw_List();
|
DrawSelectList(select_list.count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#include "..\lib\gui.h"
|
#include "..\lib\gui.h"
|
||||||
#include "..\lib\obj\box_lib.h"
|
#include "..\lib\obj\box_lib.h"
|
||||||
|
|
||||||
|
#include "..\lib\patterns\select_list.h"
|
||||||
|
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
// //
|
// //
|
||||||
@ -24,7 +26,6 @@
|
|||||||
?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 T_CLIPBOARD_IS_EMPTY "Clipboard is empty"
|
|
||||||
?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" };
|
||||||
|
|
||||||
@ -34,19 +35,14 @@ enum {
|
|||||||
BT_UNLOCK
|
BT_UNLOCK
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define PANEL_TOP_H 20
|
#define PANEL_TOP_H 20
|
||||||
#define PANEL_BOTTOM_H 30
|
#define PANEL_BOTTOM_H 30
|
||||||
#define LIST_PADDING 12
|
#define LIST_PADDING 12
|
||||||
|
|
||||||
llist list;
|
|
||||||
|
|
||||||
proc_info Form;
|
proc_info Form;
|
||||||
|
|
||||||
Clipboard clipboard;
|
Clipboard clipboard;
|
||||||
|
|
||||||
scroll_bar scroll1 = { 18,200,398, 44,18,0,115,15,0,0xeeeeee,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
|
|
||||||
|
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
// //
|
// //
|
||||||
@ -57,9 +53,6 @@ scroll_bar scroll1 = { 18,200,398, 44,18,0,115,15,0,0xeeeeee,0xD2CED0,0x555555,0
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
list.SetFont(8, 14, 0x90);
|
|
||||||
list.no_selection = true;
|
|
||||||
SetEventMask(0x27);
|
SetEventMask(0x27);
|
||||||
load_dll(boxlib, #box_lib_init,0);
|
load_dll(boxlib, #box_lib_init,0);
|
||||||
loop()
|
loop()
|
||||||
@ -71,13 +64,13 @@ void main()
|
|||||||
if (!CheckActiveProcess(Form.ID)) break;
|
if (!CheckActiveProcess(Form.ID)) break;
|
||||||
mouse.get();
|
mouse.get();
|
||||||
scrollbar_v_mouse (#scroll1);
|
scrollbar_v_mouse (#scroll1);
|
||||||
if (list.first != scroll1.position)
|
if (select_list.first != scroll1.position)
|
||||||
{
|
{
|
||||||
list.first = scroll1.position;
|
select_list.first = scroll1.position;
|
||||||
Draw_List();
|
DrawSelectList(clipboard.GetSlotCount());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (mouse.vert) && (list.MouseScroll(mouse.vert)) Draw_List();
|
if (mouse.vert) && (select_list.MouseScroll(mouse.vert)) DrawSelectList(clipboard.GetSlotCount());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
@ -93,7 +86,7 @@ void main()
|
|||||||
|
|
||||||
case evKey:
|
case evKey:
|
||||||
GetKeys();
|
GetKeys();
|
||||||
if (list.ProcessKey(key_scancode)) Draw_List();
|
if (select_list.ProcessKey(key_scancode)) DrawSelectList(clipboard.GetSlotCount());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
@ -103,14 +96,19 @@ void main()
|
|||||||
IF (Form.status_window>=2) break;
|
IF (Form.status_window>=2) break;
|
||||||
if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); break; }
|
if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); break; }
|
||||||
if (Form.width < 570) { MoveSize(OLD,OLD,570,OLD); break; }
|
if (Form.width < 570) { MoveSize(OLD,OLD,570,OLD); break; }
|
||||||
list.SetSizes(LIST_PADDING, LIST_PADDING+PANEL_TOP_H, Form.cwidth-LIST_PADDING-LIST_PADDING-scroll1.size_x,
|
InitSelectList(
|
||||||
Form.cheight-PANEL_BOTTOM_H-PANEL_TOP_H-LIST_PADDING-LIST_PADDING, 20);
|
LIST_PADDING,
|
||||||
|
LIST_PADDING+PANEL_TOP_H,
|
||||||
|
Form.cwidth-LIST_PADDING-LIST_PADDING-scroll1.size_x,
|
||||||
|
Form.cheight-PANEL_BOTTOM_H-PANEL_TOP_H-LIST_PADDING-LIST_PADDING,
|
||||||
|
true
|
||||||
|
);
|
||||||
DrawWindowContent();
|
DrawWindowContent();
|
||||||
Draw_List();
|
DrawSelectList(clipboard.GetSlotCount());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (clipboard.GetSlotCount() > list.count) Draw_List();
|
if (clipboard.GetSlotCount() > select_list.count) DrawSelectList(clipboard.GetSlotCount());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,37 +116,47 @@ void main()
|
|||||||
|
|
||||||
void DrawWindowContent()
|
void DrawWindowContent()
|
||||||
{
|
{
|
||||||
int button_x = list.x;
|
int button_x = select_list.x;
|
||||||
DrawBar(0,0, Form.cwidth, PANEL_TOP_H, system.color.work);
|
DrawBar(0,0, Form.cwidth, PANEL_TOP_H, system.color.work);
|
||||||
DrawBar(0,Form.cheight-PANEL_BOTTOM_H, Form.cwidth, PANEL_BOTTOM_H, system.color.work);
|
DrawBar(0,Form.cheight-PANEL_BOTTOM_H, Form.cwidth, PANEL_BOTTOM_H, system.color.work);
|
||||||
DrawRectangle3D(list.x-2, list.y-2, list.w+3+scroll1.size_x, list.h+3, system.color.work_dark, system.color.work_light);
|
DrawRectangle3D(select_list.x-2, select_list.y-2, select_list.w+3+scroll1.size_x, select_list.h+3, system.color.work_dark, system.color.work_light);
|
||||||
DrawWideRectangle(list.x-LIST_PADDING, list.y-LIST_PADDING, LIST_PADDING*2+list.w+scroll1.size_x, LIST_PADDING*2+list.h, LIST_PADDING-2, system.color.work);
|
DrawWideRectangle(select_list.x-LIST_PADDING, select_list.y-LIST_PADDING, LIST_PADDING*2+select_list.w+scroll1.size_x, LIST_PADDING*2+select_list.h, LIST_PADDING-2, system.color.work);
|
||||||
button_x += DrawStandartCaptButton(button_x, list.y + list.h + 8, BT_DELETE_LAST_SLOT, T_DELETE_LAST_SLOT);
|
button_x += DrawStandartCaptButton(button_x, select_list.y + select_list.h + 8, BT_DELETE_LAST_SLOT, T_DELETE_LAST_SLOT);
|
||||||
button_x += DrawStandartCaptButton(button_x, list.y + 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, list.y + 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);
|
||||||
DrawRectangle(list.x-1, list.y-1, list.w+1+scroll1.size_x, list.h+1, system.color.work_graph);
|
DrawRectangle(select_list.x-1, select_list.y-1, select_list.w+1+scroll1.size_x, select_list.h+1, system.color.work_graph);
|
||||||
WriteText(list.x+12, list.y - 23, 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(list.x+list.w-68, list.y - 23, list.font_type, system.color.work_text, T_COLUMN_VIEW);
|
WriteText(select_list.x+select_list.w-68, select_list.y - 23, select_list.font_type, system.color.work_text, T_COLUMN_VIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawScroller()
|
void DrawSelectList_Line(dword i)
|
||||||
{
|
{
|
||||||
scroll1.bckg_col = MixColors(system.color.work, 0xBBBbbb, 80);
|
int yyy, length, slot_data_type_number;
|
||||||
scroll1.frnt_col = MixColors(system.color.work,0xFFFfff,120);
|
dword line_text[2048];
|
||||||
scroll1.line_col = system.color.work_graph;
|
dword size_kb;
|
||||||
|
dword text_color = 0;
|
||||||
|
|
||||||
scroll1.max_area = list.count;
|
clipboard.GetSlotData(select_list.first + i);
|
||||||
scroll1.cur_area = list.visible;
|
yyy = i*select_list.item_h+select_list.y;
|
||||||
scroll1.position = list.first;
|
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+44, yyy+select_list.text_y, select_list.font_type, text_color, itoa(clipboard.slot_data.size));
|
||||||
|
size_kb = ConvertSizeToKb(clipboard.slot_data.size);
|
||||||
|
WriteText(select_list.x+44, yyy+select_list.text_y, select_list.font_type, text_color, size_kb);
|
||||||
|
slot_data_type_number = clipboard.slot_data.type;
|
||||||
|
WriteText(select_list.x+140, yyy+select_list.text_y, select_list.font_type, text_color, data_type[slot_data_type_number]);
|
||||||
|
WriteText(select_list.x+select_list.w - 88, yyy+select_list.text_y, select_list.font_type, 0x006597, T_VIEW_OPTIONS);
|
||||||
|
DefineButton(select_list.x+select_list.w - 95, yyy, 50, select_list.item_h, 100+i+BT_HIDE, NULL);
|
||||||
|
DefineButton(select_list.x+select_list.w - 95 + 51, yyy, 40, select_list.item_h, 300+i+BT_HIDE, NULL);
|
||||||
|
|
||||||
scroll1.all_redraw=1;
|
length = select_list.w-236 - 95 / select_list.font_w - 2;
|
||||||
scroll1.start_x = list.x + list.w;
|
if (clipboard.slot_data.size-8 < length) length = clipboard.slot_data.size-8;
|
||||||
scroll1.start_y = list.y-1;
|
memmov(#line_text, clipboard.slot_data.content, length);
|
||||||
scroll1.size_y = list.h+2;
|
replace_char(#line_text, 0, 31, length); // 31 is a dot
|
||||||
|
WriteText(select_list.x+236, yyy+select_list.text_y, select_list.font_type, text_color, #line_text);
|
||||||
scrollbar_v_draw(#scroll1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
replace_char(dword in_str, char from_char, to_char, int length) {
|
replace_char(dword in_str, char from_char, to_char, int length) {
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i<length; i++) {
|
for (i=0; i<length; i++) {
|
||||||
@ -157,48 +165,6 @@ replace_char(dword in_str, char from_char, to_char, int length) {
|
|||||||
ESBYTE[in_str+length]=0;
|
ESBYTE[in_str+length]=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw_List()
|
|
||||||
{
|
|
||||||
int i, yyy, list_last, slot_data_type_number, length;
|
|
||||||
dword line_text[2048];
|
|
||||||
dword size_kb;
|
|
||||||
dword text_color = 0;
|
|
||||||
|
|
||||||
list.count = clipboard.GetSlotCount();
|
|
||||||
list.CheckDoesValuesOkey();
|
|
||||||
|
|
||||||
if (list.count > list.visible) list_last = list.visible; else list_last = list.count;
|
|
||||||
|
|
||||||
for (i=0; i<list.visible; i++;) DeleteButton(list.first + i + 100);
|
|
||||||
for (i=0; i<list.visible; i++;) DeleteButton(list.first + i + 300);
|
|
||||||
|
|
||||||
for (i=0; i<list_last; i++;)
|
|
||||||
{
|
|
||||||
clipboard.GetSlotData(list.first + i);
|
|
||||||
yyy = i*list.item_h+list.y;
|
|
||||||
DrawBar(list.x,yyy,list.w, list.item_h, 0xFFFfff);
|
|
||||||
WriteText(list.x+12, yyy+list.text_y, list.font_type, text_color, itoa(list.first + i));
|
|
||||||
//WriteText(list.x+44, yyy+list.text_y, list.font_type, text_color, itoa(clipboard.slot_data.size));
|
|
||||||
size_kb = ConvertSizeToKb(clipboard.slot_data.size);
|
|
||||||
WriteText(list.x+44, yyy+list.text_y, list.font_type, text_color, size_kb);
|
|
||||||
slot_data_type_number = clipboard.slot_data.type;
|
|
||||||
WriteText(list.x+140, yyy+list.text_y, list.font_type, text_color, data_type[slot_data_type_number]);
|
|
||||||
WriteText(list.x+list.w - 88, yyy+list.text_y, list.font_type, 0x006597, T_VIEW_OPTIONS);
|
|
||||||
DefineButton(list.x+list.w - 95, yyy, 50, list.item_h, 100+i+BT_HIDE, NULL);
|
|
||||||
DefineButton(list.x+list.w - 95 + 51, yyy, 40, list.item_h, 300+i+BT_HIDE, NULL);
|
|
||||||
|
|
||||||
length = list.w-236 - 95 / list.font_w - 2;
|
|
||||||
if (clipboard.slot_data.size-8 < length) length = clipboard.slot_data.size-8;
|
|
||||||
memmov(#line_text, clipboard.slot_data.content, length);
|
|
||||||
replace_char(#line_text, 0, 31, length); // 31 is a dot
|
|
||||||
WriteText(list.x+236, yyy+list.text_y, list.font_type, text_color, #line_text);
|
|
||||||
}
|
|
||||||
DrawBar(list.x,i*list.item_h+list.y, list.w, -i*list.item_h+ list.h, 0xFFFfff);
|
|
||||||
if (!list.count) WriteText(-strlen(T_CLIPBOARD_IS_EMPTY)*list.font_w + list.w / 2 + list.x + 1,
|
|
||||||
list.h / 2 - 8 + list.y, list.font_type, 0x999999, T_CLIPBOARD_IS_EMPTY);
|
|
||||||
DrawScroller();
|
|
||||||
}
|
|
||||||
|
|
||||||
int SaveSlotContents(int slot_id) {
|
int SaveSlotContents(int slot_id) {
|
||||||
clipboard.GetSlotData(slot_id);
|
clipboard.GetSlotData(slot_id);
|
||||||
EAX = WriteFile(clipboard.slot_data.size, clipboard.slot_data.content, DEFAULT_SAVE_PATH);
|
EAX = WriteFile(clipboard.slot_data.size, clipboard.slot_data.content, DEFAULT_SAVE_PATH);
|
||||||
@ -221,18 +187,18 @@ int SaveSlotContents(int slot_id) {
|
|||||||
void EventDeleteLastSlot()
|
void EventDeleteLastSlot()
|
||||||
{
|
{
|
||||||
clipboard.DelLastSlot();
|
clipboard.DelLastSlot();
|
||||||
Draw_List();
|
DrawSelectList(clipboard.GetSlotCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventDeleteAllSlots()
|
void EventDeleteAllSlots()
|
||||||
{
|
{
|
||||||
while (clipboard.GetSlotCount()) clipboard.DelLastSlot();
|
while (clipboard.GetSlotCount()) clipboard.DelLastSlot();
|
||||||
Draw_List();
|
DrawSelectList(clipboard.GetSlotCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventResetBufferLock() {
|
void EventResetBufferLock() {
|
||||||
clipboard.ResetBlockingBuffer();
|
clipboard.ResetBlockingBuffer();
|
||||||
Draw_List();
|
DrawSelectList(clipboard.GetSlotCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventOpenAsText(int slot_id) {
|
void EventOpenAsText(int slot_id) {
|
||||||
|
@ -6,9 +6,17 @@ proc_info Form;
|
|||||||
#define T_CAUTION_TITLE "CAUTION"
|
#define T_CAUTION_TITLE "CAUTION"
|
||||||
#define T_CAUTION_PARAGRAPH "Installing additional drivers can be harmful to the stability of the operation system and potentionally can harm hardware."
|
#define T_CAUTION_PARAGRAPH "Installing additional drivers can be harmful to the stability of the operation system and potentionally can harm hardware."
|
||||||
#define T_ASSEPT_RISK "I assept the risk"
|
#define T_ASSEPT_RISK "I assept the risk"
|
||||||
|
#define T_README "Readme"
|
||||||
|
#define T_INSTALL "Install"
|
||||||
|
|
||||||
#define BUTTON_ID_ASSEPT_RISK 10
|
#define BUTTON_ID_ASSEPT_RISK 10
|
||||||
|
#define BUTTON_ID_README 11
|
||||||
|
#define BUTTON_ID_INSTALL 12
|
||||||
|
|
||||||
|
//WINDOW STEPS
|
||||||
|
#define WINDOW_STEP_INTRO 1;
|
||||||
|
#define WINDOW_STEP_DRIVER_LIST 2;
|
||||||
|
char window_step = WINDOW_STEP_INTRO;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
@ -18,6 +26,10 @@ void main()
|
|||||||
case evButton:
|
case evButton:
|
||||||
id=GetButtonID();
|
id=GetButtonID();
|
||||||
if (id==1) ExitProcess();
|
if (id==1) ExitProcess();
|
||||||
|
if (id==BUTTON_ID_ASSEPT_RISK) {
|
||||||
|
window_step = WINDOW_STEP_DRIVER_LIST;
|
||||||
|
goto _EV_WINDOW_REDRAW;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case evKey:
|
case evKey:
|
||||||
@ -25,25 +37,42 @@ void main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
draw_window();
|
_EV_WINDOW_REDRAW:
|
||||||
|
system.color.get();
|
||||||
|
DefineAndDrawWindow(215, 100, 550, 350, 0x33, system.color.work, WINDOW_TITLE);
|
||||||
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
|
if (window_step == WINDOW_STEP_INTRO) draw_intro_window();
|
||||||
|
if (window_step == WINDOW_STEP_DRIVER_LIST) draw_driver_list_window();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void draw_window()
|
void draw_intro_window()
|
||||||
{
|
{
|
||||||
incn y;
|
incn y;
|
||||||
y.n=40;
|
y.n = Form.cheight/2 - 80;
|
||||||
system.color.get();
|
|
||||||
DefineAndDrawWindow(215, 100, 450, 250, 0x33, system.color.work, WINDOW_TITLE);
|
|
||||||
GetProcessInfo(#Form, SelfInfo);
|
|
||||||
WriteTextB(30+2,y.n+2,0x81,MixColors(system.color.work, 0xB92234,220),T_CAUTION_TITLE);
|
WriteTextB(30+2,y.n+2,0x81,MixColors(system.color.work, 0xB92234,220),T_CAUTION_TITLE);
|
||||||
WriteTextB(30,y.n,0x81,0xB92234,T_CAUTION_TITLE);
|
WriteTextB(30,y.n,0x81,0xB92234,T_CAUTION_TITLE);
|
||||||
y.n = DrawTextViewArea(30, y.inc(30), Form.cwidth-60, Form.cheight-140, 15,
|
y.n = DrawTextViewArea(30, y.inc(30), Form.cwidth-60, Form.cheight-140,
|
||||||
T_CAUTION_PARAGRAPH, -1, system.color.work_text);
|
T_CAUTION_PARAGRAPH, -1, system.color.work_text);
|
||||||
DrawStandartCaptButton(30, y.inc(10), BUTTON_ID_ASSEPT_RISK, T_ASSEPT_RISK);
|
DrawStandartCaptButton(30, y.inc(10), BUTTON_ID_ASSEPT_RISK, T_ASSEPT_RISK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw_driver_list_window()
|
||||||
|
{
|
||||||
|
int PADDING = 12;
|
||||||
|
int right_frame_x = Form.cwidth/2 + PADDING + calc(PADDING/2);
|
||||||
|
incn y;
|
||||||
|
y.n = PADDING + 3;
|
||||||
|
//LEFT FRAME
|
||||||
|
DrawBar(PADDING, PADDING, Form.cwidth/2 - PADDING, Form.cheight - PADDING - PADDING, 0xEEEeee);
|
||||||
|
//RIGHT FRAME
|
||||||
|
WriteTextB(right_frame_x, y.n, 0x81, system.color.work_text, "ATI KMS");
|
||||||
|
WriteText(right_frame_x, y.inc(20), 0x80, MixColors(system.color.work, 0xCCCccc,80), "ver 4.4");
|
||||||
|
DrawTextViewArea(right_frame_x-2, y.inc(30), Form.cwidth - right_frame_x - PADDING, Form.cheight-100,
|
||||||
|
T_CAUTION_PARAGRAPH, -1, system.color.work_text);
|
||||||
|
right_frame_x += DrawStandartCaptButton(right_frame_x, Form.cheight-40, BUTTON_ID_README, T_README);
|
||||||
|
DrawStandartCaptButton(right_frame_x, Form.cheight-40, BUTTON_ID_INSTALL, T_INSTALL);
|
||||||
|
}
|
||||||
|
@ -279,10 +279,11 @@ Normal line break '\n' must be applied.
|
|||||||
Long lines should be breaked by word.
|
Long lines should be breaked by word.
|
||||||
TODO: scroll
|
TODO: scroll
|
||||||
*/
|
*/
|
||||||
:int DrawTextViewArea(int x,y,w,h,line_h, dword buf_start, bg_col, text_col)
|
:int DrawTextViewArea(int x,y,w,h, dword buf_start, bg_col, text_col)
|
||||||
{
|
{
|
||||||
dword write_start;
|
dword write_start;
|
||||||
dword buf_end;
|
dword buf_end;
|
||||||
|
int line_h = 15;
|
||||||
int label_length_max;
|
int label_length_max;
|
||||||
int write_length;
|
int write_length;
|
||||||
bool end_found;
|
bool end_found;
|
||||||
|
@ -26,7 +26,7 @@ dword I_Path = #program_path;
|
|||||||
char param[4096];
|
char param[4096];
|
||||||
char program_path[4096];
|
char program_path[4096];
|
||||||
|
|
||||||
#define bool char
|
#define bool int
|
||||||
|
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
#define OLD -1
|
#define OLD -1
|
||||||
|
54
programs/cmm/lib/patterns/select_list.h
Normal file
54
programs/cmm/lib/patterns/select_list.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
llist select_list;
|
||||||
|
scroll_bar scroll1 = { 18,200,398, 44,18,0,115,15,0,0xeeeeee,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
|
||||||
|
dword select_list_count_offset;
|
||||||
|
|
||||||
|
?define T_SELECT_LIST_NO_DATA "No data to show"
|
||||||
|
|
||||||
|
void InitSelectList(dword _x, _y, _w, _h, _no_selection)
|
||||||
|
{
|
||||||
|
select_list.no_selection = _no_selection;
|
||||||
|
select_list.SetFont(8, 14, 0x90);
|
||||||
|
select_list.SetSizes(_x, _y, _w, _h, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawSelectList(dword _items_count)
|
||||||
|
{
|
||||||
|
int i, list_last;
|
||||||
|
|
||||||
|
select_list.count = _items_count;
|
||||||
|
select_list.CheckDoesValuesOkey();
|
||||||
|
|
||||||
|
if (select_list.count > select_list.visible) list_last = select_list.visible; else list_last = select_list.count;
|
||||||
|
|
||||||
|
for (i=0; i<select_list.visible; i++;) DeleteButton(select_list.first + i + 100);
|
||||||
|
for (i=0; i<select_list.visible; i++;) DeleteButton(select_list.first + i + 300);
|
||||||
|
|
||||||
|
for (i=0; i<list_last; i++;)
|
||||||
|
{
|
||||||
|
DrawBar(select_list.x,i*select_list.item_h+select_list.y,select_list.w, select_list.item_h, 0xFFFfff);
|
||||||
|
DrawSelectList_Line(i); //NEED TO BE IMPLEMENTED IN APP
|
||||||
|
}
|
||||||
|
DrawBar(select_list.x,i*select_list.item_h+select_list.y, select_list.w, -i*select_list.item_h+ select_list.h, 0xFFFfff);
|
||||||
|
if (!select_list.count) WriteText(-strlen(T_SELECT_LIST_NO_DATA)*select_list.font_w + select_list.w / 2 + select_list.x + 1,
|
||||||
|
select_list.h / 2 - 8 + select_list.y, select_list.font_type, 0x999999, T_SELECT_LIST_NO_DATA);
|
||||||
|
DrawSelectListScroller();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DrawSelectListScroller()
|
||||||
|
{
|
||||||
|
scroll1.bckg_col = MixColors(system.color.work, 0xBBBbbb, 80);
|
||||||
|
scroll1.frnt_col = MixColors(system.color.work,0xFFFfff,120);
|
||||||
|
scroll1.line_col = system.color.work_graph;
|
||||||
|
|
||||||
|
scroll1.max_area = select_list.count;
|
||||||
|
scroll1.cur_area = select_list.visible;
|
||||||
|
scroll1.position = select_list.first;
|
||||||
|
|
||||||
|
scroll1.all_redraw=1;
|
||||||
|
scroll1.start_x = select_list.x + select_list.w;
|
||||||
|
scroll1.start_y = select_list.y-1;
|
||||||
|
scroll1.size_y = select_list.h+2;
|
||||||
|
|
||||||
|
scrollbar_v_draw(#scroll1);
|
||||||
|
}
|
@ -7,7 +7,7 @@ SKIN_PARAMS \
|
|||||||
bouter=0x33383A:\ ; border outer
|
bouter=0x33383A:\ ; border outer
|
||||||
bframe=0x626262],\ ; border middle
|
bframe=0x626262],\ ; border middle
|
||||||
colors inactive = [binner=0x626262:\ ; border inner
|
colors inactive = [binner=0x626262:\ ; border inner
|
||||||
bouter=0x747474:\ ; border outer
|
bouter=0x33383A:\ ; border outer
|
||||||
bframe=0x626262],\ ; border middle
|
bframe=0x626262],\ ; border middle
|
||||||
dtp = 'default.dtp' ; dtp colors
|
dtp = 'default.dtp' ; dtp colors
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
Loading…
Reference in New Issue
Block a user