Commit a8cea9a
Display a background image to the empty tool box
Changed files (6)
modifiedAUTHORSaddedicons/corvus_monedula.pngmodifiedlibbirdfont/ColorTool.valamodifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/Toolbox.valamodifiedlibbirdfont/ZoomBar.vala
Diff
@@ -5,3 +5,4 @@ Eduardo Schettino Zhantong Zhang Clemens Lang Hideki Yamane+Rene Mensennew file mode 100644Binary files /dev/null and b/icons/corvus_monedula.png differ@@ -34,6 +34,7 @@ public class ColorTool : Tool { color_updated.connect (() => { MainWindow.get_toolbox ().redraw ((int)x, (int)y, (int)x + 20, (int)y + 20);+ GlyphCanvas.redraw (); }); } @@ -1000,7 +1000,8 @@ public class DrawingTools : ToolCollection { idle.set_callback (() => { MainWindow.get_toolbox ().reset_active_tool (); - pen_tool.set_selected (true);+ foresight_tool.set_selected (true);+ update_drawing_and_background_tools (foresight_tool); select_draw_tool (); set_point_type_from_preferences ();@@ -62,6 +62,7 @@ public class Toolbox : GLib.Object { tab_bar.signal_tab_selected.connect ((tab) => { string tab_name = tab.get_display ().get_name ();+ if (tab_name == "Kerning") { current_set = kerning_tools; } else if (tab_name == "Preview") {@@ -70,9 +71,12 @@ public class Toolbox : GLib.Object { current_set = overview_tools; } else if (tab_name == "Backgrounds") { current_set = background_tools;- } else {+ } else if (tab.get_display () is Glyph) { current_set = drawing_tools;- }+ } else {+ current_set = new EmptySet ();+ } + update_expanders (); redraw (0, 0, allocation_width, allocation_height);@@ -420,17 +424,52 @@ public class Toolbox : GLib.Object { } public void draw (int w, int h, Context cr) { - cr.save ();+ EmptySet empty_set;+ ImageSurface bg; - cr.rectangle (0, 0, w, h);- cr.set_line_width (0);- cr.set_source_rgba (51/255.0, 54/255.0, 59/255.0, 1);- cr.fill ();+ if (current_set is EmptySet) {+ empty_set = (EmptySet) current_set;+ + if (empty_set.background != null) {+ bg = (!) empty_set.background;+ + cr.save ();+ cr.scale ((double) allocation_width / bg.get_width (), (double) allocation_height / bg.get_height ());+ cr.set_source_surface (bg, 0, 0);+ cr.paint (); + cr.restore ();+ + draw_expanders (w, h, cr);+ }+ } else {+ cr.save ();+ + cr.rectangle (0, 0, w, h);+ cr.set_line_width (0);+ cr.set_source_rgba (51/255.0, 54/255.0, 59/255.0, 1);+ cr.fill (); - draw_expanders (w, h, cr);+ draw_expanders (w, h, cr);+ + cr.restore ();+ }+ }+ + public class EmptySet : ToolCollection {+ + public ImageSurface? background;+ Gee.ArrayList<Expander> expanders; - cr.restore ();+ public EmptySet () {+ background = Icons.get_icon ("corvus_monedula.png");+ expanders = new Gee.ArrayList<Expander> ();+ }+ + public override Gee.ArrayList<Expander> get_expanders () {+ return expanders;+ } }+ } }@@ -103,7 +103,6 @@ public class ZoomBar : Tool { } void draw_bar (Context cr) {- double scale = Toolbox.get_scale (); double height = h; double radius = height / 2; double margin = w * 0.1;