F5 Ultimate Edition ;-) see issue #372
This commit is contained in:
@@ -644,6 +644,7 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) {
|
|||||||
bool shift = event->state & GDK_SHIFT_MASK;
|
bool shift = event->state & GDK_SHIFT_MASK;
|
||||||
|
|
||||||
if (!ctrl) {
|
if (!ctrl) {
|
||||||
|
// Normal
|
||||||
switch(event->keyval) {
|
switch(event->keyval) {
|
||||||
case GDK_h:
|
case GDK_h:
|
||||||
case GDK_H:
|
case GDK_H:
|
||||||
@@ -674,11 +675,12 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case GDK_F5:
|
case GDK_F5:
|
||||||
openThm->openBatchResultDefaultViewer();
|
openThm->openDefaultViewer(event->state & GDK_SHIFT_MASK ? 2 : 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// With control
|
||||||
switch (event->keyval) {
|
switch (event->keyval) {
|
||||||
case GDK_s:
|
case GDK_s:
|
||||||
saveAsPressed();
|
saveAsPressed();
|
||||||
@@ -695,6 +697,10 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) {
|
|||||||
case GDK_Z:
|
case GDK_Z:
|
||||||
history->redo ();
|
history->redo ();
|
||||||
return true;
|
return true;
|
||||||
|
case GDK_F5:
|
||||||
|
openThm->openDefaultViewer(3);
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -392,9 +392,9 @@ void FileBrowser::partPasteProfile () {
|
|||||||
partialPasteDlg.hide ();
|
partialPasteDlg.hide ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::openBatchResultDefaultViewer () {
|
void FileBrowser::openDefaultViewer (int destination) {
|
||||||
if (selected.size()==1)
|
if (selected.size()==1)
|
||||||
((FileBrowserEntry*)selected[0])->thumbnail->openBatchResultDefaultViewer();
|
((FileBrowserEntry*)selected[0])->thumbnail->openDefaultViewer(destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileBrowser::keyPressed (GdkEventKey* event) {
|
bool FileBrowser::keyPressed (GdkEventKey* event) {
|
||||||
@@ -428,7 +428,13 @@ bool FileBrowser::keyPressed (GdkEventKey* event) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (event->keyval==GDK_F5) {
|
else if (event->keyval==GDK_F5) {
|
||||||
openBatchResultDefaultViewer ();
|
int dest = 1;
|
||||||
|
if (event->state & GDK_SHIFT_MASK)
|
||||||
|
dest = 2;
|
||||||
|
else if (event->state & GDK_CONTROL_MASK)
|
||||||
|
dest = 3;
|
||||||
|
|
||||||
|
openDefaultViewer (dest);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -113,7 +113,7 @@ class FileBrowser : public ThumbBrowserBase, public LWButtonListener {
|
|||||||
void pasteProfile ();
|
void pasteProfile ();
|
||||||
void partPasteProfile ();
|
void partPasteProfile ();
|
||||||
|
|
||||||
void openBatchResultDefaultViewer ();
|
void openDefaultViewer (int destination);
|
||||||
|
|
||||||
void redrawNeeded (ThumbBrowserEntryBase* entry);
|
void redrawNeeded (ThumbBrowserEntryBase* entry);
|
||||||
void thumbRearrangementNeeded ();
|
void thumbRearrangementNeeded ();
|
||||||
|
@@ -505,25 +505,58 @@ void Thumbnail::removeThumbnailListener (ThumbnailListener* tnl) {
|
|||||||
|
|
||||||
// Calculates the standard filename for the automatically named batch result
|
// Calculates the standard filename for the automatically named batch result
|
||||||
// and opens it in OS default viewer
|
// and opens it in OS default viewer
|
||||||
|
// destination: 1=Batch conf. file; 2=batch out dir; 3=RAW dir
|
||||||
// Return: Success?
|
// Return: Success?
|
||||||
bool Thumbnail::openBatchResultDefaultViewer() {
|
bool Thumbnail::openDefaultViewer(int destination) {
|
||||||
Glib::ustring openFName = Glib::ustring::compose ("%1.%2", BatchQueue::calcAutoFileNameBase(fname), options.saveFormat.format);
|
|
||||||
|
|
||||||
printf ("Try opening %s\n", openFName.c_str());
|
|
||||||
|
|
||||||
if (Glib::file_test (openFName, Glib::FILE_TEST_EXISTS)) {
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
ShellExecute(NULL, "open", openFName.c_str(), NULL, NULL, SW_SHOWMAXIMIZED);
|
Glib::ustring openFName;
|
||||||
return true;
|
|
||||||
|
if (destination==1) {
|
||||||
|
openFName = Glib::ustring::compose ("%1.%2", BatchQueue::calcAutoFileNameBase(fname), options.saveFormat.format);
|
||||||
|
if (Glib::file_test (openFName, Glib::FILE_TEST_EXISTS)) {
|
||||||
|
ShellExecute(NULL, "open", openFName.c_str(), NULL, NULL, SW_SHOWMAXIMIZED );
|
||||||
|
} else {
|
||||||
|
printf("File not found\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
openFName = destination == 3 ? fname
|
||||||
|
: Glib::ustring::compose ("%1.%2", BatchQueue::calcAutoFileNameBase(fname), options.saveFormat.format);
|
||||||
|
|
||||||
|
printf("Opening %s\n", openFName.c_str());
|
||||||
|
|
||||||
|
if (Glib::file_test (openFName, Glib::FILE_TEST_EXISTS)) {
|
||||||
|
// Output file exists, so open explorer and select output file
|
||||||
|
const char* org=Glib::ustring::compose("/select,\"%1\"", openFName).c_str();
|
||||||
|
char* par=new char[strlen(org)+1];
|
||||||
|
strcpy(par, org);
|
||||||
|
|
||||||
|
// In this case the / disturbs
|
||||||
|
char* p = par+1; // skip the first backslash
|
||||||
|
while (*p!=0) {
|
||||||
|
if (*p=='/') *p='\\';
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShellExecute(NULL, "open", "explorer.exe", par, NULL, SW_SHOWNORMAL );
|
||||||
|
|
||||||
|
delete[] par;
|
||||||
|
} else if (Glib::file_test (Glib::path_get_dirname(openFName), Glib::FILE_TEST_EXISTS)) {
|
||||||
|
// Out file does not exist, but directory
|
||||||
|
ShellExecute(NULL, "explore", Glib::path_get_dirname(openFName).c_str(), NULL, NULL, SW_SHOWNORMAL );
|
||||||
|
} else {
|
||||||
|
printf("File and dir not found\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// TODO: Add more OSes here
|
// TODO: Add more OSes here
|
||||||
printf("Automatic opening not supported on this OS\n");
|
printf("Automatic opening not supported on this OS\n");
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else {
|
|
||||||
printf("File not found\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
@@ -128,7 +128,7 @@ class Thumbnail {
|
|||||||
void updateCache ();
|
void updateCache ();
|
||||||
void saveThumbnail ();
|
void saveThumbnail ();
|
||||||
|
|
||||||
bool openBatchResultDefaultViewer();
|
bool openDefaultViewer(int destination);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user