Code

keep selected option for calligraphic
authorbuliabyak <buliabyak@users.sourceforge.net>
Sun, 14 May 2006 03:27:13 +0000 (03:27 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Sun, 14 May 2006 03:27:13 +0000 (03:27 +0000)
src/dyna-draw-context.cpp
src/dyna-draw-context.h
src/preferences-skeleton.h
src/ui/dialog/inkscape-preferences.cpp
src/ui/dialog/inkscape-preferences.h

index 99cea177becf954b307d2e6b2001e69b106ad18d..ebabeef317eb06b74271a86c246a88b55480fdd7 100644 (file)
@@ -156,6 +156,7 @@ sp_dyna_draw_context_init(SPDynaDrawContext *ddc)
     ddc->flatness = 0.9;
 
     ddc->abs_width = false;
+    ddc->keep_selected = true;
 }
 
 static void
@@ -218,6 +219,7 @@ sp_dyna_draw_context_setup(SPEventContext *ec)
     sp_event_context_read(ec, "usepressure");
     sp_event_context_read(ec, "usetilt");
     sp_event_context_read(ec, "abs_width");
+    sp_event_context_read(ec, "keep_selected");
 
     ddc->is_drawing = false;
 
@@ -256,6 +258,8 @@ sp_dyna_draw_context_set(SPEventContext *ec, gchar const *key, gchar const *val)
         ddc->usetilt = (val && strcmp(val, "0"));
     } else if (!strcmp(key, "abs_width")) {
         ddc->abs_width = (val && strcmp(val, "0"));
+    } else if (!strcmp(key, "keep_selected")) {
+        ddc->keep_selected = (val && strcmp(val, "0"));
     }
 
     //g_print("DDC: %g %g %g %g\n", ddc->mass, ddc->drag, ddc->angle, ddc->width);
@@ -654,7 +658,8 @@ set_to_accumulated(SPDynaDrawContext *dc)
             Inkscape::GC::release(dc->repr);
             item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer());
             item->updateRepr();
-            sp_desktop_selection(desktop)->set(dc->repr);
+            if (dc->keep_selected)
+                sp_desktop_selection(desktop)->set(dc->repr);
         }
         abp = nr_artpath_affine(sp_curve_first_bpath(dc->accumulated), sp_desktop_dt2root_affine(desktop));
         str = sp_svg_write_path(abp);
index fef6f1ea3b6deb7c8c49edabc9be3a564bb56150..27d3291da63e5307a2d26fc74173d89955a71805 100644 (file)
@@ -101,6 +101,9 @@ struct SPDynaDrawContext
 
     /** uses absolute width independent of zoom */
     bool abs_width;
+
+    /** newly created object remain selected */
+    bool keep_selected;
 };
 
 struct SPDynaDrawContextClass
index 6fd5b235d26ab6ebdd86f166a6ea91306b7b06d4..073fdbb78801262386f13f5c0e76c749f7f88078 100644 (file)
@@ -60,7 +60,7 @@ static char const preferences_skeleton[] =
 "    </group>\n"
 "    <eventcontext id=\"calligraphic\" style=\"fill:black;fill-opacity:1;fill-rule:nonzero;stroke:none;\"\n"
 "                       mass=\"0.02\" drag=\"1\" angle=\"30\" width=\"0.15\" thinning=\"0.1\" flatness=\"0.9\"  usecurrent=\"0\"\n"
-"                       usepressure=\"0\" usetilt=\"0\"/>\n"
+"                       usepressure=\"0\" usetilt=\"0\" keep_selected=\"1\"/>\n"
 "    <eventcontext id=\"text\"  usecurrent=\"0\" gradientdrag=\"1\"\n"
 "                  style=\"fill:black;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;font-style:normal;font-weight:normal;font-size:12px;\" selcue=\"1\"/>\n"
 "    <eventcontext id=\"nodes\" selcue=\"1\" gradientdrag=\"1\"/>\n"
index f5b447e2616de33fc3a6c094e199247d1a536420..b3eac43360e1d03b647423ee79ea99301908f4a1 100644 (file)
@@ -302,6 +302,7 @@ void InkscapePreferences::initPageTools()
     _path_tools = _page_list.get_model()->get_path(iter_tools);
 
     _calligrapy_use_abs_size.init ( _("Width is in absolute units"), "tools.calligraphic", "abs_width", false);
+    _calligrapy_keep_selected.init ( _("Keep selected"), "tools.calligraphic", "keep_selected", true);
     _connector_ignore_text.init( _("Don't attach connectors to text objects"), "tools.connector", "ignoretext", true);
 
     //Selector
@@ -374,6 +375,8 @@ void InkscapePreferences::initPageTools()
     this->AddNewObjectsStyle(_page_calligraphy, "tools.calligraphic");
     _page_calligraphy.add_line( false, "", _calligrapy_use_abs_size, "", 
                             _("If on, pen width is in absolute units (px) independent of zoom; otherwise pen width depends on zoom so that it looks the same at any zoom"));
+    _page_calligraphy.add_line( false, "", _calligrapy_keep_selected, "", 
+                            _("If on, each object created with this tool will remain selected after you finish drawing it"));
     //Text
     this->AddPage(_page_text, _("Text"), iter_tools, PREFS_PAGE_TOOLS_TEXT);
     this->AddSelcueCheckbox(_page_text, "tools.text", true);
index c3a3c0c9e4788653bd94781c7c425fd7f60bf417..077c2c416f4db845ab1088805183f8f97d02cc93 100644 (file)
@@ -115,6 +115,7 @@ protected:
     PrefCheckButton _win_save_geom, _win_hide_task, _win_zoom_resize;
 
     PrefCheckButton _calligrapy_use_abs_size;
+    PrefCheckButton _calligrapy_keep_selected;
 
     PrefCheckButton _connector_ignore_text;