remove bogus backslashed from iso-8859-1, try to fix insert and encodeString, fixes in insetlatexaccent removed some unused code

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@383 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 1999-12-16 06:43:25 +00:00
parent c32b845a53
commit 7c6267e4b1
41 changed files with 2854 additions and 6987 deletions

View File

@ -1,3 +1,31 @@
1999-12-16 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/kbmap.C: commented out the use of the hash map in kb_map,
beginning of movement to a stl::container.
* several files: removed code that was not in effect when
MOVE_TEXT was defined.
* lib/kbd/iso8859-1.cdef: removed bogus backslashes. Backslashes
for escaping should not be used. We can discuss if the string
should be enclosed in f.ex. [] instead of "".
* src/trans_mgr.C (insert): use the new returned value from
encodeString to get deadkeys and keymaps done correctly.
* src/chset.C (encodeString): changed to return a pair, to tell
what to use if we know the string.
* src/lyxscreen.h (fillArc): new function.
* src/FontInfo.C (resize): rewritten to use more std::string like
structore, especially string::replace.
* src/insets/insetlatexaccent.C (Draw): use fillArc for the
approp. accents.
* configure.in (chmod +x some scripts): remove config/gcc-hack
1999-12-15 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr> 1999-12-15 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/buffer.C (writeFile): change once again the top comment in a * src/buffer.C (writeFile): change once again the top comment in a

View File

@ -24,8 +24,7 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
### Set the execute permissions of the various scripts correctly ### Set the execute permissions of the various scripts correctly
for file in config/install-sh config/mkinstalldirs config/hack-gcc \ for file in config/install-sh config/mkinstalldirs lib/configure ; do
lib/configure ; do
chmod 755 ${srcdir}/${file} chmod 755 ${srcdir}/${file}
done done

View File

@ -8,103 +8,96 @@
161 "!`" # mirrored ! 161 "!`" # mirrored !
#162 Cent sign? #162 Cent sign?
163 "\\pounds{}" # pound sign 163 "\pounds{}" # pound sign
#164 String sign? #164 String sign?
#165 Yen sign? #165 Yen sign?
#166 What's this? #166 What's this?
167 "\\S{}" # paragraph 167 "\S{}" # paragraph
168 "\\\"{}" # umlaut 168 "\"{}" # umlaut
169 "\\copyright{}" 169 "\copyright{}"
170 "\\b{a}" # a macron 170 "\b{a}" # a macron
171 "\\guillemotleft{}" 171 "\guillemotleft{}"
#172 What's this? #172 What's this?
#173 horiz. line? #173 horiz. line?
#174 Registered? #174 Registered?
#175 horiz. line at the top? #175 horiz. line at the top?
176 "\\b{}" # circle 176 "\b{}" # circle
#177 Plusminus? #177 Plusminus?
#178 ^2? #178 ^2?
#179 ^3? #179 ^3?
180 "\\'{}" # acute 180 "\'{}" # acute
181 "$\\mu$" # micro 181 "$\mu$" # micro
#182 Paragraph? #182 Paragraph?
183 "$\\cdot$" 183 "$\cdot$"
184 "\\c{}" # cedilla 184 "\c{}" # cedilla
185 "${^1}$" 185 "${^1}$"
186 "\\b{o}" # o macron 186 "\b{o}" # o macron
187 "\\guillemotright{}" 187 "\guillemotright{}"
188 "\\ensuremath{\frac14}" 188 "\ensuremath{\frac14}"
189 "\\ensuremath{\frac12}" 189 "\ensuremath{\frac12}"
190 "\\ensuremath{\frac34}" # "0BE 190 "\ensuremath{\frac34}" # "0BE
191 "?`" # mirrored ? 191 "?`" # mirrored ?
192 "\\`{A}" 192 "\`{A}"
193 "\\'{A}" 193 "\'{A}"
194 "\\^{A}" 194 "\^{A}"
195 "\\~{A}" 195 "\~{A}"
196 "\\\"{A}" 196 "\"{A}"
197 "\\AA{}" # A with circle 197 "\AA{}" # A with circle
198 "\\AE{}" # AE cat'ed together 198 "\AE{}" # AE cat'ed together
199 "\\c{C}" # C cedilla 199 "\c{C}" # C cedilla
200 "\\`{E}" 200 "\`{E}"
201 "\\'{E}" 201 "\'{E}"
202 "\\^{E}" 202 "\^{E}"
203 "\\\"{E}" 203 "\"{E}"
204 "\\`{I}" 204 "\`{I}"
205 "\\'{I}" 205 "\'{I}"
206 "\\^{I}" 206 "\^{I}"
207 "\\\"{I}" 207 "\"{I}"
208 "\\DH{}" 208 "\DH{}"
209 "\\~{N}" 209 "\~{N}"
210 "\\`{O}" 210 "\`{O}"
211 "\\'{O}" 211 "\'{O}"
212 "\\^{O}" 212 "\^{O}"
213 "\\~{O}" 213 "\~{O}"
214 "\\\"{O}" 214 "\"{O}"
215 "$\\times$" 215 "$\times$"
216 "\\O{}" 216 "\O{}"
217 "\\`{U}" 217 "\`{U}"
218 "\\'{U}" 218 "\'{U}"
219 "\\^{U}" 219 "\^{U}"
220 "\\\"{U}" 220 "\"{U}"
221 "\\'{Y}" 221 "\'{Y}"
222 "\\TH{}" 222 "\TH{}"
223 "\\ss{}" # German sharp S 223 "\ss{}" # German sharp S
224 "\\`{a}" 224 "\`{a}"
225 "\\'{a}" 225 "\'{a}"
226 "\\^{a}" 226 "\^{a}"
227 "\\~{a}" 227 "\~{a}"
228 "\\\"{a}" 228 "\"{a}"
229 "\\aa{}" # a with circle 229 "\aa{}" # a with circle
230 "\\ae{}" 230 "\ae{}"
231 "\\c{c}" # c cedilla 231 "\c{c}" # c cedilla
232 "\\`{e}" 232 "\`{e}"
233 "\\'{e}" 233 "\'{e}"
234 "\\^{e}" 234 "\^{e}"
235 "\\\"{e}" 235 "\\"{e}"
236 "\\`{\\i}" 236 "\`{\i}"
237 "\\'{\\i}" 237 "\'{\i}"
238 "\\^{\\i}" 238 "\^{\i}"
239 "\\\"{\\i}" 239 "\"{\i}"
240 "\\dh{}" 240 "\dh{}"
241 "\\~{n}" 241 "\~{n}"
242 "\\`{o}" 242 "\`{o}"
243 "\\'{o}" 243 "\'{o}"
244 "\\^{o}" 244 "\^{o}"
245 "\\~{o}" 245 "\~{o}"
246 "\\\"{o}" 246 "\"{o}"
247 "$\\div$" 247 "$\div$"
248 "\\o{}" 248 "\o{}"
249 "\\`{u}" 249 "\`{u}"
250 "\\'{u}" 250 "\'{u}"
251 "\\^{u}" 251 "\^{u}"
252 "\\\"{u}" 252 "\"{u}"
253 "\\'{y}" 253 "\'{y}"
254 "\\th{}" 254 "\th{}"
255 "\\\"{y}" 255 "\"{y}"

1156
po/lyx.pot

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,6 @@
#include "BackStack.h" #include "BackStack.h"
#include "lyxtext.h" #include "lyxtext.h"
#define MOVE_TEXT 1
class LyXView; class LyXView;
class Buffer; class Buffer;
@ -48,10 +47,8 @@ public:
void fitCursor(); void fitCursor();
/// ///
void update(); void update();
#ifdef MOVE_TEXT
/// ///
void update(signed char f); void update(signed char f);
#endif
/// ///
void updateScrollbar(); void updateScrollbar();
/// ///
@ -70,20 +67,18 @@ public:
LyXView * owner() const { return owner_; } LyXView * owner() const { return owner_; }
/// ///
LyXScreen * getScreen() LyXScreen * getScreen()
{ {
fl_set_timer(timer_cursor, 0.4); fl_set_timer(timer_cursor, 0.4);
return screen; return screen;
} }
/// ///
void savePosition(); void savePosition();
/// ///
void restorePosition(); void restorePosition();
#ifdef MOVE_TEXT
/** This holds the mapping between buffer paragraphs and screen rows. /** This holds the mapping between buffer paragraphs and screen rows.
This should be private...but not yet. (Lgb) This should be private...but not yet. (Lgb)
*/ */
LyXText * text; LyXText * text;
#endif
private: private:
/// Update pixmap of screen /// Update pixmap of screen
void updateScreen(); void updateScreen();

View File

@ -4,7 +4,7 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1997 Asger Alstrup * Copyright 1997 Asger Alstrup
* and the LyX Team. * and the LyX Team.
* *
* ====================================================== */ * ====================================================== */
@ -67,32 +67,30 @@ string FontInfo::getFontname(int size)
return strings[closestind]; return strings[closestind];
} }
/// Build newly sized font string /// Build newly sized font string
string FontInfo::resize(string const & font, int size) const { string FontInfo::resize(string const & font, int size) const
{
string ret(font);
// Find the position of the size spec // Find the position of the size spec
#ifdef WITH_WARNINGS int cut = 0;
#warning rewrite to use std::string constructs string::iterator before = 0;
#endif string::iterator after = 0;
int cut = 0, before = 0, after = 0; for (string::iterator sit = ret.begin();
for (string::size_type i = 0; i < font.length(); ++i) { sit != ret.end(); ++sit)
if (font[i] == '-') { if ((*sit) == '-') {
++cut; ++cut;
if (cut == 7) { if (cut == 7) before = sit + 1;
before = i; else if (cut == 8) {
} else if (cut == 8) { after = sit;
after = i;
break; break;
} }
} }
} ret.replace(before, after, tostr(size));
return ret;
string head = font;
head.erase(before + 1, string::npos);
string tail = font;
tail.erase(0, after);
return head + tostr(size) + tail;
} }
/// Set new pattern /// Set new pattern
void FontInfo::setPattern(string const & pat) void FontInfo::setPattern(string const & pat)
{ {
@ -101,6 +99,7 @@ void FontInfo::setPattern(string const & pat)
pattern = pat; pattern = pat;
} }
/// Query font in X11 /// Query font in X11
void FontInfo::query() void FontInfo::query()
{ {
@ -108,7 +107,8 @@ void FontInfo::query()
return; return;
if (pattern.empty()) { if (pattern.empty()) {
lyxerr << "Can not use empty font name for font query." << endl; lyxerr << "Can not use empty font name for font query."
<< endl;
queried = true; queried = true;
return; return;
} }
@ -141,6 +141,7 @@ void FontInfo::query()
queried = true; queried = true;
} }
/// Release allocated stuff /// Release allocated stuff
void FontInfo::release() void FontInfo::release()
{ {

View File

@ -19,7 +19,7 @@
#include "gettext.h" #include "gettext.h"
#include "support/lstrings.h" #include "support/lstrings.h"
/* /*
NAMING RULES FOR USER-COMMANDS NAMING RULES FOR USER-COMMANDS
Here's the set of rules to apply when a new command name is introduced: Here's the set of rules to apply when a new command name is introduced:
@ -71,281 +71,300 @@ void LyXAction::init()
if (init) return; if (init) return;
lfun_item items[] = { lfun_item items[] = {
{ LFUN_ACUTE, "accent-acute", "", Noop }, { LFUN_ACUTE, "accent-acute", "", Noop },
{ LFUN_BREVE, "accent-breve", "", Noop }, { LFUN_BREVE, "accent-breve", "", Noop },
{ LFUN_CARON, "accent-caron", "", Noop }, { LFUN_CARON, "accent-caron", "", Noop },
{ LFUN_CEDILLA, "accent-cedilla", "", Noop }, { LFUN_CEDILLA, "accent-cedilla", "", Noop },
{ LFUN_CIRCLE, "accent-circle", "", Noop }, { LFUN_CIRCLE, "accent-circle", "", Noop },
{ LFUN_CIRCUMFLEX, "accent-circumflex", "", Noop }, { LFUN_CIRCUMFLEX, "accent-circumflex", "", Noop },
{ LFUN_DOT, "accent-dot", "", Noop }, { LFUN_DOT, "accent-dot", "", Noop },
{ LFUN_GRAVE, "accent-grave", "", Noop }, { LFUN_GRAVE, "accent-grave", "", Noop },
{ LFUN_HUNG_UMLAUT, "accent-hungarian-umlaut", "", Noop }, { LFUN_HUNG_UMLAUT, "accent-hungarian-umlaut", "", Noop },
{ LFUN_MACRON, "accent-macron", "", Noop }, { LFUN_MACRON, "accent-macron", "", Noop },
{ LFUN_OGONEK, "accent-ogonek", "", Noop }, { LFUN_OGONEK, "accent-ogonek", "", Noop },
{ LFUN_SPECIAL_CARON, "accent-special-caron", "", Noop }, { LFUN_SPECIAL_CARON, "accent-special-caron", "", Noop },
{ LFUN_TIE, "accent-tie", "", Noop }, { LFUN_TIE, "accent-tie", "", Noop },
{ LFUN_TILDE, "accent-tilde", "", Noop }, { LFUN_TILDE, "accent-tilde", "", Noop },
{ LFUN_UMLAUT, "accent-umlaut", "", Noop }, { LFUN_UMLAUT, "accent-umlaut", "", Noop },
{ LFUN_UNDERBAR, "accent-underbar", "", Noop }, { LFUN_UNDERBAR, "accent-underbar", "", Noop },
{ LFUN_UNDERDOT, "accent-underdot", "", Noop }, { LFUN_UNDERDOT, "accent-underdot", "", Noop },
{ LFUN_VECTOR, "accent-vector", "", Noop }, { LFUN_VECTOR, "accent-vector", "", Noop },
{ LFUN_APPENDIX, "appendix", N_("Insert appendix"), Noop }, { LFUN_APPENDIX, "appendix", N_("Insert appendix"), Noop },
{ LFUN_APROPOS, "apropos", N_("Describe command"), NoBuffer|ReadOnly }, { LFUN_APROPOS, "apropos", N_("Describe command"),
{ LFUN_LEFTSEL, "backward-select", NoBuffer|ReadOnly },
N_("Select previous char"), ReadOnly }, { LFUN_LEFTSEL, "backward-select",
{ LFUN_BIBDB_ADD, "bibtex-database-add", "", Noop }, N_("Select previous char"), ReadOnly },
{ LFUN_BIBDB_DEL, "bibtex-database-del", "", Noop }, { LFUN_BIBDB_ADD, "bibtex-database-add", "", Noop },
{ LFUN_INSERT_BIBTEX, "bibtex-insert", N_("Insert bibtex"), Noop }, { LFUN_BIBDB_DEL, "bibtex-database-del", "", Noop },
{ LFUN_BIBTEX_STYLE, "bibtex-style", "", Noop }, { LFUN_INSERT_BIBTEX, "bibtex-insert", N_("Insert bibtex"),
{ LFUN_BREAKLINE, "break-line", "", Noop }, Noop },
{ LFUN_BREAKPARAGRAPH, "break-paragraph", "", Noop }, { LFUN_BIBTEX_STYLE, "bibtex-style", "", Noop },
{ LFUN_BREAKPARAGRAPHKEEPLAYOUT, "break-paragraph-keep-layout", { LFUN_BREAKLINE, "break-line", "", Noop },
"", Noop }, { LFUN_BREAKPARAGRAPH, "break-paragraph", "", Noop },
{ LFUN_BREAKPARAGRAPH_SKIP, "break-paragraph-skip", "", Noop }, { LFUN_BREAKPARAGRAPHKEEPLAYOUT, "break-paragraph-keep-layout",
{ LFUN_BUILDPROG, "build-program", _("Build program"), Noop }, "", Noop },
{ LFUN_AUTOSAVE, "buffer-auto-save", N_("Autosave"), Noop }, { LFUN_BREAKPARAGRAPH_SKIP, "break-paragraph-skip", "", Noop },
{ LFUN_BEGINNINGBUF, "buffer-begin", { LFUN_BUILDPROG, "build-program", _("Build program"), Noop },
N_("Go to beginning of document"), ReadOnly }, { LFUN_AUTOSAVE, "buffer-auto-save", N_("Autosave"), Noop },
{ LFUN_BEGINNINGBUFSEL, "buffer-begin-select", { LFUN_BEGINNINGBUF, "buffer-begin",
N_("Select to beginning of document"), ReadOnly }, N_("Go to beginning of document"), ReadOnly },
{ LFUN_CHILDINSERT, "buffer-child-insert", "", Noop }, { LFUN_BEGINNINGBUFSEL, "buffer-begin-select",
{ LFUN_CHILDOPEN, "buffer-child-open", "", ReadOnly }, N_("Select to beginning of document"), ReadOnly },
{ LFUN_RUNCHKTEX, "buffer-chktex", N_("Check TeX"), ReadOnly }, { LFUN_CHILDINSERT, "buffer-child-insert", "", Noop },
{ LFUN_CLOSEBUFFER, "buffer-close", N_("Close"), ReadOnly }, { LFUN_CHILDOPEN, "buffer-child-open", "", ReadOnly },
{ LFUN_ENDBUF, "buffer-end", { LFUN_RUNCHKTEX, "buffer-chktex", N_("Check TeX"), ReadOnly },
N_("Go to end of document"), ReadOnly }, { LFUN_CLOSEBUFFER, "buffer-close", N_("Close"), ReadOnly },
{ LFUN_ENDBUFSEL, "buffer-end-select", { LFUN_ENDBUF, "buffer-end",
N_("Select to end of document"), ReadOnly }, N_("Go to end of document"), ReadOnly },
{ LFUN_EXPORT, "buffer-export", N_("Export to"), ReadOnly }, { LFUN_ENDBUFSEL, "buffer-end-select",
{ LFUN_FAX, "buffer-fax", N_("Fax"), ReadOnly }, N_("Select to end of document"), ReadOnly },
{ LFUN_INSERTFOOTNOTE, "buffer-float-insert", "", Noop }, { LFUN_EXPORT, "buffer-export", N_("Export to"), ReadOnly },
{ LFUN_IMPORT, "buffer-import", { LFUN_FAX, "buffer-fax", N_("Fax"), ReadOnly },
N_("Import document"), NoBuffer }, { LFUN_INSERTFOOTNOTE, "buffer-float-insert", "", Noop },
{ LFUN_BUFFERBULLETSSELECT, "buffer-itemize-bullets-select", { LFUN_IMPORT, "buffer-import",
"", Noop }, N_("Import document"), NoBuffer },
{ LFUN_MENUNEW, "buffer-new", N_("New document") , NoBuffer }, { LFUN_BUFFERBULLETSSELECT, "buffer-itemize-bullets-select",
{ LFUN_MENUNEWTMPLT,"buffer-new-template", "", Noop },
N_("New document from template"), NoBuffer }, { LFUN_MENUNEW, "buffer-new", N_("New document") , NoBuffer },
{ LFUN_MENUOPEN, "buffer-open", N_("Open"), NoBuffer }, { LFUN_MENUNEWTMPLT,"buffer-new-template",
{ LFUN_PREVBUFFER, "buffer-previous", N_("New document from template"), NoBuffer },
N_("Switch to previous document"), ReadOnly }, { LFUN_MENUOPEN, "buffer-open", N_("Open"), NoBuffer },
{ LFUN_MENUPRINT, "buffer-print", N_("Print"), ReadOnly }, { LFUN_PREVBUFFER, "buffer-previous",
{ LFUN_MENURELOAD, "buffer-reload", N_("Switch to previous document"), ReadOnly },
N_("Revert to saved"), ReadOnly }, { LFUN_MENUPRINT, "buffer-print", N_("Print"), ReadOnly },
{ LFUN_READ_ONLY_TOGGLE, "buffer-toggle-read-only", { LFUN_MENURELOAD, "buffer-reload",
N_("Toggle read-only"), ReadOnly }, N_("Revert to saved"), ReadOnly },
{ LFUN_RUNLATEX, "buffer-typeset", N_("Update DVI"), ReadOnly }, { LFUN_READ_ONLY_TOGGLE, "buffer-toggle-read-only",
{ LFUN_RUNDVIPS, "buffer-typeset-ps", N_("Toggle read-only"), ReadOnly },
N_("Update PostScript"), ReadOnly }, { LFUN_RUNLATEX, "buffer-typeset", N_("Update DVI"),
{ LFUN_PREVIEW, "buffer-view", N_("View DVI") , ReadOnly }, ReadOnly },
{ LFUN_PREVIEWPS, "buffer-view-ps", { LFUN_RUNDVIPS, "buffer-typeset-ps",
N_("View PostScript") , ReadOnly }, N_("Update PostScript"), ReadOnly },
{ LFUN_MENUWRITE, "buffer-write", N_("Save"), ReadOnly }, { LFUN_PREVIEW, "buffer-view", N_("View DVI") , ReadOnly },
{ LFUN_MENUWRITEAS, "buffer-write-as", N_("Save As"), ReadOnly }, { LFUN_PREVIEWPS, "buffer-view-ps",
{ LFUN_CANCEL, "cancel", N_("Cancel"), NoBuffer }, N_("View PostScript") , ReadOnly },
{ LFUN_LEFT, "char-backward", N_("Go one char back"), ReadOnly }, { LFUN_MENUWRITE, "buffer-write", N_("Save"), ReadOnly },
{ LFUN_RIGHT, "char-forward", N_("Go one char forward"), ReadOnly }, { LFUN_MENUWRITEAS, "buffer-write-as", N_("Save As"),
{ LFUN_INSERT_CITATION, "citation-insert", ReadOnly },
N_("Insert citation"), Noop }, { LFUN_CANCEL, "cancel", N_("Cancel"), NoBuffer },
{ LFUN_EXEC_COMMAND, "command-execute", "", NoBuffer }, { LFUN_LEFT, "char-backward", N_("Go one char back"),
{ LFUN_PREFIX, "command-prefix", ReadOnly },
N_("Execute command"), NoBuffer }, { LFUN_RIGHT, "char-forward", N_("Go one char forward"),
{ LFUN_SEQUENCE, "command-sequence", "", Noop }, ReadOnly },
{ LFUN_COPY, "copy", N_("Copy"), ReadOnly }, { LFUN_INSERT_CITATION, "citation-insert",
{ LFUN_CUT, "cut", N_("Cut"), Noop }, N_("Insert citation"), Noop },
{ LFUN_BACKSPACE, "delete-backward", "", Noop }, { LFUN_EXEC_COMMAND, "command-execute", "", NoBuffer },
{ LFUN_BACKSPACE_SKIP, "delete-backward-skip", "", Noop }, { LFUN_PREFIX, "command-prefix",
{ LFUN_DELETE, "delete-forward", "", Noop }, N_("Execute command"), NoBuffer },
{ LFUN_DELETE_SKIP, "delete-forward-skip", "", Noop }, { LFUN_SEQUENCE, "command-sequence", "", Noop },
{ LFUN_DEPTH_MIN, "depth-decrement", { LFUN_COPY, "copy", N_("Copy"), ReadOnly },
N_("Decrement environment depth"), Noop }, { LFUN_CUT, "cut", N_("Cut"), Noop },
{ LFUN_DEPTH_PLUS, "depth-increment", { LFUN_BACKSPACE, "delete-backward", "", Noop },
N_("Increment environment depth"), Noop }, { LFUN_BACKSPACE_SKIP, "delete-backward-skip", "", Noop },
{ LFUN_DEPTH, "depth-next", { LFUN_DELETE, "delete-forward", "", Noop },
N_("Change environment depth"), Noop }, { LFUN_DELETE_SKIP, "delete-forward-skip", "", Noop },
{ LFUN_LDOTS, "dots-insert", N_("Insert ... dots"), Noop }, { LFUN_DEPTH_MIN, "depth-decrement",
{ LFUN_DOWN, "down", N_("Go down"), ReadOnly }, N_("Decrement environment depth"), Noop },
{ LFUN_DOWNSEL, "down-select", { LFUN_DEPTH_PLUS, "depth-increment",
N_("Select next line"), ReadOnly }, N_("Increment environment depth"), Noop },
{ LFUN_DROP_LAYOUTS_CHOICE, "drop-layouts-choice", { LFUN_DEPTH, "depth-next",
N_("Choose Paragraph Environment"), ReadOnly }, N_("Change environment depth"), Noop },
{ LFUN_END_OF_SENTENCE, "end-of-sentence-period-insert", { LFUN_LDOTS, "dots-insert", N_("Insert ... dots"), Noop },
N_("Insert end of sentence period"), Noop }, { LFUN_DOWN, "down", N_("Go down"), ReadOnly },
{ LFUN_GOTOERROR, "error-next", N_("Go to next error"), Noop }, { LFUN_DOWNSEL, "down-select",
{ LFUN_REMOVEERRORS, "error-remove-all", N_("Select next line"), ReadOnly },
N_("Remove all error boxes"), ReadOnly }, { LFUN_DROP_LAYOUTS_CHOICE, "drop-layouts-choice",
{ LFUN_FIGURE, "figure-insert", N_("Insert Figure"), Noop }, N_("Choose Paragraph Environment"), ReadOnly },
{ LFUN_FILE_INSERT, "file-insert", "", Noop }, { LFUN_END_OF_SENTENCE, "end-of-sentence-period-insert",
{ LFUN_FILE_INSERT_ASCII, "file-insert-ascii", "", Noop }, N_("Insert end of sentence period"), Noop },
{ LFUN_FILE_NEW, "file-new", "", NoBuffer }, { LFUN_GOTOERROR, "error-next", N_("Go to next error"), Noop },
{ LFUN_FILE_OPEN, "file-open", "", NoBuffer }, { LFUN_REMOVEERRORS, "error-remove-all",
{ LFUN_MENUSEARCH, "find-replace", N_("Find & Replace") , Noop }, N_("Remove all error boxes"), ReadOnly },
{ LFUN_BOLD, "font-bold", N_("Toggle bold"), Noop }, { LFUN_FIGURE, "figure-insert", N_("Insert Figure"), Noop },
{ LFUN_CODE, "font-code", N_("Toggle code style"), Noop }, { LFUN_FILE_INSERT, "file-insert", "", Noop },
{ LFUN_DEFAULT, "font-default", N_("Default font style"), Noop }, { LFUN_FILE_INSERT_ASCII, "file-insert-ascii", "", Noop },
{ LFUN_EMPH, "font-emph", N_("Toggle emphasize"), Noop }, { LFUN_FILE_NEW, "file-new", "", NoBuffer },
{ LFUN_FREE, "font-free", N_("Toggle user defined style"), Noop }, { LFUN_FILE_OPEN, "file-open", "", NoBuffer },
{ LFUN_NOUN, "font-noun", N_("Toggle noun style"), Noop }, { LFUN_MENUSEARCH, "find-replace", N_("Find & Replace"),
{ LFUN_ROMAN, "font-roman", N_("Toggle roman font style"), Noop }, Noop },
{ LFUN_SANS, "font-sans", N_("Toggle sans font style"), Noop }, { LFUN_BOLD, "font-bold", N_("Toggle bold"), Noop },
{ LFUN_FONT_SIZE, "font-size", N_("Set font size"), Noop }, { LFUN_CODE, "font-code", N_("Toggle code style"), Noop },
{ LFUN_FONT_STATE, "font-state", N_("Show font state"), ReadOnly }, { LFUN_DEFAULT, "font-default", N_("Default font style"),
{ LFUN_UNDERLINE, "font-underline", Noop },
N_("Toggle font underline"), Noop }, { LFUN_EMPH, "font-emph", N_("Toggle emphasize"), Noop },
{ LFUN_FOOTMELT, "footnote-insert", N_("Insert Footnote"), Noop }, { LFUN_FREE, "font-free", N_("Toggle user defined style"),
{ LFUN_RIGHTSEL, "forward-select", N_("Select next char"), ReadOnly }, Noop },
{ LFUN_HFILL, "hfill-insert", { LFUN_NOUN, "font-noun", N_("Toggle noun style"), Noop },
N_("Insert horizontal fill"), Noop }, { LFUN_ROMAN, "font-roman", N_("Toggle roman font style"),
{ LFUN_HTMLURL, "html-insert", "", Noop }, Noop },
{ LFUN_HYPHENATION, "hyphenation-point-insert", { LFUN_SANS, "font-sans", N_("Toggle sans font style"), Noop },
N_("Insert hyphenation point"), Noop }, { LFUN_FONT_SIZE, "font-size", N_("Set font size"), Noop },
{ LFUN_INDEX_INSERT, "index-insert", { LFUN_FONT_STATE, "font-state", N_("Show font state"),
N_("Insert index item"), Noop }, ReadOnly },
{ LFUN_INDEX_INSERT_LAST, "index-insert-last", { LFUN_UNDERLINE, "font-underline",
N_("Insert last index item"), Noop }, N_("Toggle font underline"), Noop },
{ LFUN_INDEX_PRINT, "index-print", N_("Insert index list"), Noop }, { LFUN_FOOTMELT, "footnote-insert", N_("Insert Footnote"),
{ LFUN_KMAP_OFF, "keymap-off", N_("Turn off keymap"), ReadOnly }, Noop },
{ LFUN_KMAP_PRIM, "keymap-primary", { LFUN_RIGHTSEL, "forward-select", N_("Select next char"),
N_("Use primary keymap"), ReadOnly }, ReadOnly },
{ LFUN_KMAP_SEC, "keymap-secondary", { LFUN_HFILL, "hfill-insert",
N_("Use secondary keymap"), ReadOnly }, N_("Insert horizontal fill"), Noop },
{ LFUN_KMAP_TOGGLE, "keymap-toggle", N_("Toggle keymap"), ReadOnly }, { LFUN_HTMLURL, "html-insert", "", Noop },
{ LFUN_INSERT_LABEL, "label-insert", N_("Insert Label"), Noop }, { LFUN_HYPHENATION, "hyphenation-point-insert",
{ LFUN_LATEX_LOG, "latex-view-log", N_("View LaTeX log"), ReadOnly }, N_("Insert hyphenation point"), Noop },
{ LFUN_LAYOUT, "layout", "", Noop }, { LFUN_INDEX_INSERT, "index-insert",
{ LFUN_LAYOUT_CHARACTER, "layout-character", "", Noop }, N_("Insert index item"), Noop },
{ LFUN_LAYOUT_COPY, "layout-copy", { LFUN_INDEX_INSERT_LAST, "index-insert-last",
N_("Copy paragraph environment type"), Noop }, N_("Insert last index item"), Noop },
{ LFUN_LAYOUT_DOCUMENT, "layout-document", "", ReadOnly }, { LFUN_INDEX_PRINT, "index-print", N_("Insert index list"),
{ LFUN_LAYOUTNO, "layout-number", "", Noop }, // internal only Noop },
{ LFUN_LAYOUT_PARAGRAPH, "layout-paragraph", "", ReadOnly }, { LFUN_KMAP_OFF, "keymap-off", N_("Turn off keymap"),
{ LFUN_LAYOUT_PAPER, "layout-paper", "", ReadOnly }, ReadOnly },
{ LFUN_LAYOUT_PASTE, "layout-paste", { LFUN_KMAP_PRIM, "keymap-primary",
N_("Paste paragraph environment type"), Noop }, N_("Use primary keymap"), ReadOnly },
{ LFUN_LAYOUT_PREAMBLE, "layout-preamble", "", ReadOnly }, { LFUN_KMAP_SEC, "keymap-secondary",
{ LFUN_LAYOUT_QUOTES, "layout-quotes", "", ReadOnly }, N_("Use secondary keymap"), ReadOnly },
{ LFUN_LAYOUT_SAVE_DEFAULT, "layout-save-default", "", ReadOnly }, { LFUN_KMAP_TOGGLE, "keymap-toggle", N_("Toggle keymap"),
{ LFUN_LAYOUT_TABLE, "layout-table", "", Noop }, ReadOnly },
{ LFUN_HOME, "line-begin", { LFUN_INSERT_LABEL, "label-insert", N_("Insert Label"),
N_("Go to beginning of line"), ReadOnly }, Noop },
{ LFUN_HOMESEL, "line-begin-select", { LFUN_LATEX_LOG, "latex-view-log", N_("View LaTeX log"),
N_("Select to beginning of line"), ReadOnly }, ReadOnly },
{ LFUN_DELETE_LINE_FORWARD, "line-delete-forward", "", Noop }, { LFUN_LAYOUT, "layout", "", Noop },
{ LFUN_END, "line-end", N_("Go to end of line"), ReadOnly }, { LFUN_LAYOUT_CHARACTER, "layout-character", "", Noop },
{ LFUN_ENDSEL, "line-end-select", { LFUN_LAYOUT_COPY, "layout-copy",
N_("Select to end of line"), ReadOnly }, N_("Copy paragraph environment type"), Noop },
{ LFUN_LOA_INSERT, "loa-insert", { LFUN_LAYOUT_DOCUMENT, "layout-document", "", ReadOnly },
N_("Insert list of algorithms"), Noop }, { LFUN_LAYOUTNO, "layout-number", "", Noop }, // internal only
{ LFUN_LOF_INSERT, "lof-insert", { LFUN_LAYOUT_PARAGRAPH, "layout-paragraph", "", ReadOnly },
N_("Insert list of figures"), Noop }, { LFUN_LAYOUT_PAPER, "layout-paper", "", ReadOnly },
{ LFUN_LOT_INSERT, "lot-insert", { LFUN_LAYOUT_PASTE, "layout-paste",
N_("Insert list of tables"), Noop }, N_("Paste paragraph environment type"), Noop },
{ LFUN_QUIT, "lyx-quit", N_("Exit"), NoBuffer }, { LFUN_LAYOUT_PREAMBLE, "layout-preamble", "", ReadOnly },
{ LFUN_MARGINMELT, "marginpar-insert", { LFUN_LAYOUT_QUOTES, "layout-quotes", "", ReadOnly },
N_("Insert Margin note"), Noop }, { LFUN_LAYOUT_SAVE_DEFAULT, "layout-save-default", "",
{ LFUN_MARK_OFF, "mark-off", "", ReadOnly }, ReadOnly },
{ LFUN_MARK_ON, "mark-on", "", ReadOnly }, { LFUN_LAYOUT_TABLE, "layout-table", "", Noop },
{ LFUN_SETMARK, "mark-toggle", "", ReadOnly }, { LFUN_HOME, "line-begin",
{ LFUN_MATH_DELIM, "math-delim", "", Noop }, N_("Go to beginning of line"), ReadOnly },
{ LFUN_MATH_DISPLAY, "math-display", "", Noop }, { LFUN_HOMESEL, "line-begin-select",
{ LFUN_GREEK, "math-greek", N_("Math Greek"), Noop }, N_("Select to beginning of line"), ReadOnly },
{ LFUN_GREEK_TOGGLE, "math-greek-toggle", "", Noop }, { LFUN_DELETE_LINE_FORWARD, "line-delete-forward", "", Noop },
{ LFUN_INSERT_MATH, "math-insert", { LFUN_END, "line-end", N_("Go to end of line"), ReadOnly },
N_("Insert math symbol"), Noop }, { LFUN_ENDSEL, "line-end-select",
{ LFUN_MATH_LIMITS, "math-limits", "", Noop }, N_("Select to end of line"), ReadOnly },
{ LFUN_MATH_MACRO, "math-macro", "", Noop }, { LFUN_LOA_INSERT, "loa-insert",
{ LFUN_MATH_MACROARG, "math-macro-arg", "", Noop }, N_("Insert list of algorithms"), Noop },
{ LFUN_INSERT_MATRIX, "math-matrix", "", Noop }, { LFUN_LOF_INSERT, "lof-insert",
{ LFUN_MATH_MODE, "math-mode", N_("Math mode"), Noop }, N_("Insert list of figures"), Noop },
{ LFUN_MATH_NONUMBER, "math-nonumber", "", Noop }, { LFUN_LOT_INSERT, "lot-insert",
{ LFUN_MATH_NUMBER, "math-number", "", Noop }, N_("Insert list of tables"), Noop },
{ LFUN_MATH_SIZE, "math-size", "", Noop }, { LFUN_QUIT, "lyx-quit", N_("Exit"), NoBuffer },
{ LFUN_MELT, "melt", N_("Melt"), Noop }, { LFUN_MARGINMELT, "marginpar-insert",
{ LFUN_MENU_OPEN_BY_NAME, "menu-open", "", NoBuffer }, N_("Insert Margin note"), Noop },
{ LFUN_MENU_SEPARATOR, "menu-separator-insert", "", Noop }, { LFUN_MARK_OFF, "mark-off", "", ReadOnly },
{ LFUN_META_FAKE, "meta-prefix", "", NoBuffer }, { LFUN_MARK_ON, "mark-on", "", ReadOnly },
{ LFUN_INSERT_NOTE, "note-insert", "", Noop }, { LFUN_SETMARK, "mark-toggle", "", ReadOnly },
{ LFUN_GOTONOTE, "note-next", "", ReadOnly }, { LFUN_MATH_DELIM, "math-delim", "", Noop },
{ LFUN_OPENSTUFF, "open-stuff", "", ReadOnly }, { LFUN_MATH_DISPLAY, "math-display", "", Noop },
{ LFUN_DOWN_PARAGRAPH, "paragraph-down", { LFUN_GREEK, "math-greek", N_("Math Greek"), Noop },
N_("Go one paragraph down"), ReadOnly }, { LFUN_GREEK_TOGGLE, "math-greek-toggle", "", Noop },
{ LFUN_DOWN_PARAGRAPHSEL, "paragraph-down-select", { LFUN_INSERT_MATH, "math-insert",
N_("Select next paragraph"), ReadOnly }, N_("Insert math symbol"), Noop },
{ LFUN_UP_PARAGRAPH, "paragraph-up", { LFUN_MATH_LIMITS, "math-limits", "", Noop },
N_("Go one paragraph up"), ReadOnly }, { LFUN_MATH_MACRO, "math-macro", "", Noop },
{ LFUN_UP_PARAGRAPHSEL, "paragraph-up-select", { LFUN_MATH_MACROARG, "math-macro-arg", "", Noop },
N_("Select previous paragraph"), ReadOnly }, { LFUN_INSERT_MATRIX, "math-matrix", "", Noop },
{ LFUN_PARENTINSERT, "parent-insert", "", Noop }, { LFUN_MATH_MODE, "math-mode", N_("Math mode"), Noop },
{ LFUN_PASTE, "paste", N_("Paste") , Noop }, { LFUN_MATH_NONUMBER, "math-nonumber", "", Noop },
{ LFUN_SAVEPREFERENCES, "preferences-save", { LFUN_MATH_NUMBER, "math-number", "", Noop },
"Save Preferences", NoBuffer }, { LFUN_MATH_SIZE, "math-size", "", Noop },
{ LFUN_PASTESELECTION, "primary-selection-paste", "", Noop }, { LFUN_MELT, "melt", N_("Melt"), Noop },
{ LFUN_PROTECTEDSPACE, "protected-space-insert", { LFUN_MENU_OPEN_BY_NAME, "menu-open", "", NoBuffer },
N_("Insert protected space"), Noop }, { LFUN_MENU_SEPARATOR, "menu-separator-insert", "", Noop },
{ LFUN_QUOTE, "quote-insert", N_("Insert quote"), Noop }, { LFUN_META_FAKE, "meta-prefix", "", NoBuffer },
{ LFUN_RECONFIGURE, "reconfigure", { LFUN_INSERT_NOTE, "note-insert", "", Noop },
N_("Reconfigure"), NoBuffer }, { LFUN_GOTONOTE, "note-next", "", ReadOnly },
{ LFUN_REDO, "redo", N_("Redo"), Noop }, { LFUN_OPENSTUFF, "open-stuff", "", ReadOnly },
{ LFUN_REFBACK, "reference-back", "", ReadOnly }, { LFUN_DOWN_PARAGRAPH, "paragraph-down",
{ LFUN_REFGOTO, "reference-goto", "", ReadOnly }, N_("Go one paragraph down"), ReadOnly },
{ LFUN_INSERT_REF, "reference-insert", { LFUN_DOWN_PARAGRAPHSEL, "paragraph-down-select",
N_("Insert cross reference"), Noop }, N_("Select next paragraph"), ReadOnly },
{ LFUN_REFTOGGLE, "reference-toggle", "", Noop }, { LFUN_UP_PARAGRAPH, "paragraph-up",
{ LFUN_NEXT, "screen-down", "", ReadOnly }, N_("Go one paragraph up"), ReadOnly },
{ LFUN_NEXTSEL, "screen-down-select", "", ReadOnly }, { LFUN_UP_PARAGRAPHSEL, "paragraph-up-select",
{ LFUN_CENTER, "screen-recenter", "", ReadOnly }, N_("Select previous paragraph"), ReadOnly },
{ LFUN_PRIOR, "screen-up", "", ReadOnly }, { LFUN_PARENTINSERT, "parent-insert", "", Noop },
{ LFUN_PRIORSEL, "screen-up-select", "", ReadOnly }, { LFUN_PASTE, "paste", N_("Paste") , Noop },
{ LFUN_SELFINSERT, "self-insert", "", Noop }, { LFUN_SAVEPREFERENCES, "preferences-save",
{ LFUN_CHARATCURSOR, "server-char-after", "", ReadOnly }, "Save Preferences", NoBuffer },
{ LFUN_GETFONT, "server-get-font", "", ReadOnly }, { LFUN_PASTESELECTION, "primary-selection-paste", "", Noop },
{ LFUN_GETLATEX, "server-get-latex", "", ReadOnly }, { LFUN_PROTECTEDSPACE, "protected-space-insert",
{ LFUN_GETLAYOUT, "server-get-layout", "", ReadOnly }, N_("Insert protected space"), Noop },
{ LFUN_GETNAME, "server-get-name", "", ReadOnly }, { LFUN_QUOTE, "quote-insert", N_("Insert quote"), Noop },
{ LFUN_GETTIP, "server-get-tip", "", ReadOnly }, { LFUN_RECONFIGURE, "reconfigure",
{ LFUN_GETXY, "server-get-xy", "", ReadOnly }, N_("Reconfigure"), NoBuffer },
{ LFUN_GOTOFILEROW, "server-goto-file-row", "", Noop }, { LFUN_REDO, "redo", N_("Redo"), Noop },
{ LFUN_NOTIFY, "server-notify", "", ReadOnly }, { LFUN_REFBACK, "reference-back", "", ReadOnly },
{ LFUN_SETXY, "server-set-xy", "", ReadOnly }, { LFUN_REFGOTO, "reference-goto", "", ReadOnly },
{ LFUN_SPELLCHECK, "spellchecker", "", Noop }, { LFUN_INSERT_REF, "reference-insert",
{ LFUN_INSERT_MATH, "symbol-insert", "", Noop }, N_("Insert cross reference"), Noop },
{ LFUN_TAB, "tab-forward", "", Noop }, { LFUN_REFTOGGLE, "reference-toggle", "", Noop },
{ LFUN_TABINSERT, "tab-insert", "", Noop }, { LFUN_NEXT, "screen-down", "", ReadOnly },
{ LFUN_TABLE, "table-insert", N_("Insert Table"), Noop }, { LFUN_NEXTSEL, "screen-down-select", "", ReadOnly },
{ LFUN_TEX, "tex-mode", N_("Toggle TeX style"), Noop }, { LFUN_CENTER, "screen-recenter", "", ReadOnly },
{ LFUN_TOC_INSERT, "toc-insert", { LFUN_PRIOR, "screen-up", "", ReadOnly },
N_("Insert table of contents"), Noop }, { LFUN_PRIORSEL, "screen-up-select", "", ReadOnly },
{ LFUN_TOCVIEW, "toc-view", { LFUN_SELFINSERT, "self-insert", "", Noop },
N_("View table of contents"), ReadOnly }, { LFUN_CHARATCURSOR, "server-char-after", "", ReadOnly },
{ LFUN_TOGGLECURSORFOLLOW, "toggle-cursor-follows-scrollbar", { LFUN_GETFONT, "server-get-font", "", ReadOnly },
N_("Toggle cursor does/doesn't follow the scrollbar"), { LFUN_GETLATEX, "server-get-latex", "", ReadOnly },
ReadOnly }, { LFUN_GETLAYOUT, "server-get-layout", "", ReadOnly },
{ LFUN_ADD_TO_TOOLBAR, "toolbar-add-to", "", NoBuffer }, { LFUN_GETNAME, "server-get-name", "", ReadOnly },
{ LFUN_PUSH_TOOLBAR, "toolbar-push", "", NoBuffer }, { LFUN_GETTIP, "server-get-tip", "", ReadOnly },
{ LFUN_UNDO, "undo", N_("Undo"), Noop }, { LFUN_GETXY, "server-get-xy", "", ReadOnly },
{ LFUN_UP, "up", "", ReadOnly }, { LFUN_GOTOFILEROW, "server-goto-file-row", "", Noop },
{ LFUN_UPSEL, "up-select", "", ReadOnly }, { LFUN_NOTIFY, "server-notify", "", ReadOnly },
{ LFUN_URL, "url-insert", "", Noop }, { LFUN_SETXY, "server-set-xy", "", ReadOnly },
{ LFUN_VC_CHECKIN, "vc-check-in", "", ReadOnly }, { LFUN_SPELLCHECK, "spellchecker", "", Noop },
{ LFUN_VC_CHECKOUT, "vc-check-out", "", ReadOnly }, { LFUN_INSERT_MATH, "symbol-insert", "", Noop },
{ LFUN_VC_HISTORY, "vc-history", "", ReadOnly }, { LFUN_TAB, "tab-forward", "", Noop },
{ LFUN_VC_REGISTER, "vc-register", { LFUN_TABINSERT, "tab-insert", "", Noop },
N_("Register document under version control"), ReadOnly }, { LFUN_TABLE, "table-insert", N_("Insert Table"), Noop },
{ LFUN_VC_REVERT, "vc-revert", "", ReadOnly }, { LFUN_TEX, "tex-mode", N_("Toggle TeX style"), Noop },
{ LFUN_VC_UNDO, "vc-undo-last", "", ReadOnly }, { LFUN_TOC_INSERT, "toc-insert",
{ LFUN_WORDLEFT, "word-backward", "", ReadOnly }, N_("Insert table of contents"), Noop },
{ LFUN_WORDLEFTSEL, "word-backward-select", "", ReadOnly }, { LFUN_TOCVIEW, "toc-view",
{ LFUN_CAPITALIZE_WORD, "word-capitalize", "", Noop }, N_("View table of contents"), ReadOnly },
{ LFUN_DELETE_WORD_BACKWARD, "word-delete-backward", { LFUN_TOGGLECURSORFOLLOW, "toggle-cursor-follows-scrollbar",
"", Noop }, N_("Toggle cursor does/doesn't follow the scrollbar"),
{ LFUN_DELETE_WORD_FORWARD, "word-delete-forward", "", Noop }, ReadOnly },
{ LFUN_WORDFINDBACKWARD, "word-find-backward", "", ReadOnly }, { LFUN_ADD_TO_TOOLBAR, "toolbar-add-to", "", NoBuffer },
{ LFUN_WORDFINDFORWARD, "word-find-forward", "", ReadOnly }, { LFUN_PUSH_TOOLBAR, "toolbar-push", "", NoBuffer },
{ LFUN_WORDRIGHT, "word-forward", "", ReadOnly }, { LFUN_UNDO, "undo", N_("Undo"), Noop },
{ LFUN_WORDRIGHTSEL, "word-forward-select", "", ReadOnly }, { LFUN_UP, "up", "", ReadOnly },
{ LFUN_LOWCASE_WORD, "word-lowcase", "", Noop }, { LFUN_UPSEL, "up-select", "", ReadOnly },
{ LFUN_UPCASE_WORD, "word-upcase", "", Noop }, { LFUN_URL, "url-insert", "", Noop },
{ LFUN_NOACTION, "", "", Noop } { LFUN_VC_CHECKIN, "vc-check-in", "", ReadOnly },
{ LFUN_VC_CHECKOUT, "vc-check-out", "", ReadOnly },
{ LFUN_VC_HISTORY, "vc-history", "", ReadOnly },
{ LFUN_VC_REGISTER, "vc-register",
N_("Register document under version control"), ReadOnly },
{ LFUN_VC_REVERT, "vc-revert", "", ReadOnly },
{ LFUN_VC_UNDO, "vc-undo-last", "", ReadOnly },
{ LFUN_WORDLEFT, "word-backward", "", ReadOnly },
{ LFUN_WORDLEFTSEL, "word-backward-select", "", ReadOnly },
{ LFUN_CAPITALIZE_WORD, "word-capitalize", "", Noop },
{ LFUN_DELETE_WORD_BACKWARD, "word-delete-backward",
"", Noop },
{ LFUN_DELETE_WORD_FORWARD, "word-delete-forward", "", Noop },
{ LFUN_WORDFINDBACKWARD, "word-find-backward", "", ReadOnly },
{ LFUN_WORDFINDFORWARD, "word-find-forward", "", ReadOnly },
{ LFUN_WORDRIGHT, "word-forward", "", ReadOnly },
{ LFUN_WORDRIGHTSEL, "word-forward-select", "", ReadOnly },
{ LFUN_LOWCASE_WORD, "word-lowcase", "", Noop },
{ LFUN_UPCASE_WORD, "word-upcase", "", Noop },
{ LFUN_NOACTION, "", "", Noop }
}; };
int i = 0; int i = 0;
@ -376,7 +395,8 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const
if (pit == lyx_arg_map.end()) { if (pit == lyx_arg_map.end()) {
// the action does not have any pseudoactions // the action does not have any pseudoactions
lyxerr[Debug::ACTION] << "Action " << action lyxerr[Debug::ACTION] << "Action " << action
<< " does not have any pseudo actions.\n"; << " does not have any pseudo actions."
<< endl;
return LFUN_UNKNOWN_ACTION; return LFUN_UNKNOWN_ACTION;
} }
@ -387,14 +407,14 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const
lyxerr[Debug::ACTION] lyxerr[Debug::ACTION]
<< "Action " << action << "Action " << action
<< "does not have any pseudoactions with arg " << "does not have any pseudoactions with arg "
<< arg << '\n'; << arg << endl;
return LFUN_UNKNOWN_ACTION; return LFUN_UNKNOWN_ACTION;
} }
// pseudo action exist // pseudo action exist
lyxerr[Debug::ACTION] << "Pseudoaction exist[" lyxerr[Debug::ACTION] << "Pseudoaction exist["
<< action << '|' << action << '|'
<< arg << "] = " << (*aci).second << '\n'; << arg << "] = " << (*aci).second << endl;
return (*aci).second; return (*aci).second;
} }
@ -423,8 +443,8 @@ int LyXAction::getPseudoAction(kb_action action, string const & arg) const
(*ami).second[arg] = pseudo_counter; (*ami).second[arg] = pseudo_counter;
lyxerr[Debug::ACTION] << "Creating new pseudoaction " lyxerr[Debug::ACTION] << "Creating new pseudoaction "
<< pseudo_counter << " for [" << action << pseudo_counter << " for [" << action
<< '|' << arg << "]\n"; << '|' << arg << "]\n";
return pseudo_counter; return pseudo_counter;
} }
@ -438,8 +458,8 @@ kb_action LyXAction::retrieveActionArg(int pseudo, string & arg) const
if (pit != lyx_pseudo_map.end()) { if (pit != lyx_pseudo_map.end()) {
lyxerr[Debug::ACTION] << "Found the pseudoaction: [" lyxerr[Debug::ACTION] << "Found the pseudoaction: ["
<< (*pit).second.action << '|' << (*pit).second.action << '|'
<< (*pit).second.arg << '\n'; << (*pit).second.arg << '\n';
arg = (*pit).second.arg; arg = (*pit).second.arg;
return (*pit).second.action; return (*pit).second.action;
} else { } else {
@ -509,17 +529,18 @@ int LyXAction::getApproxFunc(string const & func) const
string LyXAction::getApproxFuncName(string const & func) const string LyXAction::getApproxFuncName(string const & func) const
{ {
int f = getApproxFunc(func); int f = getApproxFunc(func);
// This will return empty string if f isn't an action. // This will return empty string if f isn't an action.
return getActionName(f); return getActionName(f);
} }
string LyXAction::getActionName(int action) const string LyXAction::getActionName(int action) const
{ {
info_map::const_iterator iit = lyx_info_map.find(static_cast<kb_action>(action)); info_map::const_iterator iit =
lyx_info_map.find(static_cast<kb_action>(action));
return iit != lyx_info_map.end() ? (*iit).second.name : string(); return iit != lyx_info_map.end() ? (*iit).second.name : string();
} }
@ -565,15 +586,15 @@ string LyXAction::helpText(int pseudoaction) const
bool LyXAction::funcHasFlag(kb_action action, bool LyXAction::funcHasFlag(kb_action action,
LyXAction::func_attrib flag) const LyXAction::func_attrib flag) const
{ {
info_map::const_iterator ici = lyx_info_map.find(action); info_map::const_iterator ici = lyx_info_map.find(action);
if (ici != lyx_info_map.end()) { if (ici != lyx_info_map.end()) {
return (*ici).second.attrib & flag; return (*ici).second.attrib & flag;
} else { } else {
// it really should exist, but... // it really should exist, but...
lyxerr << "No info about kb_action: " << action << '\n'; lyxerr << "No info about kb_action: " << action << '\n';
return false; return false;
} }
} }

View File

@ -33,10 +33,10 @@
extern FD_form_document * fd_form_document; extern FD_form_document * fd_form_document;
FD_form_main * fd_form_main; /* a pointer to the one in LyXView FD_form_main * fd_form_main; /* a pointer to the one in LyXView
should be removed as soon as possible */ should be removed as soon as possible */
MiniBuffer * minibuffer;/* a pointer to the one in LyXView MiniBuffer * minibuffer;/* a pointer to the one in LyXView
should be removed as soon as possible */ should be removed as soon as possible */
extern void AutoSave(); extern void AutoSave();
extern char updatetimer; extern char updatetimer;
@ -68,6 +68,7 @@ LyXView::~LyXView()
delete intl; delete intl;
} }
/// Redraw the main form. /// Redraw the main form.
void LyXView::redraw() { void LyXView::redraw() {
lyxerr[Debug::INFO] << "LyXView::redraw()" << endl; lyxerr[Debug::INFO] << "LyXView::redraw()" << endl;
@ -86,23 +87,21 @@ void LyXView::UpdateTimerCB(FL_OBJECT * ob, long)
return; return;
view->view()->getScreen()->HideCursor(); view->view()->getScreen()->HideCursor();
#ifdef MOVE_TEXT
view->view()->update(-2); view->view()->update(-2);
#else
view->buffer()->update(-2);
#endif
/* This update can happen, even when the work area has lost /* This update can happen, even when the work area has lost
* the focus. So suppress the cursor in that case */ * the focus. So suppress the cursor in that case */
updatetimer = 0; updatetimer = 0;
} }
// Wrapper for the above // Wrapper for the above
extern "C" void C_LyXView_UpdateTimerCB(FL_OBJECT * ob, long data) { extern "C" void C_LyXView_UpdateTimerCB(FL_OBJECT * ob, long data)
{
LyXView::UpdateTimerCB(ob, data); LyXView::UpdateTimerCB(ob, data);
} }
// Callback for autosave timer // Callback for autosave timer
void LyXView::AutosaveTimerCB(FL_OBJECT *, long) void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
{ {
@ -110,8 +109,10 @@ void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
AutoSave(); AutoSave();
} }
// Wrapper for the above // Wrapper for the above
extern "C" void C_LyXView_AutosaveTimerCB(FL_OBJECT * ob, long data) { extern "C" void C_LyXView_AutosaveTimerCB(FL_OBJECT * ob, long data)
{
LyXView::AutosaveTimerCB(ob, data); LyXView::AutosaveTimerCB(ob, data);
} }
@ -133,7 +134,8 @@ int LyXView::atCloseMainFormCB(FL_FORM *, void *)
// Wrapper for the above // Wrapper for the above
extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM * form, void * p) { extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM * form, void * p)
{
return LyXView::atCloseMainFormCB(form, p); return LyXView::atCloseMainFormCB(form, p);
} }
@ -209,10 +211,9 @@ FD_form_main * LyXView::create_form_form_main(int width, int height)
// //
minibuffer = new MiniBuffer(this, air, height-(25+air), minibuffer = new MiniBuffer(this, air, height-(25+air),
width-(2*air), 25); width-(2*air), 25);
::minibuffer = minibuffer; // to be removed later ::minibuffer = minibuffer; // to be removed later
// //
// TIMERS // TIMERS
// //
@ -253,6 +254,7 @@ FD_form_main * LyXView::create_form_form_main(int width, int height)
return fdui; return fdui;
} }
extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev); extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev);
void LyXView::init() void LyXView::init()
@ -300,7 +302,7 @@ void LyXView::updateLayoutChoice()
toolbar->combox->clear(); toolbar->combox->clear();
for (int i = 0; for (int i = 0;
textclasslist.NameOfLayout(buffer()-> textclasslist.NameOfLayout(buffer()->
params.textclass, i) != "@@end@@"; params.textclass, i) != "@@end@@";
i++) { i++) {
LyXLayout const & layout = textclasslist. LyXLayout const & layout = textclasslist.
Style(buffer()->params.textclass, i); Style(buffer()->params.textclass, i);
@ -315,11 +317,7 @@ void LyXView::updateLayoutChoice()
// we need to do this. // we need to do this.
toolbar->combox->Redraw(); toolbar->combox->Redraw();
#ifdef MOVE_TEXT
char layout = bufferview->text->cursor.par->GetLayout(); char layout = bufferview->text->cursor.par->GetLayout();
#else
char layout = buffer()->text->cursor.par->GetLayout();
#endif
if (layout != current_layout){ if (layout != current_layout){
toolbar->combox->select(layout + 1); toolbar->combox->select(layout + 1);
@ -331,10 +329,10 @@ void LyXView::updateLayoutChoice()
void LyXView::UpdateDocumentClassChoice() void LyXView::UpdateDocumentClassChoice()
{ {
// update the document class display in the document form // update the document class display in the document form
int i;
if (fd_form_document) { if (fd_form_document) {
fl_clear_choice(fd_form_document->choice_class); fl_clear_choice(fd_form_document->choice_class);
for (i = 0; textclasslist.DescOfClass (i)!= "@@end@@"; i++) { for (int i = 0;
textclasslist.DescOfClass(i) != "@@end@@"; ++i) {
fl_addto_choice(fd_form_document->choice_class, fl_addto_choice(fd_form_document->choice_class,
textclasslist.DescOfClass(i).c_str()); textclasslist.DescOfClass(i).c_str());
} }
@ -344,7 +342,7 @@ void LyXView::UpdateDocumentClassChoice()
// This is necessary, since FL_FREE-Objects doesn't get all keypress events // This is necessary, since FL_FREE-Objects doesn't get all keypress events
// as FL_KEYBOARD events :-( Matthias 280596 // as FL_KEYBOARD events :-( Matthias 280596
int LyXView::KeyPressMask_raw_callback(FL_FORM *fl, void *xev) int LyXView::KeyPressMask_raw_callback(FL_FORM * fl, void * xev)
{ {
LyXView * view = static_cast<LyXView*>(fl->u_vdata); LyXView * view = static_cast<LyXView*>(fl->u_vdata);
int retval = 0; // 0 means XForms should have a look at this event int retval = 0; // 0 means XForms should have a look at this event
@ -360,14 +358,17 @@ int LyXView::KeyPressMask_raw_callback(FL_FORM *fl, void *xev)
return retval; return retval;
} }
// wrapper for the above // wrapper for the above
extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev) extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev)
{ {
return LyXView::KeyPressMask_raw_callback(fl, xev); return LyXView::KeyPressMask_raw_callback(fl, xev);
} }
// Updates the title of the window with the filename of the current document // Updates the title of the window with the filename of the current document
void LyXView::updateWindowTitle() { void LyXView::updateWindowTitle()
{
static string last_title = "LyX"; static string last_title = "LyX";
string title = "LyX"; string title = "LyX";

View File

@ -50,7 +50,6 @@ lyx_SOURCES = \
bibforms.h \ bibforms.h \
bmtable.C \ bmtable.C \
bmtable.h \ bmtable.h \
broken_const.h \
broken_headers.h \ broken_headers.h \
buffer.C \ buffer.C \
buffer.h \ buffer.h \

View File

@ -73,254 +73,242 @@ inline void EnableParagraphExtra ()
bool UpdateParagraphExtra() bool UpdateParagraphExtra()
{ {
bool update = false; bool update = false;
if (current_view->getScreen() && current_view->available()) { if (current_view->getScreen() && current_view->available()) {
update = true; update = true;
#ifdef MOVE_TEXT LyXParagraph * par = current_view->text->cursor.par;
LyXParagraph * par = current_view->text->cursor.par;
#else
LyXParagraph * par = current_view->buffer()->text->cursor.par;
#endif
EnableParagraphExtra(); EnableParagraphExtra();
fl_activate_object(fd_form_paragraph_extra->input_pextra_width); fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp); fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
fl_set_input(fd_form_paragraph_extra->input_pextra_width, fl_set_input(fd_form_paragraph_extra->input_pextra_width,
par->pextra_width.c_str()); par->pextra_width.c_str());
fl_set_input(fd_form_paragraph_extra->input_pextra_widthp, fl_set_input(fd_form_paragraph_extra->input_pextra_widthp,
par->pextra_widthp.c_str()); par->pextra_widthp.c_str());
switch(par->pextra_alignment) { switch(par->pextra_alignment) {
case LyXParagraph::MINIPAGE_ALIGN_TOP: case LyXParagraph::MINIPAGE_ALIGN_TOP:
fl_set_button(fd_form_paragraph_extra->radio_pextra_top, 1); fl_set_button(fd_form_paragraph_extra->radio_pextra_top, 1);
break; break;
case LyXParagraph::MINIPAGE_ALIGN_MIDDLE: case LyXParagraph::MINIPAGE_ALIGN_MIDDLE:
fl_set_button(fd_form_paragraph_extra->radio_pextra_middle, 1); fl_set_button(fd_form_paragraph_extra->radio_pextra_middle, 1);
break; break;
case LyXParagraph::MINIPAGE_ALIGN_BOTTOM: case LyXParagraph::MINIPAGE_ALIGN_BOTTOM:
fl_set_button(fd_form_paragraph_extra->radio_pextra_bottom, 1); fl_set_button(fd_form_paragraph_extra->radio_pextra_bottom, 1);
break; break;
} }
fl_set_button(fd_form_paragraph_extra->radio_pextra_hfill, fl_set_button(fd_form_paragraph_extra->radio_pextra_hfill,
par->pextra_hfill); par->pextra_hfill);
fl_set_button(fd_form_paragraph_extra->radio_pextra_startmp, fl_set_button(fd_form_paragraph_extra->radio_pextra_startmp,
par->pextra_start_minipage); par->pextra_start_minipage);
CheckInputWidth(); CheckInputWidth();
if (par->pextra_type == LyXParagraph::PEXTRA_INDENT) { if (par->pextra_type == LyXParagraph::PEXTRA_INDENT) {
fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 1); fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 1);
fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0); fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0);
fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0); fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
} else if (par->pextra_type == LyXParagraph::PEXTRA_MINIPAGE) { } else if (par->pextra_type == LyXParagraph::PEXTRA_MINIPAGE) {
fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0); fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0);
fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 1); fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 1);
fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0); fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0);
fl_activate_object(fd_form_paragraph_extra->radio_pextra_top); fl_activate_object(fd_form_paragraph_extra->radio_pextra_top);
fl_activate_object(fd_form_paragraph_extra->radio_pextra_middle); fl_activate_object(fd_form_paragraph_extra->radio_pextra_middle);
fl_activate_object(fd_form_paragraph_extra->radio_pextra_bottom); fl_activate_object(fd_form_paragraph_extra->radio_pextra_bottom);
} else if (par->pextra_type == LyXParagraph::PEXTRA_FLOATFLT) { } else if (par->pextra_type == LyXParagraph::PEXTRA_FLOATFLT) {
fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0); fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0);
fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0); fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0);
fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 1); fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 1);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
} else { } else {
fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0); fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0);
fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0); fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0);
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width); fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp); fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
} }
if (par->pextra_type == LyXParagraph::PEXTRA_NONE) if (par->pextra_type == LyXParagraph::PEXTRA_NONE)
ActivateParagraphExtraButtons(); ActivateParagraphExtraButtons();
} }
fl_hide_object(fd_form_paragraph_extra->text_warning); fl_hide_object(fd_form_paragraph_extra->text_warning);
if (current_view->buffer()->isReadonly()) { if (current_view->buffer()->isReadonly()) {
DisableParagraphExtra(); DisableParagraphExtra();
fl_set_object_label(fd_form_paragraph_extra->text_warning, fl_set_object_label(fd_form_paragraph_extra->text_warning,
_("Document is read-only. " _("Document is read-only. "
"No changes to layout permitted.")); "No changes to layout permitted."));
fl_show_object(fd_form_paragraph_extra->text_warning); fl_show_object(fd_form_paragraph_extra->text_warning);
} }
if (!update && fd_form_paragraph_extra->form_paragraph_extra->visible) { if (!update && fd_form_paragraph_extra->form_paragraph_extra->visible) {
fl_hide_form(fd_form_paragraph_extra->form_paragraph_extra); fl_hide_form(fd_form_paragraph_extra->form_paragraph_extra);
} }
return update; return update;
} }
void ParagraphExtraOpen(FL_OBJECT *, long) void ParagraphExtraOpen(FL_OBJECT *, long)
{ {
if (UpdateParagraphExtra()) { if (UpdateParagraphExtra()) {
if (fd_form_paragraph_extra->form_paragraph_extra->visible) { if (fd_form_paragraph_extra->form_paragraph_extra->visible) {
fl_raise_form(fd_form_paragraph_extra->form_paragraph_extra); fl_raise_form(fd_form_paragraph_extra->form_paragraph_extra);
} else { } else {
fl_show_form(fd_form_paragraph_extra->form_paragraph_extra, fl_show_form(fd_form_paragraph_extra->form_paragraph_extra,
FL_PLACE_MOUSE, FL_FULLBORDER, FL_PLACE_MOUSE, FL_FULLBORDER,
_("ParagraphExtra Layout")); _("ParagraphExtra Layout"));
} }
} }
} }
void ParagraphExtraApplyCB(FL_OBJECT *, long) void ParagraphExtraApplyCB(FL_OBJECT *, long)
{ {
if (current_view->getScreen() && current_view->available()) { if (current_view->getScreen() && current_view->available()) {
FD_form_paragraph_extra const * fd = fd_form_paragraph_extra; FD_form_paragraph_extra const * fd = fd_form_paragraph_extra;
char const * width = fl_get_input(fd->input_pextra_width); char const * width = fl_get_input(fd->input_pextra_width);
char const * widthp = fl_get_input(fd->input_pextra_widthp); char const * widthp = fl_get_input(fd->input_pextra_widthp);
#ifdef MOVE_TEXT LyXText * text = current_view->text;
LyXText * text = current_view->text; int type = LyXParagraph::PEXTRA_NONE;
#else LyXParagraph::MINIPAGE_ALIGNMENT alignment =
LyXText * text = current_view->buffer()->text; LyXParagraph::MINIPAGE_ALIGN_TOP;
#endif bool
int type = LyXParagraph::PEXTRA_NONE; hfill = false,
LyXParagraph::MINIPAGE_ALIGNMENT alignment = start_minipage = false;
LyXParagraph::MINIPAGE_ALIGN_TOP;
bool
hfill = false,
start_minipage = false;
if (fl_get_button(fd_form_paragraph_extra->radio_pextra_indent)) { if (fl_get_button(fd_form_paragraph_extra->radio_pextra_indent)) {
type = LyXParagraph::PEXTRA_INDENT; type = LyXParagraph::PEXTRA_INDENT;
} else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_minipage)) { } else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_minipage)) {
type = LyXParagraph::PEXTRA_MINIPAGE; type = LyXParagraph::PEXTRA_MINIPAGE;
hfill = fl_get_button(fd_form_paragraph_extra->radio_pextra_hfill); hfill = fl_get_button(fd_form_paragraph_extra->radio_pextra_hfill);
start_minipage = start_minipage =
fl_get_button(fd_form_paragraph_extra->radio_pextra_startmp); fl_get_button(fd_form_paragraph_extra->radio_pextra_startmp);
if (fl_get_button(fd_form_paragraph_extra->radio_pextra_top)) if (fl_get_button(fd_form_paragraph_extra->radio_pextra_top))
alignment = LyXParagraph::MINIPAGE_ALIGN_TOP; alignment = LyXParagraph::MINIPAGE_ALIGN_TOP;
else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_middle)) else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_middle))
alignment = LyXParagraph::MINIPAGE_ALIGN_MIDDLE; alignment = LyXParagraph::MINIPAGE_ALIGN_MIDDLE;
else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_bottom)) else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_bottom))
alignment = LyXParagraph::MINIPAGE_ALIGN_BOTTOM; alignment = LyXParagraph::MINIPAGE_ALIGN_BOTTOM;
} else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_floatflt)) { } else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_floatflt)) {
type = LyXParagraph::PEXTRA_FLOATFLT; type = LyXParagraph::PEXTRA_FLOATFLT;
} }
text->SetParagraphExtraOpt(type, width, widthp, alignment, hfill, text->SetParagraphExtraOpt(type, width, widthp, alignment, hfill,
start_minipage); start_minipage);
#ifdef MOVE_TEXT current_view->update(1);
current_view->update(1); minibuffer->Set(_("ParagraphExtra layout set"));
#else }
current_view->buffer()->update(1); return;
#endif
minibuffer->Set(_("ParagraphExtra layout set"));
}
return;
} }
void ParagraphExtraCancelCB(FL_OBJECT *, long) void ParagraphExtraCancelCB(FL_OBJECT *, long)
{ {
fl_hide_form(fd_form_paragraph_extra->form_paragraph_extra); fl_hide_form(fd_form_paragraph_extra->form_paragraph_extra);
} }
void ParagraphExtraOKCB(FL_OBJECT * ob, long data) void ParagraphExtraOKCB(FL_OBJECT * ob, long data)
{ {
ParagraphExtraCancelCB(ob, data); ParagraphExtraCancelCB(ob, data);
ParagraphExtraApplyCB(ob, data); ParagraphExtraApplyCB(ob, data);
} }
void CheckPExtraOptCB(FL_OBJECT * ob, long) void CheckPExtraOptCB(FL_OBJECT * ob, long)
{ {
ActivateParagraphExtraButtons(); ActivateParagraphExtraButtons();
CheckInputWidth(); CheckInputWidth();
if (ob == fd_form_paragraph_extra->radio_pextra_indent) { if (ob == fd_form_paragraph_extra->radio_pextra_indent) {
int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_indent); int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_indent);
if (n) { if (n) {
fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0); fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0);
fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0); fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0);
fl_activate_object(fd_form_paragraph_extra->input_pextra_width); fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp); fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
} else { } else {
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width); fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp); fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
ActivateParagraphExtraButtons(); ActivateParagraphExtraButtons();
} }
} else if (ob == fd_form_paragraph_extra->radio_pextra_minipage) { } else if (ob == fd_form_paragraph_extra->radio_pextra_minipage) {
int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_minipage); int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_minipage);
if (n) { if (n) {
fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0); fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0);
fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0); fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0);
fl_activate_object(fd_form_paragraph_extra->input_pextra_width); fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp); fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
fl_activate_object(fd_form_paragraph_extra->radio_pextra_top); fl_activate_object(fd_form_paragraph_extra->radio_pextra_top);
fl_activate_object(fd_form_paragraph_extra->radio_pextra_middle); fl_activate_object(fd_form_paragraph_extra->radio_pextra_middle);
fl_activate_object(fd_form_paragraph_extra->radio_pextra_bottom); fl_activate_object(fd_form_paragraph_extra->radio_pextra_bottom);
} else { } else {
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width); fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp); fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
ActivateParagraphExtraButtons(); ActivateParagraphExtraButtons();
} }
} else if (ob == fd_form_paragraph_extra->radio_pextra_floatflt) { } else if (ob == fd_form_paragraph_extra->radio_pextra_floatflt) {
int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_floatflt); int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_floatflt);
if (n) { if (n) {
fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0); fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0);
fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0); fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0);
fl_activate_object(fd_form_paragraph_extra->input_pextra_width); fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp); fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
fl_activate_object(fd_form_paragraph_extra->radio_pextra_top); fl_activate_object(fd_form_paragraph_extra->radio_pextra_top);
fl_activate_object(fd_form_paragraph_extra->radio_pextra_middle); fl_activate_object(fd_form_paragraph_extra->radio_pextra_middle);
fl_activate_object(fd_form_paragraph_extra->radio_pextra_bottom); fl_activate_object(fd_form_paragraph_extra->radio_pextra_bottom);
} else { } else {
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width); fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp); fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
ActivateParagraphExtraButtons(); ActivateParagraphExtraButtons();
} }
} }
return; return;
} }
static bool CheckInputWidth() static bool CheckInputWidth()
{ {
string s1 = fl_get_input(fd_form_paragraph_extra->input_pextra_width); string s1 = fl_get_input(fd_form_paragraph_extra->input_pextra_width);
string s2 = fl_get_input(fd_form_paragraph_extra->input_pextra_widthp); string s2 = fl_get_input(fd_form_paragraph_extra->input_pextra_widthp);
if (s1.empty() && s2.empty()) { if (s1.empty() && s2.empty()) {
fl_activate_object(fd_form_paragraph_extra->input_pextra_width); fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp); fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
fl_hide_object(fd_form_paragraph_extra->text_warning); fl_hide_object(fd_form_paragraph_extra->text_warning);
DeactivateParagraphExtraButtons(); DeactivateParagraphExtraButtons();
return false; return false;
} }
if (!s1.empty()) { // LyXLength parameter if (!s1.empty()) { // LyXLength parameter
fl_activate_object(fd_form_paragraph_extra->input_pextra_width); fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp); fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
if (!isValidLength(s1)) { if (!isValidLength(s1)) {
DeactivateParagraphExtraButtons(); DeactivateParagraphExtraButtons();
fl_set_object_label(fd_form_paragraph_extra->text_warning, fl_set_object_label(fd_form_paragraph_extra->text_warning,
_("Warning: Invalid Length (valid example: 10mm)")); _("Warning: Invalid Length (valid example: 10mm)"));
fl_show_object(fd_form_paragraph_extra->text_warning); fl_show_object(fd_form_paragraph_extra->text_warning);
return false; return false;
} }
} else { // !s2.empty() % parameter } else { // !s2.empty() % parameter
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width); fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp); fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
if ((atoi(s2.c_str()) < 0 ) || (atoi(s2.c_str()) > 100)) { if ((atoi(s2.c_str()) < 0 ) || (atoi(s2.c_str()) > 100)) {
DeactivateParagraphExtraButtons(); DeactivateParagraphExtraButtons();
fl_set_object_label(fd_form_paragraph_extra->text_warning, fl_set_object_label(fd_form_paragraph_extra->text_warning,
_("Warning: Invalid percent value (0-100)")); _("Warning: Invalid percent value (0-100)"));
fl_show_object(fd_form_paragraph_extra->text_warning); fl_show_object(fd_form_paragraph_extra->text_warning);
return false; return false;
} }
} }
fl_hide_object(fd_form_paragraph_extra->text_warning); fl_hide_object(fd_form_paragraph_extra->text_warning);
return true; return true;
} }

View File

@ -28,15 +28,16 @@ static int Confirmed = false;
static int ActCell; static int ActCell;
// hack to keep the cursor from jumping to the end of the text in the Extra // hack to keep the cursor from jumping to the end of the text in the Extra
// form input fields during editing. The values in LyXTable itself is changed in // form input fields during editing. The values in LyXTable itself is
// real-time, but we have no callbacks for the input fields, so I simply // changed in real-time, but we have no callbacks for the input fields,
// store and restore the cursor position for now. (too much of a hazzle to // so I simply store and restore the cursor position for now.
// do it proper; we'll trash all this code in 1.1 anyway) // (too much of a hazzle to do it proper; we'll trash all this code
// in 1.1 anyway)
static int extra_col_cursor_x; // need no y's, one-line input fields static int extra_col_cursor_x; // need no y's, one-line input fields
static int extra_multicol_cursor_x; static int extra_multicol_cursor_x;
// Joacim // Joacim
#ifdef MOVE_TEXT
bool UpdateLayoutTable(int flag) bool UpdateLayoutTable(int flag)
{ {
bool update = true; bool update = true;
@ -219,190 +220,7 @@ bool UpdateLayoutTable(int flag)
} }
return update; return update;
} }
#else
bool UpdateLayoutTable(int flag)
{
bool update = true;
if (!current_view->getScreen() || !current_view->available())
update = false;
if (update && current_view->buffer()->text->cursor.par->table) {
char buf[12];
string pwidth, special;
LyXTable * table = current_view->buffer()->text->cursor.par->table;
int cell = current_view->buffer()->text->
NumberOfCell(current_view->buffer()->text->cursor.par,
current_view->buffer()->text->cursor.pos);
ActCell = cell;
int column = table->column_of_cell(cell)+1;
fl_set_object_label(fd_form_table_options->text_warning, "");
Confirmed = false;
fl_activate_object(fd_form_table_extra->input_special_alignment);
fl_activate_object(fd_form_table_extra->input_special_multialign);
fl_activate_object(fd_form_table_options->input_column_width);
sprintf(buf, "%d", column);
fl_set_input(fd_form_table_options->input_table_column, buf);
fl_deactivate_object(fd_form_table_options->input_table_column);
int row = table->row_of_cell(cell)+1;
sprintf(buf, "%d", row);
fl_set_input(fd_form_table_options->input_table_row, buf);
fl_deactivate_object(fd_form_table_options->input_table_row);
if (table->IsMultiColumn(cell))
fl_set_button(fd_form_table_options->radio_multicolumn, 1);
else
fl_set_button(fd_form_table_options->radio_multicolumn, 0);
if (table->RotateCell(cell))
fl_set_button(fd_form_table_options->radio_rotate_cell, 1);
else
fl_set_button(fd_form_table_options->radio_rotate_cell, 0);
if (table->TopLine(cell))
fl_set_button(fd_form_table_options->radio_border_top, 1);
else
fl_set_button(fd_form_table_options->radio_border_top, 0);
if (table->BottomLine(cell))
fl_set_button(fd_form_table_options->radio_border_bottom, 1);
else
fl_set_button(fd_form_table_options->radio_border_bottom, 0);
if (table->LeftLine(cell))
fl_set_button(fd_form_table_options->radio_border_left, 1);
else
fl_set_button(fd_form_table_options->radio_border_left, 0);
if (table->RightLine(cell))
fl_set_button(fd_form_table_options->radio_border_right, 1);
else
fl_set_button(fd_form_table_options->radio_border_right, 0);
int align = table->GetAlignment(cell);
fl_set_button(fd_form_table_options->radio_align_left, 0);
fl_set_button(fd_form_table_options->radio_align_right, 0);
fl_set_button(fd_form_table_options->radio_align_center, 0);
special = table->GetAlignSpecial(cell, LyXTable::SET_SPECIAL_COLUMN);
if (flag)
{
fl_set_input(fd_form_table_extra->input_special_alignment,
special.c_str());
fl_set_input_cursorpos(fd_form_table_extra->input_special_alignment,
extra_col_cursor_x, 0); // restore the cursor
}
if (current_view->buffer()->isReadonly())
fl_deactivate_object(fd_form_table_extra->input_special_alignment);
special = table->GetAlignSpecial(cell, LyXTable::SET_SPECIAL_MULTI);
if (flag)
{
fl_set_input(fd_form_table_extra->input_special_multialign,
special.c_str());
fl_set_input_cursorpos(fd_form_table_extra->input_special_multialign,
extra_multicol_cursor_x, 0); // restore the cursor
}
if (current_view->buffer()->isReadonly())
fl_deactivate_object(fd_form_table_extra->input_special_multialign);
pwidth = table->GetPWidth(cell);
if (flag)
fl_set_input(fd_form_table_options->input_column_width, pwidth.c_str());
if (current_view->buffer()->isReadonly())
fl_deactivate_object(fd_form_table_options->input_column_width);
if (!pwidth.empty()) {
fl_activate_object(fd_form_table_options->radio_linebreak_cell);
fl_set_object_lcol(fd_form_table_options->radio_linebreak_cell,
FL_BLACK);
fl_set_button(fd_form_table_options->radio_linebreak_cell,
table->Linebreaks(table->FirstVirtualCell(cell)));
} else {
fl_deactivate_object(fd_form_table_options->radio_linebreak_cell);
fl_set_object_lcol(fd_form_table_options->radio_linebreak_cell,
FL_INACTIVE);
fl_set_button(fd_form_table_options->radio_linebreak_cell, 0);
}
if ((!pwidth.empty() && !table->IsMultiColumn(cell)) ||
(align == LYX_ALIGN_LEFT))
fl_set_button(fd_form_table_options->radio_align_left, 1);
else if (align == LYX_ALIGN_RIGHT)
fl_set_button(fd_form_table_options->radio_align_right, 1);
else
fl_set_button(fd_form_table_options->radio_align_center, 1);
if (!pwidth.empty() && !table->IsMultiColumn(cell)) {
fl_deactivate_object(fd_form_table_options->radio_align_left);
fl_deactivate_object(fd_form_table_options->radio_align_right);
fl_deactivate_object(fd_form_table_options->radio_align_center);
fl_set_object_lcol(fd_form_table_options->radio_align_left,
FL_INACTIVE);
fl_set_object_lcol(fd_form_table_options->radio_align_right,
FL_INACTIVE);
fl_set_object_lcol(fd_form_table_options->radio_align_center,
FL_INACTIVE);
} else {
fl_activate_object(fd_form_table_options->radio_align_left);
fl_activate_object(fd_form_table_options->radio_align_right);
fl_activate_object(fd_form_table_options->radio_align_center);
fl_set_object_lcol(fd_form_table_options->radio_align_left,
FL_BLACK);
fl_set_object_lcol(fd_form_table_options->radio_align_right,
FL_BLACK);
fl_set_object_lcol(fd_form_table_options->radio_align_center,
FL_BLACK);
}
fl_set_button(fd_form_table_options->radio_longtable, table->IsLongTable());
if (table->IsLongTable()) {
fl_activate_object(fd_form_table_options->radio_lt_firsthead);
fl_activate_object(fd_form_table_options->radio_lt_head);
fl_activate_object(fd_form_table_options->radio_lt_foot);
fl_activate_object(fd_form_table_options->radio_lt_lastfoot);
fl_activate_object(fd_form_table_options->radio_lt_newpage);
fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead,
FL_BLACK);
fl_set_object_lcol(fd_form_table_options->radio_lt_head,
FL_BLACK);
fl_set_object_lcol(fd_form_table_options->radio_lt_foot,
FL_BLACK);
fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot,
FL_BLACK);
fl_set_object_lcol(fd_form_table_options->radio_lt_newpage,
FL_BLACK);
fl_set_button(fd_form_table_options->radio_lt_firsthead,
table->RowOfLTFirstHead(cell));
fl_set_button(fd_form_table_options->radio_lt_head,
table->RowOfLTHead(cell));
fl_set_button(fd_form_table_options->radio_lt_foot,
table->RowOfLTFoot(cell));
fl_set_button(fd_form_table_options->radio_lt_lastfoot,
table->RowOfLTLastFoot(cell));
fl_set_button(fd_form_table_options->radio_lt_newpage,
table->LTNewPage(cell));
} else {
fl_deactivate_object(fd_form_table_options->radio_lt_firsthead);
fl_deactivate_object(fd_form_table_options->radio_lt_head);
fl_deactivate_object(fd_form_table_options->radio_lt_foot);
fl_deactivate_object(fd_form_table_options->radio_lt_lastfoot);
fl_deactivate_object(fd_form_table_options->radio_lt_newpage);
fl_set_button(fd_form_table_options->radio_lt_firsthead, 0);
fl_set_button(fd_form_table_options->radio_lt_head, 0);
fl_set_button(fd_form_table_options->radio_lt_foot, 0);
fl_set_button(fd_form_table_options->radio_lt_lastfoot, 0);
fl_set_button(fd_form_table_options->radio_lt_newpage, 0);
fl_set_object_lcol(fd_form_table_options->radio_lt_firsthead,
FL_INACTIVE);
fl_set_object_lcol(fd_form_table_options->radio_lt_head,
FL_INACTIVE);
fl_set_object_lcol(fd_form_table_options->radio_lt_foot,
FL_INACTIVE);
fl_set_object_lcol(fd_form_table_options->radio_lt_lastfoot,
FL_INACTIVE);
fl_set_object_lcol(fd_form_table_options->radio_lt_newpage,
FL_INACTIVE);
}
fl_set_button(fd_form_table_options->radio_rotate_table,
table->RotateTable());
fl_set_focus_object(fd_form_table_options->form_table_options,
fd_form_table_options->button_table_delete);
} else if (fd_form_table_options->form_table_options->visible) {
fl_set_focus_object(fd_form_table_options->form_table_options,
fd_form_table_options->button_table_delete);
fl_hide_form(fd_form_table_options->form_table_options);
}
return update;
}
#endif
void OpenLayoutTableExtra() void OpenLayoutTableExtra()
{ {
@ -445,7 +263,6 @@ void TableOptionsCB(FL_OBJECT * ob, long)
int s, num = 0; int s, num = 0;
string special, str; string special, str;
#ifdef MOVE_TEXT
if (!current_view->available() if (!current_view->available()
|| !(table = current_view->text->cursor.par->table)) { || !(table = current_view->text->cursor.par->table)) {
MenuLayoutTable(0); MenuLayoutTable(0);
@ -463,26 +280,7 @@ void TableOptionsCB(FL_OBJECT * ob, long)
extra_multicol_cursor_x = 0; extra_multicol_cursor_x = 0;
return; return;
} }
#else
if (!current_view->available()
||
!(table = current_view->buffer()->text->cursor.par->table)) {
MenuLayoutTable(0);
return;
}
int cell = current_view->buffer()->text->
NumberOfCell(current_view->buffer()->text->cursor.par,
current_view->buffer()->text->cursor.pos);
if (ActCell != cell) {
MenuLayoutTable(0);
fl_set_object_label(fd_form_table_options->text_warning,
_("Warning: Wrong Cursor position, updated window"));
fl_show_object(fd_form_table_options->text_warning);
extra_col_cursor_x = 0; // would rather place it at the end, but...
extra_multicol_cursor_x = 0;
return;
}
#endif
// No point in processing directives that you can't do anything with // No point in processing directives that you can't do anything with
// anyhow, so exit now if the buffer is read-only. // anyhow, so exit now if the buffer is read-only.
if (current_view->buffer()->isReadonly()) { if (current_view->buffer()->isReadonly()) {
@ -622,9 +420,8 @@ void TableOptionsCB(FL_OBJECT * ob, long)
num = LyXTable::SET_SPECIAL_MULTI; num = LyXTable::SET_SPECIAL_MULTI;
} else } else
return; return;
if (current_view->available()){ if (current_view->available()) {
current_view->getScreen()->HideCursor(); current_view->getScreen()->HideCursor();
#ifdef MOVE_TEXT
if (!current_view->text->selection){ if (!current_view->text->selection){
BeforeChange(); BeforeChange();
current_view->update(-2); current_view->update(-2);
@ -635,18 +432,6 @@ void TableOptionsCB(FL_OBJECT * ob, long)
else else
current_view->text->TableFeatures(num); current_view->text->TableFeatures(num);
current_view->update(1); current_view->update(1);
#else
if (!current_view->buffer()->text->selection){
BeforeChange();
current_view->buffer()->update(-2);
}
if ((num == LyXTable::SET_SPECIAL_COLUMN) ||
(num == LyXTable::SET_SPECIAL_MULTI))
current_view->buffer()->text->TableFeatures(num, special);
else
current_view->buffer()->text->TableFeatures(num);
current_view->buffer()->update(1);
#endif
} }
if (num == LyXTable::DELETE_TABLE) { if (num == LyXTable::DELETE_TABLE) {
fl_set_focus_object(fd_form_table_options->form_table_options, fl_set_focus_object(fd_form_table_options->form_table_options,
@ -657,6 +442,7 @@ void TableOptionsCB(FL_OBJECT * ob, long)
return; return;
} }
void TableOptCloseCB(FL_OBJECT *, long) void TableOptCloseCB(FL_OBJECT *, long)
{ {
fl_set_focus_object(fd_form_table_options->form_table_options, fl_set_focus_object(fd_form_table_options->form_table_options,
@ -673,37 +459,26 @@ void TableSpeCloseCB(FL_OBJECT *, long)
return; return;
} }
void SetPWidthCB(FL_OBJECT *ob, long) void SetPWidthCB(FL_OBJECT * ob, long)
{ {
fl_set_object_label(fd_form_table_options->text_warning, ""); fl_set_object_label(fd_form_table_options->text_warning, "");
Confirmed = false; Confirmed = false;
if (ob == fd_form_table_options->input_column_width) { if (ob == fd_form_table_options->input_column_width) {
string string str = fl_get_input(ob);
str;
str = fl_get_input(ob);
if (!str.empty() && !isValidLength(str)) { if (!str.empty() && !isValidLength(str)) {
fl_set_object_label(fd_form_table_options->text_warning, fl_set_object_label(fd_form_table_options->text_warning,
_("Warning: Invalid Length (valid example: 10mm)")); _("Warning: Invalid Length (valid example: 10mm)"));
fl_show_object(fd_form_table_options->text_warning); fl_show_object(fd_form_table_options->text_warning);
return; return;
} }
if (current_view->available()){ if (current_view->available()){
current_view->getScreen()->HideCursor(); current_view->getScreen()->HideCursor();
#ifdef MOVE_TEXT if (!current_view->text->selection) {
if (!current_view->text->selection){
BeforeChange(); BeforeChange();
current_view->update(-2); current_view->update(-2);
} }
current_view->text->TableFeatures(LyXTable::SET_PWIDTH, str); current_view->text->TableFeatures(LyXTable::SET_PWIDTH, str);
current_view->update(1); current_view->update(1);
#else
if (!current_view->buffer()->text->selection){
BeforeChange();
current_view->buffer()->update(-2);
}
current_view->buffer()->text->TableFeatures(LyXTable::SET_PWIDTH, str);
current_view->buffer()->update(1);
#endif
} }
MenuLayoutTable(0); // update for alignment MenuLayoutTable(0); // update for alignment
} }

View File

@ -122,9 +122,6 @@ Buffer::Buffer(string const & file, LyXRC * lyxrc, bool ronly)
filename = file; filename = file;
filepath = OnlyPath(file); filepath = OnlyPath(file);
paragraph = 0; paragraph = 0;
#ifndef MOVE_TEXT
text = 0;
#endif
the_locking_inset = 0; the_locking_inset = 0;
lyx_clean = true; lyx_clean = true;
bak_clean = true; bak_clean = true;
@ -164,9 +161,6 @@ Buffer::~Buffer()
par = tmppar; par = tmppar;
} }
paragraph = 0; paragraph = 0;
#ifndef MOVE_TEXT
delete text;
#endif
} }
@ -217,11 +211,7 @@ void Buffer::InsetUnlock()
if (the_locking_inset) { if (the_locking_inset) {
if (!inset_slept) the_locking_inset->InsetUnlock(); if (!inset_slept) the_locking_inset->InsetUnlock();
the_locking_inset = 0; the_locking_inset = 0;
#ifdef MOVE_TEXT
users->text->FinishUndo(); users->text->FinishUndo();
#else
text->FinishUndo();
#endif
inset_slept = false; inset_slept = false;
} }
} }
@ -268,7 +258,6 @@ bool Buffer::insertLyXFile(string const & filen)
bool res = true; bool res = true;
#ifdef MOVE_TEXT
if (c == '#') { if (c == '#') {
lyxerr.debug() << "Will insert file with header" << endl; lyxerr.debug() << "Will insert file with header" << endl;
res = readFile(lex, users->text->cursor.par); res = readFile(lex, users->text->cursor.par);
@ -276,15 +265,7 @@ bool Buffer::insertLyXFile(string const & filen)
lyxerr.debug() << "Will insert file without header" << endl; lyxerr.debug() << "Will insert file without header" << endl;
res = readLyXformat2(lex, users->text->cursor.par); res = readLyXformat2(lex, users->text->cursor.par);
} }
#else
if (c == '#') {
lyxerr.debug() << "Will insert file with header" << endl;
res = readFile(lex, text->cursor.par);
} else {
lyxerr.debug() << "Will insert file without header" << endl;
res = readLyXformat2(lex, text->cursor.par);
}
#endif
resize(); resize();
return res; return res;
} }
@ -319,13 +300,8 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
if(!par) { if(!par) {
par = new LyXParagraph; par = new LyXParagraph;
} else { } else {
#ifdef MOVE_TEXT
users->text->BreakParagraph(); users->text->BreakParagraph();
return_par = users->text->FirstParagraph(); return_par = users->text->FirstParagraph();
#else
text->BreakParagraph();
return_par = text->FirstParagraph();
#endif
pos = 0; pos = 0;
markDirty(); markDirty();
// We don't want to adopt the parameters from the // We don't want to adopt the parameters from the
@ -3160,13 +3136,9 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra,
// candidate for move to BufferView // candidate for move to BufferView
bool Buffer::removeAutoInsets() bool Buffer::removeAutoInsets()
{ {
LyXParagraph *par = paragraph; LyXParagraph * par = paragraph;
#ifdef MOVE_TEXT
LyXCursor cursor = users->text->cursor; LyXCursor cursor = users->text->cursor;
#else
LyXCursor cursor = text->cursor;
#endif
LyXCursor tmpcursor = cursor; LyXCursor tmpcursor = cursor;
cursor.par = tmpcursor.par->ParFromPos(tmpcursor.pos); cursor.par = tmpcursor.par->ParFromPos(tmpcursor.pos);
cursor.pos = tmpcursor.par->PositionInParFromPos(tmpcursor.pos); cursor.pos = tmpcursor.par->PositionInParFromPos(tmpcursor.pos);
@ -3176,19 +3148,11 @@ bool Buffer::removeAutoInsets()
if (par->AutoDeleteInsets()){ if (par->AutoDeleteInsets()){
a = true; a = true;
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){ if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){
#ifdef MOVE_TEXT
/* this is possible now, since SetCursor takes /* this is possible now, since SetCursor takes
care about footnotes */ care about footnotes */
users->text->SetCursorIntern(par, 0); users->text->SetCursorIntern(par, 0);
users->text->RedoParagraphs(users->text->cursor, users->text->cursor.par->Next()); users->text->RedoParagraphs(users->text->cursor, users->text->cursor.par->Next());
users->text->FullRebreak(); users->text->FullRebreak();
#else
/* this is possible now, since SetCursor takes
care about footnotes */
text->SetCursorIntern(par, 0);
text->RedoParagraphs(text->cursor, text->cursor.par->Next());
text->FullRebreak();
#endif
} }
} }
par = par->next; par = par->next;
@ -3196,11 +3160,7 @@ bool Buffer::removeAutoInsets()
/* avoid forbidden cursor positions caused by error removing */ /* avoid forbidden cursor positions caused by error removing */
if (cursor.pos > cursor.par->Last()) if (cursor.pos > cursor.par->Last())
cursor.pos = cursor.par->Last(); cursor.pos = cursor.par->Last();
#ifdef MOVE_TEXT
users->text->SetCursorIntern(cursor.par, cursor.pos); users->text->SetCursorIntern(cursor.par, cursor.pos);
#else
text->SetCursorIntern(cursor.par, cursor.pos);
#endif
return a; return a;
} }
@ -3208,11 +3168,7 @@ bool Buffer::removeAutoInsets()
int Buffer::runLaTeX() int Buffer::runLaTeX()
{ {
#ifdef MOVE_TEXT
if (!users->text) return 0; if (!users->text) return 0;
#else
if (!text) return 0;
#endif
ProhibitInput(); ProhibitInput();
@ -3275,11 +3231,7 @@ int Buffer::runLaTeX()
int Buffer::runLiterate() int Buffer::runLiterate()
{ {
#ifdef MOVE_TEXT
if (!users->text) return 0; if (!users->text) return 0;
#else
if (!text) return 0;
#endif
ProhibitInput(); ProhibitInput();
@ -3348,11 +3300,7 @@ int Buffer::runLiterate()
int Buffer::buildProgram() int Buffer::buildProgram()
{ {
#ifdef MOVE_TEXT
if (!users->text) return 0; if (!users->text) return 0;
#else
if (!text) return 0;
#endif
ProhibitInput(); ProhibitInput();
@ -3423,11 +3371,7 @@ int Buffer::buildProgram()
// Other flags: -wall -v0 -x // Other flags: -wall -v0 -x
int Buffer::runChktex() int Buffer::runChktex()
{ {
#ifdef MOVE_TEXT
if (!users->text) return 0; if (!users->text) return 0;
#else
if (!text) return 0;
#endif
ProhibitInput(); ProhibitInput();
@ -3483,13 +3427,8 @@ extern void AllFloats(char, char);
// candidate for move to BufferView // candidate for move to BufferView
void Buffer::insertErrors(TeXErrors & terr) void Buffer::insertErrors(TeXErrors & terr)
{ {
#ifdef MOVE_TEXT
// Save the cursor position // Save the cursor position
LyXCursor cursor = users->text->cursor; LyXCursor cursor = users->text->cursor;
#else
// Save the cursor position
LyXCursor cursor = text->cursor;
#endif
// This is drastic, but it's the only fix, I could find. (Asger) // This is drastic, but it's the only fix, I could find. (Asger)
AllFloats(1, 0); AllFloats(1, 0);
@ -3511,41 +3450,23 @@ void Buffer::insertErrors(TeXErrors & terr)
LyXParagraph * texrowpar = 0; LyXParagraph * texrowpar = 0;
#ifdef MOVE_TEXT
if (tmpid == -1) { if (tmpid == -1) {
texrowpar = users->text->FirstParagraph(); texrowpar = users->text->FirstParagraph();
tmppos = 0; tmppos = 0;
} else { } else {
texrowpar = users->text->GetParFromID(tmpid); texrowpar = users->text->GetParFromID(tmpid);
} }
#else
if (tmpid == -1) {
texrowpar = text->FirstParagraph();
tmppos = 0;
} else {
texrowpar = text->GetParFromID(tmpid);
}
#endif
if (texrowpar == 0) if (texrowpar == 0)
continue; continue;
InsetError * new_inset = new InsetError(msgtxt); InsetError * new_inset = new InsetError(msgtxt);
#ifdef MOVE_TEXT
users->text->SetCursorIntern(texrowpar, tmppos); users->text->SetCursorIntern(texrowpar, tmppos);
users->text->InsertInset(new_inset); users->text->InsertInset(new_inset);
users->text->FullRebreak(); users->text->FullRebreak();
} }
// Restore the cursor position // Restore the cursor position
users->text->SetCursorIntern(cursor.par, cursor.pos); users->text->SetCursorIntern(cursor.par, cursor.pos);
#else
text->SetCursorIntern(texrowpar, tmppos);
text->InsertInset(new_inset);
text->FullRebreak();
}
// Restore the cursor position
text->SetCursorIntern(cursor.par, cursor.pos);
#endif
} }
@ -3559,7 +3480,6 @@ void Buffer::setCursorFromRow (int row)
LyXParagraph * texrowpar; LyXParagraph * texrowpar;
#ifdef MOVE_TEXT
if (tmpid == -1) { if (tmpid == -1) {
texrowpar = users->text->FirstParagraph(); texrowpar = users->text->FirstParagraph();
tmppos = 0; tmppos = 0;
@ -3567,15 +3487,6 @@ void Buffer::setCursorFromRow (int row)
texrowpar = users->text->GetParFromID(tmpid); texrowpar = users->text->GetParFromID(tmpid);
} }
users->text->SetCursor(texrowpar, tmppos); users->text->SetCursor(texrowpar, tmppos);
#else
if (tmpid == -1) {
texrowpar = text->FirstParagraph();
tmppos = 0;
} else {
texrowpar = text->GetParFromID(tmpid);
}
text->SetCursor(texrowpar, tmppos);
#endif
} }
@ -3726,37 +3637,6 @@ void Buffer::markDviDirty()
} }
#ifndef MOVE_TEXT
// candidate for move to BufferView
void Buffer::update(signed char f)
{
if (!users) return;
users->owner()->updateLayoutChoice();
if (!text->selection && f > -3)
text->sel_cursor = text->cursor;
FreeUpdateTimer();
text->FullRebreak();
users->update();
if (f != 3 && f != -3) {
users->fitCursor();
users->updateScrollbar();
}
if (f == 1 || f == -1) {
if (isLyxClean()) {
markDirty();
users->owner()->getMiniBuffer()->setTimer(4);
} else {
markDirty();
}
}
}
#endif
void Buffer::validate(LaTeXFeatures & features) void Buffer::validate(LaTeXFeatures & features)
{ {
LyXParagraph * par = paragraph; LyXParagraph * par = paragraph;
@ -3868,7 +3748,7 @@ void Buffer::setOldPaperStuff()
} }
#endif #endif
#ifdef MOVE_TEXT
// candidate for move to BufferView // candidate for move to BufferView
void Buffer::insertInset(Inset * inset, string const & lout, void Buffer::insertInset(Inset * inset, string const & lout,
bool no_table) bool no_table)
@ -3921,79 +3801,18 @@ void Buffer::insertInset(Inset * inset, string const & lout,
users->text->UnFreezeUndo(); users->text->UnFreezeUndo();
} }
#else
void Buffer::insertInset(Inset * inset, string const & lout,
bool no_table)
{
// check for table/list in tables
if (no_table && text->cursor.par->table){
WriteAlert(_("Impossible Operation!"),
_("Cannot insert table/list in table."),
_("Sorry."));
return;
}
// not quite sure if we want this...
text->SetCursorParUndo();
text->FreezeUndo();
BeforeChange();
if (!lout.empty()) {
update(-2);
text->BreakParagraph();
update(-1);
if (text->cursor.par->Last()) {
text->CursorLeft();
text->BreakParagraph();
update(-1);
}
int lay = textclasslist.NumberOfLayout(params.textclass,
lout).second;
if (lay == -1) // layout not found
// use default layout "Standard" (0)
lay = 0;
text->SetLayout(lay);
text->SetParagraph(0, 0,
0, 0,
VSpace(VSpace::NONE), VSpace(VSpace::NONE),
LYX_ALIGN_LAYOUT,
string(),
0);
update(-1);
text->current_font.setLatex(LyXFont::OFF);
}
text->InsertInset(inset);
update(-1);
text->UnFreezeUndo();
}
#endif
// Open and lock an updatable inset // Open and lock an updatable inset
// candidate for move to BufferView // candidate for move to BufferView
void Buffer::open_new_inset(UpdatableInset * new_inset) void Buffer::open_new_inset(UpdatableInset * new_inset)
{ {
#ifdef MOVE_TEXT
BeforeChange(); BeforeChange();
users->text->FinishUndo(); users->text->FinishUndo();
insertInset(new_inset); insertInset(new_inset);
users->text->CursorLeft(); users->text->CursorLeft();
users->update(1); users->update(1);
new_inset->Edit(0, 0); new_inset->Edit(0, 0);
#else
BeforeChange();
text->FinishUndo();
insertInset(new_inset);
text->CursorLeft();
update(1);
new_inset->Edit(0, 0);
#endif
} }
@ -4129,19 +3948,11 @@ bool Buffer::gotoLabel(string const & label)
while ((inset = par->ReturnNextInsetPointer(pos))){ while ((inset = par->ReturnNextInsetPointer(pos))){
for (int i = 0; i < inset->GetNumberOfLabels(); i++) { for (int i = 0; i < inset->GetNumberOfLabels(); i++) {
if (label == inset->getLabel(i)) { if (label == inset->getLabel(i)) {
#ifdef MOVE_TEXT
BeforeChange(); BeforeChange();
users->text->SetCursor(par, pos); users->text->SetCursor(par, pos);
users->text->sel_cursor = users->text->cursor; users->text->sel_cursor = users->text->cursor;
users->update(0); users->update(0);
return true; return true;
#else
BeforeChange();
text->SetCursor(par, pos);
text->sel_cursor = text->cursor;
update(0);
return true;
#endif
} }
} }
pos++; pos++;

View File

@ -1,6 +1,6 @@
// -*- C++ -*- // -*- C++ -*-
/* This file is part of /* This file is part of
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
* Copyright (C) 1995 Matthias Ettrich * Copyright (C) 1995 Matthias Ettrich
@ -34,7 +34,6 @@
#include "lyxtext.h" #include "lyxtext.h"
#include "support/filetools.h" #include "support/filetools.h"
#define MOVE_TEXT 1
class LyXRC; class LyXRC;
class TeXErrors; class TeXErrors;
@ -73,16 +72,16 @@ public:
//@{ //@{
/** save the buffer's parameters as user default /** save the buffer's parameters as user default
This function saves a file user_lyxdir/templates/defaults.lyx This function saves a file user_lyxdir/templates/defaults.lyx
which parameters are those of the current buffer. This file which parameters are those of the current buffer. This file
is used as a default template when creating a new is used as a default template when creating a new
file. Returns true on success. file. Returns true on success.
*/ */
bool saveParamsAsDefaults(); bool saveParamsAsDefaults();
/** high-level interface to buffer functionality /** high-level interface to buffer functionality
This function parses a command string and executes it This function parses a command string and executes it
*/ */
void Dispatch(const string & command); void Dispatch(const string & command);
/// Maybe we know the function already by number... /// Maybe we know the function already by number...
@ -90,17 +89,11 @@ public:
/// should be changed to work for a list. /// should be changed to work for a list.
void resize() void resize()
{ {
if (users) { if (users) {
users->resize(); users->resize();
}
} }
#ifndef MOVE_TEXT
else if (text) {
delete text;
text = 0;
}
#endif
}
/// Update window titles of all users /// Update window titles of all users
void updateTitles(); void updateTitles();
@ -109,26 +102,21 @@ public:
void resetAutosaveTimers(); void resetAutosaveTimers();
/** Adds the BufferView to the users list. /** Adds the BufferView to the users list.
Later this func will insert the BufferView into a real list, Later this func will insert the BufferView into a real list,
not just setting a pointer. not just setting a pointer.
*/ */
void addUser(BufferView * u) { users = u; } void addUser(BufferView * u) { users = u; }
/** Removes the BufferView from the users list. /** Removes the BufferView from the users list.
Since we only can have one at the moment, we just reset it. Since we only can have one at the moment, we just reset it.
*/ */
void delUser(BufferView *){ users = 0; } void delUser(BufferView *){ users = 0; }
#ifndef MOVE_TEXT
///
void update(signed char f);
#endif
/// ///
void redraw() { void redraw() {
users->redraw(); users->redraw();
users->fitCursor(); users->fitCursor();
users->updateScrollbar(); users->updateScrollbar();
} }
/// Open and lock an updatable inset /// Open and lock an updatable inset
@ -263,16 +251,16 @@ public:
/// Set buffer read-only flag /// Set buffer read-only flag
void setReadonly(bool flag = true) void setReadonly(bool flag = true)
{ {
if (read_only != flag) { if (read_only != flag) {
read_only = flag; read_only = flag;
updateTitles(); updateTitles();
updateAllVisibleBufferRelatedPopups(); updateAllVisibleBufferRelatedPopups();
}
if (read_only) {
WarnReadonly();
}
} }
if (read_only) {
WarnReadonly();
}
}
/// returns true if the buffer contains a LaTeX document /// returns true if the buffer contains a LaTeX document
bool isLatex() const; bool isLatex() const;
@ -294,19 +282,19 @@ public:
#endif #endif
/** Validate a buffer for LaTeX. /** Validate a buffer for LaTeX.
This validates the buffer, and returns a struct for use by This validates the buffer, and returns a struct for use by
makeLaTeX and others. Its main use is to figure out what commands makeLaTeX and others. Its main use is to figure out what commands
and packages need to be included in the LaTeX file. It (should) and packages need to be included in the LaTeX file. It (should)
also check that the needed constructs are there (i.e. that the \refs also check that the needed constructs are there (i.e. that the \refs
points to coresponding \labels). It should perhaps inset "error" points to coresponding \labels). It should perhaps inset "error"
insets to help the user correct obvious mistakes. insets to help the user correct obvious mistakes.
*/ */
void validate(LaTeXFeatures &); //the correct parameters to be void validate(LaTeXFeatures &); //the correct parameters to be
//included later //included later
/** Insert an inset into the buffer /** Insert an inset into the buffer
Insert inset into buffer, placing it in a layout of lout, Insert inset into buffer, placing it in a layout of lout,
if no_table make sure that it doesn't end up in a table. */ if no_table make sure that it doesn't end up in a table. */
void insertInset(Inset *, string const & lout = string(), void insertInset(Inset *, string const & lout = string(),
bool no_table = false); bool no_table = false);
@ -326,7 +314,7 @@ public:
bool removeAutoInsets(); bool removeAutoInsets();
/** This will clearly have to change later. Later we can have more /** This will clearly have to change later. Later we can have more
than one user per buffer. */ than one user per buffer. */
BufferView * getUser() const { return users; } BufferView * getUser() const { return users; }
//@} //@}
@ -344,12 +332,6 @@ public:
*/ */
LyXParagraph * paragraph; LyXParagraph * paragraph;
#ifndef MOVE_TEXT
/** This holds the mapping between buffer paragraphs and screen rows.
Should be moved to BufferView. (Asger)
*/
LyXText * text;
#endif
/// per view not per buffer? /// per view not per buffer?
UpdatableInset * the_locking_inset; UpdatableInset * the_locking_inset;
@ -453,12 +435,12 @@ private:
float format; float format;
/** A list of views using this buffer. /** A list of views using this buffer.
Why not keep a list of the BufferViews that use this buffer? Why not keep a list of the BufferViews that use this buffer?
At least then we don't have to do a lot of magic like: At least then we don't have to do a lot of magic like:
buffer->lyx_gui->bufferview->updateLayoutChoice. Just ask each buffer->lyx_gui->bufferview->updateLayoutChoice. Just ask each
of the buffers in the list of users to do a updateLayoutChoice. of the buffers in the list of users to do a updateLayoutChoice.
*/ */
BufferView * users; BufferView * users;
/// Used when typesetting to place errorboxes. /// Used when typesetting to place errorboxes.
@ -469,28 +451,28 @@ private:
inline inline
void Buffer::InsetSleep() void Buffer::InsetSleep()
{ {
if (the_locking_inset && !inset_slept) { if (the_locking_inset && !inset_slept) {
the_locking_inset->GetCursorPos(slx, sly); the_locking_inset->GetCursorPos(slx, sly);
the_locking_inset->InsetUnlock(); the_locking_inset->InsetUnlock();
inset_slept = true; inset_slept = true;
} }
} }
inline inline
void Buffer::InsetWakeup() void Buffer::InsetWakeup()
{ {
if (the_locking_inset && inset_slept) { if (the_locking_inset && inset_slept) {
the_locking_inset->Edit(slx, sly); the_locking_inset->Edit(slx, sly);
inset_slept = false; inset_slept = false;
} }
} }
inline inline
void Buffer::setParentName(string const & name) void Buffer::setParentName(string const & name)
{ {
params.parentname = name; params.parentname = name;
} }
#endif #endif

View File

@ -58,8 +58,8 @@ void BufferStorage::release(Buffer * buf)
Buffer * BufferStorage::newBuffer(string const & s, Buffer * BufferStorage::newBuffer(string const & s,
LyXRC * lyxrc, LyXRC * lyxrc,
bool ronly) bool ronly)
{ {
Buffer * tmpbuf = new Buffer(s, lyxrc, ronly); Buffer * tmpbuf = new Buffer(s, lyxrc, ronly);
tmpbuf->params.useClassDefaults(); tmpbuf->params.useClassDefaults();
@ -104,7 +104,8 @@ bool BufferList::QwriteAll()
break; break;
case 2: // No case 2: // No
askMoreConfirmation = true; askMoreConfirmation = true;
unsaved += MakeDisplayPath((*it)->fileName(), 50); unsaved += MakeDisplayPath((*it)->fileName(),
50);
unsaved += "\n"; unsaved += "\n";
break; break;
case 3: // Cancel case 3: // Cancel
@ -152,7 +153,7 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
chmod("LyXVC3.lyx", 0100644) = 0 chmod("LyXVC3.lyx", 0100644) = 0
lseek(0, 0, SEEK_CUR) = 46440 lseek(0, 0, SEEK_CUR) = 46440
_exit(0) _exit(0)
*/ */
// Should proabaly have some more error checking here. // Should proabaly have some more error checking here.
// Should be cleaned up in 0.13, at least a bit. // Should be cleaned up in 0.13, at least a bit.
@ -178,7 +179,8 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
c_read = fread(cbuf, 1, blksize, fin); c_read = fread(cbuf, 1, blksize, fin);
if (c_read != 0) if (c_read != 0)
c_write = c_write =
fwrite(cbuf, 1, c_read, fout); fwrite(cbuf, 1,
c_read, fout);
} while (c_read); } while (c_read);
fin.close(); fin.close();
fout.close(); fout.close();
@ -189,7 +191,8 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
} }
delete [] cbuf; delete [] cbuf;
} else { } else {
lyxerr << "LyX was not able to make backupcopy. Beware." << endl; lyxerr << "LyX was not able to make "
"backupcopy. Beware." << endl;
} }
delete[] times; delete[] times;
} }
@ -253,8 +256,8 @@ bool BufferList::close(Buffer * buf)
if (buf->paragraph && !buf->isLyxClean() && !quitting) { if (buf->paragraph && !buf->isLyxClean() && !quitting) {
ProhibitInput(); ProhibitInput();
switch(AskConfirmation(_("Changes in document:"), switch(AskConfirmation(_("Changes in document:"),
MakeDisplayPath(buf->fileName(), 50), MakeDisplayPath(buf->fileName(), 50),
_("Save document?"))){ _("Save document?"))){
case 1: // Yes case 1: // Yes
if (write(buf)) { if (write(buf)) {
lastfiles->newFile(buf->fileName()); lastfiles->newFile(buf->fileName());
@ -309,19 +312,12 @@ void BufferList::updateInset(Inset * inset, bool mark_dirty)
{ {
for (BufferStorage::iterator it = bstore.begin(); for (BufferStorage::iterator it = bstore.begin();
it != bstore.end(); ++it) { it != bstore.end(); ++it) {
#ifdef MOVE_TEXT if ((*it)->getUser()
if ((*it)->getUser() && (*it)->getUser()->text->UpdateInset(inset)) { && (*it)->getUser()->text->UpdateInset(inset)) {
if (mark_dirty) if (mark_dirty)
(*it)->markDirty(); (*it)->markDirty();
break; break;
} }
#else
if ((*it)->text && (*it)->text->UpdateInset(inset)) {
if (mark_dirty)
(*it)->markDirty();
break;
}
#endif
} }
} }
@ -352,7 +348,6 @@ void BufferList::updateIncludedTeXfiles(string const & mastertmpdir)
(*it)->makeLaTeXFile(writefile, mastertmpdir, (*it)->makeLaTeXFile(writefile, mastertmpdir,
false, true); false, true);
(*it)->markDepClean(mastertmpdir); (*it)->markDepClean(mastertmpdir);
} }
} }
} }
@ -366,7 +361,7 @@ void BufferList::emergencyWriteAll()
bool madeit = false; bool madeit = false;
lyxerr <<_("lyx: Attempting to save" lyxerr <<_("lyx: Attempting to save"
" document ") " document ")
<< (*it)->fileName() << (*it)->fileName()
<< _(" as...") << endl; << _(" as...") << endl;
@ -382,7 +377,9 @@ void BufferList::emergencyWriteAll()
} else if (i == 1) { } else if (i == 1) {
s = AddName(GetEnvPath("HOME"), s = AddName(GetEnvPath("HOME"),
(*it)->fileName()); (*it)->fileName());
} else { // MakeAbsPath to prepend the current drive letter on OS/2 } else {
// MakeAbsPath to prepend the current
// drive letter on OS/2
s = AddName(MakeAbsPath("/tmp/"), s = AddName(MakeAbsPath("/tmp/"),
(*it)->fileName()); (*it)->fileName());
} }
@ -399,7 +396,9 @@ void BufferList::emergencyWriteAll()
lyxerr << _(" Save failed! Trying...") lyxerr << _(" Save failed! Trying...")
<< endl; << endl;
} else { } else {
lyxerr << _(" Save failed! Bummer. Document is lost.") << endl; lyxerr << _(" Save failed! Bummer. "
"Document is lost.")
<< endl;
} }
} }
} }
@ -599,10 +598,10 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
if (AskQuestion(_("Cannot open specified file:"), if (AskQuestion(_("Cannot open specified file:"),
MakeDisplayPath(s, 50), MakeDisplayPath(s, 50),
_("Create new document with this name?"))) _("Create new document with this name?")))
{ {
// Find a free buffer // Find a free buffer
b = newFile(s, string()); b = newFile(s, string());
} }
break; break;
} }

View File

@ -35,6 +35,10 @@ bool CharacterSet::loadFile(string const & fname)
string str; string str;
int n; int n;
string line; string line;
// Ok, I'll be the first to admit that this is probably not
// the fastest way to parse the cdef files, but I though it
// was a bit neat. Anyway it is wrong to use the lyxlex parse
// without the use of a keyword table.
LRegex reg("^([12][0-9][0-9])[ \t]+\"([^ ]+)\".*"); LRegex reg("^([12][0-9][0-9])[ \t]+\"([^ ]+)\".*");
while(getline(ifs, line)) { while(getline(ifs, line)) {
if (reg.exact_match(line)) { if (reg.exact_match(line)) {
@ -53,11 +57,20 @@ bool CharacterSet::loadFile(string const & fname)
} }
bool CharacterSet::encodeString(string & str) const pair<bool, int> CharacterSet::encodeString(string & str) const
{ {
lyxerr[Debug::KBMAP] << "Checking if we know [" << str << "]" << endl;
bool ret = false;
int val = 0;
Cdef::const_iterator cit = map_.find(str); Cdef::const_iterator cit = map_.find(str);
if (cit != map_.end()) return true; if (cit != map_.end()) {
return false; ret = true;
val = (*cit).second;
}
lyxerr[Debug::KBMAP] << " "
<< (ret ? "yes we" : "no we don't")
<< " know [" << str << "]" << endl;
return make_pair(ret, val);
} }

View File

@ -19,7 +19,7 @@ public:
/// ///
string const & getName() const; string const & getName() const;
/// ///
bool encodeString(string &) const; pair<bool, int> encodeString(string &) const;
private: private:
/// ///
string name_; string name_;

View File

@ -77,8 +77,8 @@ void PutInsetIntoInsetUpdateList(Inset * inset);
extern void ProhibitInput(); extern void ProhibitInput();
extern void AllowInput(); extern void AllowInput();
#define DEG2PI 57.295779513 static float const DEG2PI = 57.295779513;
#define figallocchunk 32 static int const figallocchunk = 32;
static int figinsref = 0; /* number of figures */ static int figinsref = 0; /* number of figures */
static int figarrsize = 0; /* current max number of figures */ static int figarrsize = 0; /* current max number of figures */
@ -97,7 +97,7 @@ struct pidwait {
pidwait * next; /* next */ pidwait * next; /* next */
}; };
#define MAXGS 3 /* maximum 3 gs's at a time */ static int const MAXGS = 3; /* maximum 3 gs's at a time */
static Figref ** figures; /* all the figures */ static Figref ** figures; /* all the figures */
static figdata ** bitmaps; /* all the bitmaps */ static figdata ** bitmaps; /* all the bitmaps */
@ -141,7 +141,7 @@ void addpidwait(int pid)
extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int, extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
XEvent * ev, void *) XEvent * ev, void *)
{ {
char tmp[128]; char tmp[128];
@ -153,6 +153,7 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
} }
// just kill gs, that way it will work for sure // just kill gs, that way it will work for sure
// This loop looks like S**T so it probably is...
for (int i = 0; i < bmpinsref; ++i) for (int i = 0; i < bmpinsref; ++i)
if ((long)bitmaps[i]->bitmap == (long)e->data.l[1]) { if ((long)bitmaps[i]->bitmap == (long)e->data.l[1]) {
// found the one // found the one
@ -160,7 +161,8 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
p->gsdone = true; p->gsdone = true;
// first update p->bitmap, if necessary // first update p->bitmap, if necessary
if (p->bitmap != None && p->flags > (1|8) && gs_color && p->wid) { if (p->bitmap != None
&& p->flags > (1|8) && gs_color && p->wid) {
// query current colormap and re-render // query current colormap and re-render
// the pixmap with proper colors // the pixmap with proper colors
//XColor * cmap; //XColor * cmap;
@ -172,8 +174,10 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
Display * tmpdisp; Display * tmpdisp;
GC gc = getGC(gc_copy); GC gc = getGC(gc_copy);
XGetWindowAttributes(fl_display, fl_get_canvas_id( XGetWindowAttributes(fl_display,
figinset_canvas), &wa); fl_get_canvas_id(
figinset_canvas),
&wa);
XFlush(fl_display); XFlush(fl_display);
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr << "Starting image translation " lyxerr << "Starting image translation "
@ -217,36 +221,39 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
{ {
// query current colormap // query current colormap
//cmap = (XColor *) malloc(gs_allcolors*sizeof(XColor)); //cmap = (XColor *) malloc(gs_allcolors*sizeof(XColor));
XColor * cmap = new XColor[gs_allcolors]; XColor * cmap = new XColor[gs_allcolors];
for (i = 0; i < gs_allcolors; ++i) cmap[i].pixel = i; for (i = 0; i < gs_allcolors; ++i) cmap[i].pixel = i;
XQueryColors(tmpdisp, color_map, cmap, gs_allcolors); XQueryColors(tmpdisp, color_map, cmap, gs_allcolors);
XFlush(tmpdisp); XFlush(tmpdisp);
wid1 = p->wid - 1; wid1 = p->wid - 1;
// now we process all the image // now we process all the image
for (y = 0; y < p->hgh; ++y) { for (y = 0; y < p->hgh; ++y) {
for (int x = 0; x < wid; ++x) { for (int x = 0; x < wid; ++x) {
XColor * pc = cmap + XColor * pc = cmap +
XGetPixel(im, x, y); XGetPixel(im, x, y);
XFlush(tmpdisp); XFlush(tmpdisp);
XPutPixel(im, x, y, XPutPixel(im, x, y,
gs_pixels[((pc->red+6553)* gs_pixels[((pc->red+6553)*
spc1/65535)*spc2+((pc->green+6553)* spc1/65535)*spc2+((pc->green+6553)*
spc1/65535)*gs_spc+((pc->blue+6553)* spc1/65535)*gs_spc+((pc->blue+6553)*
spc1/65535)]); spc1/65535)]);
XFlush(tmpdisp); XFlush(tmpdisp);
}
} }
}
// This must be correct. // This must be correct.
delete [] cmap; delete [] cmap;
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr << "Putting image back" << endl; lyxerr << "Putting image back"
} << endl;
XPutImage(tmpdisp, p->bitmap, gc, im, 0, 0, }
0, 0, p->wid, p->hgh); XPutImage(tmpdisp, p->bitmap,
XDestroyImage(im); gc, im, 0, 0,
if (lyxerr.debugging()) { 0, 0, p->wid, p->hgh);
lyxerr << "Done translation" << endl; XDestroyImage(im);
} if (lyxerr.debugging()) {
lyxerr << "Done translation"
<< endl;
}
} }
noim: noim:
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
@ -284,9 +291,6 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
static void AllocColors(int num) static void AllocColors(int num)
// allocate color cube numxnumxnum, if possible // allocate color cube numxnumxnum, if possible
{ {
XColor xcol;
int i;
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr << "Allocating color cube " << num lyxerr << "Allocating color cube " << num
<< 'x' << num << 'x' << num << endl; << 'x' << num << 'x' << num << endl;
@ -298,10 +302,11 @@ static void AllocColors(int num)
return; return;
} }
if (num > 5) num = 5; if (num > 5) num = 5;
for (i = 0; i < num*num*num; ++i) { XColor xcol;
xcol.red = 65535*(i/(num*num))/(num-1); for (int i = 0; i < num * num * num; ++i) {
xcol.green = 65535*((i/num) % num)/(num-1); xcol.red = 65535 * (i / (num * num)) / (num - 1);
xcol.blue = 65535*(i % num)/(num-1); xcol.green = 65535 * ((i / num) % num) / (num - 1);
xcol.blue = 65535 * (i % num) / (num - 1);
xcol.flags = DoRed | DoGreen | DoBlue; xcol.flags = DoRed | DoGreen | DoBlue;
if (!XAllocColor(fl_display, color_map, &xcol)) { if (!XAllocColor(fl_display, color_map, &xcol)) {
if (i) XFreeColors(fl_display, color_map, if (i) XFreeColors(fl_display, color_map,
@ -310,7 +315,7 @@ static void AllocColors(int num)
lyxerr << "Cannot allocate color cube " lyxerr << "Cannot allocate color cube "
<< num << endl;; << num << endl;;
} }
AllocColors(num-1); AllocColors(num - 1);
return; return;
} }
gs_pixels[i] = xcol.pixel; gs_pixels[i] = xcol.pixel;
@ -318,18 +323,16 @@ static void AllocColors(int num)
gs_color = true; gs_color = true;
gs_gray = false; gs_gray = false;
gs_spc = num; gs_spc = num;
gs_num_pixels = num*num*num; gs_num_pixels = num * num * num;
} }
static void AllocGrays(int num)
// allocate grayscale ramp // allocate grayscale ramp
static
void AllocGrays(int num)
{ {
XColor xcol;
int i;
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr << "Allocating grayscale ramp " lyxerr << "Allocating grayscale colormap "
<< num << endl; << num << endl;
} }
@ -339,8 +342,9 @@ static void AllocGrays(int num)
return; return;
} }
if (num > 128) num = 128; if (num > 128) num = 128;
for (i = 0; i < num; ++i) { XColor xcol;
xcol.red = xcol.green = xcol.blue = 65535*i/(num-1); for (int i = 0; i < num; ++i) {
xcol.red = xcol.green = xcol.blue = 65535 * i / (num - 1);
xcol.flags = DoRed | DoGreen | DoBlue; xcol.flags = DoRed | DoGreen | DoBlue;
if (!XAllocColor(fl_display, color_map, &xcol)) { if (!XAllocColor(fl_display, color_map, &xcol)) {
if (i) XFreeColors(fl_display, color_map, if (i) XFreeColors(fl_display, color_map,
@ -349,7 +353,7 @@ static void AllocGrays(int num)
lyxerr << "Cannot allocate grayscale " lyxerr << "Cannot allocate grayscale "
<< num << endl; << num << endl;
} }
AllocGrays(num/2); AllocGrays(num / 2);
return; return;
} }
gs_pixels[i] = xcol.pixel; gs_pixels[i] = xcol.pixel;
@ -362,16 +366,16 @@ static void AllocGrays(int num)
void InitFigures() void InitFigures()
{ {
unsigned int i, j, k;
Visual *vi;
bmparrsize = figarrsize = figallocchunk; bmparrsize = figarrsize = figallocchunk;
figures = static_cast<Figref**>(malloc(sizeof(Figref*)*figallocchunk)); figures = static_cast<Figref**>
bitmaps = static_cast<figdata**>(malloc(sizeof(figdata*)*figallocchunk)); (malloc(sizeof(Figref*) * figallocchunk));
bitmaps = static_cast<figdata**>
(malloc(sizeof(figdata*) * figallocchunk));
for (i = 0; i < 256; ++i) { unsigned int k;
for (unsigned int i = 0; i < 256; ++i) {
k = 0; k = 0;
for (j = 0; j < 8; ++j) for (unsigned int j = 0; j < 8; ++j)
if (i & (1 << (7-j))) k |= 1 << j; if (i & (1 << (7-j))) k |= 1 << j;
bittable[i] = char(~k); bittable[i] = char(~k);
} }
@ -386,16 +390,16 @@ void InitFigures()
// first get visual // first get visual
gs_color = false; gs_color = false;
vi = DefaultVisual(fl_display, DefaultScreen(fl_display)); Visual * vi = DefaultVisual(fl_display, DefaultScreen(fl_display));
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
printf("Visual ID: %ld, class: %d, bprgb: %d, mapsz: %d\n", printf("Visual ID: %ld, class: %d, bprgb: %d, mapsz: %d\n",
vi->visualid, vi->c_class, vi->visualid, vi->c_class,
vi->bits_per_rgb, vi->map_entries); vi->bits_per_rgb, vi->map_entries);
} }
color_visual = ( (vi->c_class == StaticColor) || color_visual = ( (vi->c_class == StaticColor) ||
(vi->c_class == PseudoColor) || (vi->c_class == PseudoColor) ||
(vi->c_class == TrueColor) || (vi->c_class == TrueColor) ||
(vi->c_class == DirectColor) ); (vi->c_class == DirectColor) );
if ((vi->c_class & 1) == 0) return; if ((vi->c_class & 1) == 0) return;
// now allocate colors // now allocate colors
if (vi->c_class == GrayScale) { if (vi->c_class == GrayScale) {
@ -404,7 +408,7 @@ void InitFigures()
} else { } else {
// allocate normal color // allocate normal color
int i = 5; int i = 5;
while (i*i*i*2 > vi->map_entries) --i; while (i * i * i * 2 > vi->map_entries) --i;
AllocColors(i); AllocColors(i);
} }
gs_allcolors = vi->map_entries; gs_allcolors = vi->map_entries;
@ -432,7 +436,7 @@ void DoneFigures()
} }
int FindBmpIndex(figdata *tmpdata) int FindBmpIndex(figdata * tmpdata)
{ {
int i = 0; int i = 0;
while (i < bmpinsref) { while (i < bmpinsref) {
@ -456,7 +460,7 @@ static void chpixmap(Pixmap, int, int)
} }
static void freefigdata(figdata *tmpdata) static void freefigdata(figdata * tmpdata)
{ {
tmpdata->ref--; tmpdata->ref--;
if (tmpdata->ref) return; if (tmpdata->ref) return;
@ -478,7 +482,7 @@ static void freefigdata(figdata *tmpdata)
int i = FindBmpIndex(tmpdata); int i = FindBmpIndex(tmpdata);
--bmpinsref; --bmpinsref;
while (i < bmpinsref) { while (i < bmpinsref) {
bitmaps[i] = bitmaps[i+1]; bitmaps[i] = bitmaps[i + 1];
++i; ++i;
} }
} }
@ -557,7 +561,8 @@ static void runqueue()
// now set up ghostview property on a window // now set up ghostview property on a window
sprintf(tbuf, "0 0 0 0 %d %d 72 72 0 0 0 0", sprintf(tbuf, "0 0 0 0 %d %d 72 72 0 0 0 0",
p->data->wid, p->data->hgh); p->data->wid, p->data->hgh);
//#warning BUG seems that the only bug here might be the hardcoded dpi.. Bummer! // #warning BUG seems that the only bug here
// might be the hardcoded dpi.. Bummer!
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr << "Will set GHOSTVIEW property to [" lyxerr << "Will set GHOSTVIEW property to ["
@ -566,35 +571,37 @@ static void runqueue()
// wait until property is deleted if executing multiple // wait until property is deleted if executing multiple
// ghostscripts // ghostscripts
for (;;) { for (;;) {
// grab server to prevent other child interfering // grab server to prevent other child
// with setting GHOSTVIEW property // interfering with setting GHOSTVIEW property
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr << "Grabbing the server" << endl; lyxerr << "Grabbing the server"
<< endl;
} }
XGrabServer(tempdisp); XGrabServer(tempdisp);
prop = XListProperties(tempdisp, fl_get_canvas_id( prop = XListProperties(tempdisp,
fl_get_canvas_id(
figinset_canvas), &nprop); figinset_canvas), &nprop);
if (!prop) break; if (!prop) break;
bool err = true; bool err = true;
for (i = 0; i < nprop; ++i) { for (i = 0; i < nprop; ++i) {
char * p = XGetAtomName(tempdisp, prop[i]); char * p = XGetAtomName(tempdisp,
prop[i]);
if (strcmp(p, "GHOSTVIEW") == 0) { if (strcmp(p, "GHOSTVIEW") == 0) {
err = false; err = false;
break; break;
} }
XFree(p); XFree(p);
} }
XFree(reinterpret_cast<char *>(prop)); /* jc: */ XFree(reinterpret_cast<char *>(prop)); // jc:
if (err) break; if (err) break;
// release the server // release the server
XUngrabServer(tempdisp); XUngrabServer(tempdisp);
XFlush(tempdisp); XFlush(tempdisp);
// ok, property found, we must wait until ghostscript // ok, property found, we must wait until
// deletes it // ghostscript deletes it
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr << "Releasing the server" << endl; lyxerr << "Releasing the server\n["
lyxerr << "["
<< getpid() << getpid()
<< "] GHOSTVIEW property" << "] GHOSTVIEW property"
" found. Waiting." << endl; " found. Waiting." << endl;
@ -644,7 +651,8 @@ static void runqueue()
XChangeProperty(tempdisp, XChangeProperty(tempdisp,
fl_get_canvas_id(figinset_canvas), fl_get_canvas_id(figinset_canvas),
XInternAtom(tempdisp, "GHOSTVIEW_COLORS", false), XInternAtom(tempdisp,
"GHOSTVIEW_COLORS", false),
XInternAtom(tempdisp, "STRING", false), XInternAtom(tempdisp, "STRING", false),
8, PropModeReplace, 8, PropModeReplace,
reinterpret_cast<unsigned char*>(tbuf), reinterpret_cast<unsigned char*>(tbuf),
@ -658,9 +666,10 @@ static void runqueue()
// set up environment // set up environment
while (environ[ne]) ++ne; while (environ[ne]) ++ne;
env = static_cast<char **>(malloc(sizeof(char*)*(ne+2))); env = static_cast<char **>
(malloc(sizeof(char*) * (ne + 2)));
env[0] = tbuf2; env[0] = tbuf2;
memcpy(&env[1], environ, sizeof(char*)*(ne+1)); memcpy(&env[1], environ, sizeof(char*) * (ne + 1));
environ = env; environ = env;
// now make gs command // now make gs command
@ -676,8 +685,9 @@ static void runqueue()
sprintf(tbuf, "%s/~lyxgs%d.ps", system_tempdir.c_str(), sprintf(tbuf, "%s/~lyxgs%d.ps", system_tempdir.c_str(),
int(getpid())); int(getpid()));
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
printf("starting gs %s %s, pid: %d\n", tbuf, lyxerr << "starting gs " << tbuf << " "
p->data->fname.c_str(), int(getpid())); << p->data->fname
<< ", pid: " << getpid() << endl;
} }
int err = execlp(lyxrc->ps_command.c_str(), int err = execlp(lyxrc->ps_command.c_str(),
@ -710,14 +720,14 @@ static void runqueue()
} }
static void addwait(int psx, int psy, int pswid, int pshgh, figdata *data) static void addwait(int psx, int psy, int pswid, int pshgh, figdata * data)
{ {
// recompute the stuff and put in the queue // recompute the stuff and put in the queue
queue * p = new queue; queue * p = new queue;
p->ofsx = psx; p->ofsx = psx;
p->ofsy = psy; p->ofsy = psy;
p->rx = (float(data->raw_wid) * 72.0)/pswid; p->rx = (float(data->raw_wid) * 72.0) / pswid;
p->ry = (float(data->raw_hgh) * 72.0)/pshgh; p->ry = (float(data->raw_hgh) * 72.0) / pshgh;
p->data = data; p->data = data;
p->next = 0; p->next = 0;
@ -758,8 +768,10 @@ static figdata * getfigdata(int wid, int hgh, string const & fname,
if (bmpinsref > bmparrsize) { if (bmpinsref > bmparrsize) {
// allocate more space // allocate more space
bmparrsize += figallocchunk; bmparrsize += figallocchunk;
figdata ** tmp = static_cast<figdata**>(malloc(sizeof(figdata*)*bmparrsize)); figdata ** tmp = static_cast<figdata**>
memcpy(tmp, bitmaps, sizeof(figdata*)*(bmparrsize-figallocchunk)); (malloc(sizeof(figdata*) * bmparrsize));
memcpy(tmp, bitmaps,
sizeof(figdata*) * (bmparrsize - figallocchunk));
free(bitmaps); free(bitmaps);
bitmaps = tmp; bitmaps = tmp;
} }
@ -804,13 +816,13 @@ static figdata * getfigdata(int wid, int hgh, string const & fname,
} }
static void getbitmap(figdata *p) static void getbitmap(figdata * p)
{ {
p->gspid = -1; p->gspid = -1;
} }
static void makeupdatelist(figdata *p) static void makeupdatelist(figdata * p)
{ {
for (int i = 0; i < figinsref; ++i) for (int i = 0; i < figinsref; ++i)
if (figures[i]->data == p) { if (figures[i]->data == p) {
@ -933,8 +945,10 @@ static void RegisterFigure(InsetFig *fi)
if (figinsref > figarrsize) { if (figinsref > figarrsize) {
// allocate more space // allocate more space
figarrsize += figallocchunk; figarrsize += figallocchunk;
Figref **tmp = static_cast<Figref**>(malloc(sizeof(Figref*)*figarrsize)); Figref ** tmp = static_cast<Figref**>
memcpy(tmp, figures, sizeof(Figref*)*(figarrsize-figallocchunk)); (malloc(sizeof(Figref*)*figarrsize));
memcpy(tmp, figures,
sizeof(Figref*)*(figarrsize-figallocchunk));
free(figures); free(figures);
figures = tmp; figures = tmp;
} }
@ -1082,12 +1096,12 @@ void InsetFig::Draw(LyXFont font, LyXScreen & scr, int baseline, float & x)
int(x), int(x),
baseline - hgh - 1, wid+1, hgh+1); baseline - hgh - 1, wid+1, hgh+1);
if (figure && figure->data) { if (figure && figure->data) {
if (figure->data->broken) msg = _("[render error]"); if (figure->data->broken) msg = _("[render error]");
else if (figure->data->reading) msg = _("[rendering ... ]"); else if (figure->data->reading) msg = _("[rendering ... ]");
} else } else
if (fname.empty()) msg = _("[no file]"); if (fname.empty()) msg = _("[no file]");
else if ((flags & 3) == 0) msg = _("[not displayed]"); else if ((flags & 3) == 0) msg = _("[not displayed]");
else if (lyxrc->ps_command.empty()) msg = _("[no ghostscript]"); else if (lyxrc->ps_command.empty()) msg = _("[no ghostscript]");
if (!msg) msg = _("[unknown error]"); if (!msg) msg = _("[unknown error]");
@ -1095,8 +1109,8 @@ void InsetFig::Draw(LyXFont font, LyXScreen & scr, int baseline, float & x)
font.setSize (LyXFont::SIZE_FOOTNOTE); font.setSize (LyXFont::SIZE_FOOTNOTE);
string justname = OnlyFilename (fname); string justname = OnlyFilename (fname);
font.drawString(justname, pm, font.drawString(justname, pm,
baseline - font.maxAscent() - 4, baseline - font.maxAscent() - 4,
int(x) + 8); int(x) + 8);
font.setSize (LyXFont::SIZE_TINY); font.setSize (LyXFont::SIZE_TINY);
font.drawText (msg, strlen(msg), pm, font.drawText (msg, strlen(msg), pm,
baseline - 4, baseline - 4,
@ -1112,9 +1126,9 @@ void InsetFig::Write(ostream & os)
Regenerate(); Regenerate();
os << "Figure size " << wid << " " << hgh << "\n"; os << "Figure size " << wid << " " << hgh << "\n";
if (!fname.empty()) { if (!fname.empty()) {
string buf1 = OnlyPath(owner->fileName()); string buf1 = OnlyPath(owner->fileName());
string fname2 = MakeRelPath(fname, buf1); string fname2 = MakeRelPath(fname, buf1);
os << "file " << fname2 << "\n"; os << "file " << fname2 << "\n";
} }
if (!subcaption.empty()) if (!subcaption.empty())
os << "subcaption " << subcaption << "\n"; os << "subcaption " << subcaption << "\n";
@ -1234,7 +1248,7 @@ int InsetFig::Linuxdoc(string &/*file*/)
int InsetFig::DocBook(string & file) int InsetFig::DocBook(string & file)
{ {
string figurename= fname; string figurename = fname;
if(suffixIs(figurename, ".eps")) if(suffixIs(figurename, ".eps"))
figurename.erase(fname.length() - 5); figurename.erase(fname.length() - 5);
@ -1320,7 +1334,8 @@ Inset * InsetFig::Clone() const
tmp->pshgh = pshgh; tmp->pshgh = pshgh;
tmp->fname = fname; tmp->fname = fname;
if (!fname.empty() && (flags & 3) && !lyxrc->ps_command.empty()) { if (!fname.empty() && (flags & 3) && !lyxrc->ps_command.empty()) {
// do not display if there is "do not display" chosen (Matthias 260696) // do not display if there is
// "do not display" chosen (Matthias 260696)
tmp->figure->data = getfigdata(wid, hgh, fname, psx, psy, tmp->figure->data = getfigdata(wid, hgh, fname, psx, psy,
pswid, pshgh, raw_wid, raw_hgh, pswid, pshgh, raw_wid, raw_hgh,
angle, flags & (3|8)); angle, flags & (3|8));
@ -1453,7 +1468,7 @@ void InsetFig::Regenerate()
if (subfigure) { if (subfigure) {
if (!subcaption.empty()) if (!subcaption.empty())
cmdbuf = "\\subfigure[" + subcaption + cmdbuf = "\\subfigure[" + subcaption +
"]{" + cmdbuf + "}"; "]{" + cmdbuf + "}";
else else
cmdbuf = "\\subfigure{" + cmdbuf + "}"; cmdbuf = "\\subfigure{" + cmdbuf + "}";
} }
@ -1584,7 +1599,7 @@ void InsetFig::TempRegenerate()
if (!recmd.empty()) cmdbuf += '}'; if (!recmd.empty()) cmdbuf += '}';
if (psubfigure && !tsubcap.empty()) { if (psubfigure && !tsubcap.empty()) {
cmdbuf = string("\\subfigure{") + tsubcap cmdbuf = string("\\subfigure{") + tsubcap
+ string("}{") + cmdbuf + "}"; + string("}{") + cmdbuf + "}";
} }
} }
@ -1646,7 +1661,8 @@ void InsetFig::Recompute()
// compiler warnings. // compiler warnings.
break; break;
} }
if (htype && !wtype && frame_hgh) newx = newy*frame_wid/frame_hgh; if (htype && !wtype && frame_hgh)
newx = newy*frame_wid/frame_hgh;
} else { } else {
newx = wid; newx = wid;
newy = hgh; newy = hgh;
@ -1682,7 +1698,8 @@ void InsetFig::Recompute()
figdata * pf = figure->data; figdata * pf = figure->data;
// get new data // get new data
if (!fname.empty() && (flags & 3) && !lyxrc->ps_command.empty()) { if (!fname.empty() && (flags & 3)
&& !lyxrc->ps_command.empty()) {
// do not display if there is "do not display" // do not display if there is "do not display"
// chosen (Matthias 260696) // chosen (Matthias 260696)
figure->data = getfigdata(wid, hgh, fname, figure->data = getfigdata(wid, hgh, fname,
@ -1779,7 +1796,7 @@ void InsetFig::CallbackFig(long arg)
char const * p; char const * p;
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
printf("Figure callback, arg %ld\n", arg); lyxerr << "Figure callback, arg " << arg << endl;
} }
switch (arg) { switch (arg) {
@ -2123,15 +2140,15 @@ void InsetFig::BrowseFile()
buf = MakeAbsPath(p, buf2); buf = MakeAbsPath(p, buf2);
buf = OnlyPath(buf); buf = OnlyPath(buf);
} else { } else {
buf = OnlyPath(owner->fileName().c_str()); buf = OnlyPath(owner->fileName().c_str());
} }
// Does user clipart directory exist? // Does user clipart directory exist?
string bufclip = AddName (user_lyxdir, "clipart"); string bufclip = AddName (user_lyxdir, "clipart");
FileInfo fileInfo(bufclip); FileInfo fileInfo(bufclip);
if (!(fileInfo.isOK() && fileInfo.isDir())) if (!(fileInfo.isOK() && fileInfo.isDir()))
// No - bail out to system clipart directory // No - bail out to system clipart directory
bufclip = AddName (system_lyxdir, "clipart"); bufclip = AddName (system_lyxdir, "clipart");
fileDlg.SetButton(0, _("Clipart"), bufclip); fileDlg.SetButton(0, _("Clipart"), bufclip);
@ -2141,7 +2158,8 @@ void InsetFig::BrowseFile()
do { do {
ProhibitInput(); ProhibitInput();
if (once) { if (once) {
p = fileDlg.Select(_("EPS Figure"), current_figure_path, p = fileDlg.Select(_("EPS Figure"),
current_figure_path,
"*ps", string()); "*ps", string());
} else { } else {
p = fileDlg.Select(_("EPS Figure"), buf, p = fileDlg.Select(_("EPS Figure"), buf,
@ -2157,11 +2175,13 @@ void InsetFig::BrowseFile()
if (contains(p, "#") || contains(p, "~") || contains(p, "$") if (contains(p, "#") || contains(p, "~") || contains(p, "$")
|| contains(p, "%") || contains(p, " ")) || contains(p, "%") || contains(p, " "))
{ {
WriteAlert(_("Filename can't contain any of these characters:"), // xgettext:no-c-format WriteAlert(_("Filename can't contain any "
_("space, '#', '~', '$' or '%'.")); "of these characters:"),
error = true; // xgettext:no-c-format
} _("space, '#', '~', '$' or '%'."));
error = true;
}
} while (error); } while (error);
if (form) fl_set_input(form->EpsFile, buf.c_str()); if (form) fl_set_input(form->EpsFile, buf.c_str());

View File

@ -1,4 +1,3 @@
#include <config.h> #include <config.h>
#include <fstream> #include <fstream>
@ -28,7 +27,7 @@ FD_citation_form * citation_form = 0;
FD_bibitem_form * bibitem_form = 0; FD_bibitem_form * bibitem_form = 0;
static Combox * bibcombox = 0; static Combox * bibcombox = 0;
extern void UpdateInset(Inset* inset, bool mark_dirty = true); extern void UpdateInset(Inset * inset, bool mark_dirty = true);
void BibitemUpdate(Combox *); void BibitemUpdate(Combox *);
FD_citation_form * create_form_citation_form(void); FD_citation_form * create_form_citation_form(void);
FD_bibitem_form * create_form_bibitem_form(void); FD_bibitem_form * create_form_bibitem_form(void);
@ -56,18 +55,13 @@ extern "C" void bibitem_cb(FL_OBJECT *, long data)
case 3: // OK, bibitem case 3: // OK, bibitem
{ {
if(!current_view->buffer()->isReadonly()) { if(!current_view->buffer()->isReadonly()) {
InsetCommand *inset = static_cast<InsetCommand*>(bibitem_form->bibitem_form->u_vdata); InsetCommand * inset = static_cast<InsetCommand*>(bibitem_form->bibitem_form->u_vdata);
inset->setContents(fl_get_input(bibitem_form->key)); inset->setContents(fl_get_input(bibitem_form->key));
inset->setOptions(fl_get_input(bibitem_form->label)); inset->setOptions(fl_get_input(bibitem_form->label));
fl_hide_form(bibitem_form->bibitem_form); fl_hide_form(bibitem_form->bibitem_form);
// Does look like a hack? It is! (but will change at 0.13) // Does look like a hack? It is! (but will change at 0.13)
#ifdef MOVE_TEXT
current_view->text->RedoParagraph(); current_view->text->RedoParagraph();
current_view->update(1); current_view->update(1);
#else
current_view->buffer()->text->RedoParagraph();
current_view->buffer()->update(1);
#endif
break; break;
} // fall through to Cancel on RO-mode } // fall through to Cancel on RO-mode
} }
@ -81,27 +75,27 @@ extern "C" void bibitem_cb(FL_OBJECT *, long data)
FD_citation_form * create_form_citation_form(void) FD_citation_form * create_form_citation_form(void)
{ {
FL_OBJECT * obj; FL_OBJECT * obj;
FD_citation_form *fdui = (FD_citation_form *) fl_calloc(1, sizeof(FD_citation_form)); FD_citation_form * fdui = (FD_citation_form *) fl_calloc(1, sizeof(FD_citation_form));
fdui->citation_form = fl_bgn_form(FL_NO_BOX, 220, 130); fdui->citation_form = fl_bgn_form(FL_NO_BOX, 220, 130);
obj = fl_add_box(FL_UP_BOX, 0, 0, 220, 130, ""); obj = fl_add_box(FL_UP_BOX, 0, 0, 220, 130, "");
fdui->key = obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 60, 30, _("Key:")); fdui->key = obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 60, 30, _("Key:"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_RIGHT); fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
bibcombox = new Combox(FL_COMBOX_INPUT); bibcombox = new Combox(FL_COMBOX_INPUT);
bibcombox->add(80, 10, 130, 30, 120); bibcombox->add(80, 10, 130, 30, 120);
obj = fl_add_button(FL_RETURN_BUTTON, 20, 90, 90, 30, _("OK")); obj = fl_add_button(FL_RETURN_BUTTON, 20, 90, 90, 30, _("OK"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, bibitem_cb, 1); fl_set_object_callback(obj, bibitem_cb, 1);
obj = fl_add_button(FL_NORMAL_BUTTON, 120, 90, 90, 30, idex(_("Cancel|^["))); obj = fl_add_button(FL_NORMAL_BUTTON, 120, 90, 90, 30, idex(_("Cancel|^[")));
fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, bibitem_cb, 0); fl_set_object_callback(obj, bibitem_cb, 0);
fdui->label = obj = fl_add_input(FL_NORMAL_INPUT, 80, 50, 130, 30, idex(_("Remark:|#R"))); fdui->label = obj = fl_add_input(FL_NORMAL_INPUT, 80, 50, 130, 30, idex(_("Remark:|#R")));
fl_set_input_shortcut(obj, scex(_("Remark:|#R")), 1); fl_set_input_shortcut(obj, scex(_("Remark:|#R")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_end_form(); fl_end_form();
//fdui->citation_form->fdui = fdui; //fdui->citation_form->fdui = fdui;
@ -113,23 +107,23 @@ FD_citation_form * create_form_citation_form(void)
FD_bibitem_form * create_form_bibitem_form(void) FD_bibitem_form * create_form_bibitem_form(void)
{ {
FL_OBJECT * obj; FL_OBJECT * obj;
FD_bibitem_form *fdui = (FD_bibitem_form *) fl_calloc(1, sizeof(FD_bibitem_form)); FD_bibitem_form * fdui = (FD_bibitem_form *) fl_calloc(1, sizeof(FD_bibitem_form));
fdui->bibitem_form = fl_bgn_form(FL_NO_BOX, 220, 130); fdui->bibitem_form = fl_bgn_form(FL_NO_BOX, 220, 130);
obj = fl_add_box(FL_UP_BOX, 0, 0, 220, 130, ""); obj = fl_add_box(FL_UP_BOX, 0, 0, 220, 130, "");
fdui->key = obj = fl_add_input(FL_NORMAL_INPUT, 80, 10, 130, 30, idex(_("Key:|#K"))); fdui->key = obj = fl_add_input(FL_NORMAL_INPUT, 80, 10, 130, 30, idex(_("Key:|#K")));
fl_set_input_shortcut(obj, scex(_("Key:|#K")), 1); fl_set_input_shortcut(obj, scex(_("Key:|#K")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
obj = fl_add_button(FL_RETURN_BUTTON, 20, 90, 90, 30, _("OK")); obj = fl_add_button(FL_RETURN_BUTTON, 20, 90, 90, 30, _("OK"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, bibitem_cb, 3); fl_set_object_callback(obj, bibitem_cb, 3);
obj = fl_add_button(FL_NORMAL_BUTTON, 120, 90, 90, 30, idex(_("Cancel|^["))); obj = fl_add_button(FL_NORMAL_BUTTON, 120, 90, 90, 30, idex(_("Cancel|^[")));
fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, bibitem_cb, 2); fl_set_object_callback(obj, bibitem_cb, 2);
fdui->label = obj = fl_add_input(FL_NORMAL_INPUT, 80, 50, 130, 30, idex(_("Label:|#L"))); fdui->label = obj = fl_add_input(FL_NORMAL_INPUT, 80, 50, 130, 30, idex(_("Label:|#L")));
fl_set_input_shortcut(obj, scex(_("Label:|#L")), 1); fl_set_input_shortcut(obj, scex(_("Label:|#L")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_end_form(); fl_end_form();
//fdui->bibitem_form->fdui = fdui; //fdui->bibitem_form->fdui = fdui;
@ -175,7 +169,8 @@ void InsetCitation::Edit(int, int)
if (citation_form->citation_form->visible) { if (citation_form->citation_form->visible) {
fl_raise_form(citation_form->citation_form); fl_raise_form(citation_form->citation_form);
} else { } else {
fl_show_form(citation_form->citation_form, FL_PLACE_MOUSE, FL_FULLBORDER, fl_show_form(citation_form->citation_form,
FL_PLACE_MOUSE, FL_FULLBORDER,
_("Citation")); _("Citation"));
} }
} }
@ -215,7 +210,7 @@ InsetBibKey::~InsetBibKey()
{ {
if(bibitem_form && bibitem_form->bibitem_form if(bibitem_form && bibitem_form->bibitem_form
&& bibitem_form->bibitem_form->visible) && bibitem_form->bibitem_form->visible)
fl_hide_form(bibitem_form->bibitem_form); fl_hide_form(bibitem_form->bibitem_form);
} }
void InsetBibKey::setCounter(int c) void InsetBibKey::setCounter(int c)
@ -484,7 +479,7 @@ int bibitemMaxWidth(LyXFont const & font)
while (par) { while (par) {
if (par->bibkey) { if (par->bibkey) {
int wx = par->bibkey->Width(font); int wx = par->bibkey->Width(font);
if (wx>w) w = wx; if (wx > w) w = wx;
} }
par = par->next; par = par->next;
} }
@ -504,7 +499,7 @@ string bibitemWidthest()
while (par) { while (par) {
if (par->bibkey) { if (par->bibkey) {
int wx = par->bibkey->Width(font); int wx = par->bibkey->Width(font);
if (wx>w) { if (wx > w) {
w = wx; w = wx;
bkey = par->bibkey; bkey = par->bibkey;
} }

View File

@ -24,7 +24,7 @@ extern LyXRC * lyxrc;
/* LatexAccent. Proper handling of accented characters */ /* LatexAccent. Proper handling of accented characters */
/* This part is done by Ivan Schreter, schreter@ccsun.tuke.sk */ /* This part is done by Ivan Schreter, schreter@ccsun.tuke.sk */
/* Later modified by Lars G. Bjonnes, larsbj@ifi.uio.no */ /* Later modified by Lars G. Bjønnes, larsbj@lyx.org */
InsetLatexAccent::InsetLatexAccent() InsetLatexAccent::InsetLatexAccent()
{ {
@ -33,13 +33,13 @@ InsetLatexAccent::InsetLatexAccent()
InsetLatexAccent::InsetLatexAccent(InsetLatexAccent const & other) InsetLatexAccent::InsetLatexAccent(InsetLatexAccent const & other)
: Inset(), contents(other.contents), : Inset(), contents(other.contents),
candisp(other.candisp), candisp(other.candisp),
modtype(other.modtype), modtype(other.modtype),
remdot(other.remdot), remdot(other.remdot),
plusasc(other.plusasc), plusasc(other.plusasc),
plusdesc(other.plusdesc), plusdesc(other.plusdesc),
ic(other.ic) ic(other.ic)
{} {}
@ -199,7 +199,7 @@ void InsetLatexAccent::checkContents()
// special clause for \i{}, \j{} \l{} and \L{} // special clause for \i{}, \j{} \l{} and \L{}
if ((modtype == DOT_LESS_I || modtype == DOT_LESS_J if ((modtype == DOT_LESS_I || modtype == DOT_LESS_J
|| modtype == lSLASH || modtype == LSLASH) || modtype == lSLASH || modtype == LSLASH)
&& contents[3] == '}' ) { && contents[3] == '}' ) {
switch (modtype) { switch (modtype) {
case DOT_LESS_I: ic = 'i'; break; case DOT_LESS_I: ic = 'i'; break;
@ -218,7 +218,7 @@ void InsetLatexAccent::checkContents()
<< ", bot: " << plusdesc << ", bot: " << plusdesc
<< ", dot: " << remdot << ", dot: " << remdot
<< ", mod: " << modtype << endl; << ", mod: " << modtype << endl;
// Special case for space // Special case for space
} else if (contents[3] == '}') { } else if (contents[3] == '}') {
ic = ' '; ic = ' ';
} else { } else {
@ -235,15 +235,16 @@ void InsetLatexAccent::checkContents()
else else
return; return;
} else if ( (ic == 'i'|| ic == 'j') && contents[4] == '}') { } else if ( (ic == 'i'|| ic == 'j') && contents[4] == '}') {
// Do a rewrite: \<foo>{i} --> \<foo>{\i} // Do a rewrite: \<foo>{i} --> \<foo>{\i}
string temp = contents; string temp = contents;
temp.erase(3, string::npos); temp.erase(3, string::npos);
temp += '\\'; temp += '\\';
temp += char(ic); temp += char(ic);
for(string::size_type j = 4; j < contents.length(); ++j) for(string::size_type j = 4;
j < contents.length(); ++j)
temp+= contents[j]; temp+= contents[j];
contents= temp; contents= temp;
++i; ++i;
remdot = true; remdot = true;
} }
@ -320,9 +321,9 @@ int InsetLatexAccent::Rbearing(LyXFont const & font) const
bool InsetLatexAccent::DisplayISO8859_9(LyXFont font, bool InsetLatexAccent::DisplayISO8859_9(LyXFont font,
LyXScreen & scr, LyXScreen & scr,
int baseline, int baseline,
float & x) float & x)
{ {
unsigned char tmpic = ic; unsigned char tmpic = ic;
@ -337,8 +338,8 @@ bool InsetLatexAccent::DisplayISO8859_9(LyXFont font,
} }
case BREVE: case BREVE:
{ if (ic == 'g') tmpic = 0xf0; { if (ic == 'g') tmpic = 0xf0;
if (ic == 'G') tmpic = 0xd0; if (ic == 'G') tmpic = 0xd0;
break; break;
} }
case UMLAUT: case UMLAUT:
{ {
@ -476,7 +477,7 @@ void InsetLatexAccent::Draw(LyXFont font,
case UNDERDOT: // underdot case UNDERDOT: // underdot
case DOT: // dot case DOT: // dot
{ {
scr.drawArc(pgc, int(x2), y + (hg / 2.0), scr.fillArc(pgc, int(x2), y + (hg / 2.0),
1, 1, 0, 360*64); 1, 1, 0, 360*64);
break; break;
} }
@ -541,9 +542,9 @@ void InsetLatexAccent::Draw(LyXFont font,
{ {
float tmpadd = y; float tmpadd = y;
tmpadd += (remdot) ? tmpadd += (remdot) ?
asc/3.0 : asc / 3.0 :
asc/5.0; // if (remdot) -> i or j asc / 5.0; // if (remdot) -> i or j
float rad = ((hg * 4.0) / 8.0); float rad = hg / 2.0;
if (rad <= 1.0) { if (rad <= 1.0) {
scr.drawPoint(pgc, scr.drawPoint(pgc,
int(x2 - ((4.0 * hg) / 7.0)), int(x2 - ((4.0 * hg) / 7.0)),
@ -552,12 +553,15 @@ void InsetLatexAccent::Draw(LyXFont font,
int(x2 + ((4.0 * hg) / 7.0)), int(x2 + ((4.0 * hg) / 7.0)),
tmpadd); tmpadd);
} else { } else {
scr.drawArc(pgc, int(x2 - ((2.0 * hg) / 4.0)), rad += .5; // this ensures that f.ex. 1.5 will
// not be rounded down to .5 and then
// converted to int = 0
scr.fillArc(pgc, int(x2 - ((2.0 * hg) / 4.0)),
tmpadd, tmpadd,
rad - 1, rad - 1, 0, 360*64); rad, rad, 0, 360*64);
scr.drawArc(pgc, int(x2 + ((2.0 * hg) / 4.0)), scr.fillArc(pgc, int(x2 + ((2.0 * hg) / 4.0)),
tmpadd, tmpadd,
rad - 1, rad - 1, 0, 360*64); rad, rad, 0, 360*64);
} }
break; break;
} }

View File

@ -37,8 +37,8 @@ extern "C" void C_Intl_DispatchCallback(FL_OBJECT * ob, long code);
Intl::Intl() Intl::Intl()
: prim_lang(lyxrc->primary_kbmap), : prim_lang(lyxrc->primary_kbmap),
sec_lang(lyxrc->secondary_kbmap), sec_lang(lyxrc->secondary_kbmap),
trans(new TransManager) trans(new TransManager)
{ {
keymapon = lyxrc->use_kbmap; keymapon = lyxrc->use_kbmap;
chsetcode = 0; chsetcode = 0;

View File

@ -39,31 +39,17 @@ enum { ModsMask = ShiftMask | ControlMask | Mod1Mask};
maxlen - length of string (including '\0') maxlen - length of string (including '\0')
Returns : length of printed string if ok, 0 otherwise. Returns : length of printed string if ok, 0 otherwise.
\* ---F------------------------------------------------------------------- */ \* ---F------------------------------------------------------------------- */
static static
int printKeysym( KeySym key, unsigned int mod, char *buf, int maxlen ) void printKeysym( KeySym key, unsigned int mod, string & buf)
{ {
mod &= ModsMask; mod &= ModsMask;
// calc required length; char * s = XKeysymToString(key);
int len = 0;
if ( mod & ShiftMask ) len += 2;
if ( mod & ControlMask ) len += 2;
if ( mod & Mod1Mask ) len += 2;
char * s = XKeysymToString( key ); if (mod & ShiftMask) buf += "S-";
if ( s ) len += strlen( s ); if (mod & ControlMask) buf += "C-";
if ( len < maxlen ) { if (mod & Mod1Mask) buf += "M-";
if ( mod & ShiftMask ) { if (s) buf += s;
*buf++ = 'S'; *buf++ = '-'; }
if ( mod & ControlMask ) {
*buf++ = 'C'; *buf++ = '-'; }
if ( mod & Mod1Mask ) {
*buf++ = 'M'; *buf++ = '-'; }
if ( s ) strcpy( buf, s );
return len;
} else
return 0;
} }
@ -78,41 +64,23 @@ int printKeysym( KeySym key, unsigned int mod, char *buf, int maxlen )
\* ---F------------------------------------------------------------------- */ \* ---F------------------------------------------------------------------- */
static static
int printKeyTab( kb_key * tabPt, char *buf, int maxLen ) void printKeyTab( kb_key * tabPt, string & buf)
{ {
int len, doneLen = 0;
unsigned int ksym, mod; unsigned int ksym, mod;
/* -------> Print each of the slots into buf. */ /* -------> Print each of the slots into buf. */
for( ; (tabPt->code & 0xffff) != NoSymbol; ++tabPt) { for( ; (tabPt->code & 0xffff) != NoSymbol; ++tabPt) {
if ( maxLen <= 0 ) break;
ksym = tabPt->code; ksym = tabPt->code;
mod = tabPt->mod & 0xffff; mod = tabPt->mod & 0xffff;
len = printKeysym( ksym, mod, buf, maxLen ); printKeysym(ksym, mod, buf);
if ( len <= 0 ) break; buf += ' ';
buf += len;
maxLen -= len;
doneLen += len;
/* -------> Add space when possible. */
if ( maxLen > 0 ) {
*buf++ = ' ';
*buf = '\0';
maxLen--;
doneLen++;
}
} }
return doneLen;
} }
// === kb_sequence methods ================================================ // === kb_sequence methods ================================================
/* ---F+------------------------------------------------------------------ *\ /* ---F+------------------------------------------------------------------ *\
Function : kb_sequence::addkey Function : kb_sequence::addkey
Called by : [user] Called by : [user]
@ -123,12 +91,13 @@ int printKeyTab( kb_key * tabPt, char *buf, int maxLen )
Returns : action or -1 if error (no map defined or key not found) Returns : action or -1 if error (no map defined or key not found)
\* ---F------------------------------------------------------------------- */ \* ---F------------------------------------------------------------------- */
int kb_sequence::addkey(KeySym key, unsigned int mod, unsigned int nmod /*= 0*/) int kb_sequence::addkey(KeySym key,
unsigned int mod, unsigned int nmod /*= 0*/)
{ {
if(length < 0) length = 0; if(length < 0) length = 0;
if(length + 1 >= size) { if(length + 1 >= size) {
unsigned int * nseq = new unsigned int[size+KB_PREALLOC]; unsigned int * nseq = new unsigned int[size + KB_PREALLOC];
size += KB_PREALLOC; size += KB_PREALLOC;
memcpy(nseq, sequence, length * sizeof(unsigned int)); memcpy(nseq, sequence, length * sizeof(unsigned int));
if(sequence != staticseq) delete sequence; if(sequence != staticseq) delete sequence;
@ -209,7 +178,7 @@ int kb_sequence::parse(char const * s)
} }
} else { } else {
int j = 0; int j = 0;
for(j = i; s[j] && (s[j])>' '; ++j) for(j = i; s[j] && s[j] > ' '; ++j)
tbuf[j-i] = s[j]; // (!!!check bounds :-) tbuf[j-i] = s[j]; // (!!!check bounds :-)
tbuf[j-i] = '\0'; tbuf[j-i] = '\0';
@ -242,11 +211,10 @@ int kb_sequence::parse(char const * s)
Returns : 0, if ok, -1 if string too long Returns : 0, if ok, -1 if string too long
\* ---F------------------------------------------------------------------- */ \* ---F------------------------------------------------------------------- */
int kb_sequence::print(char * buf, int maxlen, bool when_defined) const int kb_sequence::print(string & buf, bool when_defined) const
{ {
KeySym key; KeySym key;
unsigned int mod; unsigned int mod;
int len;
int l = length; int l = length;
if ( l < 0 && !when_defined ) l = -l; if ( l < 0 && !when_defined ) l = -l;
@ -254,21 +222,12 @@ int kb_sequence::print(char * buf, int maxlen, bool when_defined) const
key = sequence[i]; key = sequence[i];
mod = modifiers[i] & 0xffff; mod = modifiers[i] & 0xffff;
len = printKeysym( key, mod, buf, maxlen ); // RVDK_PATCH_5 printKeysym(key, mod, buf); // RVDK_PATCH_5
buf += len;
maxlen -= len;
if ( len == 0 ) {
*buf = '\0';
return -1;
}
if(i+1<l && maxlen>1) { // append a blank if(i + 1 < l) { // append a blank
*buf++ = ' '; buf += ' ';
maxlen--;
} }
} }
*buf = '\0';
return 0; return 0;
} }
@ -283,24 +242,13 @@ int kb_sequence::print(char * buf, int maxlen, bool when_defined) const
Returns : 0, if ok, -1 if string too long Returns : 0, if ok, -1 if string too long
\* ---F------------------------------------------------------------------- */ \* ---F------------------------------------------------------------------- */
int kb_sequence::printOptions(char * buf, int maxlen) const int kb_sequence::printOptions(string & buf) const
{ {
print(buf, maxlen, true); print(buf, true);
int len = strlen(buf);
maxlen -= len;
buf += len;
if ( maxlen < 20 || !curmap ) return -1; if (!curmap) return -1;
#ifdef WITH_WARNINGS buf += _(" options: ");
#warning reimplement kb_sequence using string curmap->print(buf);
#endif
char s[20];
strcpy(s, _(" options: "));
strcpy( buf, s);
buf += strlen(s);
maxlen -= strlen(s);
curmap->print(buf, maxlen);
return 0; return 0;
} }
@ -402,7 +350,10 @@ int kb_keymap::bind(char const * seq, int action)
int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence * seq) int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence * seq)
{ {
unsigned int hashval, ksym, msk1, msk0; #ifndef NO_HASH
unsigned int hashval;
#endif
unsigned int ksym, msk1, msk0;
kb_key * tab; kb_key * tab;
//suppress modifier bits we do not handle //suppress modifier bits we do not handle
@ -415,6 +366,7 @@ int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence * seq)
return -1; return -1;
} }
#ifndef NO_HASH
if(size < 0) { // --- if hash table --- if(size < 0) { // --- if hash table ---
hashval = ((key&0xff) ^ ((key>>8)&0xff)) % KB_HASHSIZE; hashval = ((key&0xff) ^ ((key>>8)&0xff)) % KB_HASHSIZE;
tab = htable[hashval]; tab = htable[hashval];
@ -424,6 +376,7 @@ int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence * seq)
return -1; return -1;
} }
} else // --- else: linear list --- } else // --- else: linear list ---
#endif
tab = table; tab = table;
// --- now search the list of keys --- // --- now search the list of keys ---
@ -436,11 +389,11 @@ int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence * seq)
if(ksym == key && (mod & ~msk0) == msk1) { if(ksym == key && (mod & ~msk0) == msk1) {
// match found: // match found:
if(tab->table) { if(tab->table) {
// this is a prefix key - set new map // this is a prefix key - set new map
seq->curmap = tab->table; seq->curmap = tab->table;
return 0; return 0;
} else { } else {
// final key - reset map // final key - reset map
seq->curmap = seq->stdmap; seq->curmap = seq->stdmap;
seq->delseq(); seq->delseq();
return tab->action; // ... and return action return tab->action; // ... and return action
@ -464,31 +417,22 @@ int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence * seq)
Returns : updated maxLen. Returns : updated maxLen.
\* ---F------------------------------------------------------------------- */ \* ---F------------------------------------------------------------------- */
int kb_keymap::print(char * buf, int maxLen) const void kb_keymap::print(string & buf) const
{ {
/* -----> Return when running out of string space or when keymap has no table. // Return when keymap has no table.
Else, place a terminating newline in case no other output is generated. */ if (!table) return;
if ( maxLen <= 3 || !buf ) return maxLen;
if ( !table ) return maxLen;
*buf = '\0';
/* -------> Hash table. Process each of its slots recursively and return. */ // Process each of its slots recursively and return.
if ( size < 0 ) { #ifndef NO_HASH
for ( int ix = 0; (ix < KB_HASHSIZE) && (maxLen > 1); ++ix ) { if ( size < 0 ) { // Hash table
for ( int ix = 0; ix < KB_HASHSIZE; ++ix ) {
if ( htable[ix] ) { if ( htable[ix] ) {
int len = printKeyTab( htable[ix], buf, maxLen ); printKeyTab(htable[ix], buf);
maxLen -= len;
buf += len;
} }
} }
} else { } else // Normal table
/* -------> Normal table. */ #endif
int len = printKeyTab( table, buf, maxLen ); printKeyTab(table, buf);
maxLen -= len;
buf += len;
}
return maxLen;
} }
@ -502,13 +446,13 @@ int kb_keymap::print(char * buf, int maxLen) const
Returns : 0 if ok. Returns : 0 if ok.
\* ---F------------------------------------------------------------------- */ \* ---F------------------------------------------------------------------- */
int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/) int kb_keymap::defkey(kb_sequence * seq, int action, int idx /*= 0*/)
{ {
unsigned int code = seq->sequence[idx]; unsigned int code = seq->sequence[idx];
if(code == NoSymbol) return -1; if(code == NoSymbol) return -1;
unsigned int modmsk = seq->modifiers[idx]; unsigned int modmsk = seq->modifiers[idx];
kb_key *tab, **ptab; kb_key * tab, ** ptab;
// --- get list------------------------------------------------------ // --- get list------------------------------------------------------
if(!table) { if(!table) {
// If we don't have any yet, make an empty one // If we don't have any yet, make an empty one
@ -517,10 +461,11 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
tab = table; tab = table;
ptab = &table; ptab = &table;
size = KB_PREALLOC; size = KB_PREALLOC;
} else if(size<0) { #ifndef NO_HASH
} else if(size < 0) {
// Hash table. // Hash table.
int hashval = (code&0xffff); int hashval = code & 0xffff;
hashval = ((hashval&0xff) ^ ((hashval>>8)&0xff)) % KB_HASHSIZE; hashval = ((hashval & 0xff) ^ ((hashval >> 8) & 0xff)) % KB_HASHSIZE;
tab = htable[hashval]; tab = htable[hashval];
ptab = htable+hashval; ptab = htable+hashval;
if(!tab) { if(!tab) {
@ -528,6 +473,7 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
tab[0].code = NoSymbol; tab[0].code = NoSymbol;
*ptab = tab; *ptab = tab;
} }
#endif
} else { } else {
tab = table; tab = table;
ptab = &table; ptab = &table;
@ -540,8 +486,8 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
for(t = tab, tsize = 1; t->code != NoSymbol; ++t, ++tsize) { for(t = tab, tsize = 1; t->code != NoSymbol; ++t, ++tsize) {
if(code == t->code && modmsk == t->mod) { // -- overwrite binding --- if(code == t->code && modmsk == t->mod) { // -- overwrite binding ---
if(idx+1 == seq->length) { if(idx+1 == seq->length) {
char buf[20]; buf[0] = 0; string buf;
seq->print(buf, 20, true); seq->print(buf, true);
lyxerr[Debug::KEY] lyxerr[Debug::KEY]
<< "Warning: New binding for '" << "Warning: New binding for '"
<< buf << buf
@ -555,28 +501,28 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
t->action = action; t->action = action;
return 0; return 0;
} else if (!t->table) { } else if (!t->table) {
char buf[20]; buf[0] = 0; string buf;
seq->print(buf, 20, true); seq->print(buf, true);
lyxerr << "Error: New binding for '" << buf lyxerr << "Error: New binding for '" << buf
<< "' is overriding old binding..." << "' is overriding old binding..."
<< endl; << endl;
return -1; return -1;
} else } else
return t->table->defkey(seq, action, idx+1); return t->table->defkey(seq, action, idx + 1);
} }
} }
// --- extend list if necessary ------------------------------------- // --- extend list if necessary -------------------------------------
if(tsize % KB_PREALLOC == 0) { if(tsize % KB_PREALLOC == 0) {
kb_key * nt = new kb_key[tsize+KB_PREALLOC]; kb_key * nt = new kb_key[tsize + KB_PREALLOC];
// Set to 0 as table is used uninitialised later (thornley) // Set to 0 as table is used uninitialised later (thornley)
nt[tsize].table = 0; nt[tsize].table = 0;
memcpy(nt, tab, tsize * sizeof(kb_key)); memcpy(nt, tab, tsize * sizeof(kb_key));
*ptab = nt; *ptab = nt;
delete[] tab; delete[] tab;
tab = nt; tab = nt;
if(size>= 0) size = tsize + KB_PREALLOC; if(size >= 0) size = tsize + KB_PREALLOC;
} }
// --- add action --------------------------------------------------- // --- add action ---------------------------------------------------
@ -588,6 +534,7 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
// --- convert list to hash table if necessary ---------------------- // --- convert list to hash table if necessary ----------------------
#ifndef NO_HASH
if(size >= 0 && tsize >= 32) { if(size >= 0 && tsize >= 32) {
kb_key * oldtab = tab; kb_key * oldtab = tab;
kb_key ** nht = new kb_key*[KB_HASHSIZE]; kb_key ** nht = new kb_key*[KB_HASHSIZE];
@ -630,7 +577,7 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
} }
delete[] oldtab; delete[] oldtab;
} }
#endif
// --- define rest of sequence -------------------------------------- // --- define rest of sequence --------------------------------------
if(idx+1 == seq->length) { if(idx+1 == seq->length) {
@ -656,6 +603,7 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
kb_keymap::~kb_keymap() kb_keymap::~kb_keymap()
{ {
if(!table) return; if(!table) return;
#ifndef NO_HASH
if(size < 0) { if(size < 0) {
for(int i = 0; i < KB_HASHSIZE; ++i) { for(int i = 0; i < KB_HASHSIZE; ++i) {
if(htable[i]) { if(htable[i]) {
@ -668,25 +616,32 @@ kb_keymap::~kb_keymap()
} }
delete htable; delete htable;
} else { } else {
#endif
for(kb_key * t = table; t->code != NoSymbol; ++t) for(kb_key * t = table; t->code != NoSymbol; ++t)
if(t->table) if(t->table)
delete t->table; delete t->table;
delete table; delete table;
#ifndef NO_HASH
} }
#endif
} }
string keyname(kb_key k) {
char buf[100]; string keyname(kb_key k)
printKeysym(k.code, k.mod, buf, 100); {
string buf;
printKeysym(k.code, k.mod, buf);
return buf; return buf;
} }
// Finds a key for a keyaction, if possible
string kb_keymap::findbinding(int act) const {
string res;
if (!table)
return res;
// Finds a key for a keyaction, if possible
string kb_keymap::findbinding(int act) const
{
string res;
if (!table) return res;
#ifndef NO_HASH
if (size < 0) { if (size < 0) {
for(int i = 0; i < KB_HASHSIZE; ++i) { for(int i = 0; i < KB_HASHSIZE; ++i) {
if(htable[i]) { if(htable[i]) {
@ -707,6 +662,7 @@ string kb_keymap::findbinding(int act) const {
} }
} }
} else { } else {
#endif
for(kb_key * t = table; t->code != NoSymbol; ++t) { for(kb_key * t = table; t->code != NoSymbol; ++t) {
if(t->table) { if(t->table) {
string suffix = t->table->findbinding(act); string suffix = t->table->findbinding(act);
@ -720,7 +676,9 @@ string kb_keymap::findbinding(int act) const {
res += "[" + keyname(*t) + "] "; res += "[" + keyname(*t) + "] ";
} }
} }
#ifndef NO_HASH
} }
#endif
return res; return res;
} }

View File

@ -17,10 +17,13 @@
#include "LString.h" #include "LString.h"
#define NO_HASH 1
#define KB_PREALLOC 16 #define KB_PREALLOC 16
#ifndef NO_HASH
#define KB_HASHSIZE 128 // yes, yes - I know. 128 is not exactly prime :-) #define KB_HASHSIZE 128 // yes, yes - I know. 128 is not exactly prime :-)
// ... but we are dealing with ASCII chars mostly. // ... but we are dealing with ASCII chars mostly.
#endif
class kb_keymap; class kb_keymap;
class kb_sequence; class kb_sequence;
@ -53,11 +56,11 @@ public:
/// Bind a key-sequence to an action /// Bind a key-sequence to an action
/** Returns 0 on success. Otherwise, position in string where /** Returns 0 on success. Otherwise, position in string where
error occured. */ error occured. */
int bind(char const * seq, int action); int bind(char const * seq, int action);
/// ///
int print(char * buf, int maxlen) const; void print(string & buf) const;
/// Look up a key in the keymap /// Look up a key in the keymap
int lookup(KeySym key, unsigned mod, kb_sequence * seq); int lookup(KeySym key, unsigned mod, kb_sequence * seq);
@ -69,18 +72,21 @@ private:
int defkey(kb_sequence * seq, int action, int idx = 0); int defkey(kb_sequence * seq, int action, int idx = 0);
/// Size of the table (<0: hashtab) /// Size of the table (<0: hashtab)
int size; int size;
/// Holds the defined keys /// Holds the defined keys
/** Both kinds of tables ends with NoSymbol */ /** Both kinds of tables ends with NoSymbol */
#ifndef NO_HASH
union union
{ {
#endif
/// Table for linear array /// Table for linear array
kb_key * table; kb_key * table;
#ifndef NO_HASH
/// Hash table holding key lists /// Hash table holding key lists
kb_key ** htable; kb_key ** htable;
}; };
#endif
}; };
@ -101,23 +107,23 @@ public:
/// ///
~kb_sequence() ~kb_sequence()
{ {
if (sequence != staticseq) { if (sequence != staticseq) {
delete sequence; delete sequence;
delete modifiers; delete modifiers;
}
} }
}
/// Add a key to the key sequence and look it up in the curmap /// Add a key to the key sequence and look it up in the curmap
/** Add a key to the key sequence and look it up in the curmap /** Add a key to the key sequence and look it up in the curmap
if the latter is defined. */ if the latter is defined. */
int addkey(KeySym key, unsigned mod, unsigned nmod = 0); int addkey(KeySym key, unsigned mod, unsigned nmod = 0);
/// ///
int print(char * buf, int maxlen, bool when_defined = false) const; //RVDK_PATCH_5 int print(string & buf, bool when_defined = false) const;
/// ///
int printOptions(char * buf, int maxlen) const; int printOptions(string & buf) const;
/// Make length negative to mark the sequence as deleted /// Make length negative to mark the sequence as deleted
void delseq(); void delseq();

View File

@ -82,6 +82,8 @@ enum LyXAlignment {
/// ///
LYX_ALIGN_SPECIAL = 32 LYX_ALIGN_SPECIAL = 32
}; };
inline void operator|=(LyXAlignment & la1, LyXAlignment la2) { inline void operator|=(LyXAlignment & la1, LyXAlignment la2) {
la1 = static_cast<LyXAlignment>(la1 | la2); la1 = static_cast<LyXAlignment>(la1 | la2);
} }
@ -187,7 +189,9 @@ public:
string const & labelstring() const { return labelstring_; } string const & labelstring() const { return labelstring_; }
string const & preamble() const { return preamble_; } string const & preamble() const { return preamble_; }
string const & latexparam() const { return latexparam_; } string const & latexparam() const { return latexparam_; }
string const & labelstring_appendix() const { return labelstring_appendix_; } string const & labelstring_appendix() const {
return labelstring_appendix_;
}
/** Default font for this layout/environment. /** Default font for this layout/environment.
The main font for this kind of environment. If an attribute has The main font for this kind of environment. If an attribute has
LyXFont::INHERITED_*, it means that the value is specified by LyXFont::INHERITED_*, it means that the value is specified by
@ -290,7 +294,7 @@ public:
} }
/// ///
bool isCommand() const { bool isCommand() const {
return latextype == LATEX_COMMAND; return latextype == LATEX_COMMAND;
} }
/// ///
bool isEnvironment() const { bool isEnvironment() const {
@ -475,12 +479,14 @@ private:
bool loaded; bool loaded;
}; };
/// ///
inline void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2) inline void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2)
{ {
p1 = static_cast<LyXTextClass::Provides>(p1 | p2); p1 = static_cast<LyXTextClass::Provides>(p1 | p2);
} }
/// ///
inline ostream & operator<<(ostream & os, LyXTextClass::PageSides p) inline ostream & operator<<(ostream & os, LyXTextClass::PageSides p)
{ {
@ -495,6 +501,7 @@ inline ostream & operator<<(ostream & os, LyXTextClass::PageSides p)
return os; return os;
} }
/// ///
class LyXTextClassList { class LyXTextClassList {
public: public:

File diff suppressed because it is too large Load Diff

View File

@ -63,12 +63,13 @@ bool setForegroundColor(char const * const color, XGCValues & val)
if (!mono_video) { if (!mono_video) {
if (XParseColor(fl_display, color_map, color, &xcol) if (XParseColor(fl_display, color_map, color, &xcol)
&& XAllocColor(fl_display, color_map, &xcol)) && XAllocColor(fl_display, color_map, &xcol))
{ {
val.foreground = xcol.pixel; val.foreground = xcol.pixel;
} else { } else {
lyxerr << "LyX: Couldn't get color " << color << endl; lyxerr << "LyX: Couldn't get color "
return false; << color << endl;
} return false;
}
} }
return true; return true;
} }
@ -79,14 +80,14 @@ void do_reverse_video(XGCValues &val)
{ {
if (reverse_video) { if (reverse_video) {
val.foreground= WhitePixel(fl_display, val.foreground= WhitePixel(fl_display,
DefaultScreen(fl_display)); DefaultScreen(fl_display));
val.background= BlackPixel(fl_display, val.background= BlackPixel(fl_display,
DefaultScreen(fl_display)); DefaultScreen(fl_display));
} else { } else {
val.foreground= BlackPixel(fl_display, val.foreground= BlackPixel(fl_display,
DefaultScreen(fl_display)); DefaultScreen(fl_display));
val.background= WhitePixel(fl_display, val.background= WhitePixel(fl_display,
DefaultScreen(fl_display)); DefaultScreen(fl_display));
} }
} }
@ -145,17 +146,22 @@ GC GetLatexGC()
XGCValues val; XGCValues val;
if (reverse_video ^ mono_video) { if (reverse_video ^ mono_video) {
val.foreground= WhitePixel(fl_display, DefaultScreen(fl_display)); val.foreground= WhitePixel(fl_display,
val.background= BlackPixel(fl_display, DefaultScreen(fl_display)); DefaultScreen(fl_display));
val.background= BlackPixel(fl_display,
DefaultScreen(fl_display));
} else { } else {
val.foreground= BlackPixel(fl_display, DefaultScreen(fl_display)); val.foreground= BlackPixel(fl_display,
val.background= WhitePixel(fl_display, DefaultScreen(fl_display)); DefaultScreen(fl_display));
val.background= WhitePixel(fl_display,
DefaultScreen(fl_display));
} }
val.function= GXcopy; val.function= GXcopy;
val.graphics_exposures = false; val.graphics_exposures = false;
setForegroundColor(latex_color, val); setForegroundColor(latex_color, val);
latex_gc = XCreateGC(fl_display, fl_root, GCBackground latex_gc = XCreateGC(fl_display, fl_root, GCBackground
| GCForeground | GCFunction | GCGraphicsExposures, | GCForeground | GCFunction
| GCGraphicsExposures,
&val); &val);
XFlush(fl_display); XFlush(fl_display);
@ -216,14 +222,14 @@ GC GetClearGC()
if (reverse_video) { if (reverse_video) {
val.foreground= BlackPixel(fl_display, val.foreground= BlackPixel(fl_display,
DefaultScreen(fl_display)); DefaultScreen(fl_display));
val.background= WhitePixel(fl_display, val.background= WhitePixel(fl_display,
DefaultScreen(fl_display)); DefaultScreen(fl_display));
} else { } else {
val.background= BlackPixel(fl_display, val.background= BlackPixel(fl_display,
DefaultScreen(fl_display)); DefaultScreen(fl_display));
val.foreground= WhitePixel(fl_display, val.foreground= WhitePixel(fl_display,
DefaultScreen(fl_display)); DefaultScreen(fl_display));
} }
val.function = GXcopy; val.function = GXcopy;
val.graphics_exposures = false; val.graphics_exposures = false;
@ -233,7 +239,8 @@ GC GetClearGC()
background_pixels = val.foreground; background_pixels = val.foreground;
clear_gc = XCreateGC(fl_display, fl_root, GCBackground clear_gc = XCreateGC(fl_display, fl_root, GCBackground
| GCForeground | GCFunction | GCGraphicsExposures, | GCForeground | GCFunction
| GCGraphicsExposures,
&val); &val);
XFlush(fl_display); XFlush(fl_display);
@ -276,7 +283,8 @@ GC GetThickLineGC()
val.line_width = 2; val.line_width = 2;
val.line_style = LineSolid; val.line_style = LineSolid;
thick_line_gc = XCreateGC(fl_display, fl_root, GCBackground thick_line_gc = XCreateGC(fl_display, fl_root, GCBackground
| GCForeground | GCFunction | GCGraphicsExposures | GCForeground | GCFunction
| GCGraphicsExposures
| GCLineWidth | GCLineStyle , &val); | GCLineWidth | GCLineStyle , &val);
XFlush(fl_display); XFlush(fl_display);
@ -339,7 +347,7 @@ GC GetSelectGC()
val.function= GXinvert; val.function= GXinvert;
select_gc = XCreateGC(fl_display, fl_root, select_gc = XCreateGC(fl_display, fl_root,
GCFunction | GCGraphicsExposures | GCPlaneMask GCFunction | GCGraphicsExposures | GCPlaneMask
| GCLineWidth | GCLineStyle , &val); | GCLineWidth | GCLineStyle , &val);
XFlush(fl_display); XFlush(fl_display);
return select_gc; return select_gc;
@ -355,14 +363,14 @@ GC GetSelectionGC()
if (!reverse_video) { if (!reverse_video) {
val.foreground= BlackPixel(fl_display, val.foreground= BlackPixel(fl_display,
DefaultScreen(fl_display)); DefaultScreen(fl_display));
val.background= WhitePixel(fl_display, val.background= WhitePixel(fl_display,
DefaultScreen(fl_display)); DefaultScreen(fl_display));
} else { } else {
val.background= BlackPixel(fl_display, val.background= BlackPixel(fl_display,
DefaultScreen(fl_display)); DefaultScreen(fl_display));
val.foreground= WhitePixel(fl_display, val.foreground= WhitePixel(fl_display,
DefaultScreen(fl_display)); DefaultScreen(fl_display));
} }
val.function= GXcopy; val.function= GXcopy;
@ -389,9 +397,11 @@ GC GetLightedGC()
if (lighted_gc) return lighted_gc; if (lighted_gc) return lighted_gc;
XGCValues val; XGCValues val;
if (reverse_video) { if (reverse_video) {
val.background= BlackPixel(fl_display, DefaultScreen(fl_display)); val.background= BlackPixel(fl_display,
DefaultScreen(fl_display));
} else { } else {
val.background= WhitePixel(fl_display, DefaultScreen(fl_display)); val.background= WhitePixel(fl_display,
DefaultScreen(fl_display));
} }
val.foreground= val.background; val.foreground= val.background;
val.function= GXcopy; val.function= GXcopy;
@ -400,7 +410,8 @@ GC GetLightedGC()
val.line_width = 0; val.line_width = 0;
setForegroundColor(lighted_color, val); setForegroundColor(lighted_color, val);
lighted_gc = XCreateGC(fl_display, fl_root, GCBackground lighted_gc = XCreateGC(fl_display, fl_root, GCBackground
| GCForeground | GCFunction | GCGraphicsExposures | GCForeground | GCFunction
| GCGraphicsExposures
| GCLineWidth | GCLineStyle , &val); | GCLineWidth | GCLineStyle , &val);
XFlush(fl_display); XFlush(fl_display);

View File

@ -4,7 +4,7 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* *
* ====================================================== */ * ====================================================== */
@ -24,7 +24,7 @@
// for us, since we use these names below. But of course this is due // for us, since we use these names below. But of course this is due
// to some old compilers. Than is broken when it comes to C++ scoping. // to some old compilers. Than is broken when it comes to C++ scoping.
#include "gettext.h" // so that we are sure tht it won't be included #include "gettext.h" // so that we are sure tht it won't be included
// later. // later.
#ifdef ON #ifdef ON
#undef ON #undef ON
#endif #endif
@ -39,11 +39,11 @@ class LyXLex;
class LyXFont { class LyXFont {
public: public:
/** The value INHERIT_* means that the font attribute is /** The value INHERIT_* means that the font attribute is
inherited from the layout. In the case of layout fonts, the inherited from the layout. In the case of layout fonts, the
attribute is inherited from the default font. attribute is inherited from the default font.
The value IGNORE_* is used with LyXFont::update() when the The value IGNORE_* is used with LyXFont::update() when the
attribute should not be changed. attribute should not be changed.
*/ */
enum FONT_FAMILY { enum FONT_FAMILY {
/// ///
ROMAN_FAMILY, // fontstruct rely on this to be 0 ROMAN_FAMILY, // fontstruct rely on this to be 0
@ -272,7 +272,7 @@ public:
string latexSize() const; string latexSize() const;
/** Updates font settings according to request. If an /** Updates font settings according to request. If an
attribute is IGNORE, the attribute is left as it is. */ attribute is IGNORE, the attribute is left as it is. */
/* /*
* When toggleall = true, all properties that matches the font in use * When toggleall = true, all properties that matches the font in use
* will have the effect that the properties is reset to the * will have the effect that the properties is reset to the
@ -284,7 +284,7 @@ public:
void update(LyXFont const & newfont, bool toggleall = false); void update(LyXFont const & newfont, bool toggleall = false);
/** Reduce font to fall back to template where possible. /** Reduce font to fall back to template where possible.
Equal fields are reduced to INHERIT */ Equal fields are reduced to INHERIT */
void reduce(LyXFont const & tmplt); void reduce(LyXFont const & tmplt);
/// Realize font from a template (INHERIT are realized) /// Realize font from a template (INHERIT are realized)
@ -307,7 +307,7 @@ public:
int latexWriteStartChanges(string &, LyXFont const & base) const; int latexWriteStartChanges(string &, LyXFont const & base) const;
/** Writes tha tail of the LaTeX needed to chagne to this font. /** Writes tha tail of the LaTeX needed to chagne to this font.
Returns number of chars written. Base is the font state we want Returns number of chars written. Base is the font state we want
to achieve. to achieve.
*/ */
int latexWriteEndChanges(string &, LyXFont const & base) const; int latexWriteEndChanges(string &, LyXFont const & base) const;
@ -374,15 +374,15 @@ private:
typedef unsigned int ui32; typedef unsigned int ui32;
/** Representation: bit table /** Representation: bit table
Layout of bit table: Layout of bit table:
11 1111 111 122 222 222 2233 11 1111 111 122 222 222 2233
Bit 012 34 567 8901 2345 678 901 234 567 8901 Bit 012 34 567 8901 2345 678 901 234 567 8901
FFF SS SSS SSSS CCCC EEE UUU NNN LLL FFF SS SSS SSSS CCCC EEE UUU NNN LLL
aaa ee hhh iiii oooo mmm nnn ooo aaa aaa ee hhh iiii oooo mmm nnn ooo aaa
mmm rr aaa zzzz llll ppp ddd uuu ttt mmm rr aaa zzzz llll ppp ddd uuu ttt
Some might think this is a dirty representation, but it gives Some might think this is a dirty representation, but it gives
us at least 25% speed-up, so why not? us at least 25% speed-up, so why not?
*/ */
ui32 bits; ui32 bits;
@ -437,25 +437,25 @@ private:
/// All inherit font /// All inherit font
enum{ inherit = ui32(INHERIT_FAMILY) << Fam_Pos enum{ inherit = ui32(INHERIT_FAMILY) << Fam_Pos
| ui32(INHERIT_SERIES) << Ser_Pos | ui32(INHERIT_SERIES) << Ser_Pos
| ui32(INHERIT_SHAPE) << Sha_Pos | ui32(INHERIT_SHAPE) << Sha_Pos
| ui32(INHERIT_SIZE) << Siz_Pos | ui32(INHERIT_SIZE) << Siz_Pos
| ui32(INHERIT_COLOR) << Col_Pos | ui32(INHERIT_COLOR) << Col_Pos
| ui32(INHERIT) << Emp_Pos | ui32(INHERIT) << Emp_Pos
| ui32(INHERIT) << Und_Pos | ui32(INHERIT) << Und_Pos
| ui32(INHERIT) << Nou_Pos | ui32(INHERIT) << Nou_Pos
| ui32(INHERIT) << Lat_Pos}; | ui32(INHERIT) << Lat_Pos};
/// All ignore font /// All ignore font
enum{ ignore = ui32(IGNORE_FAMILY) << Fam_Pos enum{ ignore = ui32(IGNORE_FAMILY) << Fam_Pos
| ui32(IGNORE_SERIES) << Ser_Pos | ui32(IGNORE_SERIES) << Ser_Pos
| ui32(IGNORE_SHAPE) << Sha_Pos | ui32(IGNORE_SHAPE) << Sha_Pos
| ui32(IGNORE_SIZE) << Siz_Pos | ui32(IGNORE_SIZE) << Siz_Pos
| ui32(IGNORE_COLOR) << Col_Pos | ui32(IGNORE_COLOR) << Col_Pos
| ui32(IGNORE) << Emp_Pos | ui32(IGNORE) << Emp_Pos
| ui32(IGNORE) << Und_Pos | ui32(IGNORE) << Und_Pos
| ui32(IGNORE) << Nou_Pos | ui32(IGNORE) << Nou_Pos
| ui32(IGNORE) << Lat_Pos}; | ui32(IGNORE) << Lat_Pos};
/// Updates a misc setting according to request /// Updates a misc setting according to request
LyXFont::FONT_MISC_STATE setMisc(LyXFont::FONT_MISC_STATE newfont, LyXFont::FONT_MISC_STATE setMisc(LyXFont::FONT_MISC_STATE newfont,
@ -507,8 +507,8 @@ inline LyXFont & LyXFont::operator=(LyXFont const & x)
} }
// You don't have to understand the stuff below :-) // You don't have to understand the stuff below :-)
// It works, and it's bloody fast. (Asger) // It works, and it's bloody fast. (Asger)
inline LyXFont::FONT_FAMILY LyXFont::family() const inline LyXFont::FONT_FAMILY LyXFont::family() const
{ {
return LyXFont::FONT_FAMILY((bits >> Fam_Pos) & Fam_Mask); return LyXFont::FONT_FAMILY((bits >> Fam_Pos) & Fam_Mask);

View File

@ -35,8 +35,8 @@
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/textutils.h" #include "support/textutils.h"
extern BufferView *current_view; // called too many times in this file... extern BufferView * current_view; // called too many times in this file...
extern MiniBuffer *minibuffer; extern MiniBuffer * minibuffer;
// Maximum length copied from the current selection to the search string // Maximum length copied from the current selection to the search string
const int LYXSEARCH_MAXLEN = 128; const int LYXSEARCH_MAXLEN = 128;
@ -46,15 +46,15 @@ const int LYXSEARCH_MAXLEN = 128;
// If nothing selected, select the word at the cursor. // If nothing selected, select the word at the cursor.
// Returns the current selection // Returns the current selection
// Note: this function should be in LyXText! // Note: this function should be in LyXText!
string const GetSelectionOrWordAtCursor(LyXText *lt); string const GetSelectionOrWordAtCursor(LyXText * lt);
// Returns the current selection. If nothing is selected or if the selection // Returns the current selection. If nothing is selected or if the selection
// spans 2 paragraphs, an empty string is returned. // spans 2 paragraphs, an empty string is returned.
string const GetCurrentSelectionAsString(LyXText *lt); string const GetCurrentSelectionAsString(LyXText * lt);
// This is a copy of SetSelectionOverString from text.C // This is a copy of SetSelectionOverString from text.C
// It does the same, but uses only the length as a parameter // It does the same, but uses only the length as a parameter
void SetSelectionOverLenChars(LyXText *lt, int len); void SetSelectionOverLenChars(LyXText * lt, int len);
//------------------------------------------------------------- //-------------------------------------------------------------
@ -64,9 +64,9 @@ void SetSelectionOverLenChars(LyXText *lt, int len);
// spans 2 paragraphs, an empty string is returned. // spans 2 paragraphs, an empty string is returned.
string const GetCurrentSelectionAsString(LyXText * lt) string const GetCurrentSelectionAsString(LyXText * lt)
{ {
char sz[LYXSEARCH_MAXLEN]; char sz[LYXSEARCH_MAXLEN];
sz[0] = 0; sz[0] = 0;
LyXParagraph * par = lt->cursor.par; LyXParagraph * par = lt->cursor.par;
if (lt->selection && (lt->sel_cursor.par == par)) { if (lt->selection && (lt->sel_cursor.par == par)) {
// (selected) and (begin/end in same paragraph) // (selected) and (begin/end in same paragraph)
@ -77,15 +77,15 @@ string const GetCurrentSelectionAsString(LyXText * lt)
int i = 0; int i = 0;
bool fPrevIsSpace = false; bool fPrevIsSpace = false;
char ch; char ch;
while ((i < LYXSEARCH_MAXLEN-2) && while ((i < LYXSEARCH_MAXLEN - 2) &&
(pos < par->Last()) && (pos < endpos)) { (pos < par->Last()) && (pos < endpos)) {
ch = par->GetChar(pos); ch = par->GetChar(pos);
//HB??: Maybe (ch <= ' ') //HB??: Maybe (ch <= ' ')
if ((ch == ' ') || (ch <= LyXParagraph::META_INSET)) { if ((ch == ' ') || (ch <= LyXParagraph::META_INSET)) {
// consecutive spaces --> 1 space char // consecutive spaces --> 1 space char
if (fPrevIsSpace) { if (fPrevIsSpace) {
pos++; // Next text pos ++pos; // Next text pos
continue; // same search pos continue; // same search pos
} }
sz[i] = ' '; sz[i] = ' ';
@ -94,8 +94,8 @@ string const GetCurrentSelectionAsString(LyXText * lt)
sz[i] = ch; sz[i] = ch;
fPrevIsSpace = false; fPrevIsSpace = false;
} }
pos++; ++pos;
i++; ++i;
} }
sz[i] = 0; sz[i] = 0;
} }
@ -105,7 +105,7 @@ string const GetCurrentSelectionAsString(LyXText * lt)
// If nothing selected, select the word at the cursor. // If nothing selected, select the word at the cursor.
// Returns the current selection // Returns the current selection
string const GetSelectionOrWordAtCursor(LyXText *lt) string const GetSelectionOrWordAtCursor(LyXText * lt)
{ {
lt->SelectWordWhenUnderCursor(); lt->SelectWordWhenUnderCursor();
return GetCurrentSelectionAsString(lt); return GetCurrentSelectionAsString(lt);
@ -114,11 +114,10 @@ string const GetSelectionOrWordAtCursor(LyXText *lt)
// This is a copy of SetSelectionOverString from text.C // This is a copy of SetSelectionOverString from text.C
// It does the same, but uses only the length as a parameter // It does the same, but uses only the length as a parameter
void SetSelectionOverLenChars(LyXText *lt, int len) void SetSelectionOverLenChars(LyXText * lt, int len)
{ {
lt->sel_cursor = lt->cursor; lt->sel_cursor = lt->cursor;
int i; for (int i = 0; i < len; ++i)
for (i= 0; i < len; i++)
lt->CursorRight(); lt->CursorRight();
lt->SetSelection(); lt->SetSelection();
} }
@ -131,23 +130,17 @@ void LyXFindReplace1::StartSearch()
LyXFindReplace0::StartSearch(); LyXFindReplace0::StartSearch();
SetReplaceEnabled(!current_view->buffer()->isReadonly()); SetReplaceEnabled(!current_view->buffer()->isReadonly());
searchForward = true; searchForward = true;
#ifdef MOVE_TEXT
if (lsSearch.empty()) if (lsSearch.empty())
SetSearchString(GetSelectionOrWordAtCursor(current_view->text)); SetSearchString(GetSelectionOrWordAtCursor(current_view->text));
#else
if (lsSearch.empty())
SetSearchString(GetSelectionOrWordAtCursor(current_view->buffer()->text));
#endif
} }
// TODO?: the user can insert multiple spaces with this routine (1999-01-11, dnaber) // TODO?: the user can insert multiple spaces with this
// routine (1999-01-11, dnaber)
void LyXFindReplace1::SearchReplaceCB() void LyXFindReplace1::SearchReplaceCB()
{ {
if (!current_view->getScreen()) if (!current_view->getScreen()) return;
return; if (current_view->buffer()->isReadonly()) return;
if (current_view->buffer()->isReadonly())
return;
// CutSelection cannot cut a single space, so we have to stop // CutSelection cannot cut a single space, so we have to stop
// in order to avoid endless loop :-( // in order to avoid endless loop :-(
@ -162,7 +155,6 @@ void LyXFindReplace1::SearchReplaceCB()
string const replacestring = ReplaceString(); string const replacestring = ReplaceString();
current_view->getScreen()->HideCursor(); current_view->getScreen()->HideCursor();
#ifdef MOVE_TEXT
current_view->update(-2); current_view->update(-2);
LyXText * ltCur = current_view->text; LyXText * ltCur = current_view->text;
@ -175,20 +167,6 @@ void LyXFindReplace1::SearchReplaceCB()
SetSelectionOverString(replacestring.c_str()); SetSelectionOverString(replacestring.c_str());
current_view->update(1); current_view->update(1);
} }
#else
current_view->buffer()->update(-2);
LyXText * ltCur = current_view->buffer()->text;
if (ltCur->selection) {
// clear the selection (if there is any)
current_view->getScreen()->ToggleSelection(false);
current_view->buffer()->text->
ReplaceSelectionWithString(replacestring.c_str());
current_view->buffer()->text->
SetSelectionOverString(replacestring.c_str());
current_view->buffer()->update(1);
}
#endif
// jump to next match: // jump to next match:
SearchCB( searchForward ); SearchCB( searchForward );
@ -198,12 +176,8 @@ void LyXFindReplace1::SearchReplaceCB()
// replaces all occurences of a string (1999-01-15, dnaber@mini.gt.owl.de) // replaces all occurences of a string (1999-01-15, dnaber@mini.gt.owl.de)
void LyXFindReplace1::SearchReplaceAllCB() void LyXFindReplace1::SearchReplaceAllCB()
{ {
LyXText * ltCur; if (!current_view->getScreen()) return;
if (current_view->buffer()->isReadonly()) return;
if (!current_view->getScreen())
return;
if (current_view->buffer()->isReadonly())
return;
// CutSelection cannot cut a single space, so we have to stop // CutSelection cannot cut a single space, so we have to stop
// in order to avoid endless loop :-( // in order to avoid endless loop :-(
@ -212,19 +186,19 @@ void LyXFindReplace1::SearchReplaceAllCB()
&& SearchString()[0] == ' ') ) { && SearchString()[0] == ' ') ) {
WriteAlert(_("Sorry!"), _("You cannot replace a single space, " WriteAlert(_("Sorry!"), _("You cannot replace a single space, "
"nor an empty character.")); "nor an empty character."));
return; return;
} }
string const replacestring = ReplaceString(); string const replacestring = ReplaceString();
current_view->getScreen()->HideCursor(); current_view->getScreen()->HideCursor();
#ifdef MOVE_TEXT
// start at top // start at top
current_view->text->ClearSelection(); current_view->text->ClearSelection();
current_view->text->CursorTop(); current_view->text->CursorTop();
int replace_count = 0; int replace_count = 0;
LyXText * ltCur;
do { do {
ltCur = current_view->text; ltCur = current_view->text;
if (ltCur->selection) { if (ltCur->selection) {
@ -238,26 +212,6 @@ void LyXFindReplace1::SearchReplaceAllCB()
++replace_count; ++replace_count;
} }
} while( SearchCB(true) ); } while( SearchCB(true) );
#else
// start at top
current_view->buffer()->text->ClearSelection();
current_view->buffer()->text->CursorTop();
int replace_count = 0;
do {
ltCur = current_view->buffer()->text;
if (ltCur->selection) {
current_view->buffer()->update(-2);
current_view->getScreen()->ToggleSelection(false);
current_view->buffer()->text->
ReplaceSelectionWithString(replacestring.c_str());
current_view->buffer()->text->
SetSelectionOverString(replacestring.c_str());
current_view->buffer()->update(1);
replace_count++;
}
} while( SearchCB(true) );
#endif
if( replace_count == 0 ) { if( replace_count == 0 ) {
LyXBell(); LyXBell();
minibuffer->Set(_("String not found!")); minibuffer->Set(_("String not found!"));
@ -275,33 +229,25 @@ void LyXFindReplace1::SearchReplaceAllCB()
bool LyXFindReplace1::SearchCB(bool fForward) bool LyXFindReplace1::SearchCB(bool fForward)
{ {
LyXText * ltCur;
bool result;
// store search direction // store search direction
searchForward = fForward; searchForward = fForward;
if (!current_view->getScreen()) if (!current_view->getScreen())
return(false); return false;
current_view->getScreen()->HideCursor(); current_view->getScreen()->HideCursor();
#ifdef MOVE_TEXT
current_view->update(-2); current_view->update(-2);
ltCur = current_view->text; LyXText * ltCur = current_view->text;
#else
current_view->buffer()->update(-2);
ltCur = current_view->buffer()->text;
#endif
if (ltCur->selection) if (ltCur->selection)
ltCur->cursor = fForward ? ltCur->sel_end_cursor : ltCur->cursor = fForward ? ltCur->sel_end_cursor :
ltCur->sel_start_cursor; ltCur->sel_start_cursor;
ReInitFromForm(); ReInitFromForm();
iLenSelected = SearchString().length(); iLenSelected = SearchString().length();
bool result;
if (!ValidSearchData() || if (!ValidSearchData() ||
(fForward ? SearchForward(ltCur) : SearchBackward(ltCur))) { (fForward ? SearchForward(ltCur) : SearchBackward(ltCur))) {
#ifdef MOVE_TEXT
current_view->update(-2); current_view->update(-2);
// clear the selection (if there is any) // clear the selection (if there is any)
@ -310,16 +256,6 @@ bool LyXFindReplace1::SearchCB(bool fForward)
// set the new selection // set the new selection
SetSelectionOverLenChars(current_view->text, iLenSelected); SetSelectionOverLenChars(current_view->text, iLenSelected);
#else
current_view->buffer()->update(-2);
// clear the selection (if there is any)
current_view->getScreen()->ToggleSelection();
current_view->buffer()->text->ClearSelection();
// set the new selection
SetSelectionOverLenChars(current_view->buffer()->text, iLenSelected);
#endif
current_view->getScreen()->ToggleSelection(false); current_view->getScreen()->ToggleSelection(false);
minibuffer->Set(_("Found.")); minibuffer->Set(_("Found."));
result = true; result = true;
@ -332,7 +268,7 @@ bool LyXFindReplace1::SearchCB(bool fForward)
if (current_view->getWorkArea()->focus) if (current_view->getWorkArea()->focus)
current_view->getScreen()->ShowCursor(); current_view->getScreen()->ShowCursor();
return(result); return result;
} }
@ -345,8 +281,8 @@ bool LyXFindReplace1::SearchForward(LyXText * lt)
LyXParagraph::size_type pos = lt->cursor.pos; LyXParagraph::size_type pos = lt->cursor.pos;
while (par && !IsSearchStringInText(par, pos)) { while (par && !IsSearchStringInText(par, pos)) {
if (pos<par->Last()-1) if (pos < par->Last() - 1)
pos++; ++pos;
else { else {
pos = 0; pos = 0;
par = par->Next(); par = par->Next();
@ -363,21 +299,21 @@ bool LyXFindReplace1::SearchForward(LyXText * lt)
// if the string can be found: return true and set the cursor to // if the string can be found: return true and set the cursor to
// the new position // the new position
// (was: LyXText::SearchBackward(char const* string) in text2.C ) // (was: LyXText::SearchBackward(char const* string) in text2.C )
bool LyXFindReplace1::SearchBackward(LyXText *lt) bool LyXFindReplace1::SearchBackward(LyXText * lt)
{ {
LyXParagraph *par = lt->cursor.par; LyXParagraph * par = lt->cursor.par;
int pos = lt->cursor.pos; int pos = lt->cursor.pos;
do { do {
if (pos>0) if (pos > 0)
pos--; --pos;
else { else {
// We skip empty paragraphs (Asger) // We skip empty paragraphs (Asger)
do { do {
par = par->Previous(); par = par->Previous();
if (par) if (par)
pos = par->Last()-1; pos = par->Last() - 1;
} while (par && pos<0); } while (par && pos < 0);
} }
} while (par && !IsSearchStringInText(par, pos)); } while (par && !IsSearchStringInText(par, pos));
@ -408,12 +344,10 @@ int LyXFindReplace1::CompareChars(char chSearch, char chText)
bool LyXFindReplace1::IsSearchStringInText(LyXParagraph * par, bool LyXFindReplace1::IsSearchStringInText(LyXParagraph * par,
LyXParagraph::size_type pos) LyXParagraph::size_type pos)
{ {
char chSrch = 0; if (!par) return false;
char chText;
if (!par)
return false;
char chSrch = 0;
char chText;
bool fPrevIsSpace = false; bool fPrevIsSpace = false;
int iText = 0; int iText = 0;
string::size_type iSrch = 0; string::size_type iSrch = 0;
@ -423,7 +357,7 @@ bool LyXFindReplace1::IsSearchStringInText(LyXParagraph * par,
chText = par->GetChar(pos+iText); chText = par->GetChar(pos+iText);
if (chText == ' ') { if (chText == ' ') {
if (fPrevIsSpace) { if (fPrevIsSpace) {
iText++; // next Text pos ++iText; // next Text pos
continue; // same search pos continue; // same search pos
} }
fPrevIsSpace = true; fPrevIsSpace = true;
@ -440,7 +374,7 @@ bool LyXFindReplace1::IsSearchStringInText(LyXParagraph * par,
return false; return false;
if (!MatchWord() if (!MatchWord()
|| ((pos <= 0 || !IsLetterCharOrDigit(par->GetChar(pos-1))) || ((pos <= 0 || !IsLetterCharOrDigit(par->GetChar(pos - 1)))
&& (pos + iText >= par->Last() && (pos + iText >= par->Last()
|| !IsLetterCharOrDigit(par->GetChar(pos + iText))))) { || !IsLetterCharOrDigit(par->GetChar(pos + iText))))) {
iLenSelected = iText; iLenSelected = iText;

File diff suppressed because it is too large Load Diff

View File

@ -47,15 +47,16 @@ public:
/// The last key was meta /// The last key was meta
bool wasMetaKey() const; bool wasMetaKey() const;
// These can't be global because are part of the internat state (ale970227) // These can't be global because are part of the
// internal state (ale970227)
/// Get the current keyseq string /// Get the current keyseq string
string keyseqStr(int l = 190) const; string keyseqStr() const;
/// Is the key sequence uncomplete? /// Is the key sequence uncomplete?
bool keyseqUncomplete() const; bool keyseqUncomplete() const;
/// get options for the current keyseq /// get options for the current keyseq
string keyseqOptions(int l = 190) const; string keyseqOptions() const;
/// True if lyxfunc reports an error /// True if lyxfunc reports an error
bool errorStat() const { return errorstat; } bool errorStat() const { return errorstat; }
@ -70,7 +71,6 @@ public:
/// Should a hint message be displayed? /// Should a hint message be displayed?
void setHintMessage(bool); void setHintMessage(bool);
private: private:
/// ///
LyXView * owner; LyXView * owner;
@ -94,8 +94,8 @@ private:
mutable bool errorstat; mutable bool errorstat;
/** Buffer to store messages and result data. Is there a /** Buffer to store messages and result data. Is there a
good reason to have this one as static in Dispatch? (Ale) good reason to have this one as static in Dispatch? (Ale)
*/ */
mutable string dispatch_buffer; mutable string dispatch_buffer;
/// Command name and shortcut information /// Command name and shortcut information
string commandshortcut; string commandshortcut;
@ -136,22 +136,22 @@ bool LyXFunc::wasMetaKey() const
inline inline
string LyXFunc::keyseqStr(int l) const string LyXFunc::keyseqStr() const
{ {
char text[200]; // Why not just remove this function
keyseq.print(text, l, true); string text;
string tmp(text); keyseq.print(text, true);
return tmp; return text;
} }
inline inline
string LyXFunc::keyseqOptions(int l) const string LyXFunc::keyseqOptions() const
{ {
char text[200]; // Why not just remove this function
keyseq.printOptions(text, l); string text;
string tmp(text); keyseq.printOptions(text);
return tmp; return text;
} }
@ -161,12 +161,14 @@ bool LyXFunc::keyseqUncomplete() const
return (keyseq.length > 0); return (keyseq.length > 0);
} }
inline inline
void LyXFunc::setHintMessage(bool hm) void LyXFunc::setHintMessage(bool hm)
{ {
show_sc = hm; show_sc = hm;
} }
inline inline
void operator|=(LyXFunc::func_status & fs, LyXFunc::func_status f) void operator|=(LyXFunc::func_status & fs, LyXFunc::func_status f)
{ {

View File

@ -130,6 +130,7 @@ enum LyXRCTags {
RC_LAST RC_LAST
}; };
static keyword_item lyxrcTags[] = { static keyword_item lyxrcTags[] = {
{ "\\accept_compound", RC_ACCEPT_COMPOUND }, { "\\accept_compound", RC_ACCEPT_COMPOUND },
{ "\\alternate_language", RC_ALT_LANG }, { "\\alternate_language", RC_ALT_LANG },
@ -547,7 +548,7 @@ int LyXRC::read(string const & filename)
BufferParams::PAPER_LEGALPAPER; BufferParams::PAPER_LEGALPAPER;
else if (size == "executive") else if (size == "executive")
default_papersize = default_papersize =
BufferParams::PAPER_EXECUTIVEPAPER; BufferParams::PAPER_EXECUTIVEPAPER;
else if (size == "a3") else if (size == "a3")
default_papersize = default_papersize =
BufferParams::PAPER_A3PAPER; BufferParams::PAPER_A3PAPER;

View File

@ -42,13 +42,13 @@ public:
~LyXScreen(); ~LyXScreen();
/** Return the forground pixmap. This function is a _hack_, /** Return the forground pixmap. This function is a _hack_,
we should be rid of it as soon as possible. But to do that we should be rid of it as soon as possible. But to do that
a lot in the mathcode and the figinset has to be rewritten. a lot in the mathcode and the figinset has to be rewritten.
Tasks for 0.13. */ Tasks for 0.13. */
Pixmap getForeground() { return foreground; }; Pixmap getForeground() { return foreground; };
/** Draws the screen form textposition y. Uses as much of /** Draws the screen form textposition y. Uses as much of
the already printed pixmap as possible */ the already printed pixmap as possible */
void Draw(long y ); void Draw(long y );
/// Redraws the screen, without using existing pixmap /// Redraws the screen, without using existing pixmap
@ -76,27 +76,27 @@ public:
void ToggleToggle(); void ToggleToggle();
/** Updates part of the screen. If text->status is /** Updates part of the screen. If text->status is
LyXText::NEED_MORE_REFRESH, we update from the LyXText::NEED_MORE_REFRESH, we update from the
point of change and to the end of the screen. point of change and to the end of the screen.
If text->status is LyXText::NEED_VERY_LITTLE_REFRESH, If text->status is LyXText::NEED_VERY_LITTLE_REFRESH,
we only update the current row. */ we only update the current row. */
void Update(); void Update();
/** Updates part of the screen. Updates till row with cursor, /** Updates part of the screen. Updates till row with cursor,
or only current row */ or only current row */
void SmallUpdate(); void SmallUpdate();
/** Functions for drawing into the LyXScreen. The number of /** Functions for drawing into the LyXScreen. The number of
drawing functions should be minimized, now there drawing functions should be minimized, now there
is too many. And also there is mixed X and XForms drawing is too many. And also there is mixed X and XForms drawing
functions called. Not good. */ functions called. Not good. */
void drawPoint(GC gc, int x, int y); void drawPoint(GC gc, int x, int y);
/// ///
void drawLine(gc_type t, int baseline, int x, int length); void drawLine(gc_type t, int baseline, int x, int length);
/// ///
void drawLine(GC gc, int a, int b, int c, int d); void drawLine(GC gc, int a, int b, int c, int d);
/// ///
void drawLines(GC gc, XPoint *p, int np); void drawLines(GC gc, XPoint * p, int np);
/// ///
void drawVerticalLine(gc_type t, int x, int y1, int y2); void drawVerticalLine(gc_type t, int x, int y1, int y2);
/// ///
@ -110,11 +110,15 @@ public:
/// ///
void drawVerticalOnOffLine(int x, int y1, int y2); void drawVerticalOnOffLine(int x, int y1, int y2);
/// ///
void fillArc(GC gc, int x, int y,
unsigned int w, unsigned int h,
int a1, int a2);
///
void drawArc(GC gc, int x, int y, void drawArc(GC gc, int x, int y,
unsigned int w, unsigned int h, unsigned int w, unsigned int h,
int a1, int a2); int a1, int a2);
/// ///
void drawSegments(GC gc, XSegment *s, int ns); void drawSegments(GC gc, XSegment * s, int ns);
/// ///
void fillRectangle(gc_type t, int, int, int, int); void fillRectangle(gc_type t, int, int, int, int);
/// ///
@ -123,11 +127,11 @@ public:
void drawFrame(int ft, int x, int y, int w, int h, void drawFrame(int ft, int x, int y, int w, int h,
FL_COLOR col, int b); FL_COLOR col, int b);
/// ///
int drawText(LyXFont const &font, char const*, int drawText(LyXFont const & font, char const *,
int n, int baseline, int x); int n, int baseline, int x);
/// ///
int drawString(LyXFont const &font, string const &str, int drawString(LyXFont const & font, string const & str,
int baseline, int x); int baseline, int x);
/// first visible pixel-row /// first visible pixel-row
long first; long first;
@ -142,10 +146,10 @@ private:
void DrawFromTo(int y1, int y2); void DrawFromTo(int y1, int y2);
/// y is a coordinate of the text /// y is a coordinate of the text
void DrawOneRow(Row* row, long &y_text); void DrawOneRow(Row * row, long & y_text);
/// ///
LyXText *text; LyXText * text;
/// ///
Pixmap foreground; Pixmap foreground;
@ -172,39 +176,44 @@ private:
/// ///
long screen_refresh_y; long screen_refresh_y;
/// ///
Row *screen_refresh_row; Row * screen_refresh_row;
/// ///
friend class InsetFormula; friend class InsetFormula;
}; };
// Some of the easy to inline draw methods: // Some of the easy to inline draw methods:
inline void LyXScreen::drawPoint(GC gc, int x, int y) inline
void LyXScreen::drawPoint(GC gc, int x, int y)
{ {
XDrawPoint(fl_display, foreground, gc, XDrawPoint(fl_display, foreground, gc,
x, y); x, y);
} }
inline void LyXScreen::drawLine(GC gc, int a, int b, int c, int d) inline
void LyXScreen::drawLine(GC gc, int a, int b, int c, int d)
{ {
XDrawLine(fl_display, foreground, gc, a, b, c, d); XDrawLine(fl_display, foreground, gc, a, b, c, d);
} }
inline void LyXScreen::drawLine(gc_type t, int baseline, int x, int length) inline
void LyXScreen::drawLine(gc_type t, int baseline, int x, int length)
{ {
drawLine(getGC(t), x, baseline, x + length, baseline); drawLine(getGC(t), x, baseline, x + length, baseline);
} }
inline void LyXScreen::drawLines(GC gc, XPoint *p, int np) inline
void LyXScreen::drawLines(GC gc, XPoint * p, int np)
{ {
XDrawLines(fl_display, foreground, gc, p, np, CoordModeOrigin); XDrawLines(fl_display, foreground, gc, p, np, CoordModeOrigin);
} }
inline void LyXScreen::drawVerticalLine(gc_type t, int x, int y1, int y2) inline
void LyXScreen::drawVerticalLine(gc_type t, int x, int y1, int y2)
{ {
drawLine(getGC(t), drawLine(getGC(t),
x, x,
@ -214,7 +223,8 @@ inline void LyXScreen::drawVerticalLine(gc_type t, int x, int y1, int y2)
} }
inline void LyXScreen::drawOnOffLine(int baseline, int x, int length) inline
void LyXScreen::drawOnOffLine(int baseline, int x, int length)
{ {
drawLine(getGC(gc_on_off_line), drawLine(getGC(gc_on_off_line),
x, x,
@ -224,7 +234,8 @@ inline void LyXScreen::drawOnOffLine(int baseline, int x, int length)
} }
inline void LyXScreen::drawThickLine(int baseline, int x, int length) inline
void LyXScreen::drawThickLine(int baseline, int x, int length)
{ {
drawLine(getGC(gc_thick_line), drawLine(getGC(gc_thick_line),
x, x,
@ -234,7 +245,8 @@ inline void LyXScreen::drawThickLine(int baseline, int x, int length)
} }
inline void LyXScreen::drawVerticalOnOffLine(int x, int y1, int y2) inline
void LyXScreen::drawVerticalOnOffLine(int x, int y1, int y2)
{ {
drawLine(getGC(gc_fill), drawLine(getGC(gc_fill),
x, x,
@ -244,7 +256,19 @@ inline void LyXScreen::drawVerticalOnOffLine(int x, int y1, int y2)
} }
inline void LyXScreen::drawArc(GC gc, int x, int y, inline
void LyXScreen::fillArc(GC gc, int x, int y,
unsigned int w, unsigned int h,
int a1, int a2)
{
XFillArc(fl_display, foreground, gc,
x, y,
w, h, a1, a2);
}
inline
void LyXScreen::drawArc(GC gc, int x, int y,
unsigned int w, unsigned int h, unsigned int w, unsigned int h,
int a1, int a2) int a1, int a2)
{ {
@ -254,35 +278,40 @@ inline void LyXScreen::drawArc(GC gc, int x, int y,
} }
inline void LyXScreen::drawSegments(GC gc, XSegment *s, int ns) inline
void LyXScreen::drawSegments(GC gc, XSegment * s, int ns)
{ {
XDrawSegments(fl_display, foreground, gc, s, ns); XDrawSegments(fl_display, foreground, gc, s, ns);
} }
inline void LyXScreen::fillRectangle(gc_type t, int a, int b, int c, int d) inline
void LyXScreen::fillRectangle(gc_type t, int a, int b, int c, int d)
{ {
XFillRectangle(fl_display, foreground, getGC(t), XFillRectangle(fl_display, foreground, getGC(t),
a, b, c, d); a, b, c, d);
} }
inline void LyXScreen::drawRectangle(gc_type t, int x, int y, int width, int height) inline
void LyXScreen::drawRectangle(gc_type t, int x, int y, int width, int height)
{ {
XDrawRectangle(fl_display, foreground, getGC(t), XDrawRectangle(fl_display, foreground, getGC(t),
x, y, width, height); x, y, width, height);
} }
inline int LyXScreen::drawText(LyXFont const &font, char const*fs, inline
int n, int baseline, int x) int LyXScreen::drawText(LyXFont const & font, char const * fs,
int n, int baseline, int x)
{ {
return font.drawText(fs, n, foreground, baseline, x); return font.drawText(fs, n, foreground, baseline, x);
} }
inline int LyXScreen::drawString(LyXFont const &font, string const &str, inline
int baseline, int x) int LyXScreen::drawString(LyXFont const & font, string const & str,
int baseline, int x)
{ {
return font.drawString(str, foreground, baseline, x); return font.drawString(str, foreground, baseline, x);
} }

View File

@ -252,7 +252,7 @@ void Menus::create_menus(int air)
MENU_LABEL_SIZE, MENU_LABEL_SIZE,
_("Layout"), _("Layout"),
strlen(_("Layout"))) + mbadd, strlen(_("Layout"))) + mbadd,
mbheight, _("Layout")); mbheight, _("Layout"));
moffset += obj->w + air; moffset += obj->w + air;
fl_set_object_shortcut(obj, scex(_("MB|#L")), 1); fl_set_object_shortcut(obj, scex(_("MB|#L")), 1);
fl_set_object_callback(obj, C_Menus_ShowLayoutMenu, 0); fl_set_object_callback(obj, C_Menus_ShowLayoutMenu, 0);
@ -486,27 +486,27 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
int SubFileExport = 0; int SubFileExport = 0;
if (!LinuxDoc && !DocBook) if (!LinuxDoc && !DocBook)
SubFileExport= fl_defpup(FL_ObjWin(ob), SubFileExport= fl_defpup(FL_ObjWin(ob),
_("Export%t" _("Export%t"
"|as LaTeX...%x40" "|as LaTeX...%x40"
"|as DVI...%x41" "|as DVI...%x41"
"|as PostScript...%x42" "|as PostScript...%x42"
"|as Ascii Text...%x43" "|as Ascii Text...%x43"
"|as HTML...%x44" "|as HTML...%x44"
"|Custom...%x45")); "|Custom...%x45"));
else if(LinuxDoc) else if(LinuxDoc)
SubFileExport= fl_defpup(FL_ObjWin(ob), SubFileExport= fl_defpup(FL_ObjWin(ob),
_("Export%t" _("Export%t"
"|as LinuxDoc...%x40" "|as LinuxDoc...%x40"
"|as DVI...%x41" "|as DVI...%x41"
"|as PostScript...%x42" "|as PostScript...%x42"
"|as Ascii Text...%x43")); "|as Ascii Text...%x43"));
else if(DocBook) else if(DocBook)
SubFileExport= fl_defpup(FL_ObjWin(ob), SubFileExport= fl_defpup(FL_ObjWin(ob),
_("Export%t" _("Export%t"
"|as DocBook...%x40" "|as DocBook...%x40"
"|as DVI...%x41" "|as DVI...%x41"
"|as PostScript...%x42" "|as PostScript...%x42"
"|as Ascii Text...%x43")); "|as Ascii Text...%x43"));
fl_setpup_shortcut(SubFileExport, 40, scex(_("FEX|Ll#l#L"))); fl_setpup_shortcut(SubFileExport, 40, scex(_("FEX|Ll#l#L")));
fl_setpup_shortcut(SubFileExport, 41, scex(_("FEX|Dd#d#D"))); fl_setpup_shortcut(SubFileExport, 41, scex(_("FEX|Dd#d#D")));
@ -674,7 +674,7 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
default: default:
men->currentView() men->currentView()
->buffer(bufferlist ->buffer(bufferlist
.loadLyXFile((*lastfiles)[choice - 18])); .loadLyXFile((*lastfiles)[choice - 18]));
break; break;
} }
fl_freepup(SubFileImport); fl_freepup(SubFileImport);
@ -707,11 +707,11 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
// Import sub-menu // Import sub-menu
int SubFileImport = fl_defpup(FL_ObjWin(ob), int SubFileImport = fl_defpup(FL_ObjWin(ob),
_("Import%t" _("Import%t"
"|LaTeX...%x15" "|LaTeX...%x15"
"|Ascii Text as Lines...%x16" "|Ascii Text as Lines...%x16"
"|Ascii Text as Paragraphs...%x17" "|Ascii Text as Paragraphs...%x17"
"|Noweb...%x18")); "|Noweb...%x18"));
fl_setpup_shortcut(SubFileImport, 15, scex(_("FIM|Ll#l#L"))); fl_setpup_shortcut(SubFileImport, 15, scex(_("FIM|Ll#l#L")));
fl_setpup_shortcut(SubFileImport, 16, scex(_("FIM|Aa#a#A"))); fl_setpup_shortcut(SubFileImport, 16, scex(_("FIM|Aa#a#A")));
@ -728,10 +728,10 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
// This can be done cleaner later. // This can be done cleaner later.
int FileMenu = fl_defpup(FL_ObjWin(ob), int FileMenu = fl_defpup(FL_ObjWin(ob),
_("New..." _("New..."
"|New from template..." "|New from template..."
"|Open...%l" "|Open...%l"
"|Import%m%l" "|Import%m%l"
"|Exit%l"), SubFileImport); "|Exit%l"), SubFileImport);
fl_setpup_shortcut(FileMenu, 1, scex(_("FM|Nn#n#N"))); fl_setpup_shortcut(FileMenu, 1, scex(_("FM|Nn#n#N")));
fl_setpup_shortcut(FileMenu, 2, scex(_("FM|tT#t#T"))); fl_setpup_shortcut(FileMenu, 2, scex(_("FM|tT#t#T")));
@ -790,7 +790,7 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
default: default:
men->currentView() men->currentView()
->buffer(bufferlist ->buffer(bufferlist
.loadLyXFile((*lastfiles)[choice - 6])); .loadLyXFile((*lastfiles)[choice - 6]));
break; break;
} }
@ -800,7 +800,7 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
return; return;
} }
#ifdef MOVE_TEXT
void Menus::ShowEditMenu(FL_OBJECT * ob, long) void Menus::ShowEditMenu(FL_OBJECT * ob, long)
{ {
Menus * men = static_cast<Menus*>(ob->u_vdata); Menus * men = static_cast<Menus*>(ob->u_vdata);
@ -815,14 +815,14 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
// Floats & Insets submenu // Floats & Insets submenu
int SubEditFloats= fl_defpup(FL_ObjWin(ob), int SubEditFloats= fl_defpup(FL_ObjWin(ob),
_("Floats & Insets%t" _("Floats & Insets%t"
"|Open/Close%x21" "|Open/Close%x21"
"|Melt%x22" "|Melt%x22"
"|Open All Footnotes/Margin Notes%x23" "|Open All Footnotes/Margin Notes%x23"
"|Close All Footnotes/Margin Notes%x24" "|Close All Footnotes/Margin Notes%x24"
"|Open All Figures/Tables%x25" "|Open All Figures/Tables%x25"
"|Close All Figures/Tables%x26%l" "|Close All Figures/Tables%x26%l"
"|Remove all Error Boxes%x27")); "|Remove all Error Boxes%x27"));
fl_setpup_shortcut(SubEditFloats, 21, scex(_("EMF|Oo#o#O"))); fl_setpup_shortcut(SubEditFloats, 21, scex(_("EMF|Oo#o#O")));
fl_setpup_shortcut(SubEditFloats, 22, scex(_("EMF|Mm#m#M"))); fl_setpup_shortcut(SubEditFloats, 22, scex(_("EMF|Mm#m#M")));
@ -897,10 +897,10 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
int align = men->currentView()->text->cursor.par-> int align = men->currentView()->text->cursor.par->
table->GetAlignment(men->currentView()->text-> table->GetAlignment(men->currentView()->text->
NumberOfCell(men->currentView()-> NumberOfCell(men->currentView()->
text->cursor.par, text->cursor.par,
men->currentView()-> men->currentView()->
text->cursor.pos)); text->cursor.pos));
if (align == LYX_ALIGN_LEFT) if (align == LYX_ALIGN_LEFT)
fl_addtopup(SubEditTable, _("|Align Left%R%x40")); fl_addtopup(SubEditTable, _("|Align Left%R%x40"));
else else
@ -979,24 +979,24 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
fl_setpup_shortcut(SubVersionControl, 56, scex(_("EMV|Hh#h#H"))); fl_setpup_shortcut(SubVersionControl, 56, scex(_("EMV|Hh#h#H")));
int EditMenu= fl_defpup(FL_ObjWin(ob), int EditMenu= fl_defpup(FL_ObjWin(ob),
_("Undo" _("Undo"
"|Redo %l" "|Redo %l"
"|Cut" "|Cut"
"|Copy" "|Copy"
"|Paste%l" "|Paste%l"
"|Find & Replace..." "|Find & Replace..."
"|Go to Error" "|Go to Error"
"|Go to Note" "|Go to Note"
"|Floats & Insets%m" "|Floats & Insets%m"
"|Table%m" "|Table%m"
"|Spellchecker...." "|Spellchecker...."
"|Check TeX" "|Check TeX"
"|Table of Contents...%l" "|Table of Contents...%l"
"|Version Control%m%l" "|Version Control%m%l"
"|View LaTeX log file%l" "|View LaTeX log file%l"
"|Paste Primary Selection as Lines" "|Paste Primary Selection as Lines"
"|Paste Primary Selection as Paragraphs"), "|Paste Primary Selection as Paragraphs"),
SubEditFloats, SubEditTable, SubVersionControl); SubEditFloats, SubEditTable, SubVersionControl);
fl_setpup_shortcut(EditMenu, 1, scex(_("EM|Uu#u#U"))); fl_setpup_shortcut(EditMenu, 1, scex(_("EM|Uu#u#U")));
fl_setpup_shortcut(EditMenu, 2, scex(_("EM|Rr#r#R"))); fl_setpup_shortcut(EditMenu, 2, scex(_("EM|Rr#r#R")));
@ -1121,328 +1121,6 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
fl_freepup(SubEditTable); fl_freepup(SubEditTable);
fl_freepup(SubVersionControl); fl_freepup(SubVersionControl);
} }
#else
void Menus::ShowEditMenu(FL_OBJECT * ob, long)
{
Menus * men = static_cast<Menus*>(ob->u_vdata);
// set the pseudo menu-button
fl_set_object_boxtype(ob, FL_UP_BOX);
fl_set_button(ob, 0);
fl_redraw_object(ob);
Buffer * tmpbuffer = men->_view->buffer();
LyXFunc * tmpfunc = men->_view->getLyXFunc();
// Floats & Insets submenu
int SubEditFloats= fl_defpup(FL_ObjWin(ob),
_("Floats & Insets%t"
"|Open/Close%x21"
"|Melt%x22"
"|Open All Footnotes/Margin Notes%x23"
"|Close All Footnotes/Margin Notes%x24"
"|Open All Figures/Tables%x25"
"|Close All Figures/Tables%x26%l"
"|Remove all Error Boxes%x27"));
fl_setpup_shortcut(SubEditFloats, 21, scex(_("EMF|Oo#o#O")));
fl_setpup_shortcut(SubEditFloats, 22, scex(_("EMF|Mm#m#M")));
fl_setpup_shortcut(SubEditFloats, 23, scex(_("EMF|Aa#a#A")));
fl_setpup_shortcut(SubEditFloats, 24, scex(_("EMF|Cc#c#C")));
fl_setpup_shortcut(SubEditFloats, 25, scex(_("EMF|Ff#f#F")));
fl_setpup_shortcut(SubEditFloats, 26, scex(_("EMF|Tt#t#T")));
fl_setpup_shortcut(SubEditFloats, 27, scex(_("EMF|Rr#r#R")));
// Table submenu
int SubEditTable = fl_newpup(FL_ObjWin(ob));
if (men->currentView()->available() &&
tmpbuffer->text->cursor.par->table &&
!tmpbuffer->isReadonly()){
fl_addtopup(SubEditTable, _("Table%t"));
if (tmpbuffer->text->cursor.par->table->
IsMultiColumn(tmpbuffer->text->
NumberOfCell(tmpbuffer->
text->cursor.par,
tmpbuffer->
text->cursor.pos)))
fl_addtopup(SubEditTable, _("|Multicolumn%B%x44%l"));
else
fl_addtopup(SubEditTable, _("|Multicolumn%b%x44%l"));
fl_setpup_shortcut(SubEditTable, 44, scex(_("EMT|Mm#m#M")));
if (tmpbuffer->text->cursor.par->table->
TopLine(tmpbuffer->text->
NumberOfCell(tmpbuffer->
text->cursor.par,
tmpbuffer->text->
cursor.pos)))
fl_addtopup(SubEditTable, _("|Line Top%B%x36"));
else
fl_addtopup(SubEditTable, _("|Line Top%b%x36"));
fl_setpup_shortcut(SubEditTable, 36, scex(_("EMT|Tt#t#T")));
if (tmpbuffer->text->cursor.par->table->
BottomLine(tmpbuffer->text->
NumberOfCell(tmpbuffer->
text->cursor.par,
tmpbuffer->
text->cursor.pos)))
fl_addtopup(SubEditTable, _("|Line Bottom%B%x37"));
else
fl_addtopup(SubEditTable, _("|Line Bottom%b%x37"));
fl_setpup_shortcut(SubEditTable, 37, scex(_("EMT|Bb#b#B")));
if (tmpbuffer->text->cursor.par->table->
LeftLine(tmpbuffer->text->
NumberOfCell(tmpbuffer->
text->cursor.par,
tmpbuffer->
text->cursor.pos)))
fl_addtopup(SubEditTable, _("|Line Left%B%x38"));
else
fl_addtopup(SubEditTable, _("|Line Left%b%x38"));
fl_setpup_shortcut(SubEditTable, 38, scex(_("EMT|Ll#l#L")));
if (tmpbuffer->text->cursor.par->table->
RightLine(tmpbuffer->text->
NumberOfCell(tmpbuffer->
text->cursor.par,
tmpbuffer->
text->cursor.pos)))
fl_addtopup(SubEditTable, _("|Line Right%B%x39%l"));
else
fl_addtopup(SubEditTable, _("|Line Right%b%x39%l"));
fl_setpup_shortcut(SubEditTable, 39, scex(_("EMT|Rr#r#R")));
int align = tmpbuffer->text->cursor.par->
table->GetAlignment(tmpbuffer->text->
NumberOfCell(tmpbuffer->
text->cursor.par,
tmpbuffer->
text->cursor.pos));
if (align == LYX_ALIGN_LEFT)
fl_addtopup(SubEditTable, _("|Align Left%R%x40"));
else
fl_addtopup(SubEditTable, _("|Align Left%r%x40"));
fl_setpup_shortcut(SubEditTable, 40, scex(_("EMT|eE#e#E")));
if (align == LYX_ALIGN_RIGHT)
fl_addtopup(SubEditTable, _("|Align Right%R%x41"));
else
fl_addtopup(SubEditTable, _("|Align Right%r%x41"));
fl_setpup_shortcut(SubEditTable, 41, scex(_("EMT|iI#i#I")));
if (align == LYX_ALIGN_CENTER)
fl_addtopup(SubEditTable, _("|Align Center%R%x42%l"));
else
fl_addtopup(SubEditTable, _("|Align Center%r%x42%l"));
fl_setpup_shortcut(SubEditTable, 42, scex(_("EMT|Cc#c#C")));
// xgettext:no-c-format
fl_addtopup(SubEditTable, _("|Append Row%x32"));
fl_setpup_shortcut(SubEditTable, 32, scex(_("EMT|oO#o#O")));
// xgettext:no-c-format
fl_addtopup(SubEditTable, _("|Append Column%x33%l"));
fl_setpup_shortcut(SubEditTable, 33, scex(_("EMT|uU#u#U")));
// xgettext:no-c-format
fl_addtopup(SubEditTable, _("|Delete Row%x34"));
fl_setpup_shortcut(SubEditTable, 34, scex(_("EMT|wW#w#W")));
// xgettext:no-c-format
fl_addtopup(SubEditTable, _("|Delete Column%x35%l"));
fl_setpup_shortcut(SubEditTable, 35, scex(_("EMT|nN#n#N")));
// xgettext:no-c-format
fl_addtopup(SubEditTable, _("|Delete Table%x43"));
fl_setpup_shortcut(SubEditTable, 43, scex(_("EMT|Dd#d#D")));
}
else {
fl_addtopup(SubEditTable, _("Table%t"));
// xgettext:no-c-format
fl_addtopup(SubEditTable, _("|Insert table%x31"));
fl_setpup_shortcut(SubEditTable, 31, scex(_("EMT|Ii#i#I")));
}
int SubVersionControl = fl_newpup(FL_ObjWin(ob));
fl_addtopup(SubVersionControl, _("Version Control%t"));
if (tmpbuffer->lyxvc.inUse()) {
// xgettext:no-c-format
fl_addtopup(SubVersionControl, _("|Register%d%x51"));
if (tmpbuffer->isReadonly()) {
// signifies that the file is not checked out
// xgettext:no-c-format
fl_addtopup(SubVersionControl, _("|Check In Changes%d%x52"));
// xgettext:no-c-format
fl_addtopup(SubVersionControl, _("|Check Out for Edit%x53"));
} else {
// signifies that the file is checked out
// xgettext:no-c-format
fl_addtopup(SubVersionControl, _("|Check In Changes%x52"));
// xgettext:no-c-format
fl_addtopup(SubVersionControl, _("|Check Out for Edit%d%x53"));
}
// xgettext:no-c-format
fl_addtopup(SubVersionControl, _("|Revert to last version%x54"));
// xgettext:no-c-format
fl_addtopup(SubVersionControl, _("|Undo last check in%x55"));
// xgettext:no-c-format
fl_addtopup(SubVersionControl, _("|Show History%x56"));
} else {
// xgettext:no-c-format
fl_addtopup(SubVersionControl, _("|Register%x51"));
}
// the shortcuts are not good.
fl_setpup_shortcut(SubVersionControl, 51, scex(_("EMV|Rr#r#R")));
fl_setpup_shortcut(SubVersionControl, 52, scex(_("EMV|Ii#i#I")));
fl_setpup_shortcut(SubVersionControl, 53, scex(_("EMV|Oo#o#O")));
fl_setpup_shortcut(SubVersionControl, 54, scex(_("EMV|lL#l#l")));
fl_setpup_shortcut(SubVersionControl, 55, scex(_("EMV|Uu#u#U")));
fl_setpup_shortcut(SubVersionControl, 56, scex(_("EMV|Hh#h#H")));
int EditMenu= fl_defpup(FL_ObjWin(ob),
_("Undo"
"|Redo %l"
"|Cut"
"|Copy"
"|Paste%l"
"|Find & Replace..."
"|Go to Error"
"|Go to Note"
"|Floats & Insets%m"
"|Table%m"
"|Spellchecker...."
"|Check TeX"
"|Table of Contents...%l"
"|Version Control%m%l"
"|View LaTeX log file%l"
"|Paste Primary Selection as Lines"
"|Paste Primary Selection as Paragraphs"),
SubEditFloats, SubEditTable, SubVersionControl);
fl_setpup_shortcut(EditMenu, 1, scex(_("EM|Uu#u#U")));
fl_setpup_shortcut(EditMenu, 2, scex(_("EM|Rr#r#R")));
fl_setpup_shortcut(EditMenu, 3, scex(_("EM|Cc#c#C")));
fl_setpup_shortcut(EditMenu, 4, scex(_("EM|oO#o#O")));
fl_setpup_shortcut(EditMenu, 5, scex(_("EM|Pp#p#P")));
fl_setpup_shortcut(EditMenu, 6, scex(_("EM|Ff#f#F")));
fl_setpup_shortcut(EditMenu, 7, scex(_("EM|Ee#e#E")));
fl_setpup_shortcut(EditMenu, 8, scex(_("EM|Nn#n#N")));
fl_setpup_shortcut(EditMenu, 9, scex(_("EM|Ii#i#I")));
fl_setpup_shortcut(EditMenu, 10, scex(_("EM|Tt#t#T")));
fl_setpup_shortcut(EditMenu, 11, scex(_("EM|Ss#s#S")));
fl_setpup_shortcut(EditMenu, 12, scex(_("EM|hH#h#H")));
fl_setpup_shortcut(EditMenu, 13, scex(_("EM|aA#a#A")));
fl_setpup_shortcut(EditMenu, 14, scex(_("EM|Vv#v#V")));
fl_setpup_shortcut(EditMenu, 15, scex(_("EM|wW#w#W")));
fl_setpup_shortcut(EditMenu, 16, scex(_("EM|Ll#l#L")));
fl_setpup_shortcut(EditMenu, 17, scex(_("EM|gG#g#G")));
// disable unavailable entries.
if(tmpbuffer->undostack.empty())
fl_setpup_mode(EditMenu, 1, FL_PUP_GREY);
if(tmpbuffer->redostack.empty())
fl_setpup_mode(EditMenu, 2, FL_PUP_GREY);
if(lyxrc->isp_command == "none")
fl_setpup_mode(EditMenu, 11, FL_PUP_GREY);
if(lyxrc->chktex_command == "none")
fl_setpup_mode(EditMenu, 12, FL_PUP_GREY);
if (tmpbuffer->isReadonly()) {
fl_setpup_mode(EditMenu, 1, FL_PUP_GREY);
fl_setpup_mode(EditMenu, 2, FL_PUP_GREY);
fl_setpup_mode(EditMenu, 3, FL_PUP_GREY);
fl_setpup_mode(EditMenu, 5, FL_PUP_GREY);
fl_setpup_mode(EditMenu, 16, FL_PUP_GREY);
fl_setpup_mode(EditMenu, 17, FL_PUP_GREY);
}
fl_setpup_position(men->_view->getForm()->x + ob->x,
men->_view->getForm()->y + ob->y +
ob->h + 10);
int choice = fl_dopup(EditMenu);
XFlush(fl_display);
// set the pseudo menu-button back
fl_set_object_boxtype(ob, FL_FLAT_BOX);
fl_redraw_object(ob);
switch (choice) {
case 1: tmpfunc->Dispatch(LFUN_UNDO); break;
case 2: tmpfunc->Dispatch(LFUN_REDO); break;
case 3: tmpfunc->Dispatch(LFUN_CUT); break;
case 4: tmpfunc->Dispatch(LFUN_COPY); break;
case 5: tmpfunc->Dispatch(LFUN_PASTE); break;
case 6: tmpfunc->Dispatch(LFUN_MENUSEARCH); break;
case 7: tmpfunc->Dispatch(LFUN_GOTOERROR); break;
case 8: tmpfunc->Dispatch(LFUN_GOTONOTE); break;
case 9: // floats & insets
break;
case 10:// table
break;
case 11: tmpfunc->Dispatch(LFUN_SPELLCHECK); break;
case 12: tmpfunc->Dispatch(LFUN_RUNCHKTEX); break;
case 13: tmpfunc->Dispatch(LFUN_TOCVIEW); break;
case 14: // version control
break;
case 15: tmpfunc->Dispatch(LFUN_LATEX_LOG); break;
case 16: tmpfunc->Dispatch(LFUN_PASTESELECTION, "line"); break;
case 17: tmpfunc->Dispatch(LFUN_PASTESELECTION, "paragraph"); break;
// floats & insets sub-menu
case 21: ToggleFloat(); break;
case 22: tmpfunc->Dispatch(LFUN_MELT); break;
case 23: AllFloats(1, 0); break;
case 24: AllFloats(0, 0); break;
case 25: AllFloats(1, 1); break;
case 26: AllFloats(0, 1); break;
case 27: tmpfunc->Dispatch(LFUN_REMOVEERRORS); break;
case 31: tmpfunc->Dispatch(LFUN_TABLE); break;
// this is really temporary. We need new function in keybind.C
// These should set the minibuffer, too.
case 32: case 33: case 34:
case 35: case 36: case 37:
case 38: case 39: case 40:
case 41: case 42: case 43:
case 44:
if (men->currentView()->available()){
men->currentView()->getScreen()->HideCursor();
if (!tmpbuffer->text->selection){
BeforeChange();
tmpbuffer->update(-2);
}
tmpbuffer->text->
TableFeatures(choice - 32);
tmpbuffer->update(1);
}
break;
// version control sub-menu
case 51: // register
tmpfunc->Dispatch(LFUN_VC_REGISTER);
break;
case 52: // check in
tmpfunc->Dispatch(LFUN_VC_CHECKIN);
break;
case 53: // check out
tmpfunc->Dispatch(LFUN_VC_CHECKOUT);
break;
case 54: // revert to last
tmpfunc->Dispatch(LFUN_VC_REVERT);
break;
case 55: // undo last
tmpfunc->Dispatch(LFUN_VC_UNDO);
break;
case 56: // show history
tmpfunc->Dispatch(LFUN_VC_HISTORY);
break;
}
fl_freepup(EditMenu);
fl_freepup(SubEditFloats);
fl_freepup(SubEditTable);
fl_freepup(SubVersionControl);
}
#endif
void Menus::ShowLayoutMenu(FL_OBJECT * ob, long) void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
@ -1489,11 +1167,7 @@ void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
fl_setpup_shortcut(LayoutMenu, 13, scex(_("LM|Ss#s#S"))); fl_setpup_shortcut(LayoutMenu, 13, scex(_("LM|Ss#s#S")));
// Set values of checkboxes according to font // Set values of checkboxes according to font
#ifdef MOVE_TEXT
LyXFont font = men->currentView()->text->real_current_font; LyXFont font = men->currentView()->text->real_current_font;
#else
LyXFont font = tmpbuffer->text->real_current_font;
#endif
if (font.emph() == LyXFont::ON) if (font.emph() == LyXFont::ON)
fl_setpup_mode(LayoutMenu, 7, FL_PUP_CHECK); fl_setpup_mode(LayoutMenu, 7, FL_PUP_CHECK);
if (font.noun() == LyXFont::ON) if (font.noun() == LyXFont::ON)
@ -1504,13 +1178,8 @@ void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
fl_setpup_mode(LayoutMenu, 10, FL_PUP_CHECK); fl_setpup_mode(LayoutMenu, 10, FL_PUP_CHECK);
// Grey out unavailable entries // Grey out unavailable entries
#ifdef MOVE_TEXT
if (!men->currentView()->text->cursor.par->table) if (!men->currentView()->text->cursor.par->table)
fl_setpup_mode(LayoutMenu, 5, FL_PUP_GREY); fl_setpup_mode(LayoutMenu, 5, FL_PUP_GREY);
#else
if (!tmpbuffer->text->cursor.par->table)
fl_setpup_mode(LayoutMenu, 5, FL_PUP_GREY);
#endif
if (tmpbuffer->isReadonly()) { if (tmpbuffer->isReadonly()) {
fl_setpup_mode(LayoutMenu, 1, FL_PUP_GREY); fl_setpup_mode(LayoutMenu, 1, FL_PUP_GREY);
@ -1561,20 +1230,20 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
int SubInsertAscii = fl_defpup(FL_ObjWin(ob), int SubInsertAscii = fl_defpup(FL_ObjWin(ob),
_("Import ASCII file%t" _("Import ASCII file%t"
"|As Lines%x41" "|As Lines%x41"
"|As Paragraphs%x42")); "|As Paragraphs%x42"));
fl_setpup_shortcut(SubInsertAscii, 41, scex(_("IMA|Ll#l#L"))); fl_setpup_shortcut(SubInsertAscii, 41, scex(_("IMA|Ll#l#L")));
fl_setpup_shortcut(SubInsertAscii, 42, scex(_("IMA|Pp#p#P"))); fl_setpup_shortcut(SubInsertAscii, 42, scex(_("IMA|Pp#p#P")));
int SubInsertTableList= fl_defpup(FL_ObjWin(ob), int SubInsertTableList= fl_defpup(FL_ObjWin(ob),
_("Lists & TOC%t" _("Lists & TOC%t"
"|Table of Contents%x21" "|Table of Contents%x21"
"|List of Figures%x22" "|List of Figures%x22"
"|List of Tables%x23" "|List of Tables%x23"
"|List of Algorithms%x24" "|List of Algorithms%x24"
"|Index List%x25" "|Index List%x25"
"|BibTeX Reference%x26")); "|BibTeX Reference%x26"));
fl_setpup_shortcut(SubInsertTableList, 21, scex(_("IMT|Cc#c#C"))); fl_setpup_shortcut(SubInsertTableList, 21, scex(_("IMT|Cc#c#C")));
fl_setpup_shortcut(SubInsertTableList, 22, scex(_("IMT|Ff#f#F"))); fl_setpup_shortcut(SubInsertTableList, 22, scex(_("IMT|Ff#f#F")));
@ -1584,12 +1253,12 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
fl_setpup_shortcut(SubInsertTableList, 26, scex(_("IMT|Bb#b#B"))); fl_setpup_shortcut(SubInsertTableList, 26, scex(_("IMT|Bb#b#B")));
int SubInsertFloatList = fl_defpup(FL_ObjWin(ob), int SubInsertFloatList = fl_defpup(FL_ObjWin(ob),
_("Floats%t" _("Floats%t"
"|Figure Float%x71" "|Figure Float%x71"
"|Table Float%x72" "|Table Float%x72"
"|Wide Figure Float%x73" "|Wide Figure Float%x73"
"|Wide Table Float%l%x74" "|Wide Table Float%l%x74"
"|Algorithm Float%x75")); "|Algorithm Float%x75"));
fl_setpup_shortcut(SubInsertFloatList, 71, scex(_("IMF|gG#g#G"))); fl_setpup_shortcut(SubInsertFloatList, 71, scex(_("IMF|gG#g#G")));
fl_setpup_shortcut(SubInsertFloatList, 72, scex(_("IMF|Tt#t#T"))); fl_setpup_shortcut(SubInsertFloatList, 72, scex(_("IMF|Tt#t#T")));
@ -1598,15 +1267,15 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
fl_setpup_shortcut(SubInsertFloatList, 75, scex(_("IMF|Aa#a#A"))); fl_setpup_shortcut(SubInsertFloatList, 75, scex(_("IMF|Aa#a#A")));
int SubInsertSpecial = fl_defpup(FL_ObjWin(ob), int SubInsertSpecial = fl_defpup(FL_ObjWin(ob),
_("Special Character%t" _("Special Character%t"
"|HFill%x31" "|HFill%x31"
"|Hyphenation Point%x32" "|Hyphenation Point%x32"
"|Protected Blank%x33" "|Protected Blank%x33"
"|Linebreak%x34" "|Linebreak%x34"
"|Ellipsis (...)%x35" "|Ellipsis (...)%x35"
"|End of sentence period%x36" "|End of sentence period%x36"
"|Ordinary Quote (\")%x37" "|Ordinary Quote (\")%x37"
"|Menu Separator %x38")); "|Menu Separator %x38"));
fl_setpup_shortcut(SubInsertSpecial, 31, scex(_("IMS|Hh#h#H"))); fl_setpup_shortcut(SubInsertSpecial, 31, scex(_("IMS|Hh#h#H")));
fl_setpup_shortcut(SubInsertSpecial, 32, scex(_("IMS|Pp#p#P"))); fl_setpup_shortcut(SubInsertSpecial, 32, scex(_("IMS|Pp#p#P")));
@ -1691,10 +1360,10 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
break; break;
case 6: tmpfunc->Dispatch(LFUN_FOOTMELT); break case 6: tmpfunc->Dispatch(LFUN_FOOTMELT); break
; ;
case 7: tmpfunc->Dispatch(LFUN_MARGINMELT); break; case 7: tmpfunc->Dispatch(LFUN_MARGINMELT); break;
case 8: // Float sub-menu case 8: // Float sub-menu
case 71: case 71:
tmpfunc->Dispatch(LFUN_INSERTFOOTNOTE, "figure"); tmpfunc->Dispatch(LFUN_INSERTFOOTNOTE, "figure");
break; break;
@ -1764,14 +1433,14 @@ void Menus::ShowMathMenu(FL_OBJECT * ob, long)
int MathMenu = fl_defpup(FL_ObjWin(ob), int MathMenu = fl_defpup(FL_ObjWin(ob),
_("Fraction" _("Fraction"
"|Square root" "|Square root"
"|Exponent" "|Exponent"
"|Index" "|Index"
"|Sum" "|Sum"
"|Integral%l" "|Integral%l"
"|Math mode" "|Math mode"
"|Display%l" "|Display%l"
"|Math Panel...")); "|Math Panel..."));
fl_setpup_shortcut(MathMenu, 1, scex(_("MM|Ff#f#F"))); fl_setpup_shortcut(MathMenu, 1, scex(_("MM|Ff#f#F")));
fl_setpup_shortcut(MathMenu, 2, scex(_("MM|Ss#s#S"))); fl_setpup_shortcut(MathMenu, 2, scex(_("MM|Ss#s#S")));
@ -1848,10 +1517,10 @@ void Menus::ShowOptionsMenu(FL_OBJECT * ob, long)
int OptionsMenu = fl_defpup(FL_ObjWin(ob), int OptionsMenu = fl_defpup(FL_ObjWin(ob),
_("Screen Fonts..." _("Screen Fonts..."
"|Spellchecker Options..." "|Spellchecker Options..."
"|Keyboard..." "|Keyboard..."
"|LaTeX...%l" "|LaTeX...%l"
"|Reconfigure" )); "|Reconfigure" ));
fl_setpup_shortcut(OptionsMenu, 1, scex(_("OM|Ff#f#F"))); fl_setpup_shortcut(OptionsMenu, 1, scex(_("OM|Ff#f#F")));
fl_setpup_shortcut(OptionsMenu, 2, scex(_("OM|Ss#s#S"))); fl_setpup_shortcut(OptionsMenu, 2, scex(_("OM|Ss#s#S")));
@ -1927,16 +1596,16 @@ void Menus::ShowHelpMenu(FL_OBJECT * ob, long)
int HelpMenu = fl_defpup(FL_ObjWin(ob), int HelpMenu = fl_defpup(FL_ObjWin(ob),
_("Introduction" _("Introduction"
"|Tutorial" "|Tutorial"
"|User's Guide" "|User's Guide"
"|Extended Features" "|Extended Features"
"|Customization" "|Customization"
"|Reference Manual" "|Reference Manual"
"|Known Bugs" "|Known Bugs"
"|LaTeX Configuration%l" "|LaTeX Configuration%l"
"|Copyright and Warranty..." "|Copyright and Warranty..."
"|Credits..." "|Credits..."
"|Version...")); "|Version..."));
fl_setpup_shortcut(HelpMenu, 1, scex(_("HM|Ii#I#i"))); fl_setpup_shortcut(HelpMenu, 1, scex(_("HM|Ii#I#i")));
fl_setpup_shortcut(HelpMenu, 2, scex(_("HM|Tt#T#t"))); fl_setpup_shortcut(HelpMenu, 2, scex(_("HM|Tt#T#t")));

View File

@ -329,7 +329,7 @@ void LyXParagraph::validate(LaTeXFeatures & features)
{ {
// this will be useful later // this will be useful later
LyXLayout const & layout = textclasslist.Style(GetCurrentTextClass(), LyXLayout const & layout = textclasslist.Style(GetCurrentTextClass(),
GetLayout()); GetLayout());
// check the params. // check the params.
if (line_top || line_bottom) if (line_top || line_bottom)
@ -954,7 +954,7 @@ LyXFont LyXParagraph::getFont(LyXParagraph::size_type pos) const
{ {
LyXFont tmpfont; LyXFont tmpfont;
LyXLayout const & layout = textclasslist.Style(GetCurrentTextClass(), LyXLayout const & layout = textclasslist.Style(GetCurrentTextClass(),
GetLayout()); GetLayout());
LyXParagraph::size_type main_body = 0; LyXParagraph::size_type main_body = 0;
if (layout.labeltype == LABEL_MANUAL) if (layout.labeltype == LABEL_MANUAL)
main_body = BeginningOfMainBody(); main_body = BeginningOfMainBody();
@ -1136,9 +1136,9 @@ char LyXParagraph::GetChar(LyXParagraph::size_type pos) const
string LyXParagraph::GetWord(LyXParagraph::size_type & lastpos) const string LyXParagraph::GetWord(LyXParagraph::size_type & lastpos) const
//Added 98/9/21 by REH //Added 98/9/21 by REH
// return an string of the current word, and the end of the word // return an string of the current word, and the end of the word
// in lastpos. // in lastpos.
// the current word is defined as starting at the first character from // the current word is defined as starting at the first character from
// the immediate left of lastpospos which meets the definition of IsLetter(), // the immediate left of lastpospos which meets the definition of IsLetter(),
@ -1206,8 +1206,8 @@ LyXParagraph::size_type LyXParagraph::Last() const
{ {
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
return text.size() + NextAfterFootnote()->Last() + 1; return text.size() + NextAfterFootnote()->Last() + 1;
/* the 1 is the symbol /* the 1 is the symbol
for the footnote */ for the footnote */
else else
return text.size(); return text.size();
} }
@ -2279,8 +2279,8 @@ void LyXParagraph::readSimpleWholeFile(FILE * myfile)
LyXParagraph * LyXParagraph::TeXOnePar(string & file, TexRow & texrow, LyXParagraph * LyXParagraph::TeXOnePar(string & file, TexRow & texrow,
string & foot, TexRow & foot_texrow, string & foot, TexRow & foot_texrow,
int & foot_count) int & foot_count)
{ {
lyxerr[Debug::LATEX] << "TeXOnePar... " << this << endl; lyxerr[Debug::LATEX] << "TeXOnePar... " << this << endl;
LyXParagraph * par = next; LyXParagraph * par = next;
@ -2365,7 +2365,7 @@ LyXParagraph * LyXParagraph::TeXOnePar(string & file, TexRow & texrow,
} }
file += "\\par}"; file += "\\par}";
} else if (textclasslist.Style(GetCurrentTextClass(), } else if (textclasslist.Style(GetCurrentTextClass(),
GetLayout()).isCommand()){ GetLayout()).isCommand()){
if (style.resfont.size() != font.size()) { if (style.resfont.size() != font.size()) {
file += '\\'; file += '\\';
file += font.latexSize(); file += font.latexSize();
@ -2674,7 +2674,7 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
} }
current_cell_number = -1; current_cell_number = -1;
tmp = table->TexEndOfCell(file, current_cell_number); tmp = table->TexEndOfCell(file, current_cell_number);
for (; tmp >0 ; --tmp) for (; tmp > 0 ; --tmp)
texrow.newline(); texrow.newline();
texrow.start(this, 0); texrow.start(this, 0);
@ -2686,13 +2686,15 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
current_cell_number++; current_cell_number++;
continue; continue;
} }
column++; ++column;
// Fully instantiated font // Fully instantiated font
LyXFont font = getFont(i); LyXFont font = getFont(i);
// Spaces at end of font change are simulated to be outside font change. // Spaces at end of font change are simulated to be
// i.e. we write "\textXX{text} " rather than "\textXX{text }". (Asger) // outside font change.
// i.e. we write "\textXX{text} " rather than
// "\textXX{text }". (Asger)
if (open_font && c == ' ' && i <= size() - 2 if (open_font && c == ' ' && i <= size() - 2
&& getFont(i+1) != running_font && getFont(i+1) != font) { && getFont(i+1) != running_font && getFont(i+1) != font) {
font = getFont(i+1); font = getFont(i+1);
@ -2725,9 +2727,11 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
} }
if (c == LyXParagraph::META_NEWLINE) { if (c == LyXParagraph::META_NEWLINE) {
// special case for inside a table // special case for inside a table
// different from default case in SimpleTeXSpecialChars() // different from default case in
// SimpleTeXSpecialChars()
if (open_font) { if (open_font) {
column += running_font.latexWriteEndChanges(file, basefont); column += running_font
.latexWriteEndChanges(file, basefont);
open_font = false; open_font = false;
} }
basefont = getFont(-1); basefont = getFont(-1);
@ -2742,8 +2746,8 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
// put the EndOfCell because it is put after the // put the EndOfCell because it is put after the
// for(...) // for(...)
if (table->ShouldBeVeryLastCell(current_cell_number)) { if (table->ShouldBeVeryLastCell(current_cell_number)) {
current_cell_number--; current_cell_number--;
break; break;
} }
int tmp = table->TexEndOfCell(file, int tmp = table->TexEndOfCell(file,
current_cell_number); current_cell_number);
@ -2801,7 +2805,7 @@ bool LyXParagraph::TeXContTableRows(string & file,
size_type lastpos = i; size_type lastpos = i;
int cell = table->CellHasContRow(current_cell_number); int cell = table->CellHasContRow(current_cell_number);
current_cell_number++; ++current_cell_number;
while(cell >= 0) { while(cell >= 0) {
// first find the right position // first find the right position
i = lastpos; i = lastpos;
@ -2820,15 +2824,18 @@ bool LyXParagraph::TeXContTableRows(string & file,
file += ' '; file += ' ';
} }
for (; i < size() && (c = GetChar(i)) != LyXParagraph::META_NEWLINE; for (; i < size()
&& (c = GetChar(i)) != LyXParagraph::META_NEWLINE;
++i) { ++i) {
++column; ++column;
// Fully instantiated font // Fully instantiated font
LyXFont font = getFont(i); LyXFont font = getFont(i);
// Spaces at end of font change are simulated to be outside font change. // Spaces at end of font change are simulated to
// i.e. we write "\textXX{text} " rather than "\textXX{text }". (Asger) // be outside font change. i.e. we write
// "\textXX{text} " rather than "\textXX{text }".
// (Asger)
if (open_font && c == ' ' && i <= size() - 2 if (open_font && c == ' ' && i <= size() - 2
&& getFont(i + 1) != running_font && getFont(i + 1) != running_font
&& getFont(i + 1) != font) { && getFont(i + 1) != font) {
@ -2947,23 +2954,22 @@ bool LyXParagraph::linuxDocConvertChar(char c, string & sgml_string)
return retval; return retval;
} }
void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra, void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
int & desc_on, int depth) int & desc_on, int depth)
{ {
if (!table) if (!table) return;
return;
lyxerr[Debug::LATEX] << "SimpleDocbookOneTablePar... " << this << endl; lyxerr[Debug::LATEX] << "SimpleDocbookOneTablePar... " << this << endl;
int column, tmp; int column;
int current_cell_number = -1;
LyXFont font1, font2; LyXFont font1, font2;
char c; char c;
Inset *inset; Inset * inset;
size_type main_body; size_type main_body;
string emph = "emphasis"; string emph = "emphasis";
bool emph_flag= false; bool emph_flag = false;
int char_line_count= 0;
LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), GetLayout()); LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(),
GetLayout());
if (style.labeltype != LABEL_MANUAL) if (style.labeltype != LABEL_MANUAL)
main_body = 0; main_body = 0;
@ -2976,24 +2982,24 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
else else
font1 = style.font; font1 = style.font;
char_line_count = depth; int char_line_count = depth;
addNewlineAndDepth(file, depth); addNewlineAndDepth(file, depth);
if (footnoteflag == LyXParagraph::NO_FOOTNOTE) { if (footnoteflag == LyXParagraph::NO_FOOTNOTE) {
file += "<INFORMALTABLE>"; file += "<INFORMALTABLE>";
addNewlineAndDepth(file, ++depth); addNewlineAndDepth(file, ++depth);
} }
current_cell_number = -1; int current_cell_number = -1;
tmp = table->DocBookEndOfCell(file, current_cell_number, depth); int tmp = table->DocBookEndOfCell(file, current_cell_number, depth);
/* parsing main loop */ /* parsing main loop */
for (size_type i = 0; i < size(); ++i) { for (size_type i = 0; i < size(); ++i) {
c = GetChar(i); c = GetChar(i);
if (table->IsContRow(current_cell_number+1)) { if (table->IsContRow(current_cell_number+1)) {
if (c == LyXParagraph::META_NEWLINE) if (c == LyXParagraph::META_NEWLINE)
current_cell_number++; ++current_cell_number;
continue; continue;
} }
column++; ++column;
// Fully instantiated font // Fully instantiated font
font2 = getFont(i); font2 = getFont(i);
@ -3029,7 +3035,7 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
break; break;
} }
tmp= table->DocBookEndOfCell(file, current_cell_number, tmp= table->DocBookEndOfCell(file, current_cell_number,
depth); depth);
if (tmp > 0) if (tmp > 0)
column = 0; column = 0;
@ -3040,19 +3046,24 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
// //
// This code needs some explanation: // This code needs some explanation:
// Two insets are treated specially // Two insets are treated specially
// label if it is the first element in a command paragraph // label if it is the first element in a
// command paragraph
// desc_on == 3 // desc_on == 3
// graphics inside tables or figure floats can't go on // graphics inside tables or figure floats
// title (the equivalente in latex for this case is caption // can't go on
// title (the equivalente in latex for this
// case is caption
// and title should come first // and title should come first
// desc_on == 4 // desc_on == 4
// //
if(desc_on != 3 || i != 0) { if(desc_on != 3 || i != 0) {
if(tmp_out[0] == '@') { if(tmp_out[0] == '@') {
if(desc_on == 4) if(desc_on == 4)
extra += frontStrip(tmp_out, '@'); extra += frontStrip(tmp_out,
'@');
else else
file += frontStrip(tmp_out, '@'); file += frontStrip(tmp_out,
'@');
} else } else
file += tmp_out; file += tmp_out;
} }
@ -3110,12 +3121,12 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
void LyXParagraph::DocBookContTableRows(string & file, string & extra, void LyXParagraph::DocBookContTableRows(string & file, string & extra,
int & desc_on, LyXParagraph::size_type i, int & desc_on,
LyXParagraph::size_type i,
int current_cell_number, int &column) int current_cell_number, int &column)
{ {
if (!table) if (!table) return;
return;
lyxerr[Debug::LATEX] << "DocBookContTableRows... " << this << endl; lyxerr[Debug::LATEX] << "DocBookContTableRows... " << this << endl;
@ -3145,7 +3156,7 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra,
lastpos = i; lastpos = i;
cell = table->CellHasContRow(current_cell_number); cell = table->CellHasContRow(current_cell_number);
current_cell_number++; ++current_cell_number;
while(cell >= 0) { while(cell >= 0) {
// first find the right position // first find the right position
i = lastpos; i = lastpos;
@ -3243,6 +3254,7 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra,
lyxerr[Debug::LATEX] << "DocBookContTableRows...done " << this << endl; lyxerr[Debug::LATEX] << "DocBookContTableRows...done " << this << endl;
} }
void LyXParagraph::SimpleTeXBlanks(string & file, TexRow & texrow, void LyXParagraph::SimpleTeXBlanks(string & file, TexRow & texrow,
LyXParagraph::size_type const i, LyXParagraph::size_type const i,
int & column, LyXFont const & font, int & column, LyXFont const & font,
@ -3547,14 +3559,14 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
string fname2 = TmpFileName(string(), "RAT2"); string fname2 = TmpFileName(string(), "RAT2");
int lastpos = i; int lastpos = i;
int cell = table->CellHasContRow(actcell); int cell = table->CellHasContRow(actcell);
actcell++; ++actcell;
while(cell >= 0) { while(cell >= 0) {
// first find the right position // first find the right position
i = lastpos; i = lastpos;
for (; i < size() && actcell < cell; ++i) { for (; i < size() && actcell < cell; ++i) {
c = GetChar(i); c = GetChar(i);
if (c == LyXParagraph::META_NEWLINE) if (c == LyXParagraph::META_NEWLINE)
actcell++; ++actcell;
} }
lastpos = i; lastpos = i;
c = GetChar(i); c = GetChar(i);
@ -3572,7 +3584,8 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
switch (c) { switch (c) {
case LyXParagraph::META_INSET: case LyXParagraph::META_INSET:
if ((inset = GetInset(i))) { if ((inset = GetInset(i))) {
fstream fs(fname2.c_str(), ios::in|ios::out); fstream fs(fname2.c_str(),
ios::in|ios::out);
if (!fs) { if (!fs) {
WriteAlert(_("LYX_ERROR:"), WriteAlert(_("LYX_ERROR:"),
_("Cannot open temporary file:"), _("Cannot open temporary file:"),
@ -3605,7 +3618,9 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
if (c != '\0') if (c != '\0')
os << c; os << c;
else else
lyxerr.debug() << "RoffAsciiTable: NULL char in structure." << endl; lyxerr.debug() << "RoffAsciiTable: "
"NULL char in structure."
<< endl;
break; break;
} }
} }
@ -3626,7 +3641,7 @@ LyXParagraph * LyXParagraph::TeXDeeper(string & file, TexRow & texrow,
if (par->IsDummy()) if (par->IsDummy())
lyxerr << "ERROR (LyXParagraph::TeXDeeper)" << endl; lyxerr << "ERROR (LyXParagraph::TeXDeeper)" << endl;
if (textclasslist.Style(GetCurrentTextClass(), if (textclasslist.Style(GetCurrentTextClass(),
par->layout).isEnvironment() par->layout).isEnvironment()
|| par->pextra_type != PEXTRA_NONE) || par->pextra_type != PEXTRA_NONE)
{ {
par = par->TeXEnvironment(file, texrow, par = par->TeXEnvironment(file, texrow,
@ -3645,12 +3660,12 @@ LyXParagraph * LyXParagraph::TeXDeeper(string & file, TexRow & texrow,
LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow, LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow,
string & foot, TexRow & foot_texrow, string & foot, TexRow & foot_texrow,
int & foot_count) int & foot_count)
{ {
bool eindent_open = false; bool eindent_open = false;
bool foot_this_level = false; bool foot_this_level = false;
// flags when footnotetext should be appended to file. // flags when footnotetext should be appended to file.
static bool minipage_open = false; static bool minipage_open = false;
static int minipage_open_depth = 0; static int minipage_open_depth = 0;
char par_sep = current_view->buffer()->params.paragraph_separation; char par_sep = current_view->buffer()->params.paragraph_separation;
@ -3788,24 +3803,25 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow,
if (minipage_open && par && !style.isEnvironment() && if (minipage_open && par && !style.isEnvironment() &&
(par->pextra_type == PEXTRA_MINIPAGE) && (par->pextra_type == PEXTRA_MINIPAGE) &&
par->pextra_start_minipage) { par->pextra_start_minipage) {
file += "\\end{minipage}\n"; file += "\\end{minipage}\n";
texrow.newline();
if (par_sep == BufferParams::PARSEP_INDENT) {
file += "}\n";
texrow.newline(); texrow.newline();
} if (par_sep == BufferParams::PARSEP_INDENT) {
minipage_open = false; file += "}\n";
texrow.newline();
}
minipage_open = false;
} }
if (par && par->depth > depth) { if (par && par->depth > depth) {
if (textclasslist.Style(GetCurrentTextClass(), if (textclasslist.Style(GetCurrentTextClass(),
par->layout).isParagraph() par->layout).isParagraph()
&& !par->table && !par->table
&& !suffixIs(file, "\n\n")) { && !suffixIs(file, "\n\n")) {
// There should be at least one '\n' already // There should be at least one '\n' already
// but we need there to be two for Standard // but we need there to be two for Standard
// paragraphs that are depth-increment'ed to be // paragraphs that are depth-increment'ed to be
// output correctly. However, tables can also be // output correctly. However, tables can
// paragraphs so don't adjust them. ARRae // also be paragraphs so don't adjust them.
// ARRae
file += '\n'; file += '\n';
texrow.newline(); texrow.newline();
} }
@ -3931,7 +3947,7 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
LyXParagraph * par = this; LyXParagraph * par = this;
LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(),
previous->GetLayout()); previous->GetLayout());
if (style.needprotect && footnotekind != LyXParagraph::FOOTNOTE){ if (style.needprotect && footnotekind != LyXParagraph::FOOTNOTE){
lyxerr << "ERROR (LyXParagraph::TeXFootnote): " lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
@ -3991,7 +4007,8 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
sprintf(bufr, "\\begin{floatingfigure}{%s}\n", sprintf(bufr, "\\begin{floatingfigure}{%s}\n",
pextra_width.c_str()); pextra_width.c_str());
else else
sprintf(bufr, "\\begin{floatingfigure}{%f\\textwidth}\n", sprintf(bufr,
"\\begin{floatingfigure}{%f\\textwidth}\n",
atoi(pextra_widthp.c_str())/100.0); atoi(pextra_widthp.c_str())/100.0);
file += bufr; file += bufr;
} else { } else {
@ -4045,16 +4062,18 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
|| !footer_in_body) { || !footer_in_body) {
// Process text for all floats except footnotes in body // Process text for all floats except footnotes in body
do { do {
LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), LyXLayout const & style =
par->layout); textclasslist.Style(GetCurrentTextClass(),
par->layout);
if (par->IsDummy()) if (par->IsDummy())
lyxerr << "ERROR (LyXParagraph::TeXFootnote)" lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
<< endl; << endl;
if (style.isEnvironment() if (style.isEnvironment()
|| par->pextra_type == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */ || par->pextra_type == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */
// Allows the use of minipages within float environments. // Allows the use of minipages within float
// Shouldn't be circular because we don't support // environments. Shouldn't be circular because
// footnotes inside floats (yet). ARRae // we don't support footnotes inside
// floats (yet). ARRae
par = par->TeXEnvironment(file, texrow, par = par->TeXEnvironment(file, texrow,
foot, foot_texrow, foot, foot_texrow,
foot_count); foot_count);
@ -4078,16 +4097,18 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
TexRow dummy_texrow; TexRow dummy_texrow;
int dummy_count = 0; int dummy_count = 0;
do { do {
LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), LyXLayout const & style =
par->layout); textclasslist.Style(GetCurrentTextClass(),
par->layout);
if (par->IsDummy()) if (par->IsDummy())
lyxerr << "ERROR (LyXParagraph::TeXFootnote)" lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
<< endl; << endl;
if (style.isEnvironment() if (style.isEnvironment()
|| par->pextra_type == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */ || par->pextra_type == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */
// Allows the use of minipages within float environments. // Allows the use of minipages within float
// Shouldn't be circular because we don't support // environments. Shouldn't be circular because
// footnotes inside floats (yet). ARRae // we don't support footnotes inside
// floats (yet). ARRae
par = par->TeXEnvironment(foot, foot_texrow, par = par->TeXEnvironment(foot, foot_texrow,
dummy, dummy_texrow, dummy, dummy_texrow,
dummy_count); dummy_count);
@ -4102,7 +4123,8 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
dummy, dummy_texrow, dummy, dummy_texrow,
dummy_count); dummy_count);
} }
} while (par && par->footnoteflag != LyXParagraph::NO_FOOTNOTE); } while (par
&& par->footnoteflag != LyXParagraph::NO_FOOTNOTE);
if (dummy_count) { if (dummy_count) {
lyxerr << "ERROR (LyXParagraph::TeXFootnote): " lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
"Footnote in a Footnote -- not supported" "Footnote in a Footnote -- not supported"
@ -4163,80 +4185,84 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
void LyXParagraph::SetPExtraType(int type, char const * width, void LyXParagraph::SetPExtraType(int type, char const * width,
char const * widthp) char const * widthp)
{ {
pextra_type = type; pextra_type = type;
pextra_width = width; pextra_width = width;
pextra_widthp = widthp; pextra_widthp = widthp;
if (textclasslist.Style(GetCurrentTextClass(), if (textclasslist.Style(GetCurrentTextClass(),
layout).isEnvironment()) { layout).isEnvironment()) {
LyXParagraph LyXParagraph
* par = this, * par = this,
* ppar = par; * ppar = par;
while (par && (par->layout == layout) && (par->depth == depth)) { while (par && (par->layout == layout)
ppar = par; && (par->depth == depth)) {
par = par->Previous(); ppar = par;
if (par) par = par->Previous();
par = par->FirstPhysicalPar(); if (par)
while (par && par->depth > depth) { par = par->FirstPhysicalPar();
par = par->Previous(); while (par && par->depth > depth) {
if (par) par = par->Previous();
par = par->FirstPhysicalPar(); if (par)
} par = par->FirstPhysicalPar();
} }
par = ppar; }
while (par && (par->layout == layout) && (par->depth == depth)) { par = ppar;
par->pextra_type = type; while (par && (par->layout == layout)
par->pextra_width = width; && (par->depth == depth)) {
par->pextra_widthp = widthp; par->pextra_type = type;
par = par->NextAfterFootnote(); par->pextra_width = width;
if (par && (par->depth > depth)) par->pextra_widthp = widthp;
par->SetPExtraType(type, width, widthp); par = par->NextAfterFootnote();
while (par && ((par->depth > depth) || par->IsDummy())) if (par && (par->depth > depth))
par = par->NextAfterFootnote(); par->SetPExtraType(type, width, widthp);
} while (par && ((par->depth > depth) || par->IsDummy()))
} par = par->NextAfterFootnote();
}
}
} }
void LyXParagraph::UnsetPExtraType() void LyXParagraph::UnsetPExtraType()
{ {
if (pextra_type == PEXTRA_NONE) if (pextra_type == PEXTRA_NONE)
return; return;
pextra_type = PEXTRA_NONE; pextra_type = PEXTRA_NONE;
pextra_width.clear(); pextra_width.clear();
pextra_widthp.clear(); pextra_widthp.clear();
if (textclasslist.Style(GetCurrentTextClass(), if (textclasslist.Style(GetCurrentTextClass(),
layout).isEnvironment()) { layout).isEnvironment()) {
LyXParagraph LyXParagraph
* par = this, * par = this,
* ppar = par; * ppar = par;
while (par && (par->layout == layout) && (par->depth == depth)) { while (par && (par->layout == layout)
ppar = par; && (par->depth == depth)) {
par = par->Previous(); ppar = par;
if (par) par = par->Previous();
par = par->FirstPhysicalPar(); if (par)
while (par && par->depth > depth) { par = par->FirstPhysicalPar();
par = par->Previous(); while (par && par->depth > depth) {
if (par) par = par->Previous();
par = par->FirstPhysicalPar(); if (par)
} par = par->FirstPhysicalPar();
} }
par = ppar; }
while (par && (par->layout == layout) && (par->depth == depth)) { par = ppar;
par->pextra_type = PEXTRA_NONE; while (par && (par->layout == layout)
par->pextra_width.clear(); && (par->depth == depth)) {
par->pextra_widthp.clear(); par->pextra_type = PEXTRA_NONE;
par = par->NextAfterFootnote(); par->pextra_width.clear();
if (par && (par->depth > depth)) par->pextra_widthp.clear();
par->UnsetPExtraType(); par = par->NextAfterFootnote();
while (par && ((par->depth > depth) || par->IsDummy())) if (par && (par->depth > depth))
par = par->NextAfterFootnote(); par->UnsetPExtraType();
} while (par && ((par->depth > depth) || par->IsDummy()))
} par = par->NextAfterFootnote();
}
}
} }
@ -4305,5 +4331,5 @@ bool LyXParagraph::IsLetter(LyXParagraph::size_type pos) const
bool LyXParagraph::IsWord(size_type pos ) const bool LyXParagraph::IsWord(size_type pos ) const
{ {
return IsWordChar( GetChar(pos) ) ; return IsWordChar(GetChar(pos)) ;
} }

View File

@ -30,8 +30,8 @@ LyXScreen::LyXScreen(Window window,
Dimension offset_y, Dimension offset_y,
LyXText *text_ptr) LyXText *text_ptr)
: text(text_ptr), _window(window), : text(text_ptr), _window(window),
_width(width), _height(height), _width(width), _height(height),
_offset_x(offset_x), _offset_y(offset_y) _offset_x(offset_x), _offset_y(offset_y)
{ {
first = 0; first = 0;
@ -85,17 +85,13 @@ void LyXScreen::expose(int x, int y, int exp_width, int exp_height)
void LyXScreen::DrawFromTo(int y1, int y2) void LyXScreen::DrawFromTo(int y1, int y2)
{ {
Row* row = 0; long y_text = first + y1;
long y_text = 0;
long y = 0;
y_text = first + y1;
/* get the first needed row */ /* get the first needed row */
row = text->GetRowNearY(y_text); Row * row = text->GetRowNearY(y_text);
/* y_text is now the real beginning of the row */ /* y_text is now the real beginning of the row */
y = y_text - first; long y = y_text - first;
/* y1 is now the real beginning of row on the screen */ /* y1 is now the real beginning of row on the screen */
while (row != 0 && y < y2) { while (row != 0 && y < y2) {
@ -117,11 +113,9 @@ void LyXScreen::DrawFromTo(int y1, int y2)
} }
void LyXScreen::DrawOneRow(Row *row, long &y_text) void LyXScreen::DrawOneRow(Row * row, long & y_text)
{ {
long y = 0; long y = y_text - first;
y = y_text - first;
if (y + row->height > 0 && y - row->height <= _height) { if (y + row->height > 0 && y - row->height <= _height) {
/* ok there is something visible */ /* ok there is something visible */
@ -137,7 +131,7 @@ void LyXScreen::Draw(long y)
{ {
if (cursor_visible) HideCursor(); if (cursor_visible) HideCursor();
if (y<0) y = 0; if (y < 0) y = 0;
long old_first = first; long old_first = first;
first = y; first = y;
@ -265,7 +259,8 @@ int LyXScreen::FitManualCursor(long /*x*/, long y, int asc, int desc)
} }
void LyXScreen::HideManualCursor(long x, long y, int asc, int desc){ void LyXScreen::HideManualCursor(long x, long y, int asc, int desc)
{
if (fast_selection || mono_video) if (fast_selection || mono_video)
ShowManualCursor(x, y, asc, desc); ShowManualCursor(x, y, asc, desc);
else else
@ -304,7 +299,7 @@ void LyXScreen::ShowManualCursor(long x, long y, int asc, int desc)
cursor_pixmap_w = 1; cursor_pixmap_w = 1;
cursor_pixmap_h = y2 - y1 + 1; cursor_pixmap_h = y2 - y1 + 1;
cursor_pixmap_x = x, cursor_pixmap_x = x,
cursor_pixmap_y = y1; cursor_pixmap_y = y1;
cursor_pixmap = cursor_pixmap =
XCreatePixmap (fl_display, XCreatePixmap (fl_display,
fl_root, fl_root,
@ -439,14 +434,14 @@ void LyXScreen::Update()
DrawOneRow(text->refresh_row, y); DrawOneRow(text->refresh_row, y);
text->status = LyXText::UNCHANGED; text->status = LyXText::UNCHANGED;
expose(0, text->refresh_y-first, expose(0, text->refresh_y-first,
_width, text->refresh_row->height); _width, text->refresh_row->height);
} }
} }
void LyXScreen::SmallUpdate() void LyXScreen::SmallUpdate()
{ {
Row *row = 0; Row * row = 0;
long y = 0; long y = 0;
long y2 = 0; long y2 = 0;
@ -486,12 +481,13 @@ void LyXScreen::SmallUpdate()
void LyXScreen::ToggleSelection(bool kill_selection) void LyXScreen::ToggleSelection(bool kill_selection)
{ {
long top = 0;
long bottom = 0;
/* only if there is a selection */ /* only if there is a selection */
if (!text->selection) if (!text->selection)
return; return;
long top = 0;
long bottom = 0;
if (fast_selection || mono_video){ if (fast_selection || mono_video){
@ -640,7 +636,7 @@ void LyXScreen::ToggleToggle()
&& text->toggle_cursor.pos == text->toggle_end_cursor.pos) && text->toggle_cursor.pos == text->toggle_end_cursor.pos)
return; return;
if (fast_selection || mono_video){ if (fast_selection || mono_video) {
/* selection only in one row ?*/ /* selection only in one row ?*/
if (text->toggle_cursor.y == text->toggle_end_cursor.y) { if (text->toggle_cursor.y == text->toggle_end_cursor.y) {
@ -810,22 +806,24 @@ void LyXScreen::drawFrame(int /*ft*/, int x, int y, int w, int h,
// I think these calls to fl_color might make xforms sometimes // I think these calls to fl_color might make xforms sometimes
// draw the wrong color on other objects. // draw the wrong color on other objects.
fl_color(FL_TOP_BCOL); fl_color(FL_TOP_BCOL);
XFillRectangle(fl_display, foreground, fl_gc, x-d, y-d, w+2*d, d); XFillRectangle(fl_display, foreground, fl_gc,
x - d, y - d, w + 2 * d, d);
fl_color(FL_BOTTOM_BCOL); fl_color(FL_BOTTOM_BCOL);
XFillRectangle(fl_display, foreground, fl_gc, x-d, y+h, w+2*d, d); XFillRectangle(fl_display, foreground, fl_gc,
x - d, y + h, w + 2 * d, d);
// Now a couple of trapezoids // Now a couple of trapezoids
XPoint pl[4], pr[4]; XPoint pl[4], pr[4];
pl[0].x = x-d; pl[0].y = y-d; pl[0].x = x - d; pl[0].y = y - d;
pl[1].x = x-d; pl[1].y = y+h+d; pl[1].x = x - d; pl[1].y = y + h + d;
pl[2].x = x; pl[2].y = y+h; pl[2].x = x; pl[2].y = y + h;
pl[3].x = x; pl[3].y = y; pl[3].x = x; pl[3].y = y;
pr[0].x = x+w+d; pr[0].y = y-d; pr[0].x = x + w + d; pr[0].y = y - d;
pr[1].x = x+w+d; pr[1].y = y+h+d; pr[1].x = x + w + d; pr[1].y = y + h + d;
pr[2].x = x+w; pr[2].y = y+h; pr[2].x = x + w; pr[2].y = y + h;
pr[3].x = x+w; pr[3].y = y; pr[3].x = x + w; pr[3].y = y;
fl_color(FL_LEFT_BCOL); fl_color(FL_LEFT_BCOL);
XFillPolygon(fl_display, XFillPolygon(fl_display,

View File

@ -3,8 +3,8 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1999 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
* ====================================================== */ * ====================================================== */
@ -114,7 +114,8 @@ private:
lyxstring::Srep::Srep(lyxstring::size_type nsz, const value_type * p) lyxstring::Srep::Srep(lyxstring::size_type nsz, const value_type * p)
{ {
// can be called with p == 0 by lyxstring::assign(const value_type *, size_type) // can be called with p == 0 by
// lyxstring::assign(const value_type *, size_type)
sz = nsz; sz = nsz;
ref = 1; ref = 1;
@ -148,7 +149,8 @@ lyxstring::Srep::Srep(lyxstring::size_type nsz, value_type ch)
void lyxstring::Srep::assign(lyxstring::size_type nsz, const value_type * p) void lyxstring::Srep::assign(lyxstring::size_type nsz, const value_type * p)
{ {
// can be called with p == 0 by lyxstring::assign(const value_type *, size_type) // can be called with p == 0
// by lyxstring::assign(const value_type *, size_type)
if (res < nsz) { if (res < nsz) {
delete[] s; delete[] s;
@ -223,7 +225,7 @@ void lyxstring::Srep::push_back(value_type c)
void lyxstring::Srep::insert(lyxstring::size_type pos, const value_type * p, void lyxstring::Srep::insert(lyxstring::size_type pos, const value_type * p,
lyxstring::size_type n) lyxstring::size_type n)
{ {
if (res < n + sz) { if (res < n + sz) {
do { do {
@ -799,7 +801,7 @@ lyxstring & lyxstring::insert(size_type pos, lyxstring const & x)
lyxstring & lyxstring::insert(size_type pos, lyxstring const & x, lyxstring & lyxstring::insert(size_type pos, lyxstring const & x,
size_type pos2, size_type n) size_type pos2, size_type n)
{ {
Assert(pos <= rep->sz && pos2 <= x.rep->sz); // STD! Assert(pos <= rep->sz && pos2 <= x.rep->sz); // STD!
TestlyxstringInvariant(this); TestlyxstringInvariant(this);
@ -912,7 +914,7 @@ lyxstring::size_type lyxstring::find(lyxstring const & a, size_type i) const
lyxstring::size_type lyxstring::find(value_type const * ptr, size_type i, lyxstring::size_type lyxstring::find(value_type const * ptr, size_type i,
size_type n) const size_type n) const
{ {
Assert(ptr); // OURS! Assert(ptr); // OURS!
if (!rep->sz || !*ptr || i >= rep->sz) return npos; if (!rep->sz || !*ptr || i >= rep->sz) return npos;
@ -987,7 +989,7 @@ lyxstring::size_type lyxstring::rfind(lyxstring const & a, size_type i) const
lyxstring::size_type lyxstring::rfind(value_type const * ptr, size_type i, lyxstring::size_type lyxstring::rfind(value_type const * ptr, size_type i,
size_type n) const size_type n) const
{ {
Assert(ptr); // OURS! Assert(ptr); // OURS!
TestlyxstringInvariant(this); TestlyxstringInvariant(this);

View File

@ -21,9 +21,9 @@
#pragma implementation #pragma implementation
#endif #endif
extern void addNewlineAndDepth(string &file, int const depth); // Jug 990923 extern void addNewlineAndDepth(string & file, int const depth); // Jug 990923
#define WIDTH_OF_LINE 5 static int const WIDTH_OF_LINE = 5;
/* konstruktor */ /* konstruktor */
LyXTable::LyXTable(int rows_arg, int columns_arg) LyXTable::LyXTable(int rows_arg, int columns_arg)
@ -34,18 +34,17 @@ LyXTable::LyXTable(int rows_arg, int columns_arg)
LyXTable::LyXTable(LyXLex &lex) LyXTable::LyXTable(LyXLex &lex)
{ {
FILE *file = lex.getFile(); FILE * file = lex.getFile();
Read(file); Read(file);
} }
LyXTable::~LyXTable() { LyXTable::~LyXTable() {
int i;
delete[] rowofcell; delete[] rowofcell;
delete[] columnofcell; delete[] columnofcell;
delete[] column_info; delete[] column_info;
delete[] row_info; delete[] row_info;
for (i = 0; i<rows; i++) { for (int i = 0; i < rows; ++i) {
delete[] cell_info[i]; // verify that this shoudn't be freed with delete delete[] cell_info[i]; // verify that this shoudn't be freed with delete
} }
delete[] cell_info; delete[] cell_info;
@ -54,20 +53,20 @@ LyXTable::~LyXTable() {
LyXTable * LyXTable::Clone() LyXTable * LyXTable::Clone()
{ {
LyXTable *result = new LyXTable(rows, columns); LyXTable * result = new LyXTable(rows, columns);
int row, column;; int row, column;;
for (row = 0; row<rows; row++){ for (row = 0; row < rows; ++row) {
for (column = 0; column<columns;column++){ for (column = 0; column < columns; ++column) {
result->cell_info[row][column] = cell_info[row][column]; result->cell_info[row][column] = cell_info[row][column];
} }
} }
for (row = 0; row<rows; row++){ for (row = 0; row < rows; ++row) {
result->row_info[row] = row_info[row]; result->row_info[row] = row_info[row];
} }
for (column = 0; column<columns; column++){ for (column = 0; column < columns; ++column) {
result->column_info[column].left_line = column_info[column].left_line; result->column_info[column].left_line = column_info[column].left_line;
result->column_info[column].right_line = column_info[column].right_line; result->column_info[column].right_line = column_info[column].right_line;
result->column_info[column].alignment = column_info[column].alignment; result->column_info[column].alignment = column_info[column].alignment;
@ -85,21 +84,21 @@ LyXTable * LyXTable::Clone()
/* activates all lines and sets all widths to 0 */ /* activates all lines and sets all widths to 0 */
void LyXTable::Init(int rows_arg, int columns_arg) void LyXTable::Init(int rows_arg, int columns_arg)
{ {
int i, j, cellno; int i, j;
rows = rows_arg; rows = rows_arg;
columns = columns_arg; columns = columns_arg;
column_info = new columnstruct[columns]; column_info = new columnstruct[columns];
row_info = new rowstruct[rows]; row_info = new rowstruct[rows];
cell_info = new cellstruct*[rows]; cell_info = new cellstruct*[rows];
cellno = 0; int cellno = 0;
for (i = 0; i<rows;i++) { for (i = 0; i < rows; ++i) {
cell_info[i] = new cellstruct[columns]; cell_info[i] = new cellstruct[columns];
row_info[i].top_line = true; row_info[i].top_line = true;
row_info[i].bottom_line = false; row_info[i].bottom_line = false;
row_info[i].is_cont_row = false; row_info[i].is_cont_row = false;
row_info[i].newpage = false; row_info[i].newpage = false;
for (j = 0; j<columns; j++) { for (j = 0; j < columns; ++j) {
cell_info[i][j].cellno = cellno++; cell_info[i][j].cellno = cellno++;
cell_info[i][j].width_of_cell = 0; cell_info[i][j].width_of_cell = 0;
cell_info[i][j].multicolumn = LyXTable::CELL_NORMAL; cell_info[i][j].multicolumn = LyXTable::CELL_NORMAL;
@ -114,7 +113,7 @@ void LyXTable::Init(int rows_arg, int columns_arg)
row_info[i-1].bottom_line = true; row_info[i-1].bottom_line = true;
row_info[0].bottom_line = true; row_info[0].bottom_line = true;
for (i = 0; i<columns;i++) { for (i = 0; i < columns; ++i) {
column_info[i].left_line = true; column_info[i].left_line = true;
column_info[i].right_line = false; column_info[i].right_line = false;
column_info[i].alignment = LYX_ALIGN_CENTER; column_info[i].alignment = LYX_ALIGN_CENTER;
@ -142,26 +141,26 @@ void LyXTable::Init(int rows_arg, int columns_arg)
void LyXTable::AppendRow(int cell) void LyXTable::AppendRow(int cell)
{ {
int row = row_of_cell(cell); int row = row_of_cell(cell);
rowstruct *row_info2 = new rowstruct[rows+1]; rowstruct * row_info2 = new rowstruct[rows + 1];
cellstruct** cell_info2 = new cellstruct*[rows+1]; cellstruct ** cell_info2 = new cellstruct * [rows + 1];
int i; int i;
for (i = 0; i <= row; i++) { for (i = 0; i <= row; ++i) {
cell_info2[i] = cell_info[i]; cell_info2[i] = cell_info[i];
row_info2[i] = row_info[i]; row_info2[i] = row_info[i];
} }
for (i = rows-1; i >= row; i--) { for (i = rows - 1; i >= row; --i) {
cell_info2[i+1] = cell_info[i]; cell_info2[i + 1] = cell_info[i];
row_info2[i+1] = row_info[i]; row_info2[i + 1] = row_info[i];
} }
for (i = row;row_info[i].is_cont_row;i--); for (i = row; row_info[i].is_cont_row; --i);
if (((row+1)>= rows) || !row_info[row+1].is_cont_row) if (((row + 1) >= rows) || !row_info[row + 1].is_cont_row)
row_info2[row+1].is_cont_row = false; row_info2[row + 1].is_cont_row = false;
row_info2[row+1].top_line = row_info[i].top_line; row_info2[row + 1].top_line = row_info[i].top_line;
cell_info2[row+1] = new cellstruct[columns]; cell_info2[row + 1] = new cellstruct[columns];
for (i = 0; i<columns; i++) { for (i = 0; i < columns; ++i) {
cell_info2[row+1][i].width_of_cell = 0; cell_info2[row + 1][i].width_of_cell = 0;
cell_info2[row+1][i] = cell_info2[row][i]; cell_info2[row + 1][i] = cell_info2[row][i];
} }
delete[] cell_info; delete[] cell_info;
@ -169,7 +168,7 @@ void LyXTable::AppendRow(int cell)
delete[] row_info; delete[] row_info;
row_info = row_info2; row_info = row_info2;
rows++; ++rows;
Reinit(); Reinit();
} }
@ -180,29 +179,28 @@ void LyXTable::DeleteRow(int cell)
int row = row_of_cell(cell); int row = row_of_cell(cell);
while(!row_info[row].is_cont_row && RowHasContRow(cell)) while(!row_info[row].is_cont_row && RowHasContRow(cell))
DeleteRow(cell_info[row+1][0].cellno); DeleteRow(cell_info[row+1][0].cellno);
rowstruct *row_info2 = new rowstruct[rows-1]; rowstruct * row_info2 = new rowstruct[rows - 1];
cellstruct** cell_info2 = new cellstruct*[rows-1]; cellstruct ** cell_info2 = new cellstruct * [rows - 1];
int i;
delete[] cell_info[row]; delete[] cell_info[row];
for (i = 0; i < row; i++) { int i = 0;
for (; i < row; ++i) {
cell_info2[i] = cell_info[i]; cell_info2[i] = cell_info[i];
row_info2[i] = row_info[i]; row_info2[i] = row_info[i];
} }
if (row_info[i].is_cont_row) if (row_info[i].is_cont_row)
row_info2[i-1].bottom_line = row_info[i].bottom_line; row_info2[i - 1].bottom_line = row_info[i].bottom_line;
for (i = row; i < rows - 1; i++) { for (i = row; i < rows - 1; ++i) {
cell_info2[i] = cell_info[i+1]; cell_info2[i] = cell_info[i + 1];
row_info2[i] = row_info[i+1]; row_info2[i] = row_info[i + 1];
} }
delete[] cell_info; delete[] cell_info;
cell_info = cell_info2; cell_info = cell_info2;
delete[] row_info; delete[] row_info;
row_info = row_info2; row_info = row_info2;
rows--; --rows;
Reinit(); Reinit();
} }
@ -210,63 +208,64 @@ void LyXTable::DeleteRow(int cell)
void LyXTable::AppendColumn(int cell) void LyXTable::AppendColumn(int cell)
{ {
int i, j; int j;
columnstruct *column_info2 = new columnstruct[columns+1]; columnstruct * column_info2 = new columnstruct[columns + 1];
int column = right_column_of_cell(cell); int column = right_column_of_cell(cell);
for (i = 0; i<= column; i++){ int i = 0;
for (; i <= column; ++i) {
column_info2[i] = column_info[i]; column_info2[i] = column_info[i];
} }
for (i = columns-1; i>= column; i--){ for (i = columns - 1; i >= column; --i) {
column_info2[i+1] = column_info[i]; column_info2[i + 1] = column_info[i];
} }
delete[] column_info; delete[] column_info;
column_info = column_info2; column_info = column_info2;
for (i = 0; i<rows;i++){ for (i = 0; i < rows; ++i) {
cellstruct* tmp = cell_info[i]; cellstruct * tmp = cell_info[i];
cell_info[i] = new cellstruct[columns+1]; cell_info[i] = new cellstruct[columns + 1];
for (j = 0; j<= column; j++){ for (j = 0; j <= column; ++j) {
cell_info[i][j] = tmp[j]; cell_info[i][j] = tmp[j];
} }
for (j = column; j<columns; j++){ for (j = column; j < columns; ++j) {
cell_info[i][j+1] = tmp[j]; cell_info[i][j + 1] = tmp[j];
} }
// care about multicolumns // care about multicolumns
if (cell_info[i][column+1].multicolumn if (cell_info[i][column + 1].multicolumn
== LyXTable::CELL_BEGIN_OF_MULTICOLUMN){ == LyXTable::CELL_BEGIN_OF_MULTICOLUMN){
cell_info[i][column+1].multicolumn = cell_info[i][column + 1].multicolumn =
LyXTable::CELL_PART_OF_MULTICOLUMN; LyXTable::CELL_PART_OF_MULTICOLUMN;
} }
if (column + 1 == columns if (column + 1 == columns
|| cell_info[i][column+2].multicolumn || cell_info[i][column + 2].multicolumn
!= LyXTable::CELL_PART_OF_MULTICOLUMN){ != LyXTable::CELL_PART_OF_MULTICOLUMN){
cell_info[i][column+1].multicolumn = cell_info[i][column + 1].multicolumn =
LyXTable::CELL_NORMAL; LyXTable::CELL_NORMAL;
} }
delete[] tmp; delete[] tmp;
} }
columns++; ++columns;
Reinit(); Reinit();
} }
void LyXTable::Reinit() void LyXTable::Reinit()
{ {
int i, j; int j;
for (i = 0; i<rows;i++) { int i = 0;
for (j = 0; j<columns; j++) { for (; i < rows; ++i) {
for (j = 0; j < columns; ++j) {
cell_info[i][j].width_of_cell = 0; cell_info[i][j].width_of_cell = 0;
if ((i+1 < rows) && !row_info[i+1].is_cont_row) if ((i + 1 < rows) && !row_info[i+1].is_cont_row)
cell_info[i][j].has_cont_row = false; cell_info[i][j].has_cont_row = false;
} }
} }
for (i = 0; i<columns;i++) { for (i = 0; i < columns; ++i) {
calculate_width_of_column(i); calculate_width_of_column(i);
} }
calculate_width_of_table(); calculate_width_of_table();
@ -277,11 +276,11 @@ void LyXTable::Reinit()
void LyXTable::set_row_column_number_info() void LyXTable::set_row_column_number_info()
{ {
int row = 0;
int c = 0; int c = 0;
int column = 0; int column = 0;
numberofcells = -1; numberofcells = -1;
for (row = 0; row<rows; ++row) { int row = 0;
for (; row < rows; ++row) {
for (column = 0; column<columns; ++column) { for (column = 0; column<columns; ++column) {
if (cell_info[row][column].multicolumn if (cell_info[row][column].multicolumn
!= LyXTable::CELL_PART_OF_MULTICOLUMN) != LyXTable::CELL_PART_OF_MULTICOLUMN)
@ -303,15 +302,15 @@ void LyXTable::set_row_column_number_info()
while (c < numberofcells && row < rows && column < columns) { while (c < numberofcells && row < rows && column < columns) {
rowofcell[c] = row; rowofcell[c] = row;
columnofcell[c] = column; columnofcell[c] = column;
c++; ++c;
do{ do{
column++; ++column;
} while (column < columns && } while (column < columns &&
cell_info[row][column].multicolumn cell_info[row][column].multicolumn
== LyXTable::CELL_PART_OF_MULTICOLUMN); == LyXTable::CELL_PART_OF_MULTICOLUMN);
if (column == columns){ if (column == columns){
column = 0; column = 0;
row++; ++row;
} }
} }
} }
@ -321,12 +320,11 @@ void LyXTable::DeleteColumn(int cell)
{ {
int column1 = column_of_cell(cell); int column1 = column_of_cell(cell);
int column2 = right_column_of_cell(cell); int column2 = right_column_of_cell(cell);
int column;
if (column1 == 0 && column2 == columns - 1) if (column1 == 0 && column2 == columns - 1)
return; return;
for (column = column1; column <= column2;column++){ for (int column = column1; column <= column2; ++column) {
delete_column(column1); delete_column(column1);
} }
Reinit(); Reinit();
@ -342,11 +340,10 @@ int LyXTable::GetNumberOfCells()
int LyXTable::NumberOfCellsInRow(int cell) int LyXTable::NumberOfCellsInRow(int cell)
{ {
int row = row_of_cell(cell); int row = row_of_cell(cell);
int i = 0;
int result = 0; int result = 0;
for (i = 0; i<columns; i++){ for (int i = 0; i < columns; ++i) {
if (cell_info[row][i].multicolumn != LyXTable::CELL_PART_OF_MULTICOLUMN) if (cell_info[row][i].multicolumn != LyXTable::CELL_PART_OF_MULTICOLUMN)
result++; ++result;
} }
return result; return result;
} }
@ -405,6 +402,7 @@ bool LyXTable::LeftLine(int cell)
return column_info[column_of_cell(cell)].left_line; return column_info[column_of_cell(cell)].left_line;
} }
bool LyXTable::RightLine(int cell) bool LyXTable::RightLine(int cell)
{ {
return column_info[right_column_of_cell(cell)].right_line; return column_info[right_column_of_cell(cell)].right_line;
@ -434,7 +432,7 @@ bool LyXTable::TopAlreadyDrawed(int cell)
bool LyXTable::VeryLastRow(int cell) bool LyXTable::VeryLastRow(int cell)
{ {
return (row_of_cell(cell) == rows-1); return (row_of_cell(cell) == rows - 1);
} }
@ -875,8 +873,9 @@ void LyXTable::Read(FILE * file)
#warning Insert a error message window here that this format is not supported anymore #warning Insert a error message window here that this format is not supported anymore
#endif #endif
if (version < 5) { if (version < 5) {
fprintf(stderr, "Tabular format < 5 is not supported anymore\n" lyxerr << "Tabular format < 5 is not supported anymore\n"
"Get an older version of LyX (< 1.1.x) for conversion!\n"); "Get an older version of LyX (< 1.1.x) for conversion!"
<< endl;
return; return;
} }
a = b = c = d = -1; a = b = c = d = -1;

View File

@ -94,7 +94,7 @@
#include "build.xpm" #include "build.xpm"
// this one is not "C" because combox callbacks are really C++ %-| // this one is not "C" because combox callbacks are really C++ %-|
extern void LayoutsCB(int, void*); extern void LayoutsCB(int, void *);
extern char const ** get_pixmap_from_symbol(char const * arg, int, int); extern char const ** get_pixmap_from_symbol(char const * arg, int, int);
extern LyXAction lyxaction; extern LyXAction lyxaction;
@ -109,7 +109,7 @@ enum _tooltags {
}; };
struct keyword_item toolTags[TO_LAST-1] = { struct keyword_item toolTags[TO_LAST - 1] = {
{ "\\add", TO_ADD }, { "\\add", TO_ADD },
{ "\\end_toolbar", TO_ENDTOOLBAR }, { "\\end_toolbar", TO_ENDTOOLBAR },
{ "\\layouts", TO_LAYOUTS }, { "\\layouts", TO_LAYOUTS },
@ -126,7 +126,7 @@ Toolbar::Toolbar(Toolbar const &rct, LyXView *o, int x, int y)
reset(); reset();
// extracts the toolbar struct form rct. // extracts the toolbar struct form rct.
toolbarItem *tmplist = rct.toollist; toolbarItem * tmplist = rct.toollist;
while (tmplist != 0) { while (tmplist != 0) {
add(tmplist->action); add(tmplist->action);
lyxerr[Debug::TOOLBAR] << "tool action: " lyxerr[Debug::TOOLBAR] << "tool action: "
@ -140,7 +140,7 @@ Toolbar::Toolbar(Toolbar const &rct, LyXView *o, int x, int y)
void Toolbar::BubbleTimerCB(FL_OBJECT *, long data) void Toolbar::BubbleTimerCB(FL_OBJECT *, long data)
{ {
FL_OBJECT * ob = reinterpret_cast<FL_OBJECT*>(data); FL_OBJECT * ob = reinterpret_cast<FL_OBJECT*>(data);
char* help = static_cast<char*>(ob->u_vdata); char * help = static_cast<char*>(ob->u_vdata);
fl_show_oneliner(help, ob->form->x + ob->x, fl_show_oneliner(help, ob->form->x + ob->x,
ob->form->y + ob->y + ob->h); ob->form->y + ob->y + ob->h);
} }
@ -154,7 +154,8 @@ extern "C" void C_Toolbar_BubbleTimerCB(FL_OBJECT * ob, long data)
// post_handler for bubble-help (Matthias) // post_handler for bubble-help (Matthias)
int Toolbar::BubblePost(FL_OBJECT *ob, int event, int Toolbar::BubblePost(FL_OBJECT *ob, int event,
FL_Coord /*mx*/, FL_Coord /*my*/, int /*key*/, void */*xev*/) FL_Coord /*mx*/, FL_Coord /*my*/,
int /*key*/, void */*xev*/)
{ {
string help = static_cast<char *>(ob->u_vdata); string help = static_cast<char *>(ob->u_vdata);
Toolbar * t = reinterpret_cast<Toolbar*>(ob->u_ldata); Toolbar * t = reinterpret_cast<Toolbar*>(ob->u_ldata);
@ -174,8 +175,8 @@ int Toolbar::BubblePost(FL_OBJECT *ob, int event,
extern "C" int C_Toolbar_BubblePost(FL_OBJECT * ob, int event, extern "C" int C_Toolbar_BubblePost(FL_OBJECT * ob, int event,
FL_Coord /*mx*/, FL_Coord /*my*/, FL_Coord /*mx*/, FL_Coord /*my*/,
int key, void * xev) int key, void * xev)
{ {
return Toolbar::BubblePost(ob, event, 0, 0, key, xev); return Toolbar::BubblePost(ob, event, 0, 0, key, xev);
} }
@ -229,9 +230,9 @@ int Toolbar::get_toolbar_func(string const & func)
{ {
int action = lyxaction.LookupFunc(func.c_str()); int action = lyxaction.LookupFunc(func.c_str());
if (action == -1) { if (action == -1) {
if (func == "separator"){ if (func == "separator"){
action = TOOL_SEPARATOR; action = TOOL_SEPARATOR;
} else if (func == "layouts"){ } else if (func == "layouts"){
action = TOOL_LAYOUTS; action = TOOL_LAYOUTS;
} else action = 0; } else action = 0;
} }
@ -286,7 +287,7 @@ void Toolbar::set(bool doingmain)
fl_addto_form(owner->getForm()); fl_addto_form(owner->getForm());
} }
#if FL_REVISION <86 #if FL_REVISION < 86
// Ensure borderwidth is 2 to get visual feedback // Ensure borderwidth is 2 to get visual feedback
int bw = fl_get_border_width(); int bw = fl_get_border_width();
fl_set_border_width(-2); fl_set_border_width(-2);
@ -299,63 +300,63 @@ void Toolbar::set(bool doingmain)
while(item != 0) { while(item != 0) {
switch(item->action){ switch(item->action){
case TOOL_SEPARATOR: case TOOL_SEPARATOR:
xpos += sepspace; xpos += sepspace;
item = item->next; item = item->next;
break; break;
case TOOL_LAYOUTS: case TOOL_LAYOUTS:
xpos += standardspacing; xpos += standardspacing;
if (!combox) if (!combox)
combox = new Combox(FL_COMBOX_DROPLIST); combox = new Combox(FL_COMBOX_DROPLIST);
combox->add(xpos, ypos, 135, height, 300); combox->add(xpos, ypos, 135, height, 300);
combox->setcallback(LayoutsCB); combox->setcallback(LayoutsCB);
combox->resize(FL_RESIZE_ALL); combox->resize(FL_RESIZE_ALL);
combox->gravity(NorthWestGravity, NorthWestGravity); combox->gravity(NorthWestGravity, NorthWestGravity);
item = item->next; item = item->next;
xpos += 135; xpos += 135;
break; break;
default: default:
xpos += standardspacing; xpos += standardspacing;
item->icon = obj = item->icon = obj =
fl_add_pixmapbutton(FL_NORMAL_BUTTON, fl_add_pixmapbutton(FL_NORMAL_BUTTON,
xpos, ypos, xpos, ypos,
buttonwidth, buttonwidth,
height, ""); height, "");
fl_set_object_boxtype(obj, FL_UP_BOX); fl_set_object_boxtype(obj, FL_UP_BOX);
fl_set_object_color(obj, FL_MCOL, FL_BLUE); fl_set_object_color(obj, FL_MCOL, FL_BLUE);
fl_set_object_resize(obj, FL_RESIZE_ALL); fl_set_object_resize(obj, FL_RESIZE_ALL);
fl_set_object_gravity(obj, fl_set_object_gravity(obj,
NorthWestGravity, NorthWestGravity,
NorthWestGravity); NorthWestGravity);
fl_set_object_callback(obj, C_Toolbar_ToolbarCB, fl_set_object_callback(obj, C_Toolbar_ToolbarCB,
static_cast<long>(item->action)); static_cast<long>(item->action));
#if FL_REVISION >85 #if FL_REVISION >85
// Remove the blue feedback rectangle // Remove the blue feedback rectangle
fl_set_pixmapbutton_focus_outline(obj, 0); fl_set_pixmapbutton_focus_outline(obj, 0);
#endif #endif
// set the bubble-help (Matthias) // set the bubble-help (Matthias)
#warning This is dangerous! #warning This is dangerous!
obj->u_vdata = const_cast<char*>(item->help.c_str()); obj->u_vdata = const_cast<char*>(item->help.c_str());
// we need to know what toolbar this item // we need to know what toolbar this item
// belongs too. (Lgb) // belongs too. (Lgb)
obj->u_ldata = reinterpret_cast<long>(this); obj->u_ldata = reinterpret_cast<long>(this);
fl_set_object_posthandler(obj, C_Toolbar_BubblePost); fl_set_object_posthandler(obj, C_Toolbar_BubblePost);
fl_set_pixmapbutton_data(obj, const_cast<char**>(item->pixmap)); fl_set_pixmapbutton_data(obj, const_cast<char**>(item->pixmap));
item = item->next; item = item->next;
// we must remember to update the positions // we must remember to update the positions
xpos += buttonwidth; xpos += buttonwidth;
// ypos is constant // ypos is constant
/* Here will come a check to see if the new /* Here will come a check to see if the new
* pos is within the bounds of the main frame, * pos is within the bounds of the main frame,
* and perhaps wrap the toolbar if not. * and perhaps wrap the toolbar if not.
*/ */
break; break;
} }
} }
#if FL_REVISION <86 #if FL_REVISION < 86
// Reset borderwidth to its default value. // Reset borderwidth to its default value.
fl_set_border_width(bw); fl_set_border_width(bw);
#endif #endif
@ -370,7 +371,7 @@ void Toolbar::set(bool doingmain)
} }
char const **Toolbar::getPixmap(kb_action action, string const & arg) char const ** Toolbar::getPixmap(kb_action action, string const & arg)
{ {
char const ** pixmap = unknown_xpm; //0 char const ** pixmap = unknown_xpm; //0
switch(action){ switch(action){
@ -480,7 +481,8 @@ void Toolbar::add(int action, bool doclean)
if (lyxaction.isPseudoAction(action)) { if (lyxaction.isPseudoAction(action)) {
string arg; string arg;
kb_action act = static_cast<kb_action>(lyxaction.retrieveActionArg(action, arg)); kb_action act = static_cast<kb_action>
(lyxaction.retrieveActionArg(action, arg));
pixmap = getPixmap(act, arg); pixmap = getPixmap(act, arg);
help = lyxaction.helpText(act); help = lyxaction.helpText(act);
help += " "; help += " ";
@ -495,21 +497,21 @@ void Toolbar::add(int action, bool doclean)
if (pixmap != 0 if (pixmap != 0
|| action == TOOL_SEPARATOR || action == TOOL_SEPARATOR
|| action == TOOL_LAYOUTS) || action == TOOL_LAYOUTS)
{ {
newItem = new toolbarItem; newItem = new toolbarItem;
newItem->action = action; newItem->action = action;
newItem->pixmap = pixmap; newItem->pixmap = pixmap;
newItem->help = help; newItem->help = help;
// the new item is placed at the end of the list // the new item is placed at the end of the list
tmp = toollist; tmp = toollist;
if (tmp != 0){ if (tmp != 0){
while(tmp->next != 0) while(tmp->next != 0)
tmp = tmp->next; tmp = tmp->next;
// here is tmp->next == 0 // here is tmp->next == 0
tmp->next = newItem; tmp->next = newItem;
} else } else
toollist = newItem; toollist = newItem;
} }
//if (action == TOOL_LAYOUTS) { //if (action == TOOL_LAYOUTS) {
// combox = new Combox(FL_COMBOX_DROPLIST); // combox = new Combox(FL_COMBOX_DROPLIST);
//} //}
@ -566,7 +568,7 @@ void Toolbar::push(int nth)
int count = 0; int count = 0;
toolbarItem * tmp = toollist; toolbarItem * tmp = toollist;
while (tmp) { while (tmp) {
count++; ++count;
if (count == nth) { if (count == nth) {
fl_trigger_object(tmp->icon); fl_trigger_object(tmp->icon);
return; return;
@ -600,37 +602,37 @@ void Toolbar::read(LyXLex & lex)
<< lex.GetString() << '\'' << endl; << lex.GetString() << '\'' << endl;
switch(lex.lex()) { switch(lex.lex()) {
case TO_ADD: case TO_ADD:
if (lex.EatLine()) { if (lex.EatLine()) {
func = lex.GetString(); func = lex.GetString();
lyxerr[Debug::TOOLBAR] lyxerr[Debug::TOOLBAR]
<< "Toolbar::read TO_ADD func: `" << "Toolbar::read TO_ADD func: `"
<< func << "'" << endl; << func << "'" << endl;
add(func); add(func);
} }
break; break;
case TO_SEPARATOR: case TO_SEPARATOR:
add(TOOL_SEPARATOR); add(TOOL_SEPARATOR);
break; break;
case TO_LAYOUTS: case TO_LAYOUTS:
add(TOOL_LAYOUTS); add(TOOL_LAYOUTS);
break; break;
case TO_NEWLINE: case TO_NEWLINE:
add(TOOL_NEWLINE); add(TOOL_NEWLINE);
break; break;
case TO_ENDTOOLBAR: case TO_ENDTOOLBAR:
// should not set automatically // should not set automatically
//set(); //set();
quit = true; quit = true;
break; break;
default: default:
lex.printError("Toolbar::read: " lex.printError("Toolbar::read: "
"Unknown toolbar tag: `$$Token'"); "Unknown toolbar tag: `$$Token'");
break; break;
} }
} }
lex.popTable(); lex.popTable();

View File

@ -46,9 +46,8 @@ string DefaultTrans::process(char c, TransManager & k)
Trans::Trans() Trans::Trans()
{ {
int i; int i = 0;
for(; i < 256; ++i)
for(i = 0; i < 256; ++i)
keymap_[i] = 0; keymap_[i] = 0;
for(i = 0; i < TEX_MAX_ACCENT + 1; ++i) for(i = 0; i < TEX_MAX_ACCENT + 1; ++i)
@ -81,9 +80,7 @@ void Trans::InsertException(Trans::keyexc & exclist, char c,
void Trans::FreeException(Trans::keyexc & exclist) void Trans::FreeException(Trans::keyexc & exclist)
{ {
Trans::keyexc p; Trans::keyexc p = exclist;
p = exclist;
while (p) { while (p) {
p = exclist->next; p = exclist->next;
delete exclist; delete exclist;
@ -94,9 +91,8 @@ void Trans::FreeException(Trans::keyexc & exclist)
void Trans::FreeKeymap() void Trans::FreeKeymap()
{ {
int i; int i = 0;
for(; i < 256; ++i)
for(i = 0; i < 256; ++i)
if (keymap_[i]) { if (keymap_[i]) {
delete keymap_[i]; delete keymap_[i];
keymap_[i] = 0; keymap_[i] = 0;
@ -131,7 +127,7 @@ enum _kmaptags {
}; };
struct keyword_item kmapTags[K_LAST-1] = { struct keyword_item kmapTags[K_LAST - 1] = {
{"\\kcomb", KCOMB }, {"\\kcomb", KCOMB },
{ "\\kmap", KMAP }, { "\\kmap", KMAP },
{ "\\kmod", KMOD }, { "\\kmod", KMOD },
@ -235,7 +231,8 @@ int Trans::Load(LyXLex & lex)
tex_accent accent_2= getkeymod(str); tex_accent accent_2= getkeymod(str);
if (accent_2 == TEX_NOACCENT) return -1; if (accent_2 == TEX_NOACCENT) return -1;
if (kmod_list_[accent_1] == 0 || kmod_list_[accent_2] == 0) if (kmod_list_[accent_1] == 0
|| kmod_list_[accent_2] == 0)
return -1; return -1;
// Find what key accent_2 is on - should // Find what key accent_2 is on - should
@ -317,7 +314,8 @@ int Trans::Load(LyXLex & lex)
} else } else
return -1; return -1;
InsertException(kmod_list_[accent]->exception_list, key, str); InsertException(kmod_list_[accent]->exception_list,
key, str);
break; break;
} }
case LyXLex::LEX_FEOF: case LyXLex::LEX_FEOF:
@ -352,7 +350,8 @@ string Trans::process(char c, TransManager & k)
if ((t == 0 && (*dt = c)) || (t[0] != 0 && (dt = t)) ){ if ((t == 0 && (*dt = c)) || (t[0] != 0 && (dt = t)) ){
return k.normalkey(c, dt); return k.normalkey(c, dt);
} else { } else {
return k.deadkey(c, *kmod_list_[static_cast<tex_accent>(t[1])]); return k.deadkey(c,
*kmod_list_[static_cast<tex_accent>(t[1])]);
} }
} }
@ -388,7 +387,8 @@ tex_accent getkeymod(string const & p)
<< "].name = `" << lyx_accent_table[i].name << "].name = `" << lyx_accent_table[i].name
<< "'" << endl; << "'" << endl;
if ( lyx_accent_table[i].name && contains(p, lyx_accent_table[i].name)) { if ( lyx_accent_table[i].name
&& contains(p, lyx_accent_table[i].name)) {
lyxerr[Debug::KBMAP] << "Found it!" << endl; lyxerr[Debug::KBMAP] << "Found it!" << endl;
return static_cast<tex_accent>(i); return static_cast<tex_accent>(i);
} }

View File

@ -302,21 +302,26 @@ void TransManager::insertVerbatim(string const & str, LyXText * text)
void TransManager::insert(string str, LyXText * text) void TransManager::insert(string str, LyXText * text)
{ {
// Go through the character encoding only if the current // Go through the character encoding only if the current
// encoding (chset_->name()) matches the current font_norm // encoding (chset_->name()) matches the current font_norm
// (lyrxc->font_norm // (lyrxc->font_norm
if (chset_.getName() != lyxrc->font_norm || // Is false to speak about "only if" the current encoding will
! chset_.encodeString(str)) { // almost always be equal to font_norm.
// Could not find an encoding pair<bool, int> enc = chset_.encodeString(str);
InsetLatexAccent ins(str); if (chset_.getName() != lyxrc->font_norm ||
if (ins.CanDisplay()) { !enc.first) {
text->InsertInset(new InsetLatexAccent(ins)); // Could not find an encoding
return; InsetLatexAccent ins(str);
if (ins.CanDisplay()) {
text->InsertInset(new InsetLatexAccent(ins));
} else {
insertVerbatim(str, text);
}
return;
} }
} string tmp; tmp += static_cast<char>(enc.second);
insertVerbatim(tmp, text);
insertVerbatim(str, text);
} }

View File

@ -26,17 +26,17 @@
#include "support/lstrings.h" #include "support/lstrings.h"
extern LyXRC * lyxrc; extern LyXRC * lyxrc;
extern BufferView *current_view; extern BufferView * current_view;
/* length units /* length units
*/ */
static const int num_units = LyXLength::UNIT_NONE; static const int num_units = LyXLength::UNIT_NONE;
// I am not sure if "mu" should be possible to select (Lgb) // I am not sure if "mu" should be possible to select (Lgb)
static char const * unit_name[num_units] = { "sp", "pt", "bp", "dd", static char const * unit_name[num_units] = { "sp", "pt", "bp", "dd",
"mm", "pc", "cc", "cm", "mm", "pc", "cc", "cm",
"in", "ex", "em", "mu" }; "in", "ex", "em", "mu" };
LyXLength::UNIT unitFromString (string const & data) LyXLength::UNIT unitFromString (string const & data)
@ -121,7 +121,7 @@ static char nextToken (string & data)
static struct { static struct {
char const * pattern; char const * pattern;
int plus_val_index, minus_val_index, int plus_val_index, minus_val_index,
plus_uni_index, minus_uni_index; plus_uni_index, minus_uni_index;
} table[] = { { "nu", 0, 0, 0, 0 }, } table[] = { { "nu", 0, 0, 0, 0 },
{ "nu+nu", 2, 0, 2, 0 }, { "nu+nu", 2, 0, 2, 0 },
{ "nu+nu-nu", 2, 3, 2, 3 }, { "nu+nu-nu", 2, 3, 2, 3 },
@ -202,12 +202,12 @@ bool isValidGlueLength (string const & data, LyXGlueLength * result)
// is zero, the corresponding array value is zero or UNIT_NONE, // is zero, the corresponding array value is zero or UNIT_NONE,
// so we needn't check this. // so we needn't check this.
if (result) { if (result) {
result->val = number[1] * val_sign; result->val = number[1] * val_sign;
result->uni = unit[1]; result->uni = unit[1];
result->plus_val = number[table[table_index].plus_val_index]; result->plus_val = number[table[table_index].plus_val_index];
result->minus_val = number[table[table_index].minus_val_index]; result->minus_val = number[table[table_index].minus_val_index];
result->plus_uni = unit [table[table_index].plus_uni_index]; result->plus_uni = unit [table[table_index].plus_uni_index];
result->minus_uni = unit [table[table_index].minus_uni_index]; result->minus_uni = unit [table[table_index].minus_uni_index];
} }
return true; return true;
} }
@ -258,8 +258,8 @@ bool isValidLength(string const & data, LyXLength * result)
// It _was_ a correct length string. // It _was_ a correct length string.
// Store away the values we found. // Store away the values we found.
if (result) { if (result) {
result->val = number[1]*val_sign; result->val = number[1] * val_sign;
result->uni = unit[1]; result->uni = unit[1];
} }
return true; return true;
} }
@ -473,17 +473,17 @@ string VSpace::asLatexCommand() const
switch (kin) { switch (kin) {
case NONE: return string(); case NONE: return string();
case DEFSKIP: case DEFSKIP:
return current_view->buffer()->params.getDefSkip().asLatexCommand(); return current_view->buffer()->params.getDefSkip().asLatexCommand();
case SMALLSKIP: return kp ? "\\vspace*{\\smallskipamount}" case SMALLSKIP: return kp ? "\\vspace*{\\smallskipamount}"
: "\\smallskip{}"; : "\\smallskip{}";
case MEDSKIP: return kp ? "\\vspace*{\\medskipamount}" case MEDSKIP: return kp ? "\\vspace*{\\medskipamount}"
: "\\medskip{}"; : "\\medskip{}";
case BIGSKIP: return kp ? "\\vspace*{\\bigskipamount}" case BIGSKIP: return kp ? "\\vspace*{\\bigskipamount}"
: "\\bigskip{}"; : "\\bigskip{}";
case VFILL: return kp ? "\\vspace*{\\fill}" case VFILL: return kp ? "\\vspace*{\\fill}"
: "\\vfill{}"; : "\\vfill{}";
case LENGTH: return kp ? "\\vspace*{" + len.asLatexString() + '}' case LENGTH: return kp ? "\\vspace*{" + len.asLatexString() + '}'
: "\\vspace{" + len.asLatexString() + '}'; : "\\vspace{" + len.asLatexString() + '}';
} }
return string(); // should never be reached return string(); // should never be reached
} }
@ -492,11 +492,7 @@ string VSpace::asLatexCommand() const
int VSpace::inPixels() const int VSpace::inPixels() const
{ {
// Height of a normal line in pixels (zoom factor considered) // Height of a normal line in pixels (zoom factor considered)
#ifdef MOVE_TEXT
int height = current_view->text->DefaultHeight(); // [pixels] int height = current_view->text->DefaultHeight(); // [pixels]
#else
int height = current_view->buffer()->text->DefaultHeight(); // [pixels]
#endif
// Zoom factor specified by user in percent // Zoom factor specified by user in percent
float const zoom = lyxrc->zoom / 100.0; // [percent] float const zoom = lyxrc->zoom / 100.0; // [percent]
@ -511,16 +507,16 @@ int VSpace::inPixels() const
case NONE: return 0; case NONE: return 0;
case DEFSKIP: case DEFSKIP:
return current_view->buffer()->params.getDefSkip().inPixels(); return current_view->buffer()->params.getDefSkip().inPixels();
// This is how the skips are normally defined by // This is how the skips are normally defined by
// LateX. But there should be some way to change // LateX. But there should be some way to change
// this per document. // this per document.
case SMALLSKIP: return height/4; case SMALLSKIP: return height/4;
case MEDSKIP: return height/2; case MEDSKIP: return height/2;
case BIGSKIP: return height; case BIGSKIP: return height;
case VFILL: return 3*height; case VFILL: return 3*height;
// leave space for the vfill symbol // leave space for the vfill symbol
case LENGTH: case LENGTH:
// Pixel values are scaled so that the ratio // Pixel values are scaled so that the ratio
// between lengths and font sizes on the screen // between lengths and font sizes on the screen
@ -551,7 +547,7 @@ int VSpace::inPixels() const
case LyXLength::DD: case LyXLength::DD:
// Didot: 1157dd = 1238 pt? // Didot: 1157dd = 1238 pt?
result = zoom * dpi * value result = zoom * dpi * value
/ (72.27/(0.376 * 2.845)); // 67.559735 / (72.27 / (0.376 * 2.845)); // 67.559735
break; break;
case LyXLength::MM: case LyXLength::MM:
// Millimeter: 1 mm = 1/25.4 inch // Millimeter: 1 mm = 1/25.4 inch
@ -561,12 +557,12 @@ int VSpace::inPixels() const
case LyXLength::PC: case LyXLength::PC:
// Pica: 1 pc = 12 pt // Pica: 1 pc = 12 pt
result = zoom * dpi * value result = zoom * dpi * value
/ (72.27/12); // 6.0225 / (72.27 / 12); // 6.0225
break; break;
case LyXLength::CC: case LyXLength::CC:
// Cicero: 1 cc = 12 dd // Cicero: 1 cc = 12 dd
result = zoom * dpi * value result = zoom * dpi * value
/ (72.27/ (12*0.376*2.845)); // 5.6299779 / (72.27 / (12 * 0.376 * 2.845)); // 5.6299779
break; break;
case LyXLength::CM: case LyXLength::CM:
// Centimeter: 1 cm = 1/2.54 inch // Centimeter: 1 cm = 1/2.54 inch
@ -586,7 +582,7 @@ int VSpace::inPixels() const
result = zoom * value * height / 2; // Why 2? result = zoom * value * height / 2; // Why 2?
break; break;
case LyXLength::MU: // This is probably only allowed in case LyXLength::MU: // This is probably only allowed in
// math mode // math mode
result = zoom * value * height; result = zoom * value * height;
break; break;
case LyXLength::UNIT_NONE: case LyXLength::UNIT_NONE: