diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2006-05-23 09:17:37 +0000 |
|---|---|---|
| committer | joncruz <joncruz@users.sourceforge.net> | 2006-05-23 09:17:37 +0000 |
| commit | 9697981a95a44a3ef1d8c9a5caf919a9dc6f3bdc (patch) | |
| tree | 2d683fb6bae8ffaa5f25101e1faa5fe1be6e8bec /src/dialogs | |
| parent | * Use hardcoded sample string for font preview instead of the string from the... (diff) | |
| download | inkscape-9697981a95a44a3ef1d8c9a5caf919a9dc6f3bdc.tar.gz inkscape-9697981a95a44a3ef1d8c9a5caf919a9dc6f3bdc.zip | |
Panel refactoring
(bzr r976)
Diffstat (limited to 'src/dialogs')
| -rw-r--r-- | src/dialogs/layers-panel.cpp | 2 | ||||
| -rw-r--r-- | src/dialogs/swatches.cpp | 36 | ||||
| -rw-r--r-- | src/dialogs/swatches.h | 2 |
3 files changed, 35 insertions, 5 deletions
diff --git a/src/dialogs/layers-panel.cpp b/src/dialogs/layers-panel.cpp index 21b3102ef..ad2678141 100644 --- a/src/dialogs/layers-panel.cpp +++ b/src/dialogs/layers-panel.cpp @@ -581,7 +581,7 @@ void LayersPanel::_handleRowChange( Gtk::TreeModel::Path const& path, Gtk::TreeM * Constructor */ LayersPanel::LayersPanel() : - Inkscape::UI::Widget::Panel( "dialogs.layers" ), + Inkscape::UI::Widget::Panel( Glib::ustring(), "dialogs.layers" ), _maxNestDepth(20), _mgr(0), _desktop(0), diff --git a/src/dialogs/swatches.cpp b/src/dialogs/swatches.cpp index 31e91562b..dc9b6fdd6 100644 --- a/src/dialogs/swatches.cpp +++ b/src/dialogs/swatches.cpp @@ -30,6 +30,7 @@ #include "path-prefix.h" #include "swatches.h" #include "sp-item.h" +#include "prefs-utils.h" #include "eek-preview.h" @@ -915,15 +916,33 @@ SwatchesPanel& SwatchesPanel::getInstance() /** * Constructor */ -SwatchesPanel::SwatchesPanel() : - Inkscape::UI::Widget::Panel( "dialogs.swatches", true ), +SwatchesPanel::SwatchesPanel(gchar const* prefsPath) : + Inkscape::UI::Widget::Panel( Glib::ustring(), prefsPath, true ), _holder(0) { + Gtk::RadioMenuItem* hotItem = 0; _holder = new PreviewHolder(); loadEmUp(); if ( !possible.empty() ) { - JustForNow* first = possible.front(); + JustForNow* first = 0; + gchar const* targetName = 0; + if ( _prefs_path ) { + targetName = prefs_get_string_attribute( _prefs_path, "palette" ); + if ( targetName ) { + for ( std::vector<JustForNow*>::iterator iter = possible.begin(); iter != possible.end(); ++iter ) { + if ( (*iter)->_name == targetName ) { + first = *iter; + break; + } + } + } + } + + if ( !first ) { + first = possible.front(); + } + if ( first->_prefWidth > 0 ) { _holder->setColumnPref( first->_prefWidth ); } @@ -938,6 +957,9 @@ SwatchesPanel::SwatchesPanel() : for ( std::vector<JustForNow*>::iterator it = possible.begin(); it != possible.end(); it++ ) { JustForNow* curr = *it; Gtk::RadioMenuItem* single = manage(new Gtk::RadioMenuItem(groupOne, curr->_name)); + if ( curr == first ) { + hotItem = single; + } _regItem( single, 3, i ); i++; } @@ -951,6 +973,9 @@ SwatchesPanel::SwatchesPanel() : show_all_children(); restorePanelPrefs(); + if ( hotItem ) { + hotItem->set_active(); + } } SwatchesPanel::~SwatchesPanel() @@ -976,6 +1001,11 @@ void SwatchesPanel::_handleAction( int setId, int itemId ) if ( itemId >= 0 && itemId < static_cast<int>(possible.size()) ) { _holder->clear(); JustForNow* curr = possible[itemId]; + + if ( _prefs_path ) { + prefs_set_string_attribute( _prefs_path, "palette", curr->_name.c_str() ); + } + if ( curr->_prefWidth > 0 ) { _holder->setColumnPref( curr->_prefWidth ); } diff --git a/src/dialogs/swatches.h b/src/dialogs/swatches.h index 7e1357c48..02861781f 100644 --- a/src/dialogs/swatches.h +++ b/src/dialogs/swatches.h @@ -89,7 +89,7 @@ private: class SwatchesPanel : public Inkscape::UI::Widget::Panel { public: - SwatchesPanel(); + SwatchesPanel(gchar const* prefsPath = "dialogs.swatches"); virtual ~SwatchesPanel(); static SwatchesPanel& getInstance(); |
