Clone in a terminal:
Commit e056293
Johan Mattsson - 2014-11-27T17:22:59+00:00
e056293b406105946474c2c5bda77a5e012c02e9johan.mattsson.m@gmail.com

Set default license

Changed files (6)

Diff

diff --git a/libbirdfont/DescriptionDisplay.vala b/libbirdfont/DescriptionDisplay.valaindex 58702fb..36e8d1d 100644--- a/libbirdfont/DescriptionDisplay.vala+++ b/libbirdfont/DescriptionDisplay.vala@@ -39,6 +39,8 @@ public class DescriptionDisplay : FontDisplay { 	 	Gee.ArrayList<Widget> widgets; 	+	private static bool disable_copyright = false;+	 	public DescriptionDisplay () { 		double margin = 12 * MainWindow.units; 		double label_size = 20 * MainWindow.units;@@ -151,9 +153,14 @@ public class DescriptionDisplay : FontDisplay { 		copyright.text_changed.connect ((t) => { 			font.copyright = t; 		});+		copyright.set_editable (!disable_copyright); 		widgets.add (copyright); 	} +	public static void set_copyright_editable (bool t) {+		disable_copyright = !t;+	}+ 	public override void draw (WidgetAllocation allocation, Context cr) { 		this.allocation = allocation; 		@@ -302,6 +309,7 @@ public class DescriptionDisplay : FontDisplay { 	}  	public override void selected_canvas () {+		copyright.set_editable (!disable_copyright); 		update_scrollbar (); 		GlyphCanvas.redraw (); 	}diff --git a/libbirdfont/Font.vala b/libbirdfont/Font.valaindex d02fea8..cdc4c1c 100644--- a/libbirdfont/Font.vala+++ b/libbirdfont/Font.vala@@ -96,6 +96,8 @@ public class Font : GLib.Object {  	Ligatures ligatures_substitution; 	+	public static string? default_license = null; +	 	public Font () { 		KerningClasses kerning_classes; 		@@ -106,7 +108,7 @@ public class Font : GLib.Object { 		unique_identifier = "Typeface"; 		version = "Version 1.0"; 		description = "";-		copyright = "";+		copyright = default_license != null ? ((!) default_license).dup () : ""; 	 		glyph_cache = new GlyphTable (); 		glyph_name = new GlyphTable ();@@ -132,6 +134,10 @@ public class Font : GLib.Object { 		background_images = new Gee.ArrayList<BackgroundImage> (); 	} +	public static void set_default_license (string license) {+		default_license = license;+	}+ 	public Ligatures get_ligatures () { 		return ligatures_substitution; 	}diff --git a/libbirdfont/MenuTab.vala b/libbirdfont/MenuTab.valaindex ba3c065..a9fc175 100644--- a/libbirdfont/MenuTab.vala+++ b/libbirdfont/MenuTab.vala@@ -78,8 +78,7 @@ public class MenuTab : FontDisplay { 	 	public static void export_fonts_in_background () { 		if (suppress_event || MainWindow.native_window.can_export ()) {-			warning ("suppress_event is already set");-			return false;+			return; 		} 		 		MenuTab.export_callback = new ExportCallback ();diff --git a/libbirdfont/PenTool.vala b/libbirdfont/PenTool.valaindex 39d1a10..9271d24 100644--- a/libbirdfont/PenTool.vala+++ b/libbirdfont/PenTool.vala@@ -223,6 +223,8 @@ public class PenTool : Tool { 					last_point_y = selected_point.y; 				} 			}+			+			GlyphCanvas.redraw (); 		}); 		 		key_release_action.connect ((self, keyval) => {diff --git a/libbirdfont/Renderer/Text.vala b/libbirdfont/Renderer/Text.valaindex 9cfe9a8..3b5b103 100644--- a/libbirdfont/Renderer/Text.vala+++ b/libbirdfont/Renderer/Text.vala@@ -22,7 +22,7 @@ public class Text : Widget { 	public Font font { 		get { 			if (current_font == null) {-				load_default_font ();+				current_font = get_default_font (); 			} 			 			return (!) current_font;@@ -68,11 +68,15 @@ public class Text : Widget { 	}  	public static void load_default_font () {-		File path = SearchPaths.find_file (null, "roboto.bf");-		if (FontCache.get_default_cache ().get_font ((!) path.get_path ()) == null) {+		if (get_default_font () == null) { 			warning ("Default font not found."); 		} 	}+	+	public static Font? get_default_font () {+		File path = SearchPaths.find_file (null, "roboto.bf");+		return FontCache.get_default_cache ().get_font ((!) path.get_path ());+	}  	public void set_font_size (double height_in_pixels) { 		font_size = height_in_pixels;diff --git a/libbirdfont/Renderer/TextArea.vala b/libbirdfont/Renderer/TextArea.valaindex 1bcf42a..9a23e69 100644--- a/libbirdfont/Renderer/TextArea.vala+++ b/libbirdfont/Renderer/TextArea.vala@@ -62,11 +62,13 @@ public class TextArea : Widget { 	Gee.ArrayList<TextUndoItem> redo_items = new Gee.ArrayList<TextUndoItem> (); 	 	bool store_undo_state_at_next_event = false;+	bool editable; 	 	public TextArea (double font_size = 20) { 		this.font_size = font_size; 		width = min_width; 		height = min_height;+		editable = true; 	}  	public override double get_height () {@@ -114,7 +116,11 @@ public class TextArea : Widget { 	public void key_press (uint keyval) { 		unichar c; 		TextUndoItem ui;-				+		+		if (!editable) {+			return;+		}+		 		c = (unichar) keyval; 		 		switch (c) {@@ -1383,6 +1389,10 @@ public class TextArea : Widget { 		} 	} 	+	public void set_editable (bool editable) {+		this.editable = editable;+	}+	 	public class TextUndoItem : GLib.Object { 		public Carret carret; 		public Gee.ArrayList<Paragraph> added = new Gee.ArrayList<Paragraph> ();

Contact

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