Code

Sorry, I got off on a branch and ended up with a bunch of things. I'm just going...
authorTed Gould <ted@canonical.com>
Thu, 25 Sep 2008 04:27:18 +0000 (23:27 -0500)
committerTed Gould <ted@canonical.com>
Thu, 25 Sep 2008 04:27:18 +0000 (23:27 -0500)
* Added a focus mode activated by Shift+F11.  The goal of this mode is to
remove all toolbars for a short period so that you maximize screen area.
Useful on small screens.  Also when you know lots of shortcuts.

* Created what I'm calling "Quick Zoom."  The idea here is to have a modal
zoom for touching up something with fine detail and then returning to what
you're doing.  This is activated with the letter "Q" on the keyboard.  When
you release it, you return back to where you were.  This will zoom in on
selected objects, or if you're in the node tool selected nodes.

* Added .svg on the temporary files in extensions.  This'll make many of
them happier.  This only works on recent versions of GLib, but shouldn't
break older ones more than they already are.

* Moved the Inkscape configuration directory on Linux from ~/.inkscape
to ~/.config/Inkscape.  This is the new way to do things with the cross
desktop naming spec.  I'm unsure whether we should be putting crash dumps
in .config or .cache though.

* Removed 'tools_switch_current' because every usage of it already had a
pointer to where it needed to go.  Removes usage of globals.

* Made it so that dialogs will be transparent when not focused.  This is
an alternate to having the docked, and one that I like better as I feel it
gives me more screen area.  You can adjust how much transparency and the
speed of the animation in the preferences dialog.  (Note: this requires
GTK+ 2.12 and a compositor, but gracefully degrades if you don't have
either)

27 files changed:
.bzrignore [new file with mode: 0644]
configure.ac
share/keys/default.xml
src/desktop.cpp
src/desktop.h
src/event-context.cpp
src/extension/db.h
src/extension/implementation/script.cpp
src/extension/implementation/script.h
src/extension/timer.cpp
src/inkscape.cpp
src/interface.cpp
src/live_effects/parameter/path.cpp
src/menus-skeleton.h
src/nodepath.h
src/preferences-skeleton.h
src/selection-chemistry.cpp
src/tools-switch.cpp
src/tools-switch.h
src/ui/dialog/floating-behavior.cpp
src/ui/dialog/floating-behavior.h
src/ui/dialog/inkscape-preferences.cpp
src/ui/dialog/inkscape-preferences.h
src/verbs.cpp
src/verbs.h
src/widgets/desktop-widget.cpp
src/widgets/sp-xmlview-attr-list.h

diff --git a/.bzrignore b/.bzrignore
new file mode 100644 (file)
index 0000000..4dc262f
--- /dev/null
@@ -0,0 +1,38 @@
+Makefile.in
+aclocal.m4
+autom4te.cache
+build
+compile
+config.guess
+config.h.in
+config.sub
+configure
+depcomp
+install
+install-sh
+intltool-extract.in
+intltool-merge.in
+intltool-update.in
+missing
+doc/Makefile.in
+po/Makefile.in.in
+share/Makefile.in
+share/clipart/Makefile.in
+share/examples/Makefile.in
+share/extensions/Makefile.in
+share/extensions/Barcode/Makefile.in
+share/extensions/Poly3DObjects/Makefile.in
+share/extensions/alphabet_soup/Makefile.in
+share/extensions/xaml2svg/Makefile.in
+share/fonts/Makefile.in
+share/gradients/Makefile.in
+share/icons/Makefile.in
+share/keys/Makefile.in
+share/markers/Makefile.in
+share/palettes/Makefile.in
+share/patterns/Makefile.in
+share/screens/Makefile.in
+share/templates/Makefile.in
+share/tutorials/Makefile.in
+share/ui/Makefile.in
+src/Makefile.in
index 46f255abbcd22c5ab7472963bdb0ec9f30442e33..5a77262410bfc34329ee61d5b965312162437eb4 100644 (file)
@@ -551,11 +551,10 @@ fi
 AC_SUBST(POPPLER_CFLAGS)
 AC_SUBST(POPPLER_LIBS)
 
-ink_svd_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$POPPLER_CFLAGS $CPPFLAGS"
-AC_MSG_CHECKING([whether libpoppler has new getNextChar])
-AC_EGREP_CPP([Unicode ..u. int .uLen], [#include "GfxFont.h"], AC_DEFINE([POPPLER_NEW_GFXFONT], [], [True iff libpoppler is 0.8.3 or newer.]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
-CPPFLAGS="$ink_svd_CPPFLAGS"
+PKG_CHECK_MODULES(POPPLERNEW, poppler >= 0.8.3, popplernew=yes, popplernew=no)
+if test "x$popplernew" = "xyes"; then
+       AC_DEFINE(POPPLER_NEW_GFXFONT, 1, [Poppler version of GfxFont to use (0.8.3 or higher versions of Poppler)])
+fi
 
 dnl ******************************
 dnl Inkboard dependency checking
index 5ed3124d5bc65b5d9a1725bd07fc8510927f02de..e5e5d43aa61ba67e5d323d25219eee9cac4a4770 100644 (file)
@@ -215,6 +215,7 @@ override) the bindings in the main default.xml.
 <!-- View -->
 
   <bind key="F11" action="FullScreen" display="true"/> 
+  <bind key="F11" action="FocusToggle" modifiers="Shift" display="true"/> 
 
   <bind key="Tab" modifiers="Ctrl" action="NextWindow" display="true"/>
   <bind key="ISO_Left_Tab" modifiers="Ctrl" action="NextWindow" />
index 4f6ea7a5ac051e01ceef2f2d2467b36f1279d569..004a0116eed4971c277fe942a7883ad810e18493 100644 (file)
@@ -133,6 +133,7 @@ SPDesktop::SPDesktop() :
     page( 0 ),
     page_border( 0 ),
     current( 0 ),
+       _focusMode(false),
     zooms_past( 0 ),
     zooms_future( 0 ),
     dkey( 0 ),
@@ -861,6 +862,102 @@ SPDesktop::next_zoom()
     zooms_future = g_list_remove (zooms_future, ((NRRect *) zooms_future->data));
 }
 
