replace task_width with task_maximum_size. change wiki documentation.

git-svn-id: http://tint2.googlecode.com/svn/trunk@128 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
lorthiois@bbsoft.fr 2009-06-25 21:47:38 +00:00
parent 3550ebadf1
commit 96e1cfc58e
10 changed files with 56 additions and 22 deletions

View file

@ -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 2009-06-24
- vertical panel done - vertical panel done
user's parameters : user's parameters :

View file

@ -331,54 +331,67 @@ void add_entry (char *key, char *value)
max_tick_urgent = (atoi (value) * 2) + 1; max_tick_urgent = (atoi (value) * 2) + 1;
/* Battery */ /* Battery */
#ifdef ENABLE_BATTERY
else if (strcmp (key, "battery") == 0) { else if (strcmp (key, "battery") == 0) {
#ifdef ENABLE_BATTERY
if(atoi(value) == 1) if(atoi(value) == 1)
panel_config->battery.area.on_screen = 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) { else if (strcmp (key, "battery_low_status") == 0) {
#ifdef ENABLE_BATTERY
battery_low_status = atoi(value); battery_low_status = atoi(value);
if(battery_low_status < 0 || battery_low_status > 100) if(battery_low_status < 0 || battery_low_status > 100)
battery_low_status = 0; battery_low_status = 0;
#endif
} }
else if (strcmp (key, "battery_low_cmd") == 0) { else if (strcmp (key, "battery_low_cmd") == 0) {
#ifdef ENABLE_BATTERY
if (battery_low_cmd) g_free(battery_low_cmd); if (battery_low_cmd) g_free(battery_low_cmd);
if (strlen(value) > 0) battery_low_cmd = strdup (value); if (strlen(value) > 0) battery_low_cmd = strdup (value);
else battery_low_cmd = 0; else battery_low_cmd = 0;
#endif
} }
else if (strcmp (key, "bat1_font") == 0) { else if (strcmp (key, "bat1_font") == 0) {
#ifdef ENABLE_BATTERY
if (save_file_config) old_bat1_font = strdup (value); if (save_file_config) old_bat1_font = strdup (value);
if (bat1_font_desc) pango_font_description_free(bat1_font_desc); if (bat1_font_desc) pango_font_description_free(bat1_font_desc);
bat1_font_desc = pango_font_description_from_string (value); bat1_font_desc = pango_font_description_from_string (value);
#endif
} }
else if (strcmp (key, "bat2_font") == 0) { else if (strcmp (key, "bat2_font") == 0) {
#ifdef ENABLE_BATTERY
if (save_file_config) old_bat2_font = strdup (value); if (save_file_config) old_bat2_font = strdup (value);
if (bat2_font_desc) pango_font_description_free(bat2_font_desc); if (bat2_font_desc) pango_font_description_free(bat2_font_desc);
bat2_font_desc = pango_font_description_from_string (value); bat2_font_desc = pango_font_description_from_string (value);
#endif
} }
else if (strcmp (key, "battery_font_color") == 0) { else if (strcmp (key, "battery_font_color") == 0) {
#ifdef ENABLE_BATTERY
extract_values(value, &value1, &value2, &value3); extract_values(value, &value1, &value2, &value3);
get_color (value1, panel_config->battery.font.color); get_color (value1, panel_config->battery.font.color);
if (value2) panel_config->battery.font.alpha = (atoi (value2) / 100.0); if (value2) panel_config->battery.font.alpha = (atoi (value2) / 100.0);
else panel_config->battery.font.alpha = 0.5; else panel_config->battery.font.alpha = 0.5;
#endif
} }
else if (strcmp (key, "battery_padding") == 0) { else if (strcmp (key, "battery_padding") == 0) {
#ifdef ENABLE_BATTERY
extract_values(value, &value1, &value2, &value3); extract_values(value, &value1, &value2, &value3);
panel_config->battery.area.paddingxlr = panel_config->battery.area.paddingx = atoi (value1); panel_config->battery.area.paddingxlr = panel_config->battery.area.paddingx = atoi (value1);
if (value2) panel_config->battery.area.paddingy = atoi (value2); if (value2) panel_config->battery.area.paddingy = atoi (value2);
if (value3) panel_config->battery.area.paddingx = atoi (value3); if (value3) panel_config->battery.area.paddingx = atoi (value3);
#endif
} }
else if (strcmp (key, "battery_background_id") == 0) { else if (strcmp (key, "battery_background_id") == 0) {
#ifdef ENABLE_BATTERY
int id = atoi (value); int id = atoi (value);
Area *a = g_slist_nth_data(list_back, id); 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.back, &a->pix.back, sizeof(Color));
memcpy(&panel_config->battery.area.pix.border, &a->pix.border, sizeof(Border)); 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 #endif
}
/* Clock */ /* Clock */
else if (strcmp (key, "time1_format") == 0) { 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); panel_config->g_task.icon = atoi (value);
else if (strcmp (key, "task_centered") == 0) else if (strcmp (key, "task_centered") == 0)
panel_config->g_task.centered = atoi (value); 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_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) { else if (strcmp (key, "task_padding") == 0) {
extract_values(value, &value1, &value2, &value3); extract_values(value, &value1, &value2, &value3);
panel_config->g_task.area.paddingxlr = panel_config->g_task.area.paddingx = atoi (value1); 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); fputs("panel_monitor = all\n", fp);
if (panel_position & BOTTOM) fputs("panel_position = bottom", fp); if (panel_position & BOTTOM) fputs("panel_position = bottom", fp);
else fputs("panel_position = top", fp); else fputs("panel_position = top", fp);
if (panel_position & LEFT) fputs(" left\n", fp); if (panel_position & LEFT) fputs(" left horizontal\n", fp);
else if (panel_position & RIGHT) fputs(" right\n", fp); else if (panel_position & RIGHT) fputs(" right horizontal\n", fp);
else fputs(" center\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_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_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, "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); fprintf(fp, "font_shadow = %d\n", panel_config->g_task.font_shadow);
fputs("panel_background_id = 1\n", fp); fputs("panel_background_id = 1\n", fp);
fputs("wm_menu = 0\n", fp);
fputs("\n#---------------------------------------------\n", fp); fputs("\n#---------------------------------------------\n", fp);
fputs("# TASKBAR\n", fp); fputs("# TASKBAR\n", fp);
@ -847,7 +871,7 @@ void save_config ()
if (old_task_icon_size) fputs("task_icon = 1\n", fp); if (old_task_icon_size) fputs("task_icon = 1\n", fp);
else fputs("task_icon = 0\n", fp); else fputs("task_icon = 0\n", fp);
fputs("task_text = 1\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_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_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); 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)); 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_padding = 2 2\n", fp);
fputs("clock_background_id = 0\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 #ifdef ENABLE_BATTERY
fputs("\n#---------------------------------------------\n", fp); fputs("\n#---------------------------------------------\n", fp);

View file

@ -24,6 +24,7 @@ typedef struct {
int icon_posy; int icon_posy;
int icon_size1; int icon_size1;
int maximum_width; int maximum_width;
int maximum_height;
// starting position for text ~ task_padding + task_border + icon_size // starting position for text ~ task_padding + task_border + icon_size
double text_posx, text_posy; double text_posx, text_posy;

View file

@ -72,7 +72,7 @@ void init_taskbar()
else { else {
panel->g_task.area.posx = panel->g_taskbar.posx + panel->g_taskbar.pix.border.width + panel->g_taskbar.paddingy; 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.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) { 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' // new task width for 'desktop'
task_count = g_slist_length(taskbar->area.list); 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 { else {
taskbar_height = taskbar->area.height - (2 * panel->g_taskbar.pix.border.width) - (2 * panel->g_taskbar.paddingxlr); 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); if (task_count>1) taskbar_height -= ((task_count-1) * panel->g_taskbar.paddingx);
pixel_height = taskbar_height / task_count; pixel_height = taskbar_height / task_count;
if (pixel_height > panel->g_task.maximum_width) if (pixel_height > panel->g_task.maximum_height)
pixel_height = panel->g_task.maximum_width; pixel_height = panel->g_task.maximum_height;
else else
modulo_height = taskbar_height % task_count; modulo_height = taskbar_height % task_count;
} }

View file

@ -24,7 +24,8 @@ border_color = #ffffff 70
# PANEL # PANEL
#--------------------------------------------- #---------------------------------------------
panel_monitor = all panel_monitor = all
panel_position = bottom center panel_position = bottom center horizontal
#panel_position = center left vertical
panel_size = 94% 30 panel_size = 94% 30
panel_margin = 0 0 panel_margin = 0 0
panel_padding = 7 0 panel_padding = 7 0
@ -45,7 +46,7 @@ taskbar_background_id = 0
#--------------------------------------------- #---------------------------------------------
task_icon = 1 task_icon = 1
task_text = 1 task_text = 1
task_width = 140 task_maximum_size = 140 30
task_centered = 1 task_centered = 1
task_padding = 6 3 task_padding = 6 3
task_font = sans 7 task_font = sans 7

View file

@ -45,7 +45,7 @@ taskbar_background_id = 2
#--------------------------------------------- #---------------------------------------------
task_icon = 1 task_icon = 1
task_text = 0 task_text = 0
task_width = 34 task_maximum_size = 34 34
task_centered = 1 task_centered = 1
task_padding = 2 3 task_padding = 2 3
task_font = sans 8 task_font = sans 8

View file

@ -40,7 +40,7 @@ taskbar_background_id = 0
#--------------------------------------------- #---------------------------------------------
task_icon = 0 task_icon = 0
task_text = 1 task_text = 1
task_width = 160 task_maximum_size = 160 30
task_centered = 1 task_centered = 1
task_padding = 3 1 task_padding = 3 1
task_font = sans bold 7.5 task_font = sans bold 7.5

View file

@ -40,7 +40,7 @@ taskbar_background_id = 0
#--------------------------------------------- #---------------------------------------------
task_icon = 0 task_icon = 0
task_text = 1 task_text = 1
task_width = 160 task_maximum_size = 160 30
task_centered = 1 task_centered = 1
task_padding = 5 0 task_padding = 5 0
task_font = sans 7.5 task_font = sans 7.5

View file

@ -45,7 +45,7 @@ taskbar_background_id = 2
#--------------------------------------------- #---------------------------------------------
task_icon = 0 task_icon = 0
task_text = 1 task_text = 1
task_width = 26 task_maximum_size = 120 26
task_centered = 1 task_centered = 1
task_padding = 1 5 task_padding = 1 5
task_font = sans 7.5 task_font = sans 7.5

View file

@ -52,7 +52,7 @@ taskbar_background_id = 2
#--------------------------------------------- #---------------------------------------------
task_icon = 1 task_icon = 1
task_text = 0 task_text = 0
task_width = 30 task_maximum_size = 120 30
task_centered = 1 task_centered = 1
task_padding = 4 6 task_padding = 4 6
task_font = sans bold 7.5 task_font = sans bold 7.5