index 3c78eb0bb1f611aa962d552853762de9906e4bc7..356a09418de9439c8661762afcec391cfb44d1d4 100644 (file)
#include <gtkmm/paned.h>
#include <gtk/gtk.h>
-#include "macros.h"
-#include "inkscape-private.h"
-#include "desktop-handles.h"
+#include "box3d-context.h"
+#include "color-profile-fns.h"
+#include "conn-avoid-ref.h"
#include "desktop-events.h"
-#include "document.h"
+#include "desktop-handles.h"
#include "desktop-widget.h"
-#include "sp-namedview.h"
-#include "interface.h"
-#include "toolbox.h"
-#include "preferences.h"
-#include "file.h"
#include "display/canvas-arena.h"
#include "display/nr-arena.h"
+#include "document.h"
+#include "ege-color-prof-tracker.h"
+#include "ege-select-one-action.h"
#include <extension/db.h>
+#include "file.h"
#include "helper/units.h"
-#include "widgets/button.h"
-#include "widgets/ruler.h"
-#include "widgets/widget-sizes.h"
-#include "widgets/spw-utilities.h"
-#include "widgets/spinbutton-events.h"
-#include "widgets/layer-selector.h"
+#include "inkscape-private.h"
+#include "interface.h"
+#include "macros.h"
+#include "preferences.h"
+#include "sp-image.h"
+#include "sp-item.h"
+#include "sp-namedview.h"
+#include "toolbox.h"
#include "ui/dialog/dialog-manager.h"
+#include "ui/dialog/swatches.h"
#include "ui/widget/dock.h"
+#include "ui/widget/layer-selector.h"
#include "ui/widget/selected-style.h"
-#include "sp-item.h"
-#include "dialogs/swatches.h"
-#include "conn-avoid-ref.h"
-#include "ege-select-one-action.h"
-#include "ege-color-prof-tracker.h"
-#include "color-profile-fns.h"
-#include "box3d-context.h"
-#include "sp-image.h"
+#include "widgets/button.h"
+#include "widgets/ruler.h"
+#include "widgets/spinbutton-events.h"
+#include "widgets/spw-utilities.h"
+#include "widgets/toolbox.h"
+#include "widgets/widget-sizes.h"
#if defined (SOLARIS) && (SOLARIS == 8)
#include "round.h"
private:
static void hook(EgeColorProfTracker *tracker, gint a, gint b, CMSPrefWatcher *watcher);
-
+
class DisplayProfileWatcher : public Inkscape::Preferences::Observer {
public:
DisplayProfileWatcher(CMSPrefWatcher &pw) : Observer("/options/displayprofile"), _pw(pw) {}
- virtual void notify(Inkscape::Preferences::Entry const &val) {
+ virtual void notify(Inkscape::Preferences::Entry const &/*val*/) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
_pw._setCmsSensitive(!prefs->getString("/options/displayprofile/uri").empty());
_pw._refreshAll();
private:
CMSPrefWatcher &_pw;
};
-
+
DisplayProfileWatcher _dpw;
-
+
class SoftProofWatcher : public Inkscape::Preferences::Observer {
public:
SoftProofWatcher(CMSPrefWatcher &pw) : Observer("/options/softproof"), _pw(pw) {}
private:
CMSPrefWatcher &_pw;
};
-
+
SoftProofWatcher _spw;
-
+
void _refreshAll();
void _setCmsSensitive(bool value);
std::list<SPDesktopWidget*> _widget_list;
EgeColorProfTracker *_tracker;
-
+
friend class DisplayProfileWatcher;
friend class SoftproofWatcher;
};
GtkWidget *hbox;
GtkWidget *eventbox;
GtkStyle *style;
-
+
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
new (&dtw->modified_connection) sigc::connection();
dtw->aux_toolbox = sp_aux_toolbox_new ();
gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->aux_toolbox, FALSE, TRUE, 0);
+ dtw->snap_toolbox = sp_snap_toolbox_new ();
+ gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->snap_toolbox, FALSE, TRUE, 0);
+
dtw->commands_toolbox = sp_commands_toolbox_new ();
gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->commands_toolbox, FALSE, TRUE, 0);
void
SPDesktopWidget::setWindowTransient (void *p, int transient_policy)
{
- GtkWindow *w =GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(this)));
- if (w)
+ Gtk::Window *window = (Gtk::Window*)gtk_object_get_data (GTK_OBJECT(this), "window");
+ if (window)
{
+ GtkWindow *w = (GtkWindow *) window->gobj();
gtk_window_set_transient_for (GTK_WINDOW(p), w);
/*
* (so that its transients also could raise)
*/
if (transient_policy == 2)
-
// without this, a transient window not always emerges on top
gtk_window_present (w);
}
pref_root = "/window/";
}
+#ifndef GDK_WINDOWING_QUARTZ
if (!prefs->getBool(pref_root + "menu/state", true)) {
gtk_widget_hide_all (dtw->menubar);
} else {
gtk_widget_show_all (dtw->menubar);
}
+#endif
if (!prefs->getBool(pref_root + "commands/state", true)) {
gtk_widget_hide_all (dtw->commands_toolbox);
gtk_widget_show_all (dtw->commands_toolbox);
}
+ if (!prefs->getBool(pref_root + "snaptoolbox/state", true)) {
+ gtk_widget_hide_all (dtw->snap_toolbox);
+ } else {
+ gtk_widget_show_all (dtw->snap_toolbox);
+ }
+
if (!prefs->getBool(pref_root + "toppanel/state", true)) {
gtk_widget_hide_all (dtw->aux_toolbox);
} else {
SPViewWidget *
sp_desktop_widget_new (SPNamedView *namedview)
{
- SPDesktopWidget *dtw = (SPDesktopWidget*)gtk_type_new (SP_TYPE_DESKTOP_WIDGET);
+ SPDesktopWidget *dtw = (SPDesktopWidget*)g_object_new(SP_TYPE_DESKTOP_WIDGET, NULL);
dtw->dt2r = 1.0 / namedview->doc_units->unittobase;
dtw->layer_selector->setDesktop(dtw->desktop);
dtw->menubar = sp_ui_main_menubar (dtw->desktop);
+#ifndef GDK_WINDOWING_QUARTZ
gtk_widget_show_all (dtw->menubar);
gtk_box_pack_start (GTK_BOX (dtw->vbox), dtw->menubar, FALSE, FALSE, 0);
+#endif
sp_desktop_widget_layout (dtw);
sp_tool_toolbox_set_desktop (dtw->tool_toolbox, dtw->desktop);
sp_aux_toolbox_set_desktop (dtw->aux_toolbox, dtw->desktop);
sp_commands_toolbox_set_desktop (dtw->commands_toolbox, dtw->desktop);
+ sp_snap_toolbox_set_desktop (dtw->snap_toolbox, dtw->desktop);
return SP_VIEW_WIDGET (dtw);
}
@@ -1406,7 +1421,7 @@ sp_desktop_widget_namedview_modified (SPObject *obj, guint flags, SPDesktopWidge
{
SPNamedView *nv=SP_NAMEDVIEW(obj);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
- dtw->dt2r = 1.0 / nv->doc_units->unittobase;
+ dtw->dt2r = 1.0 / nv->doc_units->unittobase;
dtw->ruler_origin = Geom::Point(0,0); //nv->gridorigin; Why was the grid origin used here?
sp_ruler_set_metric (GTK_RULER (dtw->vruler), nv->getDefaultMetric());
@@ -1416,6 +1431,7 @@ sp_desktop_widget_namedview_modified (SPObject *obj, guint flags, SPDesktopWidge
gtk_tooltips_set_tip (dtw->tt, dtw->vruler_box, gettext(sp_unit_get_plural (nv->doc_units)), NULL);
sp_desktop_widget_update_rulers (dtw);
+ update_snap_toolbox(dtw->desktop, NULL, dtw->snap_toolbox);
}
}
Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) );
SPObject* root = doc->root;
SPItem* item = SP_ITEM(root);
- boost::optional<Geom::Rect> deskarea = Geom::unify(darea, sp_item_bbox_desktop(item));
+ Geom::OptRect deskarea = Geom::unify(darea, sp_item_bbox_desktop(item));
/* Canvas region we always show unconditionally */
Geom::Rect carea( Geom::Point(deskarea->min()[Geom::X] * scale - 64, deskarea->max()[Geom::Y] * -scale - 64),