Clone in a terminal:
Commit 709ebd8
Johan Mattsson - 2014-07-21T14:26:47+00:00
709ebd83db255511456c4872c20543c0e4b587aajohan.mattsson.m@gmail.com

New file chooser & keep expanders open

Changed files (18)

Diff

diff --git a/birdfont/GtkWindow.vala b/birdfont/GtkWindow.valaindex 17b539d..bbafa2f 100644--- a/birdfont/GtkWindow.vala+++ b/birdfont/GtkWindow.vala@@ -750,15 +750,21 @@ public class GtkWindow : Gtk.Window, NativeWindow { 		Gtk.main_quit ();	 	} 	-	public string? file_chooser_save (string title) {-		return file_chooser (title, FileChooserAction.SAVE, Stock.SAVE);-	}--	public string? file_chooser_open (string title) {-		return file_chooser (title, FileChooserAction.OPEN, Stock.OPEN);+	public void file_chooser (string title, FileChooser fc, uint flags) {+		string? fn = null;+		+		if ((flags & FileChooser.LOAD) > 0) {+			fn = show_file_chooser (title, FileChooserAction.OPEN, Stock.OPEN);+		} else if ((flags & FileChooser.SAVE) > 0) {+			fn = show_file_chooser (title, FileChooserAction.SAVE, Stock.SAVE);+		} else {+			warning ("Unknown type");+		}+		+		fc.selected (fn); 	} 	-	public string? file_chooser (string title, FileChooserAction action, string label) {+	public string? show_file_chooser (string title, FileChooserAction action, string label) { 		string? fn = null; 		FileChooserDialog file_chooser = new FileChooserDialog (title, this, action, Stock.CANCEL, ResponseType.CANCEL, label, ResponseType.ACCEPT); 		Font font = BirdFont.get_current_font ();diff --git a/libbirdfont/BackgroundTool.vala b/libbirdfont/BackgroundTool.valaindex f16e94a..9f9f2fc 100644--- a/libbirdfont/BackgroundTool.vala+++ b/libbirdfont/BackgroundTool.vala@@ -177,18 +177,21 @@ public class BackgroundTool : Tool { 	}  	internal static void import_background_image () {-		BackgroundImage bg;-		string? fn;-		string path;+		FileChooser fc = new FileChooser (); 		-		fn = MainWindow.file_chooser_open (_("Select background image"));+		fc.file_selected.connect ((fn) => {+			BackgroundImage bg;+			string path;+			+			if (fn != null) {+				path = (!) fn;+				bg = new BackgroundImage (path);+				imported_background = bg;+				MainWindow.native_window.load_background_image ();+			}+		}); 		-		if (fn != null) {-			path = (!) fn;-			bg = new BackgroundImage (path);-			imported_background = bg;-			MainWindow.native_window.load_background_image ();-		}+		MainWindow.file_chooser (_("Select background image"), fc, FileChooser.LOAD); 	} } diff --git a/libbirdfont/DrawingTools.vala b/libbirdfont/DrawingTools.valaindex d4ded3e..47249d1 100644--- a/libbirdfont/DrawingTools.vala+++ b/libbirdfont/DrawingTools.vala@@ -788,21 +788,7 @@ public class DrawingTools : ToolCollection  { 			track_tool.set_samples_per_point (freehand_samples.get_value ()); 		}); -		// selection policy-		draw_tools.set_open (true);-		key_tools.set_open (true);-		draw_tool_modifiers.set_open (true);-		edit_point_modifiers.set_open (true);-		path_tool_modifiers.set_open (true);-		view_tools.set_open (true);-		grid.set_open (true);-		characterset_tools.set_open (true);-		test_tools.set_open (true);-		guideline_tools.set_open (true);-		shape_tools.set_open (true);-		background_tools.set_open (true);-		style_tools.set_open (true);-		+		// selection policy	 		add_expander (draw_tools); 		 		if (BirdFont.android) {@@ -851,8 +837,7 @@ public class DrawingTools : ToolCollection  { 		 		grid.set_persistent (true); 		grid.set_unique (true);-		grid.set_open (false);-		+ 		shape_tools.set_persistent (true); 		shape_tools.set_unique (true); 		@@ -1018,7 +1003,6 @@ public class DrawingTools : ToolCollection  { 		 		GridTool.sizes.clear (); 		-		grid_expander.set_open (true); 		MainWindow.get_toolbox ().update_expanders (); 		MainWindow.get_toolbox ().redraw (0, 0, Toolbox.allocation_width, Toolbox.allocation_height);		 	}@@ -1047,7 +1031,6 @@ public class DrawingTools : ToolCollection  {  		GridTool.sizes.add (grid_width); -		grid_expander.set_open (true); 		tb.update_expanders (); 		 		tb.redraw (0, 0, Toolbox.allocation_width, Toolbox.allocation_height);diff --git a/libbirdfont/Expander.vala b/libbirdfont/Expander.valaindex 5e4eed6..166fd14 100644--- a/libbirdfont/Expander.vala+++ b/libbirdfont/Expander.vala@@ -31,7 +31,6 @@ public class Expander : GLib.Object { 	protected double opacity = 0; 	 	protected bool active = false;-	protected bool open = false;  	public List<Tool> tool; @@ -116,10 +115,7 @@ public class Expander : GLib.Object { 	 	public void set_offset (double ty) { 		y = ty;-		-		if (open) {-			update_tool_position ();-		}+		update_tool_position (); 	} 	 	public void add_tool (Tool t) {@@ -171,17 +167,6 @@ public class Expander : GLib.Object { 		return r; 	} 	-	public bool is_open () {-		return open;-	}-	-	public virtual bool set_open (bool o) {-		bool r = (open != o);-		margin = 0;-		open = o;-		return r;-	}-	 	public void draw (int wd, int hd, Context cr) { 		double yt = y + scroll + 2; 		double ih2 = 5.4 / 2;@@ -200,30 +185,24 @@ public class Expander : GLib.Object { 		cr.new_path (); 		cr.set_line_width (1); 		cr.set_source_rgba (0, 0, 0, opacity);-		if (!open) {-			cr.move_to (x - iw2 + 3, yt - ih2 - 0.7);-			cr.line_to (x + iw2 + 3, yt);	-			cr.line_to (x - iw2 + 3, ih2 + yt - 0.7);-		} else {-			cr.move_to (x - iw2 + 3, yt - ih2 - 0.7 + 1);-			cr.line_to (x + iw2 + 3, yt - ih2 - 0.7 + 1);-			cr.line_to (x + iw2, yt + 2 + 1);	-		}+		+		cr.move_to (x - iw2 + 3, yt - ih2 - 0.7 + 1);+		cr.line_to (x + iw2 + 3, yt - ih2 - 0.7 + 1);+		cr.line_to (x + iw2, yt + 2 + 1);	+ 		cr.close_path(); 		cr.stroke (); 		cr.restore (); 	} 	 	public void draw_content (int w, int h, Context cr) {-		if (open) {-			cr.save ();-			foreach (var t in tool) {-				if (t.tool_is_visible ()) {-					t.draw (cr);-				}+		cr.save ();+		foreach (var t in tool) {+			if (t.tool_is_visible ()) {+				t.draw (cr); 			}-			cr.restore (); 		}+		cr.restore (); 	} 	 }diff --git a/libbirdfont/ExportTool.vala b/libbirdfont/ExportTool.valaindex 1b2e32e..834cad3 100644--- a/libbirdfont/ExportTool.vala+++ b/libbirdfont/ExportTool.vala@@ -114,43 +114,46 @@ public class ExportTool : GLib.Object { 	} 	 	public static void export_current_glyph () {-		Glyph glyph = MainWindow.get_current_glyph ();-		FontDisplay fd = MainWindow.get_current_display ();-		string glyph_svg;-		string? f;-		string svg_file;-		File file;-		DataOutputStream os;-		string name;--		name = glyph.get_name ();-				-		f = MainWindow.file_chooser_save ("Save");-		if (f == null) {-			return;-		}-		-		svg_file = (!) f;	-		file = File.new_for_path (svg_file);-		-		if (!(fd is Glyph)) {-			return;-		}-		-		try {+		FileChooser fc = new FileChooser ();+		fc.file_selected.connect ((f) => {+			Glyph glyph = MainWindow.get_current_glyph ();+			FontDisplay fd = MainWindow.get_current_display ();+			string glyph_svg;+			string svg_file;+			File file;+			DataOutputStream os;+			string name; 			-			if (file.query_exists ()) {-				file.delete ();+			name = glyph.get_name ();+			+			if (f == null) {+				return; 			} 			-			glyph_svg = export_current_glyph_to_string ();-			os = new DataOutputStream (file.create(FileCreateFlags.REPLACE_DESTINATION));-			os.put_string (glyph_svg);-	-		} catch (Error e) {-			stderr.printf (@"Export \"$svg_file\" \n");-			critical (@"$(e.message)");-		}+			svg_file = (!) f;	+			file = File.new_for_path (svg_file);+			+			if (!(fd is Glyph)) {+				return;+			}+			+			try {+				+				if (file.query_exists ()) {+					file.delete ();+				}+				+				glyph_svg = export_current_glyph_to_string ();+				os = new DataOutputStream (file.create(FileCreateFlags.REPLACE_DESTINATION));+				os.put_string (glyph_svg);+		+			} catch (Error e) {+				stderr.printf (@"Export \"$svg_file\" \n");+				critical (@"$(e.message)");+			}+		});+		+		MainWindow.file_chooser (t_("Save"), fc, FileChooser.SAVE); 	}  	/* Font must be saved before export in order to know where thediff --git a/libbirdfont/FileChooser.vala b/libbirdfont/FileChooser.valanew file mode 100644index 0000000..32aea66--- /dev/null+++ b/libbirdfont/FileChooser.vala@@ -0,0 +1,37 @@+/*+    Copyright (C) 2014 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.+*/++namespace BirdFont {++public class FileChooser : GLib.Object {+	+	public static uint NONE = 0;+	public static uint SAVE = 1;+	public static uint LOAD = 1 << 1;+	+	public signal void file_selected  (string? path);+	+	public FileChooser () {	+	}+	+	public void selected (string? path) {+		file_selected (path);+	}+	+	public void cancel () {+		file_selected (null);+	}+}++}diff --git a/libbirdfont/KerningTools.vala b/libbirdfont/KerningTools.valaindex 0a85038..b2c78d4 100644--- a/libbirdfont/KerningTools.vala+++ b/libbirdfont/KerningTools.vala@@ -98,11 +98,9 @@ public class KerningTools : ToolCollection  { 		 		kerning_tools.set_persistent (false); 		kerning_tools.set_unique (false);-		kerning_tools.set_open (true);  		classes.set_persistent (true); 		classes.set_unique (true);-		classes.set_open (true); 		 		expanders.append (kerning_tools); 		expanders.append (classes);diff --git a/libbirdfont/LoadCallback.vala b/libbirdfont/LoadCallback.valaindex 4068fcf..3503d48 100644--- a/libbirdfont/LoadCallback.vala+++ b/libbirdfont/LoadCallback.vala@@ -55,32 +55,34 @@ public class LoadCallback : GLib.Object { 	}  	private void load_new_font () {-		string? fn;-		Font f;-+		FileChooser fc = new FileChooser ();+		 		if (MenuTab.suppress_event) { 			warn_if_test ("Event suppressed"); 			return; 		} 		-		f = BirdFont.get_current_font ();-		fn = MainWindow.file_chooser_open (t_("Open"));-		-		if (fn != null) {-			f.delete_backup ();-			-			f = BirdFont.new_font ();-			-			MainWindow.clear_glyph_cache ();+		fc.file_selected.connect((fn) => {+			Font f = BirdFont.get_current_font (); 			-			f.set_file ((!) fn);-			MainWindow.native_window.load ();-			-			file_loaded.connect (() => {-				KerningTools.update_kerning_classes ();-				MenuTab.select_overview ();-			});-		}+			if (fn != null) {+				f.delete_backup ();+				+				f = BirdFont.new_font ();+				+				MainWindow.clear_glyph_cache ();+				+				f.set_file ((!) fn);+				MainWindow.native_window.load ();+				+				file_loaded.connect (() => {+					KerningTools.update_kerning_classes ();+					MenuTab.select_overview ();+				});+			}+		});+		+		MainWindow.file_chooser (t_("Open"), fc, FileChooser.LOAD); 	} } 	diff --git a/libbirdfont/MainWindow.vala b/libbirdfont/MainWindow.valaindex ff2fc31..a49c446 100644--- a/libbirdfont/MainWindow.vala+++ b/libbirdfont/MainWindow.vala@@ -161,14 +161,10 @@ public class MainWindow : GLib.Object { 		return singleton;
 	}
 	
