read the ChangeLog, use the C++ style casts more, some changes to the debugbufs, some whitespace changes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@366 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 1999-12-13 00:05:34 +00:00
parent 9ae99cab29
commit 6130fe1aa5
50 changed files with 747 additions and 787 deletions

View File

@ -1,3 +1,22 @@
1999-12-12 Lars Gullik Bjønnes <larsbj@lyx.org>
* Makefile.in.in (MKINSTALLDIRS): use $(srcdir)/@MKINSTALLDIRS@
* intl/Makefile.in (MKINSTALLDIRS): ditto
* src/LyXAction.C (init): changed to hold the LFUN data in a
automatic array in stead of in callso to newFunc, this speeds up
compilation a lot. Also all the memory used by the array is
returned when the init is completed.
* a lot of files: compiled with -Wold-style-cast, changed most of
the reported offenders to C++ style casts. Did not change the
offenders in C files.
* src/trans.h (Match): change argument type to unsigned int.
* src/support/DebugStream.C: fix some types on the streambufs so
that it works on a conforming implementation.
1999-12-10 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* lib/examples/example_{raw,lyxified}.lyx: fix embarassing sentence.

View File

@ -184,8 +184,8 @@ dnl Check the version of g++
elif test $ac_cv_prog_cxx_g = yes; then
case $gxx_version in
2.7*) CXXFLAGS="$lyx_opt";;
2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive";;
2.95.*) CXXFLAGS="-g $lyx_opt";;
2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";;
2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti";;
*) CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";;
esac
else

View File

@ -141,7 +141,6 @@ LYX_ERROR(dnl
the development tools.])
fi
### Setup GNU gettext
dnl GNU gettext is written in C
AC_LANG_C

View File

