Clone in a terminal:
Commit 2a6798f
Johan Mattsson - 2015-03-08T17:57:18+00:00
2a6798fbbaa06fb3b619730ff3f80d7ad1628a0bjohan.mattsson.m@gmail.com

List and remove guides

Changed files (3)

Diff

diff --git a/libbirdfont/GuideTab.vala b/libbirdfont/GuideTab.valanew file mode 100644index 0000000..68b782c--- /dev/null+++ b/libbirdfont/GuideTab.vala@@ -0,0 +1,64 @@+/*+    Copyright (C) 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 +    published by the Free Software Foundation; either version 3 of the +    License, or (at your option) any later version.++    This library is distributed in the hope that it will be useful, but +    WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +    Lesser General Public License for more details.+*/+using Cairo;+using Math;++namespace BirdFont {++public class GuideTab : Table {+	+	Gee.ArrayList<Row> rows = new Gee.ArrayList<Row> ();+	+	public GuideTab () {+	}++	public override Gee.ArrayList<Row> get_rows () {+		return rows;+	}++	public override void selected_row (Row row, int column, bool delete_button) {+		Font font = BirdFont.get_current_font ();+		int index = row.get_index ();+		+		if (delete_button) {+			return_if_fail (0 <= index < BirdFont.get_current_font ().custom_guides.size);+			BirdFont.get_current_font ().custom_guides.remove_at (index);+			update_rows ();+		}+	}+	+	public override void update_rows () {+		int i = 0;+		SpacingData spacing = BirdFont.get_current_font ().get_spacing ();+		+		rows.clear ();+		+		foreach (Line guide in BirdFont.get_current_font ().custom_guides) {+			rows.add (new Row.columns_1 (guide.label, i));+			i++;+		}+		+		GlyphCanvas.redraw ();+	}++	public override string get_label () {+		return t_("Guides");+	}++	public override string get_name () {+		return "Guides";+	}+}++}diff --git a/libbirdfont/Menu.vala b/libbirdfont/Menu.valaindex 6206d57..ae2d876 100644--- a/libbirdfont/Menu.vala+++ b/libbirdfont/Menu.vala@@ -257,6 +257,13 @@ public class Menu : GLib.Object { 		}); 		edit_menu.items.add (create_guide); +		MenuItem show_guide_guide = add_menu_item (t_("List Guides"), "show guide tab");+		show_guide_guide.action.connect (() => {+			MenuTab.show_guide_tab ();+			show_menu = false;+		});+		edit_menu.items.add (show_guide_guide);+		 		MenuItem select_point_above = add_menu_item (t_("Select Point Above"), "select point above"); 		select_point_above.action.connect (() => { 			PenTool.select_point_up ();diff --git a/libbirdfont/MenuTab.vala b/libbirdfont/MenuTab.valaindex e03e284..416b986 100644--- a/libbirdfont/MenuTab.vala+++ b/libbirdfont/MenuTab.vala@@ -601,6 +601,10 @@ public class MenuTab : FontDisplay { 	public static void show_settings_tab () { 		MainWindow.get_tab_bar ().add_unique_tab (new SettingsDisplay ()); 	}++	public static void show_guide_tab () {+		MainWindow.get_tab_bar ().add_unique_tab (new GuideTab ());+	}	 }  }

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112