]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetCommand.cpp
DocBook: add a TODO for a newly discovered bug.
[features.git] / src / insets / InsetCommand.cpp
index 1d67ad97d95d527aec7907d618b4e6ed01b8c5a2..9ca958b5f880857c6195614fa93dcdf9d14cc50c 100644 (file)
@@ -18,7 +18,6 @@
 #include "BufferParams.h"
 #include "BufferView.h"
 #include "Cursor.h"
-#include "DispatchResult.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
 #include "Lexer.h"
 
 #include "insets/InsetBox.h"
 #include "insets/InsetBranch.h"
-#include "insets/InsetCommand.h"
 #include "insets/InsetERT.h"
 #include "insets/InsetExternal.h"
 #include "insets/InsetFloat.h"
 #include "insets/InsetGraphics.h"
 #include "insets/InsetIndex.h"
-#include "insets/InsetLine.h"
 #include "insets/InsetListings.h"
 #include "insets/InsetNote.h"
 #include "insets/InsetPhantom.h"
 #include "insets/InsetSpace.h"
-#include "insets/InsetTabular.h"
 #include "insets/InsetVSpace.h"
 #include "insets/InsetWrap.h"
 
 #include "support/debug.h"
-#include "support/gettext.h"
 #include "support/lstrings.h"
 
 #include "frontends/Application.h"
@@ -60,14 +55,14 @@ namespace lyx {
 // FIXME Would it now be possible to use the InsetCode in
 // place of the mailer name and recover that information?
 InsetCommand::InsetCommand(Buffer * buf, InsetCommandParams const & p)
-       : Inset(buf), p_(p)
+       : Inset(buf), p_(p), broken_(false)
 {}
 
 
 // The sole purpose of this copy constructor is to make sure
 // that the mouse_hover_ map is not copied and remains empty.
 InsetCommand::InsetCommand(InsetCommand const & rhs)
-       : Inset(rhs), p_(rhs.p_)
+       : Inset(rhs), p_(rhs.p_), broken_(false)
 {}
 
 
@@ -80,6 +75,7 @@ InsetCommand & InsetCommand::operator=(InsetCommand const & rhs)
        p_ = rhs.p_;
        mouse_hover_.clear();
        button_ = RenderButton();
+       broken_ = false;
 
        return *this;
 }
@@ -101,7 +97,7 @@ InsetCommand::~InsetCommand()
 void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        button_.update(screenLabel(), editable() || clickable(*mi.base.bv, 0, 0),
-                      inheritFont());
+                      inheritFont(), broken_);
        button_.metrics(mi, dim);
 }
 
@@ -161,9 +157,9 @@ int InsetCommand::plaintext(odocstringstream & os,
 }
 
 
-int InsetCommand::docbook(odocstream &, OutputParams const &) const
+void InsetCommand::docbook(XMLStream &, OutputParams const &) const
 {
-       return 0;
+       return;
 }
 
 
@@ -189,7 +185,7 @@ void InsetCommand::validate(LaTeXFeatures & features) const
 
 void InsetCommand::changeCmdName(string const & new_name)
 {
-       string const old_name = getCmdName();
+       string const old_name = getCmdName();
        if (old_name == new_name)
                return;
 
@@ -220,6 +216,9 @@ void InsetCommand::doDispatch(Cursor & cur, FuncRequest & cmd)
                }
                InsetCommandParams p(p_.code());
                InsetCommand::string2params(to_utf8(cmd.argument()), p);
+               if (p == p_)
+                       // no change
+                       break;
                if (p.getCmdName().empty())
                        cur.noScreenUpdate();
                else {
@@ -230,6 +229,8 @@ void InsetCommand::doDispatch(Cursor & cur, FuncRequest & cmd)
                                string const data = InsetCommand::params2string(p);
                                lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
                                lyx::dispatch(FuncRequest(LFUN_CHAR_DELETE_FORWARD));
+                               cur.forceBufferUpdate();
+                               break;
                        } else
                                setParams(p);
                }
@@ -345,7 +346,8 @@ bool decodeInsetParam(string const & name, string & data,
        case NOMENCL_PRINT_CODE:
        case REF_CODE:
        case TOC_CODE:
-       case HYPERLINK_CODE: {
+       case HYPERLINK_CODE:
+       case COUNTER_CODE: {
                InsetCommandParams p(code);
                data = InsetCommand::params2string(p);
                break;