Commit c7f90d0
Use icon font in tab bar
Changed files (7)
deletedicons/next_tab.pngdeletedicons/previous_tab.pngdeletedicons/progress_wheel.pngmodifiedlibbirdfont/LabelTool.valamodifiedlibbirdfont/TabBar.valamodifiedlibbirdfont/Theme.valamodifiedresources/icons.bf
Diff
deleted file mode 100644Binary files a/icons/next_tab.png and /dev/null differdeleted file mode 100644Binary files a/icons/previous_tab.png and /dev/null differdeleted file mode 100644Binary files a/icons/progress_wheel.png and /dev/null differ@@ -85,7 +85,7 @@ public class LabelTool : Tool { bgy = y + 2; if (is_selected ()) {- Theme.color (cr, "Background 6");+ Theme.color (cr, "Glyph Count Background"); } else { Theme.color (cr, "Background 3"); }@@ -1,5 +1,5 @@ /*- Copyright (C) 2012, 2014 Johan Mattsson+ Copyright (C) 2012, 2014, 2015 Johan Mattsson This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -45,8 +45,6 @@ public class TabBar : GLib.Object { ImageSurface? next_tab; ImageSurface? to_previous_tab; - ImageSurface? menu_icon;- double scale = 1; // scale images in 320 dpi bool processing = false;@@ -56,6 +54,11 @@ public class TabBar : GLib.Object { double background_g = 54 /255.0; double background_b = 59 /255.0; + Text menu_icon;+ Text progress_icon;+ Text left_arrow;+ Text right_arrow;+ public TabBar () { tabs = new Gee.ArrayList<Tab> (); @@ -63,8 +66,18 @@ public class TabBar : GLib.Object { to_previous_tab = Icons.get_icon ("previous_tab.png"); progress = Icons.get_icon ("progress_wheel.png");++ menu_icon = new Text ("menu_icon");+ menu_icon.load_font (Theme.get_icon_file ()); - menu_icon = Icons.get_icon ("menu.png");+ progress_icon = new Text ("progress");+ progress_icon.load_font (Theme.get_icon_file ());++ left_arrow = new Text ("left_arrow");+ left_arrow.load_font (Theme.get_icon_file ());+ + right_arrow = new Text ("right_arrow");+ right_arrow.load_font (Theme.get_icon_file ()); } public void redraw (int x, int y, int w, int h) {@@ -496,7 +509,7 @@ public class TabBar : GLib.Object { private void scroll_to_tab (int index, bool send_signal_selected = true) { double offset = 19; int i = 0;- double end = (has_progress_wheel ()) ? width - 28 : width - 19;+ double end = (has_progress_wheel ()) ? width - 68 : width - 40; if (index < first_tab) { first_tab = index;@@ -637,54 +650,78 @@ public class TabBar : GLib.Object { if (has_scroll () && !has_progress_wheel ()) { // left arrow- cr.set_source_surface ((!) to_previous_tab, 2 / scale, h / 2.0 - ((!) to_previous_tab).get_height () / 2);- cr.paint ();+ Theme.text_color (left_arrow, "Foreground 2");+ left_arrow.set_font_size (40 / scale);+ left_arrow.widget_x = 2 / scale;+ left_arrow.widget_y = h / 2.0 - (40 / scale ) / 2;+ left_arrow.draw (cr); // right arrow+ Theme.text_color (right_arrow, "Foreground 2"); next_tab_x = (has_progress_wheel ()) ? w - (2 * 19 + 3) / scale : w - 19 / scale; next_tab_x-= 32 / scale;- cr.set_source_surface ((!) next_tab, next_tab_x, h / 2.0 - ((!) next_tab).get_height () / 2.0);- cr.paint ();++ right_arrow.set_font_size (40 / scale);+ right_arrow.widget_x = next_tab_x;+ right_arrow.widget_y = h / 2.0 - (40 / scale ) / 2;+ right_arrow.draw (cr); } // progress wheel if (has_progress_wheel ()) {- ImageSurface p = (!) progress;- Surface s = new Surface.similar (p, p.get_content (), p.get_width (), p.get_height ());+ + // FIXME: make text rendering thread safe and update position+ double progress_size = 40 / scale;+ Surface s = new Surface.similar (cr.get_target (), Cairo.Content.COLOR_ALPHA, (int) progress_size, (int) progress_size); Context c = new Context (s); + if (MainWindow.get_menu ().show_menu) {+ Theme.text_color (menu_icon, "Foreground Inverted");+ } else {+ Theme.text_color (menu_icon, "Foreground 2");+ }+ + progress_icon.set_font_size (progress_size);+ progress_icon.widget_x = 0;+ progress_icon.widget_y = 0;+ c.save ();- c.rectangle (0, 0, p.get_width (), p.get_height ());+ c.rectangle (0, 0, progress_size, progress_size); c.set_line_width (0); c.set_source_rgba (background_r, background_g, background_b, 1); c.fill_preserve (); - c.translate (p.get_width () / 2.0, p.get_height () / 2.0);+ c.translate (progress_size / 2.0, progress_size / 2.0); c.rotate (wheel_rotation);- c.translate (-p.get_width () / 2.0, -p.get_height () / 2.0);+ c.translate (-progress_size / 2.0, -progress_size / 2.0); - c.set_source_surface ((!) progress, 0 ,0);+ progress_icon.draw (c); - c.translate (p.get_width () / 2.0, p.get_height () / 2.0);+ c.translate (progress_size / 2.0, progress_size / 2.0); c.paint (); c.restore (); - progress_y = (has_scroll ()) ? h - ((!) progress).get_height () - 5 / scale : (h - ((!) progress).get_height ()) / 2;+ progress_y = (has_scroll ()) ? h - progress_size - 5 / scale : (h - progress_size) / 2; cr.set_source_surface (c.get_target (), w - 19 / scale, progress_y); cr.paint (); } else { // menu icon- if (menu_icon != null) {- - if (MainWindow.get_menu ().show_menu) {- Theme.color (cr, "Background 3");- cr.rectangle (w - 32 / scale, 0, 32 / scale, h);- cr.fill ();- }- - cr.set_source_surface ((!) menu_icon, w - 25 / scale, h / 2.0 - ((!) menu_icon).get_height () / 2.0);- cr.paint ();+ if (MainWindow.get_menu ().show_menu) {+ Theme.color (cr, "Background 3");+ cr.rectangle (w - 32 / scale, 0, 32 / scale, h);+ cr.fill (); }+ + if (MainWindow.get_menu ().show_menu) {+ Theme.text_color (menu_icon, "Foreground Inverted");+ } else {+ Theme.text_color (menu_icon, "Foreground 2");+ }+ + menu_icon.set_font_size (40 / scale);+ menu_icon.widget_x = w - 25 / scale;+ menu_icon.widget_y = 3 / scale;+ menu_icon.draw (cr); } draw_tabs (cr);@@ -167,6 +167,7 @@ public class Theme : GLib.Object { Theme.set_default_color ("Overview Selected Foreground", 45 / 255.0, 45 / 255.0, 45 / 255.0, 1); Theme.set_default_color ("Overview Foreground", 45 / 255.0, 45 / 255.0, 45 / 255.0, 1); + Theme.set_default_color ("Glyph Count Background", 101 / 255.0, 108 / 255.0, 116 / 255.0, 1); if (BirdFont.has_argument ("--test")) { current_theme = "generated_theme.theme";@@ -230,6 +231,8 @@ public class Theme : GLib.Object { t_("Overview Selected Foreground"); t_("Overview Foreground");+ + t_("Glyph Count Background"); } } @@ -452,11 +452,27 @@ GNU Lesser General Public License</copyright> <glyph id="1" left="-28" right="28"> </glyph> </collection>+<collection name="left_arrow">+ <selected id="1"/>+ <glyph id="1" left="-28" right="25.184466019417457">+ <path stroke="0" skew="0" data="S 16.3457544910,11.1720448618 D 12.9964458443,7.8227362151 3.5780616609,3.9215137507 -1.1585760518,3.9215137507 T D -5.8952137645,3.9215137507 -15.3135979479,7.8227362151 -18.6629065945,11.1720448618 T D -22.0122152412,14.5213535084 -25.9134377056,23.9397376918 -25.9134377056,28.6763754045 T D -25.9134377056,33.4130131172 -22.0122152412,42.8313973006 -18.6629065945,46.1807059473 T D -15.3135979479,49.5300145940 -5.8952137645,53.4312370584 -1.1585760518,53.4312370584 T D 3.5780616609,53.4312370584 12.9964458443,49.5300145940 16.3457544910,46.1807059473 T D 19.6950631377,42.8313973006 23.5962856021,33.4130131172 23.5962856021,28.6763754045 T D 23.5962856021,23.9397376918 19.6950631377,14.5213535084 16.3457544910,11.1720448618 T" />+ <path stroke="0" skew="0" data="S 19.0193836125,28.5566343042 D 19.0193836125,32.3716968002 15.8771953315,39.9576103638 13.1795387700,42.6552669253 T D 10.4818822084,45.3529234869 2.8959686448,48.4951117679 -0.9190938511,48.4951117679 T D -4.7341563471,48.4951117679 -12.3200699107,45.3529234869 -15.0177264722,42.6552669253 T D -17.7153830338,39.9576103638 -20.8575713148,32.3716968002 -20.8575713148,28.5566343042 T D -20.8575713148,24.7415718082 -17.7153830338,17.1556582447 -15.0177264722,14.4580016831 T D -12.3200699107,11.7603451216 -4.7341563471,8.6181568405 -0.9190938511,8.6181568405 T D 2.8959686448,8.6181568405 10.4818822084,11.7603451216 13.1795387700,14.4580016831 T D 15.8771953315,17.1556582447 19.0193836125,24.7415718082 19.0193836125,28.5566343042 T" />+ <path stroke="0" skew="0" data="B 3.6031455894,42.2522867907 M -11.4649549106,27.1840862907 M 3.8796255894,14.8808862907 M 3.6031455894,42.2522867907" />+ </glyph>+</collection> <collection unicode="U+6d"> <selected id="1"/> <glyph id="1" left="-28" right="28"> </glyph> </collection>+<collection name="menu_icon">+ <selected id="1"/>+ <glyph id="1" left="-28" right="28">+ <path stroke="0" skew="0" data="S -20.0000000000,54.0582524272 L 24.0000000000,54.0582524272 L 24.0000000000,50.0582524272 L -20.0000000000,50.0582524272 L -20.0000000000,54.0582524272" />+ <path stroke="0" skew="0" data="S -20.0000000000,42.0582524272 L 24.0000000000,42.0582524272 L 24.0000000000,38.0582524272 L -20.0000000000,38.0582524272 L -20.0000000000,42.0582524272" />+ <path stroke="0" skew="0" data="S -20.0000000000,30.0582524272 L 24.0000000000,30.0582524272 L 24.0000000000,26.0582524272 L -20.0000000000,26.0582524272 L -20.0000000000,30.0582524272" />+ </glyph>+</collection> <collection name="move"> <selected id="1"/> <glyph id="1" left="-28" right="44.833598726114666">@@ -579,6 +595,12 @@ GNU Lesser General Public License</copyright> <path stroke="0" skew="0" data="B 7.2272862394,15.0689835207 M -8.1172942606,27.3721835207 M 6.9508062394,42.4403840207 M 7.2272862394,15.0689835207" /> </glyph> </collection>+<collection name="progress">+ <selected id="1"/>+ <glyph id="1" left="-28" right="28">+ <path stroke="0" skew="0" data="S 15.2459546926,42.3268608414 D 12.7256932529,44.8471222811 5.6386215657,47.7826834915 2.0744336570,47.7826834915 T D -1.4897542518,47.7826834915 -8.5768259390,44.8471222811 -11.0970873786,42.3268608414 T D -13.6173488183,39.8065994017 -16.5529100287,32.7195277146 -16.5529100287,29.1553398058 T D -16.5529100287,25.5911518971 -13.6173488183,18.5040802099 -11.0970873786,15.9838187702 T D -8.5768259390,13.4635573305 -1.4897542518,10.5279961202 2.0744336570,10.5279961202 T D 5.6386215657,10.5279961202 12.7256932529,13.4635573305 15.2459546926,15.9838187702 L 19.7155857659,11.2747054963 D 16.2484515754,7.8075713058 6.4987374504,3.7691074859 1.5954692557,3.7691074859 D -3.3077989391,3.7691074859 -13.0575130641,7.8075713058 -16.5246472546,11.2747054963 T D -19.9917814450,14.7418396868 -24.0302452649,24.4915538117 -24.0302452649,29.3948220065 T D -24.0302452649,34.2980902012 -19.9917814450,44.0478043262 -16.5246472546,47.5149385167 T D -13.0575130641,50.9820727072 -3.3077989391,55.0205365270 1.5954692557,55.0205365270 T D 6.4987374504,55.0205365270 16.0036116558,51.6997601095 19.7155857659,47.5149385167 L 15.2459546926,42.3268608414" />+ </glyph>+</collection> <collection unicode="U+71"> <selected id="1"/> <glyph id="1" left="-28" right="28">@@ -619,6 +641,14 @@ GNU Lesser General Public License</copyright> <path stroke="0" skew="0" data="B 2.0546235781,52.3710516520 M 1.9262535781,32.9589516520 M -5.6495264219,38.0974516520 C -5.6495264219,38.0974516520 -12.9863064219,29.1023516520 -11.0580064219,20.6176516520 C -9.1296364219,12.1329516520 5.9114635781,7.6333516520 5.9114635781,7.6333516520 M -5.9157164219,1.4627516520 C -5.9157164219,1.4627516520 -20.9643867219,8.2750516520 -22.4995067219,18.0464516520 C -24.4057467319,30.1802516520 -13.0213164219,41.2527516520 -13.0213164219,41.2527516520 M -23.2708067219,44.4005516520 M 2.0546235781,52.3710516520" /> </glyph> </collection>+<collection name="right_arrow">+ <selected id="1"/>+ <glyph id="1" left="-28" right="25.184466019417457">+ <path stroke="0" skew="0" data="S -25.9134377056,28.6763754045 D -25.9134377056,33.4130131172 -22.0122152412,42.8313973006 -18.6629065945,46.1807059473 T D -15.3135979478,49.5300145940 -5.8952137644,53.4312370584 -1.1585760517,53.4312370584 T D 3.5780616610,53.4312370584 12.9964458444,49.5300145940 16.3457544910,46.1807059473 T D 19.6950631376,42.8313973006 23.5962856021,33.4130131172 23.5962856021,28.6763754045 T D 23.5962856021,23.9397376918 19.6950631377,14.5213535084 16.3457544910,11.1720448618 T D 12.9964458443,7.8227362152 3.5780616610,3.9215137507 -1.1585760517,3.9215137507 T D -5.8952137644,3.9215137507 -15.3135979478,7.8227362151 -18.6629065945,11.1720448618 T D -22.0122152412,14.5213535084 -25.9134377056,23.9397376918 -25.9134377056,28.6763754045 T" />+ <path stroke="0" skew="0" data="S -15.1374675725,14.3382605828 D -12.4398110110,11.6406040213 -4.8538974474,8.4984157402 -1.0388349514,8.4984157402 T D 2.7762275446,8.4984157402 10.3621411081,11.6406040213 13.0597976697,14.3382605828 T D 15.7574542313,17.0359171443 18.8996425123,24.6218307079 18.8996425123,28.4368932039 T D 18.8996425123,32.2519556999 15.7574542312,39.8378692635 13.0597976697,42.5355258250 T D 10.3621411081,45.2331823866 2.7762275446,48.3753706676 -1.0388349514,48.3753706676 T D -4.8538974474,48.3753706676 -12.4398110110,45.2331823866 -15.1374675725,42.5355258250 T D -17.8351241340,39.8378692634 -20.9773124151,32.2519556999 -20.9773124151,28.4368932039 T D -20.9773124151,24.6218307079 -17.8351241341,17.0359171444 -15.1374675725,14.3382605828 T" />+ <path stroke="0" skew="0" data="B -6.1967776929,14.8808862907 M 9.1478028071,27.1840862907 M -5.9202976929,42.2522867907 M -6.1967776929,14.8808862907" />+ </glyph>+</collection> <collection name="rotation"> <selected id="1"/> <glyph id="1" left="-28" right="45.892473118279582">@@ -953,11 +983,14 @@ GNU Lesser General Public License</copyright> <ligature sequence="s p i n _ b u t t o n" replacement="spin_button"/> <ligature sequence="c r e a t e _ l i n e" replacement="create_line"/> <ligature sequence="b e z i e r _ l i n e" replacement="bezier_line"/>+<ligature sequence="r i g h t _ a r r o w" replacement="right_arrow"/> <ligature sequence="f u l l _ g l y p h" replacement="full_glyph"/> <ligature sequence="p o i n t _ t o o l" replacement="point_tool"/> <ligature sequence="s e l e c t _ a l l" replacement="select_all"/> <ligature sequence="m o v e _ l a y e r" replacement="move_layer"/> <ligature sequence="h e l p _ l i n e s" replacement="help_lines"/>+<ligature sequence="l e f t _ a r r o w" replacement="left_arrow"/>+<ligature sequence="m e n u _ i c o n" replacement="menu_icon"/> <ligature sequence="t t f _ u n i t s" replacement="ttf_units"/> <ligature sequence="r e c t a n g l e" replacement="rectangle"/> <ligature sequence="z o o m _ t o o l" replacement="zoom_tool"/>@@ -968,6 +1001,7 @@ GNU Lesser General Public License</copyright> <ligature sequence="a u t o t r a c e" replacement="autotrace"/> <ligature sequence="s h o w _ g r i d" replacement="show_grid"/> <ligature sequence="i n f o _ i c o n" replacement="info_icon"/>+<ligature sequence="p r o g r e s s" replacement="progress"/> <ligature sequence="z o o m _ 1 _ 1" replacement="zoom_1_1"/> <ligature sequence="p e n _ t o o l" replacement="pen_tool"/> <ligature sequence="r o t a t i o n" replacement="rotation"/>