Commit 383fc79
Merge ../birdfont-android/birdfont
Changed files (7)
modifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/FontName.valamodifiedlibbirdfont/HiddenTools.valamodifiedlibbirdfont/LabelTool.valamodifiedlibbirdfont/Table.valamodifiedlibbirdfont/Tool.valamodifiedlibbirdfont/Toolbox.vala
Diff
@@ -147,7 +147,9 @@ public class DrawingTools : ToolCollection { zoom_tool.select_action.connect ((self) => { update_drawing_and_background_tools (self); });-#if ANDROID == false+#if ANDROID+ Toolbox.hidden_tools.hidden_expander.add_tool (zoom_tool);+#else draw_tools.add_tool (zoom_tool); #endif move_tool = new MoveTool ("move");@@ -41,7 +41,7 @@ public class FontName : Tool { // tab label font_name = new Text (); font_name.set_text (BirdFont.get_current_font ().get_full_name ());- text_height = 22;+ text_height = 22 * Toolbox.get_scale (); max_width = (width - 2 * x * Toolbox.get_scale ()); font_name.set_font_size (text_height);@@ -20,9 +20,10 @@ namespace BirdFont { public class HiddenTools : ToolCollection { public Gee.ArrayList<Expander> expanders;+ public Expander hidden_expander; public HiddenTools () {- Expander hidden_expander = new Expander ();+ hidden_expander = new Expander (); expanders = new Gee.ArrayList<Expander> (); Tool zoom_in = new Tool ("zoom_in", t_("Zoom in"));@@ -67,7 +67,7 @@ public class LabelTool : Tool { cr.save (); label_text = new Text (); label_text.set_text (label);- text_height = 18;+ text_height = 18 * Toolbox.get_scale (); if (is_selected ()) { Theme.text_color (label_text, "Text Tool Box");@@ -106,7 +106,7 @@ public abstract class Table : FontDisplay { cr.save (); Theme.color (cr, "Text Foreground"); t = row.get_column (0);- t.widget_x = 40 * MainWindow.units;;+ t.widget_x = 40 * MainWindow.units; t.widget_y = y + 45 * MainWindow.units; t.draw (cr); cr.restore ();@@ -127,7 +127,7 @@ public abstract class Table : FontDisplay { Theme.color (cr, "Table Background 1"); } - cr.rectangle (0, y * MainWindow.units, allocation.width, 25 * MainWindow.units);+ cr.rectangle (0, y, allocation.width, 25 * MainWindow.units); cr.fill (); cr.restore (); @@ -211,7 +211,7 @@ public abstract class Table : FontDisplay { } public override void scroll_wheel_down (double x, double y) {- scroll += 30;+ scroll += 30 * MainWindow.units; if (scroll > page_height - allocation.height) { scroll = page_height - allocation.height;@@ -226,7 +226,7 @@ public abstract class Table : FontDisplay { } public override void scroll_wheel_up (double x, double y) {- scroll -= 30;+ scroll -= 30 * MainWindow.units; if (scroll < 0) { scroll = 0;@@ -20,8 +20,8 @@ public class Tool : Widget { public double x = 0; public double y = 0;- public double w = 33 * Toolbox.get_scale ();- public double h = (33 / 1.11) * Toolbox.get_scale ();+ public double w;+ public double h; double scale; @@ -88,8 +88,10 @@ public class Tool : Widget { icon_font = new Text (); - scale = w / 111.0; // scale to 320 dpi- + scale = MainWindow.units;+ w = 33 * Toolbox.get_scale ();+ h = (33 / 1.11) * Toolbox.get_scale ();+ if (name != null) { set_icon ((!) name); this.name = (!) name;@@ -192,7 +194,7 @@ public class Tool : Widget { icon_font = new Text ((!) name); found = icon_font.load_font (icon_file); icon_font.use_cache (true);- icon_font.set_font_size (35);+ icon_font.set_font_size (35 * Toolbox.get_scale ()); if (!found) { warning (@"Icon font for toolbox was not found. ($(icon_file))");@@ -257,6 +259,9 @@ public class Tool : Widget { string border = "Button Border 3"; string background = "Button Border 3"; + double scale = Toolbox.get_scale (); + + printd (@"scale: $scale\n"); cr.save (); bgx = xt;@@ -284,12 +289,12 @@ public class Tool : Widget { } Theme.color (cr, background);- draw_rounded_rectangle (cr, bgx, bgy, 34, 28, 4);+ draw_rounded_rectangle (cr, bgx, bgy, 34 * scale, 28 * scale, 4 * scale); cr.fill (); cr.set_line_width (1); Theme.color (cr, border);- draw_rounded_rectangle (cr, bgx, bgy, 34, 28, 4);+ draw_rounded_rectangle (cr, bgx, bgy, 34 * scale, 28 * scale, 4 * scale); cr.stroke (); iconx = bgx + 1 + (w - 1) / 2 - icon_font.get_sidebearing_extent () / 2;@@ -20,12 +20,12 @@ namespace BirdFont { public class Toolbox : GLib.Object { public static ToolCollection current_set; + public static HiddenTools hidden_tools; public static DrawingTools drawing_tools; public static KerningTools kerning_tools; public static PreviewTools preview_tools; public static OverviewTools overview_tools;- public static BackgroundTools background_tools;- public static HiddenTools hidden_tools;+ public static BackgroundTools background_tools; public static SpacingTools spacing_tools; public static FileTools file_tools; @@ -46,8 +46,6 @@ public class Toolbox : GLib.Object { double scroll_y = 0; public List<ToolCollection> tool_sets = new List<ToolCollection> ();- - static double scale = 1; string? tool_tip = null; double tool_tip_x = 0;@@ -57,12 +55,12 @@ public class Toolbox : GLib.Object { current_tool = new Tool ("no_icon"); press_tool = new Tool (null); + hidden_tools = new HiddenTools (); drawing_tools = new DrawingTools (glyph_canvas); kerning_tools = new KerningTools (); preview_tools = new PreviewTools (); overview_tools = new OverviewTools (); background_tools = new BackgroundTools ();- hidden_tools = new HiddenTools (); spacing_tools = new SpacingTools (); file_tools = new FileTools (); @@ -118,9 +116,6 @@ public class Toolbox : GLib.Object { if (w != allocation_width || allocation_height != h) { allocation_width = w; allocation_height = h;- - scale = 1;- Toolbox.redraw_tool_box (); } }@@ -404,13 +399,9 @@ public class Toolbox : GLib.Object { b.select_tool (b.get_tool (name)); }- - public static void set_scale (double s) {- scale = s;- }- + public static double get_scale () {- return scale;+ return MainWindow.units; } public void set_default_tool_size () {