]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathMacroTemplate.h
revert last patch. there's something wrong, possibly unrelated to this
[lyx.git] / src / mathed / MathMacroTemplate.h
index 6f2fa1d3b7e03b7696760bdf4f3390a82fb948a1..0af0975144ff8460b98ef672cbfdace65cbb9e1f 100644 (file)
@@ -40,19 +40,18 @@ public:
        ///
        void edit(Cursor & cur, bool front, EntryDirection entry_from);
        ///
-       bool notifyCursorLeaves(Cursor & cur);
+       bool notifyCursorLeaves(Cursor const & old, Cursor & cur);
        ///
-       void read(Buffer const &, Lexer & lex);
+       void read(Lexer & lex);
        ///
-       void write(Buffer const &, std::ostream & os) const;
+       void write(std::ostream & os) const;
        ///
        void write(WriteStream & os) const;
        /// Output LaTeX code, but assume that the macro is not definied yet
        /// if overwriteRedefinition is true
        void write(WriteStream & os, bool overwriteRedefinition) const;
        ///
-       int plaintext(Buffer const &, odocstream &,
-               OutputParams const &) const;
+       int plaintext(odocstream &, OutputParams const &) const;
        ///
        bool noFontChange() const { return true; }
 
@@ -99,6 +98,8 @@ public:
        InsetCode lyxCode() const { return MATHMACRO_CODE; }
        ///
        void infoize(odocstream & os) const;
+       ///
+       docstring contextMenu(BufferView const &, int, int) const;
 
 protected:
        ///
@@ -119,9 +120,9 @@ private:
        /// shift every #n with from<=n, i.e. #n -> #(n-by)
        void shiftArguments(size_t from, int by);
        ///
-       void insertParameter(Cursor & cur, int pos, bool greedy = false);
+       void insertParameter(Cursor & cur, int pos, bool greedy = false, bool addarg = true);
        ///
-       void removeParameter(Cursor & cur, int pos, bool greedy = false );
+       void removeParameter(Cursor & cur, int pos, bool greedy = false);
        ///
        void makeOptional(Cursor & cur);
        ///
@@ -134,11 +135,21 @@ private:
        idx_type displayIdx() const { return optionals_ + 2; }
        ///
        void updateLook() const;
-       /// The representation of the macro tempalte, with some holes to edit
+       /// look through the macro for #n arguments
+       int maxArgumentInDefinition() const;
+       /// add missing #n arguments up to \c maxArg
+       void insertMissingArguments(int maxArg);
+       /// change the arity
+       void changeArity(Cursor & cur, int newNumArg);
+       /// find arguments in definition and adapt the arity accordingly
+       void commitEditChanges(Cursor & cur);
+       /// The representation of the macro template, with some holes to edit
        mutable MathData look_;
        ///
        mutable int numargs_;
        ///
+       mutable int argsInLook_;
+       ///
        int optionals_;
        /// keeps the old optional default value when an 
        /// optional argument is disabled
@@ -149,7 +160,7 @@ private:
        /// defined before already?
        mutable bool redefinition_;
        ///
-       void createLook() const;
+       void createLook(int args) const;
        ///
        mutable bool lookOutdated_;
        /// true if in pre-calculations of metrics to get height of boxes