]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathMacroTemplate.h
Change the interface to a paragraph's layout. We still store a LayoutPtr, but now...
[lyx.git] / src / mathed / MathMacroTemplate.h
index edf6cf6c0d1baa3ae4072f02ecaeefc4ecf9dbd8..80a0f9acba6adcf68316478cd50faf2382d30301 100644 (file)
@@ -38,21 +38,20 @@ public:
        ///
        EDITABLE editable() const { return HIGHLY_EDITABLE; }
        ///
-       void edit(Cursor & cur, bool front, EntryDirectionType entry_from);
+       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; }
 
@@ -119,9 +118,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 +133,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 +158,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