Commit 8b15920
bugfix: redraw is lost when a new version of a glyph is created
Changed files (5)
modifiedsrc/Glyph.valamodifiedsrc/OverView.valamodifiedsrc/PenTool.valamodifiedsrc/ResizeTool.valamodifiedsrc/VersionList.vala
Diff
@@ -71,8 +71,6 @@ class Glyph : FontDisplay { public double move_offset_x = 0; public double move_offset_y = 0; - public signal void queue_draw_area (int x, int y, int w, int h);- public Allocation allocation; public string name;@@ -109,11 +107,6 @@ class Glyph : FontDisplay { left_limit = -28 * SCALE; right_limit = 28 * SCALE;- - // TODO: call redraw direcly- queue_draw_area.connect ((x, y, w, h) => {- redraw_area (x, y, w, h);- }); } public Glyph.no_lines (string name, unichar unichar_code = 0) {@@ -273,7 +266,7 @@ class Glyph : FontDisplay { view_offset_y -= 10 / view_zoom; } - queue_draw_area (0, 0, allocation.width, allocation.height);+ redraw_area (0, 0, allocation.width, allocation.height); } public override void scroll_wheel_down (Gdk.EventScroll e) {@@ -285,7 +278,7 @@ class Glyph : FontDisplay { view_offset_y += 10 / view_zoom; } - queue_draw_area (0, 0, allocation.width, allocation.height);+ redraw_area (0, 0, allocation.width, allocation.height); } public void add_path (Path p) {@@ -457,7 +450,7 @@ class Glyph : FontDisplay { } public void redraw_help_lines () {- queue_draw_area (0, 0, allocation.width, allocation.height);+ redraw_area (0, 0, allocation.width, allocation.height); } public void set_show_help_lines (bool hl) {@@ -476,7 +469,7 @@ class Glyph : FontDisplay { sort_help_lines (); line.queue_draw_area.connect ((x, y, w, h) => {- this.queue_draw_area (x, y, w, h);+ this.redraw_area (x, y, w, h); }); } @@ -718,7 +711,7 @@ class Glyph : FontDisplay { w = Math.fabs (zoom_x1 - zoom_x2) + 100; h = Math.fabs (zoom_y1 - zoom_y2) + 100; - queue_draw_area ((int)x, (int)y, (int)w, (int)h);+ redraw_area ((int)x, (int)y, (int)w, (int)h); } public void set_zoom_area (int sx, int sy, int nx, int ny) {@@ -798,7 +791,7 @@ class Glyph : FontDisplay { double xta = -view_offset_x - xmin; double xtb = -view_offset_x - xmax; - queue_draw_area ((int)xtb - 10, (int)yta - 10, (int)(xtb - xta) + 10, (int) (yta - ytb) + 10);+ redraw_area ((int)xtb - 10, (int)yta - 10, (int)(xtb - xta) + 10, (int) (yta - ytb) + 10); } public Path get_closeset_path (double x, double y) {@@ -909,7 +902,7 @@ class Glyph : FontDisplay { p.add (xt, yt); paths.append (p); added = true;- queue_draw_area (0, 0, allocation.width, allocation.height);+ redraw_area (0, 0, allocation.width, allocation.height); break; } }@@ -969,13 +962,13 @@ class Glyph : FontDisplay { yt = yc - y - view_offset_y; // redraw control point- queue_draw_area ((int)(x - 4*view_zoom), (int)(y - 4*view_zoom), (int)(x + 3*view_zoom), (int)(y + 3*view_zoom));+ redraw_area ((int)(x - 4*view_zoom), (int)(y - 4*view_zoom), (int)(x + 3*view_zoom), (int)(y + 3*view_zoom)); // update position of selected point ((!) selected_point).set_position (xt, yt); if (view_zoom >= 2) {- queue_draw_area (0, 0, allocation.width, allocation.height);+ redraw_area (0, 0, allocation.width, allocation.height); } else { redraw_last_stroke (x, y); }@@ -983,7 +976,7 @@ class Glyph : FontDisplay { if (flipping_point_on_path != null) { p = (!) flipping_point_on_path; p.recalculate_handles (x, y);- queue_draw_area (0, 0, allocation.width, allocation.height);+ redraw_area (0, 0, allocation.width, allocation.height); } } @@ -1022,7 +1015,7 @@ class Glyph : FontDisplay { } } - queue_draw_area ((int)px - 20, (int)py - 20, tw + 120, th + 120); + redraw_area ((int)px - 20, (int)py - 20, tw + 120, th + 120); } public Path? get_last_path () @@ -1062,7 +1055,7 @@ class Glyph : FontDisplay { delete_invisible_paths (); - queue_draw_area (0, 0, allocation.width, allocation.height);+ redraw_area (0, 0, allocation.width, allocation.height); return r; }@@ -1074,7 +1067,7 @@ class Glyph : FontDisplay { p.set_editable (true); } - queue_draw_area (0, 0, allocation.width, allocation.height);+ redraw_area (0, 0, allocation.width, allocation.height); } public void redraw_path_region (Path p) {@@ -1087,7 +1080,7 @@ class Glyph : FontDisplay { w = reverse_path_coordinate_x (p.xmax) - x; h = reverse_path_coordinate_x (p.ymax) - y; // FIXME: redraw path - queue_draw_area (x, y, w, h); + redraw_area (x, y, w, h); } /** Delete all paths without area. */@@ -1176,7 +1169,7 @@ class Glyph : FontDisplay { set_zoom_from_area (); zoom_out (); // add some margin - queue_draw_area (0, 0, allocation.width, allocation.height);+ redraw_area (0, 0, allocation.width, allocation.height); } @@ -71,9 +71,7 @@ class OverView : FontDisplay { bool selected = tabs.select_char (s); unichar new_char = s.get_char (0); Font f = Supplement.get_current_font ();- - stdout.printf ("Open '%s' character: %u (%s)\n", s, new_char, Font.to_hex (new_char));- + if (!selected) { GlyphCollection? fg = f.get_glyph_collection (s); Glyph g = (fg == null) ? new Glyph (s, new_char) : ((!) fg).get_current ();@@ -308,9 +306,7 @@ class OverView : FontDisplay { cr.set_font_size (14); left_margin = 0;- - print (@"items_per_row: $items_per_row \n");- + for (int j = 0; j < items_per_row; j++) { if (all_avail) {@@ -450,9 +446,7 @@ class OverView : FontDisplay { n_items = ((allocation.width - 40) / nail_width); rows = (allocation.height / nail_height);- - print (@"n_items: $n_items (2)\n");- + if (items_per_row != n_items) { if (items_per_row == 0) { items_per_row = n_items;@@ -883,7 +877,7 @@ class OverView : FontDisplay { Font f; uint len; - print (@"n_items: $n_items\n");+ redraw_area (0, 0, allocation.width, allocation.height); if (all_avail) { f = Supplement.get_current_font ();@@ -955,8 +949,6 @@ class OverView : FontDisplay { adjust_scroll (); adjust_scroll ();- - redraw_area (0, 0, allocation.width, allocation.height); } public override void button_press (EventButton e) {@@ -364,7 +364,7 @@ class PenTool : Tool { ((!)e).set_active (true); } - g.queue_draw_area (0, 0, g.allocation.width, g.allocation.height);+ g.redraw_area (0, 0, g.allocation.width, g.allocation.height); } public void control_point_event (double event_x, double event_y) {@@ -178,8 +178,8 @@ class ResizeTool : Tool { x = (int) (p.xmax * ivz + g.view_offset_x + (g.allocation.width / 2) * ivz); y = (int) (p.ymax * ivz + g.view_offset_y + (g.allocation.height / 2) * ivz); - g.queue_draw_area (x, y, (int) move_icon.get_width (), (int) move_icon.get_height ());- g.queue_draw_area (0, 0, g.allocation.width, g.allocation.height);+ g.redraw_area (x, y, (int) move_icon.get_width (), (int) move_icon.get_height ());+ g.redraw_area (0, 0, g.allocation.width, g.allocation.height); } } @@ -73,6 +73,10 @@ class VersionList : DropMenu { ((!)ma.parent).deselect_all (); ma.set_selected (true); ++ MainWindow.get_tab_bar ().close_by_name (get_current ().name); + // MainWindow.get_glyph_canvas ().set_current_glyph (get_current ());+ // MainWindow.get_overview ().open_glyph_signal (get_current ().name); } public void add_glyph (Glyph new_version, bool selected = true) {