@iE-mail: larsbj@lyx.org
improvements to user interface (menus and
keyhandling) including configurable toolbar,
- and a few other minor things. Also current
+ and a few other (not so) minor things, like
+ rewriting most of the LyX kernel. Also current
source maintainer.
@bChristian Buescher
user-definable keys, lyxserver and more
Improvements to the czech keymaps
@bAlbert Chin
@iE-mail: china@thewrittenword.com
- Bug fixes.
+ Bug fixes
@bClaudio Coco
@iE-mail: lacocio@iol.it
Italian translation
@iE-mail: goebel@noris.net
Improvements to Koma-Script classes
@bClaus Hentschel
-@iE-mail claus.hentschel@mbau.fh-hannover.de
+@iE-mail: claus.hentschel@mbau.fh-hannover.de
Win32 port of LyX 1.1.x
@bBernard Michael Hurley
@iE-mail: bernardh@westherts.ac.uk
@iE-mail: a.leeming@ic.ac.uk
GUI-I-fication of insets and more
@bEdwin Leuven
-@iE-mail leuven@fee.uva.nl
+@iE-mail: leuven@fee.uva.nl
Qt2 frontend
GUI-I-fication of several popups (in particular
the one you are using now :)
@bJohn Levon
-@iE-mail moz@compsoc.man.ac.uk
+@iE-mail: moz@compsoc.man.ac.uk
KDE port
GUI-I-fication of several popups
@bJosé Matos
@iE-mail: a.t.meinen@chello.nl
Dutch translation coordinator
@bDaniel Naber
-@iE-mail dnaber@mini.gt.owl.de
+@iE-mail: dnaber@mini.gt.owl.de
Improvements to find&replace popup
@bDirk Niggemann
@iE-mail: dabn100@cam.ac.uk
Better support for serbian and serbocroatian
@bKornelia Pietsch
@iE-mail: pietsch@mathematik.tu-chemnitz.de
+ heavy mathed testing
provided siamltex document class
@bAndré Poenitz
@iE-mail: poenitz@HTWM.De
file io with streams
--export and --import command line options
@bAlkis Polyzotis
- Keymap work.
+ Keymap work
@bBernhard Psaier
Designer of the LyX-Banner
@bThomas Pundt
initial configure script
@bAllan Rae
@iE-mail: rae@elec.uq.edu.au
+ GUI-I architect, LyX PR head, LDN,
bug reports/fixes, Itemize Bullet Selection,
xforms-0.81 + gcc-2.6.3 compatibility
@bGarst R. Reese
Support for Koma-Script family of classes
@bMichael Ressler
@iE-mail: mike.ressler@alum.mit.edu
- various documentation contributions, AASTeX support
+ documentation maintainer, AASTeX support
@bHubert Schreier
spellchecker (ispell frontend)
beautiful document-manager based on the simple
- table of contents (temporary removed)
+ table of contents (removed)
@bIvan Schreter
@iE-mail: schreter@kdk.sk
international support and kbmaps for slovak, czech,
small fixes (some work, others didn't)
@bPeter Sütterlin
@iE-mail: pit@uni-sw.gwdg.de
- aapaper support, bug reports
+ aapaper support, german documentation translation,
+ bug reports
@bKayvan Aghaiepour Sylvan
@iE-mail: kayvan@sylvan.com
noweb2lyx and reLyX integration of noweb files.
- Added Import->Noweb and key bindings to menus.
+ added Import->Noweb and key bindings to menus.
@bReuben Thomas
@iE-mail: rrt@dcs.gla.ac.uk
- encts document class
- lots of useful bug reports
+ encts document class
+ lots of useful bug reports
@bDekel Tsur
@iE-mail: dekel@math.tau.ac.il
- Hebrew support.
- Many bug fixes.
+ Hebrew support, general file converter,
+ many many bug fixes.
@bMatthias Ulrichs
@iE-mail: urlichs@smurf.noris.de
bug reports and small fixes
svjour/svjog, egs and llncs document classes
@bJuergen Vigna
@iE-mail: jug@sad.it
- Fax- and Ascii-Export support
+ complete rewrite of the tabular, text inset
+ fax- and Ascii-Export support
iletter and dinbrief support
@bJohn P. Weiss
@iE-mail: weissjp@colorado.edu
Tutorial chapter 1
@bEdmar Wienskoski Jr.
@iE-mail: edmar-w-jr@technologist.com
- Literate programming support
- Various bug fixes
+ literate programming support
+ various bug fixes
@bSerge Winitzki
@iE-mail: winitzki@erebus.phys.cwru.edu
- Updates to the Scientific Word bindings
+ updates to the Scientific Word bindings
@bStephan Witt
@iE-mail: stephan.witt@beusen.de
- Support for page selection for printing
- Support for number of copies
+ support for page selection for printing
+ support for number of copies
@bHenner Zeller
@iE-mail: zeller@think.de
rotation of wysiwyg figures
+2001-06-26 The LyX Project <lyx@violet.home.sad.it>
+
+ * CREDITS: update a bit
+
+ * ui/default.ui: make math align entries non-optional, move
+ math-mutate stuff to Edit>Math.
+
+2001-06-26 The LyX Project <lyx@rose.home.sad.it>
+
+ * ui/default.ui: add align options to edit_math menu.
+
2001-06-23 The LyX Project <jug@sad.it>
* templates/dinbrief.lyx: remove obsolete \cursor tag
End
Menu "edit_math"
+ Item "Toggle numbering|n" "math-number"
+ Item "Toggle numbering of line|u" "math-nonumber"
+ Item "Toggle limits|l" "math-limits"
+ Separator
+ Item "Inline formula|I" "math-mutate inline"
+ Item "Displayed formula|D" "math-mutate display"
+ Item "Eqnarray environment|q" "math-mutate eqnarray"
+ Item "Align environment|A" "math-mutate align"
+ Separator
+ Item "Align Left|f" "math-halign left"
+ Item "Align Center|C" "math-halign center"
+ Item "Align Right|R" "math-halign right"
+ Separator
+ Item "V.Align Top|T" "math-valign top"
+ Item "V.Align Center|e" "math-valign center"
+ Item "V.Align Bottom|B" "math-valign bottom"
+ Separator
# Item "Make eqnarray|e" "break-line e"
# Item "Make multline|m" "break-line m"
# Item "Make align 1 column|1" "break-line 1"
# Item "Make alignat 2 columns|2" "break-line B"
# Item "Make alignat 3 columns|3" "break-line C"
# Separator
- Item "Toggle numbering|n" "math-number"
- Item "Toggle numbering of line|u" "math-nonumber"
- Item "Toggle limits|l" "math-limits"
End
#
Menu "insert"
Item "Math Formula|h" "math-mode simple"
Item "Display Formula|D" "math-mode display"
- Item "Change to Inline Math Formula|q" "math-mutate simple"
- Item "Change to Displayed Math Formula|q" "math-mutate equation"
- Item "Change to Eqnarray Environment|q" "math-mutate eqnarray"
- Item "Change to Align Environment|g" "math-mutate align"
Separator
Submenu "Special Character|S" "insert_special"
Item "Citation Reference...|C" "citation-insert"
src/LyXSendto.C
src/lyxvc.C
src/LyXView.C
+src/mathed/formulabase.C
src/mathed/formula.C
src/mathed/formulamacro.C
src/MenuBackend.C
bool res = true;
if (c == '#') {
- lyxerr.debug() << "Will insert file with header" << endl;
+ lyxerr[Debug::INFO] << "Will insert file with header" << endl;
res = buffer()->readFile(lex, text->cursor.par());
} else {
- lyxerr.debug() << "Will insert file without header" << endl;
+ lyxerr[Debug::INFO] << "Will insert file without header"
+ << endl;
res = buffer()->readLyXformat2(lex, text->cursor.par());
}
#include "lyxrow.h"
#include "LyXView.h"
#include "commandtags.h"
+#include "lyxfunc.h"
#include "font.h"
#include "bufferview_funcs.h"
#include "TextCache.h"
return;
LyXText * text = bv_->getLyXText();
- if (text->real_current_font.isRightToLeft() &&
- text->real_current_font.latex() != LyXFont::ON) {
+ if (text->real_current_font.isRightToLeft()
+#ifndef NO_LATEX
+ &&
+ text->real_current_font.latex() != LyXFont::ON
+#endif
+ ) {
if (owner_->getIntl()->keymap == Intl::PRIMARY)
owner_->getIntl()->KeyMapSec();
} else {
}
}
- // get absolute path of file and make sure the filename ends
- // with .lyx
- filename = MakeAbsPath(filename);
- if (!IsLyXFilename(filename))
- filename += ".lyx";
+ // get absolute path of file and add ".lyx" to the filename if
+ // necessary
+ filename = FileSearch(string(), filename, "lyx");
string const disp_fn(MakeDisplayPath(filename));
- // Inserts document
ostringstream s1;
s1 << _("Inserting document") << ' '
<< disp_fn << " ...";
case LFUN_FREE:
owner_->getDialogs()->setUserFreeFont();
break;
-
+
+#ifndef NO_LATEX
case LFUN_TEX:
Tex(bv_);
setState();
owner_->showState();
break;
-
+#endif
+
case LFUN_FILE_INSERT:
{
MenuInsertLyXFile(argument);
case LFUN_LAYOUT:
{
- lyxerr.debug() << "LFUN_LAYOUT: (arg) "
- << argument << endl;
+ lyxerr[Debug::INFO] << "LFUN_LAYOUT: (arg) "
+ << argument << endl;
// Derive layout number from given argument (string)
// and current buffer's textclass (number). */
update(lt,
BufferView::SELECT
| BufferView::FITCUR);
- lt->changeWordCase(bv_, LyXText::text_uppercase);
+ lt->changeCase(bv_, LyXText::text_uppercase);
if (lt->inset_owner)
updateInset(lt->inset_owner, true);
update(lt,
LyXText * lt = bv_->getLyXText();
update(lt, BufferView::SELECT|BufferView::FITCUR);
- lt->changeWordCase(bv_, LyXText::text_lowercase);
+ lt->changeCase(bv_, LyXText::text_lowercase);
if (lt->inset_owner)
updateInset(lt->inset_owner, true);
update(lt,
LyXText * lt = bv_->getLyXText();
update(lt, BufferView::SELECT|BufferView::FITCUR);
- lt->changeWordCase(bv_,
- LyXText::text_capitalization);
+ lt->changeCase(bv_, LyXText::text_capitalization);
if (lt->inset_owner)
updateInset(lt->inset_owner, true);
update(lt,
cur_value = par->params().spacing().getValue();
}
- istringstream istr(argument.c_str());
+ istringstream istr(argument);
string tmp;
istr >> tmp;
case LFUN_SETXY:
{
-#warning Should check sscanf for errors (Lgb)
- int x;
- int y;
- ::sscanf(argument.c_str(), " %d %d", &x, &y);
+ int x = 0;
+ int y = 0;
+ if (::sscanf(argument.c_str(), " %d %d", &x, &y) != 2) {
+ lyxerr << "SETXY: Could not parse coordinates in '"
+ << argument << std::endl;
+ }
bv_->getLyXText()->setCursorFromCoordinates(bv_, x, y);
}
break;
case LFUN_GETLATEX:
{
+#ifndef NO_LATEX
LyXFont & font = bv_->getLyXText()->current_font;
if (font.latex() == LyXFont::ON)
owner_->getLyXFunc()->setMessage("L");
else
+#endif
owner_->getLyXFunc()->setMessage("0");
}
break;
string(),
0);
update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
-
+#ifndef NO_LATEX
bv_->text->current_font.setLatex(LyXFont::OFF);
+#endif
}
bv_->text->insertInset(bv_, inset);
+2001-06-27 Juergen Vigna <jug@sad.it>
+
+ * text.C (cursorLeftOneWord): changed to return the cursor and added
+ overlay with BufferView * parameter which calls this one.
+ (getWord): added
+ (selectWord): use new getWord function.
+ (changeCase): renamed from changeWordCase as and extended to work
+ also on selections.
+
+ * lyxtext.h: added enum word_location
+
+ * BufferView_pimpl.C (Dispatch): change function changeWordCase to
+ changeCase as this operates now also on selections.
+
+2001-06-26 The LyX Project <lyx@violet.home.sad.it>
+
+ * lyxfunc.C (getStatus): support LFUN_MATH_MUTATE
+
+ * many files: send debug output to Debug::INFO instead of
+ Debug::ANY.
+
+ * converter.C (View):
+ (Convert):
+ (Move): send debug output to Debug::FILES instead of console.
+
+2001-06-26 The LyX Project <lyx@rose.home.sad.it>
+
+ * lyxfunc.C (getStatus): use func_status
+
+ * func_status.h: new header, describing the results of
+ LyXFunc::getStatus;
+
+ * lyxfunc.C (getStatus): add support for LFUN_MATH_VALIGN and
+ LFUN_MATH_HALIGN.
+
+2001-06-25 The LyX Project <jug@sad.it>
+
+ * buffer.C (sgmlOpenTag):
+ (sgmlCloseTag):
+ (SimpleDocBookOnePar): disable the depth spaces, for the moment.
+
+2001-06-26 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * text2.C: remove some dead code
+
+ * tabular.C (GetCellInset): store the last cell checked (gotten)
+
+ * tabular.h: add the helper for the speedup
+
+ * lyxtext.h: remove some dead code
+
+2001-06-26 The LyX Project <Asger>
+
+ * paragraph.C: Change export to LaTeX of alignment to
+ \begin{center} and family for better roundtrip work with reLyX.
+
+ * Tune the math drawing a bit.
+
+2001-06-25 The LyX Project <Asger>
+
+ * LColor.C (LColor): New color for math background. New color
+ for buttons.
+
+2001-06-25 The LyX Project <jug@sad.it>
+
+ * lyxfunc.C (MenuNew): remove extra check for .lyx file
+
+ * lyxfunc.C (Open):
+ * bufferlist.C (newFile): do not restrict to files ending with
+ .lyx
+
+ * BufferView_pimpl.C (MenuInsertLyXFile):
+
2001-06-24 The LyX Project <jug@sad.it>
* lyxlex_pimpl.C (compare_tags): use compare_ascii_no_case instead
f.setEmph(LyXFont::INHERIT);
f.setUnderbar(LyXFont::INHERIT);
f.setNoun(LyXFont::INHERIT);
+#ifndef NO_LATEX
f.setLatex(LyXFont::INHERIT);
+#endif
f.setColor(LColor::inherit);
lyxerr << "Font '" << f.stateText(0)
<< "' matched by\n" << font << endl;
{ depthbar, N_("depth bar"), "depthbar", "IndianRed", "depthbar" },
{ language, N_("language"), "language", "Blue", "language" },
{ command, N_("command inset"), "command", "black", "command" },
- { commandbg, N_("command inset background"), "commandbg", "grey80", "commandbg" },
+ { commandbg, N_("command inset background"), "commandbg", "azure", "commandbg" },
{ commandframe, N_("command inset frame"), "commandframe", "black", "commandframe" },
{ special, N_("special character"), "special", "RoyalBlue", "special" },
{ math, N_("math"), "math", "DarkBlue", "math" },
{ mathbg, N_("math background"), "mathbg", "AntiqueWhite", "mathbg" },
+ { mathmacrobg, N_("Math macro background"), "mathmacrobg", "AntiqueWhite", "mathmacrobg" },
{ mathframe, N_("math frame"), "mathframe", "Magenta", "mathframe" },
{ mathcursor, N_("math cursor"), "mathcursor", "black", "mathcursor" },
{ mathline, N_("math line"), "mathline", "Blue", "mathline" },
{ captionframe, N_("caption frame"), "captionframe", "DarkRed", "captionframe" },
{ collapsable, N_("collapsable inset text"), "collapsable", "DarkRed", "collapsable" },
{ collapsableframe, N_("collapsable inset frame"), "collapsableframe", "IndianRed", "collapsableframe" },
- { insetbg, N_("inset background"), "insetbg", "grey60", "insetbg" },
+ { insetbg, N_("inset background"), "insetbg", "grey80", "insetbg" },
{ insetframe, N_("inset frame"), "insetframe", "IndianRed", "insetframe" },
{ error, N_("LaTeX error"), "error", "Red", "error" },
{ eolmarker, N_("end-of-line marker"), "eolmarker", "Brown", "eolmarker" },
"LightSteelBlue", "tabularonoffline" },
{ bottomarea, N_("bottom area"), "bottomarea", "grey40", "bottomarea" },
{ pagebreak, N_("page break"), "pagebreak", "RoyalBlue", "pagebreak" },
- { top, N_("top of button"), "top", "grey80", "top" },
- { bottom, N_("bottom of button"), "bottom", "grey40", "bottom" },
- { left, N_("left of button"), "left", "grey80", "left" },
- { right, N_("right of button"), "right", "grey40", "right" },
- { buttonbg, N_("button background"), "buttonbg", "grey60", "buttonbg" },
+ { top, N_("top of button"), "top", "grey90", "top" },
+ { bottom, N_("bottom of button"), "bottom", "grey60", "bottom" },
+ { left, N_("left of button"), "left", "grey90", "left" },
+ { right, N_("right of button"), "right", "grey60", "right" },
+ { buttonbg, N_("button background"), "buttonbg", "grey80", "buttonbg" },
{ inherit, N_("inherit"), "inherit", "black", "inherit" },
{ ignore, N_("ignore"), "ignore", "black", "ignore" },
{ ignore, 0, 0, 0, 0 }
math,
/// Math inset background color
mathbg,
+ /// Macro math inset background color
+ mathmacrobg,
/// Math inset frame color
mathframe,
/// Math cursor color
N_("Tabular Features"), Noop },
{ LFUN_INSET_TABULAR, "tabular-insert",
N_("Insert a new Tabular Inset"), Noop },
+#ifndef NO_LATEX
{ LFUN_TEX, "tex-mode", N_("Toggle TeX style"), Noop },
+#endif
{ LFUN_INSET_TEXT, "text-insert",
N_("Insert a new Text Inset"), Noop },
{ LFUN_INSET_THEOREM, "theorem-insert", "", Noop },
figureForm.h \
font.C \
font.h \
+ func_status.h \
gettext.C \
gettext.h \
importer.C \
if (!Lgb_bug_find_hack)
lyxerr << "point not called from "
"workarea::workhandler\n";
- lyxerr.debug() << "Painter drawable: "
+ lyxerr[Debug::INFO] << "Painter drawable: "
<< owner.getPixmap() << endl;
}
if (!Lgb_bug_find_hack)
lyxerr << "line not called from "
"workarea::workhandler\n";
- lyxerr.debug() << "Painter drawable: "
+ lyxerr[Debug::INFO] << "Painter drawable: "
<< owner.getPixmap() << endl;
}
if (!Lgb_bug_find_hack)
lyxerr << "lines not called from "
"workarea::workhandler\n";
- lyxerr.debug() << "Painter drawable: "
+ lyxerr[Debug::INFO] << "Painter drawable: "
<< owner.getPixmap() << endl;
}
}
}
}
- if (f.underbar() == LyXFont::ON && f.latex() != LyXFont::ON)
+ if (f.underbar() == LyXFont::ON
+#ifndef NO_LATEX
+ && f.latex() != LyXFont::ON
+#endif
+ )
underline(f, x, y, lyxfont::width(s, ls, f));
return *this;
}
}
}
}
- if (f.underbar() == LyXFont::ON && f.latex() != LyXFont::ON)
+ if (f.underbar() == LyXFont::ON
+#ifndef NO_LATEX
+ && f.latex() != LyXFont::ON
+#endif
+ )
underline(f, x, y, lyxfont::width(s, ls, f));
return *this;
}
void TextCache::add(Buffer * buf, int workwidth, LyXText * text)
{
- lyxerr.debug() << "TextCache::add " << text;
+ lyxerr[Debug::INFO] << "TextCache::add " << text;
if (bufferlist.isLoaded(buf)) {
cache[buf] = make_pair(workwidth, text);
- lyxerr.debug() << " added" << endl;
+ lyxerr[Debug::INFO] << " added" << endl;
} else {
delete text;
- lyxerr.debug() << " deleted" << endl;
+ lyxerr[Debug::INFO] << " deleted" << endl;
}
}
add(LFUN_DEPTH);
add(SEPARATOR);
+#ifndef NO_LATEX
add(LFUN_TEX);
+#endif
add(LFUN_MATH_MODE);
add(SEPARATOR);
)
{
bool the_end_read = false;
+#ifdef NO_LATEX
+ static string inset_ert_contents;
+#endif
#ifndef NO_PEXTRA_REALLY
// This is super temporary but is needed to get the compability
// mode for minipages work correctly together with new tabulars.
par->insertInset(pos, inset, font);
++pos;
} else if (token == "\\layout") {
+#ifdef NO_LATEX
+ // Do the insetert.
+ if (!inset_ert_contents.empty()) {
+ Inset * inset = new InsetERT(inset_ert_contents);
+ par->insertInset(pos, inset, font);
+ ++pos;
+ inset_ert_contents.erase();
+ }
+#endif
lex.EatLine();
string const layoutname = lex.GetString();
pair<bool, LyXTextClass::LayoutList::size_type> pp
} else if (token == "\\size") {
lex.next();
font.setLyXSize(lex.GetString());
+#ifndef NO_LATEX
+#ifdef WITH_WARNINGS
+#warning compatability hack needed
+#endif
} else if (token == "\\latex") {
lex.next();
string const tok = lex.GetString();
else
lex.printError("Unknown LaTeX font flag "
"`$$Token'");
+#else
+ } else if (token == "\\latex") {
+ lex.next();
+ string const tok = lex.GetString();
+ if (tok == "no_latex") {
+ ; // nothing
+ } else if (tok == "latex") {
+ ; // nothing
+ } else if (tok == "default") {
+ ; // nothing
+ } else {
+ lex.printError("Unknown LaTeX font flag "
+ "`$$Token'");
+ }
+#endif
} else if (token == "\\lang") {
lex.next();
string const tok = lex.GetString();
} else {
lyxerr << "Should this ever happen?" << endl;
}
-
+
+#ifndef NO_LATEX
LyXFont const font1 = LyXFont(LyXFont::ALL_INHERIT, params.language);
+#endif
for (Paragraph::size_type i = 0; i < par->size(); ++i) {
if (!i && !noparbreak) {
if (linelen > 0)
currlinelen += (ltype_depth-depth)*2;
}
}
+#ifndef NO_LATEX
LyXFont const font2 = par->getFontSettings(params, i);
if (font1.latex() != font2.latex()) {
if (font2.latex() == LyXFont::OFF)
} else {
islatex = 0;
}
+#endif
char c = par->getUChar(params, i);
if (islatex)
} else if (c != '\0')
buffer << c;
else if (c == '\0')
- lyxerr.debug() << "writeAsciiFile: NULL char in structure." << endl;
+ lyxerr[Debug::INFO] << "writeAsciiFile: NULL char in structure." << endl;
++currlinelen;
break;
}
texrow.newline();
texrow.newline();
}
- lyxerr.debug() << "lyx header finished" << endl;
+ lyxerr[Debug::INFO] << "lyx header finished" << endl;
// There are a few differences between nice LaTeX and usual files:
// usual is \batchmode and has a
// special input@path to allow the including of figures
ofs << "\\begin{document}\n";
texrow.newline();
} // only_body
- lyxerr.debug() << "preamble finished, now the body." << endl;
+ lyxerr[Debug::INFO] << "preamble finished, now the body." << endl;
if (!lyxrc.language_auto_begin) {
ofs << subst(lyxrc.language_command_begin, "$$lang",
lyxerr << "File was not closed properly." << endl;
}
- lyxerr.debug() << "Finished making latex file." << endl;
+ lyxerr[Debug::INFO] << "Finished making latex file." << endl;
}
string const & latexname) const
{
if (!latexname.empty() && latexname != "!-- --")
- os << string(depth, ' ') << "<" << latexname << ">\n";
+ os << "<!-- " << depth << " -->" << "<" << latexname << ">";
+ //os << string(depth, ' ') << "<" << latexname << ">\n";
}
string const & latexname) const
{
if (!latexname.empty() && latexname != "!-- --")
- os << string(depth, ' ') << "</" << latexname << ">\n";
+ os << "<!-- " << depth << " -->" << "</" << latexname << ">\n";
+ //os << string(depth, ' ') << "</" << latexname << ">\n";
}
continue;
}
- if (font.latex() == LyXFont::ON || style.latexparam() == "CDATA") {
+ if (
+#ifndef NO_LATEX
+ font.latex() == LyXFont::ON ||
+#endif
+ style.latexparam() == "CDATA") {
// "TeX"-Mode on == > SGML-Mode on.
if (c != '\0')
os << c;
LyXFont font_old = style.labeltype == LABEL_MANUAL ? style.labelfont : style.font;
int char_line_count = depth;
- if (!style.free_spacing)
- os << string(depth,' ');
+ //if (!style.free_spacing)
+ // os << string(depth,' ');
// parsing main loop
for (Paragraph::size_type i = 0;
else
os << tmp_out;
}
+#ifndef NO_LATEX
} else if (font.latex() == LyXFont::ON) {
// "TeX"-Mode on ==> SGML-Mode on.
if (c != '\0')
os << c;
++char_line_count;
+#endif
} else {
string sgml_string;
if (par->linuxDocConvertChar(c, sgml_string)
// <term> not closed...
os << "</term>";
}
- os << '\n';
+ if(style.free_spacing) os << '\n';
}
}
}
}
- lyxerr.debug() << "Includeonly(" << lst << ')' << endl;
+ lyxerr[Debug::INFO] << "Includeonly(" << lst << ')' << endl;
return lst;
}
if (tname.empty()) {
tname = LibFileSearch("templates", "defaults.lyx");
}
- if (!tname.empty() && IsLyXFilename(tname)) {
+ if (!tname.empty()) {
bool templateok = false;
LyXLex lex(0, 0);
lex.setFile(tname);
}
+#ifndef NO_LATEX
void Tex(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setLatex (LyXFont::TOGGLE);
ToggleAndShow(bv, font);
}
+#endif
// Change environment depth.
bv->update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
if (font.language() != ignore_language ||
+#ifndef NO_LATEX
font.latex() != LyXFont::IGNORE ||
+#endif
font.number() != LyXFont::IGNORE)
{
LyXCursor & cursor = text->cursor;
#include <iosfwd>
+#if 1
+// For NO_LATEX
+#include "lyxfont.h"
+#endif
+
/** These are all the lyxfunctions (as enums).
Please add new functions at the end of the enum, right
before LFUN_LASTACTION.
LFUN_HFILL,
LFUN_DEPTH,
LFUN_FREE, // 30
+#ifndef NO_LATEX
LFUN_TEX,
+#endif
#if 0
LFUN_FOOTMELT, // schedule for deletion
LFUN_MARGINMELT, // schedule for deletion
std::ostream & operator<<(std::ostream &, kb_action);
#endif
-
-
-
-
command += " " + QuoteName(OnlyFilename((filename)));
- lyxerr << "Executing command: " << command << endl;
+ lyxerr[Debug::FILES] << "Executing command: " << command << endl;
ShowMessage(buffer, _("Executing command:"), command);
Path p(OnlyPath(filename));
Converter const & conv = converterlist[*cit];
bool dummy = conv.To->dummy() && conv.to != "program";
if (!dummy)
- lyxerr << "Converting from "
+ lyxerr[Debug::FILES] << "Converting from "
<< conv.from << " to " << conv.to << endl;
infile = outfile;
outfile = conv.result_dir.empty()
if (conv.latex) {
run_latex = true;
string command = subst(conv.command, token_from, "");
- lyxerr << "Running " << command << endl;
+ lyxerr[Debug::FILES] << "Running " << command << endl;
if (!runLaTeX(buffer, command))
return false;
} else {
if (conv.need_aux && !run_latex
&& !latex_command.empty()) {
- lyxerr << "Running " << latex_command
- << " to update aux file"<< endl;
+ lyxerr[Debug::FILES]
+ << "Running " << latex_command
+ << " to update aux file"<< endl;
runLaTeX(buffer, latex_command);
}
command = add_options(command,
dvipdfm_options(buffer));
- lyxerr << "Calling " << command << endl;
+ lyxerr[Debug::FILES] << "Calling " << command << endl;
if (buffer)
ShowMessage(buffer, _("Executing command:"), command);
string from2 = path + *it;
string to2 = to_base + (*it).substr(base.length());
to2 = ChangeExtension(to2, to_extension);
- lyxerr << "moving " << from2 << " to " << to2 << endl;
+ lyxerr[Debug::FILES] << "moving " << from2
+ << " to " << to2 << endl;
bool moved = (copy)
? lyx::copy(from2, to2)
: lyx::rename(from2, to2);
d_.showBibitem.connect(slot(this, &ControlBibitem::showInset));
}
+
void ControlBibitem::applyParamsToInset()
{
// FIXME:
using SigC::slot;
using std::vector;
+
ControlCharacter::ControlCharacter(LyXView & lv, Dialogs & d)
: ControlDialog<ControlConnectBD>(lv, d),
font_(0), toggleall_(false)
return LyXFont::IGNORE_FAMILY;
}
+
void ControlCharacter::setFamily(LyXFont::FONT_FAMILY val)
{
font_->setFamily(val);
}
+
LyXFont::FONT_SERIES ControlCharacter::getSeries() const
{
if (font_.get())
return LyXFont::IGNORE_SERIES;
}
+
void ControlCharacter::setSeries(LyXFont::FONT_SERIES val)
{
font_->setSeries(val);
}
+
LyXFont::FONT_SHAPE ControlCharacter::getShape() const
{
if (font_.get())
return LyXFont::IGNORE_SHAPE;
}
+
void ControlCharacter::setShape(LyXFont::FONT_SHAPE val)
{
font_->setShape(val);
}
+
LyXFont::FONT_SIZE ControlCharacter::getSize() const
{
if (font_.get())
return LyXFont::IGNORE_SIZE;
}
+
void ControlCharacter::setSize(LyXFont::FONT_SIZE val)
{
font_->setSize(val);
}
+
character::FONT_STATE ControlCharacter::getBar() const
{
if (font_.get()) {
else if (font_->noun() != LyXFont::IGNORE)
return character::NOUN_TOGGLE;
-
+#ifndef NO_LATEX
else if (font_->latex() != LyXFont::IGNORE)
return character::LATEX_TOGGLE;
+#endif
}
return character::IGNORE;
}
+
void ControlCharacter::setBar(character::FONT_STATE val)
{
switch (val) {
font_->setEmph(LyXFont::IGNORE);
font_->setUnderbar(LyXFont::IGNORE);
font_->setNoun(LyXFont::IGNORE);
+#ifndef NO_LATEX
font_->setLatex(LyXFont::IGNORE);
+#endif
break;
case character::EMPH_TOGGLE:
font_->setNoun(LyXFont::TOGGLE);
break;
+#ifndef NO_LATEX
case character::LATEX_TOGGLE:
font_->setLatex(LyXFont::TOGGLE);
break;
-
+#endif
+
case character::INHERIT:
font_->setEmph(LyXFont::INHERIT);
font_->setUnderbar(LyXFont::INHERIT);
font_->setNoun(LyXFont::INHERIT);
+#ifndef NO_LATEX
font_->setLatex(LyXFont::INHERIT);
+#endif
break;
}
}
+
LColor::color ControlCharacter::getColor() const
{
LColor::color col = LColor::ignore;
return col;
}
+
void ControlCharacter::setColor(LColor::color val)
{
switch (val) {
return toggleall_;
}
+
void ControlCharacter::setToggleAll(bool t)
{
toggleall_ = t;
lyxerr[Debug::GUI] << "Setting above space \"" << LyXGlueLength(spaceabove.length().asString()).asString() << "\"" << endl;
lyxerr[Debug::GUI] << "Setting below space \"" << LyXGlueLength(spacebelow.length().asString()).asString() << "\"" << endl;
- lv_->view()->text->SetParagraph(lv_->view(),
+ lv_->view()->text->setParagraph(lv_->view(),
dialog_->getLineAbove(), dialog_->getLineBelow(),
dialog_->getPagebreakAbove(), dialog_->getPagebreakBelow(),
spaceabove, spacebelow, dialog_->getAlign(),
}
-void FormSplashBase::mousePressEvent( QMouseEvent * e)
+void FormSplashBase::mousePressEvent( QMouseEvent * )
{
hide();
}
+2001-06-26 The LyX Project <lyx@violet.home.sad.it>
+
+ * combox.C (remove): send debug output to Debug::GUI.
+
+2001-06-26 The LyX Project <lyx@rose.home.sad.it>
+
+ * Menubar_pimpl.C (create_submenu):
+ * Toolbar_pimpl.C (update): update to use func_status
+
+2001-06-25 The LyX Project <lyx@tulip.home.sad.it>
+
+ * FormPreferences.C (Path::feedback): remove bogus description of
+ lyxpipe.
+
2001-06-16 Angus Leeming <a.leeming@ic.ac.uk>
* xformsBC.h: clean-up of included files.
str = lyxrc.getDescription(LyXRC::RC_BACKUPDIR_PATH);
else if (ob == dialog_->input_serverpipe) {
str = lyxrc.getDescription(LyXRC::RC_SERVERPIPE);
- str += " Enter either the input pipe, xxx.in, or the output pipe, xxx.out.";
}
return str;
if (i->kind() == MenuItem::Separator)
*last = "%l";
else if (!i->optional() ||
- !(view->getLyXFunc()->getStatus(i->action()) & LyXFunc::Disabled))
+ !(view->getLyXFunc()->getStatus(i->action())
+ & func_status::Disabled))
last = it;
it = extra_labels.begin();
switch (item.kind()) {
case MenuItem::Command: {
- LyXFunc::func_status flag =
+ func_status::value_type flag =
view->getLyXFunc()->getStatus(item.action());
// handle optional entries.
- if (item.optional() && (flag & LyXFunc::Disabled)) {
+ if (item.optional()
+ && (flag & func_status::Disabled)) {
lyxerr[Debug::GUI]
<< "Skipping optional item "
<< item.label() << endl;
// Modify the entry using the function status
string pupmode;
- if (flag & (LyXFunc::Disabled | LyXFunc::Unknown))
+ if (flag & (func_status::Disabled
+ | func_status::Unknown))
pupmode += "%i";
- if (flag & LyXFunc::ToggleOn)
+ if (flag & func_status::ToggleOn)
pupmode += "%B";
- if (flag & LyXFunc::ToggleOff)
+ if (flag & func_status::ToggleOff)
pupmode += "%b";
label += pupmode;
#include "debug.h"
#include "LyXView.h"
#include "lyxfunc.h"
+#include "func_status.h"
#include "BufferView.h"
#include "buffer.h"
#include "LyXAction.h"
for (; p != end; ++p) {
if (p->icon) {
int status = owner->getLyXFunc()->getStatus(p->action);
- if (status & LyXFunc::ToggleOn) {
+ if (status & func_status::ToggleOn) {
// I'd like to use a different color
// here, but then the problem is to
// know how to use transparency with
fl_set_object_boxtype(p->icon, FL_UP_BOX);
}
- if (status & LyXFunc::Disabled) {
+ if (status & func_status::Disabled) {
// Is there a way here to specify a
// mask in order to show that the
// button is disabled? (JMarc)
-// -*- C++ -*-
/*
* File: bmtable.h
* Purpose: Declaration of the XForms object bmtable.
void Combox::remove()
{
- lyxerr.debug() << "Button: " << button << endl;
+ lyxerr[Debug::GUI] << "Button: " << button << endl;
if (button) {
fl_delete_object(button);
fl_free_object(button);
}
- lyxerr.debug() << "Label: " << label << endl;
+ lyxerr[Debug::GUI] << "Label: " << label << endl;
if (label && label != button) {
fl_delete_object(label);
fl_free_object(label);
}
- lyxerr.debug() << "Form: " << form << endl;
- lyxerr.debug() << "Browser: " << browser << endl;
+ lyxerr[Debug::GUI] << "Form: " << form << endl;
+ lyxerr[Debug::GUI] << "Browser: " << browser << endl;
if (form && browser) {
fl_delete_object(browser);
fl_free_object(browser);
--- /dev/null
+// -*- C++ -*-
+#ifndef FUNC_STATUS_H
+#define FUNC_STATUS_H
+
+/// The status of a function.
+namespace func_status {
+
+enum value_type {
+ /// No problem
+ OK = 0,
+ ///
+ Unknown = 1,
+ /// Command cannot be executed
+ Disabled = 2,
+ ///
+ ToggleOn = 4,
+ ///
+ ToggleOff = 8
+ };
+}
+
+///
+inline
+void operator|=(func_status::value_type & fs, func_status::value_type f)
+{
+ fs = static_cast<func_status::value_type>(fs | f);
+}
+
+#endif
+2001-06-26 The LyX Project <lyx@violet.home.sad.it>
+
+ * figinset.C:
+ * inset.C:
+ * insetgraphics.C: send debug output to Debug::INFO instead of
+ Debug::ANY.
+
+2001-06-26 The LyX Project <lyx@rose.home.sad.it>
+
+ * insettabular.h:
+ * insettabular.C (getStatus): update to use func_status
+
+2001-06-26 ben <nicolas.marsgui@libertysurf.fr>
+
+ * insetref.C (DocBook): added support for cross-references without
+ a name.
+
+2001-06-26 The LyX Project <jug@sad.it>
+
+ * insetref.C:
+ * insetref.h:
+ * insetlabel.C:
+ * insetlabel.h: removed escape method and moved it to
+ support/lstrings.h.
+
+2001-06-26 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * insettabular.C (getMaxWidth): do the speedup in a different way,
+ remove dead code
+
2001-06-24 The LyX Project <Asger>
* insettabular.C (getMaxWidth): We cache a mapping from
2001-06-14 Juergen Vigna <jug@sad.it>
- * insettext.C (draw): removed warinings.
+ * insettext.C (draw): removed warnings.
2001-06-13 Juergen Vigna <jug@sad.it>
// now fork rendering process
forkstat = fork();
if (forkstat == -1) {
- lyxerr.debug()
+ lyxerr[Debug::INFO]
<< "Cannot fork, using slow "
"method for pixmap translation." << endl;
tmpdisp = fl_get_display();
bitmaps.clear();
figures.clear();
- lyxerr.debug() << "Unregistering figures..." << endl;
+ lyxerr[Debug::INFO] << "Unregistering figures..." << endl;
}
// if we are still there, an error occurred.
lyxerr << "Error executing ghostscript. "
<< "Code: " << err << endl;
- lyxerr.debug() << "Cmd: "
+ lyxerr[Debug::INFO] << "Cmd: "
<< lyxrc.ps_command
<< " -sDEVICE=x11 "
<< tmpf << ' '
// this func is only "called" in spellchecker.C
void sigchldchecker(pid_t pid, int * status)
{
- lyxerr.debug() << "Got pid = " << pid << endl;
+ lyxerr[Debug::INFO] << "Got pid = " << pid << endl;
bool pid_handled = false;
for (bitmaps_type::iterator it = bitmaps.begin();
it != bitmaps.end(); ++it) {
if ((*it)->reading && pid == (*it)->gspid) {
- lyxerr.debug() << "Found pid in bitmaps" << endl;
+ lyxerr[Debug::INFO] << "Found pid in bitmaps" << endl;
// now read the file and remove it from disk
figdata * p = (*it);
p->reading = false;
if ((*it)->gsdone) *status = 0;
if (*status == 0) {
- lyxerr.debug() << "GS [" << pid
+ lyxerr[Debug::INFO] << "GS [" << pid
<< "] exit OK." << endl;
} else {
lyxerr << "GS [" << pid << "] error "
}
}
if (!pid_handled) {
- lyxerr.debug() << "Checking pid in pidwait" << endl;
+ lyxerr[Debug::INFO] << "Checking pid in pidwait" << endl;
list<int>::iterator it = find(pidwaitlist.begin(),
pidwaitlist.end(), pid);
if (it != pidwaitlist.end()) {
- lyxerr.debug() << "Found pid in pidwait\n"
+ lyxerr[Debug::INFO] << "Found pid in pidwait\n"
<< "Caught child pid of recompute "
"routine" << pid << endl;
pidwaitlist.erase(it);
}
}
if (pid == -1) {
- lyxerr.debug() << "waitpid error" << endl;
+ lyxerr[Debug::INFO] << "waitpid error" << endl;
switch (errno) {
case ECHILD:
lyxerr << "The process or process group specified by "
} else if (pid == 0) {
lyxerr << "waitpid nohang" << endl;;
} else {
- lyxerr.debug() << "normal exit from childhandler" << endl;
+ lyxerr[Debug::INFO] << "normal exit from childhandler" << endl;
}
}
lex.next();
string const token = lex.GetString();
- lyxerr.debug() << "Token: " << token << endl;
+ lyxerr[Debug::INFO] << "Token: " << token << endl;
if (token.empty())
continue;
case PER_PAGE: wtype = PER_PAGE; break;
case PER_COL: wtype = PER_COL; break;
default:
- lyxerr.debug() << "Unknown type!" << endl;
+ lyxerr[Debug::INFO] << "Unknown type!" << endl;
break;
}
twtype = wtype;
case IN: htype = IN; break;
case PER_PAGE: htype = PER_PAGE; break;
default:
- lyxerr.debug() << "Unknown type!" << endl;
+ lyxerr[Debug::INFO] << "Unknown type!" << endl;
break;
}
thtype = htype;
void InsetFig::Edit(BufferView * bv, int, int, unsigned int)
{
- lyxerr.debug() << "Editing InsetFig." << endl;
+ lyxerr[Debug::INFO] << "Editing InsetFig." << endl;
Regenerate();
// We should have RO-versions of the form instead.
for (;;) {
char c = 0; ifs.get(c);
if (ifs.eof()) {
- lyxerr.debug() << "End of (E)PS file reached and"
+ lyxerr[Debug::INFO] << "End of (E)PS file reached and"
" no BoundingBox!" << endl;
break;
}
if (c == '%' && lastchar == '%') {
ifs >> p;
if (p.empty()) break;
- lyxerr.debug() << "Token: `" << p << "'" << endl;
+ lyxerr[Debug::INFO] << "Token: `" << p << "'" << endl;
if (p == "BoundingBox:") {
float fpsx, fpsy, fpswid, fpshgh;
if (ifs >> fpsx >> fpsy >> fpswid >> fpshgh) {
fl_activate_object(form->Width);
break;
default:
- lyxerr.debug() << "Unknown type!" << endl;
+ lyxerr[Debug::INFO] << "Unknown type!" << endl;
break;
}
regen = true;
fl_activate_object(form->Height);
break;
default:
- lyxerr.debug() << "Unknown type!" << endl;
+ lyxerr[Debug::INFO] << "Unknown type!" << endl;
break;
}
regen = true;
void UpdatableInset::InsetButtonPress(BufferView *, int x, int y, int button)
{
- lyxerr.debug() << "Inset Button Press x=" << x
+ lyxerr[Debug::INFO] << "Inset Button Press x=" << x
<< ", y=" << y << ", button=" << button << endl;
}
void UpdatableInset::InsetButtonRelease(BufferView *, int x, int y, int button)
{
- lyxerr.debug() << "Inset Button Release x=" << x
+ lyxerr[Debug::INFO] << "Inset Button Release x=" << x
<< ", y=" << y << ", button=" << button << endl;
}
void UpdatableInset::InsetKeyPress(XKeyEvent *)
{
- lyxerr.debug() << "Inset Keypress" << endl;
+ lyxerr[Debug::INFO] << "Inset Keypress" << endl;
}
void UpdatableInset::InsetMotionNotify(BufferView *, int x, int y, int state)
{
- lyxerr.debug() << "Inset Motion Notify x=" << x
+ lyxerr[Debug::INFO] << "Inset Motion Notify x=" << x
<< ", y=" << y << ", state=" << state << endl;
}
void UpdatableInset::InsetUnlock(BufferView *)
{
- lyxerr.debug() << "Inset Unlock" << endl;
+ lyxerr[Debug::INFO] << "Inset Unlock" << endl;
}
InsetERT::InsetERT() : InsetCollapsable()
{
- setLabel(_("ERT"));
+ setLabel(_("666"));
+#ifndef NO_LATEX
LyXFont font(LyXFont::ALL_SANE);
font.setLatex (LyXFont::ON);
+#endif
labelfont = LyXFont(LyXFont::ALL_SANE);
labelfont.decSize();
labelfont.decSize();
}
+bool InsetERT::InsertInset(BufferView *, Inset *)
+{
+ return false;
+}
+
+
void InsetERT::SetFont(BufferView *, LyXFont const &, bool, bool selectall)
{
// if selectall is activated then the fontchange was an outside general
void InsetERT::Edit(BufferView * bv, int x, int y, unsigned int button)
{
InsetCollapsable::Edit(bv, x, y, button);
+#ifndef NO_LATEX
LyXFont font(LyXFont::ALL_SANE);
font.setLatex (LyXFont::ON);
+#endif
+}
+
+
+int InsetERT::Latex(Buffer const *, std::ostream & os, bool /*fragile*/,
+ bool /*free_spc*/) const
+{
+ Paragraph::size_type siz = inset.par->size();
+ for (Paragraph::size_type i = 0; i != siz; ++i) {
+ os << inset.par->getChar(i);
+ }
+ return 1;
+}
+
+
+int InsetERT::Ascii(Buffer const *,
+ std::ostream &, int /*linelen*/) const
+{
+ return 0;
+}
+
+
+int InsetERT::Linuxdoc(Buffer const *, std::ostream &) const
+{
+ return 0;
+}
+
+
+int InsetERT::DocBook(Buffer const *, std::ostream &) const
+{
+ return 0;
}
///
InsetERT();
///
- void Write(Buffer const * buf, std::ostream & os) const;
+ virtual void Write(Buffer const * buf, std::ostream & os) const;
///
- Inset * Clone(Buffer const &) const;
+ virtual Inset * Clone(Buffer const &) const;
///
- string const EditMessage() const;
+ virtual string const EditMessage() const;
///
- bool InsertInset(BufferView *, Inset *) { return false; }
+ virtual bool InsertInset(BufferView *, Inset *);
///
- void SetFont(BufferView *, LyXFont const &, bool toggleall = false,
- bool selectall = false);
+ virtual void SetFont(BufferView *, LyXFont const &,
+ bool toggleall = false, bool selectall = false);
///
- void Edit(BufferView *, int, int, unsigned int);
+ virtual void Edit(BufferView *, int, int, unsigned int);
+ ///
+ virtual int Latex(Buffer const *, std::ostream &, bool fragile,
+ bool free_spc) const;
+ ///
+ virtual int Ascii(Buffer const *,
+ std::ostream &, int linelen = 0) const;
+ ///
+ virtual int Linuxdoc(Buffer const *, std::ostream &) const;
+ ///
+ virtual int DocBook(Buffer const *, std::ostream &) const;
};
#endif
lex.next();
string const token = lex.GetString();
- lyxerr.debug() << "Token: '" << token << '\'' << std::endl;
+ lyxerr[Debug::INFO] << "Token: '" << token << '\''
+ << std::endl;
if (token.empty()) {
continue;
}
-bool InsetGraphics::setParams(InsetGraphicsParams const & params)
+bool InsetGraphics::setParams(InsetGraphicsParams const & p)
{
// If nothing is changed, just return and say so.
- if (this->params == params)
+ if (params == p)
return false;
// Copy the new parameters.
- this->params = params;
+ params = p;
// Update the inset with the new parameters.
updateInset();
Inset * InsetGraphics::Clone(Buffer const &) const
{
+#ifdef WITH_WARNINGS
#warning use the copy constructor instead. (Lgb)
+#endif
InsetGraphics * newInset = new InsetGraphics;
newInset->cacheHandle = cacheHandle;
: form(0), labelfont(LyXFont::ALL_SANE)
{
labelfont.decSize().decSize()
- .setColor(LColor::note).setLatex(LyXFont::OFF);
+ .setColor(LColor::note)
+#ifndef NO_LATEX
+ .setLatex(LyXFont::OFF)
+#endif
+ ;
}
: contents(str), form(0), labelfont(LyXFont::ALL_SANE)
{
labelfont.decSize().decSize()
- .setColor(LColor::note).setLatex(LyXFont::OFF);
+ .setColor(LColor::note)
+#ifndef NO_LATEX
+ .setLatex(LyXFont::OFF)
+#endif
+ ;
}
#include "buffer.h"
#include "gettext.h"
#include "BufferView.h"
+#include "support/lstrings.h"
using std::ostream;
using std::vector;
os << "<anchor id=\"" << getContents() << "\" ></anchor>";
return 0;
}
-
-
-// This function escapes 8-bit characters and other problematic characters
-// It's exactly the same code as in insetref.C.
-string const InsetLabel::escape(string const & lab) const {
- char hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
- string enc;
- for (string::size_type i= 0; i < lab.length(); ++i) {
- unsigned char c = lab[i];
- if (c >= 128 || c == '=' || c == '%') {
- enc += '=';
- enc += hexdigit[c >> 4];
- enc += hexdigit[c & 15];
- } else {
- enc += c;
- }
- }
- return enc;
-}
int Linuxdoc(Buffer const *, std::ostream &) const;
///
int DocBook(Buffer const *, std::ostream &) const;
-private:
- /// This function escapes 8-bit characters
- string const escape(string const &) const;
};
#endif
LyXFont const InsetQuotes::ConvertFont(LyXFont const & f) const
{
LyXFont font(f);
+#ifndef NO_LATEX
// quotes-insets cannot be latex of any kind
font.setLatex(LyXFont::OFF);
+#endif
return font;
}
#include "frontends/Dialogs.h"
#include "lyxfunc.h"
#include "BufferView.h"
+#include "support/lstrings.h"
using std::ostream;
int InsetRef::DocBook(Buffer const *, ostream & os) const
{
- os << "<link linkend=\"" << getContents()
- << "\">" << getOptions() << "</link>";
- return 0;
-}
-
-
-// This function escapes 8-bit characters and other problematic characters
-// It's exactly the same code as in insetlabel.C.
-string const InsetRef::escape(string const & lab) const
-{
- char hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
- string enc;
- for (string::size_type i = 0; i < lab.length(); ++i) {
- unsigned char c= lab[i];
- if (c >= 128 || c == '=' || c == '%') {
- enc += '=';
- enc += hexdigit[c>>4];
- enc += hexdigit[c & 15];
- } else {
- enc += c;
- }
+ if (getOptions().empty()) {
+ os << "<xref linkend=\"" << getContents() << "\"/>";
+ } else {
+ os << "<link linkend=\"" << getContents()
+ << "\">" << getOptions() << "</link>";
}
- return enc;
+
+ return 0;
}
///
void Validate(LaTeXFeatures & features) const;
private:
- /// This function escapes 8-bit characters
- string const escape(string const &) const;
///
bool isLatex;
};
#include <cstdlib>
#include <map>
-
+//#include <signal.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "buffer.h"
#include "commandtags.h"
+#include "lyxfunc.h"
#include "debug.h"
#include "LaTeXFeatures.h"
#include "Painter.h"
using std::swap;
using std::max;
-
namespace {
const int ADD_TO_HEIGHT = 2;
first_visible_cell = cell;
if (hasSelection())
DrawCellSelection(pain, nx, baseline, i, j, cell);
+
tabular->GetCellInset(cell)->draw(bv, font, baseline, cx,
cleared);
DrawCellLines(pain, nx, baseline, i, cell);
if (the_locking_inset &&
tabular->GetCellInset(actcell) != the_locking_inset)
{
+#warning Jürgen, why is this?
Inset * inset = tabular->GetCellInset(cell);
for (i = 0;
inset != the_locking_inset && i < tabular->rows();
float dx = nx + tabular->GetBeginningOfTextInCell(cell);
float cx = dx;
//cx = dx = nx + tabular->GetBeginningOfTextInCell(cell);
- tabular->GetCellInset(cell)->draw(bv,font,baseline, dx, false);
+ tabular->GetCellInset(cell)->draw(bv, font, baseline, dx, false);
#if 0
if (bv->text->status == LyXText::CHANGED_IN_DRAW)
return;
x -= ADD_TO_TABULAR_WIDTH;
x += width(bv, font);
if (bv->text->status == LyXText::CHANGED_IN_DRAW) {
- int i=0;
- for(Inset * inset=owner();inset;++i)
+ int i = 0;
+ for(Inset * inset=owner(); inset; ++i)
inset = inset->owner();
if (calculate_dimensions_of_cells(bv, font, false))
need_update = INIT;
if (the_locking_inset == inset) {
the_locking_inset->InsetUnlock(bv);
the_locking_inset = 0;
+#ifdef WITH_WARNINGS
#warning fix scrolling when cellinset has requested a scroll (Jug)!!!
+#endif
#if 0
if (scroll(false))
scroll(bv, 0.0F);
bool hs = hasSelection();
- result=DISPATCHED;
+ result = DISPATCHED;
// this one have priority over the locked InsetText!
switch (action) {
case LFUN_SHIFT_TAB:
changed = tabular->SetDescentOfRow(actrow, maxDesc + ADD_TO_HEIGHT) || changed;
return changed;
}
+#if 0
+ cur_cell = -1;
+#endif
for (int i = 0; i < tabular->rows(); ++i) {
maxAsc = 0;
maxDesc = 0;
- for (int j= 0; j < tabular->columns(); ++j) {
+ for (int j = 0; j < tabular->columns(); ++j) {
if (tabular->IsPartOfMultiColumn(i,j))
continue;
++cell;
int InsetTabular::getMaxWidth(BufferView * bv,
UpdatableInset const * inset) const
{
- typedef std::map<UpdatableInset const *, int> Cache;
- static Cache cache;
-
- int cell = -1;
- Cache::const_iterator ci = cache.find(inset);
- if (ci != cache.end()) {
- cell = (*ci).second;
- if (tabular->GetCellInset(cell) != inset) {
- cell = -1;
- }
+ int cell = tabular->cur_cell;
+ if (tabular->GetCellInset(cell) != inset) {
+ cell = actcell;
+ if (tabular->GetCellInset(cell) != inset) {
+ lyxerr << "Actcell not equal to actual cell!" << std::endl;
+ //raise(SIGSTOP);
+ cell = -1;
+ }
}
int const n = tabular->GetNumberOfCells();
+
if (cell == -1) {
cell = 0;
for (; cell < n; ++cell) {
if (tabular->GetCellInset(cell) == inset)
break;
}
- cache[inset] = cell;
}
-
- if (cell >= n)
- return -1;
+
+ if (cell >= n) {
+ return -1;
+ }
+
int w = GetMaxWidthOfCell(bv, cell);
- if (w > 0)
+ if (w > 0) {
// because the inset then subtracts it's top_x and owner->x()
w += (inset->x() - top_x);
+ }
+
return w;
}
void InsetTabular::resizeLyXText(BufferView * bv, bool force) const
{
if (force) {
- for(int i=0; i < tabular->rows(); ++i) {
- for(int j=0; j < tabular->columns(); ++j) {
+ for(int i = 0; i < tabular->rows(); ++i) {
+ for(int j = 0; j < tabular->columns(); ++j) {
tabular->GetCellInset(i, j)->resizeLyXText(bv, true);
}
}
// 2 ... toggled on
// 3 ... toggled off
//
-LyXFunc::func_status InsetTabular::getStatus(string const & what) const
+func_status::value_type InsetTabular::getStatus(string const & what) const
{
int action = LyXTabular::LAST_ACTION;
- LyXFunc::func_status status = LyXFunc::OK;
+ func_status::value_type status = func_status::OK;
int i = 0;
for (; tabularFeatures[i].action != LyXTabular::LAST_ACTION; ++i) {
}
}
if (action == LyXTabular::LAST_ACTION)
- return LyXFunc::Unknown;
+ return func_status::Unknown;
string const argument = frontStrip(what.substr(tabularFeatures[i].feature.length()));
case LyXTabular::SET_MPWIDTH:
case LyXTabular::SET_SPECIAL_COLUMN:
case LyXTabular::SET_SPECIAL_MULTI:
- status |= LyXFunc::Disabled;
+ status |= func_status::Disabled;
return status;
case LyXTabular::APPEND_ROW:
case LyXTabular::DELETE_COLUMN:
case LyXTabular::SET_ALL_LINES:
case LyXTabular::UNSET_ALL_LINES:
- status |= LyXFunc::OK;
+ status |= func_status::OK;
return status;
case LyXTabular::MULTICOLUMN:
if (tabular->IsMultiColumn(actcell))
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::M_TOGGLE_LINE_TOP:
flag = false;
case LyXTabular::TOGGLE_LINE_TOP:
if (tabular->TopLine(actcell, flag))
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::M_TOGGLE_LINE_BOTTOM:
flag = false;
case LyXTabular::TOGGLE_LINE_BOTTOM:
if (tabular->BottomLine(actcell, flag))
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::M_TOGGLE_LINE_LEFT:
flag = false;
case LyXTabular::TOGGLE_LINE_LEFT:
if (tabular->LeftLine(actcell, flag))
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::M_TOGGLE_LINE_RIGHT:
flag = false;
case LyXTabular::TOGGLE_LINE_RIGHT:
if (tabular->RightLine(actcell, flag))
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::M_ALIGN_LEFT:
flag = false;
case LyXTabular::ALIGN_LEFT:
if (tabular->GetAlignment(actcell, flag) == LYX_ALIGN_LEFT)
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::M_ALIGN_RIGHT:
flag = false;
case LyXTabular::ALIGN_RIGHT:
if (tabular->GetAlignment(actcell, flag) == LYX_ALIGN_RIGHT)
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::M_ALIGN_CENTER:
flag = false;
case LyXTabular::ALIGN_CENTER:
if (tabular->GetAlignment(actcell, flag) == LYX_ALIGN_CENTER)
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::M_VALIGN_TOP:
flag = false;
case LyXTabular::VALIGN_TOP:
if (tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_TOP)
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::M_VALIGN_BOTTOM:
flag = false;
case LyXTabular::VALIGN_BOTTOM:
if (tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_BOTTOM)
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::M_VALIGN_CENTER:
flag = false;
case LyXTabular::VALIGN_CENTER:
if (tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_CENTER)
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::SET_LONGTABULAR:
if (tabular->IsLongTabular())
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::UNSET_LONGTABULAR:
if (!tabular->IsLongTabular())
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::SET_ROTATE_TABULAR:
if (tabular->GetRotateTabular())
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::UNSET_ROTATE_TABULAR:
if (!tabular->GetRotateTabular())
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::SET_ROTATE_CELL:
if (tabular->GetRotateCell(actcell))
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::UNSET_ROTATE_CELL:
if (!tabular->GetRotateCell(actcell))
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::SET_USEBOX:
if (strToInt(argument) == tabular->GetUsebox(actcell))
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::SET_LTFIRSTHEAD:
if (tabular->GetRowOfLTHead(actcell, dummy))
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::SET_LTHEAD:
if (tabular->GetRowOfLTHead(actcell, dummy))
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::SET_LTFOOT:
if (tabular->GetRowOfLTFoot(actcell, dummy))
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::SET_LTLASTFOOT:
if (tabular->GetRowOfLTFoot(actcell, dummy))
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
case LyXTabular::SET_LTNEWPAGE:
if (tabular->GetLTNewPage(actcell))
- status |= LyXFunc::ToggleOn;
+ status |= func_status::ToggleOn;
else
- status |= LyXFunc::ToggleOff;
+ status |= func_status::ToggleOff;
break;
default:
- status = LyXFunc::Disabled;
+ status = func_status::Disabled;
break;
}
return status;
{
if (!hasSelection())
return false;
- //delete paste_tabular;
-
- //int sel_col_start;
- //int sel_col_end;
- //int sel_row_start;
- //int sel_row_end;
int sel_col_start = tabular->column_of_cell(sel_cell_start);
int sel_col_end = tabular->column_of_cell(sel_cell_end);
int sel_row_start = tabular->row_of_cell(sel_cell_start);
int sel_row_end = tabular->row_of_cell(sel_cell_end);
if (sel_row_start > sel_row_end) {
- //int tmp tmp = sel_row_start;
- //sel_row_start = sel_row_end;
- //sel_row_end = tmp;
swap(sel_row_start, sel_row_end);
}
int const rows = sel_row_end - sel_row_start + 1;
delete paste_tabular;
paste_tabular = new LyXTabular(this, *tabular); // rows, columns);
- //int i;
for (int i = 0; i < sel_row_start; ++i)
paste_tabular->DeleteRow(0);
while(paste_tabular->rows() > rows)
#include "tabular.h"
#include "LString.h"
#include "lyxcursor.h"
-#include "lyxfunc.h"
+#include "func_status.h"
class LyXLex;
class Painter;
///
bool ShowInsetDialog(BufferView *) const;
///
- LyXFunc::func_status getStatus(string const & argument) const;
+ func_status::value_type getStatus(string const & argument) const;
///
std::vector<string> const getLabelList() const;
///
///
void SetFrameColor(BufferView *, LColor::color);
///
- LyXText * getLyXText(BufferView const *, bool const recursive=false) const;
+ LyXText * getLyXText(BufferView const *,
+ bool const recursive = false) const;
///
- void deleteLyXText(BufferView *, bool recursive=true) const;
+ void deleteLyXText(BufferView *, bool recursive = true) const;
///
- void resizeLyXText(BufferView *, bool force=false) const;
+ void resizeLyXText(BufferView *, bool force = false) const;
///
bool ShowInsetDialog(BufferView *) const;
///
bool nodraw() const;
///
int scroll(bool recursive=true) const;
+ ///
void scroll(BufferView *bv, float sx) const {
UpdatableInset::scroll(bv, sx);
}
+ ///
void scroll(BufferView *bv, int offset) const {
UpdatableInset::scroll(bv, offset);
}
void QuitLyX()
{
- lyxerr.debug() << "Running QuitLyX." << endl;
+ lyxerr[Debug::INFO] << "Running QuitLyX." << endl;
if (lyxrc.use_gui) {
if (!bufferlist.QwriteAll())
bufferlist.closeAll();
// do any other cleanup procedures now
- lyxerr.debug() << "Deleting tmp dir " << system_tempdir << endl;
+ lyxerr[Debug::INFO] << "Deleting tmp dir " << system_tempdir << endl;
DestroyLyXTmpDir(system_tempdir);
tmpname = split(tmpname, ':');
}
#endif
- lyxerr.debug() << "Arg is " << filename
- << "\nName is " << name
- << "\nTemplate is " << tmpname << endl;
+ lyxerr[Debug::INFO] << "Arg is " << filename
+ << "\nName is " << name
+ << "\nTemplate is " << tmpname << endl;
// find a free buffer
Buffer * tmpbuf = bufferlist.newFile(name, tmpname);
SIZE_NORMAL,
LColor::none,
OFF,
+#ifndef NO_LATEX
OFF,
+#endif
OFF,
OFF,
OFF };
INHERIT_SIZE,
LColor::inherit,
INHERIT,
+#ifndef NO_LATEX
INHERIT,
+#endif
INHERIT,
INHERIT,
OFF };
IGNORE_SIZE,
LColor::ignore,
IGNORE,
+#ifndef NO_LATEX
IGNORE,
+#endif
IGNORE,
IGNORE,
IGNORE };
fb1.emph == emph &&
fb1.underbar == underbar &&
fb1.noun == noun &&
+#ifndef NO_LATEX
fb1.latex == latex &&
+#endif
fb1.number == number;
}
}
+#ifndef NO_LATEX
LyXFont::FONT_MISC_STATE LyXFont::latex() const
{
return bits.latex;
}
+#endif
LColor::color LyXFont::color() const
bool LyXFont::isVisibleRightToLeft() const
{
- return (lang->RightToLeft() && latex() != ON && number() != ON);
+ return (lang->RightToLeft() &&
+#ifndef NO_LATEX
+ latex() != ON &&
+#endif
+ number() != ON);
}
}
+#ifndef NO_LATEX
LyXFont & LyXFont::setLatex(LyXFont::FONT_MISC_STATE l)
{
bits.latex = l;
return *this;
}
+#endif
LyXFont & LyXFont::setColor(LColor::color c)
setEmph(setMisc(newfont.emph(), emph()));
setUnderbar(setMisc(newfont.underbar(), underbar()));
setNoun(setMisc(newfont.noun(), noun()));
+#ifndef NO_LATEX
setLatex(setMisc(newfont.latex(), latex()));
-
+#endif
+
setNumber(setMisc(newfont.number(), number()));
if (newfont.language() == language() && toggleall)
if (language() == document_language)
setUnderbar(INHERIT);
if (noun() == tmplt.noun())
setNoun(INHERIT);
+#ifndef NO_LATEX
if (latex() == tmplt.latex())
setLatex(INHERIT);
+#endif
if (color() == tmplt.color())
setColor(LColor::inherit);
}
if (bits.noun == INHERIT) {
bits.noun = tmplt.bits.noun;
}
+#ifndef NO_LATEX
if (bits.latex == INHERIT) {
bits.latex = tmplt.bits.latex;
}
+#endif
if (bits.color == LColor::inherit) {
bits.color = tmplt.bits.color;
}
return (family() != INHERIT_FAMILY && series() != INHERIT_SERIES &&
shape() != INHERIT_SHAPE && size() != INHERIT_SIZE &&
emph() != INHERIT && underbar() != INHERIT &&
- noun() != INHERIT && latex() != INHERIT &&
+ noun() != INHERIT &&
+#ifndef NO_LATEX
+ latex() != INHERIT &&
+#endif
color() != LColor::inherit);
}
<< _(GUIMiscNames[underbar()]) << ", ";
if (noun() != INHERIT)
ost << _("Noun ") << _(GUIMiscNames[noun()]) << ", ";
+#ifndef NO_LATEX
if (latex() != INHERIT)
ost << _("Latex ") << _(GUIMiscNames[latex()]) << ", ";
+#endif
if (bits == inherit)
ost << _("Default") << ", ";
if (!params || (language() != params->language))
lex.next();
string const ttok = lex.GetString();
setLyXSize(ttok);
+#ifndef NO_LATEX
} else if (tok == "latex") {
lex.next();
string const ttok = lowercase(lex.GetString());
} else {
lex.printError("Illegal LaTeX type`$$Token'");
}
+#endif
} else if (tok == "misc") {
lex.next();
string const ttok = lowercase(lex.GetString());
if (orgfont.noun() != noun()) {
os << "\\noun " << LyXMiscNames[noun()] << " \n";
}
+#ifndef NO_LATEX
if (orgfont.latex() != latex()) {
// This is only for backwards compatibility
switch (latex()) {
break;
}
}
+#endif
if (orgfont.color() != color()) {
// To make us file compatible with older
// lyx versions we emit "default" instead
LColor::color LyXFont::realColor() const
{
+#ifndef NO_LATEX
if (latex() == ON)
return LColor::latex;
+#endif
if (color() == LColor::none)
return LColor::foreground;
return color();
bool LyXFont::equalExceptLatex(LyXFont const & f) const
{
LyXFont f1 = *this;
+#ifndef NO_LATEX
f1.setLatex(f.latex());
+#endif
return f1 == f;
}
class BufferParams;
+//#define NO_LATEX 1
+
///
class LyXFont {
public:
///
FONT_MISC_STATE noun() const;
+#ifndef NO_LATEX
///
FONT_MISC_STATE latex() const;
-
+#endif
///
FONT_MISC_STATE number() const;
LyXFont & setUnderbar(LyXFont::FONT_MISC_STATE u);
///
LyXFont & setNoun(LyXFont::FONT_MISC_STATE n);
+#ifndef NO_LATEX
///
LyXFont & setLatex(LyXFont::FONT_MISC_STATE l);
+#endif
///
LyXFont & setNumber(LyXFont::FONT_MISC_STATE n);
///
FONT_MISC_STATE underbar;
///
FONT_MISC_STATE noun;
+#ifndef NO_LATEX
///
FONT_MISC_STATE latex;
+#endif
///
FONT_MISC_STATE number;
};
#include "insets/insettheorem.h"
#include "insets/insetcaption.h"
#include "mathed/formulamacro.h"
-#include "spellchecker.h" // RVDK_PATCH_5
+#include "mathed/math_cursor.h"
+#include "mathed/math_inset.h"
+#include "spellchecker.h"
#include "minibuffer.h"
#include "vspace.h"
#include "LyXView.h"
}
-LyXFunc::func_status LyXFunc::getStatus(int ac) const
+func_status::value_type LyXFunc::getStatus(int ac) const
{
return getStatus(ac, string());
}
-LyXFunc::func_status LyXFunc::getStatus(int ac,
- string const & not_to_use_arg) const
+func_status::value_type LyXFunc::getStatus(int ac,
+ string const & not_to_use_arg) const
{
kb_action action;
- func_status flag = LyXFunc::OK;
+ func_status::value_type flag = func_status::OK;
string argument;
Buffer * buf = owner->buffer();
if (action == LFUN_UNKNOWN_ACTION) {
setErrorMessage(N_("Unknown action"));
- return LyXFunc::Unknown;
+ return func_status::Unknown;
}
// Check whether we need a buffer
LyXAction::ReadOnly)) {
// no
setErrorMessage(N_("Document is read-only"));
- flag |= LyXFunc::Disabled;
+ flag |= func_status::Disabled;
}
} else {
// no
setErrorMessage(N_("Command not allowed with"
"out any document open"));
- flag |= LyXFunc::Disabled;
+ flag |= func_status::Disabled;
return flag;
}
}
case LFUN_TABULAR_FEATURE:
disable = true;
if (owner->view()->theLockingInset()) {
- func_status ret = LyXFunc::Disabled;
+ func_status::value_type ret = func_status::Disabled;
if (owner->view()->theLockingInset()->LyxCode() == Inset::TABULAR_CODE) {
ret = static_cast<InsetTabular *>
(owner->view()->theLockingInset())->
} else if (owner->view()->theLockingInset()->GetFirstLockingInsetOfType(Inset::TABULAR_CODE)) {
ret = static_cast<InsetTabular *>
(owner->view()->theLockingInset()->
- GetFirstLockingInsetOfType(Inset::TABULAR_CODE))->
+ GetFirstLockingInsetOfType(Inset::TABULAR_CODE))->
getStatus(argument);
}
flag |= ret;
disable = false;
} else {
- static InsetTabular inset(*owner->buffer(), 1, 1);
- func_status ret;
-
- disable = true;
- ret = inset.getStatus(argument);
- if ((ret & LyXFunc::ToggleOn) ||
- (ret & LyXFunc::ToggleOff))
- flag |= LyXFunc::ToggleOff;
+ static InsetTabular inset(*owner->buffer(), 1, 1);
+ func_status::value_type ret;
+
+ disable = true;
+ ret = inset.getStatus(argument);
+ if ((ret & func_status::ToggleOn) ||
+ (ret & func_status::ToggleOff))
+ flag |= func_status::ToggleOff;
}
break;
case LFUN_BOOKMARK_GOTO:
disable = !owner->view()->
isSavedPosition(strToUnsignedInt(argument));
+ case LFUN_MATH_VALIGN: {
+ Inset * tli = owner->view()->theLockingInset();
+ if (tli && (tli->LyxCode() == Inset::MATH_CODE
+ || tli->LyxCode() == Inset::MATHMACRO_CODE)) {
+ char align = mathcursor->valign();
+ if (align == '\0') {
+ disable = true;
+ break;
+ }
+ if (argument.empty()) {
+ flag = func_status::OK;
+ break;
+ }
+ if (!contains("tcb", argument[0])) {
+ disable = true;
+ break;
+ }
+ if (argument[0] == align)
+ flag |= func_status::ToggleOn;
+ else
+ flag |= func_status::ToggleOff;
+ } else
+ disable = true;
+ break;
+ }
+ case LFUN_MATH_HALIGN: {
+ Inset * tli = owner->view()->theLockingInset();
+ if (tli && (tli->LyxCode() == Inset::MATH_CODE
+ || tli->LyxCode() == Inset::MATHMACRO_CODE)) {
+ char align = mathcursor->halign();
+ if (align == '\0') {
+ disable = true;
+ break;
+ }
+ if (argument.empty()) {
+ flag = func_status::OK;
+ break;
+ }
+ if (!contains("lcr", argument[0])) {
+ disable = true;
+ break;
+ }
+ if (argument[0] == align)
+ flag |= func_status::ToggleOn;
+ else
+ flag |= func_status::ToggleOff;
+ } else
+ disable = true;
+ break;
+ }
+ case LFUN_MATH_MUTATE: {
+ Inset * tli = owner->view()->theLockingInset();
+ if (tli && (tli->LyxCode() == Inset::MATH_CODE)) {
+ MathInsetTypes type = mathcursor->par()->GetType();
+ func_status::value_type box = func_status::ToggleOff;
+ if (argument == "inline") {
+ if (type == LM_OT_SIMPLE)
+ box = func_status::ToggleOn;
+ } else if (argument == "display") {
+ if (type == LM_OT_EQUATION)
+ box = func_status::ToggleOn;
+ } else if (argument == "eqnarray") {
+ if (type == LM_OT_EQNARRAY)
+ box = func_status::ToggleOn;
+ } else if (argument == "align") {
+ if (type == LM_OT_ALIGN)
+ box = func_status::ToggleOn;
+ } else {
+ box = func_status::OK;
+ disable = true;
+ }
+ flag |= box;
+ } else
+ disable = true;
+ break;
+ }
default:
break;
}
if (disable)
- flag |= LyXFunc::Disabled;
+ flag |= func_status::Disabled;
if (buf) {
- func_status box = LyXFunc::ToggleOff;
+ func_status::value_type box = func_status::ToggleOff;
LyXFont const & font =
TEXT(false)->real_current_font;
switch (action) {
case LFUN_EMPH:
if (font.emph() == LyXFont::ON)
- box = LyXFunc::ToggleOn;
+ box = func_status::ToggleOn;
break;
case LFUN_NOUN:
if (font.noun() == LyXFont::ON)
- box = LyXFunc::ToggleOn;
+ box = func_status::ToggleOn;
break;
case LFUN_BOLD:
if (font.series() == LyXFont::BOLD_SERIES)
- box = LyXFunc::ToggleOn;
+ box = func_status::ToggleOn;
break;
+#ifndef NO_LATEX
case LFUN_TEX:
if (font.latex() == LyXFont::ON)
- box = LyXFunc::ToggleOn;
+ box = func_status::ToggleOn;
break;
+#endif
case LFUN_READ_ONLY_TOGGLE:
if (buf->isReadonly())
- box = LyXFunc::ToggleOn;
+ box = func_status::ToggleOn;
break;
default:
- box = LyXFunc::OK;
+ box = func_status::OK;
break;
}
flag |= box;
owner->view()->hideCursor();
// We cannot use this function here
- if (getStatus(ac, do_not_use_this_arg) & Disabled)
+ if (getStatus(ac, do_not_use_this_arg) & func_status::Disabled)
goto exit_with_message;
- commandshortcut.erase();
-
- if (lyxrc.display_shortcuts && show_sc) {
- if (action != LFUN_SELFINSERT) {
- // Put name of command and list of shortcuts
- // for it in minibuffer
- string comname = lyxaction.getActionName(action);
-
- int pseudoaction = action;
- bool argsadded = false;
-
- if (!argument.empty()) {
- // If we have the command with argument,
- // this is better
- pseudoaction =
- lyxaction.searchActionArg(action,
- argument);
-
- if (pseudoaction == -1) {
- pseudoaction = action;
- } else {
- comname += " " + argument;
- argsadded = true;
- }
- }
-
- string const shortcuts =
- toplevel_keymap->findbinding(pseudoaction);
-
- if (!shortcuts.empty()) {
- comname += ": " + shortcuts;
- } else if (!argsadded) {
- comname += " " + argument;
- }
-
- if (!comname.empty()) {
- comname = strip(comname);
- commandshortcut = "(" + comname + ')';
- owner->message(commandshortcut);
-
- // Here we could even add a small pause,
- // to annoy the user and make him learn
- // the shortcuts.
- // No! That will just annoy, not teach
- // anything. The user will read the messages
- // if they are interested. (Asger)
- }
- }
- }
if (owner->view()->available() && owner->view()->theLockingInset()) {
UpdatableInset::RESULT result;
if ((action==LFUN_UNKNOWN_ACTION) && argument.empty()){
argument = keyseq.getiso();
}
- // Undo/Redo pre 0.13 is a bit tricky for insets.
+ // Undo/Redo is a bit tricky for insets.
if (action == LFUN_UNDO) {
int slx;
int sly;
case LFUN_FREE:
owner->getDialogs()->setUserFreeFont();
break;
-
+
+#ifndef NO_LATEX
case LFUN_TEX:
Tex(owner->view());
owner->view()->setState();
owner->showState();
break;
-
+#endif
+
case LFUN_RECONFIGURE:
Reconfigure(owner->view());
break;
case LFUN_LAYOUTNO:
{
- lyxerr.debug() << "LFUN_LAYOUTNO: (arg) " << argument << endl;
+ lyxerr[Debug::INFO] << "LFUN_LAYOUTNO: (arg) " << argument << endl;
int sel = strToInt(argument);
- lyxerr.debug() << "LFUN_LAYOUTNO: (sel) "<< sel << endl;
+ lyxerr[Debug::INFO] << "LFUN_LAYOUTNO: (sel) "<< sel << endl;
// Should this give a setMessage instead?
if (sel == 0)
case LFUN_GETNAME:
setMessage(owner->buffer()->fileName());
- lyxerr.debug() << "FNAME["
+ lyxerr[Debug::INFO] << "FNAME["
<< owner->buffer()->fileName()
<< "] " << endl;
break;
exit_with_message:
+ commandshortcut.erase();
+
+ if (lyxrc.display_shortcuts && show_sc) {
+ if (action != LFUN_SELFINSERT) {
+ // Put name of command and list of shortcuts
+ // for it in minibuffer
+ string comname = lyxaction.getActionName(action);
+
+ int pseudoaction = action;
+ bool argsadded = false;
+
+ if (!argument.empty()) {
+ // If we have the command with argument,
+ // this is better
+ pseudoaction =
+ lyxaction.searchActionArg(action,
+ argument);
+
+ if (pseudoaction == -1) {
+ pseudoaction = action;
+ } else {
+ comname += " " + argument;
+ argsadded = true;
+ }
+ }
+
+ string const shortcuts =
+ toplevel_keymap->findbinding(pseudoaction);
+
+ if (!shortcuts.empty()) {
+ comname += ": " + shortcuts;
+ } else if (!argsadded) {
+ comname += " " + argument;
+ }
+
+ if (!comname.empty()) {
+ comname = strip(comname);
+ commandshortcut = "(" + comname + ')';
+
+ // Here we could even add a small pause,
+ // to annoy the user and make him learn
+ // the shortcuts.
+ // No! That will just annoy, not teach
+ // anything. The user will read the messages
+ // if they are interested. (Asger)
+ }
+ }
+ }
+
string const res = getMessage();
if (res.empty()) {
if (result.second.empty()) {
owner->message(_("Canceled."));
- lyxerr.debug() << "New Document Cancelled." << endl;
+ lyxerr[Debug::INFO] << "New Document Cancelled." << endl;
return;
}
}
}
// Check whether the file already exists
- if (IsLyXFilename(s)) {
- FileInfo fi(s);
- if (fi.readable() &&
- AskQuestion(_("File already exists:"),
- MakeDisplayPath(s, 50),
- _("Do you want to open the document?"))) {
+ FileInfo fi(s);
+ if (fi.readable() &&
+ AskQuestion(_("File already exists:"),
+ MakeDisplayPath(s, 50),
+ _("Do you want to open the document?"))) {
// loads document
- string const disp_fn(MakeDisplayPath(s));
-
- ostringstream str;
- str << _("Opening document") << ' '
- << disp_fn << "...";
-
- owner->message(str.str().c_str());
- //XFlush(fl_get_display());
- owner->view()->buffer(
- bufferlist.loadLyXFile(s));
- ostringstream str2;
- str2 << _("Document") << ' '
- << disp_fn << ' ' << _("opened.");
-
- owner->message(str2.str().c_str());
-
- return;
- }
+ string const disp_fn(MakeDisplayPath(s));
+
+ ostringstream str;
+ str << _("Opening document") << ' '
+ << disp_fn << "...";
+
+ owner->message(str.str().c_str());
+ //XFlush(fl_get_display());
+ owner->view()->buffer(bufferlist.loadLyXFile(s));
+ ostringstream str2;
+ str2 << _("Document") << ' '
+ << disp_fn << ' ' << _("opened.");
+
+ owner->message(str2.str().c_str());
+
+ return;
}
} else {
s = AddName(lyxrc.document_path,
}
// find a free buffer
- lyxerr.debug() << "Find a free buffer." << endl;
+ lyxerr[Debug::INFO] << "Find a free buffer." << endl;
owner->view()->buffer(bufferlist.newFile(s, templname));
}
} else
filename = fname;
- // get absolute path of file and make sure the filename ends
- // with .lyx
- filename = MakeAbsPath(filename);
- if (!IsLyXFilename(filename))
- filename += ".lyx";
+ // get absolute path of file and add ".lyx" to the filename if
+ // necessary
+ filename = FileSearch(string(), filename, "lyx");
// loads document
string const disp_fn(MakeDisplayPath(filename));
{
string format;
string filename = split(argument, format, ' ');
- lyxerr.debug() << "LyXFunc::doImport: " << format
- << " file: " << filename << endl;
+ lyxerr[Debug::INFO] << "LyXFunc::doImport: " << format
+ << " file: " << filename << endl;
if (filename.empty()) { // need user interaction
string initpath = lyxrc.document_path;
#include FORMS_H_LOCATION
#include "commandtags.h"
+#include "func_status.h"
#include "kbsequence.h"
#include "insets/inset.h"
#include "LString.h"
*/
class LyXFunc : public SigC::Object {
public:
- /// The status of a function.
- enum func_status {
- /// No problem
- OK = 0,
- ///
- Unknown = 1,
- /// Command cannot be executed
- Disabled = 2,
- ///
- ToggleOn = 4,
- ///
- ToggleOff = 8
- };
///
explicit
LyXFunc(LyXView *);
/// we need one internall which is called from inside LyXAction and
/// can contain the string argument.
- func_status getStatus(int ac) const;
+ func_status::value_type getStatus(int ac) const;
///
- func_status getStatus(int ac, string const & not_to_use_arg) const;
+ func_status::value_type getStatus(int ac,
+ string const & not_to_use_arg) const;
/// The last key was meta
bool wasMetaKey() const;
show_sc = hm;
}
-///
-inline
-void operator|=(LyXFunc::func_status & fs, LyXFunc::func_status f)
-{
- fs = static_cast<LyXFunc::func_status>(fs | f);
-}
-
#endif
///
CHANGED_IN_DRAW
};
+ ///
+ enum word_location {
+ /// the word around the cursor
+ WHOLE_WORD,
+ /// the word begining from the cursor position
+ PARTIAL_WORD,
+ /// the next word (not yet used)
+ NEXT_WORD
+ };
/// Constructor
LyXText(BufferView *);
*/
mutable LyXCursor cursor;
-#if 0
- /* the selection cursor */
- ///
- mutable bool selection;
- ///
- mutable bool mark_set;
-
- ///
- mutable LyXCursor sel_cursor;
- ///
- mutable LyXCursor sel_start_cursor;
- ///
- mutable LyXCursor sel_end_cursor;
-#else
/** The structrue that keeps track of the selections set. */
struct Selection {
bool set() const {
};
mutable Selection selection;
-#endif
+
/// needed for the toggling
LyXCursor last_sel_cursor;
///
///
string const selectionAsString(Buffer const *) const;
+ /// select the word we need depending on word_location
+ void getWord(LyXCursor & from, LyXCursor & to, word_location) const;
/// just selects the word the cursor is in
void selectWord(BufferView *);
///
void cursorLeftOneWord(BufferView *) const;
///
+ void cursorLeftOneWord(LyXCursor &) const;
+ ///
void cursorRightOneWord(BufferView *) const;
///
void cursorUpParagraph(BufferView *) const;
text_uppercase = 2
};
/// Change the case of the word at cursor position.
- void changeWordCase(BufferView *, TextCase action);
+ void changeCase(BufferView *, TextCase action);
///
void transposeChars(BufferView const &);
+2001-06-25 The LyX Project <Asger>
+
+ * math_scriptinset.C: Fix for entering with cursor up/down.
+
+ * math_fracinset.C: We can enter fractions with cursor up and
+ down.
+
+ * math_cursor.C (Right): Fixes for cursor movement.
+
+ * formula.C (draw): New background color for math.
+
+ * math_cursor.C: Fixes for toggling labels on/off in math.
+ Fixes for infinity and other symbols that didn't appear in
+ LaTeX.
+
2001-06-24 The LyX Project <Asger>
* math_inset.C: Cursor movement is better in square roots, among
return p;
}
-char MathArray::GetChar(int pos) const
+byte MathArray::GetChar(int pos) const
{
return pos < size() ? bf_[pos + 1] : '\0';
}
memcpy(&bf_[pos + 1], &p, sizeof(p));
}
-void MathArray::insert(int pos, char b, MathTextCodes t)
+void MathArray::insert(int pos, byte b, MathTextCodes t)
{
bf_.insert(bf_.begin() + pos, 3, t);
bf_[pos + 1] = b;
insert(size(), p);
}
-void MathArray::push_back(char b, MathTextCodes c)
+void MathArray::push_back(byte b, MathTextCodes c)
{
insert(size(), b, c);
}
void MathArray::erase(int pos)
{
- if (pos < bf_.size())
+ if (pos < static_cast<int>(bf_.size()))
erase(pos, pos + item_size(pos));
}
prev(pos);
MathInset * inset = GetInset(pos);
- if (inset && inset->GetType() == LM_OT_SCRIPT)
+ if (inset && inset->isScriptInset())
+ return static_cast<MathScriptInset *>(inset);
+
+ return 0;
+}
+
+MathScriptInset * MathArray::nextScriptInset(int pos) const
+{
+ MathInset * inset = GetInset(pos);
+ if (inset && inset->isScriptInset())
return static_cast<MathScriptInset *>(inset);
return 0;
return;
int brace = 0;
- latexkeys const * l;
for (int pos = 0; pos < size(); next(pos)) {
if (isInset(pos)) {
} else {
- char fcode = GetCode(pos);
- char c = GetChar(pos);
+ MathTextCodes fcode = GetCode(pos);
+ byte c = GetChar(pos);
if (MathIsSymbol(fcode)) {
- l = lm_get_key_by_id(c, fcode == LM_TC_BSYM ? LM_TK_BIGSYM : LM_TK_SYM);
- if (l)
- os << '\\' << l->name << ' ';
+ latexkeys const * l = lm_get_key_by_id(c, LM_TK_SYM);
+
+ if (l == 0) {
+ l = lm_get_key_by_id(c, LM_TK_BIGSYM);
+ }
+
+ if (l) {
+ os << '\\' << l->name << ' ';
+ } else {
+ lyxerr << "Could not find the LaTeX name for " << c << " and fcode " << fcode << "!" << std::endl;
+ }
} else {
-
if (fcode >= LM_TC_RM && fcode <= LM_TC_TEXTRM)
os << '\\' << math_font_name[fcode - LM_TC_RM] << '{';
if (c == '}' && fcode == LM_TC_TEX && brace < 0)
lyxerr <<"Math warning: Unexpected closing brace.\n";
else
- os << char(c);
+ os << c;
}
if (fcode >= LM_TC_RM && fcode <= LM_TC_TEXTRM)
///
void insert(int pos, MathInset * inset);
///
- void insert(int pos, char, MathTextCodes);
+ void insert(int pos, byte, MathTextCodes);
///
void insert(int pos, MathArray const &);
///
void push_back(MathInset * inset);
///
- void push_back(char, MathTextCodes);
+ void push_back(byte, MathTextCodes);
///
void push_back(MathArray const &);
///
///
MathScriptInset * prevScriptInset(int pos) const;
///
- char GetChar(int pos) const;
+ MathScriptInset * nextScriptInset(int pos) const;
+ ///
+ byte GetChar(int pos) const;
///
MathTextCodes GetCode(int pos) const;
///
void InsetFormula::draw(BufferView * bv, LyXFont const &,
- int y, float & x, bool) const
+ int y, float & xx, bool) const
{
+ int x = int(xx) - 1;
+ y -= 2;
MathInset::workwidth = bv->workWidth();
Painter & pain = bv->painter();
+ int w = par()->width();
+ int h = par()->height();
+ int a = par()->ascent();
+ pain.fillRectangle(int(x), y - a, w, h, LColor::mathbg);
+
if (mathcursor) {
par()->Metrics(LM_ST_TEXT);
- int w = par()->width() + 2;
- int a = par()->ascent() + 1;
- int h = par()->height() + 1;
if (mathcursor->formula() == this) {
if (mathcursor->Selection()) {
mathcursor->SelGetArea(xp, yp, n);
pain.fillPolygon(xp, yp, n, LColor::selection);
}
- pain.rectangle(int(x - 1), y - a, w, h, LColor::green);
+ pain.rectangle(int(x), y - a, w, h, LColor::mathframe);
}
}
par()->draw(pain, int(x), y);
- x += par()->width();
+ xx += par()->width();
setCursorVisible(false);
}
//lyxerr << "toggling line number\n";
if (display()) {
bv->lockedInsetStoreUndo(Undo::INSERT);
- int row = par()->nrows() - 1;
+ int row = mathcursor->row();
bool old = par()->numbered(row);
bv->owner()->message(old ? _("No number") : _("Number"));
par()->numbered(row, !old);
{
bv->lockedInsetStoreUndo(Undo::INSERT);
- int row = par()->nrows() - 1;
+ int row = mathcursor->row();
string old_label = par()->label(row);
string new_label = arg;
int InsetFormula::ascent(BufferView *, LyXFont const &) const
{
- return par()->ascent();
+ return par()->ascent() + 4;
}
}
-
-
void InsetFormulaBase::GetCursorPos(BufferView *, int & x, int & y) const
{
mathcursor->GetPos(x, y);
}
-
vector<string> const InsetFormulaBase::getLabelList() const
{
return std::vector<string>();
}
if (!mathcursor->Left())
break;
-
// fall through...
case LFUN_DELETE:
case LFUN_CODE: mathcursor->toggleLastCode(LM_TC_TT); break;
case LFUN_DEFAULT: mathcursor->setLastCode(LM_TC_VAR); break;
+#ifndef NO_LATEX
+#ifdef WITH_WARNINGS
+#warning This needs a fix.
+ // Can we use the ERT inset here? (Lgb)
+#endif
case LFUN_TEX:
// varcode = LM_TC_TEX;
mathcursor->setLastCode(LM_TC_TEX);
bv->owner()->message(_("TeX mode"));
break;
-
+#endif
case LFUN_MATH_LIMITS:
bv->lockedInsetStoreUndo(Undo::INSERT);
if (mathcursor->toggleLimits())
if (!arg.empty()) {
bv->lockedInsetStoreUndo(Undo::INSERT);
latexkeys const * l = in_word_set(arg);
- mathcursor->SetSize(MathStyles(l ? l->id : -1));
+ mathcursor->SetSize(MathStyles(l ? l->id : static_cast<unsigned int>(-1)));
UpdateLocal(bv);
}
break;
}
break;
-
case LFUN_INSERT_MATRIX:
if (mathcursor) {
bv->lockedInsetStoreUndo(Undo::INSERT);
result = UNDISPATCHED;
break;
-
- //------- dummy actions
-#ifdef WITH_WARNINGS
-#warning Is this needed here? Shouldnt the main dispatch handle this? (Lgb)
-#endif
- //case LFUN_EXEC_COMMAND:
- //bv->owner()->getMiniBuffer()->PrepareForCommand();
- //break;
-
default:
- if ((action == -1 || action == LFUN_SELFINSERT)
- && !arg.empty()) {
+ if ((action == -1 || action == LFUN_SELFINSERT) && !arg.empty()) {
unsigned char c = arg[0];
bv->lockedInsetStoreUndo(Undo::INSERT);
mathcursor->clearLastCode();
mathcursor->insert(c, LM_TC_MIN);
} else if (('0' <= c && c <= '9') || strchr(";:!|[]().,?", c)) {
- mathcursor->insert(c, LM_TC_CONST);
+ MathTextCodes code = mathcursor->getLastCode();
+ if (code != LM_TC_TEXTRM)
+ code = LM_TC_CONST;
+ mathcursor->insert(c, code);
} else if (strchr("+/-*<>=", c)) {
- mathcursor->insert(c, LM_TC_BOP);
+ MathTextCodes code = mathcursor->getLastCode();
+ if (code != LM_TC_TEXTRM)
+ code = LM_TC_BOP;
+ mathcursor->insert(c, code);
} else if (strchr(latex_special_chars, c) && c!= '_') {
- mathcursor->insert(c, LM_TC_SPECIAL);
+ MathTextCodes code = mathcursor->getLastCode();
+ if (code != LM_TC_TEXTRM)
+ code = LM_TC_SPECIAL;
+ mathcursor->insert(c, code);
} else if (c == '_' || c == '^') {
char s[2];
s[0] = c;
sp->SetSpace(isp);
space_on = true;
} else {
- lyxerr << "look here!\n";
- //if (!mathcursor->cursor.pop() && !mathcursor->cursor.OK())
- result = FINISHED;
+ if (!mathcursor->pop())
+ result = FINISHED;
+ mathcursor->plainRight();
}
} else if (c == '\'' || c == '@') {
mathcursor->insert (c, LM_TC_VAR);
new_inset->LocalDispatch(bv, LFUN_SELFINSERT, tmp);
if (greek_kb_flag_save < 2) {
bv->unlockInset(new_inset); // bv->theLockingInset());
-#warning someone broke this in bolzano
- //bv->text->cursorRight(bv, true);
+ bv->text->cursorRight(bv, true);
}
} else
if (bv->theLockingInset()->LyxCode() == Inset::MATH_CODE ||
{
// We have already discussed what was here
LyXFont font(f);
+#ifndef NO_LATEX
font.setLatex(LyXFont::OFF);
+#endif
return font;
}
pain.fillRectangle(int(x), y , w, h, LColor::mathbg);
pain.rectangle(int(x), y, w, h, LColor::mathframe);
-
+
if (mathcursor && mathcursor->formula() == this && mathcursor->Selection()) {
int xp[10];
int yp[10];
using std::ostream;
MathBigopInset::MathBigopInset(string const & name, int id)
- : MathInset(name, LM_OT_BIGOP), lims_(-1), sym_(id)
-{}
+ : MathScriptInset(true, false), lims_(-1), sym_(id)
+{
+ SetName(name);
+}
MathInset * MathBigopInset::Clone() const
void MathBigopInset::Write(ostream & os, bool fragile) const
{
- bool const limp = GetLimits();
-
+ //bool f = sym_ != LM_int && sym_ != LM_oint && size() == LM_ST_DISPLAY;
os << '\\' << name();
-
- bool f = sym_ != LM_int && sym_ != LM_oint && size() == LM_ST_DISPLAY;
-
- if (limp && !f)
+ if (limits() == 1)
os << "\\limits ";
+ else if (limits() == -1)
+ os << "\\nolimits ";
else
- if (!limp && f)
- os << "\\nolimits ";
- else
- os << ' ';
+ os << ' ';
+ MathScriptInset::Write(os, fragile);
}
void MathBigopInset::WriteNormal(ostream & os) const
{
- bool const limp = GetLimits();
- bool f = sym_ != LM_int && sym_ != LM_oint;
-
os << "[bigop " << name();
-
- if (limp && !f)
- os << " limits";
+ if (limits() == 1)
+ os << "\\limits ";
+ else if (limits() == -1)
+ os << "\\nolimits ";
else
- if (!limp && f)
- os << " nolimits";
-
+ os << ' ';
+ MathScriptInset::WriteNormal(os);
os << "] ";
}
void MathBigopInset::Metrics(MathStyles st)
{
+ MathScriptInset::Metrics(st);
size(st);
string s;
short t;
s = name();
t = LM_TC_TEXTRM;
}
- mathed_string_dim(t, size(), s, ascent_, descent_, width_);
+
+ int asc, des, wid;
+ mathed_string_dim(t, size(), s, asc, des, wid);
if (sym_ == LM_oint)
- width_ += 2;
+ wid += 2;
+
+ if (hasLimits()) {
+ ascent_ = asc + xcell(0).height() + 2;
+ descent_ = des + xcell(1).height() + 2;
+ width_ = max(width_, wid);
+ } else {
+ ascent_ = max(ascent_, asc);
+ descent_ = max(descent_, des);
+ width_ += wid;
+ }
+
}
{
xo(x);
yo(y);
+
string s;
short t;
LColor::mathline);
++x;
}
- pain.text(x, y, s, mathed_get_font(t, size()));
+
+ int asc, des, wid;
+ mathed_string_dim(t, size(), s, asc, des, wid);
+
+ if (hasLimits()) {
+ int w = width();
+ pain.text(x + (w - wid)/2, y, s, mathed_get_font(t, size()));
+ xcell(0).draw
+ (pain, x + (w - xcell(0).width())/2, y - asc - xcell(0).descent() - 1);
+ xcell(1).draw
+ (pain, x + (w - xcell(1).width())/2, y + des + xcell(1).ascent() + 1);
+ } else {
+ pain.text(x, y, s, mathed_get_font(t, size()));
+ MathScriptInset::draw(pain, x + wid, y);
+ }
}
-bool MathBigopInset::GetLimits() const
-{
- // Default case
- if (lims_ < 0)
- return sym_ != LM_int && sym_ != LM_oint && size() == LM_ST_DISPLAY;
-
- // Custom
- return lims_ > 0;
+int MathBigopInset::limits() const
+{
+ return lims_;
}
-void MathBigopInset::SetLimits(bool ls)
+void MathBigopInset::limits(int limit)
{
- lims_ = ls ? 1 : 0;
+ lims_ = limit;
+}
+
+bool MathBigopInset::hasLimits() const
+{
+ return limits() == 1 || (limits() == 0 && size() == LM_ST_DISPLAY);
+}
+
+
+bool MathBigopInset::idxDelete(int idx)
+{
+ // ignore the return value, we do not want the inset to be deleted
+ MathScriptInset::idxDelete(idx);
+ return false;
}
#include "math_scriptinset.h"
/// big operators
-class MathBigopInset : public MathInset {
+class MathBigopInset : public MathScriptInset {
public:
///
MathBigopInset(string const &, int);
///
void Metrics(MathStyles st);
///
- bool GetLimits() const;
+ int limits() const;
///
- void SetLimits(bool);
-private:
+ bool hasLimits() const;
+ ///
+ void limits(int);
///
+ bool idxDelete(int idx);
+private:
+ /// 1: \limits, -1: \nolimits, 0: use default
int lims_;
///
int sym_;
#include "LColor.h"
#include "Painter.h"
#include "math_matrixinset.h"
+#include "math_grid.h"
#include "math_spaceinset.h"
#include "math_funcinset.h"
#include "math_bigopinset.h"
}
-void MathCursor::pop()
+bool MathCursor::pop()
{
if (path_.empty())
- return;
+ return false;
par_ = path_.back().par_;
idx_ = path_.back().idx_;
cursor_ = path_.back().cursor_;
dump("Popped:");
path_.pop_back();
+ return true;
}
if (selection) {
result = array().prev(cursor_);
- if (!result && !path_.empty()) {
- pop();
+ if (!result && pop()) {
anchor_ = cursor_;
result = array().next(anchor_);
}
if (!result) {
if (par_->idxLeft(idx_, cursor_)) {
result = true;
- } else if (!path_.empty()) {
- pop();
+ } else if (pop()) {
result = true;
}
}
}
+bool MathCursor::plainRight()
+{
+ return array().next(cursor_);
+}
+
+
bool MathCursor::Right(bool sel)
{
dump("Right 1");
if (selection) {
result = array().next(cursor_);
- if (!result && !path_.empty()) {
- pop();
+ if (!result && pop()) {
anchor_ = cursor_;
- result = array().prev(anchor_);
+ result = array().next(cursor_);
}
} else {
MathInset * p = nextActiveInset();
if (!result) {
if (par_->idxRight(idx_, cursor_)) {
result = true;
- } else if (!path_.empty()) {
- pop();
+ } else if (pop()) {
result = true;
array().next(cursor_);
}
if (cursor_ < array().size())
array().erase(cursor_);
+ // delete empty cells parts if necessary
+ if (cursor_ == 0 && array().size() == 0) {
+ bool removeit = par_->idxDelete(idx_);
+ if (pop() && removeit)
+ Delete();
+ }
+
#ifdef WITH_WARNINGS
#warning pullArg disabled
#endif
SelHandle(sel);
SelClear();
+ // check whether we could move into an inset on the right or on the left
+ MathInset * p = nextInset();
+ if (p) {
+ int idx, cursor;
+ if (p->idxFirstUp(idx, cursor)) {
+ push(p, true);
+ par_ = p;
+ idx_ = idx;
+ cursor_ = cursor;
+ dump("Up 3");
+ return true;
+ }
+ }
+
+ p = prevInset();
+ if (p) {
+ int idx, cursor;
+ if (p->idxLastUp(idx, cursor)) {
+ array().prev(cursor_);
+ push(p, false);
+ par_ = p;
+ idx_ = idx;
+ cursor_ = cursor;
+ dump("Up 4");
+ return true;
+ }
+ }
+
+
int x = xarray().pos2x(cursor_);
bool result = par_->idxUp(idx_, cursor_);
- if (!result && !path_.empty()) {
- pop();
+ if (!result && pop()) {
result = par_->idxUp(idx_, cursor_);
}
cursor_ = xarray().x2pos(x);
SelHandle(sel);
SelClear();
+ // check whether we could move into an inset on the right or on the left
+ MathInset * p = nextInset();
+ if (p) {
+ int idx, cursor;
+ if (p->idxFirstDown(idx, cursor)) {
+ push(p, true);
+ idx_ = idx;
+ cursor_ = cursor;
+ dump("Down 3");
+ return true;
+ }
+ }
+
+ p = prevInset();
+ if (p) {
+ int idx, cursor;
+ if (p->idxLastDown(idx, cursor)) {
+ array().prev(cursor_);
+ push(p, false);
+ idx_ = idx;
+ cursor_ = cursor;
+ dump("Down 4");
+ return true;
+ }
+ }
+
int x = xarray().pos2x(cursor_);
bool result = par_->idxDown(idx_, cursor_);
- if (!result && !path_.empty()) {
- pop();
+ if (!result && pop()) {
result = par_->idxDown(idx_, cursor_);
}
cursor_ = xarray().x2pos(x);
if (!prevIsInset())
return false;
MathInset * p = prevInset();
- bool old = p->GetLimits();
- p->SetLimits(!old);
- return old != p->GetLimits();
+ int old = p->limits();
+ p->limits(old == -1 ? 1 : -1);
+ return old != p->limits();
}
lyxerr << "Interpret: '" << s << "'\n";
if (s[0] == '^') {
- MathScriptInset * p = prevScriptInset();
+ MathScriptInset * p = nearbyScriptInset();
if (!p) {
p = new MathScriptInset;
insert(p);
+ array().prev(cursor_);
}
+ push(p, true);
if (!p->up())
p->up(true);
- push(p, true);
+ idx_ = 0;
return;
}
if (s[0] == '_') {
- MathScriptInset * p = prevScriptInset();
+ MathScriptInset * p = nearbyScriptInset();
if (!p) {
p = new MathScriptInset;
insert(p);
+ array().prev(cursor_);
}
+ push(p, true);
if (!p->down())
p->down(true);
- push(p, true);
+ idx_ = 1;
return;
}
MathInset * p = 0;
latexkeys const * l = in_word_set(s);
- if (!l) {
+ if (l == 0) {
if (s == "root")
p = new MathRootInset;
else if (MathMacroTable::hasTemplate(s))
break;
case LM_TK_SYM:
- if (l->id < 255)
- insert(static_cast<byte>(l->id), MathIsBOPS(l->id) ?
- LM_TC_BOPS : LM_TC_SYMB);
- else
- p = new MathFuncInset(l->name);
- break;
-
+ if (l->id < 255) {
+ insert(static_cast<byte>(l->id),
+ MathIsBOPS(l->id) ?
+ LM_TC_BOPS : LM_TC_SYMB);
+
+ } else {
+ p = new MathFuncInset(l->name);
+ }
+ break;
+
case LM_TK_STACK:
p = new MathFracInset(LM_OT_STACKREL);
break;
if (cursor_ <= 0 || !array().isInset(cursor_ - 1))
return 0;
MathInset * inset = prevInset();
- return inset->nargs() ? inset : 0;
+ return inset->isActive() ? inset : 0;
}
if (!array().isInset(cursor_))
return 0;
MathInset * inset = nextInset();
- return inset->nargs() ? inset : 0;
+ return inset->isActive() ? inset : 0;
}
-MathScriptInset * MathCursor::prevScriptInset() const
+MathScriptInset * MathCursor::nearbyScriptInset() const
{
normalize();
- return array().prevScriptInset(cursor_);
+ MathScriptInset * p = array().prevScriptInset(cursor_);
+ if (p)
+ return p;
+ return array().nextScriptInset(cursor_);
}
bool MathCursor::nextIsActive() const
{
- return nextIsInset() && nextInset()->nargs();
+ return nextIsInset() && nextInset()->isActive();
}
bool MathCursor::prevIsActive() const
{
- return prevIsInset() && prevInset()->nargs();
+ return prevIsInset() && prevInset()->isActive();
}
{
par_->idxRight(idx_, cursor_);
}
+
+char MathCursor::valign() const
+{
+ int idx;
+ MathGridInset * p =
+ static_cast<MathGridInset *>(enclosing(LM_OT_MATRIX, idx));
+ return p ? p->valign() : 0;
+}
+
+char MathCursor::halign() const
+{
+ int idx;
+ MathGridInset * p =
+ static_cast<MathGridInset *>(enclosing(LM_OT_MATRIX, idx));
+ return p ? p->halign(idx % p->ncols()) : 0;
+}
/// Put the cursor in the last position
void last();
///
+ bool plainRight();
+ ///
void Delete();
///
void DelLine();
MathTextCodes prevCode() const;
///
void selArray(MathArray &) const;
-
+ ///
+ char valign() const;
+ ///
+ char halign() const;
+ ///
+ int col() const;
+ ///
+ int row() const;
+
//protected:
///
bool macro_mode;
///
MathStyles style() const;
- ///
+ /// Make sure cursor position is valid
void normalize() const;
+ /// Enter a new MathInset from the front or the back
+ void push(MathInset * par, bool first);
+ /// Leave current MathInset
+ bool pop();
+
private:
/// Description of a position
struct MathIter {
/// MathPath
std::vector<MathIter> path_;
- ///
- void push(MathInset * par, bool first);
- ///
- void pop();
///
int last() const;
///
///
MathInset * prevActiveInset() const;
///
- MathScriptInset * prevScriptInset() const;
- ///
- int col() const;
- ///
- int row() const;
+ MathScriptInset * nearbyScriptInset() const;
///
MathFuncInset * imacro;
#include "support/LOstream.h"
-MathFracInset::MathFracInset(short ot)
+MathFracInset::MathFracInset(MathInsetTypes ot)
: MathInset("frac", ot, 2)
{
if (objtype == LM_OT_STACKREL)
return true;
}
+bool MathFracInset::idxFirstUp(int & idx, int & pos) const
+{
+ idx = 0;
+ pos = 0;
+ return true;
+}
+
+bool MathFracInset::idxFirstDown(int & idx, int & pos) const
+{
+ idx = 1;
+ pos = 0;
+ return true;
+}
+
+bool MathFracInset::idxLastUp(int & idx, int & pos) const
+{
+ idx = 0;
+ pos = cell(idx).size();
+ return true;
+}
+
+bool MathFracInset::idxLastDown(int & idx, int & pos) const
+{
+ idx = 1;
+ pos = cell(idx).size();
+ return true;
+}
+
class MathFracInset : public MathInset {
public:
///
- explicit MathFracInset(short ot = LM_OT_FRAC);
+ explicit MathFracInset(MathInsetTypes ot = LM_OT_FRAC);
///
virtual MathInset * Clone() const;
///
virtual bool idxLeft(int &, int &) const;
///
virtual bool idxRight(int &, int &) const;
+ ///
+ virtual bool idxFirstUp(int & idx, int & pos) const;
+ ///
+ virtual bool idxFirstDown(int & idx, int & pos) const;
+ ///
+ virtual bool idxLastUp(int & idx, int & pos) const;
+ ///
+ virtual bool idxLastDown(int & idx, int & pos) const;
};
#endif
extern LyXFont WhichFont(short type, int size);
-MathFuncInset::MathFuncInset(string const & nm, short ot)
+MathFuncInset::MathFuncInset(string const & nm, MathInsetTypes ot)
: MathInset(nm, ot)
{
lims_ = (GetType() == LM_OT_FUNCLIM);
{
if (!name_.empty() && name_[0] > ' ') {
LyXFont font = WhichFont(LM_TC_TEXTRM, size());
+#ifndef NO_LATEX
font.setLatex(LyXFont::ON);
+#endif
x += (lyxfont::width('I', font) + 3) / 4;
pain.text(x, y, name_, font);
}
void MathFuncInset::Metrics(MathStyles st)
{
LyXFont font = WhichFont(LM_TC_TEXTRM, size());
+#ifndef NO_LATEX
font.setLatex(LyXFont::ON);
+#endif
size_ = st;
if (name_.empty()) {
width_ = lyxfont::width('M', font);
class MathFuncInset : public MathInset {
public:
///
- explicit MathFuncInset(string const & nm, short ot = LM_OT_FUNC);
+ explicit MathFuncInset(string const & nm, MathInsetTypes ot = LM_OT_FUNC);
///
- MathInset * Clone() const;
+ MathInset * Clone() const;
///
void draw(Painter &, int, int);
///
{}
-MathGridInset::MathGridInset(int m, int n, string const & nm, short ot)
+MathGridInset::MathGridInset(int m, int n, string const & nm, MathInsetTypes ot)
: MathInset(nm, ot, m * n), rowinfo_(n), colinfo_(m), v_align_('c')
{
if (m <= 0)
colinfo_[col].h_align_ = h;
}
+char MathGridInset::halign(int col) const
+{
+ return colinfo_[col].h_align_;
+}
+
void MathGridInset::valign(char c)
{
- lyxerr << "setting valign to " << c << "\n";
v_align_ = c;
}
+char MathGridInset::valign() const
+{
+ return v_align_;
+}
+
void MathGridInset::Metrics(MathStyles st)
{
// let the cells adjust themselves
}
// adjust vertical offset
- lyxerr << "v_align: " << v_align_ << "\n";
int h = 0;
switch (v_align_) {
case 't':
width_ = colinfo_.back().offset_ + colinfo_.back().width_;
ascent_ = - rowinfo_.front().offset_ + rowinfo_.front().ascent_;
descent_ = rowinfo_.back().offset_ + rowinfo_.back().descent_;
-
- // some extra space around
- width_ += 2 * MATH_BORDER;
- ascent_ += MATH_BORDER;
- descent_ += MATH_BORDER;
/*
// Increase ws_[i] for 'R' columns (except the first one)
void MathGridInset::addRow(int row)
{
- lyxerr << "adding row " << row << endl;
rowinfo_.insert(rowinfo_.begin() + row + 1, RowInfo());
cells_.insert(cells_.begin() + (row + 1) * ncols(), ncols(), MathXArray());
}
public:
///
- MathGridInset(int m, int n, string const & nm, short ot);
+ MathGridInset(int m, int n, string const & nm, MathInsetTypes ot);
///
MathInset * Clone() const = 0;
///
///
void halign(char c, int col);
///
+ char halign(int col) const;
+ ///
void valign(char c);
///
+ char valign() const;
+ ///
void resize(short int type, int cols);
///
const RowInfo & rowinfo(int row) const;
#include "math_defs.h"
#include "math_parser.h"
#include "support/lstrings.h"
+#include <iostream>
namespace {
{
{"setminus", LM_TK_SYM, LM_setminus},
{"ldots", LM_TK_DOTS, LM_ldots},
- //{"limits", LM_TK_LIMIT, 1 },
+ {"limits", LM_TK_LIMIT, 1 },
{"stackrel", LM_TK_STACK, 0},
{"ll", LM_TK_SYM, LM_ll},
{"label", LM_TK_LABEL, 0},
{"widehat", LM_TK_WIDE, LM_widehat},
{"sin", LM_TK_FUNC, 0},
{"asymp", LM_TK_SYM, LM_asymp},
- //{"nolimits", LM_TK_LIMIT, 0 },
+ {"nolimits", LM_TK_LIMIT, 0 },
{"perp", LM_TK_MACRO, LM_perp},
{"wedge", LM_TK_SYM, LM_wedge},
{"ln", LM_TK_FUNC, 0},
};
-
struct symbolindex {
- int id;
+ unsigned int id;
short token;
- symbolindex(int i, short t) : id(i), token(t)
+ symbolindex(unsigned int i, short t) : id(i), token(t)
{}
-
+
bool operator<(symbolindex const & s) const
{
return (id < s.id) || (id == s.id && token < s.token);
init() {
int const n = sizeof(wordlist)/sizeof(wordlist[0]);
for (latexkeys const * it = wordlist; it != wordlist + n; ++it) {
+ if (LatexkeyByName.find(it->name) != LatexkeyByName.end()) {
+ std::cerr << "math_hash.C: Bug: Duplicate entry: "
+ << it->name << std::endl;
+ }
LatexkeyByName[it->name] = it - wordlist;
+ if (it->id != 0 &&
+ LatexkeyById.find(symbolindex(it->id, it->token)) !=
+ LatexkeyById.end()) {
+ std::cerr << "math_hash.C: Bug: Duplicate entry: "
+ << it->name << " Id: "
+ << it->id << " token: " << it->token
+ << std::endl;
+ }
LatexkeyById[symbolindex(it->id, it->token)] = it - wordlist;
}
}
}
-latexkeys const * lm_get_key_by_id(int id, short tc)
+latexkeys const * lm_get_key_by_id(unsigned int id, short tc)
{
std::map<symbolindex, int>::const_iterator pos
= LatexkeyById.find(symbolindex(id, tc));
int MathInset::workwidth;
-MathInset::MathInset(string const & name, short ot, int nargs)
+MathInset::MathInset(string const & name, MathInsetTypes ot, int nargs)
: name_(name), objtype(ot), width_(0), ascent_(0), descent_(0),
size_(LM_ST_TEXT), cells_(nargs), xo_(0), yo_(0)
{}
}
-bool MathInset::GetLimits() const
+int MathInset::limits() const
{
return false;
}
-void MathInset::SetLimits(bool) {}
+void MathInset::limits(int)
+{
+}
+
+bool MathInset::hasLimits() const
+{
+ return false;
+}
string const & MathInset::name() const
}
-short MathInset::GetType() const
+MathInsetTypes MathInset::GetType() const
{
return objtype;
}
-void MathInset::SetType(short t)
+void MathInset::SetType(MathInsetTypes t)
{
objtype = t;
}
}
-bool MathInset::idxHome(int & i, int & pos) const
+bool MathInset::idxHome(int & /* idx */, int & pos) const
{
if (pos == 0)
return false;
}
+bool MathInset::idxFirstUp(int &, int &) const
+{
+ return false;
+}
+
+
+bool MathInset::idxFirstDown(int &, int &) const
+{
+ return false;
+}
+
+bool MathInset::idxDelete(int)
+{
+ return false;
+}
+
+
+bool MathInset::idxLastUp(int &, int &) const
+{
+ return false;
+}
+
+
+bool MathInset::idxLastDown(int &, int &) const
+{
+ return false;
+}
+
+
void MathInset::GetXY(int & x, int & y) const
{
x = xo();
*/
///
explicit
- MathInset (string const & nm = string(), short ot = LM_OT_SIMPLE, int na = 0);
+ MathInset (string const & nm = string(), MathInsetTypes ot = LM_OT_SIMPLE, int na = 0);
/// The virtual base destructor
virtual ~MathInset() {}
/// Appends itself with macro arguments substituted
virtual void substitute(MathArray & array, MathMacro const & macro) const;
/// Compute the size of the object
- virtual void Metrics(MathStyles st) = 0;
+ virtual void Metrics(MathStyles st) = 0;
///
virtual int ascent() const;
///
///
virtual int height() const;
///
- virtual bool GetLimits() const;
+ virtual bool hasLimits() const;
///
- virtual void SetLimits(bool);
+ virtual int limits() const;
+ ///
+ virtual void limits(int);
///
string const & name() const;
///
- short GetType() const;
+ MathInsetTypes GetType() const;
//Man: Avoid to use these functions if it's not strictly necessary
///
- virtual void SetType(short t);
+ virtual void SetType(MathInsetTypes t);
///
virtual void SetName(string const & n);
///
virtual bool idxLeft(int & idx, int & pos) const;
/// The right key
virtual bool idxRight(int & idx, int & pos) const;
- /// Where should we go when we enter the inset from the left?
+
+ /// Target pos when we enter the inset from the left by pressing "Right"
virtual bool idxFirst(int & idx, int & pos) const;
- /// Where should we go when we enter the inset from the right?
+ /// Target pos when we enter the inset from the left by pressing "Up"
+ virtual bool idxFirstUp(int & idx, int & pos) const;
+ /// Target pos when we enter the inset from the left by pressing "Down"
+ virtual bool idxFirstDown(int & idx, int & pos) const;
+
+ /// Target pos when we enter the inset from the right by pressing "Left"
virtual bool idxLast(int & idx, int & pos) const;
+ /// Target pos when we enter the inset from the right by pressing "Up"
+ virtual bool idxLastUp(int & idx, int & pos) const;
+ /// Target pos when we enter the inset from the right by pressing "Down"
+ virtual bool idxLastDown(int & idx, int & pos) const;
/// Where should we go if we press home?
virtual bool idxHome(int & idx, int & pos) const;
/// Where should we go if we press end?
virtual bool idxEnd(int & idx, int & pos) const;
+ /// Delete a cell and move cursor
+ // a return value true indicates that the whole inset should be deleted
+ virtual bool idxDelete(int idx);
+
///
int nargs() const;
void GetXY(int & x, int & y) const;
///
bool covers(int x, int y) const;
+ /// Identifies ScriptInsets
+ virtual bool isScriptInset() const { return false; }
+ ///
+ virtual bool isActive() const { return nargs() > 0; }
///
///
string name_;
///
- short objtype;
+ MathInsetTypes objtype;
///
int width_;
///
insertTemplate(t);
}
+ {
+ MathMacroTemplate * t = new MathMacroTemplate("to", 0);
+ t->push_back(LM_rightarrow, LM_TC_SYMB);
+ insertTemplate(t);
+ }
+
{
MathMacroTemplate * t = new MathMacroTemplate("perp", 0);
t->push_back(LM_bot, LM_TC_BOP);
if (l)
width_ += 30 + l;
}
-
-/*
- {
- cxrow->setBaseline((cxrow == row_.begin()) ?
- cxrow->ascent() :
- cxrow->ascent() + cprow->descent()
- + MATH_ROWSEP + cprow->getBaseline());
- h += cxrow->ascent() + cxrow->descent() + MATH_ROWSEP;
- cprow = cxrow;
- }
-
- int const hl = descent();
- h -= MATH_ROWSEP;
-
- // Compute vertical align
- switch (v_align_) {
- case 't':
- ascent = row_.begin()->getBaseline();
- break;
- case 'b':
- ascent = h - hl;
- break;
- default:
- ascent = row_.begin().is_last() ? h / 2 : h - hl;
- break;
- }
- descent = h - ascent + 2;
-
- // Increase ws_[i] for 'R' columns (except the first one)
- for (int i = 1; i < nc_; ++i)
- if (h_align_[i] == 'R')
- ws_[i] += 10 * df_width;
- // Increase ws_[i] for 'C' column
- if (h_align_[0] == 'C')
- if (ws_[0] < 7 * workwidth / 8)
- ws_[0] = 7 * workwidth / 8;
-
-*/
-
}
+
void MathMatrixInset::draw(Painter & pain, int x, int y)
{
xo(x);
if (numberedType()) {
LyXFont wfont = WhichFont(LM_TC_BF, size());
+#ifndef NO_LATEX
wfont.setLatex(LyXFont::OFF);
+#endif
int xx = x + colinfo_.back().offset_ + colinfo_.back().width_ + 20;
for (int row = 0; row < nrows(); ++row)
pain.text(xx, y + rowinfo_[row].offset_, nicelabel(row), wfont);
MathScriptInset * lastScriptInset(MathArray & array)
{
MathInset * p = array.back_inset();
- if (!p || p->GetType() != LM_OT_SCRIPT) {
+ if (!p || !p->isScriptInset()) {
p = new MathScriptInset;
array.push_back(p);
}
static bool curr_num;
static string curr_label;
-void mathed_parse_lines(MathInset * inset, int col)
+void mathed_parse_lines(MathInset * inset, int col, bool numbered, bool outmost)
{
MathGridInset * p = static_cast<MathGridInset *>(inset);
- while (1) {
+ for (int row = 0; true; ++row) {
// reset global variables
- curr_num = true;
+ curr_num = numbered;
curr_label = string();
// reading a row
mathed_parse(p->cell(idx), FLAG_AMPERSAND);
mathed_parse(p->cell(idx), FLAG_NEWLINE | FLAG_END);
+ if (outmost) {
+ MathMatrixInset * m = static_cast<MathMatrixInset *>(p);
+ m->numbered(row, curr_num);
+ m->label(row, curr_label);
+ }
+
// Hack!
// no newline
if (yylval.i != -1)
switch (typ) {
case LM_OT_SIMPLE: {
+ curr_num = latex_mathenv[i].numbered;
+ curr_label = string();
mathed_parse(p->cell(0), 0);
+ MathMatrixInset * m = static_cast<MathMatrixInset *>(p);
+ m->numbered(0, curr_num);
+ m->label(0, curr_label);
break;
}
case LM_OT_EQUATION: {
+ curr_num = latex_mathenv[i].numbered;
+ curr_label = string();
mathed_parse(p->cell(0), FLAG_END);
+ MathMatrixInset * m = static_cast<MathMatrixInset *>(p);
+ m->numbered(0, curr_num);
+ m->label(0, curr_label);
break;
}
case LM_OT_EQNARRAY: {
- mathed_parse_lines(p, 3);
+ mathed_parse_lines(p, 3, latex_mathenv[i].numbered, true);
break;
}
LexGetArg('{');
//int c = atoi(yytext.c_str());
lyxerr << "LM_OT_ALIGNAT: not implemented\n";
- mathed_parse_lines(p, 2);
+ mathed_parse_lines(p, 2, latex_mathenv[i].numbered, true);
lyxerr << "LM_OT_ALIGNAT: par: " << *p << "\n";
break;
}
p->SetName(latex_mathenv[i].basename);
-/*
- curr_num = latex_mathenv[i].numbered;
- p->numbered(p->nrows()-1, curr_num);
-*/
break;
}
{
MathScriptInset * p = lastScriptInset(array);
if (p)
- p->SetLimits(bool(yylval.l->id));
+ p->limits(yylval.l->id ? 1 : -1);
break;
}
mm->valign(valign[0]);
mm->halign(halign);
- mathed_parse_lines(mm, halign.size());
+ mathed_parse_lines(mm, halign.size(), latex_mathenv[i].numbered, false);
do_insert(array, mm);
//lyxerr << "read matrix " << *mm << "\n";
break;
///
short token;
///
- int id;
+ unsigned int id;
};
latexkeys const * in_word_set(string const & str);
///
-latexkeys const * lm_get_key_by_id(int id, short tc);
+latexkeys const * lm_get_key_by_id(unsigned int id, short tc);
MathInset * mathed_parse(std::istream &);
MathInset::Metrics(st);
size_ = st;
width_ = max(xcell(0).width(), xcell(1).width()) + 2;
- ascent_ = xcell(0).height() + 9;
- descent_ = xcell(1).height();
+ if (up())
+ ascent_ = max(ascent_, xcell(0).height() + 9);
+ if (down())
+ descent_ = max(descent_, xcell(1).height());
}
pos = cell(idx).size();
return true;
}
+
+
+bool MathScriptInset::idxFirstUp(int & idx, int & pos) const
+{
+ if (!up())
+ return false;
+ idx = 0;
+ pos = 0;
+ return true;
+}
+
+bool MathScriptInset::idxFirstDown(int & idx, int & pos) const
+{
+ if (!down())
+ return false;
+ idx = 1;
+ pos = 0;
+ return true;
+}
+
+bool MathScriptInset::idxLastUp(int & idx, int & pos) const
+{
+ if (!up())
+ return false;
+ idx = 0;
+ pos = cell(idx).size();
+ return true;
+}
+
+bool MathScriptInset::idxLastDown(int & idx, int & pos) const
+{
+ if (!down())
+ return false;
+ idx = 1;
+ pos = cell(idx).size();
+ return true;
+}
+
+
+bool MathScriptInset::idxDelete(int idx)
+{
+ if (idx == 0) {
+ up(false);
+ return !down();
+ } else {
+ down(false);
+ return !up();
+ }
+}
///
bool idxFirst(int & idx, int & pos) const;
///
+ bool idxFirstUp(int & idx, int & pos) const;
+ ///
+ bool idxFirstDown(int & idx, int & pos) const;
+ ///
bool idxLast(int & idx, int & pos) const;
///
+ bool idxLastUp(int & idx, int & pos) const;
+ ///
+ bool idxLastDown(int & idx, int & pos) const;
+ ///
bool up() const;
///
bool down() const;
void up(bool);
///
void down(bool);
+ ///
+ bool isActive() const { return false; }
+ /// Identifies ScriptInsets
+ bool isScriptInset() const { return true; }
+ ///
+ bool idxDelete(int idx);
private:
///
bool up_;
#include "support/LOstream.h"
-MathSpaceInset::MathSpaceInset(int sp, short ot)
+MathSpaceInset::MathSpaceInset(int sp, MathInsetTypes ot)
: MathInset("", ot), space_(sp)
{}
class MathSpaceInset : public MathInset {
public:
///
- MathSpaceInset(int sp, short ot = LM_OT_SPACE);
+ MathSpaceInset(int sp, MathInsetTypes ot = LM_OT_SPACE);
///
MathInset * Clone() const;
///
LyXFont mathed_get_font(short type, int size)
{
LyXFont f = WhichFont(type, size);
+#ifndef NO_LATEX
if (type == LM_TC_TEX) {
f.setLatex(LyXFont::ON);
}
+#endif
return f;
}
else
main_body = beginningOfMainBody();
+ int column = 0;
+
if (main_body > 0) {
os << '[';
+ ++column;
basefont = getFont(bparams, -2); // Get label font
} else {
basefont = getFont(bparams, -1); // Get layout font
}
- int column = 0;
-
if (main_body >= 0
&& !pimpl_->size()) {
if (style.isCommand()) {
os << '{';
++column;
- } else if (params().align() != LYX_ALIGN_LAYOUT) {
- os << '{';
- ++column;
- return_value = true;
}
}
if (style.isCommand()) {
os << '{';
++column;
- } else if (params().align() != LYX_ALIGN_LAYOUT && next_) {
- // We do not need \par here (Dekel)
- // os << "{\\par";
- os << "{";
- ++column;
- return_value = true;
}
if (params().noindent()) {
case LYX_ALIGN_SPECIAL:
break;
case LYX_ALIGN_LEFT:
- if (moving_arg)
- os << "\\protect";
if (getParLanguage(bparams)->babel() != "hebrew") {
- os << "\\raggedright ";
- column+= 13;
+ os << "\\begin{flushleft}";
+ column+= 17;
} else {
- os << "\\raggedleft ";
- column+= 12;
+ os << "\\begin{flushright}";
+ column+= 18;
}
break;
case LYX_ALIGN_RIGHT:
- if (moving_arg)
- os << "\\protect";
if (getParLanguage(bparams)->babel() != "hebrew") {
- os << "\\raggedleft ";
- column+= 12;
+ os << "\\begin{flushright}";
+ column+= 18;
} else {
- os << "\\raggedright ";
- column+= 13;
+ os << "\\begin{flushleft}";
+ column+= 17;
}
break;
case LYX_ALIGN_CENTER:
- if (moving_arg)
- os << "\\protect";
- os << "\\centering ";
- column+= 11;
+ os << "\\begin{center}";
+ column+= 14;
break;
}
}
// newlines are handled differently here than
// the default in SimpleTeXSpecialChars().
if (!style.newline_allowed
- || font.latex() == LyXFont::ON) {
+#ifndef NO_LATEX
+ || font.latex() == LyXFont::ON
+#endif
+ ) {
os << '\n';
} else {
if (open_font) {
return_value = false;
}
+ switch (params().align()) {
+ case LYX_ALIGN_NONE:
+ case LYX_ALIGN_BLOCK:
+ case LYX_ALIGN_LAYOUT:
+ case LYX_ALIGN_SPECIAL:
+ break;
+ case LYX_ALIGN_LEFT:
+ if (getParLanguage(bparams)->babel() != "hebrew") {
+ os << "\\end{flushleft}";
+ column+= 15;
+ } else {
+ os << "\\end{flushright}";
+ column+= 16;
+ }
+ break;
+ case LYX_ALIGN_RIGHT:
+ if (getParLanguage(bparams)->babel() != "hebrew") {
+ os << "\\end{flushright}";
+ column+= 16;
+ } else {
+ os << "\\end{flushleft}";
+ column+= 15;
+ }
+ break;
+ case LYX_ALIGN_CENTER:
+ os << "\\end{center}";
+ column+= 12;
+ break;
+ }
+
lyxerr[Debug::LATEX] << "SimpleTeXOnePar...done " << this << endl;
return return_value;
}
{
return pimpl_->params;
}
+
&& i
&& owner_->getChar(i - 1) != ' '
&& (i < owner_->size() - 1)
+#ifndef NO_LATEX
// In LaTeX mode, we don't want to
// break lines since some commands
// do not like this
&& ! (font.latex() == LyXFont::ON)
+#endif
// same in FreeSpacing mode
&& !style.free_spacing
// In typewriter mode, we want to avoid
texrow.newline();
texrow.start(owner_, i + 1);
column = 0;
- } else if (font.latex() == LyXFont::OFF) {
+ } else
+#ifndef NO_LATEX
+ if (font.latex() == LyXFont::OFF) {
+#endif
if (style.free_spacing) {
os << '~';
} else {
os << ' ';
}
+#ifndef NO_LATEX
}
+#endif
}
default:
// And now for the special cases within each mode
+#ifndef NO_LATEX
// Are we in LaTeX mode?
if (font.latex() == LyXFont::ON) {
// at present we only have one option
break;
}
} else {
+#endif
// Plain mode (i.e. not LaTeX)
switch (c) {
case '\\':
}
break;
}
+#ifndef NO_LATEX
}
+#endif
}
}
+2001-06-26 The LyX Project <lyx@violet.home.sad.it>
+
+ * filetools.C (DeleteAllFilesInDir): send debug output to
+ Debug::FILES instewad of Debug::ANY.
+
+ * DebugStream.h: remove gcc 2.8.x hack.
+
+2001-06-26 The LyX Project <jug@sad.it>
+
+ * lstrings.h:
+ * lstrings.C (escape): move method to escape non ascii characters
+ from insets label and ref to here.
+
+2001-06-25 The LyX Project <jug@sad.it>
+
+ * filetools.C (IsLyXFilename):
+ (IsSGMLFilename): do case insensitive name matching
+
2001-06-24 The LyX Project <jug@sad.it>
* lstrings.C (compare_ascii_no_case): version of compare_no_case
#include "LOstream.h"
-// I don't really like this, but too please doc++...(Lgb)
-using std::ostream;
-
#ifdef TEST_DEBUGSTREAM
#include <string>
struct Debug {
debug[Debug::type(Debug::INFO | Debug::CRIT)] << "...info/crit...\n";
*/
-class DebugStream : public ostream
+class DebugStream : public std::ostream
{
-// This workaround is needed only for gcc 2.8.1 (and possibly egcs
-// 1.0.x), which generates a compiler error when subclassing from
-// std::. (JMarc)
public:
/// Constructor, sets the debug level to t.
explicit DebugStream(Debug::type t = Debug::NONE);
bool IsLyXFilename(string const & filename)
{
- return suffixIs(filename, ".lyx");
+ return suffixIs(lowercase(filename), ".lyx");
}
bool IsSGMLFilename(string const & filename)
{
- return suffixIs(filename, ".sgml");
+ return suffixIs(lowercase(filename), ".sgml");
}
continue;
string const unlinkpath = AddName (path, temp);
- lyxerr.debug() << "Deleting file: " << unlinkpath << endl;
+ lyxerr[Debug::FILES] << "Deleting file: " << unlinkpath
+ << endl;
bool deleted = true;
if (FileInfo(unlinkpath).isDir())
return 1;
}
-static
-int ascii_tolower(int c) {
- if (c >= 'A' && c <= 'Z')
- return c - 'A' + 'a';
- return c;
+
+namespace {
+ int ascii_tolower(int c) {
+ if (c >= 'A' && c <= 'Z')
+ return c - 'A' + 'a';
+ return c;
+ }
}
+
int compare_ascii_no_case(string const & s, string const & s2)
{
string::const_iterator p = s.begin();
}
return tmp;
}
+
+
+// This function escapes 8-bit characters and other problematic
+// characters that cause problems in latex labels.
+string const escape(string const & lab)
+{
+ char hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+ string enc;
+ for (string::size_type i = 0; i < lab.length(); ++i) {
+ unsigned char c= lab[i];
+ if (c >= 128 || c == '=' || c == '%') {
+ enc += '=';
+ enc += hexdigit[c>>4];
+ enc += hexdigit[c & 15];
+ } else {
+ enc += c;
+ }
+ }
+ return enc;
+}
/// Same as split but uses the last delim.
string const rsplit(string const & a, string & piece, char delim);
+/// Escapes non ASCII chars
+string const escape(string const & lab);
+
#endif
retval = 0;
if (how == SystemDontWait) {
- (os::shell() == os::UNIX) ? command += " &"
- : command = "start /min/n " + command;
+ if (os::shell() == os::UNIX) {
+ command += " &";
+ } else {
+ command = "start /min/n " + command;
+ }
}
return startscript();
LyXTabular::LyXTabular(InsetTabular * inset, int rows_arg, int columns_arg)
{
owner_ = inset;
+ cur_cell = -1;
Init(rows_arg, columns_arg);
}
LyXTabular::LyXTabular(InsetTabular * inset, LyXTabular const & lt)
{
owner_ = inset;
+ cur_cell = -1;
Init(lt.rows_, lt.columns_, <);
#if 0
#ifdef WITH_WARNINGS
LyXTabular::LyXTabular(Buffer const * buf, InsetTabular * inset, LyXLex & lex)
{
owner_ = inset;
+ cur_cell = -1;
Read(buf, lex);
}
// So then it is ok to throw an exception, or for now
// call abort()
lyx::Assert(rows_ == lt.rows_ && columns_ == lt.columns_);
-
+ cur_cell = -1;
cell_info = lt.cell_info;
row_info = lt.row_info;
column_info = lt.column_info;
InsetText * LyXTabular::GetCellInset(int cell) const
{
+ cur_cell = cell;
return & cell_info[row_of_cell(cell)][column_of_cell(cell)].inset;
}
void Validate(LaTeXFeatures &) const;
///
std::vector<string> const getLabelList() const;
+ ///
+ mutable int cur_cell;
private:
///
struct cellstruct {
if (id == (*kit).id()
&& pos < (*kit).pos()) {
(*kit).pos((*kit).pos() + 1);
- lyxerr.debug()
+ lyxerr[Debug::INFO]
<< "TeXRow::increasePos: ideally this "
"should never happen..." << endl;
}
// When verified to work this clause should be deleted.
if (id == (*kit).id()
&& pos == (*kit).pos()) {
- lyxerr.debug()
+ lyxerr[Debug::INFO]
<< "TexRow::increasePos: this should happen "
"maximum one time for each run of "
"increasePos!" << endl;
last_separator = i - 1;
x = width; // this means break
} else {
-#if 0
- last_separator = i;
- x += width;
-#else
x += singleWidth(bview, par, i, c);
-#endif
}
} else {
if (IsLineSeparatorChar(c))
not_ready = false;
// Set the dimensions of the row
+#ifdef WITH_WARNINGS
+#warning Something is rotten here! (Jug)
+#endif
tmprow->fill(fill(bview, tmprow, workWidth(bview)));
setHeightOfRow(bview, tmprow);
void LyXText::cursorLeftOneWord(BufferView * bview) const
{
- // treat HFills, floats and Insets as words
LyXCursor tmpcursor = cursor;
- while (tmpcursor.pos()
- && (tmpcursor.par()->isSeparator(tmpcursor.pos() - 1)
- || tmpcursor.par()->isKomma(tmpcursor.pos() - 1))
- && !(tmpcursor.par()->isHfill(tmpcursor.pos() - 1)
- || tmpcursor.par()->isInset(tmpcursor.pos() - 1)))
- tmpcursor.pos(tmpcursor.pos() - 1);
-
- if (tmpcursor.pos()
- && (tmpcursor.par()->isInset(tmpcursor.pos() - 1)
- || tmpcursor.par()->isHfill(tmpcursor.pos() - 1))) {
- tmpcursor.pos(tmpcursor.pos() - 1);
- } else if (!tmpcursor.pos()) {
- if (tmpcursor.par()->previous()){
- tmpcursor.par(tmpcursor.par()->previous());
- tmpcursor.pos(tmpcursor.par()->size());
- }
- } else { // Here, tmpcursor != 0
- while (tmpcursor.pos() > 0 &&
- tmpcursor.par()->isWord(tmpcursor.pos()-1) )
- tmpcursor.pos(tmpcursor.pos() - 1);
- }
+ cursorLeftOneWord(tmpcursor);
setCursor(bview, tmpcursor.par(), tmpcursor.pos());
}
+void LyXText::cursorLeftOneWord(LyXCursor & cur) const
+{
+ // treat HFills, floats and Insets as words
+ cur = cursor;
+ while (cur.pos()
+ && (cur.par()->isSeparator(cur.pos() - 1)
+ || cur.par()->isKomma(cur.pos() - 1))
+ && !(cur.par()->isHfill(cur.pos() - 1)
+ || cur.par()->isInset(cur.pos() - 1)))
+ cur.pos(cur.pos() - 1);
+
+ if (cur.pos()
+ && (cur.par()->isInset(cur.pos() - 1)
+ || cur.par()->isHfill(cur.pos() - 1))) {
+ cur.pos(cur.pos() - 1);
+ } else if (!cur.pos()) {
+ if (cur.par()->previous()){
+ cur.par(cur.par()->previous());
+ cur.pos(cur.par()->size());
+ }
+ } else { // Here, cur != 0
+ while (cur.pos() > 0 &&
+ cur.par()->isWord(cur.pos()-1) )
+ cur.pos(cur.pos() - 1);
+ }
+}
+
/* -------> Select current word. This depends on behaviour of CursorLeftOneWord(), so it is
patched as well. */
-void LyXText::selectWord(BufferView * bview)
+void LyXText::getWord(LyXCursor & from, LyXCursor & to, word_location loc) const
{
- // Move cursor to the beginning, when not already there.
- if (cursor.pos()
- && !cursor.par()->isSeparator(cursor.pos() - 1)
- && !cursor.par()->isKomma(cursor.pos() - 1))
- cursorLeftOneWord(bview);
+ // first put the cursor where we wana start to select the word
+ from = cursor;
+ switch(loc) {
+ case WHOLE_WORD:
+ // Move cursor to the beginning, when not already there.
+ if (from.pos() && !from.par()->isSeparator(from.pos() - 1)
+ && !from.par()->isKomma(from.pos() - 1))
+ cursorLeftOneWord(from);
+ break;
+ case NEXT_WORD:
+ lyxerr << "LyXText::getWord: NEXT_WORD not implemented yet\n";
+ break;
+ case PARTIAL_WORD:
+ break;
+ }
+ to = from;
+ while (to.pos() < to.par()->size()
+ && !to.par()->isSeparator(to.pos())
+ && !to.par()->isKomma(to.pos())
+ && !to.par()->isHfill(to.pos()) )
+ {
+ to.pos(to.pos() + 1);
+ }
+}
- // set the sel cursor
-#if 0
- sel_cursor = cursor;
-#else
+
+void LyXText::selectWord(BufferView * bview)
+{
+ LyXCursor from;
+ LyXCursor to;
+ getWord(from, to, WHOLE_WORD);
+ if (cursor != from)
+ setCursor(bview, from.par(), from.pos());
selection.cursor = cursor;
-#endif
-
- while (cursor.pos() < cursor.par()->size()
- && !cursor.par()->isSeparator(cursor.pos())
- && !cursor.par()->isKomma(cursor.pos()) )
- cursor.pos(cursor.pos() + 1);
- setCursor(bview, cursor.par(), cursor.pos() );
-
- // finally set the selection
+ setCursor(bview, to.par(), to.pos() );
setSelection(bview);
}
-
/* -------> Select the word currently under the cursor when:
1: no selection is currently set,
2: the cursor is not at the borders of the word. */
bool LyXText::selectWordWhenUnderCursor(BufferView * bview)
{
-#if 0
- if (!selection &&
-#else
- if (!selection.set() &&
-#endif
+ if (!selection.set() &&
cursor.pos() > 0 && cursor.pos() < cursor.par()->size()
&& !cursor.par()->isSeparator(cursor.pos())
&& !cursor.par()->isKomma(cursor.pos())
// Now, skip until we have real text (will jump paragraphs)
while ((cursor.par()->size() > cursor.pos()
&& (!cursor.par()->isLetter(cursor.pos())
+#ifndef NO_LATEX
|| cursor.par()->getFont(bview->buffer()->params, cursor.pos())
- .latex() == LyXFont::ON))
+ .latex() == LyXFont::ON
+#endif
+ ))
|| (cursor.par()->size() == cursor.pos()
&& cursor.par()->next())){
if (cursor.pos() == cursor.par()->size()) {
}
// Start the selection from here
-#if 0
- sel_cursor = cursor;
-#else
selection.cursor = cursor;
-#endif
std::ostringstream latex;
// Finally, we copy the word to a string and return it
string str;
-#if 0
- if (sel_cursor.pos() < cursor.pos()) {
- Paragraph::size_type i;
- for (i = sel_cursor.pos(); i < cursor.pos(); ++i) {
- if (cursor.par()->getChar(i) != Paragraph::META_INSET)
- str += cursor.par()->getChar(i);
- }
- }
-#else
if (selection.cursor.pos() < cursor.pos()) {
Paragraph::size_type i;
for (i = selection.cursor.pos(); i < cursor.pos(); ++i) {
str += cursor.par()->getChar(i);
}
}
-#endif
return str;
}
// This one is also only for the spellchecker
void LyXText::selectSelectedWord(BufferView * bview)
{
-#if 0
- // move cursor to the beginning
- setCursor(bview, sel_cursor.par(), sel_cursor.pos());
-
- // set the sel cursor
- sel_cursor = cursor;
-#else
// move cursor to the beginning
setCursor(bview, selection.cursor.par(), selection.cursor.pos());
// set the sel cursor
selection.cursor = cursor;
-#endif
std::ostringstream latex;
// now find the end of the word
else {
LyXCursor tmpcursor = cursor;
tmpcursor.row(0); // ??
-#if 0
- selection = true; // to avoid deletion
-#else
selection.set(true); // to avoid deletion
-#endif
cursorRightOneWord(bview);
setCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
-#if 0
- sel_cursor = cursor;
-#else
selection.cursor = cursor;
-#endif
cursor = tmpcursor;
setSelection(bview);
else {
LyXCursor tmpcursor = cursor;
tmpcursor.row(0); // ??
-#if 0
- selection = true; // to avoid deletion
-#else
selection.set(true); // to avoid deletion
-#endif
cursorLeftOneWord(bview);
setCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
-#if 0
- sel_cursor = cursor;
-#else
selection.cursor = cursor;
-#endif
cursor = tmpcursor;
setSelection(bview);
cutSelection(bview);
// We can't store the row over a regular setCursor
// so we set it to 0 and reset it afterwards.
tmpcursor.row(0); // ??
-#if 0
- selection = true; // to avoid deletion
-#else
selection.set(true); // to avoid deletion
-#endif
cursorEnd(bview);
setCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
-#if 0
- sel_cursor = cursor;
-#else
selection.cursor = cursor;
-#endif
cursor = tmpcursor;
setSelection(bview);
// What is this test for ??? (JMarc)
-#if 0
- if (!selection) {
-#else
- if (!selection.set()) {
-#endif
+ if (!selection.set()) {
deleteWordForward(bview);
} else {
cutSelection(bview);
// Paragraph, but it will have to change for 1.1 anyway. At least
// it does not access outside of the allocated array as the older
// version did. (JMarc)
-void LyXText::changeWordCase(BufferView * bview, LyXText::TextCase action)
+void LyXText::changeCase(BufferView * bview, LyXText::TextCase action)
{
- Paragraph * tmppar = cursor.par();
+ LyXCursor from;
+ LyXCursor to;
- setUndo(bview->buffer(),Undo::FINISH,
- tmppar->previous(), tmppar->next());
+ if (selection.set()) {
+ from = selection.cursor;
+ to = cursor;
+ } else {
+ getWord(from, to, PARTIAL_WORD);
+ setCursor(bview, to.par(), to.pos()+1);
+ }
- Paragraph::size_type tmppos = cursor.pos();
+ setUndo(bview->buffer(), Undo::FINISH,
+ from.par()->previous(), to.par()->next());
- while (tmppos < tmppar->size()) {
- unsigned char c = tmppar->getChar(tmppos);
- if (IsKommaChar(c) || IsLineSeparatorChar(c))
- break;
- if (c != Paragraph::META_INSET) {
+ while(from != to) {
+ unsigned char c = from.par()->getChar(from.pos());
+ if (!IsInsetChar(c) && !IsHfillChar(c)) {
switch (action) {
case text_lowercase:
c = tolower(c);
break;
}
}
-
- //tmppar->text[tmppos] = c;
- tmppar->setChar(tmppos, c);
- ++tmppos;
+ from.par()->setChar(from.pos(), c);
+ checkParagraph(bview, from.par(), from.pos());
+ from.pos(from.pos() + 1);
+ if (from.pos() >= from.par()->size()) {
+ from.par(from.par()->next());
+ from.pos(0);
+ }
+ }
+ if (to.row() != from.row()) {
+ refresh_y = from.y() - from.row()->baseline();
+ refresh_row = from.row();
+ status = LyXText::NEED_MORE_REFRESH;
}
- checkParagraph(bview, tmppar, tmppos);
- cursorRightOneWord(bview);
}
float last_tmpx = tmpx;
if (main_body > 0 &&
- (main_body-1 > last ||
+ (main_body - 1 > last ||
!row->par()->isLineSeparator(main_body - 1)))
main_body = 0;
++vc;
}
- if (1 || (tmpx + last_tmpx) / 2 > x) {
+ if ((tmpx + last_tmpx) / 2 > x) {
tmpx = last_tmpx;
left_side = true;
}
status = LyXText::UNCHANGED;
// set cursor at the very top position
-#if 0
- selection = true; /* these setting is necessary
- because of the delete-empty-
- paragraph mechanism in
- SetCursor */
-#else
selection.set(true); /* these setting is necessary
because of the delete-empty-
paragraph mechanism in
SetCursor */
-#endif
if (bv_owner) {
Paragraph * par = ownerParagraph();
current_font = getFont(bv_owner->buffer(), par, 0);
} else
current_font = LyXFont(LyXFont::ALL_SANE);
-#if 0
- sel_cursor = cursor;
- selection = false;
- mark_set = false;
-#else
selection.cursor = cursor;
selection.set(false);
selection.mark(false);
-#endif
// no rebreak necessary
need_break_row = 0;
par = par->next();
}
setCursorIntern(bview, firstrow->par(), 0);
-#if 0
- sel_cursor = cursor;
-#else
selection.cursor = cursor;
-#endif
#if 0
printf("TP = %x\n",inset_owner->owner());
// Dump all rowinformation:
// set layout over selection and make a total rebreak of those paragraphs
void LyXText::setLayout(BufferView * bview, LyXTextClass::size_type layout)
{
-#if 0
- LyXCursor tmpcursor = cursor; /* store the current cursor */
-
- // if there is no selection just set the layout
- // of the current paragraph */
- if (!selection) {
- sel_start_cursor = cursor; // dummy selection
- sel_end_cursor = cursor;
- }
- Paragraph *
- endpar = SetLayout(bview, cursor, sel_start_cursor,
- sel_end_cursor, layout);
- RedoParagraphs(bview, sel_start_cursor, endpar);
-
- // we have to reset the selection, because the
- // geometry could have changed
- SetCursor(bview, sel_start_cursor.par(),
- sel_start_cursor.pos(), false);
- sel_cursor = cursor;
- SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos(),
- false);
- UpdateCounters(bview, cursor.row());
- ClearSelection(bview);
- SetSelection(bview);
- SetCursor(bview, tmpcursor.par(), tmpcursor.pos(), true);
-#else
LyXCursor tmpcursor = cursor; /* store the current cursor */
// if there is no selection just set the layout
clearSelection(bview);
setSelection(bview);
setCursor(bview, tmpcursor.par(), tmpcursor.pos(), true);
-#endif
}
-#if 0
-// increment depth over selection and
-// make a total rebreak of those paragraphs
-void LyXText::IncDepth(BufferView * bview)
-{
- // If there is no selection, just use the current paragraph
- if (!selection) {
- sel_start_cursor = cursor; // dummy selection
- sel_end_cursor = cursor;
- }
-
- // We end at the next paragraph with depth 0
- Paragraph * endpar = sel_end_cursor.par()->next();
-
- Paragraph * undoendpar = endpar;
-
- if (endpar && endpar->getDepth()) {
- while (endpar && endpar->getDepth()) {
- endpar = endpar->next();
- undoendpar = endpar;
- }
- }
- else if (endpar) {
- endpar = endpar->next(); // because of parindents etc.
- }
-
- SetUndo(bview->buffer(), Undo::EDIT,
- sel_start_cursor.par()->previous(),
- undoendpar);
-
- LyXCursor tmpcursor = cursor; // store the current cursor
-
- // ok we have a selection. This is always between sel_start_cursor
- // and sel_end cursor
- cursor = sel_start_cursor;
-
- bool anything_changed = false;
-
- while (true) {
- // NOTE: you can't change the depth of a bibliography entry
- if (
- textclasslist.Style(bview->buffer()->params.textclass,
- cursor.par()->GetLayout()
- ).labeltype != LABEL_BIBLIO) {
- Paragraph * prev = cursor.par()->previous();
-
- if (prev
- && (prev->GetDepth() - cursor.par()->GetDepth() > 0
- || (prev->GetDepth() == cursor.par()->GetDepth()
- && textclasslist.Style(bview->buffer()->params.textclass,
- prev->GetLayout()).isEnvironment()))) {
- cursor.par()->params.depth(cursor.par()->params.depth() + 1);
- anything_changed = true;
- }
- }
- if (cursor.par() == sel_end_cursor.par())
- break;
- cursor.par(cursor.par()->next());
- }
-
- // if nothing changed set all depth to 0
- if (!anything_changed) {
- cursor = sel_start_cursor;
- while (cursor.par() != sel_end_cursor.par()) {
- cursor.par()->params.depth(0);
- cursor.par(cursor.par()->next());
- }
- cursor.par()->params.depth(0);
- }
-
- redoParagraphs(bview, sel_start_cursor, endpar);
-
- // we have to reset the selection, because the
- // geometry could have changed
- setCursor(bview, sel_start_cursor.par(),
- sel_start_cursor.pos());
- sel_cursor = cursor;
- setCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
- updateCounters(bview, cursor.row());
- clearSelection(bview);
- setSelection(bview);
- setCursor(bview, tmpcursor.par(), tmpcursor.pos());
-}
-#else
// increment depth over selection and
// make a total rebreak of those paragraphs
void LyXText::incDepth(BufferView * bview)
setSelection(bview);
setCursor(bview, tmpcursor.par(), tmpcursor.pos());
}
-#endif
// decrement depth over selection and
string::size_type const l = str.length();
for (string::size_type i = 0; i < l; ++i) {
- if (str[i] == '\"'
+ if (str[i] == '\"'
+#ifndef NO_LATEX
&& text->getFont(current_view->buffer(),text->cursor.par(),
text->cursor.pos()).latex() == LyXFont::OFF
+#endif
&& text->getFont(current_view->buffer(),text->cursor.par(),
text->cursor.pos()).language()->lang() != "hebrew")
current_view->insertCorrectQuote();