diff --git a/ChangeLog b/ChangeLog index 98c9184..2f8bdc8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-06-25 +- improve user's message when compiled with --disable-battery +- replace 'task_width = width' by 'task_maximum_size = width height' + width will be used in horizontal panel + height will be used in vertical panel + 2009-06-24 - vertical panel done user's parameters : diff --git a/src/config.c b/src/config.c index 6a74227..0a1d13a 100644 --- a/src/config.c +++ b/src/config.c @@ -331,54 +331,67 @@ void add_entry (char *key, char *value) max_tick_urgent = (atoi (value) * 2) + 1; /* Battery */ -#ifdef ENABLE_BATTERY else if (strcmp (key, "battery") == 0) { +#ifdef ENABLE_BATTERY if(atoi(value) == 1) panel_config->battery.area.on_screen = 1; +#else + if(atoi(value) == 1) + printf("tint2 is build without battery support\n"); +#endif } else if (strcmp (key, "battery_low_status") == 0) { +#ifdef ENABLE_BATTERY battery_low_status = atoi(value); if(battery_low_status < 0 || battery_low_status > 100) battery_low_status = 0; +#endif } else if (strcmp (key, "battery_low_cmd") == 0) { +#ifdef ENABLE_BATTERY if (battery_low_cmd) g_free(battery_low_cmd); if (strlen(value) > 0) battery_low_cmd = strdup (value); else battery_low_cmd = 0; +#endif } else if (strcmp (key, "bat1_font") == 0) { +#ifdef ENABLE_BATTERY if (save_file_config) old_bat1_font = strdup (value); if (bat1_font_desc) pango_font_description_free(bat1_font_desc); bat1_font_desc = pango_font_description_from_string (value); +#endif } else if (strcmp (key, "bat2_font") == 0) { +#ifdef ENABLE_BATTERY if (save_file_config) old_bat2_font = strdup (value); if (bat2_font_desc) pango_font_description_free(bat2_font_desc); bat2_font_desc = pango_font_description_from_string (value); +#endif } else if (strcmp (key, "battery_font_color") == 0) { +#ifdef ENABLE_BATTERY extract_values(value, &value1, &value2, &value3); get_color (value1, panel_config->battery.font.color); if (value2) panel_config->battery.font.alpha = (atoi (value2) / 100.0); else panel_config->battery.font.alpha = 0.5; +#endif } else if (strcmp (key, "battery_padding") == 0) { +#ifdef ENABLE_BATTERY extract_values(value, &value1, &value2, &value3); panel_config->battery.area.paddingxlr = panel_config->battery.area.paddingx = atoi (value1); if (value2) panel_config->battery.area.paddingy = atoi (value2); if (value3) panel_config->battery.area.paddingx = atoi (value3); +#endif } else if (strcmp (key, "battery_background_id") == 0) { +#ifdef ENABLE_BATTERY int id = atoi (value); Area *a = g_slist_nth_data(list_back, id); memcpy(&panel_config->battery.area.pix.back, &a->pix.back, sizeof(Color)); memcpy(&panel_config->battery.area.pix.border, &a->pix.border, sizeof(Border)); - } -#else - else if ((strcmp (key, "battery") == 0) || (strcmp (key, "battery_low_status") == 0) || (strcmp (key, "battery_low_cmd") == 0) || (strcmp (key, "bat1_font") == 0) || (strcmp (key, "bat2_font") == 0) || (strcmp (key, "battery_font_color") == 0) || (strcmp (key, "battery_padding") == 0) || (strcmp (key, "battery_background_id") == 0)) { - printf("tint2 is build without battery support\n"); - } #endif + } /* Clock */ else if (strcmp (key, "time1_format") == 0) { @@ -461,8 +474,18 @@ void add_entry (char *key, char *value) panel_config->g_task.icon = atoi (value); else if (strcmp (key, "task_centered") == 0) panel_config->g_task.centered = atoi (value); - else if (strcmp (key, "task_width") == 0) + else if (strcmp (key, "task_width") == 0) { + // old parameter : just for backward compatibility panel_config->g_task.maximum_width = atoi (value); + panel_config->g_task.maximum_height = 30; + } + else if (strcmp (key, "task_maximum_size") == 0) { + extract_values(value, &value1, &value2, &value3); + panel_config->g_task.maximum_width = atoi (value1); + panel_config->g_task.maximum_height = 30; + if (value2) + panel_config->g_task.maximum_height = atoi (value2); + } else if (strcmp (key, "task_padding") == 0) { extract_values(value, &value1, &value2, &value3); panel_config->g_task.area.paddingxlr = panel_config->g_task.area.paddingx = atoi (value1); @@ -824,14 +847,15 @@ void save_config () fputs("panel_monitor = all\n", fp); if (panel_position & BOTTOM) fputs("panel_position = bottom", fp); else fputs("panel_position = top", fp); - if (panel_position & LEFT) fputs(" left\n", fp); - else if (panel_position & RIGHT) fputs(" right\n", fp); - else fputs(" center\n", fp); + if (panel_position & LEFT) fputs(" left horizontal\n", fp); + else if (panel_position & RIGHT) fputs(" right horizontal\n", fp); + else fputs(" center horizontal\n", fp); fprintf(fp, "panel_size = %d %d\n", (int)panel_config->initial_width, (int)panel_config->initial_height); fprintf(fp, "panel_margin = %d %d\n", panel_config->marginx, panel_config->marginy); fprintf(fp, "panel_padding = %d %d %d\n", panel_config->area.paddingxlr, panel_config->area.paddingy, panel_config->area.paddingx); fprintf(fp, "font_shadow = %d\n", panel_config->g_task.font_shadow); fputs("panel_background_id = 1\n", fp); + fputs("wm_menu = 0\n", fp); fputs("\n#---------------------------------------------\n", fp); fputs("# TASKBAR\n", fp); @@ -847,7 +871,7 @@ void save_config () if (old_task_icon_size) fputs("task_icon = 1\n", fp); else fputs("task_icon = 0\n", fp); fputs("task_text = 1\n", fp); - fprintf(fp, "task_width = %d\n", panel_config->g_task.maximum_width); + fprintf(fp, "task_maximum_size = %d %d\n", panel_config->g_task.maximum_width, panel_config->g_task.maximum_height); fprintf(fp, "task_centered = %d\n", panel_config->g_task.centered); fprintf(fp, "task_padding = %d %d\n", panel_config->g_task.area.paddingx, panel_config->g_task.area.paddingy); fprintf(fp, "task_font = %s\n", old_task_font); @@ -874,6 +898,8 @@ void save_config () fprintf(fp, "clock_font_color = #%02x%02x%02x %d\n", (int)(panel_config->clock.font.color[0]*255), (int)(panel_config->clock.font.color[1]*255), (int)(panel_config->clock.font.color[2]*255), (int)(panel_config->clock.font.alpha*100)); fputs("clock_padding = 2 2\n", fp); fputs("clock_background_id = 0\n", fp); + fputs("#clock_lclick_command = xclock\n", fp); + fputs("clock_rclick_command = orage\n", fp); #ifdef ENABLE_BATTERY fputs("\n#---------------------------------------------\n", fp); diff --git a/src/taskbar/task.h b/src/taskbar/task.h index 75d29c1..5f1ecf1 100644 --- a/src/taskbar/task.h +++ b/src/taskbar/task.h @@ -24,6 +24,7 @@ typedef struct { int icon_posy; int icon_size1; int maximum_width; + int maximum_height; // starting position for text ~ task_padding + task_border + icon_size double text_posx, text_posy; diff --git a/src/taskbar/taskbar.c b/src/taskbar/taskbar.c index 89da2a8..8da5b03 100644 --- a/src/taskbar/taskbar.c +++ b/src/taskbar/taskbar.c @@ -72,7 +72,7 @@ void init_taskbar() else { panel->g_task.area.posx = panel->g_taskbar.posx + panel->g_taskbar.pix.border.width + panel->g_taskbar.paddingy; panel->g_task.area.width = panel->area.width - (2 * panel->g_task.area.posx); - panel->g_task.area.height = panel->g_task.maximum_width; + panel->g_task.area.height = panel->g_task.maximum_height; } if (panel->g_task.area.pix.border.rounded > panel->g_task.area.height/2) { @@ -274,14 +274,14 @@ void resize_taskbar(void *obj) // new task width for 'desktop' task_count = g_slist_length(taskbar->area.list); - if (!task_count) pixel_height = panel->g_task.maximum_width; + if (!task_count) pixel_height = panel->g_task.maximum_height; else { taskbar_height = taskbar->area.height - (2 * panel->g_taskbar.pix.border.width) - (2 * panel->g_taskbar.paddingxlr); if (task_count>1) taskbar_height -= ((task_count-1) * panel->g_taskbar.paddingx); pixel_height = taskbar_height / task_count; - if (pixel_height > panel->g_task.maximum_width) - pixel_height = panel->g_task.maximum_width; + if (pixel_height > panel->g_task.maximum_height) + pixel_height = panel->g_task.maximum_height; else modulo_height = taskbar_height % task_count; } diff --git a/tintrc01 b/tintrc01 index 20b0a71..d1398ae 100644 --- a/tintrc01 +++ b/tintrc01 @@ -24,7 +24,8 @@ border_color = #ffffff 70 # PANEL #--------------------------------------------- panel_monitor = all -panel_position = bottom center +panel_position = bottom center horizontal +#panel_position = center left vertical panel_size = 94% 30 panel_margin = 0 0 panel_padding = 7 0 @@ -45,7 +46,7 @@ taskbar_background_id = 0 #--------------------------------------------- task_icon = 1 task_text = 1 -task_width = 140 +task_maximum_size = 140 30 task_centered = 1 task_padding = 6 3 task_font = sans 7 diff --git a/tintrc02 b/tintrc02 index 846675e..660ac5f 100644 --- a/tintrc02 +++ b/tintrc02 @@ -45,7 +45,7 @@ taskbar_background_id = 2 #--------------------------------------------- task_icon = 1 task_text = 0 -task_width = 34 +task_maximum_size = 34 34 task_centered = 1 task_padding = 2 3 task_font = sans 8 diff --git a/tintrc03 b/tintrc03 index ed90606..587ca50 100644 --- a/tintrc03 +++ b/tintrc03 @@ -40,7 +40,7 @@ taskbar_background_id = 0 #--------------------------------------------- task_icon = 0 task_text = 1 -task_width = 160 +task_maximum_size = 160 30 task_centered = 1 task_padding = 3 1 task_font = sans bold 7.5 diff --git a/tintrc04 b/tintrc04 index db3432e..e4bb2de 100644 --- a/tintrc04 +++ b/tintrc04 @@ -40,7 +40,7 @@ taskbar_background_id = 0 #--------------------------------------------- task_icon = 0 task_text = 1 -task_width = 160 +task_maximum_size = 160 30 task_centered = 1 task_padding = 5 0 task_font = sans 7.5 diff --git a/tintrc05 b/tintrc05 index 624400e..432b28d 100644 --- a/tintrc05 +++ b/tintrc05 @@ -45,7 +45,7 @@ taskbar_background_id = 2 #--------------------------------------------- task_icon = 0 task_text = 1 -task_width = 26 +task_maximum_size = 120 26 task_centered = 1 task_padding = 1 5 task_font = sans 7.5 diff --git a/tintrc06 b/tintrc06 index fa7fdf7..696c490 100644 --- a/tintrc06 +++ b/tintrc06 @@ -52,7 +52,7 @@ taskbar_background_id = 2 #--------------------------------------------- task_icon = 1 task_text = 0 -task_width = 30 +task_maximum_size = 120 30 task_centered = 1 task_padding = 4 6 task_font = sans bold 7.5