Code

Removed horizontal scroll bar from swatches when embedded.
authorjoncruz <joncruz@users.sourceforge.net>
Sat, 18 Feb 2006 08:56:22 +0000 (08:56 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Sat, 18 Feb 2006 08:56:22 +0000 (08:56 +0000)
ChangeLog
src/dialogs/swatches.cpp
src/dialogs/swatches.h
src/ui/previewfillable.h
src/ui/previewholder.cpp
src/ui/previewholder.h
src/widgets/desktop-widget.cpp

index b5ea4ed7e7b7f0288e14d0d36969f0104e276d37..5414336bbf5be2ed1f25dd6a1c1f499cc474fb38 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-02-18  Jon A. Cruz  <jon@joncruz.org>
+       * 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  <mjwybrow@users.sourceforge.net>
 
        *  src/document.cpp, src/document.h, src/sp-conn-end-pair.cpp, 
index 739cda3b27b2d6277210f78d4199c986afdcf4f4..dd48fa5392f3cd288e98fff5b50ce40ca4f63e11 100644 (file)
@@ -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 ) {
index ca17cd066cd2ad90e4034f55734fc6fd98bc3ba5..fea2b83094a4043461086115b40a5f58bf10a895 100644 (file)
@@ -61,6 +61,8 @@ public:
 
     static SwatchesPanel& getInstance();
 
+    void Temp();
+
 protected:
     virtual void _handleAction( int setId, int itemId );
 
index 106eda7eac03ccaf287a57dd5a3556cc19c28fee..b62ab6b99fd7fbca9d70e4e2ab9e84fcf158beba 100644 (file)
@@ -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;
 };
index e73cd740706f5a6fe7eaed2b92df802de3ff41ca..321b7899fc164114bef8dc9cd11513f21b7f7def 100644 (file)
@@ -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<Gtk::ScrolledWindow*>(_scroller)->set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER );
+            }
+            break;
+
+            case Gtk::ANCHOR_EAST:
+            case Gtk::ANCHOR_WEST:
+            {
+                dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->set_policy( Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC );
+            }
+            break;
+
+            default:
+            {
+                dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC );
+            }
+        }
+    }
+}
 
 void PreviewHolder::rebuildUI()
 {
index 96d9b8228ab206c98748094b1f7474237adb873e..532aa771f91966bb0b77a8969c23b9fb93f50a1d 100644 (file)
@@ -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<Previewable*> items;
     Gtk::Bin *_scroller;
     Gtk::Table *_insides;
+    Gtk::AnchorType _anchor;
     Gtk::BuiltinIconSize _baseSize;
     ViewType _view;
 };
index 2cd6f13d399dccd0e59e2dcaaee27e5d851f0114..acd631c6a41f54525af45c5b12cf28ac868c26a6 100644 (file)
@@ -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 );
     }