summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2006-02-19 05:32:13 +0000
committerjoncruz <joncruz@users.sourceforge.net>2006-02-19 05:32:13 +0000
commitbd98ee2549cf40630a6da66bbd994f2cc39b11b3 (patch)
tree96ba2f14c0a94aa5031b009d5200bf3eb4ccc3b8 /src
parentupdated PO files (diff)
downloadinkscape-bd98ee2549cf40630a6da66bbd994f2cc39b11b3.tar.gz
inkscape-bd98ee2549cf40630a6da66bbd994f2cc39b11b3.zip
Fixing scrollbar size for embeded color swatches.
(bzr r158)
Diffstat (limited to 'src')
-rw-r--r--src/dialogs/swatches.cpp6
-rw-r--r--src/dialogs/swatches.h3
-rw-r--r--src/ui/previewholder.cpp34
-rw-r--r--src/ui/previewholder.h3
-rw-r--r--src/ui/widget/panel.cpp8
-rw-r--r--src/ui/widget/panel.h3
-rw-r--r--src/widgets/desktop-widget.cpp2
7 files changed, 52 insertions, 7 deletions
diff --git a/src/dialogs/swatches.cpp b/src/dialogs/swatches.cpp
index dd48fa539..c01217fe6 100644
--- a/src/dialogs/swatches.cpp
+++ b/src/dialogs/swatches.cpp
@@ -482,15 +482,17 @@ SwatchesPanel::~SwatchesPanel()
{
}
-void SwatchesPanel::Temp()
+void SwatchesPanel::setOrientation( Gtk::AnchorType how )
{
+ // Must call the parent class or bad things might happen
+ Inkscape::UI::Widget::Panel::setOrientation( how );
+
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 fea2b8309..37a04cfba 100644
--- a/src/dialogs/swatches.h
+++ b/src/dialogs/swatches.h
@@ -60,8 +60,7 @@ public:
virtual ~SwatchesPanel();
static SwatchesPanel& getInstance();
-
- void Temp();
+ virtual void setOrientation( Gtk::AnchorType how );
protected:
virtual void _handleAction( int setId, int itemId );
diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp
index 321b7899f..961c060bb 100644
--- a/src/ui/previewholder.cpp
+++ b/src/ui/previewholder.cpp
@@ -14,6 +14,8 @@
#include "previewholder.h"
#include <gtkmm/scrolledwindow.h>
+#include <gtkmm/sizegroup.h>
+#include <gtkmm/scrollbar.h>
namespace Inkscape {
@@ -24,6 +26,9 @@ PreviewHolder::PreviewHolder() :
VBox(),
PreviewFillable(),
_scroller(0),
+ _zee0(0),
+ _zee1(0),
+ _zee2(0),
_anchor(Gtk::ANCHOR_CENTER),
_baseSize(Gtk::ICON_SIZE_MENU),
_view(VIEW_TYPE_LIST)
@@ -32,9 +37,15 @@ PreviewHolder::PreviewHolder() :
Gtk::Table* stuff = manage(new Gtk::Table( 1, 2 ));
stuff->set_col_spacings( 8 );
_insides = stuff;
+
+ // Add a container with the scroller and a spacer
+ Gtk::Table* spaceHolder = manage( new Gtk::Table(1, 2) );
+ _zee0 = manage( new Gtk::VBox() );
_scroller->add(*stuff);
+ spaceHolder->attach( *_scroller, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
+ spaceHolder->attach( *_zee0, 1, 2, 0, 1, Gtk::SHRINK, Gtk::FILL|Gtk::EXPAND );
- pack_start(*_scroller, Gtk::PACK_EXPAND_WIDGET);
+ pack_start(*spaceHolder, Gtk::PACK_EXPAND_WIDGET);
}
PreviewHolder::~PreviewHolder()
@@ -89,12 +100,31 @@ void PreviewHolder::setOrientation( Gtk::AnchorType how )
{
if ( _anchor != how )
{
+ _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 );
+ //dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER );
+ dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->set_policy( Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC );
+ if ( !_zee1 )
+ {
+ _zee1 = manage( new Gtk::VBox() );
+ _zee2 = manage( new Gtk::VBox() );
+
+ // Trick to get the scrolled window to a minimum height larger than the scrollbar
+
+ Gtk::VScrollbar* vs = dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->get_vscrollbar();
+ // TODO fix leakage
+ Glib::RefPtr<Gtk::SizeGroup> sizer = Gtk::SizeGroup::create(Gtk::SIZE_GROUP_VERTICAL);
+ sizer->add_widget( *_zee1 );
+ sizer->add_widget( *_zee2 );
+ sizer->add_widget( *vs );
+
+ _zee0->pack_start( *_zee1 );
+ _zee0->pack_start( *_zee2 );
+ }
}
break;
diff --git a/src/ui/previewholder.h b/src/ui/previewholder.h
index 532aa771f..58d0dba5d 100644
--- a/src/ui/previewholder.h
+++ b/src/ui/previewholder.h
@@ -40,6 +40,9 @@ private:
std::vector<Previewable*> items;
Gtk::Bin *_scroller;
Gtk::Table *_insides;
+ Gtk::Box *_zee0;
+ Gtk::Box *_zee1;
+ Gtk::Box *_zee2;
Gtk::AnchorType _anchor;
Gtk::BuiltinIconSize _baseSize;
ViewType _view;
diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp
index 67aca690a..b0a35614d 100644
--- a/src/ui/widget/panel.cpp
+++ b/src/ui/widget/panel.cpp
@@ -134,6 +134,14 @@ void Panel::setLabel(Glib::ustring const &label)
tabTitle.set_label(this->label);
}
+void Panel::setOrientation( Gtk::AnchorType how )
+{
+ if ( _anchor != how )
+ {
+ _anchor = how;
+ }
+}
+
void Panel::_regItem( Gtk::MenuItem* item, int group, int id )
{
menu.append( *item );
diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h
index 07225b8ce..9c53be8bb 100644
--- a/src/ui/widget/panel.h
+++ b/src/ui/widget/panel.h
@@ -38,6 +38,8 @@ public:
void setLabel(Glib::ustring const &label);
Glib::ustring const &getLabel() const;
+ virtual void setOrientation( Gtk::AnchorType how );
+
const gchar *_prefs_path;
void restorePanelPrefs();
@@ -47,6 +49,7 @@ protected:
virtual void _handleAction( int setId, int itemId );
+ Gtk::AnchorType _anchor;
private:
void init();
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index acd631c6a..2bf9f6b2e 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -184,7 +184,7 @@ sp_desktop_widget_init (SPDesktopWidget *dtw)
using Inkscape::UI::Dialogs::SwatchesPanel;
SwatchesPanel* swatches = new SwatchesPanel();
- swatches->Temp();
+ swatches->setOrientation( Gtk::ANCHOR_SOUTH );
dtw->panels = GTK_WIDGET(swatches->gobj());
gtk_box_pack_end( GTK_BOX( dtw->vbox ), dtw->panels, FALSE, TRUE, 0 );
}