Keyboard shortcut in SaveAs window (issue 2165)

This commit is contained in:
michael
2013-12-30 11:07:26 -05:00
parent 56c188cd50
commit ca04eb9c2a
3 changed files with 21 additions and 1 deletions

View File

@@ -1392,6 +1392,7 @@ TP_RGBCURVES_RED;R
TP_ROTATE_DEGREE;Degree
TP_ROTATE_LABEL;Rotate
TP_ROTATE_SELECTLINE;Select Straight Line
TP_SAVEDIALOG_OK_TIP;Shortcut <b>Ctrl-Enter</b>
TP_SHADOWSHLIGHTS_HIGHLIGHTS;Highlights
TP_SHADOWSHLIGHTS_HLTONALW;Tonal Width for Highlights
TP_SHADOWSHLIGHTS_LABEL;Shadows/Highlights

View File

@@ -97,6 +97,8 @@ SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) {
ok->set_image (*Gtk::manage(new RTImage ("gtk-apply.png")));
cancel->set_image (*Gtk::manage(new RTImage ("gtk-cancel.png")));
ok->set_tooltip_markup (M("TP_SAVEDIALOG_OK_TIP"));
ok->signal_clicked().connect( sigc::mem_fun(*this, &SaveAsDialog::okPressed) );
cancel->signal_clicked().connect( sigc::mem_fun(*this, &SaveAsDialog::cancelPressed) );
@@ -128,6 +130,7 @@ SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) {
set_border_width (4);
show_all_children ();
signal_key_press_event().connect( sigc::mem_fun(*this, &SaveAsDialog::keyPressed) );
}
void SaveAsDialog::saveImmediatlyClicked () {
@@ -269,3 +272,19 @@ void SaveAsDialog::setImagePath (Glib::ustring ipath) {
}
catch (Gtk::FileChooserError &err) {}
}
bool SaveAsDialog::keyPressed (GdkEventKey* event) {
bool ctrl = event->state & GDK_CONTROL_MASK;
if (ctrl){
switch(event->keyval) {
case GDK_Return: // Ctrl-Enter equivalent to pressing OK button
case GDK_KP_Enter:
SaveAsDialog::okPressed();
return true;
}
}
return false;
}

View File

@@ -17,7 +17,6 @@
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SAVEASDLG_
#define _SAVEASDLG_
#include <gtkmm.h>
#include "adjuster.h"
@@ -62,6 +61,7 @@ class SaveAsDialog : public Gtk::Dialog, public FormatChangeListener {
void okPressed ();
void cancelPressed ();
void formatChanged (Glib::ustring f);
bool keyPressed (GdkEventKey* event);
};