#include <config.h>
-#include "debug.h"
-
-#include "xformsBC.h"
-#include "ControlInclude.h"
#include "FormInclude.h"
+#include "ControlInclude.h"
#include "forms/form_include.h"
-#include "insets/insetinclude.h"
+
#include "Tooltips.h"
#include "xforms_helpers.h" // setEnabled
+#include "xformsBC.h"
+
#include "support/lstrings.h" // strip
+
#include "lyx_forms.h"
-#include <algorithm>
+using lyx::support::rtrim;
+
+using std::string;
-using namespace lyx::support;
typedef FormController<ControlInclude, FormView<FD_include> > base_class;
void FormInclude::update()
{
- string const filename = controller().params().cparams.getContents();
- string const cmdname = controller().params().cparams.getCmdName();
- bool const preview = static_cast<bool>((controller().params().cparams.preview()));
+ string const filename = controller().params().getContents();
+ string const cmdname = controller().params().getCmdName();
+ bool const preview = static_cast<bool>((controller().params().preview()));
fl_set_input(dialog_->input_filename, filename.c_str());
void FormInclude::apply()
{
- InsetInclude::Params params = controller().params();
-
- params.cparams.preview(fl_get_button(dialog_->check_preview));
+ InsetCommandParams params = controller().params();
- string const file = fl_get_input(dialog_->input_filename);
- if (controller().fileExists(file))
- params.cparams.setContents(file);
- else
- params.cparams.setContents("");
+ params.preview(fl_get_button(dialog_->check_preview));
+ params.setContents(getString(dialog_->input_filename));
ControlInclude::Type const type = ControlInclude::Type(type_.get());
if (type == ControlInclude::INPUT)
- params.flag = InsetInclude::INPUT;
+ params.setCmdName("input");
else if (type == ControlInclude::INCLUDE)
- params.flag = InsetInclude::INCLUDE;
+ params.setCmdName("include");
else if (type == ControlInclude::VERBATIM) {
if (fl_get_button(dialog_->check_visiblespace))
- params.flag = InsetInclude::VERBAST;
+ params.setCmdName("verbatiminput*");
else
- params.flag = InsetInclude::VERB;
+ params.setCmdName("verbatiminput");
}
controller().setParams(params);
ButtonPolicy::SMInput action = ButtonPolicy::SMI_VALID;
if (ob == dialog_->button_browse) {
- string const in_name = fl_get_input(dialog_->input_filename);
+ string const in_name = getString(dialog_->input_filename);
fl_freeze_form(form());
ControlInclude::Type const type = ControlInclude::Type(type_.get());
string const out_name = controller().Browse(in_name, type);
fl_unfreeze_form(form());
} else if (ob == dialog_->button_load) {
- string const in_name = fl_get_input(dialog_->input_filename);
+ string const in_name = getString(dialog_->input_filename);
if (!rtrim(in_name).empty() && controller().fileExists(in_name)) {
dialog().OKButton();
controller().load(rtrim(in_name));
setEnabled(dialog_->button_load, true);
} else if (ob == dialog_->input_filename) {
- string const in_name = fl_get_input(dialog_->input_filename);
+ string const in_name = getString(dialog_->input_filename);
if (rtrim(in_name).empty())
action = ButtonPolicy::SMI_INVALID;
}