summaryrefslogtreecommitdiffstats
path: root/src/ui/widget
diff options
context:
space:
mode:
authorJohn Smith <john.smith7545@yahoo.com>2012-02-17 08:05:08 +0000
committerJohn Smith <removethis.john.q.public@bigmail.com>2012-02-17 08:05:08 +0000
commitafb80368d6bf4dc2a55b011c9a14fa4288d2fe84 (patch)
tree6ec54c830a6537271186388726542ca873ff7830 /src/ui/widget
parentDocumentation of the Text and Font dialog (diff)
downloadinkscape-afb80368d6bf4dc2a55b011c9a14fa4288d2fe84.tar.gz
inkscape-afb80368d6bf4dc2a55b011c9a14fa4288d2fe84.zip
Fix for 171579 : Make inkscape remember dialogs window status
(bzr r10992)
Diffstat (limited to 'src/ui/widget')
-rw-r--r--src/ui/widget/dock-item.cpp51
-rw-r--r--src/ui/widget/dock-item.h13
-rw-r--r--src/ui/widget/dock.cpp4
-rw-r--r--src/ui/widget/imagetoggler.cpp11
4 files changed, 63 insertions, 16 deletions
diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp
index 34c68284e..07098fa11 100644
--- a/src/ui/widget/dock-item.cpp
+++ b/src/ui/widget/dock-item.cpp
@@ -14,6 +14,7 @@
#include "inkscape.h"
#include "preferences.h"
#include "ui/widget/dock.h"
+#include "ui/icon-names.h"
#include "widgets/icon.h"
#include <gtkmm/icontheme.h>
@@ -24,7 +25,7 @@ namespace UI {
namespace Widget {
DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& long_name,
- const Glib::ustring& icon_name, State state) :
+ const Glib::ustring& icon_name, State state, Placement placement) :
_dock(dock),
_prev_state(state),
_prev_position(0),
@@ -41,8 +42,13 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l
GDL_DOCK_ITEM_BEH_NORMAL :
GDL_DOCK_ITEM_BEH_CANT_DOCK_CENTER);
+
if (!icon_name.empty()) {
Glib::RefPtr<Gtk::IconTheme> iconTheme = Gtk::IconTheme::get_default();
+
+ if (!iconTheme->has_icon(icon_name)) {
+ Inkscape::queueIconPrerender( INKSCAPE_ICON(icon_name.data()), Inkscape::ICON_SIZE_MENU );
+ }
// Icon might be in the icon theme, or might be a stock item. Check the proper source:
if ( iconTheme->has_icon(icon_name) ) {
int width = 0;
@@ -78,9 +84,14 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l
signal_delete_event().connect(sigc::mem_fun(*this, &Inkscape::UI::Widget::DockItem::_onDeleteEvent));
signal_realize().connect(sigc::mem_fun(*this, &Inkscape::UI::Widget::DockItem::_onRealize));
- _dock.addItem(*this, (_prev_state == FLOATING_STATE ? FLOATING : TOP));
+ _dock.addItem(*this, ( _prev_state == FLOATING_STATE || _prev_state == ICONIFIED_FLOATING_STATE ) ? FLOATING : placement);
+
+ if (_prev_state == ICONIFIED_FLOATING_STATE || _prev_state == ICONIFIED_DOCKED_STATE) {
+ iconify();
+ }
show_all();
+
}
DockItem::~DockItem()
@@ -198,7 +209,17 @@ DockItem::isIconified() const
DockItem::State
DockItem::getState() const
{
- return (isAttached() ? (isFloating() ? FLOATING_STATE : DOCKED_STATE) : UNATTACHED);
+ if (isIconified() && _prev_state == FLOATING_STATE) {
+ return ICONIFIED_FLOATING_STATE;
+ } else if (isIconified()) {
+ return ICONIFIED_DOCKED_STATE;
+ } else if (isFloating() && isAttached()) {
+ return FLOATING_STATE;
+ } else if (isAttached()) {
+ return DOCKED_STATE;
+ }
+
+ return UNATTACHED;
}
DockItem::State
@@ -210,10 +231,12 @@ DockItem::getPrevState() const
DockItem::Placement
DockItem::getPlacement() const
{
- GdlDockPlacement placement = (GdlDockPlacement)NONE;
- gdl_dock_object_child_placement(gdl_dock_object_get_parent_object (GDL_DOCK_OBJECT(_gdl_dock_item)),
- GDL_DOCK_OBJECT(_gdl_dock_item),
- &placement);
+ GdlDockPlacement placement = (GdlDockPlacement)TOP;
+ GdlDockObject *parent = gdl_dock_object_get_parent_object (GDL_DOCK_OBJECT(_gdl_dock_item));
+ if (parent) {
+ gdl_dock_object_child_placement(parent, GDL_DOCK_OBJECT(_gdl_dock_item), &placement);
+ }
+
return (Placement)placement;
}
@@ -230,6 +253,12 @@ DockItem::show()
}
void
+DockItem::iconify()
+{
+ gdl_dock_item_iconify_item (GDL_DOCK_ITEM(_gdl_dock_item));
+}
+
+void
DockItem::show_all()
{
gtk_widget_show_all(_gdl_dock_item);
@@ -239,10 +268,9 @@ void
DockItem::present()
{
- if (isIconified() || !isAttached()) {
+ if (!isIconified() && !isAttached()) {
show();
}
-
// tabbed
else if (getPlacement() == CENTER) {
int i = gtk_notebook_page_num(GTK_NOTEBOOK(gtk_widget_get_parent(_gdl_dock_item)),
@@ -338,6 +366,11 @@ DockItem::_onHideWindow()
void
DockItem::_onHide()
{
+ if (_prev_state == ICONIFIED_DOCKED_STATE)
+ _prev_state = DOCKED_STATE;
+ else if (_prev_state == ICONIFIED_FLOATING_STATE)
+ _prev_state = FLOATING_STATE;
+
_signal_state_changed.emit(UNATTACHED, getState());
}
diff --git a/src/ui/widget/dock-item.h b/src/ui/widget/dock-item.h
index 573307452..75ffea1a0 100644
--- a/src/ui/widget/dock-item.h
+++ b/src/ui/widget/dock-item.h
@@ -34,10 +34,12 @@ class DockItem {
public:
- enum State { UNATTACHED, // item not bound to the dock (a temporary state)
- FLOATING_STATE, // item not in its dock (but can be docked in other,
- // e.g. floating, docks)
- DOCKED_STATE }; // item in its assigned dock
+ enum State { UNATTACHED, // item not bound to the dock (a temporary state)
+ FLOATING_STATE, // item not in its dock (but can be docked in other,
+ // e.g. floating, docks)
+ DOCKED_STATE, // item in its assigned dock
+ ICONIFIED_DOCKED_STATE, // item iconified in its assigned dock from dock
+ ICONIFIED_FLOATING_STATE}; // item iconified in its assigned dock from float
enum Placement {
NONE = GDL_DOCK_NONE,
@@ -50,7 +52,7 @@ public:
};
DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& long_name,
- const Glib::ustring& icon_name, State state);
+ const Glib::ustring& icon_name, State state, Placement placement);
~DockItem();
@@ -80,6 +82,7 @@ public:
void hide();
void show();
+ void iconify();
void show_all();
void present();
diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp
index 62682b9dc..a6e983304 100644
--- a/src/ui/widget/dock.cpp
+++ b/src/ui/widget/dock.cpp
@@ -229,12 +229,14 @@ void Dock::_onLayoutChanged()
{
if (isEmpty()) {
if (hasIconifiedItems()) {
+ _paned->get_child1()->set_size_request(-1, -1);
_scrolled_window->set_size_request(_default_dock_bar_width);
} else {
+ _paned->get_child1()->set_size_request(-1, -1);
_scrolled_window->set_size_request(_default_empty_width);
}
-
getParentPaned()->set_position(INT_MAX);
+
} else {
// unset any forced size requests
_paned->get_child1()->set_size_request(-1, -1);
diff --git a/src/ui/widget/imagetoggler.cpp b/src/ui/widget/imagetoggler.cpp
index 073e071af..6517219f2 100644
--- a/src/ui/widget/imagetoggler.cpp
+++ b/src/ui/widget/imagetoggler.cpp
@@ -14,6 +14,8 @@
#include <gtkmm/icontheme.h>
#include "widgets/icon.h"
+#include "widgets/toolbox.h"
+#include "ui/icon-names.h"
namespace Inkscape {
namespace UI {
@@ -33,10 +35,17 @@ ImageToggler::ImageToggler( char const* on, char const* off) :
int phys = sp_icon_get_phys_size((int)Inkscape::ICON_SIZE_DECORATION);
Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default();
+ if (!icon_theme->has_icon(_pixOnName)) {
+ Inkscape::queueIconPrerender( INKSCAPE_ICON(_pixOnName.data()), Inkscape::ICON_SIZE_DECORATION );
+ }
+ if (!icon_theme->has_icon(_pixOffName)) {
+ Inkscape::queueIconPrerender( INKSCAPE_ICON(_pixOffName.data()), Inkscape::ICON_SIZE_DECORATION );
+ }
+
+
if (icon_theme->has_icon(_pixOnName)) {
_property_pixbuf_on = icon_theme->load_icon(_pixOnName, phys, (Gtk::IconLookupFlags)0);
}
-
if (icon_theme->has_icon(_pixOffName)) {
_property_pixbuf_off = icon_theme->load_icon(_pixOffName, phys, (Gtk::IconLookupFlags)0);
}