- if (ob == dialog_->button_browse)
- return inputBrowse();
-
- if (ob == dialog_->button_load) {
- if (compare(fl_get_input(dialog_->input_filename),"")) {
- ApplyButton();
- return ButtonPolicy::SMI_NOOP;
+ 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;