@ -43,24 +43,24 @@
#include "layout.h"
extern BufferList bufferlist;
void sigchldhandler(pid_t pid, int *status);
void sigchldhandler(pid_t pid, int * status);
extern void SetXtermCursor(Window win);
extern bool input_prohibited;
extern bool selection_possible;
extern void BeforeChange();
extern char ascii_type;
extern int UnlockInset(UpdatableInset* inset);
extern int UnlockInset(UpdatableInset * inset);
extern void ToggleFloat();
extern void MenuPasteSelection(char at);
extern InsetUpdateStruct *InsetUpdateList;
extern InsetUpdateStruct * InsetUpdateList;
extern void UpdateInsetUpdateList();
extern void FreeUpdateTimer();
// This is _very_ temporary
FL_OBJECT * figinset_canvas;
BufferView::BufferView(LyXView *o, int xpos, int ypos,
BufferView::BufferView(LyXView * o, int xpos, int ypos,
int width, int height)
: owner_(o)
{
@ -93,7 +93,7 @@ BufferView::~BufferView()
}
void BufferView::buffer(Buffer *b)
void BufferView::buffer(Buffer * b)
{
lyxerr[Debug::INFO] << "Setting buffer in BufferView" << endl;
if (buffer_) {
@ -470,27 +470,39 @@ void BufferView::gotoError()
}
extern "C" {
// Just a bunch of C wrappers around static members of BufferView
extern "C" void C_BufferView_UpCB(FL_OBJECT * ob, long buf) {
BufferView::UpCB(ob, buf);
}
void C_BufferView_UpCB(FL_OBJECT * ob, long buf)
{
BufferView::UpCB(ob, buf);
}
extern "C" void C_BufferView_DownCB(FL_OBJECT * ob, long buf) {
BufferView::DownCB(ob, buf);
}
extern "C" void C_BufferView_ScrollCB(FL_OBJECT * ob, long buf) {
BufferView::ScrollCB(ob, buf);
}
void C_BufferView_DownCB(FL_OBJECT * ob, long buf)
{
BufferView::DownCB(ob, buf);
}
extern "C" void C_BufferView_CursorToggleCB(FL_OBJECT * ob, long buf) {
BufferView::CursorToggleCB(ob, buf);
}
extern "C" int C_BufferView_work_area_handler(FL_OBJECT * ob, int event,
FL_Coord, FL_Coord,
int key, void * xev) {
return BufferView::work_area_handler(ob, event, 0, 0, key, xev);
void C_BufferView_ScrollCB(FL_OBJECT * ob, long buf)
{
BufferView::ScrollCB(ob, buf);
}
void C_BufferView_CursorToggleCB(FL_OBJECT * ob, long buf)
{
BufferView::CursorToggleCB(ob, buf);
}
int C_BufferView_work_area_handler(FL_OBJECT * ob, int event,
FL_Coord, FL_Coord,
int key, void * xev)
{
return BufferView::work_area_handler(ob, event,
0, 0, key, xev);
}
}
@ -576,9 +588,9 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
fl_set_border_width(-2); // to get visible feedback
#endif
button_down = obj = fl_add_pixmapbutton(FL_TOUCH_BUTTON,
width-15+4*bw,
ypos + height-15,
15, 15, "");
width - 15 + 4 * bw,
ypos + height - 15,
15, 15, "");
fl_set_object_boxtype(obj, FL_UP_BOX);
fl_set_object_color(obj, FL_MCOL, FL_BLUE);
fl_set_object_resize(obj, FL_RESIZE_ALL);
@ -588,7 +600,7 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
fl_set_pixmapbutton_data(obj, const_cast<char**>(down_xpm));
fl_set_border_width(-bw);
#if FL_REVISION >85
#if FL_REVISION > 85
// Remove the blue feedback rectangle
fl_set_pixmapbutton_focus_outline(obj, 0);
#endif
@ -612,9 +624,8 @@ void BufferView::UpCB(FL_OBJECT * ob, long)
if (view->buffer_ == 0) return;
XEvent const * ev2;
static long time = 0;
ev2 = fl_last_event();
XEvent const * ev2 = fl_last_event();
if (ev2->type == ButtonPress || ev2->type == ButtonRelease)
time = 0;
int button = fl_get_button_numb(ob);
@ -1854,7 +1865,7 @@ void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
// these comments posted to lyx@via
{
int status = 1;
int pid = waitpid((pid_t)0, &status, WNOHANG);
int pid = waitpid(static_cast<pid_t>(0), &status, WNOHANG);
if (pid == -1) // error find out what is wrong
; // ignore it for now.
else if (pid > 0)

View File

@ -33,7 +33,7 @@ string FontInfo::getFontname(int size)
int closestind = -1;
double error = 100000;
for (int i = 0; i<matches; i++) {
for (int i = 0; i < matches; ++i) {
if (sizes[i] == 0) {
// Scalable font should not be considered close
} else if (sizes[i] == size) {
@ -125,7 +125,7 @@ void FontInfo::query()
strings = new string[matches];
// We have matches. Run them through
for(int i = 0; i<matches; i++) {
for(int i = 0; i < matches; ++i) {
string name(list[i]);
sizes[i] = atoi(token(name, '-', 7).c_str());
strings[i] = name;

View File

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

View File

@ -177,14 +177,13 @@ lyx_SOURCES = \
lyx_main.o: lyx_main.C lyx_main.h config.h version.h debug.h gettext.h \
lyx_gui.h lyx_gui_misc.h lyxrc.h support/path.h support/filetools.h \
bufferlist.h debug.h support/FileInfo.h lastfiles.h intl.h \
bufferlist.h support/FileInfo.h lastfiles.h intl.h \
lyxserver.h layout.h gettext.h
$(CXXCOMPILE) -DLYX_DIR=\"$(LYX_DIR)\" -DTOP_SRCDIR=\"$(top_srcdir)\" \
-DLYX_NAME=\"$(PACKAGE)\" -c $(top_srcdir)/src/lyx_main.C
-c $(top_srcdir)/src/lyx_main.C
main.o: main.C config.h lyx_main.h gettext.h LString.h support/filetools.h
$(CXXCOMPILE) -DPACKAGE=\"$(PACKAGE)\" -DLOCALEDIR=\"$(localedir)\" \
-c ${top_srcdir}/src/main.C
$(CXXCOMPILE) -DLOCALEDIR=\"$(localedir)\" -c $(top_srcdir)/src/main.C
dist-hook:
cd $(distdir) ; rm -rf `find cheaders -name \*CVS\*`

View File

@ -374,14 +374,14 @@ int fl_get_bmtable(FL_OBJECT *ob)
/*
* You can change the max number of items if you want.
*/
void fl_set_bmtable_maxitems(FL_OBJECT *ob, int i)
void fl_set_bmtable_maxitems(FL_OBJECT * ob, int i)
{
if (i>0 && (BMTABLE_SPEC *)ob->spec)
if (i > 0 && (BMTABLE_SPEC *)ob->spec)
((BMTABLE_SPEC *)ob->spec)->maxi = i;
}
int fl_get_bmtable_maxitems(FL_OBJECT *ob)
int fl_get_bmtable_maxitems(FL_OBJECT * ob)
{
if ((BMTABLE_SPEC *)ob->spec)
return ((BMTABLE_SPEC *)ob->spec)->maxi;
@ -417,7 +417,7 @@ int fl_get_bmtable_numb(FL_OBJECT *ob)
}
Pixmap fl_get_bmtable_pixmap(FL_OBJECT *ob)
Pixmap fl_get_bmtable_pixmap(FL_OBJECT * ob)
{
if ((BMTABLE_SPEC *)ob->spec)
return ((BMTABLE_SPEC *)ob->spec)->pix;
@ -426,11 +426,11 @@ Pixmap fl_get_bmtable_pixmap(FL_OBJECT *ob)
}
void fl_draw_bmtable_item(FL_OBJECT *ob, int i, Drawable d, int xx, int yy)
void fl_draw_bmtable_item(FL_OBJECT * ob, int i, Drawable d, int xx, int yy)
{
int x, y, w, h;
GC gc = fl_state[fl_get_vclass()].gc[0];
BMTABLE_SPEC *sp = (BMTABLE_SPEC *)ob->spec;
BMTABLE_SPEC * sp = (BMTABLE_SPEC *)ob->spec;
if (sp && sp->pix) {
x = (i % sp->nx)*sp->dx + FL_abs(ob->bw);

View File

@ -420,7 +420,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
tmpret = lex.FindToken(string_footnotekinds);
if (tmpret == -1) tmpret++;
if (tmpret != LYX_LAYOUT_DEFAULT)
footnotekind = (LyXParagraph::footnote_kind)tmpret; // bad
footnotekind = static_cast<LyXParagraph::footnote_kind>(tmpret); // bad
if (footnotekind == LyXParagraph::FOOTNOTE
|| footnotekind == LyXParagraph::MARGIN)
footnoteflag = LyXParagraph::CLOSED_FOOTNOTE;
@ -2201,7 +2201,7 @@ void Buffer::makeLinuxDocFile(string const & filename, int column)
string userName(getUserName());
ofs << "<!-- LinuxDoc file was created by LyX 1.0 (C) 1995-1999 "
<< "by <" << userName << "> " << (char*)date() << " -->\n";
<< "by <" << userName << "> " << date() << " -->\n";
if(params.options.empty())
sgmlOpenTag(ofs, 0, top_element);
@ -2791,7 +2791,7 @@ void Buffer::makeDocBookFile(string const & filename, int column)
string userName(getUserName());
ofs << "<!-- DocBook file was created by LyX 1.0 (C) 1995-1999\n"
<< "by <" << userName << "> " << (char*)date() << " -->\n";
<< "by <" << userName << "> " << date() << " -->\n";
if(params.options.empty())
sgmlOpenTag(ofs, 0, top_element);

View File

@ -162,9 +162,8 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
FileInfo finfo(buf->fileName());
if (finfo.exist()) {
mode_t fmode = finfo.getMode();
struct utimbuf * times = new struct utimbuf;
struct utimbuf *times =
(struct utimbuf*)new char[sizeof(struct utimbuf)];
times->actime = finfo.getAccessTime();
times->modtime = finfo.getModificationTime();
long blksize = finfo.getBlockSize();

View File

@ -197,8 +197,8 @@ void Combox::add(int x, int y, int w, int hmin, int hmax)
}
} // end of switch
label->u_vdata = (void*)this;
button->u_vdata = (void*)this;
label->u_vdata = this;
button->u_vdata = this;
// Hmm, it seems fl_create_browser is broken in xforms 0.86.
// We have to work around that by creating the dropped browser form
@ -207,7 +207,7 @@ void Combox::add(int x, int y, int w, int hmin, int hmax)
FL_FORM * current_form = fl_current_form;
fl_end_form();
bw = w+20; bh = hmax-hmin-12;
bw = w + 20; bh = hmax - hmin - 12;
form = fl_bgn_form(FL_NO_BOX, bw, bh);
browser = obj = fl_add_browser(FL_HOLD_BROWSER, 0, 0, bw, bh, "");
@ -216,7 +216,7 @@ void Combox::add(int x, int y, int w, int hmin, int hmax)
fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity);
fl_set_object_callback(obj, C_Combox_combo_cb, 2);
fl_end_form();
browser->u_vdata = (void*)this;
browser->u_vdata = this;
form->u_vdata = browser;
fl_register_raw_callback(form,
ButtonPressMask|KeyPressMask,
@ -309,23 +309,23 @@ void Combox::deactivate()
void Combox::input_cb(FL_OBJECT *ob, long)
{
Combox *combo = (Combox*)ob->u_vdata;
Combox * combo = static_cast<Combox*>(ob->u_vdata);
char const *text = fl_get_input(ob);
char const * text = fl_get_input(ob);
combo->addto(text);
combo->is_empty = false;
}
extern "C" void C_Combox_input_cb(FL_OBJECT *ob, long data)
extern "C" void C_Combox_input_cb(FL_OBJECT * ob, long data)
{
Combox::input_cb(ob, data);
}
void Combox::combo_cb(FL_OBJECT *ob, long data)
void Combox::combo_cb(FL_OBJECT * ob, long data)
{
Combox *combo = (Combox*)ob->u_vdata;
Combox * combo = static_cast<Combox*>(ob->u_vdata);
switch (data) {
case 0:
{
@ -357,39 +357,40 @@ void Combox::combo_cb(FL_OBJECT *ob, long data)
}
}
extern "C" void C_Combox_combo_cb(FL_OBJECT *ob, long data)
extern "C" void C_Combox_combo_cb(FL_OBJECT * ob, long data)
{
Combox::combo_cb(ob, data);
}
int Combox::peek_event(FL_FORM * form, void *xev)
int Combox::peek_event(FL_FORM * form, void * xev)
{
FL_OBJECT *ob = (FL_OBJECT *)form->u_vdata;
Combox *combo = (Combox*)ob->u_vdata;
FL_OBJECT * ob = static_cast<FL_OBJECT *>(form->u_vdata);
Combox * combo = static_cast<Combox*>(ob->u_vdata);
#if FL_REVISION < 86
if(((XEvent *)xev)->type == ButtonPress && !ob->belowmouse)
#endif
#if FL_REVISION > 85
// I don't know why belowmouse does not work, but it doesn't. (Asger)
if (((XEvent *) xev)->type == ButtonPress && (
((XEvent *)xev)->xbutton.x - ob->x < 0 ||
((XEvent *)xev)->xbutton.x - ob->x > ob->w ||
((XEvent *)xev)->xbutton.y - ob->y < 0 ||
((XEvent *)xev)->xbutton.y - ob->y > ob->h))
// Are we sure?
if (static_cast<XEvent *>(xev)->type == ButtonPress && (
static_cast<XEvent *>(xev)->xbutton.x - ob->x < 0 ||
static_cast<XEvent *>(xev)->xbutton.x - ob->x > ob->w ||
static_cast<XEvent *>(xev)->xbutton.y - ob->y < 0 ||
static_cast<XEvent *>(xev)->xbutton.y - ob->y > ob->h))
#endif
{
combo->Hide(1);
return 1;
}
if (((XEvent*)xev)->type != KeyPress) return 0;
if (static_cast<XEvent*>(xev)->type != KeyPress) return 0;
char s_r[10];
static int num_bytes;
KeySym keysym_return;
num_bytes = XLookupString(&((XEvent*)xev)->xkey, s_r, 10,
num_bytes = XLookupString(&static_cast<XEvent*>(xev)->xkey, s_r, 10,
&keysym_return, 0);
XFlush(fl_display);
switch (keysym_return) {

View File

@ -203,12 +203,12 @@ int Combox::get()
}
inline
char const*Combox::getline()
char const * Combox::getline()
{
if (type == FL_COMBOX_INPUT)
return fl_get_input(label);
else
return ((browser) ? fl_get_browser_line(browser, sel): (char const*)0);
return browser ? fl_get_browser_line(browser, sel) : 0;
}
#endif

View File

@ -122,5 +122,3 @@ ostream & operator<<(ostream & o, Debug::type t);
extern DebugStream lyxerr;
#endif

View File

@ -367,14 +367,14 @@ void InitFigures()
Visual *vi;
bmparrsize = figarrsize = figallocchunk;
figures = (Figref**) malloc(sizeof(Figref*)*figallocchunk);
bitmaps = (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) {
k = 0;
for (j = 0; j < 8; ++j)
if (i & (1 << (7-j))) k |= 1 << j;
bittable[i] = (char) ~k;
bittable[i] = char(~k);
}
fl_add_canvas_handler(figinset_canvas, ClientMessage,
@ -579,14 +579,14 @@ static void runqueue()
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((char *)prop); /* jc: */
XFree(reinterpret_cast<char *>(prop)); /* jc: */
if (err) break;
// release the server
XUngrabServer(tempdisp);
@ -659,7 +659,7 @@ static void runqueue()
// set up environment
while (environ[ne]) ++ne;
env = (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));
environ = env;
@ -717,8 +717,8 @@ static void addwait(int psx, int psy, int pswid, int pshgh, figdata *data)
queue * p = new queue;
p->ofsx = psx;
p->ofsy = psy;
p->rx = ((float)data->raw_wid*72)/pswid;
p->ry = ((float)data->raw_hgh*72)/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;
@ -759,7 +759,7 @@ static figdata * getfigdata(int wid, int hgh, string const & fname,
if (bmpinsref > bmparrsize) {
// allocate more space
bmparrsize += figallocchunk;
figdata ** tmp = (figdata**) malloc(sizeof(figdata*)*bmparrsize);
figdata ** tmp = static_cast<figdata**>(malloc(sizeof(figdata*)*bmparrsize));
memcpy(tmp, bitmaps, sizeof(figdata*)*(bmparrsize-figallocchunk));
free(bitmaps);
bitmaps = tmp;
@ -934,7 +934,7 @@ static void RegisterFigure(InsetFig *fi)
if (figinsref > figarrsize) {
// allocate more space
figarrsize += figallocchunk;
Figref **tmp = (Figref**) malloc(sizeof(Figref*)*figarrsize);
Figref **tmp = static_cast<Figref**>(malloc(sizeof(Figref*)*figarrsize));
memcpy(tmp, figures, sizeof(Figref*)*(figarrsize-figallocchunk));
free(figures);
figures = tmp;
@ -1080,7 +1080,7 @@ void InsetFig::Draw(LyXFont font, LyXScreen & scr, int baseline, float & x)
char * msg = 0;
// draw frame
XDrawRectangle(fl_display, pm, getGC(gc_copy),
(int) x,
int(x),
baseline - hgh - 1, wid+1, hgh+1);
if (figure && figure->data) {
if (figure->data->broken) msg = _("[render error]");
@ -1097,11 +1097,11 @@ void InsetFig::Draw(LyXFont font, LyXScreen & scr, int baseline, float & x)
string justname = OnlyFilename (fname);
font.drawString(justname, pm,
baseline - font.maxAscent() - 4,
(int) x + 8);
int(x) + 8);
font.setSize (LyXFont::SIZE_TINY);
font.drawText (msg, strlen(msg), pm,
baseline - 4,
(int) x + 8);
int(x) + 8);
}
x += Width(font); // ?
@ -1599,8 +1599,8 @@ void InsetFig::Recompute()
float sin_a = sin (angle / DEG2PI); /* rotation; H. Zeller 021296 */
float cos_a = cos (angle / DEG2PI);
int frame_wid = (int) ceil (fabs(cos_a * pswid) + fabs(sin_a * pshgh));
int frame_hgh= (int) ceil (fabs(cos_a * pshgh) + fabs(sin_a * pswid));
int frame_wid = int(ceil(fabs(cos_a * pswid) + fabs(sin_a * pshgh)));
int frame_hgh= int(ceil(fabs(cos_a * pshgh) + fabs(sin_a * pswid)));
/* now recompute wid and hgh, and if that is changed, set changed */
/* this depends on chosen size of the picture and its bbox */
@ -1614,16 +1614,16 @@ void InsetFig::Recompute()
case DEF:
break;
case CM: /* cm */
newx = (int) (28.346*xwid);
newx = int(28.346 * xwid);
break;
case IN: /* in */
newx = (int) (72*xwid);
newx = int(72 * xwid);
break;
case PER_PAGE: /* % of page */
newx = (int) (5.95*xwid);
newx = int(5.95 * xwid);
break;
case PER_COL: /* % of col */
newx = (int) (2.975*xwid);
newx = int(2.975 * xwid);
break;
}
@ -1634,13 +1634,13 @@ void InsetFig::Recompute()
//lyxerr << "This should not happen!" << endl;
break;
case CM: /* cm */
newy = (int) (28.346*xhgh);
newy = int(28.346 * xhgh);
break;
case IN: /* in */
newy = (int) (72*xhgh);
newy = int(72 * xhgh);
break;
case PER_PAGE: /* % of page */
newy = (int) (8.42*xhgh);
newy = int(8.42 * xhgh);
break;
case PER_COL:
// Doesn't occur; case exists to suppress
@ -1656,12 +1656,12 @@ void InsetFig::Recompute()
if (frame_wid == 0)
nraw_x = 5;
else
nraw_x = (int) ((1.0 * pswid * newx)/frame_wid);
nraw_x = int((1.0 * pswid * newx)/frame_wid);
if (frame_hgh == 0)
nraw_y = 5;
else
nraw_y = (int) ((1.0 * pshgh * newy)/frame_hgh);
nraw_y = int((1.0 * pshgh * newy)/frame_hgh);
// cannot be zero, actually, set it to some minimum, so its clickable
if (newx < 5) newx = 5;
@ -1746,10 +1746,10 @@ void InsetFig::GetPSSizes()
float fpsx, fpsy, fpswid, fpshgh;
if (fscanf(f, "%f %f %f %f", &fpsx, &fpsy,
&fpswid, &fpshgh) == 4) {
psx = (int) fpsx;
psy = (int) fpsy;
pswid = (int) fpswid;
pshgh = (int) fpshgh;
psx = int(fpsx);
psy = int(fpsy);
pswid = int(fpswid);
pshgh = int(fpshgh);
}
if (lyxerr.debugging()) {

View File

@ -135,7 +135,7 @@ private:
inline
bool InsetInclude::isVerb() const
{
return (bool)(flag == InsetInclude::VERB || flag == InsetInclude::VERBAST);
return flag == InsetInclude::VERB || flag == InsetInclude::VERBAST;
}

View File

@ -102,7 +102,7 @@ void InsetQuotes::ParseString(string const & s)
for (i = 0; i < 6; ++i) {
if (str[0] == language_char[i]) {
language = (InsetQuotes::quote_language)i;
language = InsetQuotes::quote_language(i);
break;
}
}
@ -114,7 +114,7 @@ void InsetQuotes::ParseString(string const & s)
for (i = 0; i < 2; ++i) {
if (str[1] == side_char[i]) {
side = (InsetQuotes::quote_side)i;
side = InsetQuotes::quote_side(i);
break;
}
}
@ -126,7 +126,7 @@ void InsetQuotes::ParseString(string const & s)
for (i = 0; i < 2; ++i) {
if (str[2] == times_char[i]) {
times = (InsetQuotes::quote_times)i;
times = InsetQuotes::quote_times(i);
break;
}
}

View File

@ -1,10 +1,10 @@
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
* ====================================================== */
@ -357,7 +357,7 @@ char kb_sequence::getiso()
if(c > 0xff)
return '\0';
return (char)c;
return c;
}

View File

@ -4156,7 +4156,7 @@ void LaTeXOptions()
return;
fl_set_button(fd_latex_options->accents,
(int)current_view->buffer()->params.allowAccents);
int(current_view->buffer()->params.allowAccents));
if (fd_latex_options->LaTeXOptions->visible) {
fl_raise_form(fd_latex_options->LaTeXOptions);

View File

@ -186,11 +186,11 @@ LyXGUI::LyXGUI(LyX *owner, int *argc, char *argv[], bool GUI)
// Make sure default screen is not larger than monitor
if (width == 690 && height == 510) {
Screen * scr = (DefaultScreenOfDisplay(fl_get_display()));
if (HeightOfScreen(scr)-24<height)
height = HeightOfScreen(scr)-24;
if (WidthOfScreen(scr)-8<width)
width = WidthOfScreen(scr)-8;
Screen * scr = DefaultScreenOfDisplay(fl_get_display());
if (HeightOfScreen(scr) - 24 < height)
height = HeightOfScreen(scr) - 24;
if (WidthOfScreen(scr) - 8 < width)
width = WidthOfScreen(scr) - 8;
}
}
@ -347,7 +347,7 @@ void LyXGUI::create_forms()
fl_set_object_color(obj, FL_WHITE, FL_BLACK);
#else
FL_OBJECT *obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 0, 0, 425, 290, "");
fl_set_pixmapbutton_data(obj, (char**)banner);
fl_set_pixmapbutton_data(obj, const_cast<char **>(banner));
#if FL_REVISION > 85
fl_set_pixmapbutton_focus_outline(obj, 3);
#endif

View File

@ -226,7 +226,6 @@ void LyX::init(int */*argc*/, char **argv)
build_lyxdir.clear();
}
bool FollowLink;
do {
// Path of binary/../share/name of binary/
@ -301,7 +300,7 @@ void LyX::init(int */*argc*/, char **argv)
// Determine user lyx-dir
//
user_lyxdir = AddPath(GetEnvPath("HOME"), string(".") + LYX_NAME);
user_lyxdir = AddPath(GetEnvPath("HOME"), string(".") + PACKAGE);
lyxerr[Debug::INIT] << "User LyX directory: '"
<< user_lyxdir << '\'' << endl;
@ -330,11 +329,11 @@ void LyX::init(int */*argc*/, char **argv)
}
// Calculate screen dpi as average of x-DPI and y-DPI:
Screen * scr= (DefaultScreenOfDisplay(fl_get_display()));
Screen * scr = DefaultScreenOfDisplay(fl_get_display());
lyxrc->dpi = ((HeightOfScreen(scr)* 25.4 / HeightMMOfScreen(scr)) +
(WidthOfScreen(scr)* 25.4 / WidthMMOfScreen(scr))) / 2;
lyxerr[Debug::INFO] << "DPI setting detected to be "
<< lyxrc->dpi+0.5 << endl;
<< lyxrc->dpi + 0.5 << endl;
//
// Read configuration files

View File

@ -225,7 +225,7 @@ GC GetClearGC()
val.foreground= WhitePixel(fl_display,
DefaultScreen(fl_display));
}
val.function= GXcopy;
val.function = GXcopy;
val.graphics_exposures = false;
if (!fast_selection && background_color != "white") {
setForegroundColor(background_color.c_str(), val);

View File

@ -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.
*
* ====================================================== */
@ -903,14 +903,13 @@ int LyXFont::drawText(char const * s, int n, Pixmap pm,
} else {
// emulate smallcaps since X doesn't support this
int i;
char c;
int sx = x;
LyXFont smallfont = *this;
smallfont.decSize();
smallfont.decSize();
smallfont.setShape(LyXFont::UP_SHAPE);
for (i= 0; i < n; i++){
for (int i = 0; i < n; ++i){
c = s[i];
if (islower(c)){
c = toupper(c);

View File

@ -2048,7 +2048,7 @@ string LyXFunc::Dispatch(int ac,
case LFUN_GETTIP:
{
int qa = lyxaction.LookupFunc(argument.c_str());
setMessage(lyxaction.helpText((kb_action)qa));
setMessage(lyxaction.helpText(static_cast<kb_action>(qa)));
}
break;

View File

@ -153,7 +153,7 @@ void LyXComm::openConnection() {
<< strerror(errno) << endl;
return;
}
fl_add_io_callback(infd, FL_READ, C_LyXComm_callback, (void*)this);
fl_add_io_callback(infd, FL_READ, C_LyXComm_callback, this);
// --- prepare output pipe ---------------------------------------

View File

@ -580,6 +580,8 @@ private:
specified row
*/
LyXParagraph::size_type RowLast(Row * row);
///
void charInserted();
};
#endif

View File

@ -302,7 +302,7 @@ InsetFormula::InsetFormula(bool display)
InsetFormula::InsetFormula(MathParInset * p)
{
par = (p->GetType()>= LM_OT_MPAR) ?
new MathMatrixInset((MathMatrixInset*)p):
new MathMatrixInset(static_cast<MathMatrixInset*>(p)):
new MathParInset(p);
// mathcursor = 0;
@ -461,7 +461,7 @@ void InsetFormula::Draw(LyXFont f, LyXScreen & scr, int baseline, float & x)
font.drawString(s, pm, baseline, int(x+20));
} else
if (par->GetType() == LM_OT_MPARN) {
MathMatrixInset *mt = (MathMatrixInset*)par;
MathMatrixInset * mt = static_cast<MathMatrixInset*>(par);
int y;
MathedRowSt const* crow = mt->getRowSt();
while (crow) {
@ -1113,9 +1113,11 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
} else
if (!varcode) {
short f = (mathcursor->getLastCode()) ?
mathcursor->getLastCode():
(MathedTextCodes)mathcursor->GetFCode();
varcode = MathIsAlphaFont(f) ? (MathedTextCodes)f:LM_TC_VAR;
mathcursor->getLastCode() :
static_cast<MathedTextCodes>(mathcursor->GetFCode());
varcode = MathIsAlphaFont(f) ?
static_cast<MathedTextCodes>(f) :
LM_TC_VAR;
}
// lyxerr << "Varcode << vardoce;
@ -1161,9 +1163,11 @@ bool InsetFormula::LocalDispatch(int action, char const * arg)
if (c == ' ') {
if (!varcode) {
short f = (mathcursor->getLastCode()) ?
mathcursor->getLastCode():
(MathedTextCodes)mathcursor->GetFCode();
varcode = MathIsAlphaFont(f) ? (MathedTextCodes)f:LM_TC_VAR;
mathcursor->getLastCode() :
static_cast<MathedTextCodes>(mathcursor->GetFCode());
varcode = MathIsAlphaFont(f) ?
static_cast<MathedTextCodes>(f) :
LM_TC_VAR;
}
if (varcode == LM_TC_TEXTRM) {
mathcursor->Insert(c, LM_TC_TEXTRM);

View File

@ -105,7 +105,7 @@ void InsetFormulaMacro::Read(LyXLex & lex)
{
FILE * file = lex.getFile();
mathed_parser_file(file, lex.GetLineNo());
mathed_parse(0, 0, (MathParInset **)&tmacro);
mathed_parse(0, 0, reinterpret_cast<MathParInset **>(&tmacro));
// Update line number
lex.setLineNo(mathed_parser_lineno());

View File

@ -33,11 +33,11 @@ extern void mathed_set_font(short type, int style);
extern GC canvasGC, mathGC, latexGC, cursorGC, mathFrameGC;
static LyxArrayBase *selarray= 0;
static LyxArrayBase * selarray = 0;
inline bool IsAlpha(char c)
{
return ('A' <= c && c<= 'Z' || 'a' <= c && c<= 'z');
return ('A' <= c && c <= 'Z' || 'a' <= c && c <= 'z');
}
// This was very smaller, I'll change it later
@ -51,10 +51,11 @@ inline bool IsMacro(short tok, int id)
!(tok == LM_TK_SYM && id < 255));
}
// Yes, mathed isn't using string yet.
inline char *strnew(char const* s)
inline char * strnew(char const * s)
{
char *s1 = new char[strlen(s)+1];
char * s1 = new char[strlen(s)+1];
strcpy(s1, s);
return s1;
}
@ -66,54 +67,54 @@ inline char *strnew(char const* s)
struct MathStackXIter {
int i, imax;
MathedXIter *item;
MathedXIter * item;
MathStackXIter(int n= MAX_STACK_ITEMS): imax(n) {
MathStackXIter(int n = MAX_STACK_ITEMS): imax(n) {
item = new MathedXIter[imax];
i = 0;
}
MathStackXIter(MathStackXIter &stk);
MathStackXIter(MathStackXIter & stk);
~MathStackXIter() {
delete[] item;
}
void push(MathedXIter** a) {
void push(MathedXIter ** a) {
*a = &item[i++];
}
MathedXIter* pop() {
i--;
return &item[i-1];
MathedXIter * pop() {
--i;
return &item[i - 1];
}
MathedXIter* Item(int idx) {
return (idx+1 <= i) ? &item[i-idx-1]: (MathedXIter*)0;
MathedXIter * Item(int idx) {
return (idx + 1 <= i) ? &item[i - idx - 1] : 0;
}
void Reset() {
i = 0;
}
int Full() {
return (i>= MAX_STACK_ITEMS);
bool Full() {
return i >= MAX_STACK_ITEMS;
}
int Empty() {
return (i<= 1);
bool Empty() {
return i <= 1;
}
int Level() { return i; }
} mathstk, *selstk= 0;
} mathstk, *selstk = 0;
MathStackXIter::MathStackXIter(MathStackXIter &stk) {
MathStackXIter::MathStackXIter(MathStackXIter & stk) {
imax = stk.imax;
item = new MathedXIter[imax];
i = stk.i;
for (int k= 0; k<i; k++) {
for (int k = 0; k < i; ++k) {
item[k].SetData(stk.item[k].getPar());
item[k].GoBegin();
item[k].goPosAbs(stk.item[k].getPos());
@ -123,7 +124,7 @@ MathStackXIter::MathStackXIter(MathStackXIter &stk) {
/***---------------- Mathed Cursor ---------------------------***/
MathedCursor::MathedCursor(MathParInset *p) // : par(p)
MathedCursor::MathedCursor(MathParInset * p) // : par(p)
{
accent = 0;
anchor = 0;
@ -135,7 +136,7 @@ MathedCursor::MathedCursor(MathParInset *p) // : par(p)
}
void MathedCursor::SetPar(MathParInset *p)
void MathedCursor::SetPar(MathParInset * p)
{
win = 0;
is_visible = False;
@ -147,17 +148,18 @@ void MathedCursor::SetPar(MathParInset *p)
cursor->SetData(par);
}
void MathedCursor::Draw(long unsigned pm, int x, int y)
{
// lyxerr << "Cursor[" << x << " " << y << "] ";
win = pm; // win = (mathedCanvas) ? mathedCanvas: pm;
par->Metrics();
int w = par->Width()+2, a = par->Ascent()+1, h = par->Height()+1;
if (par->GetType()>LM_OT_PAR) { a += 4; h += 8; }
if (par->GetType() > LM_OT_PAR) { a += 4; h += 8; }
if (!canvasGC) mathed_set_font(LM_TC_VAR, 1);
// XFillRectangle(fl_display, pm, canvasGC, x, y-a, w, h);
XDrawRectangle(fl_display, pm, mathFrameGC, x-1, y-a, w, h);
XDrawRectangle(fl_display, pm, mathFrameGC, x - 1, y - a, w, h);
XFlush(fl_display);
MathParInset::pm = pm;
par->Draw(x, y);
@ -179,6 +181,7 @@ void MathedCursor::Redraw()
par->Draw(x, y);
}
bool MathedCursor::Left(bool sel)
{
if (macro_mode) {
@ -204,7 +207,7 @@ bool MathedCursor::Left(bool sel)
return true;
}
if (!selection) {
MathParInset *p = cursor->GetActiveInset();
MathParInset * p = cursor->GetActiveInset();
if (!p)
return result;
@ -217,6 +220,7 @@ bool MathedCursor::Left(bool sel)
return result;
}
// Leave the inset
bool MathedCursor::Pop()
{
@ -228,11 +232,12 @@ bool MathedCursor::Pop()
return false;
}
// Go to the inset
bool MathedCursor::Push()
{
if (cursor->IsActive()) {
MathParInset *p = cursor->GetActiveInset();
MathParInset * p = cursor->GetActiveInset();
if (!p) return false;
mathstk.push(&cursor);
cursor->SetData(p);
@ -241,6 +246,7 @@ bool MathedCursor::Push()
return false;
}
bool MathedCursor::Right(bool sel)
{
if (macro_mode) {
@ -299,7 +305,7 @@ void MathedCursor::SetPos(int x, int y)
cursor->fitCoord(x, y);
while (cursor->GetX()<x && cursor->OK()) {
if (cursor->IsActive()) {
MathParInset *p = cursor->GetActiveInset();
MathParInset * p = cursor->GetActiveInset();
if (p->Inside(x, y)) {
p->SetFocus(x, y);
mathstk.push(&cursor);
@ -327,6 +333,7 @@ void MathedCursor::Home()
cursor->GoBegin();
}
void MathedCursor::End()
{
if (macro_mode) MacroModeClose();
@ -336,6 +343,7 @@ void MathedCursor::End()
cursor->GoLast();
}
void MathedCursor::Insert(byte c, MathedTextCodes t)
{
if (selection) SelDel();
@ -347,9 +355,9 @@ void MathedCursor::Insert(byte c, MathedTextCodes t)
MacroModeClose();
if (t == LM_TC_CR) {
MathParInset *p= cursor->p;
MathParInset * p = cursor->p;
if (p == par && p->GetType()<LM_OT_MPAR && p->GetType()>LM_OT_MIN) {
MathMatrixInset* mt = new MathMatrixInset(3, 0);
MathMatrixInset * mt = new MathMatrixInset(3, 0);
mt->SetAlign(' ', "rcl");
mt->SetStyle(LM_ST_DISPLAY);
mt->SetType((p->GetType() == LM_OT_PARN) ? LM_OT_MPARN: LM_OT_MPAR);
@ -368,7 +376,7 @@ void MathedCursor::Insert(byte c, MathedTextCodes t)
}
} else
if (t == LM_TC_TAB) {
MathParInset *p = cursor->p;
MathParInset * p = cursor->p;
if (p && p->Permit(LMPF_ALLOW_TAB)) {
if (c) {
cursor->Insert(c, t);
@ -401,18 +409,19 @@ void MathedCursor::Insert(byte c, MathedTextCodes t)
clearLastCode();
}
void MathedCursor::Insert(MathedInset* p, int t)
void MathedCursor::Insert(MathedInset * p, int t)
{
if (macro_mode) MacroModeClose();
if (selection) {
if (MathIsActive(t)) {
SelCut();
((MathParInset*)p)->SetData(selarray);
static_cast<MathParInset*>(p)->SetData(selarray);
} else
SelDel();
}
if (mathstk.i<MAX_STACK_ITEMS-1) {
if (mathstk.i < MAX_STACK_ITEMS - 1) {
if (accent && !MathIsActive(t)) {
doAccent(p);
@ -429,6 +438,7 @@ void MathedCursor::Insert(MathedInset* p, int t)
lyxerr << "Math error: Full stack." << endl;
}
void MathedCursor::Delete()
{
if (macro_mode) return;
@ -444,6 +454,7 @@ void MathedCursor::Delete()
cursor->checkTabs();
}
void MathedCursor::DelLine()
{
if (macro_mode) MacroModeClose();
@ -467,7 +478,6 @@ bool MathedCursor::Up(bool sel)
if (sel && !selection) SelStart();
if (!sel && selection) SelClear();
MathParInset *p;
if (cursor->IsScript()) {
char cd = cursor->GetChar();
@ -488,10 +498,10 @@ bool MathedCursor::Up(bool sel)
result = cursor->Up();
if (!result && cursor->p) {
p = cursor->p;
MathParInset * p = cursor->p;
if (p->GetType() == LM_OT_SCRIPT) {
MathedXIter *cx = mathstk.Item(1);
MathedXIter * cx = mathstk.Item(1);
bool is_down = (cx->GetChar() == LM_TC_DOWN);
cursor = mathstk.pop();
cursor->Next();
@ -522,8 +532,6 @@ bool MathedCursor::Down(bool sel)
if (!sel && selection) SelClear();
// if (selection) SelClear();
MathParInset *p;
if (cursor->IsScript()) {
char cd = cursor->GetChar();
if (MathIsDown(cd)) {
@ -543,9 +551,9 @@ bool MathedCursor::Down(bool sel)
result = cursor->Down();
if (!result && cursor->p) {
p= cursor->p;
MathParInset * p= cursor->p;
if (p->GetType() == LM_OT_SCRIPT) {
MathedXIter *cx = mathstk.Item(1);
MathedXIter * cx = mathstk.Item(1);
bool is_up = (cx->GetChar() == LM_TC_UP);
cursor = mathstk.pop();
cursor->Next();
@ -565,10 +573,11 @@ bool MathedCursor::Down(bool sel)
return result;
}
bool MathedCursor::Limits()
{
if (cursor->IsInset()) {
MathedInset *p = cursor->GetInset();
MathedInset * p = cursor->GetInset();
bool ol = p->GetLimits();
p->SetLimits(!ol);
return (ol!= p->GetLimits());
@ -576,15 +585,16 @@ bool MathedCursor::Limits()
return false;
}
void MathedCursor::SetSize(short size)
{
MathParInset *p = cursor->p;
MathParInset * p = cursor->p;
p->UserSetSize(size);
cursor->SetData(p);
}
void MathedCursor::setLabel(char const* label)
void MathedCursor::setLabel(char const * label)
{ // ugly hack and possible bug
if (!cursor->setLabel(strnew(label)))
lyxerr << "MathErr: Bad place to set labels." << endl;
@ -593,16 +603,16 @@ void MathedCursor::setLabel(char const* label)
void MathedCursor::setNumbered()
{ // another ugly hack
MathedRowSt *crow = cursor->crow;
MathedRowSt * crow = cursor->crow;
if (!crow) return;
crow->setNumbered(!crow->isNumbered());
}
void MathedCursor::Interpret(char const *s)
void MathedCursor::Interpret(char const * s)
{
MathedInset *p = 0;
latexkeys *l = 0;
MathedInset * p = 0;
latexkeys * l = 0;
MathedTextCodes tcode = LM_TC_INSET;
if (s[0] == '^' || s[0] == '_') {
@ -643,7 +653,7 @@ void MathedCursor::Interpret(char const *s)
} else
p = new MathFuncInset(s, LM_OT_UNDEF);
} else {
tcode = ((MathMacro*)p)->getTCode();
tcode = static_cast<MathMacro*>(p)->getTCode();
lyxerr << "Macro2 " << s << ' ' << tcode << " " ;
}
} else {
@ -657,7 +667,7 @@ void MathedCursor::Interpret(char const *s)
case LM_TK_SYM:
{
if (l->id<255) {
Insert((byte)l->id, MathIsBOPS(l->id) ?
Insert(static_cast<byte>(l->id), MathIsBOPS(l->id) ?
LM_TC_BOPS: LM_TC_SYMB);
} else {
p = new MathFuncInset(l->name);
@ -705,7 +715,7 @@ void MathedCursor::Interpret(char const *s)
break;
case LM_TK_MACRO:
p = MathMacroTable::mathMTable.getMacro(s);
tcode = ((MathMacro*)p)->getTCode();
tcode = static_cast<MathMacro*>(p)->getTCode();
lyxerr[Debug::MATHED] << "Macro " << s << ' ' << tcode << endl;
break;
default:
@ -725,11 +735,11 @@ void MathedCursor::Interpret(char const *s)
bool MathedCursor::pullArg()
{
if (cursor->IsActive()) {
MathParInset *p = cursor->GetActiveInset();
MathParInset * p = cursor->GetActiveInset();
if (!p) {
return false;
}
LyxArrayBase *a = p->GetData();
LyxArrayBase * a = p->GetData();
p->SetData(0);
Delete();
if (a) {
@ -755,12 +765,13 @@ void MathedCursor::MacroModeOpen()
lyxerr << "Mathed Warning: Already in macro mode" << endl;
}
void MathedCursor::MacroModeClose()
{
if (macro_mode) {
macro_mode = false;
latexkeys *l = in_word_set(macrobf, macroln);
if (macroln>0 && (!l || (l && IsMacro(l->token, l->id))) &&
latexkeys * l = in_word_set(macrobf, macroln);
if (macroln > 0 && (!l || (l && IsMacro(l->token, l->id))) &&
!MathMacroTable::mathMTable.getMacro(macrobf)) {
if (!l) {
imacro->SetName(strnew(macrobf));
@ -772,7 +783,7 @@ void MathedCursor::MacroModeClose()
Left();
imacro->SetName(0);
if (cursor->GetInset()->GetType() == LM_OT_ACCENT) {
setAccent(((MathAccentInset*)cursor->GetInset())->getAccentCode());
setAccent(static_cast<MathAccentInset*>(cursor->GetInset())->getAccentCode());
}
cursor->Delete();
if (l || MathMacroTable::mathMTable.getMacro(macrobf)) {
@ -783,6 +794,7 @@ void MathedCursor::MacroModeClose()
}
}
void MathedCursor::MacroModeBack()
{
if (macro_mode) {
@ -795,36 +807,37 @@ void MathedCursor::MacroModeBack()
lyxerr << "Mathed Warning: we are not in macro mode" << endl;
}
void MathedCursor::MacroModeInsert(char c)
{
if (macro_mode) {
macrobf[macroln+1] = macrobf[macroln];
macrobf[macroln + 1] = macrobf[macroln];
macrobf[macroln++] = c;
imacro->Metrics();
} else
lyxerr << "Mathed Warning: we are not in macro mode" << endl;
}
void MathedCursor::SelCopy()
{
if (selection) {
int p1, p2;
p1 = (cursor->pos < selpos) ? cursor->pos: selpos;
p2 = (cursor->pos > selpos) ? cursor->pos: selpos;
int p1 = (cursor->pos < selpos) ? cursor->pos: selpos;
int p2 = (cursor->pos > selpos) ? cursor->pos: selpos;
selarray = cursor->Copy(p1, p2);
cursor->Adjust();
SelClear();
}
}
void MathedCursor::SelCut()
{
if (selection) {
if (cursor->pos == selpos) return;
int p1, p2;
p1 = (cursor->pos < selpos) ? cursor->pos: selpos;
p2 = (cursor->pos > selpos) ? cursor->pos: selpos;
int p1 = (cursor->pos < selpos) ? cursor->pos: selpos;
int p2 = (cursor->pos > selpos) ? cursor->pos: selpos;
selarray = cursor->Copy(p1, p2);
cursor->Clean(selpos);
cursor->Adjust();
@ -832,6 +845,7 @@ void MathedCursor::SelCut()
}
}
void MathedCursor::SelDel()
{
// lyxerr << "Deleting sel "
@ -843,6 +857,7 @@ void MathedCursor::SelDel()
}
}
void MathedCursor::SelPaste()
{
// lyxerr << "paste " << selarray << " " << curor->pos;
@ -853,6 +868,7 @@ void MathedCursor::SelPaste()
}
}
void MathedCursor::SelStart()
{
lyxerr[Debug::MATHED] << "Starting sel " << endl;
@ -868,6 +884,7 @@ void MathedCursor::SelStart()
}
}
void MathedCursor::SelClear()
{
lyxerr[Debug::MATHED] << "Clearing sel " << endl;
@ -886,7 +903,7 @@ void MathedCursor::SelBalance()
// If unbalanced, balance them
while (d != 0) {
if (d<0) {
if (d < 0) {
// lyxerr << "b[" << mathstk.Level() << " " << selstk->Level << " " << anchor->GetX() << " " << cursor->GetX() << "]";
anchor = selstk->pop();
if (anchor->GetX() >= cursor->GetX())
@ -903,7 +920,7 @@ void MathedCursor::SelBalance()
}
XPoint *MathedCursor::SelGetArea(int& np)
XPoint * MathedCursor::SelGetArea(int & np)
{
if (!selection) {
np = 0;
@ -913,13 +930,13 @@ XPoint *MathedCursor::SelGetArea(int& np)
static XPoint point[10];
// single row selection
int i = 0, x, y, a, d, w, xo, yo, x1, y1, a1, d1; //, p1, p2;
int i = 0, x, y, a, d, xo, yo, x1, y1, a1, d1; //, p1, p2;
// Balance anchor and cursor
SelBalance();
cursor->p->GetXY(xo, yo);
w = cursor->p->Width();
int w = cursor->p->Width();
cursor->GetPos(x1, y1);
cursor->getAD(a1, d1);
anchor->GetPos(x, y);
@ -930,26 +947,26 @@ XPoint *MathedCursor::SelGetArea(int& np)
point[i].x = x;
point[i++].y = y-a;
if (y!= y1) {
if (y != y1) {
point[i].x = xo + w;
point[i++].y = y-a;
if (x1<xo+w) {
point[i++].y = y - a;
if (x1 < xo + w) {
point[i].x = xo + w;
point[i++].y = y1-a;
point[i++].y = y1 - a;
}
}
point[i].x = x1;
point[i++].y = y1-a;
point[i++].y = y1 - a;
point[i].x = x1;
point[i++].y = y1+d;
point[i++].y = y1 + d;
if (y!= y1) {
if (y != y1) {
point[i].x = xo;
point[i++].y = y1+d;
if (x>xo) {
point[i++].y = y1 + d;
if (x > xo) {
point[i].x = xo;
point[i++].y = y+d;
point[i++].y = y + d;
}
}
point[i].x = point[0].x;
@ -976,16 +993,16 @@ void MathedCursor::setAccent(int ac)
int MathedCursor::getAccent() const
{
return (accent>0) ? nestaccent[accent-1]: 0;
return (accent > 0) ? nestaccent[accent - 1]: 0;
}
void MathedCursor::doAccent(byte c, MathedTextCodes t)
{
MathedInset *ac = 0;
MathedInset * ac = 0;
for (int i= accent-1; i>= 0; i--) {
if (i == accent-1)
for (int i = accent - 1; i >= 0; --i) {
if (i == accent - 1)
ac = new MathAccentInset(c, t, nestaccent[i]);
else
ac = new MathAccentInset(ac, nestaccent[i]);
@ -997,12 +1014,12 @@ void MathedCursor::doAccent(byte c, MathedTextCodes t)
}
void MathedCursor::doAccent(MathedInset *p)
void MathedCursor::doAccent(MathedInset * p)
{
MathedInset *ac = 0;
MathedInset * ac = 0;
for (int i= accent-1; i>= 0; i--) {
if (i == accent-1)
for (int i = accent - 1; i >= 0; --i) {
if (i == accent - 1)
ac = new MathAccentInset(p, nestaccent[i]);
else
ac = new MathAccentInset(ac, nestaccent[i]);

View File

@ -302,16 +302,16 @@ void mathed_draw_deco(Window win, int x, int y, int w, int h, int code)
{
Matriz mt, sqmt;
XPoint p[32];
float *d, xx, yy, x2, y2;
int i= 0, j, n, r;
float xx, yy, x2, y2;
int i= 0, j, n;
j = search_deco(code);
if (j<0) return;
if (j < 0) return;
r = math_deco_table[j].angle;
d = math_deco_table[j].data;
int r = math_deco_table[j].angle;
float * d = math_deco_table[j].data;
if (h > 70 && (math_deco_table[j].code == (int) '(' || math_deco_table[j].code == (int) ')'))
if (h > 70 && (math_deco_table[j].code == int('(') || math_deco_table[j].code == int(')')))
d = parenthHigh;
mt.rota(r);
@ -323,7 +323,7 @@ void mathed_draw_deco(Window win, int x, int y, int w, int h, int code)
if (r> 0 && r< 3) y += h;
if (r>= 2) x += w;
do {
code = (int)d[i++];
code = int(d[i++]);
switch (code) {
case 0: break;
case 1:
@ -336,24 +336,24 @@ void mathed_draw_deco(Window win, int x, int y, int w, int h, int code)
else
mt.transf(xx, yy, xx, yy);
mt.transf(x2, y2, x2, y2);
XDrawLine(fl_display, win, mathGC, x+(int)xx, y+(int)yy,
x+(int)x2, y+(int)y2);
XDrawLine(fl_display, win, mathGC, x + int(xx), y + int(yy),
x + int(x2), y + int(y2));
XFlush(fl_display);
break;
}
case 2:
case 4:
{
n = (int)d[i++];
for (j= 0; j<n; j++) {
n = int(d[i++]);
for (j = 0; j < n; ++j) {
xx = d[i++]; yy = d[i++];
// lyxerr << " " << xx << " " << yy << " ";
if (code == 4)
sqmt.transf(xx, yy, xx, yy);
else
mt.transf(xx, yy, xx, yy);
p[j].x = x+(int)xx;
p[j].y = y+(int)yy;
p[j].x = x + int(xx);
p[j].y = y + int(yy);
// lyxerr << "P[" << j " " << xx << " " << yy << " " << x << " " << y << "]";
}
XDrawLines(fl_display, win, mathLineGC, p, n, CoordModeOrigin);

View File

@ -100,10 +100,10 @@ MathedInset* MathedIter::GetInset()
// An active math inset MUST be derived from MathParInset because it
// must have at least one paragraph to edit
MathParInset* MathedIter::GetActiveInset()
MathParInset * MathedIter::GetActiveInset()
{
if (IsActive()) {
return (MathParInset*)GetInset();
return static_cast<MathParInset*>(GetInset());
}
lyxerr << "Math Error: This is not an active inset" << endl;

View File

@ -228,7 +228,7 @@ void MathMacroArgument::Draw(int x, int baseline)
MathParInset::Draw(x, baseline);
} else {
unsigned char s[3];
sprintf((char*)s, "#%d", number);
sprintf(reinterpret_cast<char*>(s), "#%d", number);
drawStr(LM_TC_TEX, size, x, baseline, &s[0], 2);
}
}
@ -240,7 +240,7 @@ void MathMacroArgument::Metrics()
MathParInset::Metrics();
} else {
unsigned char s[3];
sprintf((char*)s, "#%d", number);
sprintf(reinterpret_cast<char*>(s), "#%d", number);
width = mathed_string_width(LM_TC_TEX, size, &s[0], 2);
mathed_string_height(LM_TC_TEX, size, &s[0], 2, ascent, descent);
}
@ -424,7 +424,7 @@ void MathMacroTemplate::GetMacroXY(int i, int & x, int & y) const
MathParInset * MathMacroTemplate::getMacroPar(int i) const
{
return (i >= 0 && i < nargs) ? (MathParInset*)&args[i] : 0;
return (i >= 0 && i < nargs) ? static_cast<MathParInset*>(&args[i]) : 0;
}

View File

@ -483,7 +483,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array,
case LM_TK_LIMIT:
{
if (binset) {
binset->SetLimits((bool)(yylval.l->id));
binset->SetLimits(bool(yylval.l->id));
binset = 0;
}
break;
@ -630,7 +630,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array,
case LM_TK_FONT:
{
varcode = (MathedTextCodes)yylval.l->id;
varcode = static_cast<MathedTextCodes>(yylval.l->id);
yy_mtextmode = bool(varcode == LM_TC_TEXTRM);
flags |= (FLAG_BRACE|FLAG_BRACE_FONT);
break;
@ -759,7 +759,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array,
if (p) {
data.Insert(p, p->getTCode());
p->setArgumentIdx(0);
mathed_parse(FLAG_END, p->GetData(), (MathParInset**)&p);
mathed_parse(FLAG_END, p->GetData(), reinterpret_cast<MathParInset**>(&p));
// for (int i= 0; p->setArgumentIdx(i); i++)
// p->SetData(mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST));
} else
@ -777,7 +777,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array,
if (accent) {
data.Insert(doAccent(p));
} else
data.Insert(p, ((MathMacro*)p)->getTCode());
data.Insert(p, static_cast<MathMacro*>(p)->getTCode());
}
break;
}

View File

@ -145,7 +145,7 @@ BitmapMenu::BitmapMenu(int n, FL_OBJECT * bt, BitmapMenu * prevx): nb(n)
w = h = 0;
form = 0;
i = 0;
ww = 2*FL_abs(FL_BOUND_WIDTH);
ww = 2 * FL_abs(FL_BOUND_WIDTH);
x = y = ww;
y += 8;
bitmap = new FL_OBJECTP[nb];
@ -245,16 +245,16 @@ int peek_event(FL_FORM * /*form*/, void *xev)
if (BitmapMenu::active == 0)
return 0;
if(((XEvent *)xev)->type == ButtonPress)
if(static_cast<XEvent *>(xev)->type == ButtonPress)
{
BitmapMenu::active->Hide();
return 1;
}
if(((XEvent *)xev)->type == KeyPress)
if(static_cast<XEvent *>(xev)->type == KeyPress)
{
char c[5];
KeySym keysym;
XLookupString(&((XEvent *)xev)->xkey, &c[0], 5, &keysym, 0);
XLookupString(&static_cast<XEvent *>(xev)->xkey, &c[0], 5, &keysym, 0);
if (keysym == XK_Left)
BitmapMenu::active->Prev(); else
if (keysym == XK_Right)

View File

@ -118,10 +118,10 @@ void MathDelimInset::Write(string & outf)
} else {
if (left == '{' || left == '}') {
outf += '\\';
outf += (char) left;
outf += char(left);
outf += ' ';
} else {
outf += (char) left;
outf += char(left);
outf += ' ';
}
}
@ -134,10 +134,10 @@ void MathDelimInset::Write(string & outf)
} else {
if (right == '{' || right == '}') {
outf += '\\';
outf += (char) right;
outf += char(right);
outf += ' ';
} else {
outf += (char) right;
outf += char(right);
outf += ' ';
}
}
@ -197,7 +197,7 @@ void MathAccentInset::Write(string & outf)
outf += ' ';
}
} else
outf += (char) c;
outf += char(c);
if (fn>= LM_TC_RM && fn<= LM_TC_TEXTRM)
outf += '}';
@ -315,7 +315,7 @@ void MathParInset::Write(string & outf)
lyxerr <<"Math warning: Unexpected closing brace."
<< endl;
else
outf += (char) *s;
outf += char(*s);
}
s++; ls--;
}
@ -397,7 +397,7 @@ void MathMatrixInset::Write(string & outf)
outf += '}';
if (v_align == 't' || v_align == 'b') {
outf += '[';
outf += (char) v_align;
outf += char(v_align);
outf += ']';
}
outf += '{';

View File

@ -91,7 +91,7 @@ struct isp_result {
isp_result() {
flag = ISP_UNKNOWN;
count = 0;
misses = (char**)0;
misses = static_cast<char**>(0);
}
~isp_result() {
if (misses) delete[] misses;
@ -337,7 +337,7 @@ void create_ispell_pipe(string const & lang)
argv[argc++] = 0;
execvp("ispell", (char * const *) argv);
execvp("ispell", static_cast<char * const *>(argv));
// free the memory used by string::copy in the
// setup of argv
@ -412,7 +412,7 @@ isp_result *ispell_check_word(char *word)
/* I think we have to check if ispell is still alive here because
the signal-handler could have disabled blocking on the fd */
if (isp_pid == -1) return (isp_result *) 0;
if (isp_pid == -1) return 0;
result = new isp_result;

View File

@ -37,15 +37,19 @@ ostream & operator<<(ostream & o, Debug::type t)
*/
class nullbuf : public streambuf {
protected:
#ifndef MODERN_STL_STREAMS
typedef char char_type;
typedef int int_type;
///
virtual int sync() { return 0; }
#endif
///
virtual streamsize xsputn(char const *, streamsize n) {
virtual streamsize xsputn(char_type const *, streamsize n) {
// fakes a purge of the buffer by returning n
return n;
}
///
virtual int overflow(int c = EOF) {
virtual int_type overflow(int_type c = EOF) {
// fakes success by returning c
return c == EOF ? ' ' : c;
}
@ -60,6 +64,10 @@ public:
teebuf(streambuf * b1, streambuf * b2)
: streambuf(), sb1(b1), sb2(b2) {}
protected:
#ifndef MODERN_STL_STREAMS
typedef char char_type;
typedef int int_type;
#endif
///
virtual int sync() {
#ifdef MODERN_STL_STREAMS
@ -71,7 +79,7 @@ protected:
#endif
}
///
virtual streamsize xsputn(char const * p, streamsize n) {
virtual streamsize xsputn(char_type const * p, streamsize n) {
#ifdef MODERN_STL_STREAMS
sb2->sputn(p, n);
return sb1->sputn(p, n);
@ -81,7 +89,7 @@ protected:
#endif
}
///
virtual int overflow(int c = EOF) {
virtual int_type overflow(int_type c = EOF) {
#ifdef MODERN_STL_STREAMS
sb2->sputc(c);
return sb1->sputc(c);
@ -104,6 +112,10 @@ public:
debugbuf(streambuf * b)
: streambuf(), sb(b) {}
protected:
#ifndef MODERN_STL_STREAMS
typedef char char_type;
typedef int int_type;
#endif
///
virtual int sync() {
#ifdef MODERN_STL_STREAMS
@ -113,7 +125,7 @@ protected:
#endif
}
///
virtual streamsize xsputn(char const * p, streamsize n) {
virtual streamsize xsputn(char_type const * p, streamsize n) {
#ifdef MODERN_STL_STREAMS
return sb->sputn(p, n);
#else
@ -121,7 +133,7 @@ protected:
#endif
}
///
virtual int overflow(int c = EOF) {
virtual int_type overflow(int_type c = EOF) {
#ifdef MODERN_STL_STREAMS
return sb->sputc(c);
#else
@ -133,12 +145,14 @@ private:
streambuf * sb;
};
/// So that public parts of DebugStream does not need to know about filebuf
struct DebugStream::debugstream_internal {
/// Used when logging to file.
filebuf fbuf;
};
/// Constructor, sets the debug level to t.
DebugStream::DebugStream(Debug::type t)
: ostream(new debugbuf(cerr.rdbuf())),
@ -165,6 +179,7 @@ DebugStream::~DebugStream()
delete internal;
}
/// Sets the debugstreams' logfile to f.
void DebugStream::logFile(char const * f)
{

View File

@ -12,7 +12,7 @@
#ifndef DEBUGSTREAM_H
#define DEBUGSTREAM_H
#include "LOstream.h"
#include <iostream>
#ifdef TEST_DEBUGSTREAM
#include <string>

View File

@ -3,8 +3,8 @@
*
* LyX, The Document Processor
*
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
* ====================================================== */

View File

@ -26,10 +26,10 @@ unsigned long lyxsum(char const * file);
inline char * date()
{
time_t tid;
if ((tid= time(0)) == (time_t)-1)
return (char*)0;
if ((tid= time(0)) == static_cast<time_t>(-1))
return 0;
else
return (ctime(&tid));
return ctime(&tid);
}

View File

@ -14,7 +14,11 @@
#include <config.h>
#include <stdio.h>
#ifdef __GLIBCPP__
#include <fstream>
#else
#include <cstdio>
#endif
/* Number of bytes to read at once. */
#define BUFLEN (1 << 16)
@ -80,15 +84,39 @@ static unsigned long const crctab[256] =
Return crc if successful, 0 if an error occurs. */
unsigned long
lyxsum (char const*file)
lyxsum (char const * file)
{
unsigned char buf[BUFLEN];
unsigned long crc = 0;
long length = 0;
long bytes_read;
register FILE *fp;
#if __GLIBCPP__
char buf[BUFLEN];
ifstream ifs(file);
if (!ifs) {
return 0;
}
fp = fopen (file, "r");
while ((bytes_read = ifs.readsome(buf, BUFLEN)) > 0) {
unsigned char * cp = reinterpret_cast<unsigned char*>(buf);
length += bytes_read;
while (bytes_read--)
crc = (crc << 8) ^ crctab[((crc >> 24) ^ *(cp++)) & 0xFF];
}
if (ifs.fail()) {
ifs.close();
return 0;
}
ifs.close();
if (ifs.fail()) {
return 0;
}
#else
unsigned char buf[BUFLEN];
register FILE * fp = fopen (file, "r");
if (fp == 0) {
return 0;
}
@ -109,7 +137,7 @@ lyxsum (char const*file)
if (fclose (fp) == EOF) {
return 0;
}
#endif
bytes_read = length;
while (bytes_read > 0) {
crc = (crc << 8) ^ crctab[((crc >> 24) ^ bytes_read) & 0xFF];

View File

@ -4,10 +4,10 @@
#pragma implementation
#endif
#include <errno.h>
#include <cerrno>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <csignal>
#include <cstdlib>
#include <cstdio>
#include <unistd.h>
@ -25,7 +25,7 @@ Systemcalls::Systemcalls(Starttype how, string const & what, Callbackfct cback)
start = how;
command = what;
cbk = cback;
pid = (pid_t) 0;
pid = static_cast<pid_t>(0);
retval = 0;
startscript();
}
@ -183,7 +183,7 @@ int Systemcalls::startscript(Starttype how, string const & what,
start = how;
command = what;
cbk = cback;
pid = (pid_t) 0; // yet no child
pid = static_cast<pid_t>(0); // yet no child
retval = 0;
return startscript();
}

View File

@ -1,7 +1,7 @@
#include <config.h>
#include <errno.h>
#include <stdlib.h>
#include <cerrno>
#include <cstdlib>
#include <unistd.h>
#include <sys/wait.h>
#include "syscontr.h"

View File

@ -905,7 +905,7 @@ void LyXTable::Read(FILE * file)
*atmp = 0;
fgets(vtmp, sizeof(vtmp), file);
sscanf(vtmp, "%d %d %d %s %s", &a, &b, &c, stmp, atmp);
column_info[i].alignment = (char) a;
column_info[i].alignment = static_cast<char>(a);
column_info[i].left_line = b;
column_info[i].right_line = c;
if (*stmp == '"') { /* strip quotes if they exists */
@ -923,21 +923,21 @@ void LyXTable::Read(FILE * file)
} else if (*stmp)
column_info[i].p_width = stmp;
}
for (i = 0; i<rows;i++){
for (j = 0;j<columns;j++){
for (i = 0; i < rows; ++i) {
for (j = 0; j < columns; ++j) {
*stmp = 0;
*atmp = 0;
a = b = c = d = e = f = g = 0;
fgets(vtmp, sizeof(vtmp), file);
sscanf(vtmp, "%d %d %d %d %d %d %d %s %s\n",
&a, &b, &c, &d, &e, &f, &g, stmp, atmp);
cell_info[i][j].multicolumn = (char) a;
cell_info[i][j].alignment = (char) b;
cell_info[i][j].top_line = (char) c;
cell_info[i][j].bottom_line = (char) d;
cell_info[i][j].has_cont_row = (bool) e;
cell_info[i][j].rotate = (bool) f;
cell_info[i][j].linebreaks = (bool) g;
cell_info[i][j].multicolumn = static_cast<char>(a);
cell_info[i][j].alignment = static_cast<char>(b);
cell_info[i][j].top_line = static_cast<char>(c);
cell_info[i][j].bottom_line = static_cast<char>(d);
cell_info[i][j].has_cont_row = static_cast<bool>(e);
cell_info[i][j].rotate = static_cast<bool>(f);
cell_info[i][j].linebreaks = static_cast<bool>(g);
// this is only to see if I have an empty string first
// this clause should be always TRUE!!!
if (*stmp == '"') {

View File

@ -38,7 +38,7 @@
//static
tex_accent_struct lyx_accent_table[18] = {
{ (tex_accent)0, "", "", "",(kb_action)0},
{ static_cast<tex_accent>(0), "", "", "", static_cast<kb_action>(0)},
{TEX_ACUTE, "\\'", " AEIOUYaeiouySZszRLCNrlcn", "acute", LFUN_ACUTE},
{TEX_GRAVE, "\\`", " aeiouAEIOU", "grave", LFUN_GRAVE},
{TEX_MACRON, "\\=", " EeAIOUaiou", "macron", LFUN_MACRON},
@ -56,19 +56,19 @@ tex_accent_struct lyx_accent_table[18] = {
{TEX_UMLAUT, "\\\"", " AEIOUaeiouy", "umlaut", LFUN_UMLAUT},
{TEX_DOT, "\\.", " ZzICGicgEe", "dot", LFUN_DOT},
{TEX_OGONEK, "\\k", " AaEe", "ogonek", LFUN_OGONEK},
{ (tex_accent)0, "", "", "",(kb_action)0}};
{ static_cast<tex_accent>(0), "", "", "", static_cast<kb_action>(0)}};
tex_accent_struct get_accent(kb_action action)
{
int i= 0;
while (i<= TEX_MAX_ACCENT){
int i = 0;
while (i <= TEX_MAX_ACCENT){
if (lyx_accent_table[i].action == action)
return lyx_accent_table[i];
i++;
++i;
}
struct tex_accent_struct temp = { (tex_accent)0, 0, 0,
0,(kb_action)0};
struct tex_accent_struct temp = { static_cast<tex_accent>(0), 0, 0,
0, static_cast<kb_action>(0)};
return temp;
}

View File

@ -2178,16 +2178,6 @@ void LyXText::RedoParagraph()
* same Paragraph one to the right and make a rebreak */
void LyXText::InsertChar(char c)
{
Row * row;
Row * tmprow;
long y;
bool jumped_over_space;
LyXFont realtmpfont;
LyXFont rawtmpfont;
LyXParagraph::size_type z;
LyXParagraph::size_type lastpos;
LyXFont rawparfont;
SetUndo(Undo::INSERT,
cursor.par->ParFromPos(cursor.pos)->previous,
cursor.par->ParFromPos(cursor.pos)->next);
@ -2205,7 +2195,8 @@ void LyXText::InsertChar(char c)
/* table stuff -- begin*/
if (cursor.par->table) {
InsertCharInTable(c);
goto out;
charInserted();
return;
}
/* table stuff -- end*/
@ -2222,18 +2213,18 @@ void LyXText::InsertChar(char c)
#warning There is a bug here! (Asger)
#endif
realtmpfont = real_current_font;
rawtmpfont = current_font; /* store the current font.
LyXFont realtmpfont = real_current_font;
LyXFont rawtmpfont = current_font; /* store the current font.
* This is because of the use
* of cursor movements. The moving
* cursor would refresh the
* current font */
// Get the font that is used to calculate the baselineskip
lastpos = cursor.par->Last();
rawparfont = cursor.par->GetFontSettings(lastpos - 1);
LyXParagraph::size_type lastpos = cursor.par->Last();
LyXFont rawparfont = cursor.par->GetFontSettings(lastpos - 1);
jumped_over_space = false;
bool jumped_over_space = false;
if (IsLineSeparatorChar(c)) {
@ -2266,12 +2257,15 @@ void LyXText::InsertChar(char c)
minibuffer->Set(_("You cannot insert a space at the beginning of a paragraph. Please read the Tutorial."));
else
minibuffer->Set(_("You cannot type two spaces this way. Please read the Tutorial."));
goto out;
charInserted();
return;
}
} else if (IsNewlineChar(c)) {
if (cursor.par->FirstPhysicalPar() == cursor.par
&& cursor.pos <= BeginningOfMainBody(cursor.par))
goto out;
&& cursor.pos <= BeginningOfMainBody(cursor.par)) {
charInserted();
return;
}
/* no newline at first position
* of a paragraph or behind labels.
* TeX does not allow that. */
@ -2293,8 +2287,8 @@ void LyXText::InsertChar(char c)
in future */
/* row = GetRow(cursor.par, cursor.pos, y);*/
/* ok, heres a better way: */
row = cursor.row;
y = cursor.y - row->baseline;
Row * row = cursor.row;
long y = cursor.y - row->baseline;
if (c != LyXParagraph::META_INSET) /* in this case LyXText::InsertInset
* already insertet the character */
cursor.par->InsertChar(cursor.pos, c);
@ -2302,7 +2296,7 @@ void LyXText::InsertChar(char c)
if (!jumped_over_space) {
/* refresh the positions */
tmprow = row;
Row * tmprow = row;
while (tmprow->next && tmprow->next->par == row->par) {
tmprow = tmprow->next;
tmprow->pos++;
@ -2314,7 +2308,8 @@ void LyXText::InsertChar(char c)
|| cursor.par->IsNewline(cursor.pos)
|| cursor.row->fill == -1)
&& row->previous && row->previous->par == row->par) {
z = NextBreakPoint(row->previous, paperwidth);
LyXParagraph::size_type z = NextBreakPoint(row->previous,
paperwidth);
if ( z >= row->pos) {
row->pos = z + 1;
@ -2345,7 +2340,8 @@ void LyXText::InsertChar(char c)
&& rawparfont != rawtmpfont)
RedoHeightOfParagraph(cursor);
goto out;
charInserted();
return;
}
}
@ -2407,21 +2403,25 @@ void LyXText::InsertChar(char c)
RedoDrawingOfParagraph(cursor);
}
}
out:
charInserted();
}
void LyXText::charInserted()
{
// Here we could call FinishUndo for every 20 characters inserted.
// This is from my experience how emacs does it.
static unsigned short counter = 0;
static unsigned int counter = 0;
if (counter < 20) {
++counter;
} else {
FinishUndo();
counter = 0;
}
return;
}
void LyXText::PrepareToPrint(Row * row, float & x, float & fill_separator,
float & fill_hfill, float & fill_label_hfill)
{

View File

@ -161,7 +161,8 @@ int Toolbar::BubblePost(FL_OBJECT *ob, int event,
if(event == FL_ENTER && !help.empty()){
fl_set_object_callback(t->bubble_timer,
C_Toolbar_BubbleTimerCB, (long) ob);
C_Toolbar_BubbleTimerCB,
reinterpret_cast<long>(ob));
fl_set_timer(t->bubble_timer, 1);
}
else if(event != FL_MOTION){
@ -327,17 +328,18 @@ void Toolbar::set(bool doingmain)
NorthWestGravity,
NorthWestGravity);
fl_set_object_callback(obj, C_Toolbar_ToolbarCB,
(long)item->action);
static_cast<long>(item->action));
#if FL_REVISION >85
// Remove the blue feedback rectangle
fl_set_pixmapbutton_focus_outline(obj, 0);
#endif
// set the bubble-help (Matthias)
obj->u_vdata = (void *) item->help.c_str();
#warning This is dangerous!
obj->u_vdata = const_cast<char*>(item->help.c_str());
// we need to know what toolbar this item
// belongs too. (Lgb)
obj->u_ldata = (long) this;
obj->u_ldata = reinterpret_cast<long>(this);
fl_set_object_posthandler(obj, C_Toolbar_BubblePost);
@ -485,8 +487,8 @@ void Toolbar::add(int action, bool doclean)
help += arg;
lyxerr.debug() << "Pseudo action " << action << endl;
} else {
pixmap = getPixmap((kb_action)action);
help = lyxaction.helpText((kb_action)action);
pixmap = getPixmap(static_cast<kb_action>(action));
help = lyxaction.helpText(static_cast<kb_action>(action));
}
// adds an item to the list

View File

@ -161,8 +161,9 @@ void Trans::AddDeadkey(tex_accent accent, string const & keys,
}
for(string::size_type i = 0; i < keys.length(); ++i) {
char * temp;
temp = keymap_[static_cast<unsigned char>(keys[i])] = new char[2];
char * temp =
keymap_[static_cast<unsigned int>(keys[i])] =
new char[2];
temp[0] = 0; temp[1] = accent;
}
kmod_list_[accent]->exception_list = 0;
@ -222,11 +223,11 @@ int Trans::Load(LyXLex & lex)
} else
return -1;
tex_accent accent_1= getkeymod(str);
tex_accent accent_1 = getkeymod(str);
if (accent_1 == TEX_NOACCENT) return -1;
if (lex.next(true)) {
str= lex.text();
str = lex.text();
lyxerr[Debug::KBMAP] << str << endl;
} else
return -1;
@ -237,10 +238,10 @@ int Trans::Load(LyXLex & lex)
if (kmod_list_[accent_1] == 0 || kmod_list_[accent_2] == 0)
return -1;
// Find what key accent_2 is on - should check about accent_1 also
int key;
for(key = 0; key < 256; ++key) {
// Find what key accent_2 is on - should
// check about accent_1 also
int key = 0;
for(; key < 256; ++key) {
if (keymap_[key] && keymap_[key][0] == 0
&& keymap_[key][1] == accent_2)
break;
@ -254,7 +255,9 @@ int Trans::Load(LyXLex & lex)
} else
return -1;
InsertException(kmod_list_[accent_1]->exception_list,(char)key, allowed, true, accent_2);
InsertException(kmod_list_[accent_1]->exception_list,
static_cast<char>(key), allowed,
true, accent_2);
}
break;
case KMAP: {
@ -349,7 +352,7 @@ 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_[(tex_accent)t[1]]);
return k.deadkey(c, *kmod_list_[static_cast<tex_accent>(t[1])]);
}
}
@ -387,7 +390,7 @@ tex_accent getkeymod(string const & p)
if ( lyx_accent_table[i].name && contains(p, lyx_accent_table[i].name)) {
lyxerr[Debug::KBMAP] << "Found it!" << endl;
return (tex_accent)i;
return static_cast<tex_accent>(i);
}
}
return TEX_NOACCENT;

View File

@ -77,7 +77,7 @@ private:
///
int Load(LyXLex &);
///
inline char * Match(char c);
inline char * Match(unsigned int c);
///
void InsertException(keyexc & exclist, char c,
string const & data, bool = false,
@ -95,9 +95,9 @@ private:
};
char * Trans::Match(char c)
char * Trans::Match(unsigned int c)
{
return keymap_[static_cast<unsigned char>(c)];
return keymap_[c];
}
#endif

View File

@ -278,7 +278,7 @@ void TransManager::TranslateAndInsert(char c, LyXText * text)
// Process with tokens
string temp;
while(res.length()>0) {
while(res.length() > 0) {
res = split(res, temp, TransState::TOKEN_SEP);
insert(temp, text);
}
@ -289,7 +289,7 @@ void TransManager::insertVerbatim(string const & str, LyXText * text)
{
int l = str.length();
for (int i = 0;i<l;i++){
for (int i = 0; i < l; ++i){
if (str[i] == '\"'
&& text->GetFont(text->cursor.par,
text->cursor.pos).latex() == LyXFont::OFF)

View File

@ -42,8 +42,8 @@ static char const * unit_name[num_units] = { "sp", "pt", "bp", "dd",
LyXLength::UNIT unitFromString (string const & data)
{
int i = 0;
while ((i<num_units) && (data != unit_name[i])) ++i;
return (LyXLength::UNIT)i;
while ((i < num_units) && (data != unit_name[i])) ++i;
return static_cast<LyXLength::UNIT>(i);
}
/* The following static items form a simple scanner for