Commit 140f6da
always show new backgrounds
Changed files (7)
modifiedsrc/BackgroundSelection.valamodifiedsrc/BackgroundTool.valamodifiedsrc/CutBackgroundTool.valamodifiedsrc/Glyph.valamodifiedsrc/GlyphBackgroundImage.valamodifiedsrc/Path.valamodifiedsrc/Toolbox.vala
Diff
@@ -24,38 +24,22 @@ namespace Supplement { class BackgroundSelection : FontDisplay { int active_box = -1;- ImageSurface add_icon; - Glyph glyph;+ ImageSurface add_icon; CutBackgroundCanvas cut_background_canvas; List <string> background_images = new List <string> (); Allocation allocation;+ Glyph glyph; - public BackgroundSelection (Glyph glyph) {+ public BackgroundSelection () { ImageSurface? i;+ glyph = MainWindow.get_current_glyph ();+ i = Icons.get_icon ("add_background_image.png"); return_if_fail (i != null); add_icon = (!) i;- this.glyph = glyph;- + CutBackgroundTool cb = (CutBackgroundTool) MainWindow.get_toolbox ().get_tool ("cut_background");- cb.set_destination_file_name (glyph.get_name ());- - cb.new_image.connect ((file) => {- Tool zoom_background;- TabBar tb = MainWindow.get_tab_bar ();- - glyph.set_background_image (new GlyphBackgroundImage (file));-- tb.close_display (cut_background_canvas);- tb.select_tab_name (glyph.get_name ());- - glyph.set_background_visible (true);- - zoom_background = MainWindow.get_tool ("zoom_background_image");- zoom_background.select_action (zoom_background);-- }); } public override string get_name () {@@ -227,6 +211,7 @@ class BackgroundSelection : FontDisplay { bg.reset_scale (glyph); cut_background_canvas.set_background_image (bg);+ glyph.set_background_visible (true); MainWindow.get_current_glyph ().set_background_image (bg); tb.select_tab_name (MainWindow.get_current_glyph ().get_name ());@@ -40,7 +40,7 @@ class BackgroundTool : Tool { bool resize_bg; // DEL public BackgroundTool (string name) {- base (name, "move, resize and rotate background image", 'M', CTRL|SHIFT);+ base (name, "Move, resize and rotate background image"); top_limit = 0; bottom_limit = 0;@@ -36,7 +36,7 @@ class CutBackgroundTool : Tool { string? destination_file_name = null; public CutBackgroundTool (string name) {- base (name, "cut background image", 'u', CTRL); + base (name, "Cut background image"); select_action.connect((self) => { });@@ -95,7 +95,7 @@ class CutBackgroundTool : Tool { tb.select_tab_name (glyph.get_name ()); glyph.set_background_visible (true);- + zoom_background = MainWindow.get_tool ("zoom_background_image"); zoom_background.select_action (zoom_background); });@@ -135,6 +135,8 @@ class Glyph : FontDisplay { } } + ((!) p).set_selected (true);+ active_paths.append ((!) p); } }@@ -1660,8 +1662,12 @@ class Glyph : FontDisplay { merge_path (p0); } - open_path ();- // close_path ();+ //open_path ();+ close_path ();++ foreach (Path p in path_list) {+ p.update_region_boundries ();+ } redraw_area (0, 0, allocation.width, allocation.height); }@@ -1678,7 +1684,6 @@ class Glyph : FontDisplay { continue; } - //path_list = Path.merge (p0.copy(), p1.copy()); path_list = Path.merge (p1, p0); if (path_list.paths.length () == 0) {@@ -1698,7 +1703,7 @@ class Glyph : FontDisplay { } add_active_path (mp);-+ active_paths.remove_all (p0); active_paths.remove_all (p1); @@ -398,8 +398,6 @@ class GlyphBackgroundImage { draw_handle_triangle (x, y, cr, g, 6); - draw_handle_triangle (0, 0, cr, g, 6);- cr.restore (); } @@ -141,11 +141,7 @@ class Path { } private void draw_next (EditPoint e, EditPoint en, Context cr) {- if (en.right_handle.type == PointType.LINE && e.left_handle.type == PointType.LINE) {- draw_line (e, en, cr);- } else {- draw_curve (e, en, cr);- }+ draw_curve (e, en, cr); } private static void draw_curve (EditPoint e, EditPoint en, Context cr, double alpha = 1) {@@ -1402,7 +1398,7 @@ class Path { cr.save (); all_of_path ((x, y) => {- cr.set_source_rgba (0.3, 0.3, 0.3, 1);+ //cr.set_source_rgba (0.3, 0.3, 0.3, 1); cr.move_to (px + xc, -py + yc); cr.line_to (x + xc, -y + yc); @@ -399,7 +399,7 @@ class Toolbox : DrawingArea { background_tools.add_tool (cut_background); this.cut_background = cut_background; - Tool show_bg = new Tool ("show_background", "Show background image", 'F', SHIFT);+ Tool show_bg = new Tool ("show_background", "Show background image"); show_bg.select_action.connect((self) => { Glyph g = MainWindow.get_current_glyph (); g.set_background_visible (!g.get_background_visible ());@@ -445,7 +445,7 @@ class Toolbox : DrawingArea { return; } - BackgroundSelection bgs = new BackgroundSelection ((!) g);+ BackgroundSelection bgs = new BackgroundSelection (); MainWindow.get_tab_bar ().add_unique_tab (bgs , 120, false); tp.show_text ("");