mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 05:01:49 +00:00
small cleanup, doxygen, formatting changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1521 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
14ee5d8843
commit
9a3176581d
@ -128,7 +128,7 @@ void io_cb(int fd, void *data)
|
|||||||
if (n>=0)
|
if (n>=0)
|
||||||
s[n] = 0;
|
s[n] = 0;
|
||||||
fprintf(stderr, "monitor: Coming: %s\n", s);
|
fprintf(stderr, "monitor: Coming: %s\n", s);
|
||||||
if (strncmp(s, "LYXSRV:", 7)==0) {
|
if (compare(s, "LYXSRV:", 7) == 0) {
|
||||||
if (strstr(s, "bye")) {
|
if (strstr(s, "bye")) {
|
||||||
lyx_listen = 0;
|
lyx_listen = 0;
|
||||||
fprintf(stderr, "monitor: LyX has closed connection!\n");
|
fprintf(stderr, "monitor: LyX has closed connection!\n");
|
||||||
|
@ -65,6 +65,11 @@ src/frontends/kde/tabcreatedlg.C
|
|||||||
src/frontends/kde/tocdlg.C
|
src/frontends/kde/tocdlg.C
|
||||||
src/frontends/kde/urldlg.C
|
src/frontends/kde/urldlg.C
|
||||||
src/frontends/qt2/FormCopyright.C
|
src/frontends/qt2/FormCopyright.C
|
||||||
|
src/frontends/qt2/FormParagraph.C
|
||||||
|
src/frontends/qt2/FormPrint.C
|
||||||
|
src/frontends/qt2/FormTabularCreate.C
|
||||||
|
src/frontends/qt2/paragraphdlgimpl.C
|
||||||
|
src/frontends/qt2/tabularcreatedlgimpl.C
|
||||||
src/frontends/xforms/FormBase.h
|
src/frontends/xforms/FormBase.h
|
||||||
src/frontends/xforms/form_bibitem.C
|
src/frontends/xforms/form_bibitem.C
|
||||||
src/frontends/xforms/FormBibitem.C
|
src/frontends/xforms/FormBibitem.C
|
||||||
|
@ -1,3 +1,32 @@
|
|||||||
|
2001-02-16 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* vspace.h: doxygen
|
||||||
|
|
||||||
|
* text.C (GetVisibleRow): make several local vars const
|
||||||
|
|
||||||
|
* tabular.C: small cleanup.
|
||||||
|
|
||||||
|
* lyxserver.C (callback): use compare instead of strncmp
|
||||||
|
|
||||||
|
* lyxparagraph.h: remove all code dep. on HAVE_ROPE, move inclass
|
||||||
|
inlines to after class or to paragraph.C
|
||||||
|
|
||||||
|
* lyxfont.h: remove friend operator!=
|
||||||
|
|
||||||
|
* converter.h: move friend bool operator< to non friend and after
|
||||||
|
class def.
|
||||||
|
|
||||||
|
* combox.h: small cleanup
|
||||||
|
|
||||||
|
* buffer.h: doxygen, remove unused constructor, move inclas inlies
|
||||||
|
to inlines after class def.
|
||||||
|
|
||||||
|
* buffer.C (pop_tag): use string operations instead of strcmp
|
||||||
|
|
||||||
|
* bmtable.c: doxygen, small cleanup
|
||||||
|
|
||||||
|
* LaTeX.h: remove friend operator==
|
||||||
|
|
||||||
2001-02-14 Lars Gullik Bjønnes <larsbj@lyx.org>
|
2001-02-14 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
* screen.C:
|
* screen.C:
|
||||||
|
@ -74,9 +74,6 @@ public:
|
|||||||
std::set<string> databases;
|
std::set<string> databases;
|
||||||
///
|
///
|
||||||
std::set<string> styles;
|
std::set<string> styles;
|
||||||
///
|
|
||||||
friend
|
|
||||||
bool operator==(Aux_Info const & a, Aux_Info const & o);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,11 +160,6 @@ struct PrinterParams {
|
|||||||
{
|
{
|
||||||
testInvariant();
|
testInvariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
// do we need these?
|
|
||||||
// friend bool operator==(PrinterParams const &, PrinterParams const &);
|
|
||||||
// friend bool operator<(PrinterParams const &, PrinterParams const &);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,15 +29,15 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int nx, ny; /* Dimensions of the table */
|
int nx, ny; /**< Dimensions of the table */
|
||||||
int dx, dy; /* Size of each item */
|
int dx, dy; /**< Size of each item */
|
||||||
int bx, by; /* Bitmap's position */
|
int bx, by; /**< Bitmap's position */
|
||||||
int bw, bh; /* Bitmap dimensions */
|
int bw, bh; /**< Bitmap dimensions */
|
||||||
unsigned char const * bdata; /* Bitmap data */
|
unsigned char const * bdata; /**< Bitmap data */
|
||||||
int maxi; /* Number of items */
|
int maxi; /**< Number of items */
|
||||||
int i; /* Current position */
|
int i; /**< Current position */
|
||||||
int mousebut; /* mouse button pushed */
|
int mousebut; /**< mouse button pushed */
|
||||||
Pixmap pix; /* Pixmap from data (temporal) */
|
Pixmap pix; /**< Pixmap from data (temporal) */
|
||||||
} BMTABLE_SPEC;
|
} BMTABLE_SPEC;
|
||||||
|
|
||||||
|
|
||||||
@ -294,8 +294,10 @@ void fl_set_bmtable_pixmap_data(FL_OBJECT * ob, int nx, int ny,
|
|||||||
|
|
||||||
void fl_set_bmtable_file(FL_OBJECT * ob, int nx, int ny, char const * filename)
|
void fl_set_bmtable_file(FL_OBJECT * ob, int nx, int ny, char const * filename)
|
||||||
{
|
{
|
||||||
int xh, yh;
|
int xh;
|
||||||
unsigned int bw, bh;
|
int yh;
|
||||||
|
unsigned int bw;
|
||||||
|
unsigned int bh;
|
||||||
unsigned char * bdata;
|
unsigned char * bdata;
|
||||||
|
|
||||||
if (XReadBitmapFileData(filename, &bw, &bh,
|
if (XReadBitmapFileData(filename, &bw, &bh,
|
||||||
@ -436,7 +438,10 @@ Pixmap fl_get_bmtable_pixmap(FL_OBJECT * ob)
|
|||||||
|
|
||||||
void fl_draw_bmtable_item(FL_OBJECT * ob, int i, Drawable d, int xx, int yy)
|
void fl_draw_bmtable_item(FL_OBJECT * ob, int i, Drawable d, int xx, int yy)
|
||||||
{
|
{
|
||||||
int x, y, w, h;
|
int x;
|
||||||
|
int y;
|
||||||
|
int w;
|
||||||
|
int h;
|
||||||
GC gc = fl_state[fl_get_vclass()].gc[0];
|
GC gc = fl_state[fl_get_vclass()].gc[0];
|
||||||
BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec;
|
BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec;
|
||||||
|
|
||||||
|
@ -2546,7 +2546,7 @@ void Buffer::pop_tag(ostream & os, string const & tag,
|
|||||||
int j;
|
int j;
|
||||||
|
|
||||||
// pop all tags till specified one
|
// pop all tags till specified one
|
||||||
for (j = pos; (j >= 0) && (strcmp(stack[j], tag.c_str())); --j)
|
for (j = pos; (j >= 0) && tag != stack[j]; --j)
|
||||||
os << "</" << stack[j] << ">";
|
os << "</" << stack[j] << ">";
|
||||||
|
|
||||||
// closes the tag
|
// closes the tag
|
||||||
@ -2561,7 +2561,7 @@ void Buffer::pop_tag(ostream & os, string const & tag,
|
|||||||
#else
|
#else
|
||||||
// pop all tags till specified one
|
// pop all tags till specified one
|
||||||
int j = pos;
|
int j = pos;
|
||||||
for (int j = pos; (j >= 0) && (strcmp(stack[j], tag.c_str())); --j)
|
for (int j = pos; (j >= 0) && tag != stack[j]; --j)
|
||||||
os << "</" << stack[j] << ">";
|
os << "</" << stack[j] << ">";
|
||||||
|
|
||||||
// closes the tag
|
// closes the tag
|
||||||
|
276
src/buffer.h
276
src/buffer.h
@ -37,7 +37,6 @@
|
|||||||
class LyXRC;
|
class LyXRC;
|
||||||
class TeXErrors;
|
class TeXErrors;
|
||||||
class LaTeXFeatures;
|
class LaTeXFeatures;
|
||||||
class auto_mem_buffer;
|
|
||||||
class Language;
|
class Language;
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -54,26 +53,30 @@ struct DEPCLEAN {
|
|||||||
The is is the buffer object. It contains all the informations about
|
The is is the buffer object. It contains all the informations about
|
||||||
a document loaded into LyX. I am not sure if the class is complete or
|
a document loaded into LyX. I am not sure if the class is complete or
|
||||||
minimal, probably not.
|
minimal, probably not.
|
||||||
|
\author Lars Gullik Bjønnes
|
||||||
*/
|
*/
|
||||||
class Buffer {
|
class Buffer {
|
||||||
public:
|
public:
|
||||||
/// what type of log will getLogName() return ?
|
/// What type of log will \c getLogName() return?
|
||||||
enum LogType {
|
enum LogType {
|
||||||
latexlog, /**< LaTeX log */
|
latexlog, ///< LaTeX log
|
||||||
buildlog /**< Literate build log */
|
buildlog ///< Literate build log
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
/** Constructor
|
||||||
|
\param file
|
||||||
|
\param b optional \c false by default
|
||||||
|
*/
|
||||||
explicit Buffer(string const & file, bool b = false);
|
explicit Buffer(string const & file, bool b = false);
|
||||||
|
|
||||||
///
|
/// Destrucotr
|
||||||
~Buffer();
|
~Buffer();
|
||||||
|
|
||||||
/** save the buffer's parameters as user default
|
/** Save the buffer's parameters as user default.
|
||||||
This function saves a file #user_lyxdir/templates/defaults.lyx#
|
This function saves a file \c user_lyxdir/templates/defaults.lyx
|
||||||
which parameters are those of the current buffer. This file
|
which parameters are those of the current buffer. This file
|
||||||
is used as a default template when creating a new
|
is used as a default template when creating a new
|
||||||
file. Returns #true# on success.
|
file. Returns \c true on success.
|
||||||
*/
|
*/
|
||||||
bool saveParamsAsDefaults();
|
bool saveParamsAsDefaults();
|
||||||
|
|
||||||
@ -85,50 +88,43 @@ public:
|
|||||||
/// Maybe we know the function already by number...
|
/// Maybe we know the function already by number...
|
||||||
bool Dispatch(int ac, string const & argument);
|
bool Dispatch(int ac, string const & argument);
|
||||||
|
|
||||||
/// and have an xtl buffer to work with.
|
/// Should be changed to work for a list.
|
||||||
bool Dispatch(int, auto_mem_buffer &);
|
|
||||||
|
|
||||||
/// should be changed to work for a list.
|
|
||||||
void resize();
|
void resize();
|
||||||
///
|
///
|
||||||
void resizeInsets(BufferView *);
|
void resizeInsets(BufferView *);
|
||||||
|
|
||||||
/// Update window titles of all users
|
/// Update window titles of all users.
|
||||||
void updateTitles() const;
|
void updateTitles() const;
|
||||||
|
|
||||||
/// Reset autosave timers for all users
|
/// Reset autosave timers for all users.
|
||||||
void resetAutosaveTimers() const;
|
void resetAutosaveTimers() const;
|
||||||
|
|
||||||
/** Adds the BufferView to the users list.
|
/** Adds the BufferView to the users list.
|
||||||
Later this func will insert the #BufferView# into a real list,
|
Later this func will insert the \c BufferView into a real list,
|
||||||
not just setting a pointer.
|
not just setting a pointer.
|
||||||
*/
|
*/
|
||||||
void addUser(BufferView * u) { users = u; }
|
void addUser(BufferView * u);
|
||||||
|
|
||||||
/** Removes the #BufferView# from the users list.
|
/** Removes the #BufferView# from the users list.
|
||||||
Since we only can have one at the moment, we just reset it.
|
Since we only can have one at the moment, we just reset it.
|
||||||
*/
|
*/
|
||||||
void delUser(BufferView *) { users = 0; }
|
void delUser(BufferView *);
|
||||||
|
|
||||||
///
|
///
|
||||||
void redraw() {
|
void redraw();
|
||||||
users->redraw();
|
|
||||||
users->fitCursor(users->text);
|
|
||||||
//users->updateScrollbar();
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
/// Load the autosaved file.
|
||||||
void loadAutoSaveFile();
|
void loadAutoSaveFile();
|
||||||
|
|
||||||
/** Reads a file.
|
/** Reads a file.
|
||||||
@param par if != 0 insert the file.
|
\param par if != 0 insert the file.
|
||||||
@return #false# if method fails.
|
\return \c false if method fails.
|
||||||
*/
|
*/
|
||||||
bool readFile(LyXLex &, LyXParagraph * par = 0);
|
bool readFile(LyXLex &, LyXParagraph * par = 0);
|
||||||
|
|
||||||
/** Reads a file without header.
|
/** Reads a file without header.
|
||||||
@param par if != 0 insert the file.
|
\param par if != 0 insert the file.
|
||||||
@return false if file is not completely read.
|
\return \c false if file is not completely read.
|
||||||
*/
|
*/
|
||||||
bool readLyXformat2(LyXLex &, LyXParagraph * par = 0);
|
bool readLyXformat2(LyXLex &, LyXParagraph * par = 0);
|
||||||
|
|
||||||
@ -146,13 +142,13 @@ private:
|
|||||||
/// Parse a single inset.
|
/// Parse a single inset.
|
||||||
void readInset(LyXLex &, LyXParagraph *& par, int & pos, LyXFont &);
|
void readInset(LyXLex &, LyXParagraph *& par, int & pos, LyXFont &);
|
||||||
public:
|
public:
|
||||||
/** Save file
|
/** Save file.
|
||||||
Takes care of auto-save files and backup file if requested.
|
Takes care of auto-save files and backup file if requested.
|
||||||
Returns #true# if the save is successful, #false# otherwise.
|
Returns \c true if the save is successful, \c false otherwise.
|
||||||
*/
|
*/
|
||||||
bool save() const;
|
bool save() const;
|
||||||
|
|
||||||
/// Write file. Returns #false# if unsuccesful.
|
/// Write file. Returns \c false if unsuccesful.
|
||||||
bool writeFile(string const &, bool) const;
|
bool writeFile(string const &, bool) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -167,7 +163,7 @@ public:
|
|||||||
string const & original_path,
|
string const & original_path,
|
||||||
bool nice, bool only_body = false);
|
bool nice, bool only_body = false);
|
||||||
/** LaTeX all paragraphs from par to endpar.
|
/** LaTeX all paragraphs from par to endpar.
|
||||||
@param endpar if == 0 then to the end
|
\param \a endpar if == 0 then to the end
|
||||||
*/
|
*/
|
||||||
void latexParagraphs(std::ostream & os, LyXParagraph * par,
|
void latexParagraphs(std::ostream & os, LyXParagraph * par,
|
||||||
LyXParagraph * endpar, TexRow & texrow) const;
|
LyXParagraph * endpar, TexRow & texrow) const;
|
||||||
@ -188,66 +184,42 @@ public:
|
|||||||
bool nice, bool only_body = false);
|
bool nice, bool only_body = false);
|
||||||
|
|
||||||
/// returns the main language for the buffer (document)
|
/// returns the main language for the buffer (document)
|
||||||
Language const * GetLanguage() const {
|
Language const * GetLanguage() const;
|
||||||
return params.language;
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
bool isLyxClean() const { return lyx_clean; }
|
bool isLyxClean() const;
|
||||||
|
|
||||||
///
|
///
|
||||||
bool isBakClean() const { return bak_clean; }
|
bool isBakClean() const;
|
||||||
|
|
||||||
///
|
///
|
||||||
bool isDepClean(string const & name) const;
|
bool isDepClean(string const & name) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
void markLyxClean() const {
|
void markLyxClean() const;
|
||||||
if (!lyx_clean) {
|
|
||||||
lyx_clean = true;
|
|
||||||
updateTitles();
|
|
||||||
}
|
|
||||||
// if the .lyx file has been saved, we don't need an
|
|
||||||
// autosave
|
|
||||||
bak_clean = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
void markBakClean() { bak_clean = true; }
|
void markBakClean();
|
||||||
|
|
||||||
///
|
///
|
||||||
void markDepClean(string const & name);
|
void markDepClean(string const & name);
|
||||||
|
|
||||||
///
|
///
|
||||||
void setUnnamed(bool flag=true) { unnamed = flag; }
|
void setUnnamed(bool flag=true);
|
||||||
|
|
||||||
///
|
///
|
||||||
bool isUnnamed() { return unnamed; }
|
bool isUnnamed();
|
||||||
|
|
||||||
///
|
/// Mark this buffer as dirty.
|
||||||
void markDirty() {
|
void markDirty();
|
||||||
if (lyx_clean) {
|
|
||||||
lyx_clean = false;
|
|
||||||
updateTitles();
|
|
||||||
}
|
|
||||||
bak_clean = false;
|
|
||||||
DEPCLEAN * tmp = dep_clean;
|
|
||||||
while (tmp) {
|
|
||||||
tmp->clean = false;
|
|
||||||
tmp = tmp->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
/// Returns the buffers filename.
|
||||||
string const & fileName() const { return filename; }
|
string const & fileName() const;
|
||||||
|
|
||||||
/** A transformed version of the file name, adequate for LaTeX
|
/** A transformed version of the file name, adequate for LaTeX.
|
||||||
The path is stripped if no_path is true (default)
|
\param no_path optional if \c true then the path is stripped.
|
||||||
*/
|
*/
|
||||||
string const getLatexName(bool no_path = true) const;
|
string const getLatexName(bool no_path = true) const;
|
||||||
|
|
||||||
/// get the name and type of the log
|
/// Get the name and type of the log.
|
||||||
std::pair<LogType, string> const getLogName(void) const;
|
std::pair<LogType, string> const getLogName() const;
|
||||||
|
|
||||||
/// Change name of buffer. Updates "read-only" flag.
|
/// Change name of buffer. Updates "read-only" flag.
|
||||||
void setFileName(string const & newfile);
|
void setFileName(string const & newfile);
|
||||||
@ -256,21 +228,21 @@ public:
|
|||||||
void setParentName(string const &);
|
void setParentName(string const &);
|
||||||
|
|
||||||
/// Is buffer read-only?
|
/// Is buffer read-only?
|
||||||
bool isReadonly() const { return read_only; }
|
bool isReadonly() const;
|
||||||
|
|
||||||
/// Set buffer read-only flag
|
/// Set buffer read-only flag
|
||||||
void setReadonly(bool flag = true);
|
void setReadonly(bool flag = true);
|
||||||
|
|
||||||
/// returns #true# if the buffer contains a LaTeX document
|
/// returns \c true if the buffer contains a LaTeX document
|
||||||
bool isLatex() const;
|
bool isLatex() const;
|
||||||
/// returns #true# if the buffer contains a LinuxDoc document
|
/// returns \c true if the buffer contains a LinuxDoc document
|
||||||
bool isLinuxDoc() const;
|
bool isLinuxDoc() const;
|
||||||
/// returns #true# if the buffer contains a DocBook document
|
/// returns \c true if the buffer contains a DocBook document
|
||||||
bool isDocBook() const;
|
bool isDocBook() const;
|
||||||
/** returns #true# if the buffer contains either a LinuxDoc
|
/** returns \c true if the buffer contains either a LinuxDoc
|
||||||
or DocBook document */
|
or DocBook document */
|
||||||
bool isSGML() const;
|
bool isSGML() const;
|
||||||
/// returns #true# if the buffer contains a Wed document
|
/// returns \c true if the buffer contains a Wed document
|
||||||
bool isLiterate() const;
|
bool isLiterate() const;
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -300,16 +272,12 @@ public:
|
|||||||
///
|
///
|
||||||
string str;
|
string str;
|
||||||
};
|
};
|
||||||
///
|
/// The different content list types.
|
||||||
enum TocType {
|
enum TocType {
|
||||||
///
|
TOC_TOC = 0, ///< Table of Contents
|
||||||
TOC_TOC = 0,
|
TOC_LOF, ///< List of Figures
|
||||||
///
|
TOC_LOT, ///< List of Tables
|
||||||
TOC_LOF,
|
TOC_LOA ///< List of Algorithms
|
||||||
///
|
|
||||||
TOC_LOT,
|
|
||||||
///
|
|
||||||
TOC_LOA
|
|
||||||
};
|
};
|
||||||
///
|
///
|
||||||
std::vector<std::vector<TocItem> > const getTocList() const;
|
std::vector<std::vector<TocItem> > const getTocList() const;
|
||||||
@ -318,7 +286,7 @@ public:
|
|||||||
|
|
||||||
/** This will clearly have to change later. Later we can have more
|
/** This will clearly have to change later. Later we can have more
|
||||||
than one user per buffer. */
|
than one user per buffer. */
|
||||||
BufferView * getUser() const { return users; }
|
BufferView * getUser() const;
|
||||||
|
|
||||||
///
|
///
|
||||||
void ChangeLanguage(Language const * from, Language const * to);
|
void ChangeLanguage(Language const * from, Language const * to);
|
||||||
@ -334,20 +302,23 @@ public:
|
|||||||
///
|
///
|
||||||
BufferParams params;
|
BufferParams params;
|
||||||
|
|
||||||
/** is a list of paragraphs.
|
/** The list of paragraphs.
|
||||||
|
This is a linked list of paragraph, this list holds the
|
||||||
|
whole contents of the document.
|
||||||
*/
|
*/
|
||||||
LyXParagraph * paragraph;
|
LyXParagraph * paragraph;
|
||||||
|
|
||||||
/// RCS object
|
/// LyX version control object.
|
||||||
LyXVC lyxvc;
|
LyXVC lyxvc;
|
||||||
|
|
||||||
/// where the temporaries go if we want them
|
/// Where to put temporary files.
|
||||||
string tmppath;
|
string tmppath;
|
||||||
|
|
||||||
///
|
/// The path to the document file.
|
||||||
string filepath;
|
string filepath;
|
||||||
|
|
||||||
/** While writing as LaTeX, tells whether we are
|
/** If we are writing a nice LaTeX file or not.
|
||||||
|
While writing as LaTeX, tells whether we are
|
||||||
doing a 'nice' LaTeX file */
|
doing a 'nice' LaTeX file */
|
||||||
bool niceFile;
|
bool niceFile;
|
||||||
|
|
||||||
@ -472,10 +443,6 @@ public:
|
|||||||
friend
|
friend
|
||||||
bool operator==(inset_iterator const & iter1,
|
bool operator==(inset_iterator const & iter1,
|
||||||
inset_iterator const & iter2);
|
inset_iterator const & iter2);
|
||||||
//
|
|
||||||
//friend
|
|
||||||
//bool operator!=(inset_iterator const & iter1,
|
|
||||||
// inset_iterator const & iter2);
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
void SetParagraph();
|
void SetParagraph();
|
||||||
@ -497,11 +464,126 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
void Buffer::setParentName(string const & name)
|
void Buffer::addUser(BufferView * u)
|
||||||
|
{
|
||||||
|
users = u;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void Buffer::delUser(BufferView *)
|
||||||
|
{
|
||||||
|
users = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void Buffer::redraw()
|
||||||
|
{
|
||||||
|
users->redraw();
|
||||||
|
users->fitCursor(users->text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
Language const * Buffer::GetLanguage() const
|
||||||
|
{
|
||||||
|
return params.language;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool Buffer::isLyxClean() const
|
||||||
|
{
|
||||||
|
return lyx_clean;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool Buffer::isBakClean() const
|
||||||
|
{
|
||||||
|
return bak_clean;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void Buffer::markLyxClean() const
|
||||||
|
{
|
||||||
|
if (!lyx_clean) {
|
||||||
|
lyx_clean = true;
|
||||||
|
updateTitles();
|
||||||
|
}
|
||||||
|
// if the .lyx file has been saved, we don't need an
|
||||||
|
// autosave
|
||||||
|
bak_clean = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void Buffer::markBakClean()
|
||||||
|
{
|
||||||
|
bak_clean = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void Buffer::setUnnamed(bool flag = true)
|
||||||
|
{
|
||||||
|
unnamed = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool Buffer::isUnnamed()
|
||||||
|
{
|
||||||
|
return unnamed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void Buffer::markDirty()
|
||||||
|
{
|
||||||
|
if (lyx_clean) {
|
||||||
|
lyx_clean = false;
|
||||||
|
updateTitles();
|
||||||
|
}
|
||||||
|
bak_clean = false;
|
||||||
|
DEPCLEAN * tmp = dep_clean;
|
||||||
|
while (tmp) {
|
||||||
|
tmp->clean = false;
|
||||||
|
tmp = tmp->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
string const & Buffer::fileName() const
|
||||||
|
{
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool Buffer::isReadonly() const
|
||||||
|
{
|
||||||
|
return read_only;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
BufferView * Buffer::getUser() const
|
||||||
|
{
|
||||||
|
return users;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void Buffer::Buffer::setParentName(string const & name)
|
||||||
{
|
{
|
||||||
params.parentname = name;
|
params.parentname = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
inline
|
inline
|
||||||
bool operator==(Buffer::TocItem const & a, Buffer::TocItem const & b) {
|
bool operator==(Buffer::TocItem const & a, Buffer::TocItem const & b) {
|
||||||
|
@ -133,7 +133,9 @@ public:
|
|||||||
///
|
///
|
||||||
combox_type type;
|
combox_type type;
|
||||||
///
|
///
|
||||||
int bw, bh;
|
int bw;
|
||||||
|
///
|
||||||
|
int bh;
|
||||||
///
|
///
|
||||||
int sel;
|
int sel;
|
||||||
///
|
///
|
||||||
|
@ -61,9 +61,6 @@ public:
|
|||||||
void setViewer(string const & v) {
|
void setViewer(string const & v) {
|
||||||
viewer_ = v;
|
viewer_ = v;
|
||||||
}
|
}
|
||||||
friend bool operator<(Format const & a, Format const & b) {
|
|
||||||
return compare_no_case(a.prettyname(),b.prettyname()) < 0;
|
|
||||||
}
|
|
||||||
private:
|
private:
|
||||||
string name_;
|
string name_;
|
||||||
///
|
///
|
||||||
@ -77,6 +74,13 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool operator<(Format const & a, Format const & b)
|
||||||
|
{
|
||||||
|
return compare_no_case(a.prettyname(),b.prettyname()) < 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
class Formats {
|
class Formats {
|
||||||
public:
|
public:
|
||||||
|
@ -78,9 +78,6 @@ struct Debug {
|
|||||||
///
|
///
|
||||||
static type const ANY;
|
static type const ANY;
|
||||||
|
|
||||||
///
|
|
||||||
// friend inline void operator|=(Debug::type & d1, Debug::type d2);
|
|
||||||
|
|
||||||
/** A function to convert symbolic string names on debug levels
|
/** A function to convert symbolic string names on debug levels
|
||||||
to their numerical value.
|
to their numerical value.
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
2001-02-16 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* FormCitation.C: small cleanup.
|
||||||
|
(searchSimple): better localization of variables, don't use
|
||||||
|
sequencing operator if you don't have to.
|
||||||
|
|
||||||
|
* other: use compare instead of strcmp/strncmp
|
@ -924,10 +924,11 @@ void FormCitation::searchReg()
|
|||||||
void FormCitation::searchSimple()
|
void FormCitation::searchSimple()
|
||||||
{
|
{
|
||||||
vector<string> searchwords;
|
vector<string> searchwords;
|
||||||
string tmp, stext( search_string_ );
|
string tmp;
|
||||||
|
string stext(search_string_);
|
||||||
stext = frontStrip( strip( stext ) );
|
stext = frontStrip( strip( stext ) );
|
||||||
stext = frontStrip( split(stext, tmp, ' ') );
|
stext = frontStrip( split(stext, tmp, ' ') );
|
||||||
while( !tmp.empty() )
|
while ( !tmp.empty() )
|
||||||
{
|
{
|
||||||
searchwords.push_back(tmp);
|
searchwords.push_back(tmp);
|
||||||
stext = frontStrip( split(stext, tmp, ' ') );
|
stext = frontStrip( split(stext, tmp, ' ') );
|
||||||
@ -939,20 +940,17 @@ void FormCitation::searchSimple()
|
|||||||
clist_bib_->freeze();
|
clist_bib_->freeze();
|
||||||
|
|
||||||
int const sz = bibkeys.size();
|
int const sz = bibkeys.size();
|
||||||
bool additem;
|
for (int i = 0; i < sz; ++i) {
|
||||||
for ( int i = 0; i < sz; ++i )
|
string const data = bibkeys[i] + bibkeysInfo[i];
|
||||||
{
|
|
||||||
string data = bibkeys[i] + bibkeysInfo[i];
|
|
||||||
|
|
||||||
additem = true;
|
bool additem = true;
|
||||||
|
|
||||||
int j, szs;
|
int const szs = searchwords.size();
|
||||||
for (j = 0, szs = searchwords.size();
|
for (int j = 0; additem && j < szs; ++j)
|
||||||
additem && j < szs; ++j )
|
if (data.find(searchwords[j]) == string::npos)
|
||||||
if ( data.find(searchwords[j]) == string::npos )
|
additem = false;
|
||||||
additem = false;
|
|
||||||
|
|
||||||
if ( additem ) addItemToBibList(i);
|
if (additem) addItemToBibList(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
clist_bib_->sort();
|
clist_bib_->sort();
|
||||||
|
@ -85,14 +85,10 @@ void
|
|||||||
diaprint_on_print_from_changed (GtkEditable *editable,
|
diaprint_on_print_from_changed (GtkEditable *editable,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkSpinButton * to;
|
int nmin = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(editable) );
|
||||||
GtkAdjustment * a;
|
GtkSpinButton * to = GTK_SPIN_BUTTON(lookup_widget(GTK_WIDGET(editable), "print_to"));
|
||||||
int nmin, v;
|
GtkAdjustment * a = gtk_spin_button_get_adjustment(to);
|
||||||
|
int v = gtk_spin_button_get_value_as_int(to);
|
||||||
nmin = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(editable) );
|
|
||||||
to = GTK_SPIN_BUTTON(lookup_widget(GTK_WIDGET(editable), "print_to"));
|
|
||||||
a = gtk_spin_button_get_adjustment(to);
|
|
||||||
v = gtk_spin_button_get_value_as_int(to);
|
|
||||||
|
|
||||||
a->lower = nmin;
|
a->lower = nmin;
|
||||||
if (v < nmin)
|
if (v < nmin)
|
||||||
|
@ -143,7 +143,8 @@ void FormRef::updateRefs()
|
|||||||
dialog_->reference->setText(tmp.c_str());
|
dialog_->reference->setText(tmp.c_str());
|
||||||
|
|
||||||
for (unsigned int i=0; i < dialog_->refs->count(); ++i) {
|
for (unsigned int i=0; i < dialog_->refs->count(); ++i) {
|
||||||
if (!strcmp(dialog_->reference->text(),dialog_->refs->text(i)))
|
if (!compare(dialog_->reference->text(),
|
||||||
|
dialog_->refs->text(i)))
|
||||||
dialog_->refs->setCurrentItem(i);
|
dialog_->refs->setCurrentItem(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,20 +582,20 @@ bool DocDialog::updateParams(BufferParams & params)
|
|||||||
|
|
||||||
string DocDialog::placementString(QComboBox * box) const
|
string DocDialog::placementString(QComboBox * box) const
|
||||||
{
|
{
|
||||||
if (!strcmp(box->currentText(), _("Here")))
|
if (!compare(box->currentText(), _("Here")))
|
||||||
return "h";
|
return "h";
|
||||||
if (!strcmp(box->currentText(), _("Bottom of page")))
|
if (!compare(box->currentText(), _("Bottom of page")))
|
||||||
return "b";
|
return "b";
|
||||||
if (!strcmp(box->currentText(), _("Top of page")))
|
if (!compare(box->currentText(), _("Top of page")))
|
||||||
return "t";
|
return "t";
|
||||||
if (!strcmp(box->currentText(), _("Separate page")))
|
if (!compare(box->currentText(), _("Separate page")))
|
||||||
return "p";
|
return "p";
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void DocDialog::linespacingChanged(const char * sel)
|
void DocDialog::linespacingChanged(const char * sel)
|
||||||
{
|
{
|
||||||
bool const custom = !strcmp(sel, _("custom"));
|
bool const custom = !compare(sel, _("custom"));
|
||||||
|
|
||||||
settings->linespacingVal->setEnabled(custom);
|
settings->linespacingVal->setEnabled(custom);
|
||||||
}
|
}
|
||||||
@ -603,7 +603,7 @@ void DocDialog::linespacingChanged(const char * sel)
|
|||||||
|
|
||||||
void DocDialog::paraspacingChanged(const char * sel)
|
void DocDialog::paraspacingChanged(const char * sel)
|
||||||
{
|
{
|
||||||
bool const custom = !strcmp(sel, _("custom"));
|
bool const custom = !compare(sel, _("custom"));
|
||||||
settings->paraspacingValue->setEnabled(custom);
|
settings->paraspacingValue->setEnabled(custom);
|
||||||
settings->paraspacingStretch->setEnabled(custom);
|
settings->paraspacingStretch->setEnabled(custom);
|
||||||
settings->paraspacingShrink->setEnabled(custom);
|
settings->paraspacingShrink->setEnabled(custom);
|
||||||
@ -612,7 +612,8 @@ void DocDialog::paraspacingChanged(const char * sel)
|
|||||||
void DocDialog::addspaceChanged(bool on)
|
void DocDialog::addspaceChanged(bool on)
|
||||||
{
|
{
|
||||||
settings->paraspacing->setEnabled(on);
|
settings->paraspacing->setEnabled(on);
|
||||||
on = (on && !strcmp(settings->paraspacing->currentText(), _("custom")));
|
on = (on && !compare(settings->paraspacing->currentText(),
|
||||||
|
_("custom")));
|
||||||
settings->paraspacingValue->setEnabled(on);
|
settings->paraspacingValue->setEnabled(on);
|
||||||
settings->paraspacingStretch->setEnabled(on);
|
settings->paraspacingStretch->setEnabled(on);
|
||||||
settings->paraspacingShrink->setEnabled(on);
|
settings->paraspacingShrink->setEnabled(on);
|
||||||
|
@ -91,7 +91,7 @@ void ParaDialog::setReadOnly(bool readonly)
|
|||||||
void ParaDialog::setLabelWidth(char const * text)
|
void ParaDialog::setLabelWidth(char const * text)
|
||||||
{
|
{
|
||||||
// FIXME: should be cleverer here
|
// FIXME: should be cleverer here
|
||||||
if (!strcmp(_("Senseless with this layout!"),text)) {
|
if (!compare(_("Senseless with this layout!"), text)) {
|
||||||
generalpage->labelwidth->setText("");
|
generalpage->labelwidth->setText("");
|
||||||
generalpage->labelwidth->setEnabled(false);
|
generalpage->labelwidth->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -56,7 +56,7 @@ void PrintDialog::clickedBrowse()
|
|||||||
|
|
||||||
void PrintDialog::changedCount(char const * text)
|
void PrintDialog::changedCount(char const * text)
|
||||||
{
|
{
|
||||||
if (strcmp("",text) && strToInt(text) == 0) {
|
if (compare("", text) && strToInt(text) == 0) {
|
||||||
count->setText("1");
|
count->setText("1");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2001-02-16 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* other: use compare instead of strcmp/strncmp
|
||||||
|
|
||||||
2001-02-15 Angus Leeming <a.leeming@ic.ac.uk>
|
2001-02-15 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
* ButtonController.[Ch]: changed trigger_change_ vector and associated
|
* ButtonController.[Ch]: changed trigger_change_ vector and associated
|
||||||
|
@ -79,7 +79,7 @@ void FormBibitem::build()
|
|||||||
bool FormBibitem::input(FL_OBJECT *, long)
|
bool FormBibitem::input(FL_OBJECT *, long)
|
||||||
{
|
{
|
||||||
// minimal validation
|
// minimal validation
|
||||||
if (!strcmp(fl_get_input(dialog_->key),""))
|
if (!compare(fl_get_input(dialog_->key), ""))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -79,7 +79,7 @@ void FormBibtex::build()
|
|||||||
bool FormBibtex::input(FL_OBJECT *, long)
|
bool FormBibtex::input(FL_OBJECT *, long)
|
||||||
{
|
{
|
||||||
// minimal validation
|
// minimal validation
|
||||||
if (!strcmp(fl_get_input(dialog_->database),""))
|
if (!compare(fl_get_input(dialog_->database),""))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -196,7 +196,7 @@ void FormPrint::update()
|
|||||||
|
|
||||||
fl_set_input(dialog_->input_count,
|
fl_set_input(dialog_->input_count,
|
||||||
tostr(pp.count_copies).c_str());
|
tostr(pp.count_copies).c_str());
|
||||||
bc_.valid();
|
bc_.valid(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
2001-02-16 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* insettext.C (textWidth): constify local var
|
||||||
|
|
||||||
|
* insettabular.C: small cleanup.
|
||||||
|
|
||||||
|
* insetfoot.C (Latex): constify local var
|
||||||
|
|
||||||
|
* insetcollapsable.C: small cleanup.
|
||||||
|
|
||||||
|
* figinset.C (runqueue): use compare instead of strcmp
|
||||||
|
|
||||||
2001-02-14 Lars Gullik Bjønnes <larsbj@lyx.org>
|
2001-02-14 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
* insettext.C:
|
* insettext.C:
|
||||||
|
@ -566,7 +566,7 @@ void runqueue()
|
|||||||
for (i = 0; i < nprop; ++i) {
|
for (i = 0; i < nprop; ++i) {
|
||||||
char * p = XGetAtomName(tempdisp,
|
char * p = XGetAtomName(tempdisp,
|
||||||
prop[i]);
|
prop[i]);
|
||||||
if (strcmp(p, "GHOSTVIEW") == 0) {
|
if (compare(p, "GHOSTVIEW") == 0) {
|
||||||
err = false;
|
err = false;
|
||||||
// We free it when we leave so we don't leak.
|
// We free it when we leave so we don't leak.
|
||||||
XFree(p);
|
XFree(p);
|
||||||
|
@ -99,7 +99,9 @@ void InsetCollapsable::Read(Buffer const * buf, LyXLex & lex)
|
|||||||
|
|
||||||
int InsetCollapsable::ascent_collapsed(Painter & pain, LyXFont const &) const
|
int InsetCollapsable::ascent_collapsed(Painter & pain, LyXFont const &) const
|
||||||
{
|
{
|
||||||
int width = 0, ascent = 0, descent = 0;
|
int width = 0;
|
||||||
|
int ascent = 0;
|
||||||
|
int descent = 0;
|
||||||
pain.buttonText(0, 0, label, labelfont, false,
|
pain.buttonText(0, 0, label, labelfont, false,
|
||||||
width, ascent, descent);
|
width, ascent, descent);
|
||||||
return ascent;
|
return ascent;
|
||||||
@ -108,7 +110,9 @@ int InsetCollapsable::ascent_collapsed(Painter & pain, LyXFont const &) const
|
|||||||
|
|
||||||
int InsetCollapsable::descent_collapsed(Painter & pain, LyXFont const &) const
|
int InsetCollapsable::descent_collapsed(Painter & pain, LyXFont const &) const
|
||||||
{
|
{
|
||||||
int width = 0, ascent = 0, descent = 0;
|
int width = 0;
|
||||||
|
int ascent = 0;
|
||||||
|
int descent = 0;
|
||||||
pain.buttonText(0, 0, label, labelfont, false,
|
pain.buttonText(0, 0, label, labelfont, false,
|
||||||
width, ascent, descent);
|
width, ascent, descent);
|
||||||
return descent;
|
return descent;
|
||||||
@ -117,7 +121,9 @@ int InsetCollapsable::descent_collapsed(Painter & pain, LyXFont const &) const
|
|||||||
|
|
||||||
int InsetCollapsable::width_collapsed(Painter & pain, LyXFont const &) const
|
int InsetCollapsable::width_collapsed(Painter & pain, LyXFont const &) const
|
||||||
{
|
{
|
||||||
int width, ascent, descent;
|
int width;
|
||||||
|
int ascent;
|
||||||
|
int descent;
|
||||||
pain.buttonText(TEXT_TO_INSET_OFFSET, 0, label, labelfont, false,
|
pain.buttonText(TEXT_TO_INSET_OFFSET, 0, label, labelfont, false,
|
||||||
width, ascent, descent);
|
width, ascent, descent);
|
||||||
return width + (2*TEXT_TO_INSET_OFFSET);
|
return width + (2*TEXT_TO_INSET_OFFSET);
|
||||||
@ -292,7 +298,7 @@ int InsetCollapsable::Latex(Buffer const * buf, ostream & os,
|
|||||||
int InsetCollapsable::getMaxWidth(Painter & pain,
|
int InsetCollapsable::getMaxWidth(Painter & pain,
|
||||||
UpdatableInset const * inset) const
|
UpdatableInset const * inset) const
|
||||||
{
|
{
|
||||||
int w = UpdatableInset::getMaxWidth(pain,inset);
|
int const w = UpdatableInset::getMaxWidth(pain, inset);
|
||||||
|
|
||||||
if (w < 0) {
|
if (w < 0) {
|
||||||
// What does a negative max width signify? (Lgb)
|
// What does a negative max width signify? (Lgb)
|
||||||
|
@ -55,7 +55,7 @@ int InsetFoot::Latex(Buffer const * buf,
|
|||||||
{
|
{
|
||||||
os << "\\footnote{%\n";
|
os << "\\footnote{%\n";
|
||||||
|
|
||||||
int i = inset->Latex(buf, os, fragile, fp);
|
int const i = inset->Latex(buf, os, fragile, fp);
|
||||||
os << "}%\n";
|
os << "}%\n";
|
||||||
|
|
||||||
return i + 2;
|
return i + 2;
|
||||||
|
@ -220,7 +220,8 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
int i, j;
|
int i;
|
||||||
|
int j;
|
||||||
int nx;
|
int nx;
|
||||||
|
|
||||||
UpdatableInset::draw(bv, font, baseline, x, cleared);
|
UpdatableInset::draw(bv, font, baseline, x, cleared);
|
||||||
@ -355,7 +356,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
|||||||
void InsetTabular::DrawCellLines(Painter & pain, int x, int baseline,
|
void InsetTabular::DrawCellLines(Painter & pain, int x, int baseline,
|
||||||
int row, int cell) const
|
int row, int cell) const
|
||||||
{
|
{
|
||||||
int x2 = x + tabular->GetWidthOfColumn(cell);
|
int x2 = x + tabular->GetWidthOfColumn(cell);
|
||||||
bool on_off;
|
bool on_off;
|
||||||
|
|
||||||
if (!tabular->TopAlreadyDrawed(cell)) {
|
if (!tabular->TopAlreadyDrawed(cell)) {
|
||||||
@ -1367,7 +1368,7 @@ bool InsetTabular::TabularFeatures(BufferView * bv, string const & what)
|
|||||||
string const tmp = tabularFeatures[i].feature;
|
string const tmp = tabularFeatures[i].feature;
|
||||||
|
|
||||||
if (tmp == what.substr(0, tmp.length())) {
|
if (tmp == what.substr(0, tmp.length())) {
|
||||||
//if (!strncmp(tabularFeatures[i].feature.c_str(), what.c_str(),
|
//if (!compare(tabularFeatures[i].feature.c_str(), what.c_str(),
|
||||||
//tabularFeatures[i].feature.length())) {
|
//tabularFeatures[i].feature.length())) {
|
||||||
action = tabularFeatures[i].action;
|
action = tabularFeatures[i].action;
|
||||||
break;
|
break;
|
||||||
@ -1805,7 +1806,7 @@ LyXFunc::func_status InsetTabular::getStatus(string const & what) const
|
|||||||
for (; tabularFeatures[i].action != LyXTabular::LAST_ACTION; ++i) {
|
for (; tabularFeatures[i].action != LyXTabular::LAST_ACTION; ++i) {
|
||||||
string const tmp = tabularFeatures[i].feature;
|
string const tmp = tabularFeatures[i].feature;
|
||||||
if (tmp == what.substr(0, tmp.length())) {
|
if (tmp == what.substr(0, tmp.length())) {
|
||||||
//if (!strncmp(tabularFeatures[i].feature.c_str(), what.c_str(),
|
//if (!compare(tabularFeatures[i].feature.c_str(), what.c_str(),
|
||||||
// tabularFeatures[i].feature.length())) {
|
// tabularFeatures[i].feature.length())) {
|
||||||
action = tabularFeatures[i].action;
|
action = tabularFeatures[i].action;
|
||||||
break;
|
break;
|
||||||
@ -1816,7 +1817,8 @@ LyXFunc::func_status InsetTabular::getStatus(string const & what) const
|
|||||||
|
|
||||||
string const argument = frontStrip(what.substr(tabularFeatures[i].feature.length()));
|
string const argument = frontStrip(what.substr(tabularFeatures[i].feature.length()));
|
||||||
|
|
||||||
int sel_row_start, sel_row_end;
|
int sel_row_start;
|
||||||
|
int sel_row_end;
|
||||||
int dummy;
|
int dummy;
|
||||||
bool flag = true;
|
bool flag = true;
|
||||||
|
|
||||||
@ -2022,8 +2024,10 @@ bool InsetTabular::copySelection(BufferView * bv)
|
|||||||
return false;
|
return false;
|
||||||
delete paste_tabular;
|
delete paste_tabular;
|
||||||
|
|
||||||
int sel_col_start, sel_col_end;
|
int sel_col_start;
|
||||||
int sel_row_start, sel_row_end;
|
int sel_col_end;
|
||||||
|
int sel_row_start;
|
||||||
|
int sel_row_end;
|
||||||
|
|
||||||
sel_col_start = tabular->column_of_cell(sel_cell_start);
|
sel_col_start = tabular->column_of_cell(sel_cell_start);
|
||||||
sel_col_end = tabular->column_of_cell(sel_cell_end);
|
sel_col_end = tabular->column_of_cell(sel_cell_end);
|
||||||
@ -2108,8 +2112,10 @@ bool InsetTabular::cutSelection()
|
|||||||
if (!hasSelection())
|
if (!hasSelection())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int sel_col_start, sel_col_end;
|
int sel_col_start;
|
||||||
int sel_row_start, sel_row_end;
|
int sel_col_end;
|
||||||
|
int sel_row_start;
|
||||||
|
int sel_row_end;
|
||||||
|
|
||||||
sel_col_start = tabular->column_of_cell(sel_cell_start);
|
sel_col_start = tabular->column_of_cell(sel_cell_start);
|
||||||
sel_col_end = tabular->column_of_cell(sel_cell_end);
|
sel_col_end = tabular->column_of_cell(sel_cell_end);
|
||||||
|
@ -261,7 +261,7 @@ int InsetText::width(BufferView * bv, LyXFont const &) const
|
|||||||
|
|
||||||
int InsetText::textWidth(Painter & pain) const
|
int InsetText::textWidth(Painter & pain) const
|
||||||
{
|
{
|
||||||
int w = getMaxWidth(pain, this);
|
int const w = getMaxWidth(pain, this);
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,10 +320,6 @@ public:
|
|||||||
friend
|
friend
|
||||||
bool operator==(LyXFont const & font1, LyXFont const & font2);
|
bool operator==(LyXFont const & font1, LyXFont const & font2);
|
||||||
|
|
||||||
///
|
|
||||||
friend
|
|
||||||
bool operator!=(LyXFont const & font1, LyXFont const & font2);
|
|
||||||
|
|
||||||
/// compares two fonts, ignoring the setting of the Latex part.
|
/// compares two fonts, ignoring the setting of the Latex part.
|
||||||
bool equalExceptLatex(LyXFont const &) const;
|
bool equalExceptLatex(LyXFont const &) const;
|
||||||
|
|
||||||
|
@ -16,12 +16,6 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define HAVE_ROPE 1
|
|
||||||
|
|
||||||
#ifdef HAVE_ROPE
|
|
||||||
#include <rope>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
@ -128,11 +122,7 @@ public:
|
|||||||
///
|
///
|
||||||
typedef char value_type;
|
typedef char value_type;
|
||||||
///
|
///
|
||||||
#ifndef HAVE_ROPE
|
|
||||||
typedef std::vector<value_type> TextContainer;
|
typedef std::vector<value_type> TextContainer;
|
||||||
#else
|
|
||||||
typedef std::rope<value_type> TextContainer;
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
/* This should be TextContainer::size_type, but we need
|
/* This should be TextContainer::size_type, but we need
|
||||||
signed values for now.
|
signed values for now.
|
||||||
@ -169,14 +159,9 @@ public:
|
|||||||
void validate(LaTeXFeatures &) const;
|
void validate(LaTeXFeatures &) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
int id() const {
|
int id() const;
|
||||||
return id_;
|
|
||||||
}
|
|
||||||
///
|
///
|
||||||
void id(int id_arg) {
|
void id(int id_arg);
|
||||||
id_ = id_arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
void read();
|
void read();
|
||||||
|
|
||||||
@ -212,18 +197,13 @@ public:
|
|||||||
void MakeSameLayout(LyXParagraph const * par);
|
void MakeSameLayout(LyXParagraph const * par);
|
||||||
|
|
||||||
/// Is it the first par with same depth and layout?
|
/// Is it the first par with same depth and layout?
|
||||||
bool IsFirstInSequence() const {
|
bool IsFirstInSequence() const;
|
||||||
LyXParagraph const * dhook = DepthHook(GetDepth());
|
|
||||||
return (dhook == this
|
|
||||||
|| dhook->GetLayout() != GetLayout()
|
|
||||||
|| dhook->GetDepth() != GetDepth());
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Check if the current paragraph is the last paragraph in a
|
/** Check if the current paragraph is the last paragraph in a
|
||||||
proof environment */
|
proof environment */
|
||||||
int GetEndLabel(BufferParams const &) const;
|
int GetEndLabel(BufferParams const &) const;
|
||||||
///
|
///
|
||||||
Inset * InInset() { return inset_owner; }
|
Inset * InInset();
|
||||||
///
|
///
|
||||||
void SetInsetOwner(Inset * i);
|
void SetInsetOwner(Inset * i);
|
||||||
///
|
///
|
||||||
@ -238,26 +218,13 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
size_type size() const { return text.size(); }
|
size_type size() const;
|
||||||
///
|
///
|
||||||
void fitToSize() {
|
void fitToSize();
|
||||||
#ifndef HAVE_ROPE
|
|
||||||
text.resize(text.size());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
///
|
///
|
||||||
void setContentsFromPar(LyXParagraph * par) {
|
void setContentsFromPar(LyXParagraph * par);
|
||||||
text = par->text;
|
|
||||||
}
|
|
||||||
///
|
///
|
||||||
void clearContents() {
|
void clearContents();
|
||||||
#ifndef HAVE_ROPE
|
|
||||||
text.clear();
|
|
||||||
#else
|
|
||||||
text.erase(text.mutable_begin(), text.mutable_end());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
VSpace added_space_top;
|
VSpace added_space_top;
|
||||||
|
|
||||||
@ -308,11 +275,11 @@ private:
|
|||||||
array<int, 10> counter_;
|
array<int, 10> counter_;
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
void setCounter(int i, int v) { counter_[i] = v; }
|
void setCounter(int i, int v);
|
||||||
///
|
///
|
||||||
int getCounter(int i) const { return counter_[i]; }
|
int getCounter(int i) const;
|
||||||
///
|
///
|
||||||
void incCounter(int i) { counter_[i]++; }
|
void incCounter(int i);
|
||||||
///
|
///
|
||||||
bool start_of_appendix;
|
bool start_of_appendix;
|
||||||
|
|
||||||
@ -444,14 +411,7 @@ public:
|
|||||||
///
|
///
|
||||||
value_type GetUChar(BufferParams const &, size_type pos) const;
|
value_type GetUChar(BufferParams const &, size_type pos) const;
|
||||||
/// The position must already exist.
|
/// The position must already exist.
|
||||||
void SetChar(size_type pos, value_type c) {
|
void SetChar(size_type pos, value_type c);
|
||||||
#ifndef HAVE_ROPE
|
|
||||||
text[pos] = c;
|
|
||||||
#else
|
|
||||||
text.replace(pos, c);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
void SetFont(size_type pos, LyXFont const & font);
|
void SetFont(size_type pos, LyXFont const & font);
|
||||||
///
|
///
|
||||||
@ -688,15 +648,97 @@ public:
|
|||||||
InsetList::iterator it;
|
InsetList::iterator it;
|
||||||
};
|
};
|
||||||
///
|
///
|
||||||
inset_iterator inset_iterator_begin() {
|
inset_iterator inset_iterator_begin();
|
||||||
return inset_iterator(insetlist.begin());
|
|
||||||
}
|
|
||||||
///
|
///
|
||||||
inset_iterator inset_iterator_end() {
|
inset_iterator inset_iterator_end();
|
||||||
return inset_iterator(insetlist.end());
|
|
||||||
}
|
|
||||||
///
|
///
|
||||||
inset_iterator InsetIterator(size_type pos);
|
inset_iterator InsetIterator(size_type pos);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
int LyXParagraph::id() const
|
||||||
|
{
|
||||||
|
return id_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void LyXParagraph::id(int id_arg)
|
||||||
|
{
|
||||||
|
id_ = id_arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool LyXParagraph::IsFirstInSequence() const
|
||||||
|
{
|
||||||
|
LyXParagraph const * dhook = DepthHook(GetDepth());
|
||||||
|
return (dhook == this
|
||||||
|
|| dhook->GetLayout() != GetLayout()
|
||||||
|
|| dhook->GetDepth() != GetDepth());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
Inset * LyXParagraph::InInset()
|
||||||
|
{
|
||||||
|
return inset_owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
LyXParagraph::size_type LyXParagraph::size() const
|
||||||
|
{
|
||||||
|
return text.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void LyXParagraph::clearContents()
|
||||||
|
{
|
||||||
|
text.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void LyXParagraph::setCounter(int i, int v)
|
||||||
|
{
|
||||||
|
counter_[i] = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
int LyXParagraph::getCounter(int i) const
|
||||||
|
{
|
||||||
|
return counter_[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void LyXParagraph::incCounter(int i)
|
||||||
|
{
|
||||||
|
counter_[i]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void LyXParagraph::SetChar(size_type pos, value_type c)
|
||||||
|
{
|
||||||
|
text[pos] = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
LyXParagraph::inset_iterator LyXParagraph::inset_iterator_begin()
|
||||||
|
{
|
||||||
|
return inset_iterator(insetlist.begin());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
LyXParagraph::inset_iterator LyXParagraph::inset_iterator_end()
|
||||||
|
{
|
||||||
|
return inset_iterator(insetlist.end());
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -432,9 +432,9 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
|
|||||||
while(*p) {
|
while(*p) {
|
||||||
// --- 1. check 'header' ---
|
// --- 1. check 'header' ---
|
||||||
|
|
||||||
if (strncmp(p, "LYXSRV:", 7) == 0) {
|
if (compare(p, "LYXSRV:", 7) == 0) {
|
||||||
server_only = true;
|
server_only = true;
|
||||||
} else if (0!= strncmp(p, "LYXCMD:", 7)) {
|
} else if (0 != compare(p, "LYXCMD:", 7)) {
|
||||||
lyxerr << "LyXServer: Unknown request" << endl;
|
lyxerr << "LyXServer: Unknown request" << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,21 @@
|
|||||||
|
2001-02-16 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* Makefile.am (libmathed_la_SOURCES): remove math_write.C, add
|
||||||
|
math_utils.h
|
||||||
|
|
||||||
|
* math_write.C: delete file
|
||||||
|
* math_delim.C: delete file
|
||||||
|
* marh_sqrtinset.h: delete file
|
||||||
|
|
||||||
|
* move funcs to more localized files, more general cleanup.
|
||||||
|
Constify several local vars. Doxygen changes. Formatting.
|
||||||
|
|
||||||
2001-02-15 Lars Gullik Bjønnes <larsbj@lyx.org>
|
2001-02-15 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* support.C: add some consts
|
||||||
|
|
||||||
* matriz.C: clean up a bit.
|
* matriz.C: clean up a bit.
|
||||||
|
(matmat): remove the for loop.
|
||||||
|
|
||||||
* several files: changes so that several friends can be removed
|
* several files: changes so that several friends can be removed
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ libmathed_la_SOURCES = \
|
|||||||
math_spaceinset.h \
|
math_spaceinset.h \
|
||||||
math_symbols.C \
|
math_symbols.C \
|
||||||
math_utils.C \
|
math_utils.C \
|
||||||
math_write.C \
|
math_utils.h \
|
||||||
math_xiter.C \
|
math_xiter.C \
|
||||||
math_xiter.h \
|
math_xiter.h \
|
||||||
matriz.C \
|
matriz.C \
|
||||||
|
@ -59,6 +59,7 @@ extern string mathed_label;
|
|||||||
extern char const * latex_special_chars;
|
extern char const * latex_special_chars;
|
||||||
|
|
||||||
int greek_kb_flag = 0;
|
int greek_kb_flag = 0;
|
||||||
|
extern char const * latex_mathenv[];
|
||||||
|
|
||||||
// this is only used by Whichfont and mathed_init_fonts (Lgb)
|
// this is only used by Whichfont and mathed_init_fonts (Lgb)
|
||||||
LyXFont * Math_Fonts = 0;
|
LyXFont * Math_Fonts = 0;
|
||||||
@ -70,15 +71,22 @@ static int sel_x;
|
|||||||
static int sel_y;
|
static int sel_y;
|
||||||
static bool sel_flag;
|
static bool sel_flag;
|
||||||
|
|
||||||
MathedCursor * InsetFormula::mathcursor = 0;
|
// quite a hack i know. Should be done with return values...
|
||||||
|
int number_of_newlines = 0;
|
||||||
|
|
||||||
|
static
|
||||||
|
int mathed_write(MathParInset *, std::ostream &, bool fragile,
|
||||||
|
string const & label = string());
|
||||||
|
|
||||||
void mathed_init_fonts();
|
void mathed_init_fonts();
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void mathedValidate(LaTeXFeatures & features, MathParInset * par);
|
void mathedValidate(LaTeXFeatures & features, MathParInset * par);
|
||||||
|
|
||||||
|
|
||||||
|
MathedCursor * InsetFormula::mathcursor = 0;
|
||||||
|
|
||||||
|
|
||||||
LyXFont WhichFont(short type, int size)
|
LyXFont WhichFont(short type, int size)
|
||||||
{
|
{
|
||||||
LyXFont f;
|
LyXFont f;
|
||||||
@ -250,11 +258,9 @@ void InsetFormula::Write(Buffer const * buf, ostream & os) const
|
|||||||
|
|
||||||
int InsetFormula::Latex(Buffer const *, ostream & os, bool fragile, bool) const
|
int InsetFormula::Latex(Buffer const *, ostream & os, bool fragile, bool) const
|
||||||
{
|
{
|
||||||
int ret = 0;
|
|
||||||
//#warning Alejandro, the number of lines is not returned in this case
|
//#warning Alejandro, the number of lines is not returned in this case
|
||||||
// This problem will disapear at 0.13.
|
// This problem will disapear at 0.13.
|
||||||
mathed_write(par, os, &ret, fragile, label);
|
return mathed_write(par, os, fragile, label);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -905,7 +911,7 @@ InsetFormula::LocalDispatch(BufferView * bv, int action, string const & arg)
|
|||||||
|
|
||||||
case LFUN_MATH_SIZE:
|
case LFUN_MATH_SIZE:
|
||||||
if (!arg.empty()) {
|
if (!arg.empty()) {
|
||||||
latexkeys * l = in_word_set(arg);
|
latexkeys const * l = in_word_set(arg);
|
||||||
int sz = (l) ? l->id: -1;
|
int sz = (l) ? l->id: -1;
|
||||||
mathcursor->SetSize(sz);
|
mathcursor->SetSize(sz);
|
||||||
UpdateLocal(bv);
|
UpdateLocal(bv);
|
||||||
@ -950,7 +956,7 @@ InsetFormula::LocalDispatch(BufferView * bv, int action, string const & arg)
|
|||||||
bv->lockedInsetStoreUndo(Undo::INSERT);
|
bv->lockedInsetStoreUndo(Undo::INSERT);
|
||||||
char lf[40], rg[40], arg2[40];
|
char lf[40], rg[40], arg2[40];
|
||||||
int ilf = '(', irg = '.';
|
int ilf = '(', irg = '.';
|
||||||
latexkeys * l;
|
latexkeys const * l;
|
||||||
string vdelim("(){}[]./|");
|
string vdelim("(){}[]./|");
|
||||||
|
|
||||||
if (arg.empty())
|
if (arg.empty())
|
||||||
@ -1246,3 +1252,57 @@ void mathedValidate(LaTeXFeatures & features, MathParInset * par)
|
|||||||
it.Next();
|
it.Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
int mathed_write(MathParInset * p, ostream & os,
|
||||||
|
bool fragile, string const & label)
|
||||||
|
{
|
||||||
|
number_of_newlines = 0;
|
||||||
|
short mathed_env = p->GetType();
|
||||||
|
|
||||||
|
if (mathed_env == LM_OT_MIN) {
|
||||||
|
if (fragile) os << "\\protect";
|
||||||
|
os << "\\( "; // changed from " \\( " (Albrecht Dress)
|
||||||
|
} else {
|
||||||
|
if (mathed_env == LM_OT_PAR){
|
||||||
|
os << "\\[\n";
|
||||||
|
} else {
|
||||||
|
os << "\\begin{"
|
||||||
|
<< latex_mathenv[mathed_env]
|
||||||
|
<< "}";
|
||||||
|
if (is_multicolumn(mathed_env)) {
|
||||||
|
if (mathed_env != LM_OT_ALIGNAT
|
||||||
|
&& mathed_env != LM_OT_ALIGNATN)
|
||||||
|
os << "%";
|
||||||
|
os << "{" << p->GetColumns()/2 << "}";
|
||||||
|
}
|
||||||
|
os << "\n";
|
||||||
|
}
|
||||||
|
++number_of_newlines;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!label.empty() && label[0] > ' '
|
||||||
|
&& is_singlely_numbered(mathed_env)) {
|
||||||
|
os << "\\label{"
|
||||||
|
<< label
|
||||||
|
<< "}\n";
|
||||||
|
++number_of_newlines;
|
||||||
|
}
|
||||||
|
|
||||||
|
p->Write(os, fragile);
|
||||||
|
|
||||||
|
if (mathed_env == LM_OT_MIN){
|
||||||
|
if (fragile) os << "\\protect";
|
||||||
|
os << " \\)";
|
||||||
|
} else if (mathed_env == LM_OT_PAR) {
|
||||||
|
os << "\\]\n";
|
||||||
|
++number_of_newlines;
|
||||||
|
} else {
|
||||||
|
os << "\n\\end{"
|
||||||
|
<< latex_mathenv[mathed_env]
|
||||||
|
<< "}\n";
|
||||||
|
number_of_newlines += 2;
|
||||||
|
}
|
||||||
|
return number_of_newlines;
|
||||||
|
}
|
||||||
|
@ -198,7 +198,7 @@ void InsetFormulaMacro::InsetUnlock(BufferView * bv)
|
|||||||
MathedArray * tarray = tmacro->GetData();
|
MathedArray * tarray = tmacro->GetData();
|
||||||
MathedIter it(tarray);
|
MathedIter it(tarray);
|
||||||
it.Clear();
|
it.Clear();
|
||||||
tmacro->SetData(par->GetData());
|
tmacro->setData(par->GetData());
|
||||||
tmacro->setEditMode(false);
|
tmacro->setEditMode(false);
|
||||||
InsetFormula::InsetUnlock(bv);
|
InsetFormula::InsetUnlock(bv);
|
||||||
}
|
}
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
|
|
||||||
#ifndef MATH_SQRTINSET_H
|
|
||||||
#define MATH_SQRTINSET_H
|
|
||||||
|
|
||||||
#include "math_parinset.h"
|
|
||||||
|
|
||||||
///
|
|
||||||
class MathSqrtInset: public MathParInset {
|
|
||||||
public:
|
|
||||||
///
|
|
||||||
MathSqrtInset(short st = LM_ST_TEXT);
|
|
||||||
///
|
|
||||||
MathedInset * Clone();
|
|
||||||
///
|
|
||||||
void draw(Painter &, int x, int baseline);
|
|
||||||
///
|
|
||||||
void Write(std::ostream &, bool fragile);
|
|
||||||
///
|
|
||||||
void Metrics();
|
|
||||||
///
|
|
||||||
bool Inside(int, int);
|
|
||||||
private:
|
|
||||||
///
|
|
||||||
int hmax, wbody;
|
|
||||||
};
|
|
||||||
#endif
|
|
@ -84,7 +84,7 @@ MathAccentInset::Metrics()
|
|||||||
|
|
||||||
void MathAccentInset::Write(ostream & os, bool fragile)
|
void MathAccentInset::Write(ostream & os, bool fragile)
|
||||||
{
|
{
|
||||||
latexkeys * l = lm_get_key_by_id(code, LM_TK_ACCENT);
|
latexkeys const * l = lm_get_key_by_id(code, LM_TK_ACCENT);
|
||||||
os << '\\' << l->name;
|
os << '\\' << l->name;
|
||||||
if (code!= LM_not)
|
if (code!= LM_not)
|
||||||
os << '{';
|
os << '{';
|
||||||
@ -100,7 +100,7 @@ void MathAccentInset::Write(ostream & os, bool fragile)
|
|||||||
<< '{';
|
<< '{';
|
||||||
}
|
}
|
||||||
if (MathIsSymbol(fn)) {
|
if (MathIsSymbol(fn)) {
|
||||||
latexkeys * l = lm_get_key_by_id(c, LM_TK_SYM);
|
latexkeys const * l = lm_get_key_by_id(c, LM_TK_SYM);
|
||||||
if (l) {
|
if (l) {
|
||||||
os << '\\' << l->name << ' ';
|
os << '\\' << l->name << ' ';
|
||||||
}
|
}
|
||||||
|
@ -452,8 +452,8 @@ void MathedCursor::Insert(byte c, MathedTextCodes t)
|
|||||||
MathMatrixInset * mt = create_multiline(type, cols);
|
MathMatrixInset * mt = create_multiline(type, cols);
|
||||||
mt->SetStyle(LM_ST_DISPLAY);
|
mt->SetStyle(LM_ST_DISPLAY);
|
||||||
mt->SetType(type);
|
mt->SetType(type);
|
||||||
mt->SetData(p->GetData());
|
mt->setData(p->GetData());
|
||||||
p->SetData(0); // BUG duda
|
p->setData(0); // BUG duda
|
||||||
delete p;
|
delete p;
|
||||||
par = mt;
|
par = mt;
|
||||||
p = mt;
|
p = mt;
|
||||||
@ -510,7 +510,7 @@ void MathedCursor::Insert(MathedInset * p, int t)
|
|||||||
if (selection) {
|
if (selection) {
|
||||||
if (MathIsActive(t)) {
|
if (MathIsActive(t)) {
|
||||||
SelCut();
|
SelCut();
|
||||||
static_cast<MathParInset*>(p)->SetData(selarray);
|
static_cast<MathParInset*>(p)->setData(selarray);
|
||||||
} else
|
} else
|
||||||
SelDel();
|
SelDel();
|
||||||
}
|
}
|
||||||
@ -720,7 +720,7 @@ void MathedCursor::setNumbered()
|
|||||||
void MathedCursor::Interpret(string const & s)
|
void MathedCursor::Interpret(string const & s)
|
||||||
{
|
{
|
||||||
MathedInset * p = 0;
|
MathedInset * p = 0;
|
||||||
latexkeys * l = 0;
|
latexkeys const * l = 0;
|
||||||
MathedTextCodes tcode = LM_TC_INSET;
|
MathedTextCodes tcode = LM_TC_INSET;
|
||||||
|
|
||||||
if (s[0] == '^' || s[0] == '_') {
|
if (s[0] == '^' || s[0] == '_') {
|
||||||
@ -758,7 +758,7 @@ void MathedCursor::Interpret(string const & s)
|
|||||||
if (!p) {
|
if (!p) {
|
||||||
lyxerr[Debug::MATHED] << "Macro2 " << s << ' ' << tcode << endl;
|
lyxerr[Debug::MATHED] << "Macro2 " << s << ' ' << tcode << endl;
|
||||||
if (s == "root") {
|
if (s == "root") {
|
||||||
p = new MathRootInset();
|
p = new MathRootInset;
|
||||||
tcode = LM_TC_ACTIVE_INSET;
|
tcode = LM_TC_ACTIVE_INSET;
|
||||||
} else
|
} else
|
||||||
p = new MathFuncInset(s, LM_OT_UNDEF);
|
p = new MathFuncInset(s, LM_OT_UNDEF);
|
||||||
@ -844,7 +844,7 @@ bool MathedCursor::pullArg()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
MathedArray * a = p->GetData();
|
MathedArray * a = p->GetData();
|
||||||
p->SetData(0);
|
p->setData(0);
|
||||||
Delete();
|
Delete();
|
||||||
if (a) {
|
if (a) {
|
||||||
cursor->Merge(a);
|
cursor->Merge(a);
|
||||||
@ -872,7 +872,7 @@ void MathedCursor::MacroModeClose()
|
|||||||
{
|
{
|
||||||
if (macro_mode) {
|
if (macro_mode) {
|
||||||
macro_mode = false;
|
macro_mode = false;
|
||||||
latexkeys * l = in_word_set(imacro->GetName());
|
latexkeys const * l = in_word_set(imacro->GetName());
|
||||||
if (!imacro->GetName().empty()
|
if (!imacro->GetName().empty()
|
||||||
&& (!l || (l && IsMacro(l->token, l->id))) &&
|
&& (!l || (l && IsMacro(l->token, l->id))) &&
|
||||||
!MathMacroTable::mathMTable.getMacro(imacro->GetName())) {
|
!MathMacroTable::mathMTable.getMacro(imacro->GetName())) {
|
||||||
|
@ -9,24 +9,24 @@
|
|||||||
using std::ostream;
|
using std::ostream;
|
||||||
|
|
||||||
|
|
||||||
bool MathDecorationInset::GetLimits() const
|
MathDecorationInset::MathDecorationInset(int d, short st)
|
||||||
|
: MathParInset(st, "", LM_OT_DECO), deco_(d)
|
||||||
{
|
{
|
||||||
return deco == LM_underbrace || deco == LM_overbrace;
|
upper_ = (deco_ != LM_underline && deco_ != LM_underbrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MathDecorationInset::MathDecorationInset(int d, short st)
|
bool MathDecorationInset::GetLimits() const
|
||||||
: MathParInset(st, "", LM_OT_DECO), deco(d)
|
|
||||||
{
|
{
|
||||||
upper = (deco!= LM_underline && deco!= LM_underbrace);
|
return deco_ == LM_underbrace || deco_ == LM_overbrace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MathedInset * MathDecorationInset::Clone()
|
MathedInset * MathDecorationInset::Clone()
|
||||||
{
|
{
|
||||||
MathDecorationInset * p = new MathDecorationInset(deco, GetStyle());
|
MathDecorationInset * p = new MathDecorationInset(deco_, GetStyle());
|
||||||
MathedIter it(array);
|
MathedIter it(array);
|
||||||
p->SetData(it.Copy());
|
p->setData(it.Copy());
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,8 +34,8 @@ MathedInset * MathDecorationInset::Clone()
|
|||||||
void
|
void
|
||||||
MathDecorationInset::draw(Painter & pain, int x, int y)
|
MathDecorationInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
MathParInset::draw(pain, x + (width - dw) / 2, y);
|
MathParInset::draw(pain, x + (width - dw_) / 2, y);
|
||||||
mathed_draw_deco(pain, x, y + dy, width, dh, deco);
|
mathed_draw_deco(pain, x, y + dy_, width, dh_, deco_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -47,24 +47,24 @@ MathDecorationInset::Metrics()
|
|||||||
MathParInset::Metrics();
|
MathParInset::Metrics();
|
||||||
int w = Width() + 4;
|
int w = Width() + 4;
|
||||||
if (w < 16) w = 16;
|
if (w < 16) w = 16;
|
||||||
dh = w / 5;
|
dh_ = w / 5;
|
||||||
if (dh > h) dh = h;
|
if (dh_ > h) dh_ = h;
|
||||||
|
|
||||||
if (upper) {
|
if (upper_) {
|
||||||
ascent += dh + 2;
|
ascent += dh_ + 2;
|
||||||
dy = -ascent;
|
dy_ = -ascent;
|
||||||
} else {
|
} else {
|
||||||
dy = descent + 2;
|
dy_ = descent + 2;
|
||||||
descent += dh + 4;
|
descent += dh_ + 4;
|
||||||
}
|
}
|
||||||
dw = width;
|
dw_ = width;
|
||||||
width = w;
|
width = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathDecorationInset::Write(ostream & os, bool fragile)
|
void MathDecorationInset::Write(ostream & os, bool fragile)
|
||||||
{
|
{
|
||||||
latexkeys * l = lm_get_key_by_id(deco, LM_TK_WIDE);
|
latexkeys const * l = lm_get_key_by_id(deco_, LM_TK_WIDE);
|
||||||
if (fragile &&
|
if (fragile &&
|
||||||
(strcmp(l->name, "overbrace") == 0 ||
|
(strcmp(l->name, "overbrace") == 0 ||
|
||||||
strcmp(l->name, "underbrace") == 0 ||
|
strcmp(l->name, "underbrace") == 0 ||
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
#include "math_parinset.h"
|
#include "math_parinset.h"
|
||||||
|
|
||||||
/// Decorations over (below) a math object
|
/** Decorations over (below) a math object
|
||||||
|
\author Alejandro Aguilar Sierra
|
||||||
|
*/
|
||||||
class MathDecorationInset: public MathParInset {
|
class MathDecorationInset: public MathParInset {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
@ -18,12 +20,16 @@ public:
|
|||||||
void Metrics();
|
void Metrics();
|
||||||
///
|
///
|
||||||
bool GetLimits() const;
|
bool GetLimits() const;
|
||||||
protected:
|
private:
|
||||||
///
|
///
|
||||||
int deco;
|
int deco_;
|
||||||
///
|
///
|
||||||
bool upper;
|
bool upper_;
|
||||||
///
|
///
|
||||||
int dw, dh, dy;
|
int dw_;
|
||||||
|
///
|
||||||
|
int dh_;
|
||||||
|
///
|
||||||
|
int dy_;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,64 +0,0 @@
|
|||||||
/*
|
|
||||||
* File: math_delim.C
|
|
||||||
* Purpose: Draw delimiters and decorations
|
|
||||||
* Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
|
||||||
* Created: January 1996
|
|
||||||
* Description: Vectorial fonts for simple and resizable objets.
|
|
||||||
*
|
|
||||||
* Dependencies: Xlib, XForms
|
|
||||||
*
|
|
||||||
* Copyright: 1996, Alejandro Aguilar Sierra
|
|
||||||
*
|
|
||||||
* Version: 0.8beta, Mathed & Lyx project.
|
|
||||||
*
|
|
||||||
* You are free to use and modify this code under the terms of
|
|
||||||
* the GNU General Public Licence version 2 or later.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#include FORMS_H_LOCATION
|
|
||||||
#include <algorithm>
|
|
||||||
#include "symbol_def.h"
|
|
||||||
#include "math_inset.h"
|
|
||||||
#include "LColor.h"
|
|
||||||
#include "Painter.h"
|
|
||||||
#include "math_deliminset.h"
|
|
||||||
#include "mathed/support.h"
|
|
||||||
|
|
||||||
using std::sort;
|
|
||||||
using std::lower_bound;
|
|
||||||
using std::endl;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Internal struct of a drawing: code n x1 y1 ... xn yn, where code is:
|
|
||||||
* 0 = end, 1 = line, 2 = polyline, 3 = square line, 4= square polyline
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//inline
|
|
||||||
//int odd(int x) { return ((x) & 1); }
|
|
||||||
|
|
||||||
//typedef float matriz_data[2][2];
|
|
||||||
|
|
||||||
//const matriz_data MATIDEN= { {1, 0}, {0, 1}};
|
|
||||||
|
|
||||||
//extern int mathed_char_width(short type, int style, byte c);
|
|
||||||
//extern int mathed_char_height(short, int, byte, int &, int &);
|
|
||||||
|
|
||||||
//#define mateq(m1, m2) memcpy(m1, m2, sizeof(matriz_data))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// If we had exceptions we could return a reference in stead and not
|
|
||||||
// have to check for a null pointer in mathed_draw_deco
|
|
||||||
|
|
||||||
|
|
@ -12,31 +12,32 @@ using std::ostream;
|
|||||||
|
|
||||||
|
|
||||||
MathDelimInset::MathDelimInset(int l, int r, short st)
|
MathDelimInset::MathDelimInset(int l, int r, short st)
|
||||||
: MathParInset(st, "", LM_OT_DELIM), left(l), right(r) {}
|
: MathParInset(st, "", LM_OT_DELIM), left_(l), right_(r) {}
|
||||||
|
|
||||||
|
|
||||||
MathedInset * MathDelimInset::Clone()
|
MathedInset * MathDelimInset::Clone()
|
||||||
{
|
{
|
||||||
MathDelimInset * p = new MathDelimInset(left, right, GetStyle());
|
MathDelimInset * p = new MathDelimInset(left_, right_, GetStyle());
|
||||||
MathedIter it(array);
|
MathedIter it(array);
|
||||||
p->SetData(it.Copy());
|
p->setData(it.Copy());
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MathDelimInset::Write(ostream & os, bool fragile)
|
void MathDelimInset::Write(ostream & os, bool fragile)
|
||||||
{
|
{
|
||||||
latexkeys * l = (left != '|') ? lm_get_key_by_id(left, LM_TK_SYM): 0;
|
latexkeys const * l = (left_ != '|') ?
|
||||||
latexkeys * r = (right != '|') ? lm_get_key_by_id(right, LM_TK_SYM): 0;
|
lm_get_key_by_id(left_, LM_TK_SYM) : 0;
|
||||||
|
latexkeys const * r = (right_ != '|') ?
|
||||||
|
lm_get_key_by_id(right_, LM_TK_SYM) : 0;
|
||||||
os << "\\left";
|
os << "\\left";
|
||||||
if (l) {
|
if (l) {
|
||||||
os << '\\' << l->name << ' ';
|
os << '\\' << l->name << ' ';
|
||||||
} else {
|
} else {
|
||||||
if (left == '{' || left == '}') {
|
if (left_ == '{' || left_ == '}') {
|
||||||
os << '\\' << char(left) << ' ';
|
os << '\\' << char(left_) << ' ';
|
||||||
} else {
|
} else {
|
||||||
os << char(left) << ' ';
|
os << char(left_) << ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MathParInset::Write(os, fragile);
|
MathParInset::Write(os, fragile);
|
||||||
@ -44,36 +45,35 @@ void MathDelimInset::Write(ostream & os, bool fragile)
|
|||||||
if (r) {
|
if (r) {
|
||||||
os << '\\' << r->name << ' ';
|
os << '\\' << r->name << ' ';
|
||||||
} else {
|
} else {
|
||||||
if (right == '{' || right == '}') {
|
if (right_ == '{' || right_ == '}') {
|
||||||
os << '\\' << char(right) << ' ';
|
os << '\\' << char(right_) << ' ';
|
||||||
} else {
|
} else {
|
||||||
os << char(right) << ' ';
|
os << char(right_) << ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MathDelimInset::draw(Painter & pain, int x, int y)
|
MathDelimInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
xo(x);
|
xo(x);
|
||||||
yo(y);
|
yo(y);
|
||||||
MathParInset::draw(pain, x + dw + 2, y - dh);
|
MathParInset::draw(pain, x + dw_ + 2, y - dh_);
|
||||||
|
|
||||||
if (left == '.') {
|
if (left_ == '.') {
|
||||||
pain.line(x + 4, yo() - ascent,
|
pain.line(x + 4, yo() - ascent,
|
||||||
x + 4, yo() + descent,
|
x + 4, yo() + descent,
|
||||||
LColor::mathcursor, Painter::line_onoffdash);
|
LColor::mathcursor, Painter::line_onoffdash);
|
||||||
} else
|
} else
|
||||||
mathed_draw_deco(pain, x, y - ascent, dw, Height(), left);
|
mathed_draw_deco(pain, x, y - ascent, dw_, Height(), left_);
|
||||||
x += Width() - dw - 2;
|
x += Width() - dw_ - 2;
|
||||||
if (right == '.') {
|
if (right_ == '.') {
|
||||||
pain.line(x + 4, yo() - ascent,
|
pain.line(x + 4, yo() - ascent,
|
||||||
x + 4, yo() + descent,
|
x + 4, yo() + descent,
|
||||||
LColor::mathcursor, Painter::line_onoffdash);
|
LColor::mathcursor, Painter::line_onoffdash);
|
||||||
} else
|
} else
|
||||||
mathed_draw_deco(pain, x, y - ascent, dw, Height(), right);
|
mathed_draw_deco(pain, x, y - ascent, dw_, Height(), right_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -83,12 +83,12 @@ MathDelimInset::Metrics()
|
|||||||
MathParInset::Metrics();
|
MathParInset::Metrics();
|
||||||
int d;
|
int d;
|
||||||
|
|
||||||
mathed_char_height(LM_TC_CONST, size(), 'I', d, dh);
|
mathed_char_height(LM_TC_CONST, size(), 'I', d, dh_);
|
||||||
dh /= 2;
|
dh_ /= 2;
|
||||||
ascent += 2 + dh;
|
ascent += 2 + dh_;
|
||||||
descent += 2 - dh;
|
descent += 2 - dh_;
|
||||||
dw = Height()/5;
|
dw_ = Height()/5;
|
||||||
if (dw > 15) dw = 15;
|
if (dw_ > 15) dw_ = 15;
|
||||||
if (dw < 6) dw = 6;
|
if (dw_ < 6) dw_ = 6;
|
||||||
width += 2 * dw + 4;
|
width += 2 * dw_ + 4;
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,10 @@
|
|||||||
|
|
||||||
#include "math_parinset.h"
|
#include "math_parinset.h"
|
||||||
|
|
||||||
/// A delimiter
|
/** A delimiter
|
||||||
class MathDelimInset: public MathParInset {
|
\author Alejandro Aguilar Sierra
|
||||||
|
*/
|
||||||
|
class MathDelimInset : public MathParInset {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
MathDelimInset(int, int, short st = LM_ST_TEXT);
|
MathDelimInset(int, int, short st = LM_ST_TEXT);
|
||||||
@ -17,14 +19,14 @@ public:
|
|||||||
void Write(std::ostream &, bool fragile);
|
void Write(std::ostream &, bool fragile);
|
||||||
///
|
///
|
||||||
void Metrics();
|
void Metrics();
|
||||||
protected:
|
private:
|
||||||
///
|
///
|
||||||
int left;
|
int left_;
|
||||||
///
|
///
|
||||||
int right;
|
int right_;
|
||||||
///
|
///
|
||||||
int dw;
|
int dw_;
|
||||||
///
|
///
|
||||||
int dh;
|
int dh_;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,22 +8,22 @@ using std::ostream;
|
|||||||
|
|
||||||
|
|
||||||
MathDotsInset::MathDotsInset(string const & nam, int id, short st)
|
MathDotsInset::MathDotsInset(string const & nam, int id, short st)
|
||||||
: MathedInset(nam, LM_OT_DOTS, st), code(id) {}
|
: MathedInset(nam, LM_OT_DOTS, st), code_(id) {}
|
||||||
|
|
||||||
|
|
||||||
MathedInset * MathDotsInset::Clone()
|
MathedInset * MathDotsInset::Clone()
|
||||||
{
|
{
|
||||||
return new MathDotsInset(name, code, GetStyle());
|
return new MathDotsInset(name, code_, GetStyle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MathDotsInset::draw(Painter & pain, int x, int y)
|
MathDotsInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
mathed_draw_deco(pain, x + 2, y - dh, width - 2, ascent, code);
|
mathed_draw_deco(pain, x + 2, y - dh_, width - 2, ascent, code_);
|
||||||
if (code == LM_vdots || code == LM_ddots) ++x;
|
if (code_ == LM_vdots || code_ == LM_ddots) ++x;
|
||||||
if (code != LM_vdots) --y;
|
if (code_ != LM_vdots) --y;
|
||||||
mathed_draw_deco(pain, x + 2, y - dh, width - 2, ascent, code);
|
mathed_draw_deco(pain, x + 2, y - dh_, width - 2, ascent, code_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -32,11 +32,11 @@ MathDotsInset::Metrics()
|
|||||||
{
|
{
|
||||||
mathed_char_height(LM_TC_VAR, size(), 'M', ascent, descent);
|
mathed_char_height(LM_TC_VAR, size(), 'M', ascent, descent);
|
||||||
width = mathed_char_width(LM_TC_VAR, size(), 'M');
|
width = mathed_char_width(LM_TC_VAR, size(), 'M');
|
||||||
switch (code) {
|
switch (code_) {
|
||||||
case LM_ldots: dh = 0; break;
|
case LM_ldots: dh_ = 0; break;
|
||||||
case LM_cdots: dh = ascent/2; break;
|
case LM_cdots: dh_ = ascent/2; break;
|
||||||
case LM_vdots: width /= 2;
|
case LM_vdots: width /= 2;
|
||||||
case LM_ddots: dh = ascent; break;
|
case LM_ddots: dh_ = ascent; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "math_inset.h"
|
#include "math_inset.h"
|
||||||
#include "math_defs.h"
|
#include "math_defs.h"
|
||||||
|
|
||||||
///
|
/// The different kinds of ellipsis
|
||||||
class MathDotsInset: public MathedInset {
|
class MathDotsInset: public MathedInset {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
@ -19,6 +19,8 @@ public:
|
|||||||
void Metrics();
|
void Metrics();
|
||||||
protected:
|
protected:
|
||||||
///
|
///
|
||||||
int dh, code;
|
int dh_;
|
||||||
|
///
|
||||||
|
int code_;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,9 +14,9 @@ MathFracInset::MathFracInset(short ot)
|
|||||||
: MathParInset(LM_ST_TEXT, "frac", ot)
|
: MathParInset(LM_ST_TEXT, "frac", ot)
|
||||||
{
|
{
|
||||||
|
|
||||||
den = new MathParInset(LM_ST_TEXT); // this leaks
|
den_ = new MathParInset(LM_ST_TEXT); // this leaks
|
||||||
dh = 0;
|
dh_ = 0;
|
||||||
idx = 0;
|
idx_ = 0;
|
||||||
if (objtype == LM_OT_STACKREL) {
|
if (objtype == LM_OT_STACKREL) {
|
||||||
flag |= LMPF_SCRIPT;
|
flag |= LMPF_SCRIPT;
|
||||||
SetName("stackrel");
|
SetName("stackrel");
|
||||||
@ -26,7 +26,7 @@ MathFracInset::MathFracInset(short ot)
|
|||||||
|
|
||||||
MathFracInset::~MathFracInset()
|
MathFracInset::~MathFracInset()
|
||||||
{
|
{
|
||||||
delete den;
|
delete den_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -34,10 +34,10 @@ MathedInset * MathFracInset::Clone()
|
|||||||
{
|
{
|
||||||
MathFracInset * p = new MathFracInset(GetType());
|
MathFracInset * p = new MathFracInset(GetType());
|
||||||
MathedIter itn(array);
|
MathedIter itn(array);
|
||||||
MathedIter itd(den->GetData());
|
MathedIter itd(den_->GetData());
|
||||||
p->SetData(itn.Copy(), itd.Copy());
|
p->SetData(itn.Copy(), itd.Copy());
|
||||||
p->idx = idx;
|
p->idx_ = idx_;
|
||||||
p->dh = dh;
|
p->dh_ = dh_;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ MathedInset * MathFracInset::Clone()
|
|||||||
bool MathFracInset::setArgumentIdx(int i)
|
bool MathFracInset::setArgumentIdx(int i)
|
||||||
{
|
{
|
||||||
if (i == 0 || i == 1) {
|
if (i == 0 || i == 1) {
|
||||||
idx = i;
|
idx_ = i;
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
@ -55,8 +55,8 @@ bool MathFracInset::setArgumentIdx(int i)
|
|||||||
void MathFracInset::SetStyle(short st)
|
void MathFracInset::SetStyle(short st)
|
||||||
{
|
{
|
||||||
MathParInset::SetStyle(st);
|
MathParInset::SetStyle(st);
|
||||||
dh = 0;
|
dh_ = 0;
|
||||||
den->SetStyle((size() == LM_ST_DISPLAY) ?
|
den_->SetStyle((size() == LM_ST_DISPLAY) ?
|
||||||
static_cast<short>(LM_ST_TEXT)
|
static_cast<short>(LM_ST_TEXT)
|
||||||
: size());
|
: size());
|
||||||
}
|
}
|
||||||
@ -64,42 +64,42 @@ void MathFracInset::SetStyle(short st)
|
|||||||
|
|
||||||
void MathFracInset::SetData(MathedArray * n, MathedArray * d)
|
void MathFracInset::SetData(MathedArray * n, MathedArray * d)
|
||||||
{
|
{
|
||||||
den->SetData(d);
|
den_->setData(d);
|
||||||
MathParInset::SetData(n);
|
MathParInset::setData(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathFracInset::SetData(MathedArray * d)
|
void MathFracInset::setData(MathedArray * d)
|
||||||
{
|
{
|
||||||
if (idx == 0)
|
if (idx_ == 0)
|
||||||
MathParInset::SetData(d);
|
MathParInset::setData(d);
|
||||||
else {
|
else {
|
||||||
den->SetData(d);
|
den_->setData(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathFracInset::GetXY(int & x, int & y) const
|
void MathFracInset::GetXY(int & x, int & y) const
|
||||||
{
|
{
|
||||||
if (idx == 0)
|
if (idx_ == 0)
|
||||||
MathParInset::GetXY(x, y);
|
MathParInset::GetXY(x, y);
|
||||||
else
|
else
|
||||||
den->GetXY(x, y);
|
den_->GetXY(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MathedArray * MathFracInset::GetData()
|
MathedArray * MathFracInset::GetData()
|
||||||
{
|
{
|
||||||
if (idx == 0)
|
if (idx_ == 0)
|
||||||
return array;
|
return array;
|
||||||
else
|
else
|
||||||
return den->GetData();
|
return den_->GetData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MathFracInset::Inside(int x, int y)
|
bool MathFracInset::Inside(int x, int y)
|
||||||
{
|
{
|
||||||
int xx = xo() - (width - w0) / 2;
|
int xx = xo() - (width - w0_) / 2;
|
||||||
|
|
||||||
return x >= xx
|
return x >= xx
|
||||||
&& x <= xx + width
|
&& x <= xx + width
|
||||||
@ -110,50 +110,52 @@ bool MathFracInset::Inside(int x, int y)
|
|||||||
|
|
||||||
void MathFracInset::SetFocus(int /*x*/, int y)
|
void MathFracInset::SetFocus(int /*x*/, int y)
|
||||||
{
|
{
|
||||||
// lyxerr << "y " << y << " " << yo << " " << den->yo << " ";
|
// lyxerr << "y " << y << " " << yo << " " << den_->yo << " ";
|
||||||
idx = (y > yo()) ? 1: 0;
|
idx_ = (y > yo()) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MathFracInset::draw(Painter & pain, int x, int y)
|
MathFracInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
short idxp = idx;
|
int const idxp = idx_;
|
||||||
short sizex = size();
|
int const sizex = size();
|
||||||
|
|
||||||
idx = 0;
|
idx_ = 0;
|
||||||
if (size() == LM_ST_DISPLAY) incSize();
|
if (size() == LM_ST_DISPLAY) incSize();
|
||||||
MathParInset::draw(pain, x + (width - w0) / 2, y - des0);
|
MathParInset::draw(pain, x + (width - w0_) / 2, y - des0_);
|
||||||
den->draw(pain, x + (width - w1) / 2, y + den->Ascent() + 2 - dh);
|
den_->draw(pain, x + (width - w1_) / 2, y + den_->Ascent() + 2 - dh_);
|
||||||
size(sizex);
|
size(sizex);
|
||||||
if (objtype == LM_OT_FRAC)
|
if (objtype == LM_OT_FRAC)
|
||||||
pain.line(x + 2, y - dh, x + width - 4, y - dh, LColor::mathline);
|
pain.line(x + 2, y - dh_,
|
||||||
idx = idxp;
|
x + width - 4, y - dh_, LColor::mathline);
|
||||||
|
idx_ = idxp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MathFracInset::Metrics()
|
MathFracInset::Metrics()
|
||||||
{
|
{
|
||||||
if (!dh) {
|
if (!dh_) {
|
||||||
int a, b;
|
int a;
|
||||||
dh = mathed_char_height(LM_TC_CONST, size(), 'I', a, b) / 2;
|
int b;
|
||||||
|
dh_ = mathed_char_height(LM_TC_CONST, size(), 'I', a, b) / 2;
|
||||||
}
|
}
|
||||||
short idxp = idx;
|
int const idxp = idx_;
|
||||||
short sizex = size();
|
int const sizex = size();
|
||||||
idx = 0;
|
idx_ = 0;
|
||||||
if (size() == LM_ST_DISPLAY) incSize();
|
if (size() == LM_ST_DISPLAY) incSize();
|
||||||
MathParInset::Metrics();
|
MathParInset::Metrics();
|
||||||
size(sizex);
|
size(sizex);
|
||||||
w0 = width;
|
w0_ = width;
|
||||||
int as = Height() + 2 + dh;
|
int const as = Height() + 2 + dh_;
|
||||||
des0 = Descent() + 2 + dh;
|
des0_ = Descent() + 2 + dh_;
|
||||||
den->Metrics();
|
den_->Metrics();
|
||||||
w1 = den->Width();
|
w1_ = den_->Width();
|
||||||
width = ((w0 > w1) ? w0: w1) + 12;
|
width = ((w0_ > w1_) ? w0_: w1_) + 12;
|
||||||
ascent = as;
|
ascent = as;
|
||||||
descent = den->Height()+ 2 - dh;
|
descent = den_->Height()+ 2 - dh_;
|
||||||
idx = idxp;
|
idx_ = idxp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -162,6 +164,6 @@ void MathFracInset::Write(ostream & os, bool fragile)
|
|||||||
os << '\\' << name << '{';
|
os << '\\' << name << '{';
|
||||||
MathParInset::Write(os, fragile);
|
MathParInset::Write(os, fragile);
|
||||||
os << "}{";
|
os << "}{";
|
||||||
den->Write(os, fragile);
|
den_->Write(os, fragile);
|
||||||
os << '}';
|
os << '}';
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
#ifndef MATH_FRACINSET_H
|
#ifndef MATH_FRACINSET_H
|
||||||
#define MATH_FRACINSET_H
|
#define MATH_FRACINSET_H
|
||||||
|
|
||||||
#include "math_parinset.h"
|
#include "math_parinset.h"
|
||||||
|
|
||||||
/// Fraction like objects (frac, stackrel, binom)
|
/** Fraction like objects (frac, stackrel, binom)
|
||||||
|
\author Alejandro Aguilar Sierra
|
||||||
|
*/
|
||||||
class MathFracInset: public MathParInset {
|
class MathFracInset: public MathParInset {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
@ -24,7 +27,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetData(MathedArray *, MathedArray *);
|
void SetData(MathedArray *, MathedArray *);
|
||||||
///
|
///
|
||||||
void SetData(MathedArray *);
|
void setData(MathedArray *);
|
||||||
///
|
///
|
||||||
void GetXY(int & x, int & y) const;
|
void GetXY(int & x, int & y) const;
|
||||||
///
|
///
|
||||||
@ -36,17 +39,37 @@ public:
|
|||||||
///
|
///
|
||||||
bool setArgumentIdx(int i); // was bool Up/down(void);
|
bool setArgumentIdx(int i); // was bool Up/down(void);
|
||||||
///
|
///
|
||||||
int getArgumentIdx() const { return idx; }
|
int getArgumentIdx() const;
|
||||||
///
|
///
|
||||||
int getMaxArgumentIdx() const { return 1; }
|
int getMaxArgumentIdx() const;
|
||||||
///
|
///
|
||||||
void SetStyle(short);
|
void SetStyle(short);
|
||||||
protected:
|
private:
|
||||||
///
|
///
|
||||||
int idx;
|
int idx_;
|
||||||
///
|
///
|
||||||
MathParInset * den;
|
MathParInset * den_;
|
||||||
///
|
///
|
||||||
int w0, w1, des0, dh;
|
int w0_;
|
||||||
|
///
|
||||||
|
int w1_;
|
||||||
|
///
|
||||||
|
int des0_;
|
||||||
|
///
|
||||||
|
int dh_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
int MathFracInset::getArgumentIdx() const
|
||||||
|
{
|
||||||
|
return idx_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
int MathFracInset::getMaxArgumentIdx() const
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
/* Command-line: gperf -a -p -o -t -G -D keywords */
|
/* Command-line: gperf -a -p -o -t -G -D keywords */
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include "math_defs.h"
|
#include "math_defs.h"
|
||||||
#include "math_parser.h"
|
#include "math_parser.h"
|
||||||
|
#include "support/lstrings.h"
|
||||||
|
|
||||||
int const TOTAL_KEYWORDS = 269;
|
int const TOTAL_KEYWORDS = 269;
|
||||||
int const MIN_WORD_LENGTH = 2;
|
int const MIN_WORD_LENGTH = 2;
|
||||||
@ -38,8 +37,9 @@ math_hash (register char const * str, register int len)
|
|||||||
return len + asso_values[str[len - 1]] + asso_values[str[0]];
|
return len + asso_values[str[len - 1]] + asso_values[str[0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
latexkeys wordlist[] =
|
latexkeys const wordlist[] =
|
||||||
{
|
{
|
||||||
{"",0,0}, {"",0,0}, {"",0,0}, {"",0,0},
|
{"",0,0}, {"",0,0}, {"",0,0}, {"",0,0},
|
||||||
{"",0,0}, {"",0,0}, {"",0,0}, {"",0,0},
|
{"",0,0}, {"",0,0}, {"",0,0}, {"",0,0},
|
||||||
@ -355,7 +355,7 @@ static short lookup[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
latexkeys *
|
latexkeys const *
|
||||||
in_word_set (register char const * str, register int len)
|
in_word_set (register char const * str, register int len)
|
||||||
{
|
{
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) {
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) {
|
||||||
@ -367,17 +367,19 @@ in_word_set (register char const * str, register int len)
|
|||||||
if (idx >= 0 && idx < MAX_HASH_VALUE) {
|
if (idx >= 0 && idx < MAX_HASH_VALUE) {
|
||||||
char const * s = wordlist[idx].name;
|
char const * s = wordlist[idx].name;
|
||||||
|
|
||||||
if (*s == *str && !strcmp (str + 1, s + 1))
|
if (*s == *str && !compare(str + 1, s + 1))
|
||||||
return &wordlist[idx];
|
return &wordlist[idx];
|
||||||
} else if (idx < 0 && idx >= -MAX_HASH_VALUE) {
|
} else if (idx < 0 && idx >= -MAX_HASH_VALUE) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
int const offset = key + idx + (idx > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE);
|
int const offset = key + idx + (idx > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE);
|
||||||
latexkeys * base = &wordlist[-lookup[offset]];
|
latexkeys const * base = &wordlist[-lookup[offset]];
|
||||||
latexkeys * ptr = base + -lookup[offset + 1];
|
latexkeys const * ptr = base + -lookup[offset + 1];
|
||||||
|
|
||||||
while (--ptr >= base)
|
while (--ptr >= base)
|
||||||
if (*str == *ptr->name && !strcmp (str + 1, ptr->name + 1))
|
if (*str == *ptr->name
|
||||||
|
&& !compare(str + 1,
|
||||||
|
ptr->name + 1))
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -386,16 +388,16 @@ in_word_set (register char const * str, register int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
latexkeys * in_word_set(string const & str)
|
latexkeys const * in_word_set(string const & str)
|
||||||
{
|
{
|
||||||
return in_word_set(str.c_str(), str.length());
|
return in_word_set(str.c_str(), str.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
latexkeys * lm_get_key_by_id(int t, short tk)
|
latexkeys const * lm_get_key_by_id(int t, short tk)
|
||||||
{
|
{
|
||||||
latexkeys * l = &wordlist[MIN_HASH_VALUE+TOTAL_KEYWORDS];
|
latexkeys const * l = &wordlist[MIN_HASH_VALUE+TOTAL_KEYWORDS];
|
||||||
latexkeys * base = &wordlist[MIN_HASH_VALUE];
|
latexkeys const * base = &wordlist[MIN_HASH_VALUE];
|
||||||
while (--l >= base) {
|
while (--l >= base) {
|
||||||
if (t == l->id && tk == l->token)
|
if (t == l->id && tk == l->token)
|
||||||
return l;
|
return l;
|
||||||
@ -404,7 +406,7 @@ latexkeys * lm_get_key_by_id(int t, short tk)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
latexkeys * lm_get_key_by_index(int i)
|
latexkeys const * lm_get_key_by_index(int i)
|
||||||
{
|
{
|
||||||
if (i > 0 && i < TOTAL_KEYWORDS + 2)
|
if (i > 0 && i < TOTAL_KEYWORDS + 2)
|
||||||
return &wordlist[i];
|
return &wordlist[i];
|
||||||
|
@ -173,7 +173,7 @@ void MathMacro::SetFocus(int x, int y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathMacro::SetData(MathedArray * a)
|
void MathMacro::setData(MathedArray * a)
|
||||||
{
|
{
|
||||||
args_[idx_].array = a;
|
args_[idx_].array = a;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,10 @@
|
|||||||
class MathMacroTemplate;
|
class MathMacroTemplate;
|
||||||
|
|
||||||
|
|
||||||
/// This class contains the data for a macro
|
/** This class contains the data for a macro
|
||||||
|
\author Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
||||||
|
\version November 1996
|
||||||
|
*/
|
||||||
class MathMacro : public MathParInset
|
class MathMacro : public MathParInset
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -64,7 +67,7 @@ public:
|
|||||||
///
|
///
|
||||||
MathedRowSt * getRowSt() const;
|
MathedRowSt * getRowSt() const;
|
||||||
///
|
///
|
||||||
void SetData(MathedArray *);
|
void setData(MathedArray *);
|
||||||
///
|
///
|
||||||
MathedTextCodes getTCode() const;
|
MathedTextCodes getTCode() const;
|
||||||
///
|
///
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
#include "math_parinset.h"
|
#include "math_parinset.h"
|
||||||
|
|
||||||
/// An argument
|
/** A macro argument
|
||||||
|
\author Alejandro Aguilar Sierra
|
||||||
|
*/
|
||||||
class MathMacroArgument: public MathParInset {
|
class MathMacroArgument: public MathParInset {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
|
@ -63,7 +63,7 @@ void MathMacroTable::builtinMacros()
|
|||||||
MathedArray * array = new MathedArray; // this leaks
|
MathedArray * array = new MathedArray; // this leaks
|
||||||
iter.SetData(array);
|
iter.SetData(array);
|
||||||
iter.Insert(new MathAccentInset(LM_in, LM_TC_BOPS, LM_not)); // this leaks
|
iter.Insert(new MathAccentInset(LM_in, LM_TC_BOPS, LM_not)); // this leaks
|
||||||
m->SetData(array);
|
m->setData(array);
|
||||||
|
|
||||||
// These two are only while we are still with LyX 2.x
|
// These two are only while we are still with LyX 2.x
|
||||||
m = new MathMacroTemplate("emptyset"); // this leaks
|
m = new MathMacroTemplate("emptyset"); // this leaks
|
||||||
@ -71,20 +71,20 @@ void MathMacroTable::builtinMacros()
|
|||||||
array = new MathedArray; // this leaks
|
array = new MathedArray; // this leaks
|
||||||
iter.SetData(array);
|
iter.SetData(array);
|
||||||
iter.Insert(new MathAccentInset('O', LM_TC_RM, LM_not)); // this leaks
|
iter.Insert(new MathAccentInset('O', LM_TC_RM, LM_not)); // this leaks
|
||||||
m->SetData(array);
|
m->setData(array);
|
||||||
|
|
||||||
m = new MathMacroTemplate("perp"); // this leaks
|
m = new MathMacroTemplate("perp"); // this leaks
|
||||||
addTemplate(m);
|
addTemplate(m);
|
||||||
array = new MathedArray; // this leaks
|
array = new MathedArray; // this leaks
|
||||||
iter.SetData(array);
|
iter.SetData(array);
|
||||||
iter.Insert(LM_bot, LM_TC_BOP);
|
iter.Insert(LM_bot, LM_TC_BOP);
|
||||||
m->SetData(array);
|
m->setData(array);
|
||||||
|
|
||||||
// binom has two arguments
|
// binom has two arguments
|
||||||
m = new MathMacroTemplate("binom", 2);
|
m = new MathMacroTemplate("binom", 2);
|
||||||
addTemplate(m);
|
addTemplate(m);
|
||||||
array = new MathedArray;
|
array = new MathedArray;
|
||||||
m->SetData(array);
|
m->setData(array);
|
||||||
iter.SetData(array);
|
iter.SetData(array);
|
||||||
inset = new MathDelimInset('(', ')');
|
inset = new MathDelimInset('(', ')');
|
||||||
iter.Insert(inset, LM_TC_ACTIVE_INSET);
|
iter.Insert(inset, LM_TC_ACTIVE_INSET);
|
||||||
@ -92,7 +92,7 @@ void MathMacroTable::builtinMacros()
|
|||||||
iter.SetData(array);
|
iter.SetData(array);
|
||||||
MathFracInset * frac = new MathFracInset(LM_OT_ATOP);
|
MathFracInset * frac = new MathFracInset(LM_OT_ATOP);
|
||||||
iter.Insert(frac, LM_TC_ACTIVE_INSET);
|
iter.Insert(frac, LM_TC_ACTIVE_INSET);
|
||||||
inset->SetData(array);
|
inset->setData(array);
|
||||||
array = new MathedArray;
|
array = new MathedArray;
|
||||||
array2 = new MathedArray;
|
array2 = new MathedArray;
|
||||||
iter.SetData(array);
|
iter.SetData(array);
|
||||||
|
@ -48,7 +48,7 @@ MathMacroTemplate::~MathMacroTemplate()
|
|||||||
{
|
{
|
||||||
// prevent to delete already deleted objects
|
// prevent to delete already deleted objects
|
||||||
for (int i = 0; i < nargs_; ++i) {
|
for (int i = 0; i < nargs_; ++i) {
|
||||||
args_[i].SetData(0);
|
args_[i].setData(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ void MathMacroTemplate::update(MathMacro * macro)
|
|||||||
for (int i = 0; i < nargs_; ++i) {
|
for (int i = 0; i < nargs_; ++i) {
|
||||||
if (macro) {
|
if (macro) {
|
||||||
macro->setArgumentIdx(i);
|
macro->setArgumentIdx(i);
|
||||||
args_[i].SetData(macro->GetData());
|
args_[i].setData(macro->GetData());
|
||||||
MathedRowSt * row = macro->getRowSt();
|
MathedRowSt * row = macro->getRowSt();
|
||||||
args_[i].setRowSt(row);
|
args_[i].setRowSt(row);
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ void MathMacroTemplate::WriteDef(ostream & os, bool fragile)
|
|||||||
|
|
||||||
void MathMacroTemplate::setArgument(MathedArray * a, int i)
|
void MathMacroTemplate::setArgument(MathedArray * a, int i)
|
||||||
{
|
{
|
||||||
args_[i].SetData(a);
|
args_[i].setData(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,9 @@
|
|||||||
|
|
||||||
class MathMacro;
|
class MathMacro;
|
||||||
|
|
||||||
/// This class contains the macro definition
|
/** This class contains the macro definition
|
||||||
|
\author Alejandro Aguilar Sierra
|
||||||
|
*/
|
||||||
class MathMacroTemplate : public MathParInset {
|
class MathMacroTemplate : public MathParInset {
|
||||||
public:
|
public:
|
||||||
/// A template constructor needs all the data
|
/// A template constructor needs all the data
|
||||||
|
@ -10,244 +10,254 @@ using std::ostream;
|
|||||||
extern int number_of_newlines;
|
extern int number_of_newlines;
|
||||||
|
|
||||||
MathMatrixInset::MathMatrixInset(int m, int n, short st)
|
MathMatrixInset::MathMatrixInset(int m, int n, short st)
|
||||||
: MathParInset(st, "array", LM_OT_MATRIX), nc(m), nr(0), ws_(m),
|
: MathParInset(st, "array", LM_OT_MATRIX), nc_(m), nr_(0), ws_(m),
|
||||||
v_align(0), h_align(nc, 'c')
|
v_align_(0), h_align_(nc_, 'c'), row_(0)
|
||||||
{
|
{
|
||||||
row = 0;
|
flag = 15;
|
||||||
flag = 15;
|
if (n > 0) {
|
||||||
if (n > 0) {
|
row_ = new MathedRowSt(nc_ + 1);
|
||||||
row = new MathedRowSt(nc+1);
|
MathedXIter it(this);
|
||||||
MathedXIter it(this);
|
for (int j = 1; j < n; ++j) it.addRow();
|
||||||
for (int j = 1; j < n; ++j) it.addRow();
|
nr_ = n;
|
||||||
nr = n;
|
if (nr_ == 1 && nc_ > 1) {
|
||||||
if (nr == 1 && nc > 1) {
|
for (int j = 0; j < nc_ - 1; ++j)
|
||||||
for (int j = 0; j < nc - 1; ++j)
|
it.Insert('T', LM_TC_TAB);
|
||||||
it.Insert('T', LM_TC_TAB);
|
}
|
||||||
|
} else if (n < 0) {
|
||||||
|
row_ = new MathedRowSt(nc_ + 1);
|
||||||
|
nr_ = 1;
|
||||||
}
|
}
|
||||||
} else if (n < 0) {
|
|
||||||
row = new MathedRowSt(nc + 1);
|
|
||||||
nr = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MathMatrixInset::MathMatrixInset(MathMatrixInset * mt)
|
MathMatrixInset::MathMatrixInset(MathMatrixInset * mt)
|
||||||
: MathParInset(mt->GetStyle(), mt->GetName(), mt->GetType()),
|
: MathParInset(mt->GetStyle(), mt->GetName(), mt->GetType()),
|
||||||
nc(mt->nc), nr(0), ws_(mt->nc), v_align(mt->v_align), h_align(mt->h_align)
|
nc_(mt->nc_), nr_(0), ws_(mt->nc_),
|
||||||
|
v_align_(mt->v_align_), h_align_(mt->h_align_)
|
||||||
{
|
{
|
||||||
MathedIter it;
|
MathedIter it;
|
||||||
it.SetData(mt->GetData());
|
it.SetData(mt->GetData());
|
||||||
array = it.Copy();
|
array = it.Copy();
|
||||||
if (mt->row != 0) {
|
if (mt->row_ != 0) {
|
||||||
MathedRowSt * r, * ro= 0, * mrow = mt->row;
|
MathedRowSt * ro = 0;
|
||||||
//mrow = mt->row; // This must be redundant...
|
MathedRowSt * mrow = mt->row_;
|
||||||
while (mrow) {
|
|
||||||
r = new MathedRowSt(nc + 1);
|
while (mrow) {
|
||||||
r->setNumbered(mrow->isNumbered());
|
MathedRowSt * r = new MathedRowSt(nc_ + 1);
|
||||||
//if (mrow->label)
|
r->setNumbered(mrow->isNumbered());
|
||||||
r->setLabel(mrow->getLabel());
|
//if (mrow->label)
|
||||||
if (!ro)
|
r->setLabel(mrow->getLabel());
|
||||||
row = r;
|
if (!ro)
|
||||||
else
|
row_ = r;
|
||||||
ro->setNext(r);
|
else
|
||||||
mrow = mrow->getNext();
|
ro->setNext(r);
|
||||||
ro = r;
|
mrow = mrow->getNext();
|
||||||
++nr;
|
ro = r;
|
||||||
}
|
++nr_;
|
||||||
} else
|
}
|
||||||
row = 0;
|
} else
|
||||||
flag = mt->flag;
|
row_ = 0;
|
||||||
|
flag = mt->flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MathMatrixInset::~MathMatrixInset()
|
MathMatrixInset::~MathMatrixInset()
|
||||||
{
|
{
|
||||||
MathedRowSt * r = row;
|
MathedRowSt * r = row_;
|
||||||
while (r) {
|
while (r) {
|
||||||
MathedRowSt * q = r->getNext();
|
MathedRowSt * q = r->getNext();
|
||||||
delete r;
|
delete r;
|
||||||
r = q;
|
r = q;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MathedInset * MathMatrixInset::Clone()
|
MathedInset * MathMatrixInset::Clone()
|
||||||
{
|
{
|
||||||
return new MathMatrixInset(this);
|
return new MathMatrixInset(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathMatrixInset::SetAlign(char vv, string const & hh)
|
void MathMatrixInset::SetAlign(char vv, string const & hh)
|
||||||
{
|
{
|
||||||
v_align = vv;
|
v_align_ = vv;
|
||||||
h_align = hh.substr(0, nc); // usr just h_align = hh; perhaps
|
h_align_ = hh.substr(0, nc_); // usr just h_align = hh; perhaps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check the number of tabs and crs
|
// Check the number of tabs and crs
|
||||||
void MathMatrixInset::SetData(MathedArray * a)
|
void MathMatrixInset::setData(MathedArray * a)
|
||||||
{
|
{
|
||||||
if (!a) return;
|
if (!a) return;
|
||||||
MathedIter it(a);
|
MathedIter it(a);
|
||||||
int nn = nc - 1;
|
int nn = nc_ - 1;
|
||||||
nr = 1;
|
nr_ = 1;
|
||||||
// count tabs per row
|
// count tabs per row
|
||||||
while (it.OK()) {
|
while (it.OK()) {
|
||||||
if (it.IsTab()) {
|
if (it.IsTab()) {
|
||||||
if (nn < 0) {
|
if (nn < 0) {
|
||||||
it.Delete();
|
it.Delete();
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
// it.Next();
|
// it.Next();
|
||||||
--nn;
|
--nn;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (it.IsCR()) {
|
||||||
|
while (nn > 0) {
|
||||||
|
it.Insert(' ', LM_TC_TAB);
|
||||||
|
--nn;
|
||||||
|
}
|
||||||
|
nn = nc_ - 1;
|
||||||
|
++nr_;
|
||||||
|
}
|
||||||
|
it.Next();
|
||||||
}
|
}
|
||||||
if (it.IsCR()) {
|
it.Reset();
|
||||||
while (nn > 0) {
|
|
||||||
it.Insert(' ', LM_TC_TAB);
|
|
||||||
--nn;
|
|
||||||
}
|
|
||||||
nn = nc - 1;
|
|
||||||
++nr;
|
|
||||||
}
|
|
||||||
it.Next();
|
|
||||||
}
|
|
||||||
it.Reset();
|
|
||||||
|
|
||||||
// Automatically inserts tabs around bops
|
// Automatically inserts tabs around bops
|
||||||
// DISABLED because it's very easy to insert tabs
|
// DISABLED because it's very easy to insert tabs
|
||||||
array = a;
|
array = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathMatrixInset::draw(Painter & pain, int x, int baseline)
|
void MathMatrixInset::draw(Painter & pain, int x, int baseline)
|
||||||
{
|
{
|
||||||
MathParInset::draw(pain, x, baseline);
|
MathParInset::draw(pain, x, baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MathMatrixInset::Metrics()
|
void MathMatrixInset::Metrics()
|
||||||
{
|
{
|
||||||
int i, hl, h = 0;
|
if (!row_) {
|
||||||
MathedRowSt * cprow= 0;
|
// lyxerr << " MIDA ";
|
||||||
|
MathedXIter it(this);
|
||||||
if (!row) {
|
row_ = it.adjustVerticalSt();
|
||||||
// lyxerr << " MIDA ";
|
|
||||||
MathedXIter it(this);
|
|
||||||
row = it.adjustVerticalSt();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clean the arrays
|
|
||||||
MathedRowSt * cxrow = row;
|
|
||||||
while (cxrow) {
|
|
||||||
for (i = 0; i <= nc; ++i) cxrow->setTab(i, 0);
|
|
||||||
cxrow = cxrow->getNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Basic metrics
|
|
||||||
MathParInset::Metrics();
|
|
||||||
|
|
||||||
if (nc <= 1 && !row->getNext()) {
|
|
||||||
row->ascent(ascent);
|
|
||||||
row->descent(descent);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Vertical positions of each row
|
|
||||||
cxrow = row;
|
|
||||||
while (cxrow) {
|
|
||||||
for (i = 0; i < nc; ++i) {
|
|
||||||
if (cxrow == row || ws_[i] < cxrow->getTab(i))
|
|
||||||
ws_[i] = cxrow->getTab(i);
|
|
||||||
if (cxrow->getNext() == 0 && ws_[i] == 0) ws_[i] = df_width;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cxrow->setBaseline((cxrow == row) ?
|
// Clean the arrays
|
||||||
cxrow->ascent() :
|
MathedRowSt * cxrow = row_;
|
||||||
cxrow->ascent() + cprow->descent()
|
while (cxrow) {
|
||||||
+ MATH_ROWSEP + cprow->getBaseline());
|
for (int i = 0; i <= nc_; ++i)
|
||||||
h += cxrow->ascent() + cxrow->descent() + MATH_ROWSEP;
|
cxrow->setTab(i, 0);
|
||||||
cprow = cxrow;
|
cxrow = cxrow->getNext();
|
||||||
cxrow = cxrow->getNext();
|
}
|
||||||
}
|
|
||||||
|
// Basic metrics
|
||||||
hl = Descent();
|
MathParInset::Metrics();
|
||||||
h -= MATH_ROWSEP;
|
|
||||||
|
if (nc_ <= 1 && !row_->getNext()) {
|
||||||
// Compute vertical align
|
row_->ascent(ascent);
|
||||||
switch (v_align) {
|
row_->descent(descent);
|
||||||
case 't': ascent = row->getBaseline(); break;
|
}
|
||||||
case 'b': ascent = h - hl; break;
|
|
||||||
default: ascent = (row->getNext()) ? h / 2: h - hl; break;
|
// Vertical positions of each row
|
||||||
}
|
cxrow = row_;
|
||||||
descent = h - ascent + 2;
|
MathedRowSt * cprow = 0;
|
||||||
|
int h = 0;
|
||||||
// Increase ws_[i] for 'R' columns (except the first one)
|
while (cxrow) {
|
||||||
for (i = 1; i < nc; ++i)
|
for (int i = 0; i < nc_; ++i) {
|
||||||
if (h_align[i] == 'R')
|
if (cxrow == row_ || ws_[i] < cxrow->getTab(i))
|
||||||
ws_[i] += 10*df_width;
|
ws_[i] = cxrow->getTab(i);
|
||||||
// Increase ws_[i] for 'C' column
|
if (cxrow->getNext() == 0 && ws_[i] == 0)
|
||||||
if (h_align[0] == 'C')
|
ws_[i] = df_width;
|
||||||
if (ws_[0] < 7*workWidth/8)
|
}
|
||||||
ws_[0] = 7*workWidth/8;
|
|
||||||
|
cxrow->setBaseline((cxrow == row_) ?
|
||||||
// Adjust local tabs
|
cxrow->ascent() :
|
||||||
cxrow = row;
|
cxrow->ascent() + cprow->descent()
|
||||||
width = MATH_COLSEP;
|
+ MATH_ROWSEP + cprow->getBaseline());
|
||||||
while (cxrow) {
|
h += cxrow->ascent() + cxrow->descent() + MATH_ROWSEP;
|
||||||
int rg = MATH_COLSEP, ww, lf = 0; //, * w = cxrow->w;
|
cprow = cxrow;
|
||||||
for (i = 0; i < nc; ++i) {
|
cxrow = cxrow->getNext();
|
||||||
bool isvoid = false;
|
}
|
||||||
if (cxrow->getTab(i) <= 0) {
|
|
||||||
cxrow->setTab(i, df_width);
|
int hl = Descent();
|
||||||
isvoid = true;
|
h -= MATH_ROWSEP;
|
||||||
}
|
|
||||||
switch (h_align[i]) {
|
// Compute vertical align
|
||||||
case 'l':
|
switch (v_align_) {
|
||||||
lf = 0;
|
case 't':
|
||||||
break;
|
ascent = row_->getBaseline();
|
||||||
case 'c':
|
break;
|
||||||
lf = (ws_[i] - cxrow->getTab(i))/2;
|
case 'b':
|
||||||
break;
|
ascent = h - hl;
|
||||||
case 'r':
|
break;
|
||||||
case 'R':
|
default:
|
||||||
lf = ws_[i] - cxrow->getTab(i);
|
ascent = (row_->getNext()) ? h / 2 : h - hl;
|
||||||
break;
|
break;
|
||||||
case 'C':
|
}
|
||||||
if (cxrow == row)
|
descent = h - ascent + 2;
|
||||||
lf = 0;
|
|
||||||
else if (!cxrow->getNext())
|
// Increase ws_[i] for 'R' columns (except the first one)
|
||||||
lf = ws_[i] - cxrow->getTab(i);
|
for (int i = 1; i < nc_; ++i)
|
||||||
else
|
if (h_align_[i] == 'R')
|
||||||
lf = (ws_[i] - cxrow->getTab(i))/2;
|
ws_[i] += 10 * df_width;
|
||||||
break;
|
// Increase ws_[i] for 'C' column
|
||||||
}
|
if (h_align_[0] == 'C')
|
||||||
ww = (isvoid) ? lf : lf + cxrow->getTab(i);
|
if (ws_[0] < 7 * workWidth / 8)
|
||||||
cxrow->setTab(i, lf + rg);
|
ws_[0] = 7 * workWidth / 8;
|
||||||
rg = ws_[i] - ww + MATH_COLSEP;
|
|
||||||
if (cxrow == row) width += ws_[i] + MATH_COLSEP;
|
// Adjust local tabs
|
||||||
|
cxrow = row_;
|
||||||
|
width = MATH_COLSEP;
|
||||||
|
while (cxrow) {
|
||||||
|
int rg = MATH_COLSEP;
|
||||||
|
int lf = 0;
|
||||||
|
for (int i = 0; i < nc_; ++i) {
|
||||||
|
bool isvoid = false;
|
||||||
|
if (cxrow->getTab(i) <= 0) {
|
||||||
|
cxrow->setTab(i, df_width);
|
||||||
|
isvoid = true;
|
||||||
|
}
|
||||||
|
switch (h_align_[i]) {
|
||||||
|
case 'l':
|
||||||
|
lf = 0;
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
lf = (ws_[i] - cxrow->getTab(i))/2;
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
case 'R':
|
||||||
|
lf = ws_[i] - cxrow->getTab(i);
|
||||||
|
break;
|
||||||
|
case 'C':
|
||||||
|
if (cxrow == row_)
|
||||||
|
lf = 0;
|
||||||
|
else if (!cxrow->getNext())
|
||||||
|
lf = ws_[i] - cxrow->getTab(i);
|
||||||
|
else
|
||||||
|
lf = (ws_[i] - cxrow->getTab(i))/2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
int ww = (isvoid) ? lf : lf + cxrow->getTab(i);
|
||||||
|
cxrow->setTab(i, lf + rg);
|
||||||
|
rg = ws_[i] - ww + MATH_COLSEP;
|
||||||
|
if (cxrow == row_)
|
||||||
|
width += ws_[i] + MATH_COLSEP;
|
||||||
|
}
|
||||||
|
cxrow->setBaseline(cxrow->getBaseline() - ascent);
|
||||||
|
cxrow = cxrow->getNext();
|
||||||
}
|
}
|
||||||
cxrow->setBaseline(cxrow->getBaseline() - ascent);
|
|
||||||
cxrow = cxrow->getNext();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathMatrixInset::Write(ostream & os, bool fragile)
|
void MathMatrixInset::Write(ostream & os, bool fragile)
|
||||||
{
|
{
|
||||||
if (GetType() == LM_OT_MATRIX){
|
if (GetType() == LM_OT_MATRIX) {
|
||||||
if (fragile)
|
if (fragile)
|
||||||
os << "\\protect";
|
os << "\\protect";
|
||||||
os << "\\begin{"
|
os << "\\begin{"
|
||||||
<< name
|
<< name
|
||||||
<< '}';
|
<< '}';
|
||||||
if (v_align == 't' || v_align == 'b') {
|
if (v_align_ == 't' || v_align_ == 'b') {
|
||||||
os << '['
|
os << '['
|
||||||
<< char(v_align)
|
<< char(v_align_)
|
||||||
<< ']';
|
<< ']';
|
||||||
}
|
}
|
||||||
os << '{'
|
os << '{'
|
||||||
<< h_align
|
<< h_align_
|
||||||
<< "}\n";
|
<< "}\n";
|
||||||
++number_of_newlines;
|
++number_of_newlines;
|
||||||
}
|
}
|
||||||
|
@ -9,55 +9,89 @@
|
|||||||
/** Multiline math paragraph base class.
|
/** Multiline math paragraph base class.
|
||||||
This is the base to all multiline editable math objects
|
This is the base to all multiline editable math objects
|
||||||
like array and eqnarray.
|
like array and eqnarray.
|
||||||
*/
|
\author Alejandro Aguilar Sierra
|
||||||
class MathMatrixInset: public MathParInset {
|
*/
|
||||||
public:
|
class MathMatrixInset : public MathParInset {
|
||||||
///
|
public:
|
||||||
explicit
|
///
|
||||||
MathMatrixInset(int m = 1, int n = 1, short st = LM_ST_TEXT);
|
explicit
|
||||||
///
|
MathMatrixInset(int m = 1, int n = 1, short st = LM_ST_TEXT);
|
||||||
explicit
|
///
|
||||||
MathMatrixInset(MathMatrixInset *);
|
explicit
|
||||||
///
|
MathMatrixInset(MathMatrixInset *);
|
||||||
MathedInset * Clone();
|
///
|
||||||
///
|
MathedInset * Clone();
|
||||||
virtual ~MathMatrixInset();
|
///
|
||||||
///
|
virtual ~MathMatrixInset();
|
||||||
void draw(Painter &, int, int);
|
///
|
||||||
///
|
void draw(Painter &, int, int);
|
||||||
void Write(std::ostream &, bool fragile);
|
///
|
||||||
///
|
void Write(std::ostream &, bool fragile);
|
||||||
void Metrics();
|
///
|
||||||
///
|
void Metrics();
|
||||||
void SetData(MathedArray *);
|
///
|
||||||
///
|
void setData(MathedArray *);
|
||||||
void SetAlign(char, string const &);
|
///
|
||||||
///
|
void SetAlign(char, string const &);
|
||||||
int GetColumns() const { return nc; }
|
///
|
||||||
///
|
int GetColumns() const;
|
||||||
int GetRows() const { return nr; }
|
///
|
||||||
///
|
int GetRows() const;
|
||||||
virtual bool isMatrix() const { return true; }
|
///
|
||||||
|
virtual bool isMatrix() const;
|
||||||
|
|
||||||
/// Use this to manage the extra information independently of paragraph
|
/// Use this to manage the extra information independently of paragraph
|
||||||
MathedRowSt * getRowSt() const { return row; }
|
MathedRowSt * getRowSt() const;
|
||||||
///
|
///
|
||||||
void setRowSt(MathedRowSt * r) { row = r; }
|
void setRowSt(MathedRowSt * r);
|
||||||
|
private:
|
||||||
protected:
|
/// Number of columns & rows
|
||||||
/// Number of columns & rows
|
int nc_;
|
||||||
int nc;
|
///
|
||||||
///
|
int nr_;
|
||||||
int nr;
|
/// tab sizes
|
||||||
/// tab sizes
|
std::vector<int> ws_;
|
||||||
std::vector<int> ws_;
|
///
|
||||||
///
|
char v_align_; // add approp. type
|
||||||
char v_align; // add approp. type
|
///
|
||||||
///
|
|
||||||
//std::vector<char> h_align;
|
//std::vector<char> h_align;
|
||||||
string h_align; // a vector would perhaps be more correct
|
string h_align_; // a vector would perhaps be more correct
|
||||||
/// Vertical structure
|
/// Vertical structure
|
||||||
MathedRowSt * row;
|
MathedRowSt * row_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
int MathMatrixInset::GetColumns() const
|
||||||
|
{
|
||||||
|
return nc_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
int MathMatrixInset::GetRows() const
|
||||||
|
{
|
||||||
|
return nr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool MathMatrixInset::isMatrix() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
MathedRowSt * MathMatrixInset::getRowSt() const
|
||||||
|
{
|
||||||
|
return row_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void MathMatrixInset::setRowSt(MathedRowSt * r)
|
||||||
|
{
|
||||||
|
row_ = r;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -150,8 +150,9 @@ void button_cb(FL_OBJECT * ob, long data)
|
|||||||
/* callbacks for form delim */
|
/* callbacks for form delim */
|
||||||
void delim_cb(FL_OBJECT *, long data)
|
void delim_cb(FL_OBJECT *, long data)
|
||||||
{
|
{
|
||||||
int left = fd_delim->left->u_ldata, right= fd_delim->right->u_ldata;
|
int left = fd_delim->left->u_ldata;
|
||||||
int side = (fl_get_button(fd_delim->right)!= 0);
|
int right= fd_delim->right->u_ldata;
|
||||||
|
int side = (fl_get_button(fd_delim->right) != 0);
|
||||||
|
|
||||||
switch (data) {
|
switch (data) {
|
||||||
case MM_APPLY:
|
case MM_APPLY:
|
||||||
|
@ -66,7 +66,6 @@ enum SomeMathValues {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Class to manage bitmap menu bars
|
/// Class to manage bitmap menu bars
|
||||||
class BitmapMenu {
|
class BitmapMenu {
|
||||||
///
|
///
|
||||||
@ -78,7 +77,9 @@ class BitmapMenu {
|
|||||||
///
|
///
|
||||||
typedef bitmaps_type::size_type size_type;
|
typedef bitmaps_type::size_type size_type;
|
||||||
///
|
///
|
||||||
BitmapMenu * next, * prev;
|
BitmapMenu * next;
|
||||||
|
///
|
||||||
|
BitmapMenu * prev;
|
||||||
/// Current bitmap
|
/// Current bitmap
|
||||||
size_type current_;
|
size_type current_;
|
||||||
/// Border width
|
/// Border width
|
||||||
|
@ -42,7 +42,7 @@ MathParInset::MathParInset(MathParInset * p)
|
|||||||
flag = p->flag;
|
flag = p->flag;
|
||||||
p->setArgumentIdx(0);
|
p->setArgumentIdx(0);
|
||||||
MathedIter it(p->GetData());
|
MathedIter it(p->GetData());
|
||||||
SetData(it.Copy());
|
setData(it.Copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ MathedInset * MathParInset::Clone()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathParInset::SetData(MathedArray * a)
|
void MathParInset::setData(MathedArray * a)
|
||||||
{
|
{
|
||||||
array = a;
|
array = a;
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ void MathParInset::Write(ostream & os, bool fragile)
|
|||||||
{
|
{
|
||||||
if (!array) return;
|
if (!array) return;
|
||||||
int brace = 0;
|
int brace = 0;
|
||||||
latexkeys * l;
|
latexkeys const * l;
|
||||||
MathedIter data(array);
|
MathedIter data(array);
|
||||||
// hack
|
// hack
|
||||||
MathedRowSt const * crow = getRowSt();
|
MathedRowSt const * crow = getRowSt();
|
||||||
|
@ -5,11 +5,13 @@
|
|||||||
#include "math_inset.h"
|
#include "math_inset.h"
|
||||||
#include "math_defs.h"
|
#include "math_defs.h"
|
||||||
|
|
||||||
struct MathedRowSt;
|
class MathedRowSt;
|
||||||
class MathedArray;
|
class MathedArray;
|
||||||
|
|
||||||
|
|
||||||
/** The math paragraph base class, base to all editable math objects */
|
/** The math paragraph base class, base to all editable math objects
|
||||||
|
\author Alejandro Aguilar Sierra
|
||||||
|
*/
|
||||||
class MathParInset: public MathedInset {
|
class MathParInset: public MathedInset {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
@ -31,7 +33,7 @@ public:
|
|||||||
///
|
///
|
||||||
virtual void UserSetSize(short);
|
virtual void UserSetSize(short);
|
||||||
/// Data is stored in a LyXArray
|
/// Data is stored in a LyXArray
|
||||||
virtual void SetData(MathedArray *);
|
virtual void setData(MathedArray *);
|
||||||
///
|
///
|
||||||
virtual MathedArray * GetData();
|
virtual MathedArray * GetData();
|
||||||
/// Paragraph position
|
/// Paragraph position
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "support/lyxlib.h"
|
#include "support/lyxlib.h"
|
||||||
#include "mathed/support.h"
|
#include "mathed/support.h"
|
||||||
|
#include "boost/array.hpp"
|
||||||
|
|
||||||
using std::istream;
|
using std::istream;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
@ -64,6 +65,19 @@ enum {
|
|||||||
FLAG_BRACK_END = 256 // Next ] ends the parsing process
|
FLAG_BRACK_END = 256 // Next ] ends the parsing process
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
union YYSTYPE {
|
||||||
|
///
|
||||||
|
unsigned char c;
|
||||||
|
///
|
||||||
|
char const * s;
|
||||||
|
///
|
||||||
|
int i;
|
||||||
|
///
|
||||||
|
latexkeys const * l;
|
||||||
|
};
|
||||||
|
|
||||||
static
|
static
|
||||||
YYSTYPE yylval;
|
YYSTYPE yylval;
|
||||||
|
|
||||||
@ -115,7 +129,8 @@ enum lexcode_enum {
|
|||||||
|
|
||||||
static lexcode_enum lexcode[256];
|
static lexcode_enum lexcode[256];
|
||||||
#warning Replace with string
|
#warning Replace with string
|
||||||
static char yytext[256];
|
//static char yytext[256];
|
||||||
|
static array<char, 256> yytext;
|
||||||
static int yylineno;
|
static int yylineno;
|
||||||
static istream * yyis;
|
static istream * yyis;
|
||||||
static bool yy_mtextmode= false;
|
static bool yy_mtextmode= false;
|
||||||
@ -195,7 +210,7 @@ char LexGetArg(char lf, bool accept_spaces= false)
|
|||||||
if (c == lf) ++bcnt;
|
if (c == lf) ++bcnt;
|
||||||
if (c == rg) --bcnt;
|
if (c == rg) --bcnt;
|
||||||
if ((c > ' ' || (c == ' ' && accept_spaces)) && bcnt > 0) *(p++) = c;
|
if ((c > ' ' || (c == ' ' && accept_spaces)) && bcnt > 0) *(p++) = c;
|
||||||
} while (bcnt > 0 && yyis->good() && p-yytext < 255);
|
} while (bcnt > 0 && yyis->good() && p - yytext.data() < 255);
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
return rg;
|
return rg;
|
||||||
}
|
}
|
||||||
@ -295,7 +310,7 @@ int yylex(void)
|
|||||||
if (lexcode[c] == LexAlpha || lexcode[c] == LexDigit) {
|
if (lexcode[c] == LexAlpha || lexcode[c] == LexDigit) {
|
||||||
char * p = &yytext[0];
|
char * p = &yytext[0];
|
||||||
while ((lexcode[c] == LexAlpha || lexcode[c] == LexDigit)
|
while ((lexcode[c] == LexAlpha || lexcode[c] == LexDigit)
|
||||||
&& p-yytext < 255) {
|
&& p - yytext.data() < 255) {
|
||||||
*p = c;
|
*p = c;
|
||||||
yyis->get(cc);
|
yyis->get(cc);
|
||||||
c = cc;
|
c = cc;
|
||||||
@ -303,16 +318,16 @@ int yylex(void)
|
|||||||
}
|
}
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
if (yyis->good()) yyis->putback(c);
|
if (yyis->good()) yyis->putback(c);
|
||||||
latexkeys * l = in_word_set (yytext, strlen(yytext));
|
latexkeys const * l = in_word_set (yytext.data(), strlen(yytext.data()));
|
||||||
if (l) {
|
if (l) {
|
||||||
if (l->token == LM_TK_BEGIN || l->token == LM_TK_END) {
|
if (l->token == LM_TK_BEGIN || l->token == LM_TK_END) {
|
||||||
int i;
|
int i;
|
||||||
LexGetArg('{');
|
LexGetArg('{');
|
||||||
// for (i = 0; i < 5 && strncmp(yytext, latex_mathenv[i],
|
// for (i = 0; i < 5 && compare(yytext, latex_mathenv[i],
|
||||||
// strlen(latex_mathenv[i])); ++i);
|
// strlen(latex_mathenv[i])); ++i);
|
||||||
|
|
||||||
for (i = 0; i < latex_mathenv_num
|
for (i = 0; i < latex_mathenv_num
|
||||||
&& strcmp(yytext, latex_mathenv[i]); ++i);
|
&& compare(yytext.data(), latex_mathenv[i]); ++i);
|
||||||
yylval.i = i;
|
yylval.i = i;
|
||||||
} else
|
} else
|
||||||
if (l->token == LM_TK_SPACE)
|
if (l->token == LM_TK_SPACE)
|
||||||
@ -321,7 +336,7 @@ int yylex(void)
|
|||||||
yylval.l = l;
|
yylval.l = l;
|
||||||
return l->token;
|
return l->token;
|
||||||
} else {
|
} else {
|
||||||
yylval.s = yytext;
|
yylval.s = yytext.data();
|
||||||
return LM_TK_UNDEF;
|
return LM_TK_UNDEF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -449,12 +464,12 @@ MathedArray * mathed_parse(unsigned flags = 0, MathedArray * array = 0,
|
|||||||
char const c = yyis->peek();
|
char const c = yyis->peek();
|
||||||
if (c == '[') {
|
if (c == '[') {
|
||||||
LexGetArg('[');
|
LexGetArg('[');
|
||||||
na = lyx::atoi(yytext);
|
na = lyx::atoi(yytext.data());
|
||||||
}
|
}
|
||||||
macro = new MathMacroTemplate(name, na);
|
macro = new MathMacroTemplate(name, na);
|
||||||
flags = FLAG_BRACE|FLAG_BRACE_LAST;
|
flags = FLAG_BRACE|FLAG_BRACE_LAST;
|
||||||
*mtx = macro;
|
*mtx = macro;
|
||||||
macro->SetData(array);
|
macro->setData(array);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LM_TK_SPECIAL:
|
case LM_TK_SPECIAL:
|
||||||
@ -545,7 +560,7 @@ MathedArray * mathed_parse(unsigned flags = 0, MathedArray * array = 0,
|
|||||||
{
|
{
|
||||||
MathParInset * p = new MathParInset(size, "", LM_OT_SCRIPT);
|
MathParInset * p = new MathParInset(size, "", LM_OT_SCRIPT);
|
||||||
MathedArray * ar = mathed_parse(FLAG_BRACE_OPT|FLAG_BRACE_LAST, 0);
|
MathedArray * ar = mathed_parse(FLAG_BRACE_OPT|FLAG_BRACE_LAST, 0);
|
||||||
p->SetData(ar);
|
p->setData(ar);
|
||||||
// lyxerr << "UP[" << p->GetStyle() << "]" << endl;
|
// lyxerr << "UP[" << p->GetStyle() << "]" << endl;
|
||||||
data.Insert (p, LM_TC_UP);
|
data.Insert (p, LM_TC_UP);
|
||||||
break;
|
break;
|
||||||
@ -554,7 +569,7 @@ MathedArray * mathed_parse(unsigned flags = 0, MathedArray * array = 0,
|
|||||||
{
|
{
|
||||||
MathParInset * p = new MathParInset(size, "", LM_OT_SCRIPT);
|
MathParInset * p = new MathParInset(size, "", LM_OT_SCRIPT);
|
||||||
MathedArray * ar = mathed_parse(FLAG_BRACE_OPT|FLAG_BRACE_LAST, 0);
|
MathedArray * ar = mathed_parse(FLAG_BRACE_OPT|FLAG_BRACE_LAST, 0);
|
||||||
p->SetData(ar);
|
p->setData(ar);
|
||||||
data.Insert (p, LM_TC_DOWN);
|
data.Insert (p, LM_TC_DOWN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -666,13 +681,13 @@ MathedArray * mathed_parse(unsigned flags = 0, MathedArray * array = 0,
|
|||||||
if (c == '[') {
|
if (c == '[') {
|
||||||
rt = new MathRootInset(size);
|
rt = new MathRootInset(size);
|
||||||
rt->setArgumentIdx(0);
|
rt->setArgumentIdx(0);
|
||||||
rt->SetData(mathed_parse(FLAG_BRACK_END, 0, &rt));
|
rt->setData(mathed_parse(FLAG_BRACK_END, 0, &rt));
|
||||||
rt->setArgumentIdx(1);
|
rt->setArgumentIdx(1);
|
||||||
} else {
|
} else {
|
||||||
yyis->putback(c);
|
yyis->putback(c);
|
||||||
rt = new MathSqrtInset(size);
|
rt = new MathSqrtInset(size);
|
||||||
}
|
}
|
||||||
rt->SetData(mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST, 0, &rt));
|
rt->setData(mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST, 0, &rt));
|
||||||
data.Insert(rt, LM_TC_ACTIVE_INSET);
|
data.Insert(rt, LM_TC_ACTIVE_INSET);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -689,7 +704,7 @@ MathedArray * mathed_parse(unsigned flags = 0, MathedArray * array = 0,
|
|||||||
if (rgd == LM_TK_SYM || rgd == LM_TK_STR || rgd == LM_TK_BOP || rgd == LM_TK_SPECIAL)
|
if (rgd == LM_TK_SYM || rgd == LM_TK_STR || rgd == LM_TK_BOP || rgd == LM_TK_SPECIAL)
|
||||||
rgd = (rgd == LM_TK_SYM) ? yylval.l->id: yylval.i;
|
rgd = (rgd == LM_TK_SYM) ? yylval.l->id: yylval.i;
|
||||||
MathDelimInset * dl = new MathDelimInset(lfd, rgd);
|
MathDelimInset * dl = new MathDelimInset(lfd, rgd);
|
||||||
dl->SetData(a);
|
dl->setData(a);
|
||||||
data.Insert(dl, LM_TC_ACTIVE_INSET);
|
data.Insert(dl, LM_TC_ACTIVE_INSET);
|
||||||
// lyxerr << "RL[" << lfd << " " << rgd << "]";
|
// lyxerr << "RL[" << lfd << " " << rgd << "]";
|
||||||
break;
|
break;
|
||||||
@ -717,7 +732,7 @@ MathedArray * mathed_parse(unsigned flags = 0, MathedArray * array = 0,
|
|||||||
{
|
{
|
||||||
MathDecorationInset * sq = new MathDecorationInset(yylval.l->id,
|
MathDecorationInset * sq = new MathDecorationInset(yylval.l->id,
|
||||||
size);
|
size);
|
||||||
sq->SetData(mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST));
|
sq->setData(mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST));
|
||||||
data.Insert(sq, LM_TC_ACTIVE_INSET);
|
data.Insert(sq, LM_TC_ACTIVE_INSET);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -759,7 +774,7 @@ MathedArray * mathed_parse(unsigned flags = 0, MathedArray * array = 0,
|
|||||||
else
|
else
|
||||||
data.Insert(p, p->getTCode());
|
data.Insert(p, p->getTCode());
|
||||||
for (int i = 0; p->setArgumentIdx(i); ++i)
|
for (int i = 0; p->setArgumentIdx(i); ++i)
|
||||||
p->SetData(mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST));
|
p->setData(mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MathedInset * q = new MathFuncInset(yylval.s, LM_OT_UNDEF);
|
MathedInset * q = new MathFuncInset(yylval.s, LM_OT_UNDEF);
|
||||||
@ -780,7 +795,7 @@ MathedArray * mathed_parse(unsigned flags = 0, MathedArray * array = 0,
|
|||||||
lyxerr << "[" << yylval.i << "]" << endl;
|
lyxerr << "[" << yylval.i << "]" << endl;
|
||||||
--plevel;
|
--plevel;
|
||||||
if (mt) { // && (flags & FLAG_END)) {
|
if (mt) { // && (flags & FLAG_END)) {
|
||||||
mt->SetData(array);
|
mt->setData(array);
|
||||||
array = 0;
|
array = 0;
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
@ -792,10 +807,10 @@ MathedArray * mathed_parse(unsigned flags = 0, MathedArray * array = 0,
|
|||||||
ar[0] = ar2[0] = '\0';
|
ar[0] = ar2[0] = '\0';
|
||||||
char rg = LexGetArg(0);
|
char rg = LexGetArg(0);
|
||||||
if (rg == ']') {
|
if (rg == ']') {
|
||||||
strcpy(ar2, yytext);
|
strcpy(ar2, yytext.data());
|
||||||
rg = LexGetArg('{');
|
rg = LexGetArg('{');
|
||||||
}
|
}
|
||||||
strcpy(ar, yytext);
|
strcpy(ar, yytext.data());
|
||||||
int const nc = parse_align(ar, ar2);
|
int const nc = parse_align(ar, ar2);
|
||||||
MathParInset * mm = new MathMatrixInset(nc, 0);
|
MathParInset * mm = new MathMatrixInset(nc, 0);
|
||||||
mm->SetAlign(ar2[0], ar);
|
mm->SetAlign(ar2[0], ar);
|
||||||
@ -827,7 +842,7 @@ MathedArray * mathed_parse(unsigned flags = 0, MathedArray * array = 0,
|
|||||||
<< c << "'" << endl;
|
<< c << "'" << endl;
|
||||||
}
|
}
|
||||||
LexGetArg('{');
|
LexGetArg('{');
|
||||||
cols = strToInt(string(yytext));
|
cols = strToInt(string(yytext.data()));
|
||||||
}
|
}
|
||||||
mt = create_multiline(mathed_env, cols);
|
mt = create_multiline(mathed_env, cols);
|
||||||
if (mtx) *mtx = mt;
|
if (mtx) *mtx = mt;
|
||||||
@ -847,7 +862,7 @@ MathedArray * mathed_parse(unsigned flags = 0, MathedArray * array = 0,
|
|||||||
} else {
|
} else {
|
||||||
// lyxerr << "MATHCRO[" << yytext << "]";
|
// lyxerr << "MATHCRO[" << yytext << "]";
|
||||||
MathMacro * p =
|
MathMacro * p =
|
||||||
MathMacroTable::mathMTable.getMacro(yytext);
|
MathMacroTable::mathMTable.getMacro(yytext.data());
|
||||||
if (p) {
|
if (p) {
|
||||||
data.Insert(p, p->getTCode());
|
data.Insert(p, p->getTCode());
|
||||||
p->setArgumentIdx(0);
|
p->setArgumentIdx(0);
|
||||||
@ -880,14 +895,14 @@ MathedArray * mathed_parse(unsigned flags = 0, MathedArray * array = 0,
|
|||||||
if (rg != '}') {
|
if (rg != '}') {
|
||||||
mathPrintError("Expected '{'");
|
mathPrintError("Expected '{'");
|
||||||
// debug info
|
// debug info
|
||||||
lyxerr << "[" << yytext << "]" << endl;
|
lyxerr << "[" << yytext.data() << "]" << endl;
|
||||||
panic = true;
|
panic = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (crow) {
|
if (crow) {
|
||||||
crow->setLabel(yytext);
|
crow->setLabel(yytext.data());
|
||||||
} else {
|
} else {
|
||||||
mathed_label = yytext;
|
mathed_label = yytext.data();
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
lyxerr << "Label[" << mathed_label << "]" << endl;
|
lyxerr << "Label[" << mathed_label << "]" << endl;
|
||||||
@ -897,7 +912,7 @@ MathedArray * mathed_parse(unsigned flags = 0, MathedArray * array = 0,
|
|||||||
default:
|
default:
|
||||||
mathPrintError("Unrecognized token");
|
mathPrintError("Unrecognized token");
|
||||||
// debug info
|
// debug info
|
||||||
lyxerr << "[" << t << " " << yytext << "]" << endl;
|
lyxerr << "[" << t << " " << yytext.data() << "]" << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tprev = t;
|
tprev = t;
|
||||||
|
@ -35,105 +35,93 @@
|
|||||||
///
|
///
|
||||||
enum MathTokenEnum
|
enum MathTokenEnum
|
||||||
{
|
{
|
||||||
///
|
///
|
||||||
LM_TK_BOP = 256,
|
LM_TK_BOP = 256,
|
||||||
///
|
///
|
||||||
LM_TK_ALPHA,
|
LM_TK_ALPHA,
|
||||||
///
|
///
|
||||||
LM_TK_STR,
|
LM_TK_STR,
|
||||||
///
|
///
|
||||||
LM_TK_SYM,
|
LM_TK_SYM,
|
||||||
///
|
///
|
||||||
LM_TK_FRAC,
|
LM_TK_FRAC,
|
||||||
///
|
///
|
||||||
LM_TK_SQRT,
|
LM_TK_SQRT,
|
||||||
///
|
///
|
||||||
LM_TK_BEGIN,
|
LM_TK_BEGIN,
|
||||||
///
|
///
|
||||||
LM_TK_END,
|
LM_TK_END,
|
||||||
///
|
///
|
||||||
LM_TK_NEWLINE,
|
LM_TK_NEWLINE,
|
||||||
///
|
///
|
||||||
LM_TK_UNDEF,
|
LM_TK_UNDEF,
|
||||||
///
|
///
|
||||||
LM_TK_FONT,
|
LM_TK_FONT,
|
||||||
///
|
///
|
||||||
LM_TK_LEFT,
|
LM_TK_LEFT,
|
||||||
///
|
///
|
||||||
LM_TK_RIGHT,
|
LM_TK_RIGHT,
|
||||||
///
|
///
|
||||||
LM_TK_ACCENT,
|
LM_TK_ACCENT,
|
||||||
///
|
///
|
||||||
LM_TK_WIDE,
|
LM_TK_WIDE,
|
||||||
///
|
///
|
||||||
LM_TK_FUNC,
|
LM_TK_FUNC,
|
||||||
///
|
///
|
||||||
LM_TK_FUNCLIM,
|
LM_TK_FUNCLIM,
|
||||||
///
|
///
|
||||||
LM_TK_BIGSYM,
|
LM_TK_BIGSYM,
|
||||||
///
|
///
|
||||||
LM_TK_LABEL,
|
LM_TK_LABEL,
|
||||||
///
|
///
|
||||||
LM_TK_NONUM,
|
LM_TK_NONUM,
|
||||||
///
|
///
|
||||||
LM_TK_SPACE,
|
LM_TK_SPACE,
|
||||||
///
|
///
|
||||||
LM_TK_DOTS,
|
LM_TK_DOTS,
|
||||||
///
|
///
|
||||||
LM_TK_LIMIT,
|
LM_TK_LIMIT,
|
||||||
///
|
///
|
||||||
LM_TK_STY,
|
LM_TK_STY,
|
||||||
///
|
///
|
||||||
LM_TK_PMOD,
|
LM_TK_PMOD,
|
||||||
///
|
///
|
||||||
LM_TK_BMOD,
|
LM_TK_BMOD,
|
||||||
///
|
///
|
||||||
LM_TK_MACRO,
|
LM_TK_MACRO,
|
||||||
///
|
///
|
||||||
LM_TK_SPECIAL,
|
LM_TK_SPECIAL,
|
||||||
///
|
///
|
||||||
LM_TK_ARGUMENT,
|
LM_TK_ARGUMENT,
|
||||||
///
|
///
|
||||||
LM_TK_NEWCOMMAND,
|
LM_TK_NEWCOMMAND,
|
||||||
///
|
///
|
||||||
LM_TK_STACK
|
LM_TK_STACK
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
struct latexkeys {
|
struct latexkeys {
|
||||||
///
|
///
|
||||||
char const * name;
|
char const * name;
|
||||||
///
|
///
|
||||||
short token;
|
short token;
|
||||||
///
|
///
|
||||||
int id;
|
int id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
latexkeys *
|
latexkeys const *
|
||||||
in_word_set (register char const * str, register int len);
|
in_word_set (register char const * str, register int len);
|
||||||
|
|
||||||
///
|
///
|
||||||
latexkeys * in_word_set(string const & str);
|
latexkeys const * in_word_set(string const & str);
|
||||||
|
|
||||||
///
|
///
|
||||||
latexkeys * lm_get_key(int index);
|
latexkeys * lm_get_key(int index);
|
||||||
|
|
||||||
///
|
///
|
||||||
latexkeys * lm_get_key_by_id(int id, short tc = LM_TK_SYM);
|
latexkeys const * lm_get_key_by_id(int id, short tc = LM_TK_SYM);
|
||||||
|
|
||||||
///
|
|
||||||
union YYSTYPE {
|
|
||||||
///
|
|
||||||
unsigned char c;
|
|
||||||
///
|
|
||||||
char * s;
|
|
||||||
///
|
|
||||||
int i;
|
|
||||||
///
|
|
||||||
latexkeys * l;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,35 +28,36 @@ using std::ostream;
|
|||||||
MathRootInset::MathRootInset(short st)
|
MathRootInset::MathRootInset(short st)
|
||||||
: MathSqrtInset(st)
|
: MathSqrtInset(st)
|
||||||
{
|
{
|
||||||
idx = 1;
|
idx_ = 1;
|
||||||
uroot = new MathParInset(LM_ST_TEXT);
|
uroot_ = new MathParInset(LM_ST_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MathRootInset::~MathRootInset()
|
MathRootInset::~MathRootInset()
|
||||||
{
|
{
|
||||||
delete uroot;
|
delete uroot_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MathedInset * MathRootInset::Clone()
|
MathedInset * MathRootInset::Clone()
|
||||||
{
|
{
|
||||||
MathRootInset * p = new MathRootInset(GetStyle());
|
MathRootInset * p = new MathRootInset(GetStyle());
|
||||||
MathedIter it(array), itr(uroot->GetData());
|
MathedIter it(array);
|
||||||
p->SetData(it.Copy());
|
MathedIter itr(uroot_->GetData());
|
||||||
|
p->setData(it.Copy());
|
||||||
p->setArgumentIdx(0);
|
p->setArgumentIdx(0);
|
||||||
p->SetData(itr.Copy());
|
p->setData(itr.Copy());
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathRootInset::SetData(MathedArray * d)
|
void MathRootInset::setData(MathedArray * d)
|
||||||
{
|
{
|
||||||
if (idx == 1)
|
if (idx_ == 1)
|
||||||
MathParInset::SetData(d);
|
MathParInset::setData(d);
|
||||||
else {
|
else {
|
||||||
uroot->SetData(d);
|
uroot_->setData(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ void MathRootInset::SetData(MathedArray * d)
|
|||||||
bool MathRootInset::setArgumentIdx(int i)
|
bool MathRootInset::setArgumentIdx(int i)
|
||||||
{
|
{
|
||||||
if (i == 0 || i == 1) {
|
if (i == 0 || i == 1) {
|
||||||
idx = i;
|
idx_ = i;
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
@ -73,54 +74,54 @@ bool MathRootInset::setArgumentIdx(int i)
|
|||||||
|
|
||||||
void MathRootInset::GetXY(int & x, int & y) const
|
void MathRootInset::GetXY(int & x, int & y) const
|
||||||
{
|
{
|
||||||
if (idx == 1)
|
if (idx_ == 1)
|
||||||
MathParInset::GetXY(x, y);
|
MathParInset::GetXY(x, y);
|
||||||
else
|
else
|
||||||
uroot->GetXY(x, y);
|
uroot_->GetXY(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MathedArray * MathRootInset::GetData()
|
MathedArray * MathRootInset::GetData()
|
||||||
{
|
{
|
||||||
if (idx == 1)
|
if (idx_ == 1)
|
||||||
return array;
|
return array;
|
||||||
else
|
else
|
||||||
return uroot->GetData();
|
return uroot_->GetData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MathRootInset::Inside(int x, int y)
|
bool MathRootInset::Inside(int x, int y)
|
||||||
{
|
{
|
||||||
return (uroot->Inside(x, y) || MathSqrtInset::Inside(x, y));
|
return (uroot_->Inside(x, y) || MathSqrtInset::Inside(x, y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathRootInset::Metrics()
|
void MathRootInset::Metrics()
|
||||||
{
|
{
|
||||||
int idxp = idx;
|
int idxp = idx_;
|
||||||
|
|
||||||
idx = 1;
|
idx_ = 1;
|
||||||
MathSqrtInset::Metrics();
|
MathSqrtInset::Metrics();
|
||||||
uroot->Metrics();
|
uroot_->Metrics();
|
||||||
wroot = uroot->Width();
|
wroot_ = uroot_->Width();
|
||||||
dh = Height()/2;
|
dh_ = Height()/2;
|
||||||
width += wroot;
|
width += wroot_;
|
||||||
// if (uroot->Ascent() > dh)
|
// if (uroot->Ascent() > dh)
|
||||||
if (uroot->Height() > dh)
|
if (uroot_->Height() > dh_)
|
||||||
ascent += uroot->Height() - dh;
|
ascent += uroot_->Height() - dh_;
|
||||||
dh -= descent - uroot->Descent();
|
dh_ -= descent - uroot_->Descent();
|
||||||
idx = idxp;
|
idx_ = idxp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathRootInset::draw(Painter & pain, int x, int y)
|
void MathRootInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
int idxp = idx;
|
int idxp = idx_;
|
||||||
|
|
||||||
idx = 1;
|
idx_ = 1;
|
||||||
uroot->draw(pain, x, y - dh);
|
uroot_->draw(pain, x, y - dh_);
|
||||||
MathSqrtInset::draw(pain, x + wroot, y);
|
MathSqrtInset::draw(pain, x + wroot_, y);
|
||||||
idx = idxp;
|
idx_ = idxp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -128,20 +129,20 @@ void MathRootInset::SetStyle(short st)
|
|||||||
{
|
{
|
||||||
MathSqrtInset::SetStyle(st);
|
MathSqrtInset::SetStyle(st);
|
||||||
|
|
||||||
uroot->SetStyle((size() < LM_ST_SCRIPTSCRIPT) ? size() + 1 : size());
|
uroot_->SetStyle((size() < LM_ST_SCRIPTSCRIPT) ? size() + 1 : size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathRootInset::SetFocus(int x, int)
|
void MathRootInset::SetFocus(int x, int)
|
||||||
{
|
{
|
||||||
idx = (x > xo() + wroot) ? 1: 0;
|
idx_ = (x > xo() + wroot_) ? 1: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathRootInset::Write(ostream & os, bool fragile)
|
void MathRootInset::Write(ostream & os, bool fragile)
|
||||||
{
|
{
|
||||||
os << '\\' << name << '[';
|
os << '\\' << name << '[';
|
||||||
uroot->Write(os, fragile);
|
uroot_->Write(os, fragile);
|
||||||
os << "]{";
|
os << "]{";
|
||||||
MathParInset::Write(os, fragile);
|
MathParInset::Write(os, fragile);
|
||||||
os << '}';
|
os << '}';
|
||||||
|
@ -21,49 +21,68 @@
|
|||||||
|
|
||||||
#include "math_sqrtinset.h"
|
#include "math_sqrtinset.h"
|
||||||
#include "symbol_def.h"
|
#include "symbol_def.h"
|
||||||
#include "LString.h"
|
|
||||||
|
|
||||||
///
|
|
||||||
class MathRootInset: public MathSqrtInset {
|
/** The general n-th root inset.
|
||||||
|
\author Alejandro Aguilar Sierra
|
||||||
|
\version January 1999
|
||||||
|
*/
|
||||||
|
class MathRootInset : public MathSqrtInset {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
explicit
|
explicit
|
||||||
MathRootInset(short st = LM_ST_TEXT);
|
MathRootInset(short st = LM_ST_TEXT);
|
||||||
///
|
///
|
||||||
~MathRootInset();
|
~MathRootInset();
|
||||||
///
|
///
|
||||||
MathedInset * Clone();
|
MathedInset * Clone();
|
||||||
///
|
///
|
||||||
void draw(Painter &, int x, int baseline);
|
void draw(Painter &, int x, int baseline);
|
||||||
///
|
///
|
||||||
void Write(std::ostream &, bool fragile);
|
void Write(std::ostream &, bool fragile);
|
||||||
///
|
///
|
||||||
void Metrics();
|
void Metrics();
|
||||||
///
|
///
|
||||||
bool Inside(int, int);
|
bool Inside(int, int);
|
||||||
///
|
///
|
||||||
void SetFocus(int, int);
|
void SetFocus(int, int);
|
||||||
///
|
///
|
||||||
void SetData(MathedArray *);
|
void setData(MathedArray *);
|
||||||
///
|
///
|
||||||
void GetXY(int & x, int & y) const;
|
void GetXY(int & x, int & y) const;
|
||||||
///
|
///
|
||||||
MathedArray * GetData();
|
MathedArray * GetData();
|
||||||
///
|
///
|
||||||
bool setArgumentIdx(int i);
|
bool setArgumentIdx(int i);
|
||||||
///
|
///
|
||||||
int getArgumentIdx() const { return idx; }
|
int getArgumentIdx() const;
|
||||||
///
|
///
|
||||||
int getMaxArgumentIdx() const { return 1; }
|
int getMaxArgumentIdx() const;
|
||||||
///
|
///
|
||||||
void SetStyle(short);
|
void SetStyle(short);
|
||||||
|
private:
|
||||||
protected:
|
///
|
||||||
///
|
int idx_;
|
||||||
int idx;
|
///
|
||||||
///
|
MathParInset * uroot_;
|
||||||
MathParInset * uroot;
|
///
|
||||||
///
|
int wroot_;
|
||||||
int wroot, dh;
|
///
|
||||||
|
int dh_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
int MathRootInset::getArgumentIdx() const
|
||||||
|
{
|
||||||
|
return idx_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
int MathRootInset::getMaxArgumentIdx() const
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,8 +8,9 @@
|
|||||||
It allows to manage the extra info independently of the paragraph data.
|
It allows to manage the extra info independently of the paragraph data.
|
||||||
Only used for multiline paragraphs.
|
Only used for multiline paragraphs.
|
||||||
*/
|
*/
|
||||||
struct MathedRowSt
|
class MathedRowSt
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
///
|
///
|
||||||
typedef std::vector<int> Widths;
|
typedef std::vector<int> Widths;
|
||||||
|
|
||||||
@ -20,37 +21,39 @@ struct MathedRowSt
|
|||||||
numbered_(true), next_(0)
|
numbered_(true), next_(0)
|
||||||
{}
|
{}
|
||||||
/// Should be const but...
|
/// Should be const but...
|
||||||
MathedRowSt * getNext() const { return next_; }
|
MathedRowSt * getNext() const;
|
||||||
/// ...we couldn't use this.
|
/// ...we couldn't use this.
|
||||||
void setNext(MathedRowSt * n) { next_ = n; }
|
void setNext(MathedRowSt * n);
|
||||||
///
|
///
|
||||||
string const & getLabel() const { return label_; }
|
string const & getLabel() const;
|
||||||
///
|
///
|
||||||
bool isNumbered() const { return numbered_; }
|
bool isNumbered() const;
|
||||||
///
|
///
|
||||||
int getBaseline() const { return y_; }
|
int getBaseline() const;
|
||||||
///
|
///
|
||||||
void setBaseline(int b) { y_ = b; }
|
void setBaseline(int b);
|
||||||
///
|
///
|
||||||
int ascent() const { return asc_; }
|
int ascent() const;
|
||||||
///
|
///
|
||||||
int descent() const { return desc_; }
|
int descent() const;
|
||||||
///
|
///
|
||||||
void ascent(int a) { asc_ = a; }
|
void ascent(int a);
|
||||||
///
|
///
|
||||||
void descent(int d) { desc_ = d; }
|
void descent(int d);
|
||||||
///
|
///
|
||||||
int getTab(int i) const { return widths_[i]; }
|
int getTab(int i) const;
|
||||||
///
|
///
|
||||||
void setLabel(string const & l) { label_ = l; }
|
void setLabel(string const & l);
|
||||||
///
|
///
|
||||||
void setNumbered(bool nf) { numbered_ = nf; }
|
void setNumbered(bool nf);
|
||||||
///
|
///
|
||||||
void setTab(int i, int t) { widths_[i] = t; }
|
void setTab(int i, int t);
|
||||||
private:
|
private:
|
||||||
/// Vericals
|
/// Vericals
|
||||||
int asc_;
|
int asc_;
|
||||||
|
///
|
||||||
int desc_;
|
int desc_;
|
||||||
|
///
|
||||||
int y_;
|
int y_;
|
||||||
/// widths
|
/// widths
|
||||||
Widths widths_;
|
Widths widths_;
|
||||||
@ -61,4 +64,102 @@ private:
|
|||||||
///
|
///
|
||||||
MathedRowSt * next_;
|
MathedRowSt * next_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
MathedRowSt * MathedRowSt::getNext() const
|
||||||
|
{
|
||||||
|
return next_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void MathedRowSt::setNext(MathedRowSt * n)
|
||||||
|
{
|
||||||
|
next_ = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
string const & MathedRowSt::getLabel() const
|
||||||
|
{
|
||||||
|
return label_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool MathedRowSt::isNumbered() const
|
||||||
|
{
|
||||||
|
return numbered_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
int MathedRowSt::getBaseline() const
|
||||||
|
{
|
||||||
|
return y_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void MathedRowSt::setBaseline(int b)
|
||||||
|
{
|
||||||
|
y_ = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
int MathedRowSt::ascent() const
|
||||||
|
{
|
||||||
|
return asc_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
int MathedRowSt::descent() const
|
||||||
|
{
|
||||||
|
return desc_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void MathedRowSt::ascent(int a)
|
||||||
|
{
|
||||||
|
asc_ = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void MathedRowSt::descent(int d)
|
||||||
|
{
|
||||||
|
desc_ = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
int MathedRowSt::getTab(int i) const
|
||||||
|
{
|
||||||
|
return widths_[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void MathedRowSt::setLabel(string const & l)
|
||||||
|
{
|
||||||
|
label_ = l;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void MathedRowSt::setNumbered(bool nf)
|
||||||
|
{
|
||||||
|
numbered_ = nf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
void MathedRowSt::setTab(int i, int t)
|
||||||
|
{
|
||||||
|
widths_[i] = t;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -17,15 +17,15 @@ MathedInset * MathSqrtInset::Clone()
|
|||||||
{
|
{
|
||||||
MathSqrtInset * p = new MathSqrtInset(GetStyle());
|
MathSqrtInset * p = new MathSqrtInset(GetStyle());
|
||||||
MathedIter it(array);
|
MathedIter it(array);
|
||||||
p->SetData(it.Copy());
|
p->setData(it.Copy());
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MathSqrtInset::Inside(int x, int y)
|
bool MathSqrtInset::Inside(int x, int y)
|
||||||
{
|
{
|
||||||
return x >= xo() - hmax
|
return x >= xo() - hmax_
|
||||||
&& x <= xo() + width - hmax
|
&& x <= xo() + width - hmax_
|
||||||
&& y <= yo() + descent
|
&& y <= yo() + descent
|
||||||
&& y >= yo() - ascent;
|
&& y >= yo() - ascent;
|
||||||
}
|
}
|
||||||
@ -34,16 +34,17 @@ bool MathSqrtInset::Inside(int x, int y)
|
|||||||
void
|
void
|
||||||
MathSqrtInset::draw(Painter & pain, int x, int y)
|
MathSqrtInset::draw(Painter & pain, int x, int y)
|
||||||
{
|
{
|
||||||
MathParInset::draw(pain, x + hmax + 2, y);
|
MathParInset::draw(pain, x + hmax_ + 2, y);
|
||||||
int h = ascent;
|
int const h = ascent;
|
||||||
int d = descent;
|
int const d = descent;
|
||||||
int h2 = Height() / 2;
|
int const h2 = Height() / 2;
|
||||||
int w2 = (Height() > 4 * hmax) ? hmax : hmax / 2;
|
int const w2 = (Height() > 4 * hmax_) ? hmax_ : hmax_ / 2;
|
||||||
int xp[4], yp[4];
|
int xp[4];
|
||||||
xp[0] = x + hmax + wbody; yp[0] = y - h;
|
int yp[4];
|
||||||
xp[1] = x + hmax; yp[1] = y - h;
|
xp[0] = x + hmax_ + wbody_; yp[0] = y - h;
|
||||||
xp[2] = x + w2; yp[2] = y + d;
|
xp[1] = x + hmax_; yp[1] = y - h;
|
||||||
xp[3] = x; yp[3] = y + d - h2;
|
xp[2] = x + w2; yp[2] = y + d;
|
||||||
|
xp[3] = x; yp[3] = y + d - h2;
|
||||||
pain.lines(xp, yp, 4, LColor::mathline);
|
pain.lines(xp, yp, 4, LColor::mathline);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,11 +55,12 @@ MathSqrtInset::Metrics()
|
|||||||
MathParInset::Metrics();
|
MathParInset::Metrics();
|
||||||
ascent += 4;
|
ascent += 4;
|
||||||
descent += 2;
|
descent += 2;
|
||||||
int a, b;
|
int a;
|
||||||
hmax = mathed_char_height(LM_TC_VAR, size(), 'I', a, b);
|
int b;
|
||||||
if (hmax < 10) hmax = 10;
|
hmax_ = mathed_char_height(LM_TC_VAR, size(), 'I', a, b);
|
||||||
wbody = width + 4;
|
if (hmax_ < 10) hmax_ = 10;
|
||||||
width += hmax + 4;
|
wbody_ = width + 4;
|
||||||
|
width += hmax_ + 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,8 +4,10 @@
|
|||||||
|
|
||||||
#include "math_parinset.h"
|
#include "math_parinset.h"
|
||||||
|
|
||||||
///
|
/** The square root inset.
|
||||||
class MathSqrtInset: public MathParInset {
|
\author Alejandro Aguilar Siearra
|
||||||
|
*/
|
||||||
|
class MathSqrtInset : public MathParInset {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
MathSqrtInset(short st = LM_ST_TEXT);
|
MathSqrtInset(short st = LM_ST_TEXT);
|
||||||
@ -21,6 +23,8 @@ public:
|
|||||||
bool Inside(int, int);
|
bool Inside(int, int);
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
int hmax, wbody;
|
int hmax_;
|
||||||
|
///
|
||||||
|
int wbody_;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -58,70 +58,83 @@ extern BufferView * current_view;
|
|||||||
#include "dots.xbm"
|
#include "dots.xbm"
|
||||||
|
|
||||||
/* Latex code for those bitmaps */
|
/* Latex code for those bitmaps */
|
||||||
static char const * latex_greek[] = {
|
static
|
||||||
"Gamma", "Delta", "Theta", "Lambda", "Xi", "Pi",
|
char const * latex_greek[] = {
|
||||||
"Sigma", "Upsilon", "Phi", "Psi", "Omega",
|
"Gamma", "Delta", "Theta", "Lambda", "Xi", "Pi",
|
||||||
"alpha", "beta", "gamma", "delta", "epsilon", "varepsilon", "zeta",
|
"Sigma", "Upsilon", "Phi", "Psi", "Omega",
|
||||||
"eta", "theta", "vartheta", "iota", "kappa", "lambda", "mu",
|
"alpha", "beta", "gamma", "delta", "epsilon", "varepsilon", "zeta",
|
||||||
"nu", "xi", "pi", "varpi", "rho", "sigma", "varsigma",
|
"eta", "theta", "vartheta", "iota", "kappa", "lambda", "mu",
|
||||||
"tau", "upsilon", "phi", "varphi", "chi", "psi", "omega", ""
|
"nu", "xi", "pi", "varpi", "rho", "sigma", "varsigma",
|
||||||
|
"tau", "upsilon", "phi", "varphi", "chi", "psi", "omega", ""
|
||||||
};
|
};
|
||||||
|
|
||||||
static char const * latex_brel[] = {
|
|
||||||
"leq", "geq", "equiv", "models",
|
static
|
||||||
"prec", "succ", "sim", "perp",
|
char const * latex_brel[] = {
|
||||||
"preceq", "succeq", "simeq", "mid",
|
"leq", "geq", "equiv", "models",
|
||||||
"ll", "gg", "asymp", "parallel",
|
"prec", "succ", "sim", "perp",
|
||||||
"subset", "supset", "approx", "smile",
|
"preceq", "succeq", "simeq", "mid",
|
||||||
"subseteq", "supseteq", "cong", "frown",
|
"ll", "gg", "asymp", "parallel",
|
||||||
"sqsubseteq", "sqsupseteq", "doteq", "neq",
|
"subset", "supset", "approx", "smile",
|
||||||
"in", "ni", "propto", "notin",
|
"subseteq", "supseteq", "cong", "frown",
|
||||||
"vdash", "dashv", "bowtie", ""
|
"sqsubseteq", "sqsupseteq", "doteq", "neq",
|
||||||
|
"in", "ni", "propto", "notin",
|
||||||
|
"vdash", "dashv", "bowtie", ""
|
||||||
};
|
};
|
||||||
|
|
||||||
static char const * latex_arrow[] = {
|
|
||||||
"downarrow", "leftarrow", "Downarrow", "Leftarrow",
|
static
|
||||||
"hookleftarrow", "rightarrow", "uparrow", "Rightarrow", "Uparrow",
|
char const * latex_arrow[] = {
|
||||||
"hookrightarrow", "updownarrow", "Leftrightarrow", "leftharpoonup",
|
"downarrow", "leftarrow", "Downarrow", "Leftarrow",
|
||||||
"rightharpoonup", "rightleftharpoons", "leftrightarrow", "Updownarrow",
|
"hookleftarrow", "rightarrow", "uparrow", "Rightarrow", "Uparrow",
|
||||||
"leftharpoondown", "rightharpoondown", "mapsto",
|
"hookrightarrow", "updownarrow", "Leftrightarrow", "leftharpoonup",
|
||||||
"Longleftarrow", "Longrightarrow", "Longleftrightarrow",
|
"rightharpoonup", "rightleftharpoons", "leftrightarrow", "Updownarrow",
|
||||||
"longleftrightarrow", "longleftarrow", "longrightarrow", "longmapsto",
|
"leftharpoondown", "rightharpoondown", "mapsto",
|
||||||
"nwarrow", "nearrow", "swarrow", "searrow", "",
|
"Longleftarrow", "Longrightarrow", "Longleftrightarrow",
|
||||||
|
"longleftrightarrow", "longleftarrow", "longrightarrow", "longmapsto",
|
||||||
|
"nwarrow", "nearrow", "swarrow", "searrow", "",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
char const * latex_varsz[] = {
|
char const * latex_varsz[] = {
|
||||||
"sum", "int", "oint",
|
"sum", "int", "oint",
|
||||||
"prod", "coprod", "bigsqcup",
|
"prod", "coprod", "bigsqcup",
|
||||||
"bigotimes", "bigodot", "bigoplus",
|
"bigotimes", "bigodot", "bigoplus",
|
||||||
"bigcap", "bigcup", "biguplus",
|
"bigcap", "bigcup", "biguplus",
|
||||||
"bigvee", "bigwedge", ""
|
"bigvee", "bigwedge", ""
|
||||||
};
|
};
|
||||||
|
|
||||||
static char const * latex_bop[] = {
|
|
||||||
"pm", "cap", "diamond", "oplus",
|
static
|
||||||
"mp", "cup", "bigtriangleup", "ominus",
|
char const * latex_bop[] = {
|
||||||
"times", "uplus", "bigtriangledown", "otimes",
|
"pm", "cap", "diamond", "oplus",
|
||||||
"div", "sqcap", "triangleright", "oslash",
|
"mp", "cup", "bigtriangleup", "ominus",
|
||||||
"cdot", "sqcup", "triangleleft", "odot",
|
"times", "uplus", "bigtriangledown", "otimes",
|
||||||
"star", "vee", "amalg", "bigcirc",
|
"div", "sqcap", "triangleright", "oslash",
|
||||||
"setminus", "wedge", "dagger", "circ",
|
"cdot", "sqcup", "triangleleft", "odot",
|
||||||
"bullet", "wr", "ddagger", ""
|
"star", "vee", "amalg", "bigcirc",
|
||||||
|
"setminus", "wedge", "dagger", "circ",
|
||||||
|
"bullet", "wr", "ddagger", ""
|
||||||
};
|
};
|
||||||
|
|
||||||
static char const * latex_misc[] = {
|
|
||||||
"nabla", "partial", "infty", "prime", "ell",
|
static
|
||||||
"emptyset", "exists", "forall", "imath", "jmath",
|
char const * latex_misc[] = {
|
||||||
"Re", "Im", "aleph", "wp", "hbar",
|
"nabla", "partial", "infty", "prime", "ell",
|
||||||
"angle", "top", "bot", "Vert", "neg",
|
"emptyset", "exists", "forall", "imath", "jmath",
|
||||||
"flat", "natural", "sharp", "surd", "triangle",
|
"Re", "Im", "aleph", "wp", "hbar",
|
||||||
"diamondsuit", "heartsuit", "clubsuit", "spadesuit", ""
|
"angle", "top", "bot", "Vert", "neg",
|
||||||
|
"flat", "natural", "sharp", "surd", "triangle",
|
||||||
|
"diamondsuit", "heartsuit", "clubsuit", "spadesuit", ""
|
||||||
};
|
};
|
||||||
|
|
||||||
static char const * latex_dots[] = {
|
|
||||||
"ldots", "cdots", "vdots", "ddots"
|
static
|
||||||
|
char const * latex_dots[] = {
|
||||||
|
"ldots", "cdots", "vdots", "ddots"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern char const ** mathed_get_pixmap_from_icon(int d);
|
extern char const ** mathed_get_pixmap_from_icon(int d);
|
||||||
extern "C" void math_cb(FL_OBJECT*, long);
|
extern "C" void math_cb(FL_OBJECT*, long);
|
||||||
static char const ** pixmapFromBitmapData(char const *, int, int);
|
static char const ** pixmapFromBitmapData(char const *, int, int);
|
||||||
@ -133,17 +146,17 @@ BitmapMenu * BitmapMenu::active = 0;
|
|||||||
BitmapMenu::BitmapMenu(int n, FL_OBJECT * bt, BitmapMenu * prevx)
|
BitmapMenu::BitmapMenu(int n, FL_OBJECT * bt, BitmapMenu * prevx)
|
||||||
: current_(0), bitmaps_(n)
|
: current_(0), bitmaps_(n)
|
||||||
{
|
{
|
||||||
w = h = 0;
|
w = h = 0;
|
||||||
form = 0;
|
form = 0;
|
||||||
ww = 2 * FL_abs(FL_BOUND_WIDTH);
|
ww = 2 * FL_abs(FL_BOUND_WIDTH);
|
||||||
x = y = ww;
|
x = y = ww;
|
||||||
y += 8;
|
y += 8;
|
||||||
button = bt;
|
button = bt;
|
||||||
button->u_vdata = this;
|
button->u_vdata = this;
|
||||||
prev = prevx;
|
prev = prevx;
|
||||||
next = 0;
|
next = 0;
|
||||||
if (prev)
|
if (prev)
|
||||||
prev->next = this;
|
prev->next = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -157,404 +170,424 @@ BitmapMenu::~BitmapMenu()
|
|||||||
|
|
||||||
void BitmapMenu::Hide()
|
void BitmapMenu::Hide()
|
||||||
{
|
{
|
||||||
fl_hide_form(form);
|
fl_hide_form(form);
|
||||||
fl_set_button(button, 0);
|
fl_set_button(button, 0);
|
||||||
active = 0;
|
active = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BitmapMenu::Show()
|
void BitmapMenu::Show()
|
||||||
{
|
{
|
||||||
if (active)
|
if (active)
|
||||||
active->Hide();
|
active->Hide();
|
||||||
active = this;
|
active = this;
|
||||||
// int x = button->form->x + button->x, y = button->form->y + button->y;
|
// int x = button->form->x + button->x, y = button->form->y + button->y;
|
||||||
// fl_set_form_position(form, x, y + button->h);
|
// fl_set_form_position(form, x, y + button->h);
|
||||||
fl_set_button(button, 1);
|
fl_set_button(button, 1);
|
||||||
fl_show_form(form, FL_PLACE_MOUSE, FL_NOBORDER, "");
|
fl_show_form(form, FL_PLACE_MOUSE, FL_NOBORDER, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FL_OBJECT *
|
FL_OBJECT *
|
||||||
BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh,
|
BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh,
|
||||||
unsigned char const * data, Bool vert)
|
unsigned char const * data, Bool vert)
|
||||||
{
|
{
|
||||||
if (current_ >= bitmaps_.size())
|
if (current_ >= bitmaps_.size())
|
||||||
return 0;
|
return 0;
|
||||||
int wx = bw+ww/2, wy = bh+ww/2;
|
int wx = bw + ww / 2;
|
||||||
wx += (wx % nx);
|
int wy = bh + ww / 2;
|
||||||
wy += (wy % ny);
|
wx += (wx % nx);
|
||||||
FL_OBJECT * obj = fl_create_bmtable(1, x, y, wx, wy, "");
|
wy += (wy % ny);
|
||||||
fl_set_object_callback(obj, math_cb, id);
|
FL_OBJECT * obj = fl_create_bmtable(1, x, y, wx, wy, "");
|
||||||
fl_set_object_lcol(obj, FL_BLUE);
|
fl_set_object_callback(obj, math_cb, id);
|
||||||
fl_set_object_boxtype(obj, FL_UP_BOX);
|
fl_set_object_lcol(obj, FL_BLUE);
|
||||||
fl_set_bmtable_data(obj, nx, ny, bw, bh, data);
|
fl_set_object_boxtype(obj, FL_UP_BOX);
|
||||||
if (vert) {
|
fl_set_bmtable_data(obj, nx, ny, bw, bh, data);
|
||||||
y += wy + 8;
|
if (vert) {
|
||||||
h = max(y, h);
|
y += wy + 8;
|
||||||
w = max(x + wx + ww, w);
|
h = max(y, h);
|
||||||
} else {
|
w = max(x + wx + ww, w);
|
||||||
x += wx + 8;
|
} else {
|
||||||
w = max(x, w);
|
x += wx + 8;
|
||||||
h = max(y + wy + ww, h);
|
w = max(x, w);
|
||||||
}
|
h = max(y + wy + ww, h);
|
||||||
bitmaps_[current_++] = obj;
|
}
|
||||||
return obj;
|
bitmaps_[current_++] = obj;
|
||||||
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BitmapMenu::Create()
|
void BitmapMenu::Create()
|
||||||
{
|
{
|
||||||
if (current_ < bitmaps_.size()) {
|
if (current_ < bitmaps_.size()) {
|
||||||
lyxerr << "Error: Bitmaps not created!" << endl;
|
lyxerr << "Error: Bitmaps not created!" << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
form = fl_bgn_form(FL_UP_BOX, w, h);
|
form = fl_bgn_form(FL_UP_BOX, w, h);
|
||||||
for (current_ = 0; current_ < bitmaps_.size(); ++current_) {
|
for (current_ = 0; current_ < bitmaps_.size(); ++current_) {
|
||||||
fl_add_object(form, bitmaps_[current_]);
|
fl_add_object(form, bitmaps_[current_]);
|
||||||
bitmaps_[current_]->u_vdata = this;
|
bitmaps_[current_]->u_vdata = this;
|
||||||
}
|
}
|
||||||
fl_end_form();
|
fl_end_form();
|
||||||
fl_register_raw_callback(form, KeyPressMask, C_peek_event);
|
fl_register_raw_callback(form, KeyPressMask, C_peek_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int BitmapMenu::GetIndex(FL_OBJECT* ob)
|
int BitmapMenu::GetIndex(FL_OBJECT* ob)
|
||||||
{
|
{
|
||||||
if (active == this) {
|
if (active == this) {
|
||||||
int k = 0;
|
int k = 0;
|
||||||
for (current_ = 0; current_ < bitmaps_.size(); ++current_) {
|
for (current_ = 0; current_ < bitmaps_.size(); ++current_) {
|
||||||
if (bitmaps_[current_] == ob)
|
if (bitmaps_[current_] == ob)
|
||||||
return k+fl_get_bmtable(ob);
|
return k+fl_get_bmtable(ob);
|
||||||
k += fl_get_bmtable_maxitems(bitmaps_[current_]);
|
k += fl_get_bmtable_maxitems(bitmaps_[current_]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int peek_event(FL_FORM * /*form*/, void *xev)
|
int peek_event(FL_FORM * /*form*/, void *xev)
|
||||||
{
|
{
|
||||||
if (BitmapMenu::active == 0)
|
if (BitmapMenu::active == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (static_cast<XEvent *>(xev)->type == ButtonPress)
|
if (static_cast<XEvent *>(xev)->type == ButtonPress) {
|
||||||
{
|
BitmapMenu::active->Hide();
|
||||||
BitmapMenu::active->Hide();
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
if (static_cast<XEvent *>(xev)->type == KeyPress) {
|
||||||
if (static_cast<XEvent *>(xev)->type == KeyPress)
|
char c[5];
|
||||||
{
|
KeySym keysym;
|
||||||
char c[5];
|
XLookupString(&static_cast<XEvent *>(xev)->xkey, &c[0], 5, &keysym, 0);
|
||||||
KeySym keysym;
|
if (keysym == XK_Left)
|
||||||
XLookupString(&static_cast<XEvent *>(xev)->xkey, &c[0], 5, &keysym, 0);
|
BitmapMenu::active->Prev(); else
|
||||||
if (keysym == XK_Left)
|
if (keysym == XK_Right)
|
||||||
BitmapMenu::active->Prev(); else
|
BitmapMenu::active->Next();
|
||||||
if (keysym == XK_Right)
|
else
|
||||||
BitmapMenu::active->Next();
|
BitmapMenu::active->Hide();
|
||||||
else
|
return 1;
|
||||||
BitmapMenu::active->Hide();
|
}
|
||||||
return 1;
|
return 0;
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This is just a wrapper.
|
// This is just a wrapper.
|
||||||
extern "C" int C_peek_event(FL_FORM *form, void *ptr) {
|
extern "C" int C_peek_event(FL_FORM *form, void *ptr)
|
||||||
return peek_event(form, ptr);
|
{
|
||||||
|
return peek_event(form, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" void math_cb(FL_OBJECT* ob, long data)
|
extern "C" void math_cb(FL_OBJECT* ob, long data)
|
||||||
{
|
{
|
||||||
BitmapMenu * menu = static_cast<BitmapMenu*>(ob->u_vdata);
|
BitmapMenu * menu = static_cast<BitmapMenu*>(ob->u_vdata);
|
||||||
int i = menu->GetIndex(ob);
|
int i = menu->GetIndex(ob);
|
||||||
char const *s = 0;
|
char const *s = 0;
|
||||||
|
|
||||||
// lyxerr << "data[" << data << "]";
|
// lyxerr << "data[" << data << "]";
|
||||||
if (i<0) return;
|
if (i<0) return;
|
||||||
switch (data) {
|
switch (data) {
|
||||||
case MM_GREEK:
|
case MM_GREEK:
|
||||||
s = latex_greek[i];
|
s = latex_greek[i];
|
||||||
break;
|
break;
|
||||||
case MM_ARROW:
|
case MM_ARROW:
|
||||||
s = latex_arrow[i];
|
s = latex_arrow[i];
|
||||||
break;
|
break;
|
||||||
case MM_BRELATS:
|
case MM_BRELATS:
|
||||||
s = latex_brel[i];
|
s = latex_brel[i];
|
||||||
break;
|
break;
|
||||||
case MM_BOP:
|
case MM_BOP:
|
||||||
s = latex_bop[i];
|
s = latex_bop[i];
|
||||||
break;
|
break;
|
||||||
case MM_VARSIZE:
|
case MM_VARSIZE:
|
||||||
s = latex_varsz[i];
|
s = latex_varsz[i];
|
||||||
break;
|
break;
|
||||||
case MM_MISC:
|
case MM_MISC:
|
||||||
s = latex_misc[i];
|
s = latex_misc[i];
|
||||||
break;
|
break;
|
||||||
case MM_DOTS:
|
case MM_DOTS:
|
||||||
// lyxerr << "dots[" << latex_dots[i] << " " << i << "]";
|
// lyxerr << "dots[" << latex_dots[i] << " " << i << "]";
|
||||||
s = latex_dots[i-29];
|
s = latex_dots[i-29];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
if (current_view->available() && lyxrc.display_shortcuts) {
|
if (current_view->available() && lyxrc.display_shortcuts) {
|
||||||
current_view->owner()->getMiniBuffer()->Set("Inserting symbol ", s);
|
current_view->owner()->getMiniBuffer()->Set("Inserting symbol ", s);
|
||||||
}
|
}
|
||||||
current_view->owner()->getLyXFunc()->Dispatch(LFUN_INSERT_MATH, s);
|
current_view->owner()->getLyXFunc()->Dispatch(LFUN_INSERT_MATH, s);
|
||||||
}
|
}
|
||||||
if (menu)
|
if (menu)
|
||||||
menu->Hide();
|
menu->Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char const ** get_pixmap_from_symbol(char const * arg, int wx, int hx)
|
char const ** get_pixmap_from_symbol(char const * arg, int wx, int hx)
|
||||||
{
|
{
|
||||||
char const ** data = 0;
|
char const ** data = 0;
|
||||||
latexkeys * l = in_word_set (arg, strlen(arg));
|
latexkeys const * l = in_word_set (arg, strlen(arg));
|
||||||
if (!l)
|
if (!l)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
switch (l->token) {
|
switch (l->token) {
|
||||||
case LM_TK_FRAC:
|
case LM_TK_FRAC:
|
||||||
data = mathed_get_pixmap_from_icon(MM_FRAC);
|
data = mathed_get_pixmap_from_icon(MM_FRAC);
|
||||||
break;
|
break;
|
||||||
case LM_TK_SQRT:
|
case LM_TK_SQRT:
|
||||||
data = mathed_get_pixmap_from_icon(MM_SQRT);
|
data = mathed_get_pixmap_from_icon(MM_SQRT);
|
||||||
break;
|
break;
|
||||||
case LM_TK_BIGSYM:
|
case LM_TK_BIGSYM:
|
||||||
case LM_TK_SYM:
|
case LM_TK_SYM:
|
||||||
// I have to use directly the bitmap data since the
|
// I have to use directly the bitmap data since the
|
||||||
// bitmap tables are not yet created when this
|
// bitmap tables are not yet created when this
|
||||||
// function is called.
|
// function is called.
|
||||||
data = pixmapFromBitmapData(arg, wx, hx);
|
data = pixmapFromBitmapData(arg, wx, hx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool math_insert_greek(BufferView * bv, char c)
|
bool math_insert_greek(BufferView * bv, char c)
|
||||||
{
|
{
|
||||||
if (bv->available() &&
|
if (bv->available() &&
|
||||||
(('A' <= c && c <= 'Z') ||
|
(('A' <= c && c <= 'Z') ||
|
||||||
('a'<= c && c<= 'z'))) {
|
('a'<= c && c<= 'z'))) {
|
||||||
string tmp;
|
string tmp;
|
||||||
tmp = c;
|
tmp = c;
|
||||||
if (!bv->theLockingInset() || bv->theLockingInset()->IsTextInset()) {
|
if (!bv->theLockingInset() || bv->theLockingInset()->IsTextInset()) {
|
||||||
int greek_kb_flag_save = greek_kb_flag;
|
int greek_kb_flag_save = greek_kb_flag;
|
||||||
InsetFormula * new_inset = new InsetFormula();
|
InsetFormula * new_inset = new InsetFormula();
|
||||||
bv->beforeChange(bv->text);
|
bv->beforeChange(bv->text);
|
||||||
if (!bv->insertInset(new_inset)) {
|
if (!bv->insertInset(new_inset)) {
|
||||||
delete new_inset;
|
delete new_inset;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Update(1);//BUG
|
// Update(1);//BUG
|
||||||
new_inset->Edit(bv, 0, 0, 0);
|
new_inset->Edit(bv, 0, 0, 0);
|
||||||
new_inset->LocalDispatch(bv, LFUN_SELFINSERT, tmp);
|
new_inset->LocalDispatch(bv, LFUN_SELFINSERT, tmp);
|
||||||
if (greek_kb_flag_save < 2) {
|
if (greek_kb_flag_save < 2) {
|
||||||
bv->unlockInset(new_inset); // bv->theLockingInset());
|
bv->unlockInset(new_inset); // bv->theLockingInset());
|
||||||
bv->text->CursorRight(bv, true);
|
bv->text->CursorRight(bv, true);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (bv->theLockingInset()->LyxCode() == Inset::MATH_CODE ||
|
if (bv->theLockingInset()->LyxCode() == Inset::MATH_CODE ||
|
||||||
bv->theLockingInset()->LyxCode() == Inset::MATHMACRO_CODE)
|
bv->theLockingInset()->LyxCode() == Inset::MATHMACRO_CODE)
|
||||||
static_cast<InsetFormula*>(bv->theLockingInset())->LocalDispatch(bv, LFUN_SELFINSERT, tmp);
|
static_cast<InsetFormula*>(bv->theLockingInset())->LocalDispatch(bv, LFUN_SELFINSERT, tmp);
|
||||||
else
|
else
|
||||||
lyxerr << "Math error: attempt to write on a wrong "
|
lyxerr << "Math error: attempt to write on a wrong "
|
||||||
"class of inset." << endl;
|
"class of inset." << endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void math_insert_symbol(BufferView * bv, string const & s)
|
void math_insert_symbol(BufferView * bv, string const & s)
|
||||||
{
|
{
|
||||||
if (bv->available()) {
|
if (bv->available()) {
|
||||||
if (!bv->theLockingInset() || bv->theLockingInset()->IsTextInset()) {
|
if (!bv->theLockingInset() || bv->theLockingInset()->IsTextInset()) {
|
||||||
InsetFormula * new_inset = new InsetFormula();
|
InsetFormula * new_inset = new InsetFormula();
|
||||||
bv->beforeChange(bv->text);
|
bv->beforeChange(bv->text);
|
||||||
if (!bv->insertInset(new_inset)) {
|
if (!bv->insertInset(new_inset)) {
|
||||||
delete new_inset;
|
delete new_inset;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Update(1);//BUG
|
new_inset->Edit(bv, 0, 0, 0);
|
||||||
new_inset->Edit(bv, 0, 0, 0);
|
new_inset->InsertSymbol(bv, s);
|
||||||
new_inset->InsertSymbol(bv, s);
|
} else
|
||||||
} else
|
if (bv->theLockingInset()->LyxCode() == Inset::MATH_CODE ||
|
||||||
if (bv->theLockingInset()->LyxCode() == Inset::MATH_CODE ||
|
bv->theLockingInset()->LyxCode() == Inset::MATHMACRO_CODE)
|
||||||
bv->theLockingInset()->LyxCode() == Inset::MATHMACRO_CODE)
|
static_cast<InsetFormula*>(bv->theLockingInset())->InsertSymbol(bv, s);
|
||||||
static_cast<InsetFormula*>(bv->theLockingInset())->InsertSymbol(bv, s);
|
else
|
||||||
else
|
lyxerr << "Math error: attempt to write on a wrong "
|
||||||
lyxerr << "Math error: attempt to write on a wrong "
|
"class of inset." << endl;
|
||||||
"class of inset." << endl;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BitmapMenu * sym_menu= 0;
|
BitmapMenu * sym_menu = 0;
|
||||||
|
|
||||||
void create_symbol_menues(FD_panel * symb_form)
|
void create_symbol_menues(FD_panel * symb_form)
|
||||||
{
|
{
|
||||||
FL_OBJECT * obj;
|
FL_OBJECT * obj;
|
||||||
BitmapMenu * menu;
|
BitmapMenu * menu;
|
||||||
|
|
||||||
sym_menu = menu = new BitmapMenu(2, symb_form->greek);
|
sym_menu = menu = new BitmapMenu(2, symb_form->greek);
|
||||||
obj = menu->AddBitmap(MM_GREEK, 6, 2, Greek_width, Greek_height,
|
obj = menu->AddBitmap(MM_GREEK, 6, 2, Greek_width, Greek_height,
|
||||||
Greek_bits);
|
Greek_bits);
|
||||||
fl_set_bmtable_maxitems(obj, 11);
|
fl_set_bmtable_maxitems(obj, 11);
|
||||||
obj = menu->AddBitmap(MM_GREEK, 7, 4, greek_width, greek_height,
|
obj = menu->AddBitmap(MM_GREEK, 7, 4, greek_width, greek_height,
|
||||||
greek_bits);
|
greek_bits);
|
||||||
menu->Create();
|
menu->Create();
|
||||||
|
|
||||||
menu = new BitmapMenu(1, symb_form->boperator, menu);
|
menu = new BitmapMenu(1, symb_form->boperator, menu);
|
||||||
obj = menu->AddBitmap(MM_BOP, 4, 8, bop_width, bop_height,
|
obj = menu->AddBitmap(MM_BOP, 4, 8, bop_width, bop_height,
|
||||||
bop_bits);
|
bop_bits);
|
||||||
fl_set_bmtable_maxitems(obj, 31);
|
fl_set_bmtable_maxitems(obj, 31);
|
||||||
menu->Create();
|
menu->Create();
|
||||||
|
|
||||||
menu = new BitmapMenu(1, symb_form->brelats, menu);
|
menu = new BitmapMenu(1, symb_form->brelats, menu);
|
||||||
obj = menu->AddBitmap(MM_BRELATS, 4, 9, brel_width, brel_height,
|
obj = menu->AddBitmap(MM_BRELATS, 4, 9, brel_width, brel_height,
|
||||||
brel_bits);
|
brel_bits);
|
||||||
fl_set_bmtable_maxitems(obj, 35);
|
fl_set_bmtable_maxitems(obj, 35);
|
||||||
menu->Create();
|
menu->Create();
|
||||||
|
|
||||||
menu = new BitmapMenu(3, symb_form->arrow, menu);
|
menu = new BitmapMenu(3, symb_form->arrow, menu);
|
||||||
obj = menu->AddBitmap(MM_ARROW, 5, 4, arrow_width, arrow_height,
|
obj = menu->AddBitmap(MM_ARROW, 5, 4, arrow_width, arrow_height,
|
||||||
arrow_bits);
|
arrow_bits);
|
||||||
obj = menu->AddBitmap(MM_ARROW, 2, 4, larrow_width, larrow_height,
|
obj = menu->AddBitmap(MM_ARROW, 2, 4, larrow_width, larrow_height,
|
||||||
larrow_bits, False);
|
larrow_bits, False);
|
||||||
fl_set_bmtable_maxitems(obj, 7);
|
fl_set_bmtable_maxitems(obj, 7);
|
||||||
obj = menu->AddBitmap(MM_ARROW, 2, 2, darrow_width, darrow_height,
|
obj = menu->AddBitmap(MM_ARROW, 2, 2, darrow_width, darrow_height,
|
||||||
darrow_bits);
|
darrow_bits);
|
||||||
menu->Create();
|
menu->Create();
|
||||||
|
|
||||||
menu = new BitmapMenu(1, symb_form->varsize, menu);
|
menu = new BitmapMenu(1, symb_form->varsize, menu);
|
||||||
obj = menu->AddBitmap(MM_VARSIZE, 3, 5, varsz_width, varsz_height,
|
obj = menu->AddBitmap(MM_VARSIZE, 3, 5, varsz_width, varsz_height,
|
||||||
varsz_bits);
|
varsz_bits);
|
||||||
fl_set_bmtable_maxitems(obj, 14);
|
fl_set_bmtable_maxitems(obj, 14);
|
||||||
menu->Create();
|
menu->Create();
|
||||||
|
|
||||||
menu = new BitmapMenu(2, symb_form->misc, menu);
|
menu = new BitmapMenu(2, symb_form->misc, menu);
|
||||||
obj = menu->AddBitmap(MM_MISC, 5, 6, misc_width, misc_height,
|
obj = menu->AddBitmap(MM_MISC, 5, 6, misc_width, misc_height,
|
||||||
misc_bits);
|
misc_bits);
|
||||||
fl_set_bmtable_maxitems(obj, 29);
|
fl_set_bmtable_maxitems(obj, 29);
|
||||||
obj = menu->AddBitmap(MM_DOTS, 4, 1, dots_width, dots_height,
|
obj = menu->AddBitmap(MM_DOTS, 4, 1, dots_width, dots_height,
|
||||||
dots_bits);
|
dots_bits);
|
||||||
menu->Create();
|
menu->Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
char const ** pixmapFromBitmapData(char const * s, int wx, int hx)
|
char const ** pixmapFromBitmapData(char const * s, int wx, int hx)
|
||||||
{
|
{
|
||||||
int i;
|
char const ** data = 0;
|
||||||
char const ** data = 0;
|
|
||||||
|
|
||||||
int id = -1;
|
int id = -1;
|
||||||
|
|
||||||
for (i = 0; i < 6; ++i) {
|
int i = 0;
|
||||||
char const ** latex_str = 0;
|
for (; i < 6; ++i) {
|
||||||
switch (i) {
|
char const ** latex_str = 0;
|
||||||
case 0: latex_str = latex_greek; break;
|
switch (i) {
|
||||||
case 1: latex_str = latex_bop; break;
|
case 0: latex_str = latex_greek; break;
|
||||||
case 2: latex_str = latex_brel; break;
|
case 1: latex_str = latex_bop; break;
|
||||||
case 3: latex_str = latex_arrow; break;
|
case 2: latex_str = latex_brel; break;
|
||||||
case 4: latex_str = latex_varsz; break;
|
case 3: latex_str = latex_arrow; break;
|
||||||
case 5: latex_str = latex_misc; break;
|
case 4: latex_str = latex_varsz; break;
|
||||||
|
case 5: latex_str = latex_misc; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int k = 0; latex_str[k][0] > ' '; ++k) {
|
||||||
|
if (compare(latex_str[k], s) == 0) {
|
||||||
|
id = k;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (id >= 0) break;
|
||||||
}
|
}
|
||||||
|
if (i < 6 && id >= 0) {
|
||||||
|
unsigned char const * bdata = 0;
|
||||||
|
int w = 0;
|
||||||
|
int h = 0;
|
||||||
|
int dw = 0;
|
||||||
|
int dh = 0;
|
||||||
|
|
||||||
for (int k = 0; latex_str[k][0] > ' '; ++k) {
|
lyxerr[Debug::MATHED] << "Imando " << i << ", " << id << endl;
|
||||||
if (strcmp(latex_str[k], s) == 0) {
|
switch (i) {
|
||||||
id = k;
|
case 0:
|
||||||
break;
|
if (id <= 10) {
|
||||||
}
|
w = Greek_width;
|
||||||
}
|
h = Greek_height;
|
||||||
if (id >= 0) break;
|
bdata = Greek_bits;
|
||||||
}
|
dw = 6;
|
||||||
if (i < 6 && id >= 0) {
|
dh = 2;
|
||||||
unsigned char const * bdata = 0;
|
} else {
|
||||||
int w = 0, h = 0, dw = 0, dh = 0;
|
w = greek_width;
|
||||||
|
h = greek_height;
|
||||||
|
bdata = greek_bits;
|
||||||
|
dw = 7;
|
||||||
|
dh = 4;
|
||||||
|
id -= 11;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
w = bop_width;
|
||||||
|
h = bop_height;
|
||||||
|
bdata = bop_bits;
|
||||||
|
dw = 4;
|
||||||
|
dh = 8;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
w = brel_width;
|
||||||
|
h = brel_height;
|
||||||
|
bdata = brel_bits;
|
||||||
|
dw = 4;
|
||||||
|
dh = 9;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (id < 20) {
|
||||||
|
w = arrow_width;
|
||||||
|
h = arrow_height;
|
||||||
|
bdata = arrow_bits;
|
||||||
|
dw = 5;
|
||||||
|
dh = 4;
|
||||||
|
} else if (id > 28) {
|
||||||
|
w = darrow_width;
|
||||||
|
h = darrow_height;
|
||||||
|
bdata = darrow_bits;
|
||||||
|
dw = 2;
|
||||||
|
dh = 2;
|
||||||
|
id -= 29;
|
||||||
|
} else {
|
||||||
|
w = larrow_width;
|
||||||
|
h = larrow_height;
|
||||||
|
bdata = larrow_bits;
|
||||||
|
dw = 2;
|
||||||
|
dh = 4;
|
||||||
|
id -= 20;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
w = varsz_width;
|
||||||
|
h = varsz_height;
|
||||||
|
bdata = varsz_bits;
|
||||||
|
dw = 3;
|
||||||
|
dh = 5;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
w = misc_width;
|
||||||
|
h = misc_height;
|
||||||
|
bdata = misc_bits;
|
||||||
|
dw = 5;
|
||||||
|
dh = 6;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
int ww = w / dw;
|
||||||
|
int hh = h / dh;
|
||||||
|
|
||||||
lyxerr[Debug::MATHED] << "Imando " << i << ", " << id << endl;
|
XImage * xima = XCreateImage(fl_get_display(), 0, 1, XYBitmap, 0,
|
||||||
switch (i) {
|
const_cast<char*>(reinterpret_cast<char const *>(bdata)), w, h, 8, 0);
|
||||||
case 0:
|
xima->byte_order = LSBFirst;
|
||||||
if (id<= 10) {
|
xima->bitmap_bit_order = LSBFirst;
|
||||||
w = Greek_width;
|
int x = (id % dw) * ww;
|
||||||
h = Greek_height;
|
int y = (id/dw) * hh;
|
||||||
bdata = Greek_bits;
|
if (ww > wx) ww = wx;
|
||||||
dw = 6; dh = 2;
|
if (hh > hx) hh = hx;
|
||||||
} else {
|
XImage * sbima = XSubImage(xima, x, y, ww, hh);
|
||||||
w = greek_width;
|
XpmCreateDataFromImage(fl_get_display(), const_cast<char***>(&data), sbima, sbima, 0);
|
||||||
h = greek_height;
|
|
||||||
bdata = greek_bits;
|
|
||||||
dw = 7; dh = 4;
|
|
||||||
id -= 11;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
w = bop_width;
|
|
||||||
h = bop_height;
|
|
||||||
bdata = bop_bits;
|
|
||||||
dw = 4; dh = 8;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
w = brel_width;
|
|
||||||
h = brel_height;
|
|
||||||
bdata = brel_bits;
|
|
||||||
dw = 4; dh = 9;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
if (id<20) {
|
|
||||||
w = arrow_width;
|
|
||||||
h = arrow_height;
|
|
||||||
bdata = arrow_bits;
|
|
||||||
dw = 5; dh = 4;
|
|
||||||
} else if (id>28) {
|
|
||||||
w = darrow_width;
|
|
||||||
h = darrow_height;
|
|
||||||
bdata = darrow_bits;
|
|
||||||
dw = 2; dh = 2;
|
|
||||||
id -= 29;
|
|
||||||
} else {
|
|
||||||
w = larrow_width;
|
|
||||||
h = larrow_height;
|
|
||||||
bdata = larrow_bits;
|
|
||||||
dw = 2; dh = 4;
|
|
||||||
id -= 20;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
w = varsz_width;
|
|
||||||
h = varsz_height;
|
|
||||||
bdata = varsz_bits;
|
|
||||||
dw = 3; dh = 5;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
w = misc_width;
|
|
||||||
h = misc_height;
|
|
||||||
bdata = misc_bits;
|
|
||||||
dw = 5; dh = 6;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
int ww = w/dw, hh = h/dh, x, y;
|
|
||||||
|
|
||||||
XImage * xima = XCreateImage(fl_get_display(), 0, 1, XYBitmap, 0,
|
// Dirty hack to get blue symbols quickly
|
||||||
const_cast<char*>(reinterpret_cast<char const *>(bdata)), w, h, 8, 0);
|
char * sx = const_cast<char*>(strstr(data[2], "FFFFFFFF"));
|
||||||
xima->byte_order = LSBFirst;
|
if (sx) {
|
||||||
xima->bitmap_bit_order = LSBFirst;
|
for (int k = 0; k < 8; ++k) sx[k] = '0';
|
||||||
x = (id % dw)*ww;
|
}
|
||||||
y = (id/dw)*hh;
|
|
||||||
if (ww > wx) ww = wx;
|
|
||||||
if (hh > hx) hh = hx;
|
|
||||||
XImage * sbima = XSubImage(xima, x, y, ww, hh);
|
|
||||||
XpmCreateDataFromImage(fl_get_display(), const_cast<char***>(&data), sbima, sbima, 0);
|
|
||||||
|
|
||||||
// Dirty hack to get blue symbols quickly
|
|
||||||
char * sx = const_cast<char*>(strstr(data[2], "FFFFFFFF"));
|
|
||||||
if (sx) {
|
|
||||||
for (int k = 0; k < 8; ++k) sx[k] = '0';
|
|
||||||
}
|
|
||||||
|
|
||||||
// XDestroyImage(xima);
|
// XDestroyImage(xima);
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@ struct binary_op_pair {
|
|||||||
short isrel;
|
short isrel;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
binary_op_pair binary_op_table[] = {
|
binary_op_pair binary_op_table[] = {
|
||||||
{ LM_leq, LMB_RELATION }, { LM_geq, LMB_RELATION },
|
{ LM_leq, LMB_RELATION }, { LM_geq, LMB_RELATION },
|
||||||
{ LM_equiv, LMB_RELATION }, { LM_models, LMB_RELATION },
|
{ LM_equiv, LMB_RELATION }, { LM_models, LMB_RELATION },
|
||||||
|
9
src/mathed/math_utils.h
Normal file
9
src/mathed/math_utils.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
|
||||||
|
#ifndef MATHUTILS_H
|
||||||
|
#define MATHUTILS_H
|
||||||
|
|
||||||
|
extern
|
||||||
|
int MathedLookupBOP(short id);
|
||||||
|
|
||||||
|
#endif
|
@ -1,90 +0,0 @@
|
|||||||
/*
|
|
||||||
* File: math_write.h
|
|
||||||
* Purpose: Write math paragraphs in LaTeX
|
|
||||||
* Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
|
||||||
* Created: January 1996
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Dependencies: Xlib, XForms
|
|
||||||
*
|
|
||||||
* Copyright: 1996, 1997 Alejandro Aguilar Sierra
|
|
||||||
*
|
|
||||||
* Version: 0.8beta, Mathed & Lyx project.
|
|
||||||
*
|
|
||||||
* You are free to use and modify this code under the terms of
|
|
||||||
* the GNU General Public Licence version 2 or later.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#include "LString.h"
|
|
||||||
#include "math_inset.h"
|
|
||||||
#include "math_iter.h"
|
|
||||||
#include "math_parser.h"
|
|
||||||
#include "math_parinset.h"
|
|
||||||
#include "mathed/support.h"
|
|
||||||
#include "support/lstrings.h"
|
|
||||||
#include "debug.h"
|
|
||||||
|
|
||||||
using std::ostream;
|
|
||||||
using std::endl;
|
|
||||||
|
|
||||||
extern char const * latex_mathenv[];
|
|
||||||
|
|
||||||
// quite a hack i know. Should be done with return values...
|
|
||||||
int number_of_newlines = 0;
|
|
||||||
|
|
||||||
|
|
||||||
void mathed_write(MathParInset * p, ostream & os, int * newlines,
|
|
||||||
bool fragile, string const & label)
|
|
||||||
{
|
|
||||||
number_of_newlines = 0;
|
|
||||||
short mathed_env = p->GetType();
|
|
||||||
|
|
||||||
if (mathed_env == LM_OT_MIN) {
|
|
||||||
if (fragile) os << "\\protect";
|
|
||||||
os << "\\( "; // changed from " \\( " (Albrecht Dress)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (mathed_env == LM_OT_PAR){
|
|
||||||
os << "\\[\n";
|
|
||||||
} else {
|
|
||||||
os << "\\begin{"
|
|
||||||
<< latex_mathenv[mathed_env]
|
|
||||||
<< "}";
|
|
||||||
if (is_multicolumn(mathed_env)) {
|
|
||||||
if (mathed_env != LM_OT_ALIGNAT
|
|
||||||
&& mathed_env != LM_OT_ALIGNATN)
|
|
||||||
os << "%";
|
|
||||||
os << "{" << p->GetColumns()/2 << "}";
|
|
||||||
}
|
|
||||||
os << "\n";
|
|
||||||
}
|
|
||||||
++number_of_newlines;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!label.empty() && label[0] > ' ' && is_singlely_numbered(mathed_env)) {
|
|
||||||
os << "\\label{"
|
|
||||||
<< label
|
|
||||||
<< "}\n";
|
|
||||||
++number_of_newlines;
|
|
||||||
}
|
|
||||||
|
|
||||||
p->Write(os, fragile);
|
|
||||||
|
|
||||||
if (mathed_env == LM_OT_MIN){
|
|
||||||
if (fragile) os << "\\protect";
|
|
||||||
os << " \\)";
|
|
||||||
}
|
|
||||||
else if (mathed_env == LM_OT_PAR) {
|
|
||||||
os << "\\]\n";
|
|
||||||
++number_of_newlines;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
os << "\n\\end{"
|
|
||||||
<< latex_mathenv[mathed_env]
|
|
||||||
<< "}\n";
|
|
||||||
number_of_newlines += 2;
|
|
||||||
}
|
|
||||||
*newlines = number_of_newlines;
|
|
||||||
}
|
|
@ -214,7 +214,7 @@ void MathedXIter::SetData(MathParInset * pp)
|
|||||||
}
|
}
|
||||||
if (!array) {
|
if (!array) {
|
||||||
array = new MathedArray; // this leaks
|
array = new MathedArray; // this leaks
|
||||||
p->SetData(array);
|
p->setData(array);
|
||||||
}
|
}
|
||||||
size = p->GetStyle();
|
size = p->GetStyle();
|
||||||
Reset();
|
Reset();
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "math_iter.h"
|
#include "math_iter.h"
|
||||||
|
|
||||||
struct MathedRowSt;
|
class MathedRowSt;
|
||||||
class MathParInset;
|
class MathParInset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,8 +4,13 @@
|
|||||||
|
|
||||||
#include "matriz.h"
|
#include "matriz.h"
|
||||||
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
int odd(int x) { return ((x) & 1); }
|
int odd(int x)
|
||||||
|
{
|
||||||
|
return (x & 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define mateq(m1, m2) memcpy(m1, m2, sizeof(matriz_data))
|
#define mateq(m1, m2) memcpy(m1, m2, sizeof(matriz_data))
|
||||||
|
|
||||||
@ -25,8 +30,10 @@ void Matriz::rota(int code)
|
|||||||
mateq(r, MATIDEN);
|
mateq(r, MATIDEN);
|
||||||
float const cs = (odd(code)) ? 0 : (1 - code);
|
float const cs = (odd(code)) ? 0 : (1 - code);
|
||||||
float const sn = (odd(code)) ? (2 - code) : 0;
|
float const sn = (odd(code)) ? (2 - code) : 0;
|
||||||
r[0][0] = cs; r[0][1] = sn;
|
r[0][0] = cs;
|
||||||
r[1][0] = -r[0][1]; r[1][1] = r[0][0];
|
r[0][1] = sn;
|
||||||
|
r[1][0] = -r[0][1];
|
||||||
|
r[1][1] = r[0][0];
|
||||||
matmat(r);
|
matmat(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +42,8 @@ void Matriz::escala(float x, float y)
|
|||||||
{
|
{
|
||||||
matriz_data s;
|
matriz_data s;
|
||||||
mateq(s, MATIDEN);
|
mateq(s, MATIDEN);
|
||||||
s[0][0] = x; s[1][1] = y;
|
s[0][0] = x;
|
||||||
|
s[1][1] = y;
|
||||||
matmat(s);
|
matmat(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,10 +51,10 @@ void Matriz::escala(float x, float y)
|
|||||||
void Matriz::matmat(matriz_data & a)
|
void Matriz::matmat(matriz_data & a)
|
||||||
{
|
{
|
||||||
matriz_data c;
|
matriz_data c;
|
||||||
for (int i = 0; i < 2; ++i) {
|
c[0][0] = a[0][0] * m_[0][0] + a[0][1] * m_[1][0];
|
||||||
c[0][i] = a[0][0] * m_[0][i] + a[0][1] * m_[1][i];
|
c[1][0] = a[1][0] * m_[0][0] + a[1][1] * m_[1][0];
|
||||||
c[1][i] = a[1][0] * m_[0][i] + a[1][1] * m_[1][i];
|
c[0][1] = a[0][0] * m_[0][1] + a[0][1] * m_[1][1];
|
||||||
}
|
c[1][1] = a[1][0] * m_[0][1] + a[1][1] * m_[1][1];
|
||||||
mateq(m_, c);
|
mateq(m_, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "matriz.h"
|
#include "matriz.h"
|
||||||
#include "symbol_def.h"
|
#include "symbol_def.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "math_utils.h"
|
||||||
|
|
||||||
using std::sort;
|
using std::sort;
|
||||||
using std::lower_bound;
|
using std::lower_bound;
|
||||||
@ -19,18 +20,18 @@ using std::max;
|
|||||||
extern LyXFont WhichFont(short type, int size);
|
extern LyXFont WhichFont(short type, int size);
|
||||||
|
|
||||||
char const * math_font_name[] = {
|
char const * math_font_name[] = {
|
||||||
"mathrm",
|
"mathrm",
|
||||||
"mathcal",
|
"mathcal",
|
||||||
"mathbf",
|
"mathbf",
|
||||||
"mathsf",
|
"mathsf",
|
||||||
"mathtt",
|
"mathtt",
|
||||||
"mathit",
|
"mathit",
|
||||||
"textrm"
|
"textrm"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
char const * latex_mathspace[] = {
|
char const * latex_mathspace[] = {
|
||||||
"!", ",", ":", ";", "quad", "qquad"
|
"!", ",", ":", ";", "quad", "qquad"
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -40,199 +41,238 @@ char const * latex_mathspace[] = {
|
|||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
float parenthHigh[] = {
|
float const parenthHigh[] = {
|
||||||
2.0, 13.0, 0.9840, 0.0014, 0.7143, 0.0323, 0.4603, 0.0772, 0.2540,
|
2.0, 13.0,
|
||||||
0.1278, 0.1746, 0.1966, 0.0952, 0.3300, 0.0950, 0.5000, 0.0952, 0.6700,
|
0.9840, 0.0014, 0.7143, 0.0323, 0.4603, 0.0772,
|
||||||
0.1746, 0.8034, 0.2540, 0.8722, 0.4603, 0.9228, 0.7143, 0.9677, 0.9840,
|
0.2540, 0.1278, 0.1746, 0.1966, 0.0952, 0.3300,
|
||||||
0.9986, 0.0
|
0.0950, 0.5000, 0.0952, 0.6700, 0.1746, 0.8034,
|
||||||
|
0.2540, 0.8722, 0.4603, 0.9228, 0.7143, 0.9677,
|
||||||
|
0.9840, 0.9986,
|
||||||
|
0.0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static float parenth[] = {
|
static
|
||||||
2.0, 13.0,
|
float const parenth[] = {
|
||||||
0.9930, 0.0071, 0.7324, 0.0578, 0.5141, 0.1126, 0.3380, 0.1714,
|
2.0, 13.0,
|
||||||
0.2183, 0.2333, 0.0634, 0.3621, 0.0141, 0.5000, 0.0563, 0.6369,
|
0.9930, 0.0071, 0.7324, 0.0578, 0.5141, 0.1126,
|
||||||
0.2113, 0.7647, 0.3310, 0.8276, 0.5070, 0.8864, 0.7254, 0.9412,
|
0.3380, 0.1714, 0.2183, 0.2333, 0.0634, 0.3621,
|
||||||
0.9930, 0.9919,
|
0.0141, 0.5000, 0.0563, 0.6369, 0.2113, 0.7647,
|
||||||
0.0
|
0.3310, 0.8276, 0.5070, 0.8864, 0.7254, 0.9412,
|
||||||
|
0.9930, 0.9919,
|
||||||
|
0.0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static float brace[] = {
|
static
|
||||||
2.0, 21.0,
|
float const brace[] = {
|
||||||
0.9492, 0.0020, 0.9379, 0.0020, 0.7458, 0.0243, 0.5819, 0.0527,
|
2.0, 21.0,
|
||||||
0.4859, 0.0892, 0.4463, 0.1278, 0.4463, 0.3732, 0.4011, 0.4199,
|
0.9492, 0.0020, 0.9379, 0.0020, 0.7458, 0.0243,
|
||||||
0.2712, 0.4615, 0.0734, 0.4919, 0.0113, 0.5000, 0.0734, 0.5081,
|
0.5819, 0.0527, 0.4859, 0.0892, 0.4463, 0.1278,
|
||||||
0.2712, 0.5385, 0.4011, 0.5801, 0.4463, 0.6268, 0.4463, 0.8722,
|
0.4463, 0.3732, 0.4011, 0.4199, 0.2712, 0.4615,
|
||||||
0.4859, 0.9108, 0.5819, 0.9473, 0.7458, 0.9757, 0.9379, 0.9980,
|
0.0734, 0.4919, 0.0113, 0.5000, 0.0734, 0.5081,
|
||||||
0.9492, 0.9980,
|
0.2712, 0.5385, 0.4011, 0.5801, 0.4463, 0.6268,
|
||||||
0.0
|
0.4463, 0.8722, 0.4859, 0.9108, 0.5819, 0.9473,
|
||||||
};
|
0.7458, 0.9757, 0.9379, 0.9980, 0.9492, 0.9980,
|
||||||
|
0.0
|
||||||
static float arrow[] = {
|
|
||||||
4, 7,
|
|
||||||
0.015, 0.7500, 0.2, 0.6, 0.35, 0.35, 0.5, 0.05,
|
|
||||||
0.65, 0.35, 0.8, 0.6, 0.95, 0.7500,
|
|
||||||
3, 0.5, 0.15, 0.5, 0.95,
|
|
||||||
0.0
|
|
||||||
};
|
|
||||||
|
|
||||||
static float Arrow[] = {
|
|
||||||
4, 7,
|
|
||||||
0.015, 0.7500, 0.2, 0.6, 0.35, 0.35, 0.5, 0.05,
|
|
||||||
0.65, 0.35, 0.8, 0.6, 0.95, 0.7500,
|
|
||||||
3, 0.35, 0.5, 0.35, 0.95,
|
|
||||||
3, 0.65, 0.5, 0.65, 0.95,
|
|
||||||
0.0
|
|
||||||
};
|
|
||||||
|
|
||||||
static float udarrow[] = {
|
|
||||||
2, 3,
|
|
||||||
0.015, 0.25, 0.5, 0.05, 0.95, 0.25,
|
|
||||||
2, 3,
|
|
||||||
0.015, 0.75, 0.5, 0.95, 0.95, 0.75,
|
|
||||||
1, 0.5, 0.2, 0.5, 0.8,
|
|
||||||
0.0
|
|
||||||
};
|
|
||||||
|
|
||||||
static float Udarrow[] = {
|
|
||||||
2, 3,
|
|
||||||
0.015, 0.25, 0.5, 0.05, 0.95, 0.25,
|
|
||||||
2, 3,
|
|
||||||
0.015, 0.75, 0.5, 0.95, 0.95, 0.75,
|
|
||||||
1, 0.35, 0.2, 0.35, 0.8,
|
|
||||||
1, 0.65, 0.2, 0.65, 0.8,
|
|
||||||
0.0
|
|
||||||
};
|
|
||||||
|
|
||||||
static float brack[] = {
|
|
||||||
2.0, 4,
|
|
||||||
0.95, 0.05, 0.05, 0.05, 0.05, 0.95, 0.95, 0.95,
|
|
||||||
0.0
|
|
||||||
};
|
|
||||||
|
|
||||||
static float corner[] = {
|
|
||||||
2.0, 3,
|
|
||||||
0.95, 0.05, 0.05, 0.05, 0.05, 0.95,
|
|
||||||
0.0
|
|
||||||
};
|
|
||||||
|
|
||||||
static float angle[] = {
|
|
||||||
2.0, 3,
|
|
||||||
1, 0, 0.05, 0.5, 1, 1,
|
|
||||||
0.0
|
|
||||||
};
|
|
||||||
|
|
||||||
static float slash[] = {
|
|
||||||
1, 0.95, 0.05, 0.05, 0.95,
|
|
||||||
0.0
|
|
||||||
};
|
|
||||||
|
|
||||||
static float hline[] = {
|
|
||||||
1, 0.05, 0.5, 0.95, 0.5,
|
|
||||||
0.0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static float hline2[] = {
|
// Is this correct? (Lgb)
|
||||||
|
static
|
||||||
|
float const arrow[] = {
|
||||||
|
4, 7,
|
||||||
|
0.0150, 0.7500, 0.2000, 0.6000, 0.3500, 0.3500,
|
||||||
|
0.5000, 0.0500, 0.6500, 0.3500, 0.8000, 0.6000,
|
||||||
|
0.9500, 0.7500,
|
||||||
|
3, 0.5000, 0.1500, 0.5000, 0.9500,
|
||||||
|
0.0
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Is this correct? (Lgb)
|
||||||
|
static
|
||||||
|
float const Arrow[] = {
|
||||||
|
4, 7,
|
||||||
|
0.0150, 0.7500, 0.2000, 0.6000, 0.3500, 0.3500,
|
||||||
|
0.5000, 0.0500, 0.6500, 0.3500, 0.8000, 0.6000,
|
||||||
|
0.9500, 0.7500,
|
||||||
|
3, 0.3500, 0.5000, 0.3500, 0.9500,
|
||||||
|
3, 0.6500, 0.5000, 0.6500, 0.9500,
|
||||||
|
0.0
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
float const udarrow[] = {
|
||||||
|
2, 3,
|
||||||
|
0.015, 0.25, 0.5, 0.05, 0.95, 0.25,
|
||||||
|
2, 3,
|
||||||
|
0.015, 0.75, 0.5, 0.95, 0.95, 0.75,
|
||||||
|
1, 0.5, 0.2, 0.5, 0.8,
|
||||||
|
0.0
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
float const Udarrow[] = {
|
||||||
|
2, 3,
|
||||||
|
0.015, 0.25, 0.5, 0.05, 0.95, 0.25,
|
||||||
|
2, 3,
|
||||||
|
0.015, 0.75, 0.5, 0.95, 0.95, 0.75,
|
||||||
|
1, 0.35, 0.2, 0.35, 0.8,
|
||||||
|
1, 0.65, 0.2, 0.65, 0.8,
|
||||||
|
0.0
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
float const brack[] = {
|
||||||
|
2.0, 4,
|
||||||
|
0.95, 0.05, 0.05, 0.05, 0.05, 0.95, 0.95, 0.95,
|
||||||
|
0.0
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
float const corner[] = {
|
||||||
|
2.0, 3,
|
||||||
|
0.95, 0.05, 0.05, 0.05, 0.05, 0.95,
|
||||||
|
0.0
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
float const angle[] = {
|
||||||
|
2.0, 3,
|
||||||
|
1, 0, 0.05, 0.5, 1, 1,
|
||||||
|
0.0
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
float const slash[] = {
|
||||||
|
1, 0.95, 0.05, 0.05, 0.95,
|
||||||
|
0.0
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static const float hline[] = {
|
||||||
|
1, 0.05, 0.5, 0.95, 0.5,
|
||||||
|
0.0
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
float const hline2[] = {
|
||||||
1, 0.1, 0.5, 0.3, 0.5,
|
1, 0.1, 0.5, 0.3, 0.5,
|
||||||
1, 0.7, 0.5, 0.9, 0.5,
|
1, 0.7, 0.5, 0.9, 0.5,
|
||||||
0.0
|
0.0
|
||||||
};
|
};
|
||||||
|
|
||||||
static float hline3[] = {
|
|
||||||
1, 0.1, 0, 0.15, 0,
|
static
|
||||||
1, 0.475, 0, 0.525, 0,
|
float const hline3[] = {
|
||||||
1, 0.85, 0, 0.9, 0,
|
1, 0.1, 0, 0.15, 0,
|
||||||
0.0
|
1, 0.475, 0, 0.525, 0,
|
||||||
|
1, 0.85, 0, 0.9, 0,
|
||||||
|
0.0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static float dline3[] = {
|
static
|
||||||
1, 0.1, 0.1, 0.15, 0.15,
|
float const dline3[] = {
|
||||||
1, 0.475, 0.475, 0.525, 0.525,
|
1, 0.1, 0.1, 0.15, 0.15,
|
||||||
1, 0.85, 0.85, 0.9, 0.9,
|
1, 0.475, 0.475, 0.525, 0.525,
|
||||||
0.0
|
1, 0.85, 0.85, 0.9, 0.9,
|
||||||
|
0.0
|
||||||
};
|
};
|
||||||
|
|
||||||
static float hlinesmall[] = {
|
|
||||||
1, 0.4, 0.5, 0.6, 0.5,
|
static
|
||||||
0.0
|
float const hlinesmall[] = {
|
||||||
|
1, 0.4, 0.5, 0.6, 0.5,
|
||||||
|
0.0
|
||||||
};
|
};
|
||||||
|
|
||||||
static float vert[] = {
|
|
||||||
1, 0.5, 0.05, 0.5, 0.95,
|
static
|
||||||
0.0
|
float const vert[] = {
|
||||||
|
1, 0.5, 0.05, 0.5, 0.95,
|
||||||
|
0.0
|
||||||
};
|
};
|
||||||
|
|
||||||
static float Vert[] = {
|
|
||||||
1, 0.3, 0.05, 0.3, 0.95,
|
static
|
||||||
1, 0.7, 0.05, 0.7, 0.95,
|
float const Vert[] = {
|
||||||
0.0
|
1, 0.3, 0.05, 0.3, 0.95,
|
||||||
|
1, 0.7, 0.05, 0.7, 0.95,
|
||||||
|
0.0
|
||||||
};
|
};
|
||||||
|
|
||||||
static float tilde[] = {
|
|
||||||
2.0, 4,
|
static
|
||||||
0.05, 0.8, 0.25, 0.2, 0.75, 0.8, 0.95, 0.2,
|
float const tilde[] = {
|
||||||
0.0
|
2.0, 4,
|
||||||
|
0.05, 0.8, 0.25, 0.2, 0.75, 0.8, 0.95, 0.2,
|
||||||
|
0.0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
math_deco_struct math_deco_table[] = {
|
math_deco_struct math_deco_table[] = {
|
||||||
|
// Decorations
|
||||||
|
{ LM_widehat, &angle[0], 3 },
|
||||||
|
{ LM_widetilde, &tilde[0], 0 },
|
||||||
|
{ LM_underline, &hline[0], 0 },
|
||||||
|
{ LM_overline, &hline[0], 0 },
|
||||||
|
{ LM_underbrace, &brace[0], 1 },
|
||||||
|
{ LM_overbrace, &brace[0], 3 },
|
||||||
|
{ LM_overleftarrow, &arrow[0], 1 },
|
||||||
|
{ LM_overightarrow, &arrow[0], 3 },
|
||||||
|
|
||||||
// Decorations
|
// Delimiters
|
||||||
{ LM_widehat, &angle[0], 3 },
|
{ '(', &parenth[0], 0 },
|
||||||
{ LM_widetilde, &tilde[0], 0 },
|
{ ')', &parenth[0], 2 },
|
||||||
{ LM_underline, &hline[0], 0 },
|
{ '{', &brace[0], 0 },
|
||||||
{ LM_overline, &hline[0], 0 },
|
{ '}', &brace[0], 2 },
|
||||||
{ LM_underbrace, &brace[0], 1 },
|
{ '[', &brack[0], 0 },
|
||||||
{ LM_overbrace, &brace[0], 3 },
|
{ ']', &brack[0], 2 },
|
||||||
{ LM_overleftarrow, &arrow[0], 1 },
|
{ '|', &vert[0], 0 },
|
||||||
{ LM_overightarrow, &arrow[0], 3 },
|
{ '/', &slash[0], 0 },
|
||||||
|
{ LM_Vert, &Vert[0], 0 },
|
||||||
|
{ LM_backslash, &slash[0], 1 },
|
||||||
|
{ LM_langle, &angle[0], 0 },
|
||||||
|
{ LM_lceil, &corner[0], 0 },
|
||||||
|
{ LM_lfloor, &corner[0], 1 },
|
||||||
|
{ LM_rangle, &angle[0], 2 },
|
||||||
|
{ LM_rceil, &corner[0], 3 },
|
||||||
|
{ LM_rfloor, &corner[0], 2 },
|
||||||
|
{ LM_downarrow, &arrow[0], 2 },
|
||||||
|
{ LM_Downarrow, &Arrow[0], 2 },
|
||||||
|
{ LM_uparrow, &arrow[0], 0 },
|
||||||
|
{ LM_Uparrow, &Arrow[0], 0 },
|
||||||
|
{ LM_updownarrow, &udarrow[0], 0 },
|
||||||
|
{ LM_Updownarrow, &Udarrow[0], 0 },
|
||||||
|
|
||||||
// Delimiters
|
// Accents
|
||||||
{ '(', &parenth[0], 0 },
|
{ LM_ddot, &hline2[0], 0 },
|
||||||
{ ')', &parenth[0], 2 },
|
{ LM_hat, &angle[0], 3 },
|
||||||
{ '{', &brace[0], 0 },
|
{ LM_grave, &slash[0], 1 },
|
||||||
{ '}', &brace[0], 2 },
|
{ LM_acute, &slash[0], 0 },
|
||||||
{ '[', &brack[0], 0 },
|
{ LM_tilde, &tilde[0], 0 },
|
||||||
{ ']', &brack[0], 2 },
|
{ LM_bar, &hline[0], 0 },
|
||||||
{ '|', &vert[0], 0 },
|
{ LM_dot, &hlinesmall[0], 0 },
|
||||||
{ '/', &slash[0], 0 },
|
{ LM_check, &angle[0], 1 },
|
||||||
{ LM_Vert, &Vert[0], 0 },
|
{ LM_breve, &parenth[0], 1 },
|
||||||
{ LM_backslash, &slash[0], 1 },
|
{ LM_vec, &arrow[0], 3 },
|
||||||
{ LM_langle, &angle[0], 0 },
|
{ LM_not, &slash[0], 0 },
|
||||||
{ LM_lceil, &corner[0], 0 },
|
|
||||||
{ LM_lfloor, &corner[0], 1 },
|
|
||||||
{ LM_rangle, &angle[0], 2 },
|
|
||||||
{ LM_rceil, &corner[0], 3 },
|
|
||||||
{ LM_rfloor, &corner[0], 2 },
|
|
||||||
{ LM_downarrow, &arrow[0], 2 },
|
|
||||||
{ LM_Downarrow, &Arrow[0], 2 },
|
|
||||||
{ LM_uparrow, &arrow[0], 0 },
|
|
||||||
{ LM_Uparrow, &Arrow[0], 0 },
|
|
||||||
{ LM_updownarrow, &udarrow[0], 0 },
|
|
||||||
{ LM_Updownarrow, &Udarrow[0], 0 },
|
|
||||||
|
|
||||||
// Accents
|
// Dots
|
||||||
{ LM_ddot, &hline2[0], 0 },
|
{ LM_ldots, &hline3[0], 0 },
|
||||||
{ LM_hat, &angle[0], 3 },
|
{ LM_cdots, &hline3[0], 0 },
|
||||||
{ LM_grave, &slash[0], 1 },
|
{ LM_vdots, &hline3[0], 1 },
|
||||||
{ LM_acute, &slash[0], 0 },
|
{ LM_ddots, &dline3[0], 0 }
|
||||||
{ LM_tilde, &tilde[0], 0 },
|
|
||||||
{ LM_bar, &hline[0], 0 },
|
|
||||||
{ LM_dot, &hlinesmall[0], 0 },
|
|
||||||
{ LM_check, &angle[0], 1 },
|
|
||||||
{ LM_breve, &parenth[0], 1 },
|
|
||||||
{ LM_vec, &arrow[0], 3 },
|
|
||||||
{ LM_not, &slash[0], 0 },
|
|
||||||
|
|
||||||
// Dots
|
|
||||||
{ LM_ldots, &hline3[0], 0 },
|
|
||||||
{ LM_cdots, &hline3[0], 0 },
|
|
||||||
{ LM_vdots, &hline3[0], 1 },
|
|
||||||
{ LM_ddots, &dline3[0], 0 }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -247,7 +287,9 @@ struct math_deco_compare {
|
|||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int const math_deco_table_size = sizeof(math_deco_table) /sizeof(math_deco_struct);
|
int const math_deco_table_size =
|
||||||
|
sizeof(math_deco_table) /sizeof(math_deco_struct);
|
||||||
|
|
||||||
|
|
||||||
class init_deco_table {
|
class init_deco_table {
|
||||||
public:
|
public:
|
||||||
@ -263,16 +305,17 @@ private:
|
|||||||
static bool init;
|
static bool init;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
bool init_deco_table::init = false;
|
bool init_deco_table::init = false;
|
||||||
static init_deco_table idt;
|
static init_deco_table idt;
|
||||||
|
|
||||||
|
|
||||||
int mathed_char_height(short type, int size, byte c, int & asc, int & des)
|
int mathed_char_height(short type, int size, byte c, int & asc, int & des)
|
||||||
{
|
{
|
||||||
LyXFont font = WhichFont(type, size);
|
LyXFont const font = WhichFont(type, size);
|
||||||
des = lyxfont::descent(c, font);
|
des = lyxfont::descent(c, font);
|
||||||
asc = lyxfont::ascent(c, font);
|
asc = lyxfont::ascent(c, font);
|
||||||
return asc + des;
|
return asc + des;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -282,16 +325,15 @@ int mathed_char_width(short type, int size, byte c)
|
|||||||
string s;
|
string s;
|
||||||
s += c;
|
s += c;
|
||||||
return mathed_string_width(type, size, s);
|
return mathed_string_width(type, size, s);
|
||||||
}
|
} else
|
||||||
else
|
return lyxfont::width(c, WhichFont(type, size));
|
||||||
return lyxfont::width(c, WhichFont(type, size));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int mathed_string_height(short type, int size, string const & s,
|
int mathed_string_height(short type, int size, string const & s,
|
||||||
int & asc, int & des)
|
int & asc, int & des)
|
||||||
{
|
{
|
||||||
LyXFont font = WhichFont(type, size);
|
LyXFont const font = WhichFont(type, size);
|
||||||
asc = des = 0;
|
asc = des = 0;
|
||||||
for (string::const_iterator it = s.begin(); it != s.end(); ++it) {
|
for (string::const_iterator it = s.begin(); it != s.end(); ++it) {
|
||||||
des = max(des, lyxfont::descent(*it, font));
|
des = max(des, lyxfont::descent(*it, font));
|
||||||
@ -350,8 +392,8 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h, int code)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int r = mds.angle;
|
int const r = mds.angle;
|
||||||
float * d = mds.data;
|
float const * d = mds.data;
|
||||||
|
|
||||||
if (h > 70 && (mds.code == int('(')
|
if (h > 70 && (mds.code == int('(')
|
||||||
|| mds.code == int(')')))
|
|| mds.code == int(')')))
|
||||||
@ -365,8 +407,8 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h, int code)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int r = mds->angle;
|
int const r = mds->angle;
|
||||||
float * d = mds->data;
|
float const * d = mds->data;
|
||||||
|
|
||||||
if (h > 70 && (mds->code == int('(')
|
if (h > 70 && (mds->code == int('(')
|
||||||
|| mds->code == int(')')))
|
|| mds->code == int(')')))
|
||||||
@ -376,7 +418,7 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h, int code)
|
|||||||
mt.rota(r);
|
mt.rota(r);
|
||||||
mt.escala(w, h);
|
mt.escala(w, h);
|
||||||
|
|
||||||
int n = (w < h) ? w : h;
|
int const n = (w < h) ? w : h;
|
||||||
sqmt.rota(r);
|
sqmt.rota(r);
|
||||||
sqmt.escala(n, n);
|
sqmt.escala(n, n);
|
||||||
if (r > 0 && r < 3) y += h;
|
if (r > 0 && r < 3) y += h;
|
||||||
@ -403,8 +445,9 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h, int code)
|
|||||||
case 2:
|
case 2:
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
int xp[32], yp[32];
|
int xp[32];
|
||||||
n = int(d[i++]);
|
int yp[32];
|
||||||
|
int const n = int(d[i++]);
|
||||||
for (int j = 0; j < n; ++j) {
|
for (int j = 0; j < n; ++j) {
|
||||||
xx = d[i++]; yy = d[i++];
|
xx = d[i++]; yy = d[i++];
|
||||||
// lyxerr << " " << xx << " " << yy << " ";
|
// lyxerr << " " << xx << " " << yy << " ";
|
||||||
@ -430,7 +473,7 @@ struct deco_not_found {};
|
|||||||
|
|
||||||
math_deco_struct const & search_deco(int code)
|
math_deco_struct const & search_deco(int code)
|
||||||
{
|
{
|
||||||
math_deco_struct * res =
|
math_deco_struct const * res =
|
||||||
lower_bound(math_deco_table,
|
lower_bound(math_deco_table,
|
||||||
math_deco_table + math_deco_table_size,
|
math_deco_table + math_deco_table_size,
|
||||||
code, math_deco_compare());
|
code, math_deco_compare());
|
||||||
@ -447,7 +490,7 @@ math_deco_struct const * search_deco(int code)
|
|||||||
{
|
{
|
||||||
math_deco_struct search_elem = { code, 0, 0 };
|
math_deco_struct search_elem = { code, 0, 0 };
|
||||||
|
|
||||||
math_deco_struct * res =
|
math_deco_struct const * res =
|
||||||
lower_bound(math_deco_table,
|
lower_bound(math_deco_table,
|
||||||
math_deco_table + math_deco_table_size,
|
math_deco_table + math_deco_table_size,
|
||||||
search_elem, math_deco_compare());
|
search_elem, math_deco_compare());
|
||||||
@ -509,12 +552,13 @@ bool MathIsBOPS(short x)
|
|||||||
|
|
||||||
bool MathIsBinary(short x)
|
bool MathIsBinary(short x)
|
||||||
{
|
{
|
||||||
return x == LM_TC_BOP || x == LM_TC_BOPS;
|
return x == LM_TC_BOP || x == LM_TC_BOPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MathIsSymbol(short x) {
|
bool MathIsSymbol(short x)
|
||||||
return LM_TC_SYMB <= x && x <= LM_TC_BSYM;
|
{
|
||||||
|
return LM_TC_SYMB <= x && x <= LM_TC_BSYM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ class MathParInset;
|
|||||||
|
|
||||||
struct math_deco_struct {
|
struct math_deco_struct {
|
||||||
int code;
|
int code;
|
||||||
float * data;
|
float const * data;
|
||||||
int angle;
|
int angle;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -38,10 +38,6 @@ extern math_deco_struct const * search_deco(int code);
|
|||||||
extern
|
extern
|
||||||
MathedArray * mathed_parse(unsigned flags, MathedArray * data,
|
MathedArray * mathed_parse(unsigned flags, MathedArray * data,
|
||||||
MathParInset ** mt);
|
MathParInset ** mt);
|
||||||
/// math_write.C
|
|
||||||
extern
|
|
||||||
void mathed_write(MathParInset *, std::ostream &, int *, bool fragile,
|
|
||||||
string const & label = string());
|
|
||||||
|
|
||||||
/// math_parser.C
|
/// math_parser.C
|
||||||
extern
|
extern
|
||||||
@ -49,9 +45,6 @@ void mathed_parser_file(std::istream &, int);
|
|||||||
/// math_parser.C
|
/// math_parser.C
|
||||||
extern
|
extern
|
||||||
int mathed_parser_lineno();
|
int mathed_parser_lineno();
|
||||||
/// math_utils.C
|
|
||||||
extern
|
|
||||||
int MathedLookupBOP(short);
|
|
||||||
|
|
||||||
extern
|
extern
|
||||||
bool MathIsInset(short x);
|
bool MathIsInset(short x);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// This file was created automatically. Don't change it! [asierra18jan96]
|
// This -*- C++ -*- file was created automatically.
|
||||||
|
// Don't change it! [asierra18jan96]
|
||||||
|
|
||||||
#ifndef SYMBOL_DEF
|
#ifndef SYMBOL_DEF
|
||||||
#define SYMBOL_DEF
|
#define SYMBOL_DEF
|
||||||
@ -215,202 +216,202 @@
|
|||||||
|
|
||||||
/// Symbols that don't exist in X11 symbol font
|
/// Symbols that don't exist in X11 symbol font
|
||||||
enum Math_Symbols_enum {
|
enum Math_Symbols_enum {
|
||||||
///
|
///
|
||||||
LM_NoFont = 256,
|
LM_NoFont = 256,
|
||||||
///
|
///
|
||||||
LM_epsilon,
|
LM_epsilon,
|
||||||
///
|
///
|
||||||
LM_hookleftarrow,
|
LM_hookleftarrow,
|
||||||
///
|
///
|
||||||
LM_hookrightarrow,
|
LM_hookrightarrow,
|
||||||
///
|
///
|
||||||
LM_updownarrow,
|
LM_updownarrow,
|
||||||
///
|
///
|
||||||
LM_leftharpoonup,
|
LM_leftharpoonup,
|
||||||
///
|
///
|
||||||
LM_rightharpoonup,
|
LM_rightharpoonup,
|
||||||
///
|
///
|
||||||
LM_rightleftharpoons,
|
LM_rightleftharpoons,
|
||||||
///
|
///
|
||||||
LM_Updownarrow,
|
LM_Updownarrow,
|
||||||
///
|
///
|
||||||
LM_leftharpoondown,
|
LM_leftharpoondown,
|
||||||
///
|
///
|
||||||
LM_rightharpoondown,
|
LM_rightharpoondown,
|
||||||
///
|
///
|
||||||
LM_mapsto,
|
LM_mapsto,
|
||||||
///
|
///
|
||||||
LM_Longleftarrow,
|
LM_Longleftarrow,
|
||||||
///
|
///
|
||||||
LM_Longrightarrow,
|
LM_Longrightarrow,
|
||||||
///
|
///
|
||||||
LM_Longleftrightarrow,
|
LM_Longleftrightarrow,
|
||||||
///
|
///
|
||||||
LM_longleftrightarrow,
|
LM_longleftrightarrow,
|
||||||
///
|
///
|
||||||
LM_longleftarrow,
|
LM_longleftarrow,
|
||||||
///
|
///
|
||||||
LM_longrightarrow,
|
LM_longrightarrow,
|
||||||
///
|
///
|
||||||
LM_longmapsto,
|
LM_longmapsto,
|
||||||
///
|
///
|
||||||
LM_nwarrow,
|
LM_nwarrow,
|
||||||
///
|
///
|
||||||
LM_nearrow,
|
LM_nearrow,
|
||||||
///
|
///
|
||||||
LM_swarrow,
|
LM_swarrow,
|
||||||
///
|
///
|
||||||
LM_searrow,
|
LM_searrow,
|
||||||
///
|
///
|
||||||
LM_models,
|
LM_models,
|
||||||
///
|
///
|
||||||
LM_prec,
|
LM_prec,
|
||||||
///
|
///
|
||||||
LM_succ,
|
LM_succ,
|
||||||
///
|
///
|
||||||
LM_sim,
|
LM_sim,
|
||||||
///
|
///
|
||||||
LM_perp,
|
LM_perp,
|
||||||
///
|
///
|
||||||
LM_preceq,
|
LM_preceq,
|
||||||
///
|
///
|
||||||
LM_succeq,
|
LM_succeq,
|
||||||
///
|
///
|
||||||
LM_simeq,
|
LM_simeq,
|
||||||
///
|
///
|
||||||
LM_ll,
|
LM_ll,
|
||||||
///
|
///
|
||||||
LM_gg,
|
LM_gg,
|
||||||
///
|
///
|
||||||
LM_asymp,
|
LM_asymp,
|
||||||
///
|
///
|
||||||
LM_parallel,
|
LM_parallel,
|
||||||
///
|
///
|
||||||
LM_smile,
|
LM_smile,
|
||||||
///
|
///
|
||||||
LM_frown,
|
LM_frown,
|
||||||
///
|
///
|
||||||
LM_sqsubseteq,
|
LM_sqsubseteq,
|
||||||
///
|
///
|
||||||
LM_sqsupseteq,
|
LM_sqsupseteq,
|
||||||
///
|
///
|
||||||
LM_doteq,
|
LM_doteq,
|
||||||
///
|
///
|
||||||
LM_ni,
|
LM_ni,
|
||||||
///
|
///
|
||||||
LM_notin,
|
LM_notin,
|
||||||
///
|
///
|
||||||
LM_vdash,
|
LM_vdash,
|
||||||
///
|
///
|
||||||
LM_dashv,
|
LM_dashv,
|
||||||
///
|
///
|
||||||
LM_bowtie,
|
LM_bowtie,
|
||||||
///
|
///
|
||||||
LM_mp,
|
LM_mp,
|
||||||
///
|
///
|
||||||
LM_bigtriangleup,
|
LM_bigtriangleup,
|
||||||
///
|
///
|
||||||
LM_ominus,
|
LM_ominus,
|
||||||
///
|
///
|
||||||
LM_uplus,
|
LM_uplus,
|
||||||
///
|
///
|
||||||
LM_bigtriangledown,
|
LM_bigtriangledown,
|
||||||
///
|
///
|
||||||
LM_sqcap,
|
LM_sqcap,
|
||||||
///
|
///
|
||||||
LM_triangleright,
|
LM_triangleright,
|
||||||
///
|
///
|
||||||
LM_sqcup,
|
LM_sqcup,
|
||||||
///
|
///
|
||||||
LM_triangleleft,
|
LM_triangleleft,
|
||||||
///
|
///
|
||||||
LM_odot,
|
LM_odot,
|
||||||
///
|
///
|
||||||
LM_star,
|
LM_star,
|
||||||
///
|
///
|
||||||
LM_amalg,
|
LM_amalg,
|
||||||
///
|
///
|
||||||
LM_bigcirc,
|
LM_bigcirc,
|
||||||
///
|
///
|
||||||
LM_setminus,
|
LM_setminus,
|
||||||
///
|
///
|
||||||
LM_dagger,
|
LM_dagger,
|
||||||
///
|
///
|
||||||
LM_circ,
|
LM_circ,
|
||||||
///
|
///
|
||||||
LM_wr,
|
LM_wr,
|
||||||
///
|
///
|
||||||
LM_ddagger,
|
LM_ddagger,
|
||||||
///
|
///
|
||||||
LM_oint,
|
LM_oint,
|
||||||
///
|
///
|
||||||
LM_coprod,
|
LM_coprod,
|
||||||
///
|
///
|
||||||
LM_bigsqcup,
|
LM_bigsqcup,
|
||||||
///
|
///
|
||||||
LM_bigotimes,
|
LM_bigotimes,
|
||||||
///
|
///
|
||||||
LM_bigodot,
|
LM_bigodot,
|
||||||
///
|
///
|
||||||
LM_bigoplus,
|
LM_bigoplus,
|
||||||
///
|
///
|
||||||
LM_bigcap,
|
LM_bigcap,
|
||||||
///
|
///
|
||||||
LM_bigcup,
|
LM_bigcup,
|
||||||
///
|
///
|
||||||
LM_biguplus,
|
LM_biguplus,
|
||||||
///
|
///
|
||||||
LM_bigvee,
|
LM_bigvee,
|
||||||
///
|
///
|
||||||
LM_bigwedge,
|
LM_bigwedge,
|
||||||
///
|
///
|
||||||
LM_ell,
|
LM_ell,
|
||||||
///
|
///
|
||||||
LM_imath,
|
LM_imath,
|
||||||
///
|
///
|
||||||
LM_jmath,
|
LM_jmath,
|
||||||
///
|
///
|
||||||
LM_hbar,
|
LM_hbar,
|
||||||
///
|
///
|
||||||
LM_top,
|
LM_top,
|
||||||
///
|
///
|
||||||
LM_Vert,
|
LM_Vert,
|
||||||
///
|
///
|
||||||
LM_flat,
|
LM_flat,
|
||||||
///
|
///
|
||||||
LM_natural,
|
LM_natural,
|
||||||
///
|
///
|
||||||
LM_triangle,
|
LM_triangle,
|
||||||
///
|
///
|
||||||
LM_widehat,
|
LM_widehat,
|
||||||
///
|
///
|
||||||
LM_widetilde,
|
LM_widetilde,
|
||||||
///
|
///
|
||||||
LM_underline,
|
LM_underline,
|
||||||
///
|
///
|
||||||
LM_overline,
|
LM_overline,
|
||||||
///
|
///
|
||||||
LM_underbrace,
|
LM_underbrace,
|
||||||
///
|
///
|
||||||
LM_overbrace,
|
LM_overbrace,
|
||||||
///
|
///
|
||||||
LM_overleftarrow,
|
LM_overleftarrow,
|
||||||
///
|
///
|
||||||
LM_overightarrow,
|
LM_overightarrow,
|
||||||
///
|
///
|
||||||
LM_ldots,
|
LM_ldots,
|
||||||
///
|
///
|
||||||
LM_cdots,
|
LM_cdots,
|
||||||
///
|
///
|
||||||
LM_vdots,
|
LM_vdots,
|
||||||
///
|
///
|
||||||
LM_ddots,
|
LM_ddots,
|
||||||
///
|
///
|
||||||
LM_backslash,
|
LM_backslash,
|
||||||
///
|
///
|
||||||
LM_emptyset,
|
LM_emptyset,
|
||||||
///
|
///
|
||||||
LM_last_symbol
|
LM_last_symbol
|
||||||
};
|
};
|
||||||
|
|
||||||
// Accents
|
// Accents
|
||||||
@ -429,16 +430,16 @@ enum Math_Symbols_enum {
|
|||||||
|
|
||||||
///
|
///
|
||||||
enum Math_Accent_enum {
|
enum Math_Accent_enum {
|
||||||
///
|
///
|
||||||
LM_ddot = LM_last_symbol,
|
LM_ddot = LM_last_symbol,
|
||||||
///
|
///
|
||||||
LM_check,
|
LM_check,
|
||||||
///
|
///
|
||||||
LM_vec,
|
LM_vec,
|
||||||
///
|
///
|
||||||
LM_breve,
|
LM_breve,
|
||||||
///
|
///
|
||||||
LM_not
|
LM_not
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -447,4 +448,3 @@ enum Math_Accent_enum {
|
|||||||
#define LM_qquad 5
|
#define LM_qquad 5
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -68,9 +68,7 @@ unsigned int LyXParagraph::paragraph_id = 0;
|
|||||||
|
|
||||||
LyXParagraph::LyXParagraph()
|
LyXParagraph::LyXParagraph()
|
||||||
{
|
{
|
||||||
#ifndef HAVE_ROPE
|
|
||||||
text.reserve(500); // is this number too big?
|
text.reserve(500); // is this number too big?
|
||||||
#endif
|
|
||||||
for (int i = 0; i < 10; ++i) setCounter(i , 0);
|
for (int i = 0; i < 10; ++i) setCounter(i , 0);
|
||||||
appendix = false;
|
appendix = false;
|
||||||
enumdepth = 0;
|
enumdepth = 0;
|
||||||
@ -93,9 +91,7 @@ LyXParagraph::LyXParagraph()
|
|||||||
// This konstruktor inserts the new paragraph in a list.
|
// This konstruktor inserts the new paragraph in a list.
|
||||||
LyXParagraph::LyXParagraph(LyXParagraph * par)
|
LyXParagraph::LyXParagraph(LyXParagraph * par)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_ROPE
|
|
||||||
text.reserve(500);
|
text.reserve(500);
|
||||||
#endif
|
|
||||||
par->fitToSize();
|
par->fitToSize();
|
||||||
|
|
||||||
for (int i = 0; i < 10; ++i) setCounter(i, 0);
|
for (int i = 0; i < 10; ++i) setCounter(i, 0);
|
||||||
@ -560,11 +556,9 @@ void LyXParagraph::Erase(LyXParagraph::size_type pos)
|
|||||||
insetlist.erase(it);
|
insetlist.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifndef HAVE_ROPE
|
|
||||||
text.erase(text.begin() + pos);
|
text.erase(text.begin() + pos);
|
||||||
#else
|
|
||||||
text.erase(text.mutable_begin() + pos);
|
|
||||||
#endif
|
|
||||||
// Erase entries in the tables.
|
// Erase entries in the tables.
|
||||||
FontTable search_font(pos, LyXFont());
|
FontTable search_font(pos, LyXFont());
|
||||||
|
|
||||||
@ -640,11 +634,8 @@ void LyXParagraph::InsertChar(LyXParagraph::size_type pos,
|
|||||||
#else
|
#else
|
||||||
Assert(pos <= size());
|
Assert(pos <= size());
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_ROPE
|
|
||||||
text.insert(text.begin() + pos, c);
|
text.insert(text.begin() + pos, c);
|
||||||
#else
|
|
||||||
text.insert(pos, c);
|
|
||||||
#endif
|
|
||||||
// Update the font table.
|
// Update the font table.
|
||||||
FontTable search_font(pos, LyXFont());
|
FontTable search_font(pos, LyXFont());
|
||||||
for (FontList::iterator it = lower_bound(fontlist.begin(),
|
for (FontList::iterator it = lower_bound(fontlist.begin(),
|
||||||
@ -4089,3 +4080,16 @@ void LyXParagraph::resizeInsetsLyXText(BufferView * bv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LyXParagraph::fitToSize()
|
||||||
|
{
|
||||||
|
TextContainer tmp(text.begin(), text.end());
|
||||||
|
text.swap(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LyXParagraph::setContentsFromPar(LyXParagraph * par)
|
||||||
|
{
|
||||||
|
text = par->text;
|
||||||
|
}
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
|
|
||||||
/*
|
/** String helper functions.
|
||||||
This is a collection of string helper functions that works
|
\file lstrings.h
|
||||||
together with string (and later also with STL String. Some of these
|
This is a collection of string helper functions that works
|
||||||
would certainly benefit from a rewrite/optimization.
|
together with string (and later also with STL String. Some of these
|
||||||
|
would certainly benefit from a rewrite/optimization.
|
||||||
|
\author Lars Gullik Bjønnes
|
||||||
|
\author Jean-Marc Lasgouttes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LSTRINGS_H
|
#ifndef LSTRINGS_H
|
||||||
@ -71,7 +74,7 @@ string const lowercase(string const &);
|
|||||||
///
|
///
|
||||||
string const uppercase(string const &);
|
string const uppercase(string const &);
|
||||||
|
|
||||||
/// convert T to string
|
/// convert \a T to string
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline
|
inline
|
||||||
string const tostr(T const & t)
|
string const tostr(T const & t)
|
||||||
@ -147,20 +150,24 @@ bool containsOnly(char const *, string const &);
|
|||||||
string::size_type countChar(string const & a, char c);
|
string::size_type countChar(string const & a, char c);
|
||||||
|
|
||||||
/** Extracts a token from this string at the nth delim.
|
/** Extracts a token from this string at the nth delim.
|
||||||
Doesn't modify the original string. Similar to strtok.
|
Doesn't modify the original string. Similar to strtok.
|
||||||
Example:
|
Example:
|
||||||
#"a;bc;d".token(';', 1) == "bc";#
|
\code
|
||||||
#"a;bc;d".token(';', 2) == "d";#
|
"a;bc;d".token(';', 1) == "bc";
|
||||||
|
"a;bc;d".token(';', 2) == "d";
|
||||||
|
\endcode
|
||||||
*/
|
*/
|
||||||
string const token(string const & a, char delim, int n);
|
string const token(string const & a, char delim, int n);
|
||||||
|
|
||||||
|
|
||||||
/** Search a token in this string using the delim.
|
/** Search a token in this string using the delim.
|
||||||
Doesn't modify the original string. Returns -1 in case of
|
Doesn't modify the original string. Returns -1 in case of
|
||||||
failure.
|
failure.
|
||||||
Example:
|
Example:
|
||||||
#"a;bc;d".tokenPos(';', "bc") == 1;#
|
\code
|
||||||
#"a;bc;d".token(';', "d") == 2;#
|
"a;bc;d".tokenPos(';', "bc") == 1;
|
||||||
|
"a;bc;d".token(';', "d") == 2;
|
||||||
|
\endcode
|
||||||
*/
|
*/
|
||||||
int tokenPos(string const & a, char delim, string const & tok);
|
int tokenPos(string const & a, char delim, string const & tok);
|
||||||
|
|
||||||
@ -170,37 +177,47 @@ int tokenPos(string const & a, char delim, string const & tok);
|
|||||||
*/
|
*/
|
||||||
bool regexMatch(string const & a, string const & pattern);
|
bool regexMatch(string const & a, string const & pattern);
|
||||||
|
|
||||||
/// Substitute all "oldchar"s with "newchar"
|
/// Substitute all \a oldchar with \a newchar
|
||||||
string const subst(string const & a, char oldchar, char newchar);
|
string const subst(string const & a, char oldchar, char newchar);
|
||||||
|
|
||||||
/// Substitutes all instances of oldstr with newstr
|
/// Substitutes all instances of \a oldstr with \a newstr
|
||||||
string const subst(string const & a,
|
string const subst(string const & a,
|
||||||
char const * oldstr, string const & newstr);
|
char const * oldstr, string const & newstr);
|
||||||
|
|
||||||
/// substitutes all instances ofr oldstr with newstr
|
/// substitutes all instances of \a oldstr with \a newstr
|
||||||
string const subst(string const & a,
|
string const subst(string const & a,
|
||||||
string const & oldstr, string const & newstr);
|
string const & oldstr, string const & newstr);
|
||||||
|
|
||||||
/** Strips characters off the end of a string.
|
/** Strips characters off the end of a string.
|
||||||
#"abccc".strip('c') = "ab".#
|
\code
|
||||||
*/
|
"abccc".strip('c') = "ab".
|
||||||
|
\endcode
|
||||||
|
*/
|
||||||
string const strip(string const & a, char c = ' ');
|
string const strip(string const & a, char c = ' ');
|
||||||
|
|
||||||
/** Strips characters of the beginning of a string.
|
/** Strips characters of the beginning of a string.
|
||||||
#"cccba".frontstrip('c') = "ba"#. */
|
\code
|
||||||
|
"cccba".frontstrip('c') = "ba"
|
||||||
|
\endcode
|
||||||
|
*/
|
||||||
string const frontStrip(string const & a, char c = ' ');
|
string const frontStrip(string const & a, char c = ' ');
|
||||||
|
|
||||||
/** Strips characters off the beginning of a string.
|
/** Strips characters off the beginning of a string.
|
||||||
#"ababcdef".frontstrip("ab") = "cdef"# .*/
|
\code
|
||||||
|
"ababcdef".frontstrip("ab") = "cdef"
|
||||||
|
\endcode
|
||||||
|
*/
|
||||||
string const frontStrip(string const & a, char const * p);
|
string const frontStrip(string const & a, char const * p);
|
||||||
|
|
||||||
/** Splits the string by the first delim.
|
/** Splits the string by the first delim.
|
||||||
Splits the string by the first appearance of delim.
|
Splits the string by the first appearance of delim.
|
||||||
The leading string up to delim is returned in piece (not including
|
The leading string up to delim is returned in piece (not including
|
||||||
delim), while the original string is cut from after the delimiter.
|
delim), while the original string is cut from after the delimiter.
|
||||||
Example:
|
Example:
|
||||||
#s1= ""; s2= "a;bc".split(s1, ';') -> s1 == "a"; s2 == "bc";#
|
\code
|
||||||
*/
|
s1= ""; s2= "a;bc".split(s1, ';') -> s1 == "a"; s2 == "bc";
|
||||||
|
\endcode
|
||||||
|
*/
|
||||||
string const split(string const & a, string & piece, char delim);
|
string const split(string const & a, string & piece, char delim);
|
||||||
|
|
||||||
/// Same as split but does not return a piece
|
/// Same as split but does not return a piece
|
||||||
|
@ -1348,7 +1348,8 @@ void LyXTabular::ReadNew(Buffer const * buf, istream & is,
|
|||||||
void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
|
void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
|
||||||
{
|
{
|
||||||
int version;
|
int version;
|
||||||
int i, j;
|
int i;
|
||||||
|
int j;
|
||||||
int rows_arg = 0;
|
int rows_arg = 0;
|
||||||
int columns_arg = 0;
|
int columns_arg = 0;
|
||||||
int is_long_tabular_arg = false;
|
int is_long_tabular_arg = false;
|
||||||
|
@ -365,6 +365,7 @@ public:
|
|||||||
bool GetLTNewPage(int cell) const;
|
bool GetLTNewPage(int cell) const;
|
||||||
///
|
///
|
||||||
InsetText * GetCellInset(int cell) const;
|
InsetText * GetCellInset(int cell) const;
|
||||||
|
///
|
||||||
InsetText * GetCellInset(int row, int column) const;
|
InsetText * GetCellInset(int row, int column) const;
|
||||||
///
|
///
|
||||||
int rows() const { return rows_; }
|
int rows() const { return rows_; }
|
||||||
|
15
src/text.C
15
src/text.C
@ -3088,15 +3088,12 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
#warning Should be fixed with a lyxinset::clear_width(bv, font) function! (Jug)
|
#warning Should be fixed with a lyxinset::clear_width(bv, font) function! (Jug)
|
||||||
#warning Should we not fix this in the Painter, please have a look Lars! (Jug)
|
#warning Should we not fix this in the Painter, please have a look Lars! (Jug)
|
||||||
#endif
|
#endif
|
||||||
int w = (inset_owner ? inset_owner->width(bview, font)-2 : ww);
|
int const y = y_offset < 0 ? 0 : y_offset;
|
||||||
int h = row_ptr->height();
|
int const h = y_offset < 0 ?
|
||||||
int x = x_offset;
|
row_ptr->height() + y_offset : row_ptr->height();
|
||||||
int y = y_offset;
|
int const w = inset_owner ?
|
||||||
if (y < 0) {
|
inset_owner->width(bview, font) - 2 : ww;
|
||||||
h += y;
|
int const x = x_offset;
|
||||||
y = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
pain.fillRectangle(x, y, w, h);
|
pain.fillRectangle(x, y, w, h);
|
||||||
} else if (inset != 0) {
|
} else if (inset != 0) {
|
||||||
int h = row_ptr->baseline() - inset->ascent(bview, font);
|
int h = row_ptr->baseline() - inset->ascent(bview, font);
|
||||||
|
18
src/vspace.h
18
src/vspace.h
@ -173,7 +173,7 @@ extern bool isValidGlueLength(string const & data, LyXGlueLength * result);
|
|||||||
/// VSpace class
|
/// VSpace class
|
||||||
class VSpace {
|
class VSpace {
|
||||||
public:
|
public:
|
||||||
///
|
/// The different kinds of spaces.
|
||||||
enum vspace_kind {
|
enum vspace_kind {
|
||||||
///
|
///
|
||||||
NONE,
|
NONE,
|
||||||
@ -190,37 +190,37 @@ public:
|
|||||||
///
|
///
|
||||||
LENGTH
|
LENGTH
|
||||||
};
|
};
|
||||||
/// constructors
|
/// Constructor
|
||||||
VSpace() :
|
VSpace() :
|
||||||
kin (NONE),
|
kin (NONE),
|
||||||
len(0.0, LyXLength::PT),
|
len(0.0, LyXLength::PT),
|
||||||
kp (false) {}
|
kp (false) {}
|
||||||
///
|
/// Constructor
|
||||||
explicit
|
explicit
|
||||||
VSpace(vspace_kind k) :
|
VSpace(vspace_kind k) :
|
||||||
kin (k),
|
kin (k),
|
||||||
len (0.0, LyXLength::PT),
|
len (0.0, LyXLength::PT),
|
||||||
kp (false) {}
|
kp (false) {}
|
||||||
///
|
/// Constructor
|
||||||
explicit
|
explicit
|
||||||
VSpace(LyXGlueLength l) :
|
VSpace(LyXGlueLength l) :
|
||||||
kin (LENGTH),
|
kin (LENGTH),
|
||||||
len (l),
|
len (l),
|
||||||
kp (false) {}
|
kp (false) {}
|
||||||
|
|
||||||
///
|
/// Constructor
|
||||||
explicit
|
explicit
|
||||||
VSpace(float v, LyXLength::UNIT u) :
|
VSpace(float v, LyXLength::UNIT u) :
|
||||||
kin (LENGTH),
|
kin (LENGTH),
|
||||||
len (v, u),
|
len (v, u),
|
||||||
kp (false) {}
|
kp (false) {}
|
||||||
|
|
||||||
/// this constructor is for reading from a .lyx file
|
/// Constructor for reading from a .lyx file
|
||||||
explicit
|
explicit
|
||||||
VSpace(string const & data);
|
VSpace(string const & data);
|
||||||
|
|
||||||
// access functions
|
/// access functions
|
||||||
vspace_kind kind() const { return kin; }
|
vspace_kind kind() const { return kin; }
|
||||||
///
|
///
|
||||||
LyXGlueLength length() const { return len; }
|
LyXGlueLength length() const { return len; }
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ public:
|
|||||||
///
|
///
|
||||||
int inPixels(int default_height, int default_skip) const;
|
int inPixels(int default_height, int default_skip) const;
|
||||||
private:
|
private:
|
||||||
///
|
/// This VSpace kind
|
||||||
vspace_kind kin;
|
vspace_kind kin;
|
||||||
///
|
///
|
||||||
LyXGlueLength len;
|
LyXGlueLength len;
|
||||||
|
Loading…
Reference in New Issue
Block a user