+#include "tools-switch.h"
+#include "node-context.h"
+#include "shape-editor.h"
+#include "nodepath.h"
+
+/** \brief  Performs a quick zoom into what the user is working on
+       \param  enable  Whether we're going in or out of quick zoom
+
+*/
+void 
+SPDesktop::zoom_quick (bool enable)
+{
+       if (enable == _quick_zoom_enabled) {
+               return;
+       }
+
+       if (enable == true) {
+               _quick_zoom_stored_area = get_display_area();
+               bool zoomed = false;
+
+               if (!zoomed) {
+                       SPItem * singleItem = selection->singleItem();
+                       if (singleItem != NULL && tools_isactive(this, TOOLS_NODES)) {
+                               SPNodeContext * ncontext = SP_NODE_CONTEXT(event_context);
+
+                               Inkscape::NodePath::Path * nodepath = ncontext->shape_editor->get_nodepath();
+                               // printf("I've got a nodepath, crazy\n");
+
+                               Geom::Rect nodes;
+                               bool firstnode = true;
+
+                               if (nodepath->selected) {
+                                       for (GList *spl = nodepath->subpaths; spl != NULL; spl = spl->next) {
+                                          Inkscape::NodePath::SubPath *subpath = (Inkscape::NodePath::SubPath *) spl->data;
+                                               for (GList *nl = subpath->nodes; nl != NULL; nl = nl->next) {
+                                                  Inkscape::NodePath::Node *node = (Inkscape::NodePath::Node *) nl->data;
+                                                       if (node->selected) {
+                                                               // printf("\tSelected node\n");
+                                                               if (firstnode) {
+                                                                       nodes = Geom::Rect(node->pos, node->pos);
+                                                                       firstnode = false;
+                                                               } else {
+                                                                       nodes.expandTo(node->pos);
+                                                               }
+
+                                                               if (node->p.other != NULL) {
+                                                                       /* Include previous node pos */
+                                                                       nodes.expandTo(node->p.other->pos);
+
+                                                                       /* Include previous handle */
+                                                                       if (!sp_node_side_is_line(node, &node->p)) {
+                                                                               nodes.expandTo(node->p.pos);
+                                                                       }
+                                                               }
+
+                                                               if (node->n.other != NULL) {
+                                                                       /* Include previous node pos */
+                                                                       nodes.expandTo(node->n.other->pos);
+
+                                                                       /* Include previous handle */
+                                                                       if (!sp_node_side_is_line(node, &node->n)) {
+                                                                               nodes.expandTo(node->n.pos);
+                                                                       }
+                                                               }
+                                                       }
+                                               }
+                                       }
+
+                                       if (!firstnode && nodes.area() * 2.0 < _quick_zoom_stored_area.area()) {
+                                               set_display_area(nodes, 10);
+                                               zoomed = true;
+                                       }
+                               }
+                       }
+               }
+
+               if (!zoomed) {
+                       boost::optional<Geom::Rect> const d = selection->bounds_2geom();
+                       if (d && !d->isEmpty() && d->area() * 2.0 < _quick_zoom_stored_area.area()) {
+                               set_display_area(*d, 10);
+                               zoomed = true;
+                       } 
+               }
+
+               if (!zoomed) {
+                       zoom_relative(_quick_zoom_stored_area.midpoint()[NR::X], _quick_zoom_stored_area.midpoint()[NR::Y], 2.0);
+                       zoomed = true;
+               }
+       } else {
+               set_display_area(_quick_zoom_stored_area, 0);
+       }
+
+       _quick_zoom_enabled = enable;
+       return;
+}
+
 /**
  * Zoom to point with absolute zoom factor.
  */
@@ -1129,6 +1226,33 @@ SPDesktop::fullscreen()
     _widget->setFullscreen();
 }
 
+/** \brief  Checks to see if the user is working in focused mode
+
+       Returns the value of \c _focusMode
+*/
+bool
+SPDesktop::is_focusMode()
+{
+       return _focusMode;
+}
+
+/** \brief  Changes whether the user is in focus mode or not
+       \param  mode  Which mode the view should be in
+
+*/
+void
+SPDesktop::focusMode (bool mode)
+{
+       if (mode == _focusMode) { return; }
+
+       _focusMode = mode;
+
+       layoutWidget();
+       //sp_desktop_widget_layout(SPDesktopWidget);
+
+       return;
+}
+
 void
 SPDesktop::getWindowGeometry (gint &x, gint &y, gint &w, gint &h)
 {
index f02f5556ca0d6e81086b90dffea368a97e4355c4..fa38e1b7188715a069a5d328f03905052f428ebb 100644 (file)
@@ -30,6 +30,7 @@
 #include <sigc++/sigc++.h>
 
 #include <2geom/matrix.h>
+#include <2geom/rect.h>
 
 #include "ui/view/view.h"
 #include "ui/view/edit-widget-interface.h"
@@ -112,9 +113,12 @@ struct SPDesktop : public Inkscape::UI::View::View
     SPCanvasItem  *page;        ///< page background
     SPCanvasItem  *page_border; ///< page border
     SPCSSAttr     *current;     ///< current style
+    bool           _focusMode;  ///< Whether we're focused working or general working
 
     GList *zooms_past;
     GList *zooms_future;
+    bool _quick_zoom_enabled; ///< Signifies that currently we're in quick zoom mode
+       Geom::Rect _quick_zoom_stored_area;  ///< The area of the screen before quick zoom
     unsigned int dkey;
     unsigned int number;
     guint window_state;
@@ -246,6 +250,9 @@ struct SPDesktop : public Inkscape::UI::View::View
     double current_zoom() const  { return _d2w.descrim(); }
     void prev_zoom();
     void next_zoom();
+    void zoom_quick(bool enable = true);
+       /** \brief  Returns whether the desktop is in quick zoom mode or not */
+       bool quick_zoomed(void) { return _quick_zoom_enabled; }
 
     bool scroll_to_point (Geom::Point const &s_dt, gdouble autoscrollspeed = 0);
     void scroll_world (double dx, double dy, bool is_scrolling = false);
@@ -289,10 +296,12 @@ struct SPDesktop : public Inkscape::UI::View::View
     bool is_iconified();
     bool is_maximized();
     bool is_fullscreen();
+    bool is_focusMode();
 
     void iconify();
     void maximize();
     void fullscreen();
+    void focusMode(bool mode = true);
 
     void registerEditWidget (Inkscape::UI::View::EditWidgetInterface *widget)
     { _widget = widget; }
index 9df17114631543479188ed8cb0a2eb1b777156d3..e5f81a2b9d58ce02122f60437523161c6644eea7 100644 (file)
@@ -533,6 +533,16 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
                         ret = TRUE;
                     }
                     break;
