From: joncruz Date: Sat, 18 Feb 2006 08:56:22 +0000 (+0000) Subject: Removed horizontal scroll bar from swatches when embedded. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1bdb42eddb21aee3dc7fb58ff67ce9b2ec482763;p=inkscape.git Removed horizontal scroll bar from swatches when embedded. --- diff --git a/ChangeLog b/ChangeLog index b5ea4ed7e..5414336bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-02-18 Jon A. Cruz + * src/widgets/desktop-widget.cpp, src/dialogs/swatches.cpp, + src/dialogs/swatches.h, src/ui/previewholder.cpp, + src/ui/previewfillable.h, src/ui/previewholder.h: + + Removed horizontal scroll bar from swatches when embedded. + + 2006-02-15 Michael Wybrow * src/document.cpp, src/document.h, src/sp-conn-end-pair.cpp, diff --git a/src/dialogs/swatches.cpp b/src/dialogs/swatches.cpp index 739cda3b2..dd48fa539 100644 --- a/src/dialogs/swatches.cpp +++ b/src/dialogs/swatches.cpp @@ -482,6 +482,15 @@ SwatchesPanel::~SwatchesPanel() { } +void SwatchesPanel::Temp() +{ + if ( _holder ) + { + _holder->setOrientation( Gtk::ANCHOR_SOUTH ); + } +} + + void SwatchesPanel::_handleAction( int setId, int itemId ) { switch( setId ) { diff --git a/src/dialogs/swatches.h b/src/dialogs/swatches.h index ca17cd066..fea2b8309 100644 --- a/src/dialogs/swatches.h +++ b/src/dialogs/swatches.h @@ -61,6 +61,8 @@ public: static SwatchesPanel& getInstance(); + void Temp(); + protected: virtual void _handleAction( int setId, int itemId ); diff --git a/src/ui/previewfillable.h b/src/ui/previewfillable.h index 106eda7ea..b62ab6b99 100644 --- a/src/ui/previewfillable.h +++ b/src/ui/previewfillable.h @@ -26,6 +26,7 @@ public: virtual void clear() = 0; virtual void addPreview( Previewable* preview ) = 0; virtual void setStyle(Gtk::BuiltinIconSize size, ViewType type) = 0; + virtual void setOrientation( Gtk::AnchorType how ) = 0; virtual Gtk::BuiltinIconSize getPreviewSize() const = 0; virtual ViewType getPreviewType() const = 0; }; diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index e73cd7407..321b7899f 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -24,6 +24,7 @@ PreviewHolder::PreviewHolder() : VBox(), PreviewFillable(), _scroller(0), + _anchor(Gtk::ANCHOR_CENTER), _baseSize(Gtk::ICON_SIZE_MENU), _view(VIEW_TYPE_LIST) { @@ -84,6 +85,33 @@ void PreviewHolder::setStyle(Gtk::BuiltinIconSize size, ViewType view) } } +void PreviewHolder::setOrientation( Gtk::AnchorType how ) +{ + if ( _anchor != how ) + { + switch ( _anchor ) + { + case Gtk::ANCHOR_NORTH: + case Gtk::ANCHOR_SOUTH: + { + dynamic_cast(_scroller)->set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER ); + } + break; + + case Gtk::ANCHOR_EAST: + case Gtk::ANCHOR_WEST: + { + dynamic_cast(_scroller)->set_policy( Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC ); + } + break; + + default: + { + dynamic_cast(_scroller)->set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC ); + } + } + } +} void PreviewHolder::rebuildUI() { diff --git a/src/ui/previewholder.h b/src/ui/previewholder.h index 96d9b8228..532aa771f 100644 --- a/src/ui/previewholder.h +++ b/src/ui/previewholder.h @@ -30,6 +30,7 @@ public: virtual void clear(); virtual void addPreview( Previewable* preview ); virtual void setStyle(Gtk::BuiltinIconSize size, ViewType view); + virtual void setOrientation( Gtk::AnchorType how ); virtual Gtk::BuiltinIconSize getPreviewSize() const { return _baseSize; } virtual ViewType getPreviewType() const { return _view; } @@ -39,6 +40,7 @@ private: std::vector items; Gtk::Bin *_scroller; Gtk::Table *_insides; + Gtk::AnchorType _anchor; Gtk::BuiltinIconSize _baseSize; ViewType _view; }; diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 2cd6f13d3..acd631c6a 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -184,6 +184,7 @@ sp_desktop_widget_init (SPDesktopWidget *dtw) using Inkscape::UI::Dialogs::SwatchesPanel; SwatchesPanel* swatches = new SwatchesPanel(); + swatches->Temp(); dtw->panels = GTK_WIDGET(swatches->gobj()); gtk_box_pack_end( GTK_BOX( dtw->vbox ), dtw->panels, FALSE, TRUE, 0 ); }