Clone in a terminal:
Commit e6b5ede
Johan Mattsson - 2016-10-08T15:45:48+00:00
e6b5ede3c12fa98df30ed92f09cde95d9dc99a65johan.mattsson.m@gmail.com

Drop help texts

Changed files (7)

Diff

diff --git a/libbirdfont/Help.vala b/libbirdfont/Help.valadeleted file mode 100644index 1b49ba2..0000000--- a/libbirdfont/Help.vala+++ /dev/null@@ -1,123 +0,0 @@-/*-	Copyright (C) 2016 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;--namespace BirdFont {--public class Help {--	bool visible;-	TextArea help_text;-	Text close;-	const int box_margin = 7;-	-	public Help () {-		string v = Preferences.get ("help_visible");-		visible = v == "true";-		help_text = create_help_text (t_("BirdFont is a font editor."));-		-		Color color = Theme.get_color ("Menu Foreground");-		close = new Text ("close", 30, 0, color);-		close.load_font ("icons.bf");-	}--	public static TextArea create_help_text (string lines) {-		Color color = Theme.get_color ("Menu Foreground");-		TextArea text = new TextArea (17, color);-		text.min_width = 200;-		text.min_height = 100;-		text.width = 200;-		text.height = 100;-		text.allocation = new WidgetAllocation.for_area (0, 0, (int)text.min_width, (int)text.min_height);-		text.set_text (lines);-		text.layout ();-		text.set_editable (false);-		text.draw_border = false;-		return text;-	}--	public void set_help_text (TextArea text) {-		if (text != help_text && is_visible ()) {-			help_text = text;-			GlyphCanvas.redraw ();-		}-	}--	public void set_visible (bool v) {-		visible = v;-		Preferences.set ("help_visible", @"$v");-	}-	-	public bool is_visible () {-		return visible;-	}--	public void draw (Context cr, WidgetAllocation allocation) {-		int margin_x = 10;-		int margin_y = 15;--		help_text.allocation = allocation;-		help_text.widget_x = allocation.width - help_text.width - margin_x;-		help_text.widget_y = allocation.height - help_text.height - margin_y;-		-		draw_box (cr, allocation);-		-		help_text.draw (cr);--		double close_x = allocation.width;-		close_x -= close.get_sidebearing_extent ();-		close_x -= margin_x;-		close_x -= box_margin;-		-		double close_y = allocation.height;-		close_y -= help_text.height;-		close_y -= margin_y;-		close_y -= 2 * box_margin;-		-		close.widget_x = close_x;-		close.widget_y = close_y;-		close.draw (cr);-	}--	public bool button_press (uint button, double x, double y) {-		if (close.widget_x < x < close.widget_x + close.get_sidebearing_extent ()-			&& close.widget_y < y < close.widget_y + close.font_size) {-			-			set_visible (false);-			GlyphCanvas.redraw ();-			return true;-		}-		-		return false;-	}--	public void draw_box (Context cr, WidgetAllocation allocation) {-		cr.save();--		Theme.color (cr, "Menu Background");-		double x, y, w, h;-		x = help_text.widget_x - 2 * box_margin;-		y = help_text.widget_y - 2 * box_margin; -		w = help_text.width + 2 * box_margin;-		h = help_text.height + 2 * box_margin;-		Widget.draw_rounded_rectangle (cr, x, y, w, h, 7);-		cr.fill ();--		cr.restore();-	}--}--}diff --git a/libbirdfont/KerningDisplay.vala b/libbirdfont/KerningDisplay.valaindex e678d0f..79163c0 100644--- a/libbirdfont/KerningDisplay.vala+++ b/libbirdfont/KerningDisplay.vala@@ -60,8 +60,6 @@ public class KerningDisplay : FontDisplay { 		redo_items = new Gee.ArrayList <UndoItem> (); 		w.set_otf_tags (KerningTools.get_otf_tags ()); 		first_row.add (w);-		-		description = Help.create_help_text (t_("Kerning is the process of adjusting the space between two letters. You can cahnge the space between one letter and all other letters in the spacing tab.")); 	}  	public GlyphSequence get_first_row () {diff --git a/libbirdfont/LayerLabel.vala b/libbirdfont/LayerLabel.valaindex 040a747..72e5559 100644--- a/libbirdfont/LayerLabel.vala+++ b/libbirdfont/LayerLabel.vala@@ -33,10 +33,6 @@ public class LayerLabel : Tool { 	public LayerLabel (Layer layer) { 		base (); -		if (help_text_hide == null) {-			update_description ();-		}- 		this.layer = layer; 		this.label = layer.name; 		@@ -87,13 +83,6 @@ public class LayerLabel : Tool { 				redraw (); 			} 			-			if (y <= ty <= y + h) {-				if (tx < 25 && help_text_hide != null) {-					Help help = MainWindow.get_help ();-					help.set_help_text ((!) help_text_hide);-				}-			}-			 			return false; 		}); @@ -101,14 +90,9 @@ public class LayerLabel : Tool { 			active_layer = false; 		}); 	}--	void update_description () {-		help_text_hide = Help.create_help_text (t_("Hide the layer."));	-	}-+	 	public override void clear_cache () { 		base.clear_cache ();-		update_description (); 	} 		 	void move_layer_up () {diff --git a/libbirdfont/Menu.vala b/libbirdfont/Menu.valaindex 0724717..737dda4 100644--- a/libbirdfont/Menu.vala+++ b/libbirdfont/Menu.vala@@ -493,15 +493,6 @@ public class Menu : AbstractMenu { 			show_menu = false; 		}); 		menu.items.add (version);--		MenuItem help = add_menu_item (t_("Help"), "help");-		help.action.connect (() => {-			Help help_box = MainWindow.get_help ();-			help_box.set_visible (!help_box.is_visible ());-			GlyphCanvas.redraw ();-			show_menu = false;-		});-		menu.items.add (help); 			 		set_current_menu (menu); 		top_menu = menu;diff --git a/libbirdfont/TabContent.vala b/libbirdfont/TabContent.valaindex a82a6d4..e5d4e84 100644--- a/libbirdfont/TabContent.vala+++ b/libbirdfont/TabContent.vala@@ -120,12 +120,6 @@ public class TabContent : GLib.Object { 				MainWindow.scrollbar.draw (cr, allocation, scollbar_width); 			} 		}--		Help help = MainWindow.get_help ();-		-		if (help.is_visible ()) {-			help.draw (cr, allocation);-		} 	}  	public static void create_pause_surface () {@@ -244,12 +238,6 @@ public class TabContent : GLib.Object {  		last_press_time = GLib.get_real_time (); -		Help help = MainWindow.get_help ();-		-		if (help.button_press (button, x, y)) {-			return; // event consumed by help text-		}- 		if (MainWindow.get_dialog ().visible) { 			MainWindow.get_dialog ().button_press (button, x, y); 		} else if (!MainWindow.get_menu ().show_menu) {diff --git a/libbirdfont/Tool.vala b/libbirdfont/Tool.valaindex e5e2c2e..c4a1c7b 100644--- a/libbirdfont/Tool.vala+++ b/libbirdfont/Tool.vala@@ -125,14 +125,6 @@ public class Tool : Widget { 		panel_move_action.connect ((self, x, y) => { 			if (is_active ()) { 				wait_for_tooltip ();-				-				Help help_box = MainWindow.get_help ();-				-				if (help == null) {-					help = update_help ();-				}-				-				help_box.set_help_text ((!) help); 				redraw (); 			} 			return false;@@ -143,21 +135,6 @@ public class Tool : Widget { 		help = null; 	} 	-	public TextArea? update_help () {-		string t = get_tip ();-		string description = t;-		-		if (t != "" && extented_description != "") {-			description += "\n\n";-		}-		-		if (extented_description != "") {-			description += extented_description;-		}-		-		return Help.create_help_text (description);-	}-	 	public virtual string get_tip () { 		return tip; 	}diff --git a/libbirdfont/ToolItem.vala b/libbirdfont/ToolItem.valaindex 9f163d7..3b92125 100644--- a/libbirdfont/ToolItem.vala+++ b/libbirdfont/ToolItem.vala@@ -25,7 +25,6 @@ public class ToolItem : MenuItem { 		 		set { 			base.modifiers = value;-			tool.update_help (); 		} 	} 	@@ -36,7 +35,6 @@ public class ToolItem : MenuItem { 		 		set { 			base.key = value;-			tool.update_help (); 		} 	} 	

Contact

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