vertical panel done

git-svn-id: http://tint2.googlecode.com/svn/trunk@124 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
lorthiois@bbsoft.fr 2009-06-24 20:17:57 +00:00
parent c334860bb2
commit 3550ebadf1
6 changed files with 77 additions and 44 deletions

View file

@ -1,3 +1,13 @@
2009-06-24
- vertical panel done
user's parameters :
1) add 'vertical' to panel_position (panel_position = center left vertical)
2) use 'task_width' to define the task height (task_width = 30)
3) adjust paddingy on task and systray wiil define the size of icons
all others parameters are automatically converted by tint2
(x padding become y padding, width become height ...)
so user's change between horizontal and vertical are minimised.
2009-06-23
- play with vertical panel
check sample file tintrc05 and tintrc06

View file

@ -59,22 +59,20 @@ void init_systray()
systray.area.panel = panel;
systray.area._draw_foreground = draw_systray;
systray.area._resize = resize_systray;
systray.area.resize = 1;
systray.area.redraw = 1;
refresh_systray = 0;
// configure systray
// draw only one systray (even with multi panel)
systray.area.posy = panel->area.pix.border.width + panel->area.paddingy;
systray.area.height = panel->area.height - (2 * systray.area.posy);
systray.area.width = 0;
systray.area.redraw = 1;
systray.area.posx = panel->area.width - panel->area.paddingxlr - panel->area.pix.border.width - systray.area.width;
if (panel->clock.area.on_screen)
systray.area.posx -= (panel->clock.area.width + panel->area.paddingx);
#ifdef ENABLE_BATTERY
if (panel->battery.area.on_screen)
systray.area.posx -= (panel->battery.area.width + panel->area.paddingx);
#endif
if (panel_horizontal) {
systray.area.posy = panel->area.pix.border.width + panel->area.paddingy;
systray.area.height = panel->area.height - (2 * systray.area.posy);
}
else {
systray.area.posx = panel->area.pix.border.width + panel->area.paddingy;
systray.area.width = panel->area.width - (2 * panel->area.pix.border.width) - (2 * panel->area.paddingy);
}
}
@ -91,7 +89,6 @@ void cleanup_systray()
}
free_area(&systray.area);
cleanup_net();
}
@ -112,22 +109,46 @@ void resize_systray(void *obj)
int count, posx, posy;
int icon_size;
icon_size = sysbar->area.height - (2 * sysbar->area.pix.border.width) - (2 * sysbar->area.paddingy);
if (panel_horizontal)
icon_size = sysbar->area.height;
else
icon_size = sysbar->area.width;
icon_size = icon_size - (2 * sysbar->area.pix.border.width) - (2 * sysbar->area.paddingy);
count = g_slist_length(systray.list_icons);
if (!count) systray.area.width = 0;
else systray.area.width = (2 * systray.area.pix.border.width) + (2 * systray.area.paddingxlr) + (icon_size * count) + ((count-1) * systray.area.paddingx);
if (panel_horizontal) {
if (!count) systray.area.width = 0;
else systray.area.width = (2 * systray.area.pix.border.width) + (2 * systray.area.paddingxlr) + (icon_size * count) + ((count-1) * systray.area.paddingx);
systray.area.posx = panel->area.width - panel->area.pix.border.width - panel->area.paddingxlr - systray.area.width;
if (panel->clock.area.on_screen)
systray.area.posx -= (panel->clock.area.width + panel->area.paddingx);
systray.area.posx = panel->area.width - panel->area.pix.border.width - panel->area.paddingxlr - systray.area.width;
if (panel->clock.area.on_screen)
systray.area.posx -= (panel->clock.area.width + panel->area.paddingx);
#ifdef ENABLE_BATTERY
if (panel->battery.area.on_screen)
systray.area.posx -= (panel->battery.area.width + panel->area.paddingx);
if (panel->battery.area.on_screen)
systray.area.posx -= (panel->battery.area.width + panel->area.paddingx);
#endif
}
else {
if (!count) systray.area.height = 0;
else systray.area.height = (2 * systray.area.pix.border.width) + (2 * systray.area.paddingxlr) + (icon_size * count) + ((count-1) * systray.area.paddingx);
posy = panel->area.pix.border.width + panel->area.paddingy + systray.area.pix.border.width + systray.area.paddingy;
posx = systray.area.posx + systray.area.pix.border.width + systray.area.paddingxlr;
systray.area.posy = panel->area.pix.border.width + panel->area.paddingxlr;
if (panel->clock.area.on_screen)
systray.area.posy += (panel->clock.area.height + panel->area.paddingx);
#ifdef ENABLE_BATTERY
if (panel->battery.area.on_screen)
systray.area.posy += (panel->battery.area.height + panel->area.paddingx);
#endif
}
if (panel_horizontal) {
posy = panel->area.pix.border.width + panel->area.paddingy + systray.area.pix.border.width + systray.area.paddingy;
posx = systray.area.posx + systray.area.pix.border.width + systray.area.paddingxlr;
}
else {
posx = panel->area.pix.border.width + panel->area.paddingy + systray.area.pix.border.width + systray.area.paddingy;
posy = systray.area.posy + systray.area.pix.border.width + systray.area.paddingxlr;
}
for (l = systray.list_icons; l ; l = l->next) {
traywin = (TrayWindow*)l->data;
@ -135,7 +156,10 @@ void resize_systray(void *obj)
traywin->x = posx;
traywin->width = icon_size;
traywin->height = icon_size;
posx += (icon_size + systray.area.paddingx);
if (panel_horizontal)
posx += (icon_size + systray.area.paddingx);
else
posy += (icon_size + systray.area.paddingx);
// position and size the icon window
XMoveResizeWindow(server.dsp, traywin->id, traywin->x, traywin->y, icon_size, icon_size);

View file

@ -289,7 +289,7 @@ void draw_task (void *obj, cairo_t *c, int active)
Task *tsk = obj;
PangoLayout *layout;
config_color *config_text;
int width, height;
int width=0, height;
Panel *panel = (Panel*)tsk->area.panel;
if (panel->g_task.text) {

View file

@ -84,11 +84,10 @@ void init_taskbar()
int height_ink, height;
get_text_size(panel->g_task.font_desc, &height_ink, &height, panel->area.height, "TAjpg", 5);
if (!panel->g_task.maximum_width)
if (!panel->g_task.maximum_width && panel_horizontal)
panel->g_task.maximum_width = server.monitor[panel->monitor].width;
// add task_icon_size
panel->g_task.text_posx = panel->g_task.area.paddingxlr + panel->g_task.area.pix.border.width;
panel->g_task.text_posx = panel->g_task.area.pix.border.width + panel->g_task.area.paddingxlr;
panel->g_task.text_posy = (panel->g_task.area.height - height) / 2.0;
if (panel->g_task.icon) {
panel->g_task.icon_size1 = panel->g_task.area.height - (2 * panel->g_task.area.paddingy);
@ -292,7 +291,7 @@ void resize_taskbar(void *obj)
else {
taskbar->task_width = pixel_height;
taskbar->task_modulo = modulo_height;
taskbar->text_width = taskbar->area.width - (2 * taskbar->area.paddingy) - (2 * taskbar->area.pix.border.width);
taskbar->text_width = taskbar->area.width - (2 * panel->g_taskbar.paddingy) - panel->g_task.text_posx - panel->g_task.area.pix.border.width - panel->g_task.area.paddingx;
}
// change pos_y and height for all tasks

View file

@ -12,12 +12,12 @@ border_color = #d1d1d1 34
rounded = 3
border_width = 1
background_color = #000000 40
border_color = #d1d1d1 34
background_color = #96b3a9 60
border_color = #d1d1d1 70
rounded = 2
border_width = 0
background_color = #d1d1d1 24
background_color = #707070 40
border_color = #d1d1d1 40
#---------------------------------------------
@ -43,22 +43,22 @@ taskbar_background_id = 2
#---------------------------------------------
# TASKS
#---------------------------------------------
task_icon = 1
task_icon = 0
task_text = 1
task_width = 26
task_centered = 1
task_padding = 4 3
task_font = sans bold 7.5
task_font_color = #ffffff 60
task_active_font_color = #ffffff 90
task_padding = 1 5
task_font = sans 7.5
task_font_color = #ffffff 80
task_active_font_color = #ffffff 100
task_background_id = 0
task_active_background_id = 3
#---------------------------------------------
# SYSTRAYBAR
#---------------------------------------------
#systray_padding = 6 3 5
systray_background_id = 2
systray_padding = 0 28 2
systray_background_id = 0
#---------------------------------------------
# CLOCK
@ -68,7 +68,7 @@ time1_font = sans bold 8
#time2_format = %A %d %B
time2_format = %A %d
time2_font = sans 7
clock_font_color = #ffffff 60
clock_font_color = #ffffff 90
clock_padding = 4 2
clock_background_id = 2
clock_lclick_command = xclock
@ -82,9 +82,9 @@ battery_low_status = 10
battery_low_cmd = notify-send "battery low"
bat1_font = sans bold 7
bat2_font = sans 7
battery_font_color = #ffffff 60
battery_font_color = #ffffff 90
battery_padding = 0 0
battery_background_id = 0
battery_background_id = 2
#---------------------------------------------
# MOUSE ACTION ON TASK

View file

@ -64,8 +64,8 @@ task_active_background_id = 3
#---------------------------------------------
# SYSTRAYBAR
#---------------------------------------------
#systray_padding = 6 3 5
systray_background_id = 2
systray_padding = 4 10 2
systray_background_id = 0
#---------------------------------------------
# CLOCK