- // it is probably legal to have no printer name since the system will
- // have a default printer set. Or should have.
-// if (fl_get_button(dialog_->radio_printer)
-// && !strlen(fl_get_input(dialog_->input_printer))) {
-// activate = false;
-// }
+ if (ob == dialog_->button_browse) {
+ // Get the filename from the dialog
+ string const in_name = fl_get_input(dialog_->input_file);
+ string const out_name = controller().Browse(in_name);
+
+ // Save the filename to the dialog
+ if (out_name != in_name && !out_name.empty()) {
+ fl_set_input(dialog_->input_file, out_name.c_str());
+ input(0, 0);
+ }
+
+ // select the file radio
+ if (!out_name.empty()) {
+ fl_set_button(dialog_->radio_file, 1);
+ fl_set_button(dialog_->radio_printer, 0);
+ }
+ }
+
+ // if we type into file, select that as a target
+ if (ob == dialog_->input_file && fl_get_button(dialog_->radio_printer)
+ && strlen(fl_get_input(dialog_->input_file))) {
+ fl_set_button(dialog_->radio_file, 1);
+ fl_set_button(dialog_->radio_printer, 0);
+ } else if (ob == dialog_->input_printer) {
+ fl_set_button(dialog_->radio_file, 0);
+ fl_set_button(dialog_->radio_printer, 1);
+ }
+