Auto-sizing of single tab thumbnail ribbon, also on zoomin/out. Stops autosizing once you manually move the ribbon splitter.

This commit is contained in:
Oliver Duis
2010-11-10 00:39:20 +01:00
parent a876935d37
commit 6cce14161f
6 changed files with 23 additions and 2 deletions

View File

@@ -409,6 +409,11 @@ void FileCatalog::refreshAll () {
fileBrowser->refreshThumbImages ();
}
void FileCatalog::refreshHeight () {
int newHeight=fileBrowser->getEffectiveHeight();
set_size_request(0, newHeight);
}
void FileCatalog::_openImage (std::vector<Thumbnail*> tmb) {
if (enabled && listener!=NULL) {
@@ -838,14 +843,14 @@ bool FileCatalog::trashIsEmpty () {
void FileCatalog::zoomIn () {
fileBrowser->zoomIn ();
refreshHeight();
}
void FileCatalog::zoomOut () {
fileBrowser->zoomOut ();
refreshHeight();
}
void FileCatalog::refreshEditedState (const std::set<Glib::ustring>& efiles) {

View File

@@ -148,6 +148,7 @@ class FileCatalog : public Gtk::VBox,
void redrawAll ();
void refreshAll ();
void refreshHeight ();
void openRequested (std::vector<Thumbnail*> tbe);
void deleteRequested (std::vector<FileBrowserEntry*> tbe);
@@ -179,6 +180,8 @@ class FileCatalog : public Gtk::VBox,
void openPrevImage () { fileBrowser->openPrevImage(); }
bool handleShortcutKey (GdkEventKey* event);
};
#endif

View File

@@ -349,6 +349,7 @@ void RTWindow::MoveFileBrowserToEditor()
epanel->catalogPane->add(*fCatalog);
fCatalog->fileBrowser->setArrangement(ThumbBrowserBase::TB_Horizontal);
fCatalog->redrawAll();
fCatalog->refreshHeight();
}
}

View File

@@ -534,6 +534,14 @@ void ThumbBrowserBase::setScrollPosition (double h, double v) {
vscroll.set_value (v>vscroll.get_adjustment()->get_upper() ? vscroll.get_adjustment()->get_upper() : v);
}
// needed for auto-height in single tab
int ThumbBrowserBase::getEffectiveHeight() {
int h=0;
if (fd.size()>0) h=fd[0]->getEffectiveHeight();
return h;
}
/*void PreviewImgUpdater::processCustomOrder () {
// find first filtered entry, if any

View File

@@ -90,6 +90,7 @@ class ThumbBrowserBase : public Gtk::VBox {
void zoomIn () { zoomChanged (true); }
void zoomOut () { zoomChanged (false); }
int getEffectiveHeight ();
const std::vector<ThumbBrowserEntryBase*>& getEntries () { return fd; }
void styleChanged (const Glib::RefPtr<Gtk::Style>& style);

View File

@@ -101,6 +101,9 @@ protected:
void addButtonSet (LWButtonSet* bs);
int getMinimalHeight () { return height; }
int getMinimalWidth () { return width; }
int getEffectiveHeight () { return fnlabh+dtlabh+upperMargin+lowerMargin+textGap+height; }
bool inside (int x, int y);
bool insideWindow (int x, int y, int w, int h);
void setPosition (int x, int y, int w, int h);