File indexing completed on 2024-05-12 17:10:54
0001 /* 0002 * vrunner theme engine 0003 * 0004 * vrunner.c 0005 * 0006 * Copyright (C) 2006 Quinn Storm <livinglatexkali@gmail.com> (original legacy theme engine) 0007 * Copyright (C) 2006 Varun <varunratnakar@gmail.com> 0008 * 0009 * This program is free software; you can redistribute it and/or 0010 * modify it under the terms of the GNU General Public License 0011 * as published by the Free Software Foundation; either version 2 0012 * of the License, or (at your option) any later version. 0013 * 0014 * This program is distributed in the hope that it will be useful, 0015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 * GNU General Public License for more details. 0018 * 0019 * You should have received a copy of the GNU General Public License 0020 * along with this program; if not, write to the Free Software 0021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0022 */ 0023 0024 //vrunner engine 0025 #include <emerald.h> 0026 #include <engine.h> 0027 #include "vrunner_engine.h" 0028 0029 #define SECT "vrunner_settings" 0030 0031 #define FLTS(flt) \ 0032 load_float_setting(f,&((private_fs *)ws->fs_act->engine_fs)->flt,"active_" #flt ,SECT);\ 0033 load_float_setting(f,&((private_fs *)ws->fs_inact->engine_fs)->flt,"inactive_" #flt ,SECT); 0034 0035 /* 0036 * settings structs 0037 */ 0038 typedef struct _private_fs 0039 { 0040 alpha_color title_left; 0041 alpha_color title_left_lower; 0042 alpha_color title_middle; 0043 alpha_color title_middle_lower; 0044 alpha_color title_right; 0045 alpha_color title_right_lower; 0046 alpha_color window_halo; 0047 alpha_color window_highlight; 0048 alpha_color window_shadow; 0049 alpha_color separator_line; 0050 alpha_color contents_highlight; 0051 alpha_color contents_shadow; 0052 alpha_color contents_halo; 0053 double title_notch_position; 0054 double curve_offset; 0055 double frame_notch_position; 0056 double color_contrast; 0057 double alpha_contrast; 0058 double glow_radius; 0059 alpha_color glow_inner; 0060 gboolean use_glow; 0061 } private_fs; 0062 0063 typedef struct _private_ws 0064 { 0065 gboolean round_top_left; 0066 gboolean round_top_right; 0067 gboolean round_bottom_left; 0068 gboolean round_bottom_right; 0069 double corner_radius; 0070 } private_ws; 0071 0072 void get_meta_info (EngineMetaInfo * emi) 0073 { 0074 emi->version = g_strdup("0.2"); 0075 emi->description = g_strdup(_("Multiple gradients with somewhat glassy features too")); 0076 emi->last_compat = g_strdup("0.0"); // old themes marked still compatible for now 0077 emi->icon = gdk_pixbuf_new_from_inline(-1, my_pixbuf, TRUE, NULL); 0078 } 0079 0080 void 0081 draw_closed_curve (cairo_t *cr, 0082 double x, 0083 double y, 0084 double w, 0085 double h, 0086 double ch, 0087 gboolean tophalf) 0088 { 0089 cairo_move_to (cr, x, y); 0090 if(tophalf || ch == 0) 0091 cairo_line_to (cr, x + w, y); 0092 else 0093 cairo_curve_to (cr, x, y, x + w/2, y + ch, x + w, y); 0094 0095 cairo_line_to (cr, x + w, y + h); 0096 0097 if(tophalf && ch != 0) 0098 cairo_curve_to (cr, x + w, y + h, x + w/2, y + h + ch, x, y + h); 0099 else 0100 cairo_line_to (cr, x, y + h); 0101 0102 cairo_line_to (cr, x, y); 0103 } 0104 0105 void 0106 draw_filled_closed_curve (cairo_t *cr, 0107 double x, 0108 double y, 0109 double w, 0110 double h, 0111 double ch, 0112 gboolean tophalf, 0113 alpha_color * c0, 0114 alpha_color * c1, 0115 alpha_color * c2) 0116 { 0117 cairo_pattern_t *pattern; 0118 0119 draw_closed_curve (cr, x, y, w, h, ch, tophalf); 0120 0121 pattern = cairo_pattern_create_linear (x, y, x + w, y + h); 0122 cairo_pattern_add_color_stop_rgba (pattern, 0.0, c0->color.r, c0->color.g, 0123 c0->color.b,c0->alpha); 0124 cairo_pattern_add_color_stop_rgba (pattern, 0.5, c1->color.r, c1->color.g, 0125 c1->color.b,c1->alpha); 0126 cairo_pattern_add_color_stop_rgba (pattern, 1.0, c2->color.r, c2->color.g, 0127 c2->color.b,c2->alpha); 0128 //cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD); 0129 cairo_set_source (cr, pattern); 0130 cairo_fill (cr); 0131 cairo_pattern_destroy (pattern); 0132 } 0133 0134 void create_glow(decor_t *d, cairo_t *cr, 0135 double x, double y, double w, double h, 0136 alpha_color * c0, double p) 0137 { 0138 double r = 0.0; 0139 double wp = p; 0140 double hp = p; 0141 //cairo_rectangle(cr, x1, y1, w, h); 0142 frame_settings * fs = d->fs; 0143 // private_fs * pfs = fs->engine_fs; 0144 window_settings * ws = fs->ws; 0145 if(wp*2 > w) wp = w/2; 0146 if(hp*2 > h) hp = h/2; 0147 0148 x = x+wp; 0149 y = y+hp; 0150 wp = wp*2; 0151 hp = hp*2; 0152 w = w-wp; 0153 h = h-hp; 0154 0155 alpha_color c1; 0156 c1.color = c0->color; 0157 c1.alpha = 0; 0158 cairo_set_operator (cr, CAIRO_OPERATOR_OVER); 0159 0160 fill_rounded_rectangle (cr, 0161 x-wp, y-hp, wp, hp, CORNER_TOPLEFT, 0162 c0, &c1, (SHADE_LEFT | SHADE_TOP ), ws, r); 0163 fill_rounded_rectangle (cr, 0164 x, y-hp, w, hp, 0, 0165 c0, &c1, SHADE_TOP, ws, r); 0166 fill_rounded_rectangle (cr, 0167 x+w, y-hp, wp, hp, CORNER_TOPRIGHT, 0168 c0, &c1, (SHADE_RIGHT | SHADE_TOP ), ws, r); 0169 fill_rounded_rectangle (cr, 0170 x-wp, y, wp, h, 0, 0171 c0, &c1, SHADE_LEFT, ws, r); 0172 fill_rounded_rectangle (cr, 0173 x+w, y, wp, h, 0, 0174 c0, &c1, SHADE_RIGHT, ws, r); 0175 fill_rounded_rectangle (cr, 0176 x-wp, y+h, wp, hp, CORNER_BOTTOMLEFT, 0177 c0, &c1, (SHADE_LEFT | SHADE_BOTTOM ), ws, r); 0178 fill_rounded_rectangle (cr, 0179 x, y+h, w, hp, 0, 0180 c0, &c1, SHADE_BOTTOM, ws, r); 0181 fill_rounded_rectangle (cr, 0182 x+w, y+h, wp, hp, CORNER_BOTTOMRIGHT, 0183 c0, &c1, (SHADE_RIGHT | SHADE_BOTTOM ), ws, r); 0184 0185 cairo_rectangle (cr, x, y, w, h); 0186 cairo_set_source_alpha_color (cr, c0); 0187 cairo_fill (cr); 0188 } 0189 0190 static gint get_real_pos(window_settings * ws, gint tobj, decor_t * d) 0191 { 0192 gint width = d->width; 0193 gint base = ws->left_space; 0194 switch(d->tobj_item_state[tobj]) 0195 { 0196 case 1: 0197 base = (width - ws->left_space - ws->right_space - d->tobj_size[0] - d->tobj_size[2]) / 2 0198 - d->tobj_size[1]/2 + ws->left_space + d->tobj_size[0]; 0199 break; 0200 case 2: 0201 base = width - ws->right_space - d->tobj_size[2]; 0202 break; 0203 case 3: 0204 return -1; 0205 default: 0206 break; 0207 } 0208 return base + d->tobj_item_pos[tobj]; 0209 } 0210 0211 void engine_draw_frame (decor_t * d, cairo_t * cr) 0212 { 0213 double x1, y1, x2, y2, h, 0214 top_title_height, bottom_title_height, 0215 top_left, top_right; 0216 int top, title_width = 0, title_height = 0, title_pos; 0217 // double curve_offset; 0218 frame_settings * fs = d->fs; 0219 private_fs * pfs = fs->engine_fs; 0220 window_settings * ws = fs->ws; 0221 private_ws * pws = ws->engine_ws; 0222 gdouble pleft; 0223 gdouble ptop; 0224 gdouble pwidth; 0225 gdouble pheight; 0226 top = ws->win_extents.top + ws->titlebar_height; 0227 0228 x1 = ws->left_space - ws->win_extents.left; 0229 y1 = ws->top_space - ws->win_extents.top; 0230 x2 = d->width - ws->right_space + ws->win_extents.right; 0231 y2 = d->height - ws->bottom_space + ws->win_extents.bottom; 0232 pleft = x1 + ws->win_extents.left - 0.5; 0233 ptop = y1 + top - 0.5; 0234 pwidth = x2 - x1 - ws->win_extents.left - ws->win_extents.right + 1; 0235 pheight = y2 - y1 - top-ws->win_extents.bottom + 1; 0236 0237 h = d->height - ws->top_space - ws->titlebar_height - ws->bottom_space; 0238 0239 int corners = 0240 ((pws->round_top_left) ? CORNER_TOPLEFT : 0) | 0241 ((pws->round_top_right) ? CORNER_TOPRIGHT : 0) | 0242 ((pws->round_bottom_left) ? CORNER_BOTTOMLEFT : 0) | 0243 ((pws->round_bottom_right) ? CORNER_BOTTOMRIGHT : 0); 0244 0245 // maximize work-a-round 0246 if (d->state & (WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY | 0247 WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY)) 0248 corners = 0; 0249 0250 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); 0251 cairo_set_line_width (cr, 0.0); 0252 0253 top_title_height = (top - 0.5)*pfs->title_notch_position + 1; 0254 bottom_title_height = (top - 0.5)*(1-pfs->title_notch_position) + 1; 0255 0256 top_left = ws->win_extents.left; 0257 top_right = ws->win_extents.right; 0258 if((top_left < pws->corner_radius) && (corners & CORNER_TOPLEFT)) 0259 top_left = pws->corner_radius; 0260 if((top_right < pws->corner_radius) && (corners & CORNER_TOPRIGHT)) 0261 top_right = pws->corner_radius; 0262 0263 // Main Top Titlebar 0264 rounded_rectangle (cr, 0265 x1 + 0.5, 0266 y1 + 0.5, 0267 x2 - x1 - 1, 0268 top + 1, 0269 (CORNER_TOPLEFT | CORNER_TOPRIGHT) & corners, ws, 0270 pws->corner_radius); 0271 cairo_clip(cr); 0272 0273 draw_filled_closed_curve(cr, 0274 x1 + 0.5, 0275 y1 + 0.5, 0276 x2 - x1 - 1, 0277 top_title_height + 1, 0278 pfs->curve_offset, 0279 TRUE, 0280 &pfs->title_left, 0281 &pfs->title_middle, 0282 &pfs->title_right); 0283 0284 draw_filled_closed_curve(cr, 0285 x1 + 0.5, 0286 y1 + top_title_height - 1, 0287 x2 - x1 - 1, 0288 bottom_title_height + 2, 0289 pfs->curve_offset, 0290 FALSE, 0291 &pfs->title_left_lower, 0292 &pfs->title_middle_lower, 0293 &pfs->title_right_lower); 0294 0295 cairo_reset_clip(cr); 0296 0297 // Left and Right 0298 fill_rounded_rectangle (cr, 0299 x1+0.5, 0300 y1 + top - 0.5, 0301 ws->win_extents.left, 0302 h + 0.5, 0303 0, 0304 &pfs->title_left_lower,&pfs->title_left_lower, 0305 SHADE_BOTTOM, ws, 0306 pws->corner_radius); 0307 0308 fill_rounded_rectangle (cr, 0309 x2 - ws->win_extents.right-0.5, 0310 y1 + top - 0.5, 0311 ws->win_extents.right, 0312 h + 0.5, 0313 0, 0314 &pfs->title_right_lower,&pfs->title_right_lower, 0315 SHADE_BOTTOM, ws, 0316 pws->corner_radius); 0317 0318 // Bottom Frame 0319 rounded_rectangle (cr, 0320 x1 + 0.5, 0321 y2 - ws->win_extents.bottom, 0322 x2 - x1 - 1, 0323 ws->win_extents.bottom, 0324 (CORNER_BOTTOMLEFT | CORNER_BOTTOMRIGHT) & corners, ws, 0325 pws->corner_radius); 0326 0327 cairo_clip(cr); 0328 0329 draw_filled_closed_curve(cr, 0330 x1 + 0.5, 0331 y2 - ws->win_extents.bottom, 0332 x2 - x1 - 1, 0333 ws->win_extents.bottom, 0334 0, 0335 TRUE, 0336 &pfs->title_left_lower, 0337 &pfs->title_middle_lower, 0338 &pfs->title_right_lower); 0339 0340 cairo_reset_clip(cr); 0341 0342 // Title Glow 0343 if(pfs->use_glow) { 0344 cairo_set_operator (cr, CAIRO_OPERATOR_ATOP); 0345 0346 if(PANGO_IS_LAYOUT(d->layout)) 0347 pango_layout_get_pixel_size(d->layout, &title_width, &title_height); 0348 title_pos = get_real_pos(ws, TBT_TITLE, d); 0349 create_glow (d, cr, title_pos, y1 + top/2.0 - title_height/2.0, 0350 title_width, title_height, 0351 &pfs->glow_inner, pfs->glow_radius); 0352 } 0353 0354 0355 // ======= NEW LAYER ====== 0356 cairo_set_operator (cr, CAIRO_OPERATOR_OVER); 0357 cairo_set_line_width (cr, 1.0); 0358 0359 // Titlebar Separator 0360 if(pfs->separator_line.alpha > 0) { 0361 cairo_set_source_alpha_color(cr, &pfs->separator_line); 0362 cairo_move_to (cr, x1 + 0.5, y1 + top - 0.5); 0363 cairo_rel_line_to (cr, x2 - x1 - 1, 0.0); 0364 cairo_stroke (cr); 0365 } 0366 0367 // Frame Clip 0368 rounded_rectangle (cr, 0369 x1 + 0.5, y1 + 0.5, 0370 x2 - x1 - 1.0, y2 - y1 - 1.0, 0371 (CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT | 0372 CORNER_BOTTOMRIGHT) & corners, ws, 0373 pws->corner_radius); 0374 cairo_clip (cr); 0375 0376 cairo_translate (cr, 1.0, 1.0); 0377 0378 // highlight 0379 rounded_rectangle (cr, 0380 x1 + 0.5, y1 + 0.5, 0381 x2 - x1 - 1.0, y2 - y1 - 1.0, 0382 (CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT | 0383 CORNER_BOTTOMRIGHT) & corners, ws, 0384 pws->corner_radius); 0385 0386 cairo_set_source_alpha_color (cr, &pfs->window_highlight); 0387 cairo_stroke (cr); 0388 0389 cairo_translate (cr, -2.0, -2.0); 0390 0391 // shadow 0392 rounded_rectangle (cr, 0393 x1 + 0.5, y1 + 0.5, 0394 x2 - x1 - 1.0, y2 - y1 - 1.0, 0395 (CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT | 0396 CORNER_BOTTOMRIGHT) & corners, ws, 0397 pws->corner_radius); 0398 0399 cairo_set_source_alpha_color (cr, &pfs->window_shadow); 0400 cairo_stroke (cr); 0401 0402 cairo_translate (cr, 1.0, 1.0); 0403 0404 cairo_reset_clip (cr); 0405 0406 // halo 0407 rounded_rectangle (cr, 0408 x1 + 0.5, y1 + 0.5, 0409 x2 - x1 - 1.0, y2 - y1 - 1.0, 0410 (CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT | 0411 CORNER_BOTTOMRIGHT) & corners, ws, 0412 pws->corner_radius); 0413 0414 cairo_set_source_alpha_color (cr, &pfs->window_halo); 0415 cairo_stroke (cr); 0416 0417 // inner border 0418 //TODO - make this a bit more pixel-perfect...but it works for now 0419 0420 cairo_set_line_width (cr, 1.0); 0421 0422 cairo_move_to (cr, pleft + pwidth + 1.5, ptop - 1); 0423 cairo_rel_line_to (cr, -pwidth - 2.5, 0); 0424 cairo_rel_line_to (cr, 0, pheight + 2.5); 0425 cairo_set_source_alpha_color (cr, &pfs->contents_shadow); 0426 cairo_stroke (cr); 0427 0428 cairo_move_to (cr, pleft + pwidth + 1, ptop - 1.5); 0429 cairo_rel_line_to (cr, 0, pheight + 2.5); 0430 cairo_rel_line_to (cr, -pwidth - 2.5, 0); 0431 cairo_set_source_alpha_color (cr, &pfs->contents_highlight); 0432 cairo_stroke (cr); 0433 0434 cairo_move_to (cr, pleft, ptop); 0435 cairo_rel_line_to (cr, pwidth, 0); 0436 cairo_rel_line_to (cr, 0, pheight); 0437 cairo_rel_line_to (cr, -pwidth, 0); 0438 cairo_rel_line_to (cr, 0, -pheight); 0439 cairo_set_source_alpha_color (cr, &pfs->contents_halo); 0440 cairo_stroke(cr); 0441 } 0442 0443 void load_engine_settings(GKeyFile * f, window_settings * ws) 0444 { 0445 private_ws * pws = ws->engine_ws; 0446 0447 // color settings 0448 PFACS(title_left); 0449 PFACS(title_middle); 0450 PFACS(title_right); 0451 PFACS(window_halo); 0452 PFACS(window_highlight); 0453 PFACS(window_shadow); 0454 PFACS(separator_line); 0455 PFACS(contents_shadow); 0456 PFACS(contents_highlight); 0457 PFACS(contents_halo); 0458 PFACS(glow_inner); 0459 FLTS(color_contrast); 0460 FLTS(glow_radius); 0461 FLTS(alpha_contrast); 0462 FLTS(curve_offset); 0463 FLTS(title_notch_position); 0464 0465 private_fs * pfs = ws->fs_act->engine_fs; 0466 CCOLOR(title_left_lower, title_left); 0467 CCOLOR(title_middle_lower, title_middle); 0468 CCOLOR(title_right_lower, title_right); 0469 load_bool_setting(f, &pfs->use_glow, "active_use_glow", SECT); 0470 0471 pfs = ws->fs_inact->engine_fs; 0472 CCOLOR(title_left_lower, title_left); 0473 CCOLOR(title_middle_lower, title_middle); 0474 CCOLOR(title_right_lower, title_right); 0475 load_bool_setting(f, &pfs->use_glow, "inactive_use_glow", SECT); 0476 0477 load_bool_setting(f, &pws->round_top_left, "round_top_left", SECT); 0478 load_bool_setting(f, &pws->round_top_right, "round_top_right", SECT); 0479 load_bool_setting(f, &pws->round_bottom_left, "round_bottom_left", SECT); 0480 load_bool_setting(f, &pws->round_bottom_right, "round_bottom_right", SECT); 0481 load_float_setting(f, &pws->corner_radius, "radius", SECT); 0482 } 0483 0484 void init_engine(window_settings * ws) 0485 { 0486 private_fs * pfs; 0487 private_ws * pws; 0488 0489 pws = malloc(sizeof(private_ws)); 0490 ws->engine_ws = pws; 0491 bzero(pws, sizeof(private_ws)); 0492 pws->round_top_left = TRUE; 0493 pws->round_top_right = TRUE; 0494 pws->round_bottom_left = TRUE; 0495 pws->round_bottom_right = TRUE; 0496 pws->corner_radius = 5.0; 0497 0498 pfs = malloc(sizeof(private_fs)); 0499 ws->fs_act->engine_fs = pfs; 0500 bzero(pfs, sizeof(private_fs)); 0501 pfs->title_notch_position = 0.5; 0502 pfs->curve_offset = 0.0; 0503 pfs->color_contrast = 0.9; 0504 pfs->use_glow = FALSE; 0505 pfs->alpha_contrast = 0.9; 0506 pfs->glow_radius = 7.0; 0507 ACOLOR(title_left, 0.8, 0.8, 0.8, 0.8); 0508 CCOLOR(title_left_lower,title_left); 0509 ACOLOR(title_middle, 0.8, 0.8, 0.8, 0.8); 0510 CCOLOR(title_middle_lower, title_middle); 0511 ACOLOR(title_right, 0.8, 0.8, 0.8, 0.8); 0512 CCOLOR(title_right_lower, title_right); 0513 ACOLOR(window_highlight, 1.0, 1.0, 1.0, 0.8); 0514 ACOLOR(window_shadow, 0.6, 0.6, 0.6, 0.8); 0515 ACOLOR(window_halo, 0.8, 0.8, 0.8, 0.8); 0516 ACOLOR(separator_line, 0.0, 0.0, 0.0, 0.0); 0517 ACOLOR(contents_highlight, 1.0, 1.0, 1.0, 0.8); 0518 ACOLOR(contents_shadow, 0.6, 0.6, 0.6, 0.8); 0519 ACOLOR(contents_halo, 0.8, 0.8, 0.8, 0.8); 0520 ACOLOR(glow_inner, 0.9, 0.9, 0.9, 0.9); 0521 0522 pfs = malloc(sizeof(private_fs)); 0523 bzero(pfs, sizeof(private_fs)); 0524 ws->fs_inact->engine_fs = pfs; 0525 pfs->title_notch_position = 0.5; 0526 pfs->curve_offset = 0.0; 0527 pfs->color_contrast = 0.9; 0528 pfs->alpha_contrast = 0.9; 0529 pfs->use_glow = FALSE; 0530 pfs->glow_radius = 7.0; 0531 ACOLOR(title_left, 0.8, 0.8, 0.8,0.6); 0532 CCOLOR(title_left_lower, title_left); 0533 ACOLOR(title_middle, 0.8, 0.8, 0.8, 0.6); 0534 CCOLOR(title_middle_lower, title_middle); 0535 ACOLOR(title_right, 0.8, 0.8, 0.8, 0.6); 0536 CCOLOR(title_right_lower, title_right); 0537 ACOLOR(window_highlight,1.0, 1.0, 1.0, 0.7); 0538 ACOLOR(window_shadow, 0.6, 0.6, 0.6, 0.7); 0539 ACOLOR(window_halo, 0.8, 0.8, 0.8, 0.7); 0540 ACOLOR(separator_line, 0.0, 0.0, 0.0, 0.0); 0541 ACOLOR(contents_highlight, 1.0, 1.0, 1.0, 0.8); 0542 ACOLOR(contents_shadow, 0.6, 0.6, 0.6, 0.8); 0543 ACOLOR(contents_halo, 0.8, 0.8, 0.8, 0.8); 0544 ACOLOR(glow_inner, 0.9, 0.9, 0.9, 0.9); 0545 } 0546 0547 void fini_engine(window_settings * ws) 0548 { 0549 free(ws->fs_act->engine_fs); 0550 free(ws->fs_inact->engine_fs); 0551 } 0552 #if 0 0553 void layout_corners_frame(GtkWidget * vbox) 0554 { 0555 GtkWidget * hbox; 0556 GtkWidget * junk; 0557 0558 junk = gtk_check_button_new_with_label(_("Round Top Left Corner")); 0559 gtk_box_pack_startC(vbox, junk, FALSE, FALSE, 0); 0560 register_setting(junk, ST_BOOL, SECT, "round_top_left"); 0561 0562 junk = gtk_check_button_new_with_label(_("Round Top Right Corner")); 0563 gtk_box_pack_startC(vbox, junk, FALSE, FALSE, 0); 0564 register_setting(junk, ST_BOOL, SECT, "round_top_right"); 0565 0566 junk = gtk_check_button_new_with_label(_("Round Bottom Left Corner")); 0567 gtk_box_pack_startC(vbox, junk, FALSE, FALSE, 0); 0568 register_setting(junk, ST_BOOL, SECT, "round_bottom_left"); 0569 0570 junk = gtk_check_button_new_with_label(_("Round Bottom Right Corner")); 0571 gtk_box_pack_startC(vbox, junk, FALSE, FALSE, 0); 0572 register_setting(junk, ST_BOOL, SECT, "round_bottom_right"); 0573 0574 hbox = gtk_hbox_new(FALSE, 2); 0575 gtk_box_pack_startC(vbox, hbox, FALSE, FALSE, 0); 0576 0577 gtk_box_pack_startC(hbox, gtk_label_new(_("Rounding Radius")), FALSE, FALSE, 0); 0578 0579 junk = scaler_new(0, 20, 0.5); 0580 gtk_box_pack_startC(hbox, junk, TRUE, TRUE, 0); 0581 register_setting(junk, ST_FLOAT, SECT, "radius"); 0582 0583 } 0584 void my_engine_settings(GtkWidget * hbox, gboolean active) 0585 { 0586 GtkWidget * vbox; 0587 GtkWidget * junk; 0588 GtkWidget * scroller; 0589 0590 vbox = gtk_vbox_new(FALSE, 2); 0591 gtk_box_pack_startC(hbox, vbox, TRUE, TRUE, 0); 0592 gtk_box_pack_startC(vbox, gtk_label_new(active ? "Active Window" : "Inactive Window"), FALSE, FALSE, 0); 0593 gtk_box_pack_startC(vbox, gtk_hseparator_new(), FALSE, FALSE, 0); 0594 scroller = gtk_scrolled_window_new(NULL, NULL); 0595 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroller), 0596 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); 0597 gtk_box_pack_startC(vbox, scroller, TRUE, TRUE, 0); 0598 0599 table_new(3, FALSE, FALSE); 0600 0601 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroller), GTK_WIDGET(get_current_table())); 0602 0603 make_labels(_("Colors")); 0604 table_append_separator(); 0605 ACAV(_("Left Blend"), "title_left", SECT); 0606 ACAV(_("Middle Blend"), "title_middle", SECT); 0607 ACAV(_("Right Blend"), "title_right", SECT); 0608 0609 table_append_separator(); 0610 junk = gtk_label_new(_("Contrast")); 0611 table_append(junk, FALSE); 0612 junk = gtk_label_new(_("(Color)")); 0613 table_append(junk, FALSE); 0614 junk = scaler_new(0, 1, 0.01); 0615 table_append(junk, FALSE); 0616 if(active) 0617 register_setting(junk, ST_FLOAT, SECT, "active_color_contrast"); 0618 else 0619 register_setting(junk, ST_FLOAT, SECT, "inactive_color_contrast"); 0620 0621 junk = gtk_label_new(_("Contrast")); 0622 table_append(junk, FALSE); 0623 junk = gtk_label_new(_("(Alpha)")); 0624 table_append(junk, FALSE); 0625 junk = scaler_new(0, 1, 0.01); 0626 table_append(junk, FALSE); 0627 if(active) 0628 register_setting(junk, ST_FLOAT, SECT, "active_alpha_contrast"); 0629 else 0630 register_setting(junk, ST_FLOAT, SECT, "inactive_alpha_contrast"); 0631 0632 junk = gtk_label_new(_("Notch")); 0633 table_append(junk, FALSE); 0634 junk = gtk_label_new(_("Position")); 0635 table_append(junk, FALSE); 0636 junk = scaler_new(0, 1, 0.01); 0637 gtk_range_set_value(GTK_RANGE(junk), 0.5); 0638 table_append(junk, FALSE); 0639 if(active) 0640 register_setting(junk, ST_FLOAT, SECT, "active_title_notch_position"); 0641 else 0642 register_setting(junk, ST_FLOAT, SECT, "inactive_title_notch_position"); 0643 0644 junk = gtk_label_new(_("Curve")); 0645 table_append(junk, FALSE); 0646 junk = gtk_label_new(_("Offset")); 0647 table_append(junk, FALSE); 0648 junk = scaler_new(-100, 100, 0.1); 0649 gtk_range_set_value(GTK_RANGE(junk), 0); 0650 table_append(junk, FALSE); 0651 if(active) 0652 register_setting(junk, ST_FLOAT, SECT, "active_curve_offset"); 0653 else 0654 register_setting(junk, ST_FLOAT, SECT, "inactive_curve_offset"); 0655 0656 table_append_separator(); 0657 0658 junk = gtk_check_button_new_with_label(_("Use Glow")); 0659 gtk_box_pack_startC(vbox, junk, FALSE, FALSE, 0); 0660 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(junk), FALSE); 0661 if(active) 0662 register_setting(junk, ST_BOOL, SECT, "active_use_glow"); 0663 else 0664 register_setting(junk, ST_BOOL, SECT, "inactive_use_glow"); 0665 0666 ACAV(_("Title Glow"), "glow_inner", SECT); 0667 junk = gtk_label_new("Glow"); 0668 table_append(junk, FALSE); 0669 junk = gtk_label_new(_("Radius")); 0670 table_append(junk, FALSE); 0671 junk = scaler_new(0, 25, 0.1); 0672 gtk_range_set_value(GTK_RANGE(junk), 7.0); 0673 table_append(junk, FALSE); 0674 if(active) 0675 register_setting(junk, ST_FLOAT, SECT, "active_glow_radius"); 0676 else 0677 register_setting(junk, ST_FLOAT, SECT, "inactive_glow_radius"); 0678 0679 table_append_separator(); 0680 ACAV(_("Titlebar Separator"), "separator_line", SECT); 0681 0682 table_append_separator(); 0683 ACAV(_("Frame Outline"), "window_halo", SECT); 0684 ACAV(_("Frame Highlight"), "window_highlight", SECT); 0685 ACAV("Frame Shadow", "window_shadow", SECT); 0686 0687 table_append_separator(); 0688 ACAV(_("Contents Outline"), "contents_halo", SECT); 0689 ACAV(_("Contents Highlight"), "contents_highlight", SECT); 0690 ACAV("Contents Shadow", "contents_shadow", SECT); 0691 } 0692 0693 void layout_engine_colors(GtkWidget * vbox) 0694 { 0695 GtkWidget * hbox; 0696 0697 hbox = gtk_hbox_new(FALSE, 2); 0698 gtk_box_pack_startC(vbox, hbox, TRUE, TRUE, 0); 0699 my_engine_settings(hbox, TRUE); 0700 gtk_box_pack_startC(hbox, gtk_vseparator_new(), FALSE, FALSE, 0); 0701 my_engine_settings(hbox, FALSE); 0702 } 0703 0704 void layout_engine_settings(GtkWidget * vbox) 0705 { 0706 GtkWidget * note; 0707 0708 note = gtk_notebook_new(); 0709 gtk_box_pack_startC(vbox, note, TRUE, TRUE, 0); 0710 layout_engine_colors(build_notebook_page(_("Colors"), note)); 0711 layout_corners_frame(build_notebook_page(_("Frame"), note)); 0712 } 0713 #endif