]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormExternal.C
remove defaults stuff, let Qt handle no toolbar
[lyx.git] / src / frontends / xforms / FormExternal.C
index d4f45513e21b10480f3d0f77330e4dda9f12f067..a74505b0bf6afc7558ce70ab23efdafc285d1961 100644 (file)
@@ -1,62 +1,71 @@
 /**
  * \file FormExternal.C
- * Copyright 2000-2001 The LyX Team.
- * See the file COPYING.
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
  * \author Asger Alstrup
- * \author John Levon, moz@compsoc.man.ac.uk
- * \author Angus Leeming, a.leeming@ic.ac.uk
+ * \author John Levon
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "xformsBC.h"
 #include "ControlExternal.h"
 #include "FormExternal.h"
-#include "form_external.h"
+#include "forms/form_external.h"
 #include "gettext.h"
 #include "xforms_helpers.h"
 #include "helper_funcs.h"
 
-typedef FormCB<ControlExternal, FormDB<FD_form_external> > base_class;
+#include "support/lstrings.h"
+#include FORMS_H_LOCATION
+
+typedef FormController<ControlExternal, FormView<FD_external> > base_class;
 
-FormExternal::FormExternal(ControlExternal & c)
-       : base_class(c, _("Edit external file"))
+FormExternal::FormExternal(Dialog & parent)
+       : base_class(parent, _("Edit external file"))
 {}
 
 
 void FormExternal::apply()
 {
-       controller().params().filename =
-               fl_get_input(dialog_->input_filename);
-       controller().params().parameters =
-               fl_get_input(dialog_->input_parameters);
+       InsetExternal::Params params = controller().params();
+
+       params.filename = fl_get_input(dialog_->input_filename);
+       params.parameters = fl_get_input(dialog_->input_parameters);
 
-       int const choice = fl_get_choice(dialog_->choice_template);
-       controller().params().templ = controller().getTemplate(choice);
+       int const choice = fl_get_choice(dialog_->choice_template) - 1;
+       params.templ = controller().getTemplate(choice);
+
+       controller().setParams(params);
 }
 
 
 void FormExternal::build()
 {
-       dialog_.reset(build_external());
+       dialog_.reset(build_external(this));
 
        string const choice =
-           " " + getStringFromVector(controller().getTemplates(), " | ") + " ";
+               ' ' + getStringFromVector(controller().getTemplates(), " | ") + ' ';
        fl_addto_choice(dialog_->choice_template, choice.c_str());
-       fl_set_input_return (dialog_->input_filename, FL_RETURN_CHANGED);
 
-       bc().setOK(dialog_->button_ok);
-       bc().setApply(dialog_->button_apply);
-       bc().setCancel(dialog_->button_cancel);
+       fl_set_input_return (dialog_->input_filename,  FL_RETURN_CHANGED);
+       fl_set_input_return (dialog_->input_parameters, FL_RETURN_CHANGED);
+
+       setPrehandler(dialog_->input_filename);
+       setPrehandler(dialog_->input_parameters);
+
+       bcview().setOK(dialog_->button_ok);
+       bcview().setApply(dialog_->button_apply);
+       bcview().setCancel(dialog_->button_close);
 
-       bc().addReadOnly(dialog_->input_filename);
-       bc().addReadOnly(dialog_->button_filenamebrowse);
-       bc().addReadOnly(dialog_->input_parameters);
+       bcview().addReadOnly(dialog_->input_filename);
+       bcview().addReadOnly(dialog_->button_filenamebrowse);
+       bcview().addReadOnly(dialog_->input_parameters);
 }
 
 
@@ -83,8 +92,10 @@ ButtonPolicy::SMInput FormExternal::input(FL_OBJECT * ob, long)
        if (ob == dialog_->choice_template) {
 
                // set to the chosen template
-               int const choice = fl_get_choice(dialog_->choice_template);
-               controller().params().templ = controller().getTemplate(choice);
+               int const choice = fl_get_choice(dialog_->choice_template) - 1;
+               InsetExternal::Params params = controller().params();
+               params.templ = controller().getTemplate(choice);
+               controller().setParams(params);
 
                updateComboChange();