-	public static string? file_chooser_save (string title) {
-		return MainWindow.native_window.file_chooser_save (title);
+	public static void file_chooser (string title, FileChooser fc, uint flags) {
+		MainWindow.native_window.file_chooser (title, fc, flags);
 	}
-
-	public static string? file_chooser_open (string title) {
-		return MainWindow.native_window.file_chooser_open (title);
-	}
-
+	
 	public static void set_scrollbar_size (double size) {
 		if (!is_null (MainWindow.native_window)) {
 			MainWindow.native_window.set_scrollbar_size (size);
diff --git a/libbirdfont/MenuTab.vala b/libbirdfont/MenuTab.valaindex 74f4014..eb1ac5b 100644--- a/libbirdfont/MenuTab.vala+++ b/libbirdfont/MenuTab.vala@@ -134,8 +134,7 @@ public class MenuTab : FontDisplay { 	 	// FIXME: background thread 	public static void save_as_bfp () {-		Font f;-		string? fn;+		FileChooser fc = new FileChooser (); 		 		if (suppress_event) { 			warn_if_test ("Event suppressed");@@ -146,14 +145,17 @@ public class MenuTab : FontDisplay { 			return; 		} 		-		f = BirdFont.get_current_font ();	-		fn = MainWindow.file_chooser_save (t_("Save"));-		-		if (fn != null) {-			f.init_bfp ((!) fn);-		}+		fc.file_selected.connect((fn) => {+			Font f = BirdFont.get_current_font ();	+			+			if (fn != null) {+				f.init_bfp ((!) fn);+			}+			+			set_suppress_event (false);+		}); 		-		set_suppress_event (false);+		MainWindow.file_chooser (t_("Save"), fc, FileChooser.SAVE); 	} 	 	public static void new_file () {diff --git a/libbirdfont/NativeWindow.vala b/libbirdfont/NativeWindow.valaindex be01812..0a31d14 100644--- a/libbirdfont/NativeWindow.vala+++ b/libbirdfont/NativeWindow.vala@@ -15,8 +15,7 @@ namespace BirdFont {  public interface NativeWindow : GLib.Object {-	public abstract string? file_chooser_save (string title);-	public abstract string? file_chooser_open (string title);+	public abstract void file_chooser (string title, FileChooser file_chooser_callback, uint flags); 	 	public abstract void update_window_size (); diff --git a/libbirdfont/PenTool.vala b/libbirdfont/PenTool.valaindex 179504d..a19184c 100644--- a/libbirdfont/PenTool.vala+++ b/libbirdfont/PenTool.vala@@ -190,7 +190,7 @@ public class PenTool : Tool { 			selection_box_last_x = x; 			selection_box_last_y = y; 			-			if (Path.distance (begin_action_x, x, begin_action_y, y) > 2 * MainWindow.units) {+			if (Path.distance (begin_action_x, x, begin_action_y, y) > 10 * MainWindow.units) { 				point_selection_image = false; 			} 			@@ -852,7 +852,7 @@ public class PenTool : Tool { 		double ratio; 		PointSelection ps; 		-		if (move_selected_handle && selected_points.size > 0) {+		if (move_selected_handle) { 			i = Path.edit_point_handle_image; 		} else if (move_selected) { 			if (selected_points.size > 0) {@@ -867,7 +867,7 @@ public class PenTool : Tool { 			img = (!) i;	 			 			cr.save ();-			ratio = 40 * MainWindow.units / img.get_width ();+			ratio = 60 * MainWindow.units / img.get_width (); 			cr.scale (ratio, ratio); 			x = begin_action_x - ratio * img.get_width () / 2; 			x /= ratio;diff --git a/libbirdfont/PointConverter.vala b/libbirdfont/PointConverter.valaindex f6cd224..a2fe5a0 100644--- a/libbirdfont/PointConverter.vala+++ b/libbirdfont/PointConverter.vala@@ -30,9 +30,7 @@ public class PointConverter {  	public Path get_quadratic_path () { 		Path p;-		EditPoint prev;-		double x, y;-		+ 		quadratic_path = original_path.copy (); 		p = get_estimated_cubic_path (); 		p.remove_points_on_points ();diff --git a/libbirdfont/PreviewTools.vala b/libbirdfont/PreviewTools.valaindex 4ee4f1e..43e23aa 100644--- a/libbirdfont/PreviewTools.vala+++ b/libbirdfont/PreviewTools.vala@@ -39,8 +39,6 @@ public class PreviewTools : ToolCollection  { 		}); 		webview_tools.add_tool (generate_html_button); 		-		webview_tools.set_open (true);-		 		expanders.append (webview_tools); 	} diff --git a/libbirdfont/SaveCallback.vala b/libbirdfont/SaveCallback.valaindex 573df49..3496bd7 100644--- a/libbirdfont/SaveCallback.vala+++ b/libbirdfont/SaveCallback.vala@@ -21,44 +21,44 @@ public class SaveCallback : GLib.Object { 	public SaveCallback () {	 	} 	-	public bool save_as ()  {-		string? fn = null;-		string f;-		string file_name;-		File file;-		bool saved = false;-		Font font = BirdFont.get_current_font ();-		int i;-		+	public void save_as ()  { 		if (MenuTab.suppress_event) { 			warn_if_test ("Event suppressed");-			return false;+			return; 		}-		-		fn = MainWindow.file_chooser_save (t_("Save"));-		-		if (fn != null) {-			f = (!) fn;-			-			if (f.has_suffix (".bf")) {-				f = f.replace (".bf", "");-			}++		FileChooser fc = new FileChooser ();+		fc.file_selected.connect ((fn) => {+			string f;+			string file_name;+			File file;+			bool saved = false;+			Font font = BirdFont.get_current_font ();+			int i;	 			-			file_name = @"$(f).bf";-			file = File.new_for_path (file_name);-			i = 2;-			while (file.query_exists ()) {-				file_name = @"$(f)_$i.bf";+			if (fn != null) {+				f = (!) fn;+				+				if (f.has_suffix (".bf")) {+					f = f.replace (".bf", "");+				}+				+				file_name = @"$(f).bf"; 				file = File.new_for_path (file_name);-				i++;+				i = 2;+				while (file.query_exists ()) {+					file_name = @"$(f)_$i.bf";+					file = File.new_for_path (file_name);+					i++;+				}+				+				font.font_file = file_name;+				save ();+				saved = true; 			}-			-			font.font_file = file_name;-			save ();-			saved = true;-		}+		}); 		-		return saved;+		MainWindow.file_chooser (t_("Save"), fc, FileChooser.SAVE); 	}  	public void save () {diff --git a/libbirdfont/StrokeTool.vala b/libbirdfont/StrokeTool.valaindex 6b4ecc1..001ae4a 100644--- a/libbirdfont/StrokeTool.vala+++ b/libbirdfont/StrokeTool.vala@@ -182,7 +182,6 @@ public class StrokeTool : Tool { 	 	static Path create_stroke (Path p, double thickness) { 		Path stroked;-		Path path; 		 		if (p.points.size >= 2) { 			stroked = p.copy ();@@ -202,10 +201,6 @@ public class StrokeTool : Tool { 		return stroked; 	} 	-	static bool in_range (double x, double y,EditPoint a, EditPoint b) {-		return fmin (a.x, b.x) < x < fmax (a.x, b.x) && fmin (a.y, b.y) < y < fmax (a.y, b.y);-	}- 	static void add_corners (Path p) { 		// TODO: 	}@@ -218,7 +213,6 @@ public class StrokeTool : Tool { 		Path new_path = original.copy ();  		EditPoint np, sp, nprev, sprev;-		double n_distance, s_distance, nsratio; 			 		int i = 0; 			@@ -510,8 +504,6 @@ public class StrokeTool : Tool { 		snext = new EditPoint (); 		nnext = new EditPoint (); 		-		double merge_angle = 0;-		 		print (@"\n"); 		for (int index = 1;index < stroked.points.size; index++) { 			np = new_path.points.get (index);@@ -568,9 +560,6 @@ public class StrokeTool : Tool { 		 		double last_prev_ratio = 0; -		double pn_distance = 0;-		double ps_distance = 0;- 		double ratio = 0; 		 		nprev = new_path.points.get (new_path.points.size - 1);diff --git a/libbirdfont/SvgParser.vala b/libbirdfont/SvgParser.valaindex d1448c4..649ba9d 100644--- a/libbirdfont/SvgParser.vala+++ b/libbirdfont/SvgParser.vala@@ -33,17 +33,19 @@ public class SvgParser { 	} 	 	public static void import () {-		string? p;-		string path;-		-		p = MainWindow.file_chooser_open (t_("Import"));--		if (p == null) {-			return;-		}+		FileChooser fc = new FileChooser ();+		fc.file_selected.connect ((p) => {+			string path;+				+			if (p == null) {+				return;+			}+			+			path = (!) p;+			import_svg (path);+		}); 		-		path = (!) p;-		import_svg (path);+		MainWindow.file_chooser (t_("Import"), fc, FileChooser.LOAD); 	} 	 	public static void import_svg_data (string xml_data) {diff --git a/libbirdfont/Toolbox.vala b/libbirdfont/Toolbox.valaindex 6a1abac..3917e4e 100644--- a/libbirdfont/Toolbox.vala+++ b/libbirdfont/Toolbox.vala@@ -105,13 +105,7 @@ public class Toolbox : GLib.Object  { 	} 	 	public void press (uint button, double x, double y) {-		foreach (Expander exp in current_set.get_expanders ()) {-			if (exp.is_over (x, y)) {-				exp.set_open (! exp.is_open ());					-				update_expanders ();			-				redraw_tool_box ();-			}-			+		foreach (Expander exp in current_set.get_expanders ()) {	 			foreach (Tool t in exp.tool) { 				if (t.tool_is_visible () && t.is_over (x, y)) { 					t.panel_press_action (t, button, x, y);@@ -128,19 +122,17 @@ public class Toolbox : GLib.Object  { 		bool active; 		 		foreach (Expander exp in current_set.get_expanders ()) {			-			if (exp.is_open ()) {-				foreach (Tool t in exp.tool) {-					if (t.tool_is_visible ()) {-						active = t.is_over (x, y);-						-						if (active) {-							if (press_tool == t) {-								select_tool (t);-							}+			foreach (Tool t in exp.tool) {+				if (t.tool_is_visible ()) {+					active = t.is_over (x, y);+					+					if (active) {+						if (press_tool == t) {+							select_tool (t); 						}-						-						t.panel_release_action (t, button, x, y); 					}+					+					t.panel_release_action (t, button, x, y); 				} 			} 		}@@ -231,26 +223,25 @@ public class Toolbox : GLib.Object  { 				redraw ((int) exp.x - 10, (int) exp.y - 10, (int) (exp.x + exp.w + 10), (int) (exp.y + exp.h + 10)); 			} 			-			if (exp.is_open ()) {-				foreach (Tool t in exp.tool) {-					if (t.tool_is_visible ()) {-						active = t.is_over (x, y);-						tpa = null;-						-						update = t.set_active (active);-						tpa = MainWindow.get_tooltip ();-						-						if (active && tpa != null) {-							((!)tpa).update_text ();-						}-						-						if (update) {-							redraw (0, 0, allocation_width, allocation_height);-						}-						-						if (t.panel_move_action (t, x, y)) {-							consumed = true;-						}++			foreach (Tool t in exp.tool) {+				if (t.tool_is_visible ()) {+					active = t.is_over (x, y);+					tpa = null;+					+					update = t.set_active (active);+					tpa = MainWindow.get_tooltip ();+					+					if (active && tpa != null) {+						((!)tpa).update_text ();+					}+					+					if (update) {+						redraw (0, 0, allocation_width, allocation_height);+					}+					+					if (t.panel_move_action (t, x, y)) {+						consumed = true; 					} 				} 			}@@ -300,9 +291,7 @@ public class Toolbox : GLib.Object  { 				if (tool.get_id () == t.get_id ()) { 					if (!t.tool_is_visible ()) { 						warning ("Tool is hidden");-					} else {-						exp.set_open (true);-						+					} else {						 						update = false; 						 						update = tool.set_selected (true);@@ -374,13 +363,9 @@ public class Toolbox : GLib.Object  { 		pos = 4 * get_scale (); 		foreach (Expander e in current_set.get_expanders ()) { 			e.set_offset (pos);-			-			if (e.is_open ()) {-				pos += e.get_content_height () + 4 * get_scale ();-			} else {-				pos += 10 * get_scale ();-			}-			++			pos += e.get_content_height () + 4 * get_scale ();+					 			current_set.content_height = pos; 			 			if (BirdFont.android) {@@ -396,9 +381,7 @@ public class Toolbox : GLib.Object  { 	private void draw_expanders (int w, int h, Context cr) { 		foreach (Expander e in current_set.get_expanders ()) { 			e.draw (w, h, cr);-			if (e.is_open ()) {-				e.draw_content (w, h, cr);-			}+			e.draw_content (w, h, cr); 		} 	} 	@@ -407,12 +390,7 @@ public class Toolbox : GLib.Object  { 		 		cr.rectangle (0, 0, w, h); 		cr.set_line_width (0);-		-		if (BirdFont.android) {-			cr.set_source_rgba (224/255.0, 224/255.0, 224/255.0, 1);-		} else {-			cr.set_source_rgba (240/255.0, 240/255.0, 240/255.0, 1);-		}+		cr.set_source_rgba (240/255.0, 240/255.0, 240/255.0, 1); 		cr.fill (); 		 		cr.rectangle (0, 0, 1, h);

Contact

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