Add ability to export to an external editor within the same folder as the original file - issue 6195 (#6232)

* import and change the art code -thanks to Alberto

* Possible fixed for white space in folder

* Added verbose when white-space

* Replace WS only if windows and Gimp

* Fixed Windows and Gimp bug for external editor - thanks to Lawrence37

* Fix LGTM alert for reused variable name

Co-authored-by: Thanatomanic <6567747+Thanatomanic@users.noreply.github.com>
This commit is contained in:
Desmis
2021-05-13 12:41:22 +02:00
committed by GitHub
parent 3cb6e88ea4
commit eb8f121709
9 changed files with 149 additions and 12 deletions

View File

@@ -1244,7 +1244,48 @@ Gtk::Widget* Preferences::getGeneralPanel()
externaleditorGrid->attach_next_to(*editorToSendTo, *edOther, Gtk::POS_RIGHT, 1, 1);
#endif
fdg->add(*externaleditorGrid);
// fdg->add(*externaleditorGrid);
editor_dir_temp = Gtk::manage(new Gtk::RadioButton(M("PREFERENCES_EXTEDITOR_DIR_TEMP")));
editor_dir_current = Gtk::manage(new Gtk::RadioButton(M("PREFERENCES_EXTEDITOR_DIR_CURRENT")));
editor_dir_custom = Gtk::manage(new Gtk::RadioButton(M("PREFERENCES_EXTEDITOR_DIR_CUSTOM") + ": "));
editor_dir_custom_path = Gtk::manage(new MyFileChooserButton("", Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER));
ge = editor_dir_temp->get_group();
editor_dir_current->set_group(ge);
editor_dir_custom->set_group(ge);
editor_float32 = Gtk::manage(new Gtk::CheckButton(M("PREFERENCES_EXTEDITOR_FLOAT32")));
editor_bypass_output_profile = Gtk::manage(new Gtk::CheckButton(M("PREFERENCES_EXTEDITOR_BYPASS_OUTPUT_PROFILE")));
{
Gtk::Frame *f = Gtk::manage(new Gtk::Frame(M("PREFERENCES_EXTEDITOR_DIR")));
setExpandAlignProperties(f, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL);
Gtk::Box *vb = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL));
vb->pack_start(*editor_dir_temp);
vb->pack_start(*editor_dir_current);
Gtk::Box *hb = Gtk::manage(new Gtk::Box());
hb->pack_start(*editor_dir_custom, Gtk::PACK_SHRINK);
hb->pack_start(*editor_dir_custom_path, Gtk::PACK_EXPAND_WIDGET, 2);
vb->pack_start(*hb);
f->add(*vb);
hb = Gtk::manage(new Gtk::Box());
hb->pack_start(*externaleditorGrid);
hb->pack_start(*f, Gtk::PACK_EXPAND_WIDGET, 4);
vb = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL));
vb->pack_start(*hb);
hb = Gtk::manage(new Gtk::Box());
//I disabled these 2 functionnalities...easy to enable
// hb->pack_start(*editor_float32, Gtk::PACK_SHRINK);
// hb->pack_start(*editor_bypass_output_profile, Gtk::PACK_SHRINK, 4);
vb->pack_start(*hb, Gtk::PACK_SHRINK, 4);
vb->show_all_children();
vb->show();
fdg->add(*vb);
}
vbGeneral->attach_next_to (*fdg, *fclip, Gtk::POS_BOTTOM, 2, 1);
langAutoDetectConn = ckbLangAutoDetect->signal_toggled().connect(sigc::mem_fun(*this, &Preferences::langAutoDetectToggled));
tconn = themeCBT->signal_changed().connect ( sigc::mem_fun (*this, &Preferences::themeChanged) );
@@ -1727,6 +1768,17 @@ void Preferences::storePreferences()
moptions.editorToSendTo = 3;
}
if (editor_dir_temp->get_active()) {
moptions.editor_out_dir = Options::EDITOR_OUT_DIR_TEMP;
} else if (editor_dir_current->get_active()) {
moptions.editor_out_dir = Options::EDITOR_OUT_DIR_CURRENT;
} else {
moptions.editor_out_dir = Options::EDITOR_OUT_DIR_CUSTOM;
}
moptions.editor_custom_out_dir = editor_dir_custom_path->get_filename();
moptions.editor_float32 = editor_float32->get_active();
moptions.editor_bypass_output_profile = editor_bypass_output_profile->get_active();
moptions.CPBPath = txtCustProfBuilderPath->get_text();
moptions.CPBKeys = CPBKeyType(custProfBuilderLabelType->get_active_row_number());
@@ -2010,6 +2062,17 @@ void Preferences::fillPreferences()
#endif
editorToSendTo->set_text(moptions.customEditorProg);
editor_dir_temp->set_active(moptions.editor_out_dir == Options::EDITOR_OUT_DIR_TEMP);
editor_dir_current->set_active(moptions.editor_out_dir == Options::EDITOR_OUT_DIR_CURRENT);
editor_dir_custom->set_active(moptions.editor_out_dir == Options::EDITOR_OUT_DIR_CUSTOM);
if (Glib::file_test(moptions.editor_custom_out_dir, Glib::FILE_TEST_IS_DIR)) {
editor_dir_custom_path->set_current_folder(moptions.editor_custom_out_dir);
} else {
editor_dir_custom_path->set_current_folder(Glib::get_tmp_dir());
}
editor_float32->set_active(moptions.editor_float32);
editor_bypass_output_profile->set_active(moptions.editor_bypass_output_profile);
txtCustProfBuilderPath->set_text(moptions.CPBPath);
custProfBuilderLabelType->set_active(moptions.CPBKeys);