From: gustav_b Date: Thu, 6 Sep 2007 00:32:22 +0000 (+0000) Subject: Prevented automatic center docking from happening and added the X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e6ab333964dd7ef6941edd00f4a43bb5b1bdb2ff;p=inkscape.git Prevented automatic center docking from happening and added the preference "options.dialogscancenterdock" to allow users to disable it completely. --- diff --git a/src/libgdl/gdl-dock-placeholder.c b/src/libgdl/gdl-dock-placeholder.c index 11c0d3127..c22ea038c 100644 --- a/src/libgdl/gdl-dock-placeholder.c +++ b/src/libgdl/gdl-dock-placeholder.c @@ -333,14 +333,11 @@ gdl_dock_placeholder_add (GtkContainer *container, GtkWidget *widget) { GdlDockPlaceholder *ph; - GdlDockPlacement pos = GDL_DOCK_CENTER; /* default position */ + GdlDockPlacement pos = GDL_DOCK_TOP; /* default position */ g_return_if_fail (GDL_IS_DOCK_PLACEHOLDER (container)); g_return_if_fail (GDL_IS_DOCK_ITEM (widget)); - if (GDL_DOCK_ITEM (widget)->behavior & GDL_DOCK_ITEM_BEH_CANT_DOCK_CENTER) - pos = GDL_DOCK_TOP; - ph = GDL_DOCK_PLACEHOLDER (container); if (ph->_priv->placement_stack) pos = (GdlDockPlacement) ph->_priv->placement_stack->data; diff --git a/src/libgdl/gdl-dock.c b/src/libgdl/gdl-dock.c index cb3e1b372..7c74791db 100644 --- a/src/libgdl/gdl-dock.c +++ b/src/libgdl/gdl-dock.c @@ -1077,17 +1077,11 @@ gdl_dock_refine_placement (GdlDock *dock, GdlDockItem *dock_item, if (placement == GDL_DOCK_LEFT || placement == GDL_DOCK_RIGHT) { /* Check if dock_object touches center in terms of width */ - if (GTK_WIDGET (dock)->allocation.width/2 > object_size.width && - !(dock_item->behavior & GDL_DOCK_ITEM_BEH_CANT_DOCK_CENTER)) { - return GDL_DOCK_CENTER; + if (GTK_WIDGET (dock)->allocation.width/2 > object_size.width) { + return GDL_DOCK_TOP; } - } else if (placement == GDL_DOCK_TOP || placement == GDL_DOCK_BOTTOM) { - /* Check if dock_object touches center in terms of height */ - if (GTK_WIDGET (dock)->allocation.height/2 > object_size.height && - !(dock_item->behavior & GDL_DOCK_ITEM_BEH_CANT_DOCK_CENTER)) { - return GDL_DOCK_CENTER; - } - } + } + return placement; } diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 208b822f2..97d399f28 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -196,6 +196,7 @@ static char const preferences_skeleton[] = " \n" " \n" " \n" +" \n" " \n" #ifdef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs " \n" diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 97f11f56e..46a2667c7 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -12,6 +12,7 @@ #include "dock-item.h" #include "desktop.h" #include "inkscape.h" +#include "prefs-utils.h" #include "ui/widget/dock.h" #include "widgets/icon.h" @@ -47,6 +48,11 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l } + GdlDockItemBehavior gdl_dock_behavior = + (prefs_get_int_attribute_limited ("options.dialogscancenterdock", "value", 1, 0, 1) == 0 ? + GDL_DOCK_ITEM_BEH_CANT_DOCK_CENTER + : GDL_DOCK_ITEM_BEH_NORMAL); + if (!icon_name.empty()) { Gtk::Widget *icon = sp_icon_get_icon(icon_name, Inkscape::ICON_SIZE_MENU); if (icon) { @@ -62,12 +68,12 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l delete icon; _gdl_dock_item = - gdl_dock_item_new_with_pixbuf_icon(name.c_str(), long_name.c_str(), _icon_pixbuf->gobj(), - GDL_DOCK_ITEM_BEH_NORMAL); + gdl_dock_item_new_with_pixbuf_icon(name.c_str(), long_name.c_str(), + _icon_pixbuf->gobj(), gdl_dock_behavior); } } else { _gdl_dock_item = - gdl_dock_item_new(name.c_str(), long_name.c_str(), GDL_DOCK_ITEM_BEH_NORMAL); + gdl_dock_item_new(name.c_str(), long_name.c_str(), gdl_dock_behavior); } _frame.set_shadow_type(Gtk::SHADOW_IN);