mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +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
713
src/BufferView.C
713
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();
|
||||
///
|
||||
@ -78,12 +75,10 @@ public:
|
||||
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()
|
||||
{
|
||||
|
@ -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:
|
||||
|
||||
@ -90,12 +90,14 @@ void LyXAction::init()
|
||||
{ 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_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_INSERT_BIBTEX, "bibtex-insert", N_("Insert bibtex"),
|
||||
Noop },
|
||||
{ LFUN_BIBTEX_STYLE, "bibtex-style", "", Noop },
|
||||
{ LFUN_BREAKLINE, "break-line", "", Noop },
|
||||
{ LFUN_BREAKPARAGRAPH, "break-paragraph", "", Noop },
|
||||
@ -134,17 +136,21 @@ void LyXAction::init()
|
||||
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_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_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_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 },
|
||||
@ -179,21 +185,28 @@ void LyXAction::init()
|
||||
{ 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_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_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_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_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_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_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 },
|
||||
@ -203,15 +216,20 @@ void LyXAction::init()
|
||||
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_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_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",
|
||||
@ -224,7 +242,8 @@ void LyXAction::init()
|
||||
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_SAVE_DEFAULT, "layout-save-default", "",
|
||||
ReadOnly },
|
||||
{ LFUN_LAYOUT_TABLE, "layout-table", "", Noop },
|
||||
{ LFUN_HOME, "line-begin",
|
||||
N_("Go to beginning of line"), ReadOnly },
|
||||
@ -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';
|
||||
<< arg << "] = " << (*aci).second << endl;
|
||||
|
||||
return (*aci).second;
|
||||
}
|
||||
@ -517,7 +537,8 @@ string LyXAction::getApproxFuncName(string const & func) const
|
||||
|
||||
string LyXAction::getActionName(int action) const
|
||||
{
|
||||
info_map::const_iterator iit = lyx_info_map.find(static_cast<kb_action>(action));
|
||||
info_map::const_iterator iit =
|
||||
lyx_info_map.find(static_cast<kb_action>(action));
|
||||
|
||||
return iit != lyx_info_map.end() ? (*iit).second.name : string();
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
@ -212,7 +214,6 @@ FD_form_main * LyXView::create_form_form_main(int width, int height)
|
||||
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()
|
||||
@ -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 \
|
||||
|
@ -76,11 +76,7 @@ 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
|
||||
|
||||
EnableParagraphExtra();
|
||||
|
||||
@ -175,11 +171,7 @@ void ParagraphExtraApplyCB(FL_OBJECT *, long)
|
||||
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;
|
||||
@ -205,11 +197,7 @@ void ParagraphExtraApplyCB(FL_OBJECT *, long)
|
||||
}
|
||||
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;
|
||||
|
@ -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,14 +459,12 @@ 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)"));
|
||||
@ -689,21 +473,12 @@ void SetPWidthCB(FL_OBJECT *ob, long)
|
||||
}
|
||||
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++;
|
||||
|
20
src/buffer.h
20
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;
|
||||
@ -94,12 +93,6 @@ public:
|
||||
if (users) {
|
||||
users->resize();
|
||||
}
|
||||
#ifndef MOVE_TEXT
|
||||
else if (text) {
|
||||
delete text;
|
||||
text = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Update window titles of all users
|
||||
@ -119,11 +112,6 @@ public:
|
||||
*/
|
||||
void delUser(BufferView *){ users = 0; }
|
||||
|
||||
#ifndef MOVE_TEXT
|
||||
///
|
||||
void update(signed char f);
|
||||
#endif
|
||||
|
||||
///
|
||||
void redraw() {
|
||||
users->redraw();
|
||||
@ -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;
|
||||
|
||||
|
@ -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
|
||||
@ -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;
|
||||
}
|
||||
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
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 */
|
||||
@ -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 "
|
||||
@ -239,13 +243,16 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
|
||||
// This must be correct.
|
||||
delete [] cmap;
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "Putting image back" << endl;
|
||||
lyxerr << "Putting image back"
|
||||
<< endl;
|
||||
}
|
||||
XPutImage(tmpdisp, p->bitmap, gc, im, 0, 0,
|
||||
XPutImage(tmpdisp, p->bitmap,
|
||||
gc, im, 0, 0,
|
||||
0, 0, p->wid, p->hgh);
|
||||
XDestroyImage(im);
|
||||
if (lyxerr.debugging()) {
|
||||
lyxerr << "Done translation" << endl;
|
||||
lyxerr << "Done translation"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
noim:
|
||||
@ -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,7 +390,7 @@ 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,
|
||||
@ -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;
|
||||
}
|
||||
@ -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));
|
||||
@ -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) {
|
||||
@ -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,
|
||||
@ -2158,7 +2176,9 @@ 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
|
||||
WriteAlert(_("Filename can't contain any "
|
||||
"of these characters:"),
|
||||
// xgettext:no-c-format
|
||||
_("space, '#', '~', '$' or '%'."));
|
||||
error = true;
|
||||
}
|
||||
|
@ -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,7 +75,7 @@ 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, "");
|
||||
@ -113,7 +107,7 @@ 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, "");
|
||||
@ -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"));
|
||||
}
|
||||
}
|
||||
@ -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()
|
||||
{
|
||||
@ -240,7 +240,8 @@ void InsetLatexAccent::checkContents()
|
||||
temp.erase(3, string::npos);
|
||||
temp += '\\';
|
||||
temp += char(ic);
|
||||
for(string::size_type j = 4; j < contents.length(); ++j)
|
||||
for(string::size_type j = 4;
|
||||
j < contents.length(); ++j)
|
||||
temp+= contents[j];
|
||||
contents= temp;
|
||||
++i;
|
||||
@ -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;
|
||||
}
|
||||
|
190
src/kbmap.C
190
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;
|
||||
printKeysym(key, mod, buf); // RVDK_PATCH_5
|
||||
|
||||
if ( len == 0 ) {
|
||||
*buf = '\0';
|
||||
return -1;
|
||||
}
|
||||
|
||||
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 ---
|
||||
@ -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. */
|
||||
// Return when keymap has no table.
|
||||
if (!table) return;
|
||||
|
||||
if ( maxLen <= 3 || !buf ) return maxLen;
|
||||
if ( !table ) return maxLen;
|
||||
*buf = '\0';
|
||||
|
||||
/* -------> Hash table. Process each of its slots recursively and return. */
|
||||
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;
|
||||
}
|
||||
|
||||
|
16
src/kbmap.h
16
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;
|
||||
|
||||
@ -57,7 +60,7 @@ public:
|
||||
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);
|
||||
@ -73,14 +76,17 @@ private:
|
||||
|
||||
/// 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
|
||||
};
|
||||
|
||||
|
||||
@ -114,10 +120,10 @@ public:
|
||||
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();
|
||||
|
@ -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
|
||||
@ -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:
|
||||
|
694
src/lyx_cb.C
694
src/lyx_cb.C
File diff suppressed because it is too large
Load Diff
@ -66,7 +66,8 @@ bool setForegroundColor(char const * const color, XGCValues & val)
|
||||
{
|
||||
val.foreground = xcol.pixel;
|
||||
} else {
|
||||
lyxerr << "LyX: Couldn't get color " << color << endl;
|
||||
lyxerr << "LyX: Couldn't get color "
|
||||
<< color << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
@ -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);
|
||||
|
138
src/lyxfr1.C
138
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);
|
||||
|
||||
//-------------------------------------------------------------
|
||||
|
||||
@ -65,8 +65,8 @@ void SetSelectionOverLenChars(LyXText *lt, int len);
|
||||
string const GetCurrentSelectionAsString(LyXText * lt)
|
||||
{
|
||||
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,7 +77,7 @@ string const GetCurrentSelectionAsString(LyXText * lt)
|
||||
int i = 0;
|
||||
bool fPrevIsSpace = false;
|
||||
char ch;
|
||||
while ((i < LYXSEARCH_MAXLEN-2) &&
|
||||
while ((i < LYXSEARCH_MAXLEN - 2) &&
|
||||
(pos < par->Last()) && (pos < endpos)) {
|
||||
ch = par->GetChar(pos);
|
||||
|
||||
@ -85,7 +85,7 @@ string const GetCurrentSelectionAsString(LyXText * lt)
|
||||
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 :-(
|
||||
@ -219,12 +193,12 @@ void LyXFindReplace1::SearchReplaceAllCB()
|
||||
|
||||
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;
|
||||
|
||||
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)
|
||||
{
|
||||
if (!par) return false;
|
||||
|
||||
char chSrch = 0;
|
||||
char chText;
|
||||
|
||||
if (!par)
|
||||
return false;
|
||||
|
||||
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;
|
||||
|
2209
src/lyxfunc.C
2209
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;
|
||||
@ -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 },
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
///
|
||||
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,10 +127,10 @@ 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 drawText(LyXFont const & font, char const *,
|
||||
int n, int baseline, int x);
|
||||
///
|
||||
int drawString(LyXFont const &font, string const &str,
|
||||
int drawString(LyXFont const & font, string const & str,
|
||||
int baseline, int x);
|
||||
|
||||
/// first visible pixel-row
|
||||
@ -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,34 +278,39 @@ 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,
|
||||
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,
|
||||
inline
|
||||
int LyXScreen::drawString(LyXFont const & font, string const & str,
|
||||
int baseline, int x)
|
||||
{
|
||||
return font.drawString(str, foreground, baseline, x);
|
||||
|
335
src/menus.C
335
src/menus.C
@ -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);
|
||||
@ -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);
|
||||
@ -1691,7 +1360,7 @@ 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
|
||||
|
132
src/paragraph.C
132
src/paragraph.C
@ -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);
|
||||
@ -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);
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -3804,8 +3819,9 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow,
|
||||
// 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
|
||||
// output correctly. However, tables can
|
||||
// also be paragraphs so don't adjust them.
|
||||
// ARRae
|
||||
file += '\n';
|
||||
texrow.newline();
|
||||
}
|
||||
@ -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(),
|
||||
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(),
|
||||
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"
|
||||
@ -4173,7 +4195,8 @@ void LyXParagraph::SetPExtraType(int type, char const * width,
|
||||
* par = this,
|
||||
* ppar = par;
|
||||
|
||||
while (par && (par->layout == layout) && (par->depth == depth)) {
|
||||
while (par && (par->layout == layout)
|
||||
&& (par->depth == depth)) {
|
||||
ppar = par;
|
||||
par = par->Previous();
|
||||
if (par)
|
||||
@ -4185,7 +4208,8 @@ void LyXParagraph::SetPExtraType(int type, char const * width,
|
||||
}
|
||||
}
|
||||
par = ppar;
|
||||
while (par && (par->layout == layout) && (par->depth == depth)) {
|
||||
while (par && (par->layout == layout)
|
||||
&& (par->depth == depth)) {
|
||||
par->pextra_type = type;
|
||||
par->pextra_width = width;
|
||||
par->pextra_widthp = widthp;
|
||||
@ -4214,7 +4238,8 @@ void LyXParagraph::UnsetPExtraType()
|
||||
* par = this,
|
||||
* ppar = par;
|
||||
|
||||
while (par && (par->layout == layout) && (par->depth == depth)) {
|
||||
while (par && (par->layout == layout)
|
||||
&& (par->depth == depth)) {
|
||||
ppar = par;
|
||||
par = par->Previous();
|
||||
if (par)
|
||||
@ -4226,7 +4251,8 @@ void LyXParagraph::UnsetPExtraType()
|
||||
}
|
||||
}
|
||||
par = ppar;
|
||||
while (par && (par->layout == layout) && (par->depth == depth)) {
|
||||
while (par && (par->layout == layout)
|
||||
&& (par->depth == depth)) {
|
||||
par->pextra_type = PEXTRA_NONE;
|
||||
par->pextra_width.clear();
|
||||
par->pextra_widthp.clear();
|
||||
@ -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)) ;
|
||||
}
|
||||
|
52
src/screen.C
52
src/screen.C
@ -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
|
||||
@ -446,7 +441,7 @@ void LyXScreen::Update()
|
||||
|
||||
void LyXScreen::SmallUpdate()
|
||||
{
|
||||
Row *row = 0;
|
||||
Row * row = 0;
|
||||
long y = 0;
|
||||
long y2 = 0;
|
||||
|
||||
@ -486,13 +481,14 @@ 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){
|
||||
|
||||
/* selection only in one row ?*/
|
||||
@ -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;
|
||||
|
149
src/table.C
149
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;
|
||||
|
@ -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);
|
||||
@ -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);
|
||||
@ -355,7 +356,7 @@ void Toolbar::set(bool doingmain)
|
||||
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 += " ";
|
||||
@ -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;
|
||||
|
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);
|
||||
}
|
||||
|
@ -306,17 +306,22 @@ void TransManager::insert(string str, LyXText * text)
|
||||
// encoding (chset_->name()) matches the current font_norm
|
||||
// (lyrxc->font_norm
|
||||
|
||||
// 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 ||
|
||||
! chset_.encodeString(str)) {
|
||||
!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);
|
||||
}
|
||||
|
||||
|
||||
|
14
src/vspace.C
14
src/vspace.C
@ -26,7 +26,7 @@
|
||||
#include "support/lstrings.h"
|
||||
|
||||
extern LyXRC * lyxrc;
|
||||
extern BufferView *current_view;
|
||||
extern BufferView * current_view;
|
||||
|
||||
/* length units
|
||||
*/
|
||||
@ -258,7 +258,7 @@ 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->val = number[1] * val_sign;
|
||||
result->uni = unit[1];
|
||||
}
|
||||
return true;
|
||||
@ -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]
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user