Keyboard navigation in File Browser (issue 1919, on behalf of Adam Reichold)

Select a thumbnail using the arrow keys, select multiple with Shift
This commit is contained in:
michael
2013-07-02 13:33:46 -04:00
parent fbf5a98e1c
commit 01414d0550
4 changed files with 188 additions and 34 deletions

View File

@@ -310,12 +310,12 @@ void FileBrowser::rightClicked (ThumbBrowserEntryBase* entry) {
trash->set_sensitive (false);
untrash->set_sensitive (false);
for (size_t i=0; i<selected.size(); i++)
for (size_t i=0; i<selected.size(); i++)
if ((static_cast<FileBrowserEntry*>(selected[i]))->thumbnail->getStage()==1) {
untrash->set_sensitive (true);
break;
}
for (size_t i=0; i<selected.size(); i++)
for (size_t i=0; i<selected.size(); i++)
if ((static_cast<FileBrowserEntry*>(selected[i]))->thumbnail->getStage()==0) {
trash->set_sensitive (true);
break;
@@ -331,7 +331,7 @@ void FileBrowser::rightClicked (ThumbBrowserEntryBase* entry) {
int p = 0;
Gtk::Menu* applmenu = Gtk::manage (new Gtk::Menu ());
std::vector<Glib::ustring> profnames = profileStore.getProfileNames ();
for (size_t i=0; i<profnames.size(); i++) {
for (size_t i=0; i<profnames.size(); i++) {
Gtk::MenuItem* mi = Gtk::manage (new Gtk::MenuItem (profnames[i]));
applmenu->attach (*mi, 0, 1, p, p+1); p++;
mi->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::applyMenuItemActivated), profnames[i]));
@@ -343,7 +343,7 @@ void FileBrowser::rightClicked (ThumbBrowserEntryBase* entry) {
p = 0;
Gtk::Menu* applpartmenu = Gtk::manage (new Gtk::Menu ());
//std::vector<Glib::ustring> profnames = profileStore.getProfileNames (); // this is already created for submenu applmenu above
for (size_t i=0; i<profnames.size(); i++) {
for (size_t i=0; i<profnames.size(); i++) {
Gtk::MenuItem* mi = Gtk::manage (new Gtk::MenuItem (profnames[i]));
applpartmenu->attach (*mi, 0, 1, p, p+1); p++;
mi->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::applyPartialMenuItemActivated), profnames[i]));
@@ -404,7 +404,7 @@ struct addparams {
int AddEntryUIThread (void* data) {
addparams* ap = static_cast<addparams*>(data);
addparams* ap = static_cast<addparams*>(data);
FileBrowserIdleHelper* fbih = ap->fbih;
if (fbih->destroyed) {
@@ -563,7 +563,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) {
MYREADERLOCK(l, entryRW);
#endif
for (size_t i=0; i<selected.size(); i++)
for (size_t i=0; i<selected.size(); i++)
mselected.push_back (static_cast<FileBrowserEntry*>(selected[i]));
}
@@ -786,7 +786,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) {
else if (m==partpasteprof)
partPasteProfile ();
else if (m==clearprof) {
for (size_t i=0; i<mselected.size(); i++)
for (size_t i=0; i<mselected.size(); i++)
mselected[i]->thumbnail->clearProcParams (FILEBROWSER);
queue_draw ();
} else if (m==execcustprof) {
@@ -802,12 +802,12 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) {
if (!mselected.empty() && bppcl)
bppcl->endBatchPParamsChange();
} else if (m==clearFromCache) {
for (size_t i=0; i<mselected.size(); i++)
for (size_t i=0; i<mselected.size(); i++)
tbl->clearFromCacheRequested (mselected, false);
//queue_draw ();
}
else if (m==clearFromCacheFull) {
for (size_t i=0; i<mselected.size(); i++)
for (size_t i=0; i<mselected.size(); i++)
tbl->clearFromCacheRequested (mselected, true);
//queue_draw ();
} else if (miOpenDefaultViewer!=NULL && m==miOpenDefaultViewer) {
@@ -919,7 +919,7 @@ void FileBrowser::openDefaultViewer (int destination) {
}
if (!success) {
Gtk::MessageDialog msgd (M("MAIN_MSG_IMAGEUNPROCESSED"), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
Gtk::MessageDialog msgd (M("MAIN_MSG_IMAGEUNPROCESSED"), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd.run ();
}
}
@@ -970,6 +970,22 @@ bool FileBrowser::keyPressed (GdkEventKey* event) {
FileBrowser::openNextImage ();
return true;
}
else if (event->keyval==GDK_Left) {
selectPrev (1, shift);
return true;
}
else if (event->keyval==GDK_Right) {
selectNext (1, shift);
return true;
}
else if (event->keyval==GDK_Up) {
selectPrev (numOfCols, shift);
return true;
}
else if (event->keyval==GDK_Down) {
selectNext (numOfCols, shift);
return true;
}
else if (event->keyval==GDK_F5) {
int dest = 1;
@@ -1065,7 +1081,7 @@ void FileBrowser::applyMenuItemActivated (Glib::ustring ppname) {
if (partProfile->pparams && !selected.empty()) {
if (bppcl)
bppcl->beginBatchPParamsChange(selected.size());
for (size_t i=0; i<selected.size(); i++)
for (size_t i=0; i<selected.size(); i++)
(static_cast<FileBrowserEntry*>(selected[i]))->thumbnail->setProcParams (*partProfile->pparams, partProfile->pedited, FILEBROWSER);
if (bppcl)
bppcl->endBatchPParamsChange();
@@ -1090,7 +1106,7 @@ void FileBrowser::applyPartialMenuItemActivated (Glib::ustring ppname) {
if (bppcl)
bppcl->beginBatchPParamsChange(selected.size());
for (size_t i=0; i<selected.size(); i++) {
for (size_t i=0; i<selected.size(); i++) {
selected[i]->thumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file
rtengine::procparams::PartialProfile dstProfile(true);
@@ -1213,7 +1229,7 @@ bool FileBrowser::checkFilter (ThumbBrowserEntryBase* entryb) { // true -> entry
void FileBrowser::toTrashRequested (std::vector<FileBrowserEntry*> tbe) {
for (size_t i=0; i<tbe.size(); i++) {
for (size_t i=0; i<tbe.size(); i++) {
// try to load the last saved parameters from the cache or from the paramfile file
tbe[i]->thumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file
@@ -1235,7 +1251,7 @@ void FileBrowser::toTrashRequested (std::vector<FileBrowserEntry*> tbe) {
void FileBrowser::fromTrashRequested (std::vector<FileBrowserEntry*> tbe) {
for (size_t i=0; i<tbe.size(); i++) {
for (size_t i=0; i<tbe.size(); i++) {
// if thumbnail was marked inTrash=true then param file must be there, no need to run customprofilebuilder
if (tbe[i]->thumbnail->getStage()==0)