]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormRef.C
remove defaults stuff, let Qt handle no toolbar
[lyx.git] / src / frontends / xforms / FormRef.C
index 672c24cfa1970cdb756ecad851db56f3826d9539..6cd04355a86e837f3d2fef9f048ba825e1ee9a37 100644 (file)
@@ -1,9 +1,9 @@
 /**
- * \file xforms/FormRef.C
+ * \file FormRef.C
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Angus Leeming 
+ * \author Angus Leeming
  *
  * Full author contact details are available in file CREDITS
  */
@@ -11,9 +11,6 @@
 #include <config.h>
 #include <algorithm>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "xformsBC.h"
 #include "ControlRef.h"
@@ -31,10 +28,10 @@ using std::max;
 using std::sort;
 using std::vector;
 
-typedef FormCB<ControlRef, FormDB<FD_ref> > base_class;
+typedef FormController<ControlRef, FormView<FD_ref> > base_class;
 
-FormRef::FormRef()
-       : base_class(_("Reference")),
+FormRef::FormRef(Dialog & parent)
+       : base_class(parent, _("Reference")),
          at_ref_(false)
 {}
 
@@ -57,14 +54,14 @@ void FormRef::build()
        setPrehandler(dialog_->input_ref);
 
        // Manage the ok and cancel/close buttons
-       bc().setOK(dialog_->button_ok);
-       bc().setApply(dialog_->button_apply);
-       bc().setCancel(dialog_->button_close);
-       bc().setRestore(dialog_->button_restore);
+       bcview().setOK(dialog_->button_ok);
+       bcview().setApply(dialog_->button_apply);
+       bcview().setCancel(dialog_->button_close);
+       bcview().setRestore(dialog_->button_restore);
 
-       bc().addReadOnly(dialog_->button_update);
-       bc().addReadOnly(dialog_->input_name);
-       bc().addReadOnly(dialog_->input_ref);
+       bcview().addReadOnly(dialog_->button_update);
+       bcview().addReadOnly(dialog_->input_name);
+       bcview().addReadOnly(dialog_->input_ref);
 
        // set up the tooltips
        string str = _("Select a document for references.");
@@ -93,16 +90,15 @@ void FormRef::update()
        switch_go_button();
 
        // Name is irrelevant to LaTeX/Literate documents
-       if (controller().docType() == ControlRef::LATEX ||
-           controller().docType() == ControlRef::LITERATE) {
+       Kernel::DocTypes doctype = kernel().docType();
+       if (doctype == Kernel::LATEX || doctype == Kernel::LITERATE) {
                setEnabled(dialog_->input_name, false);
        } else {
                setEnabled(dialog_->input_name, true);
        }
 
        // type is irrelevant to LinuxDoc/DocBook.
-       if (controller().docType() == ControlRef::LINUXDOC ||
-           controller().docType() == ControlRef::DOCBOOK) {
+       if (doctype == Kernel::LINUXDOC || doctype == Kernel::DOCBOOK) {
                fl_set_choice(dialog_->choice_format, 1);
                setEnabled(dialog_->choice_format, false);
        } else {
@@ -119,7 +115,7 @@ void FormRef::update()
                // create a string of entries " entry1 | entry2 | entry3 "
                // with which to initialise the xforms choice object.
                string const choice =
-                       " " + getStringFromVector(buffers, " | ") + " ";
+                       ' ' + getStringFromVector(buffers, " | ") + ' ';
 
                fl_clear_choice(dialog_->choice_document);
                fl_addto_choice(dialog_->choice_document, choice.c_str());
@@ -154,7 +150,7 @@ void updateHighlight(FL_OBJECT * browser,
                fl_select_browser_line(browser, i+1);
        }
 }
+
 } // namespace anon
 
 
@@ -229,7 +225,7 @@ ButtonPolicy::SMInput FormRef::input(FL_OBJECT * ob, long)
                if (sel < 1 || sel > refs_.size())
                        return ButtonPolicy::SMI_NOOP;
 
-               if (!controller().bufferIsReadonly()) {
+               if (!kernel().isBufferReadonly()) {
                        string s = fl_get_browser_line(dialog_->browser_refs, sel);
                        fl_set_input(dialog_->input_ref, s.c_str());
                }
@@ -247,6 +243,9 @@ ButtonPolicy::SMInput FormRef::input(FL_OBJECT * ob, long)
                   ob == dialog_->check_sort ||
                   ob == dialog_->choice_document) {
 
+               // No change to data
+               activate = ButtonPolicy::SMI_NOOP;
+
                if (ob == dialog_->button_update ||
                    ob == dialog_->choice_document) {
                        string const name =