2013-10-24 00:05:17 +02:00
|
|
|
//11.03.12 - start!
|
|
|
|
|
2021-12-24 21:07:57 +01:00
|
|
|
#define MEMSIZE 1024*70
|
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/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"
|
2021-12-21 18:22:15 +01:00
|
|
|
#include "../lib/patterns/restart_process.h"
|
2016-02-13 12:00:14 +01:00
|
|
|
|
2021-12-30 00:09:18 +01:00
|
|
|
dword fmas;
|
|
|
|
|
2019-03-18 23:31:13 +01:00
|
|
|
#include "ui_elements_preview.h"
|
2021-12-22 02:26:10 +01:00
|
|
|
#include "const.h"
|
2019-03-18 23:31:13 +01:00
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
//===================================================//
|
|
|
|
// //
|
|
|
|
// DATA //
|
|
|
|
// //
|
|
|
|
//===================================================//
|
|
|
|
|
2021-12-30 00:09:18 +01:00
|
|
|
int active_skin=-1, active_wallpaper=-1, active_screensaver=-1;
|
2021-12-25 11:36:30 +01:00
|
|
|
|
2019-03-15 15:05:59 +01:00
|
|
|
checkbox update_docky = { T_UPDATE_DOCK, false };
|
2018-04-22 15:33:01 +02:00
|
|
|
|
2021-12-24 21:07:57 +01:00
|
|
|
checkbox optionbox_stretch = { T_CHECKBOX_STRETCH, false };
|
2019-03-15 13:19:45 +01:00
|
|
|
checkbox optionbox_tiled = { T_CHECKBOX_TILED, false };
|
2021-12-24 21:07:57 +01:00
|
|
|
checkbox optionbox_auto = { T_CHECKBOX_AUTO, true };
|
2019-03-15 13:19:45 +01:00
|
|
|
|
2021-12-28 19:24:06 +01:00
|
|
|
char ss_available[200];
|
|
|
|
|
2021-12-24 21:07:57 +01:00
|
|
|
collection list;
|
2021-12-23 13:27:15 +01:00
|
|
|
|
2021-12-30 00:09:18 +01:00
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
//===================================================//
|
|
|
|
// //
|
|
|
|
// CODE //
|
|
|
|
// //
|
|
|
|
//===================================================//
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2021-12-23 13:27:15 +01:00
|
|
|
int id, i;
|
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);
|
2018-09-11 23:09:14 +02:00
|
|
|
load_dll(Proc_lib, #OpenDialog_init,0);
|
|
|
|
OpenDialog_init stdcall (#o_dialog);
|
|
|
|
|
2021-12-25 11:36:30 +01:00
|
|
|
GetIniSettings();
|
|
|
|
|
2021-12-21 18:22:15 +01:00
|
|
|
tabs.add(#t_skins, #EventTabSkinsClick);
|
|
|
|
tabs.add(#t_wallpapers, #EventTabWallpappersClick);
|
|
|
|
tabs.add(#t_screensaver, #EventTabScreensaverClick);
|
2020-05-10 14:49:02 +02:00
|
|
|
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();
|
2021-12-28 19:24:06 +01:00
|
|
|
if (tabs.active_tab == TAB_SCREENSAVERS) {
|
|
|
|
scrollbar_h_mouse stdcall (#ss_timeout);
|
|
|
|
if (ss_timeout.redraw) {
|
|
|
|
draw_timeout();
|
|
|
|
ss_timeout.redraw = false; //reset flag
|
|
|
|
}
|
|
|
|
}
|
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();
|
2020-05-10 14:49:02 +02:00
|
|
|
tabs.click(id);
|
2021-12-24 21:07:57 +01:00
|
|
|
if (tabs.active_tab == TAB_SKINS) {
|
|
|
|
checkbox1.click(id);
|
|
|
|
spinbox1.click(id);
|
|
|
|
if (update_docky.click(id)) EventUpdateDocky();
|
|
|
|
}
|
|
|
|
if (tabs.active_tab == TAB_WALLPAPERS) {
|
|
|
|
if (id==BTN_SELECT_WALLP_FOLDER) EventSelectWallpFolder();
|
|
|
|
if (optionbox_stretch.click(id)) EventSetWallpMode(1,0,0);
|
|
|
|
if (optionbox_tiled.click(id)) EventSetWallpMode(0,1,0);
|
|
|
|
if (optionbox_auto.click(id)) EventSetWallpMode(0,0,1);
|
|
|
|
}
|
|
|
|
if (tabs.active_tab == TAB_SCREENSAVERS) {
|
|
|
|
if (id==BTN_TEST_SCREENSAVER) EventOpenFile();
|
2021-12-27 16:48:22 +01:00
|
|
|
if (id==BTN_SET_SCREENSAVER) EventSetSs();
|
2021-12-24 21:07:57 +01:00
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case evKey:
|
2015-08-10 12:47:21 +02:00
|
|
|
GetKeys();
|
2021-12-28 19:24:06 +01:00
|
|
|
if (select_list.ProcessKey(key_scancode)) { EventApply(); break; }
|
|
|
|
if (key_scancode==SCAN_CODE_ENTER) { EventOpenFile(); break; }
|
|
|
|
if (key_scancode==SCAN_CODE_DEL) { EventDeleteFile(); break; }
|
2021-12-21 18:22:15 +01:00
|
|
|
if (key_scancode==SCAN_CODE_TAB) {
|
|
|
|
id = tabs.active_tab+1;
|
|
|
|
if(id==3)id=0;
|
|
|
|
tabs.click(id + tabs.base_id);
|
|
|
|
break;
|
|
|
|
}
|
2021-12-23 13:27:15 +01:00
|
|
|
for (i=select_list.cur_y+1; i<select_list.count; i++)
|
2013-10-24 00:05:17 +02:00
|
|
|
{
|
2021-12-26 19:21:03 +01:00
|
|
|
id = list.get(i) + strrchr(list.get(i), '/');
|
|
|
|
if (ESBYTE[id]==key_ascii) || (ESBYTE[id]==key_ascii-32)
|
2016-02-13 12:00:14 +01:00
|
|
|
{
|
2021-12-23 13:27:15 +01:00
|
|
|
select_list.cur_y = i - 1;
|
2016-11-02 13:19:15 +01:00
|
|
|
select_list.KeyDown();
|
2016-02-13 12:00:14 +01:00
|
|
|
EventApply();
|
|
|
|
break;
|
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2018-09-11 23:09:14 +02:00
|
|
|
case evReDraw:
|
|
|
|
draw_window();
|
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();
|
2021-12-23 13:27:15 +01:00
|
|
|
DefineAndDrawWindow(screen.width-WIN_W-9/2,80,WIN_W+9,WIN_H+4+skin_height,0x34,sc.work,WINDOW_HEADER,0);
|
2019-03-15 15:05:59 +01:00
|
|
|
|
2020-05-10 14:49:02 +02:00
|
|
|
tabs.draw();
|
2021-12-28 19:24:06 +01:00
|
|
|
draw_icon_16w(tabs.x + TAB_P, LP+5, 17);
|
|
|
|
draw_icon_16w(sizeof(t_skins)-1*8 + TAB_P + TAB_P + tabs.x, LP+5, 6);
|
|
|
|
draw_icon_16w(sizeof(t_wallpapers)+sizeof(t_skins)-2*8 + TAB_P + TAB_P + TAB_P + tabs.x, LP+5, 61);
|
2020-05-10 14:49:02 +02:00
|
|
|
|
2021-12-23 13:27:15 +01:00
|
|
|
$push select_list.cur_y
|
2016-11-02 15:30:45 +01:00
|
|
|
SelectList_Init(
|
2021-12-28 19:24:06 +01:00
|
|
|
LP,
|
2021-12-21 18:22:15 +01:00
|
|
|
PANEL_H,
|
|
|
|
LIST_W,
|
2021-12-28 19:24:06 +01:00
|
|
|
WIN_H - LP - PANEL_H
|
2016-11-02 15:30:45 +01:00
|
|
|
);
|
2021-12-23 13:27:15 +01:00
|
|
|
$pop select_list.cur_y
|
2018-04-19 22:12:07 +02:00
|
|
|
|
2021-12-23 13:27:15 +01:00
|
|
|
DrawBar(RIGHTx, PANEL_H, RIGHTw, WIN_H-PANEL_H-LP, sc.work);
|
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();
|
2018-04-19 22:12:07 +02:00
|
|
|
|
2021-12-23 13:27:15 +01:00
|
|
|
if (tabs.active_tab == TAB_SKINS)
|
2018-04-19 22:12:07 +02:00
|
|
|
{
|
2021-12-23 13:27:15 +01:00
|
|
|
DrawFrame(RIGHTx, PANEL_H+5, RIGHTw, RIGHTh, T_UI_PREVIEW);
|
|
|
|
DrawUiElementsPreview(RIGHTx+20, PANEL_H+5, RIGHTh);
|
|
|
|
if (CheckProcessExists("@DOCKY")) update_docky.draw(RIGHTx, PANEL_H+250);
|
2018-04-19 22:12:07 +02:00
|
|
|
}
|
2021-12-23 13:27:15 +01:00
|
|
|
if (tabs.active_tab == TAB_WALLPAPERS)
|
2018-09-11 23:09:14 +02:00
|
|
|
{
|
2021-12-24 21:07:57 +01:00
|
|
|
DrawFrame(RIGHTx, PANEL_H+5, 180, 105, T_PICTURE_MODE);
|
2021-12-23 13:27:15 +01:00
|
|
|
optionbox_stretch.draw(RIGHTx+14, PANEL_H+25);
|
|
|
|
optionbox_tiled.draw(RIGHTx+14, PANEL_H+52);
|
2021-12-24 21:07:57 +01:00
|
|
|
optionbox_auto.draw(RIGHTx+14, PANEL_H+79);
|
|
|
|
DrawStandartCaptButton(RIGHTx, PANEL_H+130, BTN_SELECT_WALLP_FOLDER, T_SELECT_FOLDER);
|
2021-12-21 18:22:15 +01:00
|
|
|
}
|
2021-12-23 13:27:15 +01:00
|
|
|
if (tabs.active_tab == TAB_SCREENSAVERS)
|
2021-12-21 18:22:15 +01:00
|
|
|
{
|
2021-12-28 19:24:06 +01:00
|
|
|
draw_timeout();
|
|
|
|
ss_timeout.line_col = sc.work_graph;
|
|
|
|
ss_timeout.frnt_col = sc.work;
|
|
|
|
scrollbar_h_draw stdcall (#ss_timeout);
|
|
|
|
DrawRectangle(RIGHTx, RIGHTy+25, RIGHTw-20, 15, sc.work_graph);
|
|
|
|
ESI = DrawStandartCaptButton(RIGHTx, PANEL_H + 65, BTN_TEST_SCREENSAVER, T_SS_PREVIEW);
|
|
|
|
DrawStandartCaptButton(RIGHTx+ESI, PANEL_H + 65, BTN_SET_SCREENSAVER, T_SS_SET);
|
2018-09-11 23:09:14 +02:00
|
|
|
}
|
2016-02-13 12:00:14 +01:00
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
2021-12-28 19:24:06 +01:00
|
|
|
void draw_timeout()
|
|
|
|
{
|
|
|
|
miniprintf(#param, T_SS_TIMEOUT, ss_timeout.position+1);
|
|
|
|
WriteTextWithBg(RIGHTx, PANEL_H, 0xD0, sc.work_text, #param, sc.work);
|
|
|
|
}
|
|
|
|
|
2021-12-30 00:09:18 +01:00
|
|
|
void add_filesnames_into_the_list()
|
2021-12-22 02:26:10 +01:00
|
|
|
{
|
2021-12-30 00:09:18 +01:00
|
|
|
int j;
|
|
|
|
for (j=0; j<select_list.count; j++) {
|
|
|
|
miniprintf(#param,"%s/",#folder_path);
|
|
|
|
strcat(#param, io.dir.position(ESDWORD[j*4+fmas]));
|
|
|
|
list.add(#param);
|
|
|
|
}
|
2021-12-22 02:26:10 +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;
|
2021-12-30 00:09:18 +01:00
|
|
|
dword ext;
|
2021-12-24 21:07:57 +01:00
|
|
|
select_list.ClearList();
|
2021-12-30 00:09:18 +01:00
|
|
|
|
|
|
|
if (io.dir.buffer) free(io.dir.buffer);
|
2016-02-13 12:00:14 +01:00
|
|
|
io.dir.load(#folder_path,DIR_ONLYREAL);
|
2021-12-25 11:36:30 +01:00
|
|
|
|
2021-12-30 00:09:18 +01:00
|
|
|
if (fmas) free(fmas);
|
|
|
|
fmas = malloc(io.dir.count * 4);
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
for (j=0; j<io.dir.count; j++)
|
2013-12-26 23:51:43 +01:00
|
|
|
{
|
2021-12-30 00:09:18 +01:00
|
|
|
strncpy(#param, io.dir.position(j), PATHLEN);
|
|
|
|
strlwr(#param);
|
|
|
|
ext = #param + strrchr(#param,'.');
|
2021-12-23 13:27:15 +01:00
|
|
|
if (tabs.active_tab==TAB_SKINS) {
|
2021-12-30 00:09:18 +01:00
|
|
|
if (!streq(ext,"skn")) continue;
|
2018-09-11 23:09:14 +02:00
|
|
|
}
|
2021-12-23 13:27:15 +01:00
|
|
|
if (tabs.active_tab==TAB_WALLPAPERS) {
|
2021-12-30 00:09:18 +01:00
|
|
|
if (!streq(ext,"png")) && (!streq(ext,"jpg"))
|
|
|
|
&& (!streq(ext,"jpeg")) && (!streq(ext,"bmp"))
|
|
|
|
&& (!streq(ext,"gif")) continue;
|
2018-09-11 23:09:14 +02:00
|
|
|
}
|
2021-12-30 00:09:18 +01:00
|
|
|
ESDWORD[select_list.count*4 + fmas] = j;
|
2016-11-02 13:19:15 +01:00
|
|
|
select_list.count++;
|
2013-12-26 23:51:43 +01:00
|
|
|
}
|
2021-12-30 00:09:18 +01:00
|
|
|
sort_by_name(0, select_list.count-1);
|
2021-12-25 11:36:30 +01:00
|
|
|
|
2021-12-24 21:07:57 +01:00
|
|
|
list.drop();
|
|
|
|
//save current item for tab change
|
2021-12-25 11:36:30 +01:00
|
|
|
//add default item
|
2021-12-30 00:09:18 +01:00
|
|
|
if(tabs.active_tab == TAB_SKINS)
|
|
|
|
{
|
|
|
|
select_list.count++;
|
|
|
|
list.add(#default_skin);
|
|
|
|
add_filesnames_into_the_list();
|
|
|
|
if (active_skin==-1) && (ESBYTE[#previous_skin])
|
|
|
|
{
|
|
|
|
for (j=0; j<select_list.count; j++) {
|
|
|
|
if (streq(list.get(j), #previous_skin)) {
|
|
|
|
active_skin = j;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
select_list.cur_y = active_skin;
|
|
|
|
} else {
|
|
|
|
select_list.count++;
|
|
|
|
list.add(#default_wallp);
|
|
|
|
add_filesnames_into_the_list();
|
|
|
|
if (active_wallpaper==-1) && (ESBYTE[#previous_wallp]=='\\')
|
|
|
|
{
|
|
|
|
for (j=0; j<select_list.count; j++) {
|
|
|
|
if (streq(list.get(j), #previous_wallp+4)) {
|
|
|
|
active_wallpaper = j;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
select_list.cur_y = active_wallpaper;
|
2021-12-24 21:07:57 +01:00
|
|
|
}
|
2021-12-25 11:36:30 +01:00
|
|
|
|
|
|
|
if (!select_list.count) notify(T_NO_FILES);
|
2021-12-30 00:09:18 +01:00
|
|
|
if (select_list.cur_y>SL_VISIBLE) {
|
|
|
|
select_list.first = -SL_VISIBLE/2 + select_list.cur_y;
|
|
|
|
}
|
2021-12-24 21:07:57 +01:00
|
|
|
select_list.CheckDoesValuesOkey();
|
|
|
|
if (LIST_W) draw_window();
|
2020-11-27 14:25:36 +01:00
|
|
|
}
|
|
|
|
|
2016-11-02 15:30:45 +01:00
|
|
|
void SelectList_DrawLine(dword i)
|
2016-02-13 12:00:14 +01:00
|
|
|
{
|
2021-12-23 13:27:15 +01:00
|
|
|
int draw_y = i*SELECT_LIST_ITEMH+PANEL_H;
|
|
|
|
int i_abs = select_list.first + i;
|
2021-12-28 19:24:06 +01:00
|
|
|
dword text_color = 0xFFFfff;
|
|
|
|
dword bg_color = 0x000000;
|
2021-12-30 00:09:18 +01:00
|
|
|
char filename_buf[PATHLEN];
|
2021-12-24 21:07:57 +01:00
|
|
|
char* filename = #filename_buf;
|
|
|
|
|
|
|
|
strcpy(filename, list.get(i_abs));
|
|
|
|
if (EAX = strrchr(filename,'/')) filename += EAX;
|
2021-12-25 11:36:30 +01:00
|
|
|
if (ESBYTE[filename]=='T') && (ESBYTE[filename+1]=='_') filename+=2;
|
|
|
|
EAX = math.min(strrchr(filename,'.')-1, LIST_W - 24 / 8);
|
|
|
|
if(EAX) ESBYTE[filename+EAX] = '\0';
|
2021-12-24 21:07:57 +01:00
|
|
|
|
|
|
|
//save current item for tab change
|
|
|
|
switch(tabs.active_tab) {
|
2021-12-25 11:36:30 +01:00
|
|
|
CASE TAB_SKINS:
|
|
|
|
active_skin = select_list.cur_y;
|
|
|
|
if (!i_abs) filename = T_DEFAULT;
|
|
|
|
BREAK;
|
|
|
|
CASE TAB_WALLPAPERS:
|
|
|
|
active_wallpaper = select_list.cur_y;
|
|
|
|
if (!i_abs) filename = T_DEFAULT;
|
|
|
|
BREAK;
|
|
|
|
CASE TAB_SCREENSAVERS:
|
|
|
|
active_screensaver = select_list.cur_y;
|
2021-12-28 19:24:06 +01:00
|
|
|
if (!i_abs) filename = T_NO_SS;
|
2021-12-24 21:07:57 +01:00
|
|
|
}
|
2016-11-02 13:19:15 +01:00
|
|
|
|
2021-12-28 19:24:06 +01:00
|
|
|
if (select_list.cur_y == i_abs) {
|
|
|
|
text_color = sc.button;
|
|
|
|
bg_color = sc.button_text;
|
2013-12-26 23:51:43 +01:00
|
|
|
}
|
2021-12-28 19:24:06 +01:00
|
|
|
DrawBar(select_list.x, draw_y, LIST_W, SELECT_LIST_ITEMH, text_color);
|
|
|
|
WriteText(select_list.x+12,draw_y+select_list.text_y,select_list.font_type,bg_color, filename);
|
2013-10-24 00:05:17 +02:00
|
|
|
}
|
|
|
|
|
2016-11-02 15:30:45 +01:00
|
|
|
|
2020-05-20 21:34:09 +02:00
|
|
|
|
2021-12-25 11:36:30 +01:00
|
|
|
void GetIniSettings()
|
2021-12-24 21:07:57 +01:00
|
|
|
{
|
2021-12-25 11:36:30 +01:00
|
|
|
ini.section = "style";
|
2021-12-28 19:24:06 +01:00
|
|
|
ini.GetString("default_skin", #default_skin, PATHLEN, 0);
|
|
|
|
ini.GetString("default_wallp", #default_wallp, PATHLEN, 0);
|
2021-12-30 00:09:18 +01:00
|
|
|
ini.GetString("skin", #previous_skin, PATHLEN, 0);
|
|
|
|
ini.GetString("bg_param", #previous_wallp, PATHLEN, 0);
|
|
|
|
|
|
|
|
ini.section = "screensaver";
|
|
|
|
ss_timeout.position = ini.GetInt("timeout", 10) - 1;
|
|
|
|
ini.GetString("available", #ss_available, sizeof(ss_available), 0);
|
|
|
|
ini.GetString("program", #previous_ss, PATHLEN, 0);
|
2021-12-24 21:07:57 +01:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2021-12-30 00:09:18 +01:00
|
|
|
miniprintf(#folder_path, "%s/res/skins", get_real_kolibrios_path());
|
2021-12-24 21:07:57 +01:00
|
|
|
Open_Dir();
|
2020-05-10 14:49:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void EventTabWallpappersClick()
|
|
|
|
{
|
2021-12-22 02:26:10 +01:00
|
|
|
if (opendir_path) {
|
|
|
|
strcpy(#folder_path, #opendir_path);
|
|
|
|
} else {
|
2021-12-30 00:09:18 +01:00
|
|
|
miniprintf(#folder_path, "%s/res/wallpapers", get_real_kolibrios_path());
|
2021-12-22 02:26:10 +01:00
|
|
|
}
|
2021-12-24 21:07:57 +01:00
|
|
|
Open_Dir();
|
2016-02-13 12:00:14 +01:00
|
|
|
}
|
2013-10-24 23:45:17 +02:00
|
|
|
|
2021-12-21 18:22:15 +01:00
|
|
|
void EventTabScreensaverClick()
|
|
|
|
{
|
2021-12-24 21:07:57 +01:00
|
|
|
dword j;
|
|
|
|
char ssmas[sizeof(ss_available)];
|
|
|
|
list.drop();
|
|
|
|
select_list.ClearList();
|
|
|
|
|
2021-12-25 11:36:30 +01:00
|
|
|
select_list.count++;
|
2021-12-28 19:24:06 +01:00
|
|
|
list.add("");
|
2021-12-25 11:36:30 +01:00
|
|
|
|
2021-12-24 21:07:57 +01:00
|
|
|
strcpy(#ssmas, #ss_available);
|
|
|
|
do {
|
2021-12-25 11:36:30 +01:00
|
|
|
j = strrchr(#ssmas, '|');
|
|
|
|
miniprintf(#param, "/sys/%s", #ssmas + j);
|
2021-12-24 21:07:57 +01:00
|
|
|
list.add(#param);
|
2021-12-25 11:36:30 +01:00
|
|
|
ESBYTE[#ssmas + j - 1] = '\0';
|
2021-12-24 21:07:57 +01:00
|
|
|
select_list.count++;
|
|
|
|
} while (j);
|
|
|
|
|
2021-12-30 00:09:18 +01:00
|
|
|
if (active_screensaver == -1) && (ESBYTE[#previous_ss]) {
|
|
|
|
for (j=0; j<select_list.count; j++) {
|
|
|
|
if (strstr(list.get(j), #previous_ss)) active_screensaver = j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
select_list.cur_y = active_screensaver;
|
|
|
|
|
2021-12-24 21:07:57 +01:00
|
|
|
if (LIST_W) draw_window();
|
2021-12-21 18:22:15 +01:00
|
|
|
}
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
void EventDeleteFile()
|
|
|
|
{
|
2021-12-25 11:36:30 +01:00
|
|
|
if (select_list.cur_y) DeleteFile(#cur_file_path); //no not delete default
|
2016-02-13 12:00:14 +01:00
|
|
|
Open_Dir();
|
|
|
|
EventApply();
|
|
|
|
}
|
2013-10-24 23:45:17 +02:00
|
|
|
|
2018-09-11 23:09:14 +02:00
|
|
|
void EventSelectWallpFolder()
|
|
|
|
{
|
2021-12-28 19:24:06 +01:00
|
|
|
o_dialog.type = 2; //select folder
|
2018-09-11 23:09:14 +02:00
|
|
|
OpenDialog_start stdcall (#o_dialog);
|
2021-12-22 02:26:10 +01:00
|
|
|
if (o_dialog.status) EventTabWallpappersClick();
|
2018-09-11 23:09:14 +02:00
|
|
|
}
|
|
|
|
|
2021-12-24 21:07:57 +01:00
|
|
|
void EventSetWallpMode(dword _stretch, _titled, _auto)
|
2019-03-15 13:19:45 +01:00
|
|
|
{
|
2021-12-24 21:07:57 +01:00
|
|
|
optionbox_stretch.checked = _stretch;
|
|
|
|
optionbox_tiled.checked = _titled;
|
|
|
|
optionbox_auto.checked = _auto;
|
2019-03-15 13:19:45 +01:00
|
|
|
optionbox_tiled.redraw();
|
|
|
|
optionbox_stretch.redraw();
|
2021-12-24 21:07:57 +01:00
|
|
|
optionbox_auto.redraw();
|
2019-03-15 13:19:45 +01:00
|
|
|
EventApply();
|
|
|
|
}
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
void EventApply()
|
|
|
|
{
|
2021-12-24 21:07:57 +01:00
|
|
|
char kivparam[4096+10];
|
|
|
|
dword file_name = list.get(select_list.cur_y);
|
2021-12-25 11:36:30 +01:00
|
|
|
strcpy(#cur_file_path, list.get(select_list.cur_y));
|
2021-12-23 13:27:15 +01:00
|
|
|
if (tabs.active_tab==TAB_SKINS)
|
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
|
|
|
}
|
2021-12-23 13:27:15 +01:00
|
|
|
if (tabs.active_tab==TAB_WALLPAPERS)
|
2016-02-13 12:00:14 +01:00
|
|
|
{
|
2018-11-12 17:27:48 +01:00
|
|
|
SelectList_Draw();
|
2021-12-24 21:07:57 +01:00
|
|
|
miniprintf(#kivparam, "\\S__%s", #cur_file_path);
|
2021-12-25 11:36:30 +01:00
|
|
|
if (optionbox_tiled.checked) || (!select_list.cur_y) kivparam[1]='T';
|
2021-12-24 21:07:57 +01:00
|
|
|
if (optionbox_auto.checked) {
|
2021-12-25 11:36:30 +01:00
|
|
|
file_name += strrchr(file_name, '/');
|
|
|
|
if (ESBYTE[file_name] == 'T') && (ESBYTE[file_name+1] == '_') {
|
2021-12-24 21:07:57 +01:00
|
|
|
kivparam[1]='T';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RunProgram("/sys/media/kiv", #kivparam);
|
|
|
|
}
|
|
|
|
if (tabs.active_tab==TAB_SCREENSAVERS)
|
|
|
|
{
|
|
|
|
SelectList_Draw();
|
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()
|
|
|
|
{
|
2021-12-28 19:24:06 +01:00
|
|
|
if (update_docky.checked) {
|
|
|
|
RestartProcessByName("/sys/@docky", MULTIPLE);
|
|
|
|
pause(50);
|
|
|
|
ActivateWindow_Self();
|
|
|
|
}
|
2019-03-15 15:05:59 +01:00
|
|
|
}
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
void EventOpenFile()
|
|
|
|
{
|
2021-12-25 11:36:30 +01:00
|
|
|
switch (tabs.active_tab) {
|
|
|
|
case TAB_SKINS: RunProgram("/sys/skincfg", #cur_file_path); break;
|
|
|
|
case TAB_WALLPAPERS: RunProgram("/sys/media/kiv", #cur_file_path); break;
|
|
|
|
case TAB_SCREENSAVERS: if(select_list.cur_y) RunProgram(list.get(select_list.cur_y), "@ss");
|
|
|
|
}
|
2016-02-13 12:00:14 +01:00
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
2018-11-12 17:27:48 +01:00
|
|
|
void EventExit()
|
|
|
|
{
|
2021-12-30 00:09:18 +01:00
|
|
|
if (get_real_kolibrios_path()) && (ESBYTE[#cur_skin_path]) {
|
2021-12-22 02:26:10 +01:00
|
|
|
ini.section = "style";
|
|
|
|
ini.SetString("skin", #cur_skin_path, strlen(#cur_skin_path));
|
|
|
|
}
|
2018-11-12 17:27:48 +01:00
|
|
|
ExitProcess();
|
|
|
|
}
|
|
|
|
|
2021-12-27 16:48:22 +01:00
|
|
|
void EventSetSs()
|
|
|
|
{
|
|
|
|
dword cur_ss = list.get(select_list.cur_y);
|
|
|
|
ini.section = "screensaver";
|
|
|
|
ini.SetString("program", cur_ss, strlen(cur_ss));
|
2021-12-28 19:24:06 +01:00
|
|
|
ini.SetInt("timeout", ss_timeout.position+1);
|
2021-12-27 16:48:22 +01:00
|
|
|
RestartProcessByName("/sys/@ss", MULTIPLE);
|
|
|
|
}
|
|
|
|
|
2013-10-24 00:05:17 +02:00
|
|
|
stop:
|
2021-12-28 19:24:06 +01:00
|
|
|
|
|
|
|
char folder_path[PATHLEN];
|
2021-12-30 00:09:18 +01:00
|
|
|
|
2021-12-28 19:24:06 +01:00
|
|
|
char cur_file_path[PATHLEN];
|
|
|
|
char cur_skin_path[PATHLEN];
|
2021-12-30 00:09:18 +01:00
|
|
|
|
2021-12-28 19:24:06 +01:00
|
|
|
char default_skin[PATHLEN];
|
2021-12-30 00:09:18 +01:00
|
|
|
char default_wallp[PATHLEN];
|
|
|
|
|
|
|
|
char previous_skin[PATHLEN];
|
|
|
|
char previous_wallp[PATHLEN];
|
|
|
|
char previous_ss[PATHLEN];
|