]> Dogcows Code - chaz/tint2/commitdiff
vertical panel done
authorThierry Lorthiois <lorthiois@bbsoft.fr>
Wed, 24 Jun 2009 20:17:57 +0000 (20:17 +0000)
committerThierry Lorthiois <lorthiois@bbsoft.fr>
Wed, 24 Jun 2009 20:17:57 +0000 (20:17 +0000)
ChangeLog
src/systray/systraybar.c
src/taskbar/task.c
src/taskbar/taskbar.c
tintrc05
tintrc06

index 923300a5d7f637079a4ad1c68035c403827a1e57..98c918423109f3990381468a4373d449a947b26f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index f0adce7258220d9687fb11afe9378eaea80b7fdf..5045f688252939ebeda7bfe3ace413d2b197c6fb 100644 (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);
index 866fdb8b9fb3c3fc0ecde9a0a9ef7bc6bb0990cd..0b8bdc8c98a9a16cacb6345b2254b6cd3ed5bbed 100644 (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) {
index deb6e04fa07a5b4be8d57ece25cfecddf44f9e32..89da2a85fba19294d2be42c35abc3d93c84e83a7 100644 (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
index 65bfe9b8af54715595d7bd434630fcad6255938b..624400ec85c269f1bb1a528da549f3c2e7cd6e95 100644 (file)
--- a/tintrc05
+++ b/tintrc05
@@ -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
index 19fc53d7c45af254997f835b17cd713e1e91d3e7..fa7fdf78e883b7826f2373d72cc0e173bec9aae8 100644 (file)
--- a/tintrc06
+++ b/tintrc06
@@ -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
This page took 0.034227 seconds and 4 git commands to generate.