diff --git a/programs/cmm/appearance/appearance.c b/programs/cmm/appearance/appearance.c index a7ed7f7ffb..d5abf2ab8c 100644 --- a/programs/cmm/appearance/appearance.c +++ b/programs/cmm/appearance/appearance.c @@ -129,8 +129,8 @@ void DrawWindowContent() tabs.h = Form.cheight-LP-LP; tabs.draw_wrapper(); - tabs.draw_button(tabs.x+TAB_PADDING, tabs.y+TAB_HEIGHT, SKINS, T_SKINS); - tabs.draw_button(strlen(T_SKINS)*8+tabs.x+TAB_PADDING+TAB_PADDING, tabs.y+TAB_HEIGHT, WALLPAPERS, T_WALLPAPERS); + 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); id = select_list.cur_y; SelectList_Init( diff --git a/programs/cmm/kf_font_viewer/font_viewer.c b/programs/cmm/kf_font_viewer/font_viewer.c index dd619e1b90..1f7f87c970 100644 --- a/programs/cmm/kf_font_viewer/font_viewer.c +++ b/programs/cmm/kf_font_viewer/font_viewer.c @@ -3,7 +3,9 @@ #include "../lib/kfont.h" #include "../lib/gui.h" -#define PANELH 30 +#define PANELH 28 +#define WIN_W 490 +#define WIN_H 315 proc_info Form; enum { @@ -11,6 +13,10 @@ enum { PHRASE_TAB=20, CHARS_TAB }; +_tabs tabs = { 0,0, WIN_W, WIN_H, PHRASE_TAB}; + +rect preview; + void main() { @@ -18,7 +24,6 @@ void main() char title[4196]; if (!param) strcpy(#param, DEFAULT_FONT); kfont.init(#param); - tabs.active_tab=PHRASE_TAB; strcpy(#title, "Font preview: "); strcat(#title, #param); loop() switch(WaitEvent()) @@ -32,19 +37,27 @@ void main() goto _DRAW_WINDOW_CONTENT; case evReDraw: system.color.get(); - DefineAndDrawWindow(215,100,500,320+skin_height,0x74,0xFFFFFF,#title,0); + DefineAndDrawWindow(215,100,WIN_W+9,WIN_H+skin_height+5,0x74,0xFFFFFF,#title,0); GetProcessInfo(#Form, SelfInfo); if (Form.status_window>2) break; _DRAW_WINDOW_CONTENT: + DrawBar(0, 0, Form.cwidth, PANELH-1, system.color.work); + DrawBar(0, PANELH-1,Form.cwidth,1,system.color.work_graph); CheckBox(10, 8, STRONG_BTN, "Bold", kfont.bold); CheckBox(83,8, SMOOTH_BTN, "Smooth", kfont.smooth); - tabs.draw(Form.cwidth-150, PANELH, PHRASE_TAB, "Phrase"); - tabs.draw(Form.cwidth-70, PANELH, CHARS_TAB, "Chars"); - DrawBar(0, PANELH-1,Form.cwidth,1,system.color.work_graph); + + tabs.draw_button(Form.cwidth-130, PHRASE_TAB, "Phrase"); + tabs.draw_button(Form.cwidth-60, CHARS_TAB, "Chars"); + + preview.x = tabs.x; + preview.y = PANELH; + preview.w = Form.cwidth; + preview.h = Form.cheight - PANELH; + if (!kfont.font) { - DrawBar(0, PANELH, Form.cwidth, Form.cheight - PANELH, 0xFFFfff); + DrawBar(preview.x, preview.y, preview.w, preview.h, 0xFFFfff); WriteText(10, 50, 0x82, 0xFF00FF, "Font is not loaded."); break; } @@ -64,7 +77,7 @@ void DrawPreviewPhrase() kfont.WriteIntoBuffer(10,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, 0, i, #line); } if (kfont.smooth) kfont.ApplySmooth(); - kfont.ShowBuffer(0, PANELH); + kfont.ShowBuffer(preview.x, preview.y); } void DrawPreviewChars() @@ -78,11 +91,11 @@ void DrawPreviewChars() line[0]=i; kfont.WriteIntoBuffer(x,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, 0, 16, #line); x+= kfont.height+2; - if (x>=Form.cwidth-30) { + if (x>=preview.w-30) { x=20; y+=kfont.height+2; } } if (kfont.smooth) kfont.ApplySmooth(); - kfont.ShowBuffer(0, PANELH); + kfont.ShowBuffer(preview.x, preview.y); } diff --git a/programs/cmm/lib/gui/tabs.h b/programs/cmm/lib/gui/tabs.h index e6cdca98f2..a6c22562bb 100644 --- a/programs/cmm/lib/gui/tabs.h +++ b/programs/cmm/lib/gui/tabs.h @@ -6,6 +6,7 @@ { int x,y,w,h; int active_tab; + int c; void draw_button(); int click(); void draw_wrapper(); @@ -25,13 +26,14 @@ DrawBar(x, y+TAB_HEIGHT-1, w, 1, color_light_border); DrawBar(x, y+TAB_HEIGHT, w, 1, color_light); + + c = y + TAB_HEIGHT; } -:void _tabs::draw_button(dword xx,yy, but_id, text) +:void _tabs::draw_button(dword xx, but_id, text) { dword col_bg, col_text; dword ww=strlen(text)*8, hh=TAB_HEIGHT; - yy -= hh; if (but_id==active_tab) { @@ -43,9 +45,9 @@ col_bg=0xC3A1B7; col_text=0x333333; } - DefineHiddenButton(xx,yy, ww-1,hh-1, but_id); - WriteText(xx, yy+6, 0x90, col_text, text); - DrawBar(xx, yy+hh-3, ww, 3, col_bg); + DefineHiddenButton(xx,y, ww-1,hh-1, but_id); + WriteText(xx, y+6, 0x90, col_text, text); + DrawBar(xx, y+hh-3, ww, 3, col_bg); } :int _tabs::click(int N)