2 * This file is part of RawTherapee.
4 * Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
6 * RawTherapee is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * RawTherapee is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
23 #include <windirmonitor.h>
25 #include <dirselectionlistener.h>
26 #include <filebrowser.h>
27 #include <procthread.h>
28 #include <exiffiltersettings.h>
30 #include <fileselectionlistener.h>
32 #include <fileselectionchangelistener.h>
33 #include <coarsepanel.h>
35 #include <filterpanel.h>
37 class PreviewLoaderListener
{
39 virtual void previewReady (FileBrowserEntry
* fd
) {}
40 virtual void previewsFinished () {}
46 Glib::ustring fullName
;
48 DirEntry (const Glib::ustring
& n
) : fullName (n
) {}
50 bool operator< (DirEntry
& other
) {
51 return fullName
.casefold() < other
.fullName
.casefold();
55 class PreviewLoader
: public ProcessingThread
<DirEntry
> {
58 PreviewLoaderListener
* pl
;
61 PreviewLoader () : pl(NULL
) { ProcessingThread
<DirEntry
>(); }
62 void setPreviewLoaderListener (PreviewLoaderListener
* p
) { pl
= p
; }
64 void process () { ProcessingThread
<DirEntry
>::process (); }
65 void process (DirEntry
& current
);
66 void remove (Glib::ustring fname
);
70 class FileCatalog
: public Gtk::VBox
,
71 public DirSelectionListener
,
72 public PreviewLoaderListener
,
73 public FilterPanelListener
,
74 public FileBrowserListener
76 , public WinDirChangeListener
81 FileBrowser
* fileBrowser
;
84 Glib::ustring selectedDirectory
;
87 PreviewLoader previewLoader
;
88 FileSelectionListener
* listener
;
89 FileSelectionChangeListener
* fslistener
;
90 ImageAreaToolListener
* iatlistener
;
93 Gtk::HBox
* buttonBar2
;
94 Gtk::ToggleButton
* bDir
;
95 Gtk::ToggleButton
* bUnRanked
;
96 Gtk::ToggleButton
* bRank
[5];
97 Gtk::ToggleButton
* bTrash
;
98 Gtk::ToggleButton
* categoryButtons
[8];
99 sigc::connection bCateg
[8];
100 Gtk::Image
* iranked
[5], *igranked
[5];
102 double hScrollPos
[8];
103 double vScrollPos
[8];
106 Gtk::VBox
* trashButtonBox
;
108 Gtk::Button
* zoomInButton
;
109 Gtk::Button
* zoomOutButton
;
111 ExifFilterSettings dirEFS
;
112 ExifFilterSettings currentEFS
;
113 bool hasValidCurrentEFS
;
115 FilterPanel
* filterPanel
;
117 Glib::RefPtr
<Gio::FileMonitor
> dirMonitor
;
119 Gtk::ProgressBar
* progressBar
;
125 WinDirMonitor
* wdMonitor
;
128 void winDirChanged ();
131 std::vector
<Glib::ustring
> fileNameList
;
132 std::set
<Glib::ustring
> editedFiles
;
134 void addAndOpenFile (const Glib::ustring
& fname
);
135 void checkAndAddFile (Glib::RefPtr
<Gio::File
> info
);
136 std::vector
<Glib::ustring
> getFileList ();
137 BrowserFilter
getFilter ();
140 CoarsePanel
* coarsePanel
;
143 FileCatalog (CoarsePanel
* cp
, ToolBar
* tb
);
144 void dirSelected (const Glib::ustring
& dirname
, const Glib::ustring
& openfile
="");
146 void refreshEditedState (const std::set
<Glib::ustring
>& efiles
);
148 // previewloaderlistener interface
149 void previewReady (FileBrowserEntry
* fdn
);
150 void previewsFinished ();
151 void _previewsFinished ();
152 void _refreshProgressBar ();
154 // filterpanel interface
155 void exifFilterChanged ();
157 Glib::ustring
lastSelectedDir () { return selectedDirectory
; }
158 void setEnabled (bool e
); // if not enabled, it does not open image
163 void openRequested (std::vector
<Thumbnail
*> tbe
);
164 void deleteRequested (std::vector
<FileBrowserEntry
*> tbe
);
165 void developRequested (std::vector
<FileBrowserEntry
*> tbe
);
166 void renameRequested (std::vector
<FileBrowserEntry
*> tbe
);
167 void selectionChanged (std::vector
<Thumbnail
*> tbe
);
170 void setFileSelectionListener (FileSelectionListener
* l
) { listener
= l
; }
171 void setFileSelectionChangeListener (FileSelectionChangeListener
* l
) { fslistener
= l
; }
172 void setImageAreaToolListener (ImageAreaToolListener
* l
) { iatlistener
= l
; }
173 void setFilterPanel (FilterPanel
* fpanel
);
175 void categoryButtonToggled (Gtk::ToggleButton
* b
);
176 void filterChanged ();
177 void runFilterDialog ();
180 void on_dir_changed (const Glib::RefPtr
<Gio::File
>& file
, const Glib::RefPtr
<Gio::File
>& other_file
, Gio::FileMonitorEvent event_type
, bool internal
);
181 int reparseDirectory ();
182 void _openImage (std::vector
<Thumbnail
*> tmb
);
187 void openNextImage () { fileBrowser
->openNextImage(); }
188 void openPrevImage () { fileBrowser
->openPrevImage(); }