+                case GDK_Q:
+                case GDK_q:
+                                       if (desktop->quick_zoomed()) {
+                                               ret = TRUE;
+                                       }
+                    if (!MOD__SHIFT && !MOD__CTRL && !MOD__ALT) {
+                                               desktop->zoom_quick(true);
+                        ret = TRUE;
+                    }
+                    break;
                 case GDK_W:
                 case GDK_w:
                 case GDK_F4:
@@ -628,6 +638,13 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
                         ret= TRUE;
                     } 
                     break;
+                case GDK_Q:
+                case GDK_q:
+                                       if (desktop->quick_zoomed()) {
+                                               desktop->zoom_quick(false);
+                        ret = TRUE;
+                    }
+                    break;
                 default:
                     break;
             }
index c67a62bf2b4bc6b46dae9bd5420d42610f795ed1..9505ac779c51229ed91cac9056e49d3779dc6c02 100644 (file)
@@ -64,7 +64,7 @@ public:
     typedef std::list<Input *> InputList;
     typedef std::list<Effect *> EffectList;
 
-    InputList  &get_input_list (InputList &ou_list);
+    InputList  &get_input_list  (InputList &ou_list);
     OutputList &get_output_list (OutputList &ou_list);
     EffectList &get_effect_list (EffectList &ou_list);
 }; /* class DB */
index 1f6d973c33e8b065d3f4415239b275ab974bc5af..9475b479623ed6e98865d48cd5baf03c8bf5a6e2 100644 (file)
  * Released under GNU GPL, read the file 'COPYING' for more information
  */
 
-/*
-TODO:
-FIXME:
-  After Inkscape makes a formal requirement for a GTK version above 2.11.4, please
-  replace all the instances of ink_ext_XXXXXX in this file that represent
-  svg files with ink_ext_XXXXXX.svg . Doing so will prevent errors in extensions
-  that call inkscape to manipulate the file.
-
-  "** (inkscape:5848): WARNING **: Format autodetect failed. The file is being opened as SVG."
-
-  references:
-  http://www.gtk.org/api/2.6/glib/glib-File-Utilities.html#g-mkstemp
-  http://ftp.gnome.org/pub/gnome/sources/glib/2.11/glib-2.11.4.changes
-  http://developer.gnome.org/doc/API/2.0/glib/glib-File-Utilities.html#g-mkstemp
-
-  --Aaron Spike
-*/
 #define __INKSCAPE_EXTENSION_IMPLEMENTATION_SCRIPT_C__
 
 #ifdef HAVE_CONFIG_H
