Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7909 → Rev 7908

/programs/cmm/sysmon/sysmon.c
37,7 → 37,6
#define WIN_CONTENT_W 400
#define WIN_CONTENT_H 465
#define ICONGAP 26
#define BASE_TAB_BUTTON_ID 10
proc_info Form;
 
#ifdef LANG_RUS
52,8 → 51,14
#define T_APP_TITLE "System Monitor"
#endif
 
_tabs tabs = { 4, 10, WIN_CONTENT_W+WIN_PAD+WIN_PAD-4-4, BASE_TAB_BUTTON_ID };
enum {
TAB_GENERAL=20,
TAB_DRIVES,
TAB_PROCESSES
};
 
_tabs tabs = { TAB_GENERAL, 4, 10, WIN_CONTENT_W+WIN_PAD+WIN_PAD-4-4, TAB_HEIGHT };
 
//===================================================//
// //
// GENERAL EVENTS //
70,7 → 75,10
if (Form.status_window>2) return false;
//if (Form.width < 300) { MoveSize(OLD,OLD,300,OLD); break; }
//if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); break; }
tabs.draw();
tabs.draw_wrapper();
butx = tabs.draw_button(tabs.x+TAB_PADDING, TAB_GENERAL, T_CPU_AND_RAM);
butx = tabs.draw_button(strlen(T_CPU_AND_RAM)*8+TAB_PADDING+butx, TAB_DRIVES, T_DRIVES);
tabs.draw_button(strlen(T_DRIVES)*8+TAB_PADDING+butx, TAB_PROCESSES, T_PROCESSES);
return true;
}
 
78,7 → 86,18
{
int bid = GetButtonID();
if (1==bid) ExitProcess();
tabs.click();
if (TAB_GENERAL==bid) {
tabs.active_tab = TAB_GENERAL;
CPUnRAM__Main();
}
if (TAB_PROCESSES==bid) {
tabs.active_tab = TAB_PROCESSES;
Processes__Main();
}
if (TAB_DRIVES==bid) {
tabs.active_tab = TAB_DRIVES;
Drives__Main();
}
return bid;
}
 
