Commit 8f4d418
Show version and build time stamp in GUI
Changed files (12)
modifiedlibbirdfont/BackgroundTools.valamodifiedlibbirdfont/Button.valamodifiedlibbirdfont/Menu.valamodifiedlibbirdfont/MessageDialog.valamodifiedlibbirdfont/OverViewItem.valamodifiedlibbirdfont/Renderer/Text.valamodifiedlibbirdfont/Renderer/TextArea.valamodifiedlibbirdfont/SaveDialog.valamodifiedlibbirdfont/TabContent.valamodifiedlibbirdfont/TableLayout.valamodifiedlibbirdfont/ZoomView.valamodifiedscripts/configfile.py
Diff
@@ -75,6 +75,8 @@ public class BackgroundTools : ToolCollection { foreach (BackgroundSelection selection in current_image.selections) { add_part (selection); }+ + parts.redraw (); } public void add_part (BackgroundSelection selection) {@@ -147,6 +149,8 @@ public class BackgroundTools : ToolCollection { MainWindow.get_toolbox ().update_expanders (); Toolbox.redraw_tool_box (); }+ + parts.redraw (); } void set_new_background_image (GlyphCollection gc, BackgroundPartLabel bpl) {@@ -280,7 +284,7 @@ public class BackgroundTools : ToolCollection { font.add_background_image (image); }- + public override Gee.ArrayList<string> get_displays () { Gee.ArrayList<string> d = new Gee.ArrayList<string> (); d.add ("Backgrounds");@@ -59,7 +59,7 @@ public class Button : Widget { return label.get_width () + 2 * padding; } - public override void button_press (uint button, double x, double y) {+ public override void button_release (uint button, double x, double y) { if (is_over (x, y)) { action (); }@@ -476,7 +476,16 @@ public class Menu : GLib.Object { show_menu = false; }); menu.items.add (description);- ++ MenuItem version = add_menu_item (t_("Version"), "birdfont version");+ version.action.connect (() => {+ MainWindow.show_message (t_("Version") + ": " + get_version () + "\n"+ + get_build_stamp ());+ show_menu = false;+ });+ menu.items.add (version);++ current_menu = menu; top_menu = menu; allocation = new WidgetAllocation ();@@ -22,7 +22,8 @@ public class MessageDialog : Dialog { TextArea message; public MessageDialog (string message) {- this.message = new TextArea (20 * MainWindow.units);+ Color c = Theme.get_color ("Text Tool Box");+ this.message = new TextArea (20 * MainWindow.units, c); this.message.set_text (message); this.message.draw_border = false; this.message.editable = false;@@ -45,7 +46,9 @@ public class MessageDialog : Dialog { message.layout (); width = message.get_width ();- height = message.get_height () + ok_button.get_height ();+ height = message.get_height ();+ height += ok_button.get_height ();+ height += 5 * MainWindow.units; cx = (allocation.width - width) / 2.0; cy = (allocation.height - height) / 2.0;@@ -69,6 +72,7 @@ public class MessageDialog : Dialog { cr.stroke (); cr.restore (); + cy += 5 * MainWindow.units; message.widget_x = cx + 10 * MainWindow.units; message.widget_y = cy; message.allocation = allocation;@@ -83,6 +87,10 @@ public class MessageDialog : Dialog { public override void button_press (uint button, double x, double y) { ok_button.button_press (button, x, y); }+ + public override void button_release (uint button, double x, double y) {+ ok_button.button_release (button, x, y);+ } } }@@ -372,7 +372,7 @@ public class OverViewItem : GLib.Object { cr.save (); cr.set_antialias (Cairo.Antialias.NONE);- cr.set_source_surface (cache, (int) (x + 1), (int) (y + height - 20));+ cr.set_source_surface (cache, (int) (x + 1), (int) (y + height - 19)); cr.paint (); cr.restore (); }@@ -40,10 +40,10 @@ public class Text : Widget { public double font_size; public double sidebearing_extent = 0; - double r = 0;- double g = 0;- double b = 0;- double a = 1;+ public double r = 0;+ public double g = 0;+ public double b = 0;+ public double a = 1; bool use_cached_glyphs = true; double truncated_width = -1;@@ -24,6 +24,7 @@ public class TextArea : Widget { public double font_size; public double padding = 3.3; public bool single_line = false;+ public Color text_color = Color.black (); public bool draw_carret { get { return carret_is_visible; }@@ -65,11 +66,15 @@ public class TextArea : Widget { public bool editable; public bool use_cache = true; - public TextArea (double font_size = 20) {+ public TextArea (double font_size = 20, Color? c = null) { this.font_size = font_size; width = min_width; height = min_height; editable = true;+ + if (c != null) {+ text_color = (!) c;+ } } public override void focus (bool focus) {@@ -105,12 +110,12 @@ public class TextArea : Widget { next_paragraph = text.index_of ("\n", last_paragraph); if (next_paragraph == -1) {- paragraph = new Paragraph (text.substring (last_paragraph), font_size, paragraphs.size);+ paragraph = new Paragraph (text.substring (last_paragraph), font_size, paragraphs.size, text_color); paragraphs.add (paragraph); last_paragraph = DONE; } else { next_paragraph += "\n".length;- paragraph = new Paragraph (text.substring (last_paragraph, next_paragraph - last_paragraph), font_size, paragraphs.size);+ paragraph = new Paragraph (text.substring (last_paragraph, next_paragraph - last_paragraph), font_size, paragraphs.size, text_color); paragraphs.add (paragraph); last_paragraph = next_paragraph; }@@ -279,7 +284,7 @@ public class TextArea : Widget { if (unlikely (!(0 <= carret.paragraph < paragraphs.size))) { warning (@"No paragraph, index: $(carret.paragraph), size: $(paragraphs.size)");- p = new Paragraph ("", 0, 0);+ p = new Paragraph ("", 0, 0, text_color); paragraphs.add (p); return p; }@@ -710,7 +715,7 @@ public class TextArea : Widget { u = true; if (paragraphs.size == 0) {- paragraphs.add (new Paragraph ("", font_size, 0));+ paragraphs.add (new Paragraph ("", font_size, 0, text_color)); } } else { ui = new TextUndoItem (carret);@@ -739,7 +744,7 @@ public class TextArea : Widget { for (int i = 1; i < pgs.size; i++) { paragraph_index++; string next = pgs.get (i);- next_paragraph = new Paragraph (next, font_size, paragraph_index);+ next_paragraph = new Paragraph (next, font_size, paragraph_index, text_color); paragraphs.insert (paragraph_index, next_paragraph); ui.added.add (next_paragraph); u = true;@@ -799,7 +804,7 @@ public class TextArea : Widget { w = next_word.text; if (next_word.widget_y <= tt_click <= next_word.widget_y + font_size) {- Theme.text_color (next_word, "Foreground 1");+ //FIXME: DELETE Theme.text_color (next_word, "Foreground 1"); p = next_word.get_sidebearing_extent (); @@ -1187,7 +1192,7 @@ public class TextArea : Widget { if (paragraphs.size > 0 && paragraphs.get (0).words.size > 0) { Text t = paragraphs.get (0).words.get (0);- Theme.text_color (t, "Foreground 1");+ //FIXME: DELETE Theme.text_color (t, "Foreground 1"); } for (int i = first_visible; i < last_visible; i++) {@@ -1201,7 +1206,7 @@ public class TextArea : Widget { cc = new Context ((!) paragraph.cached_surface); foreach (Text next_word in paragraph.words) {- Theme.text_color (next_word, "Foreground 1");+ //FIXME: DELETE Theme.text_color (next_word, "Foreground 1"); if (next_word.text != "\n") { next_word.draw_at_top (cc, next_word.widget_x, next_word.widget_y - ty);@@ -1487,25 +1492,22 @@ public class TextArea : Widget { } private Gee.ArrayList<Text> words_in_paragraph = new Gee.ArrayList<Text> ();- public int text_length;- public bool need_layout = true;- public Surface? cached_surface = null;- double font_size;- public int index;+ Color text_color; - public Paragraph (string text, double font_size, int index) {+ public Paragraph (string text, double font_size, int index, Color c) { this.index = index; this.font_size = font_size;+ text_color = c; set_text (text); } public Paragraph copy () {- Paragraph p = new Paragraph (text.dup (), font_size, index);+ Paragraph p = new Paragraph (text.dup (), font_size, index, text_color); p.need_layout = true; return p; }@@ -1555,6 +1557,12 @@ public class TextArea : Widget { } word = new Text (w, font_size);+ + word.r = text_color.r;+ word.g = text_color.g;+ word.b = text_color.b;+ word.a = text_color.a;+ words_in_paragraph.add (word); } }@@ -129,6 +129,12 @@ public class SaveDialog : Dialog { discard_button.button_press (button, x, y); cancel_button.button_press (button, x, y); }++ public override void button_release (uint button, double x, double y) {+ save_button.button_release (button, x, y);+ discard_button.button_release (button, x, y);+ cancel_button.button_release (button, x, y);+ } } }@@ -155,16 +155,16 @@ public class TabContent : GLib.Object { if (MenuTab.suppress_event) { return; }-- if (MainWindow.get_menu ().show_menu) {+ + if (MainWindow.get_dialog ().visible) {+ MainWindow.get_dialog ().button_release (button, x, y);+ } else if (MainWindow.get_menu ().show_menu) { MainWindow.get_menu ().button_release (button, x, y);+ } else if (text_input_visible) {+ text_input.button_release (button, x, y); + GlyphCanvas.redraw (); } else {- if (text_input_visible) {- text_input.button_release (button, x, y); - GlyphCanvas.redraw ();- } else {- GlyphCanvas.current_display.button_release (button, x, y);- }+ GlyphCanvas.current_display.button_release (button, x, y); } } @@ -174,7 +174,7 @@ public class TabContent : GLib.Object { } last_press_time = GLib.get_real_time ();-+ if (MainWindow.get_dialog ().visible) { MainWindow.get_dialog ().button_press (button, x, y); } else if (!MainWindow.get_menu ().show_menu) {@@ -178,6 +178,12 @@ public class TableLayout : FontDisplay { set_focus (t); t.button_release (button, x, y); }++ foreach (Widget w in widgets) {+ if (w.is_over (x, y)) {+ w.button_release (button, x, y);+ }+ } GlyphCanvas.redraw (); }@@ -26,10 +26,6 @@ class ZoomView : GLib.Object { this.zoom = zoom; this.allocation = allocation; }- - public string to_string () {- return @"x: $(x), y: $y, zoom: $zoom\n" + allocation.to_string ();- } } }@@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. import version import time;+from time import gmtime, strftime VERSION = version.VERSION @@ -25,7 +26,7 @@ def write_config (prefix): print ("Writing Config.vala") vars = (('VERSION', VERSION),- ('BUILD_TIMESTAMP', time.asctime( time.localtime(time.time()))),+ ('BUILD_TIMESTAMP', strftime("%Y-%m-%d %H:%M:%S +0000", gmtime())), ('PREFIX', prefix), )