The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Merge ../birdfont-android/birdfont

These changes was commited to the Birdfont repository Thu, 21 May 2015 06:55:06 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Thu, 21 May 2015 06:55:06 +0000 (08:55 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Thu, 21 May 2015 06:55:06 +0000 (08:55 +0200)
commit 383fc79d3f60ab00304e4a7b623b4c14a2bab8a7
tree 51c7c0c977cc2e0809f80ac968a42dbeb8b90db8
parent 5949cad5dbf1b781152401263d3d7de30328481f
parent b411dac041dbfe8c922e7907c979a04b8575143b
Merge ../birdfont-android/birdfont

libbirdfont/DrawingTools.vala
libbirdfont/FontName.vala
libbirdfont/HiddenTools.vala
libbirdfont/LabelTool.vala
libbirdfont/Table.vala
libbirdfont/Tool.vala
libbirdfont/Toolbox.vala
--- a/libbirdfont/DrawingTools.vala +++ b/libbirdfont/DrawingTools.vala @@ -147,7 +147,9 @@ 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");
--- a/libbirdfont/FontName.vala +++ b/libbirdfont/FontName.vala @@ -41,7 +41,7 @@ // 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);
--- a/libbirdfont/HiddenTools.vala +++ b/libbirdfont/HiddenTools.vala @@ -20,9 +20,10 @@ 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"));
--- a/libbirdfont/LabelTool.vala +++ b/libbirdfont/LabelTool.vala @@ -67,7 +67,7 @@ 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");
--- a/libbirdfont/Table.vala +++ b/libbirdfont/Table.vala @@ -106,7 +106,7 @@ 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 @@ 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 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 override void scroll_wheel_up (double x, double y) { - scroll -= 30; + scroll -= 30 * MainWindow.units; if (scroll < 0) { scroll = 0;
--- a/libbirdfont/Tool.vala +++ b/libbirdfont/Tool.vala @@ -20,8 +20,8 @@ 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 @@ 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 @@ 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 @@ 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 @@ } 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;
--- a/libbirdfont/Toolbox.vala +++ b/libbirdfont/Toolbox.vala @@ -20,12 +20,12 @@ 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 @@ 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 @@ 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 @@ if (w != allocation_width || allocation_height != h) { allocation_width = w; allocation_height = h; - - scale = 1; - Toolbox.redraw_tool_box (); } } @@ -404,13 +399,9 @@ 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 () {