From: joncruz Date: Fri, 22 Feb 2008 09:28:35 +0000 (+0000) Subject: Stop taking up vertical space when horizontal scrollbar not shown. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=88e0b0687c367c5f0cb015d4f9e1074928878f3b;p=inkscape.git Stop taking up vertical space when horizontal scrollbar not shown. Fixes Bug #168619 --- diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index da991e1df..ba0b6a7ef 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -62,6 +62,10 @@ void PreviewHolder::clear() { items.clear(); _prefCols = 0; + // Kludge to restore scrollbars + if ( !_wrap && (_view != VIEW_TYPE_LIST) && (_anchor == Gtk::ANCHOR_NORTH || _anchor == Gtk::ANCHOR_SOUTH) ) { + dynamic_cast(_scroller)->set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER ); + } rebuildUI(); } @@ -131,6 +135,10 @@ void PreviewHolder::setStyle( ::PreviewSize size, ViewType view, guint ratio ) _baseSize = size; _view = view; _ratio = ratio; + // Kludge to restore scrollbars + if ( !_wrap && (_view != VIEW_TYPE_LIST) && (_anchor == Gtk::ANCHOR_NORTH || _anchor == Gtk::ANCHOR_SOUTH) ) { + dynamic_cast(_scroller)->set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER ); + } rebuildUI(); } } @@ -197,6 +205,18 @@ void PreviewHolder::on_size_allocate( Gtk::Allocation& allocation ) // g_message( "on_size_allocate(%d, %d) (%d, %d)", allocation.get_x(), allocation.get_y(), allocation.get_width(), allocation.get_height() ); // g_message(" anchor:%d", _anchor); Gtk::VBox::on_size_allocate( allocation ); + + if ( _insides && !_wrap && (_view != VIEW_TYPE_LIST) && (_anchor == Gtk::ANCHOR_NORTH || _anchor == Gtk::ANCHOR_SOUTH) ) { + Gtk::Requisition req; + _insides->size_request(req); + gint delta = allocation.get_width() - req.width; + + if ( (delta > 4) && req.height < allocation.get_height() ) { + dynamic_cast(_scroller)->set_policy( Gtk::POLICY_NEVER, Gtk::POLICY_NEVER ); + } else { + dynamic_cast(_scroller)->set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER ); + } + } } void PreviewHolder::on_size_request( Gtk::Requisition* requisition )