@@ -77,19 +60,18 @@ namespace Inkscape {
 namespace Extension {
 namespace Implementation {
 
-void pump_events (void) {
+/** \brief  Make GTK+ events continue to come through a little bit
+       
+       This just keeps coming the events through so that we'll make the GUI
+       update and look pretty.
+*/
+void
+Script::pump_events (void) {
     while( Gtk::Main::events_pending() )
         Gtk::Main::iteration();
     return;
 }
 
-//Interpreter lookup table
-struct interpreter_t {
-        gchar const *identity;
-        gchar const *prefstring;
-        gchar const *defaultval;
-};
-
 
 /** \brief  A table of what interpreters to call for a given language
 
@@ -97,7 +79,7 @@ struct interpreter_t {
     given script.  It also tracks the preference to use to overwrite
     the given interpreter to a custom one per user.
 */
-static interpreter_t const interpreterTab[] = {
+Script::interpreter_t const Script::interpreterTab[] = {
         {"perl",   "perl-interpreter",   "perl"   },
 #ifdef WIN32
         {"python", "python-interpreter", "pythonw" },
@@ -111,12 +93,13 @@ static interpreter_t const interpreterTab[] = {
 
 
 
-/**
- * Look up an interpreter name, and translate to something that
- * is executable
- */
-static Glib::ustring
-resolveInterpreterExecutable(const Glib::ustring &interpNameArg)
+/** \brief Look up an interpreter name, and translate to something that
+           is executable
+    \param interpNameArg  The name of the interpreter that we're looking
+                             for, should be an entry in interpreterTab
+*/
+Glib::ustring
+Script::resolveInterpreterExecutable(const Glib::ustring &interpNameArg)
 {
 
     Glib::ustring interpName = interpNameArg;
@@ -184,8 +167,6 @@ resolveInterpreterExecutable(const Glib::ustring &interpNameArg)
     return interpName;
 }
 
-
-
 /** \brief     This function creates a script object and sets up the
                variables.
     \return    A script object
@@ -199,7 +180,6 @@ Script::Script() :
 {
 }
 
-
 /**
  *   brief     Destructor
  */
@@ -573,7 +553,7 @@ Script::open(Inkscape::Extension::Input *module,
     std::string tempfilename_out;
     int tempfd_out = 0;
     try {
-        tempfd_out = Inkscape::IO::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX");
+        tempfd_out = Inkscape::IO::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX.svg");
     } catch (...) {
         /// \todo Popup dialog here
         return NULL;
@@ -647,7 +627,7 @@ Script::save(Inkscape::Extension::Output *module,
     std::string tempfilename_in;
     int tempfd_in = 0;
     try {
-        tempfd_in = Inkscape::IO::file_open_tmp(tempfilename_in, "ink_ext_XXXXXX");
+        tempfd_in = Inkscape::IO::file_open_tmp(tempfilename_in, "ink_ext_XXXXXX.svg");
     } catch (...) {
         /// \todo Popup dialog here
         return;
index 226a6beb2d69d44380a1c1b9eb88bc9a9d7eae8f..4620375f928f584dfc320eb09f64cd41b32b4fdc 100644 (file)
@@ -199,6 +199,20 @@ private:
                  const std::list<std::string> &in_params,
                  const Glib::ustring &filein,
                  file_listener &fileout);
+
+       void pump_events (void);
+
+       /** \brief  A definition of an interpreter, which can be specified
+                   in the INX file, but we need to know what to call */
+       struct interpreter_t {
+                       gchar const *identity;    /**< The ID that is in the INX file */
+                       gchar const *prefstring;  /**< The preferences key that can override the default */
+                       gchar const *defaultval;  /**< The default value if there are no preferences */
+       };
+    static interpreter_t const interpreterTab[];
+
+       Glib::ustring resolveInterpreterExecutable(const Glib::ustring &interpNameArg);
+
 }; // class Script
 
 
index c7a9331a0ab3dc10bfbc00c9975b74b07d2ad2aa..640bf143df51f85321d8ec5d6928352e5c31ba60 100644 (file)
@@ -31,7 +31,7 @@ bool ExpirationTimer::timer_started = false;
     This function creates the timer, and sets the time to the current
     time, plus what ever the current timeout is.  Also, if this is
     the first timer extension, the timer is kicked off.  This function
-    also sets up teh circularly linked list of all the timers.
+    also sets up the circularly linked list of all the timers.
 */
 ExpirationTimer::ExpirationTimer (Extension * in_extension):
     locked(0),
index 6a0971ac7f92252f8b355db9a5342240f8a6f6e3..dca23d5396fd8e294e3082b41d3ae4d31152f465 100644 (file)
@@ -147,12 +147,7 @@ static void (* fpe_handler)  (int) = SIG_DFL;
 static void (* ill_handler)  (int) = SIG_DFL;
 static void (* bus_handler)  (int) = SIG_DFL;
 
-#ifdef WIN32
 #define INKSCAPE_PROFILE_DIR "Inkscape"
-#else
-#define INKSCAPE_PROFILE_DIR ".inkscape"
-#endif
-
 #define MENUS_FILE "menus.xml"
 
 
@@ -626,20 +621,20 @@ inkscape_crash_handler (int /*signum*/)
 
             if (!docname || !*docname) docname = "emergency";
             // try saving to the profile location
-            g_snprintf (c, 1024, "%.256s.%s.%d", docname, sptstr, count);
+            g_snprintf (c, 1024, "%.256s.%s.%d.svg", docname, sptstr, count);
             gchar * location = homedir_path(c);
             Inkscape::IO::dump_fopen_call(location, "E");
             file = Inkscape::IO::fopen_utf8name(location, "w");
             g_free(location);
             if (!file) {
                 // try saving to /tmp
-                g_snprintf (c, 1024, "/tmp/inkscape-%.256s.%s.%d", docname, sptstr, count);
+                g_snprintf (c, 1024, "/tmp/inkscape-%.256s.%s.%d.svg", docname, sptstr, count);
                 Inkscape::IO::dump_fopen_call(c, "G");
                 file = Inkscape::IO::fopen_utf8name(c, "w");
             }
             if (!file) {
                 // try saving to the current directory
-                g_snprintf (c, 1024, "inkscape-%.256s.%s.%d", docname, sptstr, count);
+                g_snprintf (c, 1024, "inkscape-%.256s.%s.%d.svg", docname, sptstr, count);
                 Inkscape::IO::dump_fopen_call(c, "F");
                 file = Inkscape::IO::fopen_utf8name(c, "w");
             }
@@ -1392,7 +1387,7 @@ profile_path(const char *filename)
         }
 #endif
         if (!prefdir) {
-            prefdir = homedir_path(NULL);
+            prefdir = homedir_path(".config");
         }
     }
     return g_build_filename(prefdir, INKSCAPE_PROFILE_DIR, filename, NULL);
index 5abf8d8db4370e8f28584c860bc61fa13d205ecd..35e7bf9571a49751993928eedafe6da2a372076a 100644 (file)
@@ -633,14 +633,18 @@ checkitem_toggled(GtkCheckMenuItem *menuitem, gpointer user_data)
     gchar const *pref = (gchar const *) user_data;
     Inkscape::UI::View::View *view = (Inkscape::UI::View::View *) g_object_get_data(G_OBJECT(menuitem), "view");
 
-    gchar const *pref_path;
-    if (reinterpret_cast<SPDesktop*>(view)->is_fullscreen())
+    gchar *pref_path;
+    if (reinterpret_cast<SPDesktop*>(view)->is_focusMode()) {
+        pref_path = g_strconcat("focus.", pref, NULL);
+    } else if (reinterpret_cast<SPDesktop*>(view)->is_fullscreen()) {
         pref_path = g_strconcat("fullscreen.", pref, NULL);
-    else
+    } else {
         pref_path = g_strconcat("window.", pref, NULL);
+       }
 
     gboolean checked = gtk_check_menu_item_get_active(menuitem);
     prefs_set_int_attribute(pref_path, "state", checked);
+       g_free(pref_path);
 
     reinterpret_cast<SPDesktop*>(view)->layoutWidget();
 }
index 84aadff3cae8f680d37a34201c33cfa36d9cc9a1..78ebca38470774152a10c28789fff6b5a84ebee3 100644 (file)
@@ -197,7 +197,7 @@ PathParam::param_editOncanvas(SPItem * item, SPDesktop * dt)
 {
     // If not already in nodecontext, goto it!
     if (!tools_isactive(dt, TOOLS_NODES)) {
-        tools_switch_current(TOOLS_NODES);
+        tools_switch(dt, TOOLS_NODES);
     }
 
     ShapeEditor * shape_editor = SP_NODE_CONTEXT( dt->event_context )->shape_editor;
index bd4f8535ee74fe19b16c6de2a094b706e0948393..680d4f0feb95bc19f25d710d553790a109f66584 100644 (file)
@@ -134,6 +134,8 @@ static char const menus_skeleton[] =
 "       <verb verb-id=\"ViewNew\" />\n"
 "       <separator/>\n"
 "       <verb verb-id=\"FullScreen\" />\n"
+// Not quite ready to be in the menus.
+// "       <verb verb-id=\"FocusToggle\" />\n"
 "   </submenu>\n"
 "   <submenu name=\"" N_("_Layer") "\">\n"
 "       <verb verb-id=\"LayerNew\" />\n"
index 907d47be443b391f387ff9535798b182f7fdf758..336c9019ce12282a7896630ad1fb12977ac384f5 100644 (file)
@@ -300,6 +300,8 @@ void sp_nodepath_select_segment_near_point(Inkscape::NodePath::Path *nodepath, G
 void sp_nodepath_add_node_near_point(Inkscape::NodePath::Path *nodepath, Geom::Point p);
 void sp_nodepath_curve_drag(Inkscape::NodePath::Path *nodepath, int node, double t, Geom::Point delta);
 Inkscape::NodePath::Node * sp_nodepath_get_node_by_index(Inkscape::NodePath::Path *np, int index);
+bool sp_node_side_is_line (Inkscape::NodePath::Node *node, Inkscape::NodePath::NodeSide *side);
+
 /* possibly private functions */
 
 void sp_node_selected_add_node (Inkscape::NodePath::Path *nodepath);
index 3ca113e856328e0468fc97403d7f547f059dc672..6cf1b3feb0723f68eb4c530d71e7c5aee83e14e4 100644 (file)
@@ -27,6 +27,16 @@ static char const preferences_skeleton[] =
 "    <group id=\"rulers\" state=\"1\"/>\n"
 "    <group id=\"scrollbars\" state=\"1\"/>\n"
 "  </group>\n"
+"  <group id=\"focus\">\n"
+"    <group id=\"menu\" state=\"0\"/>\n"
+"    <group id=\"commands\" state=\"0\"/>\n"
+"    <group id=\"toppanel\" state=\"0\"/>\n"
+"    <group id=\"toolbox\" state=\"0\"/>\n"
+"    <group id=\"statusbar\" state=\"0\"/>\n"
+"    <group id=\"panels\" state=\"0\"/>\n"
+"    <group id=\"rulers\" state=\"0\"/>\n"
+"    <group id=\"scrollbars\" state=\"0\"/>\n"
+"  </group>\n"
 "\n"
 "  <group id=\"documents\">\n"
 "    <group id=\"recent\"/>\n"
@@ -185,6 +195,15 @@ static char const preferences_skeleton[] =
 "    <group id=\"colorpickerwindow\" />\n"
 "    <group id=\"undo-history\" />\n"
 "    <group id=\"filtereffects\" />\n"
+"    <group id=\"transparency\"\n"
+"       on-focus=\"1.0\"\n"
+"       on-blur=\"0.50\"\n"
+#ifdef WIN32
+"       animate-time=\"0\"\n" // apparently windows sucks (flickers)
+#else
+"       animate-time=\"100\"\n" // time to change in ms
+#endif
+"      />\n"
 "  </group>\n"
 "  <group id=\"printing\">\n"
 "    <settings id=\"ps\"/>\n"
@@ -299,6 +318,8 @@ static char const preferences_skeleton[] =
 "  </group>\n"
 "\n"
 "  <group id=\"extensions\">"
+// NOTE: This gets filled in by the extensions themselves based on
+// the properties that they provide in their INX files.
 "  </group>\n"
 "\n"
 "  <group id=\"desktop\""
index 5e089a87a419af7464383bfe735de814b27e355d..591cc795dcb627cd6799e470c7efea7f816232b5 100644 (file)
@@ -1688,7 +1688,7 @@ void sp_selection_edit_clip_or_mask(SPDesktop * dt, bool clip)
                     if ( SP_IS_ITEM(child) ) {
                         // If not already in nodecontext, goto it!
                         if (!tools_isactive(dt, TOOLS_NODES)) {
-                            tools_switch_current(TOOLS_NODES);
+                            tools_switch(dt, TOOLS_NODES);
                         }
 
                         ShapeEditor * shape_editor = SP_NODE_CONTEXT( dt->event_context )->shape_editor;
index 6ee162f1db6f8a89a8c1fbf1391ce23aa425ea54..da03ab7bf2b5be53bc197648c98583256d5b6873 100644 (file)
@@ -258,13 +258,6 @@ tools_switch(SPDesktop *dt, int num)
     }
 }
 
-void
-tools_switch_current(int num)
-{
-    SPDesktop *dt = SP_ACTIVE_DESKTOP;
-    if (dt) tools_switch(dt, num);
-}
-
 void tools_switch_by_item(SPDesktop *dt, SPItem *item)
 {
     if (SP_IS_RECT(item)) {
index 2026c1a3d257591a086a73c6c7bf4720178696ff..38b83b226329f6505293c6477db5a257aafc3058 100644 (file)
@@ -40,7 +40,6 @@ enum {
 int tools_isactive(SPDesktop *dt, unsigned num);
 int tools_active(SPDesktop *dt);
 void tools_switch(SPDesktop *dt, int num);
-void tools_switch_current(int num);
 void tools_switch_by_item (SPDesktop *dt, SPItem *item);
 
 #endif /* !SEEN_TOOLS_SWITCH_H */
index f670c64106f9b38b0af7ad93273ba0d6a732ec9f..9f5571b4b9a859cd2ac9d363bf25674017c8156f 100644 (file)
@@ -32,6 +32,13 @@ namespace Behavior {
 FloatingBehavior::FloatingBehavior(Dialog &dialog) :
     Behavior(dialog),
     _d (new Gtk::Dialog(_dialog._title))
+#if GTK_VERSION_GE(2, 12)
+       ,_dialog_active(_d->property_is_active())
+       ,_steps(0)
+       ,_trans_focus(prefs_get_double_attribute_limited("dialogs.transparency", "on-focus", 0.95, 0.0, 1.0))
+       ,_trans_blur(prefs_get_double_attribute_limited("dialogs.transparency", "on-blur", 0.50, 0.0, 1.0))
+       ,_trans_time(prefs_get_int_attribute_limited("dialogs.transparency", "animate-time", 100, 0, 5000))
+#endif
 {
     hide();
     _d->set_has_separator(false);
@@ -40,8 +47,83 @@ FloatingBehavior::FloatingBehavior(Dialog &dialog) :
 
     sp_transientize(GTK_WIDGET(_d->gobj()));
     _dialog.retransientize_suppress = false;
+
+#if GTK_VERSION_GE(2, 12)
+       _focus_event();
+       _dialog_active.signal_changed().connect(sigc::mem_fun(this, &FloatingBehavior::_focus_event));
+#endif
+
+}
+
+#if GTK_VERSION_GE(2, 12)
+/** \brief  A function called when the window gets focus
+
+       This function gets called on a focus event.  It figures out how much
+       time is required for a transition, and the number of steps that'll take,
+       and sets up the _trans_timer function to do the work.  If the transition
+       time is set to 0 ms it just calls _trans_timer once with _steps equal to
+       zero so that the transition happens instantaneously.  This occurs on
+       windows as opacity changes cause flicker there.
+*/
+void FloatingBehavior::_focus_event (void) {
+       _steps = 0;
+       _trans_focus = prefs_get_double_attribute_limited("dialogs.transparency", "on-focus", 0.95, 0.0, 1.0);
+       _trans_blur = prefs_get_double_attribute_limited("dialogs.transparency", "on-blur", 0.50, 0.0, 1.0);
+       _trans_time = prefs_get_int_attribute_limited("dialogs.transparency", "animate-time", 100, 0, 5000);
+
+       if (_trans_time != 0) {
+               float diff = _trans_focus - _trans_blur;
+               if (diff < 0.0) diff *= -1.0;
+
+               while (diff > 0.05) {
+                       _steps++;
+                       diff = diff / 2.0;
+               }
+
+               if (_steps != 0) {
+                       Glib::signal_timeout().connect(sigc::mem_fun(this, &FloatingBehavior::_trans_timer), _trans_time / _steps);
+               }
+       }
+       _trans_timer();
+
+       return;
 }
 
+/** \brief  Move the opacity of a window towards our goal
+
+       This is a timer function that is set up by _focus_event to slightly
+       move the opacity of the window along in an animated fashion.  It moves
+       the opacity half way to the goal until it runs out of steps, and then
+       it just forces the goal.
+*/
+bool FloatingBehavior::_trans_timer (void) {
+       // printf("Go go gadget timer: %d\n", _steps);
+       if (_steps == 0) {
+               if (_dialog_active.get_value()) {
+                       _d->set_opacity(_trans_focus);
+               } else {
+                       _d->set_opacity(_trans_blur);
+               }
+
+               return false;
+       }
+
+       float goal, current;
+       goal = current = _d->get_opacity();
+
+       if (_dialog_active.get_value()) {
+               goal = _trans_focus;
+       } else {
+               goal = _trans_blur;
+       }
+       
+       _d->set_opacity(current - ((current - goal) / 2));
+       _steps--;
+       return true;
+}
+
+#endif
+
 FloatingBehavior::~FloatingBehavior() 
 { 
     delete _d;
index a7e6ef3a047bac0fb495c29382e1c010290a6e5d..0ab2d6981cc35843ca599d33d98aa577c2c4f48c 100644 (file)
@@ -14,6 +14,7 @@
 #define INKSCAPE_UI_DIALOG_FLOATING_BEHAVIOR_H
 
 #include <gtkmm/dialog.h>
+#include <glibmm/property.h>
 #include "behavior.h"
 
 namespace Inkscape {
@@ -62,6 +63,17 @@ private:
 
     Gtk::Dialog *_d;   //< the actual dialog
 
+#if GTK_VERSION_GE(2, 12)
+       void _focus_event (void);
+       bool _trans_timer (void);
+
+       Glib::PropertyProxy_ReadOnly<bool> _dialog_active;  //< Variable proxy to track whether the dialog is the active window
+       int _steps;          //< Number of steps for the timer to animate the transparent dialog
+       float _trans_focus;  //< The percentage opacity when the dialog is focused
+       float _trans_blur;   //< The percentage opactiy when the dialog is not focused
+       int _trans_time;     //< The amount of time (in ms) for the dialog to change it's transparency
+#endif
+
 };
 
 } // namespace Behavior
index 2eec6347890d31b6a42927cfce777422e2f1b25b..e2e717c534319bfb88c5919c182c1534c9dbd62f 100644 (file)
@@ -513,11 +513,11 @@ void InkscapePreferences::initPageWindows()
     _win_ontop_agressive.init ( _("Aggressive"), "options.transientpolicy", "value", 2, false, &_win_ontop_none);
 
     _page_windows.add_group_header( _("Saving window geometry (size and position):"));
-    _page_windows.add_line( false, "", _win_save_geom_off, "",
+    _page_windows.add_line( true, "", _win_save_geom_off, "",
                             _("Let the window manager determine placement of all windows"));
-    _page_windows.add_line( false, "", _win_save_geom_prefs, "",
+    _page_windows.add_line( true, "", _win_save_geom_prefs, "",
                             _("Remember and use the last window's geometry (saves geometry to user preferences)"));
-    _page_windows.add_line( false, "", _win_save_geom, "",
+    _page_windows.add_line( true, "", _win_save_geom, "",
                             _("Save and restore window geometry for each document (saves geometry in the document)"));
 
     _page_windows.add_group_header( _("Dialog behavior (requires restart):"));
@@ -537,6 +537,16 @@ void InkscapePreferences::initPageWindows()
                             _("Same as Normal but may work better with some window managers"));
 #endif
 
+#if GTK_VERSION_GE(2, 12)
+       _page_windows.add_group_header( _("Dialog Transparency:"));
+       _win_trans_focus.init("dialogs.transparency", "on-focus", 0.5, 1.0, 0.01, 0.1, 1.0, false, false);
+       _page_windows.add_line( true, _("Opacity when focused:"), _win_trans_focus, "", "");
+       _win_trans_blur.init("dialogs.transparency", "on-blur", 0.0, 1.0, 0.01, 0.1, 0.5, false, false);
+       _page_windows.add_line( true, _("Opacity when unfocused:"), _win_trans_blur, "", "");
+       _win_trans_time.init("dialogs.transparency", "animate-time", 0, 1000, 10, 100, 100, true, false);
+       _page_windows.add_line( true, _("Time of opacity change animation:"), _win_trans_time, "ms", "");
+#endif
+
     _page_windows.add_group_header( _("Miscellaneous:"));
 #ifndef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs
     _page_windows.add_line( false, "", _win_hide_task, "",
index 30dd2bdaab96307275451249b22192eb46f94fd2..02794d0e223b47052cb8046b5e4c51ad032e4382 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <iostream>
 #include <vector>
+#include <gtkmm/base.h>
 #include <gtkmm/table.h>
 #include <gtkmm/colorbutton.h>
 #include <gtkmm/comboboxtext.h>
@@ -140,6 +141,9 @@ protected:
     PrefRadioButton _win_ontop_none, _win_ontop_normal, _win_ontop_agressive;
     PrefRadioButton _win_save_geom_off, _win_save_geom, _win_save_geom_prefs;
     PrefCheckButton _win_hide_task, _win_zoom_resize , _win_show_close;
+       PrefSpinButton _win_trans_focus; /**< The dialog transparency setting for when the dialog is focused. */
+       PrefSpinButton _win_trans_blur;  /**< The dialog transparency setting for when the dialog is out of focus. */
+       PrefSpinButton _win_trans_time;  /**< How much time to go from one transparency setting to another */
 
     PrefCheckButton _calligrapy_use_abs_size;
     PrefCheckButton _calligrapy_keep_selected;
index 71ec33b3f62e423f13bc34c7675210cb2f4c5185..c1e7e5fc93b9f383c0f538efb09530bb4e763b8d 100644 (file)
@@ -1070,13 +1070,12 @@ SelectionVerb::perform(SPAction *action, void *data, void */*pdata*/)
             break;
         case SP_VERB_SELECTION_DYNAMIC_OFFSET:
             sp_selected_path_create_offset_object_zero(dt);
-            tools_switch_current(TOOLS_NODES);
+            tools_switch(dt, TOOLS_NODES);
             break;
         case SP_VERB_SELECTION_LINKED_OFFSET:
             sp_selected_path_create_updating_offset_object_zero(dt);
-            tools_switch_current(TOOLS_NODES);
+            tools_switch(dt, TOOLS_NODES);
             break;
-
         case SP_VERB_SELECTION_OUTLINE:
             sp_selected_path_outline(dt);
             break;
@@ -1434,61 +1433,61 @@ ContextVerb::perform(SPAction *action, void *data, void */*pdata*/)
 
     switch (verb) {
         case SP_VERB_CONTEXT_SELECT:
-            tools_switch_current(TOOLS_SELECT);
+            tools_switch(dt, TOOLS_SELECT);
             break;
         case SP_VERB_CONTEXT_NODE:
-            tools_switch_current(TOOLS_NODES);
+            tools_switch(dt, TOOLS_NODES);
             break;
         case SP_VERB_CONTEXT_TWEAK:
-            tools_switch_current(TOOLS_TWEAK);
+            tools_switch(dt, TOOLS_TWEAK);
             break;
         case SP_VERB_CONTEXT_RECT:
-            tools_switch_current(TOOLS_SHAPES_RECT);
+            tools_switch(dt, TOOLS_SHAPES_RECT);
             break;
         case SP_VERB_CONTEXT_3DBOX:
-            tools_switch_current(TOOLS_SHAPES_3DBOX);
+            tools_switch(dt, TOOLS_SHAPES_3DBOX);
             break;
         case SP_VERB_CONTEXT_ARC:
-            tools_switch_current(TOOLS_SHAPES_ARC);
+            tools_switch(dt, TOOLS_SHAPES_ARC);
             break;
         case SP_VERB_CONTEXT_STAR:
-            tools_switch_current(TOOLS_SHAPES_STAR);
+            tools_switch(dt, TOOLS_SHAPES_STAR);
             break;
         case SP_VERB_CONTEXT_SPIRAL:
-            tools_switch_current(TOOLS_SHAPES_SPIRAL);
+            tools_switch(dt, TOOLS_SHAPES_SPIRAL);
             break;
         case SP_VERB_CONTEXT_PENCIL:
-            tools_switch_current(TOOLS_FREEHAND_PENCIL);
+            tools_switch(dt, TOOLS_FREEHAND_PENCIL);
             break;
         case SP_VERB_CONTEXT_PEN:
-            tools_switch_current(TOOLS_FREEHAND_PEN);
+            tools_switch(dt, TOOLS_FREEHAND_PEN);
             break;
         case SP_VERB_CONTEXT_CALLIGRAPHIC:
-            tools_switch_current(TOOLS_CALLIGRAPHIC);
+            tools_switch(dt, TOOLS_CALLIGRAPHIC);
             break;
         case SP_VERB_CONTEXT_TEXT:
-            tools_switch_current(TOOLS_TEXT);
+            tools_switch(dt, TOOLS_TEXT);
             break;
         case SP_VERB_CONTEXT_GRADIENT:
-            tools_switch_current(TOOLS_GRADIENT);
+            tools_switch(dt, TOOLS_GRADIENT);
             break;
         case SP_VERB_CONTEXT_ZOOM:
-            tools_switch_current(TOOLS_ZOOM);
+            tools_switch(dt, TOOLS_ZOOM);
             break;
         case SP_VERB_CONTEXT_DROPPER:
-            tools_switch_current(TOOLS_DROPPER);
+            tools_switch(dt, TOOLS_DROPPER);
             break;
         case SP_VERB_CONTEXT_CONNECTOR:
-            tools_switch_current (TOOLS_CONNECTOR);
+            tools_switch(dt,  TOOLS_CONNECTOR);
             break;
         case SP_VERB_CONTEXT_PAINTBUCKET:
-            tools_switch_current(TOOLS_PAINTBUCKET);
+            tools_switch(dt, TOOLS_PAINTBUCKET);
             break;
         case SP_VERB_CONTEXT_ERASER:
-            tools_switch_current(TOOLS_ERASER);
+            tools_switch(dt, TOOLS_ERASER);
             break;
         case SP_VERB_CONTEXT_LPETOOL:
-            tools_switch_current(TOOLS_LPETOOL);
+            tools_switch(dt, TOOLS_LPETOOL);
             break;
 
         case SP_VERB_CONTEXT_SELECT_PREFS:
@@ -1702,6 +1701,9 @@ ZoomVerb::perform(SPAction *action, void *data, void */*pdata*/)
             dt->fullscreen();
             break;
 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
+        case SP_VERB_FOCUSTOGGLE:
+            dt->focusMode(!dt->is_focusMode());
+            break;
         case SP_VERB_VIEW_NEW:
             sp_ui_new_view();
             break;
@@ -2572,6 +2574,8 @@ Verb *Verb::_base_verbs[] = {
     new ZoomVerb(SP_VERB_FULLSCREEN, "FullScreen", N_("_Fullscreen"), N_("Stretch this document window to full screen"),
                  "view-fullscreen"),
 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
+    new ZoomVerb(SP_VERB_FOCUSTOGGLE, "FocusToggle", N_("Toggle _Focus Mode"), N_("Remove excess toolbars to focus on drawing"),
+                 NULL),
     new ZoomVerb(SP_VERB_VIEW_NEW, "ViewNew", N_("Duplic_ate Window"), N_("Open a new window with the same document"),
                  "window-new"),
     new ZoomVerb(SP_VERB_VIEW_NEW_PREVIEW, "ViewNewPreview", N_("_New View Preview"),
index 2362f23aac6398f6cd7291fa63d880d137e1c7cc..8ae12f422b37ca5a8f84e914675c71127111e0bf 100644 (file)
@@ -205,6 +205,7 @@ enum {
 #ifdef HAVE_GTK_WINDOW_FULLSCREEN
     SP_VERB_FULLSCREEN,
 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
+    SP_VERB_FOCUSTOGGLE,
     SP_VERB_VIEW_NEW,
     SP_VERB_VIEW_NEW_PREVIEW,
     SP_VERB_VIEW_MODE_NORMAL,
index aae34ed98166b5b13dceaed05b7cf9fc7fb72bdc..f7e2c3f2776f6635c20a2f7f89ea7cc0463248a5 100644 (file)
@@ -1194,48 +1194,72 @@ sp_desktop_widget_fullscreen(SPDesktopWidget *dtw)
 void
 sp_desktop_widget_layout (SPDesktopWidget *dtw)
 {
-    bool fullscreen = dtw->desktop->is_fullscreen();
+       gchar * pref_path = NULL;
+       gchar const * pref_root = NULL;
+
+       if (dtw->desktop->is_focusMode()) {
+               pref_root = "focus.";
+       } else if (dtw->desktop->is_fullscreen()) {
+               pref_root = "fullscreen.";
+       } else {
+               pref_root = "window.";
+       }
+
+       pref_path = g_strconcat(pref_root, "menu", NULL);
+
     Inkscape::Preferences *prefs = Inkscape::Preferences::get();
 
-    if (!prefs->getBool(( fullscreen ? "fullscreen.menu" : "window.menu" ), "state", true)) {
+    if (!prefs->getBool(pref_path, "state", true)) {
         gtk_widget_hide_all (dtw->menubar);
     } else {
         gtk_widget_show_all (dtw->menubar);
     }
+       g_free(pref_path);
 
-    if (!prefs->getBool(( fullscreen ? "fullscreen.commands" : "window.commands" ), "state", true)) {
+       pref_path = g_strconcat(pref_root, "commands", NULL);
+    if (!prefs->getBool(pref_path, "state", true)) {
         gtk_widget_hide_all (dtw->commands_toolbox);
     } else {
         gtk_widget_show_all (dtw->commands_toolbox);
     }
+       g_free(pref_path);
 
-    if (!prefs->getBool(( fullscreen ? "fullscreen.toppanel" : "window.toppanel" ), "state", true)) {
+       pref_path = g_strconcat(pref_root, "toppanel", NULL);
+    if (!prefs->getBool(pref_path, "state", true)) {
         gtk_widget_hide_all (dtw->aux_toolbox);
     } else {
         // we cannot just show_all because that will show all tools' panels;
         // this is a function from toolbox.cpp that shows only the current tool's panel
         show_aux_toolbox (dtw->aux_toolbox);
     }
+       g_free(pref_path);
 
-    if (!prefs->getBool(( fullscreen ? "fullscreen.toolbox" : "window.toolbox" ), "state", true)) {
+       pref_path = g_strconcat(pref_root, "toolbox", NULL);
+    if (!prefs->getBool(pref_path, "state", true)) {
         gtk_widget_hide_all (dtw->tool_toolbox);
     } else {
         gtk_widget_show_all (dtw->tool_toolbox);
     }
+       g_free(pref_path);
 
-    if (!prefs->getBool(( fullscreen ? "fullscreen.statusbar" : "window.statusbar" ), "state", true)) {
+       pref_path = g_strconcat(pref_root, "statusbar", NULL);
+    if (!prefs->getBool(pref_path, "state", true)) {
         gtk_widget_hide_all (dtw->statusbar);
     } else {
         gtk_widget_show_all (dtw->statusbar);
     }
+       g_free(pref_path);
 
-    if (!prefs->getBool(( fullscreen ? "fullscreen.panels" : "window.panels" ), "state", true)) {
+       pref_path = g_strconcat(pref_root, "panels", NULL);
+    if (!prefs->getBool(pref_path, "state", true)) {
         gtk_widget_hide_all( dtw->panels );
     } else {
         gtk_widget_show_all( dtw->panels );
     }
+       g_free(pref_path);
 
-    if (!prefs->getBool(( fullscreen ? "fullscreen.scrollbars" : "window.scrollbars" ), "state", true)) {
+       pref_path = g_strconcat(pref_root, "scrollbars", NULL);
+    if (!prefs->getBool(pref_path, "state", true)) {
         gtk_widget_hide_all (dtw->hscrollbar);
         gtk_widget_hide_all (dtw->vscrollbar_box);
         gtk_widget_hide_all( dtw->cms_adjust );
@@ -1244,14 +1268,19 @@ sp_desktop_widget_layout (SPDesktopWidget *dtw)
         gtk_widget_show_all (dtw->vscrollbar_box);
         gtk_widget_show_all( dtw->cms_adjust );
     }
+       g_free(pref_path);
 
-    if (!prefs->getBool(( fullscreen ? "fullscreen.rulers" : "window.rulers" ), "state", true)) {
+       pref_path = g_strconcat(pref_root, "rulers", NULL);
+    if (!prefs->getBool(pref_path, "state", true)) {
         gtk_widget_hide_all (dtw->hruler);
         gtk_widget_hide_all (dtw->vruler);
     } else {
         gtk_widget_show_all (dtw->hruler);
         gtk_widget_show_all (dtw->vruler);
     }
+       g_free(pref_path);
+
+       return;
 }
 
 void
index c6ac75d27652d79863cfa1b14790dfa775f0aff3..8e7b844d0601b77d468600115931c133ee8d1ac4 100644 (file)
@@ -13,8 +13,8 @@
  */
 
 #include <stdio.h>
+#include <gtk/gtkctree.h>
 #include <gtk/gtk.h>
-#include <gtk/gtkclist.h>
 #include "../xml/repr.h"