Fixed two thumb size related bugs (see issue #346)

This commit is contained in:
Oliver Duis
2010-11-20 13:52:09 +01:00
parent e16b4eee2e
commit 62ef20da5f
4 changed files with 12 additions and 5 deletions

View File

@@ -195,7 +195,7 @@ void FileBrowser::addEntry_ (FileBrowserEntry* entry) {
entry->getThumbButtonSet()->setRank (entry->thumbnail->getRank()); entry->getThumbButtonSet()->setRank (entry->thumbnail->getRank());
entry->getThumbButtonSet()->setInTrash (entry->thumbnail->getStage()==1); entry->getThumbButtonSet()->setInTrash (entry->thumbnail->getStage()==1);
entry->getThumbButtonSet()->setButtonListener (this); entry->getThumbButtonSet()->setButtonListener (this);
entry->resize (options.thumbSize); entry->resize (getCurrentThumbSize());
// find place in abc order // find place in abc order
std::vector<ThumbBrowserEntryBase*>::iterator i = fd.begin(); std::vector<ThumbBrowserEntryBase*>::iterator i = fd.begin();

View File

@@ -467,7 +467,7 @@ void ThumbBrowserBase::zoomChanged (bool zoomIn) {
int newHeight; int newHeight;
int i=0; int i=0;
int optThumbSize=inTabMode ? options.thumbSizeTab : options.thumbSize; int optThumbSize=getCurrentThumbSize();
if (zoomIn) if (zoomIn)
for (i=0; i<options.thumbnailZoomRatios.size(); i++) { for (i=0; i<options.thumbnailZoomRatios.size(); i++) {
newHeight = (int)(options.thumbnailZoomRatios[i] * options.maxThumbnailHeight); newHeight = (int)(options.thumbnailZoomRatios[i] * options.maxThumbnailHeight);
@@ -490,10 +490,13 @@ void ThumbBrowserBase::zoomChanged (bool zoomIn) {
gdk_window_process_updates (get_window()->gobj(), true); gdk_window_process_updates (get_window()->gobj(), true);
#endif #endif
} }
int ThumbBrowserBase::getCurrentThumbSize() { return inTabMode ? options.thumbSizeTab : options.thumbSize; }
void ThumbBrowserBase::refreshThumbImages () { void ThumbBrowserBase::refreshThumbImages () {
for (int i=0; i<fd.size(); i++){ for (int i=0; i<fd.size(); i++){
previewHeight = inTabMode ? options.thumbSizeTab : options.thumbSize; previewHeight = getCurrentThumbSize();
fd[i]->resize (previewHeight);// TODO!!! Might be performance bottleneck fd[i]->resize (previewHeight);// TODO!!! Might be performance bottleneck
fd[i]->refreshThumbnailImage (); // TODO: This might cause crashes on some installations fd[i]->refreshThumbnailImage (); // TODO: This might cause crashes on some installations
} }
@@ -527,7 +530,7 @@ void ThumbBrowserBase::enableTabMode(bool enable) {
if (options.thumbSizeTab!=options.thumbSize) { if (options.thumbSizeTab!=options.thumbSize) {
for (int i=0; i<fd.size(); i++) for (int i=0; i<fd.size(); i++)
fd[i]->resize (inTabMode ? options.thumbSizeTab : options.thumbSize); fd[i]->resize (getCurrentThumbSize());
} }
redraw (); redraw ();

View File

@@ -57,7 +57,8 @@ class ThumbBrowserBase : public Gtk::VBox {
int inW, inH; int inW, inH;
bool inTabMode; // Tab mode has e.g. different preview heights bool inTabMode; // Tab mode has e.g. different preview heights
int getCurrentThumbSize(); // depending on filmstrip/file browser mode
void resizeThumbnailArea (int w, int h); void resizeThumbnailArea (int w, int h);
void internalAreaResized (Gtk::Allocation& req); void internalAreaResized (Gtk::Allocation& req);
void buttonPressed (int x, int y, int button, GdkEventType type, int state, int clx, int cly, int clw, int clh); void buttonPressed (int x, int y, int button, GdkEventType type, int state, int clx, int cly, int clw, int clh);

View File

@@ -271,6 +271,9 @@ void ThumbBrowserEntryBase::resize (int h) {
// dimensions of the info text // dimensions of the info text
getTextSizes (infow, infoh); getTextSizes (infow, infoh);
preh -= infoh + textGap; preh -= infoh + textGap;
// If the text size was selected very high in preferences this may go negative
if (preh<0) preh=0;
} }
calcThumbnailSize (); calcThumbnailSize ();