98,10 → 117,5
load_dll(libimg, #libimg_init,1);
load_dll(libini, #lib_init,1);
load_dll(boxlib, #box_lib_init,0);
 
tabs.add(T_CPU_AND_RAM, #CPUnRAM__Main);
tabs.add(T_DRIVES, #Drives__Main);
tabs.add(T_PROCESSES, #Processes__Main);
 
CPUnRAM__Main();
}
/programs/cmm/lib/gui/tabs.h
3,58 → 3,28
#endif
 
#define TAB_HEIGHT 28
#define NAME_SIZE 64
 
:struct _tabs
{
int x,y,w;
int base_id;
 
int active_tab;
char names[640];
int count;
dword events[10];
 
int x,y,w,h;
dword draw_button();
int click();
void draw();
void draw_active_tab();
void add();
 
dword draw_button();
void draw_wrapper();
};
 
:void _tabs::draw()
:void _tabs::draw_wrapper()
{
int i, xx=x;
 
if (w) {
DrawBar(x+1,y+0+TAB_HEIGHT,w,1, sc.work_graph);
DrawBar(x+1,y+1+TAB_HEIGHT,w,1, sc.work_light);
DrawRectangle(x,y+TAB_HEIGHT,w-1,h-TAB_HEIGHT, sc.work_graph);
DrawBar(x+1,y+1+TAB_HEIGHT,w-3,1, sc.work_light);
}
 
for (i=0; i<count; i++) {
xx += draw_button(xx + TAB_PADDING, i, i*NAME_SIZE + #names) + TAB_PADDING;
}
}
 
:void _tabs::draw_active_tab()
:dword _tabs::draw_button(dword xx, but_id, text)
{
events[active_tab]();
}
 
:void _tabs::add(dword text, event)
{
strcpy(count*NAME_SIZE + #names, text);
events[count] = event;
count++;
}
 
:dword _tabs::draw_button(dword xx, _id, text)
{
dword col_bg, col_text;
dword ww=strlen(text)*8;
dword ww=strlen(text)*8, hh=TAB_HEIGHT;
 
if (_id==active_tab)
if (but_id==active_tab)
{
col_bg = 0xE44C9C;
col_text = sc.work_text;
64,18 → 34,16
col_bg = 0xC3A1B7;
col_text = MixColors(sc.work, sc.work_text, 120);
}
DefineHiddenButton(xx-2,y, ww-1+4,TAB_HEIGHT-1, _id + base_id);
DefineHiddenButton(xx-2,y, ww-1+4,hh-1, but_id);
WriteText(xx, y+6, 0x90, col_text, text);
DrawBar(xx, y+TAB_HEIGHT-3, ww, 3, col_bg);
return ww;
DrawBar(xx, y+hh-3, ww, 3, col_bg);
//DrawStandartCaptButton(xx, y, but_id, text); //GetFreeButtonId()
return xx;
}
 
:int _tabs::click(int _id)
:int _tabs::click(int N)
{
if (_id < base_id) || (_id > base_id + count) || (_id == active_tab) {
return false;
}
active_tab = _id - base_id;
events[active_tab]();
if (N==active_tab) return false;
active_tab = N;
return true;
}
/programs/cmm/appearance/appearance.c
6,19 → 6,18
#endif
 
#define MEMSIZE 200*1024
#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"
#include "..\lib\mem.h"
#include "..\lib\strings.h"
#include "..\lib\io.h"
#include "..\lib\list_box.h"
#include "..\lib\gui.h"
 
#include "../lib/obj/box_lib.h"
#include "../lib/obj/proc_lib.h"
#include "../lib/obj/libini.h"
#include "..\lib\obj\box_lib.h"
#include "..\lib\obj\proc_lib.h"
#include "..\lib\obj\libini.h"
 
#include "../lib/patterns/select_list.h"
#include "../lib/patterns/simple_open_dialog.h"
#include "..\lib\patterns\select_list.h"
#include "..\lib\patterns\simple_open_dialog.h"
 
#include "ui_elements_preview.h"
 
57,8 → 56,9
 
signed int active_skin=-1, active_wallpaper=-1;
enum {
BASE_TAB_BUTTON_ID=2,
BTN_SELECT_WALLP_FOLDER=10 };
SKINS=2,
WALLPAPERS,
BTN_SELECT_WALLP_FOLDER };
 
char folder_path[4096];
char cur_file_path[4096];
71,10 → 71,8
proc_info Form;
block skp;
 
enum {SKINS, WALLPAPERS};
_tabs tabs = { SKINS, LP, LP, NULL, NULL };
 
_tabs tabs = { LP, LP, NULL, BASE_TAB_BUTTON_ID };
 
checkbox update_docky = { T_UPDATE_DOCK, false };
 
char default_dir[] = "/rd/1";
100,21 → 98,17
 
void main()
{
int id;
int id, mouse_clicked;
 
GetRealFolderPathes();
 
load_dll(boxlib, #box_lib_init,0);
load_dll(libini, #lib_init,1);
load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1);
load_dll(Proc_lib, #OpenDialog_init,0);
o_dialog.type = 2; //select folder
OpenDialog_init stdcall (#o_dialog);
 
tabs.add(T_SKINS, #EventTabSkinsClick);
tabs.add(T_WALLPAPERS, #EventTabWallpappersClick);
tabs.draw_active_tab();
EventTabClick(SKINS);
 
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
loop() switch(WaitEvent())
139,8 → 133,9
case evButton:
id=GetButtonID();
if (id==1) EventExit();
if (id==SKINS) EventTabClick(SKINS);
if (id==WALLPAPERS) EventTabClick(WALLPAPERS);
if (id==BTN_SELECT_WALLP_FOLDER) EventSelectWallpFolder();
tabs.click(id);
checkbox1.click(id);
spinbox1.click(id);
if (update_docky.click(id)) EventUpdateDocky();
152,7 → 147,10
GetKeys();
if (select_list.ProcessKey(key_scancode)) EventApply();
if (key_scancode==SCAN_CODE_ENTER) EventOpenFile();
if (key_scancode==SCAN_CODE_TAB) tabs.click(tabs.active_tab ^ 1);
if (key_scancode==SCAN_CODE_TAB) {
if (tabs.active_tab==SKINS) EventTabClick(WALLPAPERS);
else EventTabClick(SKINS);
}
if (key_scancode==SCAN_CODE_DEL) EventDeleteFile();
 
if (! edit_cmm.flags & ed_focus) && (! edit_st.flags & ed_focus)
200,19 → 198,17
if (tabs.active_tab == SKINS) list_w=250; else list_w=350;
 
tabs.w = Form.cwidth-LP-LP;
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);
tabs.h = Form.cheight-LP-LP;
tabs.draw_wrapper();
tabs.draw_button(tabs.x+TAB_PADDING, SKINS, T_SKINS);
tabs.draw_button(strlen(T_SKINS)*8+tabs.x+TAB_PADDING+TAB_PADDING, WALLPAPERS, T_WALLPAPERS);
 
if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y;
select_list.CheckDoesValuesOkey();
 
id = select_list.cur_y;
SelectList_Init(
tabs.x+TAB_PADDING,
tabs.y+TAB_HEIGHT+TAB_PADDING,
list_w,
Form.cheight-LP-LP - TAB_PADDING - TAB_PADDING - TAB_HEIGHT,
tabs.h - TAB_PADDING - TAB_PADDING - TAB_HEIGHT,
false
);
select_list.cur_y = id;
303,8 → 299,11
// //
//===================================================//
 
void EventTabSkinsClick()
void EventTabClick(int N)
{
tabs.click(N);
if (tabs.active_tab == SKINS)
{
active_wallpaper = select_list.cur_y;
strcpy(#folder_path, #skins_folder_path);
select_list.ClearList();
311,11 → 310,8
Open_Dir();
if (!select_list.count) notify("'No skins were found' -E");
select_list.cur_y = active_skin;
 
if (select_list.w) draw_window();
}
 
void EventTabWallpappersClick()
if (tabs.active_tab == WALLPAPERS)
{
active_skin = select_list.cur_y;
strcpy(#folder_path, #wallp_folder_path);
323,7 → 319,8
Open_Dir();
if (!select_list.count) notify("'No wallpapers were found' -E");
select_list.cur_y = active_wallpaper;
 
}
if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y; select_list.CheckDoesValuesOkey();
if (select_list.w) draw_window();
}
 
345,7 → 342,7
OpenDialog_start stdcall (#o_dialog);
if (o_dialog.status) {
strcpy(#wallp_folder_path, #opendir_path);
EventTabWallpappersClick();
EventTabClick(WALLPAPERS);
}
}
 
/programs/cmm/kf_font_viewer/font_viewer.c
6,11 → 6,14
#define PANELH 28
#define WIN_W 490
#define WIN_H 315
#define BASE_TAB_BUTTON_ID 97
proc_info Form;
 
_tabs tabs = { WIN_W-130, 0, NULL, BASE_TAB_BUTTON_ID };
enum {
PHRASE_TAB=20, CHARS_TAB
};
 
_tabs tabs = { PHRASE_TAB };
 
block preview = { 0, PANELH, WIN_W, WIN_H - PANELH };
checkbox bold = { "Bold", false };
checkbox smooth = { "Smooth", true };
24,10 → 27,6
kfont.init(#param);
strcpy(#title, "Font preview: ");
strcat(#title, #param);
 
tabs.add("Phrase", #DrawPreviewPhrase);
tabs.add("Chars", #DrawPreviewChars);
 
loop() switch(WaitEvent())
{
case evButton:
36,7 → 35,7
bold.click(btn);
smooth.click(btn);
colored.click(btn);
tabs.click(btn);
if (btn==PHRASE_TAB) || (btn==CHARS_TAB) tabs.click(btn);
goto _DRAW_WINDOW_CONTENT;
case evReDraw:
sc.get();
54,8 → 53,8
smooth.draw(83,8);
colored.draw(170,8);
 
tabs.draw();
tabs.draw_active_tab();
tabs.draw_button(Form.cwidth-130, PHRASE_TAB, "Phrase");
tabs.draw_button(Form.cwidth-60, CHARS_TAB, "Chars");
 
if (!kfont.font)
{
63,6 → 62,8
WriteText(10, 50, 0x82, 0xFF00FF, "Font is not loaded.");
break;
}
if (tabs.active_tab==PHRASE_TAB) DrawPreviewPhrase();
if (tabs.active_tab==CHARS_TAB) DrawPreviewChars();
}
}