summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bb2de06)
raw | patch | inline | side by side (parent: bb2de06)
author | joncruz <joncruz@users.sourceforge.net> | |
Tue, 23 May 2006 09:17:37 +0000 (09:17 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Tue, 23 May 2006 09:17:37 +0000 (09:17 +0000) |
12 files changed:
diff --git a/ChangeLog b/ChangeLog
index 83d3e06e7bd70cedcf8a77dd1432cac9a65bafd2..2c56697812a29a3d6dd631c954975bf22e12425f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-05-22 Jon A. Cruz <jon@joncruz.org>
+1234567890123456789012345678901234567890123456789012345678901234567890123456
+ * src/dialogs/layers-panel.cpp, src/dialogs/swatches.cpp,
+ src/dialogs/swatches.h, src/preferences-skeleton.h,
+ src/ui/previewfillable.h, src/ui/previewholder.cpp,
+ src/ui/previewholder.h, src/ui/widget/panel.cpp,
+ src/ui/widget/panel.h, src/verbs.cpp,
+ src/widgets/desktop-widget.cpp:
+ Refactored panels.
+ Fixes RFE #1453153. Fixes RFE #1453152.
+
+
2006-05-23 MenTaLguY <mental@rydia.net>
* src/extension/internal/ps.cpp:
index 21b3102eff88105ffe162c21a636bb800013bc58..ad2678141fd7d238df0a03dc236dd148afa095c8 100644 (file)
@@ -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),
index 31e91562b2964824d70b20838ed5ce179805f15c..dc9b6fdd6db8ec0f24441ad2e736055bd4acaa82 100644 (file)
--- a/src/dialogs/swatches.cpp
+++ b/src/dialogs/swatches.cpp
#include "path-prefix.h"
#include "swatches.h"
#include "sp-item.h"
+#include "prefs-utils.h"
#include "eek-preview.h"
/**
* 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 );
}
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++;
}
show_all_children();
restorePanelPrefs();
+ if ( hotItem ) {
+ hotItem->set_active();
+ }
}
SwatchesPanel::~SwatchesPanel()
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 7e1357c483444b3dd4bb286e156303b59c0205ab..02861781f8e2746aecca0e8f9698713fdc534109 100644 (file)
--- a/src/dialogs/swatches.h
+++ b/src/dialogs/swatches.h
class SwatchesPanel : public Inkscape::UI::Widget::Panel
{
public:
- SwatchesPanel();
+ SwatchesPanel(gchar const* prefsPath = "dialogs.swatches");
virtual ~SwatchesPanel();
static SwatchesPanel& getInstance();
index d65f89a37d9fcde9dbd584b80188bc1bf112f033..a330eb9a7fb6a670526534f84c034d2f4e20b3d0 100644 (file)
" </group>\n"
" </group>\n"
" <group id=\"colorselector\" page=\"0\"/>\n"
+" <group id=\"embedded\">\n"
+" <group id=\"swatches\" />\n"
+" </group>\n"
" <group id=\"dialogs\">\n"
" <group id=\"toolbox\"/>\n"
" <group id=\"fillstroke\"/>\n"
index e73edbf63f3a133d50d29ad9b32c9d48671aac5f..95662732abf7e351d300b19d3d140258992024ba 100644 (file)
--- a/src/ui/previewfillable.h
+++ b/src/ui/previewfillable.h
virtual void setOrientation( Gtk::AnchorType how ) = 0;
virtual Inkscape::IconSize getPreviewSize() const = 0;
virtual ViewType getPreviewType() const = 0;
+ virtual void setWrap( bool b ) = 0;
+ virtual bool getWrap() const = 0;
};
index bcb4d0282c6f8e7510187af44c4a7e011740f5d4..5d87eb4f5665cbaa83ad77fa6096c9c2601d3f90 100644 (file)
--- a/src/ui/previewholder.cpp
+++ b/src/ui/previewholder.cpp
_updatesFrozen(false),
_anchor(Gtk::ANCHOR_CENTER),
_baseSize(Inkscape::ICON_SIZE_MENU),
- _view(VIEW_TYPE_LIST)
+ _view(VIEW_TYPE_LIST),
+ _wrap(false)
{
_scroller = manage(new Gtk::ScrolledWindow());
_insides = manage(new Gtk::Table( 1, 2 ));
case Gtk::ANCHOR_NORTH:
case Gtk::ANCHOR_SOUTH:
{
- dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->set_policy( Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC );
+ dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->set_policy( Gtk::POLICY_ALWAYS, _wrap ? Gtk::POLICY_AUTOMATIC : Gtk::POLICY_NEVER );
}
break;
}
}
+void PreviewHolder::setWrap( bool b )
+{
+ if ( b != _wrap ) {
+ _wrap = b;
+ switch ( _anchor )
+ {
+ case Gtk::ANCHOR_NORTH:
+ case Gtk::ANCHOR_SOUTH:
+ {
+ dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->set_policy( Gtk::POLICY_ALWAYS, _wrap ? Gtk::POLICY_AUTOMATIC : Gtk::POLICY_NEVER );
+ }
+ break;
+ default:
+ {
+ (void)0;
+ // do nothing;
+ }
+ }
+ rebuildUI();
+ }
+}
+
void PreviewHolder::setColumnPref( int cols )
{
_prefCols = cols;
diff --git a/src/ui/previewholder.h b/src/ui/previewholder.h
index 42f5b119bf4aa3bd57bed710f0b5a49a8bc6cfd0..046cdf7c7dfbef03c5707dc5c286796d80238530 100644 (file)
--- a/src/ui/previewholder.h
+++ b/src/ui/previewholder.h
virtual void setColumnPref( int cols );
virtual Inkscape::IconSize getPreviewSize() const { return _baseSize; }
virtual ViewType getPreviewType() const { return _view; }
+ virtual void setWrap( bool b );
+ virtual bool getWrap() const { return _wrap; }
protected:
virtual void on_size_allocate( Gtk::Allocation& allocation );
Gtk::AnchorType _anchor;
Inkscape::IconSize _baseSize;
ViewType _view;
+ bool _wrap;
};
} //namespace UI
index 2112ea7b2d90d28433e37da955a139e70a0b322c..4ecbda1b8631073db084f372d2f2641e7ab2e569 100644 (file)
--- a/src/ui/widget/panel.cpp
+++ b/src/ui/widget/panel.cpp
namespace UI {
namespace Widget {
+static const int PANEL_SETTING_SIZE = 0;
+static const int PANEL_SETTING_MODE = 1;
+static const int PANEL_SETTING_WRAP = 2;
+static const int PANEL_SETTING_NEXTFREE = 3;
+
/**
* Construct a Panel
*
* \param label Label.
*/
-Panel::Panel( const gchar *prefs_path, bool menuDesired ) :
- _prefs_path(NULL),
- _menuDesired(menuDesired),
- _tempArrow( Gtk::ARROW_LEFT, Gtk::SHADOW_ETCHED_OUT ),
- menu(0),
- _fillable(0)
-{
- _prefs_path = prefs_path;
- init();
-}
-
Panel::Panel() :
_prefs_path(NULL),
_menuDesired(false),
init();
}
-Panel::Panel( Glib::ustring const &label, bool menuDesired ) :
- _prefs_path(NULL),
+Panel::Panel( Glib::ustring const &label, gchar const* prefs_path, bool menuDesired ) :
+ _prefs_path(prefs_path),
_menuDesired(menuDesired),
+ label(label),
_tempArrow( Gtk::ARROW_LEFT, Gtk::SHADOW_ETCHED_OUT ),
menu(0),
_fillable(0)
{
- this->label = label;
init();
}
guint panel_size = 0;
if (_prefs_path) {
- panel_size = prefs_get_int_attribute_limited (_prefs_path, "panel_size", 1, 0, 10);
+ panel_size = prefs_get_int_attribute_limited( _prefs_path, "panel_size", 1, 0, 10 );
}
guint panel_mode = 0;
if (_prefs_path) {
- panel_mode = prefs_get_int_attribute_limited (_prefs_path, "panel_mode", 1, 0, 10);
+ panel_mode = prefs_get_int_attribute_limited( _prefs_path, "panel_mode", 1, 0, 10 );
+ }
+
+ guint panel_wrap = 0;
+ if (_prefs_path) {
+ panel_wrap = prefs_get_int_attribute_limited( _prefs_path, "panel_wrap", 0, 0, 1 );
}
menu = new Gtk::Menu();
if ( i == panel_size ) {
single->set_active(true);
}
- single->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), 0, i) );
+ single->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), PANEL_SETTING_SIZE, i) );
}
}
menu->append( *manage(new Gtk::SeparatorMenuItem()) );
}
menu->append( *one );
+ nonHorizontal.push_back( one );
menu->append( *two );
- menu->append( *manage(new Gtk::SeparatorMenuItem()) );
- one->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), 1, 0) );
- two->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), 1, 1) );
+ nonHorizontal.push_back( two );
+ Gtk::MenuItem* sep = manage( new Gtk::SeparatorMenuItem());
+ menu->append( *sep );
+ nonHorizontal.push_back( sep );
+ one->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), PANEL_SETTING_MODE, 0) );
+ two->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), PANEL_SETTING_MODE, 1) );
+
+ {
+ Glib::ustring wrapLab(_("Wrap"));
+ Gtk::CheckMenuItem *check = manage(new Gtk::CheckMenuItem(wrapLab));
+ check->set_active( panel_wrap );
+ menu->append( *check );
+ nonVertical.push_back(check);
+
+ check->signal_toggled().connect( sigc::bind<Gtk::CheckMenuItem*>(sigc::mem_fun(*this, &Panel::_wrapToggled), check) );
+
+ sep = manage( new Gtk::SeparatorMenuItem());
+ menu->append( *sep );
+ nonVertical.push_back( sep );
+ }
menu->show_all_children();
+ for ( std::vector<Gtk::Widget*>::iterator iter = nonVertical.begin(); iter != nonVertical.end(); ++iter ) {
+ (*iter)->hide();
+ }
//closeButton.set_label("X");
show_all_children();
- bounceCall (0, panel_size);
- bounceCall (1, panel_mode);
+ bounceCall( PANEL_SETTING_SIZE, panel_size );
+ bounceCall( PANEL_SETTING_MODE, panel_mode );
+ bounceCall( PANEL_SETTING_WRAP, panel_wrap );
}
void Panel::setLabel(Glib::ustring const &label)
topBar.remove(menuPopper);
rightBar.pack_start(menuPopper, false, false);
menuPopper.unreference();
- }
+ for ( std::vector<Gtk::Widget*>::iterator iter = nonHorizontal.begin(); iter != nonHorizontal.end(); ++iter ) {
+ (*iter)->hide();
+ }
+ for ( std::vector<Gtk::Widget*>::iterator iter = nonVertical.begin(); iter != nonVertical.end(); ++iter ) {
+ (*iter)->show();
+ }
+ }
+ // Ensure we are not in "list" mode
+ bounceCall( PANEL_SETTING_MODE, 1 );
topBar.remove(tabTitle);
}
break;
default:
- ; // nothing for now
+ {
+ if ( _menuDesired ) {
+ for ( std::vector<Gtk::Widget*>::iterator iter = nonHorizontal.begin(); iter != nonHorizontal.end(); ++iter ) {
+ (*iter)->show();
+ }
+ for ( std::vector<Gtk::Widget*>::iterator iter = nonVertical.begin(); iter != nonVertical.end(); ++iter ) {
+ (*iter)->hide();
+ }
+ }
+ }
}
}
}
void Panel::_regItem( Gtk::MenuItem* item, int group, int id )
{
menu->append( *item );
- item->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), group + 2, id) );
+ item->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), group + PANEL_SETTING_NEXTFREE, id) );
item->show();
}
if (_prefs_path) {
panel_mode = prefs_get_int_attribute_limited (_prefs_path, "panel_mode", 1, 0, 10);
}
- bounceCall (0, panel_size);
- bounceCall (1, panel_mode);
+ guint panel_wrap = 0;
+ if (_prefs_path) {
+ panel_wrap = prefs_get_int_attribute_limited( _prefs_path, "panel_wrap", 0, 0, 1 );
+ }
+ bounceCall( PANEL_SETTING_SIZE, panel_size );
+ bounceCall( PANEL_SETTING_MODE, panel_mode );
+ bounceCall( PANEL_SETTING_WRAP, panel_wrap );
}
void Panel::bounceCall(int i, int j)
{
menu->set_active(0);
switch ( i ) {
- case 0:
- if (_prefs_path) prefs_set_int_attribute (_prefs_path, "panel_size", j);
+ case PANEL_SETTING_SIZE:
+ if (_prefs_path) {
+ prefs_set_int_attribute( _prefs_path, "panel_size", j );
+ }
if ( _fillable ) {
ViewType currType = _fillable->getPreviewType();
switch ( j ) {
}
}
break;
- case 1:
- if (_prefs_path) prefs_set_int_attribute (_prefs_path, "panel_mode", j);
+ case PANEL_SETTING_MODE:
+ if (_prefs_path) {
+ prefs_set_int_attribute (_prefs_path, "panel_mode", j);
+ }
if ( _fillable ) {
Inkscape::IconSize currSize = _fillable->getPreviewSize();
switch ( j ) {
}
}
break;
+ case PANEL_SETTING_WRAP:
+ if (_prefs_path) {
+ prefs_set_int_attribute (_prefs_path, "panel_wrap", j ? 1 : 0);
+ }
+ if ( _fillable ) {
+ _fillable->setWrap( j );
+ }
+ break;
default:
- _handleAction( i - 2, j );
+ _handleAction( i - PANEL_SETTING_NEXTFREE, j );
+ }
+}
+
+
+void Panel::_wrapToggled(Gtk::CheckMenuItem* toggler)
+{
+ if ( toggler ) {
+ bounceCall( PANEL_SETTING_WRAP, toggler->get_active() ? 1 : 0 );
}
}
diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h
index cf201d6da7095980ba49c2a581a7d0f1cea34dd9..e091c82a12b65c87560207381aba6cc8127bc3ce 100644 (file)
--- a/src/ui/widget/panel.h
+++ b/src/ui/widget/panel.h
#ifndef SEEN_INKSCAPE_UI_WIDGET_PANEL_H
#define SEEN_INKSCAPE_UI_WIDGET_PANEL_H
+#include <vector>
#include <gtkmm/arrow.h>
#include <gtkmm/box.h>
#include <gtkmm/eventbox.h>
public:
Panel();
virtual ~Panel();
- Panel(Glib::ustring const &label, bool menuDesired = false );
- Panel(const gchar *prefs_path, bool menuDesired = false );
+ Panel(Glib::ustring const &label, gchar const *prefs_path = 0, bool menuDesired = false );
void setLabel(Glib::ustring const &label);
Glib::ustring const &getLabel() const;
void bounceCall(int i, int j);
void _popper(GdkEventButton* btn);
+ void _wrapToggled(Gtk::CheckMenuItem* toggler);
Glib::ustring label;
Gtk::EventBox menuPopper;
Gtk::Button closeButton;
Gtk::Menu* menu;
+ std::vector<Gtk::Widget*> nonHorizontal;
+ std::vector<Gtk::Widget*> nonVertical;
PreviewFillable *_fillable;
};
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 079f851b4c60b29e8d08713ca4e86a7bb78afd3f..ec56dc45e7e9b9c11eabc6d99a1aad3873510392 100644 (file)
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
return;
SPDocument *doc = sp_desktop_document(dt);
+ (void)doc;
Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview);
+ (void)repr;
}
/** \brief Decode the verb code and take appropriate action */
index b80da8aa4e232b860c9d92fff9db0445ecd9235c..7141d7ff73cf029b243b2ddbfbf121526bb19b5c 100644 (file)
{
using Inkscape::UI::Dialogs::SwatchesPanel;
- SwatchesPanel* swatches = new SwatchesPanel();
+ SwatchesPanel* swatches = new SwatchesPanel("embedded.swatches");
swatches->setOrientation( Gtk::ANCHOR_SOUTH );
dtw->panels = GTK_WIDGET(swatches->gobj());
gtk_box_pack_end( GTK_BOX( dtw->vbox ), dtw->panels, FALSE, TRUE, 0 );