diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index 83155f0a2..1708c7445 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -119,9 +119,8 @@ void BatchQueue::addEntries ( std::vector &entries, bool head) saveBatchQueue( ); } - arrangeFiles (); - queue_draw (); - notifyListener (); + redraw(); + notifyListener (false); } bool BatchQueue::saveBatchQueue( ) @@ -206,10 +205,8 @@ void BatchQueue::loadBatchQueue( ) } } - arrangeFiles (); - queue_draw (); - - notifyListener(); + redraw(); + notifyListener(false); } Glib::ustring BatchQueue::getTempFilenameForParams( const Glib::ustring filename ) @@ -265,7 +262,7 @@ void BatchQueue::cancelItems (std::vector* items) { } redraw (); - notifyListener (); + notifyListener (false); } void BatchQueue::headItems (std::vector* items) { @@ -369,7 +366,6 @@ void BatchQueue::startProcessing () { } rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) { - GThreadLock lock; // save image img Glib::ustring fname; @@ -407,16 +403,14 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) { if (processing->thumbnail) { processing->thumbnail->imageDeveloped (); processing->thumbnail->imageRemovedFromQueue (); - if (listener) - listener->imageProcessingReady (processing->filename); } } // save temporary params file name: delete as last thing Glib::ustring processedParams = processing->savedParamsFile; // delete from the queue - delete processing; - processing = NULL; + delete processing; processing = NULL; + bool queueEmptied=false; { // TODO: Check for Linux #ifdef WIN32 @@ -427,8 +421,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) { // return next job if (fd.size()==0) { - if (listener) - listener->queueEmpty (); + queueEmptied=true; } else if (listener && listener->canStartNext ()) { BatchQueueEntry* next = (BatchQueueEntry*)fd[0]; @@ -445,7 +438,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) { // remove button set next->removeButtonSet (); } - if( saveBatchQueue( ) ){ + if (saveBatchQueue( )) { safe_g_remove( processedParams ); // Delete all files in directory \batch when finished, just to be sure to remove zombies if( fd.size()==0 ){ @@ -460,7 +453,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) { } redraw (); - notifyListener (); + notifyListener (queueEmptied); return processing ? processing->job : NULL; } @@ -622,21 +615,23 @@ void BatchQueue::buttonPressed (LWButton* button, int actionCode, void* actionDa struct NLParams { BatchQueueListener* listener; int qsize; + bool queueEmptied; }; int bqnotifylistenerUI (void* data) { NLParams* params = (NLParams*)data; - params->listener->queueSizeChanged (params->qsize); + params->listener->queueSizeChanged (params->qsize, params->queueEmptied); delete params; return 0; } -void BatchQueue::notifyListener () { +void BatchQueue::notifyListener (bool queueEmptied) { if (listener) { NLParams* params = new NLParams; params->listener = listener; params->qsize = fd.size(); + params->queueEmptied = queueEmptied; g_idle_add (bqnotifylistenerUI, params); } } diff --git a/rtgui/batchqueue.h b/rtgui/batchqueue.h index 2cf9b6870..33e0d27e4 100644 --- a/rtgui/batchqueue.h +++ b/rtgui/batchqueue.h @@ -28,9 +28,7 @@ class BatchQueueListener { public: - virtual void queueSizeChanged (int qsize) =0; - virtual void imageProcessingReady (Glib::ustring fname) =0; - virtual void queueEmpty () =0; + virtual void queueSizeChanged (int qsize, bool queueEmptied) =0; virtual bool canStartNext () =0; }; @@ -57,7 +55,7 @@ class BatchQueue : public ThumbBrowserBase, Glib::ustring autoCompleteFileName (const Glib::ustring& fileName, const Glib::ustring& format); Glib::ustring getTempFilenameForParams( const Glib::ustring filename ); bool saveBatchQueue( ); - void notifyListener (); + void notifyListener (bool queueEmptied); public: BatchQueue (); diff --git a/rtgui/batchqueuepanel.cc b/rtgui/batchqueuepanel.cc index 997e6f79f..a0f49b01c 100644 --- a/rtgui/batchqueuepanel.cc +++ b/rtgui/batchqueuepanel.cc @@ -179,14 +179,17 @@ void BatchQueuePanel::updateTab (int qsize) } } -void BatchQueuePanel::queueSizeChanged (int qsize) +void BatchQueuePanel::queueSizeChanged (int qsize, bool queueEmptied) { updateTab ( qsize); -} -void BatchQueuePanel::imageProcessingReady (Glib::ustring fname) { + if (queueEmptied) { + stopBatchProc (); + fdir->set_sensitive (true); + fformat->set_sensitive (true); - parent->imageDeveloped (fname); + SoundManager::playSoundAsync(options.sndBatchQueueDone); + } } void BatchQueuePanel::startBatchProc () { @@ -201,11 +204,12 @@ void BatchQueuePanel::startBatchProc () { if (batchQueue->hasJobs()) { fdir->set_sensitive (false); fformat->set_sensitive (false); - saveOptions(); + saveOptions(); batchQueue->startProcessing (); } else stopBatchProc (); + updateTab (batchQueue->getEntries().size()); } @@ -228,15 +232,6 @@ void BatchQueuePanel::addBatchQueueJobs ( std::vector &entries startBatchProc (); } -void BatchQueuePanel::queueEmpty () { - - stopBatchProc (); - fdir->set_sensitive (true); - fformat->set_sensitive (true); - - SoundManager::playSoundAsync(options.sndBatchQueueDone); -} - bool BatchQueuePanel::canStartNext () { if (start->get_active ()) diff --git a/rtgui/batchqueuepanel.h b/rtgui/batchqueuepanel.h index 605834d28..b170ef650 100644 --- a/rtgui/batchqueuepanel.h +++ b/rtgui/batchqueuepanel.h @@ -57,9 +57,7 @@ class BatchQueuePanel : public Gtk::VBox, void addBatchQueueJobs (std::vector &entries , bool head=false); // batchqueuelistener interface - void queueSizeChanged (int qsize); - void imageProcessingReady (Glib::ustring fname); - void queueEmpty (); + void queueSizeChanged (int qsize, bool queueEmptied); bool canStartNext (); void startBatchProc (); diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index fc7271998..c71f83fa4 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -970,7 +970,7 @@ int refreshThumbImagesUI (void* data) { } void FileBrowser::_thumbRearrangementNeeded () { - refreshThumbImages (); + refreshThumbImages (); // arrangeFiles is NOT enough } void FileBrowser::thumbRearrangementNeeded () { diff --git a/rtgui/filebrowserentry.cc b/rtgui/filebrowserentry.cc index 8d24e56b7..66c8c0f7b 100644 --- a/rtgui/filebrowserentry.cc +++ b/rtgui/filebrowserentry.cc @@ -239,7 +239,7 @@ void FileBrowserEntry::_updateImage (rtengine::IImage8* img, double s, rtengine: if (rotated) parent->thumbRearrangementNeeded(); else if (redrawRequests==0) - parent->redrawNeeded (this); + parent->redrawNeeded (this); } } diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc index 5282c1005..e6228793c 100644 --- a/rtgui/filecatalog.cc +++ b/rtgui/filecatalog.cc @@ -641,17 +641,14 @@ void FileCatalog::previewsFinished (int dir_id) { } void FileCatalog::setEnabled (bool e) { - enabled = e; } void FileCatalog::redrawAll () { - fileBrowser->queue_draw (); } -void FileCatalog::refreshAll () { - +void FileCatalog::refreshThumbImages () { fileBrowser->refreshThumbImages (); } diff --git a/rtgui/filecatalog.h b/rtgui/filecatalog.h index 84a814e80..2cacebd4e 100644 --- a/rtgui/filecatalog.h +++ b/rtgui/filecatalog.h @@ -177,12 +177,13 @@ class FileCatalog : public Gtk::VBox, // filterpanel interface void exifFilterChanged (); - Glib::ustring lastSelectedDir () { return selectedDirectory; } + Glib::ustring lastSelectedDir () { return selectedDirectory; } void setEnabled (bool e); // if not enabled, it does not open image void enableTabMode(bool enable); // sets progress bar + // accessors for FileBrowser void redrawAll (); - void refreshAll (); + void refreshThumbImages (); void refreshHeight (); void openRequested (std::vector tbe); diff --git a/rtgui/filepanel.cc b/rtgui/filepanel.cc index b34279f27..15c70afd3 100644 --- a/rtgui/filepanel.cc +++ b/rtgui/filepanel.cc @@ -217,7 +217,7 @@ bool FilePanel::addBatchQueueJobs ( std::vector &entries ) { void FilePanel::optionsChanged () { tpc->optionsChanged (); - fileCatalog->refreshAll (); + fileCatalog->refreshThumbImages (); } bool FilePanel::handleShortcutKey (GdkEventKey* event) { diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index 74f1dd005..d79f95ea5 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -331,11 +331,6 @@ bool RTWindow::keyPressed (GdkEventKey* event) { return false; } -void RTWindow::imageDeveloped (Glib::ustring fname) { - -// fpanel->refreshThumbnail (fname); -} - void RTWindow::addBatchQueueJob (BatchQueueEntry* bqe, bool head) { std::vector entries; diff --git a/rtgui/rtwindow.h b/rtgui/rtwindow.h index 07c6b5ee4..f1756bb58 100644 --- a/rtgui/rtwindow.h +++ b/rtgui/rtwindow.h @@ -60,7 +60,6 @@ class RTWindow : public Gtk::Window, public rtengine::ProgressListener{ bool on_window_state_event(GdkEventWindowState* event); void on_mainNB_switch_page(GtkNotebookPage* page, guint page_num); - void imageDeveloped (Glib::ustring fname); // called by the batchqueue when it finishes an image void showPreferences (); void on_realize (); void toggle_fullscreen (); diff --git a/rtgui/thumbbrowserentrybase.cc b/rtgui/thumbbrowserentrybase.cc index 8f887fe7b..ccd82235b 100644 --- a/rtgui/thumbbrowserentrybase.cc +++ b/rtgui/thumbbrowserentrybase.cc @@ -60,7 +60,7 @@ void ThumbBrowserEntryBase::updateBackBuffer () { backBuffer = Gdk::Pixmap::create (w->get_window(), exp_width, exp_height); // If thumbnail is hidden by a filter drawing to it will crash - int backbuffer_w =0, backbuffer_h = 0; + int backbuffer_w=0, backbuffer_h=0; backBuffer->get_size(backbuffer_w, backbuffer_h); // if either with or height is zero then return early if (backbuffer_w * backbuffer_h == 0) return; @@ -338,23 +338,19 @@ void ThumbBrowserEntryBase::drawFrame (Cairo::RefPtr cr, const G void ThumbBrowserEntryBase::draw () { - if (!drawable) + if (!drawable || !parent) return; - Glib::RWLock::ReaderLock l(lockRW); + Glib::RWLock::ReaderLock l(lockRW); // No resizes, position moves etc. inbetween int bbWidth, bbHeight; if (backBuffer) backBuffer->get_size (bbWidth, bbHeight); - if (!backBuffer || selected!=bbSelected || framed!=bbFramed || preview!=bbPreview || exp_width!=bbWidth || exp_height!=bbHeight || getIconsOnImageArea ()!=bbIcons) updateBackBuffer (); - if (!parent) - return; - Gtk::Widget* w = parent->getDrawingArea (); Glib::RefPtr gc_ = Gdk::GC::create (w->get_window()); diff --git a/rtgui/thumbbrowserentrybase.h b/rtgui/thumbbrowserentrybase.h index 637b2dc9c..a9eaf2737 100644 --- a/rtgui/thumbbrowserentrybase.h +++ b/rtgui/thumbbrowserentrybase.h @@ -53,7 +53,7 @@ protected: int width; // minimal width int height; // minimal height // set by arrangeFiles() of thumbbrowser - int exp_width; // arranged width + int exp_width; // arranged width (backbuffer dimensions) int exp_height; // arranged height int startx; // x coord. in the widget int starty; // y coord. in the widget @@ -72,6 +72,7 @@ protected: void drawFrame (Cairo::RefPtr cr, const Gdk::Color& bg, const Gdk::Color& fg); void getTextSizes (int& w, int& h); + // called during updateBackBuffer for custom overlays virtual void customBackBufferUpdate (Cairo::RefPtr c) {} public: