2013-10-24 00:05:17 +02:00
|
|
|
|
//11.03.12 - start!
|
2020-11-27 14:25:36 +01:00
|
|
|
|
//ver 2.31
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2013-10-24 23:45:17 +02:00
|
|
|
|
#ifndef AUTOBUILD
|
|
|
|
|
?include "lang.h--"
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-05-20 12:40:10 +02:00
|
|
|
|
#define MEMSIZE 200*1024
|
2020-05-10 14:49:02 +02:00
|
|
|
|
#include "../lib/mem.h"
|
|
|
|
|
#include "../lib/strings.h"
|
|
|
|
|
#include "../lib/io.h"
|
|
|
|
|
#include "../lib/list_box.h"
|
|
|
|
|
#include "../lib/obj/libimg.h"
|
|
|
|
|
#include "../lib/gui.h"
|
2018-09-11 23:09:14 +02:00
|
|
|
|
|
2020-05-10 14:49:02 +02:00
|
|
|
|
#include "../lib/obj/box_lib.h"
|
|
|
|
|
#include "../lib/obj/proc_lib.h"
|
|
|
|
|
#include "../lib/obj/libini.h"
|
2013-10-24 23:45:17 +02:00
|
|
|
|
|
2020-05-10 14:49:02 +02:00
|
|
|
|
#include "../lib/patterns/select_list.h"
|
|
|
|
|
#include "../lib/patterns/simple_open_dialog.h"
|
2016-02-13 12:00:14 +01:00
|
|
|
|
|
2019-03-18 23:31:13 +01:00
|
|
|
|
#include "ui_elements_preview.h"
|
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
//===================================================//
|
|
|
|
|
// //
|
|
|
|
|
// DATA //
|
|
|
|
|
// //
|
|
|
|
|
//===================================================//
|
|
|
|
|
|
2013-10-24 23:45:17 +02:00
|
|
|
|
#ifdef LANG_RUS
|
2016-02-13 12:00:14 +01:00
|
|
|
|
?define WINDOW_HEADER "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ன<EFBFBD><EFBFBD> <20><><EFBFBD>ଫ<EFBFBD><E0ACAB><EFBFBD><EFBFBD>"
|
2020-05-10 14:49:02 +02:00
|
|
|
|
?define T_SKINS " <20>⨫<EFBFBD> <20><><EFBFBD><EFBFBD>"
|
|
|
|
|
?define T_WALLPAPERS " <20><><EFBFBD><EFBFBD>"
|
2018-09-11 23:09:14 +02:00
|
|
|
|
?define T_SELECT_FOLDER "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>"
|
2020-04-11 23:17:55 +02:00
|
|
|
|
?define MENU_LIST "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<> |Enter\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<> |Del"
|
2019-03-15 13:19:45 +01:00
|
|
|
|
?define T_PICTURE_MODE " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>⨭<EFBFBD><E2A8AD> "
|
|
|
|
|
?define T_CHECKBOX_STRETCH "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
?define T_CHECKBOX_TILED "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
2019-03-15 15:05:59 +01:00
|
|
|
|
?define T_UPDATE_DOCK "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Dock-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
2013-10-24 23:45:17 +02:00
|
|
|
|
#else
|
|
|
|
|
?define WINDOW_HEADER "Appearance"
|
2020-05-10 14:49:02 +02:00
|
|
|
|
?define T_SKINS " Skins"
|
|
|
|
|
?define T_WALLPAPERS " Wallpapers"
|
2019-03-15 13:19:45 +01:00
|
|
|
|
?define T_SELECT_FOLDER "Select folder"
|
2020-04-11 23:17:55 +02:00
|
|
|
|
?define MENU_LIST "Open file |Enter\nDelete file |Del"
|
2019-03-15 13:19:45 +01:00
|
|
|
|
?define T_PICTURE_MODE " Picture Mode "
|
|
|
|
|
?define T_CHECKBOX_STRETCH "Stretch"
|
|
|
|
|
?define T_CHECKBOX_TILED "Tiled"
|
2019-03-15 15:05:59 +01:00
|
|
|
|
?define T_UPDATE_DOCK "Update Dock"
|
2013-10-24 23:45:17 +02:00
|
|
|
|
#endif
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
#define PANEL_H 40
|
2018-04-11 19:46:08 +02:00
|
|
|
|
#define LP 10 //LIST_PADDING
|
2019-03-10 20:46:52 +01:00
|
|
|
|
char skins_folder_path[4096];
|
|
|
|
|
char wallp_folder_path[4096];
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2016-02-20 14:06:19 +01:00
|
|
|
|
signed int active_skin=-1, active_wallpaper=-1;
|
2018-09-11 23:09:14 +02:00
|
|
|
|
enum {
|
2020-05-10 14:49:02 +02:00
|
|
|
|
BASE_TAB_BUTTON_ID=2,
|
|
|
|
|
BTN_SELECT_WALLP_FOLDER=10 };
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
|
|
|
|
char folder_path[4096];
|
|
|
|
|
char cur_file_path[4096];
|
2018-11-12 17:27:48 +01:00
|
|
|
|
char cur_skin_path[4096];
|
2013-10-24 00:05:17 +02:00
|
|
|
|
char temp_filename[4096];
|
2016-01-26 00:13:50 +01:00
|
|
|
|
int files_mas[400];
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
|
|
|
|
int cur;
|
|
|
|
|
|
|
|
|
|
proc_info Form;
|
2018-04-19 22:12:07 +02:00
|
|
|
|
block skp;
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2020-05-10 14:49:02 +02:00
|
|
|
|
enum {SKINS, WALLPAPERS};
|
|
|
|
|
|
|
|
|
|
_tabs tabs = { LP, LP, NULL, BASE_TAB_BUTTON_ID };
|
2018-04-11 19:46:08 +02:00
|
|
|
|
|
2019-03-15 15:05:59 +01:00
|
|
|
|
checkbox update_docky = { T_UPDATE_DOCK, false };
|
2018-04-22 15:33:01 +02:00
|
|
|
|
|
2018-09-11 23:09:14 +02:00
|
|
|
|
char default_dir[] = "/rd/1";
|
|
|
|
|
od_filter filter2 = { 8, "TXT\0\0" };
|
|
|
|
|
|
2019-03-15 13:19:45 +01:00
|
|
|
|
checkbox optionbox_stretch = { T_CHECKBOX_STRETCH, true };
|
|
|
|
|
checkbox optionbox_tiled = { T_CHECKBOX_TILED, false };
|
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
//===================================================//
|
|
|
|
|
// //
|
|
|
|
|
// CODE //
|
|
|
|
|
// //
|
|
|
|
|
//===================================================//
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2019-03-10 20:46:52 +01:00
|
|
|
|
void GetRealFolderPathes()
|
|
|
|
|
{
|
|
|
|
|
char real_skin_path[4096];
|
|
|
|
|
SetCurDir("/kolibrios");
|
|
|
|
|
GetCurDir(#real_skin_path, sizeof(real_skin_path));
|
|
|
|
|
sprintf(#skins_folder_path, "%s/res/skins", #real_skin_path);
|
|
|
|
|
sprintf(#wallp_folder_path, "%s/res/wallpapers", #real_skin_path);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 00:05:17 +02:00
|
|
|
|
void main()
|
|
|
|
|
{
|
2020-05-10 14:49:02 +02:00
|
|
|
|
int id;
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2019-03-10 20:46:52 +01:00
|
|
|
|
GetRealFolderPathes();
|
|
|
|
|
|
2015-07-29 22:43:05 +02:00
|
|
|
|
load_dll(boxlib, #box_lib_init,0);
|
2018-11-06 18:05:54 +01:00
|
|
|
|
load_dll(libini, #lib_init,1);
|
2020-05-10 14:49:02 +02:00
|
|
|
|
load_dll(libimg, #libimg_init,1);
|
2018-09-11 23:09:14 +02:00
|
|
|
|
load_dll(Proc_lib, #OpenDialog_init,0);
|
|
|
|
|
o_dialog.type = 2; //select folder
|
|
|
|
|
OpenDialog_init stdcall (#o_dialog);
|
|
|
|
|
|
2020-05-10 14:49:02 +02:00
|
|
|
|
tabs.add(T_SKINS, #EventTabSkinsClick);
|
|
|
|
|
tabs.add(T_WALLPAPERS, #EventTabWallpappersClick);
|
|
|
|
|
tabs.draw_active_tab();
|
2018-09-11 23:09:14 +02:00
|
|
|
|
|
2018-11-12 17:27:48 +01:00
|
|
|
|
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
|
2016-01-26 00:13:50 +01:00
|
|
|
|
loop() switch(WaitEvent())
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
|
|
|
|
case evMouse:
|
2016-11-02 15:30:45 +01:00
|
|
|
|
SelectList_ProcessMouse();
|
2018-09-11 23:09:14 +02:00
|
|
|
|
|
|
|
|
|
if (tabs.active_tab == SKINS) {
|
|
|
|
|
edit_box_mouse stdcall (#edit_cmm);
|
|
|
|
|
edit_box_mouse stdcall (#edit_st);
|
|
|
|
|
}
|
2016-02-13 12:00:14 +01:00
|
|
|
|
|
2020-04-11 23:17:55 +02:00
|
|
|
|
if (mouse.key&MOUSE_RIGHT) && (mouse.up)
|
|
|
|
|
&&(select_list.MouseOver(mouse.x, mouse.y)) {
|
2016-11-02 13:19:15 +01:00
|
|
|
|
select_list.ProcessMouse(mouse.x, mouse.y);
|
2016-11-02 15:30:45 +01:00
|
|
|
|
SelectList_Draw();
|
2018-09-11 23:09:14 +02:00
|
|
|
|
EventSetNewCurrent();
|
2020-06-04 00:21:39 +02:00
|
|
|
|
open_lmenu(mouse.x, mouse.y, MENU_TOP_RIGHT, NULL, MENU_LIST);
|
2016-02-13 12:00:14 +01:00
|
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evButton:
|
|
|
|
|
id=GetButtonID();
|
2018-11-12 17:27:48 +01:00
|
|
|
|
if (id==1) EventExit();
|
2018-09-11 23:09:14 +02:00
|
|
|
|
if (id==BTN_SELECT_WALLP_FOLDER) EventSelectWallpFolder();
|
2020-05-10 14:49:02 +02:00
|
|
|
|
tabs.click(id);
|
2018-04-19 22:12:07 +02:00
|
|
|
|
checkbox1.click(id);
|
2018-04-21 14:28:00 +02:00
|
|
|
|
spinbox1.click(id);
|
2019-03-15 15:05:59 +01:00
|
|
|
|
if (update_docky.click(id)) EventUpdateDocky();
|
2019-03-15 13:19:45 +01:00
|
|
|
|
if (!optionbox_stretch.checked) && (optionbox_stretch.click(id)) EventSetWallpMode_Stretch();
|
|
|
|
|
if (!optionbox_tiled.checked) && (optionbox_tiled.click(id)) EventSetWallpMode_Tiled();
|
2013-10-24 00:05:17 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evKey:
|
2015-08-10 12:47:21 +02:00
|
|
|
|
GetKeys();
|
2016-11-02 13:19:15 +01:00
|
|
|
|
if (select_list.ProcessKey(key_scancode)) EventApply();
|
2016-02-13 12:00:14 +01:00
|
|
|
|
if (key_scancode==SCAN_CODE_ENTER) EventOpenFile();
|
2020-05-10 14:49:02 +02:00
|
|
|
|
if (key_scancode==SCAN_CODE_TAB) tabs.click(tabs.active_tab ^ 1);
|
2016-02-13 12:00:14 +01:00
|
|
|
|
if (key_scancode==SCAN_CODE_DEL) EventDeleteFile();
|
2018-09-10 21:47:52 +02:00
|
|
|
|
|
2018-10-29 12:39:31 +01:00
|
|
|
|
if (! edit_cmm.flags & ed_focus) && (! edit_st.flags & ed_focus)
|
2016-11-02 13:19:15 +01:00
|
|
|
|
for (id=select_list.cur_y+1; id<select_list.count; id++)
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
2016-02-13 12:00:14 +01:00
|
|
|
|
strcpy(#temp_filename, io.dir.position(files_mas[id]));
|
|
|
|
|
if (temp_filename[0]==key_ascii) || (temp_filename[0]==key_ascii-32)
|
|
|
|
|
{
|
2016-11-02 13:19:15 +01:00
|
|
|
|
select_list.cur_y = id - 1;
|
|
|
|
|
select_list.KeyDown();
|
2016-02-13 12:00:14 +01:00
|
|
|
|
EventApply();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
}
|
2018-09-10 21:47:52 +02:00
|
|
|
|
|
2018-09-11 23:09:14 +02:00
|
|
|
|
if (tabs.active_tab == SKINS) {
|
|
|
|
|
EAX = key_ascii << 8;
|
|
|
|
|
edit_box_key stdcall (#edit_cmm);
|
|
|
|
|
edit_box_key stdcall (#edit_st);
|
|
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
break;
|
|
|
|
|
|
2018-09-11 23:09:14 +02:00
|
|
|
|
case evReDraw:
|
|
|
|
|
draw_window();
|
2020-04-11 23:17:55 +02:00
|
|
|
|
EventHandleMenuClick();
|
2013-10-24 00:05:17 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-11 23:09:14 +02:00
|
|
|
|
void draw_window()
|
|
|
|
|
{
|
2020-05-10 14:49:02 +02:00
|
|
|
|
sc.get();
|
2020-04-18 01:52:24 +02:00
|
|
|
|
DefineAndDrawWindow(screen.width-600/2,80,630,504+skin_height,0x34,sc.work,WINDOW_HEADER,0);
|
2018-09-11 23:09:14 +02:00
|
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
|
|
|
|
IF (Form.status_window>=2) return;
|
|
|
|
|
DrawWindowContent();
|
|
|
|
|
}
|
2018-04-19 22:12:07 +02:00
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
void DrawWindowContent()
|
|
|
|
|
{
|
|
|
|
|
int id;
|
2018-09-11 23:09:14 +02:00
|
|
|
|
int list_w;
|
|
|
|
|
|
2020-04-18 01:52:24 +02:00
|
|
|
|
sc.get();
|
2019-03-15 15:05:59 +01:00
|
|
|
|
|
2019-03-15 13:19:45 +01:00
|
|
|
|
if (tabs.active_tab == SKINS) list_w=250; else list_w=350;
|
2018-04-11 19:46:08 +02:00
|
|
|
|
|
|
|
|
|
tabs.w = Form.cwidth-LP-LP;
|
2020-05-10 14:49:02 +02:00
|
|
|
|
tabs.draw();
|
|
|
|
|
DrawIcon16(tabs.x + TAB_PADDING, 15, sc.work, 17);
|
|
|
|
|
DrawIcon16(strlen(T_SKINS)*8 + tabs.x + TAB_PADDING + TAB_PADDING, 15, sc.work, 6);
|
|
|
|
|
|
2016-11-02 13:19:15 +01:00
|
|
|
|
id = select_list.cur_y;
|
2016-11-02 15:30:45 +01:00
|
|
|
|
SelectList_Init(
|
2018-04-11 19:46:08 +02:00
|
|
|
|
tabs.x+TAB_PADDING,
|
|
|
|
|
tabs.y+TAB_HEIGHT+TAB_PADDING,
|
2018-09-11 23:09:14 +02:00
|
|
|
|
list_w,
|
2021-06-24 22:42:19 +02:00
|
|
|
|
Form.cheight-LP-LP - TAB_PADDING - TAB_PADDING - TAB_HEIGHT
|
2016-11-02 15:30:45 +01:00
|
|
|
|
);
|
2016-11-02 13:19:15 +01:00
|
|
|
|
select_list.cur_y = id;
|
2018-04-19 22:12:07 +02:00
|
|
|
|
|
|
|
|
|
skp.set_size(
|
2018-04-21 14:28:00 +02:00
|
|
|
|
select_list.x + select_list.w + TAB_PADDING + scroll1.size_x + 20,
|
2019-03-15 15:05:59 +01:00
|
|
|
|
select_list.y + 30 + 50,
|
2018-09-11 23:09:14 +02:00
|
|
|
|
list_w,
|
2019-03-15 15:05:59 +01:00
|
|
|
|
230 //select_list.h - 50 - 50
|
2018-04-19 22:12:07 +02:00
|
|
|
|
);
|
|
|
|
|
|
2016-11-02 15:30:45 +01:00
|
|
|
|
SelectList_Draw();
|
2016-11-03 13:41:15 +01:00
|
|
|
|
SelectList_DrawBorder();
|
2020-04-18 01:52:24 +02:00
|
|
|
|
//DrawWideRectangle(0, 0, Form.cwidth, Form.cheight, LP, sc.work);
|
2018-04-19 22:12:07 +02:00
|
|
|
|
|
|
|
|
|
if (tabs.active_tab == SKINS)
|
|
|
|
|
{
|
2019-03-15 15:05:59 +01:00
|
|
|
|
update_docky.draw(skp.x, select_list.y+15);
|
2018-04-19 22:12:07 +02:00
|
|
|
|
DrawFrame(skp.x, skp.y, skp.w, skp.h, " Components Preview ");
|
2019-03-18 23:31:13 +01:00
|
|
|
|
DrawUiElementsPreview(skp.x+20, skp.y, skp.h);
|
2018-04-19 22:12:07 +02:00
|
|
|
|
}
|
2018-09-11 23:09:14 +02:00
|
|
|
|
if (tabs.active_tab == WALLPAPERS)
|
|
|
|
|
{
|
2019-03-15 13:19:45 +01:00
|
|
|
|
skp.x -= TAB_PADDING + 3;
|
|
|
|
|
DrawStandartCaptButton(skp.x, select_list.y, BTN_SELECT_WALLP_FOLDER, T_SELECT_FOLDER);
|
|
|
|
|
DrawFrame(skp.x, select_list.y+50, 180, 80, T_PICTURE_MODE);
|
|
|
|
|
optionbox_stretch.draw(skp.x+14, select_list.y+70);
|
|
|
|
|
optionbox_tiled.draw(skp.x+14, select_list.y+97);
|
2018-09-11 23:09:14 +02:00
|
|
|
|
}
|
2016-02-13 12:00:14 +01:00
|
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
void Open_Dir()
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
2016-02-13 12:00:14 +01:00
|
|
|
|
int j;
|
2016-11-02 13:19:15 +01:00
|
|
|
|
select_list.count = 0;
|
2016-02-13 12:00:14 +01:00
|
|
|
|
if(io.dir.buffer)free(io.dir.buffer);
|
|
|
|
|
io.dir.load(#folder_path,DIR_ONLYREAL);
|
|
|
|
|
for (j=0; j<io.dir.count; j++)
|
2013-12-26 23:51:43 +01:00
|
|
|
|
{
|
2016-02-13 12:00:14 +01:00
|
|
|
|
strcpy(#temp_filename, io.dir.position(j));
|
|
|
|
|
strlwr(#temp_filename);
|
2018-09-11 23:09:14 +02:00
|
|
|
|
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,".png")!=0)
|
|
|
|
|
&& (strcmpi(#temp_filename+strlen(#temp_filename)-4,".jpg")!=0)
|
|
|
|
|
&& (strcmpi(#temp_filename+strlen(#temp_filename)-5,".jpeg")!=0)
|
|
|
|
|
&& (strcmpi(#temp_filename+strlen(#temp_filename)-4,".gif")!=0) continue;
|
|
|
|
|
}
|
2016-11-02 13:19:15 +01:00
|
|
|
|
cur = select_list.count;
|
2016-02-13 12:00:14 +01:00
|
|
|
|
files_mas[cur]=j;
|
2016-11-02 13:19:15 +01:00
|
|
|
|
select_list.count++;
|
2013-12-26 23:51:43 +01:00
|
|
|
|
}
|
2020-11-27 14:25:36 +01:00
|
|
|
|
Sort_by_Name(0, select_list.count-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Sort_by_Name(int a, b) // for the first call: a = 0, b = sizeof(mas) - 1
|
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
int isn = a;
|
|
|
|
|
if (a >= b) return;
|
|
|
|
|
for (j = a; j <= b; j++) {
|
|
|
|
|
if (strcmpi(io.dir.position(files_mas[j]), io.dir.position(files_mas[b]))<=0) {
|
|
|
|
|
files_mas[isn] >< files_mas[j];
|
|
|
|
|
isn++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Sort_by_Name(a, isn-2);
|
|
|
|
|
Sort_by_Name(isn, b);
|
2016-02-13 12:00:14 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-02 15:30:45 +01:00
|
|
|
|
void SelectList_DrawLine(dword i)
|
2016-02-13 12:00:14 +01:00
|
|
|
|
{
|
2021-06-05 17:18:11 +02:00
|
|
|
|
int yyy;
|
2016-11-02 13:19:15 +01:00
|
|
|
|
|
|
|
|
|
cur = select_list.first + i;
|
|
|
|
|
strcpy(#temp_filename, io.dir.position(files_mas[cur]));
|
|
|
|
|
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)
|
|
|
|
|
{
|
2020-04-18 01:52:24 +02:00
|
|
|
|
DrawBar(select_list.x, yyy, select_list.w, select_list.item_h, sc.button);
|
|
|
|
|
WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,sc.button_text, #temp_filename);
|
2016-11-02 13:19:15 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2013-12-26 23:51:43 +01:00
|
|
|
|
{
|
2016-11-02 13:19:15 +01:00
|
|
|
|
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);
|
2013-12-26 23:51:43 +01:00
|
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-02 15:30:45 +01:00
|
|
|
|
void SelectList_LineChanged()
|
|
|
|
|
{
|
|
|
|
|
EventApply();
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-20 21:34:09 +02:00
|
|
|
|
void ActivateTab(int _id)
|
|
|
|
|
{
|
|
|
|
|
select_list.ClearList();
|
|
|
|
|
Open_Dir();
|
|
|
|
|
if (!select_list.count) notify("'No files were found' -E");
|
|
|
|
|
select_list.cur_y = _id;
|
|
|
|
|
if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y;
|
|
|
|
|
select_list.CheckDoesValuesOkey();
|
|
|
|
|
if (select_list.w) draw_window();
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
//===================================================//
|
|
|
|
|
// //
|
|
|
|
|
// EVENTS //
|
|
|
|
|
// //
|
|
|
|
|
//===================================================//
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2020-05-10 14:49:02 +02:00
|
|
|
|
void EventTabSkinsClick()
|
2013-10-24 23:45:17 +02:00
|
|
|
|
{
|
2020-05-10 14:49:02 +02:00
|
|
|
|
active_wallpaper = select_list.cur_y;
|
|
|
|
|
strcpy(#folder_path, #skins_folder_path);
|
2020-05-20 21:34:09 +02:00
|
|
|
|
ActivateTab(active_skin);
|
2020-05-10 14:49:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EventTabWallpappersClick()
|
|
|
|
|
{
|
|
|
|
|
active_skin = select_list.cur_y;
|
|
|
|
|
strcpy(#folder_path, #wallp_folder_path);
|
2020-05-20 21:34:09 +02:00
|
|
|
|
ActivateTab(active_wallpaper);
|
2016-02-13 12:00:14 +01:00
|
|
|
|
}
|
2013-10-24 23:45:17 +02:00
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
void EventDeleteFile()
|
|
|
|
|
{
|
|
|
|
|
io.del(#cur_file_path);
|
|
|
|
|
Open_Dir();
|
|
|
|
|
EventApply();
|
|
|
|
|
}
|
2013-10-24 23:45:17 +02:00
|
|
|
|
|
2018-09-11 23:09:14 +02:00
|
|
|
|
void EventSetNewCurrent()
|
|
|
|
|
{
|
|
|
|
|
cur = select_list.cur_y;
|
|
|
|
|
sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EventSelectWallpFolder()
|
|
|
|
|
{
|
|
|
|
|
OpenDialog_start stdcall (#o_dialog);
|
|
|
|
|
if (o_dialog.status) {
|
|
|
|
|
strcpy(#wallp_folder_path, #opendir_path);
|
2020-05-10 14:49:02 +02:00
|
|
|
|
EventTabWallpappersClick();
|
2018-09-11 23:09:14 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-15 13:19:45 +01:00
|
|
|
|
void EventSetWallpMode_Stretch()
|
|
|
|
|
{
|
|
|
|
|
optionbox_tiled.checked = false;
|
|
|
|
|
optionbox_tiled.redraw();
|
|
|
|
|
EventApply();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EventSetWallpMode_Tiled()
|
|
|
|
|
{
|
|
|
|
|
optionbox_stretch.checked = false;
|
|
|
|
|
optionbox_stretch.redraw();
|
|
|
|
|
EventApply();
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-15 15:05:59 +01:00
|
|
|
|
#include "..\lib\patterns\restart_process.h"
|
2016-02-13 12:00:14 +01:00
|
|
|
|
void EventApply()
|
|
|
|
|
{
|
2018-09-11 23:09:14 +02:00
|
|
|
|
char kivpath[4096+10];
|
|
|
|
|
EventSetNewCurrent();
|
2016-02-20 14:06:19 +01:00
|
|
|
|
if (tabs.active_tab==SKINS)
|
2016-02-13 12:00:14 +01:00
|
|
|
|
{
|
2016-11-02 13:19:15 +01:00
|
|
|
|
cur = select_list.cur_y;
|
2016-02-13 12:00:14 +01:00
|
|
|
|
SetSystemSkin(#cur_file_path);
|
2019-03-15 15:05:59 +01:00
|
|
|
|
SelectList_Draw();
|
2018-11-12 17:27:48 +01:00
|
|
|
|
strcpy(#cur_skin_path, #cur_file_path);
|
2019-03-15 15:05:59 +01:00
|
|
|
|
EventUpdateDocky();
|
2016-02-13 12:00:14 +01:00
|
|
|
|
}
|
2016-02-20 14:06:19 +01:00
|
|
|
|
if (tabs.active_tab==WALLPAPERS)
|
2016-02-13 12:00:14 +01:00
|
|
|
|
{
|
2018-11-12 17:27:48 +01:00
|
|
|
|
SelectList_Draw();
|
2019-03-15 13:19:45 +01:00
|
|
|
|
if (optionbox_stretch.checked) strcpy(#kivpath, "\\S__");
|
|
|
|
|
if (optionbox_tiled.checked) strcpy(#kivpath, "\\T__");
|
2018-09-11 23:09:14 +02:00
|
|
|
|
strcat(#kivpath, #cur_file_path);
|
|
|
|
|
RunProgram("/sys/media/kiv", #kivpath);
|
2016-02-13 12:00:14 +01:00
|
|
|
|
}
|
2013-10-24 23:45:17 +02:00
|
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2019-03-15 15:05:59 +01:00
|
|
|
|
void EventUpdateDocky()
|
|
|
|
|
{
|
|
|
|
|
if (!update_docky.checked) return;
|
|
|
|
|
KillProcessByName("@docky", MULTIPLE);
|
|
|
|
|
RunProgram("/sys/@docky",NULL);
|
|
|
|
|
pause(50);
|
|
|
|
|
ActivateWindow(GetProcessSlot(Form.ID));
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
void EventOpenFile()
|
|
|
|
|
{
|
2016-02-20 14:06:19 +01:00
|
|
|
|
if (tabs.active_tab==SKINS) RunProgram("/sys/skincfg", #cur_file_path);
|
|
|
|
|
if (tabs.active_tab==WALLPAPERS) RunProgram("/sys/media/kiv", #cur_file_path);
|
2016-02-13 12:00:14 +01:00
|
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2020-05-05 23:42:00 +02:00
|
|
|
|
_ini ini = { "/sys/settings/system.ini", "style" };
|
2018-11-12 17:27:48 +01:00
|
|
|
|
void EventExit()
|
|
|
|
|
{
|
2019-03-16 22:06:09 +01:00
|
|
|
|
if (cur_skin_path) ini.SetString("skin", #cur_skin_path, strlen(#cur_skin_path));
|
2018-11-12 17:27:48 +01:00
|
|
|
|
ExitProcess();
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-11 23:17:55 +02:00
|
|
|
|
void EventHandleMenuClick()
|
|
|
|
|
{
|
|
|
|
|
switch (get_menu_click())
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
EventOpenFile();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
EventDeleteFile();
|
|
|
|
|
break;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 00:05:17 +02:00
|
|
|
|
stop:
|