- State state = static_cast<State>(data);
-
- switch (state) {
- case BROWSE: {
- // Should browsing too be disabled in RO-mode?
- FileDialog fileDlg(lv_, _("Select document to include"),
- LFUN_SELECT_FILE_SYNC,
- make_pair(string(_("Documents")), string(lyxrc.document_path)));
-
- string ext;
-
- /* input TeX, verbatim, or LyX file ? */
- if (fl_get_button(dialog_->check_useinput))
- ext = _("*.tex| LaTeX Documents (*.tex)");
- else if (fl_get_button(dialog_->check_verbatim))
- ext = _("*| All files ");
- else
- ext = _("*.lyx| LyX Documents (*.lyx)");
-
- string mpath;
+ ButtonPolicy::SMInput action = ButtonPolicy::SMI_VALID;
+
+ if (ob == dialog_->button_browse) {
+ ControlInclude::Type type;
+ if (fl_get_button(dialog_->check_useinput))
+ type = ControlInclude::INPUT;
+ else if (fl_get_button(dialog_->check_verbatim))
+ type = ControlInclude::VERBATIM;
+ else
+ type = ControlInclude::INCLUDE;
+
+ string const in_name = fl_get_input(dialog_->input_filename);
+ fl_freeze_form(form());
+ string const out_name = controller().Browse(in_name, type);
+ fl_set_input(dialog_->input_filename, out_name.c_str());
+ fl_unfreeze_form(form());
+
+ } else if (ob == dialog_->button_load) {
+ string const in_name = fl_get_input(dialog_->input_filename);
+ if (!strip(in_name).empty() && controller().fileExists(in_name)) {
+// ApplyButton();
+ OKButton();
+ controller().load(strip(in_name));
+ action = ButtonPolicy::SMI_NOOP;
+ }
+
+ } else if (ob == dialog_->check_verbatim) {
+ setEnabled(dialog_->check_visiblespace, true);