]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormInset.C
try this for distinguishing inner and outer tabs
[lyx.git] / src / frontends / xforms / FormInset.C
index 57362adac6216e62101880ae748828e56043aa1b..7f81476aaf02e8b13eb7c17a62bc40d875c69239 100644 (file)
 FormInset::FormInset(LyXView * lv, Dialogs * d, string const & t,
                     ButtonPolicy * bp,
                     char const * close, char const * cancel)
-       : FormBaseBD( lv, d, t, bp, close, cancel ), ih_(0)
+       : FormBaseBD(lv, d, t, bp, close, cancel), ih_(0)
 {}
 
 
 void FormInset::connect()
 {
        u_ = d_->updateBufferDependent.
-                connect(slot(this, &FormInset::update));
+                connect(slot(this, &FormInset::updateSlot));
        h_ = d_->hideBufferDependent.
                 connect(slot(this, &FormInset::hide));
+       FormBase::connect();
 }
 
 
@@ -45,10 +46,19 @@ void FormInset::disconnect()
 }
 
 
-FormCommand::FormCommand( LyXView * lv, Dialogs * d, string const & t,
-                         ButtonPolicy * bp,
-                         char const * close, char const * cancel)
-       : FormInset( lv, d, t, bp, close, cancel ),
+void FormInset::updateSlot(bool switched)
+{
+       if (switched)
+               hide();
+       else
+               update();
+}
+
+
+FormCommand::FormCommand(LyXView * lv, Dialogs * d, string const & t,
+                        ButtonPolicy * bp,
+                        char const * close, char const * cancel)
+       : FormInset(lv, d, t, bp, close, cancel),
          inset_(0)
 {}
 
@@ -56,12 +66,12 @@ FormCommand::FormCommand( LyXView * lv, Dialogs * d, string const & t,
 void FormCommand::disconnect()
 {
        inset_ = 0;
-       params = InsetCommandParams( string() );
+       params = InsetCommandParams(string());
        FormInset::disconnect();
 }
 
        
-void FormCommand::showInset( InsetCommand * inset )
+void FormCommand::showInset(InsetCommand * inset)
 {
        if (inset == 0) return;  // maybe we should Assert this?
 
@@ -71,18 +81,20 @@ void FormCommand::showInset( InsetCommand * inset )
 
        inset_    = inset;
        params    = inset->params();
-       ih_ = inset->hide.connect(slot(this, &FormCommand::hide));
+       ih_ = inset->hideDialog.connect(slot(this, &FormCommand::hide));
        show();
 }
 
 
-void FormCommand::createInset( string const & arg )
+void FormCommand::createInset(string const & arg)
 {
        if (inset_) {
                ih_.disconnect();
                inset_ = 0;
        }
 
-       params.setFromString( arg );
+       params.setFromString(arg);
+       if ( !arg.empty() )
+               bc_.valid(); // so that the user can press Ok
        show();
 }