Proper check for rawzor libraries.
[rawtherapee-fixes.git] / rtgui / filecatalog.h
blobfde5489d2965ec5e571ebdd6931c44a6e4bce5f0
1 /*
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/>.
19 #ifndef _FILECATALOG_
20 #define _FILECATALOG_
22 #ifdef _WIN32
23 #include <windirmonitor.h>
24 #endif
25 #include <dirselectionlistener.h>
26 #include <filebrowser.h>
27 #include <procthread.h>
28 #include <exiffiltersettings.h>
29 #include <giomm.h>
30 #include <fileselectionlistener.h>
31 #include <set>
32 #include <fileselectionchangelistener.h>
33 #include <coarsepanel.h>
34 #include <toolbar.h>
35 #include <filterpanel.h>
37 class PreviewLoaderListener {
38 public:
39 virtual void previewReady (FileBrowserEntry* fd) {}
40 virtual void previewsFinished () {}
43 class DirEntry {
45 public:
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> {
57 protected:
58 PreviewLoaderListener* pl;
60 public:
61 PreviewLoader () : pl(NULL) { ProcessingThread<DirEntry>(); }
62 void setPreviewLoaderListener (PreviewLoaderListener* p) { pl = p; }
63 void start ();
64 void process () { ProcessingThread<DirEntry>::process (); }
65 void process (DirEntry& current);
66 void remove (Glib::ustring fname);
67 void end ();
70 class FileCatalog : public Gtk::VBox,
71 public DirSelectionListener,
72 public PreviewLoaderListener,
73 public FilterPanelListener,
74 public FileBrowserListener
75 #ifdef _WIN32
76 , public WinDirChangeListener
77 #endif
80 // thumbnail browsers
81 FileBrowser* fileBrowser;
83 Gtk::HBox* hBox;
84 Glib::ustring selectedDirectory;
85 bool enabled;
87 PreviewLoader previewLoader;
88 FileSelectionListener* listener;
89 FileSelectionChangeListener* fslistener;
90 ImageAreaToolListener* iatlistener;
92 Gtk::HBox* buttonBar;
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];
104 int lastScrollPos;
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;
120 int previewsToLoad;
121 int previewsLoaded;
124 #ifdef _WIN32
125 WinDirMonitor* wdMonitor;
126 public:
127 int checkCounter;
128 void winDirChanged ();
129 private:
130 #endif
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 ();
139 public:
140 CoarsePanel* coarsePanel;
141 ToolBar* toolBar;
143 FileCatalog (CoarsePanel* cp, ToolBar* tb);
144 void dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile="");
145 void closeDir ();
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
160 void redrawAll ();
161 void refreshAll ();
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);
168 void emptyTrash ();
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 ();
179 void on_realize();
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);
184 void zoomIn ();
185 void zoomOut ();
187 void openNextImage () { fileBrowser->openNextImage(); }
188 void openPrevImage () { fileBrowser->openPrevImage(); }
191 #endif