Proper check for rawzor libraries.
[rawtherapee-fixes.git] / rtgui / filethumbnailbuttonset.cc
blob70c8ebe45b98eec18b2920c75dedee17a9553228
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 #include <filethumbnailbuttonset.h>
20 #include <multilangmgr.h>
21 #include "config.h"
23 extern Glib::ustring argv0;
25 bool FileThumbnailButtonSet::iconsLoaded = false;
27 Cairo::RefPtr<Cairo::ImageSurface> FileThumbnailButtonSet::rankIcon;
28 Cairo::RefPtr<Cairo::ImageSurface> FileThumbnailButtonSet::gRankIcon;
29 Cairo::RefPtr<Cairo::ImageSurface> FileThumbnailButtonSet::unRankIcon;
30 Cairo::RefPtr<Cairo::ImageSurface> FileThumbnailButtonSet::trashIcon;
31 Cairo::RefPtr<Cairo::ImageSurface> FileThumbnailButtonSet::unTrashIcon;
32 Cairo::RefPtr<Cairo::ImageSurface> FileThumbnailButtonSet::processIcon;
34 FileThumbnailButtonSet::FileThumbnailButtonSet (FileBrowserEntry* myEntry) {
36 if (!iconsLoaded) {
37 unRankIcon = Cairo::ImageSurface::create_from_png (GET_DATA_PATH(argv0)+"/images/unrated.png");
38 rankIcon = Cairo::ImageSurface::create_from_png (GET_DATA_PATH(argv0)+"/images/rated.png");
39 gRankIcon = Cairo::ImageSurface::create_from_png (GET_DATA_PATH(argv0)+"/images/grayrated.png");
40 trashIcon = Cairo::ImageSurface::create_from_png (GET_DATA_PATH(argv0)+"/images/trash.png");
41 unTrashIcon = Cairo::ImageSurface::create_from_png (GET_DATA_PATH(argv0)+"/images/undelete.png");
42 processIcon = Cairo::ImageSurface::create_from_png (GET_DATA_PATH(argv0)+"/images/processing.png");
43 iconsLoaded = true;
46 add (new LWButton (unRankIcon, 0, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_POPUPUNRANK")));
47 for (int i=0; i<5; i++)
48 add (new LWButton (rankIcon, i+1, myEntry, LWButton::Left));
49 add (new LWButton (processIcon, 6, myEntry, LWButton::Right, LWButton::Center, M("FILEBROWSER_POPUPPROCESS")));
50 add (new LWButton (trashIcon, 7, myEntry, LWButton::Right, LWButton::Center, M("FILEBROWSER_POPUPTRASH")));
52 buttons[1]->setToolTip (M("FILEBROWSER_POPUPRANK1"));
53 buttons[2]->setToolTip (M("FILEBROWSER_POPUPRANK2"));
54 buttons[3]->setToolTip (M("FILEBROWSER_POPUPRANK3"));
55 buttons[4]->setToolTip (M("FILEBROWSER_POPUPRANK4"));
56 buttons[5]->setToolTip (M("FILEBROWSER_POPUPRANK5"));
59 void FileThumbnailButtonSet::setRank (int stars) {
61 for (int i=1; i<=5; i++)
62 buttons[i]->setIcon (i<=stars ? rankIcon : gRankIcon);
65 void FileThumbnailButtonSet::setInTrash (bool inTrash) {
67 buttons[7]->setIcon (inTrash ? unTrashIcon : trashIcon);
68 buttons[7]->setToolTip (inTrash ? M("FILEBROWSER_POPUPUNTRASH") : M("FILEBROWSER_POPUPTRASH"));