]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormUrl.C
Swap two printer related help messages.
[lyx.git] / src / frontends / xforms / FormUrl.C
index 2d67c03a4f102302ba5c6b64f3848c2497ee6cb0..f14e32633935b742d2cc2cd49c23a67636d7f046 100644 (file)
@@ -26,7 +26,8 @@
 #include "lyxfunc.h"
 
 FormUrl::FormUrl(LyXView * lv, Dialogs * d)
-       : FormCommand(lv, d, _("Url")), minh(0), minw(0), dialog_(0)
+       : FormCommand(lv, d, _("Url"), new NoRepeatedApplyReadOnlyPolicy),
+         dialog_(0)
 {
        // let the dialog be shown
        // These are permanent connections so we won't bother
@@ -42,49 +43,55 @@ FormUrl::~FormUrl()
 }
 
 
+FL_FORM * FormUrl::form() const
+{
+       if (dialog_) return dialog_->form;
+       return 0;
+}
+
+
+void FormUrl::connect()
+{
+       fl_set_form_maxsize(form(), 2 * minw_, minh_);
+       FormCommand::connect();
+}
+       
+
 void FormUrl::build()
 {
        dialog_ = build_url();
 
-       // XFORMS bug workaround
-       // Define the min/max dimensions. Actually applied in update()
-       minw = form()->w; minh = form()->h;
-}
+       // Workaround dumb xforms sizing bug
+       minw_ = form()->w;
+       minh_ = form()->h;
 
+       fl_set_input_return(dialog_->name, FL_RETURN_CHANGED);
+       fl_set_input_return(dialog_->url,  FL_RETURN_CHANGED);
 
-FL_FORM * FormUrl::form() const
-{
-       if ( dialog_ ) return dialog_->form;
-       return 0;
+        // Manage the ok, apply, restore and cancel/close buttons
+       bc_.setOK(dialog_->button_ok);
+       bc_.setApply(dialog_->button_apply);
+       bc_.setCancel(dialog_->button_cancel);
+       bc_.setUndoAll(dialog_->button_restore);
+       bc_.refresh();
+
+       bc_.addReadOnly(dialog_->name);
+       bc_.addReadOnly(dialog_->url);
+       bc_.addReadOnly(dialog_->radio_html);
 }
 
 
 void FormUrl::update()
 {
-       fl_set_form_minsize(form(), minw, minh);
-       fl_set_form_maxsize(form(), 2*minw, minh);
-
        fl_set_input(dialog_->url,  params.getContents().c_str());
        fl_set_input(dialog_->name, params.getOptions().c_str());
 
-       if ( params.getCmdName() == "url" )
+       if (params.getCmdName() == "url")
                fl_set_button(dialog_->radio_html, 0);
        else
                fl_set_button(dialog_->radio_html, 1);
 
-       if ( lv_->buffer()->isReadonly() ) {
-               fl_deactivate_object( dialog_->url );
-               fl_deactivate_object( dialog_->name );
-               fl_deactivate_object( dialog_->radio_html );
-               fl_deactivate_object( dialog_->button_ok );
-               fl_set_object_lcol( dialog_->button_ok, FL_INACTIVE );
-       } else {
-               fl_activate_object( dialog_->url );
-               fl_activate_object( dialog_->name );
-               fl_activate_object( dialog_->radio_html );
-               fl_activate_object( dialog_->button_ok );
-               fl_set_object_lcol( dialog_->button_ok, FL_BLACK );
-       }
+       bc_.readOnly(lv_->buffer()->isReadonly());
 }