mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 21:55:29 +00:00
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:
parent
c32b845a53
commit
7c6267e4b1
28
ChangeLog
28
ChangeLog
@ -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>
|
||||
|
||||
* src/buffer.C (writeFile): change once again the top comment in a
|
||||
|
@ -24,8 +24,7 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
|
||||
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
||||
|
||||
### Set the execute permissions of the various scripts correctly
|
||||
for file in config/install-sh config/mkinstalldirs config/hack-gcc \
|
||||
lib/configure ; do
|
||||
for file in config/install-sh config/mkinstalldirs lib/configure ; do
|
||||
chmod 755 ${srcdir}/${file}
|
||||
done
|
||||
|
||||
|
@ -8,103 +8,96 @@
|
||||
|
||||
161 "!`" # mirrored !
|
||||
#162 Cent sign?
|
||||
163 "\\pounds{}" # pound sign
|
||||
163 "\pounds{}" # pound sign
|
||||
#164 String sign?
|
||||
#165 Yen sign?
|
||||
#166 What's this?
|
||||
167 "\\S{}" # paragraph
|
||||
168 "\\\"{}" # umlaut
|
||||
169 "\\copyright{}"
|
||||
170 "\\b{a}" # a macron
|
||||
171 "\\guillemotleft{}"
|
||||
167 "\S{}" # paragraph
|
||||
168 "\"{}" # umlaut
|
||||
169 "\copyright{}"
|
||||
170 "\b{a}" # a macron
|
||||
171 "\guillemotleft{}"
|
||||
#172 What's this?
|
||||
#173 horiz. line?
|
||||
#174 Registered?
|
||||
#175 horiz. line at the top?
|
||||
176 "\\b{}" # circle
|
||||
176 "\b{}" # circle
|
||||
#177 Plusminus?
|
||||
#178 ^2?
|
||||
#179 ^3?
|
||||
180 "\\'{}" # acute
|
||||
181 "$\\mu$" # micro
|
||||
180 "\'{}" # acute
|
||||
181 "$\mu$" # micro
|
||||
#182 Paragraph?
|
||||
183 "$\\cdot$"
|
||||
184 "\\c{}" # cedilla
|
||||
183 "$\cdot$"
|
||||
184 "\c{}" # cedilla
|
||||
185 "${^1}$"
|
||||
186 "\\b{o}" # o macron
|
||||
187 "\\guillemotright{}"
|
||||
188 "\\ensuremath{\frac14}"
|
||||
189 "\\ensuremath{\frac12}"
|
||||
190 "\\ensuremath{\frac34}" # "0BE
|
||||
186 "\b{o}" # o macron
|
||||
187 "\guillemotright{}"
|
||||
188 "\ensuremath{\frac14}"
|
||||
189 "\ensuremath{\frac12}"
|
||||
190 "\ensuremath{\frac34}" # "0BE
|
||||
191 "?`" # mirrored ?
|
||||
192 "\\`{A}"
|
||||
193 "\\'{A}"
|
||||
194 "\\^{A}"
|
||||
195 "\\~{A}"
|
||||
196 "\\\"{A}"
|
||||
197 "\\AA{}" # A with circle
|
||||
198 "\\AE{}" # AE cat'ed together
|
||||
199 "\\c{C}" # C cedilla
|
||||
200 "\\`{E}"
|
||||
201 "\\'{E}"
|
||||
202 "\\^{E}"
|
||||
203 "\\\"{E}"
|
||||
204 "\\`{I}"
|
||||
205 "\\'{I}"
|
||||
206 "\\^{I}"
|
||||
207 "\\\"{I}"
|
||||
208 "\\DH{}"
|
||||
209 "\\~{N}"
|
||||
210 "\\`{O}"
|
||||
211 "\\'{O}"
|
||||
212 "\\^{O}"
|
||||
213 "\\~{O}"
|
||||
214 "\\\"{O}"
|
||||
215 "$\\times$"
|
||||
216 "\\O{}"
|
||||
217 "\\`{U}"
|
||||
218 "\\'{U}"
|
||||
219 "\\^{U}"
|
||||
220 "\\\"{U}"
|
||||
221 "\\'{Y}"
|
||||
222 "\\TH{}"
|
||||
223 "\\ss{}" # German sharp S
|
||||
224 "\\`{a}"
|
||||
225 "\\'{a}"
|
||||
226 "\\^{a}"
|
||||
227 "\\~{a}"
|
||||
228 "\\\"{a}"
|
||||
229 "\\aa{}" # a with circle
|
||||
230 "\\ae{}"
|
||||
231 "\\c{c}" # c cedilla
|
||||
232 "\\`{e}"
|
||||
233 "\\'{e}"
|
||||
234 "\\^{e}"
|
||||
235 "\\\"{e}"
|
||||
236 "\\`{\\i}"
|
||||
237 "\\'{\\i}"
|
||||
238 "\\^{\\i}"
|
||||
239 "\\\"{\\i}"
|
||||
240 "\\dh{}"
|
||||
241 "\\~{n}"
|
||||
242 "\\`{o}"
|
||||
243 "\\'{o}"
|
||||
244 "\\^{o}"
|
||||
245 "\\~{o}"
|
||||
246 "\\\"{o}"
|
||||
247 "$\\div$"
|
||||
248 "\\o{}"
|
||||
249 "\\`{u}"
|
||||
250 "\\'{u}"
|
||||
251 "\\^{u}"
|
||||
252 "\\\"{u}"
|
||||
253 "\\'{y}"
|
||||
254 "\\th{}"
|
||||
255 "\\\"{y}"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
192 "\`{A}"
|
||||
193 "\'{A}"
|
||||
194 "\^{A}"
|
||||
195 "\~{A}"
|
||||
196 "\"{A}"
|
||||
197 "\AA{}" # A with circle
|
||||
198 "\AE{}" # AE cat'ed together
|
||||
199 "\c{C}" # C cedilla
|
||||
200 "\`{E}"
|
||||
201 "\'{E}"
|
||||
202 "\^{E}"
|
||||
203 "\"{E}"
|
||||
204 "\`{I}"
|
||||
205 "\'{I}"
|
||||
206 "\^{I}"
|
||||
207 "\"{I}"
|
||||
208 "\DH{}"
|
||||
209 "\~{N}"
|
||||
210 "\`{O}"
|
||||
211 "\'{O}"
|
||||
212 "\^{O}"
|
||||
213 "\~{O}"
|
||||
214 "\"{O}"
|
||||
215 "$\times$"
|
||||
216 "\O{}"
|
||||
217 "\`{U}"
|
||||
218 "\'{U}"
|
||||
219 "\^{U}"
|
||||
220 "\"{U}"
|
||||
221 "\'{Y}"
|
||||
222 "\TH{}"
|
||||
223 "\ss{}" # German sharp S
|
||||
224 "\`{a}"
|
||||
225 "\'{a}"
|
||||
226 "\^{a}"
|
||||
227 "\~{a}"
|
||||
228 "\"{a}"
|
||||
229 "\aa{}" # a with circle
|
||||
230 "\ae{}"
|
||||
231 "\c{c}" # c cedilla
|
||||
232 "\`{e}"
|
||||
233 "\'{e}"
|
||||
234 "\^{e}"
|
||||
235 "\\"{e}"
|
||||
236 "\`{\i}"
|
||||
237 "\'{\i}"
|
||||
238 "\^{\i}"
|
||||
239 "\"{\i}"
|
||||
240 "\dh{}"
|
||||
241 "\~{n}"
|
||||
242 "\`{o}"
|
||||
243 "\'{o}"
|
||||
244 "\^{o}"
|
||||
245 "\~{o}"
|
||||
246 "\"{o}"
|
||||
247 "$\div$"
|
||||
248 "\o{}"
|
||||
249 "\`{u}"
|
||||
250 "\'{u}"
|
||||
251 "\^{u}"
|
||||
252 "\"{u}"
|
||||
253 "\'{y}"
|
||||
254 "\th{}"
|
||||
255 "\"{y}"
|
||||
|
1156
po/lyx.pot
1156
po/lyx.pot
File diff suppressed because it is too large
Load Diff
949
src/BufferView.C
949
src/BufferView.C
File diff suppressed because it is too large
Load Diff
@ -20,7 +20,6 @@
|
||||
#include "BackStack.h"
|
||||
#include "lyxtext.h"
|
||||
|
||||
#define MOVE_TEXT 1
|
||||
|
||||
class LyXView;
|
||||
class Buffer;
|
||||
@ -48,10 +47,8 @@ public:
|
||||
void fitCursor();
|
||||
///
|
||||
void update();
|
||||
#ifdef MOVE_TEXT
|
||||
///
|
||||
void update(signed char f);
|
||||
#endif
|
||||
///
|
||||
void updateScrollbar();
|
||||
///
|
||||
@ -70,20 +67,18 @@ public:
|
||||
LyXView * owner() const { return owner_; }
|
||||
///
|
||||
LyXScreen * getScreen()
|
||||
{
|
||||
fl_set_timer(timer_cursor, 0.4);
|
||||
return screen;
|
||||
}
|
||||
{
|
||||
fl_set_timer(timer_cursor, 0.4);
|
||||
return screen;
|
||||
}
|
||||
///
|
||||
void savePosition();
|
||||
///
|
||||
void restorePosition();
|
||||
#ifdef MOVE_TEXT
|
||||
/** This holds the mapping between buffer paragraphs and screen rows.
|
||||
This should be private...but not yet. (Lgb)
|
||||
*/
|
||||
LyXText * text;
|
||||
#endif
|
||||
private:
|
||||
/// Update pixmap of screen
|
||||
void updateScreen();
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 1997 Asger Alstrup
|
||||
* Copyright 1997 Asger Alstrup
|
||||
* and the LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
@ -67,32 +67,30 @@ string FontInfo::getFontname(int size)
|
||||
return strings[closestind];
|
||||
}
|
||||
|
||||
|
||||
/// 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
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning rewrite to use std::string constructs
|
||||
#endif
|
||||
int cut = 0, before = 0, after = 0;
|
||||
for (string::size_type i = 0; i < font.length(); ++i) {
|
||||
if (font[i] == '-') {
|
||||
int cut = 0;
|
||||
string::iterator before = 0;
|
||||
string::iterator after = 0;
|
||||
for (string::iterator sit = ret.begin();
|
||||
sit != ret.end(); ++sit)
|
||||
if ((*sit) == '-') {
|
||||
++cut;
|
||||
if (cut == 7) {
|
||||
before = i;
|
||||
} else if (cut == 8) {
|
||||
after = i;
|
||||
if (cut == 7) before = sit + 1;
|
||||
else if (cut == 8) {
|
||||
after = sit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string head = font;
|
||||
head.erase(before + 1, string::npos);
|
||||
string tail = font;
|
||||
tail.erase(0, after);
|
||||
return head + tostr(size) + tail;
|
||||
ret.replace(before, after, tostr(size));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/// Set new pattern
|
||||
void FontInfo::setPattern(string const & pat)
|
||||
{
|
||||
@ -101,6 +99,7 @@ void FontInfo::setPattern(string const & pat)
|
||||
pattern = pat;
|
||||
}
|
||||
|
||||
|
||||
/// Query font in X11
|
||||
void FontInfo::query()
|
||||
{
|
||||
@ -108,7 +107,8 @@ void FontInfo::query()
|
||||
return;
|
||||
|
||||
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;
|
||||
return;
|
||||
}
|
||||
@ -141,6 +141,7 @@ void FontInfo::query()
|
||||
queried = true;
|
||||
}
|
||||
|
||||
|
||||
/// Release allocated stuff
|
||||
void FontInfo::release()
|
||||
{
|
||||
|
615
src/LyXAction.C
615
src/LyXAction.C
@ -19,7 +19,7 @@
|
||||
#include "gettext.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
/*
|
||||
/*
|
||||
NAMING RULES FOR USER-COMMANDS
|
||||
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;
|
||||
|
||||
lfun_item items[] = {
|
||||
{ LFUN_ACUTE, "accent-acute", "", Noop },
|
||||
{ LFUN_BREVE, "accent-breve", "", Noop },
|
||||
{ LFUN_CARON, "accent-caron", "", Noop },
|
||||
{ LFUN_CEDILLA, "accent-cedilla", "", Noop },
|
||||
{ LFUN_CIRCLE, "accent-circle", "", Noop },
|
||||
{ LFUN_CIRCUMFLEX, "accent-circumflex", "", Noop },
|
||||
{ LFUN_DOT, "accent-dot", "", Noop },
|
||||
{ LFUN_GRAVE, "accent-grave", "", Noop },
|
||||
{ LFUN_HUNG_UMLAUT, "accent-hungarian-umlaut", "", Noop },
|
||||
{ LFUN_MACRON, "accent-macron", "", Noop },
|
||||
{ LFUN_OGONEK, "accent-ogonek", "", Noop },
|
||||
{ LFUN_SPECIAL_CARON, "accent-special-caron", "", Noop },
|
||||
{ LFUN_TIE, "accent-tie", "", Noop },
|
||||
{ LFUN_TILDE, "accent-tilde", "", Noop },
|
||||
{ LFUN_UMLAUT, "accent-umlaut", "", Noop },
|
||||
{ LFUN_UNDERBAR, "accent-underbar", "", Noop },
|
||||
{ LFUN_UNDERDOT, "accent-underdot", "", Noop },
|
||||
{ LFUN_VECTOR, "accent-vector", "", Noop },
|
||||
{ LFUN_APPENDIX, "appendix", N_("Insert appendix"), Noop },
|
||||
{ LFUN_APROPOS, "apropos", N_("Describe command"), NoBuffer|ReadOnly },
|
||||
{ LFUN_LEFTSEL, "backward-select",
|
||||
N_("Select previous char"), ReadOnly },
|
||||
{ LFUN_BIBDB_ADD, "bibtex-database-add", "", Noop },
|
||||
{ LFUN_BIBDB_DEL, "bibtex-database-del", "", Noop },
|
||||
{ LFUN_INSERT_BIBTEX, "bibtex-insert", N_("Insert bibtex"), Noop },
|
||||
{ LFUN_BIBTEX_STYLE, "bibtex-style", "", Noop },
|
||||
{ LFUN_BREAKLINE, "break-line", "", Noop },
|
||||
{ LFUN_BREAKPARAGRAPH, "break-paragraph", "", Noop },
|
||||
{ LFUN_BREAKPARAGRAPHKEEPLAYOUT, "break-paragraph-keep-layout",
|
||||
"", Noop },
|
||||
{ LFUN_BREAKPARAGRAPH_SKIP, "break-paragraph-skip", "", Noop },
|
||||
{ LFUN_BUILDPROG, "build-program", _("Build program"), Noop },
|
||||
{ LFUN_AUTOSAVE, "buffer-auto-save", N_("Autosave"), Noop },
|
||||
{ LFUN_BEGINNINGBUF, "buffer-begin",
|
||||
N_("Go to beginning of document"), ReadOnly },
|
||||
{ LFUN_BEGINNINGBUFSEL, "buffer-begin-select",
|
||||
N_("Select to beginning of document"), ReadOnly },
|
||||
{ LFUN_CHILDINSERT, "buffer-child-insert", "", Noop },
|
||||
{ LFUN_CHILDOPEN, "buffer-child-open", "", ReadOnly },
|
||||
{ LFUN_RUNCHKTEX, "buffer-chktex", N_("Check TeX"), ReadOnly },
|
||||
{ LFUN_CLOSEBUFFER, "buffer-close", N_("Close"), ReadOnly },
|
||||
{ LFUN_ENDBUF, "buffer-end",
|
||||
N_("Go to end of document"), ReadOnly },
|
||||
{ LFUN_ENDBUFSEL, "buffer-end-select",
|
||||
N_("Select to end of document"), ReadOnly },
|
||||
{ LFUN_EXPORT, "buffer-export", N_("Export to"), ReadOnly },
|
||||
{ LFUN_FAX, "buffer-fax", N_("Fax"), ReadOnly },
|
||||
{ LFUN_INSERTFOOTNOTE, "buffer-float-insert", "", Noop },
|
||||
{ LFUN_IMPORT, "buffer-import",
|
||||
N_("Import document"), NoBuffer },
|
||||
{ LFUN_BUFFERBULLETSSELECT, "buffer-itemize-bullets-select",
|
||||
"", Noop },
|
||||
{ LFUN_MENUNEW, "buffer-new", N_("New document") , NoBuffer },
|
||||
{ LFUN_MENUNEWTMPLT,"buffer-new-template",
|
||||
N_("New document from template"), NoBuffer },
|
||||
{ LFUN_MENUOPEN, "buffer-open", N_("Open"), NoBuffer },
|
||||
{ LFUN_PREVBUFFER, "buffer-previous",
|
||||
N_("Switch to previous document"), ReadOnly },
|
||||
{ LFUN_MENUPRINT, "buffer-print", N_("Print"), ReadOnly },
|
||||
{ LFUN_MENURELOAD, "buffer-reload",
|
||||
N_("Revert to saved"), ReadOnly },
|
||||
{ LFUN_READ_ONLY_TOGGLE, "buffer-toggle-read-only",
|
||||
N_("Toggle read-only"), ReadOnly },
|
||||
{ LFUN_RUNLATEX, "buffer-typeset", N_("Update DVI"), ReadOnly },
|
||||
{ LFUN_RUNDVIPS, "buffer-typeset-ps",
|
||||
N_("Update PostScript"), ReadOnly },
|
||||
{ LFUN_PREVIEW, "buffer-view", N_("View DVI") , ReadOnly },
|
||||
{ LFUN_PREVIEWPS, "buffer-view-ps",
|
||||
N_("View PostScript") , ReadOnly },
|
||||
{ LFUN_MENUWRITE, "buffer-write", N_("Save"), ReadOnly },
|
||||
{ LFUN_MENUWRITEAS, "buffer-write-as", N_("Save As"), ReadOnly },
|
||||
{ LFUN_CANCEL, "cancel", N_("Cancel"), NoBuffer },
|
||||
{ LFUN_LEFT, "char-backward", N_("Go one char back"), ReadOnly },
|
||||
{ LFUN_RIGHT, "char-forward", N_("Go one char forward"), ReadOnly },
|
||||
{ LFUN_INSERT_CITATION, "citation-insert",
|
||||
N_("Insert citation"), Noop },
|
||||
{ LFUN_EXEC_COMMAND, "command-execute", "", NoBuffer },
|
||||
{ LFUN_PREFIX, "command-prefix",
|
||||
N_("Execute command"), NoBuffer },
|
||||
{ LFUN_SEQUENCE, "command-sequence", "", Noop },
|
||||
{ LFUN_COPY, "copy", N_("Copy"), ReadOnly },
|
||||
{ LFUN_CUT, "cut", N_("Cut"), Noop },
|
||||
{ LFUN_BACKSPACE, "delete-backward", "", Noop },
|
||||
{ LFUN_BACKSPACE_SKIP, "delete-backward-skip", "", Noop },
|
||||
{ LFUN_DELETE, "delete-forward", "", Noop },
|
||||
{ LFUN_DELETE_SKIP, "delete-forward-skip", "", Noop },
|
||||
{ LFUN_DEPTH_MIN, "depth-decrement",
|
||||
N_("Decrement environment depth"), Noop },
|
||||
{ LFUN_DEPTH_PLUS, "depth-increment",
|
||||
N_("Increment environment depth"), Noop },
|
||||
{ LFUN_DEPTH, "depth-next",
|
||||
N_("Change environment depth"), Noop },
|
||||
{ LFUN_LDOTS, "dots-insert", N_("Insert ... dots"), Noop },
|
||||
{ LFUN_DOWN, "down", N_("Go down"), ReadOnly },
|
||||
{ LFUN_DOWNSEL, "down-select",
|
||||
N_("Select next line"), ReadOnly },
|
||||
{ LFUN_DROP_LAYOUTS_CHOICE, "drop-layouts-choice",
|
||||
N_("Choose Paragraph Environment"), ReadOnly },
|
||||
{ LFUN_END_OF_SENTENCE, "end-of-sentence-period-insert",
|
||||
N_("Insert end of sentence period"), Noop },
|
||||
{ LFUN_GOTOERROR, "error-next", N_("Go to next error"), Noop },
|
||||
{ LFUN_REMOVEERRORS, "error-remove-all",
|
||||
N_("Remove all error boxes"), ReadOnly },
|
||||
{ LFUN_FIGURE, "figure-insert", N_("Insert Figure"), Noop },
|
||||
{ LFUN_FILE_INSERT, "file-insert", "", Noop },
|
||||
{ LFUN_FILE_INSERT_ASCII, "file-insert-ascii", "", Noop },
|
||||
{ LFUN_FILE_NEW, "file-new", "", NoBuffer },
|
||||
{ LFUN_FILE_OPEN, "file-open", "", NoBuffer },
|
||||
{ LFUN_MENUSEARCH, "find-replace", N_("Find & Replace") , Noop },
|
||||
{ LFUN_BOLD, "font-bold", N_("Toggle bold"), Noop },
|
||||
{ LFUN_CODE, "font-code", N_("Toggle code style"), Noop },
|
||||
{ LFUN_DEFAULT, "font-default", N_("Default font style"), Noop },
|
||||
{ LFUN_EMPH, "font-emph", N_("Toggle emphasize"), Noop },
|
||||
{ LFUN_FREE, "font-free", N_("Toggle user defined style"), Noop },
|
||||
{ LFUN_NOUN, "font-noun", N_("Toggle noun style"), Noop },
|
||||
{ LFUN_ROMAN, "font-roman", N_("Toggle roman font style"), Noop },
|
||||
{ LFUN_SANS, "font-sans", N_("Toggle sans font style"), Noop },
|
||||
{ LFUN_FONT_SIZE, "font-size", N_("Set font size"), Noop },
|
||||
{ LFUN_FONT_STATE, "font-state", N_("Show font state"), ReadOnly },
|
||||
{ LFUN_UNDERLINE, "font-underline",
|
||||
N_("Toggle font underline"), Noop },
|
||||
{ LFUN_FOOTMELT, "footnote-insert", N_("Insert Footnote"), Noop },
|
||||
{ LFUN_RIGHTSEL, "forward-select", N_("Select next char"), ReadOnly },
|
||||
{ LFUN_HFILL, "hfill-insert",
|
||||
N_("Insert horizontal fill"), Noop },
|
||||
{ LFUN_HTMLURL, "html-insert", "", Noop },
|
||||
{ LFUN_HYPHENATION, "hyphenation-point-insert",
|
||||
N_("Insert hyphenation point"), Noop },
|
||||
{ LFUN_INDEX_INSERT, "index-insert",
|
||||
N_("Insert index item"), Noop },
|
||||
{ LFUN_INDEX_INSERT_LAST, "index-insert-last",
|
||||
N_("Insert last index item"), Noop },
|
||||
{ LFUN_INDEX_PRINT, "index-print", N_("Insert index list"), Noop },
|
||||
{ LFUN_KMAP_OFF, "keymap-off", N_("Turn off keymap"), ReadOnly },
|
||||
{ LFUN_KMAP_PRIM, "keymap-primary",
|
||||
N_("Use primary keymap"), ReadOnly },
|
||||
{ LFUN_KMAP_SEC, "keymap-secondary",
|
||||
N_("Use secondary keymap"), ReadOnly },
|
||||
{ LFUN_KMAP_TOGGLE, "keymap-toggle", N_("Toggle keymap"), ReadOnly },
|
||||
{ LFUN_INSERT_LABEL, "label-insert", N_("Insert Label"), Noop },
|
||||
{ LFUN_LATEX_LOG, "latex-view-log", N_("View LaTeX log"), ReadOnly },
|
||||
{ LFUN_LAYOUT, "layout", "", Noop },
|
||||
{ LFUN_LAYOUT_CHARACTER, "layout-character", "", Noop },
|
||||
{ LFUN_LAYOUT_COPY, "layout-copy",
|
||||
N_("Copy paragraph environment type"), Noop },
|
||||
{ LFUN_LAYOUT_DOCUMENT, "layout-document", "", ReadOnly },
|
||||
{ LFUN_LAYOUTNO, "layout-number", "", Noop }, // internal only
|
||||
{ LFUN_LAYOUT_PARAGRAPH, "layout-paragraph", "", ReadOnly },
|
||||
{ LFUN_LAYOUT_PAPER, "layout-paper", "", ReadOnly },
|
||||
{ LFUN_LAYOUT_PASTE, "layout-paste",
|
||||
N_("Paste paragraph environment type"), Noop },
|
||||
{ LFUN_LAYOUT_PREAMBLE, "layout-preamble", "", ReadOnly },
|
||||
{ LFUN_LAYOUT_QUOTES, "layout-quotes", "", ReadOnly },
|
||||
{ LFUN_LAYOUT_SAVE_DEFAULT, "layout-save-default", "", ReadOnly },
|
||||
{ LFUN_LAYOUT_TABLE, "layout-table", "", Noop },
|
||||
{ LFUN_HOME, "line-begin",
|
||||
N_("Go to beginning of line"), ReadOnly },
|
||||
{ LFUN_HOMESEL, "line-begin-select",
|
||||
N_("Select to beginning of line"), ReadOnly },
|
||||
{ LFUN_DELETE_LINE_FORWARD, "line-delete-forward", "", Noop },
|
||||
{ LFUN_END, "line-end", N_("Go to end of line"), ReadOnly },
|
||||
{ LFUN_ENDSEL, "line-end-select",
|
||||
N_("Select to end of line"), ReadOnly },
|
||||
{ LFUN_LOA_INSERT, "loa-insert",
|
||||
N_("Insert list of algorithms"), Noop },
|
||||
{ LFUN_LOF_INSERT, "lof-insert",
|
||||
N_("Insert list of figures"), Noop },
|
||||
{ LFUN_LOT_INSERT, "lot-insert",
|
||||
N_("Insert list of tables"), Noop },
|
||||
{ LFUN_QUIT, "lyx-quit", N_("Exit"), NoBuffer },
|
||||
{ LFUN_MARGINMELT, "marginpar-insert",
|
||||
N_("Insert Margin note"), Noop },
|
||||
{ LFUN_MARK_OFF, "mark-off", "", ReadOnly },
|
||||
{ LFUN_MARK_ON, "mark-on", "", ReadOnly },
|
||||
{ LFUN_SETMARK, "mark-toggle", "", ReadOnly },
|
||||
{ LFUN_MATH_DELIM, "math-delim", "", Noop },
|
||||
{ LFUN_MATH_DISPLAY, "math-display", "", Noop },
|
||||
{ LFUN_GREEK, "math-greek", N_("Math Greek"), Noop },
|
||||
{ LFUN_GREEK_TOGGLE, "math-greek-toggle", "", Noop },
|
||||
{ LFUN_INSERT_MATH, "math-insert",
|
||||
N_("Insert math symbol"), Noop },
|
||||
{ LFUN_MATH_LIMITS, "math-limits", "", Noop },
|
||||
{ LFUN_MATH_MACRO, "math-macro", "", Noop },
|
||||
{ LFUN_MATH_MACROARG, "math-macro-arg", "", Noop },
|
||||
{ LFUN_INSERT_MATRIX, "math-matrix", "", Noop },
|
||||
{ LFUN_MATH_MODE, "math-mode", N_("Math mode"), Noop },
|
||||
{ LFUN_MATH_NONUMBER, "math-nonumber", "", Noop },
|
||||
{ LFUN_MATH_NUMBER, "math-number", "", Noop },
|
||||
{ LFUN_MATH_SIZE, "math-size", "", Noop },
|
||||
{ LFUN_MELT, "melt", N_("Melt"), Noop },
|
||||
{ LFUN_MENU_OPEN_BY_NAME, "menu-open", "", NoBuffer },
|
||||
{ LFUN_MENU_SEPARATOR, "menu-separator-insert", "", Noop },
|
||||
{ LFUN_META_FAKE, "meta-prefix", "", NoBuffer },
|
||||
{ LFUN_INSERT_NOTE, "note-insert", "", Noop },
|
||||
{ LFUN_GOTONOTE, "note-next", "", ReadOnly },
|
||||
{ LFUN_OPENSTUFF, "open-stuff", "", ReadOnly },
|
||||
{ LFUN_DOWN_PARAGRAPH, "paragraph-down",
|
||||
N_("Go one paragraph down"), ReadOnly },
|
||||
{ LFUN_DOWN_PARAGRAPHSEL, "paragraph-down-select",
|
||||
N_("Select next paragraph"), ReadOnly },
|
||||
{ LFUN_UP_PARAGRAPH, "paragraph-up",
|
||||
N_("Go one paragraph up"), ReadOnly },
|
||||
{ LFUN_UP_PARAGRAPHSEL, "paragraph-up-select",
|
||||
N_("Select previous paragraph"), ReadOnly },
|
||||
{ LFUN_PARENTINSERT, "parent-insert", "", Noop },
|
||||
{ LFUN_PASTE, "paste", N_("Paste") , Noop },
|
||||
{ LFUN_SAVEPREFERENCES, "preferences-save",
|
||||
"Save Preferences", NoBuffer },
|
||||
{ LFUN_PASTESELECTION, "primary-selection-paste", "", Noop },
|
||||
{ LFUN_PROTECTEDSPACE, "protected-space-insert",
|
||||
N_("Insert protected space"), Noop },
|
||||
{ LFUN_QUOTE, "quote-insert", N_("Insert quote"), Noop },
|
||||
{ LFUN_RECONFIGURE, "reconfigure",
|
||||
N_("Reconfigure"), NoBuffer },
|
||||
{ LFUN_REDO, "redo", N_("Redo"), Noop },
|
||||
{ LFUN_REFBACK, "reference-back", "", ReadOnly },
|
||||
{ LFUN_REFGOTO, "reference-goto", "", ReadOnly },
|
||||
{ LFUN_INSERT_REF, "reference-insert",
|
||||
N_("Insert cross reference"), Noop },
|
||||
{ LFUN_REFTOGGLE, "reference-toggle", "", Noop },
|
||||
{ LFUN_NEXT, "screen-down", "", ReadOnly },
|
||||
{ LFUN_NEXTSEL, "screen-down-select", "", ReadOnly },
|
||||
{ LFUN_CENTER, "screen-recenter", "", ReadOnly },
|
||||
{ LFUN_PRIOR, "screen-up", "", ReadOnly },
|
||||
{ LFUN_PRIORSEL, "screen-up-select", "", ReadOnly },
|
||||
{ LFUN_SELFINSERT, "self-insert", "", Noop },
|
||||
{ LFUN_CHARATCURSOR, "server-char-after", "", ReadOnly },
|
||||
{ LFUN_GETFONT, "server-get-font", "", ReadOnly },
|
||||
{ LFUN_GETLATEX, "server-get-latex", "", ReadOnly },
|
||||
{ LFUN_GETLAYOUT, "server-get-layout", "", ReadOnly },
|
||||
{ LFUN_GETNAME, "server-get-name", "", ReadOnly },
|
||||
{ LFUN_GETTIP, "server-get-tip", "", ReadOnly },
|
||||
{ LFUN_GETXY, "server-get-xy", "", ReadOnly },
|
||||
{ LFUN_GOTOFILEROW, "server-goto-file-row", "", Noop },
|
||||
{ LFUN_NOTIFY, "server-notify", "", ReadOnly },
|
||||
{ LFUN_SETXY, "server-set-xy", "", ReadOnly },
|
||||
{ LFUN_SPELLCHECK, "spellchecker", "", Noop },
|
||||
{ LFUN_INSERT_MATH, "symbol-insert", "", Noop },
|
||||
{ LFUN_TAB, "tab-forward", "", Noop },
|
||||
{ LFUN_TABINSERT, "tab-insert", "", Noop },
|
||||
{ LFUN_TABLE, "table-insert", N_("Insert Table"), Noop },
|
||||
{ LFUN_TEX, "tex-mode", N_("Toggle TeX style"), Noop },
|
||||
{ LFUN_TOC_INSERT, "toc-insert",
|
||||
N_("Insert table of contents"), Noop },
|
||||
{ LFUN_TOCVIEW, "toc-view",
|
||||
N_("View table of contents"), ReadOnly },
|
||||
{ LFUN_TOGGLECURSORFOLLOW, "toggle-cursor-follows-scrollbar",
|
||||
N_("Toggle cursor does/doesn't follow the scrollbar"),
|
||||
ReadOnly },
|
||||
{ LFUN_ADD_TO_TOOLBAR, "toolbar-add-to", "", NoBuffer },
|
||||
{ LFUN_PUSH_TOOLBAR, "toolbar-push", "", NoBuffer },
|
||||
{ LFUN_UNDO, "undo", N_("Undo"), Noop },
|
||||
{ LFUN_UP, "up", "", ReadOnly },
|
||||
{ LFUN_UPSEL, "up-select", "", ReadOnly },
|
||||
{ LFUN_URL, "url-insert", "", 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 }
|
||||
{ LFUN_ACUTE, "accent-acute", "", Noop },
|
||||
{ LFUN_BREVE, "accent-breve", "", Noop },
|
||||
{ LFUN_CARON, "accent-caron", "", Noop },
|
||||
{ LFUN_CEDILLA, "accent-cedilla", "", Noop },
|
||||
{ LFUN_CIRCLE, "accent-circle", "", Noop },
|
||||
{ LFUN_CIRCUMFLEX, "accent-circumflex", "", Noop },
|
||||
{ LFUN_DOT, "accent-dot", "", Noop },
|
||||
{ LFUN_GRAVE, "accent-grave", "", Noop },
|
||||
{ LFUN_HUNG_UMLAUT, "accent-hungarian-umlaut", "", Noop },
|
||||
{ LFUN_MACRON, "accent-macron", "", Noop },
|
||||
{ LFUN_OGONEK, "accent-ogonek", "", Noop },
|
||||
{ LFUN_SPECIAL_CARON, "accent-special-caron", "", Noop },
|
||||
{ LFUN_TIE, "accent-tie", "", Noop },
|
||||
{ LFUN_TILDE, "accent-tilde", "", Noop },
|
||||
{ LFUN_UMLAUT, "accent-umlaut", "", Noop },
|
||||
{ LFUN_UNDERBAR, "accent-underbar", "", Noop },
|
||||
{ LFUN_UNDERDOT, "accent-underdot", "", Noop },
|
||||
{ LFUN_VECTOR, "accent-vector", "", Noop },
|
||||
{ LFUN_APPENDIX, "appendix", N_("Insert appendix"), Noop },
|
||||
{ LFUN_APROPOS, "apropos", N_("Describe command"),
|
||||
NoBuffer|ReadOnly },
|
||||
{ LFUN_LEFTSEL, "backward-select",
|
||||
N_("Select previous char"), ReadOnly },
|
||||
{ LFUN_BIBDB_ADD, "bibtex-database-add", "", Noop },
|
||||
{ LFUN_BIBDB_DEL, "bibtex-database-del", "", Noop },
|
||||
{ LFUN_INSERT_BIBTEX, "bibtex-insert", N_("Insert bibtex"),
|
||||
Noop },
|
||||
{ LFUN_BIBTEX_STYLE, "bibtex-style", "", Noop },
|
||||
{ LFUN_BREAKLINE, "break-line", "", Noop },
|
||||
{ LFUN_BREAKPARAGRAPH, "break-paragraph", "", Noop },
|
||||
{ LFUN_BREAKPARAGRAPHKEEPLAYOUT, "break-paragraph-keep-layout",
|
||||
"", Noop },
|
||||
{ LFUN_BREAKPARAGRAPH_SKIP, "break-paragraph-skip", "", Noop },
|
||||
{ LFUN_BUILDPROG, "build-program", _("Build program"), Noop },
|
||||
{ LFUN_AUTOSAVE, "buffer-auto-save", N_("Autosave"), Noop },
|
||||
{ LFUN_BEGINNINGBUF, "buffer-begin",
|
||||
N_("Go to beginning of document"), ReadOnly },
|
||||
{ LFUN_BEGINNINGBUFSEL, "buffer-begin-select",
|
||||
N_("Select to beginning of document"), ReadOnly },
|
||||
{ LFUN_CHILDINSERT, "buffer-child-insert", "", Noop },
|
||||
{ LFUN_CHILDOPEN, "buffer-child-open", "", ReadOnly },
|
||||
{ LFUN_RUNCHKTEX, "buffer-chktex", N_("Check TeX"), ReadOnly },
|
||||
{ LFUN_CLOSEBUFFER, "buffer-close", N_("Close"), ReadOnly },
|
||||
{ LFUN_ENDBUF, "buffer-end",
|
||||
N_("Go to end of document"), ReadOnly },
|
||||
{ LFUN_ENDBUFSEL, "buffer-end-select",
|
||||
N_("Select to end of document"), ReadOnly },
|
||||
{ LFUN_EXPORT, "buffer-export", N_("Export to"), ReadOnly },
|
||||
{ LFUN_FAX, "buffer-fax", N_("Fax"), ReadOnly },
|
||||
{ LFUN_INSERTFOOTNOTE, "buffer-float-insert", "", Noop },
|
||||
{ LFUN_IMPORT, "buffer-import",
|
||||
N_("Import document"), NoBuffer },
|
||||
{ LFUN_BUFFERBULLETSSELECT, "buffer-itemize-bullets-select",
|
||||
"", Noop },
|
||||
{ LFUN_MENUNEW, "buffer-new", N_("New document") , NoBuffer },
|
||||
{ LFUN_MENUNEWTMPLT,"buffer-new-template",
|
||||
N_("New document from template"), NoBuffer },
|
||||
{ LFUN_MENUOPEN, "buffer-open", N_("Open"), NoBuffer },
|
||||
{ LFUN_PREVBUFFER, "buffer-previous",
|
||||
N_("Switch to previous document"), ReadOnly },
|
||||
{ LFUN_MENUPRINT, "buffer-print", N_("Print"), ReadOnly },
|
||||
{ LFUN_MENURELOAD, "buffer-reload",
|
||||
N_("Revert to saved"), ReadOnly },
|
||||
{ LFUN_READ_ONLY_TOGGLE, "buffer-toggle-read-only",
|
||||
N_("Toggle read-only"), ReadOnly },
|
||||
{ LFUN_RUNLATEX, "buffer-typeset", N_("Update DVI"),
|
||||
ReadOnly },
|
||||
{ LFUN_RUNDVIPS, "buffer-typeset-ps",
|
||||
N_("Update PostScript"), ReadOnly },
|
||||
{ LFUN_PREVIEW, "buffer-view", N_("View DVI") , ReadOnly },
|
||||
{ LFUN_PREVIEWPS, "buffer-view-ps",
|
||||
N_("View PostScript") , ReadOnly },
|
||||
{ LFUN_MENUWRITE, "buffer-write", N_("Save"), ReadOnly },
|
||||
{ LFUN_MENUWRITEAS, "buffer-write-as", N_("Save As"),
|
||||
ReadOnly },
|
||||
{ LFUN_CANCEL, "cancel", N_("Cancel"), NoBuffer },
|
||||
{ LFUN_LEFT, "char-backward", N_("Go one char back"),
|
||||
ReadOnly },
|
||||
{ LFUN_RIGHT, "char-forward", N_("Go one char forward"),
|
||||
ReadOnly },
|
||||
{ LFUN_INSERT_CITATION, "citation-insert",
|
||||
N_("Insert citation"), Noop },
|
||||
{ LFUN_EXEC_COMMAND, "command-execute", "", NoBuffer },
|
||||
{ LFUN_PREFIX, "command-prefix",
|
||||
N_("Execute command"), NoBuffer },
|
||||
{ LFUN_SEQUENCE, "command-sequence", "", Noop },
|
||||
{ LFUN_COPY, "copy", N_("Copy"), ReadOnly },
|
||||
{ LFUN_CUT, "cut", N_("Cut"), Noop },
|
||||
{ LFUN_BACKSPACE, "delete-backward", "", Noop },
|
||||
{ LFUN_BACKSPACE_SKIP, "delete-backward-skip", "", Noop },
|
||||
{ LFUN_DELETE, "delete-forward", "", Noop },
|
||||
{ LFUN_DELETE_SKIP, "delete-forward-skip", "", Noop },
|
||||
{ LFUN_DEPTH_MIN, "depth-decrement",
|
||||
N_("Decrement environment depth"), Noop },
|
||||
{ LFUN_DEPTH_PLUS, "depth-increment",
|
||||
N_("Increment environment depth"), Noop },
|
||||
{ LFUN_DEPTH, "depth-next",
|
||||
N_("Change environment depth"), Noop },
|
||||
{ LFUN_LDOTS, "dots-insert", N_("Insert ... dots"), Noop },
|
||||
{ LFUN_DOWN, "down", N_("Go down"), ReadOnly },
|
||||
{ LFUN_DOWNSEL, "down-select",
|
||||
N_("Select next line"), ReadOnly },
|
||||
{ LFUN_DROP_LAYOUTS_CHOICE, "drop-layouts-choice",
|
||||
N_("Choose Paragraph Environment"), ReadOnly },
|
||||
{ LFUN_END_OF_SENTENCE, "end-of-sentence-period-insert",
|
||||
N_("Insert end of sentence period"), Noop },
|
||||
{ LFUN_GOTOERROR, "error-next", N_("Go to next error"), Noop },
|
||||
{ LFUN_REMOVEERRORS, "error-remove-all",
|
||||
N_("Remove all error boxes"), ReadOnly },
|
||||
{ LFUN_FIGURE, "figure-insert", N_("Insert Figure"), Noop },
|
||||
{ LFUN_FILE_INSERT, "file-insert", "", Noop },
|
||||
{ LFUN_FILE_INSERT_ASCII, "file-insert-ascii", "", Noop },
|
||||
{ LFUN_FILE_NEW, "file-new", "", NoBuffer },
|
||||
{ LFUN_FILE_OPEN, "file-open", "", NoBuffer },
|
||||
{ LFUN_MENUSEARCH, "find-replace", N_("Find & Replace"),
|
||||
Noop },
|
||||
{ LFUN_BOLD, "font-bold", N_("Toggle bold"), Noop },
|
||||
{ LFUN_CODE, "font-code", N_("Toggle code style"), Noop },
|
||||
{ LFUN_DEFAULT, "font-default", N_("Default font style"),
|
||||
Noop },
|
||||
{ LFUN_EMPH, "font-emph", N_("Toggle emphasize"), Noop },
|
||||
{ LFUN_FREE, "font-free", N_("Toggle user defined style"),
|
||||
Noop },
|
||||
{ LFUN_NOUN, "font-noun", N_("Toggle noun style"), Noop },
|
||||
{ LFUN_ROMAN, "font-roman", N_("Toggle roman font style"),
|
||||
Noop },
|
||||
{ LFUN_SANS, "font-sans", N_("Toggle sans font style"), Noop },
|
||||
{ LFUN_FONT_SIZE, "font-size", N_("Set font size"), Noop },
|
||||
{ LFUN_FONT_STATE, "font-state", N_("Show font state"),
|
||||
ReadOnly },
|
||||
{ LFUN_UNDERLINE, "font-underline",
|
||||
N_("Toggle font underline"), Noop },
|
||||
{ LFUN_FOOTMELT, "footnote-insert", N_("Insert Footnote"),
|
||||
Noop },
|
||||
{ LFUN_RIGHTSEL, "forward-select", N_("Select next char"),
|
||||
ReadOnly },
|
||||
{ LFUN_HFILL, "hfill-insert",
|
||||
N_("Insert horizontal fill"), Noop },
|
||||
{ LFUN_HTMLURL, "html-insert", "", Noop },
|
||||
{ LFUN_HYPHENATION, "hyphenation-point-insert",
|
||||
N_("Insert hyphenation point"), Noop },
|
||||
{ LFUN_INDEX_INSERT, "index-insert",
|
||||
N_("Insert index item"), Noop },
|
||||
{ LFUN_INDEX_INSERT_LAST, "index-insert-last",
|
||||
N_("Insert last index item"), Noop },
|
||||
{ LFUN_INDEX_PRINT, "index-print", N_("Insert index list"),
|
||||
Noop },
|
||||
{ LFUN_KMAP_OFF, "keymap-off", N_("Turn off keymap"),
|
||||
ReadOnly },
|
||||
{ LFUN_KMAP_PRIM, "keymap-primary",
|
||||
N_("Use primary keymap"), ReadOnly },
|
||||
{ LFUN_KMAP_SEC, "keymap-secondary",
|
||||
N_("Use secondary keymap"), ReadOnly },
|
||||
{ LFUN_KMAP_TOGGLE, "keymap-toggle", N_("Toggle keymap"),
|
||||
ReadOnly },
|
||||
{ LFUN_INSERT_LABEL, "label-insert", N_("Insert Label"),
|
||||
Noop },
|
||||
{ LFUN_LATEX_LOG, "latex-view-log", N_("View LaTeX log"),
|
||||
ReadOnly },
|
||||
{ LFUN_LAYOUT, "layout", "", Noop },
|
||||
{ LFUN_LAYOUT_CHARACTER, "layout-character", "", Noop },
|
||||
{ LFUN_LAYOUT_COPY, "layout-copy",
|
||||
N_("Copy paragraph environment type"), Noop },
|
||||
{ LFUN_LAYOUT_DOCUMENT, "layout-document", "", ReadOnly },
|
||||
{ LFUN_LAYOUTNO, "layout-number", "", Noop }, // internal only
|
||||
{ LFUN_LAYOUT_PARAGRAPH, "layout-paragraph", "", ReadOnly },
|
||||
{ LFUN_LAYOUT_PAPER, "layout-paper", "", ReadOnly },
|
||||
{ LFUN_LAYOUT_PASTE, "layout-paste",
|
||||
N_("Paste paragraph environment type"), Noop },
|
||||
{ LFUN_LAYOUT_PREAMBLE, "layout-preamble", "", ReadOnly },
|
||||
{ LFUN_LAYOUT_QUOTES, "layout-quotes", "", ReadOnly },
|
||||
{ LFUN_LAYOUT_SAVE_DEFAULT, "layout-save-default", "",
|
||||
ReadOnly },
|
||||
{ LFUN_LAYOUT_TABLE, "layout-table", "", Noop },
|
||||
{ LFUN_HOME, "line-begin",
|
||||
N_("Go to beginning of line"), ReadOnly },
|
||||
{ LFUN_HOMESEL, "line-begin-select",
|
||||
N_("Select to beginning of line"), ReadOnly },
|
||||
{ LFUN_DELETE_LINE_FORWARD, "line-delete-forward", "", Noop },
|
||||
{ LFUN_END, "line-end", N_("Go to end of line"), ReadOnly },
|
||||
{ LFUN_ENDSEL, "line-end-select",
|
||||
N_("Select to end of line"), ReadOnly },
|
||||
{ LFUN_LOA_INSERT, "loa-insert",
|
||||
N_("Insert list of algorithms"), Noop },
|
||||
{ LFUN_LOF_INSERT, "lof-insert",
|
||||
N_("Insert list of figures"), Noop },
|
||||
{ LFUN_LOT_INSERT, "lot-insert",
|
||||
N_("Insert list of tables"), Noop },
|
||||
{ LFUN_QUIT, "lyx-quit", N_("Exit"), NoBuffer },
|
||||
{ LFUN_MARGINMELT, "marginpar-insert",
|
||||
N_("Insert Margin note"), Noop },
|
||||
{ LFUN_MARK_OFF, "mark-off", "", ReadOnly },
|
||||
{ LFUN_MARK_ON, "mark-on", "", ReadOnly },
|
||||
{ LFUN_SETMARK, "mark-toggle", "", ReadOnly },
|
||||
{ LFUN_MATH_DELIM, "math-delim", "", Noop },
|
||||
{ LFUN_MATH_DISPLAY, "math-display", "", Noop },
|
||||
{ LFUN_GREEK, "math-greek", N_("Math Greek"), Noop },
|
||||
{ LFUN_GREEK_TOGGLE, "math-greek-toggle", "", Noop },
|
||||
{ LFUN_INSERT_MATH, "math-insert",
|
||||
N_("Insert math symbol"), Noop },
|
||||
{ LFUN_MATH_LIMITS, "math-limits", "", Noop },
|
||||
{ LFUN_MATH_MACRO, "math-macro", "", Noop },
|
||||
{ LFUN_MATH_MACROARG, "math-macro-arg", "", Noop },
|
||||
{ LFUN_INSERT_MATRIX, "math-matrix", "", Noop },
|
||||
{ LFUN_MATH_MODE, "math-mode", N_("Math mode"), Noop },
|
||||
{ LFUN_MATH_NONUMBER, "math-nonumber", "", Noop },
|
||||
{ LFUN_MATH_NUMBER, "math-number", "", Noop },
|
||||
{ LFUN_MATH_SIZE, "math-size", "", Noop },
|
||||
{ LFUN_MELT, "melt", N_("Melt"), Noop },
|
||||
{ LFUN_MENU_OPEN_BY_NAME, "menu-open", "", NoBuffer },
|
||||
{ LFUN_MENU_SEPARATOR, "menu-separator-insert", "", Noop },
|
||||
{ LFUN_META_FAKE, "meta-prefix", "", NoBuffer },
|
||||
{ LFUN_INSERT_NOTE, "note-insert", "", Noop },
|
||||
{ LFUN_GOTONOTE, "note-next", "", ReadOnly },
|
||||
{ LFUN_OPENSTUFF, "open-stuff", "", ReadOnly },
|
||||
{ LFUN_DOWN_PARAGRAPH, "paragraph-down",
|
||||
N_("Go one paragraph down"), ReadOnly },
|
||||
{ LFUN_DOWN_PARAGRAPHSEL, "paragraph-down-select",
|
||||
N_("Select next paragraph"), ReadOnly },
|
||||
{ LFUN_UP_PARAGRAPH, "paragraph-up",
|
||||
N_("Go one paragraph up"), ReadOnly },
|
||||
{ LFUN_UP_PARAGRAPHSEL, "paragraph-up-select",
|
||||
N_("Select previous paragraph"), ReadOnly },
|
||||
{ LFUN_PARENTINSERT, "parent-insert", "", Noop },
|
||||
{ LFUN_PASTE, "paste", N_("Paste") , Noop },
|
||||
{ LFUN_SAVEPREFERENCES, "preferences-save",
|
||||
"Save Preferences", NoBuffer },
|
||||
{ LFUN_PASTESELECTION, "primary-selection-paste", "", Noop },
|
||||
{ LFUN_PROTECTEDSPACE, "protected-space-insert",
|
||||
N_("Insert protected space"), Noop },
|
||||
{ LFUN_QUOTE, "quote-insert", N_("Insert quote"), Noop },
|
||||
{ LFUN_RECONFIGURE, "reconfigure",
|
||||
N_("Reconfigure"), NoBuffer },
|
||||
{ LFUN_REDO, "redo", N_("Redo"), Noop },
|
||||
{ LFUN_REFBACK, "reference-back", "", ReadOnly },
|
||||
{ LFUN_REFGOTO, "reference-goto", "", ReadOnly },
|
||||
{ LFUN_INSERT_REF, "reference-insert",
|
||||
N_("Insert cross reference"), Noop },
|
||||
{ LFUN_REFTOGGLE, "reference-toggle", "", Noop },
|
||||
{ LFUN_NEXT, "screen-down", "", ReadOnly },
|
||||
{ LFUN_NEXTSEL, "screen-down-select", "", ReadOnly },
|
||||
{ LFUN_CENTER, "screen-recenter", "", ReadOnly },
|
||||
{ LFUN_PRIOR, "screen-up", "", ReadOnly },
|
||||
{ LFUN_PRIORSEL, "screen-up-select", "", ReadOnly },
|
||||
{ LFUN_SELFINSERT, "self-insert", "", Noop },
|
||||
{ LFUN_CHARATCURSOR, "server-char-after", "", ReadOnly },
|
||||
{ LFUN_GETFONT, "server-get-font", "", ReadOnly },
|
||||
{ LFUN_GETLATEX, "server-get-latex", "", ReadOnly },
|
||||
{ LFUN_GETLAYOUT, "server-get-layout", "", ReadOnly },
|
||||
{ LFUN_GETNAME, "server-get-name", "", ReadOnly },
|
||||
{ LFUN_GETTIP, "server-get-tip", "", ReadOnly },
|
||||
{ LFUN_GETXY, "server-get-xy", "", ReadOnly },
|
||||
{ LFUN_GOTOFILEROW, "server-goto-file-row", "", Noop },
|
||||
{ LFUN_NOTIFY, "server-notify", "", ReadOnly },
|
||||
{ LFUN_SETXY, "server-set-xy", "", ReadOnly },
|
||||
{ LFUN_SPELLCHECK, "spellchecker", "", Noop },
|
||||
{ LFUN_INSERT_MATH, "symbol-insert", "", Noop },
|
||||
{ LFUN_TAB, "tab-forward", "", Noop },
|
||||
{ LFUN_TABINSERT, "tab-insert", "", Noop },
|
||||
{ LFUN_TABLE, "table-insert", N_("Insert Table"), Noop },
|
||||
{ LFUN_TEX, "tex-mode", N_("Toggle TeX style"), Noop },
|
||||
{ LFUN_TOC_INSERT, "toc-insert",
|
||||
N_("Insert table of contents"), Noop },
|
||||
{ LFUN_TOCVIEW, "toc-view",
|
||||
N_("View table of contents"), ReadOnly },
|
||||
{ LFUN_TOGGLECURSORFOLLOW, "toggle-cursor-follows-scrollbar",
|
||||
N_("Toggle cursor does/doesn't follow the scrollbar"),
|
||||
ReadOnly },
|
||||
{ LFUN_ADD_TO_TOOLBAR, "toolbar-add-to", "", NoBuffer },
|
||||
{ LFUN_PUSH_TOOLBAR, "toolbar-push", "", NoBuffer },
|
||||
{ LFUN_UNDO, "undo", N_("Undo"), Noop },
|
||||
{ LFUN_UP, "up", "", ReadOnly },
|
||||
{ LFUN_UPSEL, "up-select", "", ReadOnly },
|
||||
{ LFUN_URL, "url-insert", "", 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;
|
||||
@ -376,7 +395,8 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const
|
||||
if (pit == lyx_arg_map.end()) {
|
||||
// the action does not have any pseudoactions
|
||||
lyxerr[Debug::ACTION] << "Action " << action
|
||||
<< " does not have any pseudo actions.\n";
|
||||
<< " does not have any pseudo actions."
|
||||
<< endl;
|
||||
return LFUN_UNKNOWN_ACTION;
|
||||
}
|
||||
|
||||
@ -387,14 +407,14 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const
|
||||
lyxerr[Debug::ACTION]
|
||||
<< "Action " << action
|
||||
<< "does not have any pseudoactions with arg "
|
||||
<< arg << '\n';
|
||||
<< arg << endl;
|
||||
return LFUN_UNKNOWN_ACTION;
|
||||
}
|
||||
|
||||
// pseudo action exist
|
||||
lyxerr[Debug::ACTION] << "Pseudoaction exist["
|
||||
<< action << '|'
|
||||
<< arg << "] = " << (*aci).second << '\n';
|
||||
<< action << '|'
|
||||
<< arg << "] = " << (*aci).second << endl;
|
||||
|
||||
return (*aci).second;
|
||||
}
|
||||
@ -423,8 +443,8 @@ int LyXAction::getPseudoAction(kb_action action, string const & arg) const
|
||||
(*ami).second[arg] = pseudo_counter;
|
||||
|
||||
lyxerr[Debug::ACTION] << "Creating new pseudoaction "
|
||||
<< pseudo_counter << " for [" << action
|
||||
<< '|' << arg << "]\n";
|
||||
<< pseudo_counter << " for [" << action
|
||||
<< '|' << arg << "]\n";
|
||||
|
||||
return pseudo_counter;
|
||||
}
|
||||
@ -438,8 +458,8 @@ kb_action LyXAction::retrieveActionArg(int pseudo, string & arg) const
|
||||
|
||||
if (pit != lyx_pseudo_map.end()) {
|
||||
lyxerr[Debug::ACTION] << "Found the pseudoaction: ["
|
||||
<< (*pit).second.action << '|'
|
||||
<< (*pit).second.arg << '\n';
|
||||
<< (*pit).second.action << '|'
|
||||
<< (*pit).second.arg << '\n';
|
||||
arg = (*pit).second.arg;
|
||||
return (*pit).second.action;
|
||||
} else {
|
||||
@ -509,17 +529,18 @@ int LyXAction::getApproxFunc(string const & func) const
|
||||
|
||||
string LyXAction::getApproxFuncName(string const & func) const
|
||||
{
|
||||
int f = getApproxFunc(func);
|
||||
// This will return empty string if f isn't an action.
|
||||
return getActionName(f);
|
||||
int f = getApproxFunc(func);
|
||||
// This will return empty string if f isn't an action.
|
||||
return getActionName(f);
|
||||
}
|
||||
|
||||
|
||||
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,
|
||||
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()) {
|
||||
return (*ici).second.attrib & flag;
|
||||
} else {
|
||||
// it really should exist, but...
|
||||
lyxerr << "No info about kb_action: " << action << '\n';
|
||||
return false;
|
||||
}
|
||||
if (ici != lyx_info_map.end()) {
|
||||
return (*ici).second.attrib & flag;
|
||||
} else {
|
||||
// it really should exist, but...
|
||||
lyxerr << "No info about kb_action: " << action << '\n';
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -33,10 +33,10 @@
|
||||
|
||||
extern FD_form_document * fd_form_document;
|
||||
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
|
||||
should be removed as soon as possible */
|
||||
should be removed as soon as possible */
|
||||
|
||||
extern void AutoSave();
|
||||
extern char updatetimer;
|
||||
@ -68,6 +68,7 @@ LyXView::~LyXView()
|
||||
delete intl;
|
||||
}
|
||||
|
||||
|
||||
/// Redraw the main form.
|
||||
void LyXView::redraw() {
|
||||
lyxerr[Debug::INFO] << "LyXView::redraw()" << endl;
|
||||
@ -86,23 +87,21 @@ void LyXView::UpdateTimerCB(FL_OBJECT * ob, long)
|
||||
return;
|
||||
|
||||
view->view()->getScreen()->HideCursor();
|
||||
#ifdef MOVE_TEXT
|
||||
view->view()->update(-2);
|
||||
#else
|
||||
view->buffer()->update(-2);
|
||||
#endif
|
||||
|
||||
/* This update can happen, even when the work area has lost
|
||||
* the focus. So suppress the cursor in that case */
|
||||
updatetimer = 0;
|
||||
}
|
||||
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Callback for autosave timer
|
||||
void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
|
||||
{
|
||||
@ -110,8 +109,10 @@ void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
|
||||
AutoSave();
|
||||
}
|
||||
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
@ -133,7 +134,8 @@ int LyXView::atCloseMainFormCB(FL_FORM *, void *)
|
||||
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
@ -209,10 +211,9 @@ FD_form_main * LyXView::create_form_form_main(int width, int height)
|
||||
//
|
||||
|
||||
minibuffer = new MiniBuffer(this, air, height-(25+air),
|
||||
width-(2*air), 25);
|
||||
width-(2*air), 25);
|
||||
::minibuffer = minibuffer; // to be removed later
|
||||
|
||||
|
||||
//
|
||||
// TIMERS
|
||||
//
|
||||
@ -253,6 +254,7 @@ FD_form_main * LyXView::create_form_form_main(int width, int height)
|
||||
return fdui;
|
||||
}
|
||||
|
||||
|
||||
extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev);
|
||||
|
||||
void LyXView::init()
|
||||
@ -300,7 +302,7 @@ void LyXView::updateLayoutChoice()
|
||||
toolbar->combox->clear();
|
||||
for (int i = 0;
|
||||
textclasslist.NameOfLayout(buffer()->
|
||||
params.textclass, i) != "@@end@@";
|
||||
params.textclass, i) != "@@end@@";
|
||||
i++) {
|
||||
LyXLayout const & layout = textclasslist.
|
||||
Style(buffer()->params.textclass, i);
|
||||
@ -315,11 +317,7 @@ void LyXView::updateLayoutChoice()
|
||||
// we need to do this.
|
||||
toolbar->combox->Redraw();
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
char layout = bufferview->text->cursor.par->GetLayout();
|
||||
#else
|
||||
char layout = buffer()->text->cursor.par->GetLayout();
|
||||
#endif
|
||||
|
||||
if (layout != current_layout){
|
||||
toolbar->combox->select(layout + 1);
|
||||
@ -331,10 +329,10 @@ void LyXView::updateLayoutChoice()
|
||||
void LyXView::UpdateDocumentClassChoice()
|
||||
{
|
||||
// update the document class display in the document form
|
||||
int i;
|
||||
if (fd_form_document) {
|
||||
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,
|
||||
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
|
||||
// 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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
// wrapper for the above
|
||||
extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev)
|
||||
{
|
||||
return LyXView::KeyPressMask_raw_callback(fl, xev);
|
||||
}
|
||||
|
||||
|
||||
// Updates the title of the window with the filename of the current document
|
||||
void LyXView::updateWindowTitle() {
|
||||
void LyXView::updateWindowTitle()
|
||||
{
|
||||
static string last_title = "LyX";
|
||||
string title = "LyX";
|
||||
|
||||
|
@ -50,7 +50,6 @@ lyx_SOURCES = \
|
||||
bibforms.h \
|
||||
bmtable.C \
|
||||
bmtable.h \
|
||||
broken_const.h \
|
||||
broken_headers.h \
|
||||
buffer.C \
|
||||
buffer.h \
|
||||
|
@ -73,254 +73,242 @@ inline void EnableParagraphExtra ()
|
||||
|
||||
bool UpdateParagraphExtra()
|
||||
{
|
||||
bool update = false;
|
||||
if (current_view->getScreen() && current_view->available()) {
|
||||
update = true;
|
||||
#ifdef MOVE_TEXT
|
||||
LyXParagraph * par = current_view->text->cursor.par;
|
||||
#else
|
||||
LyXParagraph * par = current_view->buffer()->text->cursor.par;
|
||||
#endif
|
||||
bool update = false;
|
||||
if (current_view->getScreen() && current_view->available()) {
|
||||
update = true;
|
||||
LyXParagraph * par = current_view->text->cursor.par;
|
||||
|
||||
EnableParagraphExtra();
|
||||
EnableParagraphExtra();
|
||||
|
||||
fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
|
||||
fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
|
||||
fl_set_input(fd_form_paragraph_extra->input_pextra_width,
|
||||
par->pextra_width.c_str());
|
||||
fl_set_input(fd_form_paragraph_extra->input_pextra_widthp,
|
||||
par->pextra_widthp.c_str());
|
||||
switch(par->pextra_alignment) {
|
||||
case LyXParagraph::MINIPAGE_ALIGN_TOP:
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_top, 1);
|
||||
break;
|
||||
case LyXParagraph::MINIPAGE_ALIGN_MIDDLE:
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_middle, 1);
|
||||
break;
|
||||
case LyXParagraph::MINIPAGE_ALIGN_BOTTOM:
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_bottom, 1);
|
||||
break;
|
||||
}
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_hfill,
|
||||
par->pextra_hfill);
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_startmp,
|
||||
par->pextra_start_minipage);
|
||||
CheckInputWidth();
|
||||
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_minipage, 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_middle);
|
||||
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
|
||||
} 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_minipage, 1);
|
||||
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_middle);
|
||||
fl_activate_object(fd_form_paragraph_extra->radio_pextra_bottom);
|
||||
} 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_minipage, 0);
|
||||
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_middle);
|
||||
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
|
||||
} else {
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 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_widthp);
|
||||
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_bottom);
|
||||
}
|
||||
if (par->pextra_type == LyXParagraph::PEXTRA_NONE)
|
||||
ActivateParagraphExtraButtons();
|
||||
}
|
||||
fl_hide_object(fd_form_paragraph_extra->text_warning);
|
||||
fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
|
||||
fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
|
||||
fl_set_input(fd_form_paragraph_extra->input_pextra_width,
|
||||
par->pextra_width.c_str());
|
||||
fl_set_input(fd_form_paragraph_extra->input_pextra_widthp,
|
||||
par->pextra_widthp.c_str());
|
||||
switch(par->pextra_alignment) {
|
||||
case LyXParagraph::MINIPAGE_ALIGN_TOP:
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_top, 1);
|
||||
break;
|
||||
case LyXParagraph::MINIPAGE_ALIGN_MIDDLE:
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_middle, 1);
|
||||
break;
|
||||
case LyXParagraph::MINIPAGE_ALIGN_BOTTOM:
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_bottom, 1);
|
||||
break;
|
||||
}
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_hfill,
|
||||
par->pextra_hfill);
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_startmp,
|
||||
par->pextra_start_minipage);
|
||||
CheckInputWidth();
|
||||
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_minipage, 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_middle);
|
||||
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
|
||||
} 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_minipage, 1);
|
||||
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_middle);
|
||||
fl_activate_object(fd_form_paragraph_extra->radio_pextra_bottom);
|
||||
} 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_minipage, 0);
|
||||
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_middle);
|
||||
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
|
||||
} else {
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 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_widthp);
|
||||
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_bottom);
|
||||
}
|
||||
if (par->pextra_type == LyXParagraph::PEXTRA_NONE)
|
||||
ActivateParagraphExtraButtons();
|
||||
}
|
||||
fl_hide_object(fd_form_paragraph_extra->text_warning);
|
||||
|
||||
if (current_view->buffer()->isReadonly()) {
|
||||
DisableParagraphExtra();
|
||||
fl_set_object_label(fd_form_paragraph_extra->text_warning,
|
||||
_("Document is read-only. "
|
||||
"No changes to layout permitted."));
|
||||
fl_show_object(fd_form_paragraph_extra->text_warning);
|
||||
}
|
||||
if (!update && fd_form_paragraph_extra->form_paragraph_extra->visible) {
|
||||
fl_hide_form(fd_form_paragraph_extra->form_paragraph_extra);
|
||||
}
|
||||
return update;
|
||||
if (current_view->buffer()->isReadonly()) {
|
||||
DisableParagraphExtra();
|
||||
fl_set_object_label(fd_form_paragraph_extra->text_warning,
|
||||
_("Document is read-only. "
|
||||
"No changes to layout permitted."));
|
||||
fl_show_object(fd_form_paragraph_extra->text_warning);
|
||||
}
|
||||
if (!update && fd_form_paragraph_extra->form_paragraph_extra->visible) {
|
||||
fl_hide_form(fd_form_paragraph_extra->form_paragraph_extra);
|
||||
}
|
||||
return update;
|
||||
}
|
||||
|
||||
|
||||
void ParagraphExtraOpen(FL_OBJECT *, long)
|
||||
{
|
||||
if (UpdateParagraphExtra()) {
|
||||
if (fd_form_paragraph_extra->form_paragraph_extra->visible) {
|
||||
fl_raise_form(fd_form_paragraph_extra->form_paragraph_extra);
|
||||
} else {
|
||||
fl_show_form(fd_form_paragraph_extra->form_paragraph_extra,
|
||||
FL_PLACE_MOUSE, FL_FULLBORDER,
|
||||
_("ParagraphExtra Layout"));
|
||||
}
|
||||
}
|
||||
if (UpdateParagraphExtra()) {
|
||||
if (fd_form_paragraph_extra->form_paragraph_extra->visible) {
|
||||
fl_raise_form(fd_form_paragraph_extra->form_paragraph_extra);
|
||||
} else {
|
||||
fl_show_form(fd_form_paragraph_extra->form_paragraph_extra,
|
||||
FL_PLACE_MOUSE, FL_FULLBORDER,
|
||||
_("ParagraphExtra Layout"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ParagraphExtraApplyCB(FL_OBJECT *, long)
|
||||
{
|
||||
if (current_view->getScreen() && current_view->available()) {
|
||||
FD_form_paragraph_extra const * fd = fd_form_paragraph_extra;
|
||||
char const * width = fl_get_input(fd->input_pextra_width);
|
||||
char const * widthp = fl_get_input(fd->input_pextra_widthp);
|
||||
#ifdef MOVE_TEXT
|
||||
LyXText * text = current_view->text;
|
||||
#else
|
||||
LyXText * text = current_view->buffer()->text;
|
||||
#endif
|
||||
int type = LyXParagraph::PEXTRA_NONE;
|
||||
LyXParagraph::MINIPAGE_ALIGNMENT alignment =
|
||||
LyXParagraph::MINIPAGE_ALIGN_TOP;
|
||||
bool
|
||||
hfill = false,
|
||||
start_minipage = false;
|
||||
if (current_view->getScreen() && current_view->available()) {
|
||||
FD_form_paragraph_extra const * fd = fd_form_paragraph_extra;
|
||||
char const * width = fl_get_input(fd->input_pextra_width);
|
||||
char const * widthp = fl_get_input(fd->input_pextra_widthp);
|
||||
LyXText * text = current_view->text;
|
||||
int type = LyXParagraph::PEXTRA_NONE;
|
||||
LyXParagraph::MINIPAGE_ALIGNMENT alignment =
|
||||
LyXParagraph::MINIPAGE_ALIGN_TOP;
|
||||
bool
|
||||
hfill = false,
|
||||
start_minipage = false;
|
||||
|
||||
if (fl_get_button(fd_form_paragraph_extra->radio_pextra_indent)) {
|
||||
type = LyXParagraph::PEXTRA_INDENT;
|
||||
} else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_minipage)) {
|
||||
type = LyXParagraph::PEXTRA_MINIPAGE;
|
||||
hfill = fl_get_button(fd_form_paragraph_extra->radio_pextra_hfill);
|
||||
start_minipage =
|
||||
fl_get_button(fd_form_paragraph_extra->radio_pextra_startmp);
|
||||
if (fl_get_button(fd_form_paragraph_extra->radio_pextra_top))
|
||||
alignment = LyXParagraph::MINIPAGE_ALIGN_TOP;
|
||||
else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_middle))
|
||||
alignment = LyXParagraph::MINIPAGE_ALIGN_MIDDLE;
|
||||
else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_bottom))
|
||||
alignment = LyXParagraph::MINIPAGE_ALIGN_BOTTOM;
|
||||
} else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_floatflt)) {
|
||||
type = LyXParagraph::PEXTRA_FLOATFLT;
|
||||
}
|
||||
text->SetParagraphExtraOpt(type, width, widthp, alignment, hfill,
|
||||
start_minipage);
|
||||
#ifdef MOVE_TEXT
|
||||
current_view->update(1);
|
||||
#else
|
||||
current_view->buffer()->update(1);
|
||||
#endif
|
||||
minibuffer->Set(_("ParagraphExtra layout set"));
|
||||
}
|
||||
return;
|
||||
if (fl_get_button(fd_form_paragraph_extra->radio_pextra_indent)) {
|
||||
type = LyXParagraph::PEXTRA_INDENT;
|
||||
} else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_minipage)) {
|
||||
type = LyXParagraph::PEXTRA_MINIPAGE;
|
||||
hfill = fl_get_button(fd_form_paragraph_extra->radio_pextra_hfill);
|
||||
start_minipage =
|
||||
fl_get_button(fd_form_paragraph_extra->radio_pextra_startmp);
|
||||
if (fl_get_button(fd_form_paragraph_extra->radio_pextra_top))
|
||||
alignment = LyXParagraph::MINIPAGE_ALIGN_TOP;
|
||||
else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_middle))
|
||||
alignment = LyXParagraph::MINIPAGE_ALIGN_MIDDLE;
|
||||
else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_bottom))
|
||||
alignment = LyXParagraph::MINIPAGE_ALIGN_BOTTOM;
|
||||
} else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_floatflt)) {
|
||||
type = LyXParagraph::PEXTRA_FLOATFLT;
|
||||
}
|
||||
text->SetParagraphExtraOpt(type, width, widthp, alignment, hfill,
|
||||
start_minipage);
|
||||
current_view->update(1);
|
||||
minibuffer->Set(_("ParagraphExtra layout set"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
ParagraphExtraCancelCB(ob, data);
|
||||
ParagraphExtraApplyCB(ob, data);
|
||||
ParagraphExtraCancelCB(ob, data);
|
||||
ParagraphExtraApplyCB(ob, data);
|
||||
}
|
||||
|
||||
|
||||
void CheckPExtraOptCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
ActivateParagraphExtraButtons();
|
||||
CheckInputWidth();
|
||||
if (ob == fd_form_paragraph_extra->radio_pextra_indent) {
|
||||
int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_indent);
|
||||
if (n) {
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 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_widthp);
|
||||
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_bottom);
|
||||
} else {
|
||||
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
|
||||
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
|
||||
ActivateParagraphExtraButtons();
|
||||
}
|
||||
} else if (ob == fd_form_paragraph_extra->radio_pextra_minipage) {
|
||||
int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_minipage);
|
||||
if (n) {
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 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_widthp);
|
||||
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_bottom);
|
||||
} else {
|
||||
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->radio_pextra_top);
|
||||
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
|
||||
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
|
||||
ActivateParagraphExtraButtons();
|
||||
}
|
||||
} else if (ob == fd_form_paragraph_extra->radio_pextra_floatflt) {
|
||||
int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_floatflt);
|
||||
if (n) {
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 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_widthp);
|
||||
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_bottom);
|
||||
} else {
|
||||
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->radio_pextra_top);
|
||||
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
|
||||
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
|
||||
ActivateParagraphExtraButtons();
|
||||
}
|
||||
}
|
||||
return;
|
||||
ActivateParagraphExtraButtons();
|
||||
CheckInputWidth();
|
||||
if (ob == fd_form_paragraph_extra->radio_pextra_indent) {
|
||||
int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_indent);
|
||||
if (n) {
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 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_widthp);
|
||||
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_bottom);
|
||||
} else {
|
||||
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
|
||||
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
|
||||
ActivateParagraphExtraButtons();
|
||||
}
|
||||
} else if (ob == fd_form_paragraph_extra->radio_pextra_minipage) {
|
||||
int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_minipage);
|
||||
if (n) {
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 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_widthp);
|
||||
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_bottom);
|
||||
} else {
|
||||
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->radio_pextra_top);
|
||||
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
|
||||
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
|
||||
ActivateParagraphExtraButtons();
|
||||
}
|
||||
} else if (ob == fd_form_paragraph_extra->radio_pextra_floatflt) {
|
||||
int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_floatflt);
|
||||
if (n) {
|
||||
fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 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_widthp);
|
||||
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_bottom);
|
||||
} else {
|
||||
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->radio_pextra_top);
|
||||
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle);
|
||||
fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom);
|
||||
ActivateParagraphExtraButtons();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static bool CheckInputWidth()
|
||||
{
|
||||
string s1 = fl_get_input(fd_form_paragraph_extra->input_pextra_width);
|
||||
string s2 = fl_get_input(fd_form_paragraph_extra->input_pextra_widthp);
|
||||
if (s1.empty() && s2.empty()) {
|
||||
fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
|
||||
fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
|
||||
fl_hide_object(fd_form_paragraph_extra->text_warning);
|
||||
DeactivateParagraphExtraButtons();
|
||||
return false;
|
||||
}
|
||||
if (!s1.empty()) { // LyXLength parameter
|
||||
fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
|
||||
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
|
||||
if (!isValidLength(s1)) {
|
||||
DeactivateParagraphExtraButtons();
|
||||
fl_set_object_label(fd_form_paragraph_extra->text_warning,
|
||||
_("Warning: Invalid Length (valid example: 10mm)"));
|
||||
fl_show_object(fd_form_paragraph_extra->text_warning);
|
||||
return false;
|
||||
}
|
||||
} else { // !s2.empty() % parameter
|
||||
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
|
||||
fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
|
||||
if ((atoi(s2.c_str()) < 0 ) || (atoi(s2.c_str()) > 100)) {
|
||||
DeactivateParagraphExtraButtons();
|
||||
fl_set_object_label(fd_form_paragraph_extra->text_warning,
|
||||
_("Warning: Invalid percent value (0-100)"));
|
||||
fl_show_object(fd_form_paragraph_extra->text_warning);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
fl_hide_object(fd_form_paragraph_extra->text_warning);
|
||||
return true;
|
||||
string s1 = fl_get_input(fd_form_paragraph_extra->input_pextra_width);
|
||||
string s2 = fl_get_input(fd_form_paragraph_extra->input_pextra_widthp);
|
||||
if (s1.empty() && s2.empty()) {
|
||||
fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
|
||||
fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
|
||||
fl_hide_object(fd_form_paragraph_extra->text_warning);
|
||||
DeactivateParagraphExtraButtons();
|
||||
return false;
|
||||
}
|
||||
if (!s1.empty()) { // LyXLength parameter
|
||||
fl_activate_object(fd_form_paragraph_extra->input_pextra_width);
|
||||
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp);
|
||||
if (!isValidLength(s1)) {
|
||||
DeactivateParagraphExtraButtons();
|
||||
fl_set_object_label(fd_form_paragraph_extra->text_warning,
|
||||
_("Warning: Invalid Length (valid example: 10mm)"));
|
||||
fl_show_object(fd_form_paragraph_extra->text_warning);
|
||||
return false;
|
||||
}
|
||||
} else { // !s2.empty() % parameter
|
||||
fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width);
|
||||
fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp);
|
||||
if ((atoi(s2.c_str()) < 0 ) || (atoi(s2.c_str()) > 100)) {
|
||||
DeactivateParagraphExtraButtons();
|
||||
fl_set_object_label(fd_form_paragraph_extra->text_warning,
|
||||
_("Warning: Invalid percent value (0-100)"));
|
||||
fl_show_object(fd_form_paragraph_extra->text_warning);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
fl_hide_object(fd_form_paragraph_extra->text_warning);
|
||||
return true;
|
||||
}
|
||||
|
@ -28,15 +28,16 @@ static int Confirmed = false;
|
||||
static int ActCell;
|
||||
|
||||
// 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
|
||||
// real-time, but we have no callbacks for the input fields, so I simply
|
||||
// store and restore the cursor position for now. (too much of a hazzle to
|
||||
// do it proper; we'll trash all this code in 1.1 anyway)
|
||||
// form input fields during editing. The values in LyXTable itself is
|
||||
// changed in real-time, but we have no callbacks for the input fields,
|
||||
// so I simply store and restore the cursor position for now.
|
||||
// (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_multicol_cursor_x;
|
||||
// Joacim
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
|
||||
bool UpdateLayoutTable(int flag)
|
||||
{
|
||||
bool update = true;
|
||||
@ -219,190 +220,7 @@ bool UpdateLayoutTable(int flag)
|
||||
}
|
||||
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()
|
||||
{
|
||||
@ -445,7 +263,6 @@ void TableOptionsCB(FL_OBJECT * ob, long)
|
||||
int s, num = 0;
|
||||
string special, str;
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
if (!current_view->available()
|
||||
|| !(table = current_view->text->cursor.par->table)) {
|
||||
MenuLayoutTable(0);
|
||||
@ -463,26 +280,7 @@ void TableOptionsCB(FL_OBJECT * ob, long)
|
||||
extra_multicol_cursor_x = 0;
|
||||
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
|
||||
// anyhow, so exit now if the buffer is read-only.
|
||||
if (current_view->buffer()->isReadonly()) {
|
||||
@ -622,9 +420,8 @@ void TableOptionsCB(FL_OBJECT * ob, long)
|
||||
num = LyXTable::SET_SPECIAL_MULTI;
|
||||
} else
|
||||
return;
|
||||
if (current_view->available()){
|
||||
if (current_view->available()) {
|
||||
current_view->getScreen()->HideCursor();
|
||||
#ifdef MOVE_TEXT
|
||||
if (!current_view->text->selection){
|
||||
BeforeChange();
|
||||
current_view->update(-2);
|
||||
@ -635,18 +432,6 @@ void TableOptionsCB(FL_OBJECT * ob, long)
|
||||
else
|
||||
current_view->text->TableFeatures(num);
|
||||
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) {
|
||||
fl_set_focus_object(fd_form_table_options->form_table_options,
|
||||
@ -657,6 +442,7 @@ void TableOptionsCB(FL_OBJECT * ob, long)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void TableOptCloseCB(FL_OBJECT *, long)
|
||||
{
|
||||
fl_set_focus_object(fd_form_table_options->form_table_options,
|
||||
@ -673,37 +459,26 @@ void TableSpeCloseCB(FL_OBJECT *, long)
|
||||
return;
|
||||
}
|
||||
|
||||
void SetPWidthCB(FL_OBJECT *ob, long)
|
||||
void SetPWidthCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
fl_set_object_label(fd_form_table_options->text_warning, "");
|
||||
Confirmed = false;
|
||||
if (ob == fd_form_table_options->input_column_width) {
|
||||
string
|
||||
str;
|
||||
str = fl_get_input(ob);
|
||||
string str = fl_get_input(ob);
|
||||
if (!str.empty() && !isValidLength(str)) {
|
||||
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);
|
||||
return;
|
||||
}
|
||||
if (current_view->available()){
|
||||
current_view->getScreen()->HideCursor();
|
||||
#ifdef MOVE_TEXT
|
||||
if (!current_view->text->selection){
|
||||
if (!current_view->text->selection) {
|
||||
BeforeChange();
|
||||
current_view->update(-2);
|
||||
}
|
||||
current_view->text->TableFeatures(LyXTable::SET_PWIDTH, str);
|
||||
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
|
||||
}
|
||||
|
195
src/buffer.C
195
src/buffer.C
@ -122,9 +122,6 @@ Buffer::Buffer(string const & file, LyXRC * lyxrc, bool ronly)
|
||||
filename = file;
|
||||
filepath = OnlyPath(file);
|
||||
paragraph = 0;
|
||||
#ifndef MOVE_TEXT
|
||||
text = 0;
|
||||
#endif
|
||||
the_locking_inset = 0;
|
||||
lyx_clean = true;
|
||||
bak_clean = true;
|
||||
@ -164,9 +161,6 @@ Buffer::~Buffer()
|
||||
par = tmppar;
|
||||
}
|
||||
paragraph = 0;
|
||||
#ifndef MOVE_TEXT
|
||||
delete text;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -217,11 +211,7 @@ void Buffer::InsetUnlock()
|
||||
if (the_locking_inset) {
|
||||
if (!inset_slept) the_locking_inset->InsetUnlock();
|
||||
the_locking_inset = 0;
|
||||
#ifdef MOVE_TEXT
|
||||
users->text->FinishUndo();
|
||||
#else
|
||||
text->FinishUndo();
|
||||
#endif
|
||||
inset_slept = false;
|
||||
}
|
||||
}
|
||||
@ -268,7 +258,6 @@ bool Buffer::insertLyXFile(string const & filen)
|
||||
|
||||
bool res = true;
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
if (c == '#') {
|
||||
lyxerr.debug() << "Will insert file with header" << endl;
|
||||
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;
|
||||
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();
|
||||
return res;
|
||||
}
|
||||
@ -319,13 +300,8 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
|
||||
if(!par) {
|
||||
par = new LyXParagraph;
|
||||
} else {
|
||||
#ifdef MOVE_TEXT
|
||||
users->text->BreakParagraph();
|
||||
return_par = users->text->FirstParagraph();
|
||||
#else
|
||||
text->BreakParagraph();
|
||||
return_par = text->FirstParagraph();
|
||||
#endif
|
||||
pos = 0;
|
||||
markDirty();
|
||||
// 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
|
||||
bool Buffer::removeAutoInsets()
|
||||
{
|
||||
LyXParagraph *par = paragraph;
|
||||
LyXParagraph * par = paragraph;
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
LyXCursor cursor = users->text->cursor;
|
||||
#else
|
||||
LyXCursor cursor = text->cursor;
|
||||
#endif
|
||||
LyXCursor tmpcursor = cursor;
|
||||
cursor.par = tmpcursor.par->ParFromPos(tmpcursor.pos);
|
||||
cursor.pos = tmpcursor.par->PositionInParFromPos(tmpcursor.pos);
|
||||
@ -3176,19 +3148,11 @@ bool Buffer::removeAutoInsets()
|
||||
if (par->AutoDeleteInsets()){
|
||||
a = true;
|
||||
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){
|
||||
#ifdef MOVE_TEXT
|
||||
/* this is possible now, since SetCursor takes
|
||||
care about footnotes */
|
||||
users->text->SetCursorIntern(par, 0);
|
||||
users->text->RedoParagraphs(users->text->cursor, users->text->cursor.par->Next());
|
||||
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;
|
||||
@ -3196,11 +3160,7 @@ bool Buffer::removeAutoInsets()
|
||||
/* avoid forbidden cursor positions caused by error removing */
|
||||
if (cursor.pos > cursor.par->Last())
|
||||
cursor.pos = cursor.par->Last();
|
||||
#ifdef MOVE_TEXT
|
||||
users->text->SetCursorIntern(cursor.par, cursor.pos);
|
||||
#else
|
||||
text->SetCursorIntern(cursor.par, cursor.pos);
|
||||
#endif
|
||||
|
||||
return a;
|
||||
}
|
||||
@ -3208,11 +3168,7 @@ bool Buffer::removeAutoInsets()
|
||||
|
||||
int Buffer::runLaTeX()
|
||||
{
|
||||
#ifdef MOVE_TEXT
|
||||
if (!users->text) return 0;
|
||||
#else
|
||||
if (!text) return 0;
|
||||
#endif
|
||||
|
||||
ProhibitInput();
|
||||
|
||||
@ -3275,11 +3231,7 @@ int Buffer::runLaTeX()
|
||||
|
||||
int Buffer::runLiterate()
|
||||
{
|
||||
#ifdef MOVE_TEXT
|
||||
if (!users->text) return 0;
|
||||
#else
|
||||
if (!text) return 0;
|
||||
#endif
|
||||
|
||||
ProhibitInput();
|
||||
|
||||
@ -3348,11 +3300,7 @@ int Buffer::runLiterate()
|
||||
|
||||
int Buffer::buildProgram()
|
||||
{
|
||||
#ifdef MOVE_TEXT
|
||||
if (!users->text) return 0;
|
||||
#else
|
||||
if (!text) return 0;
|
||||
#endif
|
||||
|
||||
ProhibitInput();
|
||||
|
||||
@ -3423,11 +3371,7 @@ int Buffer::buildProgram()
|
||||
// Other flags: -wall -v0 -x
|
||||
int Buffer::runChktex()
|
||||
{
|
||||
#ifdef MOVE_TEXT
|
||||
if (!users->text) return 0;
|
||||
#else
|
||||
if (!text) return 0;
|
||||
#endif
|
||||
|
||||
ProhibitInput();
|
||||
|
||||
@ -3483,13 +3427,8 @@ extern void AllFloats(char, char);
|
||||
// candidate for move to BufferView
|
||||
void Buffer::insertErrors(TeXErrors & terr)
|
||||
{
|
||||
#ifdef MOVE_TEXT
|
||||
// Save the cursor position
|
||||
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)
|
||||
AllFloats(1, 0);
|
||||
@ -3511,41 +3450,23 @@ void Buffer::insertErrors(TeXErrors & terr)
|
||||
|
||||
LyXParagraph * texrowpar = 0;
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
if (tmpid == -1) {
|
||||
texrowpar = users->text->FirstParagraph();
|
||||
tmppos = 0;
|
||||
} else {
|
||||
texrowpar = users->text->GetParFromID(tmpid);
|
||||
}
|
||||
#else
|
||||
if (tmpid == -1) {
|
||||
texrowpar = text->FirstParagraph();
|
||||
tmppos = 0;
|
||||
} else {
|
||||
texrowpar = text->GetParFromID(tmpid);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (texrowpar == 0)
|
||||
continue;
|
||||
|
||||
InsetError * new_inset = new InsetError(msgtxt);
|
||||
#ifdef MOVE_TEXT
|
||||
users->text->SetCursorIntern(texrowpar, tmppos);
|
||||
users->text->InsertInset(new_inset);
|
||||
users->text->FullRebreak();
|
||||
}
|
||||
// Restore the cursor position
|
||||
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;
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
if (tmpid == -1) {
|
||||
texrowpar = users->text->FirstParagraph();
|
||||
tmppos = 0;
|
||||
@ -3567,15 +3487,6 @@ void Buffer::setCursorFromRow (int row)
|
||||
texrowpar = users->text->GetParFromID(tmpid);
|
||||
}
|
||||
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)
|
||||
{
|
||||
LyXParagraph * par = paragraph;
|
||||
@ -3868,7 +3748,7 @@ void Buffer::setOldPaperStuff()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
|
||||
// candidate for move to BufferView
|
||||
void Buffer::insertInset(Inset * inset, string const & lout,
|
||||
bool no_table)
|
||||
@ -3921,79 +3801,18 @@ void Buffer::insertInset(Inset * inset, string const & lout,
|
||||
|
||||
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
|
||||
// candidate for move to BufferView
|
||||
void Buffer::open_new_inset(UpdatableInset * new_inset)
|
||||
{
|
||||
#ifdef MOVE_TEXT
|
||||
BeforeChange();
|
||||
users->text->FinishUndo();
|
||||
insertInset(new_inset);
|
||||
users->text->CursorLeft();
|
||||
users->update(1);
|
||||
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))){
|
||||
for (int i = 0; i < inset->GetNumberOfLabels(); i++) {
|
||||
if (label == inset->getLabel(i)) {
|
||||
#ifdef MOVE_TEXT
|
||||
BeforeChange();
|
||||
users->text->SetCursor(par, pos);
|
||||
users->text->sel_cursor = users->text->cursor;
|
||||
users->update(0);
|
||||
return true;
|
||||
#else
|
||||
BeforeChange();
|
||||
text->SetCursor(par, pos);
|
||||
text->sel_cursor = text->cursor;
|
||||
update(0);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
pos++;
|
||||
|
128
src/buffer.h
128
src/buffer.h
@ -1,6 +1,6 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
* Copyright (C) 1995 Matthias Ettrich
|
||||
@ -34,7 +34,6 @@
|
||||
#include "lyxtext.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
#define MOVE_TEXT 1
|
||||
|
||||
class LyXRC;
|
||||
class TeXErrors;
|
||||
@ -73,16 +72,16 @@ public:
|
||||
//@{
|
||||
|
||||
/** save the buffer's parameters as user default
|
||||
This function saves a file user_lyxdir/templates/defaults.lyx
|
||||
which parameters are those of the current buffer. This file
|
||||
is used as a default template when creating a new
|
||||
file. Returns true on success.
|
||||
*/
|
||||
This function saves a file user_lyxdir/templates/defaults.lyx
|
||||
which parameters are those of the current buffer. This file
|
||||
is used as a default template when creating a new
|
||||
file. Returns true on success.
|
||||
*/
|
||||
bool saveParamsAsDefaults();
|
||||
|
||||
/** 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);
|
||||
|
||||
/// Maybe we know the function already by number...
|
||||
@ -90,17 +89,11 @@ public:
|
||||
|
||||
/// should be changed to work for a list.
|
||||
void resize()
|
||||
{
|
||||
if (users) {
|
||||
users->resize();
|
||||
{
|
||||
if (users) {
|
||||
users->resize();
|
||||
}
|
||||
}
|
||||
#ifndef MOVE_TEXT
|
||||
else if (text) {
|
||||
delete text;
|
||||
text = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Update window titles of all users
|
||||
void updateTitles();
|
||||
@ -109,26 +102,21 @@ public:
|
||||
void resetAutosaveTimers();
|
||||
|
||||
/** Adds the BufferView to the users list.
|
||||
Later this func will insert the BufferView into a real list,
|
||||
not just setting a pointer.
|
||||
*/
|
||||
Later this func will insert the BufferView into a real list,
|
||||
not just setting a pointer.
|
||||
*/
|
||||
void addUser(BufferView * u) { users = u; }
|
||||
|
||||
/** 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; }
|
||||
|
||||
#ifndef MOVE_TEXT
|
||||
///
|
||||
void update(signed char f);
|
||||
#endif
|
||||
|
||||
///
|
||||
void redraw() {
|
||||
users->redraw();
|
||||
users->fitCursor();
|
||||
users->updateScrollbar();
|
||||
users->redraw();
|
||||
users->fitCursor();
|
||||
users->updateScrollbar();
|
||||
}
|
||||
|
||||
/// Open and lock an updatable inset
|
||||
@ -263,16 +251,16 @@ public:
|
||||
|
||||
/// Set buffer read-only flag
|
||||
void setReadonly(bool flag = true)
|
||||
{
|
||||
if (read_only != flag) {
|
||||
read_only = flag;
|
||||
updateTitles();
|
||||
updateAllVisibleBufferRelatedPopups();
|
||||
{
|
||||
if (read_only != flag) {
|
||||
read_only = flag;
|
||||
updateTitles();
|
||||
updateAllVisibleBufferRelatedPopups();
|
||||
}
|
||||
if (read_only) {
|
||||
WarnReadonly();
|
||||
}
|
||||
}
|
||||
if (read_only) {
|
||||
WarnReadonly();
|
||||
}
|
||||
}
|
||||
|
||||
/// returns true if the buffer contains a LaTeX document
|
||||
bool isLatex() const;
|
||||
@ -294,19 +282,19 @@ public:
|
||||
#endif
|
||||
|
||||
/** Validate a buffer for LaTeX.
|
||||
This validates the buffer, and returns a struct for use by
|
||||
makeLaTeX and others. Its main use is to figure out what commands
|
||||
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
|
||||
points to coresponding \labels). It should perhaps inset "error"
|
||||
insets to help the user correct obvious mistakes.
|
||||
*/
|
||||
This validates the buffer, and returns a struct for use by
|
||||
makeLaTeX and others. Its main use is to figure out what commands
|
||||
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
|
||||
points to coresponding \labels). It should perhaps inset "error"
|
||||
insets to help the user correct obvious mistakes.
|
||||
*/
|
||||
void validate(LaTeXFeatures &); //the correct parameters to be
|
||||
//included later
|
||||
//included later
|
||||
|
||||
/** Insert an inset into the buffer
|
||||
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. */
|
||||
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. */
|
||||
void insertInset(Inset *, string const & lout = string(),
|
||||
bool no_table = false);
|
||||
|
||||
@ -326,7 +314,7 @@ public:
|
||||
bool removeAutoInsets();
|
||||
|
||||
/** 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; }
|
||||
|
||||
//@}
|
||||
@ -344,12 +332,6 @@ public:
|
||||
*/
|
||||
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?
|
||||
UpdatableInset * the_locking_inset;
|
||||
|
||||
@ -453,12 +435,12 @@ private:
|
||||
float format;
|
||||
|
||||
/** 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:
|
||||
buffer->lyx_gui->bufferview->updateLayoutChoice. Just ask each
|
||||
of the buffers in the list of users to do a updateLayoutChoice.
|
||||
*/
|
||||
At least then we don't have to do a lot of magic like:
|
||||
buffer->lyx_gui->bufferview->updateLayoutChoice. Just ask each
|
||||
of the buffers in the list of users to do a updateLayoutChoice.
|
||||
*/
|
||||
BufferView * users;
|
||||
|
||||
/// Used when typesetting to place errorboxes.
|
||||
@ -469,28 +451,28 @@ private:
|
||||
inline
|
||||
void Buffer::InsetSleep()
|
||||
{
|
||||
if (the_locking_inset && !inset_slept) {
|
||||
the_locking_inset->GetCursorPos(slx, sly);
|
||||
the_locking_inset->InsetUnlock();
|
||||
inset_slept = true;
|
||||
}
|
||||
if (the_locking_inset && !inset_slept) {
|
||||
the_locking_inset->GetCursorPos(slx, sly);
|
||||
the_locking_inset->InsetUnlock();
|
||||
inset_slept = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void Buffer::InsetWakeup()
|
||||
{
|
||||
if (the_locking_inset && inset_slept) {
|
||||
the_locking_inset->Edit(slx, sly);
|
||||
inset_slept = false;
|
||||
}
|
||||
if (the_locking_inset && inset_slept) {
|
||||
the_locking_inset->Edit(slx, sly);
|
||||
inset_slept = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void Buffer::setParentName(string const & name)
|
||||
{
|
||||
params.parentname = name;
|
||||
params.parentname = name;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -58,8 +58,8 @@ void BufferStorage::release(Buffer * buf)
|
||||
|
||||
|
||||
Buffer * BufferStorage::newBuffer(string const & s,
|
||||
LyXRC * lyxrc,
|
||||
bool ronly)
|
||||
LyXRC * lyxrc,
|
||||
bool ronly)
|
||||
{
|
||||
Buffer * tmpbuf = new Buffer(s, lyxrc, ronly);
|
||||
tmpbuf->params.useClassDefaults();
|
||||
@ -104,7 +104,8 @@ bool BufferList::QwriteAll()
|
||||
break;
|
||||
case 2: // No
|
||||
askMoreConfirmation = true;
|
||||
unsaved += MakeDisplayPath((*it)->fileName(), 50);
|
||||
unsaved += MakeDisplayPath((*it)->fileName(),
|
||||
50);
|
||||
unsaved += "\n";
|
||||
break;
|
||||
case 3: // Cancel
|
||||
@ -152,7 +153,7 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
|
||||
chmod("LyXVC3.lyx", 0100644) = 0
|
||||
lseek(0, 0, SEEK_CUR) = 46440
|
||||
_exit(0)
|
||||
*/
|
||||
*/
|
||||
|
||||
// Should proabaly have some more error checking here.
|
||||
// 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);
|
||||
if (c_read != 0)
|
||||
c_write =
|
||||
fwrite(cbuf, 1, c_read, fout);
|
||||
fwrite(cbuf, 1,
|
||||
c_read, fout);
|
||||
} while (c_read);
|
||||
fin.close();
|
||||
fout.close();
|
||||
@ -189,7 +191,8 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
|
||||
}
|
||||
delete [] cbuf;
|
||||
} else {
|
||||
lyxerr << "LyX was not able to make backupcopy. Beware." << endl;
|
||||
lyxerr << "LyX was not able to make "
|
||||
"backupcopy. Beware." << endl;
|
||||
}
|
||||
delete[] times;
|
||||
}
|
||||
@ -253,8 +256,8 @@ bool BufferList::close(Buffer * buf)
|
||||
if (buf->paragraph && !buf->isLyxClean() && !quitting) {
|
||||
ProhibitInput();
|
||||
switch(AskConfirmation(_("Changes in document:"),
|
||||
MakeDisplayPath(buf->fileName(), 50),
|
||||
_("Save document?"))){
|
||||
MakeDisplayPath(buf->fileName(), 50),
|
||||
_("Save document?"))){
|
||||
case 1: // Yes
|
||||
if (write(buf)) {
|
||||
lastfiles->newFile(buf->fileName());
|
||||
@ -309,19 +312,12 @@ void BufferList::updateInset(Inset * inset, bool mark_dirty)
|
||||
{
|
||||
for (BufferStorage::iterator it = bstore.begin();
|
||||
it != bstore.end(); ++it) {
|
||||
#ifdef MOVE_TEXT
|
||||
if ((*it)->getUser() && (*it)->getUser()->text->UpdateInset(inset)) {
|
||||
if ((*it)->getUser()
|
||||
&& (*it)->getUser()->text->UpdateInset(inset)) {
|
||||
if (mark_dirty)
|
||||
(*it)->markDirty();
|
||||
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,
|
||||
false, true);
|
||||
(*it)->markDepClean(mastertmpdir);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -366,7 +361,7 @@ void BufferList::emergencyWriteAll()
|
||||
bool madeit = false;
|
||||
|
||||
lyxerr <<_("lyx: Attempting to save"
|
||||
" document ")
|
||||
" document ")
|
||||
<< (*it)->fileName()
|
||||
<< _(" as...") << endl;
|
||||
|
||||
@ -382,7 +377,9 @@ void BufferList::emergencyWriteAll()
|
||||
} else if (i == 1) {
|
||||
s = AddName(GetEnvPath("HOME"),
|
||||
(*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/"),
|
||||
(*it)->fileName());
|
||||
}
|
||||
@ -399,7 +396,9 @@ void BufferList::emergencyWriteAll()
|
||||
lyxerr << _(" Save failed! Trying...")
|
||||
<< endl;
|
||||
} 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:"),
|
||||
MakeDisplayPath(s, 50),
|
||||
_("Create new document with this name?")))
|
||||
{
|
||||
// Find a free buffer
|
||||
b = newFile(s, string());
|
||||
}
|
||||
{
|
||||
// Find a free buffer
|
||||
b = newFile(s, string());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
19
src/chset.C
19
src/chset.C
@ -35,6 +35,10 @@ bool CharacterSet::loadFile(string const & fname)
|
||||
string str;
|
||||
int n;
|
||||
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]+\"([^ ]+)\".*");
|
||||
while(getline(ifs, 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);
|
||||
if (cit != map_.end()) return true;
|
||||
return false;
|
||||
if (cit != map_.end()) {
|
||||
ret = true;
|
||||
val = (*cit).second;
|
||||
}
|
||||
lyxerr[Debug::KBMAP] << " "
|
||||
<< (ret ? "yes we" : "no we don't")
|
||||
<< " know [" << str << "]" << endl;
|
||||
return make_pair(ret, val);
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
///
|
||||
string const & getName() const;
|
||||
///
|
||||
bool encodeString(string &) const;
|
||||
pair<bool, int> encodeString(string &) const;
|
||||
private:
|
||||
///
|
||||
string name_;
|
||||
|
@ -77,8 +77,8 @@ void PutInsetIntoInsetUpdateList(Inset * inset);
|
||||
extern void ProhibitInput();
|
||||
extern void AllowInput();
|
||||
|
||||
#define DEG2PI 57.295779513
|
||||
#define figallocchunk 32
|
||||
static float const DEG2PI = 57.295779513;
|
||||
static int const figallocchunk = 32;
|
||||
|
||||
static int figinsref = 0; /* number of figures */
|
||||
static int figarrsize = 0; /* current max number of figures */
|
||||
@ -97,7 +97,7 @@ struct pidwait {
|
||||
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 figdata ** bitmaps; /* all the bitmaps */
|
||||
@ -141,7 +141,7 @@ void addpidwait(int pid)
|
||||
|
||||
|
||||
extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
|
||||
XEvent * ev, void *)
|
||||
XEvent * ev, void *)
|
||||
{
|
||||
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
|
||||
// This loop looks like S**T so it probably is...
|
||||
for (int i = 0; i < bmpinsref; ++i)
|
||||
if ((long)bitmaps[i]->bitmap == (long)e->data.l[1]) {
|
||||
// found the one
|
||||
@ -160,7 +161,8 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
|
||||
p->gsdone = true;
|
||||
|
||||
// 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
|
||||
// the pixmap with proper colors
|
||||
//XColor * cmap;
|
||||
@ -172,8 +174,10 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
|
||||
Display * tmpdisp;
|
||||
GC gc = getGC(gc_copy);
|
||||
|
||||
XGetWindowAttributes(fl_display, fl_get_canvas_id(
|
||||
figinset_canvas), &wa);
|
||||
XGetWindowAttributes(fl_display,
|
||||
fl_get_canvas_id(
|
||||
figinset_canvas),
|
||||
&wa);
|
||||
XFlush(fl_display);
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "Starting image translation "
|
||||
@ -217,36 +221,39 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
|
||||
{
|
||||
// query current colormap
|
||||
//cmap = (XColor *) malloc(gs_allcolors*sizeof(XColor));
|
||||
XColor * cmap = new XColor[gs_allcolors];
|
||||
for (i = 0; i < gs_allcolors; ++i) cmap[i].pixel = i;
|
||||
XQueryColors(tmpdisp, color_map, cmap, gs_allcolors);
|
||||
XFlush(tmpdisp);
|
||||
wid1 = p->wid - 1;
|
||||
XColor * cmap = new XColor[gs_allcolors];
|
||||
for (i = 0; i < gs_allcolors; ++i) cmap[i].pixel = i;
|
||||
XQueryColors(tmpdisp, color_map, cmap, gs_allcolors);
|
||||
XFlush(tmpdisp);
|
||||
wid1 = p->wid - 1;
|
||||
// now we process all the image
|
||||
for (y = 0; y < p->hgh; ++y) {
|
||||
for (int x = 0; x < wid; ++x) {
|
||||
XColor * pc = cmap +
|
||||
XGetPixel(im, x, y);
|
||||
XFlush(tmpdisp);
|
||||
XPutPixel(im, x, y,
|
||||
gs_pixels[((pc->red+6553)*
|
||||
spc1/65535)*spc2+((pc->green+6553)*
|
||||
spc1/65535)*gs_spc+((pc->blue+6553)*
|
||||
spc1/65535)]);
|
||||
XFlush(tmpdisp);
|
||||
for (y = 0; y < p->hgh; ++y) {
|
||||
for (int x = 0; x < wid; ++x) {
|
||||
XColor * pc = cmap +
|
||||
XGetPixel(im, x, y);
|
||||
XFlush(tmpdisp);
|
||||
XPutPixel(im, x, y,
|
||||
gs_pixels[((pc->red+6553)*
|
||||
spc1/65535)*spc2+((pc->green+6553)*
|
||||
spc1/65535)*gs_spc+((pc->blue+6553)*
|
||||
spc1/65535)]);
|
||||
XFlush(tmpdisp);
|
||||
}
|
||||
}
|
||||
}
|
||||
// This must be correct.
|
||||
delete [] cmap;
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "Putting image back" << endl;
|
||||
}
|
||||
XPutImage(tmpdisp, p->bitmap, gc, im, 0, 0,
|
||||
0, 0, p->wid, p->hgh);
|
||||
XDestroyImage(im);
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "Done translation" << endl;
|
||||
}
|
||||
delete [] cmap;
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "Putting image back"
|
||||
<< endl;
|
||||
}
|
||||
XPutImage(tmpdisp, p->bitmap,
|
||||
gc, im, 0, 0,
|
||||
0, 0, p->wid, p->hgh);
|
||||
XDestroyImage(im);
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "Done translation"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
noim:
|
||||
if (lyxerr.debugging()) {
|
||||
@ -284,9 +291,6 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
|
||||
static void AllocColors(int num)
|
||||
// allocate color cube numxnumxnum, if possible
|
||||
{
|
||||
XColor xcol;
|
||||
int i;
|
||||
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "Allocating color cube " << num
|
||||
<< 'x' << num << 'x' << num << endl;
|
||||
@ -298,10 +302,11 @@ static void AllocColors(int num)
|
||||
return;
|
||||
}
|
||||
if (num > 5) num = 5;
|
||||
for (i = 0; i < num*num*num; ++i) {
|
||||
xcol.red = 65535*(i/(num*num))/(num-1);
|
||||
xcol.green = 65535*((i/num) % num)/(num-1);
|
||||
xcol.blue = 65535*(i % num)/(num-1);
|
||||
XColor xcol;
|
||||
for (int i = 0; i < num * num * num; ++i) {
|
||||
xcol.red = 65535 * (i / (num * num)) / (num - 1);
|
||||
xcol.green = 65535 * ((i / num) % num) / (num - 1);
|
||||
xcol.blue = 65535 * (i % num) / (num - 1);
|
||||
xcol.flags = DoRed | DoGreen | DoBlue;
|
||||
if (!XAllocColor(fl_display, color_map, &xcol)) {
|
||||
if (i) XFreeColors(fl_display, color_map,
|
||||
@ -310,7 +315,7 @@ static void AllocColors(int num)
|
||||
lyxerr << "Cannot allocate color cube "
|
||||
<< num << endl;;
|
||||
}
|
||||
AllocColors(num-1);
|
||||
AllocColors(num - 1);
|
||||
return;
|
||||
}
|
||||
gs_pixels[i] = xcol.pixel;
|
||||
@ -318,18 +323,16 @@ static void AllocColors(int num)
|
||||
gs_color = true;
|
||||
gs_gray = false;
|
||||
gs_spc = num;
|
||||
gs_num_pixels = num*num*num;
|
||||
gs_num_pixels = num * num * num;
|
||||
}
|
||||
|
||||
|
||||
static void AllocGrays(int num)
|
||||
// allocate grayscale ramp
|
||||
static
|
||||
void AllocGrays(int num)
|
||||
{
|
||||
XColor xcol;
|
||||
int i;
|
||||
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "Allocating grayscale ramp "
|
||||
lyxerr << "Allocating grayscale colormap "
|
||||
<< num << endl;
|
||||
}
|
||||
|
||||
@ -339,8 +342,9 @@ static void AllocGrays(int num)
|
||||
return;
|
||||
}
|
||||
if (num > 128) num = 128;
|
||||
for (i = 0; i < num; ++i) {
|
||||
xcol.red = xcol.green = xcol.blue = 65535*i/(num-1);
|
||||
XColor xcol;
|
||||
for (int i = 0; i < num; ++i) {
|
||||
xcol.red = xcol.green = xcol.blue = 65535 * i / (num - 1);
|
||||
xcol.flags = DoRed | DoGreen | DoBlue;
|
||||
if (!XAllocColor(fl_display, color_map, &xcol)) {
|
||||
if (i) XFreeColors(fl_display, color_map,
|
||||
@ -349,7 +353,7 @@ static void AllocGrays(int num)
|
||||
lyxerr << "Cannot allocate grayscale "
|
||||
<< num << endl;
|
||||
}
|
||||
AllocGrays(num/2);
|
||||
AllocGrays(num / 2);
|
||||
return;
|
||||
}
|
||||
gs_pixels[i] = xcol.pixel;
|
||||
@ -362,16 +366,16 @@ static void AllocGrays(int num)
|
||||
|
||||
void InitFigures()
|
||||
{
|
||||
unsigned int i, j, k;
|
||||
Visual *vi;
|
||||
|
||||
bmparrsize = figarrsize = figallocchunk;
|
||||
figures = static_cast<Figref**>(malloc(sizeof(Figref*)*figallocchunk));
|
||||
bitmaps = static_cast<figdata**>(malloc(sizeof(figdata*)*figallocchunk));
|
||||
figures = static_cast<Figref**>
|
||||
(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;
|
||||
for (j = 0; j < 8; ++j)
|
||||
for (unsigned int j = 0; j < 8; ++j)
|
||||
if (i & (1 << (7-j))) k |= 1 << j;
|
||||
bittable[i] = char(~k);
|
||||
}
|
||||
@ -386,16 +390,16 @@ void InitFigures()
|
||||
// first get visual
|
||||
gs_color = false;
|
||||
|
||||
vi = DefaultVisual(fl_display, DefaultScreen(fl_display));
|
||||
Visual * vi = DefaultVisual(fl_display, DefaultScreen(fl_display));
|
||||
if (lyxerr.debugging()) {
|
||||
printf("Visual ID: %ld, class: %d, bprgb: %d, mapsz: %d\n",
|
||||
vi->visualid, vi->c_class,
|
||||
vi->bits_per_rgb, vi->map_entries);
|
||||
}
|
||||
color_visual = ( (vi->c_class == StaticColor) ||
|
||||
(vi->c_class == PseudoColor) ||
|
||||
(vi->c_class == TrueColor) ||
|
||||
(vi->c_class == DirectColor) );
|
||||
(vi->c_class == PseudoColor) ||
|
||||
(vi->c_class == TrueColor) ||
|
||||
(vi->c_class == DirectColor) );
|
||||
if ((vi->c_class & 1) == 0) return;
|
||||
// now allocate colors
|
||||
if (vi->c_class == GrayScale) {
|
||||
@ -404,7 +408,7 @@ void InitFigures()
|
||||
} else {
|
||||
// allocate normal color
|
||||
int i = 5;
|
||||
while (i*i*i*2 > vi->map_entries) --i;
|
||||
while (i * i * i * 2 > vi->map_entries) --i;
|
||||
AllocColors(i);
|
||||
}
|
||||
gs_allcolors = vi->map_entries;
|
||||
@ -432,7 +436,7 @@ void DoneFigures()
|
||||
}
|
||||
|
||||
|
||||
int FindBmpIndex(figdata *tmpdata)
|
||||
int FindBmpIndex(figdata * tmpdata)
|
||||
{
|
||||
int i = 0;
|
||||
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--;
|
||||
if (tmpdata->ref) return;
|
||||
@ -478,7 +482,7 @@ static void freefigdata(figdata *tmpdata)
|
||||
int i = FindBmpIndex(tmpdata);
|
||||
--bmpinsref;
|
||||
while (i < bmpinsref) {
|
||||
bitmaps[i] = bitmaps[i+1];
|
||||
bitmaps[i] = bitmaps[i + 1];
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@ -557,7 +561,8 @@ static void runqueue()
|
||||
// now set up ghostview property on a window
|
||||
sprintf(tbuf, "0 0 0 0 %d %d 72 72 0 0 0 0",
|
||||
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()) {
|
||||
lyxerr << "Will set GHOSTVIEW property to ["
|
||||
@ -566,35 +571,37 @@ static void runqueue()
|
||||
// wait until property is deleted if executing multiple
|
||||
// ghostscripts
|
||||
for (;;) {
|
||||
// grab server to prevent other child interfering
|
||||
// with setting GHOSTVIEW property
|
||||
// grab server to prevent other child
|
||||
// interfering with setting GHOSTVIEW property
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "Grabbing the server" << endl;
|
||||
lyxerr << "Grabbing the server"
|
||||
<< endl;
|
||||
}
|
||||
XGrabServer(tempdisp);
|
||||
prop = XListProperties(tempdisp, fl_get_canvas_id(
|
||||
prop = XListProperties(tempdisp,
|
||||
fl_get_canvas_id(
|
||||
figinset_canvas), &nprop);
|
||||
if (!prop) break;
|
||||
|
||||
bool err = true;
|
||||
for (i = 0; i < nprop; ++i) {
|
||||
char * p = XGetAtomName(tempdisp, prop[i]);
|
||||
char * p = XGetAtomName(tempdisp,
|
||||
prop[i]);
|
||||
if (strcmp(p, "GHOSTVIEW") == 0) {
|
||||
err = false;
|
||||
break;
|
||||
}
|
||||
XFree(p);
|
||||
}
|
||||
XFree(reinterpret_cast<char *>(prop)); /* jc: */
|
||||
XFree(reinterpret_cast<char *>(prop)); // jc:
|
||||
if (err) break;
|
||||
// release the server
|
||||
XUngrabServer(tempdisp);
|
||||
XFlush(tempdisp);
|
||||
// ok, property found, we must wait until ghostscript
|
||||
// deletes it
|
||||
// ok, property found, we must wait until
|
||||
// ghostscript deletes it
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "Releasing the server" << endl;
|
||||
lyxerr << "["
|
||||
lyxerr << "Releasing the server\n["
|
||||
<< getpid()
|
||||
<< "] GHOSTVIEW property"
|
||||
" found. Waiting." << endl;
|
||||
@ -644,7 +651,8 @@ static void runqueue()
|
||||
|
||||
XChangeProperty(tempdisp,
|
||||
fl_get_canvas_id(figinset_canvas),
|
||||
XInternAtom(tempdisp, "GHOSTVIEW_COLORS", false),
|
||||
XInternAtom(tempdisp,
|
||||
"GHOSTVIEW_COLORS", false),
|
||||
XInternAtom(tempdisp, "STRING", false),
|
||||
8, PropModeReplace,
|
||||
reinterpret_cast<unsigned char*>(tbuf),
|
||||
@ -658,9 +666,10 @@ static void runqueue()
|
||||
|
||||
// set up environment
|
||||
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;
|
||||
memcpy(&env[1], environ, sizeof(char*)*(ne+1));
|
||||
memcpy(&env[1], environ, sizeof(char*) * (ne + 1));
|
||||
environ = env;
|
||||
|
||||
// now make gs command
|
||||
@ -676,8 +685,9 @@ static void runqueue()
|
||||
sprintf(tbuf, "%s/~lyxgs%d.ps", system_tempdir.c_str(),
|
||||
int(getpid()));
|
||||
if (lyxerr.debugging()) {
|
||||
printf("starting gs %s %s, pid: %d\n", tbuf,
|
||||
p->data->fname.c_str(), int(getpid()));
|
||||
lyxerr << "starting gs " << tbuf << " "
|
||||
<< p->data->fname
|
||||
<< ", pid: " << getpid() << endl;
|
||||
}
|
||||
|
||||
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
|
||||
queue * p = new queue;
|
||||
p->ofsx = psx;
|
||||
p->ofsy = psy;
|
||||
p->rx = (float(data->raw_wid) * 72.0)/pswid;
|
||||
p->ry = (float(data->raw_hgh) * 72.0)/pshgh;
|
||||
p->rx = (float(data->raw_wid) * 72.0) / pswid;
|
||||
p->ry = (float(data->raw_hgh) * 72.0) / pshgh;
|
||||
|
||||
p->data = data;
|
||||
p->next = 0;
|
||||
@ -758,8 +768,10 @@ static figdata * getfigdata(int wid, int hgh, string const & fname,
|
||||
if (bmpinsref > bmparrsize) {
|
||||
// allocate more space
|
||||
bmparrsize += figallocchunk;
|
||||
figdata ** tmp = static_cast<figdata**>(malloc(sizeof(figdata*)*bmparrsize));
|
||||
memcpy(tmp, bitmaps, sizeof(figdata*)*(bmparrsize-figallocchunk));
|
||||
figdata ** tmp = static_cast<figdata**>
|
||||
(malloc(sizeof(figdata*) * bmparrsize));
|
||||
memcpy(tmp, bitmaps,
|
||||
sizeof(figdata*) * (bmparrsize - figallocchunk));
|
||||
free(bitmaps);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
static void makeupdatelist(figdata *p)
|
||||
static void makeupdatelist(figdata * p)
|
||||
{
|
||||
for (int i = 0; i < figinsref; ++i)
|
||||
if (figures[i]->data == p) {
|
||||
@ -933,8 +945,10 @@ static void RegisterFigure(InsetFig *fi)
|
||||
if (figinsref > figarrsize) {
|
||||
// allocate more space
|
||||
figarrsize += figallocchunk;
|
||||
Figref **tmp = static_cast<Figref**>(malloc(sizeof(Figref*)*figarrsize));
|
||||
memcpy(tmp, figures, sizeof(Figref*)*(figarrsize-figallocchunk));
|
||||
Figref ** tmp = static_cast<Figref**>
|
||||
(malloc(sizeof(Figref*)*figarrsize));
|
||||
memcpy(tmp, figures,
|
||||
sizeof(Figref*)*(figarrsize-figallocchunk));
|
||||
free(figures);
|
||||
figures = tmp;
|
||||
}
|
||||
@ -1082,12 +1096,12 @@ void InsetFig::Draw(LyXFont font, LyXScreen & scr, int baseline, float & x)
|
||||
int(x),
|
||||
baseline - hgh - 1, wid+1, hgh+1);
|
||||
if (figure && figure->data) {
|
||||
if (figure->data->broken) msg = _("[render error]");
|
||||
else if (figure->data->reading) msg = _("[rendering ... ]");
|
||||
if (figure->data->broken) msg = _("[render error]");
|
||||
else if (figure->data->reading) msg = _("[rendering ... ]");
|
||||
} else
|
||||
if (fname.empty()) msg = _("[no file]");
|
||||
else if ((flags & 3) == 0) msg = _("[not displayed]");
|
||||
else if (lyxrc->ps_command.empty()) msg = _("[no ghostscript]");
|
||||
if (fname.empty()) msg = _("[no file]");
|
||||
else if ((flags & 3) == 0) msg = _("[not displayed]");
|
||||
else if (lyxrc->ps_command.empty()) msg = _("[no ghostscript]");
|
||||
|
||||
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);
|
||||
string justname = OnlyFilename (fname);
|
||||
font.drawString(justname, pm,
|
||||
baseline - font.maxAscent() - 4,
|
||||
int(x) + 8);
|
||||
baseline - font.maxAscent() - 4,
|
||||
int(x) + 8);
|
||||
font.setSize (LyXFont::SIZE_TINY);
|
||||
font.drawText (msg, strlen(msg), pm,
|
||||
baseline - 4,
|
||||
@ -1112,9 +1126,9 @@ void InsetFig::Write(ostream & os)
|
||||
Regenerate();
|
||||
os << "Figure size " << wid << " " << hgh << "\n";
|
||||
if (!fname.empty()) {
|
||||
string buf1 = OnlyPath(owner->fileName());
|
||||
string fname2 = MakeRelPath(fname, buf1);
|
||||
os << "file " << fname2 << "\n";
|
||||
string buf1 = OnlyPath(owner->fileName());
|
||||
string fname2 = MakeRelPath(fname, buf1);
|
||||
os << "file " << fname2 << "\n";
|
||||
}
|
||||
if (!subcaption.empty())
|
||||
os << "subcaption " << subcaption << "\n";
|
||||
@ -1234,7 +1248,7 @@ int InsetFig::Linuxdoc(string &/*file*/)
|
||||
|
||||
int InsetFig::DocBook(string & file)
|
||||
{
|
||||
string figurename= fname;
|
||||
string figurename = fname;
|
||||
|
||||
if(suffixIs(figurename, ".eps"))
|
||||
figurename.erase(fname.length() - 5);
|
||||
@ -1320,7 +1334,8 @@ Inset * InsetFig::Clone() const
|
||||
tmp->pshgh = pshgh;
|
||||
tmp->fname = fname;
|
||||
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,
|
||||
pswid, pshgh, raw_wid, raw_hgh,
|
||||
angle, flags & (3|8));
|
||||
@ -1453,7 +1468,7 @@ void InsetFig::Regenerate()
|
||||
if (subfigure) {
|
||||
if (!subcaption.empty())
|
||||
cmdbuf = "\\subfigure[" + subcaption +
|
||||
"]{" + cmdbuf + "}";
|
||||
"]{" + cmdbuf + "}";
|
||||
else
|
||||
cmdbuf = "\\subfigure{" + cmdbuf + "}";
|
||||
}
|
||||
@ -1584,7 +1599,7 @@ void InsetFig::TempRegenerate()
|
||||
if (!recmd.empty()) cmdbuf += '}';
|
||||
if (psubfigure && !tsubcap.empty()) {
|
||||
cmdbuf = string("\\subfigure{") + tsubcap
|
||||
+ string("}{") + cmdbuf + "}";
|
||||
+ string("}{") + cmdbuf + "}";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1646,7 +1661,8 @@ void InsetFig::Recompute()
|
||||
// compiler warnings.
|
||||
break;
|
||||
}
|
||||
if (htype && !wtype && frame_hgh) newx = newy*frame_wid/frame_hgh;
|
||||
if (htype && !wtype && frame_hgh)
|
||||
newx = newy*frame_wid/frame_hgh;
|
||||
} else {
|
||||
newx = wid;
|
||||
newy = hgh;
|
||||
@ -1682,7 +1698,8 @@ void InsetFig::Recompute()
|
||||
figdata * pf = figure->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"
|
||||
// chosen (Matthias 260696)
|
||||
figure->data = getfigdata(wid, hgh, fname,
|
||||
@ -1779,7 +1796,7 @@ void InsetFig::CallbackFig(long arg)
|
||||
char const * p;
|
||||
|
||||
if (lyxerr.debugging()) {
|
||||
printf("Figure callback, arg %ld\n", arg);
|
||||
lyxerr << "Figure callback, arg " << arg << endl;
|
||||
}
|
||||
|
||||
switch (arg) {
|
||||
@ -2123,15 +2140,15 @@ void InsetFig::BrowseFile()
|
||||
buf = MakeAbsPath(p, buf2);
|
||||
buf = OnlyPath(buf);
|
||||
} else {
|
||||
buf = OnlyPath(owner->fileName().c_str());
|
||||
buf = OnlyPath(owner->fileName().c_str());
|
||||
}
|
||||
|
||||
// Does user clipart directory exist?
|
||||
string bufclip = AddName (user_lyxdir, "clipart");
|
||||
FileInfo fileInfo(bufclip);
|
||||
if (!(fileInfo.isOK() && fileInfo.isDir()))
|
||||
// No - bail out to system clipart directory
|
||||
bufclip = AddName (system_lyxdir, "clipart");
|
||||
// No - bail out to system clipart directory
|
||||
bufclip = AddName (system_lyxdir, "clipart");
|
||||
|
||||
|
||||
fileDlg.SetButton(0, _("Clipart"), bufclip);
|
||||
@ -2141,7 +2158,8 @@ void InsetFig::BrowseFile()
|
||||
do {
|
||||
ProhibitInput();
|
||||
if (once) {
|
||||
p = fileDlg.Select(_("EPS Figure"), current_figure_path,
|
||||
p = fileDlg.Select(_("EPS Figure"),
|
||||
current_figure_path,
|
||||
"*ps", string());
|
||||
} else {
|
||||
p = fileDlg.Select(_("EPS Figure"), buf,
|
||||
@ -2157,11 +2175,13 @@ void InsetFig::BrowseFile()
|
||||
|
||||
if (contains(p, "#") || contains(p, "~") || contains(p, "$")
|
||||
|| contains(p, "%") || contains(p, " "))
|
||||
{
|
||||
WriteAlert(_("Filename can't contain any of these characters:"), // xgettext:no-c-format
|
||||
_("space, '#', '~', '$' or '%'."));
|
||||
error = true;
|
||||
}
|
||||
{
|
||||
WriteAlert(_("Filename can't contain any "
|
||||
"of these characters:"),
|
||||
// xgettext:no-c-format
|
||||
_("space, '#', '~', '$' or '%'."));
|
||||
error = true;
|
||||
}
|
||||
} while (error);
|
||||
|
||||
if (form) fl_set_input(form->EpsFile, buf.c_str());
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <fstream>
|
||||
@ -28,7 +27,7 @@ FD_citation_form * citation_form = 0;
|
||||
FD_bibitem_form * bibitem_form = 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 *);
|
||||
FD_citation_form * create_form_citation_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
|
||||
{
|
||||
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->setOptions(fl_get_input(bibitem_form->label));
|
||||
fl_hide_form(bibitem_form->bibitem_form);
|
||||
// Does look like a hack? It is! (but will change at 0.13)
|
||||
#ifdef MOVE_TEXT
|
||||
current_view->text->RedoParagraph();
|
||||
current_view->update(1);
|
||||
#else
|
||||
current_view->buffer()->text->RedoParagraph();
|
||||
current_view->buffer()->update(1);
|
||||
#endif
|
||||
break;
|
||||
} // 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)
|
||||
{
|
||||
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);
|
||||
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:"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_RIGHT);
|
||||
|
||||
bibcombox = new Combox(FL_COMBOX_INPUT);
|
||||
bibcombox->add(80, 10, 130, 30, 120);
|
||||
|
||||
obj = fl_add_button(FL_RETURN_BUTTON, 20, 90, 90, 30, _("OK"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, bibitem_cb, 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, bibitem_cb, 1);
|
||||
obj = fl_add_button(FL_NORMAL_BUTTON, 120, 90, 90, 30, idex(_("Cancel|^[")));
|
||||
fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, bibitem_cb, 0);
|
||||
fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, bibitem_cb, 0);
|
||||
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_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_input_shortcut(obj, scex(_("Remark:|#R")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_end_form();
|
||||
|
||||
//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)
|
||||
{
|
||||
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);
|
||||
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")));
|
||||
fl_set_input_shortcut(obj, scex(_("Key:|#K")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_input_shortcut(obj, scex(_("Key:|#K")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
obj = fl_add_button(FL_RETURN_BUTTON, 20, 90, 90, 30, _("OK"));
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, bibitem_cb, 3);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, bibitem_cb, 3);
|
||||
obj = fl_add_button(FL_NORMAL_BUTTON, 120, 90, 90, 30, idex(_("Cancel|^[")));
|
||||
fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, bibitem_cb, 2);
|
||||
fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, bibitem_cb, 2);
|
||||
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_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_input_shortcut(obj, scex(_("Label:|#L")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_end_form();
|
||||
|
||||
//fdui->bibitem_form->fdui = fdui;
|
||||
@ -175,7 +169,8 @@ void InsetCitation::Edit(int, int)
|
||||
if (citation_form->citation_form->visible) {
|
||||
fl_raise_form(citation_form->citation_form);
|
||||
} 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"));
|
||||
}
|
||||
}
|
||||
@ -215,7 +210,7 @@ InsetBibKey::~InsetBibKey()
|
||||
{
|
||||
if(bibitem_form && bibitem_form->bibitem_form
|
||||
&& bibitem_form->bibitem_form->visible)
|
||||
fl_hide_form(bibitem_form->bibitem_form);
|
||||
fl_hide_form(bibitem_form->bibitem_form);
|
||||
}
|
||||
|
||||
void InsetBibKey::setCounter(int c)
|
||||
@ -484,7 +479,7 @@ int bibitemMaxWidth(LyXFont const & font)
|
||||
while (par) {
|
||||
if (par->bibkey) {
|
||||
int wx = par->bibkey->Width(font);
|
||||
if (wx>w) w = wx;
|
||||
if (wx > w) w = wx;
|
||||
}
|
||||
par = par->next;
|
||||
}
|
||||
@ -504,7 +499,7 @@ string bibitemWidthest()
|
||||
while (par) {
|
||||
if (par->bibkey) {
|
||||
int wx = par->bibkey->Width(font);
|
||||
if (wx>w) {
|
||||
if (wx > w) {
|
||||
w = wx;
|
||||
bkey = par->bibkey;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ extern LyXRC * lyxrc;
|
||||
|
||||
/* LatexAccent. Proper handling of accented characters */
|
||||
/* 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()
|
||||
{
|
||||
@ -33,13 +33,13 @@ InsetLatexAccent::InsetLatexAccent()
|
||||
|
||||
|
||||
InsetLatexAccent::InsetLatexAccent(InsetLatexAccent const & other)
|
||||
: Inset(), contents(other.contents),
|
||||
candisp(other.candisp),
|
||||
modtype(other.modtype),
|
||||
remdot(other.remdot),
|
||||
plusasc(other.plusasc),
|
||||
plusdesc(other.plusdesc),
|
||||
ic(other.ic)
|
||||
: Inset(), contents(other.contents),
|
||||
candisp(other.candisp),
|
||||
modtype(other.modtype),
|
||||
remdot(other.remdot),
|
||||
plusasc(other.plusasc),
|
||||
plusdesc(other.plusdesc),
|
||||
ic(other.ic)
|
||||
{}
|
||||
|
||||
|
||||
@ -199,7 +199,7 @@ void InsetLatexAccent::checkContents()
|
||||
|
||||
// special clause for \i{}, \j{} \l{} and \L{}
|
||||
if ((modtype == DOT_LESS_I || modtype == DOT_LESS_J
|
||||
|| modtype == lSLASH || modtype == LSLASH)
|
||||
|| modtype == lSLASH || modtype == LSLASH)
|
||||
&& contents[3] == '}' ) {
|
||||
switch (modtype) {
|
||||
case DOT_LESS_I: ic = 'i'; break;
|
||||
@ -218,7 +218,7 @@ void InsetLatexAccent::checkContents()
|
||||
<< ", bot: " << plusdesc
|
||||
<< ", dot: " << remdot
|
||||
<< ", mod: " << modtype << endl;
|
||||
// Special case for space
|
||||
// Special case for space
|
||||
} else if (contents[3] == '}') {
|
||||
ic = ' ';
|
||||
} else {
|
||||
@ -235,15 +235,16 @@ void InsetLatexAccent::checkContents()
|
||||
else
|
||||
return;
|
||||
} else if ( (ic == 'i'|| ic == 'j') && contents[4] == '}') {
|
||||
// Do a rewrite: \<foo>{i} --> \<foo>{\i}
|
||||
string temp = contents;
|
||||
temp.erase(3, string::npos);
|
||||
temp += '\\';
|
||||
temp += char(ic);
|
||||
for(string::size_type j = 4; j < contents.length(); ++j)
|
||||
// Do a rewrite: \<foo>{i} --> \<foo>{\i}
|
||||
string temp = contents;
|
||||
temp.erase(3, string::npos);
|
||||
temp += '\\';
|
||||
temp += char(ic);
|
||||
for(string::size_type j = 4;
|
||||
j < contents.length(); ++j)
|
||||
temp+= contents[j];
|
||||
contents= temp;
|
||||
++i;
|
||||
contents= temp;
|
||||
++i;
|
||||
remdot = true;
|
||||
}
|
||||
|
||||
@ -320,9 +321,9 @@ int InsetLatexAccent::Rbearing(LyXFont const & font) const
|
||||
|
||||
|
||||
bool InsetLatexAccent::DisplayISO8859_9(LyXFont font,
|
||||
LyXScreen & scr,
|
||||
int baseline,
|
||||
float & x)
|
||||
LyXScreen & scr,
|
||||
int baseline,
|
||||
float & x)
|
||||
{
|
||||
unsigned char tmpic = ic;
|
||||
|
||||
@ -337,8 +338,8 @@ bool InsetLatexAccent::DisplayISO8859_9(LyXFont font,
|
||||
}
|
||||
case BREVE:
|
||||
{ if (ic == 'g') tmpic = 0xf0;
|
||||
if (ic == 'G') tmpic = 0xd0;
|
||||
break;
|
||||
if (ic == 'G') tmpic = 0xd0;
|
||||
break;
|
||||
}
|
||||
case UMLAUT:
|
||||
{
|
||||
@ -476,7 +477,7 @@ void InsetLatexAccent::Draw(LyXFont font,
|
||||
case UNDERDOT: // underdot
|
||||
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);
|
||||
break;
|
||||
}
|
||||
@ -541,9 +542,9 @@ void InsetLatexAccent::Draw(LyXFont font,
|
||||
{
|
||||
float tmpadd = y;
|
||||
tmpadd += (remdot) ?
|
||||
asc/3.0 :
|
||||
asc/5.0; // if (remdot) -> i or j
|
||||
float rad = ((hg * 4.0) / 8.0);
|
||||
asc / 3.0 :
|
||||
asc / 5.0; // if (remdot) -> i or j
|
||||
float rad = hg / 2.0;
|
||||
if (rad <= 1.0) {
|
||||
scr.drawPoint(pgc,
|
||||
int(x2 - ((4.0 * hg) / 7.0)),
|
||||
@ -552,12 +553,15 @@ void InsetLatexAccent::Draw(LyXFont font,
|
||||
int(x2 + ((4.0 * hg) / 7.0)),
|
||||
tmpadd);
|
||||
} 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,
|
||||
rad - 1, rad - 1, 0, 360*64);
|
||||
scr.drawArc(pgc, int(x2 + ((2.0 * hg) / 4.0)),
|
||||
rad, rad, 0, 360*64);
|
||||
scr.fillArc(pgc, int(x2 + ((2.0 * hg) / 4.0)),
|
||||
tmpadd,
|
||||
rad - 1, rad - 1, 0, 360*64);
|
||||
rad, rad, 0, 360*64);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ extern "C" void C_Intl_DispatchCallback(FL_OBJECT * ob, long code);
|
||||
|
||||
Intl::Intl()
|
||||
: prim_lang(lyxrc->primary_kbmap),
|
||||
sec_lang(lyxrc->secondary_kbmap),
|
||||
trans(new TransManager)
|
||||
sec_lang(lyxrc->secondary_kbmap),
|
||||
trans(new TransManager)
|
||||
{
|
||||
keymapon = lyxrc->use_kbmap;
|
||||
chsetcode = 0;
|
||||
|
194
src/kbmap.C
194
src/kbmap.C
@ -39,31 +39,17 @@ enum { ModsMask = ShiftMask | ControlMask | Mod1Mask};
|
||||
maxlen - length of string (including '\0')
|
||||
Returns : length of printed string if ok, 0 otherwise.
|
||||
\* ---F------------------------------------------------------------------- */
|
||||
|
||||
static
|
||||
int printKeysym( KeySym key, unsigned int mod, char *buf, int maxlen )
|
||||
void printKeysym( KeySym key, unsigned int mod, string & buf)
|
||||
{
|
||||
mod &= ModsMask;
|
||||
|
||||
// calc required length;
|
||||
int len = 0;
|
||||
if ( mod & ShiftMask ) len += 2;
|
||||
if ( mod & ControlMask ) len += 2;
|
||||
if ( mod & Mod1Mask ) len += 2;
|
||||
char * s = XKeysymToString(key);
|
||||
|
||||
char * s = XKeysymToString( key );
|
||||
if ( s ) len += strlen( s );
|
||||
if ( len < maxlen ) {
|
||||
if ( mod & ShiftMask ) {
|
||||
*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;
|
||||
if (mod & ShiftMask) buf += "S-";
|
||||
if (mod & ControlMask) buf += "C-";
|
||||
if (mod & Mod1Mask) buf += "M-";
|
||||
if (s) buf += s;
|
||||
}
|
||||
|
||||
|
||||
@ -78,41 +64,23 @@ int printKeysym( KeySym key, unsigned int mod, char *buf, int maxlen )
|
||||
\* ---F------------------------------------------------------------------- */
|
||||
|
||||
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;
|
||||
|
||||
/* -------> Print each of the slots into buf. */
|
||||
for( ; (tabPt->code & 0xffff) != NoSymbol; ++tabPt) {
|
||||
if ( maxLen <= 0 ) break;
|
||||
|
||||
ksym = tabPt->code;
|
||||
mod = tabPt->mod & 0xffff;
|
||||
|
||||
len = printKeysym( ksym, mod, buf, maxLen );
|
||||
if ( len <= 0 ) break;
|
||||
buf += len;
|
||||
maxLen -= len;
|
||||
doneLen += len;
|
||||
|
||||
/* -------> Add space when possible. */
|
||||
if ( maxLen > 0 ) {
|
||||
*buf++ = ' ';
|
||||
*buf = '\0';
|
||||
maxLen--;
|
||||
doneLen++;
|
||||
}
|
||||
printKeysym(ksym, mod, buf);
|
||||
buf += ' ';
|
||||
}
|
||||
return doneLen;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// === kb_sequence methods ================================================
|
||||
|
||||
|
||||
|
||||
/* ---F+------------------------------------------------------------------ *\
|
||||
Function : kb_sequence::addkey
|
||||
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)
|
||||
\* ---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 + 1 >= size) {
|
||||
unsigned int * nseq = new unsigned int[size+KB_PREALLOC];
|
||||
unsigned int * nseq = new unsigned int[size + KB_PREALLOC];
|
||||
size += KB_PREALLOC;
|
||||
memcpy(nseq, sequence, length * sizeof(unsigned int));
|
||||
if(sequence != staticseq) delete sequence;
|
||||
@ -209,7 +178,7 @@ int kb_sequence::parse(char const * s)
|
||||
}
|
||||
} else {
|
||||
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] = '\0';
|
||||
@ -242,11 +211,10 @@ int kb_sequence::parse(char const * s)
|
||||
Returns : 0, if ok, -1 if string too long
|
||||
\* ---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;
|
||||
unsigned int mod;
|
||||
int len;
|
||||
int l = length;
|
||||
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];
|
||||
mod = modifiers[i] & 0xffff;
|
||||
|
||||
len = printKeysym( key, mod, buf, maxlen ); // RVDK_PATCH_5
|
||||
buf += len;
|
||||
maxlen -= len;
|
||||
|
||||
if ( len == 0 ) {
|
||||
*buf = '\0';
|
||||
return -1;
|
||||
}
|
||||
printKeysym(key, mod, buf); // RVDK_PATCH_5
|
||||
|
||||
if(i+1<l && maxlen>1) { // append a blank
|
||||
*buf++ = ' ';
|
||||
maxlen--;
|
||||
if(i + 1 < l) { // append a blank
|
||||
buf += ' ';
|
||||
}
|
||||
}
|
||||
*buf = '\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
|
||||
\* ---F------------------------------------------------------------------- */
|
||||
|
||||
int kb_sequence::printOptions(char * buf, int maxlen) const
|
||||
int kb_sequence::printOptions(string & buf) const
|
||||
{
|
||||
print(buf, maxlen, true);
|
||||
int len = strlen(buf);
|
||||
maxlen -= len;
|
||||
buf += len;
|
||||
print(buf, true);
|
||||
|
||||
if ( maxlen < 20 || !curmap ) return -1;
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning reimplement kb_sequence using string
|
||||
#endif
|
||||
char s[20];
|
||||
strcpy(s, _(" options: "));
|
||||
strcpy( buf, s);
|
||||
buf += strlen(s);
|
||||
maxlen -= strlen(s);
|
||||
|
||||
curmap->print(buf, maxlen);
|
||||
if (!curmap) return -1;
|
||||
buf += _(" options: ");
|
||||
curmap->print(buf);
|
||||
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)
|
||||
{
|
||||
unsigned int hashval, ksym, msk1, msk0;
|
||||
#ifndef NO_HASH
|
||||
unsigned int hashval;
|
||||
#endif
|
||||
unsigned int ksym, msk1, msk0;
|
||||
kb_key * tab;
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
#ifndef NO_HASH
|
||||
if(size < 0) { // --- if hash table ---
|
||||
hashval = ((key&0xff) ^ ((key>>8)&0xff)) % KB_HASHSIZE;
|
||||
tab = htable[hashval];
|
||||
@ -424,6 +376,7 @@ int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence * seq)
|
||||
return -1;
|
||||
}
|
||||
} else // --- else: linear list ---
|
||||
#endif
|
||||
tab = table;
|
||||
|
||||
// --- 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) {
|
||||
// match found:
|
||||
if(tab->table) {
|
||||
// this is a prefix key - set new map
|
||||
// this is a prefix key - set new map
|
||||
seq->curmap = tab->table;
|
||||
return 0;
|
||||
} else {
|
||||
// final key - reset map
|
||||
// final key - reset map
|
||||
seq->curmap = seq->stdmap;
|
||||
seq->delseq();
|
||||
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.
|
||||
\* ---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.
|
||||
Else, place a terminating newline in case no other output is generated. */
|
||||
|
||||
if ( maxLen <= 3 || !buf ) return maxLen;
|
||||
if ( !table ) return maxLen;
|
||||
*buf = '\0';
|
||||
// Return when keymap has no table.
|
||||
if (!table) return;
|
||||
|
||||
/* -------> Hash table. Process each of its slots recursively and return. */
|
||||
if ( size < 0 ) {
|
||||
for ( int ix = 0; (ix < KB_HASHSIZE) && (maxLen > 1); ++ix ) {
|
||||
// Process each of its slots recursively and return.
|
||||
#ifndef NO_HASH
|
||||
if ( size < 0 ) { // Hash table
|
||||
for ( int ix = 0; ix < KB_HASHSIZE; ++ix ) {
|
||||
if ( htable[ix] ) {
|
||||
int len = printKeyTab( htable[ix], buf, maxLen );
|
||||
maxLen -= len;
|
||||
buf += len;
|
||||
printKeyTab(htable[ix], buf);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* -------> Normal table. */
|
||||
int len = printKeyTab( table, buf, maxLen );
|
||||
maxLen -= len;
|
||||
buf += len;
|
||||
}
|
||||
return maxLen;
|
||||
} else // Normal table
|
||||
#endif
|
||||
printKeyTab(table, buf);
|
||||
}
|
||||
|
||||
|
||||
@ -502,13 +446,13 @@ int kb_keymap::print(char * buf, int maxLen) const
|
||||
Returns : 0 if ok.
|
||||
\* ---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];
|
||||
if(code == NoSymbol) return -1;
|
||||
|
||||
unsigned int modmsk = seq->modifiers[idx];
|
||||
kb_key *tab, **ptab;
|
||||
kb_key * tab, ** ptab;
|
||||
// --- get list------------------------------------------------------
|
||||
if(!table) {
|
||||
// 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;
|
||||
ptab = &table;
|
||||
size = KB_PREALLOC;
|
||||
} else if(size<0) {
|
||||
#ifndef NO_HASH
|
||||
} else if(size < 0) {
|
||||
// Hash table.
|
||||
int hashval = (code&0xffff);
|
||||
hashval = ((hashval&0xff) ^ ((hashval>>8)&0xff)) % KB_HASHSIZE;
|
||||
int hashval = code & 0xffff;
|
||||
hashval = ((hashval & 0xff) ^ ((hashval >> 8) & 0xff)) % KB_HASHSIZE;
|
||||
tab = htable[hashval];
|
||||
ptab = htable+hashval;
|
||||
if(!tab) {
|
||||
@ -528,6 +473,7 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
|
||||
tab[0].code = NoSymbol;
|
||||
*ptab = tab;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
tab = 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) {
|
||||
if(code == t->code && modmsk == t->mod) { // -- overwrite binding ---
|
||||
if(idx+1 == seq->length) {
|
||||
char buf[20]; buf[0] = 0;
|
||||
seq->print(buf, 20, true);
|
||||
string buf;
|
||||
seq->print(buf, true);
|
||||
lyxerr[Debug::KEY]
|
||||
<< "Warning: New binding for '"
|
||||
<< buf
|
||||
@ -555,28 +501,28 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
|
||||
t->action = action;
|
||||
return 0;
|
||||
} else if (!t->table) {
|
||||
char buf[20]; buf[0] = 0;
|
||||
seq->print(buf, 20, true);
|
||||
string buf;
|
||||
seq->print(buf, true);
|
||||
lyxerr << "Error: New binding for '" << buf
|
||||
<< "' is overriding old binding..."
|
||||
<< endl;
|
||||
return -1;
|
||||
} else
|
||||
return t->table->defkey(seq, action, idx+1);
|
||||
return t->table->defkey(seq, action, idx + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// --- extend list if necessary -------------------------------------
|
||||
|
||||
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)
|
||||
nt[tsize].table = 0;
|
||||
memcpy(nt, tab, tsize * sizeof(kb_key));
|
||||
*ptab = nt;
|
||||
delete[] tab;
|
||||
tab = nt;
|
||||
if(size>= 0) size = tsize + KB_PREALLOC;
|
||||
if(size >= 0) size = tsize + KB_PREALLOC;
|
||||
}
|
||||
|
||||
// --- 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 ----------------------
|
||||
|
||||
#ifndef NO_HASH
|
||||
if(size >= 0 && tsize >= 32) {
|
||||
kb_key * oldtab = tab;
|
||||
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;
|
||||
}
|
||||
|
||||
#endif
|
||||
// --- define rest of sequence --------------------------------------
|
||||
|
||||
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()
|
||||
{
|
||||
if(!table) return;
|
||||
#ifndef NO_HASH
|
||||
if(size < 0) {
|
||||
for(int i = 0; i < KB_HASHSIZE; ++i) {
|
||||
if(htable[i]) {
|
||||
@ -668,25 +616,32 @@ kb_keymap::~kb_keymap()
|
||||
}
|
||||
delete htable;
|
||||
} else {
|
||||
#endif
|
||||
for(kb_key * t = table; t->code != NoSymbol; ++t)
|
||||
if(t->table)
|
||||
delete t->table;
|
||||
delete table;
|
||||
#ifndef NO_HASH
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
string keyname(kb_key k) {
|
||||
char buf[100];
|
||||
printKeysym(k.code, k.mod, buf, 100);
|
||||
|
||||
string keyname(kb_key k)
|
||||
{
|
||||
string buf;
|
||||
printKeysym(k.code, k.mod, 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) {
|
||||
for(int i = 0; i < KB_HASHSIZE; ++i) {
|
||||
if(htable[i]) {
|
||||
@ -707,6 +662,7 @@ string kb_keymap::findbinding(int act) const {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
for(kb_key * t = table; t->code != NoSymbol; ++t) {
|
||||
if(t->table) {
|
||||
string suffix = t->table->findbinding(act);
|
||||
@ -720,7 +676,9 @@ string kb_keymap::findbinding(int act) const {
|
||||
res += "[" + keyname(*t) + "] ";
|
||||
}
|
||||
}
|
||||
#ifndef NO_HASH
|
||||
}
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
|
36
src/kbmap.h
36
src/kbmap.h
@ -17,10 +17,13 @@
|
||||
|
||||
#include "LString.h"
|
||||
|
||||
#define NO_HASH 1
|
||||
|
||||
#define KB_PREALLOC 16
|
||||
#ifndef NO_HASH
|
||||
#define KB_HASHSIZE 128 // yes, yes - I know. 128 is not exactly prime :-)
|
||||
// ... but we are dealing with ASCII chars mostly.
|
||||
|
||||
#endif
|
||||
class kb_keymap;
|
||||
class kb_sequence;
|
||||
|
||||
@ -53,11 +56,11 @@ public:
|
||||
|
||||
/// Bind a key-sequence to an action
|
||||
/** Returns 0 on success. Otherwise, position in string where
|
||||
error occured. */
|
||||
error occured. */
|
||||
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
|
||||
int lookup(KeySym key, unsigned mod, kb_sequence * seq);
|
||||
@ -69,18 +72,21 @@ private:
|
||||
int defkey(kb_sequence * seq, int action, int idx = 0);
|
||||
|
||||
/// Size of the table (<0: hashtab)
|
||||
int size;
|
||||
int size;
|
||||
|
||||
/// Holds the defined keys
|
||||
/** Both kinds of tables ends with NoSymbol */
|
||||
#ifndef NO_HASH
|
||||
union
|
||||
{
|
||||
#endif
|
||||
/// Table for linear array
|
||||
kb_key * table;
|
||||
|
||||
#ifndef NO_HASH
|
||||
/// Hash table holding key lists
|
||||
kb_key ** htable;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@ -101,23 +107,23 @@ public:
|
||||
|
||||
///
|
||||
~kb_sequence()
|
||||
{
|
||||
if (sequence != staticseq) {
|
||||
delete sequence;
|
||||
delete modifiers;
|
||||
{
|
||||
if (sequence != staticseq) {
|
||||
delete sequence;
|
||||
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
|
||||
if the latter is defined. */
|
||||
if the latter is defined. */
|
||||
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
|
||||
void delseq();
|
||||
|
11
src/layout.h
11
src/layout.h
@ -82,6 +82,8 @@ enum LyXAlignment {
|
||||
///
|
||||
LYX_ALIGN_SPECIAL = 32
|
||||
};
|
||||
|
||||
|
||||
inline void operator|=(LyXAlignment & la1, LyXAlignment la2) {
|
||||
la1 = static_cast<LyXAlignment>(la1 | la2);
|
||||
}
|
||||
@ -187,7 +189,9 @@ public:
|
||||
string const & labelstring() const { return labelstring_; }
|
||||
string const & preamble() const { return preamble_; }
|
||||
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.
|
||||
The main font for this kind of environment. If an attribute has
|
||||
LyXFont::INHERITED_*, it means that the value is specified by
|
||||
@ -290,7 +294,7 @@ public:
|
||||
}
|
||||
///
|
||||
bool isCommand() const {
|
||||
return latextype == LATEX_COMMAND;
|
||||
return latextype == LATEX_COMMAND;
|
||||
}
|
||||
///
|
||||
bool isEnvironment() const {
|
||||
@ -475,12 +479,14 @@ private:
|
||||
bool loaded;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
inline void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2)
|
||||
{
|
||||
p1 = static_cast<LyXTextClass::Provides>(p1 | p2);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
inline ostream & operator<<(ostream & os, LyXTextClass::PageSides p)
|
||||
{
|
||||
@ -495,6 +501,7 @@ inline ostream & operator<<(ostream & os, LyXTextClass::PageSides p)
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
class LyXTextClassList {
|
||||
public:
|
||||
|
820
src/lyx_cb.C
820
src/lyx_cb.C
File diff suppressed because it is too large
Load Diff
@ -63,12 +63,13 @@ bool setForegroundColor(char const * const color, XGCValues & val)
|
||||
if (!mono_video) {
|
||||
if (XParseColor(fl_display, color_map, color, &xcol)
|
||||
&& XAllocColor(fl_display, color_map, &xcol))
|
||||
{
|
||||
val.foreground = xcol.pixel;
|
||||
} else {
|
||||
lyxerr << "LyX: Couldn't get color " << color << endl;
|
||||
return false;
|
||||
}
|
||||
{
|
||||
val.foreground = xcol.pixel;
|
||||
} else {
|
||||
lyxerr << "LyX: Couldn't get color "
|
||||
<< color << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -79,14 +80,14 @@ void do_reverse_video(XGCValues &val)
|
||||
{
|
||||
if (reverse_video) {
|
||||
val.foreground= WhitePixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
DefaultScreen(fl_display));
|
||||
val.background= BlackPixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
DefaultScreen(fl_display));
|
||||
} else {
|
||||
val.foreground= BlackPixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
DefaultScreen(fl_display));
|
||||
val.background= WhitePixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
DefaultScreen(fl_display));
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,17 +146,22 @@ GC GetLatexGC()
|
||||
|
||||
XGCValues val;
|
||||
if (reverse_video ^ mono_video) {
|
||||
val.foreground= WhitePixel(fl_display, DefaultScreen(fl_display));
|
||||
val.background= BlackPixel(fl_display, DefaultScreen(fl_display));
|
||||
val.foreground= WhitePixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
val.background= BlackPixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
} else {
|
||||
val.foreground= BlackPixel(fl_display, DefaultScreen(fl_display));
|
||||
val.background= WhitePixel(fl_display, DefaultScreen(fl_display));
|
||||
val.foreground= BlackPixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
val.background= WhitePixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
}
|
||||
val.function= GXcopy;
|
||||
val.graphics_exposures = false;
|
||||
setForegroundColor(latex_color, val);
|
||||
latex_gc = XCreateGC(fl_display, fl_root, GCBackground
|
||||
| GCForeground | GCFunction | GCGraphicsExposures,
|
||||
| GCForeground | GCFunction
|
||||
| GCGraphicsExposures,
|
||||
&val);
|
||||
XFlush(fl_display);
|
||||
|
||||
@ -216,14 +222,14 @@ GC GetClearGC()
|
||||
|
||||
if (reverse_video) {
|
||||
val.foreground= BlackPixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
DefaultScreen(fl_display));
|
||||
val.background= WhitePixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
DefaultScreen(fl_display));
|
||||
} else {
|
||||
val.background= BlackPixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
DefaultScreen(fl_display));
|
||||
val.foreground= WhitePixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
DefaultScreen(fl_display));
|
||||
}
|
||||
val.function = GXcopy;
|
||||
val.graphics_exposures = false;
|
||||
@ -233,7 +239,8 @@ GC GetClearGC()
|
||||
background_pixels = val.foreground;
|
||||
|
||||
clear_gc = XCreateGC(fl_display, fl_root, GCBackground
|
||||
| GCForeground | GCFunction | GCGraphicsExposures,
|
||||
| GCForeground | GCFunction
|
||||
| GCGraphicsExposures,
|
||||
&val);
|
||||
XFlush(fl_display);
|
||||
|
||||
@ -276,7 +283,8 @@ GC GetThickLineGC()
|
||||
val.line_width = 2;
|
||||
val.line_style = LineSolid;
|
||||
thick_line_gc = XCreateGC(fl_display, fl_root, GCBackground
|
||||
| GCForeground | GCFunction | GCGraphicsExposures
|
||||
| GCForeground | GCFunction
|
||||
| GCGraphicsExposures
|
||||
| GCLineWidth | GCLineStyle , &val);
|
||||
XFlush(fl_display);
|
||||
|
||||
@ -339,7 +347,7 @@ GC GetSelectGC()
|
||||
val.function= GXinvert;
|
||||
select_gc = XCreateGC(fl_display, fl_root,
|
||||
GCFunction | GCGraphicsExposures | GCPlaneMask
|
||||
| GCLineWidth | GCLineStyle , &val);
|
||||
| GCLineWidth | GCLineStyle , &val);
|
||||
XFlush(fl_display);
|
||||
|
||||
return select_gc;
|
||||
@ -355,14 +363,14 @@ GC GetSelectionGC()
|
||||
|
||||
if (!reverse_video) {
|
||||
val.foreground= BlackPixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
DefaultScreen(fl_display));
|
||||
val.background= WhitePixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
DefaultScreen(fl_display));
|
||||
} else {
|
||||
val.background= BlackPixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
DefaultScreen(fl_display));
|
||||
val.foreground= WhitePixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
DefaultScreen(fl_display));
|
||||
}
|
||||
|
||||
val.function= GXcopy;
|
||||
@ -389,9 +397,11 @@ GC GetLightedGC()
|
||||
if (lighted_gc) return lighted_gc;
|
||||
XGCValues val;
|
||||
if (reverse_video) {
|
||||
val.background= BlackPixel(fl_display, DefaultScreen(fl_display));
|
||||
val.background= BlackPixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
} else {
|
||||
val.background= WhitePixel(fl_display, DefaultScreen(fl_display));
|
||||
val.background= WhitePixel(fl_display,
|
||||
DefaultScreen(fl_display));
|
||||
}
|
||||
val.foreground= val.background;
|
||||
val.function= GXcopy;
|
||||
@ -400,7 +410,8 @@ GC GetLightedGC()
|
||||
val.line_width = 0;
|
||||
setForegroundColor(lighted_color, val);
|
||||
lighted_gc = XCreateGC(fl_display, fl_root, GCBackground
|
||||
| GCForeground | GCFunction | GCGraphicsExposures
|
||||
| GCForeground | GCFunction
|
||||
| GCGraphicsExposures
|
||||
| GCLineWidth | GCLineStyle , &val);
|
||||
XFlush(fl_display);
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* 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
|
||||
// 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
|
||||
// later.
|
||||
// later.
|
||||
#ifdef ON
|
||||
#undef ON
|
||||
#endif
|
||||
@ -39,11 +39,11 @@ class LyXLex;
|
||||
class LyXFont {
|
||||
public:
|
||||
/** The value INHERIT_* means that the font attribute is
|
||||
inherited from the layout. In the case of layout fonts, the
|
||||
attribute is inherited from the default font.
|
||||
The value IGNORE_* is used with LyXFont::update() when the
|
||||
attribute should not be changed.
|
||||
*/
|
||||
inherited from the layout. In the case of layout fonts, the
|
||||
attribute is inherited from the default font.
|
||||
The value IGNORE_* is used with LyXFont::update() when the
|
||||
attribute should not be changed.
|
||||
*/
|
||||
enum FONT_FAMILY {
|
||||
///
|
||||
ROMAN_FAMILY, // fontstruct rely on this to be 0
|
||||
@ -272,7 +272,7 @@ public:
|
||||
string latexSize() const;
|
||||
|
||||
/** 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
|
||||
* will have the effect that the properties is reset to the
|
||||
@ -284,7 +284,7 @@ public:
|
||||
void update(LyXFont const & newfont, bool toggleall = false);
|
||||
|
||||
/** 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);
|
||||
|
||||
/// Realize font from a template (INHERIT are realized)
|
||||
@ -307,7 +307,7 @@ public:
|
||||
int latexWriteStartChanges(string &, LyXFont const & base) const;
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
int latexWriteEndChanges(string &, LyXFont const & base) const;
|
||||
@ -374,15 +374,15 @@ private:
|
||||
typedef unsigned int ui32;
|
||||
|
||||
/** Representation: bit table
|
||||
Layout of bit table:
|
||||
11 1111 111 122 222 222 2233
|
||||
Bit 012 34 567 8901 2345 678 901 234 567 8901
|
||||
FFF SS SSS SSSS CCCC EEE UUU NNN LLL
|
||||
aaa ee hhh iiii oooo mmm nnn ooo aaa
|
||||
mmm rr aaa zzzz llll ppp ddd uuu ttt
|
||||
Layout of bit table:
|
||||
11 1111 111 122 222 222 2233
|
||||
Bit 012 34 567 8901 2345 678 901 234 567 8901
|
||||
FFF SS SSS SSSS CCCC EEE UUU NNN LLL
|
||||
aaa ee hhh iiii oooo mmm nnn ooo aaa
|
||||
mmm rr aaa zzzz llll ppp ddd uuu ttt
|
||||
|
||||
Some might think this is a dirty representation, but it gives
|
||||
us at least 25% speed-up, so why not?
|
||||
Some might think this is a dirty representation, but it gives
|
||||
us at least 25% speed-up, so why not?
|
||||
*/
|
||||
ui32 bits;
|
||||
|
||||
@ -437,25 +437,25 @@ private:
|
||||
|
||||
/// All inherit font
|
||||
enum{ inherit = ui32(INHERIT_FAMILY) << Fam_Pos
|
||||
| ui32(INHERIT_SERIES) << Ser_Pos
|
||||
| ui32(INHERIT_SHAPE) << Sha_Pos
|
||||
| ui32(INHERIT_SIZE) << Siz_Pos
|
||||
| ui32(INHERIT_COLOR) << Col_Pos
|
||||
| ui32(INHERIT) << Emp_Pos
|
||||
| ui32(INHERIT) << Und_Pos
|
||||
| ui32(INHERIT) << Nou_Pos
|
||||
| ui32(INHERIT) << Lat_Pos};
|
||||
| ui32(INHERIT_SERIES) << Ser_Pos
|
||||
| ui32(INHERIT_SHAPE) << Sha_Pos
|
||||
| ui32(INHERIT_SIZE) << Siz_Pos
|
||||
| ui32(INHERIT_COLOR) << Col_Pos
|
||||
| ui32(INHERIT) << Emp_Pos
|
||||
| ui32(INHERIT) << Und_Pos
|
||||
| ui32(INHERIT) << Nou_Pos
|
||||
| ui32(INHERIT) << Lat_Pos};
|
||||
|
||||
/// All ignore font
|
||||
enum{ ignore = ui32(IGNORE_FAMILY) << Fam_Pos
|
||||
| ui32(IGNORE_SERIES) << Ser_Pos
|
||||
| ui32(IGNORE_SHAPE) << Sha_Pos
|
||||
| ui32(IGNORE_SIZE) << Siz_Pos
|
||||
| ui32(IGNORE_COLOR) << Col_Pos
|
||||
| ui32(IGNORE) << Emp_Pos
|
||||
| ui32(IGNORE) << Und_Pos
|
||||
| ui32(IGNORE) << Nou_Pos
|
||||
| ui32(IGNORE) << Lat_Pos};
|
||||
| ui32(IGNORE_SERIES) << Ser_Pos
|
||||
| ui32(IGNORE_SHAPE) << Sha_Pos
|
||||
| ui32(IGNORE_SIZE) << Siz_Pos
|
||||
| ui32(IGNORE_COLOR) << Col_Pos
|
||||
| ui32(IGNORE) << Emp_Pos
|
||||
| ui32(IGNORE) << Und_Pos
|
||||
| ui32(IGNORE) << Nou_Pos
|
||||
| ui32(IGNORE) << Lat_Pos};
|
||||
|
||||
/// Updates a misc setting according to request
|
||||
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 :-)
|
||||
// It works, and it's bloody fast. (Asger)
|
||||
// You don't have to understand the stuff below :-)
|
||||
// It works, and it's bloody fast. (Asger)
|
||||
inline LyXFont::FONT_FAMILY LyXFont::family() const
|
||||
{
|
||||
return LyXFont::FONT_FAMILY((bits >> Fam_Pos) & Fam_Mask);
|
||||
|
150
src/lyxfr1.C
150
src/lyxfr1.C
@ -35,8 +35,8 @@
|
||||
#include "support/lstrings.h"
|
||||
#include "support/textutils.h"
|
||||
|
||||
extern BufferView *current_view; // called too many times in this file...
|
||||
extern MiniBuffer *minibuffer;
|
||||
extern BufferView * current_view; // called too many times in this file...
|
||||
extern MiniBuffer * minibuffer;
|
||||
|
||||
// Maximum length copied from the current selection to the search string
|
||||
const int LYXSEARCH_MAXLEN = 128;
|
||||
@ -46,15 +46,15 @@ const int LYXSEARCH_MAXLEN = 128;
|
||||
// If nothing selected, select the word at the cursor.
|
||||
// Returns the current selection
|
||||
// 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
|
||||
// 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
|
||||
// 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.
|
||||
string const GetCurrentSelectionAsString(LyXText * lt)
|
||||
{
|
||||
char sz[LYXSEARCH_MAXLEN];
|
||||
|
||||
char sz[LYXSEARCH_MAXLEN];
|
||||
sz[0] = 0;
|
||||
|
||||
LyXParagraph * par = lt->cursor.par;
|
||||
if (lt->selection && (lt->sel_cursor.par == par)) {
|
||||
// (selected) and (begin/end in same paragraph)
|
||||
@ -77,15 +77,15 @@ string const GetCurrentSelectionAsString(LyXText * lt)
|
||||
int i = 0;
|
||||
bool fPrevIsSpace = false;
|
||||
char ch;
|
||||
while ((i < LYXSEARCH_MAXLEN-2) &&
|
||||
(pos < par->Last()) && (pos < endpos)) {
|
||||
while ((i < LYXSEARCH_MAXLEN - 2) &&
|
||||
(pos < par->Last()) && (pos < endpos)) {
|
||||
ch = par->GetChar(pos);
|
||||
|
||||
//HB??: Maybe (ch <= ' ')
|
||||
if ((ch == ' ') || (ch <= LyXParagraph::META_INSET)) {
|
||||
// consecutive spaces --> 1 space char
|
||||
if (fPrevIsSpace) {
|
||||
pos++; // Next text pos
|
||||
++pos; // Next text pos
|
||||
continue; // same search pos
|
||||
}
|
||||
sz[i] = ' ';
|
||||
@ -94,8 +94,8 @@ string const GetCurrentSelectionAsString(LyXText * lt)
|
||||
sz[i] = ch;
|
||||
fPrevIsSpace = false;
|
||||
}
|
||||
pos++;
|
||||
i++;
|
||||
++pos;
|
||||
++i;
|
||||
}
|
||||
sz[i] = 0;
|
||||
}
|
||||
@ -105,7 +105,7 @@ string const GetCurrentSelectionAsString(LyXText * lt)
|
||||
|
||||
// If nothing selected, select the word at the cursor.
|
||||
// Returns the current selection
|
||||
string const GetSelectionOrWordAtCursor(LyXText *lt)
|
||||
string const GetSelectionOrWordAtCursor(LyXText * lt)
|
||||
{
|
||||
lt->SelectWordWhenUnderCursor();
|
||||
return GetCurrentSelectionAsString(lt);
|
||||
@ -114,11 +114,10 @@ string const GetSelectionOrWordAtCursor(LyXText *lt)
|
||||
|
||||
// This is a copy of SetSelectionOverString from text.C
|
||||
// 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;
|
||||
int i;
|
||||
for (i= 0; i < len; i++)
|
||||
for (int i = 0; i < len; ++i)
|
||||
lt->CursorRight();
|
||||
lt->SetSelection();
|
||||
}
|
||||
@ -131,23 +130,17 @@ void LyXFindReplace1::StartSearch()
|
||||
LyXFindReplace0::StartSearch();
|
||||
SetReplaceEnabled(!current_view->buffer()->isReadonly());
|
||||
searchForward = true;
|
||||
#ifdef MOVE_TEXT
|
||||
if (lsSearch.empty())
|
||||
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()
|
||||
{
|
||||
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
|
||||
// in order to avoid endless loop :-(
|
||||
@ -162,7 +155,6 @@ void LyXFindReplace1::SearchReplaceCB()
|
||||
string const replacestring = ReplaceString();
|
||||
|
||||
current_view->getScreen()->HideCursor();
|
||||
#ifdef MOVE_TEXT
|
||||
current_view->update(-2);
|
||||
|
||||
LyXText * ltCur = current_view->text;
|
||||
@ -175,20 +167,6 @@ void LyXFindReplace1::SearchReplaceCB()
|
||||
SetSelectionOverString(replacestring.c_str());
|
||||
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:
|
||||
SearchCB( searchForward );
|
||||
@ -198,12 +176,8 @@ void LyXFindReplace1::SearchReplaceCB()
|
||||
// replaces all occurences of a string (1999-01-15, dnaber@mini.gt.owl.de)
|
||||
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
|
||||
// in order to avoid endless loop :-(
|
||||
@ -212,19 +186,19 @@ void LyXFindReplace1::SearchReplaceAllCB()
|
||||
&& SearchString()[0] == ' ') ) {
|
||||
WriteAlert(_("Sorry!"), _("You cannot replace a single space, "
|
||||
"nor an empty character."));
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
string const replacestring = ReplaceString();
|
||||
|
||||
current_view->getScreen()->HideCursor();
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
// start at top
|
||||
current_view->text->ClearSelection();
|
||||
current_view->text->CursorTop();
|
||||
|
||||
int replace_count = 0;
|
||||
LyXText * ltCur;
|
||||
do {
|
||||
ltCur = current_view->text;
|
||||
if (ltCur->selection) {
|
||||
@ -238,26 +212,6 @@ void LyXFindReplace1::SearchReplaceAllCB()
|
||||
++replace_count;
|
||||
}
|
||||
} 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 ) {
|
||||
LyXBell();
|
||||
minibuffer->Set(_("String not found!"));
|
||||
@ -275,33 +229,25 @@ void LyXFindReplace1::SearchReplaceAllCB()
|
||||
|
||||
bool LyXFindReplace1::SearchCB(bool fForward)
|
||||
{
|
||||
LyXText * ltCur;
|
||||
bool result;
|
||||
|
||||
// store search direction
|
||||
searchForward = fForward;
|
||||
|
||||
if (!current_view->getScreen())
|
||||
return(false);
|
||||
return false;
|
||||
|
||||
current_view->getScreen()->HideCursor();
|
||||
#ifdef MOVE_TEXT
|
||||
current_view->update(-2);
|
||||
ltCur = current_view->text;
|
||||
#else
|
||||
current_view->buffer()->update(-2);
|
||||
ltCur = current_view->buffer()->text;
|
||||
#endif
|
||||
LyXText * ltCur = current_view->text;
|
||||
if (ltCur->selection)
|
||||
ltCur->cursor = fForward ? ltCur->sel_end_cursor :
|
||||
ltCur->sel_start_cursor;
|
||||
ltCur->sel_start_cursor;
|
||||
|
||||
ReInitFromForm();
|
||||
iLenSelected = SearchString().length();
|
||||
bool result;
|
||||
|
||||
if (!ValidSearchData() ||
|
||||
(fForward ? SearchForward(ltCur) : SearchBackward(ltCur))) {
|
||||
#ifdef MOVE_TEXT
|
||||
current_view->update(-2);
|
||||
|
||||
// clear the selection (if there is any)
|
||||
@ -310,16 +256,6 @@ bool LyXFindReplace1::SearchCB(bool fForward)
|
||||
|
||||
// set the new selection
|
||||
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);
|
||||
minibuffer->Set(_("Found."));
|
||||
result = true;
|
||||
@ -332,7 +268,7 @@ bool LyXFindReplace1::SearchCB(bool fForward)
|
||||
if (current_view->getWorkArea()->focus)
|
||||
current_view->getScreen()->ShowCursor();
|
||||
|
||||
return(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -345,8 +281,8 @@ bool LyXFindReplace1::SearchForward(LyXText * lt)
|
||||
LyXParagraph::size_type pos = lt->cursor.pos;
|
||||
|
||||
while (par && !IsSearchStringInText(par, pos)) {
|
||||
if (pos<par->Last()-1)
|
||||
pos++;
|
||||
if (pos < par->Last() - 1)
|
||||
++pos;
|
||||
else {
|
||||
pos = 0;
|
||||
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
|
||||
// the new position
|
||||
// (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;
|
||||
|
||||
do {
|
||||
if (pos>0)
|
||||
pos--;
|
||||
if (pos > 0)
|
||||
--pos;
|
||||
else {
|
||||
// We skip empty paragraphs (Asger)
|
||||
do {
|
||||
par = par->Previous();
|
||||
if (par)
|
||||
pos = par->Last()-1;
|
||||
} while (par && pos<0);
|
||||
pos = par->Last() - 1;
|
||||
} while (par && pos < 0);
|
||||
}
|
||||
} while (par && !IsSearchStringInText(par, pos));
|
||||
|
||||
@ -408,12 +344,10 @@ int LyXFindReplace1::CompareChars(char chSearch, char chText)
|
||||
bool LyXFindReplace1::IsSearchStringInText(LyXParagraph * par,
|
||||
LyXParagraph::size_type pos)
|
||||
{
|
||||
char chSrch = 0;
|
||||
char chText;
|
||||
|
||||
if (!par)
|
||||
return false;
|
||||
if (!par) return false;
|
||||
|
||||
char chSrch = 0;
|
||||
char chText;
|
||||
bool fPrevIsSpace = false;
|
||||
int iText = 0;
|
||||
string::size_type iSrch = 0;
|
||||
@ -423,7 +357,7 @@ bool LyXFindReplace1::IsSearchStringInText(LyXParagraph * par,
|
||||
chText = par->GetChar(pos+iText);
|
||||
if (chText == ' ') {
|
||||
if (fPrevIsSpace) {
|
||||
iText++; // next Text pos
|
||||
++iText; // next Text pos
|
||||
continue; // same search pos
|
||||
}
|
||||
fPrevIsSpace = true;
|
||||
@ -440,7 +374,7 @@ bool LyXFindReplace1::IsSearchStringInText(LyXParagraph * par,
|
||||
return false;
|
||||
|
||||
if (!MatchWord()
|
||||
|| ((pos <= 0 || !IsLetterCharOrDigit(par->GetChar(pos-1)))
|
||||
|| ((pos <= 0 || !IsLetterCharOrDigit(par->GetChar(pos - 1)))
|
||||
&& (pos + iText >= par->Last()
|
||||
|| !IsLetterCharOrDigit(par->GetChar(pos + iText))))) {
|
||||
iLenSelected = iText;
|
||||
|
2467
src/lyxfunc.C
2467
src/lyxfunc.C
File diff suppressed because it is too large
Load Diff
@ -47,15 +47,16 @@ public:
|
||||
/// The last key was meta
|
||||
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
|
||||
string keyseqStr(int l = 190) const;
|
||||
string keyseqStr() const;
|
||||
|
||||
/// Is the key sequence uncomplete?
|
||||
bool keyseqUncomplete() const;
|
||||
|
||||
/// get options for the current keyseq
|
||||
string keyseqOptions(int l = 190) const;
|
||||
string keyseqOptions() const;
|
||||
|
||||
/// True if lyxfunc reports an error
|
||||
bool errorStat() const { return errorstat; }
|
||||
@ -70,7 +71,6 @@ public:
|
||||
|
||||
/// Should a hint message be displayed?
|
||||
void setHintMessage(bool);
|
||||
|
||||
private:
|
||||
///
|
||||
LyXView * owner;
|
||||
@ -94,8 +94,8 @@ private:
|
||||
mutable bool errorstat;
|
||||
|
||||
/** 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;
|
||||
/// Command name and shortcut information
|
||||
string commandshortcut;
|
||||
@ -136,22 +136,22 @@ bool LyXFunc::wasMetaKey() const
|
||||
|
||||
|
||||
inline
|
||||
string LyXFunc::keyseqStr(int l) const
|
||||
string LyXFunc::keyseqStr() const
|
||||
{
|
||||
char text[200];
|
||||
keyseq.print(text, l, true);
|
||||
string tmp(text);
|
||||
return tmp;
|
||||
// Why not just remove this function
|
||||
string text;
|
||||
keyseq.print(text, true);
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
string LyXFunc::keyseqOptions(int l) const
|
||||
string LyXFunc::keyseqOptions() const
|
||||
{
|
||||
char text[200];
|
||||
keyseq.printOptions(text, l);
|
||||
string tmp(text);
|
||||
return tmp;
|
||||
// Why not just remove this function
|
||||
string text;
|
||||
keyseq.printOptions(text);
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
@ -161,12 +161,14 @@ bool LyXFunc::keyseqUncomplete() const
|
||||
return (keyseq.length > 0);
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void LyXFunc::setHintMessage(bool hm)
|
||||
{
|
||||
show_sc = hm;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void operator|=(LyXFunc::func_status & fs, LyXFunc::func_status f)
|
||||
{
|
||||
|
@ -130,6 +130,7 @@ enum LyXRCTags {
|
||||
RC_LAST
|
||||
};
|
||||
|
||||
|
||||
static keyword_item lyxrcTags[] = {
|
||||
{ "\\accept_compound", RC_ACCEPT_COMPOUND },
|
||||
{ "\\alternate_language", RC_ALT_LANG },
|
||||
@ -547,7 +548,7 @@ int LyXRC::read(string const & filename)
|
||||
BufferParams::PAPER_LEGALPAPER;
|
||||
else if (size == "executive")
|
||||
default_papersize =
|
||||
BufferParams::PAPER_EXECUTIVEPAPER;
|
||||
BufferParams::PAPER_EXECUTIVEPAPER;
|
||||
else if (size == "a3")
|
||||
default_papersize =
|
||||
BufferParams::PAPER_A3PAPER;
|
||||
|
103
src/lyxscreen.h
103
src/lyxscreen.h
@ -42,13 +42,13 @@ public:
|
||||
~LyXScreen();
|
||||
|
||||
/** Return the forground pixmap. This function is a _hack_,
|
||||
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.
|
||||
Tasks for 0.13. */
|
||||
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.
|
||||
Tasks for 0.13. */
|
||||
Pixmap getForeground() { return foreground; };
|
||||
|
||||
/** 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 );
|
||||
|
||||
/// Redraws the screen, without using existing pixmap
|
||||
@ -76,27 +76,27 @@ public:
|
||||
void ToggleToggle();
|
||||
|
||||
/** Updates part of the screen. If text->status is
|
||||
LyXText::NEED_MORE_REFRESH, we update from the
|
||||
point of change and to the end of the screen.
|
||||
If text->status is LyXText::NEED_VERY_LITTLE_REFRESH,
|
||||
we only update the current row. */
|
||||
LyXText::NEED_MORE_REFRESH, we update from the
|
||||
point of change and to the end of the screen.
|
||||
If text->status is LyXText::NEED_VERY_LITTLE_REFRESH,
|
||||
we only update the current row. */
|
||||
void Update();
|
||||
|
||||
/** Updates part of the screen. Updates till row with cursor,
|
||||
or only current row */
|
||||
or only current row */
|
||||
void SmallUpdate();
|
||||
|
||||
/** Functions for drawing into the LyXScreen. The number of
|
||||
drawing functions should be minimized, now there
|
||||
is too many. And also there is mixed X and XForms drawing
|
||||
functions called. Not good. */
|
||||
drawing functions should be minimized, now there
|
||||
is too many. And also there is mixed X and XForms drawing
|
||||
functions called. Not good. */
|
||||
void drawPoint(GC gc, int x, int y);
|
||||
///
|
||||
void drawLine(gc_type t, int baseline, int x, int length);
|
||||
///
|
||||
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);
|
||||
///
|
||||
@ -110,11 +110,15 @@ public:
|
||||
///
|
||||
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,
|
||||
unsigned int w, unsigned int h,
|
||||
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);
|
||||
///
|
||||
@ -123,11 +127,11 @@ public:
|
||||
void drawFrame(int ft, int x, int y, int w, int h,
|
||||
FL_COLOR col, int b);
|
||||
///
|
||||
int drawText(LyXFont const &font, char const*,
|
||||
int n, int baseline, int x);
|
||||
int drawText(LyXFont const & font, char const *,
|
||||
int n, int baseline, int x);
|
||||
///
|
||||
int drawString(LyXFont const &font, string const &str,
|
||||
int baseline, int x);
|
||||
int drawString(LyXFont const & font, string const & str,
|
||||
int baseline, int x);
|
||||
|
||||
/// first visible pixel-row
|
||||
long first;
|
||||
@ -142,10 +146,10 @@ private:
|
||||
void DrawFromTo(int y1, int y2);
|
||||
|
||||
/// 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;
|
||||
@ -172,39 +176,44 @@ private:
|
||||
///
|
||||
long screen_refresh_y;
|
||||
///
|
||||
Row *screen_refresh_row;
|
||||
Row * screen_refresh_row;
|
||||
///
|
||||
friend class InsetFormula;
|
||||
};
|
||||
|
||||
// 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,
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
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,
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
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),
|
||||
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),
|
||||
x, y, width, height);
|
||||
}
|
||||
|
||||
|
||||
inline int LyXScreen::drawText(LyXFont const &font, char const*fs,
|
||||
int n, int baseline, int x)
|
||||
inline
|
||||
int LyXScreen::drawText(LyXFont const & font, char const * fs,
|
||||
int n, int baseline, int x)
|
||||
{
|
||||
return font.drawText(fs, n, foreground, baseline, x);
|
||||
}
|
||||
|
||||
|
||||
inline int LyXScreen::drawString(LyXFont const &font, string const &str,
|
||||
int baseline, int x)
|
||||
inline
|
||||
int LyXScreen::drawString(LyXFont const & font, string const & str,
|
||||
int baseline, int x)
|
||||
{
|
||||
return font.drawString(str, foreground, baseline, x);
|
||||
}
|
||||
|
547
src/menus.C
547
src/menus.C
@ -252,7 +252,7 @@ void Menus::create_menus(int air)
|
||||
MENU_LABEL_SIZE,
|
||||
_("Layout"),
|
||||
strlen(_("Layout"))) + mbadd,
|
||||
mbheight, _("Layout"));
|
||||
mbheight, _("Layout"));
|
||||
moffset += obj->w + air;
|
||||
fl_set_object_shortcut(obj, scex(_("MB|#L")), 1);
|
||||
fl_set_object_callback(obj, C_Menus_ShowLayoutMenu, 0);
|
||||
@ -486,27 +486,27 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
|
||||
int SubFileExport = 0;
|
||||
if (!LinuxDoc && !DocBook)
|
||||
SubFileExport= fl_defpup(FL_ObjWin(ob),
|
||||
_("Export%t"
|
||||
"|as LaTeX...%x40"
|
||||
"|as DVI...%x41"
|
||||
"|as PostScript...%x42"
|
||||
"|as Ascii Text...%x43"
|
||||
"|as HTML...%x44"
|
||||
"|Custom...%x45"));
|
||||
_("Export%t"
|
||||
"|as LaTeX...%x40"
|
||||
"|as DVI...%x41"
|
||||
"|as PostScript...%x42"
|
||||
"|as Ascii Text...%x43"
|
||||
"|as HTML...%x44"
|
||||
"|Custom...%x45"));
|
||||
else if(LinuxDoc)
|
||||
SubFileExport= fl_defpup(FL_ObjWin(ob),
|
||||
_("Export%t"
|
||||
"|as LinuxDoc...%x40"
|
||||
"|as DVI...%x41"
|
||||
"|as PostScript...%x42"
|
||||
"|as Ascii Text...%x43"));
|
||||
_("Export%t"
|
||||
"|as LinuxDoc...%x40"
|
||||
"|as DVI...%x41"
|
||||
"|as PostScript...%x42"
|
||||
"|as Ascii Text...%x43"));
|
||||
else if(DocBook)
|
||||
SubFileExport= fl_defpup(FL_ObjWin(ob),
|
||||
_("Export%t"
|
||||
"|as DocBook...%x40"
|
||||
"|as DVI...%x41"
|
||||
"|as PostScript...%x42"
|
||||
"|as Ascii Text...%x43"));
|
||||
_("Export%t"
|
||||
"|as DocBook...%x40"
|
||||
"|as DVI...%x41"
|
||||
"|as PostScript...%x42"
|
||||
"|as Ascii Text...%x43"));
|
||||
|
||||
fl_setpup_shortcut(SubFileExport, 40, scex(_("FEX|Ll#l#L")));
|
||||
fl_setpup_shortcut(SubFileExport, 41, scex(_("FEX|Dd#d#D")));
|
||||
@ -674,7 +674,7 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long)
|
||||
default:
|
||||
men->currentView()
|
||||
->buffer(bufferlist
|
||||
.loadLyXFile((*lastfiles)[choice - 18]));
|
||||
.loadLyXFile((*lastfiles)[choice - 18]));
|
||||
break;
|
||||
}
|
||||
fl_freepup(SubFileImport);
|
||||
@ -707,11 +707,11 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
|
||||
// Import sub-menu
|
||||
|
||||
int SubFileImport = fl_defpup(FL_ObjWin(ob),
|
||||
_("Import%t"
|
||||
"|LaTeX...%x15"
|
||||
"|Ascii Text as Lines...%x16"
|
||||
"|Ascii Text as Paragraphs...%x17"
|
||||
"|Noweb...%x18"));
|
||||
_("Import%t"
|
||||
"|LaTeX...%x15"
|
||||
"|Ascii Text as Lines...%x16"
|
||||
"|Ascii Text as Paragraphs...%x17"
|
||||
"|Noweb...%x18"));
|
||||
|
||||
fl_setpup_shortcut(SubFileImport, 15, scex(_("FIM|Ll#l#L")));
|
||||
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.
|
||||
int FileMenu = fl_defpup(FL_ObjWin(ob),
|
||||
_("New..."
|
||||
"|New from template..."
|
||||
"|Open...%l"
|
||||
"|Import%m%l"
|
||||
"|Exit%l"), SubFileImport);
|
||||
"|New from template..."
|
||||
"|Open...%l"
|
||||
"|Import%m%l"
|
||||
"|Exit%l"), SubFileImport);
|
||||
|
||||
fl_setpup_shortcut(FileMenu, 1, scex(_("FM|Nn#n#N")));
|
||||
fl_setpup_shortcut(FileMenu, 2, scex(_("FM|tT#t#T")));
|
||||
@ -790,7 +790,7 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
|
||||
default:
|
||||
men->currentView()
|
||||
->buffer(bufferlist
|
||||
.loadLyXFile((*lastfiles)[choice - 6]));
|
||||
.loadLyXFile((*lastfiles)[choice - 6]));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -800,7 +800,7 @@ void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MOVE_TEXT
|
||||
|
||||
void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
||||
{
|
||||
Menus * men = static_cast<Menus*>(ob->u_vdata);
|
||||
@ -815,14 +815,14 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
||||
|
||||
// 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"));
|
||||
_("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")));
|
||||
@ -897,10 +897,10 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
||||
|
||||
int align = men->currentView()->text->cursor.par->
|
||||
table->GetAlignment(men->currentView()->text->
|
||||
NumberOfCell(men->currentView()->
|
||||
text->cursor.par,
|
||||
men->currentView()->
|
||||
text->cursor.pos));
|
||||
NumberOfCell(men->currentView()->
|
||||
text->cursor.par,
|
||||
men->currentView()->
|
||||
text->cursor.pos));
|
||||
if (align == LYX_ALIGN_LEFT)
|
||||
fl_addtopup(SubEditTable, _("|Align Left%R%x40"));
|
||||
else
|
||||
@ -979,24 +979,24 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
||||
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);
|
||||
_("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")));
|
||||
@ -1121,328 +1121,6 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
||||
fl_freepup(SubEditTable);
|
||||
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)
|
||||
@ -1489,11 +1167,7 @@ void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
|
||||
fl_setpup_shortcut(LayoutMenu, 13, scex(_("LM|Ss#s#S")));
|
||||
|
||||
// Set values of checkboxes according to font
|
||||
#ifdef MOVE_TEXT
|
||||
LyXFont font = men->currentView()->text->real_current_font;
|
||||
#else
|
||||
LyXFont font = tmpbuffer->text->real_current_font;
|
||||
#endif
|
||||
if (font.emph() == LyXFont::ON)
|
||||
fl_setpup_mode(LayoutMenu, 7, FL_PUP_CHECK);
|
||||
if (font.noun() == LyXFont::ON)
|
||||
@ -1504,13 +1178,8 @@ void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
|
||||
fl_setpup_mode(LayoutMenu, 10, FL_PUP_CHECK);
|
||||
|
||||
// Grey out unavailable entries
|
||||
#ifdef MOVE_TEXT
|
||||
if (!men->currentView()->text->cursor.par->table)
|
||||
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()) {
|
||||
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),
|
||||
_("Import ASCII file%t"
|
||||
"|As Lines%x41"
|
||||
"|As Paragraphs%x42"));
|
||||
"|As Lines%x41"
|
||||
"|As Paragraphs%x42"));
|
||||
|
||||
fl_setpup_shortcut(SubInsertAscii, 41, scex(_("IMA|Ll#l#L")));
|
||||
fl_setpup_shortcut(SubInsertAscii, 42, scex(_("IMA|Pp#p#P")));
|
||||
|
||||
int SubInsertTableList= fl_defpup(FL_ObjWin(ob),
|
||||
_("Lists & TOC%t"
|
||||
"|Table of Contents%x21"
|
||||
"|List of Figures%x22"
|
||||
"|List of Tables%x23"
|
||||
"|List of Algorithms%x24"
|
||||
"|Index List%x25"
|
||||
"|BibTeX Reference%x26"));
|
||||
_("Lists & TOC%t"
|
||||
"|Table of Contents%x21"
|
||||
"|List of Figures%x22"
|
||||
"|List of Tables%x23"
|
||||
"|List of Algorithms%x24"
|
||||
"|Index List%x25"
|
||||
"|BibTeX Reference%x26"));
|
||||
|
||||
fl_setpup_shortcut(SubInsertTableList, 21, scex(_("IMT|Cc#c#C")));
|
||||
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")));
|
||||
|
||||
int SubInsertFloatList = fl_defpup(FL_ObjWin(ob),
|
||||
_("Floats%t"
|
||||
"|Figure Float%x71"
|
||||
"|Table Float%x72"
|
||||
"|Wide Figure Float%x73"
|
||||
"|Wide Table Float%l%x74"
|
||||
"|Algorithm Float%x75"));
|
||||
_("Floats%t"
|
||||
"|Figure Float%x71"
|
||||
"|Table Float%x72"
|
||||
"|Wide Figure Float%x73"
|
||||
"|Wide Table Float%l%x74"
|
||||
"|Algorithm Float%x75"));
|
||||
|
||||
fl_setpup_shortcut(SubInsertFloatList, 71, scex(_("IMF|gG#g#G")));
|
||||
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")));
|
||||
|
||||
int SubInsertSpecial = fl_defpup(FL_ObjWin(ob),
|
||||
_("Special Character%t"
|
||||
"|HFill%x31"
|
||||
"|Hyphenation Point%x32"
|
||||
"|Protected Blank%x33"
|
||||
"|Linebreak%x34"
|
||||
"|Ellipsis (...)%x35"
|
||||
"|End of sentence period%x36"
|
||||
"|Ordinary Quote (\")%x37"
|
||||
"|Menu Separator %x38"));
|
||||
_("Special Character%t"
|
||||
"|HFill%x31"
|
||||
"|Hyphenation Point%x32"
|
||||
"|Protected Blank%x33"
|
||||
"|Linebreak%x34"
|
||||
"|Ellipsis (...)%x35"
|
||||
"|End of sentence period%x36"
|
||||
"|Ordinary Quote (\")%x37"
|
||||
"|Menu Separator %x38"));
|
||||
|
||||
fl_setpup_shortcut(SubInsertSpecial, 31, scex(_("IMS|Hh#h#H")));
|
||||
fl_setpup_shortcut(SubInsertSpecial, 32, scex(_("IMS|Pp#p#P")));
|
||||
@ -1691,10 +1360,10 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
|
||||
break;
|
||||
|
||||
case 6: tmpfunc->Dispatch(LFUN_FOOTMELT); break
|
||||
;
|
||||
;
|
||||
case 7: tmpfunc->Dispatch(LFUN_MARGINMELT); break;
|
||||
|
||||
case 8: // Float sub-menu
|
||||
case 8: // Float sub-menu
|
||||
case 71:
|
||||
tmpfunc->Dispatch(LFUN_INSERTFOOTNOTE, "figure");
|
||||
break;
|
||||
@ -1764,14 +1433,14 @@ void Menus::ShowMathMenu(FL_OBJECT * ob, long)
|
||||
|
||||
int MathMenu = fl_defpup(FL_ObjWin(ob),
|
||||
_("Fraction"
|
||||
"|Square root"
|
||||
"|Exponent"
|
||||
"|Index"
|
||||
"|Sum"
|
||||
"|Integral%l"
|
||||
"|Math mode"
|
||||
"|Display%l"
|
||||
"|Math Panel..."));
|
||||
"|Square root"
|
||||
"|Exponent"
|
||||
"|Index"
|
||||
"|Sum"
|
||||
"|Integral%l"
|
||||
"|Math mode"
|
||||
"|Display%l"
|
||||
"|Math Panel..."));
|
||||
|
||||
fl_setpup_shortcut(MathMenu, 1, scex(_("MM|Ff#f#F")));
|
||||
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),
|
||||
_("Screen Fonts..."
|
||||
"|Spellchecker Options..."
|
||||
"|Keyboard..."
|
||||
"|LaTeX...%l"
|
||||
"|Reconfigure" ));
|
||||
"|Spellchecker Options..."
|
||||
"|Keyboard..."
|
||||
"|LaTeX...%l"
|
||||
"|Reconfigure" ));
|
||||
|
||||
fl_setpup_shortcut(OptionsMenu, 1, scex(_("OM|Ff#f#F")));
|
||||
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),
|
||||
_("Introduction"
|
||||
"|Tutorial"
|
||||
"|User's Guide"
|
||||
"|Extended Features"
|
||||
"|Customization"
|
||||
"|Reference Manual"
|
||||
"|Known Bugs"
|
||||
"|LaTeX Configuration%l"
|
||||
"|Copyright and Warranty..."
|
||||
"|Credits..."
|
||||
"|Version..."));
|
||||
"|Tutorial"
|
||||
"|User's Guide"
|
||||
"|Extended Features"
|
||||
"|Customization"
|
||||
"|Reference Manual"
|
||||
"|Known Bugs"
|
||||
"|LaTeX Configuration%l"
|
||||
"|Copyright and Warranty..."
|
||||
"|Credits..."
|
||||
"|Version..."));
|
||||
|
||||
fl_setpup_shortcut(HelpMenu, 1, scex(_("HM|Ii#I#i")));
|
||||
fl_setpup_shortcut(HelpMenu, 2, scex(_("HM|Tt#T#t")));
|
||||
|
312
src/paragraph.C
312
src/paragraph.C
@ -329,7 +329,7 @@ void LyXParagraph::validate(LaTeXFeatures & features)
|
||||
{
|
||||
// this will be useful later
|
||||
LyXLayout const & layout = textclasslist.Style(GetCurrentTextClass(),
|
||||
GetLayout());
|
||||
GetLayout());
|
||||
|
||||
// check the params.
|
||||
if (line_top || line_bottom)
|
||||
@ -954,7 +954,7 @@ LyXFont LyXParagraph::getFont(LyXParagraph::size_type pos) const
|
||||
{
|
||||
LyXFont tmpfont;
|
||||
LyXLayout const & layout = textclasslist.Style(GetCurrentTextClass(),
|
||||
GetLayout());
|
||||
GetLayout());
|
||||
LyXParagraph::size_type main_body = 0;
|
||||
if (layout.labeltype == LABEL_MANUAL)
|
||||
main_body = BeginningOfMainBody();
|
||||
@ -1136,9 +1136,9 @@ char LyXParagraph::GetChar(LyXParagraph::size_type pos) const
|
||||
|
||||
|
||||
string LyXParagraph::GetWord(LyXParagraph::size_type & lastpos) const
|
||||
//Added 98/9/21 by REH
|
||||
// return an string of the current word, and the end of the word
|
||||
// in lastpos.
|
||||
//Added 98/9/21 by REH
|
||||
// return an string of the current word, and the end of the word
|
||||
// in lastpos.
|
||||
|
||||
// the current word is defined as starting at the first character from
|
||||
// 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)
|
||||
return text.size() + NextAfterFootnote()->Last() + 1;
|
||||
/* the 1 is the symbol
|
||||
for the footnote */
|
||||
/* the 1 is the symbol
|
||||
for the footnote */
|
||||
else
|
||||
return text.size();
|
||||
}
|
||||
@ -2279,8 +2279,8 @@ void LyXParagraph::readSimpleWholeFile(FILE * myfile)
|
||||
|
||||
|
||||
LyXParagraph * LyXParagraph::TeXOnePar(string & file, TexRow & texrow,
|
||||
string & foot, TexRow & foot_texrow,
|
||||
int & foot_count)
|
||||
string & foot, TexRow & foot_texrow,
|
||||
int & foot_count)
|
||||
{
|
||||
lyxerr[Debug::LATEX] << "TeXOnePar... " << this << endl;
|
||||
LyXParagraph * par = next;
|
||||
@ -2365,7 +2365,7 @@ LyXParagraph * LyXParagraph::TeXOnePar(string & file, TexRow & texrow,
|
||||
}
|
||||
file += "\\par}";
|
||||
} else if (textclasslist.Style(GetCurrentTextClass(),
|
||||
GetLayout()).isCommand()){
|
||||
GetLayout()).isCommand()){
|
||||
if (style.resfont.size() != font.size()) {
|
||||
file += '\\';
|
||||
file += font.latexSize();
|
||||
@ -2674,7 +2674,7 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
|
||||
}
|
||||
current_cell_number = -1;
|
||||
tmp = table->TexEndOfCell(file, current_cell_number);
|
||||
for (; tmp >0 ; --tmp)
|
||||
for (; tmp > 0 ; --tmp)
|
||||
texrow.newline();
|
||||
|
||||
texrow.start(this, 0);
|
||||
@ -2686,13 +2686,15 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
|
||||
current_cell_number++;
|
||||
continue;
|
||||
}
|
||||
column++;
|
||||
++column;
|
||||
|
||||
// Fully instantiated font
|
||||
LyXFont font = getFont(i);
|
||||
|
||||
// Spaces at end of font change are simulated to be outside font change.
|
||||
// i.e. we write "\textXX{text} " rather than "\textXX{text }". (Asger)
|
||||
// Spaces at end of font change are simulated to be
|
||||
// outside font change.
|
||||
// i.e. we write "\textXX{text} " rather than
|
||||
// "\textXX{text }". (Asger)
|
||||
if (open_font && c == ' ' && i <= size() - 2
|
||||
&& getFont(i+1) != running_font && getFont(i+1) != font) {
|
||||
font = getFont(i+1);
|
||||
@ -2725,9 +2727,11 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
|
||||
}
|
||||
if (c == LyXParagraph::META_NEWLINE) {
|
||||
// special case for inside a table
|
||||
// different from default case in SimpleTeXSpecialChars()
|
||||
// different from default case in
|
||||
// SimpleTeXSpecialChars()
|
||||
if (open_font) {
|
||||
column += running_font.latexWriteEndChanges(file, basefont);
|
||||
column += running_font
|
||||
.latexWriteEndChanges(file, basefont);
|
||||
open_font = false;
|
||||
}
|
||||
basefont = getFont(-1);
|
||||
@ -2742,8 +2746,8 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
|
||||
// put the EndOfCell because it is put after the
|
||||
// for(...)
|
||||
if (table->ShouldBeVeryLastCell(current_cell_number)) {
|
||||
current_cell_number--;
|
||||
break;
|
||||
current_cell_number--;
|
||||
break;
|
||||
}
|
||||
int tmp = table->TexEndOfCell(file,
|
||||
current_cell_number);
|
||||
@ -2801,7 +2805,7 @@ bool LyXParagraph::TeXContTableRows(string & file,
|
||||
|
||||
size_type lastpos = i;
|
||||
int cell = table->CellHasContRow(current_cell_number);
|
||||
current_cell_number++;
|
||||
++current_cell_number;
|
||||
while(cell >= 0) {
|
||||
// first find the right position
|
||||
i = lastpos;
|
||||
@ -2820,15 +2824,18 @@ bool LyXParagraph::TeXContTableRows(string & file,
|
||||
file += ' ';
|
||||
}
|
||||
|
||||
for (; i < size() && (c = GetChar(i)) != LyXParagraph::META_NEWLINE;
|
||||
for (; i < size()
|
||||
&& (c = GetChar(i)) != LyXParagraph::META_NEWLINE;
|
||||
++i) {
|
||||
++column;
|
||||
|
||||
// Fully instantiated font
|
||||
LyXFont font = getFont(i);
|
||||
|
||||
// Spaces at end of font change are simulated to be outside font change.
|
||||
// i.e. we write "\textXX{text} " rather than "\textXX{text }". (Asger)
|
||||
// Spaces at end of font change are simulated to
|
||||
// be outside font change. i.e. we write
|
||||
// "\textXX{text} " rather than "\textXX{text }".
|
||||
// (Asger)
|
||||
if (open_font && c == ' ' && i <= size() - 2
|
||||
&& getFont(i + 1) != running_font
|
||||
&& getFont(i + 1) != font) {
|
||||
@ -2947,23 +2954,22 @@ bool LyXParagraph::linuxDocConvertChar(char c, string & sgml_string)
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
|
||||
int & desc_on, int depth)
|
||||
{
|
||||
if (!table)
|
||||
return;
|
||||
if (!table) return;
|
||||
lyxerr[Debug::LATEX] << "SimpleDocbookOneTablePar... " << this << endl;
|
||||
int column, tmp;
|
||||
int current_cell_number = -1;
|
||||
int column;
|
||||
LyXFont font1, font2;
|
||||
char c;
|
||||
Inset *inset;
|
||||
Inset * inset;
|
||||
size_type main_body;
|
||||
string emph = "emphasis";
|
||||
bool emph_flag= false;
|
||||
int char_line_count= 0;
|
||||
bool emph_flag = false;
|
||||
|
||||
LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), GetLayout());
|
||||
LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(),
|
||||
GetLayout());
|
||||
|
||||
if (style.labeltype != LABEL_MANUAL)
|
||||
main_body = 0;
|
||||
@ -2976,24 +2982,24 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
|
||||
else
|
||||
font1 = style.font;
|
||||
|
||||
char_line_count = depth;
|
||||
int char_line_count = depth;
|
||||
addNewlineAndDepth(file, depth);
|
||||
if (footnoteflag == LyXParagraph::NO_FOOTNOTE) {
|
||||
file += "<INFORMALTABLE>";
|
||||
addNewlineAndDepth(file, ++depth);
|
||||
}
|
||||
current_cell_number = -1;
|
||||
tmp = table->DocBookEndOfCell(file, current_cell_number, depth);
|
||||
int current_cell_number = -1;
|
||||
int tmp = table->DocBookEndOfCell(file, current_cell_number, depth);
|
||||
|
||||
/* parsing main loop */
|
||||
for (size_type i = 0; i < size(); ++i) {
|
||||
c = GetChar(i);
|
||||
if (table->IsContRow(current_cell_number+1)) {
|
||||
if (c == LyXParagraph::META_NEWLINE)
|
||||
current_cell_number++;
|
||||
++current_cell_number;
|
||||
continue;
|
||||
}
|
||||
column++;
|
||||
++column;
|
||||
|
||||
// Fully instantiated font
|
||||
font2 = getFont(i);
|
||||
@ -3029,7 +3035,7 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
|
||||
break;
|
||||
}
|
||||
tmp= table->DocBookEndOfCell(file, current_cell_number,
|
||||
depth);
|
||||
depth);
|
||||
|
||||
if (tmp > 0)
|
||||
column = 0;
|
||||
@ -3040,19 +3046,24 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
|
||||
//
|
||||
// This code needs some explanation:
|
||||
// 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
|
||||
// graphics inside tables or figure floats can't go on
|
||||
// title (the equivalente in latex for this case is caption
|
||||
// graphics inside tables or figure floats
|
||||
// can't go on
|
||||
// title (the equivalente in latex for this
|
||||
// case is caption
|
||||
// and title should come first
|
||||
// desc_on == 4
|
||||
//
|
||||
if(desc_on != 3 || i != 0) {
|
||||
if(tmp_out[0] == '@') {
|
||||
if(desc_on == 4)
|
||||
extra += frontStrip(tmp_out, '@');
|
||||
extra += frontStrip(tmp_out,
|
||||
'@');
|
||||
else
|
||||
file += frontStrip(tmp_out, '@');
|
||||
file += frontStrip(tmp_out,
|
||||
'@');
|
||||
} else
|
||||
file += tmp_out;
|
||||
}
|
||||
@ -3110,12 +3121,12 @@ void LyXParagraph::SimpleDocBookOneTablePar(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)
|
||||
|
||||
{
|
||||
if (!table)
|
||||
return;
|
||||
if (!table) return;
|
||||
|
||||
lyxerr[Debug::LATEX] << "DocBookContTableRows... " << this << endl;
|
||||
|
||||
@ -3145,7 +3156,7 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra,
|
||||
|
||||
lastpos = i;
|
||||
cell = table->CellHasContRow(current_cell_number);
|
||||
current_cell_number++;
|
||||
++current_cell_number;
|
||||
while(cell >= 0) {
|
||||
// first find the right position
|
||||
i = lastpos;
|
||||
@ -3243,6 +3254,7 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra,
|
||||
lyxerr[Debug::LATEX] << "DocBookContTableRows...done " << this << endl;
|
||||
}
|
||||
|
||||
|
||||
void LyXParagraph::SimpleTeXBlanks(string & file, TexRow & texrow,
|
||||
LyXParagraph::size_type const i,
|
||||
int & column, LyXFont const & font,
|
||||
@ -3547,14 +3559,14 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
|
||||
string fname2 = TmpFileName(string(), "RAT2");
|
||||
int lastpos = i;
|
||||
int cell = table->CellHasContRow(actcell);
|
||||
actcell++;
|
||||
++actcell;
|
||||
while(cell >= 0) {
|
||||
// first find the right position
|
||||
i = lastpos;
|
||||
for (; i < size() && actcell < cell; ++i) {
|
||||
c = GetChar(i);
|
||||
if (c == LyXParagraph::META_NEWLINE)
|
||||
actcell++;
|
||||
++actcell;
|
||||
}
|
||||
lastpos = i;
|
||||
c = GetChar(i);
|
||||
@ -3572,7 +3584,8 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
|
||||
switch (c) {
|
||||
case LyXParagraph::META_INSET:
|
||||
if ((inset = GetInset(i))) {
|
||||
fstream fs(fname2.c_str(), ios::in|ios::out);
|
||||
fstream fs(fname2.c_str(),
|
||||
ios::in|ios::out);
|
||||
if (!fs) {
|
||||
WriteAlert(_("LYX_ERROR:"),
|
||||
_("Cannot open temporary file:"),
|
||||
@ -3605,7 +3618,9 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
|
||||
if (c != '\0')
|
||||
os << c;
|
||||
else
|
||||
lyxerr.debug() << "RoffAsciiTable: NULL char in structure." << endl;
|
||||
lyxerr.debug() << "RoffAsciiTable: "
|
||||
"NULL char in structure."
|
||||
<< endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3626,7 +3641,7 @@ LyXParagraph * LyXParagraph::TeXDeeper(string & file, TexRow & texrow,
|
||||
if (par->IsDummy())
|
||||
lyxerr << "ERROR (LyXParagraph::TeXDeeper)" << endl;
|
||||
if (textclasslist.Style(GetCurrentTextClass(),
|
||||
par->layout).isEnvironment()
|
||||
par->layout).isEnvironment()
|
||||
|| par->pextra_type != PEXTRA_NONE)
|
||||
{
|
||||
par = par->TeXEnvironment(file, texrow,
|
||||
@ -3645,12 +3660,12 @@ LyXParagraph * LyXParagraph::TeXDeeper(string & file, TexRow & texrow,
|
||||
|
||||
|
||||
LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow,
|
||||
string & foot, TexRow & foot_texrow,
|
||||
int & foot_count)
|
||||
string & foot, TexRow & foot_texrow,
|
||||
int & foot_count)
|
||||
{
|
||||
bool eindent_open = 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 int minipage_open_depth = 0;
|
||||
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() &&
|
||||
(par->pextra_type == PEXTRA_MINIPAGE) &&
|
||||
par->pextra_start_minipage) {
|
||||
file += "\\end{minipage}\n";
|
||||
texrow.newline();
|
||||
if (par_sep == BufferParams::PARSEP_INDENT) {
|
||||
file += "}\n";
|
||||
file += "\\end{minipage}\n";
|
||||
texrow.newline();
|
||||
}
|
||||
minipage_open = false;
|
||||
if (par_sep == BufferParams::PARSEP_INDENT) {
|
||||
file += "}\n";
|
||||
texrow.newline();
|
||||
}
|
||||
minipage_open = false;
|
||||
}
|
||||
if (par && par->depth > depth) {
|
||||
if (textclasslist.Style(GetCurrentTextClass(),
|
||||
par->layout).isParagraph()
|
||||
par->layout).isParagraph()
|
||||
&& !par->table
|
||||
&& !suffixIs(file, "\n\n")) {
|
||||
// There should be at least one '\n' already
|
||||
// but we need there to be two for Standard
|
||||
// paragraphs that are depth-increment'ed to be
|
||||
// output correctly. However, tables can also be
|
||||
// paragraphs so don't adjust them. ARRae
|
||||
// There should be at least one '\n' already
|
||||
// but we need there to be two for Standard
|
||||
// paragraphs that are depth-increment'ed to be
|
||||
// output correctly. However, tables can
|
||||
// also be paragraphs so don't adjust them.
|
||||
// ARRae
|
||||
file += '\n';
|
||||
texrow.newline();
|
||||
}
|
||||
@ -3931,7 +3947,7 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
|
||||
|
||||
LyXParagraph * par = this;
|
||||
LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(),
|
||||
previous->GetLayout());
|
||||
previous->GetLayout());
|
||||
|
||||
if (style.needprotect && footnotekind != LyXParagraph::FOOTNOTE){
|
||||
lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
|
||||
@ -3991,7 +4007,8 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
|
||||
sprintf(bufr, "\\begin{floatingfigure}{%s}\n",
|
||||
pextra_width.c_str());
|
||||
else
|
||||
sprintf(bufr, "\\begin{floatingfigure}{%f\\textwidth}\n",
|
||||
sprintf(bufr,
|
||||
"\\begin{floatingfigure}{%f\\textwidth}\n",
|
||||
atoi(pextra_widthp.c_str())/100.0);
|
||||
file += bufr;
|
||||
} else {
|
||||
@ -4045,16 +4062,18 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
|
||||
|| !footer_in_body) {
|
||||
// Process text for all floats except footnotes in body
|
||||
do {
|
||||
LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(),
|
||||
par->layout);
|
||||
LyXLayout const & style =
|
||||
textclasslist.Style(GetCurrentTextClass(),
|
||||
par->layout);
|
||||
if (par->IsDummy())
|
||||
lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
|
||||
<< endl;
|
||||
if (style.isEnvironment()
|
||||
|| par->pextra_type == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */
|
||||
// Allows the use of minipages within float environments.
|
||||
// Shouldn't be circular because we don't support
|
||||
// footnotes inside floats (yet). ARRae
|
||||
// Allows the use of minipages within float
|
||||
// environments. Shouldn't be circular because
|
||||
// we don't support footnotes inside
|
||||
// floats (yet). ARRae
|
||||
par = par->TeXEnvironment(file, texrow,
|
||||
foot, foot_texrow,
|
||||
foot_count);
|
||||
@ -4078,16 +4097,18 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
|
||||
TexRow dummy_texrow;
|
||||
int dummy_count = 0;
|
||||
do {
|
||||
LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(),
|
||||
par->layout);
|
||||
LyXLayout const & style =
|
||||
textclasslist.Style(GetCurrentTextClass(),
|
||||
par->layout);
|
||||
if (par->IsDummy())
|
||||
lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
|
||||
<< endl;
|
||||
if (style.isEnvironment()
|
||||
|| par->pextra_type == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */
|
||||
// Allows the use of minipages within float environments.
|
||||
// Shouldn't be circular because we don't support
|
||||
// footnotes inside floats (yet). ARRae
|
||||
// Allows the use of minipages within float
|
||||
// environments. Shouldn't be circular because
|
||||
// we don't support footnotes inside
|
||||
// floats (yet). ARRae
|
||||
par = par->TeXEnvironment(foot, foot_texrow,
|
||||
dummy, dummy_texrow,
|
||||
dummy_count);
|
||||
@ -4102,7 +4123,8 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
|
||||
dummy, dummy_texrow,
|
||||
dummy_count);
|
||||
}
|
||||
} while (par && par->footnoteflag != LyXParagraph::NO_FOOTNOTE);
|
||||
} while (par
|
||||
&& par->footnoteflag != LyXParagraph::NO_FOOTNOTE);
|
||||
if (dummy_count) {
|
||||
lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
|
||||
"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,
|
||||
char const * widthp)
|
||||
{
|
||||
pextra_type = type;
|
||||
pextra_width = width;
|
||||
pextra_widthp = widthp;
|
||||
pextra_type = type;
|
||||
pextra_width = width;
|
||||
pextra_widthp = widthp;
|
||||
|
||||
if (textclasslist.Style(GetCurrentTextClass(),
|
||||
layout).isEnvironment()) {
|
||||
LyXParagraph
|
||||
* par = this,
|
||||
* ppar = par;
|
||||
if (textclasslist.Style(GetCurrentTextClass(),
|
||||
layout).isEnvironment()) {
|
||||
LyXParagraph
|
||||
* par = this,
|
||||
* ppar = par;
|
||||
|
||||
while (par && (par->layout == layout) && (par->depth == depth)) {
|
||||
ppar = par;
|
||||
par = par->Previous();
|
||||
if (par)
|
||||
par = par->FirstPhysicalPar();
|
||||
while (par && par->depth > depth) {
|
||||
par = par->Previous();
|
||||
if (par)
|
||||
par = par->FirstPhysicalPar();
|
||||
}
|
||||
}
|
||||
par = ppar;
|
||||
while (par && (par->layout == layout) && (par->depth == depth)) {
|
||||
par->pextra_type = type;
|
||||
par->pextra_width = width;
|
||||
par->pextra_widthp = widthp;
|
||||
par = par->NextAfterFootnote();
|
||||
if (par && (par->depth > depth))
|
||||
par->SetPExtraType(type, width, widthp);
|
||||
while (par && ((par->depth > depth) || par->IsDummy()))
|
||||
par = par->NextAfterFootnote();
|
||||
}
|
||||
}
|
||||
while (par && (par->layout == layout)
|
||||
&& (par->depth == depth)) {
|
||||
ppar = par;
|
||||
par = par->Previous();
|
||||
if (par)
|
||||
par = par->FirstPhysicalPar();
|
||||
while (par && par->depth > depth) {
|
||||
par = par->Previous();
|
||||
if (par)
|
||||
par = par->FirstPhysicalPar();
|
||||
}
|
||||
}
|
||||
par = ppar;
|
||||
while (par && (par->layout == layout)
|
||||
&& (par->depth == depth)) {
|
||||
par->pextra_type = type;
|
||||
par->pextra_width = width;
|
||||
par->pextra_widthp = widthp;
|
||||
par = par->NextAfterFootnote();
|
||||
if (par && (par->depth > depth))
|
||||
par->SetPExtraType(type, width, widthp);
|
||||
while (par && ((par->depth > depth) || par->IsDummy()))
|
||||
par = par->NextAfterFootnote();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LyXParagraph::UnsetPExtraType()
|
||||
{
|
||||
if (pextra_type == PEXTRA_NONE)
|
||||
return;
|
||||
if (pextra_type == PEXTRA_NONE)
|
||||
return;
|
||||
|
||||
pextra_type = PEXTRA_NONE;
|
||||
pextra_width.clear();
|
||||
pextra_widthp.clear();
|
||||
pextra_type = PEXTRA_NONE;
|
||||
pextra_width.clear();
|
||||
pextra_widthp.clear();
|
||||
|
||||
if (textclasslist.Style(GetCurrentTextClass(),
|
||||
layout).isEnvironment()) {
|
||||
LyXParagraph
|
||||
* par = this,
|
||||
* ppar = par;
|
||||
if (textclasslist.Style(GetCurrentTextClass(),
|
||||
layout).isEnvironment()) {
|
||||
LyXParagraph
|
||||
* par = this,
|
||||
* ppar = par;
|
||||
|
||||
while (par && (par->layout == layout) && (par->depth == depth)) {
|
||||
ppar = par;
|
||||
par = par->Previous();
|
||||
if (par)
|
||||
par = par->FirstPhysicalPar();
|
||||
while (par && par->depth > depth) {
|
||||
par = par->Previous();
|
||||
if (par)
|
||||
par = par->FirstPhysicalPar();
|
||||
}
|
||||
}
|
||||
par = ppar;
|
||||
while (par && (par->layout == layout) && (par->depth == depth)) {
|
||||
par->pextra_type = PEXTRA_NONE;
|
||||
par->pextra_width.clear();
|
||||
par->pextra_widthp.clear();
|
||||
par = par->NextAfterFootnote();
|
||||
if (par && (par->depth > depth))
|
||||
par->UnsetPExtraType();
|
||||
while (par && ((par->depth > depth) || par->IsDummy()))
|
||||
par = par->NextAfterFootnote();
|
||||
}
|
||||
}
|
||||
while (par && (par->layout == layout)
|
||||
&& (par->depth == depth)) {
|
||||
ppar = par;
|
||||
par = par->Previous();
|
||||
if (par)
|
||||
par = par->FirstPhysicalPar();
|
||||
while (par && par->depth > depth) {
|
||||
par = par->Previous();
|
||||
if (par)
|
||||
par = par->FirstPhysicalPar();
|
||||
}
|
||||
}
|
||||
par = ppar;
|
||||
while (par && (par->layout == layout)
|
||||
&& (par->depth == depth)) {
|
||||
par->pextra_type = PEXTRA_NONE;
|
||||
par->pextra_width.clear();
|
||||
par->pextra_widthp.clear();
|
||||
par = par->NextAfterFootnote();
|
||||
if (par && (par->depth > depth))
|
||||
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
|
||||
{
|
||||
return IsWordChar( GetChar(pos) ) ;
|
||||
return IsWordChar(GetChar(pos)) ;
|
||||
}
|
||||
|
60
src/screen.C
60
src/screen.C
@ -30,8 +30,8 @@ LyXScreen::LyXScreen(Window window,
|
||||
Dimension offset_y,
|
||||
LyXText *text_ptr)
|
||||
: text(text_ptr), _window(window),
|
||||
_width(width), _height(height),
|
||||
_offset_x(offset_x), _offset_y(offset_y)
|
||||
_width(width), _height(height),
|
||||
_offset_x(offset_x), _offset_y(offset_y)
|
||||
{
|
||||
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)
|
||||
{
|
||||
Row* row = 0;
|
||||
long y_text = 0;
|
||||
long y = 0;
|
||||
|
||||
y_text = first + y1;
|
||||
long y_text = first + y1;
|
||||
|
||||
/* 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 = y_text - first;
|
||||
long y = y_text - first;
|
||||
/* y1 is now the real beginning of row on the screen */
|
||||
|
||||
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;
|
||||
|
||||
y = y_text - first;
|
||||
long y = y_text - first;
|
||||
|
||||
if (y + row->height > 0 && y - row->height <= _height) {
|
||||
/* ok there is something visible */
|
||||
@ -137,7 +131,7 @@ void LyXScreen::Draw(long y)
|
||||
{
|
||||
if (cursor_visible) HideCursor();
|
||||
|
||||
if (y<0) y = 0;
|
||||
if (y < 0) y = 0;
|
||||
long old_first = first;
|
||||
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)
|
||||
ShowManualCursor(x, y, asc, desc);
|
||||
else
|
||||
@ -304,7 +299,7 @@ void LyXScreen::ShowManualCursor(long x, long y, int asc, int desc)
|
||||
cursor_pixmap_w = 1;
|
||||
cursor_pixmap_h = y2 - y1 + 1;
|
||||
cursor_pixmap_x = x,
|
||||
cursor_pixmap_y = y1;
|
||||
cursor_pixmap_y = y1;
|
||||
cursor_pixmap =
|
||||
XCreatePixmap (fl_display,
|
||||
fl_root,
|
||||
@ -439,14 +434,14 @@ void LyXScreen::Update()
|
||||
DrawOneRow(text->refresh_row, y);
|
||||
text->status = LyXText::UNCHANGED;
|
||||
expose(0, text->refresh_y-first,
|
||||
_width, text->refresh_row->height);
|
||||
_width, text->refresh_row->height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LyXScreen::SmallUpdate()
|
||||
{
|
||||
Row *row = 0;
|
||||
Row * row = 0;
|
||||
long y = 0;
|
||||
long y2 = 0;
|
||||
|
||||
@ -486,12 +481,13 @@ void LyXScreen::SmallUpdate()
|
||||
|
||||
void LyXScreen::ToggleSelection(bool kill_selection)
|
||||
{
|
||||
long top = 0;
|
||||
long bottom = 0;
|
||||
|
||||
/* only if there is a selection */
|
||||
if (!text->selection)
|
||||
return;
|
||||
|
||||
long top = 0;
|
||||
long bottom = 0;
|
||||
|
||||
|
||||
if (fast_selection || mono_video){
|
||||
|
||||
@ -640,7 +636,7 @@ void LyXScreen::ToggleToggle()
|
||||
&& text->toggle_cursor.pos == text->toggle_end_cursor.pos)
|
||||
return;
|
||||
|
||||
if (fast_selection || mono_video){
|
||||
if (fast_selection || mono_video) {
|
||||
|
||||
/* selection only in one row ?*/
|
||||
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
|
||||
// draw the wrong color on other objects.
|
||||
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);
|
||||
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
|
||||
XPoint pl[4], pr[4];
|
||||
|
||||
pl[0].x = x-d; pl[0].y = y-d;
|
||||
pl[1].x = x-d; pl[1].y = y+h+d;
|
||||
pl[2].x = x; pl[2].y = y+h;
|
||||
pl[0].x = x - d; pl[0].y = y - d;
|
||||
pl[1].x = x - d; pl[1].y = y + h + d;
|
||||
pl[2].x = x; pl[2].y = y + h;
|
||||
pl[3].x = x; pl[3].y = y;
|
||||
|
||||
pr[0].x = x+w+d; pr[0].y = y-d;
|
||||
pr[1].x = x+w+d; pr[1].y = y+h+d;
|
||||
pr[2].x = x+w; pr[2].y = y+h;
|
||||
pr[3].x = x+w; pr[3].y = y;
|
||||
pr[0].x = x + w + d; pr[0].y = y - d;
|
||||
pr[1].x = x + w + d; pr[1].y = y + h + d;
|
||||
pr[2].x = x + w; pr[2].y = y + h;
|
||||
pr[3].x = x + w; pr[3].y = y;
|
||||
|
||||
fl_color(FL_LEFT_BCOL);
|
||||
XFillPolygon(fl_display,
|
||||
|
@ -3,8 +3,8 @@
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 1995 Matthias Ettrich
|
||||
* Copyright (C) 1995-1999 The LyX Team.
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-1999 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
|
||||
@ -114,7 +114,8 @@ private:
|
||||
|
||||
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;
|
||||
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)
|
||||
{
|
||||
// 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) {
|
||||
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,
|
||||
lyxstring::size_type n)
|
||||
lyxstring::size_type n)
|
||||
{
|
||||
if (res < n + sz) {
|
||||
do {
|
||||
@ -799,7 +801,7 @@ 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!
|
||||
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,
|
||||
size_type n) const
|
||||
size_type n) const
|
||||
{
|
||||
Assert(ptr); // OURS!
|
||||
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,
|
||||
size_type n) const
|
||||
size_type n) const
|
||||
{
|
||||
Assert(ptr); // OURS!
|
||||
TestlyxstringInvariant(this);
|
||||
|
151
src/table.C
151
src/table.C
@ -21,9 +21,9 @@
|
||||
#pragma implementation
|
||||
#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 */
|
||||
LyXTable::LyXTable(int rows_arg, int columns_arg)
|
||||
@ -34,18 +34,17 @@ LyXTable::LyXTable(int rows_arg, int columns_arg)
|
||||
|
||||
LyXTable::LyXTable(LyXLex &lex)
|
||||
{
|
||||
FILE *file = lex.getFile();
|
||||
FILE * file = lex.getFile();
|
||||
Read(file);
|
||||
}
|
||||
|
||||
|
||||
LyXTable::~LyXTable() {
|
||||
int i;
|
||||
delete[] rowofcell;
|
||||
delete[] columnofcell;
|
||||
delete[] column_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;
|
||||
@ -54,20 +53,20 @@ LyXTable::~LyXTable() {
|
||||
|
||||
LyXTable * LyXTable::Clone()
|
||||
{
|
||||
LyXTable *result = new LyXTable(rows, columns);
|
||||
LyXTable * result = new LyXTable(rows, columns);
|
||||
int row, column;;
|
||||
|
||||
for (row = 0; row<rows; row++){
|
||||
for (column = 0; column<columns;column++){
|
||||
for (row = 0; row < rows; ++row) {
|
||||
for (column = 0; column < columns; ++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];
|
||||
}
|
||||
|
||||
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].right_line = column_info[column].right_line;
|
||||
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 */
|
||||
void LyXTable::Init(int rows_arg, int columns_arg)
|
||||
{
|
||||
int i, j, cellno;
|
||||
int i, j;
|
||||
rows = rows_arg;
|
||||
columns = columns_arg;
|
||||
column_info = new columnstruct[columns];
|
||||
row_info = new rowstruct[rows];
|
||||
cell_info = new cellstruct*[rows];
|
||||
|
||||
cellno = 0;
|
||||
for (i = 0; i<rows;i++) {
|
||||
int cellno = 0;
|
||||
for (i = 0; i < rows; ++i) {
|
||||
cell_info[i] = new cellstruct[columns];
|
||||
row_info[i].top_line = true;
|
||||
row_info[i].bottom_line = false;
|
||||
row_info[i].is_cont_row = 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].width_of_cell = 0;
|
||||
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[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].right_line = false;
|
||||
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)
|
||||
{
|
||||
int row = row_of_cell(cell);
|
||||
rowstruct *row_info2 = new rowstruct[rows+1];
|
||||
cellstruct** cell_info2 = new cellstruct*[rows+1];
|
||||
rowstruct * row_info2 = new rowstruct[rows + 1];
|
||||
cellstruct ** cell_info2 = new cellstruct * [rows + 1];
|
||||
int i;
|
||||
|
||||
for (i = 0; i <= row; i++) {
|
||||
for (i = 0; i <= row; ++i) {
|
||||
cell_info2[i] = cell_info[i];
|
||||
row_info2[i] = row_info[i];
|
||||
}
|
||||
for (i = rows-1; i >= row; i--) {
|
||||
cell_info2[i+1] = cell_info[i];
|
||||
row_info2[i+1] = row_info[i];
|
||||
for (i = rows - 1; i >= row; --i) {
|
||||
cell_info2[i + 1] = cell_info[i];
|
||||
row_info2[i + 1] = row_info[i];
|
||||
}
|
||||
for (i = row;row_info[i].is_cont_row;i--);
|
||||
if (((row+1)>= rows) || !row_info[row+1].is_cont_row)
|
||||
row_info2[row+1].is_cont_row = false;
|
||||
row_info2[row+1].top_line = row_info[i].top_line;
|
||||
cell_info2[row+1] = new cellstruct[columns];
|
||||
for (i = 0; i<columns; i++) {
|
||||
cell_info2[row+1][i].width_of_cell = 0;
|
||||
cell_info2[row+1][i] = cell_info2[row][i];
|
||||
for (i = row; row_info[i].is_cont_row; --i);
|
||||
if (((row + 1) >= rows) || !row_info[row + 1].is_cont_row)
|
||||
row_info2[row + 1].is_cont_row = false;
|
||||
row_info2[row + 1].top_line = row_info[i].top_line;
|
||||
cell_info2[row + 1] = new cellstruct[columns];
|
||||
for (i = 0; i < columns; ++i) {
|
||||
cell_info2[row + 1][i].width_of_cell = 0;
|
||||
cell_info2[row + 1][i] = cell_info2[row][i];
|
||||
}
|
||||
|
||||
delete[] cell_info;
|
||||
@ -169,7 +168,7 @@ void LyXTable::AppendRow(int cell)
|
||||
delete[] row_info;
|
||||
row_info = row_info2;
|
||||
|
||||
rows++;
|
||||
++rows;
|
||||
|
||||
Reinit();
|
||||
}
|
||||
@ -180,29 +179,28 @@ void LyXTable::DeleteRow(int cell)
|
||||
int row = row_of_cell(cell);
|
||||
while(!row_info[row].is_cont_row && RowHasContRow(cell))
|
||||
DeleteRow(cell_info[row+1][0].cellno);
|
||||
rowstruct *row_info2 = new rowstruct[rows-1];
|
||||
cellstruct** cell_info2 = new cellstruct*[rows-1];
|
||||
int i;
|
||||
rowstruct * row_info2 = new rowstruct[rows - 1];
|
||||
cellstruct ** cell_info2 = new cellstruct * [rows - 1];
|
||||
|
||||
delete[] cell_info[row];
|
||||
for (i = 0; i < row; i++) {
|
||||
int i = 0;
|
||||
for (; i < row; ++i) {
|
||||
cell_info2[i] = cell_info[i];
|
||||
row_info2[i] = row_info[i];
|
||||
}
|
||||
if (row_info[i].is_cont_row)
|
||||
row_info2[i-1].bottom_line = row_info[i].bottom_line;
|
||||
for (i = row; i < rows - 1; i++) {
|
||||
cell_info2[i] = cell_info[i+1];
|
||||
row_info2[i] = row_info[i+1];
|
||||
row_info2[i - 1].bottom_line = row_info[i].bottom_line;
|
||||
for (i = row; i < rows - 1; ++i) {
|
||||
cell_info2[i] = cell_info[i + 1];
|
||||
row_info2[i] = row_info[i + 1];
|
||||
}
|
||||
|
||||
|
||||
delete[] cell_info;
|
||||
cell_info = cell_info2;
|
||||
delete[] row_info;
|
||||
row_info = row_info2;
|
||||
|
||||
rows--;
|
||||
--rows;
|
||||
|
||||
Reinit();
|
||||
}
|
||||
@ -210,63 +208,64 @@ void LyXTable::DeleteRow(int cell)
|
||||
|
||||
void LyXTable::AppendColumn(int cell)
|
||||
{
|
||||
int i, j;
|
||||
columnstruct *column_info2 = new columnstruct[columns+1];
|
||||
int j;
|
||||
columnstruct * column_info2 = new columnstruct[columns + 1];
|
||||
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];
|
||||
}
|
||||
for (i = columns-1; i>= column; i--){
|
||||
column_info2[i+1] = column_info[i];
|
||||
for (i = columns - 1; i >= column; --i) {
|
||||
column_info2[i + 1] = column_info[i];
|
||||
}
|
||||
|
||||
delete[] column_info;
|
||||
column_info = column_info2;
|
||||
|
||||
for (i = 0; i<rows;i++){
|
||||
cellstruct* tmp = cell_info[i];
|
||||
cell_info[i] = new cellstruct[columns+1];
|
||||
for (j = 0; j<= column; j++){
|
||||
for (i = 0; i < rows; ++i) {
|
||||
cellstruct * tmp = cell_info[i];
|
||||
cell_info[i] = new cellstruct[columns + 1];
|
||||
for (j = 0; j <= column; ++j) {
|
||||
cell_info[i][j] = tmp[j];
|
||||
}
|
||||
for (j = column; j<columns; j++){
|
||||
cell_info[i][j+1] = tmp[j];
|
||||
for (j = column; j < columns; ++j) {
|
||||
cell_info[i][j + 1] = tmp[j];
|
||||
}
|
||||
// care about multicolumns
|
||||
if (cell_info[i][column+1].multicolumn
|
||||
if (cell_info[i][column + 1].multicolumn
|
||||
== LyXTable::CELL_BEGIN_OF_MULTICOLUMN){
|
||||
cell_info[i][column+1].multicolumn =
|
||||
cell_info[i][column + 1].multicolumn =
|
||||
LyXTable::CELL_PART_OF_MULTICOLUMN;
|
||||
}
|
||||
if (column + 1 == columns
|
||||
|| cell_info[i][column+2].multicolumn
|
||||
|| cell_info[i][column + 2].multicolumn
|
||||
!= LyXTable::CELL_PART_OF_MULTICOLUMN){
|
||||
cell_info[i][column+1].multicolumn =
|
||||
cell_info[i][column + 1].multicolumn =
|
||||
LyXTable::CELL_NORMAL;
|
||||
}
|
||||
|
||||
delete[] tmp;
|
||||
}
|
||||
|
||||
columns++;
|
||||
++columns;
|
||||
Reinit();
|
||||
}
|
||||
|
||||
|
||||
void LyXTable::Reinit()
|
||||
{
|
||||
int i, j;
|
||||
int j;
|
||||
|
||||
for (i = 0; i<rows;i++) {
|
||||
for (j = 0; j<columns; j++) {
|
||||
int i = 0;
|
||||
for (; i < rows; ++i) {
|
||||
for (j = 0; j < columns; ++j) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i<columns;i++) {
|
||||
for (i = 0; i < columns; ++i) {
|
||||
calculate_width_of_column(i);
|
||||
}
|
||||
calculate_width_of_table();
|
||||
@ -277,11 +276,11 @@ void LyXTable::Reinit()
|
||||
|
||||
void LyXTable::set_row_column_number_info()
|
||||
{
|
||||
int row = 0;
|
||||
int c = 0;
|
||||
int column = 0;
|
||||
numberofcells = -1;
|
||||
for (row = 0; row<rows; ++row) {
|
||||
int row = 0;
|
||||
for (; row < rows; ++row) {
|
||||
for (column = 0; column<columns; ++column) {
|
||||
if (cell_info[row][column].multicolumn
|
||||
!= LyXTable::CELL_PART_OF_MULTICOLUMN)
|
||||
@ -303,15 +302,15 @@ void LyXTable::set_row_column_number_info()
|
||||
while (c < numberofcells && row < rows && column < columns) {
|
||||
rowofcell[c] = row;
|
||||
columnofcell[c] = column;
|
||||
c++;
|
||||
++c;
|
||||
do{
|
||||
column++;
|
||||
++column;
|
||||
} while (column < columns &&
|
||||
cell_info[row][column].multicolumn
|
||||
== LyXTable::CELL_PART_OF_MULTICOLUMN);
|
||||
if (column == columns){
|
||||
column = 0;
|
||||
row++;
|
||||
++row;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -321,12 +320,11 @@ void LyXTable::DeleteColumn(int cell)
|
||||
{
|
||||
int column1 = column_of_cell(cell);
|
||||
int column2 = right_column_of_cell(cell);
|
||||
int column;
|
||||
|
||||
if (column1 == 0 && column2 == columns - 1)
|
||||
return;
|
||||
|
||||
for (column = column1; column <= column2;column++){
|
||||
for (int column = column1; column <= column2; ++column) {
|
||||
delete_column(column1);
|
||||
}
|
||||
Reinit();
|
||||
@ -342,11 +340,10 @@ int LyXTable::GetNumberOfCells()
|
||||
int LyXTable::NumberOfCellsInRow(int cell)
|
||||
{
|
||||
int row = row_of_cell(cell);
|
||||
int i = 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)
|
||||
result++;
|
||||
++result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -405,6 +402,7 @@ bool LyXTable::LeftLine(int cell)
|
||||
return column_info[column_of_cell(cell)].left_line;
|
||||
}
|
||||
|
||||
|
||||
bool LyXTable::RightLine(int cell)
|
||||
{
|
||||
return column_info[right_column_of_cell(cell)].right_line;
|
||||
@ -434,7 +432,7 @@ bool LyXTable::TopAlreadyDrawed(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
|
||||
#endif
|
||||
if (version < 5) {
|
||||
fprintf(stderr, "Tabular format < 5 is not supported anymore\n"
|
||||
"Get an older version of LyX (< 1.1.x) for conversion!\n");
|
||||
lyxerr << "Tabular format < 5 is not supported anymore\n"
|
||||
"Get an older version of LyX (< 1.1.x) for conversion!"
|
||||
<< endl;
|
||||
return;
|
||||
}
|
||||
a = b = c = d = -1;
|
||||
|
212
src/toolbar.C
212
src/toolbar.C
@ -94,7 +94,7 @@
|
||||
#include "build.xpm"
|
||||
|
||||
// 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 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 },
|
||||
{ "\\end_toolbar", TO_ENDTOOLBAR },
|
||||
{ "\\layouts", TO_LAYOUTS },
|
||||
@ -126,7 +126,7 @@ Toolbar::Toolbar(Toolbar const &rct, LyXView *o, int x, int y)
|
||||
reset();
|
||||
|
||||
// extracts the toolbar struct form rct.
|
||||
toolbarItem *tmplist = rct.toollist;
|
||||
toolbarItem * tmplist = rct.toollist;
|
||||
while (tmplist != 0) {
|
||||
add(tmplist->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)
|
||||
{
|
||||
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,
|
||||
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)
|
||||
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);
|
||||
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,
|
||||
FL_Coord /*mx*/, FL_Coord /*my*/,
|
||||
int key, void * xev)
|
||||
FL_Coord /*mx*/, FL_Coord /*my*/,
|
||||
int key, void * 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());
|
||||
if (action == -1) {
|
||||
if (func == "separator"){
|
||||
action = TOOL_SEPARATOR;
|
||||
} else if (func == "layouts"){
|
||||
if (func == "separator"){
|
||||
action = TOOL_SEPARATOR;
|
||||
} else if (func == "layouts"){
|
||||
action = TOOL_LAYOUTS;
|
||||
} else action = 0;
|
||||
}
|
||||
@ -286,7 +287,7 @@ void Toolbar::set(bool doingmain)
|
||||
fl_addto_form(owner->getForm());
|
||||
}
|
||||
|
||||
#if FL_REVISION <86
|
||||
#if FL_REVISION < 86
|
||||
// Ensure borderwidth is 2 to get visual feedback
|
||||
int bw = fl_get_border_width();
|
||||
fl_set_border_width(-2);
|
||||
@ -299,63 +300,63 @@ void Toolbar::set(bool doingmain)
|
||||
|
||||
while(item != 0) {
|
||||
switch(item->action){
|
||||
case TOOL_SEPARATOR:
|
||||
xpos += sepspace;
|
||||
item = item->next;
|
||||
break;
|
||||
case TOOL_LAYOUTS:
|
||||
xpos += standardspacing;
|
||||
if (!combox)
|
||||
combox = new Combox(FL_COMBOX_DROPLIST);
|
||||
combox->add(xpos, ypos, 135, height, 300);
|
||||
combox->setcallback(LayoutsCB);
|
||||
combox->resize(FL_RESIZE_ALL);
|
||||
combox->gravity(NorthWestGravity, NorthWestGravity);
|
||||
item = item->next;
|
||||
xpos += 135;
|
||||
break;
|
||||
default:
|
||||
xpos += standardspacing;
|
||||
item->icon = obj =
|
||||
fl_add_pixmapbutton(FL_NORMAL_BUTTON,
|
||||
xpos, ypos,
|
||||
buttonwidth,
|
||||
height, "");
|
||||
fl_set_object_boxtype(obj, FL_UP_BOX);
|
||||
fl_set_object_color(obj, FL_MCOL, FL_BLUE);
|
||||
fl_set_object_resize(obj, FL_RESIZE_ALL);
|
||||
fl_set_object_gravity(obj,
|
||||
NorthWestGravity,
|
||||
NorthWestGravity);
|
||||
fl_set_object_callback(obj, C_Toolbar_ToolbarCB,
|
||||
static_cast<long>(item->action));
|
||||
case TOOL_SEPARATOR:
|
||||
xpos += sepspace;
|
||||
item = item->next;
|
||||
break;
|
||||
case TOOL_LAYOUTS:
|
||||
xpos += standardspacing;
|
||||
if (!combox)
|
||||
combox = new Combox(FL_COMBOX_DROPLIST);
|
||||
combox->add(xpos, ypos, 135, height, 300);
|
||||
combox->setcallback(LayoutsCB);
|
||||
combox->resize(FL_RESIZE_ALL);
|
||||
combox->gravity(NorthWestGravity, NorthWestGravity);
|
||||
item = item->next;
|
||||
xpos += 135;
|
||||
break;
|
||||
default:
|
||||
xpos += standardspacing;
|
||||
item->icon = obj =
|
||||
fl_add_pixmapbutton(FL_NORMAL_BUTTON,
|
||||
xpos, ypos,
|
||||
buttonwidth,
|
||||
height, "");
|
||||
fl_set_object_boxtype(obj, FL_UP_BOX);
|
||||
fl_set_object_color(obj, FL_MCOL, FL_BLUE);
|
||||
fl_set_object_resize(obj, FL_RESIZE_ALL);
|
||||
fl_set_object_gravity(obj,
|
||||
NorthWestGravity,
|
||||
NorthWestGravity);
|
||||
fl_set_object_callback(obj, C_Toolbar_ToolbarCB,
|
||||
static_cast<long>(item->action));
|
||||
#if FL_REVISION >85
|
||||
// Remove the blue feedback rectangle
|
||||
fl_set_pixmapbutton_focus_outline(obj, 0);
|
||||
// Remove the blue feedback rectangle
|
||||
fl_set_pixmapbutton_focus_outline(obj, 0);
|
||||
#endif
|
||||
|
||||
// set the bubble-help (Matthias)
|
||||
// set the bubble-help (Matthias)
|
||||
#warning This is dangerous!
|
||||
obj->u_vdata = const_cast<char*>(item->help.c_str());
|
||||
// we need to know what toolbar this item
|
||||
// belongs too. (Lgb)
|
||||
obj->u_ldata = reinterpret_cast<long>(this);
|
||||
obj->u_vdata = const_cast<char*>(item->help.c_str());
|
||||
// we need to know what toolbar this item
|
||||
// belongs too. (Lgb)
|
||||
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));
|
||||
item = item->next;
|
||||
// we must remember to update the positions
|
||||
xpos += buttonwidth;
|
||||
// ypos is constant
|
||||
/* Here will come a check to see if the new
|
||||
* pos is within the bounds of the main frame,
|
||||
* and perhaps wrap the toolbar if not.
|
||||
*/
|
||||
break;
|
||||
fl_set_pixmapbutton_data(obj, const_cast<char**>(item->pixmap));
|
||||
item = item->next;
|
||||
// we must remember to update the positions
|
||||
xpos += buttonwidth;
|
||||
// ypos is constant
|
||||
/* Here will come a check to see if the new
|
||||
* pos is within the bounds of the main frame,
|
||||
* and perhaps wrap the toolbar if not.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if FL_REVISION <86
|
||||
#if FL_REVISION < 86
|
||||
// Reset borderwidth to its default value.
|
||||
fl_set_border_width(bw);
|
||||
#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
|
||||
switch(action){
|
||||
@ -480,7 +481,8 @@ void Toolbar::add(int action, bool doclean)
|
||||
|
||||
if (lyxaction.isPseudoAction(action)) {
|
||||
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);
|
||||
help = lyxaction.helpText(act);
|
||||
help += " ";
|
||||
@ -495,21 +497,21 @@ void Toolbar::add(int action, bool doclean)
|
||||
if (pixmap != 0
|
||||
|| action == TOOL_SEPARATOR
|
||||
|| action == TOOL_LAYOUTS)
|
||||
{
|
||||
newItem = new toolbarItem;
|
||||
newItem->action = action;
|
||||
newItem->pixmap = pixmap;
|
||||
newItem->help = help;
|
||||
// the new item is placed at the end of the list
|
||||
tmp = toollist;
|
||||
if (tmp != 0){
|
||||
while(tmp->next != 0)
|
||||
tmp = tmp->next;
|
||||
// here is tmp->next == 0
|
||||
tmp->next = newItem;
|
||||
} else
|
||||
toollist = newItem;
|
||||
}
|
||||
{
|
||||
newItem = new toolbarItem;
|
||||
newItem->action = action;
|
||||
newItem->pixmap = pixmap;
|
||||
newItem->help = help;
|
||||
// the new item is placed at the end of the list
|
||||
tmp = toollist;
|
||||
if (tmp != 0){
|
||||
while(tmp->next != 0)
|
||||
tmp = tmp->next;
|
||||
// here is tmp->next == 0
|
||||
tmp->next = newItem;
|
||||
} else
|
||||
toollist = newItem;
|
||||
}
|
||||
//if (action == TOOL_LAYOUTS) {
|
||||
// combox = new Combox(FL_COMBOX_DROPLIST);
|
||||
//}
|
||||
@ -566,7 +568,7 @@ void Toolbar::push(int nth)
|
||||
int count = 0;
|
||||
toolbarItem * tmp = toollist;
|
||||
while (tmp) {
|
||||
count++;
|
||||
++count;
|
||||
if (count == nth) {
|
||||
fl_trigger_object(tmp->icon);
|
||||
return;
|
||||
@ -600,37 +602,37 @@ void Toolbar::read(LyXLex & lex)
|
||||
<< lex.GetString() << '\'' << endl;
|
||||
|
||||
switch(lex.lex()) {
|
||||
case TO_ADD:
|
||||
if (lex.EatLine()) {
|
||||
func = lex.GetString();
|
||||
lyxerr[Debug::TOOLBAR]
|
||||
<< "Toolbar::read TO_ADD func: `"
|
||||
<< func << "'" << endl;
|
||||
add(func);
|
||||
}
|
||||
break;
|
||||
case TO_ADD:
|
||||
if (lex.EatLine()) {
|
||||
func = lex.GetString();
|
||||
lyxerr[Debug::TOOLBAR]
|
||||
<< "Toolbar::read TO_ADD func: `"
|
||||
<< func << "'" << endl;
|
||||
add(func);
|
||||
}
|
||||
break;
|
||||
|
||||
case TO_SEPARATOR:
|
||||
add(TOOL_SEPARATOR);
|
||||
break;
|
||||
case TO_SEPARATOR:
|
||||
add(TOOL_SEPARATOR);
|
||||
break;
|
||||
|
||||
case TO_LAYOUTS:
|
||||
add(TOOL_LAYOUTS);
|
||||
break;
|
||||
case TO_LAYOUTS:
|
||||
add(TOOL_LAYOUTS);
|
||||
break;
|
||||
|
||||
case TO_NEWLINE:
|
||||
add(TOOL_NEWLINE);
|
||||
break;
|
||||
case TO_NEWLINE:
|
||||
add(TOOL_NEWLINE);
|
||||
break;
|
||||
|
||||
case TO_ENDTOOLBAR:
|
||||
// should not set automatically
|
||||
//set();
|
||||
quit = true;
|
||||
break;
|
||||
default:
|
||||
lex.printError("Toolbar::read: "
|
||||
"Unknown toolbar tag: `$$Token'");
|
||||
break;
|
||||
case TO_ENDTOOLBAR:
|
||||
// should not set automatically
|
||||
//set();
|
||||
quit = true;
|
||||
break;
|
||||
default:
|
||||
lex.printError("Toolbar::read: "
|
||||
"Unknown toolbar tag: `$$Token'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
lex.popTable();
|
||||
|
28
src/trans.C
28
src/trans.C
@ -46,9 +46,8 @@ string DefaultTrans::process(char c, TransManager & k)
|
||||
|
||||
Trans::Trans()
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 256; ++i)
|
||||
int i = 0;
|
||||
for(; i < 256; ++i)
|
||||
keymap_[i] = 0;
|
||||
|
||||
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)
|
||||
{
|
||||
Trans::keyexc p;
|
||||
|
||||
p = exclist;
|
||||
Trans::keyexc p = exclist;
|
||||
while (p) {
|
||||
p = exclist->next;
|
||||
delete exclist;
|
||||
@ -94,9 +91,8 @@ void Trans::FreeException(Trans::keyexc & exclist)
|
||||
|
||||
void Trans::FreeKeymap()
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 256; ++i)
|
||||
int i = 0;
|
||||
for(; i < 256; ++i)
|
||||
if (keymap_[i]) {
|
||||
delete keymap_[i];
|
||||
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 },
|
||||
{ "\\kmap", KMAP },
|
||||
{ "\\kmod", KMOD },
|
||||
@ -235,7 +231,8 @@ int Trans::Load(LyXLex & lex)
|
||||
tex_accent accent_2= getkeymod(str);
|
||||
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;
|
||||
|
||||
// Find what key accent_2 is on - should
|
||||
@ -317,7 +314,8 @@ int Trans::Load(LyXLex & lex)
|
||||
} else
|
||||
return -1;
|
||||
|
||||
InsertException(kmod_list_[accent]->exception_list, key, str);
|
||||
InsertException(kmod_list_[accent]->exception_list,
|
||||
key, str);
|
||||
break;
|
||||
}
|
||||
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)) ){
|
||||
return k.normalkey(c, dt);
|
||||
} 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
|
||||
<< "'" << 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;
|
||||
return static_cast<tex_accent>(i);
|
||||
}
|
||||
|
@ -302,21 +302,26 @@ void TransManager::insertVerbatim(string const & str, LyXText * text)
|
||||
|
||||
void TransManager::insert(string str, LyXText * text)
|
||||
{
|
||||
// Go through the character encoding only if the current
|
||||
// encoding (chset_->name()) matches the current font_norm
|
||||
// (lyrxc->font_norm
|
||||
// Go through the character encoding only if the current
|
||||
// encoding (chset_->name()) matches the current font_norm
|
||||
// (lyrxc->font_norm
|
||||
|
||||
if (chset_.getName() != lyxrc->font_norm ||
|
||||
! chset_.encodeString(str)) {
|
||||
// Could not find an encoding
|
||||
InsetLatexAccent ins(str);
|
||||
if (ins.CanDisplay()) {
|
||||
text->InsertInset(new InsetLatexAccent(ins));
|
||||
return;
|
||||
// Is false to speak about "only if" the current encoding will
|
||||
// almost always be equal to font_norm.
|
||||
pair<bool, int> enc = chset_.encodeString(str);
|
||||
if (chset_.getName() != lyxrc->font_norm ||
|
||||
!enc.first) {
|
||||
// Could not find an encoding
|
||||
InsetLatexAccent ins(str);
|
||||
if (ins.CanDisplay()) {
|
||||
text->InsertInset(new InsetLatexAccent(ins));
|
||||
} else {
|
||||
insertVerbatim(str, text);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
insertVerbatim(str, text);
|
||||
string tmp; tmp += static_cast<char>(enc.second);
|
||||
insertVerbatim(tmp, text);
|
||||
}
|
||||
|
||||
|
||||
|
60
src/vspace.C
60
src/vspace.C
@ -26,17 +26,17 @@
|
||||
#include "support/lstrings.h"
|
||||
|
||||
extern LyXRC * lyxrc;
|
||||
extern BufferView *current_view;
|
||||
extern BufferView * current_view;
|
||||
|
||||
/* 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)
|
||||
static char const * unit_name[num_units] = { "sp", "pt", "bp", "dd",
|
||||
"mm", "pc", "cc", "cm",
|
||||
"in", "ex", "em", "mu" };
|
||||
"mm", "pc", "cc", "cm",
|
||||
"in", "ex", "em", "mu" };
|
||||
|
||||
|
||||
LyXLength::UNIT unitFromString (string const & data)
|
||||
@ -121,7 +121,7 @@ static char nextToken (string & data)
|
||||
static struct {
|
||||
char const * pattern;
|
||||
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 },
|
||||
{ "nu+nu", 2, 0, 2, 0 },
|
||||
{ "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,
|
||||
// so we needn't check this.
|
||||
if (result) {
|
||||
result->val = number[1] * val_sign;
|
||||
result->uni = unit[1];
|
||||
result->plus_val = number[table[table_index].plus_val_index];
|
||||
result->minus_val = number[table[table_index].minus_val_index];
|
||||
result->plus_uni = unit [table[table_index].plus_uni_index];
|
||||
result->minus_uni = unit [table[table_index].minus_uni_index];
|
||||
result->val = number[1] * val_sign;
|
||||
result->uni = unit[1];
|
||||
result->plus_val = number[table[table_index].plus_val_index];
|
||||
result->minus_val = number[table[table_index].minus_val_index];
|
||||
result->plus_uni = unit [table[table_index].plus_uni_index];
|
||||
result->minus_uni = unit [table[table_index].minus_uni_index];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -258,8 +258,8 @@ bool isValidLength(string const & data, LyXLength * result)
|
||||
// It _was_ a correct length string.
|
||||
// Store away the values we found.
|
||||
if (result) {
|
||||
result->val = number[1]*val_sign;
|
||||
result->uni = unit[1];
|
||||
result->val = number[1] * val_sign;
|
||||
result->uni = unit[1];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -473,17 +473,17 @@ string VSpace::asLatexCommand() const
|
||||
switch (kin) {
|
||||
case NONE: return string();
|
||||
case DEFSKIP:
|
||||
return current_view->buffer()->params.getDefSkip().asLatexCommand();
|
||||
return current_view->buffer()->params.getDefSkip().asLatexCommand();
|
||||
case SMALLSKIP: return kp ? "\\vspace*{\\smallskipamount}"
|
||||
: "\\smallskip{}";
|
||||
: "\\smallskip{}";
|
||||
case MEDSKIP: return kp ? "\\vspace*{\\medskipamount}"
|
||||
: "\\medskip{}";
|
||||
: "\\medskip{}";
|
||||
case BIGSKIP: return kp ? "\\vspace*{\\bigskipamount}"
|
||||
: "\\bigskip{}";
|
||||
: "\\bigskip{}";
|
||||
case VFILL: return kp ? "\\vspace*{\\fill}"
|
||||
: "\\vfill{}";
|
||||
: "\\vfill{}";
|
||||
case LENGTH: return kp ? "\\vspace*{" + len.asLatexString() + '}'
|
||||
: "\\vspace{" + len.asLatexString() + '}';
|
||||
: "\\vspace{" + len.asLatexString() + '}';
|
||||
}
|
||||
return string(); // should never be reached
|
||||
}
|
||||
@ -492,11 +492,7 @@ string VSpace::asLatexCommand() const
|
||||
int VSpace::inPixels() const
|
||||
{
|
||||
// Height of a normal line in pixels (zoom factor considered)
|
||||
#ifdef MOVE_TEXT
|
||||
int height = current_view->text->DefaultHeight(); // [pixels]
|
||||
#else
|
||||
int height = current_view->buffer()->text->DefaultHeight(); // [pixels]
|
||||
#endif
|
||||
|
||||
// Zoom factor specified by user in percent
|
||||
float const zoom = lyxrc->zoom / 100.0; // [percent]
|
||||
@ -511,16 +507,16 @@ int VSpace::inPixels() const
|
||||
case NONE: return 0;
|
||||
|
||||
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
|
||||
// LateX. But there should be some way to change
|
||||
// this per document.
|
||||
// This is how the skips are normally defined by
|
||||
// LateX. But there should be some way to change
|
||||
// this per document.
|
||||
case SMALLSKIP: return height/4;
|
||||
case MEDSKIP: return height/2;
|
||||
case BIGSKIP: return height;
|
||||
case VFILL: return 3*height;
|
||||
// leave space for the vfill symbol
|
||||
// leave space for the vfill symbol
|
||||
case LENGTH:
|
||||
// Pixel values are scaled so that the ratio
|
||||
// between lengths and font sizes on the screen
|
||||
@ -551,7 +547,7 @@ int VSpace::inPixels() const
|
||||
case LyXLength::DD:
|
||||
// Didot: 1157dd = 1238 pt?
|
||||
result = zoom * dpi * value
|
||||
/ (72.27/(0.376 * 2.845)); // 67.559735
|
||||
/ (72.27 / (0.376 * 2.845)); // 67.559735
|
||||
break;
|
||||
case LyXLength::MM:
|
||||
// Millimeter: 1 mm = 1/25.4 inch
|
||||
@ -561,12 +557,12 @@ int VSpace::inPixels() const
|
||||
case LyXLength::PC:
|
||||
// Pica: 1 pc = 12 pt
|
||||
result = zoom * dpi * value
|
||||
/ (72.27/12); // 6.0225
|
||||
/ (72.27 / 12); // 6.0225
|
||||
break;
|
||||
case LyXLength::CC:
|
||||
// Cicero: 1 cc = 12 dd
|
||||
result = zoom * dpi * value
|
||||
/ (72.27/ (12*0.376*2.845)); // 5.6299779
|
||||
/ (72.27 / (12 * 0.376 * 2.845)); // 5.6299779
|
||||
break;
|
||||
case LyXLength::CM:
|
||||
// Centimeter: 1 cm = 1/2.54 inch
|
||||
@ -586,7 +582,7 @@ int VSpace::inPixels() const
|
||||
result = zoom * value * height / 2; // Why 2?
|
||||
break;
|
||||
case LyXLength::MU: // This is probably only allowed in
|
||||
// math mode
|
||||
// math mode
|
||||
result = zoom * value * height;
|
||||
break;
|
||||
case LyXLength::UNIT_NONE:
|
||||
|
Loading…
Reference in New Issue
Block a user