Replace the DirSelectionListener interface using a typedef'ed signal to increase simplicity and reduce boiler plate.
This commit is contained in:
@@ -347,9 +347,7 @@ void DirBrowser::row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewC
|
|||||||
Glib::ustring dname = dirTreeModel->get_iter (path)->get_value (dtColumns.dirname);
|
Glib::ustring dname = dirTreeModel->get_iter (path)->get_value (dtColumns.dirname);
|
||||||
|
|
||||||
if (safe_file_test (dname, Glib::FILE_TEST_IS_DIR))
|
if (safe_file_test (dname, Glib::FILE_TEST_IS_DIR))
|
||||||
for (size_t i = 0; i < dllisteners.size(); i++) {
|
dirSelectionSignal (dname, Glib::ustring());
|
||||||
dllisteners[i]->dirSelected (dname);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Gtk::TreePath DirBrowser::expandToDir (const Glib::ustring& absDirPath)
|
Gtk::TreePath DirBrowser::expandToDir (const Glib::ustring& absDirPath)
|
||||||
@@ -439,9 +437,7 @@ void DirBrowser::open (const Glib::ustring& dirname, const Glib::ustring& fileNa
|
|||||||
absFilePath = Glib::build_filename (absDirPath, fileName);
|
absFilePath = Glib::build_filename (absDirPath, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < dllisteners.size(); i++) {
|
dirSelectionSignal (absDirPath, absFilePath);
|
||||||
dllisteners[i]->dirSelected (absDirPath, absFilePath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirBrowser::file_changed (const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<Gio::File>& other_file, Gio::FileMonitorEvent event_type, const Gtk::TreeModel::iterator& iter, const Glib::ustring& dirName)
|
void DirBrowser::file_changed (const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<Gio::File>& other_file, Gio::FileMonitorEvent event_type, const Gtk::TreeModel::iterator& iter, const Glib::ustring& dirName)
|
||||||
|
@@ -24,7 +24,6 @@
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include "windirmonitor.h"
|
#include "windirmonitor.h"
|
||||||
#endif
|
#endif
|
||||||
#include "dirselectionlistener.h"
|
|
||||||
#include "dirbrowserremoteinterface.h"
|
#include "dirbrowserremoteinterface.h"
|
||||||
|
|
||||||
class DirBrowser : public Gtk::VBox, public DirBrowserRemoteInterface
|
class DirBrowser : public Gtk::VBox, public DirBrowserRemoteInterface
|
||||||
@@ -32,6 +31,8 @@ class DirBrowser : public Gtk::VBox, public DirBrowserRemoteInterface
|
|||||||
, public WinDirChangeListener
|
, public WinDirChangeListener
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
typedef sigc::signal<void, const Glib::ustring&, const Glib::ustring&> DirSelectionSignal;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@ private:
|
|||||||
|
|
||||||
Gtk::TreeView *dirtree;
|
Gtk::TreeView *dirtree;
|
||||||
Gtk::ScrolledWindow *scrolledwindow4;
|
Gtk::ScrolledWindow *scrolledwindow4;
|
||||||
std::vector<DirSelectionListener*> dllisteners;
|
DirSelectionSignal dirSelectionSignal;
|
||||||
|
|
||||||
void fillRoot ();
|
void fillRoot ();
|
||||||
|
|
||||||
@@ -94,7 +95,6 @@ private:
|
|||||||
void addDir (const Gtk::TreeModel::iterator& iter, const Glib::ustring& dirname);
|
void addDir (const Gtk::TreeModel::iterator& iter, const Glib::ustring& dirname);
|
||||||
Gtk::TreePath expandToDir (const Glib::ustring& dirName);
|
Gtk::TreePath expandToDir (const Glib::ustring& dirName);
|
||||||
void updateDir (const Gtk::TreeModel::iterator& iter);
|
void updateDir (const Gtk::TreeModel::iterator& iter);
|
||||||
void notifyListeners ();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DirBrowser ();
|
DirBrowser ();
|
||||||
@@ -105,11 +105,14 @@ public:
|
|||||||
void row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
|
void row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
|
||||||
void file_changed (const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<Gio::File>& other_file, Gio::FileMonitorEvent event_type, const Gtk::TreeModel::iterator& iter, const Glib::ustring& dirName);
|
void file_changed (const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<Gio::File>& other_file, Gio::FileMonitorEvent event_type, const Gtk::TreeModel::iterator& iter, const Glib::ustring& dirName);
|
||||||
void open (const Glib::ustring& dirName, const Glib::ustring& fileName = ""); // goes to dir "dirName" and selects file "fileName"
|
void open (const Glib::ustring& dirName, const Glib::ustring& fileName = ""); // goes to dir "dirName" and selects file "fileName"
|
||||||
void addDirSelectionListener (DirSelectionListener* l)
|
|
||||||
{
|
|
||||||
dllisteners.push_back (l);
|
|
||||||
}
|
|
||||||
void selectDir (Glib::ustring dir);
|
void selectDir (Glib::ustring dir);
|
||||||
|
|
||||||
|
DirSelectionSignal dirSelected () const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline DirBrowser::DirSelectionSignal DirBrowser::dirSelected () const
|
||||||
|
{
|
||||||
|
return dirSelectionSignal;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of RawTherapee.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
|
||||||
*
|
|
||||||
* RawTherapee is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* RawTherapee is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#ifndef _DIRSELECTIONLISTENER_
|
|
||||||
#define _DIRSELECTIONLISTENER_
|
|
||||||
|
|
||||||
#include <glibmm.h>
|
|
||||||
|
|
||||||
class DirSelectionListener
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual ~DirSelectionListener () {}
|
|
||||||
virtual void dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile = "") {}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@@ -23,7 +23,6 @@
|
|||||||
#include "windirmonitor.h"
|
#include "windirmonitor.h"
|
||||||
#endif
|
#endif
|
||||||
#include "dirbrowserremoteinterface.h"
|
#include "dirbrowserremoteinterface.h"
|
||||||
#include "dirselectionlistener.h"
|
|
||||||
#include "filebrowser.h"
|
#include "filebrowser.h"
|
||||||
#include "exiffiltersettings.h"
|
#include "exiffiltersettings.h"
|
||||||
#include <giomm.h>
|
#include <giomm.h>
|
||||||
@@ -60,7 +59,6 @@ class FilePanel;
|
|||||||
* - monitoring the directory (for any change)
|
* - monitoring the directory (for any change)
|
||||||
*/
|
*/
|
||||||
class FileCatalog : public Gtk::VBox,
|
class FileCatalog : public Gtk::VBox,
|
||||||
public DirSelectionListener,
|
|
||||||
public PreviewLoaderListener,
|
public PreviewLoaderListener,
|
||||||
public FilterPanelListener,
|
public FilterPanelListener,
|
||||||
public FileBrowserListener,
|
public FileBrowserListener,
|
||||||
@@ -175,7 +173,7 @@ public:
|
|||||||
|
|
||||||
FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel);
|
FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel);
|
||||||
~FileCatalog();
|
~FileCatalog();
|
||||||
void dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile = "");
|
void dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile);
|
||||||
void closeDir ();
|
void closeDir ();
|
||||||
void refreshEditedState (const std::set<Glib::ustring>& efiles);
|
void refreshEditedState (const std::set<Glib::ustring>& efiles);
|
||||||
|
|
||||||
|
@@ -61,10 +61,11 @@ FilePanel::FilePanel () : parent(NULL)
|
|||||||
|
|
||||||
placesBrowser->setDirBrowserRemoteInterface (dirBrowser);
|
placesBrowser->setDirBrowserRemoteInterface (dirBrowser);
|
||||||
recentBrowser->setDirBrowserRemoteInterface (dirBrowser);
|
recentBrowser->setDirBrowserRemoteInterface (dirBrowser);
|
||||||
dirBrowser->addDirSelectionListener (fileCatalog);
|
DirBrowser::DirSelectionSignal dirSelected = dirBrowser->dirSelected ();
|
||||||
dirBrowser->addDirSelectionListener (recentBrowser);
|
dirSelected.connect (sigc::mem_fun (fileCatalog, &FileCatalog::dirSelected));
|
||||||
dirBrowser->addDirSelectionListener (placesBrowser);
|
dirSelected.connect (sigc::mem_fun (recentBrowser, &RecentBrowser::dirSelected));
|
||||||
dirBrowser->addDirSelectionListener (tpc);
|
dirSelected.connect (sigc::mem_fun (placesBrowser, &PlacesBrowser::dirSelected));
|
||||||
|
dirSelected.connect (sigc::mem_fun (tpc, &BatchToolPanelCoordinator::dirSelected));
|
||||||
fileCatalog->setFileSelectionListener (this);
|
fileCatalog->setFileSelectionListener (this);
|
||||||
fileCatalog->setDirBrowserRemoteInterface (dirBrowser);
|
fileCatalog->setDirBrowserRemoteInterface (dirBrowser);
|
||||||
|
|
||||||
|
@@ -22,10 +22,9 @@
|
|||||||
#include <gtkmm.h>
|
#include <gtkmm.h>
|
||||||
#include <giomm.h>
|
#include <giomm.h>
|
||||||
#include "dirbrowserremoteinterface.h"
|
#include "dirbrowserremoteinterface.h"
|
||||||
#include "dirselectionlistener.h"
|
|
||||||
#include "multilangmgr.h"
|
#include "multilangmgr.h"
|
||||||
|
|
||||||
class PlacesBrowser : public Gtk::VBox, public DirSelectionListener
|
class PlacesBrowser : public Gtk::VBox
|
||||||
{
|
{
|
||||||
|
|
||||||
class PlacesColumns : public Gtk::TreeModel::ColumnRecord
|
class PlacesColumns : public Gtk::TreeModel::ColumnRecord
|
||||||
@@ -63,7 +62,7 @@ public:
|
|||||||
{
|
{
|
||||||
listener = l;
|
listener = l;
|
||||||
}
|
}
|
||||||
void dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile = "");
|
void dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile);
|
||||||
|
|
||||||
void refreshPlacesList ();
|
void refreshPlacesList ();
|
||||||
void mountChanged (const Glib::RefPtr<Gio::Mount>& m);
|
void mountChanged (const Glib::RefPtr<Gio::Mount>& m);
|
||||||
|
@@ -21,11 +21,10 @@
|
|||||||
|
|
||||||
#include <gtkmm.h>
|
#include <gtkmm.h>
|
||||||
#include "dirbrowserremoteinterface.h"
|
#include "dirbrowserremoteinterface.h"
|
||||||
#include "dirselectionlistener.h"
|
|
||||||
#include "multilangmgr.h"
|
#include "multilangmgr.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
|
|
||||||
class RecentBrowser : public Gtk::VBox, public DirSelectionListener
|
class RecentBrowser : public Gtk::VBox
|
||||||
{
|
{
|
||||||
|
|
||||||
Gtk::ComboBoxText* recentDirs;
|
Gtk::ComboBoxText* recentDirs;
|
||||||
@@ -42,7 +41,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void selectionChanged ();
|
void selectionChanged ();
|
||||||
void dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile = "");
|
void dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -57,7 +57,6 @@
|
|||||||
#include "toolbar.h"
|
#include "toolbar.h"
|
||||||
#include "lensgeom.h"
|
#include "lensgeom.h"
|
||||||
#include "lensgeomlistener.h"
|
#include "lensgeomlistener.h"
|
||||||
#include "dirselectionlistener.h"
|
|
||||||
#include "wavelet.h"
|
#include "wavelet.h"
|
||||||
#include "dirpyrequalizer.h"
|
#include "dirpyrequalizer.h"
|
||||||
#include "hsvequalizer.h"
|
#include "hsvequalizer.h"
|
||||||
@@ -93,7 +92,6 @@ class ToolPanelCoordinator : public ToolPanelListener,
|
|||||||
public SpotWBListener,
|
public SpotWBListener,
|
||||||
public CropPanelListener,
|
public CropPanelListener,
|
||||||
public ICMPanelListener,
|
public ICMPanelListener,
|
||||||
public DirSelectionListener,
|
|
||||||
public ImageAreaToolListener
|
public ImageAreaToolListener
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -236,7 +234,7 @@ public:
|
|||||||
void setDefaults (rtengine::procparams::ProcParams* defparams);
|
void setDefaults (rtengine::procparams::ProcParams* defparams);
|
||||||
|
|
||||||
// DirSelectionListener interface
|
// DirSelectionListener interface
|
||||||
void dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile = "");
|
void dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile);
|
||||||
|
|
||||||
// to support the GUI:
|
// to support the GUI:
|
||||||
CropGUIListener* getCropGUIListener (); // through the CropGUIListener the editor area can notify the "crop" ToolPanel when the crop selection changes
|
CropGUIListener* getCropGUIListener (); // through the CropGUIListener the editor area can notify the "crop" ToolPanel when the crop selection changes
|
||||||
|
Reference in New Issue
Block a user