]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetert.C
* src/LyXAction.C: mark goto-clear-bookmark as working without buffer
[lyx.git] / src / insets / insetert.C
index 1af624cacfdf246a8ff5f32ef5f42835b5114406..15e936c5d201310f9aa7f5b120d24ff2615ae09a 100644 (file)
 
 #include <sstream>
 
-using lyx::docstring;
-using lyx::odocstream;
-using lyx::pos_type;
-using lyx::support::token;
+
+namespace lyx {
+
+using support::token;
 
 using std::endl;
 using std::min;
@@ -62,7 +62,7 @@ void InsetERT::init()
        text_.current_font.setLanguage(latex_language);
        text_.real_current_font.setLanguage(latex_language);
 
-       setInsetName("ERT");
+       setInsetName(from_ascii("ERT"));
 }
 
 
@@ -213,7 +213,7 @@ void InsetERT::doDispatch(LCursor & cur, FuncRequest & cmd)
        }
        case LFUN_INSET_MODIFY: {
                InsetCollapsable::CollapseStatus st;
-               InsetERTMailer::string2params(lyx::to_utf8(cmd.argument()), st);
+               InsetERTMailer::string2params(to_utf8(cmd.argument()), st);
                setStatus(cur, st);
                break;
        }
@@ -322,6 +322,8 @@ bool InsetERT::getStatus(LCursor & cur, FuncRequest const & cmd,
                case LFUN_BIBITEM_INSERT:
                case LFUN_LINE_INSERT:
                case LFUN_PAGEBREAK_INSERT:
+               case LFUN_CLEARPAGE_INSERT:
+               case LFUN_CLEARDOUBLEPAGE_INSERT:
                case LFUN_LANGUAGE:
                case LFUN_LAYOUT:
                case LFUN_LAYOUT_PARAGRAPH:
@@ -352,6 +354,8 @@ bool InsetERT::getStatus(LCursor & cur, FuncRequest const & cmd,
                case LFUN_INSET_INSERT:
                case LFUN_PARAGRAPH_PARAMS_APPLY:
                case LFUN_PARAGRAPH_UPDATE:
+               case LFUN_NOMENCL_INSERT:
+               case LFUN_NOMENCL_PRINT:
                case LFUN_NOACTION:
                        status.enabled(false);
                        return true;
@@ -368,7 +372,7 @@ bool InsetERT::getStatus(LCursor & cur, FuncRequest const & cmd,
                // solution, we consider only the first action of the sequence
                case LFUN_COMMAND_SEQUENCE: {
                        // argument contains ';'-terminated commands
-                       string const firstcmd = token(lyx::to_utf8(cmd.argument()), ';', 0);
+                       string const firstcmd = token(to_utf8(cmd.argument()), ';', 0);
                        FuncRequest func(lyxaction.lookupFunc(firstcmd));
                        func.origin = cmd.origin;
                        return getStatus(cur, func, status);
@@ -393,14 +397,16 @@ bool InsetERT::insetAllowed(InsetBase::Code /* code */) const
 }
 
 
-void InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const
+bool InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        LyXFont tmpfont = mi.base.font;
        getDrawFont(mi.base.font);
        mi.base.font.realize(tmpfont);
        InsetCollapsable::metrics(mi, dim);
        mi.base.font = tmpfont;
+       bool const changed = dim_ != dim;
        dim_ = dim;
+       return changed;
 }
 
 
@@ -472,3 +478,6 @@ InsetERTMailer::params2string(InsetCollapsable::CollapseStatus status)
        data << name_ << ' ' << status;
        return data.str();
 }
+
+
+} // namespace lyx