2013-10-24 02:05:17 +04:00
|
|
|
|
//11.03.12 - start!
|
|
|
|
|
|
2013-10-25 01:45:17 +04:00
|
|
|
|
#ifndef AUTOBUILD
|
|
|
|
|
?include "lang.h--"
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-10-24 02:05:17 +04:00
|
|
|
|
#define MEMSIZE 0xFE800
|
2013-10-25 01:45:17 +04:00
|
|
|
|
#include "..\lib\kolibri.h"
|
2013-10-24 02:05:17 +04:00
|
|
|
|
#include "..\lib\mem.h"
|
|
|
|
|
#include "..\lib\strings.h"
|
2013-10-25 01:45:17 +04:00
|
|
|
|
#include "..\lib\dll.h"
|
|
|
|
|
#include "..\lib\file_system.h"
|
2013-10-24 02:05:17 +04:00
|
|
|
|
#include "..\lib\list_box.h"
|
2015-03-05 23:55:28 +03:00
|
|
|
|
#include "..\lib\gui.h"
|
|
|
|
|
#include "..\lib\obj\box_lib.h"
|
2013-10-25 01:45:17 +04:00
|
|
|
|
|
|
|
|
|
#ifdef LANG_RUS
|
|
|
|
|
?define WINDOW_HEADER "<EFBFBD><EFBFBD><EFBFBD>ࠢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ⥬<><E2A5AC>"
|
2013-12-27 03:36:17 +04:00
|
|
|
|
?define T_SKINS " <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"
|
|
|
|
|
?define T_WALLPAPERS " <20><><EFBFBD><EFBFBD> ࠡ<>祣<EFBFBD> <20>⮫<EFBFBD>"
|
2013-10-25 01:45:17 +04:00
|
|
|
|
#else
|
|
|
|
|
?define WINDOW_HEADER "Appearance"
|
2013-12-27 03:36:17 +04:00
|
|
|
|
?define T_SKINS " Skins"
|
|
|
|
|
?define T_WALLPAPERS " Wallpappers"
|
2013-10-25 01:45:17 +04:00
|
|
|
|
#endif
|
2013-10-24 02:05:17 +04:00
|
|
|
|
|
2014-01-29 04:14:09 +04:00
|
|
|
|
unsigned char icons[]= FROM "icons.raw";
|
2013-12-27 02:51:43 +04:00
|
|
|
|
|
2013-10-24 02:05:17 +04:00
|
|
|
|
|
|
|
|
|
#define PANEL_H 30
|
2014-04-23 20:30:49 +04:00
|
|
|
|
#define SKINS_STANDART_PATH "/kolibrios/res/skins"
|
|
|
|
|
#define WALP_STANDART_PATH "/kolibrios/res/wallpapers"
|
2013-10-24 02:05:17 +04:00
|
|
|
|
|
|
|
|
|
llist list[2];
|
|
|
|
|
int active;
|
2013-12-27 02:51:43 +04:00
|
|
|
|
enum { WALLPAPERS, SKINS };
|
2013-10-24 02:05:17 +04:00
|
|
|
|
|
|
|
|
|
char folder_path[4096];
|
|
|
|
|
char cur_file_path[4096];
|
|
|
|
|
char temp_filename[4096];
|
|
|
|
|
int files_mas[100];
|
|
|
|
|
dword buf;
|
|
|
|
|
|
|
|
|
|
int cur;
|
|
|
|
|
|
|
|
|
|
system_colors sc;
|
|
|
|
|
proc_info Form;
|
|
|
|
|
|
2013-10-25 01:45:17 +04:00
|
|
|
|
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};
|
2013-10-24 02:05:17 +04:00
|
|
|
|
|
2013-10-25 01:45:17 +04:00
|
|
|
|
#include "other.h"
|
2013-10-24 02:05:17 +04:00
|
|
|
|
|
2013-10-25 01:45:17 +04:00
|
|
|
|
//icons configurate, delete from list, delete from disk, make default
|
|
|
|
|
//remember current
|
2013-10-24 02:05:17 +04:00
|
|
|
|
|
|
|
|
|
void Open_Dir()
|
|
|
|
|
{
|
|
|
|
|
int j, filesnum;
|
|
|
|
|
|
|
|
|
|
list[active].count = 0;
|
|
|
|
|
free(buf);
|
|
|
|
|
if (GetDir(#buf, #filesnum, #folder_path, DIRS_ONLYREAL)!=0) return;
|
|
|
|
|
|
|
|
|
|
for (j=0; j<filesnum; j++)
|
|
|
|
|
{
|
|
|
|
|
strcpy(#temp_filename, j*304 + buf+72);
|
2013-12-27 02:51:43 +04:00
|
|
|
|
strlwr(#temp_filename);
|
2014-04-23 20:30:49 +04:00
|
|
|
|
if (active==SKINS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue;
|
|
|
|
|
if (active==WALLPAPERS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".txt")==0) continue;
|
2013-10-24 02:05:17 +04:00
|
|
|
|
cur = list[active].count;
|
|
|
|
|
files_mas[cur]=j;
|
2014-04-23 20:30:49 +04:00
|
|
|
|
if (!strcmpi("default.skn",#temp_filename)) files_mas[0]><files_mas[list[active].count];
|
2013-10-24 02:05:17 +04:00
|
|
|
|
list[active].count++;
|
|
|
|
|
}
|
|
|
|
|
Sort_by_Name(0, list[active].count-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Draw_List()
|
|
|
|
|
{
|
|
|
|
|
int i;
|
2013-12-27 02:51:43 +04:00
|
|
|
|
int yyy;
|
2013-10-25 01:45:17 +04:00
|
|
|
|
list[SKINS].SetSizes(0, PANEL_H, Form.cwidth-scroll1.size_x-1, Form.cheight-PANEL_H, 40, 20);
|
|
|
|
|
list[WALLPAPERS].SetSizes(0, PANEL_H, Form.cwidth-scroll1.size_x-1, Form.cheight-PANEL_H, 40, 20);
|
2013-10-24 02:05:17 +04:00
|
|
|
|
|
|
|
|
|
for (i=0; i<list[active].visible; i++;)
|
|
|
|
|
{
|
|
|
|
|
cur = list[active].first;
|
|
|
|
|
strcpy(#temp_filename, files_mas[i+cur]*304 + buf+72);
|
2013-12-27 02:51:43 +04:00
|
|
|
|
temp_filename[strlen(#temp_filename)-4] = 0;
|
|
|
|
|
yyy = i*list[active].line_h+list[active].y;
|
2013-10-24 02:05:17 +04:00
|
|
|
|
|
|
|
|
|
if (list[active].current-list[active].first==i)
|
|
|
|
|
{
|
|
|
|
|
if (sc.work_button<>sc.work)
|
|
|
|
|
{
|
2013-12-27 02:51:43 +04:00
|
|
|
|
DrawBar(0, yyy, list[active].w, list[active].line_h, sc.work_button);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
WriteText(12,yyy+list[active].text_y,0x80,sc.work_button_text, #temp_filename);
|
2013-10-24 02:05:17 +04:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-12-27 02:51:43 +04:00
|
|
|
|
DrawBar(0, yyy, list[active].w, list[active].line_h, sc.grab_button);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
WriteText(12,yyy+list[active].text_y,0x80,sc.grab_button_text, #temp_filename);
|
2013-12-27 02:51:43 +04:00
|
|
|
|
}
|
2013-10-24 02:05:17 +04:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-12-27 02:51:43 +04:00
|
|
|
|
DrawBar(0,yyy,list[active].w, list[active].line_h, 0xFFFfff);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
WriteText(12,yyy+list[active].text_y,0x80,0, #temp_filename);
|
2013-10-24 02:05:17 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
DrawBar(0,list[active].visible*list[active].line_h+list[active].y, list[active].w, -list[active].visible*list[active].line_h+ list[active].h, 0xFFFfff);
|
2013-10-25 01:45:17 +04:00
|
|
|
|
DrawScroller();
|
2013-10-24 02:05:17 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-27 02:51:43 +04:00
|
|
|
|
void GetFiles()
|
2013-10-24 02:05:17 +04:00
|
|
|
|
{
|
2013-12-27 02:51:43 +04:00
|
|
|
|
if (list[SKINS].active)
|
2013-10-24 02:05:17 +04:00
|
|
|
|
{
|
|
|
|
|
strcpy(#folder_path, SKINS_STANDART_PATH);
|
|
|
|
|
Open_Dir();
|
2014-04-23 20:30:49 +04:00
|
|
|
|
if (!list[active].count) notify("'No skins were found' -E");
|
2013-10-24 02:05:17 +04:00
|
|
|
|
}
|
2013-12-27 02:51:43 +04:00
|
|
|
|
if (list[WALLPAPERS].active)
|
2013-10-24 02:05:17 +04:00
|
|
|
|
{
|
|
|
|
|
strcpy(#folder_path, WALP_STANDART_PATH);
|
|
|
|
|
Open_Dir();
|
2014-04-23 20:30:49 +04:00
|
|
|
|
if (!list[active].count) notify("'No wallpapers were found' -E");
|
2013-10-24 02:05:17 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Apply()
|
|
|
|
|
{
|
2013-12-27 02:51:43 +04:00
|
|
|
|
if (list[SKINS].active)
|
2013-10-24 02:05:17 +04:00
|
|
|
|
{
|
|
|
|
|
strcpy(#cur_file_path, #folder_path);
|
2013-12-27 02:51:43 +04:00
|
|
|
|
cur = list[SKINS].current;
|
2014-04-23 20:30:49 +04:00
|
|
|
|
chrcat(#cur_file_path, '/');
|
2013-10-24 02:05:17 +04:00
|
|
|
|
strcat(#cur_file_path, files_mas[cur]*304 + buf+72);
|
|
|
|
|
SetSystemSkin(#cur_file_path);
|
2013-12-27 02:51:43 +04:00
|
|
|
|
//Draw_List();
|
2013-10-24 02:05:17 +04:00
|
|
|
|
}
|
2013-12-27 02:51:43 +04:00
|
|
|
|
if (list[WALLPAPERS].active)
|
2013-10-24 02:05:17 +04:00
|
|
|
|
{
|
|
|
|
|
strcpy(#cur_file_path, "\\S__");
|
|
|
|
|
strcat(#cur_file_path, #folder_path);
|
2013-12-27 02:51:43 +04:00
|
|
|
|
cur = list[WALLPAPERS].current;
|
2014-04-23 20:30:49 +04:00
|
|
|
|
chrcat(#cur_file_path, '/');
|
2013-10-24 02:05:17 +04:00
|
|
|
|
strcat(#cur_file_path, files_mas[cur]*304 + buf+72);
|
|
|
|
|
RunProgram("/sys/media/kiv", #cur_file_path);
|
|
|
|
|
Draw_List();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OpenFile()
|
|
|
|
|
{
|
2013-12-27 02:51:43 +04:00
|
|
|
|
if (list[SKINS].active) RunProgram("/sys/desktop", #cur_file_path);
|
|
|
|
|
if (list[WALLPAPERS].active) RunProgram("/sys/media/kiv", #cur_file_path);
|
2013-10-24 02:05:17 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void main()
|
|
|
|
|
{
|
|
|
|
|
int id, key, mouse_clicked;
|
|
|
|
|
mouse mm;
|
|
|
|
|
|
|
|
|
|
mem_Init();
|
2013-12-27 02:51:43 +04:00
|
|
|
|
SetEventMask(0x27);
|
2015-03-07 21:11:31 +03:00
|
|
|
|
if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("'Fatal Error: library doesn't exists /rd/1/lib/box_lib.obj' -E");
|
2013-10-24 22:26:04 +04:00
|
|
|
|
list[SKINS].current = list[WALLPAPERS].current = -1;
|
2013-10-24 02:05:17 +04:00
|
|
|
|
list[SKINS].first = list[WALLPAPERS].first = 0;
|
2013-12-27 02:51:43 +04:00
|
|
|
|
TabClick(WALLPAPERS);
|
|
|
|
|
list[WALLPAPERS].SetSizes(0, 230, 350, 400-PANEL_H, 40, 18);
|
|
|
|
|
list[SKINS].SetSizes(0, 230, 350, 400-PANEL_H, 40, 18);
|
2013-10-24 02:05:17 +04:00
|
|
|
|
loop()
|
|
|
|
|
{
|
|
|
|
|
switch(WaitEvent())
|
|
|
|
|
{
|
|
|
|
|
case evMouse:
|
2013-10-25 01:45:17 +04:00
|
|
|
|
if (!CheckActiveProcess(Form.ID)) break;
|
|
|
|
|
scrollbar_v_mouse (#scroll1);
|
|
|
|
|
if (list[active].first <> scroll1.position)
|
|
|
|
|
{
|
|
|
|
|
list[active].first = scroll1.position;
|
|
|
|
|
Draw_List();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 02:05:17 +04:00
|
|
|
|
mm.get();
|
2013-12-27 02:51:43 +04:00
|
|
|
|
|
|
|
|
|
if (mm.vert)
|
|
|
|
|
{
|
|
|
|
|
if (list[SKINS].active) && (list[SKINS].MouseScroll(mm.vert)) Draw_List();
|
|
|
|
|
if (list[WALLPAPERS].active) && (list[WALLPAPERS].MouseScroll(mm.vert)) Draw_List();
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 02:05:17 +04:00
|
|
|
|
if (mouse_clicked)
|
|
|
|
|
{
|
2013-12-27 02:51:43 +04:00
|
|
|
|
if (!mm.lkm) && (list[SKINS].active) && (list[SKINS].ProcessMouse(mm.x, mm.y)) Apply();
|
|
|
|
|
if (!mm.lkm) && (list[WALLPAPERS].active) && (list[WALLPAPERS].ProcessMouse(mm.x, mm.y)) Apply();
|
2013-10-24 02:05:17 +04:00
|
|
|
|
mouse_clicked=0;
|
|
|
|
|
}
|
2013-10-24 22:26:04 +04:00
|
|
|
|
if (mm.lkm) && (list[SKINS].MouseOver(mm.x, mm.y)) mouse_clicked=1;
|
2013-10-24 02:05:17 +04:00
|
|
|
|
break;
|
|
|
|
|
|
2013-12-27 02:51:43 +04:00
|
|
|
|
|
2013-10-24 02:05:17 +04:00
|
|
|
|
case evButton:
|
|
|
|
|
id=GetButtonID();
|
|
|
|
|
if (id==1) ExitProcess();
|
2013-12-27 02:51:43 +04:00
|
|
|
|
if (id==2) TabClick(WALLPAPERS);
|
|
|
|
|
if (id==3) TabClick(SKINS);
|
2013-10-24 02:05:17 +04:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evKey:
|
|
|
|
|
key = GetKey();
|
2013-12-27 02:51:43 +04:00
|
|
|
|
if (list[SKINS].active) && (list[SKINS].ProcessKey(key)) Apply();
|
|
|
|
|
if (list[WALLPAPERS].active) && (list[WALLPAPERS].ProcessKey(key)) Apply();
|
2013-10-24 02:05:17 +04:00
|
|
|
|
IF (key==013) OpenFile();
|
2013-12-27 02:51:43 +04:00
|
|
|
|
if (key==9) if (list[SKINS].active) TabClick(WALLPAPERS); else TabClick(SKINS);
|
2013-10-24 02:05:17 +04:00
|
|
|
|
IF (key==182) //Del
|
|
|
|
|
{
|
|
|
|
|
DeleteFile(#cur_file_path);
|
|
|
|
|
Open_Dir();
|
|
|
|
|
Apply();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evReDraw:
|
|
|
|
|
sc.get();
|
2013-12-27 02:51:43 +04:00
|
|
|
|
DefineAndDrawWindow(30,80,list[active].w+9,list[active].h+4+GetSkinHeight(),0x73,0xE4DFE1,WINDOW_HEADER,0);
|
2013-10-24 02:05:17 +04:00
|
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
|
|
|
|
IF (Form.status_window>=2) break;
|
|
|
|
|
DrawTabs();
|
|
|
|
|
Draw_List();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-27 02:51:43 +04:00
|
|
|
|
#define BT_PADDING 16
|
2013-10-24 02:05:17 +04:00
|
|
|
|
|
2013-12-27 02:51:43 +04:00
|
|
|
|
void DrawTab(dword x,y, but_id, is_active, text)
|
2013-10-24 02:05:17 +04:00
|
|
|
|
{
|
|
|
|
|
dword col_bg, col_text;
|
2013-12-27 02:51:43 +04:00
|
|
|
|
dword w=strlen(text)*6+BT_PADDING, h=21;
|
|
|
|
|
|
|
|
|
|
if (is_active)
|
|
|
|
|
{
|
|
|
|
|
col_bg=sc.work_button;
|
|
|
|
|
col_text=sc.work_button_text;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
col_bg=sc.work;
|
|
|
|
|
col_text=sc.work_text;
|
|
|
|
|
}
|
|
|
|
|
DrawRectangle(x,y, w,h, sc.work_graph);
|
|
|
|
|
DrawCaptButton(x+1,y+1, w-2,h-1, but_id, col_bg, col_text, text);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
_PutImage(x+6,y+4, 16,15, but_id-2*16*15*3+#icons);
|
2013-12-27 02:51:43 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DrawTabs()
|
|
|
|
|
{
|
2013-10-24 02:05:17 +04:00
|
|
|
|
DrawBar(0,0, Form.cwidth, PANEL_H-1, sc.work);
|
|
|
|
|
|
2013-12-27 02:51:43 +04:00
|
|
|
|
DrawTab(10,7, 2, list[WALLPAPERS].active, T_WALLPAPERS);
|
|
|
|
|
DrawTab(strlen(T_WALLPAPERS)*6+BT_PADDING+21,7, 3, list[SKINS].active, T_SKINS);
|
2013-10-24 02:05:17 +04:00
|
|
|
|
|
|
|
|
|
DrawBar(0,PANEL_H-2, Form.cwidth, 1, sc.work_graph);
|
|
|
|
|
DrawBar(0,PANEL_H-1, Form.cwidth, 1, 0xEEEeee);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TabClick(int N)
|
|
|
|
|
{
|
2013-12-27 02:51:43 +04:00
|
|
|
|
if (N==SKINS)
|
|
|
|
|
{
|
|
|
|
|
list[SKINS].active = 1;
|
|
|
|
|
list[WALLPAPERS].active = 0;
|
|
|
|
|
}
|
|
|
|
|
if (N==WALLPAPERS)
|
|
|
|
|
{
|
|
|
|
|
list[SKINS].active = 0;
|
|
|
|
|
list[WALLPAPERS].active = 1;
|
|
|
|
|
}
|
|
|
|
|
active = N;
|
|
|
|
|
GetFiles();
|
2013-10-24 02:05:17 +04:00
|
|
|
|
DrawTabs();
|
|
|
|
|
Draw_List();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2013-10-25 01:45:17 +04:00
|
|
|
|
void DrawScroller()
|
|
|
|
|
{
|
|
|
|
|
scroll1.bckg_col = 0xBBBbbb;
|
|
|
|
|
scroll1.frnt_col = sc.work;
|
|
|
|
|
scroll1.line_col = sc.work_graph;
|
|
|
|
|
|
|
|
|
|
scroll1.max_area = list[active].count;
|
|
|
|
|
scroll1.cur_area = list[active].visible;
|
|
|
|
|
scroll1.position = list[active].first;
|
|
|
|
|
|
|
|
|
|
scroll1.all_redraw=1;
|
|
|
|
|
scroll1.start_x = list[active].x + list[active].w;
|
|
|
|
|
scroll1.start_y = list[active].y-2;
|
|
|
|
|
scroll1.size_y = list[active].h+2;
|
|
|
|
|
|
|
|
|
|
scrollbar_v_draw(#scroll1);
|
|
|
|
|
}
|
2013-10-24 02:05:17 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stop:
|