Shortcuts to apply rank and color labels and a new direct popup menu for color labels, all in the File Browser (issue 1839)
This commit is contained in:
@@ -94,7 +94,10 @@ FileBrowser::FileBrowser ()
|
||||
pmenu->attach (*Gtk::manage(colorlabel[i] = new Gtk::ImageMenuItem (M(Glib::ustring::compose("%1%2","FILEBROWSER_POPUPCOLORLABEL",i)))), 0, 1, p, p+1); p++;
|
||||
}
|
||||
}
|
||||
for (int i=1; i<=5; i++){//set color label images
|
||||
|
||||
//set color label images
|
||||
colorlabel[0]->set_image(*Gtk::manage(new RTImage ("cglabel0.png")));
|
||||
for (int i=1; i<=5; i++){
|
||||
colorlabel[i]->set_image(*Gtk::manage(new RTImage (Glib::ustring::compose("%1%2%3","clabel",i,".png"))));
|
||||
}
|
||||
|
||||
@@ -268,11 +271,31 @@ FileBrowser::FileBrowser ()
|
||||
execcustprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), execcustprof));
|
||||
clearprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), clearprof));
|
||||
cachemenu->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), cachemenu));
|
||||
|
||||
|
||||
|
||||
// A separate pop-up menu for Color Labels
|
||||
int c = 0;
|
||||
pmenuColorLabels = new Gtk::Menu ();
|
||||
for (int i=0; i<=5; i++){
|
||||
pmenuColorLabels->attach (*Gtk::manage(colorlabel_pop[i] = new Gtk::ImageMenuItem (M(Glib::ustring::compose("%1%2","FILEBROWSER_POPUPCOLORLABEL",i)))), 0, 1, c, c+1); c++;
|
||||
}
|
||||
//set color label images
|
||||
colorlabel_pop[0]->set_image(*Gtk::manage(new RTImage ("cglabel0.png")));
|
||||
for (int i=1; i<=5; i++){
|
||||
colorlabel_pop[i]->set_image(*Gtk::manage(new RTImage (Glib::ustring::compose("%1%2%3","clabel",i,".png"))));
|
||||
}
|
||||
pmenuColorLabels->show_all ();
|
||||
|
||||
// Bind to event handlers
|
||||
for (int i=0; i<=5; i++)
|
||||
colorlabel_pop[i]->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuColorlabelActivated), colorlabel_pop[i]));
|
||||
}
|
||||
|
||||
FileBrowser::~FileBrowser ()
|
||||
{
|
||||
delete pmenu;
|
||||
delete pmenuColorLabels;
|
||||
delete[] amiExtProg;
|
||||
}
|
||||
|
||||
@@ -499,6 +522,18 @@ void FileBrowser::close () {
|
||||
lastClicked = NULL;
|
||||
}
|
||||
|
||||
void FileBrowser::menuColorlabelActivated (Gtk::MenuItem* m) {
|
||||
|
||||
std::vector<FileBrowserEntry*> tbe;
|
||||
tbe.push_back (static_cast<FileBrowserEntry*>(colorLabel_actionData));
|
||||
|
||||
for (int i=0; i<6; i++)
|
||||
if (m==colorlabel_pop[i]) {
|
||||
colorlabelRequested (tbe, i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void FileBrowser::menuItemActivated (Gtk::MenuItem* m) {
|
||||
|
||||
std::vector<FileBrowserEntry*> mselected;
|
||||
@@ -871,7 +906,53 @@ bool FileBrowser::keyPressed (GdkEventKey* event) {
|
||||
scrollPage(GDK_SCROLL_DOWN);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
else if (shift && !ctrl && !alt) { // rank
|
||||
switch(event->keyval) {
|
||||
case GDK_asciitilde:
|
||||
requestRanking (0);
|
||||
return true;
|
||||
case GDK_exclam:
|
||||
requestRanking (1);
|
||||
return true;
|
||||
case GDK_at:
|
||||
requestRanking (2);
|
||||
return true;
|
||||
case GDK_numbersign:
|
||||
requestRanking (3);
|
||||
return true;
|
||||
case GDK_dollar:
|
||||
requestRanking (4);
|
||||
return true;
|
||||
case GDK_percent:
|
||||
requestRanking (5);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
else if (shift && ctrl && !alt) { // color labels
|
||||
switch(event->keyval) {
|
||||
case GDK_asciitilde:
|
||||
requestColorLabel (0);
|
||||
return true;
|
||||
case GDK_exclam:
|
||||
requestColorLabel (1);
|
||||
return true;
|
||||
case GDK_at:
|
||||
requestColorLabel (2);
|
||||
return true;
|
||||
case GDK_numbersign:
|
||||
requestColorLabel (3);
|
||||
return true;
|
||||
case GDK_dollar:
|
||||
requestColorLabel (4);
|
||||
return true;
|
||||
case GDK_percent:
|
||||
requestColorLabel (5);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1092,6 +1173,22 @@ void FileBrowser::colorlabelRequested (std::vector<FileBrowserEntry*> tbe, int c
|
||||
applyFilter (filter);
|
||||
}
|
||||
|
||||
void FileBrowser::requestRanking(int rank){
|
||||
std::vector<FileBrowserEntry*> mselected;
|
||||
for (size_t i=0; i<selected.size(); i++)
|
||||
mselected.push_back (static_cast<FileBrowserEntry*>(selected[i]));
|
||||
|
||||
rankingRequested (mselected, rank);
|
||||
}
|
||||
|
||||
void FileBrowser::requestColorLabel(int colorlabel){
|
||||
std::vector<FileBrowserEntry*> mselected;
|
||||
for (size_t i=0; i<selected.size(); i++)
|
||||
mselected.push_back (static_cast<FileBrowserEntry*>(selected[i]));
|
||||
|
||||
colorlabelRequested (mselected, colorlabel);
|
||||
}
|
||||
|
||||
void FileBrowser::buttonPressed (LWButton* button, int actionCode, void* actionData) {
|
||||
|
||||
if (actionCode>=0 && actionCode<=5) { // rank
|
||||
@@ -1113,6 +1210,11 @@ void FileBrowser::buttonPressed (LWButton* button, int actionCode, void* actionD
|
||||
else
|
||||
fromTrashRequested (tbe);
|
||||
}
|
||||
else if (actionCode==8 && tbl) { // color label
|
||||
// show popup menu
|
||||
colorLabel_actionData = actionData;// this will be reused when pmenuColorLabels is clicked
|
||||
pmenuColorLabels->popup (3, this->eventTime);
|
||||
}
|
||||
}
|
||||
|
||||
void FileBrowser::openNextImage () {
|
||||
|
@@ -105,6 +105,11 @@ class FileBrowser : public ThumbBrowserBase,
|
||||
Gtk::MenuItem* clearFromCacheFull;
|
||||
Gtk::Menu* pmenu;
|
||||
|
||||
Gtk::ImageMenuItem* colorlabel_pop[6];
|
||||
Gtk::Menu* pmenuColorLabels;
|
||||
void* colorLabel_actionData;
|
||||
void menuColorlabelActivated (Gtk::MenuItem* m); // use only when menu is invoked via FileBrowser::buttonPressed to pass actionData
|
||||
|
||||
Glib::RefPtr<Gtk::AccelGroup> pmaccelgroup;
|
||||
|
||||
FileBrowserListener* tbl;
|
||||
@@ -117,6 +122,8 @@ class FileBrowser : public ThumbBrowserBase,
|
||||
void fromTrashRequested (std::vector<FileBrowserEntry*> tbe);
|
||||
void rankingRequested (std::vector<FileBrowserEntry*> tbe, int rank);
|
||||
void colorlabelRequested (std::vector<FileBrowserEntry*> tbe, int colorlabel);
|
||||
void requestRanking (int rank);
|
||||
void requestColorLabel(int colorlabel);
|
||||
void notifySelectionListener ();
|
||||
|
||||
ExportPanel* exportPanel;
|
||||
|
@@ -1773,7 +1773,7 @@ bool FileCatalog::handleShortcutKey (GdkEventKey* event) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!alt) {
|
||||
if (!alt && !shift) { // shift is reserved for ranking
|
||||
switch(event->keyval) {
|
||||
case GDK_grave:
|
||||
categoryButtonToggled(bUnRanked,false);
|
||||
@@ -1809,7 +1809,7 @@ bool FileCatalog::handleShortcutKey (GdkEventKey* event) {
|
||||
}
|
||||
}
|
||||
|
||||
if (alt) {
|
||||
if (alt && !shift) { // shift is reserved for color labeling
|
||||
switch(event->keyval) {
|
||||
case GDK_grave:
|
||||
categoryButtonToggled(bUnCLabeled,false);
|
||||
|
@@ -47,7 +47,7 @@ FileThumbnailButtonSet::FileThumbnailButtonSet (FileBrowserEntry* myEntry) {
|
||||
unTrashIcon = safe_create_from_png ("undelete-thumbnail.png");
|
||||
processIcon = safe_create_from_png ("processing-thumbnail.png");
|
||||
|
||||
colorLabelIcon_0 = safe_create_from_png ("nocolorlabel.png");
|
||||
colorLabelIcon_0 = safe_create_from_png ("cglabel0.png"); //("nocolorlabel.png");
|
||||
colorLabelIcon_1 = safe_create_from_png ("clabel1.png");
|
||||
colorLabelIcon_2 = safe_create_from_png ("clabel2.png");
|
||||
colorLabelIcon_3 = safe_create_from_png ("clabel3.png");
|
||||
@@ -57,18 +57,18 @@ FileThumbnailButtonSet::FileThumbnailButtonSet (FileBrowserEntry* myEntry) {
|
||||
}
|
||||
|
||||
add (new LWButton (processIcon, 6, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_POPUPPROCESS")));
|
||||
add (new LWButton (unRankIcon, 0, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_POPUPUNRANK")));
|
||||
add (new LWButton (unRankIcon, 0, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_UNRANK_TOOLTIP")));
|
||||
for (int i=0; i<5; i++)
|
||||
add (new LWButton (rankIcon, i+1, myEntry, LWButton::Left));
|
||||
add (new LWButton (trashIcon, 7, myEntry, LWButton::Right, LWButton::Center, M("FILEBROWSER_POPUPTRASH")));
|
||||
|
||||
add (new LWButton (colorLabelIcon_0, 8, myEntry, LWButton::Right, LWButton::Center, M("FILEBROWSER_POPUPCOLORLABEL")));
|
||||
add (new LWButton (colorLabelIcon_0, 8, myEntry, LWButton::Right, LWButton::Center, M("FILEBROWSER_COLORLABEL_TOOLTIP")));
|
||||
|
||||
buttons[2]->setToolTip (M("FILEBROWSER_POPUPRANK1"));
|
||||
buttons[3]->setToolTip (M("FILEBROWSER_POPUPRANK2"));
|
||||
buttons[4]->setToolTip (M("FILEBROWSER_POPUPRANK3"));
|
||||
buttons[5]->setToolTip (M("FILEBROWSER_POPUPRANK4"));
|
||||
buttons[6]->setToolTip (M("FILEBROWSER_POPUPRANK5"));
|
||||
buttons[2]->setToolTip (M("FILEBROWSER_RANK1_TOOLTIP"));
|
||||
buttons[3]->setToolTip (M("FILEBROWSER_RANK2_TOOLTIP"));
|
||||
buttons[4]->setToolTip (M("FILEBROWSER_RANK3_TOOLTIP"));
|
||||
buttons[5]->setToolTip (M("FILEBROWSER_RANK4_TOOLTIP"));
|
||||
buttons[6]->setToolTip (M("FILEBROWSER_RANK5_TOOLTIP"));
|
||||
}
|
||||
|
||||
void FileThumbnailButtonSet::setRank (int stars) {
|
||||
|
Reference in New Issue
Block a user