summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7053048)
raw | patch | inline | side by side (parent: 7053048)
author | joncruz <joncruz@users.sourceforge.net> | |
Sun, 19 Feb 2006 05:32:13 +0000 (05:32 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Sun, 19 Feb 2006 05:32:13 +0000 (05:32 +0000) |
diff --git a/ChangeLog b/ChangeLog
index 5414336bbf5be2ed1f25dd6a1c1f499cc474fb38..47a240965d467936fa80f3620de1591e50c71522 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-02-18 Jon A. Cruz <jon@joncruz.org>
+ * src/widgets/desktop-widget.cpp, src/dialogs/swatches.cpp,
+ src/dialogs/swatches.h, src/ui/widget/panel.cpp,
+ src/ui/widget/panel.h, src/ui/previewholder.cpp,
+ src/ui/previewholder.h:
+
+ Adding spacer to get swatches scrollbar enough room to move.
+ Tuning up API for better embedding.
+
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,
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 dd48fa5392f3cd288e98fff5b50ce40ca4f63e11..c01217fe6cee529d3520385bb7d19aa85d7ebddc 100644 (file)
--- a/src/dialogs/swatches.cpp
+++ b/src/dialogs/swatches.cpp
{
}
-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 fea2b83094a4043461086115b40a5f58bf10a895..37a04cfba3ff4d53a1bbcec3f8e4d8b9aed2a641 100644 (file)
--- a/src/dialogs/swatches.h
+++ b/src/dialogs/swatches.h
virtual ~SwatchesPanel();
static SwatchesPanel& getInstance();
-
- void Temp();
+ virtual void setOrientation( Gtk::AnchorType how );
protected:
virtual void _handleAction( int setId, int itemId );
index 321b7899fc164114bef8dc9cd11513f21b7f7def..961c060bb9381e7784de2f77904223f9c786f577 100644 (file)
--- a/src/ui/previewholder.cpp
+++ b/src/ui/previewholder.cpp
#include "previewholder.h"
#include <gtkmm/scrolledwindow.h>
+#include <gtkmm/sizegroup.h>
+#include <gtkmm/scrollbar.h>
namespace Inkscape {
VBox(),
PreviewFillable(),
_scroller(0),
+ _zee0(0),
+ _zee1(0),
+ _zee2(0),
_anchor(Gtk::ANCHOR_CENTER),
_baseSize(Gtk::ICON_SIZE_MENU),
_view(VIEW_TYPE_LIST)
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()
{
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 532aa771f91966bb0b77a8969c23b9fb93f50a1d..58d0dba5d328555f7c3ca32781e6fb3d5cc48b4c 100644 (file)
--- a/src/ui/previewholder.h
+++ b/src/ui/previewholder.h
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;
index 67aca690a002f78f7ed907e31f4f067c41079239..b0a35614df1253770d29b5157c67615eebc80d5f 100644 (file)
--- a/src/ui/widget/panel.cpp
+++ b/src/ui/widget/panel.cpp
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 07225b8ce8d7e5bdd5c38705b310324dbf461a1b..9c53be8bb1951f68238015ad513fb601d7b3cb37 100644 (file)
--- a/src/ui/widget/panel.h
+++ b/src/ui/widget/panel.h
void setLabel(Glib::ustring const &label);
Glib::ustring const &getLabel() const;
+ virtual void setOrientation( Gtk::AnchorType how );
+
const gchar *_prefs_path;
void restorePanelPrefs();
virtual void _handleAction( int setId, int itemId );
+ Gtk::AnchorType _anchor;
private:
void init();
index acd631c6a41f54525af45c5b12cf28ac868c26a6..2bf9f6b2e4207d85c0acaa4c5aff636e1ad94789 100644 (file)
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 );
}