From a040c0bc6f017d0591bbc7ad1aa590589dbc40ff Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Mon, 15 Nov 1999 12:01:38 +0000 Subject: [PATCH] white-space changes, removed definitions.h several enum changes because of this, new file undo.C rewritten some in chset.C git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@314 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BackStack.h | 4 +- src/BufferView.C | 93 ++-- src/BufferView.h | 6 +- src/Bullet.C | 8 +- src/Bullet.h | 20 +- src/Chktex.C | 4 +- src/Chktex.h | 4 +- src/DepTable.C | 4 +- src/DepTable.h | 4 +- src/FontInfo.C | 10 +- src/FontInfo.h | 6 +- src/FontLoader.C | 28 +- src/FontLoader.h | 10 +- src/ImportLaTeX.C | 8 +- src/ImportLaTeX.h | 6 +- src/ImportNoweb.C | 6 +- src/ImportNoweb.h | 4 +- src/LString.h | 4 +- src/LaTeX.C | 18 +- src/LaTeX.h | 6 +- src/LaTeXFeatures.C | 4 +- src/LaTeXFeatures.h | 4 +- src/LaTeXLog.C | 2 +- src/Literate.C | 4 +- src/Literate.h | 4 +- src/LyXAction.C | 46 +- src/LyXAction.h | 28 +- src/LyXSendto.C | 8 +- src/LyXView.C | 20 +- src/LyXView.h | 4 +- src/Makefile.am | 2 +- src/PaperLayout.C | 47 +- src/ParagraphExtra.C | 190 +++---- src/Spacing.h | 16 +- src/TableLayout.C | 131 +++-- src/bmtable.C | 24 +- src/bmtable.h | 8 +- src/broken_const.h | 6 +- src/broken_headers.h | 10 +- src/buffer.C | 1015 ++++++++++++++++++------------------- src/buffer.h | 105 ++-- src/bufferlist.C | 80 ++- src/bufferlist.h | 8 +- src/bufferparams.C | 72 +-- src/bufferparams.h | 93 +++- src/bullet_forms.C | 110 ++-- src/bullet_forms_cb.C | 6 +- src/chset.C | 114 ++--- src/chset.h | 29 +- src/combox.C | 76 +-- src/combox.h | 16 +- src/commandtags.h | 2 + src/credits.C | 6 +- src/credits_form.C | 56 +-- src/debug.h | 2 +- src/definitions.h | 184 ------- src/filedlg.C | 45 +- src/filedlg.h | 4 +- src/form1.C | 448 ++++++++--------- src/intl.C | 94 ++-- src/intl.h | 2 +- src/kbmap.C | 46 +- src/lastfiles.C | 6 +- src/lastfiles.h | 2 +- src/latexoptions.C | 40 +- src/layout.C | 21 +- src/layout.h | 13 +- src/layout_forms.C | 1056 +++++++++++++++++++------------------- src/lyx.C | 144 +++--- src/lyx_cb.C | 276 +++++----- src/lyx_gui.C | 68 +-- src/lyx_gui.h | 6 +- src/lyx_gui_misc.C | 26 +- src/lyx_gui_misc.h | 24 +- src/lyx_main.C | 24 +- src/lyx_main.h | 4 +- src/lyx_sendfax.C | 132 ++--- src/lyx_sendfax_main.C | 100 ++-- src/lyx_sty.C | 30 +- src/lyx_sty.h | 4 +- src/lyxcursor.h | 9 +- src/lyxdraw.C | 66 +-- src/lyxfont.C | 56 +-- src/lyxfont.h | 8 +- src/lyxfr0.C | 8 +- src/lyxfr1.C | 43 +- src/lyxfr1.h | 8 +- src/lyxfunc.C | 211 ++++---- src/lyxfunc.h | 4 +- src/lyxlex.C | 60 +-- src/lyxlex.h | 4 +- src/lyxlookup.C | 10 +- src/lyxlookup.h | 4 +- src/lyxparagraph.h | 273 +++------- src/lyxrc.C | 30 +- src/lyxrc.h | 7 +- src/lyxrow.h | 6 +- src/lyxscreen.h | 4 +- src/lyxserver.C | 28 +- src/lyxserver.h | 4 +- src/lyxtext.h | 71 +-- src/lyxvc.C | 14 +- src/main.C | 6 +- src/menus.C | 148 +++--- src/menus.h | 2 +- src/minibuffer.C | 22 +- src/minibuffer.h | 8 +- src/nt_defines.h | 4 +- src/os2_defines.h | 18 +- src/os2_errortable.h | 24 +- src/paragraph.C | 1086 ++++++++++++---------------------------- src/print_form.C | 178 +++---- src/screen.C | 40 +- src/sp_form.C | 156 +++--- src/spellchecker.C | 92 ++-- src/table.C | 305 ++++++----- src/table.h | 14 +- src/tex-accent.C | 28 +- src/tex-accent.h | 2 +- src/tex-strings.C | 32 +- src/tex-strings.h | 26 +- src/texoptions.C | 4 +- src/texrow.C | 6 +- src/texrow.h | 4 +- src/text.C | 508 ++++++------------- src/text2.C | 327 +++--------- src/toolbar.C | 34 +- src/toolbar.h | 14 +- src/trans.C | 178 +++---- src/trans.h | 38 +- src/trans_decl.h | 13 +- src/trans_mgr.C | 255 ++++------ src/trans_mgr.h | 79 ++- src/undo.C | 71 +++ src/undo.h | 112 +---- src/vc-backend.C | 26 +- src/vms_defines.h | 8 +- src/vspace.C | 24 +- src/vspace.h | 18 +- 139 files changed, 4412 insertions(+), 5826 deletions(-) create mode 100644 src/undo.C diff --git a/src/BackStack.h b/src/BackStack.h index 80e138f669..fbc9aef2ec 100644 --- a/src/BackStack.h +++ b/src/BackStack.h @@ -1,12 +1,12 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright (C) 1997-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #ifndef BACK_STACK_H #define BACK_STACK_H diff --git a/src/BufferView.C b/src/BufferView.C index e1a57a5004..852ab7d016 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -1,13 +1,13 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -231,7 +231,7 @@ void BufferView::updateScrollbar() maximum_height - work_area->h); #if FL_REVISION > 85 double lineh = buffer_->text->DefaultHeight(); - fl_set_slider_increment(scrollbar,work_area->h-lineh,lineh); + fl_set_slider_increment(scrollbar, work_area->h-lineh, lineh); #endif if (maxfloat>0){ if ((hfloat/maxfloat) * float(height2) < 3) @@ -318,7 +318,7 @@ int BufferView::resizeCurrentBuffer() AllowInput(); // Now if the title form still exist kill it - TimerCB(0,0); + TimerCB(0, 0); return 0; } @@ -336,10 +336,10 @@ void BufferView::gotoError() if (!buffer_->text->GotoNextError()) { if (buffer_->text->cursor.pos - || buffer_->text->cursor.par != + || buffer_->text->cursor.par != buffer_->text->FirstParagraph()) { tmp = buffer_->text->cursor; - buffer_->text->cursor.par = + buffer_->text->cursor.par = buffer_->text->FirstParagraph(); buffer_->text->cursor.pos = 0; if (!buffer_->text->GotoNextError()) { @@ -353,7 +353,7 @@ void BufferView::gotoError() } } buffer_->update(0); - buffer_->text->sel_cursor = + buffer_->text->sel_cursor = buffer_->text->cursor; } @@ -389,18 +389,18 @@ void BufferView::create_view(int xpos, int ypos, int width, int height) // a hack for the figinsets (Matthias) // This one first, then it will probably be invisible. (Lgb) - ::figinset_canvas = figinset_canvas = obj = + ::figinset_canvas = figinset_canvas = obj = fl_add_canvas(FL_NORMAL_CANVAS, xpos + 1, - ypos + 1,1,1,""); - fl_set_object_boxtype(obj,FL_NO_BOX); + ypos + 1, 1, 1, ""); + fl_set_object_boxtype(obj, FL_NO_BOX); fl_set_object_resize(obj, FL_RESIZE_ALL); fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity); // a box obj = fl_add_box(FL_BORDER_BOX, xpos, ypos, width - 15, - height,""); + height, ""); fl_set_object_resize(obj, FL_RESIZE_ALL); fl_set_object_gravity(obj, NorthWestGravity, SouthEastGravity); @@ -408,12 +408,12 @@ void BufferView::create_view(int xpos, int ypos, int width, int height) work_area = obj = fl_add_free(FL_INPUT_FREE, xpos +bw, ypos+bw, width-15-2*bw /* scrollbarwidth */, - height-2*bw,"", + height-2*bw, "", C_BufferView_work_area_handler); obj->wantkey = FL_KEY_TAB; obj->u_vdata = this; /* This is how we pass the BufferView to the work_area_handler. */ - fl_set_object_boxtype(obj,FL_DOWN_BOX); + fl_set_object_boxtype(obj, FL_DOWN_BOX); fl_set_object_resize(obj, FL_RESIZE_ALL); fl_set_object_gravity(obj, NorthWestGravity, SouthEastGravity); @@ -430,18 +430,18 @@ void BufferView::create_view(int xpos, int ypos, int width, int height) button_up = obj = fl_add_pixmapbutton(FL_TOUCH_BUTTON, width-15+4*bw, ypos, - 15,15,""); - fl_set_object_boxtype(obj,FL_UP_BOX); - fl_set_object_color(obj,FL_MCOL,FL_BLUE); + 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); - fl_set_object_gravity(obj,NorthEastGravity, NorthEastGravity); + fl_set_object_gravity(obj, NorthEastGravity, NorthEastGravity); fl_set_object_callback(obj, C_BufferView_UpCB, 0); obj->u_vdata = this; fl_set_pixmapbutton_data(obj, up_xpm); #if FL_REVISION > 85 // Remove the blue feedback rectangle - fl_set_pixmapbutton_focus_outline(obj,0); + fl_set_pixmapbutton_focus_outline(obj, 0); #endif // the scrollbar slider @@ -449,8 +449,8 @@ void BufferView::create_view(int xpos, int ypos, int width, int height) scrollbar = obj = fl_add_slider(FL_VERT_SLIDER, width-15+4*bw, ypos + 15, - 15,height-30,""); - fl_set_object_color(obj,FL_COL1,FL_MCOL); + 15, height-30, ""); + fl_set_object_color(obj, FL_COL1, FL_MCOL); fl_set_object_boxtype(obj, FL_UP_BOX); fl_set_object_resize(obj, FL_RESIZE_ALL); fl_set_object_gravity(obj, NorthEastGravity, SouthEastGravity); @@ -466,9 +466,9 @@ void BufferView::create_view(int xpos, int ypos, int width, int height) button_down = obj = fl_add_pixmapbutton(FL_TOUCH_BUTTON, 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); + 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); fl_set_object_gravity(obj, SouthEastGravity, SouthEastGravity); fl_set_object_callback(obj, C_BufferView_DownCB, 0); @@ -478,7 +478,7 @@ void BufferView::create_view(int xpos, int ypos, int width, int height) #if FL_REVISION >85 // Remove the blue feedback rectangle - fl_set_pixmapbutton_focus_outline(obj,0); + fl_set_pixmapbutton_focus_outline(obj, 0); #endif // @@ -487,8 +487,8 @@ void BufferView::create_view(int xpos, int ypos, int width, int height) // timer_cursor timer_cursor = obj = fl_add_timer(FL_HIDDEN_TIMER, - 0,0,0,0,"Timer"); - fl_set_object_callback(obj,C_BufferView_CursorToggleCB,0); + 0, 0, 0, 0, "Timer"); + fl_set_object_callback(obj, C_BufferView_CursorToggleCB, 0); obj->u_vdata = this; } @@ -729,10 +729,10 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event, view->workAreaExpose(); break; case FL_PUSH: - view->WorkAreaButtonPress(ob, 0,0,0,ev,0); + view->WorkAreaButtonPress(ob, 0, 0, 0, ev, 0); break; case FL_RELEASE: - view->WorkAreaButtonRelease(ob, 0,0,0,ev,0); + view->WorkAreaButtonRelease(ob, 0, 0, 0, ev, 0); break; case FL_MOUSE: if (ev->xmotion.x != x_old || @@ -741,11 +741,11 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event, x_old = ev->xmotion.x; y_old = ev->xmotion.y; scrollbar_value_old = view->current_scrollbar_value; - view->WorkAreaMotionNotify(ob, 0,0,0,ev,0); + view->WorkAreaMotionNotify(ob, 0, 0, 0, ev, 0); } break; // Done by the raw callback: - // case FL_KEYBOARD: WorkAreaKeyPress(ob, 0,0,0,ev,0); break; + // case FL_KEYBOARD: WorkAreaKeyPress(ob, 0, 0, 0, ev, 0); break; case FL_FOCUS: if (!view->owner_->getMiniBuffer()->shows_no_match) view->owner_->getMiniBuffer()->Init(); @@ -793,7 +793,7 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event, view->screen->HideCursor(); view->screen->ToggleSelection(); view->buffer_->text->CursorHome(); - view->buffer_->text->sel_cursor = + view->buffer_->text->sel_cursor = view->buffer_->text->cursor; view->buffer_->text->CursorEnd(); view->buffer_->text->SetSelection(); @@ -806,7 +806,7 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event, case FL_OTHER: view->WorkAreaSelectionNotify(ob, view->owner_->getForm()->window, - 0,0,ev,0); + 0, 0, ev, 0); break; } return 1; @@ -1109,19 +1109,24 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window , c = buffer_->text->cursor.par-> GetChar(buffer_->text->cursor.pos); } - if (c == LYX_META_FOOTNOTE || c == LYX_META_MARGIN - || c == LYX_META_FIG || c == LYX_META_TAB - || c == LYX_META_WIDE_FIG || c == LYX_META_WIDE_TAB - || c == LYX_META_ALGORITHM){ + if (c == LyXParagraph::META_FOOTNOTE + || c == LyXParagraph::META_MARGIN + || c == LyXParagraph::META_FIG + || c == LyXParagraph::META_TAB + || c == LyXParagraph::META_WIDE_FIG + || c == LyXParagraph::META_WIDE_TAB + || c == LyXParagraph::META_ALGORITHM){ hit = true; } else if (buffer_->text->cursor.pos - 1 >= 0) { c = buffer_->text->cursor.par-> GetChar(buffer_->text->cursor.pos - 1); - if (c == LYX_META_FOOTNOTE || c == LYX_META_MARGIN - || c == LYX_META_FIG || c == LYX_META_TAB - || c == LYX_META_WIDE_FIG - || c == LYX_META_WIDE_TAB - || c == LYX_META_ALGORITHM){ + if (c == LyXParagraph::META_FOOTNOTE + || c == LyXParagraph::META_MARGIN + || c == LyXParagraph::META_FIG + || c == LyXParagraph::META_TAB + || c == LyXParagraph::META_WIDE_FIG + || c == LyXParagraph::META_WIDE_TAB + || c == LyXParagraph::META_ALGORITHM){ // We are one step too far to the right buffer_->text->CursorLeft(); hit = true; @@ -1135,7 +1140,7 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window , } // Do we want to close a float? (click on the float-label) - if (buffer_->text->cursor.row->par->footnoteflag == + if (buffer_->text->cursor.row->par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE && buffer_->text->cursor.pos == 0 && buffer_->text->cursor.row->previous && @@ -1186,7 +1191,7 @@ Inset * BufferView::checkInsetHit(int & x, int & y) LyXCursor cursor = buffer_->text->cursor; if (cursor.pos < cursor.par->Last() - && cursor.par->GetChar(cursor.pos) == LYX_META_INSET + && cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET && cursor.par->GetInset(cursor.pos) && cursor.par->GetInset(cursor.pos)->Editable()) { @@ -1203,7 +1208,7 @@ Inset * BufferView::checkInsetHit(int & x, int & y) return tmpinset; } } else if (cursor.pos - 1 >= 0 - && cursor.par->GetChar(cursor.pos - 1) == LYX_META_INSET + && cursor.par->GetChar(cursor.pos - 1) == LyXParagraph::META_INSET && cursor.par->GetInset(cursor.pos - 1) && cursor.par->GetInset(cursor.pos - 1)->Editable()) { buffer_->text->CursorLeft(); diff --git a/src/BufferView.h b/src/BufferView.h index 2dd63c345e..39b50c9d9f 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -1,13 +1,13 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995 Matthias Ettrich * Copyright (C) 1995-1998 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #ifndef BUFFER_VIEW_H #define BUFFER_VIEW_H @@ -28,7 +28,7 @@ class Inset; class BufferView { public: /// - BufferView(LyXView *owner, int ,int ,int, int); + BufferView(LyXView *owner, int , int , int, int); /// Buffer * buffer() const { return buffer_; } /// diff --git a/src/Bullet.C b/src/Bullet.C index d9f8e2b4b8..c787570299 100644 --- a/src/Bullet.C +++ b/src/Bullet.C @@ -4,14 +4,14 @@ * generate the bullets in the bullet-panel's. * * This file is part of - *====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright (C) 1997-1998 Allan Rae * and the LyX Team * - *======================================================*/ + * ====================================================== */ #include @@ -101,7 +101,7 @@ void Bullet::generateText() } -const string & Bullet::bulletSize(const short & s) +string const & Bullet::bulletSize(const short & s) { // use a parameter rather than hard code `size' in here // in case some future function may want to retrieve @@ -117,7 +117,7 @@ const string & Bullet::bulletSize(const short & s) } -const string & Bullet::bulletEntry(const short & f, const short & c) +string const & Bullet::bulletEntry(const short & f, const short & c) { // Despite how this may at first appear the static local variables // are only initialized once.. diff --git a/src/Bullet.h b/src/Bullet.h index ecf868c92e..159a861733 100644 --- a/src/Bullet.h +++ b/src/Bullet.h @@ -1,7 +1,7 @@ // -*- C++ -*- /* This is the bullet class definition file. * This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * @@ -10,7 +10,7 @@ * * This file Copyright 1997-1999 * Allan Rae - * ======================================================*/ + * ====================================================== */ #ifndef BULLET_H #define BULLET_H @@ -32,7 +32,7 @@ public: Bullet(const int f = -1, const int c = -1, const int s = -1); /// - Bullet(const string &); + Bullet(string const &); /// ~Bullet(); @@ -44,7 +44,7 @@ public: /// void setSize(const int); /// - void setText(const string &); + void setText(string const &); /// int getCharacter() const; /// @@ -118,9 +118,9 @@ private: /// void generateText(); /// - static const string & bulletSize(const short &); + static string const & bulletSize(const short &); /// - static const string & bulletEntry(const short &, const short &); + static string const & bulletEntry(const short &, const short &); /// short font; @@ -151,7 +151,7 @@ private: /*----------------Inline Bullet Member Functions------------------*/ -inline Bullet::Bullet(const string & t) +inline Bullet::Bullet(string const & t) : font(MIN), character(MIN), size(MIN), user_text(1), text(t) { #ifdef DEBUG_AS_DEFAULT @@ -209,7 +209,7 @@ inline void Bullet::setSize(const int s) } -inline void Bullet::setText(const string & t) +inline void Bullet::setText(string const & t) { font = character = size = MIN; user_text = 1; @@ -261,7 +261,7 @@ inline Bullet & Bullet::operator = (const Bullet & b) } -inline const char * Bullet::c_str() +inline char const * Bullet::c_str() { return this->getText().c_str(); } @@ -274,5 +274,5 @@ inline const char * Bullet::c_str() static Bullet const ITEMIZE_DEFAULTS[4] = { Bullet( 0, 8 ),//"\\(\\bullet\\)" Bullet( 0, 0 ),//"\\normalfont\\bfseries{--}" Bullet( 0, 6 ),//"\\(\\ast\\)" - Bullet( 0,10 ) };//"\\(\\cdot\\)" + Bullet( 0, 10 ) };//"\\(\\cdot\\)" #endif /* BULLET_H_ */ diff --git a/src/Chktex.C b/src/Chktex.C index f4f9cf22da..375b42bfe8 100644 --- a/src/Chktex.C +++ b/src/Chktex.C @@ -1,5 +1,5 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich @@ -8,7 +8,7 @@ * This file is Copyright 1997-1998 * Asger Alstrup * - *====================================================== + * ====================================================== */ #include diff --git a/src/Chktex.h b/src/Chktex.h index f45d14d82e..907efca4b3 100644 --- a/src/Chktex.h +++ b/src/Chktex.h @@ -1,6 +1,6 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * @@ -10,7 +10,7 @@ * This file is Copyright 1997 * Asger Alstrup * - * ====================================================== + * ====================================================== */ #ifndef CHKTEX_H diff --git a/src/DepTable.C b/src/DepTable.C index c9abb08a6c..f28f744859 100644 --- a/src/DepTable.C +++ b/src/DepTable.C @@ -1,5 +1,5 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * Copyright (C) 1995 Matthias Ettrich @@ -8,7 +8,7 @@ * This file is Copyright (C) 1996-1998 * Lars Gullik Bjønnes * - * ====================================================== + * ====================================================== */ #include diff --git a/src/DepTable.h b/src/DepTable.h index 7fe2501058..6b8dc5b597 100644 --- a/src/DepTable.h +++ b/src/DepTable.h @@ -1,6 +1,6 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * Copyright (C) 1995 Matthias Ettrich @@ -8,7 +8,7 @@ * This file is Copyright (C) 1996-1998 * Lars Gullik Bjønnes * - * ====================================================== + * ====================================================== */ #ifndef DEP_TABLE_H diff --git a/src/FontInfo.C b/src/FontInfo.C index 7ac5e6bb29..0a1e664e3f 100644 --- a/src/FontInfo.C +++ b/src/FontInfo.C @@ -1,13 +1,13 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright (C) 1997 Asger Alstrup * and the LyX Team. * - * ======================================================*/ + * ====================================================== */ #include #include // fabs() @@ -33,7 +33,7 @@ string FontInfo::getFontname(int size) int closestind = -1; double error = 100000; - for (int i=0; i #include // fabs() @@ -50,11 +50,11 @@ void FontLoader::update() void FontLoader::reset() { // Clear font infos, font structs and font metrics - for (int i1=0; i1<4; i1++) - for (int i2=0; i2<2; i2++) - for (int i3=0; i3<4; i3++) { + for (int i1 = 0; i1<4; i1++) + for (int i2 = 0; i2<2; i2++) + for (int i3 = 0; i3<4; i3++) { fontinfo[i1][i2][i3] = 0; - for (int i4=0; i4<10; i4++) { + for (int i4 = 0; i4<10; i4++) { fontstruct[i1][i2][i3][i4] = 0; } } @@ -64,14 +64,14 @@ void FontLoader::reset() void FontLoader::unload() { // Unload all fonts - for (int i1=0; i1<4; i1++) - for (int i2=0; i2<2; i2++) - for (int i3=0; i3<4; i3++) { + for (int i1 = 0; i1<4; i1++) + for (int i2 = 0; i2<2; i2++) + for (int i3 = 0; i3<4; i3++) { if (fontinfo[i1][i2][i3]) { delete fontinfo[i1][i2][i3]; fontinfo[i1][i2][i3] = 0; } - for (int i4=0; i4<10; i4++) { + for (int i4 = 0; i4<10; i4++) { if (fontstruct[i1][i2][i3][i4]) { XFreeFont(fl_display, fontstruct[i1][i2][i3][i4]); fontstruct[i1][i2][i3][i4] = 0; @@ -107,7 +107,7 @@ void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family, FontInfo * fi = new FontInfo(); fontinfo[family][series][shape] = fi; - for (int cfam=0; cfam < 2; cfam++) { + for (int cfam = 0; cfam < 2; cfam++) { // Determine family name switch (family) { case LyXFont::ROMAN_FAMILY: @@ -134,7 +134,7 @@ void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family, default: ; } - for (int cser=0; cser < 4; cser++) { + for (int cser = 0; cser < 4; cser++) { // Determine series name switch (series) { case LyXFont::MEDIUM_SERIES: @@ -157,7 +157,7 @@ void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family, default: ; } - for (int csha=0; csha < 2; csha++) { + for (int csha = 0; csha < 2; csha++) { // Determine shape name switch (shape) { case LyXFont::UP_SHAPE: @@ -201,7 +201,7 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family, LyXFont::FONT_SHAPE shape, LyXFont::FONT_SIZE size) { - getFontinfo(family,series,shape); + getFontinfo(family, series, shape); int fsize = int( (lyxrc->font_sizes[size] * lyxrc->dpi * (lyxrc->zoom/100.0) ) / 72.27 + 0.5 ); diff --git a/src/FontLoader.h b/src/FontLoader.h index 4b3c167c5e..f39dec8606 100644 --- a/src/FontLoader.h +++ b/src/FontLoader.h @@ -7,10 +7,10 @@ * Copyright (C) 1997 Asger Alstrup * and the LyX Team. * - *======================================================*/ + * ====================================================== */ -#ifndef _FONTLOADER_H_ -#define _FONTLOADER_H_ +#ifndef FONTLOADER_H_ +#define FONTLOADER_H_ #ifdef __GNUG__ #pragma interface @@ -43,10 +43,10 @@ public: LyXFont::FONT_SHAPE shape, LyXFont::FONT_SIZE size) { - if (fontstruct[family][series][shape][size]!=0) + if (fontstruct[family][series][shape][size]!= 0) return fontstruct[family][series][shape][size]; else - return doLoad(family,series,shape,size); + return doLoad(family, series, shape, size); }; private: /// Array of font structs diff --git a/src/ImportLaTeX.C b/src/ImportLaTeX.C index 0a38e96c3c..3c600a579f 100644 --- a/src/ImportLaTeX.C +++ b/src/ImportLaTeX.C @@ -1,5 +1,5 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich @@ -8,7 +8,7 @@ * This file is Copyright 1998 * Asger Alstrup * - *====================================================== + * ====================================================== */ #include @@ -42,8 +42,8 @@ Buffer * ImportLaTeX::run() string tmp = lyxrc->relyx_command + " -f " + file; Systemcalls one; Buffer * buf = 0; - int result= one.startscript(Systemcalls::System, tmp); - if (result==0) { + int result = one.startscript(Systemcalls::System, tmp); + if (result == 0) { string filename = ChangeExtension(file, ".lyx", false); // File was generated without problems. Load it. buf = bufferlist.loadLyXFile(filename); diff --git a/src/ImportLaTeX.h b/src/ImportLaTeX.h index f8e029ee3f..65bb0ce283 100644 --- a/src/ImportLaTeX.h +++ b/src/ImportLaTeX.h @@ -9,11 +9,11 @@ * This file is Copyright (C) 1998 * Asger Alstrup * - *====================================================== + * ====================================================== */ -#ifndef _IMPORTLATEX_H -#define _IMPORTLATEX_H +#ifndef IMPORTLATEX_H +#define IMPORTLATEX_H #ifdef __GNUG__ #pragma interface diff --git a/src/ImportNoweb.C b/src/ImportNoweb.C index 66071111e3..e40278444e 100644 --- a/src/ImportNoweb.C +++ b/src/ImportNoweb.C @@ -1,5 +1,5 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich @@ -8,7 +8,7 @@ * This file is Copyright 1999 * Kayvan A. Sylvan * - * ====================================================== + * ====================================================== */ #include @@ -38,7 +38,7 @@ Buffer * ImportNoweb::run() Systemcalls one; Buffer * buf = 0; int result= one.startscript(Systemcalls::System, tmp); - if (result==0) { + if (result == 0) { string filename = file + ".lyx"; // File was generated without problems. Load it. buf = bufferlist.loadLyXFile(filename); diff --git a/src/ImportNoweb.h b/src/ImportNoweb.h index 3231eb4b54..d69b6aa005 100644 --- a/src/ImportNoweb.h +++ b/src/ImportNoweb.h @@ -1,6 +1,6 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * @@ -9,7 +9,7 @@ * This file is Copyright (C) 1999 * Kayvan A. Sylvan * - *====================================================== + * ====================================================== */ #ifndef IMPORTNOWEB_H diff --git a/src/LString.h b/src/LString.h index 459bdb76f8..eabdc7e815 100644 --- a/src/LString.h +++ b/src/LString.h @@ -7,7 +7,7 @@ * Copyright (C) 1995 Matthias Ettrich * Copyright (C) 1995-1999 The LyX Team. * - *======================================================*/ + * ====================================================== */ #ifndef LSTRING_H #define LSTRING_H @@ -15,10 +15,8 @@ #ifndef USE_INCLUDED_STRING #include using std::string; -//using std::wstring; #else #include "support/lyxstring.h" typedef lyxstring string; -//typedef lyxwstring wstring; #endif #endif diff --git a/src/LaTeX.C b/src/LaTeX.C index d4f9e1b4e2..be5de47faf 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -1,5 +1,5 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich @@ -8,7 +8,7 @@ * This file is Copyright 1996-1999 * Lars Gullik Bjønnes * - * ====================================================== + * ====================================================== */ #include @@ -183,7 +183,7 @@ int LaTeX::run(TeXErrors & terr, MiniBuffer * minib) lyxerr[Debug::LATEX] << "Running MakeIndex." << endl; minib->Set(_("Running MakeIndex.")); minib->Store(); - rerun=runMakeIndex(ChangeExtension(file,".idx",true)); + rerun = runMakeIndex(ChangeExtension(file, ".idx", true)); } // run bibtex @@ -314,7 +314,7 @@ typedef pair cmdret; static cmdret do_popen(string const & cmd) { // One question is if we should use popen or - // create our own popen based on fork,exec,pipe + // create our own popen based on fork, exec, pipe // of course the best would be to have a // pstream (process stream), with the // variants ipstream, opstream and @@ -340,7 +340,7 @@ static string findtexfile(string const & fil, string const & format) return OnlyFilename(fil); // No we try to find it using kpsewhich. - string kpsecmd = "kpsewhich --format=" + format + " " + fil; + string kpsecmd = "kpsewhich --format= " + format + " " + fil; cmdret c = do_popen(kpsecmd); lyxerr << "kpse status = " << c.first << "\n" @@ -371,9 +371,9 @@ bool LaTeX::runBibTeX(string const & file, DepTable & dep) l = data.substr(0, b - 0); data.erase(0, b + 1); } - string full_l = + string full_l = findtexfile( - ChangeExtension(l,"bib",false), + ChangeExtension(l, "bib", false), "bib"); lyxerr << "data = `" << full_l << "'" << endl; @@ -389,7 +389,7 @@ bool LaTeX::runBibTeX(string const & file, DepTable & dep) string style = token.substr(a, b - a); // token is now the style file // pass it to the helper - string full_l = + string full_l = findtexfile( ChangeExtension(style, "bst", false), "bst"); @@ -403,7 +403,7 @@ bool LaTeX::runBibTeX(string const & file, DepTable & dep) } if (using_bibtex) { // run bibtex and - string tmp= "bibtex "; + string tmp = "bibtex "; tmp += ChangeExtension(file, string(), true); Systemcalls one; one.startscript(Systemcalls::System, tmp); diff --git a/src/LaTeX.h b/src/LaTeX.h index 706b248c33..b9998d00fc 100644 --- a/src/LaTeX.h +++ b/src/LaTeX.h @@ -1,6 +1,6 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich @@ -9,7 +9,7 @@ * This file is Copyright (C) 1996-1999 * Lars Gullik Bjønnes * - *====================================================== + * ====================================================== */ #ifndef LATEX_H @@ -166,7 +166,7 @@ protected: /// unavail LaTeX(LaTeX const &); /// unavail - LaTeX & operator=(LaTeX const &); + LaTeX & operator= (LaTeX const &); /// void deplog(DepTable & head); diff --git a/src/LaTeXFeatures.C b/src/LaTeXFeatures.C index cf839c6762..5e187ec0b9 100644 --- a/src/LaTeXFeatures.C +++ b/src/LaTeXFeatures.C @@ -1,6 +1,6 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * @@ -78,7 +78,7 @@ string LaTeXFeatures::getPackages(BufferParams const & params) // color.sty if (color) { if (params.graphicsDriver == "default") - packages +="\\usepackage{color}\n"; + packages += "\\usepackage{color}\n"; else packages += "\\usepackage[" + params.graphicsDriver + "]{color}\n"; diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h index 58bbedb840..fbf8e70848 100644 --- a/src/LaTeXFeatures.h +++ b/src/LaTeXFeatures.h @@ -1,13 +1,13 @@ // -*- C++ -*- /* This file is part of -* ====================================================== +* ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995 Matthias Ettrich * Copyright (C) 1995-1999 the LyX Team. * -*======================================================*/ +* ====================================================== */ #ifndef LATEXFEATURES_H #define LATEXFEATURES_H diff --git a/src/LaTeXLog.C b/src/LaTeXLog.C index 6d062b3237..fcb3acca8c 100644 --- a/src/LaTeXLog.C +++ b/src/LaTeXLog.C @@ -49,7 +49,7 @@ void ShowLatexLog() fl_raise_form(fd_latex_log->LaTeXLog); } else { fl_show_form(fd_latex_log->LaTeXLog, - FL_PLACE_MOUSE | FL_FREE_SIZE,FL_FULLBORDER, + FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER, use_build ? _("Build Program Log") : _("LaTeX Log")); if (ow < 0) { ow = fd_latex_log->LaTeXLog->w; diff --git a/src/Literate.C b/src/Literate.C index 0be43b8162..1be0b452ac 100644 --- a/src/Literate.C +++ b/src/Literate.C @@ -1,11 +1,11 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ====================================================== + * ====================================================== */ #include diff --git a/src/Literate.h b/src/Literate.h index 020a0b024b..3912f9b2f9 100644 --- a/src/Literate.h +++ b/src/Literate.h @@ -1,11 +1,11 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * Copyright (C) 1995 Matthias Ettrich * - *====================================================== + * ====================================================== */ #ifndef LITERATE_H diff --git a/src/LyXAction.C b/src/LyXAction.C index 89ec88a605..55b26fde65 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -153,7 +153,9 @@ kb_func_table const lyx_func_table[] = { { "index-insert", LFUN_INDEX_INSERT }, { "index-insert-last", LFUN_INDEX_INSERT_LAST }, { "index-print", LFUN_INDEX_PRINT }, +#if 0 { "inset-latex-insert", LFUN_INSERT_INSET_LATEX }, +#endif { "keymap-off", LFUN_KMAP_OFF }, { "keymap-primary", LFUN_KMAP_PRIM }, { "keymap-secondary", LFUN_KMAP_SEC }, @@ -282,11 +284,11 @@ kb_func_table const lyx_func_table[] = { field with attributes using these tags: enum FUNC_ATTRIB { - LFAT_NONE=0, // Nothing special - LFAT_ISRO=1, // Is readonly (does not modify a buffer) - LFAT_ISIA=2, // Is interactive (requires a GUI) - LFAT_REQARG=4, // Requires argument - LFAT_ISMO=8, // Only math mode + LFAT_NONE= 0, // Nothing special + LFAT_ISRO= 1, // Is readonly (does not modify a buffer) + LFAT_ISIA= 2, // Is interactive (requires a GUI) + LFAT_REQARG= 4, // Requires argument + LFAT_ISMO= 8, // Only math mode LFAT_ETCETC }; @@ -350,7 +352,9 @@ kb_action func_attrib_table[] = { LFUN_INSERTFOOTNOTE, LFUN_INSERT_BIBTEX, LFUN_INSERT_CITATION, +#if 0 LFUN_INSERT_INSET_LATEX, +#endif LFUN_INSERT_LABEL, LFUN_INSERT_MATH, LFUN_INSERT_MATRIX, @@ -436,7 +440,7 @@ LyXAction::~LyXAction() // This is wrong, so I'll just disable it for now. // The problem is that we might free memory twice in some situations... // It's better to leak a bit that to crash. (Asger) -// for (int i=0; i < psd_idx; i++) { +// for (int i= 0; i < psd_idx; i++) { // free(lyx_func_args[i].name); // } delete[] lyx_func_args; @@ -449,8 +453,8 @@ LyXAction::~LyXAction() int LyXAction::searchActionArg(kb_action action, char const *arg) { kb_func_table *tb = &lyx_func_args[0]; - for (int i=0; iaction && !strcmp(tb->name, arg)) { + for (int i= 0; iaction && !strcmp(tb->name, arg)) { lyxerr[Debug::KEY] << "Pseudoaction already exist[" << action << '|' @@ -472,7 +476,7 @@ int LyXAction::getPseudoAction(kb_action action, char const *arg) if (psdaction >= 0) return psdaction; - if (psd_idx>=MAX_PSEUDO_ACTION) { + if (psd_idx>= MAX_PSEUDO_ACTION) { lyxerr << "Lyx Error: No more pseudo-actions allowed" << " Tell the developers." << endl; return -1; @@ -519,7 +523,7 @@ int LyXAction::LookupFunc(char const * func) while (l < r) { last_action_idx = (l+r)/2; k = strcmp(lyx_func_table[last_action_idx].name, func); - if (k==0) { + if (k == 0) { action = lyx_func_table[last_action_idx].action; break; } else @@ -566,14 +570,14 @@ char const *LyXAction::getActionName(int action) const // why LFUN_LASTACTION -1? Because LFUN_LASTACTION is too // large an because there is one internal command, hence // lyx_func_table is 2 less then LFUN_LASTACTION (Lgb) - for (int i=0; i < funcCount; i++) { - if (lyx_func_table[i].action==action) + for (int i= 0; i < funcCount; i++) { + if (lyx_func_table[i].action == action) return lyx_func_table[i].name; } // Hmm.. let's see whether this is a pseudoaction action -= LFUN_LASTACTION; - if (action>=0 && action= 0 && action=funcCount) + if (action <= 1 || action >= funcCount) goto no_desc; if (helpTexts[action].action == action) { @@ -721,7 +725,7 @@ char const *LyXAction::helpText(kb_action action) const // Function to compare items from the attrib table. extern "C" int actioncomp(const void *a, const void *b) { - int const *ia=(int const*)a, *ib=(int const*)b; + int const *ia= (int const*)a, *ib= (int const*)b; return (*ia)-(*ib); } @@ -734,7 +738,7 @@ bool LyXAction::isFuncRO(kb_action action) const if (!is_sorted) { qsort(func_attrib_table, fCount, sizeof(kb_action), actioncomp); is_sorted = true; -// for (int i=0; i= (int)LFUN_LASTACTION); + return (a >= int(LFUN_LASTACTION)); } diff --git a/src/LyXSendto.C b/src/LyXSendto.C index e85eee0df0..e71baf3e23 100644 --- a/src/LyXSendto.C +++ b/src/LyXSendto.C @@ -92,11 +92,11 @@ void SendtoApplyCB(FL_OBJECT *, long) Path p(path); // save the .lyx file in tmp_dir if this filetype is requested if (fl_get_button(fd_form_sendto->radio_ftype_lyx)) - buffer->writeFile(fname,true); + buffer->writeFile(fname, true); // if the .tex file is requested save it to the tempdir // as now we don't do the MakeDVIOutput anymore if (fl_get_button(fd_form_sendto->radio_ftype_latex)) - buffer->makeLaTeXFile(fname,path,false); + buffer->makeLaTeXFile(fname, path, false); // create the .txt file in tmp_dir if this filetype is requested if (fl_get_button(fd_form_sendto->radio_ftype_ascii)) buffer->writeFileAscii(fname, lyxrc->ascii_linelen); @@ -110,6 +110,6 @@ void SendtoCancelCB(FL_OBJECT *, long) void SendtoOKCB(FL_OBJECT *ob, long data) { - SendtoCancelCB(ob,data); - SendtoApplyCB(ob,data); + SendtoCancelCB(ob, data); + SendtoApplyCB(ob, data); } diff --git a/src/LyXView.C b/src/LyXView.C index 2ca56a41ee..d6af100d47 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -1,13 +1,13 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -50,7 +50,7 @@ extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM *, void *); LyXView::LyXView(int width, int height) { - fd_form_main = create_form_form_main(width,height); + fd_form_main = create_form_form_main(width, height); fl_set_form_atclose(_form, C_LyXView_atCloseMainFormCB, 0); lyxerr[Debug::INIT] << "Initializing LyXFunc" << endl; lyxfunc = new LyXFunc(this); @@ -215,13 +215,13 @@ FD_form_main * LyXView::create_form_form_main(int width, int height) // timer_autosave fdui->timer_autosave = obj = fl_add_timer(FL_HIDDEN_TIMER, - 0,0,0,0,"Timer"); - fl_set_object_callback(obj,C_LyXView_AutosaveTimerCB,0); + 0, 0, 0, 0, "Timer"); + fl_set_object_callback(obj, C_LyXView_AutosaveTimerCB, 0); // timer_update fdui->timer_update = obj = fl_add_timer(FL_HIDDEN_TIMER, - 0,0,0,0,"Timer"); - fl_set_object_callback(obj,C_LyXView_UpdateTimerCB,0); + 0, 0, 0, 0, "Timer"); + fl_set_object_callback(obj, C_LyXView_UpdateTimerCB, 0); obj->u_vdata = this; // @@ -284,7 +284,7 @@ void LyXView::updateLayoutChoice() // this has a bi-effect that the layouts are not showed when no // document is loaded. - if (bufferview == 0 || bufferview->buffer()==0) { + if (bufferview == 0 || bufferview->buffer() == 0) { toolbar->combox->clear(); toolbar->combox->Redraw(); return; @@ -296,7 +296,7 @@ void LyXView::updateLayoutChoice() toolbar->combox->clear(); for (int i = 0; textclasslist.NameOfLayout(buffer()-> - params.textclass, i) !="@@end@@"; + params.textclass, i) != "@@end@@"; i++) { LyXLayout const & layout = textclasslist. Style(buffer()->params.textclass, i); @@ -326,7 +326,7 @@ void LyXView::UpdateDocumentClassChoice() int i; if (fd_form_document) { fl_clear_choice(fd_form_document->choice_class); - for (i = 0; textclasslist.DescOfClass (i)!="@@end@@"; i++) { + for (i = 0; textclasslist.DescOfClass (i)!= "@@end@@"; i++) { fl_addto_choice(fd_form_document->choice_class, textclasslist.DescOfClass(i).c_str()); } diff --git a/src/LyXView.h b/src/LyXView.h index 95565adcff..7bdc77815a 100644 --- a/src/LyXView.h +++ b/src/LyXView.h @@ -1,6 +1,6 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * @@ -61,7 +61,7 @@ public: void setPosition(int, int); /// Show the main form. - void show(int, int, char const * t= "LyX"); + void show(int, int, char const * t = "LyX"); /// init (should probably be removed later) (Lgb) void init(); diff --git a/src/Makefile.am b/src/Makefile.am index b3844c4474..f5e3b6644e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -72,7 +72,6 @@ lyx_SOURCES = \ credits_form.C \ credits_form.h \ debug.h \ - definitions.h \ figure.h \ filedlg.C \ filedlg.h \ @@ -167,6 +166,7 @@ lyx_SOURCES = \ trans_decl.h \ trans_mgr.C \ trans_mgr.h \ + undo.C \ undo.h \ vc-backend.C \ vc-backend.h \ diff --git a/src/PaperLayout.C b/src/PaperLayout.C index a64ce1f0f4..3ac090b07c 100644 --- a/src/PaperLayout.C +++ b/src/PaperLayout.C @@ -2,7 +2,6 @@ #include -#include "definitions.h" #include FORMS_H_LOCATION #include "layout_forms.h" #include "lyx_main.h" @@ -122,7 +121,7 @@ bool UpdateLayoutPaper() params->use_geometry); fl_set_button(fd_form_paper->radio_portrait, 0); fl_set_button(fd_form_paper->radio_landscape, 0); - if (params->orientation == ORIENTATION_LANDSCAPE) + if (params->orientation == BufferParams::ORIENTATION_LANDSCAPE) fl_set_button(fd_form_paper->radio_landscape, 1); else fl_set_button(fd_form_paper->radio_portrait, 1); @@ -192,9 +191,9 @@ void PaperApplyCB(FL_OBJECT *, long) params->paperpackage = fl_get_choice(fd->choice_paperpackage)-1; params->use_geometry = fl_get_button(fd_form_paper->push_use_geometry); if (fl_get_button(fd_form_paper->radio_landscape)) - params->orientation = ORIENTATION_LANDSCAPE; + params->orientation = BufferParams::ORIENTATION_LANDSCAPE; else - params->orientation = ORIENTATION_PORTRAIT; + params->orientation = BufferParams::ORIENTATION_PORTRAIT; params->paperwidth = fl_get_input(fd->input_custom_width); params->paperheight = fl_get_input(fd->input_custom_height); params->leftmargin = fl_get_input(fd->input_left_margin); @@ -220,8 +219,8 @@ void PaperCancelCB(FL_OBJECT *, long) void PaperOKCB(FL_OBJECT * ob, long data) { - PaperCancelCB(ob,data); - PaperApplyCB(ob,data); + PaperCancelCB(ob, data); + PaperApplyCB(ob, data); } @@ -234,32 +233,36 @@ void PaperMarginsCB(FL_OBJECT * ob, long) checkMarginValues(); if (ob == fd->choice_papersize2) { val = fl_get_choice(fd->choice_papersize2)-1; - if (val == VM_PAPER_DEFAULT) { + if (val == BufferParams::VM_PAPER_DEFAULT) { fl_set_button(fd->push_use_geometry, 0); checkMarginValues(); } else { - if ((val != VM_PAPER_USLETTER) && (val != VM_PAPER_USLEGAL) && - (val != VM_PAPER_USEXECUTIVE) && (val != VM_PAPER_A4) && - (val != VM_PAPER_A5) && (val != VM_PAPER_B5)) { + if (val != BufferParams::VM_PAPER_USLETTER + && val != BufferParams::VM_PAPER_USLEGAL + && val != BufferParams::VM_PAPER_USEXECUTIVE + && val != BufferParams::VM_PAPER_A4 + && val != BufferParams::VM_PAPER_A5 + && val != BufferParams::VM_PAPER_B5) { fl_set_button(fd->push_use_geometry, 1); } - fl_set_choice(fd->choice_paperpackage, PACKAGE_NONE + 1); + fl_set_choice(fd->choice_paperpackage, BufferParams::PACKAGE_NONE + 1); } } else if (ob == fd->choice_paperpackage) { val = fl_get_choice(fd->choice_paperpackage)-1; - if (val != PACKAGE_NONE) { - fl_set_choice(fd->choice_papersize2, VM_PAPER_DEFAULT + 1); + if (val != BufferParams::PACKAGE_NONE) { + fl_set_choice(fd->choice_papersize2, + BufferParams::VM_PAPER_DEFAULT + 1); fl_set_button(fd->push_use_geometry, 0); } - } else if ((ob==fd->input_custom_width) - || (ob==fd->input_custom_height) - || (ob==fd->input_left_margin) - || (ob==fd->input_right_margin) - || (ob==fd->input_top_margin) - || (ob==fd->input_bottom_margin) - || (ob==fd->input_head_height) - || (ob==fd->input_head_sep) - || (ob==fd->input_foot_skip)) { + } else if (ob == fd->input_custom_width + || ob == fd->input_custom_height + || ob == fd->input_left_margin + || ob == fd->input_right_margin + || ob == fd->input_top_margin + || ob == fd->input_bottom_margin + || ob == fd->input_head_height + || ob == fd->input_head_sep + || ob == fd->input_foot_skip) { str = fl_get_input(ob); if (!str.empty() && !isValidLength(str)) { fl_set_object_label(fd_form_paper->text_warning, diff --git a/src/ParagraphExtra.C b/src/ParagraphExtra.C index dfd5aac7b0..8f3562e2ff 100644 --- a/src/ParagraphExtra.C +++ b/src/ParagraphExtra.C @@ -1,8 +1,8 @@ #include #include -#include "definitions.h" #include FORMS_H_LOCATION + #include "layout_forms.h" #include "LString.h" #include "minibuffer.h" @@ -13,62 +13,62 @@ #include "gettext.h" #include "lyxtext.h" -extern FD_form_paragraph_extra *fd_form_paragraph_extra; -extern MiniBuffer *minibuffer; -extern BufferView *current_view; +extern FD_form_paragraph_extra * fd_form_paragraph_extra; +extern MiniBuffer * minibuffer; +extern BufferView * current_view; extern void BeforeChange(); static bool CheckInputWidth(); inline void DeactivateParagraphExtraButtons () { - fl_deactivate_object (fd_form_paragraph_extra->button_ok); - fl_deactivate_object (fd_form_paragraph_extra->button_apply); - fl_set_object_lcol (fd_form_paragraph_extra->button_ok, FL_INACTIVE); - fl_set_object_lcol (fd_form_paragraph_extra->button_apply, FL_INACTIVE); + fl_deactivate_object(fd_form_paragraph_extra->button_ok); + fl_deactivate_object(fd_form_paragraph_extra->button_apply); + fl_set_object_lcol(fd_form_paragraph_extra->button_ok, FL_INACTIVE); + fl_set_object_lcol(fd_form_paragraph_extra->button_apply, FL_INACTIVE); } inline void ActivateParagraphExtraButtons () { - fl_activate_object (fd_form_paragraph_extra->button_ok); - fl_activate_object (fd_form_paragraph_extra->button_apply); - fl_set_object_lcol (fd_form_paragraph_extra->button_ok, FL_BLACK); - fl_set_object_lcol (fd_form_paragraph_extra->button_apply, FL_BLACK); + fl_activate_object(fd_form_paragraph_extra->button_ok); + fl_activate_object(fd_form_paragraph_extra->button_apply); + fl_set_object_lcol(fd_form_paragraph_extra->button_ok, FL_BLACK); + fl_set_object_lcol(fd_form_paragraph_extra->button_apply, FL_BLACK); } inline void DisableParagraphExtra () { DeactivateParagraphExtraButtons(); - fl_deactivate_object (fd_form_paragraph_extra->input_pextra_width); - fl_deactivate_object (fd_form_paragraph_extra->input_pextra_widthp); - fl_deactivate_object (fd_form_paragraph_extra->group_alignment); - fl_deactivate_object (fd_form_paragraph_extra->radio_pextra_top); - fl_deactivate_object (fd_form_paragraph_extra->radio_pextra_middle); - fl_deactivate_object (fd_form_paragraph_extra->radio_pextra_bottom); - fl_deactivate_object (fd_form_paragraph_extra->text_warning); - fl_deactivate_object (fd_form_paragraph_extra->group_extraopt); - fl_deactivate_object (fd_form_paragraph_extra->radio_pextra_indent); - fl_deactivate_object (fd_form_paragraph_extra->radio_pextra_minipage); - fl_deactivate_object (fd_form_paragraph_extra->radio_pextra_floatflt); - fl_deactivate_object (fd_form_paragraph_extra->radio_pextra_hfill); - fl_deactivate_object (fd_form_paragraph_extra->radio_pextra_startmp); + fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width); + fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp); + fl_deactivate_object(fd_form_paragraph_extra->group_alignment); + fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top); + fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle); + fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom); + fl_deactivate_object(fd_form_paragraph_extra->text_warning); + fl_deactivate_object(fd_form_paragraph_extra->group_extraopt); + fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_indent); + fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_minipage); + fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_floatflt); + fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_hfill); + fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_startmp); } inline void EnableParagraphExtra () { ActivateParagraphExtraButtons(); - fl_activate_object (fd_form_paragraph_extra->input_pextra_width); - fl_activate_object (fd_form_paragraph_extra->input_pextra_widthp); - fl_activate_object (fd_form_paragraph_extra->group_alignment); - fl_activate_object (fd_form_paragraph_extra->radio_pextra_top); - fl_activate_object (fd_form_paragraph_extra->radio_pextra_middle); - fl_activate_object (fd_form_paragraph_extra->radio_pextra_bottom); - fl_activate_object (fd_form_paragraph_extra->text_warning); - fl_activate_object (fd_form_paragraph_extra->group_extraopt); - fl_activate_object (fd_form_paragraph_extra->radio_pextra_indent); - fl_activate_object (fd_form_paragraph_extra->radio_pextra_minipage); - fl_activate_object (fd_form_paragraph_extra->radio_pextra_floatflt); - fl_activate_object (fd_form_paragraph_extra->radio_pextra_hfill); - fl_activate_object (fd_form_paragraph_extra->radio_pextra_startmp); + fl_activate_object(fd_form_paragraph_extra->input_pextra_width); + fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp); + fl_activate_object(fd_form_paragraph_extra->group_alignment); + fl_activate_object(fd_form_paragraph_extra->radio_pextra_top); + fl_activate_object(fd_form_paragraph_extra->radio_pextra_middle); + fl_activate_object(fd_form_paragraph_extra->radio_pextra_bottom); + fl_activate_object(fd_form_paragraph_extra->text_warning); + fl_activate_object(fd_form_paragraph_extra->group_extraopt); + fl_activate_object(fd_form_paragraph_extra->radio_pextra_indent); + fl_activate_object(fd_form_paragraph_extra->radio_pextra_minipage); + fl_activate_object(fd_form_paragraph_extra->radio_pextra_floatflt); + fl_activate_object(fd_form_paragraph_extra->radio_pextra_hfill); + fl_activate_object(fd_form_paragraph_extra->radio_pextra_startmp); } bool UpdateParagraphExtra() @@ -87,14 +87,14 @@ bool UpdateParagraphExtra() fl_set_input(fd_form_paragraph_extra->input_pextra_widthp, par->pextra_widthp.c_str()); switch(par->pextra_alignment) { - case MINIPAGE_ALIGN_TOP: - fl_set_button(fd_form_paragraph_extra->radio_pextra_top,1); + case LyXParagraph::MINIPAGE_ALIGN_TOP: + fl_set_button(fd_form_paragraph_extra->radio_pextra_top, 1); break; - case MINIPAGE_ALIGN_MIDDLE: - fl_set_button(fd_form_paragraph_extra->radio_pextra_middle,1); + case LyXParagraph::MINIPAGE_ALIGN_MIDDLE: + fl_set_button(fd_form_paragraph_extra->radio_pextra_middle, 1); break; - case MINIPAGE_ALIGN_BOTTOM: - fl_set_button(fd_form_paragraph_extra->radio_pextra_bottom,1); + case LyXParagraph::MINIPAGE_ALIGN_BOTTOM: + fl_set_button(fd_form_paragraph_extra->radio_pextra_bottom, 1); break; } fl_set_button(fd_form_paragraph_extra->radio_pextra_hfill, @@ -102,37 +102,37 @@ bool UpdateParagraphExtra() fl_set_button(fd_form_paragraph_extra->radio_pextra_startmp, par->pextra_start_minipage); CheckInputWidth(); - if (par->pextra_type == PEXTRA_INDENT) { - fl_set_button(fd_form_paragraph_extra->radio_pextra_indent,1); - fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage,0); - fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt,0); + if (par->pextra_type == LyXParagraph::PEXTRA_INDENT) { + fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 1); + fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0); + fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom); - } else if (par->pextra_type == PEXTRA_MINIPAGE) { - fl_set_button(fd_form_paragraph_extra->radio_pextra_indent,0); - fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage,1); - fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt,0); + } else if (par->pextra_type == LyXParagraph::PEXTRA_MINIPAGE) { + fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0); + fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 1); + fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0); fl_activate_object(fd_form_paragraph_extra->radio_pextra_top); fl_activate_object(fd_form_paragraph_extra->radio_pextra_middle); fl_activate_object(fd_form_paragraph_extra->radio_pextra_bottom); - } else if (par->pextra_type == PEXTRA_FLOATFLT) { - fl_set_button(fd_form_paragraph_extra->radio_pextra_indent,0); - fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage,0); - fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt,1); + } else if (par->pextra_type == LyXParagraph::PEXTRA_FLOATFLT) { + fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0); + fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0); + fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 1); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom); } else { - fl_set_button(fd_form_paragraph_extra->radio_pextra_indent,0); - fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage,0); + fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0); + fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0); fl_deactivate_object(fd_form_paragraph_extra->input_pextra_width); fl_deactivate_object(fd_form_paragraph_extra->input_pextra_widthp); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_middle); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_bottom); } - if (par->pextra_type == PEXTRA_NONE) + if (par->pextra_type == LyXParagraph::PEXTRA_NONE) ActivateParagraphExtraButtons(); } fl_hide_object(fd_form_paragraph_extra->text_warning); @@ -140,7 +140,8 @@ bool UpdateParagraphExtra() if (current_view->buffer()->isReadonly()) { DisableParagraphExtra(); fl_set_object_label(fd_form_paragraph_extra->text_warning, - _("Document is read-only. No changes to layout permitted.")); + _("Document is read-only. " + "No changes to layout permitted.")); fl_show_object(fd_form_paragraph_extra->text_warning); } if (!update && fd_form_paragraph_extra->form_paragraph_extra->visible) { @@ -149,6 +150,7 @@ bool UpdateParagraphExtra() return update; } + void ParagraphExtraOpen(FL_OBJECT *, long) { if (UpdateParagraphExtra()) { @@ -162,36 +164,38 @@ void ParagraphExtraOpen(FL_OBJECT *, long) } } + void ParagraphExtraApplyCB(FL_OBJECT *, long) { if (current_view->getScreen() && current_view->available()) { FD_form_paragraph_extra const * fd = fd_form_paragraph_extra; - const char * width = fl_get_input(fd->input_pextra_width); - const char * widthp = fl_get_input(fd->input_pextra_widthp); + char const * width = fl_get_input(fd->input_pextra_width); + char const * widthp = fl_get_input(fd->input_pextra_widthp); LyXText * text = current_view->buffer()->text; - int type = PEXTRA_NONE; - int alignment = 0; + int type = LyXParagraph::PEXTRA_NONE; + LyXParagraph::MINIPAGE_ALIGNMENT alignment = + LyXParagraph::MINIPAGE_ALIGN_TOP; bool hfill = false, start_minipage = false; if (fl_get_button(fd_form_paragraph_extra->radio_pextra_indent)) { - type = PEXTRA_INDENT; + type = LyXParagraph::PEXTRA_INDENT; } else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_minipage)) { - type = PEXTRA_MINIPAGE; + type = LyXParagraph::PEXTRA_MINIPAGE; hfill = fl_get_button(fd_form_paragraph_extra->radio_pextra_hfill); - start_minipage = + start_minipage = fl_get_button(fd_form_paragraph_extra->radio_pextra_startmp); if (fl_get_button(fd_form_paragraph_extra->radio_pextra_top)) - alignment = MINIPAGE_ALIGN_TOP; + alignment = LyXParagraph::MINIPAGE_ALIGN_TOP; else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_middle)) - alignment = MINIPAGE_ALIGN_MIDDLE; + alignment = LyXParagraph::MINIPAGE_ALIGN_MIDDLE; else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_bottom)) - alignment = MINIPAGE_ALIGN_BOTTOM; + alignment = LyXParagraph::MINIPAGE_ALIGN_BOTTOM; } else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_floatflt)) { - type = PEXTRA_FLOATFLT; + type = LyXParagraph::PEXTRA_FLOATFLT; } - text->SetParagraphExtraOpt(type,width,widthp,alignment,hfill, + text->SetParagraphExtraOpt(type, width, widthp, alignment, hfill, start_minipage); current_view->buffer()->update(1); minibuffer->Set(_("ParagraphExtra layout set")); @@ -199,31 +203,29 @@ void ParagraphExtraApplyCB(FL_OBJECT *, long) return; } + void ParagraphExtraCancelCB(FL_OBJECT *, long) { fl_hide_form(fd_form_paragraph_extra->form_paragraph_extra); } -void ParagraphExtraOKCB(FL_OBJECT *ob, long data) + +void ParagraphExtraOKCB(FL_OBJECT * ob, long data) { - ParagraphExtraCancelCB(ob,data); - ParagraphExtraApplyCB(ob,data); + ParagraphExtraCancelCB(ob, data); + ParagraphExtraApplyCB(ob, data); } -void CheckPExtraOptCB(FL_OBJECT *ob, long) + +void CheckPExtraOptCB(FL_OBJECT * ob, long) { - int - n; - string - s1, s2; - ActivateParagraphExtraButtons(); CheckInputWidth(); if (ob == fd_form_paragraph_extra->radio_pextra_indent) { - n = fl_get_button(fd_form_paragraph_extra->radio_pextra_indent); + int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_indent); if (n) { - fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage,0); - fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt,0); + fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0); + fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0); fl_activate_object(fd_form_paragraph_extra->input_pextra_width); fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp); fl_deactivate_object(fd_form_paragraph_extra->radio_pextra_top); @@ -235,10 +237,10 @@ void CheckPExtraOptCB(FL_OBJECT *ob, long) ActivateParagraphExtraButtons(); } } else if (ob == fd_form_paragraph_extra->radio_pextra_minipage) { - n = fl_get_button(fd_form_paragraph_extra->radio_pextra_minipage); + int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_minipage); if (n) { - fl_set_button(fd_form_paragraph_extra->radio_pextra_indent,0); - fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt,0); + fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0); + fl_set_button(fd_form_paragraph_extra->radio_pextra_floatflt, 0); fl_activate_object(fd_form_paragraph_extra->input_pextra_width); fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp); fl_activate_object(fd_form_paragraph_extra->radio_pextra_top); @@ -253,10 +255,10 @@ void CheckPExtraOptCB(FL_OBJECT *ob, long) ActivateParagraphExtraButtons(); } } else if (ob == fd_form_paragraph_extra->radio_pextra_floatflt) { - n = fl_get_button(fd_form_paragraph_extra->radio_pextra_floatflt); + int n = fl_get_button(fd_form_paragraph_extra->radio_pextra_floatflt); if (n) { - fl_set_button(fd_form_paragraph_extra->radio_pextra_indent,0); - fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage,0); + fl_set_button(fd_form_paragraph_extra->radio_pextra_indent, 0); + fl_set_button(fd_form_paragraph_extra->radio_pextra_minipage, 0); fl_activate_object(fd_form_paragraph_extra->input_pextra_width); fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp); fl_activate_object(fd_form_paragraph_extra->radio_pextra_top); @@ -274,13 +276,11 @@ void CheckPExtraOptCB(FL_OBJECT *ob, long) return; } + static bool CheckInputWidth() { - string - s1,s2; - - s1 = fl_get_input(fd_form_paragraph_extra->input_pextra_width); - s2 = fl_get_input(fd_form_paragraph_extra->input_pextra_widthp); + string s1 = fl_get_input(fd_form_paragraph_extra->input_pextra_width); + string s2 = fl_get_input(fd_form_paragraph_extra->input_pextra_widthp); if (s1.empty() && s2.empty()) { fl_activate_object(fd_form_paragraph_extra->input_pextra_width); fl_activate_object(fd_form_paragraph_extra->input_pextra_widthp); diff --git a/src/Spacing.h b/src/Spacing.h index 3bbc85282b..1024c419d2 100644 --- a/src/Spacing.h +++ b/src/Spacing.h @@ -7,7 +7,7 @@ * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #ifndef SPACING_H #define SPACING_H @@ -51,11 +51,11 @@ public: return space; } /// - void set(Spacing::Space sp, float val= 1.0) + void set(Spacing::Space sp, float val = 1.0) { space = sp; if (sp == Other) { - switch(int(val*1000 + 0.5)) { + switch(int(val * 1000 + 0.5)) { case 1000: space = Single; break; case 1250: space = Onehalf; break; case 1667: space = Double; break; @@ -64,16 +64,16 @@ public: } } /// - void set(Spacing::Space sp, char const* val) + void set(Spacing::Space sp, char const * val) { float fval; - sscanf(val,"%f",&fval); - set(sp,fval); + sscanf(val, "%f", &fval); + set(sp, fval); } /// - void writeFile(FILE *file); + void writeFile(FILE * file); /// - friend bool operator!=(Spacing const &a, Spacing const &b) + friend bool operator!=(Spacing const & a, Spacing const & b) { if (a.space == b.space && a.getValue() == b.getValue()) return false; diff --git a/src/TableLayout.C b/src/TableLayout.C index 16f8e78a9e..56700481db 100644 --- a/src/TableLayout.C +++ b/src/TableLayout.C @@ -1,8 +1,8 @@ #include #include -#include "definitions.h" #include FORMS_H_LOCATION + #include "layout_forms.h" #include "lyx_main.h" #include "lyxrc.h" @@ -19,22 +19,21 @@ extern void BeforeChange(); -/* Prototypes */ -extern FD_form_table_options *fd_form_table_options; -extern FD_form_table_extra *fd_form_table_extra; -extern BufferView *current_view; +// Prototypes +extern FD_form_table_options * fd_form_table_options; +extern FD_form_table_extra * fd_form_table_extra; +extern BufferView * current_view; + +static int Confirmed = false; +static int ActCell; -static int - Confirmed = false, - 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) - static int - extra_col_cursor_x, // need no y's, one-line input fields - extra_multicol_cursor_x; +static int extra_col_cursor_x; // need no y's, one-line input fields +static int extra_multicol_cursor_x; // Joacim bool UpdateLayoutTable(int flag) @@ -44,31 +43,26 @@ bool UpdateLayoutTable(int flag) update = false; if (update && current_view->buffer()->text->cursor.par->table) { - int - align, - column,row; - char - buf[12]; - string - pwidth, special; - + 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; - column = table->column_of_cell(cell)+1; - fl_set_object_label(fd_form_table_options->text_warning,""); + 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); + 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); - row = table->row_of_cell(cell)+1; - sprintf(buf,"%d",row); + 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)) @@ -95,11 +89,11 @@ bool UpdateLayoutTable(int flag) fl_set_button(fd_form_table_options->radio_border_right, 1); else fl_set_button(fd_form_table_options->radio_border_right, 0); - align = table->GetAlignment(cell); + 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); + special = table->GetAlignSpecial(cell, LyXTable::SET_SPECIAL_COLUMN); if (flag) { fl_set_input(fd_form_table_extra->input_special_alignment, @@ -109,7 +103,7 @@ bool UpdateLayoutTable(int flag) } if (current_view->buffer()->isReadonly()) fl_deactivate_object(fd_form_table_extra->input_special_alignment); - special = table->GetAlignSpecial(cell,LyXTable::SET_SPECIAL_MULTI); + special = table->GetAlignSpecial(cell, LyXTable::SET_SPECIAL_MULTI); if (flag) { fl_set_input(fd_form_table_extra->input_special_multialign, @@ -121,7 +115,7 @@ bool UpdateLayoutTable(int flag) 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()); + 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()) { @@ -134,7 +128,7 @@ bool UpdateLayoutTable(int flag) 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); + fl_set_button(fd_form_table_options->radio_linebreak_cell, 0); } if ((!pwidth.empty() && !table->IsMultiColumn(cell)) || (align == LYX_ALIGN_LEFT)) @@ -164,7 +158,7 @@ bool UpdateLayoutTable(int flag) fl_set_object_lcol(fd_form_table_options->radio_align_center, FL_BLACK); } - fl_set_button(fd_form_table_options->radio_longtable,table->IsLongTable()); + 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); @@ -197,11 +191,11 @@ bool UpdateLayoutTable(int flag) 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_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, @@ -225,25 +219,27 @@ bool UpdateLayoutTable(int flag) return update; } + void OpenLayoutTableExtra() { - static int ow = -1, oh; - if (fd_form_table_extra->form_table_extra->visible) { - fl_raise_form(fd_form_table_extra->form_table_extra); - } else { - fl_show_form(fd_form_table_extra->form_table_extra, - FL_PLACE_MOUSE | FL_FREE_SIZE,FL_FULLBORDER, - _("Table Extra Form")); + if (fd_form_table_extra->form_table_extra->visible) { + fl_raise_form(fd_form_table_extra->form_table_extra); + } else { + static int ow = -1, oh; + fl_show_form(fd_form_table_extra->form_table_extra, + FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER, + _("Table Extra Form")); if (ow < 0) { ow = fd_form_table_extra->form_table_extra->w; oh = fd_form_table_extra->form_table_extra->h; } fl_set_form_minsize(fd_form_table_extra->form_table_extra, - ow,oh); - } + ow, oh); + } } + void MenuLayoutTable(int flag) { if (UpdateLayoutTable(flag)) { @@ -258,10 +254,10 @@ void MenuLayoutTable(int flag) } } -void TableOptionsCB(FL_OBJECT *ob, long) + +void TableOptionsCB(FL_OBJECT * ob, long) { - LyXTable - *table = 0; + LyXTable * table = 0; int s, num = 0; @@ -271,8 +267,7 @@ void TableOptionsCB(FL_OBJECT *ob, long) if (!current_view->available() || - !(table = current_view->buffer()->text->cursor.par->table)) - { + !(table = current_view->buffer()->text->cursor.par->table)) { MenuLayoutTable(0); return; } @@ -284,8 +279,8 @@ void TableOptionsCB(FL_OBJECT *ob, long) 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; + extra_col_cursor_x = 0; // would rather place it at the end, but... + extra_multicol_cursor_x = 0; return; } // No point in processing directives that you can't do anything with @@ -296,7 +291,7 @@ void TableOptionsCB(FL_OBJECT *ob, long) } if (ob != fd_form_table_options->button_table_delete) { - fl_set_object_label(fd_form_table_options->text_warning,""); + fl_set_object_label(fd_form_table_options->text_warning, ""); Confirmed = false; } str = fl_get_input(fd_form_table_options->input_column_width); @@ -306,8 +301,8 @@ void TableOptionsCB(FL_OBJECT *ob, long) fl_show_object(fd_form_table_options->text_warning); return; } - if (((ob==fd_form_table_options->button_delete_row) && (table->rows<=1)) || - ((ob==fd_form_table_options->button_delete_column) && (table->columns<=1))) + if (((ob == fd_form_table_options->button_delete_row) && (table->rows<= 1)) || + ((ob == fd_form_table_options->button_delete_column) && (table->columns<= 1))) ob = fd_form_table_options->button_table_delete; if (ob == fd_form_table_options->button_append_row) num = LyXTable::APPEND_ROW; @@ -335,7 +330,7 @@ void TableOptionsCB(FL_OBJECT *ob, long) num = LyXTable::ALIGN_RIGHT; else if (ob == fd_form_table_options->radio_align_center) num = LyXTable::ALIGN_CENTER; - else if ((ob==fd_form_table_options->button_table_delete) && !Confirmed) { + else if ((ob == fd_form_table_options->button_table_delete) && !Confirmed) { fl_set_object_label(fd_form_table_options->text_warning, _("Confirm: press Delete-Button again")); Confirmed = true; @@ -347,7 +342,7 @@ void TableOptionsCB(FL_OBJECT *ob, long) } else if (ob == fd_form_table_options->radio_multicolumn) num = LyXTable::MULTICOLUMN; else if (ob == fd_form_table_options->radio_longtable) { - s=fl_get_button(fd_form_table_options->radio_longtable); + s = fl_get_button(fd_form_table_options->radio_longtable); if (s) { num = LyXTable::SET_LONGTABLE; fl_activate_object(fd_form_table_options->radio_lt_firsthead); @@ -372,11 +367,11 @@ void TableOptionsCB(FL_OBJECT *ob, long) 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_firsthead,0); - fl_set_button(fd_form_table_options->radio_lt_firsthead,0); - fl_set_button(fd_form_table_options->radio_lt_firsthead,0); - fl_set_button(fd_form_table_options->radio_lt_firsthead,0); + fl_set_button(fd_form_table_options->radio_lt_firsthead, 0); + fl_set_button(fd_form_table_options->radio_lt_firsthead, 0); + fl_set_button(fd_form_table_options->radio_lt_firsthead, 0); + fl_set_button(fd_form_table_options->radio_lt_firsthead, 0); + fl_set_button(fd_form_table_options->radio_lt_firsthead, 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, @@ -389,13 +384,13 @@ void TableOptionsCB(FL_OBJECT *ob, long) FL_INACTIVE); } } else if (ob == fd_form_table_options->radio_rotate_table) { - s=fl_get_button(fd_form_table_options->radio_rotate_table); + s = fl_get_button(fd_form_table_options->radio_rotate_table); if (s) num = LyXTable::SET_ROTATE_TABLE; else num = LyXTable::UNSET_ROTATE_TABLE; } else if (ob == fd_form_table_options->radio_rotate_cell) { - s=fl_get_button(fd_form_table_options->radio_rotate_cell); + s = fl_get_button(fd_form_table_options->radio_rotate_cell); if (s) num = LyXTable::SET_ROTATE_CELL; else @@ -416,12 +411,12 @@ void TableOptionsCB(FL_OBJECT *ob, long) OpenLayoutTableExtra(); return; } else if (ob == fd_form_table_extra->input_special_alignment) { - special=fl_get_input(fd_form_table_extra->input_special_alignment); + special = fl_get_input(fd_form_table_extra->input_special_alignment); int dummy; fl_get_input_cursorpos(ob, &extra_col_cursor_x, &dummy); num = LyXTable::SET_SPECIAL_COLUMN; } else if (ob == fd_form_table_extra->input_special_multialign) { - special=fl_get_input(fd_form_table_extra->input_special_multialign); + special = fl_get_input(fd_form_table_extra->input_special_multialign); int dummy; fl_get_input_cursorpos(ob, &extra_multicol_cursor_x, &dummy); num = LyXTable::SET_SPECIAL_MULTI; @@ -435,7 +430,7 @@ void TableOptionsCB(FL_OBJECT *ob, long) } if ((num == LyXTable::SET_SPECIAL_COLUMN) || (num == LyXTable::SET_SPECIAL_MULTI)) - current_view->buffer()->text->TableFeatures(num,special); + current_view->buffer()->text->TableFeatures(num, special); else current_view->buffer()->text->TableFeatures(num); current_view->buffer()->update(1); @@ -467,7 +462,7 @@ void TableSpeCloseCB(FL_OBJECT *, long) void SetPWidthCB(FL_OBJECT *ob, long) { - fl_set_object_label(fd_form_table_options->text_warning,""); + fl_set_object_label(fd_form_table_options->text_warning, ""); Confirmed = false; if (ob == fd_form_table_options->input_column_width) { string @@ -485,7 +480,7 @@ void SetPWidthCB(FL_OBJECT *ob, long) BeforeChange(); current_view->buffer()->update(-2); } - current_view->buffer()->text->TableFeatures(LyXTable::SET_PWIDTH,str); + current_view->buffer()->text->TableFeatures(LyXTable::SET_PWIDTH, str); current_view->buffer()->update(1); } MenuLayoutTable(0); // update for alignment diff --git a/src/bmtable.C b/src/bmtable.C index ffc064d2b3..a1d63255ad 100644 --- a/src/bmtable.C +++ b/src/bmtable.C @@ -6,7 +6,7 @@ * Description: A bitmap table uses a single bitmap to simulate a 2d array * of bitmap buttons. It can be used to build bitmap menus. * - * Copyright 1995,1996 Alejandro Aguilar Sierra + * Copyright 1995, 1996 Alejandro Aguilar Sierra * * You are free to use and modify this code under the terms of * the GNU General Public Licence version 2 or later. @@ -56,7 +56,7 @@ FL_OBJECT *fl_add_bmtable(int type, FL_Coord x, FL_Coord y, { FL_OBJECT *ob; - ob = fl_create_bmtable(type, x, y, w,h, label); + ob = fl_create_bmtable(type, x, y, w, h, label); fl_add_object(fl_current_form, ob); return ob; @@ -102,14 +102,14 @@ static void draw_bitmaptable(FL_OBJECT *ob) xx = FL_abs(ob->bw) - sp->bx + 1; mx = ob->x + FL_abs(ob->bw) + 1; } else { - xx =0; + xx = 0; mx = ob->x + sp->bx; } if (sp->by < FL_abs(ob->bw) + 1) { yy = FL_abs(ob->bw) - sp->by + 1; my = ob->y + FL_abs(ob->bw) + 1; } else { - yy =0; + yy = 0; my = ob->y + sp->by; } ww = (mx + sp->bw < ob->x + ob->w - FL_abs(ob->bw)) ? @@ -134,19 +134,19 @@ static void draw_bitmaptable(FL_OBJECT *ob) mx = ob->x + ob->w; my = ob->y + ob->h; ww = ob->w; - for (yy=ob->y; yy<=my; yy+=sp->dy) { - if (ob->boxtype!=FL_FLAT_BOX && (yy==ob->y || yy>my-sp->dy)) + for (yy= ob->y; yy<= my; yy+= sp->dy) { + if (ob->boxtype!= FL_FLAT_BOX && (yy == ob->y || yy>my-sp->dy)) continue; - if (lx>0 && yy>=my-sp->dy - sp->dy/2) + if (lx>0 && yy>= my-sp->dy - sp->dy/2) ww = lx*sp->dx; fl_diagline(ob->x, yy, ww, 1, FL_BOTTOM_BCOL); fl_diagline(ob->x, yy+1, ww-2, 1, FL_TOP_BCOL); } hh = ob->h; - for (xx=ob->x; xx<=mx; xx+=sp->dx) { - if (ob->boxtype!=FL_FLAT_BOX && (xx==ob->x || xx>mx-sp->dx)) + for (xx= ob->x; xx<= mx; xx+= sp->dx) { + if (ob->boxtype!= FL_FLAT_BOX && (xx == ob->x || xx>mx-sp->dx)) continue; - if (lx>0 && xx>=ob->x+lx*sp->dx) + if (lx>0 && xx>= ob->x+lx*sp->dx) hh = (sp->ny-1)*sp->dy; fl_diagline(xx, ob->y, 1, hh, FL_RIGHT_BCOL); fl_diagline(xx+1, ob->y+1, 1, hh-2, FL_LEFT_BCOL); @@ -183,7 +183,7 @@ extern "C" int handle_bitmaptable(FL_OBJECT *ob, int event, FL_Coord mx, break; } i = (mx - ob->x)/sp->dx; j = (my - ob->y)/sp->dy; - if (i>=0 && i< sp->nx && j>=0 && j< sp->ny) { + if (i>= 0 && i< sp->nx && j>= 0 && j< sp->ny) { i += j*sp->nx; if (i >= sp->maxi) i = -1; if (sp->i != i) { @@ -291,7 +291,7 @@ void fl_set_bmtable_file(FL_OBJECT *ob, int nx, int ny, char const *filename) unsigned char *bdata; if(XReadBitmapFileData(filename, &bw, &bh, - &bdata, &xh, &yh)==BitmapSuccess) + &bdata, &xh, &yh) == BitmapSuccess) fl_set_bmtable_data(ob, nx, ny, bw, bh, bdata); XFlush(fl_display); } diff --git a/src/bmtable.h b/src/bmtable.h index 85e9fdb43c..7b26b692ca 100644 --- a/src/bmtable.h +++ b/src/bmtable.h @@ -6,15 +6,15 @@ * Description: A bitmap table uses a single bitmap to simulate a 2d array * of bitmap buttons. It can be used to build bitmap menus. * - * Copyright (C) 1995,1996 Alejandro Aguilar Sierra + * Copyright (C) 1995, 1996 Alejandro Aguilar Sierra * * You are free to use and modify this code under the terms of * the GNU General Public Licence version 2 or later. * */ -#ifndef __BMTABLE_H__ -#define __BMTABLE_H__ +#ifndef BMTABLE_H +#define BMTABLE_H #include FORMS_H_LOCATION @@ -84,5 +84,5 @@ void fl_free_bmtable_bitmap(FL_OBJECT *ob); /** Free the current pixmap in preparation for installing a new one */ void fl_free_bmtable_pixmap(FL_OBJECT *ob); -#endif /* __BMTABLE_H__ */ +#endif /* BMTABLE_H */ diff --git a/src/broken_const.h b/src/broken_const.h index 3e9697a889..742e42accc 100644 --- a/src/broken_const.h +++ b/src/broken_const.h @@ -1,12 +1,12 @@ /* -*- C++ -*- */ /* This file is part of -* ====================================================== +* ====================================================== * * LyX, the High Level Word Processor * -* Copyright (C) 1995,1996 Matthias Ettrich +* Copyright (C) 1995, 1996 Matthias Ettrich * -*====================================================== +* ====================================================== broken_const.h -- inhibits the `const' keyword for compilation */ #ifdef const diff --git a/src/broken_headers.h b/src/broken_headers.h index dd97486bba..ed82f78f14 100644 --- a/src/broken_headers.h +++ b/src/broken_headers.h @@ -1,12 +1,12 @@ /* -*- C++ -*- */ /* This file is part of -* ====================================================== +* ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995 Matthias Ettrich * Copyright (C) 1995-1998 The LyX Team -*====================================================== +* ====================================================== A few prototypes missing from Sun and SCO 3.2v4 header files */ #ifndef BROKEN_HEADERS_H @@ -17,11 +17,11 @@ extern "C" { #endif #ifndef HAVE_MEMMOVE -void bcopy(unsigned char *b1, unsigned char *b2, int length); +void bcopy(unsigned char * b1, unsigned char * b2, int length); #endif -int readlink(char const *path, char *buf, int bufsiz); -int strcasecmp(char const *s1, char const *s2); +int readlink(char const * path, char * buf, int bufsiz); +int strcasecmp(char const * s1, char const * s2); #ifdef __cplusplus } diff --git a/src/buffer.C b/src/buffer.C index 3b4788e8e7..f6b56a70e9 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -1,5 +1,5 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * @@ -9,11 +9,11 @@ * This file is Copyright 1996-1999 * Lars Gullik Bjønnes * - * ====================================================== + * ====================================================== */ // Change Log: -// =========== +// =========== // 23/03/98 Heinrich Bauer (heinrich.bauer@t-mobil.de) // Spots marked "changed Heinrich Bauer, 23/03/98" modified due to the // following bug: dvi file export did not work after printing (or previewing) @@ -30,7 +30,6 @@ #pragma implementation "buffer.h" #endif -#include "definitions.h" #include "buffer.h" #include "bufferlist.h" #include "lyx_main.h" @@ -50,7 +49,9 @@ #include "insets/inseturl.h" #include "insets/insetinfo.h" #include "insets/insetquotes.h" +#if 0 #include "insets/insetlatex.h" +#endif #include "insets/insetlatexaccent.h" #include "insets/insetbib.h" #include "insets/insetindex.h" @@ -100,7 +101,7 @@ extern int tex_code_break_column; extern void FreeUpdateTimer(); -Buffer::Buffer(string const & file, LyXRC *lyxrc, bool ronly) +Buffer::Buffer(string const & file, LyXRC * lyxrc, bool ronly) { lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl; filename = file; @@ -157,11 +158,12 @@ bool Buffer::saveParamsAsDefaults() Buffer defaults = Buffer(fname); // Use the current buffer's parameters as default - defaults.params.Copy(params); + defaults.params = params; + // add an empty paragraph. Is this enough? defaults.paragraph = new LyXParagraph; - return defaults.writeFile(defaults.filename,false); + return defaults.writeFile(defaults.filename, false); } @@ -220,7 +222,7 @@ bool Buffer::insertLyXFile(string const & filen) if (!fi.exist() || !fi.readable()) { WriteAlert(_("Error!"), _("Cannot open specified file:"), - MakeDisplayPath(filename,50)); + MakeDisplayPath(filename, 50)); return false; } @@ -230,7 +232,7 @@ bool Buffer::insertLyXFile(string const & filen) if (!myfile()) { WriteAlert(_("Error!"), _("Cannot open specified file:"), - MakeDisplayPath(filename,50)); + MakeDisplayPath(filename, 50)); return false; } LyXLex lex(0, 0); @@ -258,7 +260,7 @@ bool Buffer::insertLyXFile(string const & filen) // if par = 0 normal behavior // else insert behavior // Returns false if "\the_end" is not read for formats >= 2.13. (Asger) -bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) +bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par) { string tmptok; Inset * inset = 0; @@ -269,7 +271,7 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) LyXParagraph::footnote_kind footnotekind = LyXParagraph::FOOTNOTE; bool the_end_read = false; - LyXParagraph *return_par = 0; + LyXParagraph * return_par = 0; LyXFont font = LyXFont(LyXFont::ALL_INHERIT); // If we are inserting, we cheat and get a token in advance @@ -278,13 +280,10 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) if(!par) { par = new LyXParagraph; -#ifdef NEW_TEXT - par->text.reserve(500); -#endif } else { text->BreakParagraph(); return_par = text->FirstParagraph(); - pos=0; + pos = 0; markDirty(); // We don't want to adopt the parameters from the // document we insert, so we skip until the text begins: @@ -313,7 +312,7 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) continue; else if (token[0] != '\\') { int n = token.length(); - for (int i=0; i < n; i++) { + for (int i = 0; i < n; i++) { par->InsertChar(pos, token[i]); par->SetFont(pos, font); pos++; @@ -321,7 +320,7 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) } else if (token == "\\i") { inset = new InsetLatexAccent; inset->Read(lex); - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); @@ -330,13 +329,8 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) if (!return_par) return_par = par; else { -#ifdef NEW_TEXT par->text.resize(par->text.size()); -#endif par = new LyXParagraph(par); -#ifdef NEW_TEXT - par->text.reserve(500); -#endif } pos = 0; lex.EatLine(); @@ -365,13 +359,8 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) if (!return_par) return_par = par; else { -#ifdef NEW_TEXT par->text.resize(par->text.size()); -#endif par = new LyXParagraph(par); -#ifdef NEW_TEXT - par->text.reserve(500); -#endif } footnotekind = LyXParagraph::FOOTNOTE; footnoteflag = LyXParagraph::NO_FOOTNOTE; @@ -402,7 +391,7 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) params.readPreamble(lex); } else if (token == "\\textclass") { lex.EatLine(); - pair pp = + pair pp = textclasslist.NumberOfClass(lex.GetString()); if (pp.first) { params.textclass = pp.second; @@ -457,7 +446,8 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) tmpret = lex.FindToken(string_paragraph_separation); if (tmpret == -1) tmpret++; if (tmpret != LYX_LAYOUT_DEFAULT) - params.paragraph_separation = tmpret; + params.paragraph_separation = + static_cast(tmpret); } else if (token == "\\defskip") { lex.nextToken(); params.defskip = VSpace(lex.GetString()); @@ -476,7 +466,7 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) tmpret = lex.FindToken(string_quotes_language); if (tmpret == -1) tmpret++; if (tmpret != LYX_LAYOUT_DEFAULT) { - InsetQuotes::quote_language tmpl = + InsetQuotes::quote_language tmpl = InsetQuotes::EnglishQ; switch(tmpret) { case 0: @@ -511,10 +501,14 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) break; } } else if (token == "\\papersize") { +#if 0 if (format > 2.13) +#endif tmpret = lex.FindToken(string_papersize); +#if 0 else tmpret = lex.FindToken(string_oldpapersize); +#endif if (tmpret == -1) tmpret++; else @@ -523,7 +517,7 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) tmpret = lex.FindToken(string_paperpackages); if (tmpret == -1) { tmpret++; - params.paperpackage = PACKAGE_NONE; + params.paperpackage = BufferParams::PACKAGE_NONE; } else params.paperpackage = tmpret; } else if (token == "\\use_geometry") { @@ -536,7 +530,7 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) tmpret = lex.FindToken(string_orientation); if (tmpret == -1) tmpret++; if (tmpret != LYX_LAYOUT_DEFAULT) - params.orientation = tmpret; + params.orientation = static_cast(tmpret); } else if (token == "\\paperwidth") { lex.next(); params.paperwidth = lex.GetString(); @@ -753,10 +747,11 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) if (tmptok == "Quotes") { inset = new InsetQuotes; inset->Read(lex); - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); pos++; +#if 0 // should not be used any more } else if (tmptok == "Latex") { // This one is on its way out lex.EatLine(); @@ -765,7 +760,7 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) if (tmptok[0] == '\\') { // then this latex is a // latex command - InsetCommand *tmpinset = + InsetCommand *tmpinset = new InsetCommand(); tmpinset->scanCommand(tmptok); inset = tmpinset; @@ -775,10 +770,12 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) // the paragraph and mark it as tex. inset = new InsetLatex(tmptok); } - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); pos++; +#endif +#if 0 // should not be used any more } else if (tmptok == "LatexDel") { // This one is on its way out... lex.EatLine(); @@ -797,14 +794,14 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) inset = new InsetRef(tmptok, this); } else if (contains(tmptok, "\\url{") || contains(tmptok, "\\htmlurl{")) { - string cont,opt,tmptmptok,cmdname; + string cont, opt, tmptmptok, cmdname; lex.next(); while(lex.IsOK() && lex.GetString() != "\\end_inset" ) { lex.next(); } lex.next(); while(lex.IsOK()) { - tmptmptok=lex.GetString(); + tmptmptok = lex.GetString(); if(tmptmptok[0] == '\\') { if( tmptmptok == "\\backslash") opt += '\\'; @@ -821,7 +818,7 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) } lex.next(); while(lex.IsOK()) { - tmptmptok=lex.GetString(); + tmptmptok = lex.GetString(); if(tmptmptok[0] == '\\') { if( tmptmptok == "\\backslash") cont += '\\'; @@ -842,44 +839,45 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) cmdname = string("htmlurl"); cont = strip(cont); opt = strip(opt); - inset = new InsetUrl(cmdname,cont,opt); + inset = new InsetUrl(cmdname, cont, opt); } else if (tmptok[0] == '\\') { // then this latex del is a // latex command - InsetCommand *tmpinset = + InsetCommand * tmpinset = new InsetCommand(); tmpinset->scanCommand(tmptok); inset = tmpinset; } - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); pos++; +#endif } else if (tmptok == "\\i") { inset = new InsetLatexAccent; inset->Read(lex); - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); pos++; } else if (tmptok == "FormulaMacro") { inset = new InsetFormulaMacro; inset->Read(lex); - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); pos++; } else if (tmptok == "Formula") { inset = new InsetFormula; inset->Read(lex); - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); pos++; } else if (tmptok == "Figure") { - inset = new InsetFig(100,100, this); + inset = new InsetFig(100, 100, this); inset->Read(lex); - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); pos++; @@ -890,7 +888,7 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) tmp += lex.GetString(); tmp += '}'; inset = new InsetLabel(tmp); - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); pos++; @@ -898,35 +896,35 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) } else if (tmptok == "Info") { inset = new InsetInfo; inset->Read(lex); - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); pos++; } else if (tmptok == "Include") { inset = new InsetInclude(string(), this); inset->Read(lex); - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); pos++; } else if (tmptok == "LatexCommand") { InsetCommand inscmd; inscmd.Read(lex); - if (inscmd.getCmdName()=="cite") { + if (inscmd.getCmdName() == "cite") { inset = new InsetCitation(inscmd.getContents(), inscmd.getOptions()); - } else if (inscmd.getCmdName()=="bibitem") { + } else if (inscmd.getCmdName() == "bibitem") { lex.printError("Wrong place for bibitem"); inset = inscmd.Clone(); - } else if (inscmd.getCmdName()=="BibTeX") { + } else if (inscmd.getCmdName() == "BibTeX") { inset = new InsetBibtex(inscmd.getContents(), inscmd.getOptions(), this); - } else if (inscmd.getCmdName()=="index") { + } else if (inscmd.getCmdName() == "index") { inset = new InsetIndex(inscmd.getContents()); - } else if (inscmd.getCmdName()=="include") { + } else if (inscmd.getCmdName() == "include") { inset = new InsetInclude(inscmd.getContents(), this); - } else if (inscmd.getCmdName()=="label") { + } else if (inscmd.getCmdName() == "label") { inset = new InsetLabel(inscmd.getCommand()); - } else if (inscmd.getCmdName()=="url" - || inscmd.getCmdName()=="htmlurl") { + } else if (inscmd.getCmdName() == "url" + || inscmd.getCmdName() == "htmlurl") { inset = new InsetUrl(inscmd.getCommand()); } else if (inscmd.getCmdName() == "ref" || inscmd.getCmdName() == "pageref") { @@ -937,14 +935,14 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) to the latexdel ref inset that was transformed to an empty ref inset plus the body surronded by latexdel insets */ else { - string cont,opt,tmptmptok,cmdname; + string cont, opt, tmptmptok, cmdname; lex.next(); while(lex.IsOK() && lex.GetString() != "\\end_inset" ) { lex.next(); } lex.next(); while(lex.IsOK()) { - tmptmptok=lex.GetString(); + tmptmptok = lex.GetString(); if(tmptmptok[0] == '\\') { if( tmptmptok == "\\backslash") opt += '\\'; @@ -961,7 +959,7 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) } lex.next(); while(lex.IsOK()) { - tmptmptok=lex.GetString(); + tmptmptok = lex.GetString(); if(tmptmptok[0] == '\\') { if( tmptmptok == "\\backslash") cont += '\\'; @@ -982,33 +980,33 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) cmdname = "\\" + inscmd.getCmdName(); cmdname += "[" + cont + "]"; cmdname += "{" + opt + "}"; - inset = new InsetRef(cmdname,this); + inset = new InsetRef(cmdname, this); } - } else if (inscmd.getCmdName()=="tableofcontents") { + } else if (inscmd.getCmdName() == "tableofcontents") { inset = new InsetTOC(this); - } else if (inscmd.getCmdName()=="listoffigures") { + } else if (inscmd.getCmdName() == "listoffigures") { inset = new InsetLOF(this); - } else if (inscmd.getCmdName()=="listofalgorithms") { + } else if (inscmd.getCmdName() == "listofalgorithms") { inset = new InsetLOA(this); - } else if (inscmd.getCmdName()=="listoftables") { + } else if (inscmd.getCmdName() == "listoftables") { inset = new InsetLOT(this); - } else if (inscmd.getCmdName()=="printindex") { + } else if (inscmd.getCmdName() == "printindex") { inset = new InsetPrintIndex(this); - } else if (inscmd.getCmdName()=="lyxparent") { - inset = new InsetParent(inscmd.getContents(),this); + } else if (inscmd.getCmdName() == "lyxparent") { + inset = new InsetParent(inscmd.getContents(), this); } else // The following three are only for compatibility - if (inscmd.getCmdName()=="-") { + if (inscmd.getCmdName() == "-") { inset = new InsetSpecialChar(InsetSpecialChar::HYPHENATION); - } else if (inscmd.getCmdName()=="@.") { + } else if (inscmd.getCmdName() == "@.") { inset = new InsetSpecialChar(InsetSpecialChar::END_OF_SENTENCE); - } else if (inscmd.getCmdName()=="ldots") { + } else if (inscmd.getCmdName() == "ldots") { inset = new InsetSpecialChar(InsetSpecialChar::LDOTS); } else inset = inscmd.Clone(); if (inset) { - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); pos++; @@ -1017,52 +1015,54 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) } else if (token == "\\InsetQuotes") { inset = new InsetQuotes; inset->Read(lex); - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); pos++; +#if 0 } else if (token == "\\InsetLatex") { inset = new InsetLatex; inset->Read(lex); - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); pos++; } else if (token == "\\InsetLatexDel") { lex.printError(_("Warning: Ignoring Old Inset")); +#endif } else if (token == "\\InsetFormula") { inset = new InsetFormula; inset->Read(lex); - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); pos++; } else if (token == "\\SpecialChar") { inset = new InsetSpecialChar; inset->Read(lex); - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); pos++; } else if (token == "\\Figure") { - inset = new InsetFig(100,100, this); + inset = new InsetFig(100, 100, this); inset->Read(lex); - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, inset); par->SetFont(pos, font); pos++; } else if (token == "\\newline") { - par->InsertChar(pos, LYX_META_NEWLINE); + par->InsertChar(pos, LyXParagraph::META_NEWLINE); par->SetFont(pos, font); pos++; } else if (token == "\\LyXTable") { par->table = new LyXTable(lex); } else if (token == "\\hfill") { - par->InsertChar(pos, LYX_META_HFILL); + par->InsertChar(pos, LyXParagraph::META_HFILL); par->SetFont(pos, font); pos++; } else if (token == "\\protected_separator") { - par->InsertChar(pos, LYX_META_PROTECTED_SEPARATOR); + par->InsertChar(pos, LyXParagraph::META_PROTECTED_SEPARATOR); par->SetFont(pos, font); pos++; } else if (token == "\\bibitem") { // ale970302 @@ -1080,7 +1080,7 @@ bool Buffer::readLyXformat2(LyXLex &lex, LyXParagraph * par) lex.printError("Unknown token `$$Token'. " "Inserting as text."); int n = token.length(); - for (int i=0; i < n; i++) { + for (int i = 0; i < n; i++) { par->InsertChar(pos, token[i]); par->SetFont(pos, font); pos++; @@ -1120,12 +1120,16 @@ bool Buffer::readFile(LyXLex & lex, LyXParagraph * par) // Formats >= 2.13 support "\the_end" marker if (format < 2.13) the_end = true; +#if 0 // Formats >= 2.14 changed papersize stuff if (format < 2.14) { setOldPaperStuff(); } else { +#endif setPaperStuff(); +#if 0 } +#endif if (!the_end) WriteAlert(_("Warning!"), _("Reading of document is not complete"), @@ -1164,7 +1168,8 @@ bool Buffer::writeFile(string const & filename, bool flag) lyxerr << _("Error! Document is read-only: ") << filename << endl; else - WriteAlert(_("Error! Document is read-only: "), filename); + WriteAlert(_("Error! Document is read-only: "), + filename); return false; } @@ -1176,7 +1181,8 @@ bool Buffer::writeFile(string const & filename, bool flag) lyxerr << _("Error! Cannot write file: ") << filename << endl; else - WriteFSAlert(_("Error! Cannot write file: "), filename); + WriteFSAlert(_("Error! Cannot write file: "), + filename); return false; } @@ -1186,7 +1192,8 @@ bool Buffer::writeFile(string const & filename, bool flag) lyxerr << _("Error! Cannot write file: ") << filename << endl; else - WriteFSAlert(_("Error! Cannot write file: "), filename); + WriteFSAlert(_("Error! Cannot write file: "), + filename); return false; } // The top of the file should not be written by params. @@ -1245,25 +1252,21 @@ void Buffer::writeFileAscii(string const & filename, int linelen) fname1, tmp; -#ifdef NEW_TEXT LyXParagraph::size_type i; -#else - int i; -#endif int - j,h, - ltype=0, - ltype_depth=0, - noparbreak=0, - islatex=0, - *clen=0, - actcell=0, - actpos=0, - cell=0, - cells=0, - currlinelen=0; + j, h, + ltype = 0, + ltype_depth = 0, + noparbreak = 0, + islatex = 0, + * clen = 0, + actcell = 0, + actpos = 0, + cell = 0, + cells = 0, + currlinelen = 0; long - fpos=0; + fpos = 0; bool ref_printed = false; @@ -1272,7 +1275,7 @@ void Buffer::writeFileAscii(string const & filename, int linelen) WriteFSAlert(_("Error: Cannot write file:"), filename); return; } - fname1=TmpFileName(); + fname1 = TmpFileName(); while (par) { noparbreak = 0; islatex = 0; @@ -1284,9 +1287,9 @@ void Buffer::writeFileAscii(string const & filename, int linelen) if (footnoteflag != par->footnoteflag) { footnoteflag = par->footnoteflag; if (footnoteflag) { - j=strlen(string_footnotekinds[par->footnotekind])+4; + j = strlen(string_footnotekinds[par->footnotekind])+4; if (currlinelen+j > linelen) - fprintf(file,"\n"); + fprintf(file, "\n"); fprintf(file, "([%s] ", string_footnotekinds[par->footnotekind]); currlinelen += j; @@ -1308,17 +1311,17 @@ void Buffer::writeFileAscii(string const & filename, int linelen) } /* First write the layout */ - tmp = textclasslist.NameOfLayout(params.textclass,par->layout); + tmp = textclasslist.NameOfLayout(params.textclass, par->layout); if (tmp == "Itemize") { ltype = 1; ltype_depth = depth+1; - } else if (tmp =="Enumerate") { + } else if (tmp == "Enumerate") { ltype = 2; ltype_depth = depth+1; - } else if (strstr(tmp.c_str(),"ection")) { + } else if (strstr(tmp.c_str(), "ection")) { ltype = 3; ltype_depth = depth+1; - } else if (strstr(tmp.c_str(),"aragraph")) { + } else if (strstr(tmp.c_str(), "aragraph")) { ltype = 4; ltype_depth = depth+1; } else if (tmp == "Description") { @@ -1358,7 +1361,7 @@ void Buffer::writeFileAscii(string const & filename, int linelen) if (par->table){ if (!lyxrc->ascii_roff_command.empty() && lyxrc->ascii_roff_command != "none") { - RoffAsciiTable(file,par); + RoffAsciiTable(file, par); par = par->next; continue; } @@ -1366,14 +1369,10 @@ void Buffer::writeFileAscii(string const & filename, int linelen) actcell = 0; cells = par->table->columns; clen = new int [cells]; - memset(clen,0,sizeof(int)*cells); -#ifdef NEW_TEXT + memset(clen, 0, sizeof(int)*cells); for (i = 0, j = 0, h = 1; i < par->size(); ++i, ++h) { -#else - for (i = 0, j = 0, h=1; i < par->last; i++, h++) { -#endif c = par->GetChar(i); - if (c == LYX_META_INSET) { + if (c == LyXParagraph::META_INSET) { if ((inset = par->GetInset(i))) { FilePtr fp(fname1, FilePtr::write); @@ -1385,7 +1384,7 @@ void Buffer::writeFileAscii(string const & filename, int linelen) h += ftell(fp) - 1; remove(fname1.c_str()); } - } else if (c == LYX_META_NEWLINE) { + } else if (c == LyXParagraph::META_NEWLINE) { if (clen[j] < h) clen[j] = h; h = 0; @@ -1398,15 +1397,11 @@ void Buffer::writeFileAscii(string const & filename, int linelen) } font1 = LyXFont(LyXFont::ALL_INHERIT); - actcell=0; -#ifdef NEW_TEXT + actcell = 0; for (i = 0, actpos = 1; i < par->size(); ++i, ++actpos) { -#else - for (i = 0,actpos=1; i < par->last; i++, actpos++) { -#endif if (!i && !footnoteflag && !noparbreak){ fprintf(file, "\n\n"); - for(j=0; jlabelstring.c_str()); + fprintf(file, "%s ", par->labelstring.c_str()); break; } if (ltype_depth > depth) { - for(j=ltype_depth-1; j>depth; j--) + for(j = ltype_depth-1; j>depth; j--) fprintf(file, " "); currlinelen += (ltype_depth-depth)*2; } if (par->table) { - for(j=0;j depth) { - for(j=ltype_depth; j>depth; j--) + for(j = ltype_depth; j>depth; j--) fprintf(file, " "); currlinelen += (ltype_depth-depth)*2; } - fprintf(file,"| "); + fprintf(file, "| "); } } font2 = par->GetFontSettings(i); @@ -1464,7 +1459,7 @@ void Buffer::writeFileAscii(string const & filename, int linelen) if (islatex) continue; switch (c) { - case LYX_META_INSET: + case LyXParagraph::META_INSET: if ((inset = par->GetInset(i))) { fpos = ftell(file); inset->Latex(file,-1); @@ -1472,39 +1467,39 @@ void Buffer::writeFileAscii(string const & filename, int linelen) actpos += (ftell(file) - fpos) - 1; } break; - case LYX_META_NEWLINE: + case LyXParagraph::META_NEWLINE: if (par->table) { if (par->table->NumberOfCellsInRow(actcell) <= cell) { - for(j=actpos;j depth) { - for(j=ltype_depth; j>depth; j--) + for(j = ltype_depth; j>depth; j--) fprintf(file, " "); currlinelen += (ltype_depth-depth)*2; } - for(j=0;j depth) { - for(j=ltype_depth; j>depth; j--) + for(j = ltype_depth; j>depth; j--) fprintf(file, " "); currlinelen += (ltype_depth-depth)*2; } - fprintf(file,"| "); + fprintf(file, "| "); cell = 1; } else { - for(j=actpos; j depth) { - for(j=ltype_depth; j>depth; j--) + for(j = ltype_depth; j>depth; j--) fprintf(file, " "); currlinelen += (ltype_depth-depth)*2; } } break; - case LYX_META_HFILL: + case LyXParagraph::META_HFILL: fprintf(file, "\t"); break; - case LYX_META_PROTECTED_SEPARATOR: + case LyXParagraph::META_PROTECTED_SEPARATOR: fprintf(file, " "); break; case '\\': fprintf(file, "\\"); break; default: -#ifdef NEW_TEXT if (currlinelen > linelen - 10 && c == ' ' && i + 2 < par->size()) { -#else - if (currlinelen > (linelen-10) \ - && c==' ' && (i+2 < par->last)) { -#endif fprintf(file, "\n"); for(j = 0; j < depth; ++j) fprintf(file, " "); @@ -1558,23 +1548,23 @@ void Buffer::writeFileAscii(string const & filename, int linelen) } } if (par->table) { - for(j=actpos;j depth) { - for(j=ltype_depth; j>depth; j--) + for(j = ltype_depth; j>depth; j--) fprintf(file, " "); currlinelen += (ltype_depth-depth)*2; } - for(j=0;jnext; @@ -1594,11 +1584,12 @@ void Buffer::makeLaTeXFile(string const & filename, tex_code_break_column = lyxrc->ascii_linelen; - LyXTextClass const & tclass = textclasslist.TextClass(params.textclass); + LyXTextClass const & tclass = + textclasslist.TextClass(params.textclass); FilePtr file(filename, FilePtr::write); if (!file()) { - WriteFSAlert(_("Error: Cannot write file:"),filename); + WriteFSAlert(_("Error: Cannot write file:"), filename); return; } @@ -1660,7 +1651,7 @@ void Buffer::makeLaTeXFile(string const & filename, string options; // the document class options. - if (tokenPos(tclass.opt_fontsize(), '|',params.fontsize) >= 0) { + if (tokenPos(tclass.opt_fontsize(), '|', params.fontsize) >= 0) { // only write if existing in list (and not default) options += params.fontsize; options += "pt,"; @@ -1668,24 +1659,24 @@ void Buffer::makeLaTeXFile(string const & filename, if (!params.use_geometry && - (params.paperpackage == PACKAGE_NONE)) { + (params.paperpackage == BufferParams::PACKAGE_NONE)) { switch (params.papersize) { - case PAPER_A4PAPER: + case BufferParams::PAPER_A4PAPER: options += "a4paper,"; break; - case PAPER_USLETTER: + case BufferParams::PAPER_USLETTER: options += "letterpaper,"; break; - case PAPER_A5PAPER: + case BufferParams::PAPER_A5PAPER: options += "a5paper,"; break; - case PAPER_B5PAPER: + case BufferParams::PAPER_B5PAPER: options += "b5paper,"; break; - case PAPER_EXECUTIVEPAPER: + case BufferParams::PAPER_EXECUTIVEPAPER: options += "executivepaper,"; break; - case PAPER_LEGALPAPER: + case BufferParams::PAPER_LEGALPAPER: options += "legalpaper,"; break; } @@ -1707,7 +1698,7 @@ void Buffer::makeLaTeXFile(string const & filename, options += "onecolumn,"; } - if (!params.use_geometry && params.orientation == ORIENTATION_LANDSCAPE) + if (!params.use_geometry && params.orientation == BufferParams::ORIENTATION_LANDSCAPE) options += "landscape,"; // language should be a parameter to \documentclass @@ -1751,17 +1742,17 @@ void Buffer::makeLaTeXFile(string const & filename, } /* at the very beginning the text parameters */ - if (params.paperpackage != PACKAGE_NONE) { + if (params.paperpackage != BufferParams::PACKAGE_NONE) { switch (params.paperpackage) { - case PACKAGE_A4: + case BufferParams::PACKAGE_A4: LFile += "\\usepackage{a4}\n"; texrow.newline(); break; - case PACKAGE_A4WIDE: + case BufferParams::PACKAGE_A4WIDE: LFile += "\\usepackage{a4wide}\n"; texrow.newline(); break; - case PACKAGE_WIDEMARGINSA4: + case BufferParams::PACKAGE_WIDEMARGINSA4: LFile += "\\usepackage[widemargins]{a4}\n"; texrow.newline(); break; @@ -1771,85 +1762,85 @@ void Buffer::makeLaTeXFile(string const & filename, LFile += "\\usepackage{geometry}\n"; texrow.newline(); LFile += "\\geometry{verbose"; - if (params.orientation == ORIENTATION_LANDSCAPE) + if (params.orientation == BufferParams::ORIENTATION_LANDSCAPE) LFile += ",landscape"; switch (params.papersize2) { - case VM_PAPER_CUSTOM: + case BufferParams::VM_PAPER_CUSTOM: if (!params.paperwidth.empty()) - LFile += ",paperwidth=" + LFile += ",paperwidth= " + params.paperwidth; if (!params.paperheight.empty()) - LFile += ",paperheight=" + LFile += ",paperheight= " + params.paperheight; break; - case VM_PAPER_USLETTER: + case BufferParams::VM_PAPER_USLETTER: LFile += ",letterpaper"; break; - case VM_PAPER_USLEGAL: + case BufferParams::VM_PAPER_USLEGAL: LFile += ",legalpaper"; break; - case VM_PAPER_USEXECUTIVE: + case BufferParams::VM_PAPER_USEXECUTIVE: LFile += ",executivepaper"; break; - case VM_PAPER_A3: + case BufferParams::VM_PAPER_A3: LFile += ",a3paper"; break; - case VM_PAPER_A4: + case BufferParams::VM_PAPER_A4: LFile += ",a4paper"; break; - case VM_PAPER_A5: + case BufferParams::VM_PAPER_A5: LFile += ",a5paper"; break; - case VM_PAPER_B3: + case BufferParams::VM_PAPER_B3: LFile += ",b3paper"; break; - case VM_PAPER_B4: + case BufferParams::VM_PAPER_B4: LFile += ",b4paper"; break; - case VM_PAPER_B5: + case BufferParams::VM_PAPER_B5: LFile += ",b5paper"; break; default: - // default papersize ie VM_PAPER_DEFAULT + // default papersize ie BufferParams::VM_PAPER_DEFAULT switch (lyxrc->default_papersize) { - case PAPER_DEFAULT: // keep compiler happy - case PAPER_USLETTER: + case BufferParams::PAPER_DEFAULT: // keep compiler happy + case BufferParams::PAPER_USLETTER: LFile += ",letterpaper"; break; - case PAPER_LEGALPAPER: + case BufferParams::PAPER_LEGALPAPER: LFile += ",legalpaper"; break; - case PAPER_EXECUTIVEPAPER: + case BufferParams::PAPER_EXECUTIVEPAPER: LFile += ",executivepaper"; break; - case PAPER_A3PAPER: + case BufferParams::PAPER_A3PAPER: LFile += ",a3paper"; break; - case PAPER_A4PAPER: + case BufferParams::PAPER_A4PAPER: LFile += ",a4paper"; break; - case PAPER_A5PAPER: + case BufferParams::PAPER_A5PAPER: LFile += ",a5paper"; break; - case PAPER_B5PAPER: + case BufferParams::PAPER_B5PAPER: LFile += ",b5paper"; break; } } if (!params.topmargin.empty()) - LFile += ",tmargin=" + params.topmargin; + LFile += ",tmargin= " + params.topmargin; if (!params.bottommargin.empty()) - LFile += ",bmargin=" + params.bottommargin; + LFile += ",bmargin= " + params.bottommargin; if (!params.leftmargin.empty()) - LFile += ",lmargin=" + params.leftmargin; + LFile += ",lmargin= " + params.leftmargin; if (!params.rightmargin.empty()) - LFile += ",rmargin=" + params.rightmargin; + LFile += ",rmargin= " + params.rightmargin; if (!params.headheight.empty()) - LFile += ",headheight=" + params.headheight; + LFile += ",headheight= " + params.headheight; if (!params.headsep.empty()) - LFile += ",headsep=" + params.headsep; + LFile += ",headsep= " + params.headsep; if (!params.footskip.empty()) - LFile += ",footskip=" + params.footskip; + LFile += ",footskip= " + params.footskip; LFile += "}\n"; texrow.newline(); } @@ -1858,7 +1849,7 @@ void Buffer::makeLaTeXFile(string const & filename, LFile += "\\usepackage{amsmath}\n"; } - if (tokenPos(tclass.opt_pagestyle(), '|',params.pagestyle) >= 0) { + if (tokenPos(tclass.opt_pagestyle(), '|', params.pagestyle) >= 0) { if (params.pagestyle == "fancy") { LFile += "\\usepackage{fancyhdr}\n"; texrow.newline(); @@ -2027,7 +2018,7 @@ void Buffer::makeLaTeXFile(string const & filename, // flag this with ftcount ftcount = -1; if (layout.isEnvironment() - || par->pextra_type != PEXTRA_NONE) { + || par->pextra_type != LyXParagraph::PEXTRA_NONE) { par = par->TeXEnvironment(LFile, texrow, ftnote, ft_texrow, ftcount); } else { @@ -2096,31 +2087,31 @@ void Buffer::makeLaTeXFile(string const & filename, } -bool Buffer::isLatex() +bool Buffer::isLatex() const { return textclasslist.TextClass(params.textclass).outputType() == LATEX; } -bool Buffer::isLinuxDoc() +bool Buffer::isLinuxDoc() const { return textclasslist.TextClass(params.textclass).outputType() == LINUXDOC; } -bool Buffer::isLiterate() +bool Buffer::isLiterate() const { return textclasslist.TextClass(params.textclass).outputType() == LITERATE; } -bool Buffer::isDocBook() +bool Buffer::isDocBook() const { return textclasslist.TextClass(params.textclass).outputType() == DOCBOOK; } -bool Buffer::isSGML() +bool Buffer::isSGML() const { return textclasslist.TextClass(params.textclass).outputType() == LINUXDOC || textclasslist.TextClass(params.textclass).outputType() == DOCBOOK; @@ -2129,17 +2120,18 @@ bool Buffer::isSGML() void Buffer::sgmlOpenTag(FILE * file, int depth, string const & latexname) const { - static char *space[] = {" "," "," "," "," "," "," ", - " "," "," "," "}; + static char * space[] = {" "," ", " ", " ", " ", " ", " ", + " ", " ", " ", " "}; fprintf(file, "%s<%s>\n", space[depth], latexname.c_str()); } -void Buffer::sgmlCloseTag(FILE * file, int depth, string const & latexname) const +void Buffer::sgmlCloseTag(FILE * file, int depth, + string const & latexname) const { - static char *space[] = {" "," "," "," "," "," "," ", - " "," "," "," "}; + static char * space[] = {" ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " "}; fprintf(file, "%s\n", space[depth], latexname.c_str()); } @@ -2149,7 +2141,7 @@ void Buffer::makeLinuxDocFile(string const & filename, int column) { LyXParagraph * par = paragraph; - string top_element=textclasslist.LatexnameOfClass(params.textclass); + string top_element = textclasslist.LatexnameOfClass(params.textclass); string environment_stack[10]; string item_name; @@ -2163,7 +2155,6 @@ void Buffer::makeLinuxDocFile(string const & filename, int column) return; } - //ResetTexRow(); texrow.reset(); if (params.preamble.empty()) { @@ -2175,29 +2166,32 @@ void Buffer::makeLinuxDocFile(string const & filename, int column) } string userName(getUserName()); - fprintf(file, "\n", userName.c_str(), (char *)date()); if(params.options.empty()) - sgmlOpenTag(file,0,top_element); + sgmlOpenTag(file, 0, top_element); else { string top = top_element; top += " "; top += params.options; - sgmlOpenTag(file,0,top); + sgmlOpenTag(file, 0, top); } while (par) { - int desc_on=0; /* description mode*/ - LyXLayout const & style=textclasslist.Style(GetCurrentTextClass(), par->layout); + int desc_on = 0; /* description mode*/ + LyXLayout const & style = + textclasslist.Style(GetCurrentTextClass(), + par->layout); par->AutoDeleteInsets(); /* treat as a special case for compatibility with old code */ - if (par->GetChar(0) == LYX_META_INSET) { + if (par->GetChar(0) == LyXParagraph::META_INSET) { Inset *inset = par->GetInset(0); char lyx_code = inset->LyxCode(); - if (lyx_code ==Inset::TOC_CODE){ - string temp= "toc"; + if (lyx_code == Inset::TOC_CODE){ + string temp = "toc"; sgmlOpenTag(file, depth, temp); par = par->next; @@ -2208,7 +2202,7 @@ void Buffer::makeLinuxDocFile(string const & filename, int column) /* environment tag closing */ for( ;depth > par->depth; depth--) { - sgmlCloseTag(file,depth,environment_stack[depth]); + sgmlCloseTag(file, depth, environment_stack[depth]); environment_stack[depth].clear(); } @@ -2217,27 +2211,27 @@ void Buffer::makeLinuxDocFile(string const & filename, int column) case LATEX_PARAGRAPH: if(depth == par->depth && !environment_stack[depth].empty()) { - sgmlCloseTag(file,depth,environment_stack[depth]); + sgmlCloseTag(file, depth, environment_stack[depth]); environment_stack[depth].clear(); if(depth) depth--; else - fprintf(file,"

"); + fprintf(file, "

"); } - sgmlOpenTag(file,depth,style.latexname()); + sgmlOpenTag(file, depth, style.latexname()); break; case LATEX_COMMAND: - if (depth!=0) + if (depth!= 0) LinuxDocError(par, 0, _("Error : Wrong depth for LatexType Command.\n")); if (!environment_stack[depth].empty()){ - sgmlCloseTag(file,depth,environment_stack[depth]); + sgmlCloseTag(file, depth, environment_stack[depth]); fprintf(file, "

"); } environment_stack[depth].clear(); - sgmlOpenTag(file,depth, style.latexname()); + sgmlOpenTag(file, depth, style.latexname()); break; case LATEX_ENVIRONMENT: @@ -2246,7 +2240,8 @@ void Buffer::makeLinuxDocFile(string const & filename, int column) && environment_stack[depth] != style.latexname() && !environment_stack[depth].empty()) { - sgmlCloseTag(file,depth,environment_stack[depth]); + sgmlCloseTag(file, depth, + environment_stack[depth]); environment_stack[depth].clear(); } if (depth < par->depth) { @@ -2254,23 +2249,23 @@ void Buffer::makeLinuxDocFile(string const & filename, int column) environment_stack[depth].clear(); } if (environment_stack[depth] != style.latexname()) { - if(depth==0) { - string temp="p"; - sgmlOpenTag(file,depth,temp); + if(depth == 0) { + string temp = "p"; + sgmlOpenTag(file, depth, temp); } environment_stack[depth] = style.latexname(); - sgmlOpenTag(file,depth,environment_stack[depth]); + sgmlOpenTag(file, depth, environment_stack[depth]); } if(style.latextype == LATEX_ENVIRONMENT) break; - desc_on =(style.labeltype == LABEL_MANUAL); + desc_on = (style.labeltype == LABEL_MANUAL); if(desc_on) - item_name="tag"; + item_name = "tag"; else - item_name="item"; + item_name = "item"; - sgmlOpenTag(file,depth+1,item_name); + sgmlOpenTag(file, depth+1, item_name); break; default: sgmlOpenTag(file, depth, style.latexname()); @@ -2281,11 +2276,11 @@ void Buffer::makeLinuxDocFile(string const & filename, int column) SimpleLinuxDocOnePar(file, par, desc_on, depth); par = par->next; - linuxDocHandleFootnote(file,par,depth); + linuxDocHandleFootnote(file, par, depth); } while(par && par->IsDummy()); - fprintf(file,"\n"); + fprintf(file, "\n"); /* write closing SGML tags */ switch(style.latextype) { case LATEX_COMMAND: @@ -2296,68 +2291,68 @@ void Buffer::makeLinuxDocFile(string const & filename, int column) sgmlCloseTag(file, depth, style.latexname()); break; } - - } - /* Close open tags */ for(;depth>0;depth--) - sgmlCloseTag(file,depth,environment_stack[depth]); + sgmlCloseTag(file, depth, environment_stack[depth]); if(!environment_stack[depth].empty()) - sgmlCloseTag(file,depth,environment_stack[depth]); + sgmlCloseTag(file, depth, environment_stack[depth]); fprintf(file, "\n\n"); - sgmlCloseTag(file,0,top_element); + sgmlCloseTag(file, 0, top_element); if (file.close()) { WriteFSAlert(_("Error! Could not close file properly:"), filename); - } + } } -void Buffer::linuxDocHandleFootnote(FILE *file,LyXParagraph* &par, int const depth) +void Buffer::linuxDocHandleFootnote(FILE * file, LyXParagraph * & par, + int const depth) { - string tag="footnote"; + string tag = "footnote"; while (par && par->footnoteflag != LyXParagraph::NO_FOOTNOTE) { - sgmlOpenTag(file,depth+1,tag); - SimpleLinuxDocOnePar(file, par, 0,depth+1); - sgmlCloseTag(file,depth+1,tag); + sgmlOpenTag(file, depth+1, tag); + SimpleLinuxDocOnePar(file, par, 0, depth+1); + sgmlCloseTag(file, depth+1, tag); par = par->next; } } -void Buffer::DocBookHandleCaption(FILE *file, string &inner_tag, +void Buffer::DocBookHandleCaption(FILE * file, string & inner_tag, int const depth, int desc_on, - LyXParagraph* &par) + LyXParagraph * & par) { - LyXParagraph *tpar = par; + LyXParagraph * tpar = par; string tmp_par, extra_par; while (tpar && (tpar->footnoteflag != LyXParagraph::NO_FOOTNOTE) && - (tpar->layout != textclasslist.NumberOfLayout(params.textclass,"Caption").second)) + (tpar->layout != textclasslist.NumberOfLayout(params.textclass, "Caption").second)) tpar = tpar->next; if (tpar && - tpar->layout==textclasslist.NumberOfLayout(params.textclass,"Caption").second) { - sgmlOpenTag(file,depth+1,inner_tag); - SimpleDocBookOnePar(tmp_par,extra_par,tpar,desc_on,depth+2); + tpar->layout == textclasslist.NumberOfLayout(params.textclass, + "Caption").second) { + sgmlOpenTag(file, depth+1, inner_tag); + SimpleDocBookOnePar(tmp_par, extra_par, tpar, desc_on, depth+2); tmp_par = strip(tmp_par); tmp_par = frontStrip(tmp_par); - fprintf(file,"%s",tmp_par.c_str()); - sgmlCloseTag(file,depth+1,inner_tag); + fprintf(file, "%s", tmp_par.c_str()); + sgmlCloseTag(file, depth+1, inner_tag); if(!extra_par.empty()) - fprintf(file,"%s",extra_par.c_str()); + fprintf(file, "%s", extra_par.c_str()); } } -void Buffer::DocBookHandleFootnote(FILE *file,LyXParagraph* &par, int const depth) +void Buffer::DocBookHandleFootnote(FILE * file, LyXParagraph * & par, + int const depth) { - string tag,inner_tag; - string tmp_par,extra_par; + string tag, inner_tag; + string tmp_par, extra_par; bool inner_span = false; - int desc_on=4; + int desc_on = 4; // This is not how I like to see enums. They should not be anonymous // and variables of its type should not be declared right after the @@ -2368,118 +2363,118 @@ void Buffer::DocBookHandleFootnote(FILE *file,LyXParagraph* &par, int const dept MARGIN_LIKE, FIG_LIKE, TAB_LIKE - } last=NO_ONE, present=FOOTNOTE_LIKE; + } last = NO_ONE, present = FOOTNOTE_LIKE; while (par && par->footnoteflag != LyXParagraph::NO_FOOTNOTE) { - if(last==present) { + if(last == present) { if(inner_span) { if(!tmp_par.empty()) { - fprintf(file,"%s",tmp_par.c_str()); + fprintf(file, "%s", tmp_par.c_str()); tmp_par.clear(); - sgmlCloseTag(file,depth+1,inner_tag); - sgmlOpenTag(file,depth+1,inner_tag); + sgmlCloseTag(file, depth+1, inner_tag); + sgmlOpenTag(file, depth+1, inner_tag); } } else - fprintf(file,"\n"); + fprintf(file, "\n"); } else { - fprintf(file,"%s",tmp_par.c_str()); - if(!inner_tag.empty()) sgmlCloseTag(file,depth+1,inner_tag); - if(!extra_par.empty()) fprintf(file,"%s",extra_par.c_str()); - if(!tag.empty()) sgmlCloseTag(file,depth,tag); + fprintf(file, "%s", tmp_par.c_str()); + if(!inner_tag.empty()) sgmlCloseTag(file, depth+1, inner_tag); + if(!extra_par.empty()) fprintf(file, "%s", extra_par.c_str()); + if(!tag.empty()) sgmlCloseTag(file, depth, tag); extra_par.clear(); switch (par->footnotekind) { case LyXParagraph::FOOTNOTE: case LyXParagraph::ALGORITHM: - tag="footnote"; - inner_tag="para"; - present=FOOTNOTE_LIKE; - inner_span=true; + tag = "footnote"; + inner_tag = "para"; + present = FOOTNOTE_LIKE; + inner_span = true; break; case LyXParagraph::MARGIN: - tag="sidebar"; - inner_tag="para"; - present=MARGIN_LIKE; - inner_span=true; + tag = "sidebar"; + inner_tag = "para"; + present = MARGIN_LIKE; + inner_span = true; break; case LyXParagraph::FIG: case LyXParagraph::WIDE_FIG: - tag="figure"; - inner_tag="title"; - present=FIG_LIKE; - inner_span=false; + tag = "figure"; + inner_tag = "title"; + present = FIG_LIKE; + inner_span = false; break; case LyXParagraph::TAB: case LyXParagraph::WIDE_TAB: - tag="table"; - inner_tag="title"; - present=TAB_LIKE; - inner_span=false; + tag = "table"; + inner_tag = "title"; + present = TAB_LIKE; + inner_span = false; break; } - sgmlOpenTag(file,depth,tag); + sgmlOpenTag(file, depth, tag); if ((present == TAB_LIKE) || (present == FIG_LIKE)) { DocBookHandleCaption(file, inner_tag, depth, desc_on, par); inner_tag.clear(); } else { - sgmlOpenTag(file,depth+1,inner_tag); + sgmlOpenTag(file, depth+1, inner_tag); } } // ignore all caption here, we processed them above!!! if (par->layout != textclasslist.NumberOfLayout(params.textclass, "Caption").second) { - SimpleDocBookOnePar(tmp_par,extra_par,par, - desc_on,depth+2); + SimpleDocBookOnePar(tmp_par, extra_par, par, + desc_on, depth+2); } tmp_par = frontStrip(strip(tmp_par)); - last=present; + last = present; par = par->next; } - fprintf(file,"%s",tmp_par.c_str()); - if(!inner_tag.empty()) sgmlCloseTag(file,depth+1,inner_tag); - if(!extra_par.empty()) fprintf(file,"%s",extra_par.c_str()); - if(!tag.empty()) sgmlCloseTag(file,depth,tag); + fprintf(file, "%s", tmp_par.c_str()); + if(!inner_tag.empty()) sgmlCloseTag(file, depth+1, inner_tag); + if(!extra_par.empty()) fprintf(file, "%s", extra_par.c_str()); + if(!tag.empty()) sgmlCloseTag(file, depth, tag); } /* push a tag in a style stack */ -void Buffer::push_tag(FILE *file, char const *tag, - int& pos, char stack[5][3]) +void Buffer::push_tag(FILE * file, char const * tag, + int & pos, char stack[5][3]) { int j; /* pop all previous tags */ - for (j=pos; j>=0; j--) + for (j = pos; j >= 0; j--) fprintf(file, "", stack[j]); /* add new tag */ sprintf(stack[++pos], "%s", tag); /* push all tags */ - for (j=0; j<=pos; j++) + for (j= 0; j<= pos; j++) fprintf(file, "<%s>", stack[j]); } // pop a tag from a style stack -void Buffer::pop_tag(FILE *file, char const * tag, - int& pos, char stack[5][3]) +void Buffer::pop_tag(FILE * file, char const * tag, + int & pos, char stack[5][3]) { int j; // pop all tags till specified one - for (j=pos; (j>=0) && (strcmp(stack[j], tag)); j--) + for (j= pos; (j>= 0) && (strcmp(stack[j], tag)); j--) fprintf(file, "", stack[j]); // closes the tag fprintf(file, "", tag); // push all tags, but the specified one - for (j=j+1; j<=pos; j++) { + for (j= j+1; j<= pos; j++) { fprintf(file, "<%s>", stack[j]); strcpy(stack[j-1], stack[j]); } @@ -2492,7 +2487,8 @@ void Buffer::pop_tag(FILE *file, char const * tag, // checks, if newcol chars should be put into this line // writes newline, if necessary. static -void linux_doc_line_break(FILE *file, unsigned int &colcount, const unsigned int newcol) +void linux_doc_line_break(FILE * file, unsigned int & colcount, + const unsigned int newcol) { colcount += newcol; if (colcount > lyxrc->ascii_linelen) { @@ -2502,18 +2498,16 @@ void linux_doc_line_break(FILE *file, unsigned int &colcount, const unsigned int } -void Buffer::SimpleLinuxDocOnePar(FILE *file, LyXParagraph *par, int desc_on, int const depth) +void Buffer::SimpleLinuxDocOnePar(FILE * file, LyXParagraph * par, + int desc_on, int const depth) { - LyXFont font1,font2; + LyXFont font1, font2; char c; Inset * inset; -#ifdef NEW_TEXT LyXParagraph::size_type main_body; int j; -#else - int main_body, j; -#endif - LyXLayout const & style = textclasslist.Style(params.textclass, par->GetLayout()); + LyXLayout const & style = textclasslist.Style(params.textclass, + par->GetLayout()); char family_type = 0; // family font flag bool is_bold = false; // series font flag @@ -2537,12 +2531,8 @@ void Buffer::SimpleLinuxDocOnePar(FILE *file, LyXParagraph *par, int desc_on, in /* parsing main loop */ -#ifdef NEW_TEXT for (LyXParagraph::size_type i = 0; i < par->size(); ++i) { -#else - for (int i = 0; i < par->last; i++) { -#endif /* handle quote tag */ if (i == main_body && !par->IsDummy()) { @@ -2557,31 +2547,31 @@ void Buffer::SimpleLinuxDocOnePar(FILE *file, LyXParagraph *par, int desc_on, in case 0: if (font2.family() == LyXFont::TYPEWRITER_FAMILY) { push_tag(file, "tt", stack_num, stack); - family_type=1; + family_type= 1; } else if (font2.family() == LyXFont::SANS_FAMILY) { push_tag(file, "sf", stack_num, stack); - family_type=2; + family_type= 2; } break; case 1: pop_tag(file, "tt", stack_num, stack); if (font2.family() == LyXFont::SANS_FAMILY) { push_tag(file, "sf", stack_num, stack); - family_type=2; + family_type= 2; } else { - family_type=0; + family_type= 0; } break; case 2: pop_tag(file, "sf", stack_num, stack); if (font2.family() == LyXFont::TYPEWRITER_FAMILY) { push_tag(file, "tt", stack_num, stack); - family_type=1; + family_type= 1; } else { - family_type=0; + family_type= 0; } } } @@ -2604,31 +2594,31 @@ void Buffer::SimpleLinuxDocOnePar(FILE *file, LyXParagraph *par, int desc_on, in case 0: if (font2.shape() == LyXFont::ITALIC_SHAPE) { push_tag(file, "it", stack_num, stack); - shape_type=1; + shape_type= 1; } else if (font2.shape() == LyXFont::SLANTED_SHAPE) { push_tag(file, "sl", stack_num, stack); - shape_type=2; + shape_type= 2; } break; case 1: pop_tag(file, "it", stack_num, stack); if (font2.shape() == LyXFont::SLANTED_SHAPE) { push_tag(file, "sl", stack_num, stack); - shape_type=2; + shape_type= 2; } else { - shape_type=0; + shape_type= 0; } break; case 2: pop_tag(file, "sl", stack_num, stack); if (font2.shape() == LyXFont::ITALIC_SHAPE) { push_tag(file, "it", stack_num, stack); - shape_type=1; + shape_type= 1; } else { - shape_type=0; + shape_type= 0; } } } @@ -2646,15 +2636,15 @@ void Buffer::SimpleLinuxDocOnePar(FILE *file, LyXParagraph *par, int desc_on, in c = par->GetChar(i); if (font2.latex() == LyXFont::ON) { - // "TeX"-Mode on ==> SGML-Mode on. - if (c!='\0') + // "TeX"-Mode on == > SGML-Mode on. + if (c!= '\0') fprintf(file, "%c", c); // see LaTeX-Generation... char_line_count++; - } else if (c == LYX_META_INSET) { + } else if (c == LyXParagraph::META_INSET) { inset = par->GetInset(i); string tmp_out; inset->Linuxdoc(tmp_out); - fprintf(file,"%s",tmp_out.c_str()); + fprintf(file, "%s", tmp_out.c_str()); } else { string sgml_string; @@ -2683,15 +2673,10 @@ void Buffer::SimpleLinuxDocOnePar(FILE *file, LyXParagraph *par, int desc_on, in } /* needed if there is an optional argument but no contents */ -#ifdef NEW_TEXT if (main_body > 0 && main_body == par->size()) { font1 = style.font; } -#else - if (main_body > 0 && main_body == par->last) { - font1 = style.font; - } -#endif + /* pop all defined Styles */ for (j = stack_num; j >= 0; j--) { linux_doc_line_break(file, @@ -2722,7 +2707,7 @@ void Buffer::LinuxDocError(LyXParagraph * par, int pos, /* insert an error marker in text */ new_inset = new InsetError(message); - par->InsertChar(pos, LYX_META_INSET); + par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertInset(pos, new_inset); } @@ -2738,17 +2723,17 @@ void Buffer::makeDocBookFile(string const & filename, int column) { LyXParagraph * par = paragraph; - string top_element=textclasslist.LatexnameOfClass(params.textclass); + string top_element= textclasslist.LatexnameOfClass(params.textclass); string environment_stack[MAX_NEST_LEVEL]; string environment_inner[MAX_NEST_LEVEL]; string command_stack[MAX_NEST_LEVEL]; - bool command_flag=false; - int command_depth=0,command_base=0,cmd_depth=0; + bool command_flag= false; + int command_depth= 0, command_base= 0, cmd_depth= 0; - string item_name,command_name; - string c_depth,c_params,tmps; + string item_name, command_name; + string c_depth, c_params, tmps; - int depth=0; /* paragraph depth */ + int depth= 0; /* paragraph depth */ FilePtr file(filename, FilePtr::write); tex_code_break_column = column; @@ -2768,7 +2753,7 @@ void Buffer::makeDocBookFile(string const & filename, int column) if (params.preamble.empty()) fprintf(file, ">\n\n"); else - fprintf(file, "\n [ %s \n]>\n\n",params.preamble.c_str() ); + fprintf(file, "\n [ %s \n]>\n\n", params.preamble.c_str() ); string userName(getUserName()); fprintf(file, @@ -2776,16 +2761,16 @@ void Buffer::makeDocBookFile(string const & filename, int column) fprintf(file, "by <%s> %s -->\n", userName.c_str(), (char *)date()); if(params.options.empty()) - sgmlOpenTag(file,0,top_element); + sgmlOpenTag(file, 0, top_element); else { string top = top_element; top += " "; top += params.options; - sgmlOpenTag(file,0,top); + sgmlOpenTag(file, 0, top); } while (par) { - int desc_on=0; /* description mode*/ + int desc_on= 0; /* description mode*/ LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), par->layout); par->AutoDeleteInsets(); @@ -2793,14 +2778,14 @@ void Buffer::makeDocBookFile(string const & filename, int column) /* environment tag closing */ for( ;depth > par->depth; depth--) { if(environment_inner[depth] != "!-- --") { - item_name="listitem"; - sgmlCloseTag(file,command_depth+depth, + item_name= "listitem"; + sgmlCloseTag(file, command_depth+depth, item_name); if( environment_inner[depth] == "varlistentry") - sgmlCloseTag(file,depth+command_depth, + sgmlCloseTag(file, depth+command_depth, environment_inner[depth]); } - sgmlCloseTag(file,depth+command_depth, + sgmlCloseTag(file, depth+command_depth, environment_stack[depth]); environment_stack[depth].clear(); environment_inner[depth].clear(); @@ -2810,15 +2795,15 @@ void Buffer::makeDocBookFile(string const & filename, int column) && environment_stack[depth] != style.latexname() && !environment_stack[depth].empty()) { if(environment_inner[depth] != "!-- --") { - item_name="listitem"; - sgmlCloseTag(file,command_depth+depth, + item_name= "listitem"; + sgmlCloseTag(file, command_depth+depth, item_name); if( environment_inner[depth] == "varlistentry") - sgmlCloseTag(file,depth+command_depth, + sgmlCloseTag(file, depth+command_depth, environment_inner[depth]); } - sgmlCloseTag(file,depth+command_depth, + sgmlCloseTag(file, depth+command_depth, environment_stack[depth]); environment_stack[depth].clear(); @@ -2834,7 +2819,7 @@ void Buffer::makeDocBookFile(string const & filename, int column) break; case LATEX_COMMAND: - if (depth!=0) + if (depth!= 0) LinuxDocError(par, 0, _("Error : Wrong depth for " "LatexType Command.\n")); @@ -2844,49 +2829,49 @@ void Buffer::makeDocBookFile(string const & filename, int column) tmps = style.latexparam(); c_params = split(tmps, c_depth,'|'); - cmd_depth=atoi(c_depth.c_str()); + cmd_depth= atoi(c_depth.c_str()); if(command_flag) { if(cmd_depth= command_base; j--) if(!command_stack[j].empty()) - sgmlCloseTag(file,j,command_stack[j]); - command_depth=command_base=cmd_depth; + sgmlCloseTag(file, j, command_stack[j]); + command_depth= command_base= cmd_depth; } - else if(cmd_depth<=command_depth) { + else if(cmd_depth<= command_depth) { for(int j= command_depth; j >= cmd_depth; j--) if(!command_stack[j].empty()) - sgmlCloseTag(file,j,command_stack[j]); - command_depth=cmd_depth; + sgmlCloseTag(file, j, command_stack[j]); + command_depth= cmd_depth; } else - command_depth=cmd_depth; + command_depth= cmd_depth; } else { command_depth = command_base = cmd_depth; command_flag = true; } - command_stack[command_depth]=command_name; + command_stack[command_depth]= command_name; // treat label as a special case for // more WYSIWYM handling. - if (par->GetChar(0) == LYX_META_INSET) { + if (par->GetChar(0) == LyXParagraph::META_INSET) { Inset *inset = par->GetInset(0); char lyx_code = inset->LyxCode(); - if (lyx_code ==Inset::LABEL_CODE){ - command_name+= " id=\""; - command_name+=((InsetCommand *) inset)->getContents(); - command_name+="\""; - desc_on=3; + if (lyx_code == Inset::LABEL_CODE){ + command_name+= " id= \""; + command_name+= ((InsetCommand *) inset)->getContents(); + command_name+= "\""; + desc_on= 3; } } - sgmlOpenTag(file,depth+command_depth, command_name); - item_name="title"; - sgmlOpenTag(file,depth+1+command_depth,item_name); + sgmlOpenTag(file, depth+command_depth, command_name); + item_name= "title"; + sgmlOpenTag(file, depth+1+command_depth, item_name); break; case LATEX_ENVIRONMENT: @@ -2903,7 +2888,7 @@ void Buffer::makeDocBookFile(string const & filename, int column) environment_stack[depth]); } else { if(environment_inner[depth] != "!-- --") { - item_name="listitem"; + item_name= "listitem"; sgmlCloseTag(file, command_depth + depth, item_name); @@ -2921,24 +2906,24 @@ void Buffer::makeDocBookFile(string const & filename, int column) break; } - desc_on =(style.labeltype == LABEL_MANUAL); + desc_on = (style.labeltype == LABEL_MANUAL); if(desc_on) - environment_inner[depth]="varlistentry"; + environment_inner[depth]= "varlistentry"; else - environment_inner[depth]="listitem"; + environment_inner[depth]= "listitem"; - sgmlOpenTag(file,depth+1+command_depth, + sgmlOpenTag(file, depth+1+command_depth, environment_inner[depth]); if(desc_on) { - item_name="term"; - sgmlOpenTag(file,depth+1+command_depth, + item_name= "term"; + sgmlOpenTag(file, depth+1+command_depth, item_name); } else { - item_name="para"; - sgmlOpenTag(file,depth+1+command_depth, + item_name= "para"; + sgmlOpenTag(file, depth+1+command_depth, item_name); } break; @@ -2949,14 +2934,14 @@ void Buffer::makeDocBookFile(string const & filename, int column) } do { - string tmp_par,extra_par; + string tmp_par, extra_par; - SimpleDocBookOnePar(tmp_par,extra_par, par, desc_on, + SimpleDocBookOnePar(tmp_par, extra_par, par, desc_on, depth+1+command_depth); - fprintf(file,"%s",tmp_par.c_str()); + fprintf(file, "%s", tmp_par.c_str()); par = par->next; - DocBookHandleFootnote(file,par, depth+1+command_depth); + DocBookHandleFootnote(file, par, depth+1+command_depth); } while(par && par->IsDummy()); @@ -2973,9 +2958,9 @@ void Buffer::makeDocBookFile(string const & filename, int column) style.latexparam()); break; case LATEX_ITEM_ENVIRONMENT: - if(desc_on==1) break; - end_tag="para"; - sgmlCloseTag(file,depth+1+command_depth,end_tag); + if(desc_on == 1) break; + end_tag= "para"; + sgmlCloseTag(file, depth+1+command_depth, end_tag); break; case LATEX_PARAGRAPH: if(style.latexname() != "dummy") @@ -2983,35 +2968,35 @@ void Buffer::makeDocBookFile(string const & filename, int column) style.latexname()); break; default: - sgmlCloseTag(file,depth+command_depth, + sgmlCloseTag(file, depth+command_depth, style.latexname()); break; } } // Close open tags - for(;depth>=0;depth--) { + for(;depth>= 0;depth--) { if(!environment_stack[depth].empty()) { if(environment_inner[depth] != "!-- --") { - item_name="listitem"; - sgmlCloseTag(file,command_depth+depth, + item_name= "listitem"; + sgmlCloseTag(file, command_depth+depth, item_name); if( environment_inner[depth] == "varlistentry") - sgmlCloseTag(file,depth+command_depth, + sgmlCloseTag(file, depth+command_depth, environment_inner[depth]); } - sgmlCloseTag(file,depth+command_depth, + sgmlCloseTag(file, depth+command_depth, environment_stack[depth]); } } - for(int j=command_depth;j>=command_base;j--) + for(int j= command_depth;j>= command_base;j--) if(!command_stack[j].empty()) - sgmlCloseTag(file,j,command_stack[j]); + sgmlCloseTag(file, j, command_stack[j]); fprintf(file, "\n\n"); - sgmlCloseTag(file,0,top_element); + sgmlCloseTag(file, 0, top_element); if (file.close()) { WriteFSAlert(_("Error! Could not close file properly:"), @@ -3028,20 +3013,17 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra, par->SimpleDocBookOneTablePar(file, extra, desc_on, depth); return; } - LyXFont font1,font2; + LyXFont font1, font2; char c; Inset *inset; -#ifdef NEW_TEXT LyXParagraph::size_type main_body; int j; -#else - int main_body, j; -#endif - string emph="emphasis"; - bool emph_flag=false; - int char_line_count=0; + string emph= "emphasis"; + bool emph_flag= false; + int char_line_count= 0; - LyXLayout const & style = textclasslist.Style(params.textclass, par->GetLayout()); + LyXLayout const & style = textclasslist.Style(params.textclass, + par->GetLayout()); if (style.labeltype != LABEL_MANUAL) main_body = 0; @@ -3056,32 +3038,28 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra, char_line_count = depth; if(!style.free_spacing) - for (j=0;j< depth;j++) + for (j= 0;j< depth;j++) file += ' '; /* parsing main loop */ -#ifdef NEW_TEXT for (LyXParagraph::size_type i = 0; i < par->size(); ++i) { -#else - for (int i = 0; i < par->last; i++) { -#endif font2 = par->getFont(i); /* handle tag */ if (font1.emph() != font2.emph() && i) { if (font2.emph() == LyXFont::ON) { file += ""; - emph_flag=true; + emph_flag= true; }else { file += ""; - emph_flag=false; + emph_flag= false; } } c = par->GetChar(i); - if (c == LYX_META_INSET) { + if (c == LyXParagraph::META_INSET) { inset = par->GetInset(i); string tmp_out; inset->DocBook(tmp_out); @@ -3089,15 +3067,15 @@ void Buffer::SimpleDocBookOnePar(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 - // desc_on==3 + // desc_on == 3 // 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 + // desc_on == 4 // - if(desc_on!=3 || i!=0) { - if(tmp_out[0]=='@') { - if(desc_on==4) + if(desc_on!= 3 || i!= 0) { + if(tmp_out[0] == '@') { + if(desc_on == 4) extra += frontStrip(tmp_out, '@'); else file += frontStrip(tmp_out, '@'); @@ -3106,8 +3084,8 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra, file += tmp_out; } } else if (font2.latex() == LyXFont::ON) { - // "TeX"-Mode on ==> SGML-Mode on. - if (c!='\0') + // "TeX"-Mode on == > SGML-Mode on. + if (c!= '\0') file += c; char_line_count++; } @@ -3136,15 +3114,9 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra, } /* needed if there is an optional argument but no contents */ -#ifdef NEW_TEXT if (main_body > 0 && main_body == par->size()) { font1 = style.font; } -#else - if (main_body > 0 && main_body == par->last) { - font1 = style.font; - } -#endif if (emph_flag) { file += ""; } @@ -3454,8 +3426,8 @@ void Buffer::insertErrors(TeXErrors & terr) LyXCursor cursor = text->cursor; // This is drastic, but it's the only fix, I could find. (Asger) - AllFloats(1,0); - AllFloats(1,1); + AllFloats(1, 0); + AllFloats(1, 1); for (TeXErrors::Errors::const_iterator cit = terr.begin(); cit != terr.end(); @@ -3519,11 +3491,7 @@ void Buffer::RoffAsciiTable(FILE * file, LyXParagraph * par) font1 = LyXFont(LyXFont::ALL_INHERIT), font2; Inset * inset; -#ifdef NEW_TEXT LyXParagraph::size_type i; -#else - int i; -#endif int j, cell = 0; @@ -3532,22 +3500,18 @@ void Buffer::RoffAsciiTable(FILE * file, LyXParagraph * par) FILE * fp, * fp2; - string fname1 = TmpFileName(string(),"RAT1"); - string fname2 = TmpFileName(string(),"RAT2"); - if (!(fp=fopen(fname1.c_str(),"w"))) { + string fname1 = TmpFileName(string(), "RAT1"); + string fname2 = TmpFileName(string(), "RAT2"); + if (!(fp= fopen(fname1.c_str(), "w"))) { WriteAlert(_("LYX_ERROR:"), _("Cannot open temporary file:"), fname1); return; } par->table->RoffEndOfCell(fp, -1); -#ifdef NEW_TEXT for (i = 0; i < par->size(); ++i) { -#else - for (i = 0; i < par->last; ++i) { -#endif c = par->GetChar(i); if (par->table->IsContRow(cell)) { - if (c == LYX_META_NEWLINE) + if (c == LyXParagraph::META_NEWLINE) cell++; continue; } @@ -3557,9 +3521,9 @@ void Buffer::RoffAsciiTable(FILE * file, LyXParagraph * par) continue; } switch (c) { - case LYX_META_INSET: + case LyXParagraph::META_INSET: if ((inset = par->GetInset(i))) { - if (!(fp2=fopen(fname2.c_str(),"w+"))) { + if (!(fp2= fopen(fname2.c_str(), "w+"))) { WriteAlert(_("LYX_ERROR:"), _("Cannot open temporary file:"), fname2); fclose(fp); @@ -3571,23 +3535,23 @@ void Buffer::RoffAsciiTable(FILE * file, LyXParagraph * par) c = fgetc(fp2); while(!feof(fp2)) { if (c == '\\') - fprintf(fp,"\\\\"); + fprintf(fp, "\\\\"); else - fputc(c,fp); + fputc(c, fp); c = fgetc(fp2); } fclose(fp2); } break; - case LYX_META_NEWLINE: - if (par->table->CellHasContRow(cell)>=0) - par->RoffContTableRows(fp, i+1,cell); + case LyXParagraph::META_NEWLINE: + if (par->table->CellHasContRow(cell)>= 0) + par->RoffContTableRows(fp, i+1, cell); par->table->RoffEndOfCell(fp, cell); cell++; break; - case LYX_META_HFILL: + case LyXParagraph::META_HFILL: break; - case LYX_META_PROTECTED_SEPARATOR: + case LyXParagraph::META_PROTECTED_SEPARATOR: break; case '\\': fprintf(fp, "\\\\"); @@ -3610,7 +3574,7 @@ void Buffer::RoffAsciiTable(FILE * file, LyXParagraph * par) if (!(lyxerr.debugging(Debug::ROFF))) { remove(fname1.c_str()); } - if (!(fp=fopen(fname2.c_str(),"r"))) { + if (!(fp= fopen(fname2.c_str(), "r"))) { WriteFSAlert(_("Error! Can't open temporary file:"), fname2); return; } @@ -3624,13 +3588,13 @@ void Buffer::RoffAsciiTable(FILE * file, LyXParagraph * par) while(!feof(fp) && (c == '\n')) c = fgetc(fp); while(!feof(fp)) { - for(j=0; jdepth; j++) + for(j= 0; jdepth; j++) fprintf(file, " "); while(!feof(fp) && (c != '\n')) { - fputc(c,file); + fputc(c, file); c = fgetc(fp); } - fputc('\n',file); + fputc('\n', file); // overread trailing blank lines while(!feof(fp) && (c == '\n')) c = fgetc(fp); @@ -3688,7 +3652,7 @@ void Buffer::update(signed char f) users->updateScrollbar(); } - if (f==1 || f==-1) { + if (f == 1 || f == -1) { if (isLyxClean()) { markDirty(); users->owner()->getMiniBuffer()->setTimer(4); @@ -3702,7 +3666,7 @@ void Buffer::update(signed char f) void Buffer::validate(LaTeXFeatures & features) { LyXParagraph * par = paragraph; - LyXTextClass const & tclass = + LyXTextClass const & tclass = textclasslist.TextClass(params.textclass); // AMS Style is at document level @@ -3743,7 +3707,7 @@ void Buffer::validate(LaTeXFeatures & features) if (font == 1) { features.amssymb = true; } - else if ((font >= 2 && font <=5)) { + else if ((font >= 2 && font <= 5)) { features.pifont = true; } } @@ -3757,57 +3721,58 @@ void Buffer::validate(LaTeXFeatures & features) void Buffer::setPaperStuff() { - params.papersize = PAPER_DEFAULT; + params.papersize = BufferParams::PAPER_DEFAULT; char c1 = params.paperpackage; - if (c1 == PACKAGE_NONE) { + if (c1 == BufferParams::PACKAGE_NONE) { char c2 = params.papersize2; - if (c2 == VM_PAPER_USLETTER) - params.papersize = PAPER_USLETTER; - else if (c2 == VM_PAPER_USLEGAL) - params.papersize = PAPER_LEGALPAPER; - else if (c2 == VM_PAPER_USEXECUTIVE) - params.papersize = PAPER_EXECUTIVEPAPER; - else if (c2 == VM_PAPER_A3) - params.papersize = PAPER_A3PAPER; - else if (c2 == VM_PAPER_A4) - params.papersize = PAPER_A4PAPER; - else if (c2 == VM_PAPER_A5) - params.papersize = PAPER_A5PAPER; - else if ((c2 == VM_PAPER_B3) || (c2 == VM_PAPER_B4) || - (c2 == VM_PAPER_B5)) - params.papersize = PAPER_B5PAPER; - } else if ((c1 == PACKAGE_A4) || (c1 == PACKAGE_A4WIDE) || - (c1 == PACKAGE_WIDEMARGINSA4)) - params.papersize = PAPER_A4PAPER; + if (c2 == BufferParams::VM_PAPER_USLETTER) + params.papersize = BufferParams::PAPER_USLETTER; + else if (c2 == BufferParams::VM_PAPER_USLEGAL) + params.papersize = BufferParams::PAPER_LEGALPAPER; + else if (c2 == BufferParams::VM_PAPER_USEXECUTIVE) + params.papersize = BufferParams::PAPER_EXECUTIVEPAPER; + else if (c2 == BufferParams::VM_PAPER_A3) + params.papersize = BufferParams::PAPER_A3PAPER; + else if (c2 == BufferParams::VM_PAPER_A4) + params.papersize = BufferParams::PAPER_A4PAPER; + else if (c2 == BufferParams::VM_PAPER_A5) + params.papersize = BufferParams::PAPER_A5PAPER; + else if ((c2 == BufferParams::VM_PAPER_B3) || (c2 == BufferParams::VM_PAPER_B4) || + (c2 == BufferParams::VM_PAPER_B5)) + params.papersize = BufferParams::PAPER_B5PAPER; + } else if ((c1 == BufferParams::PACKAGE_A4) || (c1 == BufferParams::PACKAGE_A4WIDE) || + (c1 == BufferParams::PACKAGE_WIDEMARGINSA4)) + params.papersize = BufferParams::PAPER_A4PAPER; } +#if 0 void Buffer::setOldPaperStuff() { char c = params.papersize = params.papersize2; - params.papersize2 = VM_PAPER_DEFAULT; - params.paperpackage = PACKAGE_NONE; + params.papersize2 = BufferParams::VM_PAPER_DEFAULT; + params.paperpackage = BufferParams::PACKAGE_NONE; if (c == OLD_PAPER_A4PAPER) - params.papersize2 = VM_PAPER_A4; + params.papersize2 = BufferParams::VM_PAPER_A4; else if (c == OLD_PAPER_A4) - params.paperpackage = PACKAGE_A4; + params.paperpackage = BufferParams::PACKAGE_A4; else if (c == OLD_PAPER_A4WIDE) - params.paperpackage = PACKAGE_A4WIDE; + params.paperpackage = BufferParams::PACKAGE_A4WIDE; else if (c == OLD_PAPER_WIDEMARGINSA4) - params.paperpackage = PACKAGE_WIDEMARGINSA4; + params.paperpackage = BufferParams::PACKAGE_WIDEMARGINSA4; else if (c == OLD_PAPER_USLETTER) - params.papersize2 = VM_PAPER_USLETTER; + params.papersize2 = BufferParams::VM_PAPER_USLETTER; else if (c == OLD_PAPER_A5PAPER) - params.papersize2 = VM_PAPER_A5; + params.papersize2 = BufferParams::VM_PAPER_A5; else if (c == OLD_PAPER_B5PAPER) - params.papersize2 = VM_PAPER_B5; + params.papersize2 = BufferParams::VM_PAPER_B5; else if (c == OLD_PAPER_EXECUTIVEPAPER) - params.papersize2 = VM_PAPER_USEXECUTIVE; + params.papersize2 = BufferParams::VM_PAPER_USEXECUTIVE; else if (c == OLD_PAPER_LEGALPAPER) - params.papersize2 = VM_PAPER_USLEGAL; + params.papersize2 = BufferParams::VM_PAPER_USLEGAL; setPaperStuff(); } - +#endif void Buffer::insertInset(Inset * inset, string const & lout, bool no_table) @@ -3870,7 +3835,7 @@ void Buffer::open_new_inset(UpdatableInset * new_inset) insertInset(new_inset); text->CursorLeft(); update(1); - new_inset->Edit(0,0); + new_inset->Edit(0, 0); } @@ -3879,17 +3844,13 @@ string Buffer::getIncludeonlyList(char delim) { string lst; LyXParagraph * par = paragraph; -#ifdef NEW_TEXT LyXParagraph::size_type pos; -#else - int pos; -#endif Inset * inset; while (par){ pos = -1; while ((inset = par->ReturnNextInsetPointer(pos))){ - if (inset->LyxCode()==Inset::INCLUDE_CODE) { - InsetInclude * insetinc = + if (inset->LyxCode() == Inset::INCLUDE_CODE) { + InsetInclude * insetinc = static_cast(inset); if (insetinc->isInclude() && insetinc->isNoLoad()) { @@ -3919,11 +3880,7 @@ string Buffer::getReferenceList(char delim) } LyXParagraph *par = paragraph; -#ifdef NEW_TEXT LyXParagraph::size_type pos; -#else - int pos; -#endif Inset * inset; string lst; while (par){ @@ -3970,20 +3927,16 @@ string Buffer::getBibkeyList(char delim) par = paragraph; while (par) { Inset * inset; -#ifdef NEW_TEXT LyXParagraph::size_type pos = -1; -#else - int pos = -1; -#endif // Search for Bibtex or Include inset while ((inset = par->ReturnNextInsetPointer(pos))) { - if (inset-> LyxCode()==Inset::BIBTEX_CODE) { + if (inset-> LyxCode() == Inset::BIBTEX_CODE) { if (!bibkeys.empty()) bibkeys += delim; - bibkeys += ((InsetBibtex*)inset)->getKeys(); - } else if (inset-> LyxCode()==Inset::INCLUDE_CODE) { - string bk = ((InsetInclude*)inset)->getKeys(); + bibkeys += static_cast(inset)->getKeys(); + } else if (inset-> LyxCode() == Inset::INCLUDE_CODE) { + string bk = static_cast(inset)->getKeys(); if (!bk.empty()) { if (!bibkeys.empty()) bibkeys += delim; @@ -4010,17 +3963,13 @@ bool Buffer::gotoLabel(string const & label) { LyXParagraph * par = paragraph; -#ifdef NEW_TEXT LyXParagraph::size_type pos; -#else - int pos; -#endif Inset * inset; while (par) { pos = -1; while ((inset = par->ReturnNextInsetPointer(pos))){ for (int i = 0; i < inset->GetNumberOfLabels(); i++) { - if (label==inset->getLabel(i)) { + if (label == inset->getLabel(i)) { BeforeChange(); text->SetCursor(par, pos); text->sel_cursor = text->cursor; diff --git a/src/buffer.h b/src/buffer.h index 91f0d79153..932fb61731 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -1,6 +1,6 @@ // -*- C++ -*- /* This file is part of -* ====================================================== +* ====================================================== * * LyX, The Document Processor * Copyright (C) 1995 Matthias Ettrich @@ -8,10 +8,10 @@ * This file is Copyleft (C) 1996 * Lars Gullik Bjønnes * -*======================================================*/ +* ====================================================== */ // Change Log: -// =========== +// =========== // 23/03/98 Heinrich Bauer (heinrich.bauer@t-mobil.de) // Spots marked "changed Heinrich Bauer, 23/03/98" modified due to the // following bug: dvi file export did not work after printing (or previewing) @@ -60,7 +60,7 @@ public: /**@name Constructors and destructor */ //@{ /// - Buffer(string const & file, LyXRC * lyxrc = 0, bool b= false); + Buffer(string const & file, LyXRC * lyxrc = 0, bool b = false); /// ~Buffer(); @@ -98,7 +98,7 @@ public: Later this func will insert the BufferView into a real list, not just setting a pointer. */ - void addUser(BufferView *u) { users = u; } + void addUser(BufferView * u) { users = u; } /** Removes the BufferView from the users list. Since we only can have one at the moment, we just reset it. @@ -109,13 +109,14 @@ public: void update(signed char f); /// - void redraw(void){ + void redraw() { users->redraw(); users->fitCursor(); - users->updateScrollbar(); } + users->updateScrollbar(); + } /// Open and lock an updatable inset - void open_new_inset(UpdatableInset*); + void open_new_inset(UpdatableInset *); /// void loadAutoSaveFile(); @@ -123,12 +124,12 @@ public: /** Reads a file. Returns false if it fails. If par is given, the file is inserted. */ - bool readFile(LyXLex &, LyXParagraph *par = 0); + bool readFile(LyXLex &, LyXParagraph * par = 0); /** Reads a file without header. Returns false, if file is not completely read. If par is given, the file is inserted. */ - bool readLyXformat2(LyXLex &,LyXParagraph *par = 0); + bool readLyXformat2(LyXLex &, LyXParagraph * par = 0); /// Inserts a lyx file at cursor position. Returns false if it fails. bool insertLyXFile(string const & filename); @@ -253,21 +254,23 @@ public: } /// returns true if the buffer contains a LaTeX document - bool isLatex(); + bool isLatex() const; /// returns true if the buffer contains a LinuxDoc document - bool isLinuxDoc(); + bool isLinuxDoc() const; /// returns true if the buffer contains a DocBook document - bool isDocBook(); + bool isDocBook() const; /// returns true if the buffer contains either a LinuxDoc or DocBook document - bool isSGML(); + bool isSGML() const; /// returns true if the buffer contains a Wed document - bool isLiterate(); + bool isLiterate() const; /// void setPaperStuff(); +#if 0 /// void setOldPaperStuff(); +#endif /** Validate a buffer for LaTeX. This validates the buffer, and returns a struct for use by @@ -277,33 +280,33 @@ public: points to coresponding \labels). It should perhaps inset "error" insets to help the user correct obvious mistakes. */ - void validate(LaTeXFeatures&); //the correct parameters to be - //included later + void validate(LaTeXFeatures &); //the correct parameters to be + //included later /** Insert an inset into the buffer Insert inset into buffer, placing it in a layout of lout, if no_table make sure that it doesn't end up in a table. */ - void insertInset(Inset *, string const &lout=string(), + void insertInset(Inset *, string const & lout = string(), bool no_table = false); /// void setCursorFromRow (int); /// - string getIncludeonlyList(char delim=','); + string getIncludeonlyList(char delim = ','); /// - string getReferenceList(char delim='|'); + string getReferenceList(char delim = '|'); /// - string getBibkeyList(char delim='|'); + string getBibkeyList(char delim = '|'); /// - bool gotoLabel(const string&); + bool gotoLabel(string const &); /// removes all autodeletable insets bool removeAutoInsets(); /** This will clearly have to change later. Later we can have more than one user per buffer. */ - BufferView* getUser() const { return users; } + BufferView * getUser() const { return users; } //@} @@ -318,15 +321,15 @@ public: /** is a list of paragraphs. */ - LyXParagraph *paragraph; + LyXParagraph * paragraph; /** This holds the mapping between buffer paragraphs and screen rows. Should be moved to BufferView. (Asger) */ - LyXText *text; + LyXText * text; /// - UpdatableInset* the_locking_inset; + UpdatableInset * the_locking_inset; /// RCS object LyXVC lyxvc; @@ -362,32 +365,41 @@ private: void insertErrors(TeXErrors &); /// - void linuxDocHandleFootnote(FILE *file,LyXParagraph* &par, int const depth); + void linuxDocHandleFootnote(FILE * file, + LyXParagraph * & par, int const depth); /// - void DocBookHandleCaption(FILE *file, string &inner_tag, + void DocBookHandleCaption(FILE * file, string & inner_tag, int const depth, int desc_on, - LyXParagraph* &par); + LyXParagraph * &par); /// - void DocBookHandleFootnote(FILE *file,LyXParagraph* &par, int const depth); + void DocBookHandleFootnote(FILE * file, + LyXParagraph * & par, int const depth); /// - void sgmlOpenTag(FILE * file,int depth,string const & latexname) const; + void sgmlOpenTag(FILE * file, int depth, + string const & latexname) const; /// - void sgmlCloseTag(FILE * file,int depth,string const & latexname) const; + void sgmlCloseTag(FILE * file, int depth, + string const & latexname) const; /// - void LinuxDocError(LyXParagraph *par, int pos, char const *message); + void LinuxDocError(LyXParagraph * par, int pos, char const * message); /// - void SimpleLinuxDocOnePar(FILE *file, LyXParagraph *par, int desc_on, int const depth); + void SimpleLinuxDocOnePar(FILE * file, LyXParagraph * par, + int desc_on, int const depth); /// - void SimpleDocBookOnePar(string &file, string &extra, LyXParagraph *par, int & desc_on, int const depth); + void SimpleDocBookOnePar(string & file, string & extra, + LyXParagraph * par, int & desc_on, + int const depth); /// LinuxDoc. - void push_tag(FILE *file, char const *tag, int& pos, char stack[5][3]); + void push_tag(FILE * file, char const * tag, + int & pos, char stack[5][3]); /// LinuxDoc. - void pop_tag(FILE *file, char const * tag, int& pos, char stack[5][3]); + void pop_tag(FILE * file, char const * tag, + int & pos, char stack[5][3]); /// - void RoffAsciiTable(FILE *file, LyXParagraph *par); + void RoffAsciiTable(FILE * file, LyXParagraph * par); /// is save needed bool lyx_clean; @@ -395,11 +407,11 @@ private: /// is autosave needed bool bak_clean; - /// do we need to run LaTeX, changed 23/03/98, Heinrich Bauer - /// We have to distinguish between TeX-runs executed in the original - /// directory (in which the original LyX-file resides) and TeX-runs - /// executed in a temporary directory. The first situation is valid - /// for a dvi-export, the latter one for printing or previewing. + /** do we need to run LaTeX, changed 23/03/98, Heinrich Bauer + We have to distinguish between TeX-runs executed in the original + directory (in which the original LyX-file resides) and TeX-runs + executed in a temporary directory. The first situation is valid + for a dvi-export, the latter one for printing or previewing. */ bool dvi_clean_orgd; bool dvi_clean_tmpd; @@ -407,7 +419,7 @@ private: bool nw_clean; /// is regenerating .tex necessary - DEPCLEAN *dep_clean; + DEPCLEAN * dep_clean; /// buffer is r/o bool read_only; @@ -425,7 +437,7 @@ private: buffer->lyx_gui->bufferview->updateLayoutChoice. Just ask each of the buffers in the list of users to do a updateLayoutChoice. */ - BufferView *users; + BufferView * users; /// friend class BufferList; @@ -459,10 +471,9 @@ void Buffer::InsetWakeup() inline -void Buffer::setParentName(string const &name) +void Buffer::setParentName(string const & name) { params.parentname = name; } - #endif diff --git a/src/bufferlist.C b/src/bufferlist.C index e6c2c3fc34..317e9f175d 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -1,5 +1,5 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Word Processor * @@ -9,7 +9,7 @@ * This file is Copyright 1996-1999 * Lars Gullik Bjønnes * - * ====================================================== + * ====================================================== */ #ifdef __GNUG__ @@ -47,7 +47,7 @@ extern int RunLinuxDoc(int, string const &); BufferStorage::BufferStorage() { // Initialize the buffer array - for (int i=NUMBER_OF_BUFFERS-1; i >=0; i--) { + for (int i = NUMBER_OF_BUFFERS-1; i >= 0; i--) { buffer[i] = 0; } } @@ -56,7 +56,7 @@ BufferStorage::BufferStorage() #ifndef NEW_STORE bool BufferStorage::isEmpty() { - for (int i=NUMBER_OF_BUFFERS-1; i >=0; i--) { + for (int i = NUMBER_OF_BUFFERS-1; i >= 0; i--) { if (buffer[i]) return false; } return true; @@ -98,7 +98,7 @@ Buffer * BufferStorage::newBuffer(string const & s, container.push_back(tmpbuf); return tmpbuf; #else - int i=0; + int i = 0; while (i < NUMBER_OF_BUFFERS - 1 && buffer[i]) i++; buffer[i] = new Buffer(s, lyxrc, ronly); @@ -129,7 +129,7 @@ Buffer * BufferStorage_Iter::operator() () Buffer * BufferStorage_Iter::operator[] (int a) { - // a is >=1 + // a is >= 1 if (a <= 0) return 0; int i = 0; @@ -177,7 +177,7 @@ 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 @@ -191,14 +191,14 @@ bool BufferList::QwriteAll() while ((b = biter())) { if (!b->isLyxClean()) { switch(AskConfirmation(_("Changes in document:"), - MakeDisplayPath(b->filename,50), + MakeDisplayPath(b->filename, 50), _("Save document?"))) { case 1: // Yes MenuWrite(b); break; case 2: // No askMoreConfirmation = true; - unsaved += MakeDisplayPath(b->filename,50); + unsaved += MakeDisplayPath(b->filename, 50); unsaved += "\n"; break; case 3: // Cancel @@ -222,7 +222,7 @@ bool BufferList::QwriteAll() bool BufferList::write(Buffer * buf, bool makeBackup) { minibuffer->Set(_("Saving document"), - MakeDisplayPath(buf->filename),"..."); + MakeDisplayPath(buf->filename), "..."); // We don't need autosaves in the immediate future. (Asger) buf->resetAutosaveTimers(); @@ -258,14 +258,14 @@ bool BufferList::write(Buffer * buf, bool makeBackup) if (finfo.exist()) { mode_t fmode = finfo.getMode(); - struct utimbuf *times = + struct utimbuf *times = (struct utimbuf*)new char[sizeof(struct utimbuf)]; times->actime = finfo.getAccessTime(); times->modtime = finfo.getModificationTime(); long blksize = finfo.getBlockSize(); lyxerr.debug() << "BlockSize: " << blksize << endl; - FilePtr fin(buf->filename,FilePtr::read); - FilePtr fout(s,FilePtr::truncate); + FilePtr fin(buf->filename, FilePtr::read); + FilePtr fout(s, FilePtr::truncate); if (fin() && fout()) { char * cbuf = new char[blksize+1]; size_t c_read = 0; @@ -273,7 +273,7 @@ bool BufferList::write(Buffer * buf, bool makeBackup) do { c_read = fread(cbuf, 1, blksize, fin); if (c_read != 0) - c_write = + c_write = fwrite(cbuf, 1, c_read, fout); } while (c_read); fin.close(); @@ -291,7 +291,7 @@ bool BufferList::write(Buffer * buf, bool makeBackup) } } - if (buf->writeFile(buf->filename,false)) { + if (buf->writeFile(buf->filename, false)) { buf->markLyxClean(); minibuffer->Set(_("Document saved as"), @@ -365,7 +365,7 @@ bool BufferList::close(Buffer * buf) if (buf->paragraph && !buf->isLyxClean() && !quitting) { ProhibitInput(); switch(AskConfirmation(_("Changes in document:"), - MakeDisplayPath(buf->filename,50), + MakeDisplayPath(buf->filename, 50), _("Save document?"))){ case 1: // Yes if (write(buf)) { @@ -409,7 +409,7 @@ void BufferList::makePup(int pup) ++ant; } #endif - if (ant == 0) fl_addtopup(pup,_("No Documents Open!%t")); + if (ant == 0) fl_addtopup(pup, _("No Documents Open!%t")); } @@ -454,8 +454,8 @@ void BufferList::updateInset(Inset * inset, bool mark_dirty) } #else BufferStorage_Iter biter(bstore); - Buffer *b=0; - while ((b=biter())) { + Buffer *b = 0; + while ((b = biter())) { if (b->text && b->text->UpdateInset(inset)) { if (mark_dirty) b->markDirty(); @@ -482,8 +482,8 @@ int BufferList::unlockInset(UpdatableInset * inset) if (!inset) return 1; BufferStorage_Iter biter(bstore); - Buffer *b=0; - while ((b=biter())) { + Buffer *b = 0; + while ((b = biter())) { if (b->the_locking_inset == inset) { b->InsetUnlock(); return 0; @@ -512,13 +512,13 @@ void BufferList::updateIncludedTeXfiles(string const & mastertmpdir) } #else BufferStorage_Iter biter(bstore); - Buffer *b=0; - while ((b=biter())) { + Buffer *b = 0; + while ((b = biter())) { if (!b->isDepClean(mastertmpdir)) { string writefile = mastertmpdir; writefile += '/'; writefile += ChangeExtension(b->getFileName(), ".tex", true); - b->makeLaTeXFile(writefile,mastertmpdir,false,true); + b->makeLaTeXFile(writefile, mastertmpdir, false, true); b->markDepClean(mastertmpdir); } } @@ -532,7 +532,7 @@ void BufferList::emergencyWriteAll() for (BufferStorage::iterator it = bstore.begin(); it != bstore.end(); ++it) { if (!(*it)->isLyxClean()) { - bool madeit=false; + bool madeit = false; lyxerr <<_("lyx: Attempting to save" " document ") @@ -559,7 +559,7 @@ void BufferList::emergencyWriteAll() lyxerr << " " << i + 1 << ") " << s << endl; - if ((*it)->writeFile(s,true)) { + if ((*it)->writeFile(s, true)) { (*it)->markLyxClean(); lyxerr << _(" Save seems successful. " "Phew.") << endl; @@ -585,7 +585,7 @@ void BufferList::emergencyWriteAll() << b->filename << _(" as...") << endl; - for (int i=0; i<3 && !madeit; i++) { + for (int i = 0; i<3 && !madeit; i++) { string s; // We try to save three places: @@ -605,7 +605,7 @@ void BufferList::emergencyWriteAll() lyxerr << " " << i + 1 << ") " << s << endl; - if (b->writeFile(s,true)) { + if (b->writeFile(s, true)) { b->markLyxClean(); lyxerr << _(" Save seems successful. Phew.") << endl; madeit = true; @@ -642,7 +642,7 @@ Buffer* BufferList::readFile(string const & s, bool ronly) if (fileInfoE.getModificationTime() > fileInfo2.getModificationTime()) { if (AskQuestion(_("An emergency save of this document exists!"), - MakeDisplayPath(s,50), + MakeDisplayPath(s, 50), _("Try to load that instead?"))) { ts = e; // the file is not saved if we load the @@ -666,7 +666,7 @@ Buffer* BufferList::readFile(string const & s, bool ronly) if (fileInfoA.getModificationTime() > fileInfo2.getModificationTime()) { if (AskQuestion(_("Autosave file is newer."), - MakeDisplayPath(s,50), + MakeDisplayPath(s, 50), _("Load that one instead?"))) { ts = a; // the file is not saved if we load the @@ -744,7 +744,7 @@ Buffer * BufferList::newFile(string const & name, string tname) } if (!tname.empty() && IsLyXFilename(tname)){ bool templateok = false; - LyXLex lex(0,0); + LyXLex lex(0, 0); lex.setFile(tname); if (lex.IsOK()) { if (b->readFile(lex)) { @@ -752,20 +752,14 @@ Buffer * BufferList::newFile(string const & name, string tname) } } if (!templateok) { - WriteAlert(_("Error!"),_("Unable to open template"), + WriteAlert(_("Error!"), _("Unable to open template"), MakeDisplayPath(tname)); // no template, start with empty buffer b->paragraph = new LyXParagraph; -#ifdef NEW_TEXT - b->paragraph->text.reserve(500); -#endif } } else { // start with empty buffer b->paragraph = new LyXParagraph; -#ifdef NEW_TEXT - b->paragraph->text.reserve(500); -#endif } b->markDirty(); @@ -789,7 +783,7 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles) s = ChangeExtension (s, ".lyx", false); } else { // sgml2lyx failed WriteAlert(_("Error!"), - _("Could not convert file"),s); + _("Could not convert file"), s); return 0; } } else { @@ -803,7 +797,7 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles) // file already open? if (exists(s)) { if (AskQuestion(_("Document is already open:"), - MakeDisplayPath(s,50), + MakeDisplayPath(s, 50), _("Do you want to reload that document?"))) { // Reload is accomplished by closing and then loading if (!close(getBuffer(s))) { @@ -820,7 +814,7 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles) bool ro = false; switch (IsFileWriteable(s)) { case 0: - minibuffer->Set(_("File `")+MakeDisplayPath(s,50)+ + minibuffer->Set(_("File `")+MakeDisplayPath(s, 50)+ _("' is read-only.")); ro = true; // Fall through @@ -838,11 +832,11 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles) lyxerr << "Do you want to checkout?" << endl; } if (AskQuestion(_("Cannot open specified file:"), - MakeDisplayPath(s,50), + MakeDisplayPath(s, 50), _("Create new document with this name?"))) { // Find a free buffer - b = newFile(s,string()); + b = newFile(s, string()); } break; } diff --git a/src/bufferlist.h b/src/bufferlist.h index c3cd5d2783..e2c0109f32 100644 --- a/src/bufferlist.h +++ b/src/bufferlist.h @@ -1,6 +1,6 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich @@ -9,7 +9,7 @@ * This file is Copyright 1996 * Lars Gullik Bjønnes * - * ======================================================*/ + * ====================================================== */ #ifndef BUFFER_LIST_H #define BUFFER_LIST_H @@ -66,7 +66,7 @@ public: /// void release(Buffer * buf); /// - Buffer* newBuffer(string const & s, LyXRC *, bool =false); + Buffer* newBuffer(string const & s, LyXRC *, bool = false); private: enum { /** The max number of buffers there are possible to have @@ -92,7 +92,7 @@ class BufferStorage_Iter { public: /// BufferStorage_Iter(BufferStorage const & bs) - { cs =& bs; index = 0;} + { cs = & bs; index = 0;} /// next Buffer* operator() (); /// diff --git a/src/bufferparams.C b/src/bufferparams.C index ff656f2024..00ff5c3e68 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include #include @@ -25,7 +25,7 @@ BufferParams::BufferParams() { - paragraph_separation = LYX_PARSEP_INDENT; + paragraph_separation = PARSEP_INDENT; defskip = VSpace(VSpace::MEDSKIP); quotes_language = InsetQuotes::EnglishQ; quotes_times = InsetQuotes::DoubleQ; @@ -51,61 +51,11 @@ BufferParams::BufferParams() user_defined_bullets[iter] = temp_bullets[iter] = ITEMIZE_DEFAULTS[iter]; } - allowAccents=false; + allowAccents = false; } -void BufferParams::Copy(BufferParams const &p) -{ - paragraph_separation = p.paragraph_separation; - defskip = p.defskip; - quotes_language = p.quotes_language; - quotes_times = p.quotes_times; - fontsize = p.fontsize; - textclass = p.textclass; - papersize = p.papersize; - papersize2 = p.papersize2; - paperpackage = p.paperpackage; - orientation = p.orientation; - use_geometry = p.use_geometry; - paperwidth = p.paperwidth; - paperheight = p.paperheight; - leftmargin = p.leftmargin; - topmargin = p.topmargin; - rightmargin = p.rightmargin; - bottommargin = p.bottommargin; - headheight = p.headheight; - headsep = p.headsep; - footskip = p.footskip; - graphicsDriver = p.graphicsDriver; - fonts = p.fonts; - spacing = p.spacing; - secnumdepth = p.secnumdepth; - tocdepth = p.tocdepth; - language = p.language; - inputenc = p.inputenc; - preamble = p.preamble; - options = p.options; - float_placement = p.float_placement; - columns = p.columns; - sides = p.sides; - pagestyle = p.pagestyle; - - // WARNING destructor will deallocate paragraph!! - // this is not good and will cause an error somewhere else. - //paragraph = p.paragraph; - - for (int i = 0; i < 4; ++i) { - temp_bullets[i] = p.temp_bullets[i]; - user_defined_bullets[i] = p.user_defined_bullets[i]; - } - - allowAccents=p.allowAccents; - use_amsmath = p.use_amsmath; -} - - -void BufferParams::writeFile(FILE *file) +void BufferParams::writeFile(FILE * file) { // The top of the file is written by the buffer. // Prints out the buffer info into the .lyx file given by file @@ -155,8 +105,8 @@ void BufferParams::writeFile(FILE *file) fprintf(file, "\\papersize %s\n", string_papersize[papersize2]); fprintf(file, "\\paperpackage %s\n", string_paperpackages[paperpackage]); - fprintf(file, "\\use_geometry %d\n",use_geometry); - fprintf(file, "\\use_amsmath %d\n",use_amsmath); + fprintf(file, "\\use_geometry %d\n", use_geometry); + fprintf(file, "\\use_amsmath %d\n", use_amsmath); fprintf(file, "\\paperorientation %s\n", string_orientation[orientation]); if (!paperwidth.empty()) @@ -233,7 +183,7 @@ void BufferParams::useClassDefaults() { } -void BufferParams::readPreamble(LyXLex &lex) +void BufferParams::readPreamble(LyXLex & lex) { if (lex.GetString() != "\\begin_preamble") lyxerr << "Error (BufferParams::readPreamble):" @@ -243,7 +193,7 @@ void BufferParams::readPreamble(LyXLex &lex) } -void BufferParams::readLanguage(LyXLex &lex) +void BufferParams::readLanguage(LyXLex & lex) { string tmptok; string test; @@ -272,11 +222,11 @@ void BufferParams::readLanguage(LyXLex &lex) } -void BufferParams::readGraphicsDriver(LyXLex &lex) +void BufferParams::readGraphicsDriver(LyXLex & lex) { string tmptok; string test; - int n=0; + int n = 0; if (!lex.next()) return; diff --git a/src/bufferparams.h b/src/bufferparams.h index 1940b5f0f4..a90736f66c 100644 --- a/src/bufferparams.h +++ b/src/bufferparams.h @@ -1,6 +1,6 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * @@ -23,6 +23,7 @@ #include "Bullet.h" #include "insets/insetquotes.h" #include "layout.h" +#include "support/block.h" /** This class contains all the parameters for this a buffer uses. Some @@ -31,15 +32,81 @@ */ class BufferParams { public: + /// + enum PAPER_SIZE { + /// + PAPER_DEFAULT, + /// + PAPER_USLETTER, + /// + PAPER_LEGALPAPER, + /// + PAPER_EXECUTIVEPAPER, + /// + PAPER_A3PAPER, + /// + PAPER_A4PAPER, + /// + PAPER_A5PAPER, + /// + PAPER_B5PAPER + }; + /// + enum PAPER_PACKAGES { + /// + PACKAGE_NONE, + /// + PACKAGE_A4, + /// + PACKAGE_A4WIDE, + /// + PACKAGE_WIDEMARGINSA4 + }; + /// + enum VMARGIN_PAPER_TYPE { + /// + VM_PAPER_DEFAULT, + /// + VM_PAPER_CUSTOM, + /// + VM_PAPER_USLETTER, + /// + VM_PAPER_USLEGAL, + /// + VM_PAPER_USEXECUTIVE, + /// + VM_PAPER_A3, + /// + VM_PAPER_A4, + /// + VM_PAPER_A5, + /// + VM_PAPER_B3, + /// + VM_PAPER_B4, + /// + VM_PAPER_B5 + }; + /// + enum PARSEP { + /// + PARSEP_INDENT, + /// + PARSEP_SKIP + }; + /// + enum PAPER_ORIENTATION { + /// + ORIENTATION_PORTRAIT, + /// + ORIENTATION_LANDSCAPE + }; //@Man: Constructors and Deconstructors //@{ /// BufferParams(); //@} - /// Dummy destructor to shut up gcc - virtual ~BufferParams() {} - /// void writeFile(FILE *); @@ -56,7 +123,7 @@ public: /** Wether paragraphs are separated by using a indent like in articles or by using a little skip like in letters. */ - char paragraph_separation; // add approp. signedness + PARSEP paragraph_separation; /// InsetQuotes::quote_language quotes_language; /// @@ -67,14 +134,14 @@ public: LyXTextClassList::ClassList::size_type textclass; /* this are for the PaperLayout */ - /// + /// char papersize; /* the general papersize (papersize2 or paperpackage */ // add approp. signedness /// char papersize2; /* the selected Geometry papersize */ // add approp. signedness /// char paperpackage; /* a special paperpackage .sty-file */ // add approp. signedness /// - char orientation; // add approp. signedness + PAPER_ORIENTATION orientation; // add approp. signedness /// bool use_geometry; /// @@ -124,17 +191,15 @@ public: /// string pagestyle; /// - Bullet temp_bullets[4]; - /// - Bullet user_defined_bullets[4]; + block temp_bullets; /// - void Copy(BufferParams const &p); + block user_defined_bullets; /// - virtual void readPreamble(LyXLex &); + void readPreamble(LyXLex &); /// - virtual void readLanguage(LyXLex &); + void readLanguage(LyXLex &); /// - virtual void readGraphicsDriver(LyXLex &); + void readGraphicsDriver(LyXLex &); /// do we allow accents on all chars in this buffer bool allowAccents; /// diff --git a/src/bullet_forms.C b/src/bullet_forms.C index f30b2018b2..0aeeb97d6c 100644 --- a/src/bullet_forms.C +++ b/src/bullet_forms.C @@ -20,7 +20,7 @@ FD_form_bullet *create_form_form_bullet(void) fdui->form_bullet = fl_bgn_form(FL_NO_BOX, 370, 390); fl_set_border_width(-1); - obj = fl_add_box(FL_UP_BOX,0,0,370,390,""); + obj = fl_add_box(FL_UP_BOX, 0, 0, 370, 390, ""); // make the border thick again to improve the bmtable looks fl_set_border_width(-3); @@ -41,75 +41,75 @@ FD_form_bullet *create_form_form_bullet(void) } fl_set_border_width(-1); - obj = fl_add_frame(FL_ENGRAVED_FRAME,95,20,255,70,""); - obj = fl_add_frame(FL_ENGRAVED_FRAME,0,340,370,50,""); - fdui->choice_bullet_size = obj = fl_add_choice(FL_NORMAL_CHOICE,15,45,65,30,idex(_("Size|#z")));fl_set_button_shortcut(obj,scex(_("Size|#z")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_TOP); - fl_set_object_callback(obj,ChoiceBulletSizeCB,0); - fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON,25,350,100,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,BulletOKCB,0); - fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON,135,350,100,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,BulletApplyCB,0); - fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON,245,350,100,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,BulletCancelCB,0); - fdui->input_bullet_latex = obj = fl_add_input(FL_NORMAL_INPUT,80,300,275,30,idex(_("LaTeX|#L")));fl_set_button_shortcut(obj,scex(_("LaTeX|#L")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lstyle(obj,FL_FIXED_STYLE); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 95, 20, 255, 70, ""); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 0, 340, 370, 50, ""); + fdui->choice_bullet_size = obj = fl_add_choice(FL_NORMAL_CHOICE, 15, 45, 65, 30, idex(_("Size|#z")));fl_set_button_shortcut(obj, scex(_("Size|#z")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP); + fl_set_object_callback(obj, ChoiceBulletSizeCB, 0); + fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 25, 350, 100, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, BulletOKCB, 0); + fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 135, 350, 100, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, BulletApplyCB, 0); + fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 245, 350, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, BulletCancelCB, 0); + fdui->input_bullet_latex = obj = fl_add_input(FL_NORMAL_INPUT, 80, 300, 275, 30, idex(_("LaTeX|#L")));fl_set_button_shortcut(obj, scex(_("LaTeX|#L")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lstyle(obj, FL_FIXED_STYLE); fl_set_input_return(obj, FL_RETURN_CHANGED); - fl_set_input_maxchars(obj,80); - fl_set_object_callback(obj,InputBulletLaTeXCB,0); + fl_set_input_maxchars(obj, 80); + fl_set_object_callback(obj, InputBulletLaTeXCB, 0); fdui->radio_bullet_depth = fl_bgn_group(); - fdui->radio_bullet_depth_1 = obj = fl_add_button(FL_RADIO_BUTTON,105,35,55,40,idex(_("1|#1")));fl_set_button_shortcut(obj,scex(_("1|#1")),1); - fl_set_object_lsize(obj,FL_LARGE_SIZE); - fl_set_object_callback(obj,BulletDepthCB,0); + fdui->radio_bullet_depth_1 = obj = fl_add_button(FL_RADIO_BUTTON, 105, 35, 55, 40, idex(_("1|#1")));fl_set_button_shortcut(obj, scex(_("1|#1")), 1); + fl_set_object_lsize(obj, FL_LARGE_SIZE); + fl_set_object_callback(obj, BulletDepthCB, 0); fl_set_button(obj, 1); - fdui->radio_bullet_depth_2 = obj = fl_add_button(FL_RADIO_BUTTON,165,35,55,40,idex(_("2|#2")));fl_set_button_shortcut(obj,scex(_("2|#2")),1); - fl_set_object_lsize(obj,FL_LARGE_SIZE); - fl_set_object_callback(obj,BulletDepthCB,1); - fdui->radio_bullet_depth_3 = obj = fl_add_button(FL_RADIO_BUTTON,225,35,55,40,idex(_("3|#3")));fl_set_button_shortcut(obj,scex(_("3|#3")),1); - fl_set_object_lsize(obj,FL_LARGE_SIZE); - fl_set_object_callback(obj,BulletDepthCB,2); - fdui->radio_bullet_depth_4 = obj = fl_add_button(FL_RADIO_BUTTON,285,35,55,40,idex(_("4|#4")));fl_set_button_shortcut(obj,scex(_("4|#4")),1); - fl_set_object_lsize(obj,FL_LARGE_SIZE); - fl_set_object_callback(obj,BulletDepthCB,3); + fdui->radio_bullet_depth_2 = obj = fl_add_button(FL_RADIO_BUTTON, 165, 35, 55, 40, idex(_("2|#2")));fl_set_button_shortcut(obj, scex(_("2|#2")), 1); + fl_set_object_lsize(obj, FL_LARGE_SIZE); + fl_set_object_callback(obj, BulletDepthCB, 1); + fdui->radio_bullet_depth_3 = obj = fl_add_button(FL_RADIO_BUTTON, 225, 35, 55, 40, idex(_("3|#3")));fl_set_button_shortcut(obj, scex(_("3|#3")), 1); + fl_set_object_lsize(obj, FL_LARGE_SIZE); + fl_set_object_callback(obj, BulletDepthCB, 2); + fdui->radio_bullet_depth_4 = obj = fl_add_button(FL_RADIO_BUTTON, 285, 35, 55, 40, idex(_("4|#4")));fl_set_button_shortcut(obj, scex(_("4|#4")), 1); + fl_set_object_lsize(obj, FL_LARGE_SIZE); + fl_set_object_callback(obj, BulletDepthCB, 3); fl_end_group(); - obj = fl_add_text(FL_NORMAL_TEXT,105,10,85,20,_("Bullet Depth")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + obj = fl_add_text(FL_NORMAL_TEXT, 105, 10, 85, 20, _("Bullet Depth")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); fdui->radio_bullet_panel = fl_bgn_group(); - fdui->radio_bullet_panel_standard = obj = fl_add_button(FL_RADIO_BUTTON,15,105,65,30,idex(_("Standard|#S")));fl_set_button_shortcut(obj,scex(_("Standard|#S")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_bullet_panel_standard = obj = fl_add_button(FL_RADIO_BUTTON, 15, 105, 65, 30, idex(_("Standard|#S")));fl_set_button_shortcut(obj, scex(_("Standard|#S")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_resize(obj, FL_RESIZE_NONE); - fl_set_object_callback(obj,BulletPanelCB,0); + fl_set_object_callback(obj, BulletPanelCB, 0); fl_set_button(obj, 1); - fdui->radio_bullet_panel_maths = obj = fl_add_button(FL_RADIO_BUTTON,15,135,65,30,idex(_("Maths|#M")));fl_set_button_shortcut(obj,scex(_("Maths|#M")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_bullet_panel_maths = obj = fl_add_button(FL_RADIO_BUTTON, 15, 135, 65, 30, idex(_("Maths|#M")));fl_set_button_shortcut(obj, scex(_("Maths|#M")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_resize(obj, FL_RESIZE_NONE); - fl_set_object_callback(obj,BulletPanelCB,1); - fdui->radio_bullet_panel_ding2 = obj = fl_add_button(FL_RADIO_BUTTON,15,195,65,30,idex(_("Ding 2|#i")));fl_set_button_shortcut(obj,scex(_("Ding 2|#i")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, BulletPanelCB, 1); + fdui->radio_bullet_panel_ding2 = obj = fl_add_button(FL_RADIO_BUTTON, 15, 195, 65, 30, idex(_("Ding 2|#i")));fl_set_button_shortcut(obj, scex(_("Ding 2|#i")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_resize(obj, FL_RESIZE_NONE); - fl_set_object_callback(obj,BulletPanelCB,3); - fdui->radio_bullet_panel_ding3 = obj = fl_add_button(FL_RADIO_BUTTON,15,225,65,30,idex(_("Ding 3|#n")));fl_set_button_shortcut(obj,scex(_("Ding 3|#n")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, BulletPanelCB, 3); + fdui->radio_bullet_panel_ding3 = obj = fl_add_button(FL_RADIO_BUTTON, 15, 225, 65, 30, idex(_("Ding 3|#n")));fl_set_button_shortcut(obj, scex(_("Ding 3|#n")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_resize(obj, FL_RESIZE_NONE); - fl_set_object_callback(obj,BulletPanelCB,4); - fdui->radio_bullet_panel_ding4 = obj = fl_add_button(FL_RADIO_BUTTON,15,255,65,30,idex(_("Ding 4|#g")));fl_set_button_shortcut(obj,scex(_("Ding 4|#g")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, BulletPanelCB, 4); + fdui->radio_bullet_panel_ding4 = obj = fl_add_button(FL_RADIO_BUTTON, 15, 255, 65, 30, idex(_("Ding 4|#g")));fl_set_button_shortcut(obj, scex(_("Ding 4|#g")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_resize(obj, FL_RESIZE_NONE); - fl_set_object_callback(obj,BulletPanelCB,5); - fdui->radio_bullet_panel_ding1 = obj = fl_add_button(FL_RADIO_BUTTON,15,165,65,30,idex(_("Ding 1|#D")));fl_set_button_shortcut(obj,scex(_("Ding 1|#D")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, BulletPanelCB, 5); + fdui->radio_bullet_panel_ding1 = obj = fl_add_button(FL_RADIO_BUTTON, 15, 165, 65, 30, idex(_("Ding 1|#D")));fl_set_button_shortcut(obj, scex(_("Ding 1|#D")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_resize(obj, FL_RESIZE_NONE); - fl_set_object_callback(obj,BulletPanelCB,2); + fl_set_object_callback(obj, BulletPanelCB, 2); fl_end_group(); fl_end_form(); diff --git a/src/bullet_forms_cb.C b/src/bullet_forms_cb.C index 4bfae21822..37ad85e2b2 100644 --- a/src/bullet_forms_cb.C +++ b/src/bullet_forms_cb.C @@ -12,8 +12,8 @@ #include "lyx_gui_misc.h" // CancelCloseBoxCB + WriteAlert extern int mono_video; -extern BufferView *current_view; -FD_form_bullet *fd_form_bullet; +extern BufferView * current_view; +FD_form_bullet * fd_form_bullet; static int current_bullet_panel; static int current_bullet_depth; @@ -47,7 +47,7 @@ void bulletForm() } else { fl_show_form(fd_form_bullet->form_bullet, - FL_PLACE_MOUSE,FL_FULLBORDER, + FL_PLACE_MOUSE, FL_FULLBORDER, _("Itemize Bullet Selection")); } } diff --git a/src/chset.C b/src/chset.C index 3cb6648106..94ed5a3b68 100644 --- a/src/chset.C +++ b/src/chset.C @@ -4,117 +4,63 @@ #pragma implementation #endif +#include + #include "chset.h" #include "support/filetools.h" -#include "lyxlex.h" +#include "support/LRegex.h" +#include "support/LSubstring.h" #include "debug.h" - -CharacterSet::CharacterSet() -{ - map_=0; -} - - -CharacterSet::~CharacterSet() -{ - freeMap(); -} - - -void CharacterSet::freeMap() +bool CharacterSet::loadFile(string const & fname) { - Cdef* t; - while(map_) { - t=map_; - map_=map_->next; - delete t; - } - + map_.clear(); name_.clear(); -} - - -bool CharacterSet::loadFile(const string& fname) -{ - freeMap(); - - if (fname.empty() || fname=="ascii") + + if (fname.empty() || fname == "ascii") return true; // ascii 7-bit - + // open definition file lyxerr[Debug::KBMAP] - << "Opening keymap file " << fname << ".cdef" << endl; + << "Reading keymap file " << fname << ".cdef" << endl; string filename = LibFileSearch("kbd", fname.c_str(), "cdef"); - FilePtr f(filename, FilePtr::read); - if (filename.empty() || !f()) { + ifstream ifs(filename.c_str()); + if (!ifs) { lyxerr << "Unable to open keymap file" << endl; return true; // no definition, use 7-bit ascii } - - name_=fname; - - // now read the file - LyXLex lex(0,0); - lex.setFile(f()); - - bool error=false; + name_ = fname; + string str; int n; - - while(lex.IsOK() && !error) { - - switch(lex.lex()){ - case LyXLex::LEX_FEOF : - lyxerr[Debug::KBMAP] << "End of parsing of .cdef file" - << endl; - break; - default: - // Get Integer - n=lex.GetInteger(); - if (n<0) { - error=true; - continue; - } - - // Get String - lex.next(true); - str=lex.GetString(); - - Cdef* tempc=new Cdef; - tempc->str=str; - tempc->ic=n; - tempc->next=map_; - map_=tempc; - + string line; + LRegex reg("^([12][0-9][0-9])[ \t]+\"([^ ]+)\".*"); + while(getline(ifs, line)) { + if (reg.exact_match(line)) { + LRegex::SubMatches const & sub = reg.exec(line); + n = atoi(line.substr(sub[1].first, + sub[1].second).c_str()); + str = LSubstring(line, sub[2].first, sub[2].second); if (lyxerr.debugging(Debug::KBMAP)) lyxerr << "Chardef: " << n - << " to [" << tempc->str << "]" << endl; - break; + << " to [" << str << "]" << endl; + map_[str] = n; } } - + lyxerr[Debug::KBMAP] << "End of parsing of .cdef file." << endl; return false; } -bool CharacterSet::encodeString(string & str) +bool CharacterSet::encodeString(string & str) const { - Cdef *t=map_; - - while(t) { - if (t->str==str) { - // Can this fail? Why is ic an unsigned char? - str = char(t->ic); - break; - } - t=t->next; - } - return (t!=0); + Cdef::const_iterator cit = map_.find(str); + if (cit != map_.end()) return true; + return false; } -string CharacterSet::getName() +string const & CharacterSet::getName() const { return name_; } diff --git a/src/chset.h b/src/chset.h index 17f08193fe..30df042b0c 100644 --- a/src/chset.h +++ b/src/chset.h @@ -6,39 +6,26 @@ #pragma interface #endif +#include #include "LString.h" +using std::map; + /// class CharacterSet { public: /// - CharacterSet(); - /// - ~CharacterSet(); - + bool loadFile(string const &); /// - bool loadFile(const string&); + string const & getName() const; /// - string getName(); - /// - bool encodeString(string&); + bool encodeString(string &) const; private: /// string name_; - - /// - struct Cdef { - /// - unsigned char ic; - /// - string str; - /// - Cdef *next; - }; - /// - Cdef *map_; + typedef map Cdef; /// - void freeMap(); + Cdef map_; }; #endif diff --git a/src/combox.C b/src/combox.C index f51f700c67..58efa6534e 100644 --- a/src/combox.C +++ b/src/combox.C @@ -86,7 +86,7 @@ void Combox::remove() } lyxerr.debug() << "Label: " << label << endl; - if (label && label!=button) { + if (label && label!= button) { fl_delete_object(label); fl_free_object(label); } @@ -127,7 +127,7 @@ void Combox::addline(char const* text) bool Combox::select_text(char const* t) { if (!browser || !t) return false; - for (int i=1; i<=fl_get_browser_maxline(browser); i++) { + for (int i= 1; i<= fl_get_browser_maxline(browser); i++) { if (!strcmp(t, fl_get_browser_line(browser, i))) { select(i); return true; @@ -140,7 +140,7 @@ bool Combox::select_text(char const* t) void Combox::select(int i) { if (!browser || !button) return; - if (i>0 && i<=fl_get_browser_maxline(browser)) sel = i; + if (i>0 && i<= fl_get_browser_maxline(browser)) sel = i; fl_deactivate_object(button); if (type == FL_COMBOX_INPUT) @@ -159,39 +159,39 @@ void Combox::add(int x, int y, int w, int hmin, int hmax) case FL_COMBOX_DROPLIST: { button = obj = fl_add_button(FL_NORMAL_BUTTON, - x+w-22,y,22,hmin,"@2->"); - fl_set_object_color(obj,FL_MCOL, FL_MCOL); + x+w-22, y, 22, hmin, "@2->"); + fl_set_object_color(obj, FL_MCOL, FL_MCOL); fl_set_object_dblbuffer(obj, 1); - fl_set_object_callback(obj,C_Combox_combo_cb,0); - label = obj = fl_add_button(FL_NORMAL_TEXT,x,y,w-22,hmin,""); - fl_set_object_boxtype(obj,FL_DOWN_BOX); - fl_set_object_color(obj,FL_MCOL,FL_BLACK); - fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE); + fl_set_object_callback(obj, C_Combox_combo_cb, 0); + label = obj = fl_add_button(FL_NORMAL_TEXT, x, y, w-22, hmin, ""); + fl_set_object_boxtype(obj, FL_DOWN_BOX); + fl_set_object_color(obj, FL_MCOL, FL_BLACK); + fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); fl_set_object_dblbuffer(obj, 1); - fl_set_object_callback(obj,C_Combox_combo_cb,0); + fl_set_object_callback(obj, C_Combox_combo_cb, 0); break; } case FL_COMBOX_NORMAL: { - button = obj = fl_add_button(FL_NORMAL_BUTTON,x,y,w,hmin,""); - fl_set_object_color(obj,FL_MCOL, FL_MCOL); - fl_set_object_boxtype(obj,FL_DOWN_BOX); - fl_set_object_callback(obj,C_Combox_combo_cb,0); - fl_set_object_color(obj,FL_MCOL,FL_BLACK); + button = obj = fl_add_button(FL_NORMAL_BUTTON, x, y, w, hmin, ""); + fl_set_object_color(obj, FL_MCOL, FL_MCOL); + fl_set_object_boxtype(obj, FL_DOWN_BOX); + fl_set_object_callback(obj, C_Combox_combo_cb, 0); + fl_set_object_color(obj, FL_MCOL, FL_BLACK); label = button; break; } case FL_COMBOX_INPUT: { button = obj = fl_add_button(FL_NORMAL_BUTTON, - x+w-22,y,22,hmin,"@2->"); - fl_set_object_color(obj,FL_MCOL, FL_MCOL); - fl_set_object_callback(obj,C_Combox_combo_cb,0); - label = obj = fl_add_input(FL_NORMAL_INPUT,x,y,w-22,hmin,""); - fl_set_object_boxtype(obj,FL_DOWN_BOX); + x+w-22, y, 22, hmin, "@2->"); + fl_set_object_color(obj, FL_MCOL, FL_MCOL); + fl_set_object_callback(obj, C_Combox_combo_cb, 0); + label = obj = fl_add_input(FL_NORMAL_INPUT, x, y, w-22, hmin, ""); + fl_set_object_boxtype(obj, FL_DOWN_BOX); fl_set_object_return(obj, FL_RETURN_END_CHANGED); - fl_set_object_callback(obj,C_Combox_input_cb,0); - //fl_set_object_color(obj,FL_MCOL,FL_BLACK); + fl_set_object_callback(obj, C_Combox_input_cb, 0); + //fl_set_object_color(obj, FL_MCOL, FL_BLACK); //fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE); break; } @@ -210,11 +210,11 @@ void Combox::add(int x, int y, int w, int hmin, int hmax) 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,""); - fl_set_object_boxtype(obj,FL_UP_BOX); - fl_set_object_color(obj,FL_MCOL, FL_YELLOW); + browser = obj = fl_add_browser(FL_HOLD_BROWSER, 0, 0, bw, bh, ""); + fl_set_object_boxtype(obj, FL_UP_BOX); + fl_set_object_color(obj, FL_MCOL, FL_YELLOW); fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity); - fl_set_object_callback(obj,C_Combox_combo_cb,2); + fl_set_object_callback(obj, C_Combox_combo_cb, 2); fl_end_form(); browser->u_vdata = (void*)this; form->u_vdata = browser; @@ -258,7 +258,7 @@ void Combox::Show() XGrabPointer(fl_display, form->window, false, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, GrabModeAsync, GrabModeAsync, - 0, 0,0); + 0, 0, 0); XFlush(fl_display); } @@ -272,7 +272,7 @@ void Combox::Hide(int who) else fl_set_object_label(label, fl_get_browser_line(browser, sel)); - if (callback) callback(sel,cb_arg); + if (callback) callback(sel, cb_arg); } XUngrabPointer(fl_display, 0); XFlush(fl_display); @@ -359,7 +359,7 @@ void 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); + Combox::combo_cb(ob, data); } @@ -369,7 +369,7 @@ int Combox::peek_event(FL_FORM * form, void *xev) Combox *combo = (Combox*)ob->u_vdata; #if FL_REVISION < 86 - if(((XEvent *)xev)->type==ButtonPress && !ob->belowmouse) + 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) @@ -398,7 +398,7 @@ int Combox::peek_event(FL_FORM * form, void *xev) fl_get_browser_maxline(combo->browser)) fl_select_browser_line(combo->browser, fl_get_browser(combo->browser)+1); - if (fl_get_browser(combo->browser)>= + if (fl_get_browser(combo->browser)>= fl_get_browser_topline(combo->browser) + fl_get_browser_screenlines(combo->browser)) fl_set_browser_topline(combo->browser, @@ -413,7 +413,7 @@ int Combox::peek_event(FL_FORM * form, void *xev) if (fl_get_browser(combo->browser) > 1) fl_select_browser_line(combo->browser, fl_get_browser(combo->browser)-1); - if (fl_get_browser(combo->browser)>= + if (fl_get_browser(combo->browser)>= fl_get_browser_topline(combo->browser) + fl_get_browser_screenlines(combo->browser)) fl_set_browser_topline(combo->browser, @@ -459,10 +459,10 @@ FD_test *create_form_test(void) FD_test *fdui = (FD_test *) fl_calloc(1, sizeof(*fdui)); fdui->test = fl_bgn_form(FL_NO_BOX, 320, 190); - obj = fl_add_box(FL_UP_BOX,0,0,320,190,""); - obj = fl_add_box(FL_DOWN_BOX,10,50,300,110,""); - obj = fl_add_button(FL_NORMAL_BUTTON,250,10,50,30,_("Done")); - combo.add(10,15,120,25,135); + obj = fl_add_box(FL_UP_BOX, 0, 0, 320, 190, ""); + obj = fl_add_box(FL_DOWN_BOX, 10, 50, 300, 110, ""); + obj = fl_add_button(FL_NORMAL_BUTTON, 250, 10, 50, 30, _("Done")); + combo.add(10, 15, 120, 25, 135); fl_end_form(); return fdui; @@ -511,7 +511,7 @@ int main(int argc, char *argv[]) // combo.select(4); /* show the first form */ - fl_show_form(fd_test->test,FL_PLACE_CENTER,FL_FULLBORDER,"test"); + fl_show_form(fd_test->test, FL_PLACE_CENTER, FL_FULLBORDER, "test"); fl_do_forms(); return 0; } diff --git a/src/combox.h b/src/combox.h index 0dfc461a27..fb32d648be 100644 --- a/src/combox.h +++ b/src/combox.h @@ -21,15 +21,15 @@ * and support for middle and right buttons, as XForms choice object. */ -#ifndef _COMBOX_H_ -#define _COMBOX_H_ +#ifndef COMBOX_H +#define COMBOX_H #ifdef __GNUG__ #pragma interface #endif #include FORMS_H_LOCATION -#include +#include /// enum combox_type { @@ -51,7 +51,7 @@ typedef void (*FL_COMBO_PRE_POST) (); class Combox { public: /// - Combox(combox_type t=FL_COMBOX_NORMAL); + Combox(combox_type t = FL_COMBOX_NORMAL); /// ~Combox(); @@ -160,21 +160,21 @@ inline void Combox::resize(unsigned r) { fl_set_object_resize(button, r); - if (label!=button) fl_set_object_resize(label, r); + if (label!= button) fl_set_object_resize(label, r); } inline void Combox::gravity(unsigned g1, unsigned g2) { fl_set_object_gravity(button, g1, g2); - if (label!=button) fl_set_object_gravity(label, g1, g2); + if (label!= button) fl_set_object_gravity(label, g1, g2); } inline void Combox::shortcut(char const* s, int i) { if (button) - fl_set_object_shortcut(button,s,i); + fl_set_object_shortcut(button, s, i); } inline @@ -205,7 +205,7 @@ int Combox::get() inline char const*Combox::getline() { - if (type==FL_COMBOX_INPUT) + if (type == FL_COMBOX_INPUT) return fl_get_input(label); else return ((browser) ? fl_get_browser_line(browser, sel): (char const*)0); diff --git a/src/commandtags.h b/src/commandtags.h index a8c36d313c..9348ca137f 100644 --- a/src/commandtags.h +++ b/src/commandtags.h @@ -118,7 +118,9 @@ enum kb_action { LFUN_GETNAME, LFUN_NOTIFY, LFUN_GOTOFILEROW, // Edmar 12/23/98 +#if 0 LFUN_INSERT_INSET_LATEX, +#endif LFUN_INSERT_NOTE, LFUN_KMAP_OFF, LFUN_KMAP_PRIM, diff --git a/src/credits.C b/src/credits.C index db4448f208..72e14b6e3d 100644 --- a/src/credits.C +++ b/src/credits.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -68,7 +68,7 @@ void ShowCredits() fl_raise_form(fd_form_credits->form_credits); } else { fl_show_form(fd_form_credits->form_credits, - FL_PLACE_MOUSE | FL_FREE_SIZE,FL_FULLBORDER, + FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER, _("Credits")); } } diff --git a/src/credits_form.C b/src/credits_form.C index c6ddea827e..77213176e9 100644 --- a/src/credits_form.C +++ b/src/credits_form.C @@ -15,22 +15,22 @@ FD_form_credits *create_form_form_credits(void) FD_form_credits *fdui = (FD_form_credits *) fl_calloc(1, sizeof(FD_form_credits)); fdui->form_credits = fl_bgn_form(FL_NO_BOX, 500, 330); - obj = fl_add_box(FL_UP_BOX,0,0,500,330,""); - obj = fl_add_button(FL_RETURN_BUTTON,180,290,140,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_box(FL_UP_BOX, 0, 0, 500, 330, ""); + obj = fl_add_button(FL_RETURN_BUTTON, 180, 290, 140, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_South, FL_South); fl_set_object_resize(obj, FL_RESIZE_NONE); - fl_set_object_callback(obj,CreditsOKCB,0); - obj = fl_add_text(FL_NORMAL_TEXT,10,40,480,30,_("Matthias")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_ITALIC_STYLE); + fl_set_object_callback(obj, CreditsOKCB, 0); + obj = fl_add_text(FL_NORMAL_TEXT, 10, 40, 480, 30, _("Matthias")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_ITALIC_STYLE); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); - obj = fl_add_text(FL_NORMAL_TEXT,10,10,480,30,_("All these people have contributed to the LyX project. Thanks,")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE); + obj = fl_add_text(FL_NORMAL_TEXT, 10, 10, 480, 30, _("All these people have contributed to the LyX project. Thanks,")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); - fdui->browser_credits = obj = fl_add_browser(FL_NORMAL_BROWSER,10,80,480,200,""); + fdui->browser_credits = obj = fl_add_browser(FL_NORMAL_BROWSER, 10, 80, 480, 200, ""); fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast); fl_end_form(); @@ -46,25 +46,25 @@ FD_copyright *create_form_copyright(void) FD_copyright *fdui = (FD_copyright *) fl_calloc(1, sizeof(FD_copyright)); fdui->copyright = fl_bgn_form(FL_NO_BOX, 450, 430); - obj = fl_add_box(FL_UP_BOX,0,0,450,430,""); - obj = fl_add_text(FL_NORMAL_TEXT,10,10,430,50,_("LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-1999 LyX Team")); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE); + obj = fl_add_box(FL_UP_BOX, 0, 0, 450, 430, ""); + obj = fl_add_text(FL_NORMAL_TEXT, 10, 10, 430, 50, _("LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-1999 LyX Team")); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); - obj = fl_add_text(FL_NORMAL_TEXT,10,70,430,110,_("This program is free software; you can redistribute it\nand/or modify it under the terms of the GNU General\nPublic License as published by the Free Software\nFoundation; either version 2 of the License, or\n(at your option) any later version.")); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE); - obj = fl_add_button(FL_RETURN_BUTTON,160,390,140,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_text(FL_NORMAL_TEXT, 10, 70, 430, 110, _("This program is free software; you can redistribute it\nand/or modify it under the terms of the GNU General\nPublic License as published by the Free Software\nFoundation; either version 2 of the License, or\n(at your option) any later version.")); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); + obj = fl_add_button(FL_RETURN_BUTTON, 160, 390, 140, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_South, FL_South); fl_set_object_resize(obj, FL_RESIZE_NONE); - fl_set_object_callback(obj,CopyrightOKCB,0); - obj = fl_add_text(FL_NORMAL_TEXT,10,190,430,190,_("LyX is distributed in the hope that it will\nbe useful, but WITHOUT ANY WARRANTY;\nwithout even the implied warranty of MERCHANTABILITY\nor FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\nYou should have received a copy of\nthe GNU General Public License\nalong with this program; if not, write to\nthe Free Software Foundation, Inc.,\n675 Mass Ave, Cambridge, MA 02139, USA.")); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE); + fl_set_object_callback(obj, CopyrightOKCB, 0); + obj = fl_add_text(FL_NORMAL_TEXT, 10, 190, 430, 190, _("LyX is distributed in the hope that it will\nbe useful, but WITHOUT ANY WARRANTY;\nwithout even the implied warranty of MERCHANTABILITY\nor FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\nYou should have received a copy of\nthe GNU General Public License\nalong with this program; if not, write to\nthe Free Software Foundation, Inc.,\n675 Mass Ave, Cambridge, MA 02139, USA.")); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); fl_end_form(); //fdui->copyright->fdui = fdui; diff --git a/src/debug.h b/src/debug.h index ce584db816..975738ce61 100644 --- a/src/debug.h +++ b/src/debug.h @@ -84,7 +84,7 @@ struct Debug { } }; /// -inline void operator|=(Debug::type & d1, Debug::type d2) +inline void operator|= (Debug::type & d1, Debug::type d2) { d1 = static_cast(d1 | d2); } diff --git a/src/definitions.h b/src/definitions.h index fb80eda5ec..e69de29bb2 100644 --- a/src/definitions.h +++ b/src/definitions.h @@ -1,184 +0,0 @@ -// -*- C++ -*- -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright (C) 1995 Matthias Ettrich - * - *======================================================*/ -#ifndef _DEFINITIONS_H -#define _DEFINITIONS_H - -// NOTE: -// We are trying to get rid of the global enums below, so try to _not_ -// add any more of them. Preferably enums should be located inside classes. -// (i.e. class FooBar { -// enum some { -// more, -// thing -// }; -// } -// to be accesed as FooBar::more and FooBar::thing - -// ALL the enums below should be given names, this to get better typechecking. -// some don't have names now because this cause warings when compiling. - - -/// -enum { // no good name for this - /// - LYX_ENVIRONMENT_DEFAULT = 97, - /// - LYX_LAYOUT_DEFAULT = 99 -}; -// Could this cause confusion that both DUMMY_LAYOUT and LAYOUT_DEFAULT has -// the same value? (Lgb) -/// -#define LYX_DUMMY_LAYOUT 99 - -/// -enum LYX_META_KIND { - /// - LYX_META_FOOTNOTE = 1, - /// - LYX_META_MARGIN, - /// - LYX_META_FIG, - /// - LYX_META_TAB, - /// - LYX_META_ALGORITHM, - /// - LYX_META_WIDE_FIG, - /// - LYX_META_WIDE_TAB, - /// - LYX_META_HFILL, - /// - LYX_META_NEWLINE, - /// - LYX_META_PROTECTED_SEPARATOR, - /// - LYX_META_INSET -}; - -/// -enum LYX_PARSEP { - /// - LYX_PARSEP_INDENT, - /// - LYX_PARSEP_SKIP -}; - -/// -enum OLD_LYX_PAPER_SIZE { - /// - OLD_PAPER_A4PAPER, - /// - OLD_PAPER_A4, - /// - OLD_PAPER_A4WIDE, - /// - OLD_PAPER_WIDEMARGINSA4, - /// - OLD_PAPER_USLETTER, - /// - OLD_PAPER_A5PAPER, - /// - OLD_PAPER_B5PAPER, - /// - OLD_PAPER_EXECUTIVEPAPER, - /// - OLD_PAPER_LEGALPAPER -}; - -/// -enum LYX_PAPER_SIZE { - /// - PAPER_DEFAULT, - /// - PAPER_USLETTER, - /// - PAPER_LEGALPAPER, - /// - PAPER_EXECUTIVEPAPER, - /// - PAPER_A3PAPER, - /// - PAPER_A4PAPER, - /// - PAPER_A5PAPER, - /// - PAPER_B5PAPER -}; - -/// -enum LYX_VMARGIN_PAPER_TYPE { - /// - VM_PAPER_DEFAULT, - /// - VM_PAPER_CUSTOM, - /// - VM_PAPER_USLETTER, - /// - VM_PAPER_USLEGAL, - /// - VM_PAPER_USEXECUTIVE, - /// - VM_PAPER_A3, - /// - VM_PAPER_A4, - /// - VM_PAPER_A5, - /// - VM_PAPER_B3, - /// - VM_PAPER_B4, - /// - VM_PAPER_B5 -}; - -/// -enum LYX_PAPER_PACKAGES { - /// - PACKAGE_NONE, - /// - PACKAGE_A4, - /// - PACKAGE_A4WIDE, - /// - PACKAGE_WIDEMARGINSA4 -}; - -/// -enum LYX_PAPER_ORIENTATION { - /// - ORIENTATION_PORTRAIT, - /// - ORIENTATION_LANDSCAPE -}; - -/// -enum LYX_PEXTRA_TYPE { - /// - PEXTRA_NONE, - /// - PEXTRA_INDENT, - /// - PEXTRA_MINIPAGE, - /// - PEXTRA_FLOATFLT -}; - -/// -enum LYX_MINIPAGE_ALIGNMENT { - /// - MINIPAGE_ALIGN_TOP, - /// - MINIPAGE_ALIGN_MIDDLE, - /// - MINIPAGE_ALIGN_BOTTOM -}; - -#endif diff --git a/src/filedlg.C b/src/filedlg.C index bbd63ba7ed..63d2fbd960 100644 --- a/src/filedlg.C +++ b/src/filedlg.C @@ -1,13 +1,13 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -55,7 +55,7 @@ #endif #ifdef BROKEN_HEADERS -extern "C" int gettimeofday(struct timeval *,struct timezone *); +extern "C" int gettimeofday(struct timeval *, struct timezone *); #define remove(a) unlink(a) #endif @@ -65,7 +65,6 @@ extern "C" int gettimeofday(struct timeval *,struct timezone *); #include "support/filetools.h" #include "filedlg.h" -#include "definitions.h" static const long SIX_MONTH_SEC = 6L * 30L * 24L * 60L * 60L; // six months, in seconds static const long ONE_HOUR_SEC = 60L * 60L; @@ -73,14 +72,14 @@ static const long ONE_HOUR_SEC = 60L * 60L; // *** User cache class implementation // global instance (user cache root) -UserCache lyxUserCache = UserCache(string(),0,0); +UserCache lyxUserCache = UserCache(string(), 0, 0); // some "C" wrappers around callbacks extern "C" void C_LyXFileDlg_FileDlgCB(FL_OBJECT *, long lArgument); extern "C" void C_LyXFileDlg_DoubleClickCB(FL_OBJECT *, long); extern "C" int C_LyXFileDlg_CancelCB(FL_FORM *, void *); -extern "C" int C_LyXDirEntryC_ldeCompProc(const void* r1, - const void* r2); +extern "C" int C_LyXDirEntryC_ldeCompProc(const void * r1, + const void * r2); // Add: creates a new user entry UserCache * UserCache::Add(uid_t ID) @@ -137,7 +136,7 @@ string UserCache::Find(uid_t ID) // *** Group cache class implementation // global instance (group cache root) -GroupCache lyxGroupCache = GroupCache(string(),0,0); +GroupCache lyxGroupCache = GroupCache(string(), 0, 0); // Add: creates a new group entry GroupCache * GroupCache::Add(gid_t ID) @@ -295,7 +294,7 @@ void LyXFileDlg::Reread() fileInfo.newFile(File, true); fileInfo.modeString(szMode); unsigned int nlink = fileInfo.getNumberOfLinks(); - string user = lyxUserCache.Find(fileInfo.getUid()); + string user = lyxUserCache.Find(fileInfo.getUid()); string group = lyxGroupCache.Find(fileInfo.getGid()); time_t modtime = fileInfo.getModificationTime(); @@ -327,7 +326,7 @@ void LyXFileDlg::Reread() if ((isLink = fileInfo.isLink())) { string Link; - if (LyXReadLink(File,Link)) { + if (LyXReadLink(File, Link)) { Buffer += " -> "; Buffer += Link; @@ -381,7 +380,7 @@ void LyXFileDlg::Reread() string temp = line + pCurrentNames[i].pszDisplayed; fl_add_browser_line(pFileDlgForm->List, temp.c_str()); } - fl_set_browser_topline(pFileDlgForm->List,iDepth); + fl_set_browser_topline(pFileDlgForm->List, iDepth); fl_show_object(pFileDlgForm->List); iLastSel = -1; } @@ -425,28 +424,28 @@ LyXFileDlg::LyXFileDlg() pFileDlgForm = create_form_FileDlg(); // Set callbacks. This means that we don't need a patch file fl_set_object_callback(pFileDlgForm->DirBox, - C_LyXFileDlg_FileDlgCB,0); + C_LyXFileDlg_FileDlgCB, 0); fl_set_object_callback(pFileDlgForm->PatBox, - C_LyXFileDlg_FileDlgCB,1); + C_LyXFileDlg_FileDlgCB, 1); fl_set_object_callback(pFileDlgForm->List, - C_LyXFileDlg_FileDlgCB,2); + C_LyXFileDlg_FileDlgCB, 2); fl_set_object_callback(pFileDlgForm->Filename, - C_LyXFileDlg_FileDlgCB,3); + C_LyXFileDlg_FileDlgCB, 3); fl_set_object_callback(pFileDlgForm->Rescan, - C_LyXFileDlg_FileDlgCB,10); + C_LyXFileDlg_FileDlgCB, 10); fl_set_object_callback(pFileDlgForm->Home, - C_LyXFileDlg_FileDlgCB,11); + C_LyXFileDlg_FileDlgCB, 11); fl_set_object_callback(pFileDlgForm->User1, - C_LyXFileDlg_FileDlgCB,12); + C_LyXFileDlg_FileDlgCB, 12); fl_set_object_callback(pFileDlgForm->User2, - C_LyXFileDlg_FileDlgCB,13); + C_LyXFileDlg_FileDlgCB, 13); // Make sure pressing the close box doesn't crash LyX. (RvdK) fl_set_form_atclose(pFileDlgForm->FileDlg, C_LyXFileDlg_CancelCB, 0); // Register doubleclick callback fl_set_browser_dblclick_callback(pFileDlgForm->List, - C_LyXFileDlg_DoubleClickCB,0); + C_LyXFileDlg_DoubleClickCB, 0); } fl_hide_object(pFileDlgForm->User1); fl_hide_object(pFileDlgForm->User2); @@ -622,7 +621,7 @@ bool LyXFileDlg::HandleDoubleClick() isDir = false; fl_set_input(pFileDlgForm->Filename, pszTemp.c_str()); } - } else if (iSelect !=0) { + } else if (iSelect != 0) { SetInfoLine(string()); } else return true; @@ -667,7 +666,7 @@ bool LyXFileDlg::HandleOK() // mask was changed pszTemp = fl_get_input(pFileDlgForm->PatBox); - if (pszTemp!=pszMask) { + if (pszTemp!= pszMask) { SetMask(pszTemp); Reread(); return false; @@ -675,7 +674,7 @@ bool LyXFileDlg::HandleOK() // directory was changed pszTemp = fl_get_input(pFileDlgForm->DirBox); - if (pszTemp!=pszDirectory) { + if (pszTemp!= pszDirectory) { SetDirectory(pszTemp); Reread(); return false; diff --git a/src/filedlg.h b/src/filedlg.h index a6dbfb154f..02e4c66c67 100644 --- a/src/filedlg.h +++ b/src/filedlg.h @@ -1,13 +1,13 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #ifndef FILEDLG_H #define FILEDLG_H diff --git a/src/form1.C b/src/form1.C index d19029e193..c9e05d38e1 100644 --- a/src/form1.C +++ b/src/form1.C @@ -6,7 +6,7 @@ /* Form definition file generated with fdesign. */ #include FORMS_H_LOCATION -#include +#include #include "form1.h" FD_KeyMap *create_form_KeyMap(void) @@ -15,64 +15,64 @@ FD_KeyMap *create_form_KeyMap(void) FD_KeyMap *fdui = (FD_KeyMap *) fl_calloc(1, sizeof(FD_KeyMap)); fdui->KeyMap = fl_bgn_form(FL_NO_BOX, 400, 400); - obj = fl_add_box(FL_UP_BOX,0,0,400,400,""); - obj = fl_add_frame(FL_ENGRAVED_FRAME,200,210,190,140,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - fdui->AcceptChset = obj = fl_add_button(FL_NORMAL_BUTTON,210,280,170,30,idex(_("Set Charset|#C")));fl_set_button_shortcut(obj,scex(_("Set Charset|#C")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->ChsetErr = obj = fl_add_text(FL_NORMAL_TEXT,210,310,170,30,_("Charset not found!")); - fl_set_object_lcol(obj,FL_RED); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE+FL_EMBOSSED_STYLE); - fdui->KeymapErr = obj = fl_add_text(FL_NORMAL_TEXT,290,60,100,90,_("Error:\n\nKeymap\nnot found")); - fl_set_object_lcol(obj,FL_RED); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE+FL_EMBOSSED_STYLE); - fdui->Charset = obj = fl_add_input(FL_NORMAL_INPUT,210,240,170,30,idex(_("Character set:|#H")));fl_set_button_shortcut(obj,scex(_("Character set:|#H")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_TOP); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,210,180,100,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,20,380,170,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_TOP); + obj = fl_add_box(FL_UP_BOX, 0, 0, 400, 400, ""); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 200, 210, 190, 140, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fdui->AcceptChset = obj = fl_add_button(FL_NORMAL_BUTTON, 210, 280, 170, 30, idex(_("Set Charset|#C")));fl_set_button_shortcut(obj, scex(_("Set Charset|#C")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->ChsetErr = obj = fl_add_text(FL_NORMAL_TEXT, 210, 310, 170, 30, _("Charset not found!")); + fl_set_object_lcol(obj, FL_RED); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE+FL_EMBOSSED_STYLE); + fdui->KeymapErr = obj = fl_add_text(FL_NORMAL_TEXT, 290, 60, 100, 90, _("Error:\n\nKeymap\nnot found")); + fl_set_object_lcol(obj, FL_RED); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE+FL_EMBOSSED_STYLE); + fdui->Charset = obj = fl_add_input(FL_NORMAL_INPUT, 210, 240, 170, 30, idex(_("Character set:|#H")));fl_set_button_shortcut(obj, scex(_("Character set:|#H")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 210, 180, 100, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 20, 380, 170, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP); fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->Accept = obj = fl_add_button(FL_RETURN_BUTTON,130,360,120,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->OtherKeymap = obj = fl_add_input(FL_NORMAL_INPUT,120,70,160,30,idex(_("Other...|#O")));fl_set_button_shortcut(obj,scex(_("Other...|#O")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->Accept = obj = fl_add_button(FL_RETURN_BUTTON, 130, 360, 120, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->OtherKeymap = obj = fl_add_input(FL_NORMAL_INPUT, 120, 70, 160, 30, idex(_("Other...|#O")));fl_set_button_shortcut(obj, scex(_("Other...|#O")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->OtherKeymap2 = obj = fl_add_input(FL_NORMAL_INPUT,120,150,160,30,idex(_("Other...|#T")));fl_set_button_shortcut(obj,scex(_("Other...|#T")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->OtherKeymap2 = obj = fl_add_input(FL_NORMAL_INPUT, 120, 150, 160, 30, idex(_("Other...|#T")));fl_set_button_shortcut(obj, scex(_("Other...|#T")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_resize(obj, FL_RESIZE_NONE); - obj = fl_add_text(FL_NORMAL_TEXT,20,10,90,20,_("Language")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 90, 20, _("Language")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_set_object_resize(obj, FL_RESIZE_NONE); - obj = fl_add_text(FL_NORMAL_TEXT,20,200,80,20,_("Mapping")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 200, 80, 20, _("Mapping")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fdui->KeyMapOn = fl_bgn_group(); - fdui->KeyOnBtn = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,250,180,30,idex(_("Primary key map|#r")));fl_set_button_shortcut(obj,scex(_("Primary key map|#r")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->KeyOffBtn = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,220,180,30,idex(_("No key mapping|#N")));fl_set_button_shortcut(obj,scex(_("No key mapping|#N")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->KeyOnBtn2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,280,180,30,idex(_("Secondary key map|#e")));fl_set_button_shortcut(obj,scex(_("Secondary key map|#e")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->KeyOnBtn = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 250, 180, 30, idex(_("Primary key map|#r")));fl_set_button_shortcut(obj, scex(_("Primary key map|#r")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->KeyOffBtn = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 220, 180, 30, idex(_("No key mapping|#N")));fl_set_button_shortcut(obj, scex(_("No key mapping|#N")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->KeyOnBtn2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 280, 180, 30, idex(_("Secondary key map|#e")));fl_set_button_shortcut(obj, scex(_("Secondary key map|#e")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_group(); - obj = fl_add_text(FL_NORMAL_TEXT,20,110,100,30,_("Secondary")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_RIGHT|FL_ALIGN_INSIDE); - obj = fl_add_text(FL_NORMAL_TEXT,20,30,100,30,_("Primary")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_RIGHT|FL_ALIGN_INSIDE); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 110, 100, 30, _("Secondary")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_RIGHT|FL_ALIGN_INSIDE); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 30, 100, 30, _("Primary")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_RIGHT|FL_ALIGN_INSIDE); fl_end_form(); //fdui->KeyMap->fdui = fdui; @@ -87,129 +87,129 @@ FD_Figure *create_form_Figure(void) FD_Figure *fdui = (FD_Figure *) fl_calloc(1, sizeof(FD_Figure)); fdui->Figure = fl_bgn_form(FL_NO_BOX, 420, 390); - obj = fl_add_box(FL_UP_BOX,0,0,420,390,""); - obj = fl_add_frame(FL_ENGRAVED_FRAME,230,220,180,80,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME,230,60,180,140,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,244,200,56,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,60,200,160,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - fdui->EpsFile = obj = fl_add_input(FL_NORMAL_INPUT,80,10,230,30,idex(_("EPS file|#E")));fl_set_button_shortcut(obj,scex(_("EPS file|#E")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,2); - fdui->Preview = obj = fl_add_button(FL_NORMAL_BUTTON,270,350,140,30,idex(_("Full Screen Preview|#v")));fl_set_button_shortcut(obj,scex(_("Full Screen Preview|#v")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,1); - fdui->Browse = obj = fl_add_button(FL_NORMAL_BUTTON,320,10,90,30,idex(_("Browse...|#B")));fl_set_button_shortcut(obj,scex(_("Browse...|#B")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,0); - fdui->Width = obj = fl_add_input(FL_FLOAT_INPUT,20,180,80,30,""); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,2); - fdui->Height = obj = fl_add_input(FL_FLOAT_INPUT,120,180,80,30,""); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,2); - fdui->ApplyBtn = obj = fl_add_button(FL_NORMAL_BUTTON,100,350,60,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,7); - fdui->OkBtn = obj = fl_add_button(FL_RETURN_BUTTON,10,350,70,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,8); - fdui->CancelBtn = obj = fl_add_button(FL_NORMAL_BUTTON,180,350,70,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,9); - fdui->Frame = obj = fl_add_checkbutton(FL_PUSH_BUTTON,230,230,180,30,idex(_("Display Frame|#F")));fl_set_button_shortcut(obj,scex(_("Display Frame|#F")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,53); - fdui->Translations = obj = fl_add_checkbutton(FL_PUSH_BUTTON,230,260,180,30,idex(_("Do Translations|#r")));fl_set_button_shortcut(obj,scex(_("Do Translations|#r")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,54); - obj = fl_add_text(FL_NORMAL_TEXT,240,210,70,20,_("Options")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->Angle = obj = fl_add_input(FL_FLOAT_INPUT,100,260,80,30,idex(_("Angle:|#L")));fl_set_button_shortcut(obj,scex(_("Angle:|#L")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,2); + obj = fl_add_box(FL_UP_BOX, 0, 0, 420, 390, ""); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 230, 220, 180, 80, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 230, 60, 180, 140, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 244, 200, 56, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 60, 200, 160, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fdui->EpsFile = obj = fl_add_input(FL_NORMAL_INPUT, 80, 10, 230, 30, idex(_("EPS file|#E")));fl_set_button_shortcut(obj, scex(_("EPS file|#E")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 2); + fdui->Preview = obj = fl_add_button(FL_NORMAL_BUTTON, 270, 350, 140, 30, idex(_("Full Screen Preview|#v")));fl_set_button_shortcut(obj, scex(_("Full Screen Preview|#v")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 1); + fdui->Browse = obj = fl_add_button(FL_NORMAL_BUTTON, 320, 10, 90, 30, idex(_("Browse...|#B")));fl_set_button_shortcut(obj, scex(_("Browse...|#B")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 0); + fdui->Width = obj = fl_add_input(FL_FLOAT_INPUT, 20, 180, 80, 30, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 2); + fdui->Height = obj = fl_add_input(FL_FLOAT_INPUT, 120, 180, 80, 30, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 2); + fdui->ApplyBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 100, 350, 60, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 7); + fdui->OkBtn = obj = fl_add_button(FL_RETURN_BUTTON, 10, 350, 70, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 8); + fdui->CancelBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 180, 350, 70, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 9); + fdui->Frame = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 230, 230, 180, 30, idex(_("Display Frame|#F")));fl_set_button_shortcut(obj, scex(_("Display Frame|#F")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 53); + fdui->Translations = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 230, 260, 180, 30, idex(_("Do Translations|#r")));fl_set_button_shortcut(obj, scex(_("Do Translations|#r")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 54); + obj = fl_add_text(FL_NORMAL_TEXT, 240, 210, 70, 20, _("Options")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->Angle = obj = fl_add_input(FL_FLOAT_INPUT, 100, 260, 80, 30, idex(_("Angle:|#L")));fl_set_button_shortcut(obj, scex(_("Angle:|#L")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 2); fdui->HeightGrp = fl_bgn_group(); // xgettext:no-c-format - fdui->page2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON,110,130,110,30,idex(_("% of Page|#g")));fl_set_button_shortcut(obj,scex(_("% of Page|#g")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,23); - fdui->Default2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON,110,70,80,30,idex(_("Default|#t")));fl_set_button_shortcut(obj,scex(_("Default|#t")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,20); - fdui->cm2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON,110,90,60,30,idex(_("cm|#m")));fl_set_button_shortcut(obj,scex(_("cm|#m")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,21); - fdui->in2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON,110,110,80,30,idex(_("inches|#h")));fl_set_button_shortcut(obj,scex(_("inches|#h")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,22); + fdui->page2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 130, 110, 30, idex(_("% of Page|#g")));fl_set_button_shortcut(obj, scex(_("% of Page|#g")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 23); + fdui->Default2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 70, 80, 30, idex(_("Default|#t")));fl_set_button_shortcut(obj, scex(_("Default|#t")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 20); + fdui->cm2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 90, 60, 30, idex(_("cm|#m")));fl_set_button_shortcut(obj, scex(_("cm|#m")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 21); + fdui->in2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 110, 80, 30, idex(_("inches|#h")));fl_set_button_shortcut(obj, scex(_("inches|#h")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 22); fl_end_group(); - obj = fl_add_text(FL_NORMAL_TEXT,237,50,53,20,_("Display")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->HeightLabel = obj = fl_add_text(FL_NORMAL_TEXT,120,50,60,20,_("Height")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->WidthLabel = obj = fl_add_text(FL_NORMAL_TEXT,20,50,60,20,_("Width")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - obj = fl_add_text(FL_NORMAL_TEXT,20,230,90,30,_("Rotation")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 237, 50, 53, 20, _("Display")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->HeightLabel = obj = fl_add_text(FL_NORMAL_TEXT, 120, 50, 60, 20, _("Height")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->WidthLabel = obj = fl_add_text(FL_NORMAL_TEXT, 20, 50, 60, 20, _("Width")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 230, 90, 30, _("Rotation")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fdui->DisplayGrp = fl_bgn_group(); - fdui->Wysiwyg3 = obj = fl_add_checkbutton(FL_RADIO_BUTTON,230,130,180,30,idex(_("Display in Color|#D")));fl_set_button_shortcut(obj,scex(_("Display in Color|#D")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,63); - fdui->Wysiwyg0 = obj = fl_add_checkbutton(FL_RADIO_BUTTON,230,160,180,30,idex(_("Do not display this figure|#y")));fl_set_button_shortcut(obj,scex(_("Do not display this figure|#y")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,3); - fdui->Wysiwyg2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON,230,100,180,30,idex(_("Display as Grayscale|#i")));fl_set_button_shortcut(obj,scex(_("Display as Grayscale|#i")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,43); - fdui->Wysiwyg1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON,230,70,180,30,idex(_("Display as Monochrome|#s")));fl_set_button_shortcut(obj,scex(_("Display as Monochrome|#s")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,33); + fdui->Wysiwyg3 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 230, 130, 180, 30, idex(_("Display in Color|#D")));fl_set_button_shortcut(obj, scex(_("Display in Color|#D")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 63); + fdui->Wysiwyg0 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 230, 160, 180, 30, idex(_("Do not display this figure|#y")));fl_set_button_shortcut(obj, scex(_("Do not display this figure|#y")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 3); + fdui->Wysiwyg2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 230, 100, 180, 30, idex(_("Display as Grayscale|#i")));fl_set_button_shortcut(obj, scex(_("Display as Grayscale|#i")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 43); + fdui->Wysiwyg1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 230, 70, 180, 30, idex(_("Display as Monochrome|#s")));fl_set_button_shortcut(obj, scex(_("Display as Monochrome|#s")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 33); fl_end_group(); fdui->WidthGrp = fl_bgn_group(); - fdui->Default1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,70,80,30,idex(_("Default|#U")));fl_set_button_shortcut(obj,scex(_("Default|#U")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,10); - fdui->cm1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,90,60,30,idex(_("cm|#c")));fl_set_button_shortcut(obj,scex(_("cm|#c")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,11); - fdui->in1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,110,80,30,idex(_("inches|#n")));fl_set_button_shortcut(obj,scex(_("inches|#n")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,12); + fdui->Default1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 70, 80, 30, idex(_("Default|#U")));fl_set_button_shortcut(obj, scex(_("Default|#U")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 10); + fdui->cm1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 90, 60, 30, idex(_("cm|#c")));fl_set_button_shortcut(obj, scex(_("cm|#c")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 11); + fdui->in1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 110, 80, 30, idex(_("inches|#n")));fl_set_button_shortcut(obj, scex(_("inches|#n")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 12); // xgettext:no-c-format - fdui->page1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,130,110,30,idex(_("% of Page|#P")));fl_set_button_shortcut(obj,scex(_("% of Page|#P")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,13); + fdui->page1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 130, 110, 30, idex(_("% of Page|#P")));fl_set_button_shortcut(obj, scex(_("% of Page|#P")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 13); // xgettext:no-c-format - fdui->column1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,150,110,30,idex(_("% of Column|#o")));fl_set_button_shortcut(obj,scex(_("% of Column|#o")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,14); + fdui->column1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 150, 110, 30, idex(_("% of Column|#o")));fl_set_button_shortcut(obj, scex(_("% of Column|#o")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 14); fl_end_group(); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,310,400,30,""); - fdui->Subcaption = obj = fl_add_input(FL_NORMAL_INPUT,150,310,260,30,idex(_("Caption|#k")));fl_set_button_shortcut(obj,scex(_("Caption|#k")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,2); - fdui->Subfigure = obj = fl_add_checkbutton(FL_PUSH_BUTTON,10,310,90,30,idex(_("Subfigure|#q")));fl_set_button_shortcut(obj,scex(_("Subfigure|#q")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,GraphicsCB,70); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 310, 400, 30, ""); + fdui->Subcaption = obj = fl_add_input(FL_NORMAL_INPUT, 150, 310, 260, 30, idex(_("Caption|#k")));fl_set_button_shortcut(obj, scex(_("Caption|#k")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 2); + fdui->Subfigure = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 310, 90, 30, idex(_("Subfigure|#q")));fl_set_button_shortcut(obj, scex(_("Subfigure|#q")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, GraphicsCB, 70); fl_end_form(); //fdui->Figure->fdui = fdui; @@ -224,47 +224,47 @@ FD_FileDlg *create_form_FileDlg(void) FD_FileDlg *fdui = (FD_FileDlg *) fl_calloc(1, sizeof(FD_FileDlg)); fdui->FileDlg = fl_bgn_form(FL_NO_BOX, 440, 380); - obj = fl_add_box(FL_UP_BOX,0,0,440,380,""); - fdui->FileInfo = obj = fl_add_text(FL_NORMAL_TEXT,10,260,420,30,""); - fl_set_object_boxtype(obj,FL_SHADOW_BOX); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + obj = fl_add_box(FL_UP_BOX, 0, 0, 440, 380, ""); + fdui->FileInfo = obj = fl_add_text(FL_NORMAL_TEXT, 10, 260, 420, 30, ""); + fl_set_object_boxtype(obj, FL_SHADOW_BOX); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->DirBox = obj = fl_add_input(FL_NORMAL_INPUT,100,10,330,30,idex(_("Directory:|#D")));fl_set_button_shortcut(obj,scex(_("Directory:|#D")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->DirBox = obj = fl_add_input(FL_NORMAL_INPUT, 100, 10, 330, 30, idex(_("Directory:|#D")));fl_set_button_shortcut(obj, scex(_("Directory:|#D")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->PatBox = obj = fl_add_input(FL_NORMAL_INPUT,100,40,330,30,idex(_("Pattern:|#P")));fl_set_button_shortcut(obj,scex(_("Pattern:|#P")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->PatBox = obj = fl_add_input(FL_NORMAL_INPUT, 100, 40, 330, 30, idex(_("Pattern:|#P")));fl_set_button_shortcut(obj, scex(_("Pattern:|#P")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->List = obj = fl_add_browser(FL_HOLD_BROWSER,10,80,320,170,""); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_TOP); + fdui->List = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 80, 320, 170, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP); fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast); - fdui->Filename = obj = fl_add_input(FL_NORMAL_INPUT,100,300,330,30,idex(_("Filename:|#F")));fl_set_button_shortcut(obj,scex(_("Filename:|#F")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->Filename = obj = fl_add_input(FL_NORMAL_INPUT, 100, 300, 330, 30, idex(_("Filename:|#F")));fl_set_button_shortcut(obj, scex(_("Filename:|#F")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->Rescan = obj = fl_add_button(FL_NORMAL_BUTTON,340,80,90,30,idex(_("Rescan|#R#r")));fl_set_button_shortcut(obj,scex(_("Rescan|#R#r")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->Rescan = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 80, 90, 30, idex(_("Rescan|#R#r")));fl_set_button_shortcut(obj, scex(_("Rescan|#R#r")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast); - fdui->Home = obj = fl_add_button(FL_NORMAL_BUTTON,340,120,90,30,idex(_("Home|#H#h")));fl_set_button_shortcut(obj,scex(_("Home|#H#h")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->Home = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 120, 90, 30, idex(_("Home|#H#h")));fl_set_button_shortcut(obj, scex(_("Home|#H#h")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast); - fdui->User1 = obj = fl_add_button(FL_NORMAL_BUTTON,340,160,90,30,idex(_("User1|#1")));fl_set_button_shortcut(obj,scex(_("User1|#1")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->User1 = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 160, 90, 30, idex(_("User1|#1")));fl_set_button_shortcut(obj, scex(_("User1|#1")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast); - fdui->User2 = obj = fl_add_button(FL_NORMAL_BUTTON,340,200,90,30,idex(_("User2|#2")));fl_set_button_shortcut(obj,scex(_("User2|#2")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->User2 = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 200, 90, 30, idex(_("User2|#2")));fl_set_button_shortcut(obj, scex(_("User2|#2")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast); - fdui->Ready = obj = fl_add_button(FL_RETURN_BUTTON,220,340,100,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->Ready = obj = fl_add_button(FL_RETURN_BUTTON, 220, 340, 100, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fdui->Cancel = obj = fl_add_button(FL_NORMAL_BUTTON,330,340,100,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->Cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 330, 340, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fdui->timer = obj = fl_add_timer(FL_HIDDEN_TIMER,10,350,20,20,""); + fdui->timer = obj = fl_add_timer(FL_HIDDEN_TIMER, 10, 350, 20, 20, ""); fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest); fl_end_form(); @@ -280,23 +280,23 @@ FD_form_table *create_form_form_table(void) FD_form_table *fdui = (FD_form_table *) fl_calloc(1, sizeof(FD_form_table)); fdui->form_table = fl_bgn_form(FL_NO_BOX, 310, 130); - obj = fl_add_box(FL_UP_BOX,0,0,310,130,""); - fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON,10,90,90,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,TableOKCB,0); - fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON,110,90,90,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,TableApplyCB,0); - fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON,210,90,90,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,TableCancelCB,0); - fdui->slider_columns = obj = fl_add_valslider(FL_HOR_SLIDER,80,50,220,30,_("Columns")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT); + obj = fl_add_box(FL_UP_BOX, 0, 0, 310, 130, ""); + fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 10, 90, 90, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, TableOKCB, 0); + fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 90, 90, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, TableApplyCB, 0); + fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 210, 90, 90, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, TableCancelCB, 0); + fdui->slider_columns = obj = fl_add_valslider(FL_HOR_SLIDER, 80, 50, 220, 30, _("Columns")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->slider_rows = obj = fl_add_valslider(FL_HOR_SLIDER,80,10,220,30,_("Rows")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT); + fdui->slider_rows = obj = fl_add_valslider(FL_HOR_SLIDER, 80, 10, 220, 30, _("Rows")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT); fl_set_object_resize(obj, FL_RESIZE_X); fl_end_form(); @@ -312,41 +312,41 @@ FD_form_search *create_form_form_search(void) FD_form_search *fdui = (FD_form_search *) fl_calloc(1, sizeof(FD_form_search)); fdui->form_search = fl_bgn_form(FL_NO_BOX, 440, 160); - obj = fl_add_box(FL_UP_BOX,0,0,440,160,""); - obj = fl_add_frame(FL_ENGRAVED_FRAME,300,10,130,80,""); + obj = fl_add_box(FL_UP_BOX, 0, 0, 440, 160, ""); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 300, 10, 130, 80, ""); fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast); - fdui->input_search = obj = fl_add_input(FL_NORMAL_INPUT,110,10,180,30,idex(_("Find|#n")));fl_set_button_shortcut(obj,scex(_("Find|#n")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->input_search = obj = fl_add_input(FL_NORMAL_INPUT, 110, 10, 180, 30, idex(_("Find|#n")));fl_set_button_shortcut(obj, scex(_("Find|#n")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->input_replace = obj = fl_add_input(FL_NORMAL_INPUT,110,40,180,30,idex(_("Replace with|#W")));fl_set_button_shortcut(obj,scex(_("Replace with|#W")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->input_replace = obj = fl_add_input(FL_NORMAL_INPUT, 110, 40, 180, 30, idex(_("Replace with|#W")));fl_set_button_shortcut(obj, scex(_("Replace with|#W")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); - obj = fl_add_button(FL_NORMAL_BUTTON,200,80,90,30,idex(_("@>|#F")));fl_set_button_shortcut(obj,scex(_("@>|#F")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_button(FL_NORMAL_BUTTON, 200, 80, 90, 30, idex(_("@>|#F")));fl_set_button_shortcut(obj, scex(_("@>|#F")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,SearchForwardCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,110,80,90,30,idex(_("@<|#B")));fl_set_button_shortcut(obj,scex(_("@<|#B")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, SearchForwardCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 110, 80, 90, 30, idex(_("@<|#B")));fl_set_button_shortcut(obj, scex(_("@<|#B")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,SearchBackwardCB,0); - fdui->replace_button = obj = fl_add_button(FL_NORMAL_BUTTON,110,120,90,30,idex(_("Replace|#R#r")));fl_set_button_shortcut(obj,scex(_("Replace|#R#r")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, SearchBackwardCB, 0); + fdui->replace_button = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 120, 90, 30, idex(_("Replace|#R#r")));fl_set_button_shortcut(obj, scex(_("Replace|#R#r")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,SearchReplaceCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,350,120,80,30,idex(_("Close|^[")));fl_set_button_shortcut(obj,scex(_("Close|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, SearchReplaceCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 350, 120, 80, 30, idex(_("Close|^[")));fl_set_button_shortcut(obj, scex(_("Close|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,SearchCancelCB,0); - fdui->btnCaseSensitive = obj = fl_add_checkbutton(FL_PUSH_BUTTON,300,20,150,30,idex(_("Case sensitive|#s#S")));fl_set_button_shortcut(obj,scex(_("Case sensitive|#s#S")),1); + fl_set_object_callback(obj, SearchCancelCB, 0); + fdui->btnCaseSensitive = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 300, 20, 150, 30, idex(_("Case sensitive|#s#S")));fl_set_button_shortcut(obj, scex(_("Case sensitive|#s#S")), 1); fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast); - fdui->btnMatchWord = obj = fl_add_checkbutton(FL_PUSH_BUTTON,300,50,150,30,idex(_("Match word|#M#m")));fl_set_button_shortcut(obj,scex(_("Match word|#M#m")),1); + fdui->btnMatchWord = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 300, 50, 150, 30, idex(_("Match word|#M#m")));fl_set_button_shortcut(obj, scex(_("Match word|#M#m")), 1); fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast); - fdui->replaceall_button = obj = fl_add_button(FL_NORMAL_BUTTON,200,120,90,30,idex(_("Replace All|#A#a")));fl_set_button_shortcut(obj,scex(_("Replace All|#A#a")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->replaceall_button = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 120, 90, 30, idex(_("Replace All|#A#a")));fl_set_button_shortcut(obj, scex(_("Replace All|#A#a")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,SearchReplaceAllCB,0); + fl_set_object_callback(obj, SearchReplaceAllCB, 0); fl_end_form(); //fdui->form_search->fdui = fdui; diff --git a/src/intl.C b/src/intl.C index 6e4f662ae9..86d1860d07 100644 --- a/src/intl.C +++ b/src/intl.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ /* * International support for LyX @@ -29,10 +29,10 @@ #include "trans_mgr.h" #include "support/lstrings.h" -extern LyXRC* lyxrc; +extern LyXRC * lyxrc; // a wrapper around the callback static member. -extern "C" void C_Intl_DispatchCallback(FL_OBJECT *ob,long code); +extern "C" void C_Intl_DispatchCallback(FL_OBJECT * ob, long code); Intl::Intl() @@ -71,23 +71,23 @@ int Intl::SetSecondary(string const & lang) void Intl::update() { - int off,prim,sec; + int off, prim, sec; - off=prim=sec=0; + off = prim = sec = 0; if (!keymapon) { - off=1; + off = 1; } else { if (primarykeymap) { - prim=1; + prim = 1; } else { - sec=1; + sec = 1; } } - fl_set_button(fd_form_keymap->KeyOffBtn,off); - fl_set_button(fd_form_keymap->KeyOnBtn,prim); - fl_set_button(fd_form_keymap->KeyOnBtn2,sec); + fl_set_button(fd_form_keymap->KeyOffBtn, off); + fl_set_button(fd_form_keymap->KeyOnBtn, prim); + fl_set_button(fd_form_keymap->KeyOnBtn2, sec); } @@ -165,19 +165,17 @@ void Intl::KeyMapPrim() void Intl::KeyMapSec() { - int i; - string p; - fl_set_button(fd_form_keymap->KeyOffBtn, 0); fl_set_button(fd_form_keymap->KeyOnBtn, 0); fl_set_button(fd_form_keymap->KeyOnBtn2, 1); /* read text from choice */ - i = Language2->get(); + int i = Language2->get(); if (lyxerr.debugging(Debug::KBMAP)) lyxerr << "Table: " << tex_babel[i-1] << endl; + string p; if (i == otherkeymap) p = fl_get_input(fd_form_keymap->OtherKeymap2); else @@ -198,23 +196,23 @@ void Intl::KeyMapSec() } -void Intl::LCombo(int, void *v) +void Intl::LCombo(int, void * v) { - Intl *itl = (Intl*) v; + Intl * itl = static_cast(v); itl->Keymap(23); return; } -void Intl::LCombo2(int, void *v) +void Intl::LCombo2(int, void * v) { - Intl *itl = (Intl*) v; + Intl * itl = static_cast(v); itl->Keymap(43); return; } -void Intl::DispatchCallback(FL_OBJECT *ob,long code) +void Intl::DispatchCallback(FL_OBJECT * ob, long code) { if (ob && (code == 0)) { fl_hide_form(ob->form); @@ -223,14 +221,14 @@ void Intl::DispatchCallback(FL_OBJECT *ob,long code) if (!ob || !(ob->u_vdata)) return; - Intl *itl=(Intl *)ob->u_vdata; + Intl * itl = static_cast(ob->u_vdata); - if (itl!=0) itl->Keymap(code); + if (itl!= 0) itl->Keymap(code); } -extern "C" void C_Intl_DispatchCallback(FL_OBJECT *ob,long code) +extern "C" void C_Intl_DispatchCallback(FL_OBJECT * ob, long code) { - Intl::DispatchCallback(ob,code); + Intl::DispatchCallback(ob, code); } void Intl::InitKeyMapper(bool on) @@ -245,34 +243,34 @@ void Intl::InitKeyMapper(bool on) Language = new Combox(FL_COMBOX_DROPLIST); Language2 = new Combox(FL_COMBOX_DROPLIST); - Language->setcallback(LCombo,this); - Language2->setcallback(LCombo2,this); + Language->setcallback(LCombo, this); + Language2->setcallback(LCombo2, this); fd_form_keymap = create_form_KeyMap(); // Add the Intl* pointer - fd_form_keymap->AcceptChset->u_vdata= - fd_form_keymap->Charset->u_vdata= - fd_form_keymap->Accept->u_vdata= - fd_form_keymap->OtherKeymap->u_vdata= - fd_form_keymap->KeyOnBtn->u_vdata= - fd_form_keymap->KeyOffBtn->u_vdata= - fd_form_keymap->KeyOnBtn2->u_vdata=(void *)this; + fd_form_keymap->AcceptChset->u_vdata = + fd_form_keymap->Charset->u_vdata = + fd_form_keymap->Accept->u_vdata = + fd_form_keymap->OtherKeymap->u_vdata = + fd_form_keymap->KeyOnBtn->u_vdata = + fd_form_keymap->KeyOffBtn->u_vdata = + fd_form_keymap->KeyOnBtn2->u_vdata = this; // add the callbacks. fl_set_object_callback(fd_form_keymap->AcceptChset, - C_Intl_DispatchCallback,27); + C_Intl_DispatchCallback, 27); fl_set_object_callback(fd_form_keymap->Charset, - C_Intl_DispatchCallback,26); + C_Intl_DispatchCallback, 26); fl_set_object_callback(fd_form_keymap->Accept, - C_Intl_DispatchCallback,0); + C_Intl_DispatchCallback, 0); fl_set_object_callback(fd_form_keymap->KeyOnBtn, - C_Intl_DispatchCallback,23); + C_Intl_DispatchCallback, 23); fl_set_object_callback(fd_form_keymap->KeyOffBtn, - C_Intl_DispatchCallback,3); + C_Intl_DispatchCallback, 3); fl_set_object_callback(fd_form_keymap->KeyOnBtn2, - C_Intl_DispatchCallback,43); + C_Intl_DispatchCallback, 43); // Make sure pressing the close box does not kill LyX. (RvdK) fl_set_form_atclose(fd_form_keymap->KeyMap, CancelCloseBoxCB, 0); @@ -283,11 +281,11 @@ void Intl::InitKeyMapper(bool on) // Adds two comboxes to the keyboard map fl_addto_form(fd_form_keymap->KeyMap); - Language->add(120,30,160,30,300); // Primary - Language2->add(120,110,160,30,300); // Secondary + Language->add(120, 30, 160, 30, 300); // Primary + Language2->add(120, 110, 160, 30, 300); // Secondary fl_end_form(); - int n=0; + int n = 0; while (true) if (!strlen(tex_babel[n])) @@ -325,8 +323,6 @@ void Intl::InitKeyMapper(bool on) void Intl::Keymap(long code) { - char const *p; - if (lyxerr.debugging(Debug::KBMAP)) lyxerr << "KeyMap callback: " << code << endl; @@ -338,22 +334,22 @@ void Intl::Keymap(long code) case 3: case 23: case 43: - if (code==3) { + if (code == 3) { KeyMapOn(false); return; } code -= 19; // change to language change type code case 4: // 4 and 24 will never be called directly, they will only be - case 24: // called through 3,23,43 (lgb) - if (code==4) { + case 24: // called through 3, 23, 43 (lgb) + if (code == 4) { KeyMapPrim(); } else { KeyMapSec(); } break; case 27: /* set new font norm */ - p = fl_get_input(fd_form_keymap->Charset); + char const * p = fl_get_input(fd_form_keymap->Charset); if (trans->setCharset(p)) fl_show_object(fd_form_keymap->ChsetErr); else diff --git a/src/intl.h b/src/intl.h index 97605c11e8..35bb46e3cb 100644 --- a/src/intl.h +++ b/src/intl.h @@ -65,7 +65,7 @@ public: /// char *chsetcode; /// - static void DispatchCallback(FL_OBJECT*,long); + static void DispatchCallback(FL_OBJECT*, long); private: /// //int SelectCharset(char const *code); diff --git a/src/kbmap.C b/src/kbmap.C index 02a6b9e742..a9f7e7a26a 100644 --- a/src/kbmap.C +++ b/src/kbmap.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include #include @@ -26,7 +26,7 @@ enum { ModsMask = ShiftMask | ControlMask | Mod1Mask}; -// === static functions =================================================== +// === static functions =================================================== /* ---F+------------------------------------------------------------------ *\ @@ -112,7 +112,7 @@ int printKeyTab( kb_key *tabPt, char *buf, int maxLen ) -// === kb_sequence methods ================================================ +// === kb_sequence methods ================================================ @@ -126,9 +126,9 @@ 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<0) length = 0; if(length+1 >= size) { unsigned int *nseq = new unsigned int[size+KB_PREALLOC]; @@ -176,36 +176,36 @@ int kb_sequence::parse(char const*s) if(s[i] && (s[i]) <= ' ') i++; if(!s[i]) break; - if(s[i+1]=='-') { // is implicit that s[i]==true + if(s[i+1] == '-') { // is implicit that s[i] == true switch(s[i]) { case 's': case 'S': mod |= ShiftMask; - i+=2; + i+= 2; continue; case 'c': case 'C': mod |= ControlMask; - i+=2; + i+= 2; continue; case 'm': case 'M': mod |= Mod1Mask; - i+=2; + i+= 2; continue; default: return i+1; } - } else if(s[i]=='~' && s[i+1] && s[i+2]=='-') { + } else if(s[i] == '~' && s[i+1] && s[i+2] == '-') { switch(s[i+1]) { case 's': case 'S': nmod |= ShiftMask; - i+=3; + i+= 3; continue; case 'c': case 'C': nmod |= ControlMask; - i+=3; + i+= 3; continue; case 'm': case 'M': nmod |= Mod1Mask; - i+=3; + i+= 3; continue; default: return i+2; @@ -300,7 +300,7 @@ int kb_sequence::printOptions(char *buf, int maxlen) const #warning reimplement kb_sequence using string #endif char s[20]; - strcpy(s,_(" options: ")); + strcpy(s, _(" options: ")); strcpy( buf, s); buf += strlen(s); maxlen -= strlen(s); @@ -337,7 +337,7 @@ void kb_sequence::delseq() KeySym kb_sequence::getsym() { int l = length; - if(l==0) return NoSymbol; + if(l == 0) return NoSymbol; if(l<0) l = -l; return sequence[l-1]; } @@ -377,7 +377,7 @@ void kb_sequence::reset() } -// === kb_keymap methods ================================================== +// === kb_keymap methods ================================================== // This binds a key to an action int kb_keymap::bind(char const *seq, int action) @@ -509,7 +509,7 @@ 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*/) { int tsize; unsigned int code, modmsk; @@ -546,7 +546,7 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*=0*/) // --- check if key is already there -------------------------------- kb_key *t; - for(t = tab, tsize=1; t->code != NoSymbol; t++, tsize++) { + for(t = tab, tsize = 1; t->code != NoSymbol; t++, tsize++) { if(code == t->code && modmsk == t->mod) { // -- overwrite binding --- if(idx+1 == seq->length) { char buf[20]; buf[0] = 0; @@ -585,7 +585,7 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*=0*/) *ptab = nt; delete[] tab; tab = nt; - if(size>=0) size = tsize+KB_PREALLOC; + if(size>= 0) size = tsize+KB_PREALLOC; } // --- add action --------------------------------------------------- @@ -597,7 +597,7 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*=0*/) // --- convert list to hash table if necessary ---------------------- - if(size>=0 && tsize>=32) { + if(size>= 0 && tsize>= 32) { kb_key *oldtab = tab; kb_key **nht = new kb_key*[KB_HASHSIZE]; for(int i = 0; i < KB_HASHSIZE; i++) @@ -666,7 +666,7 @@ kb_keymap::~kb_keymap() { if(!table) return; if(size<0) { - for(int i=0; i < KB_HASHSIZE; i++) { + for(int i = 0; i < KB_HASHSIZE; i++) { if(htable[i]) { for(kb_key *t = htable[i]; t->code != NoSymbol; t++) if(t->table) @@ -696,7 +696,7 @@ string kb_keymap::findbinding(int act) const { return res; if (size<0) { - for(int i=0; i < KB_HASHSIZE; i++) { + for(int i = 0; i < KB_HASHSIZE; i++) { if(htable[i]) { for(kb_key *t = htable[i]; t->code != NoSymbol; t++) { if(t->table) { diff --git a/src/lastfiles.C b/src/lastfiles.C index 6497f8998e..7a08ac16d2 100644 --- a/src/lastfiles.C +++ b/src/lastfiles.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -40,7 +40,7 @@ void LastFiles::setNumberOfFiles(unsigned int no) num_files = no; else { lyxerr << "LyX: lastfiles: too many files\n" - "\tdefault (=" << int(DEFAULTFILES) + "\tdefault (= " << int(DEFAULTFILES) << ") used." << endl; num_files = DEFAULTFILES; } diff --git a/src/lastfiles.h b/src/lastfiles.h index 9faf6b88a5..163ba40a11 100644 --- a/src/lastfiles.h +++ b/src/lastfiles.h @@ -1,6 +1,6 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * diff --git a/src/latexoptions.C b/src/latexoptions.C index e13e552591..3571c3060b 100644 --- a/src/latexoptions.C +++ b/src/latexoptions.C @@ -15,18 +15,18 @@ FD_LaTeXOptions *create_form_LaTeXOptions(void) FD_LaTeXOptions *fdui = (FD_LaTeXOptions *) fl_calloc(1, sizeof(FD_LaTeXOptions)); fdui->LaTeXOptions = fl_bgn_form(FL_NO_BOX, 310, 90); - obj = fl_add_box(FL_UP_BOX,0,0,310,90,""); - fdui->accents = obj = fl_add_checkbutton(FL_PUSH_BUTTON,10,10,310,30,idex(_("Allow accents on ALL characters|#w")));fl_set_button_shortcut(obj,scex(_("Allow accents on ALL characters|#w")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - obj = fl_add_button(FL_RETURN_BUTTON,10,50,90,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,LaTeXOptionsOK,0); - obj = fl_add_button(FL_NORMAL_BUTTON,110,50,90,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,LaTeXOptionsApply,0); - obj = fl_add_button(FL_NORMAL_BUTTON,210,50,90,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,LaTeXOptionsCancel,0); + obj = fl_add_box(FL_UP_BOX, 0, 0, 310, 90, ""); + fdui->accents = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 10, 310, 30, idex(_("Allow accents on ALL characters|#w")));fl_set_button_shortcut(obj, scex(_("Allow accents on ALL characters|#w")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + obj = fl_add_button(FL_RETURN_BUTTON, 10, 50, 90, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, LaTeXOptionsOK, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 110, 50, 90, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, LaTeXOptionsApply, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 210, 50, 90, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, LaTeXOptionsCancel, 0); fl_end_form(); //fdui->LaTeXOptions->fdui = fdui; @@ -41,17 +41,17 @@ FD_LaTeXLog *create_form_LaTeXLog(void) FD_LaTeXLog *fdui = (FD_LaTeXLog *) fl_calloc(1, sizeof(FD_LaTeXLog)); fdui->LaTeXLog = fl_bgn_form(FL_NO_BOX, 470, 380); - obj = fl_add_box(FL_UP_BOX,0,0,470,380,""); - fdui->browser_latexlog = obj = fl_add_browser(FL_NORMAL_BROWSER,10,10,450,320,""); + obj = fl_add_box(FL_UP_BOX, 0, 0, 470, 380, ""); + fdui->browser_latexlog = obj = fl_add_browser(FL_NORMAL_BROWSER, 10, 10, 450, 320, ""); fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast); - obj = fl_add_button(FL_RETURN_BUTTON,270,340,90,30,_("Close")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_button(FL_RETURN_BUTTON, 270, 340, 90, 30, _("Close")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,LatexLogClose,0); - obj = fl_add_button(FL_NORMAL_BUTTON,370,340,90,30,idex(_("Update|#Uu")));fl_set_button_shortcut(obj,scex(_("Update|#Uu")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, LatexLogClose, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 370, 340, 90, 30, idex(_("Update|#Uu")));fl_set_button_shortcut(obj, scex(_("Update|#Uu")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,LatexLogUpdate,0); + fl_set_object_callback(obj, LatexLogUpdate, 0); fl_end_form(); //fdui->LaTeXLog->fdui = fdui; diff --git a/src/layout.C b/src/layout.C index a21afbd0a9..a90d2ecb49 100644 --- a/src/layout.C +++ b/src/layout.C @@ -1,5 +1,5 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * @@ -18,7 +18,6 @@ using std::make_pair; using std::sort; -#include "definitions.h" #include "layout.h" #include "lyxlex.h" #include "support/filetools.h" @@ -240,7 +239,7 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) if (lexrc.next()) { if (tclass.hasLayout(lexrc.GetString())) { string tmpname = name_; - this->operator=(tclass.GetLayout(lexrc.GetString())); + this->operator= (tclass.GetLayout(lexrc.GetString())); name_ = tmpname; } else { lexrc.printError("Cannot copy known " @@ -253,7 +252,7 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) if (lexrc.next()) { if (tclass.hasLayout(lexrc.GetString())) { string tmpname = name_; - this->operator=(tclass.GetLayout(lexrc.GetString())); + this->operator= (tclass.GetLayout(lexrc.GetString())); name_ = tmpname; if (obsoleted_by().empty()) obsoleted_by_ = lexrc.GetString(); @@ -292,19 +291,19 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) case LT_LATEXTYPE: // Latex style definition. switch (lexrc.lex()) { case LT_PARAGRAPH: - latextype=LATEX_PARAGRAPH; + latextype= LATEX_PARAGRAPH; break; case LT_COMMAND: - latextype=LATEX_COMMAND; + latextype= LATEX_COMMAND; break; case LT_ENVIRONMENT: - latextype=LATEX_ENVIRONMENT; + latextype= LATEX_ENVIRONMENT; break; case LT_ITEM_ENVIRONMENT: - latextype=LATEX_ITEM_ENVIRONMENT; + latextype= LATEX_ITEM_ENVIRONMENT; break; case LT_LIST_ENVIRONMENT: - latextype=LATEX_LIST_ENVIRONMENT; + latextype= LATEX_LIST_ENVIRONMENT; break; default: lexrc.printError("Unknown latextype `$$Token'"); @@ -326,7 +325,7 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) case LT_FONT: font.lyxRead(lexrc); - labelfont=font; + labelfont= font; break; case LT_TEXTFONT: @@ -694,7 +693,7 @@ bool LyXTextClass::Read(string const & filename, bool merge) } else { LyXLayout lay; lay.name(name); - if (!(error =do_readStyle(lexrc, lay))) + if (!(error = do_readStyle(lexrc, lay))) layoutlist.push_back(lay); } } diff --git a/src/layout.h b/src/layout.h index 9096380633..6996913e72 100644 --- a/src/layout.h +++ b/src/layout.h @@ -20,7 +20,6 @@ using std::vector; using std::pair; -#include "definitions.h" #include "lyxlex.h" #include "lyxfont.h" #include "Spacing.h" @@ -28,6 +27,18 @@ using std::pair; /// Reads the style files extern void LyXSetStyle(); +/// +enum { // no good name for this + /// + LYX_ENVIRONMENT_DEFAULT = 97, + /// + LYX_LAYOUT_DEFAULT = 99 +}; +// Could this cause confusion that both DUMMY_LAYOUT and LAYOUT_DEFAULT has +// the same value? (Lgb) +/// +#define LYX_DUMMY_LAYOUT 99 + /// The different output types enum OutputType { /// diff --git a/src/layout_forms.C b/src/layout_forms.C index 871b2f5488..c94619e529 100644 --- a/src/layout_forms.C +++ b/src/layout_forms.C @@ -15,174 +15,174 @@ FD_form_document *create_form_form_document(void) FD_form_document *fdui = (FD_form_document *) fl_calloc(1, sizeof(FD_form_document)); fdui->form_document = fl_bgn_form(FL_NO_BOX, 580, 430); - obj = fl_add_box(FL_UP_BOX,0,0,580,430,""); + obj = fl_add_box(FL_UP_BOX, 0, 0, 580, 430, ""); fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast); - obj = fl_add_frame(FL_ENGRAVED_FRAME,290,110,120,70,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 290, 110, 120, 70, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - obj = fl_add_text(FL_NORMAL_TEXT,300,100,100,20,_("Separation")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 300, 100, 100, 20, _("Separation")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); fdui->group_radio_separation = fl_bgn_group(); - fdui->radio_indent = obj = fl_add_checkbutton(FL_RADIO_BUTTON,290,120,110,30,idex(_("Indent|#I")));fl_set_button_shortcut(obj,scex(_("Indent|#I")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_indent = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 290, 120, 110, 30, idex(_("Indent|#I")));fl_set_button_shortcut(obj, scex(_("Indent|#I")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->radio_skip = obj = fl_add_checkbutton(FL_RADIO_BUTTON,290,150,110,30,idex(_("Skip|#K")));fl_set_button_shortcut(obj,scex(_("Skip|#K")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_skip = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 290, 150, 110, 30, idex(_("Skip|#K")));fl_set_button_shortcut(obj, scex(_("Skip|#K")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); fl_end_group(); - fdui->choice_class = obj = fl_add_choice(FL_NORMAL_CHOICE,120,20,160,30,idex(_("Class:|#C")));fl_set_button_shortcut(obj,scex(_("Class:|#C")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->choice_class = obj = fl_add_choice(FL_NORMAL_CHOICE, 120, 20, 160, 30, idex(_("Class:|#C")));fl_set_button_shortcut(obj, scex(_("Class:|#C")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fl_set_object_callback(obj,ChoiceClassCB,0); - fdui->choice_pagestyle = obj = fl_add_choice(FL_NORMAL_CHOICE,120,60,160,30,idex(_("Pagestyle:|#P")));fl_set_button_shortcut(obj,scex(_("Pagestyle:|#P")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, ChoiceClassCB, 0); + fdui->choice_pagestyle = obj = fl_add_choice(FL_NORMAL_CHOICE, 120, 60, 160, 30, idex(_("Pagestyle:|#P")));fl_set_button_shortcut(obj, scex(_("Pagestyle:|#P")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->choice_fonts = obj = fl_add_choice(FL_NORMAL_CHOICE,120,110,160,30,idex(_("Fonts:|#F")));fl_set_button_shortcut(obj,scex(_("Fonts:|#F")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->choice_fonts = obj = fl_add_choice(FL_NORMAL_CHOICE, 120, 110, 160, 30, idex(_("Fonts:|#F")));fl_set_button_shortcut(obj, scex(_("Fonts:|#F")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->choice_fontsize = obj = fl_add_choice(FL_NORMAL_CHOICE,120,150,160,30,idex(_("Font Size:|#O")));fl_set_button_shortcut(obj,scex(_("Font Size:|#O")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->choice_fontsize = obj = fl_add_choice(FL_NORMAL_CHOICE, 120, 150, 160, 30, idex(_("Font Size:|#O")));fl_set_button_shortcut(obj, scex(_("Font Size:|#O")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON,470,390,100,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 470, 390, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,DocumentCancelCB,0); - fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON,360,390,100,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, DocumentCancelCB, 0); + fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 360, 390, 100, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,DocumentApplyCB,0); - fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON,250,390,100,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, DocumentApplyCB, 0); + fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 250, 390, 100, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,DocumentOKCB,0); - fdui->input_float_placement = obj = fl_add_input(FL_NORMAL_INPUT,450,195,120,30,idex(_("Float Placement:|#L")));fl_set_button_shortcut(obj,scex(_("Float Placement:|#L")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, DocumentOKCB, 0); + fdui->input_float_placement = obj = fl_add_input(FL_NORMAL_INPUT, 450, 195, 120, 30, idex(_("Float Placement:|#L")));fl_set_button_shortcut(obj, scex(_("Float Placement:|#L")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->choice_postscript_driver = obj = fl_add_choice(FL_NORMAL_CHOICE,120,230,190,30,idex(_("PS Driver:|#S")));fl_set_button_shortcut(obj,scex(_("PS Driver:|#S")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->choice_postscript_driver = obj = fl_add_choice(FL_NORMAL_CHOICE, 120, 230, 190, 30, idex(_("PS Driver:|#S")));fl_set_button_shortcut(obj, scex(_("PS Driver:|#S")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->choice_inputenc = obj = fl_add_choice(FL_NORMAL_CHOICE,120,270,190,30,idex(_("Encoding:|#D")));fl_set_button_shortcut(obj,scex(_("Encoding:|#D")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->choice_inputenc = obj = fl_add_choice(FL_NORMAL_CHOICE, 120, 270, 190, 30, idex(_("Encoding:|#D")));fl_set_button_shortcut(obj, scex(_("Encoding:|#D")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - obj = fl_add_frame(FL_ENGRAVED_FRAME,290,20,122,70,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 290, 20, 122, 70, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - obj = fl_add_frame(FL_ENGRAVED_FRAME,432,20,136,70,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 432, 20, 136, 70, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); fdui->group_radio_sides = fl_bgn_group(); - fdui->radio_sides_one = obj = fl_add_checkbutton(FL_RADIO_BUTTON,290,30,120,30,idex(_("One|#n")));fl_set_button_shortcut(obj,scex(_("One|#n")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_sides_one = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 290, 30, 120, 30, idex(_("One|#n")));fl_set_button_shortcut(obj, scex(_("One|#n")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->radio_sides_two = obj = fl_add_checkbutton(FL_RADIO_BUTTON,290,60,120,30,idex(_("Two|#T")));fl_set_button_shortcut(obj,scex(_("Two|#T")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_sides_two = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 290, 60, 120, 30, idex(_("Two|#T")));fl_set_button_shortcut(obj, scex(_("Two|#T")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); fl_end_group(); - obj = fl_add_text(FL_NORMAL_TEXT,300,10,60,20,_("Sides")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 300, 10, 60, 20, _("Sides")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - obj = fl_add_text(FL_NORMAL_TEXT,440,10,80,20,_("Columns")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 440, 10, 80, 20, _("Columns")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); fdui->group_radio_columns = fl_bgn_group(); - fdui->radio_columns_one = obj = fl_add_checkbutton(FL_RADIO_BUTTON,432,30,110,30,idex(_("One|#e")));fl_set_button_shortcut(obj,scex(_("One|#e")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_columns_one = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 432, 30, 110, 30, idex(_("One|#e")));fl_set_button_shortcut(obj, scex(_("One|#e")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->radio_columns_two = obj = fl_add_checkbutton(FL_RADIO_BUTTON,432,60,110,30,idex(_("Two|#w")));fl_set_button_shortcut(obj,scex(_("Two|#w")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_columns_two = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 432, 60, 110, 30, idex(_("Two|#w")));fl_set_button_shortcut(obj, scex(_("Two|#w")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); fl_end_group(); - fdui->input_extra = obj = fl_add_input(FL_NORMAL_INPUT,450,235,120,30,idex(_("Extra Options:|#X")));fl_set_button_shortcut(obj,scex(_("Extra Options:|#X")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->input_extra = obj = fl_add_input(FL_NORMAL_INPUT, 450, 235, 120, 30, idex(_("Extra Options:|#X")));fl_set_button_shortcut(obj, scex(_("Extra Options:|#X")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->choice_language = obj = fl_add_box(FL_FRAME_BOX,120,190,190,30,_("Language:")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT); + fdui->choice_language = obj = fl_add_box(FL_FRAME_BOX, 120, 190, 190, 30, _("Language:")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->input_default_skip = obj = fl_add_input(FL_NORMAL_INPUT,220,310,90,30,""); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->input_default_skip = obj = fl_add_input(FL_NORMAL_INPUT, 220, 310, 90, 30, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fl_set_object_callback(obj,DocumentDefskipCB,0); - fdui->choice_default_skip = obj = fl_add_choice(FL_NORMAL_CHOICE,120,310,90,30,idex(_("Default Skip:|#u")));fl_set_button_shortcut(obj,scex(_("Default Skip:|#u")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, DocumentDefskipCB, 0); + fdui->choice_default_skip = obj = fl_add_choice(FL_NORMAL_CHOICE, 120, 310, 90, 30, idex(_("Default Skip:|#u")));fl_set_button_shortcut(obj, scex(_("Default Skip:|#u")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fl_set_object_callback(obj,DocumentDefskipCB,0); - fdui->slider_secnumdepth = obj = fl_add_counter(FL_SIMPLE_COUNTER,490,275,80,30,_("Section number depth")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT); + fl_set_object_callback(obj, DocumentDefskipCB, 0); + fdui->slider_secnumdepth = obj = fl_add_counter(FL_SIMPLE_COUNTER, 490, 275, 80, 30, _("Section number depth")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->slider_tocdepth = obj = fl_add_counter(FL_SIMPLE_COUNTER,490,315,80,30,_("Table of contents depth")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT); + fdui->slider_tocdepth = obj = fl_add_counter(FL_SIMPLE_COUNTER, 490, 315, 80, 30, _("Table of contents depth")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->choice_spacing = obj = fl_add_choice(FL_NORMAL_CHOICE,120,350,120,30,idex(_("Spacing|#g")));fl_set_button_shortcut(obj,scex(_("Spacing|#g")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->choice_spacing = obj = fl_add_choice(FL_NORMAL_CHOICE, 120, 350, 120, 30, idex(_("Spacing|#g")));fl_set_button_shortcut(obj, scex(_("Spacing|#g")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fl_set_object_callback(obj,DocumentSpacingCB,0); - fdui->button_bullets = obj = fl_add_button(FL_NORMAL_BUTTON,430,110,130,30,idex(_("Bullet Shapes|#B")));fl_set_button_shortcut(obj,scex(_("Bullet Shapes|#B")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, DocumentSpacingCB, 0); + fdui->button_bullets = obj = fl_add_button(FL_NORMAL_BUTTON, 430, 110, 130, 30, idex(_("Bullet Shapes|#B")));fl_set_button_shortcut(obj, scex(_("Bullet Shapes|#B")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fl_set_object_callback(obj,DocumentBulletsCB,0); - fdui->check_use_amsmath = obj = fl_add_checkbutton(FL_PUSH_BUTTON,430,145,120,30,idex(_("Use AMS Math|#M")));fl_set_button_shortcut(obj,scex(_("Use AMS Math|#M")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, DocumentBulletsCB, 0); + fdui->check_use_amsmath = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 430, 145, 120, 30, idex(_("Use AMS Math|#M")));fl_set_button_shortcut(obj, scex(_("Use AMS Math|#M")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fdui->input_spacing = obj = fl_add_input(FL_FLOAT_INPUT,250,350,95,30,""); + fdui->input_spacing = obj = fl_add_input(FL_FLOAT_INPUT, 250, 350, 95, 30, ""); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_NONE); - fl_set_object_callback(obj,DocumentSpacingCB,0); + fl_set_object_callback(obj, DocumentSpacingCB, 0); fl_end_form(); //fdui->form_document->fdui = fdui; @@ -197,66 +197,66 @@ FD_form_character *create_form_form_character(void) FD_form_character *fdui = (FD_form_character *) fl_calloc(1, sizeof(FD_form_character)); fdui->form_character = fl_bgn_form(FL_NO_BOX, 300, 375); - obj = fl_add_box(FL_UP_BOX,0,0,300,375,""); + obj = fl_add_box(FL_UP_BOX, 0, 0, 300, 375, ""); fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,280,280,45,""); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 280, 280, 45, ""); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,220,280,45,""); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 220, 280, 45, ""); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,10,280,195,""); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 10, 280, 195, ""); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->choice_family = obj = fl_add_choice(FL_NORMAL_CHOICE,94,15,191,30,idex(_("Family:|#F")));fl_set_button_shortcut(obj,scex(_("Family:|#F")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->choice_family = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 15, 191, 30, idex(_("Family:|#F")));fl_set_button_shortcut(obj, scex(_("Family:|#F")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->choice_series = obj = fl_add_choice(FL_NORMAL_CHOICE,94,55,191,30,idex(_("Series:|#S")));fl_set_button_shortcut(obj,scex(_("Series:|#S")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->choice_series = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 55, 191, 30, idex(_("Series:|#S")));fl_set_button_shortcut(obj, scex(_("Series:|#S")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->choice_shape = obj = fl_add_choice(FL_NORMAL_CHOICE,94,95,191,30,idex(_("Shape:|#H")));fl_set_button_shortcut(obj,scex(_("Shape:|#H")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->choice_shape = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 95, 191, 30, idex(_("Shape:|#H")));fl_set_button_shortcut(obj, scex(_("Shape:|#H")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->choice_size = obj = fl_add_choice(FL_NORMAL_CHOICE,95,230,191,30,idex(_("Size:|#Z")));fl_set_button_shortcut(obj,scex(_("Size:|#Z")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->choice_size = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 230, 191, 30, idex(_("Size:|#Z")));fl_set_button_shortcut(obj, scex(_("Size:|#Z")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->choice_bar = obj = fl_add_choice(FL_NORMAL_CHOICE,95,290,190,30,idex(_("Misc:|#M")));fl_set_button_shortcut(obj,scex(_("Misc:|#M")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->choice_bar = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 290, 190, 30, idex(_("Misc:|#M")));fl_set_button_shortcut(obj, scex(_("Misc:|#M")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON,60,330,80,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 330, 80, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,CharacterApplyCB,0); - fdui->button_close = obj = fl_add_button(FL_RETURN_BUTTON,175,330,80,30,_("Close")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, CharacterApplyCB, 0); + fdui->button_close = obj = fl_add_button(FL_RETURN_BUTTON, 175, 330, 80, 30, _("Close")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,CharacterCloseCB,0); - fdui->choice_color = obj = fl_add_choice(FL_NORMAL_CHOICE,95,135,191,30,idex(_("Color:|#C")));fl_set_button_shortcut(obj,scex(_("Color:|#C")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, CharacterCloseCB, 0); + fdui->choice_color = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 135, 191, 30, idex(_("Color:|#C")));fl_set_button_shortcut(obj, scex(_("Color:|#C")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->check_toggle_all = obj = fl_add_checkbutton(FL_PUSH_BUTTON,30,175,260,25,idex(_("Toggle on all these|#T")));fl_set_button_shortcut(obj,scex(_("Toggle on all these|#T")),1); + fdui->check_toggle_all = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 30, 175, 260, 25, idex(_("Toggle on all these|#T")));fl_set_button_shortcut(obj, scex(_("Toggle on all these|#T")), 1); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); - obj = fl_add_text(FL_NORMAL_TEXT,20,210,210,20,_("These are never toggled")); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 210, 210, 20, _("These are never toggled")); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); - obj = fl_add_text(FL_NORMAL_TEXT,20,270,215,20,_("These are always toggled")); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 270, 215, 20, _("These are always toggled")); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast); fl_set_object_resize(obj, FL_RESIZE_X); fl_end_form(); @@ -273,98 +273,98 @@ FD_form_paragraph *create_form_form_paragraph(void) FD_form_paragraph *fdui = (FD_form_paragraph *) fl_calloc(1, sizeof(FD_form_paragraph)); fdui->form_paragraph = fl_bgn_form(FL_NO_BOX, 490, 290); - obj = fl_add_box(FL_UP_BOX,0,0,490,290,""); - fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON,127,250,100,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_box(FL_UP_BOX, 0, 0, 490, 290, ""); + fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 127, 250, 100, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,ParagraphOKCB,0); - fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON,244,250,100,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, ParagraphOKCB, 0); + fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 244, 250, 100, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,ParagraphApplyCB,0); - fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON,360,250,100,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, ParagraphApplyCB, 0); + fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 360, 250, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,ParagraphCancelCB,0); - obj = fl_add_frame(FL_ENGRAVED_FRAME,360,110,120,50,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,110,340,90,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - obj = fl_add_frame(FL_ENGRAVED_FRAME,360,20,120,70,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME,210,20,140,70,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,20,190,70,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - fdui->input_labelwidth = obj = fl_add_input(FL_NORMAL_INPUT,100,210,360,30,idex(_("Label Width:|#d")));fl_set_button_shortcut(obj,scex(_("Label Width:|#d")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, ParagraphCancelCB, 0); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 360, 110, 120, 50, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 110, 340, 90, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 360, 20, 120, 70, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 210, 20, 140, 70, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 20, 190, 70, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fdui->input_labelwidth = obj = fl_add_input(FL_NORMAL_INPUT, 100, 210, 360, 30, idex(_("Label Width:|#d")));fl_set_button_shortcut(obj, scex(_("Label Width:|#d")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_West, FL_East); fl_set_object_resize(obj, FL_RESIZE_X); - obj = fl_add_text(FL_NORMAL_TEXT,370,100,60,20,_("Indent")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->check_lines_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON,230,30,120,30,idex(_("Above|#b")));fl_set_button_shortcut(obj,scex(_("Above|#b")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->check_lines_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON,230,60,120,30,idex(_("Below|#E")));fl_set_button_shortcut(obj,scex(_("Below|#E")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->check_pagebreaks_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON,360,30,120,30,idex(_("Above|#o")));fl_set_button_shortcut(obj,scex(_("Above|#o")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->check_pagebreaks_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON,360,60,120,30,idex(_("Below|#l")));fl_set_button_shortcut(obj,scex(_("Below|#l")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->check_noindent = obj = fl_add_checkbutton(FL_PUSH_BUTTON,360,120,120,30,idex(_("No Indent|#I")));fl_set_button_shortcut(obj,scex(_("No Indent|#I")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_text(FL_NORMAL_TEXT, 370, 100, 60, 20, _("Indent")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->check_lines_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 230, 30, 120, 30, idex(_("Above|#b")));fl_set_button_shortcut(obj, scex(_("Above|#b")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->check_lines_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 230, 60, 120, 30, idex(_("Below|#E")));fl_set_button_shortcut(obj, scex(_("Below|#E")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->check_pagebreaks_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 360, 30, 120, 30, idex(_("Above|#o")));fl_set_button_shortcut(obj, scex(_("Above|#o")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->check_pagebreaks_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 360, 60, 120, 30, idex(_("Below|#l")));fl_set_button_shortcut(obj, scex(_("Below|#l")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->check_noindent = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 360, 120, 120, 30, idex(_("No Indent|#I")));fl_set_button_shortcut(obj, scex(_("No Indent|#I")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fdui->group_radio_alignment = fl_bgn_group(); - fdui->radio_align_right = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,30,80,30,idex(_("Right|#R")));fl_set_button_shortcut(obj,scex(_("Right|#R")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->radio_align_left = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,60,80,30,idex(_("Left|#f")));fl_set_button_shortcut(obj,scex(_("Left|#f")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->radio_align_block = obj = fl_add_checkbutton(FL_RADIO_BUTTON,100,30,80,30,idex(_("Block|#c")));fl_set_button_shortcut(obj,scex(_("Block|#c")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->radio_align_center = obj = fl_add_checkbutton(FL_RADIO_BUTTON,100,60,80,30,idex(_("Center|#n")));fl_set_button_shortcut(obj,scex(_("Center|#n")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_align_right = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 30, 80, 30, idex(_("Right|#R")));fl_set_button_shortcut(obj, scex(_("Right|#R")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->radio_align_left = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 60, 80, 30, idex(_("Left|#f")));fl_set_button_shortcut(obj, scex(_("Left|#f")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->radio_align_block = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 100, 30, 80, 30, idex(_("Block|#c")));fl_set_button_shortcut(obj, scex(_("Block|#c")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->radio_align_center = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 100, 60, 80, 30, idex(_("Center|#n")));fl_set_button_shortcut(obj, scex(_("Center|#n")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_group(); - fdui->input_space_above = obj = fl_add_input(FL_NORMAL_INPUT,180,120,90,30,""); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,ParagraphVSpaceCB,0); - fdui->input_space_below = obj = fl_add_input(FL_NORMAL_INPUT,180,160,90,30,""); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,ParagraphVSpaceCB,0); - fdui->choice_space_above = obj = fl_add_choice(FL_NORMAL_CHOICE,70,120,100,30,idex(_("Above:|#v")));fl_set_button_shortcut(obj,scex(_("Above:|#v")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,ParagraphVSpaceCB,0); - fdui->choice_space_below = obj = fl_add_choice(FL_NORMAL_CHOICE,70,160,100,30,idex(_("Below:|#w")));fl_set_button_shortcut(obj,scex(_("Below:|#w")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,ParagraphVSpaceCB,0); - obj = fl_add_text(FL_NORMAL_TEXT,370,10,100,20,_("Pagebreaks")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - obj = fl_add_text(FL_NORMAL_TEXT,230,10,50,20,_("Lines")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - obj = fl_add_text(FL_NORMAL_TEXT,20,10,80,20,_("Alignment")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - obj = fl_add_text(FL_NORMAL_TEXT,20,100,130,20,_("Vertical Spaces")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->button_pextra = obj = fl_add_button(FL_NORMAL_BUTTON,10,250,100,30,idex(_("ExtraOpt|#X")));fl_set_button_shortcut(obj,scex(_("ExtraOpt|#X")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->input_space_above = obj = fl_add_input(FL_NORMAL_INPUT, 180, 120, 90, 30, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, ParagraphVSpaceCB, 0); + fdui->input_space_below = obj = fl_add_input(FL_NORMAL_INPUT, 180, 160, 90, 30, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, ParagraphVSpaceCB, 0); + fdui->choice_space_above = obj = fl_add_choice(FL_NORMAL_CHOICE, 70, 120, 100, 30, idex(_("Above:|#v")));fl_set_button_shortcut(obj, scex(_("Above:|#v")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, ParagraphVSpaceCB, 0); + fdui->choice_space_below = obj = fl_add_choice(FL_NORMAL_CHOICE, 70, 160, 100, 30, idex(_("Below:|#w")));fl_set_button_shortcut(obj, scex(_("Below:|#w")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, ParagraphVSpaceCB, 0); + obj = fl_add_text(FL_NORMAL_TEXT, 370, 10, 100, 20, _("Pagebreaks")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 230, 10, 50, 20, _("Lines")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 80, 20, _("Alignment")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 100, 130, 20, _("Vertical Spaces")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->button_pextra = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 250, 100, 30, idex(_("ExtraOpt|#X")));fl_set_button_shortcut(obj, scex(_("ExtraOpt|#X")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,ParagraphExtraOpen,0); - fdui->check_space_above = obj = fl_add_checkbutton(FL_PUSH_BUTTON,270,120,40,30,idex(_("Keep|#K")));fl_set_button_shortcut(obj,scex(_("Keep|#K")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->check_space_below = obj = fl_add_checkbutton(FL_PUSH_BUTTON,270,160,40,30,idex(_("Keep|#p")));fl_set_button_shortcut(obj,scex(_("Keep|#p")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, ParagraphExtraOpen, 0); + fdui->check_space_above = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 270, 120, 40, 30, idex(_("Keep|#K")));fl_set_button_shortcut(obj, scex(_("Keep|#K")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->check_space_below = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 270, 160, 40, 30, idex(_("Keep|#p")));fl_set_button_shortcut(obj, scex(_("Keep|#p")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_form(); //fdui->form_paragraph->fdui = fdui; @@ -379,21 +379,21 @@ FD_form_preamble *create_form_form_preamble(void) FD_form_preamble *fdui = (FD_form_preamble *) fl_calloc(1, sizeof(FD_form_preamble)); fdui->form_preamble = fl_bgn_form(FL_NO_BOX, 380, 420); - obj = fl_add_box(FL_UP_BOX,0,0,380,420,""); - fdui->button_ok = obj = fl_add_button(FL_NORMAL_BUTTON,50,380,100,30,idex(_("OK|#O")));fl_set_button_shortcut(obj,scex(_("OK|#O")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_box(FL_UP_BOX, 0, 0, 380, 420, ""); + fdui->button_ok = obj = fl_add_button(FL_NORMAL_BUTTON, 50, 380, 100, 30, idex(_("OK|#O")));fl_set_button_shortcut(obj, scex(_("OK|#O")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,PreambleOKCB,0); - fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON,160,380,100,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, PreambleOKCB, 0); + fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 160, 380, 100, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,PreambleApplyCB,0); - fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON,270,380,100,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, PreambleApplyCB, 0); + fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 270, 380, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,PreambleCancelCB,0); - fdui->input_preamble = obj = fl_add_input(FL_MULTILINE_INPUT,10,10,360,360,""); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, PreambleCancelCB, 0); + fdui->input_preamble = obj = fl_add_input(FL_MULTILINE_INPUT, 10, 10, 360, 360, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast); fl_end_form(); @@ -409,29 +409,29 @@ FD_form_quotes *create_form_form_quotes(void) FD_form_quotes *fdui = (FD_form_quotes *) fl_calloc(1, sizeof(FD_form_quotes)); fdui->form_quotes = fl_bgn_form(FL_NO_BOX, 340, 130); - obj = fl_add_box(FL_UP_BOX,0,0,340,130,""); - obj = fl_add_button(FL_RETURN_BUTTON,10,90,100,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,QuotesOKCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,120,90,100,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,QuotesApplyCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,230,90,100,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,QuotesCancelCB,0); - fdui->choice_quotes_language = obj = fl_add_choice(FL_NORMAL_CHOICE,90,10,160,30,idex(_("Type:|#T")));fl_set_button_shortcut(obj,scex(_("Type:|#T")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_box(FL_UP_BOX, 0, 0, 340, 130, ""); + obj = fl_add_button(FL_RETURN_BUTTON, 10, 90, 100, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, QuotesOKCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 120, 90, 100, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, QuotesApplyCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 230, 90, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, QuotesCancelCB, 0); + fdui->choice_quotes_language = obj = fl_add_choice(FL_NORMAL_CHOICE, 90, 10, 160, 30, idex(_("Type:|#T")));fl_set_button_shortcut(obj, scex(_("Type:|#T")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fdui->group_radio_quotes_number = fl_bgn_group(); - fdui->radio_single = obj = fl_add_checkbutton(FL_RADIO_BUTTON,90,50,80,30,idex(_("Single|#S")));fl_set_button_shortcut(obj,scex(_("Single|#S")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->radio_double = obj = fl_add_checkbutton(FL_RADIO_BUTTON,170,50,80,30,idex(_("Double|#D")));fl_set_button_shortcut(obj,scex(_("Double|#D")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_single = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 90, 50, 80, 30, idex(_("Single|#S")));fl_set_button_shortcut(obj, scex(_("Single|#S")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->radio_double = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 170, 50, 80, 30, idex(_("Double|#D")));fl_set_button_shortcut(obj, scex(_("Double|#D")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_group(); - obj = fl_add_text(FL_NORMAL_TEXT,290,230,10,10,_("Text")); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + obj = fl_add_text(FL_NORMAL_TEXT, 290, 230, 10, 10, _("Text")); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); fl_end_form(); //fdui->form_quotes->fdui = fdui; @@ -446,97 +446,97 @@ FD_form_paper *create_form_form_paper(void) FD_form_paper *fdui = (FD_form_paper *) fl_calloc(1, sizeof(FD_form_paper)); fdui->form_paper = fl_bgn_form(FL_NO_BOX, 440, 430); - obj = fl_add_box(FL_UP_BOX,0,0,440,430,""); - obj = fl_add_frame(FL_ENGRAVED_FRAME,230,100,200,100,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT); - fdui->choice_paperpackage = obj = fl_add_choice(FL_NORMAL_CHOICE,290,20,140,30,idex(_("Special:|#S")));fl_set_button_shortcut(obj,scex(_("Special:|#S")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PaperMarginsCB,0); - obj = fl_add_frame(FL_ENGRAVED_FRAME,230,220,200,130,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,180,190,170,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT); - obj = fl_add_text(FL_NORMAL_TEXT,20,170,70,20,_("Margins")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - obj = fl_add_text(FL_NORMAL_TEXT,240,210,160,20,_("Foot/Head Margins")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON,320,390,100,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PaperCancelCB,0); - fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON,210,390,100,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PaperApplyCB,0); - fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON,100,390,100,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PaperOKCB,0); - obj = fl_add_frame(FL_ENGRAVED_FRAME,440,360,10,10,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME,440,350,10,10,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,100,190,70,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - obj = fl_add_text(FL_NORMAL_TEXT,20,90,95,20,_("Orientation")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + obj = fl_add_box(FL_UP_BOX, 0, 0, 440, 430, ""); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 230, 100, 200, 100, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + fdui->choice_paperpackage = obj = fl_add_choice(FL_NORMAL_CHOICE, 290, 20, 140, 30, idex(_("Special:|#S")));fl_set_button_shortcut(obj, scex(_("Special:|#S")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PaperMarginsCB, 0); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 230, 220, 200, 130, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 180, 190, 170, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 170, 70, 20, _("Margins")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 240, 210, 160, 20, _("Foot/Head Margins")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 320, 390, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PaperCancelCB, 0); + fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 210, 390, 100, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PaperApplyCB, 0); + fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 100, 390, 100, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PaperOKCB, 0); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 440, 360, 10, 10, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 440, 350, 10, 10, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 100, 190, 70, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 90, 95, 20, _("Orientation")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fdui->greoup_radio_orientation = fl_bgn_group(); - fdui->radio_portrait = obj = fl_add_checkbutton(FL_RADIO_BUTTON,20,105,120,30,idex(_("Portrait|#o")));fl_set_button_shortcut(obj,scex(_("Portrait|#o")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->radio_landscape = obj = fl_add_checkbutton(FL_RADIO_BUTTON,20,135,120,30,idex(_("Landscape|#L")));fl_set_button_shortcut(obj,scex(_("Landscape|#L")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_portrait = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 20, 105, 120, 30, idex(_("Portrait|#o")));fl_set_button_shortcut(obj, scex(_("Portrait|#o")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->radio_landscape = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 20, 135, 120, 30, idex(_("Landscape|#L")));fl_set_button_shortcut(obj, scex(_("Landscape|#L")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_group(); - fdui->choice_papersize2 = obj = fl_add_choice(FL_NORMAL_CHOICE,70,20,160,30,idex(_("Papersize:|#P")));fl_set_button_shortcut(obj,scex(_("Papersize:|#P")),1); - fl_set_object_boxtype(obj,FL_FRAME_BOX); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PaperMarginsCB,0); - obj = fl_add_text(FL_NORMAL_TEXT,240,90,150,20,_("Custom Papersize")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->push_use_geometry = obj = fl_add_checkbutton(FL_PUSH_BUTTON,20,55,170,30,idex(_("Use Geometry Package|#U")));fl_set_button_shortcut(obj,scex(_("Use Geometry Package|#U")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->input_custom_width = obj = fl_add_input(FL_NORMAL_INPUT,330,115,90,30,idex(_("Width:|#W")));fl_set_button_shortcut(obj,scex(_("Width:|#W")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PaperMarginsCB,0); - fdui->input_custom_height = obj = fl_add_input(FL_NORMAL_INPUT,330,155,90,30,idex(_("Height:|#H")));fl_set_button_shortcut(obj,scex(_("Height:|#H")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PaperMarginsCB,0); - fdui->input_top_margin = obj = fl_add_input(FL_NORMAL_INPUT,100,190,90,30,idex(_("Top:|#T")));fl_set_button_shortcut(obj,scex(_("Top:|#T")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PaperMarginsCB,0); - fdui->input_bottom_margin = obj = fl_add_input(FL_NORMAL_INPUT,100,230,90,30,idex(_("Bottom:|#B")));fl_set_button_shortcut(obj,scex(_("Bottom:|#B")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PaperMarginsCB,0); - fdui->input_left_margin = obj = fl_add_input(FL_NORMAL_INPUT,100,270,90,30,idex(_("Left:|#e")));fl_set_button_shortcut(obj,scex(_("Left:|#e")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PaperMarginsCB,0); - fdui->input_right_margin = obj = fl_add_input(FL_NORMAL_INPUT,100,310,90,30,idex(_("Right:|#R")));fl_set_button_shortcut(obj,scex(_("Right:|#R")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PaperMarginsCB,0); - fdui->input_head_height = obj = fl_add_input(FL_NORMAL_INPUT,330,230,90,30,idex(_("Headheight:|#i")));fl_set_button_shortcut(obj,scex(_("Headheight:|#i")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PaperMarginsCB,0); - fdui->input_head_sep = obj = fl_add_input(FL_NORMAL_INPUT,330,270,90,30,idex(_("Headsep:|#d")));fl_set_button_shortcut(obj,scex(_("Headsep:|#d")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PaperMarginsCB,0); - fdui->input_foot_skip = obj = fl_add_input(FL_NORMAL_INPUT,330,310,90,30,idex(_("Footskip:|#F")));fl_set_button_shortcut(obj,scex(_("Footskip:|#F")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PaperMarginsCB,0); - fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT,10,360,420,20,""); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + fdui->choice_papersize2 = obj = fl_add_choice(FL_NORMAL_CHOICE, 70, 20, 160, 30, idex(_("Papersize:|#P")));fl_set_button_shortcut(obj, scex(_("Papersize:|#P")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PaperMarginsCB, 0); + obj = fl_add_text(FL_NORMAL_TEXT, 240, 90, 150, 20, _("Custom Papersize")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->push_use_geometry = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 55, 170, 30, idex(_("Use Geometry Package|#U")));fl_set_button_shortcut(obj, scex(_("Use Geometry Package|#U")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->input_custom_width = obj = fl_add_input(FL_NORMAL_INPUT, 330, 115, 90, 30, idex(_("Width:|#W")));fl_set_button_shortcut(obj, scex(_("Width:|#W")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PaperMarginsCB, 0); + fdui->input_custom_height = obj = fl_add_input(FL_NORMAL_INPUT, 330, 155, 90, 30, idex(_("Height:|#H")));fl_set_button_shortcut(obj, scex(_("Height:|#H")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PaperMarginsCB, 0); + fdui->input_top_margin = obj = fl_add_input(FL_NORMAL_INPUT, 100, 190, 90, 30, idex(_("Top:|#T")));fl_set_button_shortcut(obj, scex(_("Top:|#T")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PaperMarginsCB, 0); + fdui->input_bottom_margin = obj = fl_add_input(FL_NORMAL_INPUT, 100, 230, 90, 30, idex(_("Bottom:|#B")));fl_set_button_shortcut(obj, scex(_("Bottom:|#B")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PaperMarginsCB, 0); + fdui->input_left_margin = obj = fl_add_input(FL_NORMAL_INPUT, 100, 270, 90, 30, idex(_("Left:|#e")));fl_set_button_shortcut(obj, scex(_("Left:|#e")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PaperMarginsCB, 0); + fdui->input_right_margin = obj = fl_add_input(FL_NORMAL_INPUT, 100, 310, 90, 30, idex(_("Right:|#R")));fl_set_button_shortcut(obj, scex(_("Right:|#R")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PaperMarginsCB, 0); + fdui->input_head_height = obj = fl_add_input(FL_NORMAL_INPUT, 330, 230, 90, 30, idex(_("Headheight:|#i")));fl_set_button_shortcut(obj, scex(_("Headheight:|#i")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PaperMarginsCB, 0); + fdui->input_head_sep = obj = fl_add_input(FL_NORMAL_INPUT, 330, 270, 90, 30, idex(_("Headsep:|#d")));fl_set_button_shortcut(obj, scex(_("Headsep:|#d")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PaperMarginsCB, 0); + fdui->input_foot_skip = obj = fl_add_input(FL_NORMAL_INPUT, 330, 310, 90, 30, idex(_("Footskip:|#F")));fl_set_button_shortcut(obj, scex(_("Footskip:|#F")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PaperMarginsCB, 0); + fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 10, 360, 420, 20, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_end_form(); //fdui->form_paper->fdui = fdui; @@ -551,121 +551,121 @@ FD_form_table_options *create_form_form_table_options(void) FD_form_table_options *fdui = (FD_form_table_options *) fl_calloc(1, sizeof(FD_form_table_options)); fdui->form_table_options = fl_bgn_form(FL_NO_BOX, 540, 310); - obj = fl_add_box(FL_UP_BOX,0,0,540,310,""); - obj = fl_add_frame(FL_ENGRAVED_FRAME,300,120,110,60,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME,300,20,110,90,""); - fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT,20,275,330,30,""); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->button_close = obj = fl_add_button(FL_RETURN_BUTTON,430,270,100,30,_("Close")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,TableOptCloseCB,0); - obj = fl_add_frame(FL_ENGRAVED_FRAME,20,20,145,105,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - obj = fl_add_text(FL_NORMAL_TEXT,30,10,70,20,_("Borders")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->radio_border_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON,75,45,25,25,idex(_("Top|#T")));fl_set_button_shortcut(obj,scex(_("Top|#T")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->radio_border_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON,75,75,25,25,idex(_("Bottom|#B")));fl_set_button_shortcut(obj,scex(_("Bottom|#B")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_BOTTOM_LEFT); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->radio_border_left = obj = fl_add_checkbutton(FL_PUSH_BUTTON,55,60,25,25,idex(_("Left|#L")));fl_set_button_shortcut(obj,scex(_("Left|#L")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->radio_border_right = obj = fl_add_checkbutton(FL_PUSH_BUTTON,95,60,25,25,idex(_("Right|#R")));fl_set_button_shortcut(obj,scex(_("Right|#R")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_RIGHT); - fl_set_object_callback(obj,TableOptionsCB,0); - obj = fl_add_frame(FL_ENGRAVED_FRAME,175,20,105,105,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_text(FL_NORMAL_TEXT,180,10,90,20,_("Alignment")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - obj = fl_add_text(FL_NORMAL_TEXT,300,10,100,20,_("Special Cell")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->radio_multicolumn = obj = fl_add_checkbutton(FL_PUSH_BUTTON,300,30,95,25,idex(_("Multicolumn|#M")));fl_set_button_shortcut(obj,scex(_("Multicolumn|#M")),1); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->button_append_column = obj = fl_add_button(FL_NORMAL_BUTTON,10,170,120,30,idex(_("Append Column|#A")));fl_set_button_shortcut(obj,scex(_("Append Column|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->button_delete_column = obj = fl_add_button(FL_NORMAL_BUTTON,140,170,120,30,idex(_("Delete Column|#O")));fl_set_button_shortcut(obj,scex(_("Delete Column|#O")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->button_append_row = obj = fl_add_button(FL_NORMAL_BUTTON,10,200,120,30,idex(_("Append Row|#p")));fl_set_button_shortcut(obj,scex(_("Append Row|#p")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->button_delete_row = obj = fl_add_button(FL_NORMAL_BUTTON,140,200,120,30,idex(_("Delete Row|#w")));fl_set_button_shortcut(obj,scex(_("Delete Row|#w")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->button_table_delete = obj = fl_add_button(FL_NORMAL_BUTTON,10,240,250,30,idex(_("Delete Table|#D")));fl_set_button_shortcut(obj,scex(_("Delete Table|#D")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->input_table_column = obj = fl_add_input(FL_NORMAL_INPUT,290,240,60,30,_("Column")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT); - fdui->input_table_row = obj = fl_add_input(FL_NORMAL_INPUT,360,240,60,30,_("Row")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT); - fdui->button_set_borders = obj = fl_add_button(FL_NORMAL_BUTTON,10,140,120,30,idex(_("Set Borders|#S")));fl_set_button_shortcut(obj,scex(_("Set Borders|#S")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->button_unset_borders = obj = fl_add_button(FL_NORMAL_BUTTON,140,140,120,30,idex(_("Unset Borders|#U")));fl_set_button_shortcut(obj,scex(_("Unset Borders|#U")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->radio_longtable = obj = fl_add_checkbutton(FL_PUSH_BUTTON,300,130,90,25,_("Longtable")); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->input_column_width = obj = fl_add_input(FL_NORMAL_INPUT,330,190,95,30,_("Width")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,SetPWidthCB,0); - fdui->radio_rotate_table = obj = fl_add_checkbutton(FL_PUSH_BUTTON,300,155,90,25,idex(_("Rotate 90°|#9")));fl_set_button_shortcut(obj,scex(_("Rotate 90°|#9")),1); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->radio_linebreak_cell = obj = fl_add_checkbutton(FL_PUSH_BUTTON,300,55,95,25,idex(_("Linebreaks|#N")));fl_set_button_shortcut(obj,scex(_("Linebreaks|#N")),1); - fl_set_object_callback(obj,TableOptionsCB,0); - obj = fl_add_text(FL_NORMAL_TEXT,300,110,100,20,_("Spec. Table")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - obj = fl_add_frame(FL_ENGRAVED_FRAME,420,20,100,160,""); - obj = fl_add_text(FL_NORMAL_TEXT,425,10,85,20,_("Longtable")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->radio_lt_firsthead = obj = fl_add_checkbutton(FL_PUSH_BUTTON,420,30,90,25,_("First Head")); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->radio_lt_head = obj = fl_add_checkbutton(FL_PUSH_BUTTON,420,60,90,25,_("Head")); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->radio_lt_foot = obj = fl_add_checkbutton(FL_PUSH_BUTTON,420,90,90,25,_("Foot")); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->radio_lt_lastfoot = obj = fl_add_checkbutton(FL_PUSH_BUTTON,420,120,90,25,_("Last Foot")); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->radio_lt_newpage = obj = fl_add_checkbutton(FL_PUSH_BUTTON,420,150,90,25,_("New Page")); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->radio_rotate_cell = obj = fl_add_checkbutton(FL_PUSH_BUTTON,300,80,95,25,_("Rotate 90°")); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->button_table_extra = obj = fl_add_button(FL_NORMAL_BUTTON,430,235,100,30,idex(_("Extra|#X")));fl_set_button_shortcut(obj,scex(_("Extra|#X")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->radio_align_left = obj = fl_add_checkbutton(FL_RADIO_BUTTON,175,30,80,25,idex(_("Left|#e")));fl_set_button_shortcut(obj,scex(_("Left|#e")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->radio_align_right = obj = fl_add_checkbutton(FL_RADIO_BUTTON,175,55,80,25,idex(_("Right|#i")));fl_set_button_shortcut(obj,scex(_("Right|#i")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,TableOptionsCB,0); - fdui->radio_align_center = obj = fl_add_checkbutton(FL_RADIO_BUTTON,175,80,80,25,idex(_("Center|#C")));fl_set_button_shortcut(obj,scex(_("Center|#C")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,TableOptionsCB,0); + obj = fl_add_box(FL_UP_BOX, 0, 0, 540, 310, ""); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 300, 120, 110, 60, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 300, 20, 110, 90, ""); + fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 20, 275, 330, 30, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->button_close = obj = fl_add_button(FL_RETURN_BUTTON, 430, 270, 100, 30, _("Close")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, TableOptCloseCB, 0); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 20, 20, 145, 105, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + obj = fl_add_text(FL_NORMAL_TEXT, 30, 10, 70, 20, _("Borders")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->radio_border_top = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 75, 45, 25, 25, idex(_("Top|#T")));fl_set_button_shortcut(obj, scex(_("Top|#T")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->radio_border_bottom = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 75, 75, 25, 25, idex(_("Bottom|#B")));fl_set_button_shortcut(obj, scex(_("Bottom|#B")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_BOTTOM_LEFT); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->radio_border_left = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 55, 60, 25, 25, idex(_("Left|#L")));fl_set_button_shortcut(obj, scex(_("Left|#L")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->radio_border_right = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 95, 60, 25, 25, idex(_("Right|#R")));fl_set_button_shortcut(obj, scex(_("Right|#R")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_RIGHT); + fl_set_object_callback(obj, TableOptionsCB, 0); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 175, 20, 105, 105, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_text(FL_NORMAL_TEXT, 180, 10, 90, 20, _("Alignment")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 300, 10, 100, 20, _("Special Cell")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->radio_multicolumn = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 300, 30, 95, 25, idex(_("Multicolumn|#M")));fl_set_button_shortcut(obj, scex(_("Multicolumn|#M")), 1); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->button_append_column = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 170, 120, 30, idex(_("Append Column|#A")));fl_set_button_shortcut(obj, scex(_("Append Column|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->button_delete_column = obj = fl_add_button(FL_NORMAL_BUTTON, 140, 170, 120, 30, idex(_("Delete Column|#O")));fl_set_button_shortcut(obj, scex(_("Delete Column|#O")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->button_append_row = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 200, 120, 30, idex(_("Append Row|#p")));fl_set_button_shortcut(obj, scex(_("Append Row|#p")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->button_delete_row = obj = fl_add_button(FL_NORMAL_BUTTON, 140, 200, 120, 30, idex(_("Delete Row|#w")));fl_set_button_shortcut(obj, scex(_("Delete Row|#w")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->button_table_delete = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 240, 250, 30, idex(_("Delete Table|#D")));fl_set_button_shortcut(obj, scex(_("Delete Table|#D")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->input_table_column = obj = fl_add_input(FL_NORMAL_INPUT, 290, 240, 60, 30, _("Column")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + fdui->input_table_row = obj = fl_add_input(FL_NORMAL_INPUT, 360, 240, 60, 30, _("Row")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + fdui->button_set_borders = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 140, 120, 30, idex(_("Set Borders|#S")));fl_set_button_shortcut(obj, scex(_("Set Borders|#S")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->button_unset_borders = obj = fl_add_button(FL_NORMAL_BUTTON, 140, 140, 120, 30, idex(_("Unset Borders|#U")));fl_set_button_shortcut(obj, scex(_("Unset Borders|#U")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->radio_longtable = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 300, 130, 90, 25, _("Longtable")); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->input_column_width = obj = fl_add_input(FL_NORMAL_INPUT, 330, 190, 95, 30, _("Width")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, SetPWidthCB, 0); + fdui->radio_rotate_table = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 300, 155, 90, 25, idex(_("Rotate 90°|#9")));fl_set_button_shortcut(obj, scex(_("Rotate 90°|#9")), 1); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->radio_linebreak_cell = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 300, 55, 95, 25, idex(_("Linebreaks|#N")));fl_set_button_shortcut(obj, scex(_("Linebreaks|#N")), 1); + fl_set_object_callback(obj, TableOptionsCB, 0); + obj = fl_add_text(FL_NORMAL_TEXT, 300, 110, 100, 20, _("Spec. Table")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 420, 20, 100, 160, ""); + obj = fl_add_text(FL_NORMAL_TEXT, 425, 10, 85, 20, _("Longtable")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->radio_lt_firsthead = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 420, 30, 90, 25, _("First Head")); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->radio_lt_head = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 420, 60, 90, 25, _("Head")); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->radio_lt_foot = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 420, 90, 90, 25, _("Foot")); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->radio_lt_lastfoot = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 420, 120, 90, 25, _("Last Foot")); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->radio_lt_newpage = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 420, 150, 90, 25, _("New Page")); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->radio_rotate_cell = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 300, 80, 95, 25, _("Rotate 90°")); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->button_table_extra = obj = fl_add_button(FL_NORMAL_BUTTON, 430, 235, 100, 30, idex(_("Extra|#X")));fl_set_button_shortcut(obj, scex(_("Extra|#X")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->radio_align_left = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 175, 30, 80, 25, idex(_("Left|#e")));fl_set_button_shortcut(obj, scex(_("Left|#e")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->radio_align_right = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 175, 55, 80, 25, idex(_("Right|#i")));fl_set_button_shortcut(obj, scex(_("Right|#i")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, TableOptionsCB, 0); + fdui->radio_align_center = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 175, 80, 80, 25, idex(_("Center|#C")));fl_set_button_shortcut(obj, scex(_("Center|#C")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, TableOptionsCB, 0); fl_end_form(); //fdui->form_table_options->fdui = fdui; @@ -680,75 +680,75 @@ FD_form_paragraph_extra *create_form_form_paragraph_extra(void) FD_form_paragraph_extra *fdui = (FD_form_paragraph_extra *) fl_calloc(1, sizeof(FD_form_paragraph_extra)); fdui->form_paragraph_extra = fl_bgn_form(FL_NO_BOX, 460, 250); - obj = fl_add_box(FL_UP_BOX,0,0,460,250,""); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,20,170,100,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME,350,20,100,100,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME,190,20,150,100,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_text(FL_NORMAL_TEXT,20,10,120,20,_("Extra Options")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->input_pextra_width = obj = fl_add_input(FL_NORMAL_INPUT,240,30,90,30,idex(_("Length|#L")));fl_set_button_shortcut(obj,scex(_("Length|#L")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,CheckPExtraOptCB,0); - fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON,130,210,100,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_box(FL_UP_BOX, 0, 0, 460, 250, ""); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 20, 170, 100, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 350, 20, 100, 100, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 190, 20, 150, 100, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 120, 20, _("Extra Options")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->input_pextra_width = obj = fl_add_input(FL_NORMAL_INPUT, 240, 30, 90, 30, idex(_("Length|#L")));fl_set_button_shortcut(obj, scex(_("Length|#L")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, CheckPExtraOptCB, 0); + fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 130, 210, 100, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,ParagraphExtraOKCB,0); - fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON,240,210,100,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, ParagraphExtraOKCB, 0); + fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 240, 210, 100, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,ParagraphExtraApplyCB,0); - fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON,350,210,100,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, ParagraphExtraApplyCB, 0); + fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 350, 210, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,ParagraphExtraCancelCB,0); - fdui->input_pextra_widthp = obj = fl_add_input(FL_INT_INPUT,240,70,90,30,idex(_("or %|#o")));fl_set_button_shortcut(obj,scex(_("or %|#o")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,CheckPExtraOptCB,0); - obj = fl_add_text(FL_NORMAL_TEXT,200,10,60,20,_("Width")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - obj = fl_add_text(FL_NORMAL_TEXT,350,10,90,20,_("Alignment")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + fl_set_object_callback(obj, ParagraphExtraCancelCB, 0); + fdui->input_pextra_widthp = obj = fl_add_input(FL_INT_INPUT, 240, 70, 90, 30, idex(_("or %|#o")));fl_set_button_shortcut(obj, scex(_("or %|#o")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, CheckPExtraOptCB, 0); + obj = fl_add_text(FL_NORMAL_TEXT, 200, 10, 60, 20, _("Width")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 350, 10, 90, 20, _("Alignment")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fdui->group_alignment = fl_bgn_group(); - fdui->radio_pextra_top = obj = fl_add_checkbutton(FL_RADIO_BUTTON,360,30,80,30,idex(_("Top|#T")));fl_set_button_shortcut(obj,scex(_("Top|#T")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,CheckPExtraOptCB,0); - fdui->radio_pextra_middle = obj = fl_add_checkbutton(FL_RADIO_BUTTON,360,60,80,30,idex(_("Middle|#d")));fl_set_button_shortcut(obj,scex(_("Middle|#d")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,CheckPExtraOptCB,0); - fdui->radio_pextra_bottom = obj = fl_add_checkbutton(FL_RADIO_BUTTON,360,90,80,30,idex(_("Bottom|#B")));fl_set_button_shortcut(obj,scex(_("Bottom|#B")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,CheckPExtraOptCB,0); + fdui->radio_pextra_top = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 360, 30, 80, 30, idex(_("Top|#T")));fl_set_button_shortcut(obj, scex(_("Top|#T")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, CheckPExtraOptCB, 0); + fdui->radio_pextra_middle = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 360, 60, 80, 30, idex(_("Middle|#d")));fl_set_button_shortcut(obj, scex(_("Middle|#d")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, CheckPExtraOptCB, 0); + fdui->radio_pextra_bottom = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 360, 90, 80, 30, idex(_("Bottom|#B")));fl_set_button_shortcut(obj, scex(_("Bottom|#B")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, CheckPExtraOptCB, 0); fl_end_group(); - fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT,10,170,330,30,""); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->radio_pextra_hfill = obj = fl_add_checkbutton(FL_PUSH_BUTTON,10,130,300,30,idex(_("HFill between Minipage paragraphs|#H")));fl_set_button_shortcut(obj,scex(_("HFill between Minipage paragraphs|#H")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->radio_pextra_startmp = obj = fl_add_checkbutton(FL_PUSH_BUTTON,10,160,260,30,idex(_("Start new Minipage|#S")));fl_set_button_shortcut(obj,scex(_("Start new Minipage|#S")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 10, 170, 330, 30, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->radio_pextra_hfill = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 130, 300, 30, idex(_("HFill between Minipage paragraphs|#H")));fl_set_button_shortcut(obj, scex(_("HFill between Minipage paragraphs|#H")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->radio_pextra_startmp = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 160, 260, 30, idex(_("Start new Minipage|#S")));fl_set_button_shortcut(obj, scex(_("Start new Minipage|#S")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fdui->group_extraopt = fl_bgn_group(); - fdui->radio_pextra_indent = obj = fl_add_checkbutton(FL_PUSH_BUTTON,10,30,160,30,idex(_("Indented Paragraph|#I")));fl_set_button_shortcut(obj,scex(_("Indented Paragraph|#I")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,CheckPExtraOptCB,0); - fdui->radio_pextra_minipage = obj = fl_add_checkbutton(FL_PUSH_BUTTON,10,60,160,30,idex(_("Minipage|#M")));fl_set_button_shortcut(obj,scex(_("Minipage|#M")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,CheckPExtraOptCB,0); - fdui->radio_pextra_floatflt = obj = fl_add_checkbutton(FL_PUSH_BUTTON,10,90,160,30,idex(_("Floatflt|#F")));fl_set_button_shortcut(obj,scex(_("Floatflt|#F")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,CheckPExtraOptCB,0); + fdui->radio_pextra_indent = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 30, 160, 30, idex(_("Indented Paragraph|#I")));fl_set_button_shortcut(obj, scex(_("Indented Paragraph|#I")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, CheckPExtraOptCB, 0); + fdui->radio_pextra_minipage = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 60, 160, 30, idex(_("Minipage|#M")));fl_set_button_shortcut(obj, scex(_("Minipage|#M")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, CheckPExtraOptCB, 0); + fdui->radio_pextra_floatflt = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 90, 160, 30, idex(_("Floatflt|#F")));fl_set_button_shortcut(obj, scex(_("Floatflt|#F")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, CheckPExtraOptCB, 0); fl_end_group(); fl_end_form(); @@ -765,43 +765,43 @@ FD_form_table_extra *create_form_form_table_extra(void) FD_form_table_extra *fdui = (FD_form_table_extra *) fl_calloc(1, sizeof(FD_form_table_extra)); fdui->form_table_extra = fl_bgn_form(FL_NO_BOX, 330, 200); - obj = fl_add_box(FL_UP_BOX,0,0,330,200,""); - obj = fl_add_frame(FL_ENGRAVED_FRAME,15,95,305,60,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_box(FL_UP_BOX, 0, 0, 330, 200, ""); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 15, 95, 305, 60, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_X); - obj = fl_add_text(FL_NORMAL_TEXT,20,85,205,20,_("Special Multicolumn Alignment")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 85, 205, 20, _("Special Multicolumn Alignment")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_X); - obj = fl_add_frame(FL_ENGRAVED_FRAME,15,20,305,60,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 15, 20, 305, 60, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->input_special_alignment = obj = fl_add_input(FL_NORMAL_INPUT,25,35,280,30,""); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->input_special_alignment = obj = fl_add_input(FL_NORMAL_INPUT, 25, 35, 280, 30, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_X); - fl_set_object_callback(obj,TableOptionsCB,0); - obj = fl_add_button(FL_RETURN_BUTTON,220,160,100,30,_("Close")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, TableOptionsCB, 0); + obj = fl_add_button(FL_RETURN_BUTTON, 220, 160, 100, 30, _("Close")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,TableSpeCloseCB,0); - obj = fl_add_text(FL_NORMAL_TEXT,20,10,170,20,_("Special Column Alignment")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + fl_set_object_callback(obj, TableSpeCloseCB, 0); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 170, 20, _("Special Column Alignment")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->input_special_multialign = obj = fl_add_input(FL_NORMAL_INPUT,25,110,280,30,""); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->input_special_multialign = obj = fl_add_input(FL_NORMAL_INPUT, 25, 110, 280, 30, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_X); - fl_set_object_callback(obj,TableOptionsCB,0); + fl_set_object_callback(obj, TableOptionsCB, 0); fl_end_form(); //fdui->form_table_extra->fdui = fdui; diff --git a/src/lyx.C b/src/lyx.C index 4af193b4fe..d8caa5d2dd 100644 --- a/src/lyx.C +++ b/src/lyx.C @@ -15,10 +15,10 @@ FD_form_title *create_form_form_title(void) FD_form_title *fdui = (FD_form_title *) fl_calloc(1, sizeof(FD_form_title)); fdui->form_title = fl_bgn_form(FL_NO_BOX, 425, 290); - obj = fl_add_box(FL_UP_BOX,0,0,425,290,""); - fl_set_object_color(obj,FL_BLACK,FL_TOP_BCOL); - fdui->timer_title = obj = fl_add_timer(FL_HIDDEN_TIMER,110,170,190,60,""); - fl_set_object_callback(obj,TimerCB,0); + obj = fl_add_box(FL_UP_BOX, 0, 0, 425, 290, ""); + fl_set_object_color(obj, FL_BLACK, FL_TOP_BCOL); + fdui->timer_title = obj = fl_add_timer(FL_HIDDEN_TIMER, 110, 170, 190, 60, ""); + fl_set_object_callback(obj, TimerCB, 0); fl_end_form(); //fdui->form_title->fdui = fdui; @@ -33,30 +33,30 @@ FD_form_figure *create_form_form_figure(void) FD_form_figure *fdui = (FD_form_figure *) fl_calloc(1, sizeof(FD_form_figure)); fdui->form_figure = fl_bgn_form(FL_NO_BOX, 340, 150); - obj = fl_add_box(FL_UP_BOX,0,0,340,150,""); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,20,320,80,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); + obj = fl_add_box(FL_UP_BOX, 0, 0, 340, 150, ""); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 20, 320, 80, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); fdui->group_radio_fugre = fl_bgn_group(); - fdui->radio_postscript = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,30,320,30,idex(_("Encapsulated Postscript (*.eps, *.ps)|#E")));fl_set_button_shortcut(obj,scex(_("Encapsulated Postscript (*.eps, *.ps)|#E")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->radio_inline = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,60,320,30,idex(_("Inlined EPS (*.eps, *.ps)|#I")));fl_set_button_shortcut(obj,scex(_("Inlined EPS (*.eps, *.ps)|#I")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_postscript = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 30, 320, 30, idex(_("Encapsulated Postscript (*.eps, *.ps)|#E")));fl_set_button_shortcut(obj, scex(_("Encapsulated Postscript (*.eps, *.ps)|#E")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->radio_inline = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 60, 320, 30, idex(_("Inlined EPS (*.eps, *.ps)|#I")));fl_set_button_shortcut(obj, scex(_("Inlined EPS (*.eps, *.ps)|#I")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_group(); - obj = fl_add_button(FL_RETURN_BUTTON,10,110,100,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,FigureOKCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,120,110,100,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,FigureApplyCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,230,110,100,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,FigureCancelCB,0); - obj = fl_add_text(FL_NORMAL_TEXT,20,10,50,20,_("Type")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + obj = fl_add_button(FL_RETURN_BUTTON, 10, 110, 100, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, FigureOKCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 120, 110, 100, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, FigureApplyCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 230, 110, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, FigureCancelCB, 0); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 50, 20, _("Type")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_end_form(); //fdui->form_figure->fdui = fdui; @@ -71,39 +71,39 @@ FD_form_screen *create_form_form_screen(void) FD_form_screen *fdui = (FD_form_screen *) fl_calloc(1, sizeof(FD_form_screen)); fdui->form_screen = fl_bgn_form(FL_NO_BOX, 390, 220); - obj = fl_add_box(FL_UP_BOX,0,0,390,220,""); - fdui->input_roman = obj = fl_add_input(FL_NORMAL_INPUT,140,10,240,30,idex(_("Roman Font|#R")));fl_set_button_shortcut(obj,scex(_("Roman Font|#R")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_box(FL_UP_BOX, 0, 0, 390, 220, ""); + fdui->input_roman = obj = fl_add_input(FL_NORMAL_INPUT, 140, 10, 240, 30, idex(_("Roman Font|#R")));fl_set_button_shortcut(obj, scex(_("Roman Font|#R")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->input_sans = obj = fl_add_input(FL_NORMAL_INPUT,140,40,240,30,idex(_("Sans Serif Font|#S")));fl_set_button_shortcut(obj,scex(_("Sans Serif Font|#S")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->input_sans = obj = fl_add_input(FL_NORMAL_INPUT, 140, 40, 240, 30, idex(_("Sans Serif Font|#S")));fl_set_button_shortcut(obj, scex(_("Sans Serif Font|#S")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->input_typewriter = obj = fl_add_input(FL_NORMAL_INPUT,140,70,240,30,idex(_("Typewriter Font|#T")));fl_set_button_shortcut(obj,scex(_("Typewriter Font|#T")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->input_typewriter = obj = fl_add_input(FL_NORMAL_INPUT, 140, 70, 240, 30, idex(_("Typewriter Font|#T")));fl_set_button_shortcut(obj, scex(_("Typewriter Font|#T")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->input_font_norm = obj = fl_add_input(FL_NORMAL_INPUT,140,100,240,30,idex(_("Font Norm|#N")));fl_set_button_shortcut(obj,scex(_("Font Norm|#N")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->input_font_norm = obj = fl_add_input(FL_NORMAL_INPUT, 140, 100, 240, 30, idex(_("Font Norm|#N")));fl_set_button_shortcut(obj, scex(_("Font Norm|#N")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->intinput_size = obj = fl_add_input(FL_INT_INPUT,140,140,50,30,idex(_("Font Zoom|#Z")));fl_set_button_shortcut(obj,scex(_("Font Zoom|#Z")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->intinput_size = obj = fl_add_input(FL_INT_INPUT, 140, 140, 50, 30, idex(_("Font Zoom|#Z")));fl_set_button_shortcut(obj, scex(_("Font Zoom|#Z")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); fl_set_object_resize(obj, FL_RESIZE_X); - obj = fl_add_button(FL_RETURN_BUTTON,60,180,100,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_button(FL_RETURN_BUTTON, 60, 180, 100, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,ScreenOKCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,170,180,100,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, ScreenOKCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 170, 180, 100, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,ScreenApplyCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,280,180,100,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, ScreenApplyCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 280, 180, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,ScreenCancelCB,0); + fl_set_object_callback(obj, ScreenCancelCB, 0); fl_end_form(); //fdui->form_screen->fdui = fdui; @@ -118,18 +118,18 @@ FD_form_toc *create_form_form_toc(void) FD_form_toc *fdui = (FD_form_toc *) fl_calloc(1, sizeof(FD_form_toc)); fdui->form_toc = fl_bgn_form(FL_NO_BOX, 420, 340); - obj = fl_add_box(FL_UP_BOX,0,0,420,340,""); - fdui->browser_toc = obj = fl_add_browser(FL_HOLD_BROWSER,10,10,400,280,""); + obj = fl_add_box(FL_UP_BOX, 0, 0, 420, 340, ""); + fdui->browser_toc = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 10, 400, 280, ""); fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast); - fl_set_object_callback(obj,TocSelectCB,0); - obj = fl_add_button(FL_RETURN_BUTTON,310,300,100,30,_("Close")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, TocSelectCB, 0); + obj = fl_add_button(FL_RETURN_BUTTON, 310, 300, 100, 30, _("Close")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,TocCancelCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,200,300,100,30,idex(_("Update|Uu#u")));fl_set_button_shortcut(obj,scex(_("Update|Uu#u")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, TocCancelCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 200, 300, 100, 30, idex(_("Update|Uu#u")));fl_set_button_shortcut(obj, scex(_("Update|Uu#u")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,TocUpdateCB,0); + fl_set_object_callback(obj, TocUpdateCB, 0); fl_end_form(); //fdui->form_toc->fdui = fdui; @@ -144,31 +144,31 @@ FD_form_ref *create_form_form_ref(void) FD_form_ref *fdui = (FD_form_ref *) fl_calloc(1, sizeof(FD_form_ref)); fdui->form_ref = fl_bgn_form(FL_NO_BOX, 290, 330); - obj = fl_add_box(FL_UP_BOX,0,0,290,330,""); - fdui->browser_ref = obj = fl_add_browser(FL_HOLD_BROWSER,10,10,270,140,""); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_box(FL_UP_BOX, 0, 0, 290, 330, ""); + fdui->browser_ref = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 10, 270, 140, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast); - obj = fl_add_button(FL_NORMAL_BUTTON,180,200,100,30,idex(_("Update|#U")));fl_set_button_shortcut(obj,scex(_("Update|#U")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_button(FL_NORMAL_BUTTON, 180, 200, 100, 30, idex(_("Update|#U")));fl_set_button_shortcut(obj, scex(_("Update|#U")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,RefUpdateCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,180,240,100,30,idex(_("Close|#C^[")));fl_set_button_shortcut(obj,scex(_("Close|#C^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, RefUpdateCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 180, 240, 100, 30, idex(_("Close|#C^[")));fl_set_button_shortcut(obj, scex(_("Close|#C^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,RefHideCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,10,240,160,30,idex(_("Insert Reference|#I^M")));fl_set_button_shortcut(obj,scex(_("Insert Reference|#I^M")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, RefHideCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 10, 240, 160, 30, idex(_("Insert Reference|#I^M")));fl_set_button_shortcut(obj, scex(_("Insert Reference|#I^M")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest); - fl_set_object_callback(obj,RefSelectCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,10,200,160,30,idex(_("Insert Page Number|#P")));fl_set_button_shortcut(obj,scex(_("Insert Page Number|#P")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, RefSelectCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 10, 200, 160, 30, idex(_("Insert Page Number|#P")));fl_set_button_shortcut(obj, scex(_("Insert Page Number|#P")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest); - fl_set_object_callback(obj,RefSelectCB,1); - obj = fl_add_button(FL_NORMAL_BUTTON,10,280,160,30,idex(_("Go to Reference|#G")));fl_set_button_shortcut(obj,scex(_("Go to Reference|#G")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, RefSelectCB, 1); + obj = fl_add_button(FL_NORMAL_BUTTON, 10, 280, 160, 30, idex(_("Go to Reference|#G")));fl_set_button_shortcut(obj, scex(_("Go to Reference|#G")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest); - fl_set_object_callback(obj,RefSelectCB,2); - fdui->ref_name = obj = fl_add_input(FL_NORMAL_INPUT,80,160,200,30,idex(_("Name|#N")));fl_set_button_shortcut(obj,scex(_("Name|#N")),1); + fl_set_object_callback(obj, RefSelectCB, 2); + fdui->ref_name = obj = fl_add_input(FL_NORMAL_INPUT, 80, 160, 200, 30, idex(_("Name|#N")));fl_set_button_shortcut(obj, scex(_("Name|#N")), 1); fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast); fl_set_object_resize(obj, FL_RESIZE_X); fl_end_form(); diff --git a/src/lyx_cb.C b/src/lyx_cb.C index a99282cb4b..062287c4da 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich, * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -31,7 +31,9 @@ #include "credits.h" #include "insets/insetref.h" #include "insets/insetquotes.h" +#if 0 #include "insets/insetlatex.h" +#endif #include "insets/insetlabel.h" #include "insets/insetinfo.h" #include "insets/insetspecialchar.h" @@ -313,7 +315,7 @@ void SmallUpdate(signed char f) current_view->buffer()->text->sel_cursor = current_view->buffer()->text->cursor; - if (f==1 || f==-1) { + if (f == 1 || f == -1) { if (current_view->buffer()->isLyxClean()) { current_view->buffer()->markDirty(); minibuffer->setTimer(4); @@ -341,7 +343,7 @@ void MenuWrite(Buffer* buf) string fname = buf->getFileName(); string s = MakeAbsPath(fname); if (AskQuestion(_("Save failed. Rename and try again?"), - MakeDisplayPath(s,50), + MakeDisplayPath(s, 50), _("(If not, document is not saved.)"))) { MenuWriteAs(buf); } @@ -379,14 +381,14 @@ void MenuWriteAs(Buffer *buffer) } // Make sure the absolute filename ends with appropriate suffix - string s= MakeAbsPath(fname); + string s = MakeAbsPath(fname); if (!IsLyXFilename(s)) s += ".lyx"; // Same name as we have already? if (s == oldname) { if (!AskQuestion(_("Same name as document already has:"), - MakeDisplayPath(s,50), + MakeDisplayPath(s, 50), _("Save anyway?"))) return; // Falls through to name change and save @@ -394,7 +396,7 @@ void MenuWriteAs(Buffer *buffer) // No, but do we have another file with this name open? else if (bufferlist.exists(s)) { if (AskQuestion(_("Another document with same name open!"), - MakeDisplayPath(s,50), + MakeDisplayPath(s, 50), _("Replace with current document?"))) { bufferlist.close(bufferlist.getBuffer(s)); @@ -412,7 +414,7 @@ void MenuWriteAs(Buffer *buffer) else { FileInfo myfile(s); if (myfile.isOK() && !AskQuestion(_("Document already exists:"), - MakeDisplayPath(s,50), + MakeDisplayPath(s, 50), _("Replace file?"))) return; } @@ -514,7 +516,7 @@ int MenuRunChktex(Buffer *buffer) } WriteAlert(_("Chktex run successfully"), s, t); } else { - WriteAlert(_("Error!"),_("It seems chktex does not work.")); + WriteAlert(_("Error!"), _("It seems chktex does not work.")); } return ret; } @@ -545,11 +547,11 @@ int MakeDVIOutput(Buffer *buffer) // Returns false if we fail. bool RunScript(Buffer * buffer, bool wait, string const & command, string const & orgname = string(), - bool need_shell=true) + bool need_shell = true) { string path; string cmd; - string name= orgname; + string name = orgname; int result = 0; if (MakeDVIOutput(buffer) > 0) @@ -605,12 +607,12 @@ bool RunScript(Buffer * buffer, bool wait, result = one.startscript(wait ? Systemcalls::Wait : Systemcalls::DontWait, cmd); } - return (result==0); + return (result == 0); } // Returns false if we fail -bool MenuRunDvips(Buffer *buffer, bool wait=false) +bool MenuRunDvips(Buffer *buffer, bool wait = false) { if (!buffer->text) return false; @@ -629,29 +631,29 @@ bool MenuRunDvips(Buffer *buffer, bool wait=false) string paper; char real_papersize = buffer->params.papersize; - if (real_papersize == PAPER_DEFAULT) + if (real_papersize == BufferParams::PAPER_DEFAULT) real_papersize = lyxrc->default_papersize; switch (real_papersize) { - case PAPER_USLETTER: + case BufferParams::PAPER_USLETTER: paper = "letter"; break; - case PAPER_A3PAPER: + case BufferParams::PAPER_A3PAPER: paper = "a3"; break; - case PAPER_A4PAPER: + case BufferParams::PAPER_A4PAPER: paper = "a4"; break; - case PAPER_A5PAPER: + case BufferParams::PAPER_A5PAPER: paper = "a5"; break; - case PAPER_B5PAPER: + case BufferParams::PAPER_B5PAPER: paper = "b5"; break; - case PAPER_EXECUTIVEPAPER: + case BufferParams::PAPER_EXECUTIVEPAPER: paper = "foolscap"; break; - case PAPER_LEGALPAPER: + case BufferParams::PAPER_LEGALPAPER: paper = "legal"; break; default: /* If nothing else fits, keep an empty value... */ @@ -662,7 +664,7 @@ bool MenuRunDvips(Buffer *buffer, bool wait=false) string command = "dvips " + lyxrc->print_to_file + ' '; command += SpaceLess(ps); if (buffer->params.use_geometry - && buffer->params.papersize2 == VM_PAPER_CUSTOM + && buffer->params.papersize2 == BufferParams::VM_PAPER_CUSTOM && !lyxrc->print_paper_dimension_flag.empty() && !buffer->params.paperwidth.empty() && !buffer->params.paperheight.empty()) { @@ -672,14 +674,14 @@ bool MenuRunDvips(Buffer *buffer, bool wait=false) command += buffer->params.paperwidth + ','; command += buffer->params.paperheight; } else if (!paper.empty() - && (real_papersize != PAPER_USLETTER || - buffer->params.orientation == ORIENTATION_PORTRAIT)) { + && (real_papersize != BufferParams::PAPER_USLETTER || + buffer->params.orientation == BufferParams::ORIENTATION_PORTRAIT)) { // dvips won't accept -t letter -t landscape. In all other // cases, include the paper size explicitly. command += ' '; command += lyxrc->print_paper_flag + ' ' + paper; } - if (buffer->params.orientation == ORIENTATION_LANDSCAPE) { + if (buffer->params.orientation == BufferParams::ORIENTATION_LANDSCAPE) { command += ' '; command += lyxrc->print_landscape_flag; } @@ -744,7 +746,7 @@ void MenuFax(Buffer *buffer) help2 += " &"; Systemcalls one(Systemcalls::System, help2); } else - send_fax(ps,lyxrc->fax_command); + send_fax(ps, lyxrc->fax_command); } @@ -757,29 +759,29 @@ bool MenuPreview(Buffer *buffer) string paper; char real_papersize = buffer->params.papersize; - if (real_papersize == PAPER_DEFAULT) + if (real_papersize == BufferParams::PAPER_DEFAULT) real_papersize = lyxrc->default_papersize; switch (real_papersize) { - case PAPER_USLETTER: + case BufferParams::PAPER_USLETTER: paper = "us"; break; - case PAPER_A3PAPER: + case BufferParams::PAPER_A3PAPER: paper = "a3"; break; - case PAPER_A4PAPER: + case BufferParams::PAPER_A4PAPER: paper = "a4"; break; - case PAPER_A5PAPER: + case BufferParams::PAPER_A5PAPER: paper = "a5"; break; - case PAPER_B5PAPER: + case BufferParams::PAPER_B5PAPER: paper = "b5"; break; - case PAPER_EXECUTIVEPAPER: + case BufferParams::PAPER_EXECUTIVEPAPER: paper = "foolscap"; break; - case PAPER_LEGALPAPER: + case BufferParams::PAPER_LEGALPAPER: paper = "legal"; break; default: /* If nothing else fits, keep the empty value */ @@ -787,14 +789,14 @@ bool MenuPreview(Buffer *buffer) } if (paper.empty()) { - if (buffer->params.orientation == ORIENTATION_LANDSCAPE) + if (buffer->params.orientation == BufferParams::ORIENTATION_LANDSCAPE) // we HAVE to give a size when the page is in // landscape, so use USletter. paper = " -paper usr"; } else { paper = " -paper " + paper; - if (buffer->params.orientation == ORIENTATION_LANDSCAPE) - paper+='r'; + if (buffer->params.orientation == BufferParams::ORIENTATION_LANDSCAPE) + paper+= 'r'; } // push directorypath, if necessary @@ -821,7 +823,7 @@ void MenuMakeLaTeX(Buffer * buffer) FilePtr myfile(s, FilePtr::read); if (myfile() && !AskQuestion(_("File already exists:"), - MakeDisplayPath(s,50), + MakeDisplayPath(s, 50), _("Do you want to overwrite the file?"))) { minibuffer->Set(_("Canceled")); return; @@ -858,7 +860,7 @@ void MenuMakeLinuxDoc(Buffer *buffer) FilePtr myfile(s, FilePtr::read); if (myfile() && !AskQuestion(_("File already exists:"), - MakeDisplayPath(s,50), + MakeDisplayPath(s, 50), _("Do you want to overwrite the file?"))) { minibuffer->Set(_("Canceled")); return; @@ -891,7 +893,7 @@ void MenuMakeDocBook(Buffer *buffer) FilePtr myfile(s, FilePtr::read); if (myfile() && !AskQuestion(_("File already exists:"), - MakeDisplayPath(s,50), + MakeDisplayPath(s, 50), _("Do you want to overwrite the file?"))) { minibuffer->Set(_("Canceled")); return; @@ -918,7 +920,7 @@ void MenuMakeAscii(Buffer *buffer) FilePtr myfile(s, FilePtr::read); if (myfile() && !AskQuestion(_("File already exists:"), - MakeDisplayPath(s,50), + MakeDisplayPath(s, 50), _("Do you want to overwrite the file?"))) { minibuffer->Set(_("Canceled")); return; @@ -997,7 +999,7 @@ void AutoSave() minibuffer->Set(_("Autosaving current document...")); // create autosave filename - string fname = OnlyPath(current_view->buffer()->getFileName()); + string fname = OnlyPath(current_view->buffer()->getFileName()); fname += "#"; fname += OnlyFilename(current_view->buffer()->getFileName()); fname += "#"; @@ -1073,7 +1075,7 @@ Buffer * NewLyxFile(string const & filename) << "\nTemplate is " << tmpname << endl; // find a free buffer - Buffer *tmpbuf = bufferlist.newFile(name,tmpname); + Buffer *tmpbuf = bufferlist.newFile(name, tmpname); if (tmpbuf) lastfiles->newFile(tmpbuf->getFileName()); return tmpbuf; @@ -1103,23 +1105,18 @@ void InsertAsciiFile(string const & f, bool asParagraph) if (!fi.exist() || !fi.readable() || !myfile()) { WriteFSAlert(_("Error! Cannot open specified file:"), - MakeDisplayPath(fname,50)); + MakeDisplayPath(fname, 50)); return; } tmppar = new LyXParagraph; -#ifdef NEW_TEXT - tmppar->text.reserve(500); -#endif tmppar->readSimpleWholeFile(myfile); // set the end of the string -#ifdef NEW_TEXT +#warning why do we do this? // I don't think this is needed. Actually it might be plain wrong. tmppar->InsertChar(tmppar->text.size() - 1,'\0'); -#else - tmppar->InsertChar(tmppar->last-1,'\0'); -#endif + // insert the string current_view->getScreen()->HideCursor(); @@ -1149,16 +1146,16 @@ void MenuShowTableOfContents() ow = fd_form_toc->form_toc->w; oh = fd_form_toc->form_toc->h; } - fl_set_form_minsize(fd_form_toc->form_toc,ow,oh); + fl_set_form_minsize(fd_form_toc->form_toc, ow, oh); } } -void MenuInsertLabel(const char *arg) +void MenuInsertLabel(char const *arg) { string label = arg; ProhibitInput(); - //string label = fl_show_input(_("Enter new label to insert:"),""); + //string label = fl_show_input(_("Enter new label to insert:"), ""); if (label.empty()) label = frontStrip(strip(askForText(_("Enter new label to insert:")))); if (!label.empty()) { @@ -1185,7 +1182,7 @@ void MenuInsertRef() ow = fd_form_ref->form_ref->w; oh = fd_form_ref->form_ref->h; } - fl_set_form_minsize(fd_form_ref->form_ref,ow,oh); + fl_set_form_minsize(fd_form_ref->form_ref, ow, oh); } } @@ -1256,11 +1253,11 @@ int RunLinuxDoc(int flag, string const & filename) if (flag != -1) { if (!current_view->available()) return 0; - current_view->buffer()->makeLinuxDocFile(name,0); - LYX_PAPER_SIZE ps = (LYX_PAPER_SIZE) current_view->buffer()->params.papersize; + current_view->buffer()->makeLinuxDocFile(name, 0); + BufferParams::PAPER_SIZE ps = current_view->buffer()->params.papersize; switch (ps) { - case PAPER_A4PAPER: add_flags = "-p a4"; break; - case PAPER_USLETTER: add_flags = "-p letter"; break; + case BufferParams::PAPER_A4PAPER: add_flags = "-p a4"; break; + case BufferParams::PAPER_USLETTER: add_flags = "-p letter"; break; default: /* nothing to be done yet ;-) */ break; } } @@ -1327,14 +1324,14 @@ int RunDocBook(int flag, string const & filename) if (!current_view->available()) return 0; - current_view->buffer()->makeDocBookFile(name,0); + current_view->buffer()->makeDocBookFile(name, 0); // Shall this code go or should it stay? (Lgb) // string add_flags; // LYX_PAPER_SIZE ps = (LYX_PAPER_SIZE) current_view->buffer()->params.papersize; // switch (ps) { -// case PAPER_A4PAPER: add_flags = "-p a4"; break; -// case PAPER_USLETTER: add_flags = "-p letter"; break; +// case BufferParams::PAPER_A4PAPER: add_flags = "-p a4"; break; +// case BufferParams::PAPER_USLETTER: add_flags = "-p letter"; break; // default: /* nothing to be done yet ;-) */ break; // } ProhibitInput(); @@ -1412,7 +1409,7 @@ void AllFloats(char flag, char figmar) ) ){ if (par->previous - && par->previous->footnoteflag != + && par->previous->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){ /* should be */ current_view->buffer()->text->SetCursorIntern(par->previous, 0); @@ -1466,13 +1463,13 @@ void MenuLayoutCharacter() fl_raise_form(fd_form_character->form_character); } else { fl_show_form(fd_form_character->form_character, - FL_PLACE_MOUSE | FL_FREE_SIZE,FL_FULLBORDER, + FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER, _("Character Style")); if (ow < 0) { ow = fd_form_character->form_character->w; oh = fd_form_character->form_character->h; } - fl_set_form_minsize(fd_form_character->form_character,ow,oh); + fl_set_form_minsize(fd_form_character->form_character, ow, oh); } } @@ -1556,7 +1553,7 @@ bool UpdateLayoutParagraph() int align = buf->text->cursor.par->GetAlign(); if (align == LYX_ALIGN_LAYOUT) - align = textclasslist.Style(buf->params.textclass, + align = textclasslist.Style(buf->params.textclass, buf->text->cursor.par->GetLayout()).align; switch (align) { @@ -1810,7 +1807,7 @@ bool UpdateLayoutDocument(BufferParams *params) fl_set_button(fd_form_document->check_use_amsmath, params->use_amsmath); - if (params->paragraph_separation == LYX_PARSEP_INDENT) + if (params->paragraph_separation == BufferParams::PARSEP_INDENT) fl_set_button(fd_form_document->radio_indent, 1); else fl_set_button(fd_form_document->radio_skip, 1); @@ -1875,7 +1872,7 @@ bool UpdateLayoutDocument(BufferParams *params) { fl_set_choice(fd_form_document->choice_spacing, 4); char sval[20]; - sprintf(sval,"%g",params->spacing.getValue()); + sprintf(sval, "%g", params->spacing.getValue()); fl_set_input(fd_form_document->input_spacing, sval); break; } @@ -2017,7 +2014,7 @@ void MenuLayoutPreamble() oh = fd_form_preamble->form_preamble->h; } fl_set_form_minsize(fd_form_preamble->form_preamble, - ow,oh); + ow, oh); } } } @@ -2038,7 +2035,7 @@ void NoteCB() { InsetInfo *new_inset = new InsetInfo(); current_view->buffer()->insertInset(new_inset); - new_inset->Edit(0,0); + new_inset->Edit(0, 0); //current_view->buffer()->update(-1); } @@ -2163,7 +2160,7 @@ void Newline() if (current_view->available()) { current_view->getScreen()->HideCursor(); current_view->buffer()->update(-2); - current_view->buffer()->text->InsertChar(LYX_META_NEWLINE); + current_view->buffer()->text->InsertChar(LyXParagraph::META_NEWLINE); current_view->buffer()->update(-1); } } @@ -2174,7 +2171,7 @@ void ProtectedBlank() if (current_view->available()) { current_view->getScreen()->HideCursor(); current_view->buffer()->update(-2); - current_view->buffer()->text->InsertChar(LYX_META_PROTECTED_SEPARATOR); + current_view->buffer()->text->InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR); current_view->buffer()->update(-1); } } @@ -2185,7 +2182,7 @@ void HFill() if (current_view->available()) { current_view->getScreen()->HideCursor(); current_view->buffer()->update(-2); - current_view->buffer()->text->InsertChar(LYX_META_HFILL); + current_view->buffer()->text->InsertChar(LyXParagraph::META_HFILL); current_view->buffer()->update(-1); } } @@ -2740,8 +2737,8 @@ extern "C" void CharacterCloseCB(FL_OBJECT *, long) extern "C" void CharacterOKCB(FL_OBJECT *ob, long data) { - CharacterApplyCB(ob,data); - CharacterCloseCB(ob,data); + CharacterApplyCB(ob, data); + CharacterCloseCB(ob, data); } @@ -2849,7 +2846,7 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long) { bool redo = false; BufferParams *params = &(current_view->buffer()->params); - current_view->buffer()->params.language = + current_view->buffer()->params.language = combo_language->getline(); // If default skip is a "Length" but there's no text in the @@ -2864,17 +2861,17 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long) /* ChangeKeymap(buffer->parameters.language, TRUE, false, fl_get_choice(fd_form_document->choice_language)); */ - params->fonts = + params->fonts = fl_get_choice_text(fd_form_document->choice_fonts); - params->inputenc = + params->inputenc = fl_get_choice_text(fd_form_document->choice_inputenc); - params->fontsize = + params->fontsize = fl_get_choice_text(fd_form_document->choice_fontsize); - params->pagestyle = + params->pagestyle = fl_get_choice_text(fd_form_document->choice_pagestyle); - params->graphicsDriver = + params->graphicsDriver = fl_get_choice_text(fd_form_document->choice_postscript_driver); - params->use_amsmath = + params->use_amsmath = fl_get_button(fd_form_document->check_use_amsmath); if (!current_view->available()) @@ -2897,13 +2894,13 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long) if (ret){ string s; - if (ret==1) - s= _("One paragraph couldn't be converted"); + if (ret == 1) + s = _("One paragraph couldn't be converted"); else { s += tostr(ret); s += _(" paragraphs couldn't be converted"); } - WriteAlert(_("Conversion Errors!"),s, + WriteAlert(_("Conversion Errors!"), s, _("into chosen document class")); } @@ -2919,9 +2916,9 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long) char tmpsep = params->paragraph_separation; if (fl_get_button(fd_form_document->radio_indent)) - params->paragraph_separation = LYX_PARSEP_INDENT; + params->paragraph_separation = BufferParams::PARSEP_INDENT; else - params->paragraph_separation = LYX_PARSEP_SKIP; + params->paragraph_separation = BufferParams::PARSEP_SKIP; if (tmpsep != params->paragraph_separation) redo = true; @@ -2981,7 +2978,7 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long) params->tocdepth = static_cast(fl_get_counter_value(fd_form_document->slider_tocdepth)); - params->float_placement = + params->float_placement = fl_get_input(fd_form_document->input_float_placement); // More checking should be done to ensure the string doesn't have @@ -2993,7 +2990,7 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long) minibuffer->Set(_("Document layout set")); current_view->buffer()->markDirty(); - params->options = + params->options = fl_get_input(fd_form_document->input_extra); } @@ -3007,8 +3004,8 @@ extern "C" void DocumentCancelCB(FL_OBJECT *, long) extern "C" void DocumentOKCB(FL_OBJECT *ob, long data) { - DocumentCancelCB(ob,data); - DocumentApplyCB(ob,data); + DocumentCancelCB(ob, data); + DocumentApplyCB(ob, data); } @@ -3031,11 +3028,11 @@ void GotoNote() if (!current_view->buffer()->text->GotoNextNote()) { if (current_view->buffer()->text->cursor.pos - || current_view->buffer()->text->cursor.par != + || current_view->buffer()->text->cursor.par != current_view->buffer()->text->FirstParagraph()) { tmp = current_view->buffer()->text->cursor; - current_view->buffer()->text->cursor.par = + current_view->buffer()->text->cursor.par = current_view->buffer()->text->FirstParagraph(); current_view->buffer()->text->cursor.pos = 0; if (!current_view->buffer()->text->GotoNextNote()) { @@ -3049,7 +3046,7 @@ void GotoNote() } } current_view->buffer()->update(0); - current_view->buffer()->text->sel_cursor = + current_view->buffer()->text->sel_cursor = current_view->buffer()->text->cursor; } @@ -3076,7 +3073,7 @@ extern "C" void QuotesApplyCB(FL_OBJECT *, long) return; minibuffer->Set(_("Quotes type set")); - //current_view->buffer()->params.quotes_language = + //current_view->buffer()->params.quotes_language = // fl_get_choice(fd_form_quotes->choice_quotes_language) - 1; InsetQuotes::quote_language lga = InsetQuotes::EnglishQ; switch(fl_get_choice(fd_form_quotes->choice_quotes_language) - 1) { @@ -3136,7 +3133,7 @@ extern "C" void PreambleApplyCB(FL_OBJECT *, long) if (!current_view->available()) return; - current_view->buffer()->params.preamble = + current_view->buffer()->params.preamble = fl_get_input(fd_form_preamble->input_preamble); current_view->buffer()->markDirty(); minibuffer->Set(_("LaTeX preamble set")); @@ -3154,7 +3151,7 @@ extern "C" void PreambleOKCB(FL_OBJECT *ob, long data) extern "C" void TableApplyCB(FL_OBJECT *, long) { - int xsize,ysize; + int xsize, ysize; if (!current_view->getScreen()) return; @@ -3193,7 +3190,7 @@ extern "C" void TableApplyCB(FL_OBJECT *, long) //if (!fl_get_button(fd_form_table->check_latex)){ // insert the new wysiwy table current_view->buffer()->text->SetLayout(0); // standard layout - if (current_view->buffer()->text->cursor.par->footnoteflag == + if (current_view->buffer()->text->cursor.par->footnoteflag == LyXParagraph::NO_FOOTNOTE) { current_view->buffer()-> text->SetParagraph(0, 0, @@ -3219,8 +3216,8 @@ extern "C" void TableApplyCB(FL_OBJECT *, long) current_view->buffer()->text->cursor.par->table = new LyXTable(xsize, ysize); int i; - for (i=0; ibuffer()->text->cursor.par->InsertChar(0,LYX_META_NEWLINE); + for (i = 0; ibuffer()->text->cursor.par->InsertChar(0, LyXParagraph::META_NEWLINE); current_view->buffer()->text->RedoParagraph(); current_view->buffer()->text->UnFreezeUndo(); @@ -3238,8 +3235,8 @@ extern "C" void TableCancelCB(FL_OBJECT *, long) extern "C" void TableOKCB(FL_OBJECT *ob, long data) { - TableApplyCB(ob,data); - TableCancelCB(ob,data); + TableApplyCB(ob, data); + TableCancelCB(ob, data); } @@ -3250,11 +3247,11 @@ extern "C" void PrintCancelCB(FL_OBJECT *, long) fl_hide_form(fd_form_print->form_print); } -static bool stringOnlyContains (string const & LStr, const char * cset) +static bool stringOnlyContains (string const & LStr, char const * cset) { - const char * cstr = LStr.c_str() ; + char const * cstr = LStr.c_str() ; - return strspn(cstr,cset) == strlen(cstr) ; + return strspn(cstr, cset) == strlen(cstr) ; } extern "C" void PrintApplyCB(FL_OBJECT *, long) @@ -3316,7 +3313,7 @@ extern "C" void PrintApplyCB(FL_OBJECT *, long) reverseflag = lyxrc->print_reverse_flag + ' '; string orientationflag; - if (buffer->params.orientation == ORIENTATION_LANDSCAPE) + if (buffer->params.orientation == BufferParams::ORIENTATION_LANDSCAPE) orientationflag = lyxrc->print_landscape_flag + ' '; string ps_file = SpaceLess(fl_get_input(fd_form_print->input_file)); @@ -3336,31 +3333,31 @@ extern "C" void PrintApplyCB(FL_OBJECT *, long) + orientationflag + extraflags; char real_papersize = buffer->params.papersize; - if (real_papersize == PAPER_DEFAULT) + if (real_papersize == BufferParams::PAPER_DEFAULT) real_papersize = lyxrc->default_papersize; string paper; switch (real_papersize) { - case PAPER_USLETTER: + case BufferParams::PAPER_USLETTER: paper = "letter"; break; - case PAPER_A3PAPER: + case BufferParams::PAPER_A3PAPER: paper = "a3"; break; - case PAPER_A4PAPER: + case BufferParams::PAPER_A4PAPER: paper = "a4"; break; - case PAPER_A5PAPER: + case BufferParams::PAPER_A5PAPER: paper = "a5"; break; - case PAPER_B5PAPER: + case BufferParams::PAPER_B5PAPER: paper = "b5"; break; - case PAPER_EXECUTIVEPAPER: + case BufferParams::PAPER_EXECUTIVEPAPER: paper = "foolscap"; break; - case PAPER_LEGALPAPER: + case BufferParams::PAPER_LEGALPAPER: paper = "legal"; break; default: /* If nothing else fits, keep an empty value... */ @@ -3368,7 +3365,7 @@ extern "C" void PrintApplyCB(FL_OBJECT *, long) } if (buffer->params.use_geometry - && buffer->params.papersize2 == VM_PAPER_CUSTOM + && buffer->params.papersize2 == BufferParams::VM_PAPER_CUSTOM && !lyxrc->print_paper_dimension_flag.empty() && !buffer->params.paperwidth.empty() && !buffer->params.paperheight.empty()) { @@ -3379,8 +3376,8 @@ extern "C" void PrintApplyCB(FL_OBJECT *, long) command += buffer->params.paperheight + ' '; } else if (!lyxrc->print_paper_flag.empty() && !paper.empty() - && (real_papersize != PAPER_USLETTER || - buffer->params.orientation == ORIENTATION_PORTRAIT)) { + && (real_papersize != BufferParams::PAPER_USLETTER || + buffer->params.orientation == BufferParams::ORIENTATION_PORTRAIT)) { command += " " + lyxrc->print_paper_flag + " " + paper + " "; } if (fl_get_button(fd_form_print->radio_file)) @@ -3421,7 +3418,7 @@ extern "C" void PrintApplyCB(FL_OBJECT *, long) extern "C" void PrintOKCB(FL_OBJECT *ob, long data) { PrintCancelCB(ob, data); - PrintApplyCB(ob,data); + PrintApplyCB(ob, data); } @@ -3466,7 +3463,7 @@ extern "C" void FigureApplyCB(FL_OBJECT *, long) // The standard layout should always be numer 0; buffer->text->SetLayout(0); - if (buffer->text->cursor.par->footnoteflag == + if (buffer->text->cursor.par->footnoteflag == LyXParagraph::NO_FOOTNOTE) { buffer->text->SetParagraph(0, 0, 0, 0, @@ -3506,8 +3503,8 @@ extern "C" void FigureCancelCB(FL_OBJECT *, long) extern "C" void FigureOKCB(FL_OBJECT *ob, long data) { - FigureApplyCB(ob,data); - FigureCancelCB(ob,data); + FigureApplyCB(ob, data); + FigureCancelCB(ob, data); } extern "C" void ScreenApplyCB(FL_OBJECT *, long) @@ -3534,8 +3531,8 @@ extern "C" void ScreenCancelCB(FL_OBJECT *, long) extern "C" void ScreenOKCB(FL_OBJECT *ob, long data) { - ScreenCancelCB(ob,data); - ScreenApplyCB(ob,data); + ScreenCancelCB(ob, data); + ScreenApplyCB(ob, data); } @@ -3566,7 +3563,7 @@ void Reconfigure() // Run configure in user lyx directory Path p(user_lyxdir); Systemcalls one(Systemcalls::System, - AddName(system_lyxdir,"configure")); + AddName(system_lyxdir, "configure")); p.pop(); minibuffer->Set(_("Reloading configuration...")); lyxrc->Read(LibFileSearch(string(), "lyxrc.defaults")); @@ -3664,7 +3661,7 @@ extern "C" void TocSelectCB(FL_OBJECT *ob, long) int i = fl_get_browser(ob); int a = 0; - for (a=1; anext; a++){ + for (a = 1; anext; a++){ tmptoclist = tmptoclist->next; } @@ -3686,7 +3683,7 @@ extern "C" void TocSelectCB(FL_OBJECT *ob, long) if (par) { BeforeChange(); current_view->buffer()->text->SetCursor(par, 0); - current_view->buffer()->text->sel_cursor = + current_view->buffer()->text->sel_cursor = current_view->buffer()->text->cursor; current_view->buffer()->update(0); } @@ -3750,7 +3747,7 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long) /* insert this into the table of contents */ /* first indent a little bit */ - for (pos=0; + for (pos = 0; pos < (labeltype - textclasslist.TextClass(current_view->buffer()-> params.textclass).maxcounter()) * 4 + 2; @@ -3771,13 +3768,8 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long) pos++; /* now the contents */ -#ifdef NEW_TEXT LyXParagraph::size_type i = 0; while (pos < 199 && i < par->size()) { -#else - int i = 0; - while (pos < 199 && i < par->last) { -#endif c = par->GetChar(i); if (isprint(c) || c >= 128) { line[pos] = c; @@ -3799,7 +3791,7 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long) tmptoclist->next = 0; int a = 0; - for (a=0; a<6; a++){ + for (a = 0; a<6; a++){ tmptoclist->counter[a] = par->GetFirstCounter(a); } tmptoclist->appendix = par->appendix; @@ -3819,7 +3811,7 @@ extern "C" void RefSelectCB(FL_OBJECT *, long data) if (!current_view->available()) return; - string s = + string s = fl_get_browser_line(fd_form_ref->browser_ref, fl_get_browser(fd_form_ref->browser_ref)); string u = frontStrip(strip(fl_get_input(fd_form_ref->ref_name))); @@ -3827,13 +3819,13 @@ extern "C" void RefSelectCB(FL_OBJECT *, long data) if (s.empty()) return; - if (data==2) { + if (data == 2) { current_view->owner()->getLyXFunc()->Dispatch(LFUN_REFGOTO, s.c_str()); return; } string t; - if (data==0) + if (data == 0) t += "\\ref"; else t += "\\pageref"; @@ -3843,7 +3835,7 @@ extern "C" void RefSelectCB(FL_OBJECT *, long data) else t += "{" + s + "}"; - Inset *new_inset = + Inset *new_inset = new InsetRef(t, current_view->buffer()); current_view->buffer()->insertInset(new_inset); } @@ -3859,9 +3851,9 @@ extern "C" void RefUpdateCB(FL_OBJECT *, long) FL_OBJECT * brow = fd_form_ref->browser_ref; // Get the current line, in order to restore it later - char const * const btmp=fl_get_browser_line(brow, + char const * const btmp = fl_get_browser_line(brow, fl_get_browser(brow)); - string currentstr=btmp ? btmp : ""; + string currentstr = btmp ? btmp : ""; //string currentstr = fl_get_browser_line(brow, // fl_get_browser(brow)); @@ -3871,7 +3863,7 @@ extern "C" void RefUpdateCB(FL_OBJECT *, long) int topline = 1; #if FL_REVISION > 85 - fl_addto_browser_chars(brow,refs.c_str()); + fl_addto_browser_chars(brow, refs.c_str()); int total_lines = fl_get_browser_maxline(brow); for (int i = 1; i <= total_lines ; i++) { if (fl_get_browser_line(brow, i) == currentstr) { @@ -3886,10 +3878,10 @@ extern "C" void RefUpdateCB(FL_OBJECT *, long) int ref_num = 0; while(true) { - curr_ref = refs.token('\n',ref_num); + curr_ref = refs.token('\n', ref_num); if (curr_ref.empty()) break; - fl_add_browser_line(brow,curr_ref.c_str()); + fl_add_browser_line(brow, curr_ref.c_str()); ref_num++; } #endif diff --git a/src/lyx_gui.C b/src/lyx_gui.C index 0622a55de2..c7d3fe9810 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -6,7 +6,7 @@ * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include #include @@ -186,7 +186,7 @@ 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())); + Screen * scr = (DefaultScreenOfDisplay(fl_get_display())); if (HeightOfScreen(scr)-24form_title, CancelCloseBoxCB, 0); fl_addto_form(fd_form_title->form_title); #ifdef TWO_COLOR_ICONS - FL_OBJECT *obj = fl_add_bitmapbutton(FL_NORMAL_BUTTON,0,0,425,290,""); - fl_set_bitmapbutton_data(obj,banner_bw_width, + FL_OBJECT *obj = fl_add_bitmapbutton(FL_NORMAL_BUTTON, 0, 0, 425, 290, ""); + fl_set_bitmapbutton_data(obj, banner_bw_width, banner_bw_height, banner_bw_bits); - fl_set_object_color(obj,FL_WHITE,FL_BLACK); + fl_set_object_color(obj, FL_WHITE, FL_BLACK); #else - FL_OBJECT *obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON,0,0,425,290,""); + FL_OBJECT *obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 0, 0, 425, 290, ""); fl_set_pixmapbutton_data(obj, (char**)banner); #if FL_REVISION > 85 - fl_set_pixmapbutton_focus_outline(obj,3); + fl_set_pixmapbutton_focus_outline(obj, 3); #endif #endif - fl_set_button_shortcut(obj,"^M ^[",1); - fl_set_object_boxtype(obj,FL_NO_BOX); - fl_set_object_callback(obj,TimerCB,0); + fl_set_button_shortcut(obj, "^M ^[", 1); + fl_set_object_boxtype(obj, FL_NO_BOX); + fl_set_object_callback(obj, TimerCB, 0); - obj = fl_add_text(FL_NORMAL_TEXT,248,265,170,16, LYX_VERSION); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_text(FL_NORMAL_TEXT, 248, 265, 170, 16, LYX_VERSION); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); #ifdef TWO_COLOR_ICONS - fl_set_object_color(obj,FL_WHITE,FL_WHITE); - fl_set_object_lcol(obj,FL_BLACK); + fl_set_object_color(obj, FL_WHITE, FL_WHITE); + fl_set_object_lcol(obj, FL_BLACK); #else -// fl_set_object_color(obj,FL_WHITE, FL_WHITE); -// fl_set_object_lcol(obj,FL_BLACK); +// fl_set_object_color(obj, FL_WHITE, FL_WHITE); +// fl_set_object_lcol(obj, FL_BLACK); fl_mapcolor(FL_FREE_COL2, 0x05, 0x2e, 0x4c); fl_mapcolor(FL_FREE_COL3, 0xe1, 0xd2, 0x9b); - fl_set_object_color(obj,FL_FREE_COL2, FL_FREE_COL2); - fl_set_object_lcol(obj,FL_FREE_COL3); + fl_set_object_color(obj, FL_FREE_COL2, FL_FREE_COL2); + fl_set_object_lcol(obj, FL_FREE_COL3); #endif - fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_end_form(); // the paragraph form @@ -433,36 +433,36 @@ void LyXGUI::create_forms() fl_addto_choice(fd_form_document->choice_spacing, _(" Single | OneHalf | Double | Other ")); - fl_set_counter_bounds(fd_form_document->slider_secnumdepth,-1,5); - fl_set_counter_bounds(fd_form_document->slider_tocdepth,-1,5); - fl_set_counter_step(fd_form_document->slider_secnumdepth,1,1); - fl_set_counter_step(fd_form_document->slider_tocdepth,1,1); + fl_set_counter_bounds(fd_form_document->slider_secnumdepth,-1, 5); + fl_set_counter_bounds(fd_form_document->slider_tocdepth,-1, 5); + fl_set_counter_step(fd_form_document->slider_secnumdepth, 1, 1); + fl_set_counter_step(fd_form_document->slider_tocdepth, 1, 1); fl_set_counter_precision(fd_form_document->slider_secnumdepth, 0); fl_set_counter_precision(fd_form_document->slider_tocdepth, 0); fl_addto_form(fd_form_document->form_document); combo_language = new Combox(FL_COMBOX_DROPLIST); FL_OBJECT *ob = fd_form_document->choice_language; combo_language->add(ob->x, ob->y, ob->w, ob->h, 200); - combo_language->shortcut("#G",1); + combo_language->shortcut("#G", 1); fl_end_form(); int n; // declared here because DEC cxx does not like multiple // declarations of variables in for() loops (JMarc) - for (n=0; tex_babel[n][0]; n++) { + for (n = 0; tex_babel[n][0]; n++) { combo_language->addto(tex_babel[n]); } // not really necessary, but we can do it anyway. fl_addto_choice(fd_form_document->choice_fontsize, "default|10|11|12"); - for (n=0; tex_fonts[n][0]; n++) { - fl_addto_choice(fd_form_document->choice_fonts,tex_fonts[n]); + for (n = 0; tex_fonts[n][0]; n++) { + fl_addto_choice(fd_form_document->choice_fonts, tex_fonts[n]); } fl_addto_choice(fd_form_document->choice_inputenc, "default|latin1|latin2|latin5" "|koi8-r|koi8-u|cp866|cp1251"); - for (n=0; tex_graphics[n][0]; n++) { + for (n = 0; tex_graphics[n][0]; n++) { fl_addto_choice(fd_form_document->choice_postscript_driver, tex_graphics[n]); } @@ -541,8 +541,8 @@ void LyXGUI::create_forms() // the table form fd_form_table = create_form_form_table(); fl_set_form_atclose(fd_form_table->form_table, CancelCloseBoxCB, 0); - fl_set_slider_bounds(fd_form_table->slider_rows,1,50); - fl_set_slider_bounds(fd_form_table->slider_columns,1,50); + fl_set_slider_bounds(fd_form_table->slider_rows, 1, 50); + fl_set_slider_bounds(fd_form_table->slider_columns, 1, 50); fl_set_slider_value(fd_form_table->slider_rows, 5); fl_set_slider_value(fd_form_table->slider_columns, 5); fl_set_slider_precision(fd_form_table->slider_rows, 0); @@ -561,7 +561,7 @@ void LyXGUI::create_forms() // the sendto form fd_form_sendto = create_form_form_sendto(); - fl_set_form_atclose(fd_form_sendto->form_sendto,CancelCloseBoxCB,0); + fl_set_form_atclose(fd_form_sendto->form_sendto, CancelCloseBoxCB, 0); // the figure form fd_form_figure = create_form_form_figure(); @@ -598,7 +598,7 @@ void LyXGUI::create_forms() int main_placement = FL_PLACE_CENTER | FL_FREE_SIZE; int title_placement = FL_PLACE_CENTER; // Did we get a valid position? - if (xpos>=0 && ypos>=0) { + if (xpos>= 0 && ypos>= 0) { lyxViews->setPosition(xpos, ypos); // show the title form in the middle of the main form fl_set_form_position(fd_form_title->form_title, diff --git a/src/lyx_gui.h b/src/lyx_gui.h index 399a93d6e9..420b077d3c 100644 --- a/src/lyx_gui.h +++ b/src/lyx_gui.h @@ -7,10 +7,10 @@ * Copyright (C) 1995 1996 Matthias Ettrich * and the LyX Team. * - *======================================================*/ + * ====================================================== */ -#ifndef _LYX_GUI_H_ -#define _LYX_GUI_H_ +#ifndef LYX_GUI_H +#define LYX_GUI_H #ifdef __GNUG__ #pragma interface diff --git a/src/lyx_gui_misc.C b/src/lyx_gui_misc.C index 2a0b816ab1..802d3b7d78 100644 --- a/src/lyx_gui_misc.C +++ b/src/lyx_gui_misc.C @@ -1,13 +1,13 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -227,7 +227,7 @@ void updateAllVisibleBufferRelatedPopups() } } if (fd_form_toc->browser_toc->visible) { - TocUpdateCB(0,0); + TocUpdateCB(0, 0); } #ifdef ALWAYS_UPDATE_REF // Ideally, the RefUpdateCB should be modified so that if the @@ -239,7 +239,7 @@ void updateAllVisibleBufferRelatedPopups() // of course a compromise and an annoyance for users switching // between separate documents. ARRae 241198 if (fd_form_ref->form_ref->visible) { - RefUpdateCB(0,0); + RefUpdateCB(0, 0); } #endif if (current_view->buffer()->isReadonly()) { @@ -308,10 +308,10 @@ void updateAllVisibleBufferRelatedPopups() const char* flyx_shortcut_extract(const char*sc) { // Find '|' in the sc and return the string after that. - register const char *sd = sc; - while(sd[0]!=0 && sd[0] != '|') sd++; + register char const *sd = sc; + while(sd[0]!= 0 && sd[0] != '|') sd++; - if (sd[0]=='|') { + if (sd[0] == '|') { sd++; //lyxerr << sd << endl; return sd; @@ -320,21 +320,21 @@ const char* flyx_shortcut_extract(const char*sc) } // Extract identifier from | string -const char* flyx_ident_extract(const char *sc) +const char* flyx_ident_extract(char const *sc) { - register const char *se = sc; - while(se[0]!=0 && se[0] != '|') se++; + register char const *se = sc; + while(se[0]!= 0 && se[0] != '|') se++; - if (se[0]==0) return sc; + if (se[0] == 0) return sc; char * sb = new char[se-sc + 1]; int index = 0; - register const char *sd = sc; + register char const *sd = sc; while (sd != se) { sb[index] = sd[0]; index++; sd++; } - sb[index]=0; + sb[index] = 0; return sb; } diff --git a/src/lyx_gui_misc.h b/src/lyx_gui_misc.h index 2ad413d558..c7291eb142 100644 --- a/src/lyx_gui_misc.h +++ b/src/lyx_gui_misc.h @@ -7,12 +7,12 @@ * Copyright (C) 1995 1996 Matthias Ettrich * and the LyX Team. * -*======================================================*/ +* ====================================================== */ // Misc. GUI specific routines -#ifndef _LYX_GUI_MISC_H -#define _LYX_GUI_MISC_H +#ifndef LYX_GUI_MISC_H +#define LYX_GUI_MISC_H #include FORMS_H_LOCATION #include "LString.h" @@ -34,27 +34,27 @@ const char* flyx_shortcut_extract(const char*sc); #define scex flyx_shortcut_extract /// Extract shortcut from | string -const char* flyx_ident_extract(const char *sc); +const char* flyx_ident_extract(char const *sc); /// Make a shortnamed versjon of the above func #define idex flyx_ident_extract /// Show message -void WriteAlert(string const & s1, string const & s2=string(), - string const & s3=string()); +void WriteAlert(string const & s1, string const & s2 = string(), + string const & s3 = string()); /// Alarms user of something related to files -void WriteFSAlert(string const & s1, string const & s2=string()); +void WriteFSAlert(string const & s1, string const & s2 = string()); /// Asks "Yes" or "No". Returns true for yes, false for no -bool AskQuestion(string const & s1, string const & s2=string(), - string const & s3=string()); +bool AskQuestion(string const & s1, string const & s2 = string(), + string const & s3 = string()); /// Asks "Yes", "No" or "Cancel". Returns 1 for yes, 2 for no, 3 for cancel -int AskConfirmation(string const & s1, string const & s2=string(), - string const & s3=string()); +int AskConfirmation(string const & s1, string const & s2 = string(), + string const & s3 = string()); /// returns a text -string askForText(string const & msg, string const & dflt=string()); +string askForText(string const & msg, string const & dflt = string()); /// Informs the user that changes in the coming form will be ignored void WarnReadonly(); diff --git a/src/lyx_main.C b/src/lyx_main.C index ede5b9c529..f7c2136454 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -86,7 +86,7 @@ LyX::LyX(int * argc, char * argv[]) // Now the GUI and LyX have taken care of their arguments, so // the only thing left on the command line should be // filenames. - if ((*argc)==2) + if ((*argc) == 2) lyxerr[Debug::INFO] << "Opening document..." << endl; else if ((*argc)>2) lyxerr[Debug::INFO] << "Opening documents..." << endl; @@ -192,7 +192,7 @@ void LyX::init(int */*argc*/, char **argv) // If we had a command line switch, system_lyxdir is already set string searchpath; if (!system_lyxdir.empty()) - searchpath=MakeAbsPath(system_lyxdir) + ';'; + searchpath= MakeAbsPath(system_lyxdir) + ';'; // LYX_DIR_10x environment variable string lyxdir = GetEnvPath("LYX_DIR_10x"); @@ -224,11 +224,11 @@ void LyX::init(int */*argc*/, char **argv) OnlyFilename(binname)) + ';'; // Follow Symlinks - FileInfo file(fullbinpath,true); + FileInfo file(fullbinpath, true); FollowLink = file.isLink(); if (FollowLink) { string Link; - if (LyXReadLink(fullbinpath,Link)) { + if (LyXReadLink(fullbinpath, Link)) { fullbinpath = Link; binpath = MakeAbsPath(OnlyPath(fullbinpath)); } @@ -320,7 +320,7 @@ 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 " @@ -400,7 +400,7 @@ void LyX::queryUserLyXDir() // Run configure in user lyx directory Path p(user_lyxdir); - system(AddName(system_lyxdir,"configure").c_str()); + system(AddName(system_lyxdir, "configure").c_str()); lyxerr << "LyX: " << _("Done!") << endl; } @@ -475,14 +475,14 @@ bool LyX::easyParse(int * argc, char * argv[]) if (arg == "-dbg") { if (i+1 < *argc) { int erri = 0; - sscanf(argv[i+1],"%d", &erri); + sscanf(argv[i+1], "%d", &erri); setDebuggingLevel(erri); // Now, remove these two arguments by shifting // the following two places down. (*argc) -= 2; - for (int j=i; j < (*argc); j++) + for (int j= i; j < (*argc); j++) argv[j] = argv[j+2]; i--; // After shift, check this number again. } else @@ -497,7 +497,7 @@ bool LyX::easyParse(int * argc, char * argv[]) // Now, remove these two arguments by shifting // the following two places down. (*argc) -= 2; - for (int j=i; j < (*argc); j++) + for (int j= i; j < (*argc); j++) argv[j] = argv[j+2]; i--; // After shift, check this number again. } else @@ -552,7 +552,7 @@ void error_handler(int err_sig) bufferlist.emergencyWriteAll(); lyxerr << "Bye." << endl; - if(err_sig!=SIGHUP && (!GetEnv("LYXDEBUG").empty() || err_sig == SIGSEGV)) + if(err_sig!= SIGHUP && (!GetEnv("LYXDEBUG").empty() || err_sig == SIGSEGV)) abort(); exit(0); } diff --git a/src/lyx_main.h b/src/lyx_main.h index 5077c4259c..668e5dd7e9 100644 --- a/src/lyx_main.h +++ b/src/lyx_main.h @@ -1,13 +1,13 @@ // -*- C++ -*- /* This file is part of -* ====================================================== +* ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995 1996 Matthias Ettrich * and the LyX Team. * -*======================================================*/ +* ====================================================== */ /* This is the declaration of the LyX class, there should only * exist _one_ instance of this in the application. */ diff --git a/src/lyx_sendfax.C b/src/lyx_sendfax.C index 1fa7b91fcd..490aa4706f 100644 --- a/src/lyx_sendfax.C +++ b/src/lyx_sendfax.C @@ -15,63 +15,63 @@ FD_xsendfax *create_form_xsendfax(void) FD_xsendfax *fdui = (FD_xsendfax *) fl_calloc(1, sizeof(FD_xsendfax)); fdui->xsendfax = fl_bgn_form(FL_NO_BOX, 600, 330); - obj = fl_add_box(FL_UP_BOX,0,0,600,330,""); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,15,465,125,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - fdui->Input_Phone = obj = fl_add_input(FL_NORMAL_INPUT,90,30,377,30,idex(_("Fax no.:|#F")));fl_set_button_shortcut(obj,scex(_("Fax no.:|#F")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->Input_Name = obj = fl_add_input(FL_NORMAL_INPUT,90,65,377,29,idex(_("Dest. Name:|#N")));fl_set_button_shortcut(obj,scex(_("Dest. Name:|#N")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->Input_Enterprise = obj = fl_add_input(FL_NORMAL_INPUT,90,100,377,29,idex(_("Enterprise:|#E")));fl_set_button_shortcut(obj,scex(_("Enterprise:|#E")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->Input_Comment = obj = fl_add_input(FL_MULTILINE_INPUT,15,165,575,106,""); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT); - fl_set_object_lstyle(obj,FL_NORMAL_STYLE+FL_EMBOSSED_STYLE); - fdui->Button_Send = obj = fl_add_button(FL_NORMAL_BUTTON,20,290,180,30,idex(_("OK|#O")));fl_set_button_shortcut(obj,scex(_("OK|#O")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fl_set_object_callback(obj,FaxSendCB,0); - fdui->Button_Cancel = obj = fl_add_button(FL_NORMAL_BUTTON,400,290,180,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fl_set_object_callback(obj,FaxCancelCB,0); - fdui->Button_Apply = obj = fl_add_button(FL_NORMAL_BUTTON,210,290,180,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fl_set_object_callback(obj,FaxApplyCB,0); - obj = fl_add_frame(FL_ENGRAVED_FRAME,485,30,105,100,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_text(FL_NORMAL_TEXT,490,20,95,20,_("Phone Book")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->Button_SPhone = obj = fl_add_button(FL_NORMAL_BUTTON,490,45,15,15,idex(_("Select from|#S")));fl_set_button_shortcut(obj,scex(_("Select from|#S")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_RIGHT); - fl_set_object_callback(obj,FaxOpenPhonebookCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,490,65,15,15,idex(_("Add to|#t")));fl_set_button_shortcut(obj,scex(_("Add to|#t")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_RIGHT); - fl_set_object_callback(obj,cb_add_phoneno,0); - obj = fl_add_button(FL_NORMAL_BUTTON,490,85,15,15,idex(_("Delete from|#D")));fl_set_button_shortcut(obj,scex(_("Delete from|#D")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_RIGHT); - fl_set_object_callback(obj,cb_delete_phoneno,0); - fdui->pb_save = obj = fl_add_button(FL_NORMAL_BUTTON,490,105,15,15,idex(_("Save|#V")));fl_set_button_shortcut(obj,scex(_("Save|#V")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_RIGHT); - fl_set_object_callback(obj,cb_save_phoneno,0); - obj = fl_add_text(FL_NORMAL_TEXT,15,5,100,20,_("Destination:")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,155,585,125,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_text(FL_NORMAL_TEXT,15,145,85,20,_("Comment:")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + obj = fl_add_box(FL_UP_BOX, 0, 0, 600, 330, ""); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 15, 465, 125, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + fdui->Input_Phone = obj = fl_add_input(FL_NORMAL_INPUT, 90, 30, 377, 30, idex(_("Fax no.:|#F")));fl_set_button_shortcut(obj, scex(_("Fax no.:|#F")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->Input_Name = obj = fl_add_input(FL_NORMAL_INPUT, 90, 65, 377, 29, idex(_("Dest. Name:|#N")));fl_set_button_shortcut(obj, scex(_("Dest. Name:|#N")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->Input_Enterprise = obj = fl_add_input(FL_NORMAL_INPUT, 90, 100, 377, 29, idex(_("Enterprise:|#E")));fl_set_button_shortcut(obj, scex(_("Enterprise:|#E")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->Input_Comment = obj = fl_add_input(FL_MULTILINE_INPUT, 15, 165, 575, 106, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + fl_set_object_lstyle(obj, FL_NORMAL_STYLE+FL_EMBOSSED_STYLE); + fdui->Button_Send = obj = fl_add_button(FL_NORMAL_BUTTON, 20, 290, 180, 30, idex(_("OK|#O")));fl_set_button_shortcut(obj, scex(_("OK|#O")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fl_set_object_callback(obj, FaxSendCB, 0); + fdui->Button_Cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 400, 290, 180, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fl_set_object_callback(obj, FaxCancelCB, 0); + fdui->Button_Apply = obj = fl_add_button(FL_NORMAL_BUTTON, 210, 290, 180, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fl_set_object_callback(obj, FaxApplyCB, 0); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 485, 30, 105, 100, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_text(FL_NORMAL_TEXT, 490, 20, 95, 20, _("Phone Book")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->Button_SPhone = obj = fl_add_button(FL_NORMAL_BUTTON, 490, 45, 15, 15, idex(_("Select from|#S")));fl_set_button_shortcut(obj, scex(_("Select from|#S")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_RIGHT); + fl_set_object_callback(obj, FaxOpenPhonebookCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 490, 65, 15, 15, idex(_("Add to|#t")));fl_set_button_shortcut(obj, scex(_("Add to|#t")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_RIGHT); + fl_set_object_callback(obj, cb_add_phoneno, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 490, 85, 15, 15, idex(_("Delete from|#D")));fl_set_button_shortcut(obj, scex(_("Delete from|#D")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_RIGHT); + fl_set_object_callback(obj, cb_delete_phoneno, 0); + fdui->pb_save = obj = fl_add_button(FL_NORMAL_BUTTON, 490, 105, 15, 15, idex(_("Save|#V")));fl_set_button_shortcut(obj, scex(_("Save|#V")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_RIGHT); + fl_set_object_callback(obj, cb_save_phoneno, 0); + obj = fl_add_text(FL_NORMAL_TEXT, 15, 5, 100, 20, _("Destination:")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 155, 585, 125, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_text(FL_NORMAL_TEXT, 15, 145, 85, 20, _("Comment:")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_end_form(); //fdui->xsendfax->fdui = fdui; @@ -86,10 +86,10 @@ FD_phonebook *create_form_phonebook(void) FD_phonebook *fdui = (FD_phonebook *) fl_calloc(1, sizeof(FD_phonebook)); fdui->phonebook = fl_bgn_form(FL_NO_BOX, 600, 320); - obj = fl_add_box(FL_UP_BOX,0,0,600,320,""); - fdui->browser = obj = fl_add_browser(FL_HOLD_BROWSER,2,2,598,318,""); - fl_set_object_lsize(obj,FL_MEDIUM_SIZE); - fl_set_object_callback(obj,cb_select_phoneno,0); + obj = fl_add_box(FL_UP_BOX, 0, 0, 600, 320, ""); + fdui->browser = obj = fl_add_browser(FL_HOLD_BROWSER, 2, 2, 598, 318, ""); + fl_set_object_lsize(obj, FL_MEDIUM_SIZE); + fl_set_object_callback(obj, cb_select_phoneno, 0); fl_end_form(); //fdui->phonebook->fdui = fdui; @@ -104,11 +104,11 @@ FD_logfile *create_form_logfile(void) FD_logfile *fdui = (FD_logfile *) fl_calloc(1, sizeof(FD_logfile)); fdui->logfile = fl_bgn_form(FL_NO_BOX, 510, 190); - obj = fl_add_box(FL_UP_BOX,0,0,510,190,""); - fdui->browser = obj = fl_add_browser(FL_NORMAL_BROWSER,10,10,490,130,""); - fdui->Button_Close = obj = fl_add_button(FL_RETURN_BUTTON,410,150,90,30,_("Close")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,FaxLogfileCloseCB,0); + obj = fl_add_box(FL_UP_BOX, 0, 0, 510, 190, ""); + fdui->browser = obj = fl_add_browser(FL_NORMAL_BROWSER, 10, 10, 490, 130, ""); + fdui->Button_Close = obj = fl_add_button(FL_RETURN_BUTTON, 410, 150, 90, 30, _("Close")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, FaxLogfileCloseCB, 0); fl_end_form(); //fdui->logfile->fdui = fdui; diff --git a/src/lyx_sendfax_main.C b/src/lyx_sendfax_main.C index e497427032..05f901884a 100644 --- a/src/lyx_sendfax_main.C +++ b/src/lyx_sendfax_main.C @@ -40,7 +40,7 @@ bool send_fax(string const &fname, string const &sendcmd) if (fname.empty()) return false; - path=OnlyPath(fname); + path= OnlyPath(fname); if (path.empty() || path == "./") filename = GetCWD() + "/" + fname; else @@ -66,9 +66,9 @@ bool send_fax(string const &fname, string const &sendcmd) phone_book_name = "phonebook"; } else phone_book_name = lyxrc->phone_book; - phone_book=FileSearch(user_lyxdir,phone_book_name); + phone_book= FileSearch(user_lyxdir, phone_book_name); if (phone_book.empty()) - phone_book = AddName(user_lyxdir,phone_book_name); + phone_book = AddName(user_lyxdir, phone_book_name); fl_set_browser_fontsize(fd_phonebook->browser, FL_NORMAL_SIZE); fl_set_browser_fontstyle(fd_phonebook->browser, FL_FIXED_STYLE); @@ -77,19 +77,19 @@ bool send_fax(string const &fname, string const &sendcmd) title += OnlyFilename(fname); /* show the first form */ - fl_show_form(fd_xsendfax->xsendfax,FL_PLACE_MOUSE,FL_FULLBORDER,title.c_str()); + fl_show_form(fd_xsendfax->xsendfax, FL_PLACE_MOUSE, FL_FULLBORDER, title.c_str()); /* while(true) { obj = fl_do_forms(); - if (obj==fd_xsendfax->Button_Cancel) + if (obj == fd_xsendfax->Button_Cancel) break; - else if (obj==fd_xsendfax->Button_Send) { - if (button_send(fname,global_sendcmd)) + else if (obj == fd_xsendfax->Button_Send) { + if (button_send(fname, global_sendcmd)) break; - } else if (obj==fd_xsendfax->Button_Apply) { - button_send(fname,global_sendcmd); - } else if (obj==fd_xsendfax->Button_SPhone) { - cb_select_phoneno(0,0); + } else if (obj == fd_xsendfax->Button_Apply) { + button_send(fname, global_sendcmd); + } else if (obj == fd_xsendfax->Button_SPhone) { + cb_select_phoneno(0, 0); } } fl_hide_form(fd_xsendfax->xsendfax); @@ -111,7 +111,7 @@ bool button_send(string const &fname, string const &sendcmd) if (phone.empty()) return false; - logfile = TmpFileName(OnlyPath(fname),"FAX"); + logfile = TmpFileName(OnlyPath(fname), "FAX"); cmd = sendcmd + " >"; cmd += logfile + " 2>"; cmd += logfile; @@ -123,7 +123,7 @@ bool button_send(string const &fname, string const &sendcmd) cmd = subst(cmd, "$$FName", fname); lyxerr << "CMD: " << cmd << endl; Systemcalls one(Systemcalls::System, cmd); - show_logfile(logfile,false); + show_logfile(logfile, false); remove(logfile.c_str()); return true; } @@ -139,13 +139,13 @@ void cb_select_phoneno(FL_OBJECT *, long) { int i, - n=fl_get_browser_maxline(fd_phonebook->browser); + n= fl_get_browser_maxline(fd_phonebook->browser); char const *line; fl_hide_form(fd_phonebook->phonebook); line = fl_get_browser_line(fd_phonebook->browser, 1); - if (!n || strstr(line,_("Empty Phonebook"))) { + if (!n || strstr(line, _("Empty Phonebook"))) { fl_clear_browser(fd_phonebook->browser); return; } @@ -155,16 +155,16 @@ void cb_select_phoneno(FL_OBJECT *, long) return; char *buf = new char [strlen(line)+1]; - strcpy(buf,line); - for(i = LEN_PHONE;(i>0) && (buf[i]==' ');i--) + strcpy(buf, line); + for(i = LEN_PHONE;(i>0) && (buf[i] == ' ');i--) ; buf[i+1] = 0; - for(i = LEN_PHONE+LEN_NAME+1;(i>LEN_PHONE) && (buf[i]==' ');i--) + for(i = LEN_PHONE+LEN_NAME+1;(i>LEN_PHONE) && (buf[i] == ' ');i--) ; buf[i+1] = 0; - fl_set_input(fd_xsendfax->Input_Phone,buf); - fl_set_input(fd_xsendfax->Input_Name,buf+LEN_PHONE+1); - fl_set_input(fd_xsendfax->Input_Enterprise,buf+LEN_PHONE+LEN_NAME+2); + fl_set_input(fd_xsendfax->Input_Phone, buf); + fl_set_input(fd_xsendfax->Input_Name, buf+LEN_PHONE+1); + fl_set_input(fd_xsendfax->Input_Enterprise, buf+LEN_PHONE+LEN_NAME+2); delete [] buf; } @@ -178,32 +178,32 @@ void cb_add_phoneno(FL_OBJECT *, long ) *phone = fl_get_input(fd_xsendfax->Input_Phone), *enterprise = fl_get_input(fd_xsendfax->Input_Enterprise); int - i,n; + i, n; if (!strlen(phone)) return; char *buf = new char [50+strlen(enterprise)]; - sprintf(buf,"%-*.*s %-*.*s %s", - LEN_PHONE,LEN_PHONE,phone, - LEN_NAME,LEN_NAME,name, + sprintf(buf, "%-*.*s %-*.*s %s", + LEN_PHONE, LEN_PHONE, phone, + LEN_NAME, LEN_NAME, name, enterprise); n = fl_get_browser_maxline(fd_phonebook->browser); if (n) { line = fl_get_browser_line(fd_phonebook->browser, 1); - if (strstr(line,_("Empty Phonebook"))) { + if (strstr(line, _("Empty Phonebook"))) { fl_clear_browser(fd_phonebook->browser); n = 0; } } for(i = 1; i <= n; i++) { line = fl_get_browser_line(fd_phonebook->browser, i); - if (!strncmp(buf,line,46)) + if (!strncmp(buf, line, 46)) break; } if (i > n) { - fl_addto_browser(fd_phonebook->browser,buf); + fl_addto_browser(fd_phonebook->browser, buf); fl_set_object_label(fd_xsendfax->pb_save, _("Save (needed)")); } delete[] buf; @@ -219,30 +219,30 @@ void cb_delete_phoneno(FL_OBJECT *, long ) *phone = fl_get_input(fd_xsendfax->Input_Phone), *enterprise = fl_get_input(fd_xsendfax->Input_Enterprise); int - i,n; + i, n; if (!strlen(phone)) return; char *buf = new char [50+strlen(enterprise)]; - sprintf(buf,"%-*.*s %-*.*s %s", - LEN_PHONE,LEN_PHONE,phone, - LEN_NAME,LEN_NAME,name, + sprintf(buf, "%-*.*s %-*.*s %s", + LEN_PHONE, LEN_PHONE, phone, + LEN_NAME, LEN_NAME, name, enterprise); n = fl_get_browser_maxline(fd_phonebook->browser); if (n) { line = fl_get_browser_line(fd_phonebook->browser, 1); - if (strstr(line,_("Empty Phonebook"))) { + if (strstr(line, _("Empty Phonebook"))) { fl_clear_browser(fd_phonebook->browser); n = 0; } } - for(i=1;i<=n;i++) { + for(i= 1;i<= n;i++) { line = fl_get_browser_line(fd_phonebook->browser, i); - if (!strncmp(buf,line,46)) + if (!strncmp(buf, line, 46)) break; } if (i <= n) { - fl_delete_browser_line(fd_phonebook->browser,i); + fl_delete_browser_line(fd_phonebook->browser, i); fl_set_object_label(fd_xsendfax->pb_save, _("Save (needed)")); } delete[] buf; @@ -254,25 +254,25 @@ void cb_save_phoneno(FL_OBJECT *, long ) char const *line; int - i,n; + i, n; FILE *fp; - if (!(fp = fopen(phone_book.c_str(),"w"))) { - WriteAlert(_("Error!"),_("Cannot open phone book: "),phone_book); + if (!(fp = fopen(phone_book.c_str(), "w"))) { + WriteAlert(_("Error!"), _("Cannot open phone book: "), phone_book); return; } n = fl_get_browser_maxline(fd_phonebook->browser); if (n) { line = fl_get_browser_line(fd_phonebook->browser, 1); - if (strstr(line,_("Empty Phonebook"))) { + if (strstr(line, _("Empty Phonebook"))) { fl_clear_browser(fd_phonebook->browser); n = 0; } } - for(i=1;i<=n;i++) { + for(i= 1;i<= n;i++) { line = fl_get_browser_line(fd_phonebook->browser, i); - fprintf(fp,"%s\n",line); + fprintf(fp, "%s\n", line); } fclose(fp); fl_set_object_label(fd_xsendfax->pb_save, _("Save")); @@ -283,7 +283,7 @@ void show_logfile(string logfile, bool show_if_empty) { if (logfile.empty()) return; - if (!fl_load_browser(fd_logfile->browser,logfile.c_str())) { + if (!fl_load_browser(fd_logfile->browser, logfile.c_str())) { if (!show_if_empty) return; fl_add_browser_line(fd_logfile->browser, @@ -293,7 +293,7 @@ void show_logfile(string logfile, bool show_if_empty) fl_raise_form(fd_logfile->logfile); } else { fl_show_form(fd_logfile->logfile, - FL_PLACE_MOUSE | FL_FREE_SIZE,FL_FULLBORDER, + FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER, _("Message-Window")); } } @@ -310,22 +310,22 @@ void FaxCancelCB(FL_OBJECT *, long) void FaxApplyCB(FL_OBJECT *, long) { - button_send(filename,global_sendcmd); + button_send(filename, global_sendcmd); } void FaxSendCB(FL_OBJECT *, long) { - if (button_send(filename,global_sendcmd)) - FaxCancelCB(0,0); + if (button_send(filename, global_sendcmd)) + FaxCancelCB(0, 0); } void FaxOpenPhonebookCB(FL_OBJECT *, long) { int - n=fl_get_browser_maxline(fd_phonebook->browser); + n= fl_get_browser_maxline(fd_phonebook->browser); if (!n) - fl_addto_browser(fd_phonebook->browser,_("@L@b@cEmpty Phonebook")); - fl_show_form(fd_phonebook->phonebook,FL_PLACE_MOUSE,FL_FULLBORDER, + fl_addto_browser(fd_phonebook->browser, _("@L@b@cEmpty Phonebook")); + fl_show_form(fd_phonebook->phonebook, FL_PLACE_MOUSE, FL_FULLBORDER, _("Phonebook")); } diff --git a/src/lyx_sty.C b/src/lyx_sty.C index 51272d3042..afa9f6a725 100644 --- a/src/lyx_sty.C +++ b/src/lyx_sty.C @@ -1,12 +1,12 @@ /* This file is part of - ====================================================== + ====================================================== LyX, The Document Processor Copyright 1995 Matthias Ettrich Copyright 1995-1999 The LyX Team. - ====================================================== + ====================================================== */ #include @@ -18,10 +18,10 @@ //\message{LyX LaTeX Extensions (LLE v0.2) of 11-Jan-1996.} // include this always -string const lyx_def = +string const lyx_def = "\\providecommand{\\LyX}{L\\kern-.1667em\\lower.25em\\hbox{Y}\\kern-.125emX\\@}"; -string const lyxline_def = +string const lyxline_def = "\\newcommand{\\lyxline}[1]{\n" " {#1 \\vspace{1ex} \\hrule width \\columnwidth \\vspace{1ex}}\n" "}"; @@ -36,43 +36,43 @@ string const lyxarrow_def = -string const quotedblbase_def = +string const quotedblbase_def = "\\ProvideTextCommandDefault{\\quotedblbase}{%\n" " \\raisebox{-1.4ex}[1ex][.5ex]{\\textquotedblright}%\n" " \\penalty10000\\hskip0em\\relax%\n" "}"; -string const quotesinglbase_def = +string const quotesinglbase_def = "\\ProvideTextCommandDefault{\\quotesinglbase}{%\n" " \\raisebox{-1.4ex}[1ex][.5ex]{\\textquoteright}%\n" " \\penalty10000\\hskip0em\\relax%\n" "}"; -string const guillemotleft_def = +string const guillemotleft_def = "\\ProvideTextCommandDefault{\\guillemotleft}{%\n" " {\\usefont{U}{lasy}{m}{n}\\char'50\\kern-.15em\\char'50}%\n" "\\penalty10000\\hskip0pt\\relax%\n" "}"; -string const guillemotright_def = +string const guillemotright_def = "\\ProvideTextCommandDefault{\\guillemotright}{%\n" " \\penalty10000\\hskip0pt%\n" " {\\usefont{U}{lasy}{m}{n}\\char'51\\kern-.15em\\char'51}%\n" "}"; -string const guilsinglleft_def = +string const guilsinglleft_def = "\\ProvideTextCommandDefault{\\guilsinglleft}{%\n" " {\\usefont{U}{lasy}{m}{n}\\char'50}%\n" " \\penalty10000\\hskip0pt\\relax%\n" "}"; -string const guilsinglright_def = +string const guilsinglright_def = "\\ProvideTextCommandDefault{\\guilsinglright}{%\n" " \\penalty10000\\hskip0pt%\n" " {\\usefont{U}{lasy}{m}{n}\\char'51}%\n" "}"; -string const paragraphindent_def = +string const paragraphindent_def = "\\newenvironment{LyXParagraphIndent}[1]%\n" "{\n" " \\begin{list}{}{%\n" @@ -88,7 +88,7 @@ string const paragraphindent_def = "}\n" "{\\end{list}}\n"; -string const floatingfootnote_def = +string const floatingfootnote_def = "%% Special footnote code from the package 'stblftnt.sty'\n" "%% Author: Robin Fairbairns -- Last revised Dec 13 1996\n" "\\let\\SF@@footnote\\footnote\n" @@ -106,16 +106,16 @@ string const floatingfootnote_def = " \\expandafter\\noexpand\\csname SF@gobble@opt \\endcsname}\n" "\\def\\SF@gobble@twobracket[#1]#2{}\n"; -string const minipageindent_def = +string const minipageindent_def = "%% This length is the backup for minipages of the \\parindent\n" "\\newlength{\\LyXMinipageIndent}\n" "\\setlength{\\LyXMinipageIndent}{\\parindent}\n"; -string const boldsymbol_def = +string const boldsymbol_def = "%% Bold symbol macro for standard LaTeX users\n" "\\newcommand{\\boldsymbol}[1]{\\mbox{\\boldmath $#1$}}\n"; -string const binom_def = +string const binom_def = "%% Binom macro for standard LaTeX users\n" "\\newcommand{\\binom}[2]{{#1 \\choose #2}}\n"; diff --git a/src/lyx_sty.h b/src/lyx_sty.h index 8c26928a41..a9a74d976c 100644 --- a/src/lyx_sty.h +++ b/src/lyx_sty.h @@ -10,8 +10,8 @@ ====================================================== */ -#ifndef _LYX_STY_H -#define _LYX_STY_H +#ifndef LYX_STY_H +#define LYX_STY_H #include "LString.h" diff --git a/src/lyxcursor.h b/src/lyxcursor.h index 12a25b0818..fc0e832d33 100644 --- a/src/lyxcursor.h +++ b/src/lyxcursor.h @@ -1,12 +1,12 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995 Matthias Ettrich * - *======================================================*/ + * ====================================================== */ #ifndef LYXCURSOR_H #define LYXCURSOR_H @@ -20,13 +20,8 @@ struct Row; struct LyXCursor { /// LyXParagraph * par; -#ifdef NEW_TEXT /// LyXParagraph::size_type pos; -#else - /// - int pos; -#endif /// int x; /// diff --git a/src/lyxdraw.C b/src/lyxdraw.C index 77cf269def..326d8edd00 100644 --- a/src/lyxdraw.C +++ b/src/lyxdraw.C @@ -24,7 +24,7 @@ Colormap color_map = 0; long int background_pixels; // X11 color names -char const * const X11Color[11] = +char const * const X11Color[11] = { "black", "black", "white", "red", "green", "blue", "cyan", "magenta", "yellow", "black", "black" }; @@ -78,14 +78,14 @@ static void do_reverse_video(XGCValues &val) { if (reverse_video) { - val.foreground=WhitePixel(fl_display, + val.foreground= WhitePixel(fl_display, DefaultScreen(fl_display)); - val.background=BlackPixel(fl_display, + val.background= BlackPixel(fl_display, DefaultScreen(fl_display)); } else { - val.foreground=BlackPixel(fl_display, + val.foreground= BlackPixel(fl_display, DefaultScreen(fl_display)); - val.background=WhitePixel(fl_display, + val.background= WhitePixel(fl_display, DefaultScreen(fl_display)); } } @@ -145,13 +145,13 @@ 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.function= GXcopy; val.graphics_exposures = false; setForegroundColor(latex_color, val); latex_gc = XCreateGC(fl_display, fl_root, GCBackground @@ -215,17 +215,17 @@ GC GetClearGC() XGCValues val; if (reverse_video) { - val.foreground=BlackPixel(fl_display, + val.foreground= BlackPixel(fl_display, DefaultScreen(fl_display)); - val.background=WhitePixel(fl_display, + val.background= WhitePixel(fl_display, DefaultScreen(fl_display)); } else { - val.background=BlackPixel(fl_display, + val.background= BlackPixel(fl_display, DefaultScreen(fl_display)); - val.foreground=WhitePixel(fl_display, + 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); @@ -249,7 +249,7 @@ GC GetOnOffLineGC() XGCValues val; do_reverse_video(val); - val.function=GXcopy; + val.function= GXcopy; val.graphics_exposures = false; setForegroundColor(on_off_line_color, val); val.line_width = 0; @@ -271,7 +271,7 @@ GC GetThickLineGC() XGCValues val; do_reverse_video(val); - val.function=GXcopy; + val.function= GXcopy; val.graphics_exposures = false; val.line_width = 2; val.line_style = LineSolid; @@ -291,11 +291,11 @@ GC GetThinOnOffLineGC() XGCValues val; do_reverse_video(val); - val.function=GXcopy; + val.function= GXcopy; val.graphics_exposures = false; val.line_style = LineOnOffDash; val.line_width = 0; - thin_on_off_line_gc = + thin_on_off_line_gc = XCreateGC(fl_display, fl_root, GCBackground | GCForeground | GCFunction | GCGraphicsExposures | GCLineWidth | GCLineStyle , &val); @@ -312,7 +312,7 @@ GC GetCopyGC() XGCValues val; do_reverse_video(val); - val.function=GXcopy; + val.function= GXcopy; val.graphics_exposures = false; val.line_style = LineSolid; val.line_width = 0; @@ -336,7 +336,7 @@ GC GetSelectGC() val.line_style = LineSolid; val.line_width = 2; val.graphics_exposures = false; - val.function=GXinvert; + val.function= GXinvert; select_gc = XCreateGC(fl_display, fl_root, GCFunction | GCGraphicsExposures | GCPlaneMask | GCLineWidth | GCLineStyle , &val); @@ -354,18 +354,18 @@ GC GetSelectionGC() XGCValues val; if (!reverse_video) { - val.foreground=BlackPixel(fl_display, + val.foreground= BlackPixel(fl_display, DefaultScreen(fl_display)); - val.background=WhitePixel(fl_display, + val.background= WhitePixel(fl_display, DefaultScreen(fl_display)); } else { - val.background=BlackPixel(fl_display, + val.background= BlackPixel(fl_display, DefaultScreen(fl_display)); - val.foreground=WhitePixel(fl_display, + val.foreground= WhitePixel(fl_display, DefaultScreen(fl_display)); } - val.function=GXcopy; + val.function= GXcopy; val.graphics_exposures = false; if (!fast_selection && selection_color[0] != 0) { if (!setForegroundColor(selection_color, val)) { @@ -389,12 +389,12 @@ 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; + val.foreground= val.background; + val.function= GXcopy; val.graphics_exposures = false; val.line_style = LineSolid; val.line_width = 0; @@ -415,7 +415,7 @@ GC GetColorGC(LyXFont::FONT_COLOR color) XGCValues val; do_reverse_video(val); - val.function=GXcopy; + val.function= GXcopy; val.graphics_exposures = false; setForegroundColor(X11Color[color], val); val.line_width = 0; @@ -432,7 +432,7 @@ GC GetColorGC(LyXFont::FONT_COLOR color) GC GetAccentGC(LyXFont const &f, int line_width) { - if (line_width>=10) line_width = 9; + if (line_width>= 10) line_width = 9; if (accent_gc[line_width]) return accent_gc[line_width]; @@ -466,7 +466,7 @@ GC GetMinipageGC() XGCValues val; do_reverse_video(val); - val.function=GXcopy; + val.function= GXcopy; val.graphics_exposures = false; val.line_style = LineOnOffDash; val.line_width = 0; diff --git a/src/lyxfont.C b/src/lyxfont.C index dbc815f967..6bd290ead5 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995 Matthias Ettrich * Copyright (C) 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include #include @@ -16,8 +16,8 @@ #endif #include + #include "gettext.h" -#include "definitions.h" #include "lyxfont.h" #include "debug.h" #include "lyxrc.h" @@ -35,23 +35,23 @@ FontLoader fontloader; // Names for the GUI // -string const GUIFamilyNames[6] = +string const GUIFamilyNames[6] = { N_("Roman"), N_("Sans serif"), N_("Typewriter"), N_("Symbol"), N_("Inherit"), N_("Ignore") }; -string const GUISeriesNames[4] = +string const GUISeriesNames[4] = { N_("Medium"), N_("Bold"), N_("Inherit"), N_("Ignore") }; -string const GUIShapeNames[6] = +string const GUIShapeNames[6] = { N_("Upright"), N_("Italic"), N_("Slanted"), N_("Smallcaps"), N_("Inherit"), N_("Ignore") }; -string const GUISizeNames[14] = +string const GUISizeNames[14] = { N_("Tiny"), N_("Smallest"), N_("Smaller"), N_("Small"), N_("Normal"), N_("Large"), N_("Larger"), N_("Largest"), N_("Huge"), N_("Huger"), N_("Increase"), N_("Decrease"), N_("Inherit"), N_("Ignore") }; -string const lGUISizeNames[15] = +string const lGUISizeNames[15] = { N_("tiny"), N_("smallest"), N_("smaller"), N_("small"), N_("normal"), N_("large"), N_("larger"), N_("largest"), N_("huge"), N_("huger"), N_("increase"), N_("decrease"), N_("inherit"), N_("ignore"), string() }; @@ -67,24 +67,24 @@ string const GUIColorNames[13] = // // Strings used to read and write .lyx format files // -string const LyXFamilyNames[6] = +string const LyXFamilyNames[6] = { "roman", "sans", "typewriter", "symbol", "default", "error" }; -string const LyXSeriesNames[4] = +string const LyXSeriesNames[4] = { "medium", "bold", "default", "error" }; string const LyXShapeNames[6] = { "up", "italic", "slanted", "smallcaps", "default", "error" }; -string const LyXSizeNames[14] = +string const LyXSizeNames[14] = { "tiny", "scriptsize", "footnotesize", "small", "normal", "large", "larger", "largest", "huge", "giant", "increase-error", "decrease-error", "default", "error" }; -string const LyXMiscNames[12] = +string const LyXMiscNames[12] = { "off", "on", "toggle", "default", "error" }; -string const LyXColorNames[13] = +string const LyXColorNames[13] = { "none", "black", "white", "red", "green", "blue", "cyan", "magenta", "yellow", "matherror", "inseterror", "default", "error" }; @@ -92,20 +92,20 @@ string const LyXColorNames[13] = // Strings used to write LaTeX files // -string const LaTeXFamilyNames[6] = +string const LaTeXFamilyNames[6] = { "textrm", "textsf", "texttt", "error1", "error2", "error3" }; -string const LaTeXSeriesNames[4] = +string const LaTeXSeriesNames[4] = { "textmd", "textbf", "error4", "error5" }; -string const LaTeXShapeNames[6] = +string const LaTeXShapeNames[6] = { "textup", "textit", "textsl", "textsc", "error6", "error7" }; -string const LaTeXSizeNames[14] = +string const LaTeXSizeNames[14] = { "tiny", "scriptsize", "footnotesize", "small", "normalsize", "large", "Large", "LARGE", "huge", "Huge", "error8", "error9", "error10", "error11" }; -string const LaTeXColorNames[13] = +string const LaTeXColorNames[13] = { "none", "black", "white", "red", "green", "blue", "cyan", "magenta", "yellow", "error12", "error13", "error14", "error15" }; @@ -375,7 +375,7 @@ LyXFont& LyXFont::setLyXFamily(string const & fam) { string s = lowercase(fam); - int i=0; + int i= 0; while (s != LyXFamilyNames[i] && LyXFamilyNames[i] != "error") i++; if (s == LyXFamilyNames[i]) { setFamily(LyXFont::FONT_FAMILY(i)); @@ -391,7 +391,7 @@ LyXFont& LyXFont::setLyXSeries(string const & ser) { string s = lowercase(ser); - int i=0; + int i= 0; while (s != LyXSeriesNames[i] && LyXSeriesNames[i] != "error") i++; if (s == LyXSeriesNames[i]) { setSeries(LyXFont::FONT_SERIES(i)); @@ -407,7 +407,7 @@ LyXFont& LyXFont::setLyXShape(string const & sha) { string s = lowercase(sha); - int i=0; + int i= 0; while (s != LyXShapeNames[i] && LyXShapeNames[i] != "error") i++; if (s == LyXShapeNames[i]) { setShape(LyXFont::FONT_SHAPE(i)); @@ -422,7 +422,7 @@ LyXFont& LyXFont::setLyXShape(string const & sha) LyXFont& LyXFont::setLyXSize(string const & siz) { string s = lowercase(siz); - int i=0; + int i= 0; while (s != LyXSizeNames[i] && LyXSizeNames[i] != "error") i++; if (s == LyXSizeNames[i]) { setSize(LyXFont::FONT_SIZE(i)); @@ -436,7 +436,7 @@ LyXFont& LyXFont::setLyXSize(string const & siz) LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz) { string s = lowercase(siz); - int i=0; + int i= 0; while (s != LyXMiscNames[i] && LyXMiscNames[i] != "error") i++; if (s == LyXMiscNames[i]) return FONT_MISC_STATE(i); @@ -449,7 +449,7 @@ LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz) LyXFont& LyXFont::setLyXColor(string const & col) { string s = lowercase(col); - int i=0; + int i= 0; while (s != LyXColorNames[i] && LyXColorNames[i] != "error") i++; if (s == LyXColorNames[i]) { setColor(LyXFont::FONT_COLOR(i)); @@ -464,7 +464,7 @@ LyXFont& LyXFont::setLyXColor(string const & col) LyXFont& LyXFont::setGUISize(string const & siz) { string s = lowercase(siz); - int i=0; + int i= 0; while (!lGUISizeNames[i].empty() && s != _(lGUISizeNames[i].c_str())) i++; @@ -817,7 +817,7 @@ GC LyXFont::getGC() const XFontStruct* LyXFont::getXFontstruct() const { - return fontloader.load(family(),series(),realShape(),size()); + return fontloader.load(family(), series(), realShape(), size()); } @@ -882,7 +882,7 @@ int LyXFont::textWidth(char const *s, int n) const smallfont.decSize(); smallfont.decSize(); smallfont.setShape(LyXFont::UP_SHAPE); - for (int i=0; i < n; i++){ + for (int i= 0; i < n; i++){ c = s[i]; if (islower(c)){ c = toupper(c); @@ -933,7 +933,7 @@ int LyXFont::drawText(char const* s, int n, Pixmap pm, smallfont.decSize(); smallfont.decSize(); smallfont.setShape(LyXFont::UP_SHAPE); - for (i=0; i < n; i++){ + for (i= 0; i < n; i++){ c = s[i]; if (islower(c)){ c = toupper(c); diff --git a/src/lyxfont.h b/src/lyxfont.h index 8de7868ea4..68015ae34b 100644 --- a/src/lyxfont.h +++ b/src/lyxfont.h @@ -6,7 +6,7 @@ * * Copyright (C) 1995 Matthias Ettrich * - *======================================================*/ + * ====================================================== */ #ifndef LYXFONT_H #define LYXFONT_H @@ -191,7 +191,7 @@ public: /// Shortcut initialization LyXFont(LyXFont::FONT_INIT3); - /// LyXFont x,y; x=y; + /// LyXFont x, y; x = y; LyXFont& operator=(LyXFont const & x); /// Decreases font size by one @@ -273,14 +273,14 @@ public: /** Updates font settings according to request. If an attribute is IGNORE, the attribute is left as it is. */ /* - * When toggleall=true, all properties that matches the font in use + * When toggleall = true, all properties that matches the font in use * will have the effect that the properties is reset to the * default. If we have a text that is TYPEWRITER_FAMILY, and is * update()'ed with TYPEWRITER_FAMILY, the operation will be as if * a INHERIT_FAMILY was asked for. This is necessary for the * toggle-user-defined-style button on the toolbar. */ - void update(LyXFont const & newfont, bool toggleall=false); + void update(LyXFont const & newfont, bool toggleall = false); /** Reduce font to fall back to template where possible. Equal fields are reduced to INHERIT */ diff --git a/src/lyxfr0.C b/src/lyxfr0.C index 27e85b893b..5c32734b9e 100644 --- a/src/lyxfr0.C +++ b/src/lyxfr0.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich, * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -143,8 +143,8 @@ void LyXFindReplace0::SetReplaceEnabled(bool fEnable) fl_deactivate_object(fd_fs->replace_button); fl_deactivate_object(fd_fs->replaceall_button); fl_deactivate_object(fd_fs->input_replace); - fl_set_object_lcol(fd_fs->replace_button,FL_INACTIVE); - fl_set_object_lcol(fd_fs->replaceall_button,FL_INACTIVE); + fl_set_object_lcol(fd_fs->replace_button, FL_INACTIVE); + fl_set_object_lcol(fd_fs->replaceall_button, FL_INACTIVE); fl_set_object_lcol(fd_fs->input_replace, FL_INACTIVE); } } diff --git a/src/lyxfr1.C b/src/lyxfr1.C index 1e4cee8ca2..c85a579eda 100644 --- a/src/lyxfr1.C +++ b/src/lyxfr1.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich, * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -33,6 +33,7 @@ #include "lyx_gui_misc.h" #include "minibuffer.h" #include "support/lstrings.h" +#include "support/textutils.h" extern BufferView *current_view; // called too many times in this file... extern MiniBuffer *minibuffer; @@ -42,8 +43,6 @@ const int LYXSEARCH_MAXLEN = 128; // function prototypes -bool IsLetterCharOrDigit(char ch); - // If nothing selected, select the word at the cursor. // Returns the current selection // Note: this function should be in LyXText! @@ -59,10 +58,6 @@ void SetSelectionOverLenChars(LyXText *lt, int len); //------------------------------------------------------------- -bool IsLetterCharOrDigit(char ch) -{ - return IsLetterChar(ch) || isdigit(ch); -} // Returns the current selection. If nothing is selected or if the selection @@ -75,17 +70,10 @@ string const GetCurrentSelectionAsString(LyXText * lt) LyXParagraph * par = lt->cursor.par; if (lt->selection && (lt->sel_cursor.par == par)) { // (selected) and (begin/end in same paragraph) -#ifdef NEW_TEXT - LyXParagraph::size_type pos = - lt->sel_start_cursor.pos; - LyXParagraph::size_type endpos = - lt->sel_end_cursor.pos; -#else - int pos = + LyXParagraph::size_type pos = lt->sel_start_cursor.pos; - int endpos = + LyXParagraph::size_type endpos = lt->sel_end_cursor.pos; -#endif int i = 0; bool fPrevIsSpace = false; char ch; @@ -94,7 +82,7 @@ string const GetCurrentSelectionAsString(LyXText * lt) ch = par->GetChar(pos); //HB??: Maybe (ch <= ' ') - if ((ch == ' ') || (ch <= LYX_META_INSET)) { + if ((ch == ' ') || (ch <= LyXParagraph::META_INSET)) { // consecutive spaces --> 1 space char if (fPrevIsSpace) { pos++; // Next text pos @@ -130,7 +118,7 @@ void SetSelectionOverLenChars(LyXText *lt, int len) { lt->sel_cursor = lt->cursor; int i; - for (i=0; i < len; i++) + for (i= 0; i < len; i++) lt->CursorRight(); lt->SetSelection(); } @@ -300,13 +288,9 @@ bool LyXFindReplace1::SearchCB(bool fForward) bool LyXFindReplace1::SearchForward(LyXText * lt) { LyXParagraph * par = lt->cursor.par; -#ifdef NEW_TEXT LyXParagraph::size_type pos = lt->cursor.pos; -#else - int pos = lt->cursor.pos; -#endif - while (par && !IsSearchStringInText(par,pos)) { + while (par && !IsSearchStringInText(par, pos)) { if (posLast()-1) pos++; else { @@ -315,7 +299,7 @@ bool LyXFindReplace1::SearchForward(LyXText * lt) } } if (par) { - lt->SetCursor(par,pos); + lt->SetCursor(par, pos); return true; } else return false; @@ -341,10 +325,10 @@ bool LyXFindReplace1::SearchBackward(LyXText *lt) pos = par->Last()-1; } while (par && pos<0); } - } while (par && !IsSearchStringInText(par,pos)); + } while (par && !IsSearchStringInText(par, pos)); if (par) { - lt->SetCursor(par,pos); + lt->SetCursor(par, pos); return true; } else return false; @@ -367,13 +351,8 @@ int LyXFindReplace1::CompareChars(char chSearch, char chText) // returns true if the search string is at the specified position // (Copied from the original "LyXText::IsStringInText" in text2.C ) -#ifdef NEW_TEXT bool LyXFindReplace1::IsSearchStringInText(LyXParagraph * par, LyXParagraph::size_type pos) -#else -bool LyXFindReplace1::IsSearchStringInText(LyXParagraph * par, - int pos) -#endif { char chSrch = 0; char chText; diff --git a/src/lyxfr1.h b/src/lyxfr1.h index f05a44aa4e..e47c746d41 100644 --- a/src/lyxfr1.h +++ b/src/lyxfr1.h @@ -54,12 +54,8 @@ protected: \end{itemize} */ int CompareChars(char chSearch, char chText); -#ifdef NEW_TEXT /// returns true if the specified string is at the specified position - bool IsSearchStringInText(LyXParagraph * par, LyXParagraph::size_type pos); -#else - /// returns true if the specified string is at the specified position - bool IsSearchStringInText(LyXParagraph * par, int pos); -#endif + bool IsSearchStringInText(LyXParagraph * par, + LyXParagraph::size_type pos); }; #endif diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 355a0a8e10..4a9debb279 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -18,7 +18,6 @@ #pragma implementation #endif -#include "definitions.h" #include "lyxlookup.h" #include "kbmap.h" #include "lyxfunc.h" @@ -28,7 +27,9 @@ #include "intl.h" #include "lyx_main.h" #include "lyx_cb.h" +#if 0 #include "insets/insetlatex.h" +#endif #include "insets/inseturl.h" #include "insets/insetlatexaccent.h" #include "insets/insettoc.h" @@ -37,20 +38,23 @@ #include "insets/insetlot.h" #include "insets/insetref.h" #include "insets/insetparent.h" +#include "insets/insetindex.h" +#include "insets/insetinclude.h" +#include "insets/insetbib.h" #include "mathed/formulamacro.h" #include "toolbar.h" #include "spellchecker.h" // RVDK_PATCH_5 #include "minibuffer.h" #include "vspace.h" -#include "insets/insetbib.h" #include "LyXView.h" -#include "insets/insetindex.h" -#include "insets/insetinclude.h" #include "filedlg.h" #include "lyx_gui_misc.h" #include "support/filetools.h" #include "support/FileInfo.h" #include "support/LAssert.h" +#include "support/syscall.h" +#include "support/lstrings.h" +#include "support/path.h" #include "lyxscreen.h" #include "debug.h" #include "lyxrc.h" @@ -59,9 +63,6 @@ #include "trans_mgr.h" #include "ImportLaTeX.h" #include "ImportNoweb.h" -#include "support/syscall.h" -#include "support/lstrings.h" -#include "support/path.h" #include "layout.h" extern bool cursor_follows_scrollbar; @@ -83,7 +84,7 @@ extern void MenuWriteAs(Buffer*); extern int MenuRunLaTeX(Buffer*); extern int MenuBuildProg(Buffer*); extern int MenuRunChktex(Buffer*); -extern bool MenuRunDvips(Buffer *,bool); +extern bool MenuRunDvips(Buffer *, bool); extern void MenuPrint(Buffer*); extern void MenuSendto(); extern void QuitLyX(); @@ -117,7 +118,7 @@ extern void SetUpdateTimer(float timer= 0.3); extern void FreeUpdateTimer(); extern bool MenuPreview(Buffer*); extern bool MenuPreviewPS(Buffer*); -extern void MenuInsertLabel(const char *); +extern void MenuInsertLabel(char const *); extern void MenuInsertRef(); extern void MenuLayoutCharacter(); extern void MenuLayoutParagraph(); @@ -258,7 +259,7 @@ int LyXFunc::processKeyEvent(XEvent *ev) if (lyxerr.debugging(Debug::KEY)) { char buf[100]; - keyseq.print(buf,100); + keyseq.print(buf, 100); lyxerr << "Key [" << action << "][" << buf << "][" @@ -271,16 +272,16 @@ int LyXFunc::processKeyEvent(XEvent *ev) if(keyseq.length>1 || keyseq.length<-1){ char buf[100]; - keyseq.print(buf,100); + keyseq.print(buf, 100); owner->getMiniBuffer()->Set(buf); } - if (action==-1) { + if (action == -1) { if (keyseq.length<-1) { // unknown key sequence... char buf[100]; LyXBell(); - keyseq.print(buf,100); - owner->getMiniBuffer()->Set(_("Unknown sequence:"),buf); + keyseq.print(buf, 100); + owner->getMiniBuffer()->Set(_("Unknown sequence:"), buf); return 0; } @@ -297,7 +298,7 @@ int LyXFunc::processKeyEvent(XEvent *ev) return 0; } } else - if (action==LFUN_SELFINSERT) { + if (action == LFUN_SELFINSERT) { argument = s_r[0]; } @@ -443,14 +444,14 @@ string LyXFunc::Dispatch(int ac, // the math inset [asierra060396] if (owner->currentView()->available() && owner->buffer()->the_locking_inset) { - if (action>1 || (action==LFUN_UNKNOWN_ACTION && keyseq.length>=-1)) { - if (action==LFUN_UNKNOWN_ACTION && argument.empty()) { + if (action>1 || (action == LFUN_UNKNOWN_ACTION && keyseq.length>= -1)) { + if (action == LFUN_UNKNOWN_ACTION && argument.empty()) { argument = keyseq.getiso(); } // Undo/Redo pre 0.13 is a bit tricky for insets. - if (action==LFUN_UNDO) { + if (action == LFUN_UNDO) { int slx, sly; - UpdatableInset* inset = + UpdatableInset* inset = owner->buffer()->the_locking_inset; inset->GetCursorPos(slx, sly); UnlockInset(inset); @@ -460,7 +461,7 @@ string LyXFunc::Dispatch(int ac, inset->Edit(slx, sly); return string(); } else - if (action==LFUN_REDO) { + if (action == LFUN_REDO) { int slx, sly; UpdatableInset* inset = owner->buffer()->the_locking_inset; inset->GetCursorPos(slx, sly); @@ -475,9 +476,9 @@ string LyXFunc::Dispatch(int ac, return string(); else { setMessage(N_("Text mode")); - if (action==LFUN_RIGHT || action==-1) + if (action == LFUN_RIGHT || action == -1) owner->buffer()->text->CursorRight(); - if (action==LFUN_LEFT || action==LFUN_RIGHT) + if (action == LFUN_LEFT || action == LFUN_RIGHT) return string(); } } @@ -538,7 +539,7 @@ string LyXFunc::Dispatch(int ac, owner->buffer()->update(-2); } char buf[100]; - keyseq.print(buf,100, true); + keyseq.print(buf, 100, true); owner->getMiniBuffer()->Set(buf, string(), string(), 1); } break; @@ -583,7 +584,7 @@ string LyXFunc::Dispatch(int ac, owner->currentView()->getScreen()-> Draw(owner->buffer()->text->cursor.y - owner->currentView()->getWorkArea()->h/2); - } else { // <= + } else { // <= owner->currentView()->getScreen()-> Draw(0); } @@ -662,7 +663,7 @@ string LyXFunc::Dispatch(int ac, case LFUN_EXPORT: { //needs argument as string - string extyp=argument; + string extyp= argument; // latex if (extyp == "latex") { @@ -744,7 +745,7 @@ string LyXFunc::Dispatch(int ac, case LFUN_IMPORT: { //needs argument as string - string imtyp=argument; + string imtyp= argument; // latex if (imtyp == "latex") { @@ -789,7 +790,7 @@ string LyXFunc::Dispatch(int ac, case LFUN_TOC_INSERT: { - Inset *new_inset = + Inset *new_inset = new InsetTOC(owner->buffer()); owner->buffer()->insertInset(new_inset, "Standard", true); @@ -798,7 +799,7 @@ string LyXFunc::Dispatch(int ac, case LFUN_LOF_INSERT: { - Inset *new_inset = + Inset *new_inset = new InsetLOF(owner->buffer()); owner->buffer()->insertInset(new_inset, "Standard", true); @@ -807,7 +808,7 @@ string LyXFunc::Dispatch(int ac, case LFUN_LOA_INSERT: { - Inset *new_inset = + Inset *new_inset = new InsetLOA(owner->buffer()); owner->buffer()->insertInset(new_inset, "Standard", true); @@ -816,7 +817,7 @@ string LyXFunc::Dispatch(int ac, case LFUN_LOT_INSERT: { - Inset *new_inset = + Inset *new_inset = new InsetLOT(owner->buffer()); owner->buffer()->insertInset(new_inset, "Standard", true); @@ -950,7 +951,7 @@ string LyXFunc::Dispatch(int ac, != LyXParagraph::NO_FOOTNOTE) { // only melt footnotes with FOOTMELT, not margins etc if(owner->buffer()->text->cursor.par->footnotekind == LyXParagraph::FOOTNOTE) - MeltCB(ob,0); + MeltCB(ob, 0); } else FootCB(ob, 0); @@ -963,7 +964,7 @@ string LyXFunc::Dispatch(int ac, != LyXParagraph::NO_FOOTNOTE) { // only melt margins if(owner->buffer()->text->cursor.par->footnotekind == LyXParagraph::MARGIN) - MeltCB(ob,0); + MeltCB(ob, 0); } else MarginCB(ob, 0); @@ -1090,7 +1091,7 @@ string LyXFunc::Dispatch(int ac, // Derive layout number from given argument (string) // and current buffer's textclass (number). */ int layoutno = -1; - layoutno = + layoutno = textclasslist.NumberOfLayout(owner-> buffer()-> text->parameters-> @@ -1233,10 +1234,10 @@ string LyXFunc::Dispatch(int ac, case LFUN_REFTOGGLE: { - InsetRef *inset = + InsetRef *inset = (InsetRef*)getInsetByCode(Inset::REF_CODE); if (inset) { - if (inset->getFlag()==InsetRef::REF) + if (inset->getFlag() == InsetRef::REF) inset->setFlag(InsetRef::PAGE_REF); else inset->setFlag(InsetRef::REF); @@ -1257,7 +1258,7 @@ string LyXFunc::Dispatch(int ac, { string label(argument); if (label.empty()) { - InsetRef *inset = + InsetRef *inset = (InsetRef*)getInsetByCode(Inset::REF_CODE); if (inset) label = inset->getContents(); @@ -1289,12 +1290,12 @@ string LyXFunc::Dispatch(int ac, tmpbuffer->update(-2); if (tmptext->cursor.pos < tmptext->cursor.par->Last() && tmptext->cursor.par->GetChar(tmptext->cursor.pos) - == LYX_META_INSET + == LyXParagraph::META_INSET && tmptext->cursor.par->GetInset(tmptext->cursor.pos) - && tmptext->cursor.par->GetInset(tmptext->cursor.pos)->Editable()==2){ + && tmptext->cursor.par->GetInset(tmptext->cursor.pos)->Editable() == 2){ Inset* tmpinset = tmptext->cursor.par->GetInset(tmptext->cursor.pos); setMessage(tmpinset->EditMessage()); - tmpinset->Edit(0,0); + tmpinset->Edit(0, 0); break; } tmptext->CursorRight(); @@ -1314,13 +1315,13 @@ string LyXFunc::Dispatch(int ac, txt->CursorLeft(); if (txt->cursor.pos < txt->cursor.par->Last() && txt->cursor.par->GetChar(txt->cursor.pos) - == LYX_META_INSET + == LyXParagraph::META_INSET && txt->cursor.par->GetInset(txt->cursor.pos) - && txt->cursor.par->GetInset(txt->cursor.pos)->Editable()==2) { + && txt->cursor.par->GetInset(txt->cursor.pos)->Editable() == 2) { Inset* tmpinset = txt->cursor.par->GetInset(txt->cursor.pos); setMessage(tmpinset->EditMessage()); tmpinset->Edit(tmpinset->Width(txt->GetFont(txt->cursor.par, - txt->cursor.pos)),0); + txt->cursor.pos)), 0); // tmpinset->Edit(-1, 0); // -1 means go rightmost break; } @@ -1576,7 +1577,7 @@ string LyXFunc::Dispatch(int ac, // --- text changing commands ------------------------ case LFUN_BREAKLINE: BeforeChange(); - owner->buffer()->text->InsertChar(LYX_META_NEWLINE); + owner->buffer()->text->InsertChar(LyXParagraph::META_NEWLINE); SmallUpdate(1); SetUpdateTimer(0.01); moveCursorUpdate(false); @@ -1585,7 +1586,7 @@ string LyXFunc::Dispatch(int ac, case LFUN_PROTECTEDSPACE: BeforeChange(); owner->buffer()->text-> - InsertChar(LYX_META_PROTECTED_SEPARATOR); + InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR); SmallUpdate(1); SetUpdateTimer(); moveCursorUpdate(false); @@ -1602,7 +1603,7 @@ string LyXFunc::Dispatch(int ac, owner->buffer()->update(0); setMessage(N_("Mark set")); } - owner->buffer()->text->sel_cursor = + owner->buffer()->text->sel_cursor = owner->buffer()->text->cursor; break; @@ -1610,7 +1611,7 @@ string LyXFunc::Dispatch(int ac, FreeUpdateTimer(); if (!owner->buffer()->text->selection) { owner->buffer()->text->Delete(); - owner->buffer()->text->sel_cursor = + owner->buffer()->text->sel_cursor = owner->buffer()->text->cursor; SmallUpdate(1); // It is possible to make it a lot faster still @@ -1650,13 +1651,13 @@ string LyXFunc::Dispatch(int ac, } else { owner->buffer()->text->CursorLeft(); owner->buffer()->text->Delete(); - owner->buffer()->text->sel_cursor = + owner->buffer()->text->sel_cursor = owner->buffer()->text->cursor; SmallUpdate(1); } } else { owner->buffer()->text->Delete(); - owner->buffer()->text->sel_cursor = + owner->buffer()->text->sel_cursor = owner->buffer()->text->cursor; SmallUpdate(1); } @@ -1701,7 +1702,7 @@ string LyXFunc::Dispatch(int ac, case LFUN_MARK_OFF: BeforeChange(); owner->buffer()->update(0); - owner->buffer()->text->sel_cursor = + owner->buffer()->text->sel_cursor = owner->buffer()->text->cursor; setMessage(N_("Mark off")); break; @@ -1711,7 +1712,7 @@ string LyXFunc::Dispatch(int ac, BeforeChange(); owner->buffer()->text->mark_set = 1; owner->buffer()->update( 0 ); - owner->buffer()->text->sel_cursor = + owner->buffer()->text->sel_cursor = owner->buffer()->text->cursor; setMessage(N_("Mark on")); break; @@ -1722,7 +1723,7 @@ string LyXFunc::Dispatch(int ac, if (!owner->buffer()->text->selection) { if (owner->getIntl()->getTrans()->backspace()) { owner->buffer()->text->Backspace(); - owner->buffer()->text->sel_cursor = + owner->buffer()->text->sel_cursor = owner->buffer()->text->cursor; SmallUpdate(1); // It is possible to make it a lot faster still @@ -1774,7 +1775,7 @@ string LyXFunc::Dispatch(int ac, owner->buffer()->text->BreakParagraph(0); SmallUpdate(1); SetUpdateTimer(0.01); - owner->buffer()->text->sel_cursor = + owner->buffer()->text->sel_cursor = owner->buffer()->text->cursor; break; } @@ -1785,7 +1786,7 @@ string LyXFunc::Dispatch(int ac, owner->buffer()->text->BreakParagraph(1); SmallUpdate(1); SetUpdateTimer(0.01); - owner->buffer()->text->sel_cursor = + owner->buffer()->text->sel_cursor = owner->buffer()->text->cursor; break; } @@ -1846,14 +1847,9 @@ string LyXFunc::Dispatch(int ac, case LFUN_CHARATCURSOR: { -#ifdef NEW_TEXT - LyXParagraph::size_type pos = + LyXParagraph::size_type pos = owner->buffer()->text->cursor.pos; if(pos < owner->buffer()->text->cursor.par->size()) -#else - int pos = owner->buffer()->text->cursor.pos; - if(pos < owner->buffer()->text->cursor.par->last) -#endif dispatch_buffer = owner->buffer()->text-> cursor.par->text[pos]; else @@ -1914,7 +1910,7 @@ string LyXFunc::Dispatch(int ac, case LFUN_NOTIFY: { char buf[100]; - keyseq.print(buf,100); + keyseq.print(buf, 100); dispatch_buffer = buf; lyxserver->notifyClient(dispatch_buffer); } @@ -1945,7 +1941,7 @@ string LyXFunc::Dispatch(int ac, owner->currentView()->getScreen()-> Draw(owner->buffer()->text->cursor.y - owner->currentView()->getWorkArea()->h/2); - } else { // <= + } else { // <= owner->currentView()->getScreen()-> Draw(0); } @@ -1984,10 +1980,10 @@ string LyXFunc::Dispatch(int ac, { char c; - if (keyseq.length==-1 && keyseq.getiso()!=0) - c=keyseq.getiso(); + if (keyseq.length == -1 && keyseq.getiso()!= 0) + c= keyseq.getiso(); else - c=0; + c= 0; owner->getIntl()->getTrans()-> deadkey(c, get_accent(action).accent, @@ -1996,7 +1992,7 @@ string LyXFunc::Dispatch(int ac, // Need to reset, in case the minibuffer calls these // actions keyseq.reset(); - keyseq.length=0; + keyseq.length= 0; // copied verbatim from do_accent_char SmallUpdate(1); @@ -2046,14 +2042,14 @@ string LyXFunc::Dispatch(int ac, break; // --- insert characters ---------------------------------------- - +#if 0 case LFUN_INSERT_INSET_LATEX: { Inset *new_inset = new InsetLatex(argument); owner->buffer()->insertInset(new_inset); } break; - +#endif // --- Mathed stuff. If we are here, there is no locked inset yet. // Greek mode @@ -2138,7 +2134,7 @@ string LyXFunc::Dispatch(int ac, case LFUN_INSERT_CITATION: { - InsetCitation *new_inset = new InsetCitation(); + InsetCitation * new_inset = new InsetCitation(); // ale970405 // The note, if any, must be after the key, delimited // by a | so both key and remark can have spaces. @@ -2152,7 +2148,7 @@ string LyXFunc::Dispatch(int ac, owner->buffer()->insertInset(new_inset); } else { owner->buffer()->insertInset(new_inset); - new_inset->Edit(0,0); + new_inset->Edit(0, 0); } } break; @@ -2166,14 +2162,14 @@ string LyXFunc::Dispatch(int ac, string bibstyle = token(lsarg, ' ', 1); if (bibstyle.empty()) bibstyle = "plain"; - InsetBibtex *new_inset + InsetBibtex * new_inset = new InsetBibtex(token(lsarg, ' ', 0), bibstyle, owner->buffer()); owner->buffer()->insertInset(new_inset); if (lsarg.empty()) { - new_inset->Edit(0,0); + new_inset->Edit(0, 0); } } break; @@ -2181,8 +2177,8 @@ string LyXFunc::Dispatch(int ac, // BibTeX data bases case LFUN_BIBDB_ADD: { - InsetBibtex *inset = - (InsetBibtex*)getInsetByCode(Inset::BIBTEX_CODE); + InsetBibtex * inset = + static_cast(getInsetByCode(Inset::BIBTEX_CODE)); if (inset) { inset->addDatabase(argument); } @@ -2191,8 +2187,8 @@ string LyXFunc::Dispatch(int ac, case LFUN_BIBDB_DEL: { - InsetBibtex *inset = - (InsetBibtex*)getInsetByCode(Inset::BIBTEX_CODE); + InsetBibtex * inset = + static_cast(getInsetByCode(Inset::BIBTEX_CODE)); if (inset) { inset->delDatabase(argument); } @@ -2201,8 +2197,8 @@ string LyXFunc::Dispatch(int ac, case LFUN_BIBTEX_STYLE: { - InsetBibtex *inset = - (InsetBibtex*)getInsetByCode(Inset::BIBTEX_CODE); + InsetBibtex * inset = + static_cast(getInsetByCode(Inset::BIBTEX_CODE)); if (inset) { inset->setOptions(argument); } @@ -2224,16 +2220,10 @@ string LyXFunc::Dispatch(int ac, // grab a word -#ifdef NEW_TEXT - LyXParagraph::size_type lastpos = + LyXParagraph::size_type lastpos = owner->buffer()->text->cursor.pos - 1; // If this can't happen, let's make sure that it really don't Assert(owner->buffer()->text->cursor.pos - 1 >= 0); -#else - int lastpos =owner->buffer()->text->cursor.pos - 1; - //this shouldn't happen, but let's be careful - if (lastpos < 0) lastpos=0; -#endif // get the current word // note that this must be done before // inserting the inset, or the inset will break @@ -2247,15 +2237,15 @@ string LyXFunc::Dispatch(int ac, new_inset->setContents(curstring); //don't edit it if the call was to INSERT_LAST - if(action!=LFUN_INDEX_INSERT_LAST) { - new_inset->Edit(0,0); + if(action!= LFUN_INDEX_INSERT_LAST) { + new_inset->Edit(0, 0); } else { //it looks blank on the screen unless //we do something. put it here. // move the cursor to the returned value of lastpos // but only for the auto-insert - owner->buffer()->text->cursor.pos=lastpos; + owner->buffer()->text->cursor.pos= lastpos; } //put the new inset into the buffer. @@ -2268,7 +2258,7 @@ string LyXFunc::Dispatch(int ac, case LFUN_INDEX_PRINT: { - Inset *new_inset = new InsetPrintIndex(owner->buffer()); + Inset * new_inset = new InsetPrintIndex(owner->buffer()); owner->buffer()->insertInset(new_inset, "Standard", true); } break; @@ -2276,23 +2266,25 @@ string LyXFunc::Dispatch(int ac, case LFUN_PARENTINSERT: { lyxerr << "arg " << argument << endl; - Inset *new_inset = new InsetParent(argument, owner->buffer()); + Inset * new_inset = new InsetParent(argument, owner->buffer()); owner->buffer()->insertInset(new_inset, "Standard", true); } break; case LFUN_CHILDINSERT: { - Inset *new_inset = new InsetInclude(argument,owner->buffer()); + Inset * new_inset = new InsetInclude(argument, + owner->buffer()); owner->buffer()->insertInset(new_inset, "Standard", true); - new_inset->Edit(0,0); + new_inset->Edit(0, 0); } break; case LFUN_CHILDOPEN: { - string filename = MakeAbsPath(argument, - OnlyPath(owner->buffer()->getFileName())); + string filename = + MakeAbsPath(argument, + OnlyPath(owner->buffer()->getFileName())); setMessage(N_("Opening child document ") + MakeDisplayPath(filename) + "..."); owner->currentView()->savePosition(); @@ -2366,7 +2358,7 @@ string LyXFunc::Dispatch(int ac, SmallUpdate(1); } SetUpdateTimer(); - owner->buffer()->text->sel_cursor = + owner->buffer()->text->sel_cursor = owner->buffer()->text->cursor; moveCursorUpdate(false); } @@ -2396,7 +2388,8 @@ string LyXFunc::Dispatch(int ac, } BeforeChange(); - for (string::size_type i = 0; i < argument.length(); ++i) { + for (string::size_type i = 0; + i < argument.length(); ++i) { if (greek_kb_flag) { if (!math_insert_greek(argument[i])) owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->buffer()->text); @@ -2407,7 +2400,7 @@ string LyXFunc::Dispatch(int ac, SmallUpdate(1); SetUpdateTimer(); - owner->buffer()->text->sel_cursor = + owner->buffer()->text->sel_cursor = owner->buffer()->text->cursor; moveCursorUpdate(false); return string(); @@ -2426,7 +2419,7 @@ string LyXFunc::Dispatch(int ac, } // end of switch exit_with_message: - string res=getMessage(); + string res= getMessage(); if (res.empty()) { if (!commandshortcut.empty()) { @@ -2487,7 +2480,7 @@ void LyXFunc::MenuNew(bool fromTemplate) // Check if the document already is open if (bufferlist.exists(s)){ switch(AskConfirmation(_("Document is already open:"), - MakeDisplayPath(s,50), + MakeDisplayPath(s, 50), _("Do you want to close that document now?\n" "('No' will just switch to the open version)"))) { @@ -2510,7 +2503,7 @@ void LyXFunc::MenuNew(bool fromTemplate) FilePtr myfile(s, FilePtr::read); if (myfile() && AskQuestion(_("File already exists:"), - MakeDisplayPath(s,50), + MakeDisplayPath(s, 50), _("Do you want to open the document?"))) { // loads document owner->getMiniBuffer()->Set(_("Opening document"), @@ -2538,7 +2531,7 @@ void LyXFunc::MenuNew(bool fromTemplate) // find a free buffer lyxerr.debug() << "Find a free buffer." << endl; - owner->currentView()->buffer(bufferlist.newFile(s,templname)); + owner->currentView()->buffer(bufferlist.newFile(s, templname)); } @@ -2626,7 +2619,7 @@ void LyXFunc::doImportASCII(bool linorpar) // Check if the document already is open if (bufferlist.exists(s)){ switch(AskConfirmation(_("Document is already open:"), - MakeDisplayPath(s,50), + MakeDisplayPath(s, 50), _("Do you want to close that document now?\n" "('No' will just switch to the open version)"))) { @@ -2653,11 +2646,11 @@ void LyXFunc::doImportASCII(bool linorpar) return; } - owner->currentView()->buffer(bufferlist.newFile(s,string())); + owner->currentView()->buffer(bufferlist.newFile(s, string())); owner->getMiniBuffer()->Set(_("Importing ASCII file"), MakeDisplayPath(filename), "..."); // Insert ASCII file - InsertAsciiFile(filename,linorpar); + InsertAsciiFile(filename, linorpar); owner->getMiniBuffer()->Set(_("ASCII file "), MakeDisplayPath(filename), _("imported.")); @@ -2705,7 +2698,7 @@ void LyXFunc::doImportLaTeX(bool isnoweb) string LyXfilename = ChangeExtension(filename, ".lyx", false); if (bufferlist.exists(LyXfilename)){ switch(AskConfirmation(_("Document is already open:"), - MakeDisplayPath(LyXfilename,50), + MakeDisplayPath(LyXfilename, 50), _("Do you want to close that document now?\n" "('No' will just switch to the open version)"))) { @@ -2843,16 +2836,12 @@ Inset * LyXFunc::getInsetByCode(Inset::Code code) bool found = false; Inset * inset = 0; LyXCursor cursor = owner->buffer()->text->cursor; -#ifdef NEW_TEXT LyXParagraph::size_type pos = cursor.pos; -#else - int pos = cursor.pos; -#endif LyXParagraph * par = cursor.par; while (par && !found) { while ((inset = par->ReturnNextInsetPointer(pos))){ - if (inset->LyxCode()==code) { + if (inset->LyxCode() == code) { found = true; break; } diff --git a/src/lyxfunc.h b/src/lyxfunc.h index 3abd7ce1ff..5228fda027 100644 --- a/src/lyxfunc.h +++ b/src/lyxfunc.h @@ -42,13 +42,13 @@ public: // These can't be global because are part of the internat state (ale970227) /// Get the current keyseq string - string keyseqStr(int l=190); + string keyseqStr(int l = 190); /// Is the key sequence uncomplete? bool keyseqUncomplete(); /// get options for the current keyseq - string keyseqOptions(int l=190); + string keyseqOptions(int l = 190); /// Returns the name of a funcion given a keyseq char const* getFunc(char*) diff --git a/src/lyxlex.C b/src/lyxlex.C index 517bad5e00..00a488341b 100644 --- a/src/lyxlex.C +++ b/src/lyxlex.C @@ -56,7 +56,7 @@ void LyXLex::popTable() void LyXLex::printTable() { lyxerr << "\nNumber of tags: " << no_items << endl; - for(int i=0; i ' ' && !feof(file)) { @@ -306,7 +306,7 @@ bool LyXLex::next(bool esc) status = LEX_TOKEN; } - if (c== '\r' && !feof(file)) { + if (c == '\r' && !feof(file)) { // The Windows support has lead to the // possibility of "\r\n" at the end of // a line. This will stop LyX choking @@ -314,7 +314,7 @@ bool LyXLex::next(bool esc) c = getc(file); } - if (c=='\n') + if (c == '\n') ++lineno; } @@ -333,9 +333,9 @@ bool LyXLex::next(bool esc) c = getc(file); // skip ','s - if (c==',') continue; + if (c == ',') continue; - if (c=='\\') { + if (c == '\\') { // escape int i = 0; do { @@ -355,7 +355,7 @@ bool LyXLex::next(bool esc) continue; } - if (c=='#') { + if (c == '#') { // Read rest of line (fast :-) fgets(buff, sizeof(buff), file); ++lineno; @@ -363,7 +363,7 @@ bool LyXLex::next(bool esc) } // string - if (c=='\"') { + if (c == '\"') { int i = -1; bool escaped = false; do { @@ -378,18 +378,18 @@ bool LyXLex::next(bool esc) buff[++i] = c; if (!escaped && c == '\"') break; - } while (c!='\n' && !feof(file) && - i!=(LEX_MAX_BUFF-2)); + } while (c!= '\n' && !feof(file) && + i!= (LEX_MAX_BUFF-2)); - if (i==(LEX_MAX_BUFF-2)) { + if (i == (LEX_MAX_BUFF-2)) { printError("Line too long"); c = '\"'; // Pretend we got a " ++i; } - if (c!='\"') { + if (c!= '\"') { printError("Missing quote"); - if (c=='\n') + if (c == '\n') ++lineno; } @@ -418,7 +418,7 @@ bool LyXLex::next(bool esc) } // new line - if (c=='\n') + if (c == '\n') ++lineno; } @@ -460,12 +460,12 @@ bool LyXLex::nextToken() printError("Line too long"); } - if (c == '\\') ungetc(c,file); // put it back + if (c == '\\') ungetc(c, file); // put it back buff[i] = '\0'; status = LEX_TOKEN; } - if (c=='\n') + if (c == '\n') ++lineno; } diff --git a/src/lyxlex.h b/src/lyxlex.h index d955d27381..39809e476a 100644 --- a/src/lyxlex.h +++ b/src/lyxlex.h @@ -126,8 +126,8 @@ protected: struct pushed_table { /// pushed_table(){ - next=0; - table_elem=0; + next= 0; + table_elem= 0; } /// pushed_table *next; diff --git a/src/lyxlookup.C b/src/lyxlookup.C index 99565a8456..8783facc01 100644 --- a/src/lyxlookup.C +++ b/src/lyxlookup.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX team. * - * ======================================================*/ + * ====================================================== */ #include @@ -25,7 +25,7 @@ static XIM xim; static XIC xic; -XComposeStatus compose_status={0,0}; +XComposeStatus compose_status= {0, 0}; // This is called after the main LyX window has been created void InitLyXLookup(Display* display, Window window) @@ -33,7 +33,7 @@ void InitLyXLookup(Display* display, Window window) xic = 0; // This part could be done before opening display - setlocale(LC_CTYPE,""); + setlocale(LC_CTYPE, ""); if (!XSupportsLocale()) { lyxerr.debug() << "InitLyXLookup: X does not support this locale." << endl; return; @@ -202,7 +202,7 @@ void CloseLyXLookup() #include #include -XComposeStatus compose_status={0,0}; +XComposeStatus compose_status= {0, 0}; // This is called after the main LyX window has been created void InitLyXLookup(Display* , Window ) diff --git a/src/lyxlookup.h b/src/lyxlookup.h index bddac0f93e..effd9236b3 100644 --- a/src/lyxlookup.h +++ b/src/lyxlookup.h @@ -1,12 +1,12 @@ /* This file is part of -*- C++ -*- -* ====================================================== +* ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995-1997 Matthias Ettrich * & The LyX team * -*======================================================*/ +* ====================================================== */ /* This header file defines wrappers around the X input method related functions. This should probably be moved into LyXView (to have diff --git a/src/lyxparagraph.h b/src/lyxparagraph.h index caa3540fdb..988b1c18b0 100644 --- a/src/lyxparagraph.h +++ b/src/lyxparagraph.h @@ -1,6 +1,6 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * @@ -16,26 +16,18 @@ #pragma interface #endif -#define NEW_TEXT 1 //#define NEW_TABLE 1 #ifdef NEW_TABLE #include #endif -#ifdef NEW_TEXT #include -//#include -//#define __STD_STUFF 1 -//#include -#endif -#include "definitions.h" #include "insets/lyxinset.h" +#include "insets/insetbib.h" #include "table.h" -#include "support/textutils.h" #include "vspace.h" -#include "insets/insetbib.h" #include "layout.h" class BufferParams; @@ -46,6 +38,52 @@ struct LaTeXFeatures; /// A LyXParagraph holds all text, attributes and insets in a text paragraph class LyXParagraph { public: + /// + enum PEXTRA_TYPE { + /// + PEXTRA_NONE, + /// + PEXTRA_INDENT, + /// + PEXTRA_MINIPAGE, + /// + PEXTRA_FLOATFLT + }; + /// + enum MINIPAGE_ALIGNMENT { + /// + MINIPAGE_ALIGN_TOP, + /// + MINIPAGE_ALIGN_MIDDLE, + /// + MINIPAGE_ALIGN_BOTTOM + }; + /// + enum META_KIND { + /// + META_FOOTNOTE = 1, + /// + META_MARGIN, + /// + META_FIG, + /// + META_TAB, + /// + META_ALGORITHM, + /// + META_WIDE_FIG, + /// + META_WIDE_TAB, + /// + META_HFILL, + /// + META_NEWLINE, + /// + META_PROTECTED_SEPARATOR, + /// + META_INSET + }; + /// The footnoteflag enum footnote_flag { /// @@ -96,18 +134,6 @@ public: id = id_arg; } -#ifndef NEW_TEXT - /** allocates more memory for the specified paragraph - pos is needed to specify the paragraph correctly. Remember the - closed footnotes - */ - void Enlarge(int pos, int number); - /** make the allocated memory fit to the needed size - used to make a paragraph smaller - */ - void FitSize(); -#endif - /// void read(); @@ -142,7 +168,6 @@ public: } -#ifdef NEW_TEXT /// typedef char value_type; /// @@ -154,14 +179,6 @@ public: TextContainer text; /// size_type size() const { return text.size(); } -#else - /// - int last; - /// - int size; - /// - char * text; -#endif /// VSpace added_space_top; @@ -271,23 +288,18 @@ public: */ LyXParagraph * NextAfterFootnote(); /// + LyXParagraph * NextAfterFootnote() const; + /// LyXParagraph * PreviousBeforeFootnote(); /// LyXParagraph * LastPhysicalPar(); /// LyXParagraph * FirstPhysicalPar(); -#ifdef NEW_TEXT /// returns the physical paragraph LyXParagraph * ParFromPos(size_type pos); /// returns the position in the physical par int PositionInParFromPos(size_type pos); -#else - /// returns the physical paragraph - LyXParagraph * ParFromPos(int pos); - /// returns the position in the physical par - int PositionInParFromPos(int pos); -#endif /// for the environments LyXParagraph * DepthHook(int depth); @@ -312,7 +324,6 @@ public: void SetOnlyLayout(LyXTextClass::LayoutList::size_type new_layout); /// int GetFirstCounter(int i); -#ifdef NEW_TEXT /// size_type Last(); /// @@ -338,11 +349,14 @@ public: /// char GetChar(size_type pos); /// + char GetChar(size_type pos) const; + /// void SetFont(size_type pos, LyXFont const & font); /// string GetWord(size_type &); /// Returns the height of the highest font in range - LyXFont::FONT_SIZE HighestFontInRange(size_type startpos, size_type endpos) const; + LyXFont::FONT_SIZE HighestFontInRange(size_type startpos, + size_type endpos) const; /// void InsertChar(size_type pos, char c); /// @@ -361,146 +375,26 @@ public: void CutIntoMinibuffer(size_type pos); /// void InsertFromMinibuffer(size_type pos); + /// - bool IsHfill(size_type pos) { - return IsHfillChar(GetChar(pos)); - } - - /// - bool IsInset(size_type pos) { - return IsInsetChar(GetChar(pos)); - } - - /// - bool IsFloat(size_type pos) { - return IsFloatChar(GetChar(pos)); - } - - /// - bool IsNewline(size_type pos) { - bool tmp = false; - if (pos >= 0) - tmp= IsNewlineChar(GetChar(pos)); - return tmp; - } - - /// - bool IsSeparator(size_type pos) { - return IsSeparatorChar(GetChar(pos)); - } - - /// - bool IsLineSeparator(size_type pos) { - return IsLineSeparatorChar(GetChar(pos)); - } - - /// - bool IsKomma(size_type pos){ - return IsKommaChar(GetChar(pos)); - } - - /// Used by the spellchecker - bool IsLetter(size_type pos); - - /// - bool IsWord(size_type pos ) { - return IsWordChar( GetChar(pos) ) ; - } -#else - /// - int Last(); - /// - void Erase(int pos); - /** the flag determines wether the layout should be copied - */ - void BreakParagraph(int pos, int flag); - /// - void BreakParagraphConservative(int pos); - /** Get unistantiated font setting. Returns the difference - between the characters font and the layoutfont. - This is what is stored in the fonttable - */ - LyXFont GetFontSettings(int pos); - /** Get fully instantiated font. If pos == -1, use the layout - font attached to this paragraph. - If pos == -2, use the label font of the layout attached here. - In all cases, the font is instantiated, i.e. does not have any - attributes with values LyXFont::INHERIT, LyXFont::IGNORE or - LyXFont::TOGGLE. - */ - LyXFont getFont(int pos); - /// - char GetChar(int pos); - /// - void SetFont(int pos, LyXFont const & font); - /// - string GetWord(int &); - /// Returns the height of the highest font in range - LyXFont::FONT_SIZE HighestFontInRange(int startpos, int endpos) const; - /// - void InsertChar(int pos, char c); - /// - void InsertInset(int pos, Inset * inset); - /// - Inset * GetInset(int pos); - /// - Inset * ReturnNextInsetPointer(int & pos); - /// - void OpenFootnote(int pos); - /// - void CloseFootnote(int pos); - /// important for cut and paste - void CopyIntoMinibuffer(int pos); - /// - void CutIntoMinibuffer(int pos); + bool IsHfill(size_type pos) const; /// - void InsertFromMinibuffer(int pos); + bool IsInset(size_type pos) const; /// - bool IsHfill(int pos) { - return IsHfillChar(GetChar(pos)); - } - + bool IsFloat(size_type pos) const; /// - bool IsInset(int pos) { - return IsInsetChar(GetChar(pos)); - } - + bool IsNewline(size_type pos) const; /// - bool IsFloat(int pos) { - return IsFloatChar(GetChar(pos)); - } - + bool IsSeparator(size_type pos) const; /// - bool IsNewline(int pos) { - bool tmp = false; - if (pos >= 0) - tmp= IsNewlineChar(GetChar(pos)); - return tmp; - } - + bool IsLineSeparator(size_type pos) const; /// - bool IsSeparator(int pos) { - return IsSeparatorChar(GetChar(pos)); - } - - /// - bool IsLineSeparator(int pos) { - return IsLineSeparatorChar(GetChar(pos)); - } - - /// - bool IsKomma(int pos){ - return IsKommaChar(GetChar(pos)); - } - + bool IsKomma(size_type pos) const; /// Used by the spellchecker - bool IsLetter(int pos); - + bool IsLetter(size_type pos) const; /// - bool IsWord( int pos ) { - return IsWordChar( GetChar(pos) ) ; - } -#endif + bool IsWord(size_type pos) const; + /** This one resets all layout and dtp switches but not the font of the single characters */ @@ -557,7 +451,6 @@ public: void SetPExtraType(int type, char const * width, char const * widthp); /// void UnsetPExtraType(); -#ifdef NEW_TEXT /// bool RoffContTableRows(FILE * file, size_type i, int actcell); @@ -565,13 +458,6 @@ public: void DocBookContTableRows(string & file, string & extra, int & desc_on, size_type i, int current_cell_number, int & column); -#else - /// - bool RoffContTableRows(FILE * file, int i, int actcell); - /// - void DocBookContTableRows(string & file, string & extra, int & desc_on, - int i, int current_cell_number, int & column); -#endif /// bool linuxDocConvertChar(char c, string & sgml_string); /// @@ -585,17 +471,10 @@ private: is limited. (Asger) */ struct FontTable { -#ifdef NEW_TEXT /// Start position of paragraph this font attribute covers size_type pos; /// Ending position of paragraph this font attribute covers size_type pos_end; -#else - /// Start position of paragraph this font attribute covers - int pos; - /// Ending position of paragraph this font attribute covers - int pos_end; -#endif /** Font. Interpretation of the font values: If a value is LyXFont::INHERIT_*, it means that the font attribute is inherited from either the layout of this @@ -613,13 +492,8 @@ private: }; /// struct InsetTable { -#ifdef NEW_TEXT /// size_type pos; -#else - /// - int pos; -#endif /// Inset * inset; #ifndef NEW_TABLE @@ -654,7 +528,6 @@ private: bool SimpleTeXOnePar(string & file, TexRow & texrow); /// bool SimpleTeXOneTablePar(string & file, TexRow & texrow); -#ifdef NEW_TEXT /// bool TeXContTableRows(string & file, size_type i, int current_cell_number, @@ -671,25 +544,9 @@ private: LyXLayout const & style, size_type & i, int & column, char const c); -#else - /// - bool TeXContTableRows(string & file, int i, int current_cell_number, - int & column, TexRow & texrow); - /// - void SimpleTeXBlanks(string & file, TexRow & texrow, - int const i, int & column, LyXFont const & font, - LyXLayout const & style); - /// - void SimpleTeXSpecialChars(string & file, TexRow & texrow, - LyXFont & font, LyXFont & running_font, - LyXFont & basefont, bool & open_font, - LyXLayout const & style, - int & i, int & column, char const c); -#endif /// int id; /// static unsigned int paragraph_id; }; - #endif diff --git a/src/lyxrc.C b/src/lyxrc.C index 520fcc6f42..ae33b10370 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -37,7 +37,7 @@ extern kb_keymap *toplevel_keymap; extern LyXAction lyxaction; enum _LyXRCTags { - RC_BEGINTOOLBAR=1, + RC_BEGINTOOLBAR = 1, RC_FONT_ENCODING, RC_PRINTER, RC_PRINT_COMMAND, @@ -253,7 +253,7 @@ LyXRC::LyXRC() view_ps_command = "ghostview -swap"; view_pspic_command = "ghostview"; view_dvi_command = "xdvi"; - default_papersize = PAPER_USLETTER; + default_papersize = BufferParams::PAPER_USLETTER; custom_export_format = "ps"; chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38"; html_command = "tth -t"; @@ -302,7 +302,7 @@ LyXRC::LyXRC() int LyXRC::ReadBindFile(string const & name) { hasBindFile = true; - string tmp = i18nLibFileSearch("bind",name,"bind"); + string tmp = i18nLibFileSearch("bind", name, "bind"); lyxerr[Debug::LYXRC] << "Reading bindfile:" << tmp << endl; int result = Read(tmp); if (result) { @@ -520,19 +520,19 @@ int LyXRC::Read(string const &filename) if (lexrc.next()) { string size = lowercase(lexrc.GetString()); if (size == "usletter") - default_papersize = PAPER_USLETTER; + default_papersize = BufferParams::PAPER_USLETTER; else if (size == "legal") - default_papersize = PAPER_LEGALPAPER; + default_papersize = BufferParams::PAPER_LEGALPAPER; else if (size == "executive") - default_papersize = PAPER_EXECUTIVEPAPER; + default_papersize = BufferParams::PAPER_EXECUTIVEPAPER; else if (size == "a3") - default_papersize = PAPER_A3PAPER; + default_papersize = BufferParams::PAPER_A3PAPER; else if (size == "a4") - default_papersize = PAPER_A4PAPER; + default_papersize = BufferParams::PAPER_A4PAPER; else if (size == "a5") - default_papersize = PAPER_A5PAPER; + default_papersize = BufferParams::PAPER_A5PAPER; else if (size == "b5") - default_papersize = PAPER_B5PAPER; + default_papersize = BufferParams::PAPER_B5PAPER; } break; case RC_VIEWDVI_COMMAND: @@ -704,24 +704,24 @@ int LyXRC::Read(string const &filename) ReadBindFile(); // !!!chb, dynamic key binding... - int action, res=0; + int action, res = 0; string seq, cmd; - if (lexrc.lex()==LyXLex::LEX_DATA) { + if (lexrc.lex() == LyXLex::LEX_DATA) { seq = lexrc.GetString(); } else { lexrc.printError("Bad key sequence: `$$Token'"); break; } - if (lexrc.lex()==LyXLex::LEX_DATA) { + if (lexrc.lex() == LyXLex::LEX_DATA) { cmd = lexrc.GetString(); } else { lexrc.printError("Bad command: `$$Token'"); break; } - if ((action = lyxaction.LookupFunc(cmd.c_str()))>=0) { + if ((action = lyxaction.LookupFunc(cmd.c_str()))>= 0) { if (lyxerr.debugging(Debug::KEY)) { lyxerr << "RC_BIND: Sequence `" << seq << "' Command `" @@ -760,7 +760,7 @@ int LyXRC::Read(string const &filename) case RC_SELECTION_COLOR: if (lexrc.next()) strncpy(selection_color, - lexrc.GetString().c_str(),31); + lexrc.GetString().c_str(), 31); break; case RC_FAX_COMMAND: if (lexrc.next()) diff --git a/src/lyxrc.h b/src/lyxrc.h index 6b2a89ec43..25d0cbdf6e 100644 --- a/src/lyxrc.h +++ b/src/lyxrc.h @@ -1,13 +1,13 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #ifndef LYXRC_H #define LYXRC_H @@ -17,6 +17,7 @@ #endif #include "toolbar.h" +#include "bufferparams.h" /// This contains the runtime configuration of LyX class LyXRC { @@ -93,7 +94,7 @@ public: /// program for viewing dvi output (default "xdvi") string view_dvi_command; /// default paper size for local xdvi/dvips/ghostview/whatever - LYX_PAPER_SIZE default_papersize; + BufferParams::PAPER_SIZE default_papersize; /// command to run chktex incl. options string chktex_command; /// command to run an html converter incl. options diff --git a/src/lyxrow.h b/src/lyxrow.h index 1f7416c021..db11a12088 100644 --- a/src/lyxrow.h +++ b/src/lyxrow.h @@ -1,6 +1,6 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * @@ -19,11 +19,7 @@ struct Row { /// LyXParagraph * par; /// -#ifdef NEW_TEXT LyXParagraph::size_type pos; -#else - int pos; -#endif /// unsigned short baseline; /** what is missing to a full row can be negative. diff --git a/src/lyxscreen.h b/src/lyxscreen.h index 3e5f47accb..9d60bf11c8 100644 --- a/src/lyxscreen.h +++ b/src/lyxscreen.h @@ -1,13 +1,13 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team * - * ======================================================*/ + * ====================================================== */ #ifndef LYXSCREEN_H #define LYXSCREEN_H diff --git a/src/lyxserver.C b/src/lyxserver.C index 9dafa73de0..d6c217529d 100644 --- a/src/lyxserver.C +++ b/src/lyxserver.C @@ -1,13 +1,13 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ /** Docu : To use the lyxserver define the name of the pipe in your @@ -304,11 +304,11 @@ void LyXComm::callback(int fd, void *v) errno = 0; int status; // the single = is intended here. - while((status = read(fd,charbuf,CMDBUFLEN-1))) + while((status = read(fd, charbuf, CMDBUFLEN-1))) {// break and return in loop if(status > 0) // got something { - charbuf[status]='\0'; // turn it into a c string + charbuf[status]= '\0'; // turn it into a c string lsbuf += strip(charbuf, '\r'); // commit any commands read while(lsbuf.find('\n') != string::npos) // while still @@ -317,7 +317,7 @@ void LyXComm::callback(int fd, void *v) { // split() grabs the entire string if // the delim /wasn't/ found. ?:-P - lsbuf=split(lsbuf, cmd,'\n'); + lsbuf= split(lsbuf, cmd,'\n'); lyxerr[Debug::LYXSERVER] << "LyXComm: status:" << status << ", lsbuf:" << lsbuf @@ -348,7 +348,7 @@ void LyXComm::callback(int fd, void *v) } c->closeConnection(); c->openConnection(); - errno=0; + errno= 0; } extern "C" void C_LyXComm_callback(int fd, void *v) @@ -401,7 +401,7 @@ LyXServer::~LyXServer() // modified june 1999 by stefano@zool.su.se to send as many bye // messages as there are clients, each with client's name. string message; - for (int i=0; inumclients==MAX_CLIENTS){ //paranoid check + if(serv->numclients == MAX_CLIENTS){ //paranoid check lyxerr[Debug::LYXSERVER] << "LyXServer: too many clients..." << endl; return; } - int i=0; //find place in clients[] + int i= 0; //find place in clients[] while (!serv->clients[i].empty() && inumclients) i++; @@ -487,10 +487,10 @@ void LyXServer::callback(LyXServer * serv, string const & msg) << client << endl; serv->pipes.send(buf); } else if (cmd == "bye") { - // If clients==0 maybe we should reset the pipes + // If clients == 0 maybe we should reset the pipes // to prevent fake callbacks int i; //look if client is registered - for (i=0; inumclients; i++) { + for (i= 0; inumclients; i++) { if (serv->clients[i] == client) break; } if (inumclients) { @@ -524,7 +524,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg) //int action = -1; string rval, buf; - if (action>=0) { + if (action>= 0) { rval = serv->func->Dispatch(action, arg.c_str()); } else { rval = "Unknown command"; diff --git a/src/lyxserver.h b/src/lyxserver.h index 9dcdf99d65..e9ddba0b90 100644 --- a/src/lyxserver.h +++ b/src/lyxserver.h @@ -1,13 +1,13 @@ // -*- C++ -*- /* This file is part of -* ====================================================== +* ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995 Matthias Ettrich * Copyright (C) 1995-1998 The LyX Team. * -*======================================================*/ +* ====================================================== */ #ifndef LYXSERVER_H #define LYXSERVER_H diff --git a/src/lyxtext.h b/src/lyxtext.h index a4fe92f227..afec122ac8 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -1,13 +1,13 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #ifndef LYXTEXT_H #define LYXTEXT_H @@ -16,7 +16,6 @@ #pragma interface #endif -#include "definitions.h" #include "lyxfont.h" #include "lyxrow.h" #include "undo.h" @@ -63,7 +62,6 @@ public: /// Destructor ~LyXText(); -#ifdef NEW_TEXT /// LyXFont GetFont(LyXParagraph * par, LyXParagraph::size_type pos); @@ -71,12 +69,6 @@ public: void SetCharFont(LyXParagraph * par, LyXParagraph::size_type pos, LyXFont font); -#else - /// - LyXFont GetFont(LyXParagraph * par, int pos); - /// - void SetCharFont(LyXParagraph * par, int pos, LyXFont font); -#endif /// returns a pointer to the very first LyXParagraph LyXParagraph * FirstParagraph(); @@ -181,12 +173,8 @@ public: /** returns a pointer to a specified row. y is set to the beginning of the row */ -#ifdef NEW_TEXT Row * GetRow(LyXParagraph * par, LyXParagraph::size_type pos, long & y); -#else - Row * GetRow(LyXParagraph * par, int pos, long & y); -#endif /** returns the height of a default row, needed for scrollbar */ int DefaultHeight(); @@ -234,19 +222,12 @@ public: char * SelectNextWord(float & value); /// void SelectSelectedWord(); -#ifdef NEW_TEXT /// void SetCursor(LyXParagraph * par, LyXParagraph::size_type pos); /// void SetCursorIntern(LyXParagraph * par, LyXParagraph::size_type pos); -#else - /// - void SetCursor(LyXParagraph * par, int pos); - /// - void SetCursorIntern(LyXParagraph * par, int pos); -#endif /// void SetCursorFromCoordinates(int x, long y); /// @@ -368,13 +349,9 @@ public: /** returns true if the specified string is at the specified position */ -#ifdef NEW_TEXT bool IsStringInText(LyXParagraph * par, LyXParagraph::size_type pos, char const * str); -#else - bool IsStringInText(LyXParagraph * par, int pos, char const * str); -#endif /** sets the selection over the number of characters of string, no check!! */ @@ -390,12 +367,10 @@ public: bool SearchForward(char const * string); bool SearchBackward(char const * string); -#ifdef NEW_TEXT /// needed to insert the selection void InsertStringA(LyXParagraph::TextContainer const & text); /// needed to insert the selection void InsertStringB(LyXParagraph::TextContainer const & text); -#endif /// needed to insert the selection void InsertStringA(char const * string); /// needed to insert the selection @@ -418,19 +393,12 @@ public: /// returns 0 if inset wasn't found int UpdateInset(Inset * inset); -#ifdef NEW_TEXT /// void CheckParagraph(LyXParagraph * par, LyXParagraph::size_type pos); /// int NumberOfCell(LyXParagraph * par, LyXParagraph::size_type pos); -#else - /// - void CheckParagraph(LyXParagraph * par, int pos); - /// - int NumberOfCell(LyXParagraph * par, int pos); -#endif /* table stuff -- begin*/ /** all table features of the text-class are put together in @@ -442,16 +410,10 @@ public: /** pos points at the beginning of the next cell (if there is one) */ -#ifdef NEW_TEXT int WidthOfCell(LyXParagraph * par, LyXParagraph::size_type & pos); /// void CheckParagraphInTable(LyXParagraph * par, LyXParagraph::size_type pos); -#else - int WidthOfCell(LyXParagraph * par, int & pos); - /// - void CheckParagraphInTable(LyXParagraph * par, int pos); -#endif /// void InsertCharInTable(char c); /// @@ -526,12 +488,8 @@ private: /** inserts a new row behind the specified row, increments * the touched counters */ -#ifdef NEW_TEXT void InsertRow(Row * row, LyXParagraph * par, LyXParagraph::size_type pos ); -#else - void InsertRow(Row * row, LyXParagraph * par, int pos ); -#endif /** removes the row and reset the touched counters */ void RemoveRow(Row * row); @@ -570,7 +528,6 @@ private: * some low level functions */ -#ifdef NEW_TEXT /// int SingleWidth(LyXParagraph * par, LyXParagraph::size_type pos); @@ -584,17 +541,6 @@ private: /// get the next breakpoint in a given paragraph LyXParagraph::size_type NextBreakPoint(Row * row, int width); -#else - /// - int SingleWidth(LyXParagraph * par, int pos); - /// - int SingleWidth(LyXParagraph * par, int pos, char c); - /// - void Draw(Row * row, int & pos, LyXScreen & scr, - int offset, float & x); - /// get the next breakpoint in a given paragraph - int NextBreakPoint(Row * row, int width); -#endif /// returns the minimum space a row needs on the screen in pixel int Fill(Row * row, int paperwidth); @@ -602,13 +548,8 @@ private: screen in pixel */ int LabelFill(Row * row); -#ifdef NEW_TEXT /// LyXParagraph::size_type BeginningOfMainBody(LyXParagraph * par); -#else - /// - int BeginningOfMainBody(LyXParagraph * par); -#endif /** Returns the left beginning of the text. This information cannot be taken from the layouts-objekt, because in LaTeX the beginning of the text fits in some cases @@ -638,20 +579,12 @@ private: /** returns true, if a expansion is needed. Rules are given by LaTeX */ -#ifdef NEW_TEXT bool HfillExpansion(Row * row_ptr, LyXParagraph::size_type pos); /** returns the paragraph position of the last character in the specified row */ LyXParagraph::size_type RowLast(Row * row); -#else - bool HfillExpansion(Row * row_ptr, int pos); - /** returns the paragraph position of the last character in the - specified row - */ - int RowLast(Row * row); -#endif }; #endif diff --git a/src/lyxvc.C b/src/lyxvc.C index 9ef4c774bb..616d2ed3af 100644 --- a/src/lyxvc.C +++ b/src/lyxvc.C @@ -85,7 +85,7 @@ void LyXVC::registrer() // If the document is changed, we might want to save it if (!vcs->owner()->isLyxClean() && AskQuestion(_("Changes in document:"), - MakeDisplayPath(vcs->owner()->getFileName(),50), + MakeDisplayPath(vcs->owner()->getFileName(), 50), _("Save document and proceed?"))) { vcs->owner()->getUser()->owner() ->getLyXFunc()->Dispatch(LFUN_MENUWRITE); @@ -115,7 +115,7 @@ void LyXVC::checkIn() // If the document is changed, we might want to save it if (!vcs->owner()->isLyxClean() && AskQuestion(_("Changes in document:"), - MakeDisplayPath(vcs->owner()->getFileName(),50), + MakeDisplayPath(vcs->owner()->getFileName(), 50), _("Save document and proceed?"))) { vcs->owner()->getUser()->owner() ->getLyXFunc()->Dispatch(LFUN_MENUWRITE); @@ -141,7 +141,7 @@ void LyXVC::checkOut() lyxerr[Debug::LYXVC] << "LyXVC: checkOut" << endl; if (!vcs->owner()->isLyxClean() && !AskQuestion(_("Changes in document:"), - MakeDisplayPath(vcs->owner()->getFileName(),50), + MakeDisplayPath(vcs->owner()->getFileName(), 50), _("Ignore changes and proceed with check out?"))) { return; } @@ -251,11 +251,11 @@ void LyXVC::viewLog(string const & fil) _("Close")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_LyXVC_logClose, 0); - obj = fl_add_button(FL_NORMAL_BUTTON,370,340,90,30, + obj = fl_add_button(FL_NORMAL_BUTTON, 370, 340, 90, 30, idex(_("Update|#Uu"))); - fl_set_button_shortcut(obj,scex(_("Update|#Uu")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_LyXVC_logUpdate,0); + fl_set_button_shortcut(obj, scex(_("Update|#Uu")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_LyXVC_logUpdate, 0); fl_end_form(); fl_set_form_atclose(browser->LaTeXLog, CancelCloseBoxCB, 0); } diff --git a/src/main.C b/src/main.C index 9b4d8ddd72..eb3bc8581d 100644 --- a/src/main.C +++ b/src/main.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - *======================================================*/ + * ====================================================== */ #include #include FORMS_H_LOCATION @@ -40,6 +40,6 @@ int main(int argc, char *argv[]) { _wildcard(&argc, &argv); #endif - LyX lyx(&argc,argv); + LyX lyx(&argc, argv); return 0; // ok } diff --git a/src/menus.C b/src/menus.C index e628836ea9..aadcbb3a71 100644 --- a/src/menus.C +++ b/src/menus.C @@ -1,13 +1,13 @@ /* * This file is part of - * ================================================== + * ================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ================================================== + * ================================================== */ /* This file contains all the menu and submenu declarations. @@ -210,122 +210,122 @@ void Menus::create_menus(int air) int moffset = 0; // menubar frame - obj = fl_add_frame(FL_UP_FRAME,0,0,form->w,mheight,""); + obj = fl_add_frame(FL_UP_FRAME, 0, 0, form->w, mheight, ""); fl_set_object_resize(obj, FL_RESIZE_ALL); fl_set_object_gravity(obj, NorthWestGravity, NorthEastGravity); menu_grp1 = fl_bgn_group(); // File menu button - menu_file = obj = + menu_file = obj = fl_add_button(FL_TOUCH_BUTTON, - air+moffset,yloc, + air+moffset, yloc, fl_get_string_width(FL_BOLD_STYLE, MENU_LABEL_SIZE, _("File"), strlen(_("File"))) + mbadd, - mbheight,_("File")); + mbheight, _("File")); moffset += obj->w + air; fl_set_object_shortcut(obj, scex(_("MB|#F")), 1); - fl_set_object_callback(obj,C_Menus_ShowFileMenu, 0); + fl_set_object_callback(obj, C_Menus_ShowFileMenu, 0); obj->u_vdata = this; // Edit menu button - menu_edit = obj = + menu_edit = obj = fl_add_button(FL_TOUCH_BUTTON, - moffset,yloc, + moffset, yloc, fl_get_string_width(FL_BOLD_STYLE, MENU_LABEL_SIZE, _("Edit"), strlen(_("Edit"))) + mbadd, - mbheight,_("Edit")); + mbheight, _("Edit")); moffset += obj->w + air; - fl_set_object_shortcut(obj, scex(_("MB|#E")),1); - fl_set_object_callback(obj,C_Menus_ShowEditMenu,0); + fl_set_object_shortcut(obj, scex(_("MB|#E")), 1); + fl_set_object_callback(obj, C_Menus_ShowEditMenu, 0); obj->u_vdata = this; // Layout menu button - menu_layout = obj = + menu_layout = obj = fl_add_button(FL_TOUCH_BUTTON, - moffset,yloc, + moffset, yloc, fl_get_string_width(FL_BOLD_STYLE, MENU_LABEL_SIZE, _("Layout"), strlen(_("Layout"))) + mbadd, - mbheight,_("Layout")); + mbheight, _("Layout")); moffset += obj->w + air; fl_set_object_shortcut(obj, scex(_("MB|#L")), 1); - fl_set_object_callback(obj,C_Menus_ShowLayoutMenu,0); + fl_set_object_callback(obj, C_Menus_ShowLayoutMenu, 0); obj->u_vdata = this; // Insert menu button button - menu_insert = obj = + menu_insert = obj = fl_add_button(FL_TOUCH_BUTTON, - moffset,yloc, + moffset, yloc, fl_get_string_width(FL_BOLD_STYLE, MENU_LABEL_SIZE, _("Insert"), strlen(_("Insert"))) + mbadd, - mbheight,_("Insert")); + mbheight, _("Insert")); moffset += obj->w + air; fl_set_object_shortcut(obj, scex(_("MB|#I")), 1); - fl_set_object_callback(obj,C_Menus_ShowInsertMenu,0); + fl_set_object_callback(obj, C_Menus_ShowInsertMenu, 0); obj->u_vdata = this; // Math menu button - menu_math = obj = + menu_math = obj = fl_add_button(FL_TOUCH_BUTTON, - moffset,yloc, + moffset, yloc, fl_get_string_width(FL_BOLD_STYLE, MENU_LABEL_SIZE, _("Math"), strlen(_("Math"))) + mbadd, - mbheight,_("Math")); + mbheight, _("Math")); moffset += obj->w + air; fl_set_object_shortcut(obj, scex(_("MB|#M")), 1); - fl_set_object_callback(obj,C_Menus_ShowMathMenu,0); + fl_set_object_callback(obj, C_Menus_ShowMathMenu, 0); obj->u_vdata = this; // Options menu button - menu_options = obj = + menu_options = obj = fl_add_button(FL_TOUCH_BUTTON, - moffset,yloc, + moffset, yloc, fl_get_string_width(FL_BOLD_STYLE, MENU_LABEL_SIZE, _("Options"), strlen(_("Options"))) + mbadd, - mbheight,_("Options")); + mbheight, _("Options")); moffset += obj->w + air; fl_set_object_shortcut(obj, scex(_("MB|#O")), 1); - fl_set_object_callback(obj,C_Menus_ShowOptionsMenu, 0); + fl_set_object_callback(obj, C_Menus_ShowOptionsMenu, 0); obj->u_vdata = this; // Documents menu button - menu_buffer = obj = + menu_buffer = obj = fl_add_button(FL_TOUCH_BUTTON, - moffset,yloc, + moffset, yloc, fl_get_string_width(FL_BOLD_STYLE, MENU_LABEL_SIZE, _("Documents"), strlen(_("Documents"))) + mbadd, - mbheight,_("Documents")); + mbheight, _("Documents")); moffset += obj->w + air; fl_set_object_shortcut(obj, scex(_("MB|#D")), 1); - fl_set_object_callback(obj,C_Menus_ShowBufferMenu,0); + fl_set_object_callback(obj, C_Menus_ShowBufferMenu, 0); obj->u_vdata = this; // Help menu button - menu_help = obj = + menu_help = obj = fl_add_button(FL_TOUCH_BUTTON, - moffset,yloc, + moffset, yloc, fl_get_string_width(FL_BOLD_STYLE, MENU_LABEL_SIZE, _("Help"), strlen(_("Help"))) + mbadd, - mbheight,_("Help")); + mbheight, _("Help")); moffset += obj->w + air; fl_set_object_shortcut(obj, scex(_("MB|#H")), 1); - fl_set_object_callback(obj,C_Menus_ShowHelpMenu,0); + fl_set_object_callback(obj, C_Menus_ShowHelpMenu, 0); obj->u_vdata = this; fl_end_group(); @@ -335,12 +335,12 @@ void Menus::create_menus(int air) obj = menu_grp1->next; do { fl_set_object_boxtype(obj, FL_FLAT_BOX); - fl_set_object_color(obj,FL_MCOL, FL_MCOL); - fl_set_object_lsize(obj,MENU_LABEL_SIZE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + fl_set_object_color(obj, FL_MCOL, FL_MCOL); + fl_set_object_lsize(obj, MENU_LABEL_SIZE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_set_object_resize(obj, FL_RESIZE_ALL); fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity); - obj=obj->next; + obj= obj->next; } while (obj != 0 && obj->objclass != FL_END_GROUP); // group 2 @@ -348,45 +348,45 @@ void Menus::create_menus(int air) menu_grp2 = fl_bgn_group(); // File menu button - menu_file2 = obj = + menu_file2 = obj = fl_add_button(FL_TOUCH_BUTTON, - air+moffset,yloc, + air+moffset, yloc, fl_get_string_width(FL_BOLD_STYLE, MENU_LABEL_SIZE, _("File"), strlen(_("File"))) + mbadd, - mbheight,_("File")); + mbheight, _("File")); moffset += obj->w + air; fl_set_object_shortcut(obj, scex(_("MB|#F")), 1); - fl_set_object_callback(obj,C_Menus_ShowFileMenu2, 0); + fl_set_object_callback(obj, C_Menus_ShowFileMenu2, 0); obj->u_vdata = this; // Options menu button - menu_options2 = obj = + menu_options2 = obj = fl_add_button(FL_TOUCH_BUTTON, - moffset,yloc, + moffset, yloc, fl_get_string_width(FL_BOLD_STYLE, MENU_LABEL_SIZE, _("Options"), strlen(_("Options"))) +mbadd, - mbheight,_("Options")); + mbheight, _("Options")); moffset += obj->w + air; fl_set_object_shortcut(obj, scex(_("MB|#O")), 1); - fl_set_object_callback(obj,C_Menus_ShowOptionsMenu, 0); + fl_set_object_callback(obj, C_Menus_ShowOptionsMenu, 0); obj->u_vdata = this; // Help menu button - menu_help2 = obj = + menu_help2 = obj = fl_add_button(FL_TOUCH_BUTTON, - moffset,yloc, + moffset, yloc, fl_get_string_width(FL_BOLD_STYLE, MENU_LABEL_SIZE, _("Help"), strlen(_("Help"))) + mbadd, - mbheight,_("Help")); + mbheight, _("Help")); moffset += obj->w + air; fl_set_object_shortcut(obj, scex(_("MB|#H")), 1); - fl_set_object_callback(obj,C_Menus_ShowHelpMenu,0); + fl_set_object_callback(obj, C_Menus_ShowHelpMenu, 0); obj->u_vdata = this; fl_end_group(); @@ -396,12 +396,12 @@ void Menus::create_menus(int air) obj = menu_grp2->next; do { fl_set_object_boxtype(obj, FL_FLAT_BOX); - fl_set_object_color(obj,FL_MCOL, FL_MCOL); - fl_set_object_lsize(obj,MENU_LABEL_SIZE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + fl_set_object_color(obj, FL_MCOL, FL_MCOL); + fl_set_object_lsize(obj, MENU_LABEL_SIZE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_set_object_resize(obj, FL_RESIZE_ALL); fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity); - obj=obj->next; + obj= obj->next; } while (obj != 0 && obj->objclass != FL_END_GROUP); } @@ -420,7 +420,7 @@ void Menus::ScreenOptions() fl_set_input(fd_form_screen->input_font_norm, lyxrc->font_norm.c_str()); char tmpstring[10]; - sprintf(tmpstring,"%d", lyxrc->zoom); + sprintf(tmpstring, "%d", lyxrc->zoom); fl_set_input(fd_form_screen->intinput_size, tmpstring); if (fd_form_screen->form_screen->visible) { fl_raise_form(fd_form_screen->form_screen); @@ -485,7 +485,7 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long) // and now docbook also. int SubFileExport = 0; if (!LinuxDoc && !DocBook) - SubFileExport=fl_defpup(FL_ObjWin(ob), + SubFileExport= fl_defpup(FL_ObjWin(ob), _("Export%t" "|as LaTeX...%x40" "|as DVI...%x41" @@ -494,14 +494,14 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long) "|as HTML...%x44" "|Custom...%x45")); else if(LinuxDoc) - SubFileExport=fl_defpup(FL_ObjWin(ob), + SubFileExport= fl_defpup(FL_ObjWin(ob), _("Export%t" "|as LinuxDoc...%x40" "|as DVI...%x41" "|as PostScript...%x42" "|as Ascii Text...%x43")); else if(DocBook) - SubFileExport=fl_defpup(FL_ObjWin(ob), + SubFileExport= fl_defpup(FL_ObjWin(ob), _("Export%t" "|as DocBook...%x40" "|as DVI...%x41" @@ -542,11 +542,11 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long) fl_setpup_shortcut(FileMenu, 7, scex(_("FM|Rr#r#R"))); fl_setpup_shortcut(FileMenu, 8, scex(_("FM|dD#d#D"))); fl_setpup_shortcut(FileMenu, 9, scex(_("FM|wW#w#W"))); - fl_setpup_shortcut(FileMenu,10, scex(_("FM|vV#v#V"))); - fl_setpup_shortcut(FileMenu,11, scex(_("FM|Uu#u#U"))); - fl_setpup_shortcut(FileMenu,12, scex(_("FM|Bb#b#B"))); - fl_setpup_shortcut(FileMenu,13, scex(_("FM|Pp#p#P"))); - fl_setpup_shortcut(FileMenu,14, scex(_("FM|Ff#f#F"))); + fl_setpup_shortcut(FileMenu, 10, scex(_("FM|vV#v#V"))); + fl_setpup_shortcut(FileMenu, 11, scex(_("FM|Uu#u#U"))); + fl_setpup_shortcut(FileMenu, 12, scex(_("FM|Bb#b#B"))); + fl_setpup_shortcut(FileMenu, 13, scex(_("FM|Pp#p#P"))); + fl_setpup_shortcut(FileMenu, 14, scex(_("FM|Ff#f#F"))); // These commands are disabled when the corresponding programs // are not installed. I simply grey them out, since I do not @@ -592,11 +592,11 @@ void Menus::ShowFileMenu(FL_OBJECT * ob, long) } // xgettext:no-c-format - fl_addtopup(FileMenu,_("|Import%m"), SubFileImport); + fl_addtopup(FileMenu, _("|Import%m"), SubFileImport); // xgettext:no-c-format - fl_addtopup(FileMenu,_("|Export%m%l"), SubFileExport); + fl_addtopup(FileMenu, _("|Export%m%l"), SubFileExport); // xgettext:no-c-format - fl_addtopup(FileMenu,_("|Exit%l")); + fl_addtopup(FileMenu, _("|Exit%l")); fl_setpup_shortcut(FileMenu, 15, scex(_("FM|Ii#i#I"))); fl_setpup_shortcut(FileMenu, 16, scex(_("FM|Ee#e#E"))); fl_setpup_shortcut(FileMenu, 17, scex(_("FM|xX#x#X"))); @@ -814,7 +814,7 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long) LyXFunc * tmpfunc = men->_view->getLyXFunc(); // Floats & Insets submenu - int SubEditFloats=fl_defpup(FL_ObjWin(ob), + int SubEditFloats= fl_defpup(FL_ObjWin(ob), _("Floats & Insets%t" "|Open/Close%x21" "|Melt%x22" @@ -942,7 +942,7 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long) fl_setpup_shortcut(SubEditTable, 31, scex(_("EMT|Ii#i#I"))); } - int SubVersionControl = fl_newpup(FL_ObjWin(ob)); + int SubVersionControl = fl_newpup(FL_ObjWin(ob)); fl_addtopup(SubVersionControl, _("Version Control%t")); if (tmpbuffer->lyxvc.inUse()) { // xgettext:no-c-format @@ -978,7 +978,7 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long) 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), + int EditMenu= fl_defpup(FL_ObjWin(ob), _("Undo" "|Redo %l" "|Cut" @@ -1236,7 +1236,7 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long) fl_setpup_shortcut(SubInsertAscii, 41, scex(_("IMA|Ll#l#L"))); fl_setpup_shortcut(SubInsertAscii, 42, scex(_("IMA|Pp#p#P"))); - int SubInsertTableList=fl_defpup(FL_ObjWin(ob), + int SubInsertTableList= fl_defpup(FL_ObjWin(ob), _("Lists & TOC%t" "|Table of Contents%x21" "|List of Figures%x22" @@ -1661,8 +1661,8 @@ void Menus::MenuDocu(string const & docname) { string fname = i18nLibFileSearch("doc", docname, "lyx"); _view->getMiniBuffer()->Set(_("Opening help file"), - MakeDisplayPath(fname),"..."); - currentView()->buffer(bufferlist.loadLyXFile(fname,false)); + MakeDisplayPath(fname), "..."); + currentView()->buffer(bufferlist.loadLyXFile(fname, false)); if (docname == "Reference") _view->getLyXFunc()->Dispatch(LFUN_TOCVIEW); diff --git a/src/menus.h b/src/menus.h index bda481d11f..84c9540d79 100644 --- a/src/menus.h +++ b/src/menus.h @@ -7,7 +7,7 @@ * Copyright (C) 1995 1996 Matthias Ettrich * and the LyX Team. * -*======================================================*/ +* ====================================================== */ #ifndef MENUS_H #define MENUS_H diff --git a/src/minibuffer.C b/src/minibuffer.C index 52f41e70d0..eea98c940c 100644 --- a/src/minibuffer.C +++ b/src/minibuffer.C @@ -26,8 +26,8 @@ #include "gettext.h" extern bool keyseqUncomplete(); -extern string keyseqOptions(int l=190); -extern string keyseqStr(int l=190); +extern string keyseqOptions(int l= 190); +extern string keyseqStr(int l= 190); extern LyXAction lyxaction; void MiniBuffer::TimerCB(FL_OBJECT * ob, long) @@ -134,7 +134,7 @@ extern "C" int C_MiniBuffer_peek_event(FL_OBJECT * ob, int event, FL_Coord, FL_Coord, int key, void * xev) { - return MiniBuffer::peek_event(ob,event,0,0,key,xev); + return MiniBuffer::peek_event(ob, event, 0, 0, key, xev); } @@ -142,7 +142,7 @@ void MiniBuffer::ExecCommand() { text.clear(); fl_set_input(the_buffer, ""); - fl_set_focus_object(owner->getForm(),the_buffer); + fl_set_focus_object(owner->getForm(), the_buffer); } @@ -151,13 +151,13 @@ FL_OBJECT * MiniBuffer::add(int type, FL_Coord x, FL_Coord y, { FL_OBJECT * obj; - the_buffer = obj = fl_add_input(type,x,y,w,h,text.c_str()); - fl_set_object_boxtype(obj,FL_DOWN_BOX); + the_buffer = obj = fl_add_input(type, x, y, w, h, text.c_str()); + fl_set_object_boxtype(obj, FL_DOWN_BOX); fl_set_object_resize(obj, FL_RESIZE_ALL); fl_set_object_gravity(obj, SouthWestGravity, SouthEastGravity); - fl_set_object_color(obj,FL_MCOL,FL_MCOL); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,C_MiniBuffer_ExecutingCB, 0); + fl_set_object_color(obj, FL_MCOL, FL_MCOL); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_MiniBuffer_ExecutingCB, 0); // To intercept Up, Down, Table for history fl_set_object_prehandler(obj, C_MiniBuffer_peek_event); @@ -165,7 +165,7 @@ FL_OBJECT * MiniBuffer::add(int type, FL_Coord x, FL_Coord y, obj->wantkey = FL_KEY_TAB; // timer - timer = fl_add_timer(FL_HIDDEN_TIMER, 0,0,0,0, "Timer"); + timer = fl_add_timer(FL_HIDDEN_TIMER, 0, 0, 0, 0, "Timer"); fl_set_object_callback(timer, C_MiniBuffer_TimerCB, 0); timer->u_vdata = this; fl_set_input(the_buffer, text.c_str()); @@ -210,7 +210,7 @@ void MiniBuffer::Init() // Else, show the buffer state. else if (owner->currentView()->available()) { - string nicename = + string nicename = MakeDisplayPath(owner->buffer()-> getFileName()); // Should we do this instead? (kindo like emacs) diff --git a/src/minibuffer.h b/src/minibuffer.h index 7c214d6f28..8ec74a6f7f 100644 --- a/src/minibuffer.h +++ b/src/minibuffer.h @@ -1,6 +1,6 @@ // -*- C++ -*- -#ifndef _MINIBUFFER_H -#define _MINIBUFFER_H +#ifndef MINIBUFFER_H +#define MINIBUFFER_H #include FORMS_H_LOCATION #include "LString.h" @@ -34,7 +34,7 @@ public: void Set(string const& = string(), string const& = string(), string const& = string(), - int delay_secs=6); + int delay_secs= 6); /// string GetText() const { return text; } /// @@ -81,7 +81,7 @@ private: int history_idx, history_cnt; /// void addHistory(string const &cmd) { - if (history_cnt==0 || (history_cnt>0 && cmd!=history[(history_cnt-1) % MAX_HISTORY])) { + if (history_cnt == 0 || (history_cnt>0 && cmd!= history[(history_cnt-1) % MAX_HISTORY])) { history[history_cnt % MAX_HISTORY] = cmd; history_cnt++; } diff --git a/src/nt_defines.h b/src/nt_defines.h index 496d022ba0..0c2c97ed13 100644 --- a/src/nt_defines.h +++ b/src/nt_defines.h @@ -1,13 +1,13 @@ /* -*- C++ -*- */ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, the High Level Word Processor * * Copyright (C) 1995Matthias Ettrich * Copyright (C) 1995-1998 The LyX Team. * - * ====================================================== + * ====================================================== A few prototypes and definitions needed for Windows NT */ /* Hacks to get LyX running under Win-NT w. Cygnus b19 (steven@cs.uu.nl) */ diff --git a/src/os2_defines.h b/src/os2_defines.h index 02525f9546..559c548bb6 100644 --- a/src/os2_defines.h +++ b/src/os2_defines.h @@ -1,20 +1,20 @@ /* -*- C++ -*- */ /* This file is part of -* ====================================================== +* ====================================================== * * LyX, The Document Processor * -* Copyright (C) 1995,1996 Matthias Ettrich +* Copyright (C) 1995, 1996 Matthias Ettrich * -*====================================================== +* ====================================================== A few prototypes and definitions needed for OS/2 */ -#ifndef _OS2_DEFINES_H -#define _OS2_DEFINES_H +#ifndef OS2_DEFINES_H +#define OS2_DEFINES_H -#include +#include #include -#include +#include #include #include /* #include */ @@ -22,8 +22,8 @@ #define lstat stat #define S_ISLNK(x) false #define S_ISBLK(x) false -#define readlink(s,t,l) (strcpy(t,s),strlen(t)) -/*#define mkfifo(p,m) (0) *//* LyXserver is temporary disabled. */ +#define readlink(s, t, l) (strcpy(t, s), strlen(t)) +/*#define mkfifo(p, m) (0) *//* LyXserver is temporary disabled. */ #define getcwd _getcwd2 #define chdir _chdir2 #define strcasecmp stricmp diff --git a/src/os2_errortable.h b/src/os2_errortable.h index 12ef89496d..9ec372f787 100644 --- a/src/os2_errortable.h +++ b/src/os2_errortable.h @@ -4,23 +4,23 @@ * * LyX, The Document Processor * -* Copyright (C) 1995,1996 Matthias Ettrich +* Copyright (C) 1995, 1996 Matthias Ettrich * -*====================================================== +* ====================================================== A table for translating OS/2 API return code into errno. Copied from emx library source. */ -#ifndef _OS2_ERRORTABLE_H -#define _OS2_ERRORTABLE_H -#ifndef _ERRNO_H -#include -#endif +#ifndef OS2_ERRORTABLE_H +#define OS2_ERRORTABLE_H +//#ifndef _ERRNO_H +#include +//#endif static unsigned char const errno_tab[] = { EINVAL, EINVAL, ENOENT, ENOENT, EMFILE, /* 0..4 */ EACCES, EBADF, EIO, ENOMEM, EIO, /* 5..9 */ - EINVAL, ENOEXEC,EINVAL, EINVAL, EINVAL, /* 10..14 */ + EINVAL, ENOEXEC, EINVAL, EINVAL, EINVAL, /* 10..14 */ ENOENT, EBUSY, EXDEV, ENOENT, EROFS, /* 15..19 */ EIO, EIO, EIO, EIO, EIO, /* 20..24 */ EIO, EIO, EIO, ENOSPC, EIO, /* 25..29 */ @@ -56,11 +56,11 @@ static unsigned char const errno_tab[] = EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 175..179 */ EINVAL, EINVAL, EINVAL, EINVAL, ECHILD, /* 180..184 */ EINVAL, EINVAL, ENOENT, EINVAL, EINVAL, /* 185..189 */ - ENOEXEC,ENOEXEC,ENOEXEC,ENOEXEC,ENOEXEC, /* 190..194 */ - ENOEXEC,ENOEXEC,ENOEXEC,ENOEXEC,ENOEXEC, /* 195..199 */ - ENOEXEC,ENOEXEC,ENOEXEC,ENOENT, EINVAL, /* 200..204 */ + ENOEXEC, ENOEXEC, ENOEXEC, ENOEXEC, ENOEXEC, /* 190..194 */ + ENOEXEC, ENOEXEC, ENOEXEC, ENOEXEC, ENOEXEC, /* 195..199 */ + ENOEXEC, ENOEXEC, ENOEXEC, ENOENT, EINVAL, /* 200..204 */ EINVAL, ENAMETOOLONG, EINVAL, EINVAL, EINVAL, /* 205..209 */ - EINVAL, EINVAL, EACCES, ENOEXEC,ENOEXEC, /* 210..214 */ + EINVAL, EINVAL, EACCES, ENOEXEC, ENOEXEC, /* 210..214 */ EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 215..219 */ EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 220..224 */ EINVAL, EINVAL, EINVAL, ECHILD, EINVAL, /* 225..229 */ diff --git a/src/paragraph.C b/src/paragraph.C index d0080cd528..d14348bb3d 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -15,6 +15,7 @@ #endif #include "lyxparagraph.h" +#include "support/textutils.h" #include "lyxrc.h" #include "layout.h" #include "tex-strings.h" @@ -27,10 +28,6 @@ #include "lyx_gui_misc.h" #include "texrow.h" -#ifndef NEW_TEXT -#define INITIAL_SIZE_PAR 10 /*Number of bytes in one paragraph*/ -#define STEP_SIZE_PAR 10 /*Number of bytes added when reallocated*/ -#endif extern void addNewlineAndDepth(string & file, int const depth); // Jug 990923 extern unsigned char GetCurrentTextClass(); // this should be fixed/removed @@ -57,11 +54,8 @@ unsigned int LyXParagraph::paragraph_id = 0; LyXParagraph::LyXParagraph() { -#ifndef NEW_TEXT - size = INITIAL_SIZE_PAR; - text = new char[size]; - last = 0; -#endif + text.reserve(500); // is this number too big? + for (int i = 0; i < 10; ++i) setCounter(i , 0); appendix = false; enumdepth = 0; @@ -88,11 +82,8 @@ LyXParagraph::LyXParagraph() /* this konstruktor inserts the new paragraph in a list */ LyXParagraph::LyXParagraph(LyXParagraph * par) { -#ifndef NEW_TEXT - size = INITIAL_SIZE_PAR; - text = new char[size]; - last = 0; -#endif +#warning we also need a reserve here +#warning this would be a nice place to shrink par for (int i = 0; i < 10; ++i) setCounter(i, 0); appendix = false; enumdepth = 0; @@ -119,26 +110,6 @@ LyXParagraph::LyXParagraph(LyXParagraph * par) Clear(); } -/// Used by the spellchecker -#ifdef NEW_TEXT -bool LyXParagraph::IsLetter(LyXParagraph::size_type pos) { -#else -bool LyXParagraph::IsLetter(int pos) { -#endif - unsigned char c = GetChar(pos); - if (IsLetterChar(c)) - return true; - // '\0' is not a letter, allthough every string contains "" (below) - if( c == '\0') - return false; - // We want to pass the ' and escape chars to ispell - string extra = lyxrc->isp_esc_chars + '\''; - char ch[2]; - ch[0] = c; - ch[1] = 0; - return contains(extra, ch); -} - void LyXParagraph::writeFile(FILE * file, BufferParams & params, char footflag, char dth) @@ -183,7 +154,7 @@ void LyXParagraph::writeFile(FILE * file, BufferParams & params, /* First write the layout */ fprintf(file, "\n\\layout %s\n", - textclasslist.NameOfLayout(params.textclass,layout) + textclasslist.NameOfLayout(params.textclass, layout) .c_str()); /* maybe some vertical spaces */ @@ -250,7 +221,7 @@ void LyXParagraph::writeFile(FILE * file, BufferParams & params, fprintf(file, " \\pextra_widthp %s", pextra_widthp.c_str()); } - fprintf(file,"\n"); + fprintf(file, "\n"); } } else { @@ -272,19 +243,11 @@ void LyXParagraph::writeFile(FILE * file, BufferParams & params, font1 = LyXFont(LyXFont::ALL_INHERIT); column = 0; -#ifdef NEW_TEXT for (size_type i = 0; i < size(); i++) { if (!i){ fprintf(file, "\n"); column = 0; } -#else - for (int i = 0; i < last; i++) { - if (!i){ - fprintf(file, "\n"); - column = 0; - } -#endif // Write font changes font2 = GetFontSettings(i); @@ -296,7 +259,7 @@ void LyXParagraph::writeFile(FILE * file, BufferParams & params, c = GetChar(i); switch (c) { - case LYX_META_INSET: + case META_INSET: inset = GetInset(i); if (inset) if (inset->DirectWrite()) { @@ -312,15 +275,15 @@ void LyXParagraph::writeFile(FILE * file, BufferParams & params, column = 0; } break; - case LYX_META_NEWLINE: + case META_NEWLINE: fprintf(file, "\n\\newline \n"); column = 0; break; - case LYX_META_HFILL: + case META_HFILL: fprintf(file, "\n\\hfill \n"); column = 0; break; - case LYX_META_PROTECTED_SEPARATOR: + case META_PROTECTED_SEPARATOR: fprintf(file, "\n\\protected_separator \n"); column = 0; break; @@ -329,22 +292,14 @@ void LyXParagraph::writeFile(FILE * file, BufferParams & params, column = 0; break; case '.': -#ifdef NEW_TEXT if (i + 1 < size() && GetChar(i + 1) == ' ') { fprintf(file, ".\n"); column = 0; } else fprintf(file, "."); -#else - if (i + 1 < last && GetChar(i + 1) == ' ') { - fprintf(file, ".\n"); - column = 0; - } else - fprintf(file, "."); -#endif break; default: - if ((column > 70 && c==' ') + if ((column > 70 && c == ' ') || column > 79){ fprintf(file, "\n"); column = 0; @@ -454,8 +409,8 @@ void LyXParagraph::validate(LaTeXFeatures & features) if (layout.needprotect && next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE) features.NeedLyXFootnoteCode = true; - if ((current_view->buffer()->params.paragraph_separation == LYX_PARSEP_INDENT) && - (pextra_type == PEXTRA_MINIPAGE)) + if ((current_view->buffer()->params.paragraph_separation == BufferParams::PARSEP_INDENT) && + (pextra_type == LyXParagraph::PEXTRA_MINIPAGE)) features.NeedLyXMinipageIndent = true; if (table && table->NeedRotating()) features.rotating = true; @@ -465,16 +420,12 @@ void LyXParagraph::validate(LaTeXFeatures & features) /* first few functions needed for cut and paste and paragraph breaking */ -#ifdef NEW_TEXT void LyXParagraph::CopyIntoMinibuffer(LyXParagraph::size_type pos) -#else -void LyXParagraph::CopyIntoMinibuffer(int pos) -#endif { minibuffer_char = GetChar(pos); minibuffer_font = GetFontSettings(pos); minibuffer_inset = 0; - if (minibuffer_char == LYX_META_INSET) { + if (minibuffer_char == LyXParagraph::META_INSET) { if (GetInset(pos)) { minibuffer_inset = GetInset(pos)->Clone(); } else { @@ -485,16 +436,12 @@ void LyXParagraph::CopyIntoMinibuffer(int pos) } } -#ifdef NEW_TEXT void LyXParagraph::CutIntoMinibuffer(LyXParagraph::size_type pos) -#else -void LyXParagraph::CutIntoMinibuffer(int pos) -#endif { minibuffer_char = GetChar(pos); minibuffer_font = GetFontSettings(pos); minibuffer_inset = 0; - if (minibuffer_char == LYX_META_INSET) { + if (minibuffer_char == LyXParagraph::META_INSET) { if (GetInset(pos)) { minibuffer_inset = GetInset(pos); // This is a little hack since I want exactly @@ -512,7 +459,7 @@ void LyXParagraph::CutIntoMinibuffer(int pos) /* find the entry */ InsetTable * tmpi = insettable; while (tmpi && tmpi->pos != pos) { - tmpi=tmpi->next; + tmpi= tmpi->next; } if (tmpi) { /* This should always be true */ tmpi->inset = 0; @@ -530,15 +477,11 @@ void LyXParagraph::CutIntoMinibuffer(int pos) } -#ifdef NEW_TEXT void LyXParagraph::InsertFromMinibuffer(LyXParagraph::size_type pos) -#else -void LyXParagraph::InsertFromMinibuffer(int pos) -#endif { InsertChar(pos, minibuffer_char); SetFont(pos, minibuffer_font); - if (minibuffer_char == LYX_META_INSET) + if (minibuffer_char == LyXParagraph::META_INSET) InsertInset(pos, minibuffer_inset); } @@ -585,11 +528,6 @@ LyXParagraph::~LyXParagraph() if (next) next->previous = previous; -#ifndef NEW_TEXT - if (text) - delete[] text; -#endif - #ifndef NEW_TABLE InsetTable * tmpinset; while (insettable) { @@ -629,15 +567,10 @@ LyXParagraph::~LyXParagraph() } -#ifdef NEW_TEXT void LyXParagraph::Erase(LyXParagraph::size_type pos) -#else -void LyXParagraph::Erase(int pos) -#endif { /* > because last is the next unused position, and you can * use it if you want */ -#ifdef NEW_TEXT if (pos > size()) { if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) NextAfterFootnote()->Erase(pos - text.size() - 1); @@ -646,24 +579,10 @@ void LyXParagraph::Erase(int pos) "position does not exist." << endl; return; } -#else - if (pos > last) { - if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) - NextAfterFootnote()->Erase(pos - last - 1); - else - lyxerr.debug() << "ERROR (LyXParagraph::Erase): " - "position does not exist." << endl; - return; - } -#endif -#ifdef NEW_TEXT if (pos < size()) { // last is free for insertation, but should be empty -#else - if (pos < last) { // last is free for insertation, but should be empty -#endif #ifdef NEW_TABLE /* if it is an inset, delete the inset entry */ - if (text[pos] == LYX_META_INSET) { + if (text[pos] == LyXParagraph::META_INSET) { /* find the entry */ for(InsetList::iterator it = insetlist.begin(); it != insetlist.end(); ++it) { @@ -676,13 +595,13 @@ void LyXParagraph::Erase(int pos) } #else /* if it is an inset, delete the inset entry */ - if (text[pos] == LYX_META_INSET) { + if (text[pos] == LyXParagraph::META_INSET) { /* find the entry */ InsetTable *tmpi = insettable; InsetTable *tmpi2 = tmpi; while (tmpi && tmpi->pos != pos) { - tmpi2=tmpi; - tmpi=tmpi->next; + tmpi2= tmpi; + tmpi= tmpi->next; } if (tmpi) { // this should always be true if (tmpi->inset) // delete the inset if it exists @@ -695,16 +614,7 @@ void LyXParagraph::Erase(int pos) } } #endif -#ifdef NEW_TEXT text.erase(text.begin() + pos); - //text.erase(pos, 1); -#else - // Shift rest of text - for (int i = pos; i < last - 1; i++) { - text[i]=text[i+1]; - } - last--; -#endif #ifdef NEW_TABLE /* erase entries in the tables */ for(FontList::iterator it = fontlist.begin(); @@ -774,7 +684,7 @@ void LyXParagraph::Erase(int pos) while (tmpi) { if (tmpi->pos > pos) tmpi->pos--; - tmpi=tmpi->next; + tmpi= tmpi->next; } #endif } else { @@ -784,57 +694,8 @@ void LyXParagraph::Erase(int pos) } -#ifndef NEW_TEXT -/* pos is needed to specify the paragraph correctly. Remember the -* closed footnotes */ -void LyXParagraph::Enlarge(int pos, int number) -{ - /* > because last is the next unused position, and you can - * use it if you want */ - if (pos > last) { - if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) - NextAfterFootnote()->Enlarge(pos - last - 1, number); - else - lyxerr << "ERROR (LyXParagraph::Enlarge): " - "position does not exist." << endl; - return; - } - - if (size - last < number) { - size += number - size + last + STEP_SIZE_PAR; - char * tmp = new char[size]; - for (int i = 0; i < last; ++i) - tmp[i] = text[i]; - delete[] text; - text = tmp; - } -} -#endif - - -#ifndef NEW_TEXT -/* make the allocated memory fit to the needed size */ -/* used to make a paragraph smaller */ -void LyXParagraph::FitSize() -{ - if (size - last > STEP_SIZE_PAR) { - size = last + STEP_SIZE_PAR; - char * tmp = new char[size]; - for (int i = 0; i < last; ++i) - tmp[i] = text[i]; - delete[] text; - text = tmp; - } -} -#endif - -#ifdef NEW_TEXT void LyXParagraph::InsertChar(LyXParagraph::size_type pos, char c) -#else -void LyXParagraph::InsertChar(int pos, char c) -#endif { -#ifdef NEW_TEXT /* > because last is the next unused position, and you can * use it if you want */ if (pos > size()) { @@ -848,37 +709,6 @@ void LyXParagraph::InsertChar(int pos, char c) return; } text.insert(text.begin() + pos, c); - //text.insert(pos, c); -#else - /* > because last is the next unused position, and you can - * use it if you want */ - if (pos > last) { - if (next - && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) - NextAfterFootnote()->InsertChar(pos - last - 1, c); - else - lyxerr.debug() << "ERROR (LyXParagraph::InsertChar): " - "position does not exist." << endl; - return; - } - // Are we full? If so, enlarge. - if (last == size) { - size += STEP_SIZE_PAR; - char * tmp = new char[size]; - for (int i = 0; i < last; i++) - tmp[i] = text[i]; - delete[] text; - text = tmp; - } - - // Shift rest of character - for (int i = last; i>pos; i--) { - text[i] = text[i - 1]; - } - - text[pos] = c; - last++; -#endif #ifdef NEW_TABLE // update the font table for(FontList::iterator it = fontlist.begin(); @@ -910,21 +740,17 @@ void LyXParagraph::InsertChar(int pos, char c) while (tmpi) { if (tmpi->pos >= pos) tmpi->pos++; - tmpi=tmpi->next; + tmpi= tmpi->next; } #endif } -#ifdef NEW_TEXT + void LyXParagraph::InsertInset(LyXParagraph::size_type pos, Inset * inset) -#else -void LyXParagraph::InsertInset(int pos, Inset * inset) -#endif { /* > because last is the next unused position, and you can * use it if you want */ -#ifdef NEW_TEXT if (pos > size()) { if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) @@ -935,21 +761,9 @@ void LyXParagraph::InsertInset(int pos, Inset * inset) "position does not exist: " << pos << endl; return; } -#else - if (pos > last) { - if (next - && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) - NextAfterFootnote() - ->InsertInset(pos - last - 1, inset); - else - lyxerr << "ERROR (LyXParagraph::InsertInset): " - "position does not exist: " << pos << endl; - return; - } -#endif - if (text[pos] != LYX_META_INSET) { + if (text[pos] != LyXParagraph::META_INSET) { lyxerr << "ERROR (LyXParagraph::InsertInset): " - "there is no LYX_META_INSET" << endl; + "there is no LyXParagraph::META_INSET" << endl; return; } @@ -973,13 +787,9 @@ void LyXParagraph::InsertInset(int pos, Inset * inset) #endif } -#ifdef NEW_TEXT + Inset * LyXParagraph::GetInset(LyXParagraph::size_type pos) -#else -Inset * LyXParagraph::GetInset(int pos) -#endif { -#ifdef NEW_TEXT if (pos >= size()) { if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) @@ -992,19 +802,6 @@ Inset * LyXParagraph::GetInset(int pos) } return 0; } -#else - if (pos >= last) { - if (next - && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) - return NextAfterFootnote()->GetInset(pos - last - 1); - else { - lyxerr << "ERROR (LyXParagraph::GetInset): " - "position does not exist: " - << pos << endl; - } - return 0; - } -#endif #ifdef NEW_TABLE /* find the inset */ for(InsetList::iterator it = insetlist.begin(); @@ -1046,13 +843,8 @@ Inset * LyXParagraph::GetInset(int pos) // Gets uninstantiated font setting at position. // Optimized after profiling. (Asger) -#ifdef NEW_TEXT LyXFont LyXParagraph::GetFontSettings(LyXParagraph::size_type pos) -#else -LyXFont LyXParagraph::GetFontSettings(int pos) -#endif { -#ifdef NEW_TEXT if (pos < size()) { #ifdef NEW_TABLE for(FontList::iterator it = fontlist.begin(); @@ -1090,43 +882,6 @@ LyXFont LyXParagraph::GetFontSettings(int pos) } else if (pos) { return GetFontSettings(pos - 1); } -#else - if (pos < last) { -#ifdef NEW_TABLE - for(FontList::iterator it = fontlist.begin(); - it != fontlist.end(); ++it) { - if (pos >= (*it).pos && pos <= (*it).pos_end) - return (*it).font; - } -#else - FontTable * tmp = fonttable; - while (tmp) { - if (pos >= tmp->pos && pos <= tmp->pos_end) - return tmp->font; - tmp = tmp->next; - } -#endif - } - /* > because last is the next unused position, and you can - * use it if you want */ - else if (pos > last) { - if (next - && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) - return NextAfterFootnote() - ->GetFontSettings(pos - last - 1); - else { - // Why is it an error to ask for the font of a - // position that does not exist? Would it be - // enough for this to be anable on debug? - // We want strict error checking, but it's ok to only - // have it when debugging. (Asger) - lyxerr << "ERROR (LyXParagraph::GetFontSettings): " - "position does not exist. " << pos << endl; - } - } else if (pos) { - return GetFontSettings(pos - 1); - } -#endif return LyXFont(LyXFont::ALL_INHERIT); } @@ -1138,20 +893,12 @@ LyXFont LyXParagraph::GetFontSettings(int pos) // the true picture of the buffer. (Asger) // If position is -1, we get the layout font of the paragraph. // If position is -2, we get the font of the manual label of the paragraph. -#ifdef NEW_TEXT LyXFont LyXParagraph::getFont(LyXParagraph::size_type pos) -#else -LyXFont LyXParagraph::getFont(int pos) -#endif { LyXFont tmpfont; LyXLayout const & layout = textclasslist.Style(GetCurrentTextClass(), GetLayout()); -#ifdef NEW_TEXT LyXParagraph::size_type main_body = 0; -#else - int main_body = 0; -#endif if (layout.labeltype == LABEL_MANUAL) main_body = BeginningOfMainBody(); @@ -1190,11 +937,7 @@ LyXFont LyXParagraph::getFont(int pos) /// Returns the height of the highest font in range -#ifdef NEW_TEXT LyXFont::FONT_SIZE LyXParagraph::HighestFontInRange(LyXParagraph::size_type startpos, LyXParagraph::size_type endpos) const -#else -LyXFont::FONT_SIZE LyXParagraph::HighestFontInRange(int startpos, int endpos) const -#endif { LyXFont::FONT_SIZE maxsize = LyXFont::SIZE_TINY; #ifdef NEW_TABLE @@ -1211,7 +954,7 @@ LyXFont::FONT_SIZE LyXParagraph::HighestFontInRange(int startpos, int endpos) co while (tmp) { if (startpos <= tmp->pos_end && endpos >= tmp->pos) { LyXFont::FONT_SIZE size = tmp->font.size(); - if (size > maxsize && size<=LyXFont::SIZE_HUGER) + if (size > maxsize && size<= LyXFont::SIZE_HUGER) maxsize = size; } tmp = tmp->next; @@ -1221,11 +964,7 @@ LyXFont::FONT_SIZE LyXParagraph::HighestFontInRange(int startpos, int endpos) co } -#ifdef NEW_TEXT char LyXParagraph::GetChar(LyXParagraph::size_type pos) -#else -char LyXParagraph::GetChar(int pos) -#endif { #ifdef DEVEL_VERSION /* a workaround to 'fix' some bugs in text-class */ @@ -1238,7 +977,6 @@ char LyXParagraph::GetChar(int pos) } #endif -#ifdef NEW_TEXT if (pos < size()) { return text[pos]; } @@ -1255,20 +993,63 @@ char LyXParagraph::GetChar(int pos) << ")\n"; } return '\0'; -#else - if (pos < last) { + } else { + /* we should have a footnote environment */ + if (!next || next->footnoteflag == LyXParagraph::NO_FOOTNOTE) { + // Notice that LyX does request the + // last char from time to time. (Asger) + //lyxerr << "ERROR (LyXParagraph::GetChar): " + // "expected footnote." << endl; + return '\0'; + } + switch (next->footnotekind) { + case LyXParagraph::FOOTNOTE: + return LyXParagraph::META_FOOTNOTE; + case LyXParagraph::MARGIN: + return LyXParagraph::META_MARGIN; + case LyXParagraph::FIG: + case LyXParagraph::WIDE_FIG: + return LyXParagraph::META_FIG; + case LyXParagraph::TAB: + case LyXParagraph::WIDE_TAB: + return LyXParagraph::META_TAB; + case LyXParagraph::ALGORITHM: + return LyXParagraph::META_ALGORITHM; + } + return '\0'; // to shut up gcc + } +} + + +char LyXParagraph::GetChar(LyXParagraph::size_type pos) const +{ +#ifdef DEVEL_VERSION + /* a workaround to 'fix' some bugs in text-class */ + if (pos < 0) { + // This function is important. It should not work around bugs. + // Let's find the bugs instead and fix them. (Asger) + lyxerr << "FATAL ERROR (LyXParagraph::GetChar):" + " bad position " << pos << endl; + abort(); + } +#endif + + if (pos < size()) { return text[pos]; } /* > because last is the next unused position, and you can * use it if you want */ - else if (pos > last) { + else if (pos > size()) { if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE) - return NextAfterFootnote()->GetChar(pos - last - 1); - else + return NextAfterFootnote() + ->GetChar(pos - text.size() - 1); + else { lyxerr << "ERROR (LyXParagraph::GetChar): " - "position does not exist." << pos << endl; + "position does not exist." + << pos << " (" << static_cast(pos) + << ")\n"; + } return '\0'; -#endif } else { /* we should have a footnote environment */ if (!next || next->footnoteflag == LyXParagraph::NO_FOOTNOTE) { @@ -1280,29 +1061,24 @@ char LyXParagraph::GetChar(int pos) } switch (next->footnotekind) { case LyXParagraph::FOOTNOTE: - return LYX_META_FOOTNOTE; + return LyXParagraph::META_FOOTNOTE; case LyXParagraph::MARGIN: - return LYX_META_MARGIN; + return LyXParagraph::META_MARGIN; case LyXParagraph::FIG: case LyXParagraph::WIDE_FIG: - return LYX_META_FIG; + return LyXParagraph::META_FIG; case LyXParagraph::TAB: case LyXParagraph::WIDE_TAB: - return LYX_META_TAB; + return LyXParagraph::META_TAB; case LyXParagraph::ALGORITHM: - return LYX_META_ALGORITHM; + return LyXParagraph::META_ALGORITHM; } return '\0'; // to shut up gcc } } -#ifdef NEW_TEXT string LyXParagraph::GetWord(LyXParagraph::size_type & lastpos) -#else -string LyXParagraph::GetWord(int & lastpos) -#endif - //Added 98/9/21 by REH // return an string of the current word, and the end of the word // in lastpos. @@ -1333,7 +1109,7 @@ string LyXParagraph::GetWord(int & lastpos) //i think the devcode aborts before this, but why not be // versatile? - if (lastpos < 0) lastpos=0; + if (lastpos < 0) lastpos= 0; // move back until we have a letter @@ -1345,17 +1121,17 @@ string LyXParagraph::GetWord(int & lastpos) //since someone might have typed a punctuation first int firstpos = lastpos; - while ((firstpos >=0) && !IsLetter(firstpos)) + while ((firstpos >= 0) && !IsLetter(firstpos)) firstpos--; // now find the beginning by looking for a nonletter - while ((firstpos>=0) && IsLetter(firstpos)) + while ((firstpos>= 0) && IsLetter(firstpos)) firstpos--; // the above is now pointing to the preceeding non-letter firstpos++; - lastpos=firstpos; + lastpos= firstpos; // so copy characters into theword until we get a nonletter // note that this can easily exceed lastpos, wich means @@ -1369,37 +1145,19 @@ string LyXParagraph::GetWord(int & lastpos) } -#ifdef NEW_TEXT LyXParagraph::size_type LyXParagraph::Last() -#else -int LyXParagraph::Last() -#endif { -#ifdef NEW_TEXT if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) return text.size() + NextAfterFootnote()->Last() + 1; /* the 1 is the symbol for the footnote */ else return text.size(); -#else - if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) - return last + NextAfterFootnote()->Last() + 1; - /* the 1 is the symbol - for the footnote */ - else - return last; -#endif } -#ifdef NEW_TEXT LyXParagraph * LyXParagraph::ParFromPos(LyXParagraph::size_type pos) -#else -LyXParagraph * LyXParagraph::ParFromPos(int pos) -#endif { -#ifdef NEW_TEXT /* > because last is the next unused position, and you can * use it if you want */ if (pos > size()) { @@ -1412,33 +1170,15 @@ LyXParagraph * LyXParagraph::ParFromPos(int pos) "position does not exist." << endl; return this; } -#else - /* > because last is the next unused position, and you can - * use it if you want */ - if (pos > last) { - if (next - && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) - return NextAfterFootnote()->ParFromPos(pos - last - 1); - else - lyxerr << "ERROR (LyXParagraph::ParFromPos): " - "position does not exist." << endl; - return this; - } -#endif else return this; } -#ifdef NEW_TEXT int LyXParagraph::PositionInParFromPos(LyXParagraph::size_type pos) -#else -int LyXParagraph::PositionInParFromPos(int pos) -#endif { /* > because last is the next unused position, and you can * use it if you want */ -#ifdef NEW_TEXT if (pos > size()) { if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) @@ -1450,34 +1190,16 @@ int LyXParagraph::PositionInParFromPos(int pos) "position does not exist." << endl; return pos; } -#else - if (pos > last) { - if (next - && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) - return NextAfterFootnote() - ->PositionInParFromPos(pos - last - 1); - else - lyxerr << - "ERROR (LyXParagraph::PositionInParFromPos): " - "position does not exist." << endl; - return pos; - } -#endif else return pos; } -#ifdef NEW_TEXT void LyXParagraph::SetFont(LyXParagraph::size_type pos, LyXFont const & font) -#else -void LyXParagraph::SetFont(int pos, LyXFont const & font) -#endif { /* > because last is the next unused position, and you can * use it if you want */ -#ifdef NEW_TEXT if (pos > size()) { if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) { NextAfterFootnote()->SetFont(pos - text.size() - 1, @@ -1488,17 +1210,6 @@ void LyXParagraph::SetFont(int pos, LyXFont const & font) } return; } -#else - if (pos > last) { - if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) { - NextAfterFootnote()->SetFont(pos - last - 1, font); - } else { - lyxerr << "ERROR (LyXParagraph::SetFont): " - "position does not exist." << endl; - } - return; - } -#endif LyXFont patternfont(LyXFont::ALL_INHERIT); // First, reduce font against layout/label font @@ -1748,6 +1459,23 @@ LyXParagraph * LyXParagraph::NextAfterFootnote() } +LyXParagraph * LyXParagraph::NextAfterFootnote() const +{ + if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE) { + LyXParagraph * tmp = next; + while (tmp && tmp->footnoteflag != LyXParagraph::NO_FOOTNOTE) + tmp = tmp->next; + if (tmp && tmp->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE) + return tmp; /* there can be more than one footnote + in a logical paragraph */ + else + return next; /* this should never happen! */ + } + else + return next; +} + + LyXParagraph * LyXParagraph::PreviousBeforeFootnote() { LyXParagraph * tmp; @@ -1772,7 +1500,8 @@ LyXParagraph * LyXParagraph::LastPhysicalPar() return this; LyXParagraph * tmp = this; - while (tmp->next && tmp->next->footnoteflag != LyXParagraph::NO_FOOTNOTE) + while (tmp->next + && tmp->next->footnoteflag != LyXParagraph::NO_FOOTNOTE) tmp = tmp->NextAfterFootnote(); return tmp; @@ -1820,18 +1549,11 @@ LyXParagraph * LyXParagraph::Previous() return previous; } -#ifdef NEW_TEXT + void LyXParagraph::BreakParagraph(LyXParagraph::size_type pos, int flag) -#else -void LyXParagraph::BreakParagraph(int pos, int flag) -#endif { -#ifdef NEW_TEXT size_type i, pos_end, pos_first; -#else - int i, pos_end, pos_first; -#endif /* create a new paragraph */ LyXParagraph * par = ParFromPos(pos); LyXParagraph * firstpar = FirstPhysicalPar(); @@ -1872,18 +1594,9 @@ void LyXParagraph::BreakParagraph(int pos, int flag) while (ParFromPos(pos_first) != par) pos_first++; -#ifdef NEW_TEXT pos_end = pos_first + par->text.size() - 1; tmp->text.reserve(pos_end - pos); -#else - pos_end = pos_first + par->last - 1; - /* make sure there is enough memory for the now larger - paragraph. This is not neccessary, because - InsertFromMinibuffer will enlarge the memory (it uses - InsertChar of course). But doing it by hand - is MUCH faster! (only one time, not thousend times!!) */ - tmp->Enlarge(0, pos_end - pos); -#endif + for (i = pos; i <= pos_end; i++) { par->CutIntoMinibuffer(i - pos_first); tmp->InsertFromMinibuffer(i - pos); @@ -1891,12 +1604,8 @@ void LyXParagraph::BreakParagraph(int pos, int flag) for (i = pos_end; i >= pos; i--) par->Erase(i - pos_first); -#ifdef NEW_TEXT + par->text.resize(par->text.size()); -#else - /* free memory of the now shorter paragraph*/ - par->FitSize(); -#endif } /* just an idea of me */ @@ -1951,7 +1660,7 @@ LyXParagraph * LyXParagraph::FirstSelfrowPar() LyXParagraph * tmppar = this; while (tmppar && ( (tmppar->IsDummy() - && tmppar->previous->footnoteflag == + && tmppar->previous->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) || tmppar->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)) tmppar = tmppar->previous; @@ -1987,23 +1696,11 @@ LyXParagraph * LyXParagraph::Clone() /* copy everything behind the break-position to the new paragraph */ -#ifdef NEW_TEXT result->text.reserve(size()); for (size_type i = 0; i < size(); i++) { CopyIntoMinibuffer(i); result->InsertFromMinibuffer(i); } -#else - /* make shure there is enough memory for the now larger paragraph. - * This is not neccessary, because InsertFromMinibuffer will enlarge - * the memory (it uses InsertChar of course). But doing it by hand - * is MUCH faster! (only one time, not thousend times!!) */ - result->Enlarge(0, last+2); - for (int i = 0; i < last; i++) { - CopyIntoMinibuffer(i); - result->InsertFromMinibuffer(i); - } -#endif return result; } @@ -2041,17 +1738,10 @@ bool LyXParagraph::HasSameLayout(LyXParagraph * par) par->depth == depth); } -#ifdef NEW_TEXT + void LyXParagraph::BreakParagraphConservative(LyXParagraph::size_type pos) -#else -void LyXParagraph::BreakParagraphConservative(int pos) -#endif { -#ifdef NEW_TEXT size_type i, pos_end, pos_first; -#else - int i, pos_end, pos_first; -#endif /* create a new paragraph */ LyXParagraph * par = ParFromPos(pos); @@ -2066,21 +1756,14 @@ void LyXParagraph::BreakParagraphConservative(int pos) pos_first = 0; while (ParFromPos(pos_first) != par) pos_first++; -#ifdef NEW_TEXT pos_end = pos_first + par->text.size() - 1; -#else - pos_end = pos_first + par->last - 1; -#endif /* make shure there is enough memory for the now larger paragraph. This is not neccessary, because InsertFromMinibuffer will enlarge the memory (it uses InsertChar of course). But doing it by hand is MUCH faster! (only one time, not thousend times!!) */ -#ifdef NEW_TEXT tmp->text.reserve(pos_end - pos); -#else - tmp->Enlarge(0, pos_end - pos); -#endif + for (i = pos; i <= pos_end; i++) { par->CutIntoMinibuffer(i - pos_first); @@ -2088,12 +1771,8 @@ void LyXParagraph::BreakParagraphConservative(int pos) } for (i = pos_end; i >= pos; i--) par->Erase(i - pos_first); -#ifdef NEW_TEXT + par->text.resize(par->text.size()); -#else - /* free memory of the now shorter paragraph*/ - par->FitSize(); -#endif } } @@ -2111,19 +1790,9 @@ void LyXParagraph::PasteParagraph() firstpar->added_space_bottom = the_next->added_space_bottom; firstpar->pagebreak_bottom = the_next->pagebreak_bottom; -#ifdef NEW_TEXT size_type pos_end = the_next->text.size() - 1; size_type pos_insert = Last(); size_type i; -#else - int pos_end = the_next->last - 1; - int pos_insert = Last(); - /* enlarge the paragraph. This is faster than enlarge it - * every 10th insertion. */ - if (pos_end >= 0) - Enlarge(pos_insert, pos_end); - int i; -#endif /* ok, now copy the paragraph */ for (i = 0; i <= pos_end; i++) { @@ -2135,11 +1804,8 @@ void LyXParagraph::PasteParagraph() delete the_next; } -#ifdef NEW_TEXT + void LyXParagraph::OpenFootnote(LyXParagraph::size_type pos) -#else -void LyXParagraph::OpenFootnote(int pos) -#endif { LyXParagraph * par = ParFromPos(pos); par = par->next; @@ -2149,11 +1815,8 @@ void LyXParagraph::OpenFootnote(int pos) } } -#ifdef NEW_TEXT + void LyXParagraph::CloseFootnote(LyXParagraph::size_type pos) -#else -void LyXParagraph::CloseFootnote(int pos) -#endif { LyXParagraph * par = ParFromPos(pos); par = par->next; @@ -2243,7 +1906,7 @@ void LyXParagraph::SetOnlyLayout(LyXTextClass::LayoutList::size_type new_layout) p1 = ppar->pextra_width, p2 = ppar->pextra_widthp; ppar->SetPExtraType(ppar->pextra_type, - p1.c_str(),p2.c_str()); + p1.c_str(), p2.c_str()); } if ((par->pextra_type == PEXTRA_NONE) && npar && (npar->pextra_type != PEXTRA_NONE)) { @@ -2251,7 +1914,7 @@ void LyXParagraph::SetOnlyLayout(LyXTextClass::LayoutList::size_type new_layout) p1 = npar->pextra_width, p2 = npar->pextra_widthp; npar->SetPExtraType(npar->pextra_type, - p1.c_str(),p2.c_str()); + p1.c_str(), p2.c_str()); } } } @@ -2293,7 +1956,7 @@ void LyXParagraph::SetLayout(LyXTextClass::LayoutList::size_type new_layout) p1 = ppar->pextra_width, p2 = ppar->pextra_widthp; ppar->SetPExtraType(ppar->pextra_type, - p1.c_str(),p2.c_str()); + p1.c_str(), p2.c_str()); } if ((par->pextra_type == PEXTRA_NONE) && npar && (npar->pextra_type != PEXTRA_NONE)) { @@ -2301,7 +1964,7 @@ void LyXParagraph::SetLayout(LyXTextClass::LayoutList::size_type new_layout) p1 = npar->pextra_width, p2 = npar->pextra_widthp; npar->SetPExtraType(npar->pextra_type, - p1.c_str(),p2.c_str()); + p1.c_str(), p2.c_str()); } } } @@ -2319,22 +1982,21 @@ int LyXParagraph::BeginningOfMainBody() if (FirstPhysicalPar() != this) return -1; - -// Unroll the first two cycles of the loop -// and remember the previous character to remove unnecessary GetChar() calls -#ifdef NEW_TEXT + // Unroll the first two cycles of the loop + // and remember the previous character to + // remove unnecessary GetChar() calls size_type i = 0; if (i < size() - && GetChar(i) != LYX_META_NEWLINE) { + && GetChar(i) != LyXParagraph::META_NEWLINE) { ++i; char previous_char, temp; if (i < size() - && (previous_char = GetChar(i)) != LYX_META_NEWLINE) { - // Yes, this ^ is supposed to be "=" not "==" + && (previous_char = GetChar(i)) != LyXParagraph::META_NEWLINE) { + // Yes, this ^ is supposed to be "= " not "== " ++i; while (i < size() && previous_char != ' ' - && (temp = GetChar(i)) != LYX_META_NEWLINE) { + && (temp = GetChar(i)) != LyXParagraph::META_NEWLINE) { ++i; previous_char = temp; } @@ -2342,38 +2004,11 @@ int LyXParagraph::BeginningOfMainBody() } if (i == 0 && i == size() && - !(footnoteflag==LyXParagraph::NO_FOOTNOTE + !(footnoteflag == LyXParagraph::NO_FOOTNOTE && next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE)) i++; /* the cursor should not jump * to the main body if there * is nothing in! */ -#else - int i = 0; - if (i < last - && GetChar(i) != LYX_META_NEWLINE) { - ++i; - char previous_char, temp; - if (i < last - && (previous_char = GetChar(i)) != LYX_META_NEWLINE) { - // Yes, this ^ is supposed to be "=" not "==" - ++i; - while (i < last - && previous_char != ' ' - && (temp = GetChar(i)) != LYX_META_NEWLINE) { - ++i; - previous_char = temp; - } - } - } - - if (i==0 && i == last && - !(footnoteflag==LyXParagraph::NO_FOOTNOTE - && next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE) - ) - i++; /* the cursor should not jump - * to the main body if there - * is nothing in! */ -#endif return i; } @@ -2432,11 +2067,7 @@ int LyXParagraph::AutoDeleteInsets() } -#ifdef NEW_TEXT Inset * LyXParagraph::ReturnNextInsetPointer(LyXParagraph::size_type & pos) -#else -Inset * LyXParagraph::ReturnNextInsetPointer(int & pos) -#endif { #ifdef NEW_TABLE InsetTable * tmp = 0; @@ -2460,7 +2091,7 @@ Inset * LyXParagraph::ReturnNextInsetPointer(int & pos) if (!tmpi2 || tmpi->pos < tmpi2->pos) tmpi2 = tmpi; } - tmpi=tmpi->next; + tmpi= tmpi->next; } if (tmpi2){ pos = tmpi2->pos; @@ -2486,13 +2117,8 @@ int LyXParagraph::GetPositionOfInset(Inset * inset) if (footnoteflag == LyXParagraph::NO_FOOTNOTE && next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) { int further = NextAfterFootnote()->GetPositionOfInset(inset); -#ifdef NEW_TEXT if (further != -1) return size() + 1 + further; -#else - if (further != -1) - return last + 1 + further; -#endif } return -1; #else @@ -2507,15 +2133,10 @@ int LyXParagraph::GetPositionOfInset(Inset * inset) /* think about footnotes */ if (footnoteflag == LyXParagraph::NO_FOOTNOTE && next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) { - int further = + int further = NextAfterFootnote()->GetPositionOfInset(inset); -#ifdef NEW_TEXT if (further != -1) return text.size() + 1 + further; -#else - if (further != -1) - return last + 1 + further; -#endif } return -1; } @@ -2525,27 +2146,13 @@ int LyXParagraph::GetPositionOfInset(Inset * inset) void LyXParagraph::readSimpleWholeFile(FILE * myfile) { - -#ifndef NEW_TEXT - FileInfo fileInfo(fileno(myfile)); - long file_size = fileInfo.getSize(); - /* it is horrible, I know, but faster. - * I should not use InsertString for that :-( */ - - /* I will write a better insertion in the future */ - Enlarge(0, file_size + 10); -#endif rewind(myfile); if (!feof(myfile)) { char c = 0; do { c = fgetc(myfile); -#ifdef NEW_TEXT InsertChar(text.size(), c); -#else - InsertChar(last,c); -#endif } while (!feof(myfile)); } @@ -2558,7 +2165,8 @@ LyXParagraph * LyXParagraph::TeXOnePar(string & file, TexRow & texrow, { lyxerr[Debug::LATEX] << "TeXOnePar... " << this << endl; LyXParagraph * par = next; - LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), layout); + LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), + layout); bool further_blank_line = false; if (IsDummy()) @@ -2722,11 +2330,7 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow) return SimpleTeXOneTablePar(file, texrow); char c; -#ifdef NEW_TEXT size_type main_body; -#else - int main_body; -#endif bool return_value = false; @@ -2749,11 +2353,7 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow) int column = 0; if (main_body >= 0 -#ifdef NEW_TEXT && !text.size() -#else - && !last -#endif && !IsDummy()) { if (style.isCommand()) { file += '{'; @@ -2772,11 +2372,7 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow) texrow.start(this, 0); -#ifdef NEW_TEXT for (size_type i = 0; i < size(); ++i) { -#else - for (int i = 0; i < last; ++i) { -#endif column++; // First char in paragraph or after label? if (i == main_body && !IsDummy()) { @@ -2810,15 +2406,15 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow) case LYX_ALIGN_SPECIAL: break; case LYX_ALIGN_LEFT: file += "\\raggedright "; - column+=13; + column+= 13; break; case LYX_ALIGN_RIGHT: file += "\\raggedleft "; - column+=12; + column+= 12; break; case LYX_ALIGN_CENTER: file += "\\centering "; - column+=11; + column+= 11; break; } } @@ -2831,22 +2427,15 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow) // Spaces at end of font change are simulated to be // outside font change, i.e. we write "\textXX{text} " // rather than "\textXX{text }". (Asger) -#ifdef NEW_TEXT if (open_font && c == ' ' && i <= size() - 2 && !getFont(i+1).equalExceptLatex(running_font) && !getFont(i+1).equalExceptLatex(font)) { font = getFont(i+1); } -#else - if (open_font && c == ' ' && i <= last-2 - && !getFont(i+1).equalExceptLatex(running_font) - && !getFont(i+1).equalExceptLatex(font)) { - font = getFont(i+1); - } -#endif // We end font definition before blanks if (!font.equalExceptLatex(running_font) && open_font) { - column += running_font.latexWriteEndChanges(file, basefont); + column += running_font.latexWriteEndChanges(file, + basefont); running_font = basefont; open_font = false; } @@ -2855,7 +2444,8 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow) if (c == ' '){ // Do not print the separation of the optional argument if (i != main_body - 1) { - SimpleTeXBlanks(file, texrow, i, column, font, style); + SimpleTeXBlanks(file, texrow, i, + column, font, style); } } @@ -2867,7 +2457,7 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow) open_font = true; } - if (c == LYX_META_NEWLINE) { + if (c == LyXParagraph::META_NEWLINE) { // newlines are handled differently here than // the default in SimpleTeXSpecialChars(). if (!style.newline_allowed @@ -2901,19 +2491,12 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow) running_font.latexWriteEndChanges(file, basefont); } -#ifdef NEW_TEXT /* needed if there is an optional argument but no contents */ if (main_body > 0 && main_body == size()) { file += "]~"; return_value = false; } -#else - /* needed if there is an optional argument but no contents */ - if (main_body > 0 && main_body == last) { - file += "]~"; - return_value = false; - } -#endif + lyxerr[Debug::LATEX] << "SimpleTeXOnePar...done " << this << endl; return return_value; } @@ -2929,7 +2512,7 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow) bool return_value = false; int current_cell_number = -1; - LyXLayout const & style = + LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), GetLayout()); LyXFont basefont = getFont(-1); // Get layout font // Which font is currently active? @@ -2958,33 +2541,29 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow) case LYX_ALIGN_SPECIAL: break; case LYX_ALIGN_LEFT: file += "\\raggedright "; - column+=13; + column+= 13; break; case LYX_ALIGN_RIGHT: file += "\\raggedleft "; - column+=12; + column+= 12; break; case LYX_ALIGN_CENTER: file += "\\centering "; - column+=11; + column+= 11; break; } } current_cell_number = -1; - tmp = table->TexEndOfCell(file,current_cell_number); + tmp = table->TexEndOfCell(file, current_cell_number); for (; tmp >0 ; --tmp) texrow.newline(); texrow.start(this, 0); -#ifdef NEW_TEXT for (size_type i = 0; i < size(); ++i) { -#else - for (int i = 0; i < last; ++i) { -#endif c = GetChar(i); if (table->IsContRow(current_cell_number+1)) { - if (c == LYX_META_NEWLINE) + if (c == LyXParagraph::META_NEWLINE) current_cell_number++; continue; } @@ -2995,18 +2574,15 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow) // Spaces at end of font change are simulated to be outside font change. // i.e. we write "\textXX{text} " rather than "\textXX{text }". (Asger) -#ifdef NEW_TEXT if (open_font && c == ' ' && i <= size() - 2 -#else - if (open_font && c == ' ' && i <= last-2 -#endif && getFont(i+1) != running_font && getFont(i+1) != font) { font = getFont(i+1); } // We end font definition before blanks if (font != running_font && open_font) { - column += running_font.latexWriteEndChanges(file, basefont); + column += running_font.latexWriteEndChanges(file, + basefont); running_font = basefont; open_font = false; } @@ -3028,7 +2604,7 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow) column += 9; } } - if (c == LYX_META_NEWLINE) { + if (c == LyXParagraph::META_NEWLINE) { // special case for inside a table // different from default case in SimpleTeXSpecialChars() if (open_font) { @@ -3039,7 +2615,9 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow) running_font = basefont; current_cell_number++; if (table->CellHasContRow(current_cell_number) >= 0) { - TeXContTableRows(file, i+1, current_cell_number, column, texrow); + TeXContTableRows(file, i+1, + current_cell_number, + column, texrow); } // if this cell follow only ContRows till end don't // put the EndOfCell because it is put after the @@ -3048,7 +2626,8 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow) current_cell_number--; break; } - int tmp = table->TexEndOfCell(file, current_cell_number); + int tmp = table->TexEndOfCell(file, + current_cell_number); if (tmp>0) { column = 0; } else if (tmp < 0) { @@ -3079,16 +2658,10 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow) // This one spits out the text off ContRows in tables -#ifdef NEW_TEXT bool LyXParagraph::TeXContTableRows(string & file, LyXParagraph::size_type i, int current_cell_number, int & column, TexRow & texrow) -#else -bool LyXParagraph::TeXContTableRows(string & file, int i, - int current_cell_number, - int & column, TexRow & texrow) -#endif { lyxerr[Debug::LATEX] << "TeXContTableRows... " << this << endl; if (!table) @@ -3097,7 +2670,8 @@ bool LyXParagraph::TeXContTableRows(string & file, int i, char c; bool return_value = false; - LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), GetLayout()); + LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), + GetLayout()); LyXFont basefont; basefont = getFont(-1); // Get layout font @@ -3106,23 +2680,15 @@ bool LyXParagraph::TeXContTableRows(string & file, int i, // Do we have an open font change? bool open_font = false; -#ifdef NEW_TEXT size_type lastpos = i; -#else - int lastpos = i; -#endif int cell = table->CellHasContRow(current_cell_number); current_cell_number++; while(cell >= 0) { // first find the right position i = lastpos; -#ifdef NEW_TEXT for (; (i < size()) && (current_cell_numberDocBookEndOfCell(file,current_cell_number, depth); + tmp = table->DocBookEndOfCell(file, current_cell_number, depth); /* parsing main loop */ -#ifdef NEW_TEXT for (size_type i = 0; i < size(); ++i) { -#else - for (int i = 0; i < last; ++i) { -#endif c = GetChar(i); if (table->IsContRow(current_cell_number+1)) { - if (c == LYX_META_NEWLINE) + if (c == LyXParagraph::META_NEWLINE) current_cell_number++; continue; } @@ -3331,17 +2883,17 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra, if (font1.emph() != font2.emph() && i) { if (font2.emph() == LyXFont::ON) { file += ""; - emph_flag=true; + emph_flag= true; } else if (emph_flag) { file += ""; - emph_flag=false; + emph_flag= false; } } - if (c == LYX_META_NEWLINE) { + if (c == LyXParagraph::META_NEWLINE) { // we have only to control for emphasis open here! if (emph_flag) { file += ""; - emph_flag=false; + emph_flag= false; } font1 = font2 = getFont(-1); current_cell_number++; @@ -3357,12 +2909,12 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra, current_cell_number--; break; } - tmp=table->DocBookEndOfCell(file, current_cell_number, + tmp= table->DocBookEndOfCell(file, current_cell_number, depth); if (tmp > 0) column = 0; - } else if (c == LYX_META_INSET) { + } else if (c == LyXParagraph::META_INSET) { inset = GetInset(i); string tmp_out; inset->DocBook(tmp_out); @@ -3370,11 +2922,11 @@ 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 - // desc_on==3 + // desc_on == 3 // 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 + // desc_on == 4 // if(desc_on != 3 || i != 0) { if(tmp_out[0] == '@') { @@ -3386,7 +2938,7 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra, file += tmp_out; } } else if (font2.latex() == LyXFont::ON) { - // "TeX"-Mode on ==> SGML-Mode on. + // "TeX"-Mode on == > SGML-Mode on. if (c != '\0') file += c; char_line_count++; @@ -3413,15 +2965,10 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra, } /* needed if there is an optional argument but no contents */ -#ifdef NEW_TEXT if (main_body > 0 && main_body == size()) { font1 = style.font; } -#else - if (main_body > 0 && main_body == last) { - font1 = style.font; - } -#endif + if (emph_flag) { file += ""; } @@ -3442,17 +2989,11 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra, << this << endl; } -#ifdef NEW_TEXT -void LyXParagraph::DocBookContTableRows(string & file, string & extra, - int & desc_on, LyXParagraph::size_type i, - int current_cell_number, int &column) -#else void LyXParagraph::DocBookContTableRows(string & file, string & extra, - int & desc_on, int i, + int & desc_on, LyXParagraph::size_type i, int current_cell_number, int &column) -#endif { if (!table) return; @@ -3460,21 +3001,17 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra, lyxerr[Debug::LATEX] << "DocBookContTableRows... " << this << endl; int cell; - LyXFont font1,font2; + LyXFont font1, font2; char c; Inset * inset; -#ifdef NEW_TEXT size_type main_body; size_type lastpos; -#else - int main_body; - int lastpos; -#endif - string emph="emphasis"; - bool emph_flag=false; - int char_line_count=0; + string emph= "emphasis"; + bool emph_flag= false; + int char_line_count= 0; - LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), GetLayout()); + LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), + GetLayout()); if (style.labeltype != LABEL_MANUAL) main_body = 0; @@ -3493,13 +3030,9 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra, while(cell >= 0) { // first find the right position i = lastpos; -#ifdef NEW_TEXT for (; i < size() && current_cell_number < cell; ++i) { -#else - for (; i < last && (current_cell_number < cell); ++i) { -#endif c = GetChar(i); - if (c == LYX_META_NEWLINE) + if (c == LyXParagraph::META_NEWLINE) current_cell_number++; } lastpos = i; @@ -3510,16 +3043,13 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra, // file += " \\\\\n"; // column = 0; // } else - if ((c != ' ') && (c != LYX_META_NEWLINE)) { + if ((c != ' ') && (c != LyXParagraph::META_NEWLINE)) { file += ' '; } -#ifdef NEW_TEXT - for (; i < size() && (c = GetChar(i)) != LYX_META_NEWLINE; - ++i) { -#else - for (; i < last && ((c = GetChar(i)) != LYX_META_NEWLINE); + + for (; i < size() + && (c = GetChar(i)) != LyXParagraph::META_NEWLINE; ++i) { -#endif ++column; // Fully instantiated font @@ -3529,13 +3059,13 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra, if (font1.emph() != font2.emph() && i) { if (font2.emph() == LyXFont::ON) { file += ""; - emph_flag=true; + emph_flag= true; } else if (emph_flag) { file += ""; - emph_flag=false; + emph_flag= false; } } - if (c == LYX_META_INSET) { + if (c == LyXParagraph::META_INSET) { inset = GetInset(i); string tmp_out; inset->DocBook(tmp_out); @@ -3543,14 +3073,14 @@ void LyXParagraph::DocBookContTableRows(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 - // desc_on==3 + // desc_on == 3 // 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 + // desc_on == 4 // if(desc_on != 3 || i != 0) { - if(tmp_out[0]=='@') { + if(tmp_out[0] == '@') { if(desc_on == 4) extra += frontStrip(tmp_out, '@'); else @@ -3559,8 +3089,8 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra, file += tmp_out; } } else if (font2.latex() == LyXFont::ON) { - // "TeX"-Mode on ==> SGML-Mode on. - if (c!='\0') + // "TeX"-Mode on == > SGML-Mode on. + if (c!= '\0') file += c; char_line_count++; } else { @@ -3586,7 +3116,7 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra, // we have only to control for emphasis open here! if (emph_flag) { file += ""; - emph_flag=false; + emph_flag= false; } font1 = font2 = getFont(-1); cell = table->CellHasContRow(current_cell_number); @@ -3594,24 +3124,15 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra, lyxerr[Debug::LATEX] << "DocBookContTableRows...done " << this << endl; } -#ifdef NEW_TEXT -void LyXParagraph::SimpleTeXBlanks(string & file, TexRow & texrow, - LyXParagraph::size_type const i, int & column, LyXFont const & font, - LyXLayout const & style) -#else void LyXParagraph::SimpleTeXBlanks(string & file, TexRow & texrow, - int const i, int & column, LyXFont const & font, + LyXParagraph::size_type const i, + int & column, LyXFont const & font, LyXLayout const & style) -#endif { if (column > tex_code_break_column && i && GetChar(i - 1) != ' ' -#ifdef NEW_TEXT && (i < size() - 1) -#else - && (i < last-1) -#endif // In LaTeX mode, we don't want to // break lines since some commands // do not like this @@ -3645,27 +3166,20 @@ void LyXParagraph::SimpleTeXBlanks(string & file, TexRow & texrow, } -#ifdef NEW_TEXT void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow, - LyXFont & font, LyXFont & running_font, + LyXFont & font, + LyXFont & running_font, LyXFont & basefont, bool & open_font, LyXLayout const & style, - LyXParagraph::size_type & i, int &column, char const c) -#else -void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow, - LyXFont & font, LyXFont & running_font, - LyXFont & basefont, - bool & open_font, - LyXLayout const & style, - int & i, int &column, char const c) -#endif + LyXParagraph::size_type & i, + int & column, char const c) { // Two major modes: LaTeX or plain // Handle here those cases common to both modes // and then split to handle the two modes separately. switch (c) { - case LYX_META_INSET: { + case LyXParagraph::META_INSET: { Inset * inset = GetInset(i); if (inset) { int len = file.length(); @@ -3683,16 +3197,17 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow, } break; - case LYX_META_NEWLINE: + case LyXParagraph::META_NEWLINE: if (open_font) { - column += running_font.latexWriteEndChanges(file, basefont); + column += running_font.latexWriteEndChanges(file, + basefont); open_font = false; } basefont = getFont(-1); running_font = basefont; break; - case LYX_META_HFILL: + case LyXParagraph::META_HFILL: file += "\\hfill{}"; column += 7; break; @@ -3705,7 +3220,7 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow, // but I'll leave it as a switch statement // so its simpler to extend. (ARRae) switch (c) { - case LYX_META_PROTECTED_SEPARATOR: + case LyXParagraph::META_PROTECTED_SEPARATOR: file += ' '; break; @@ -3723,7 +3238,7 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow, } else { // Plain mode (i.e. not LaTeX) switch (c) { - case LYX_META_PROTECTED_SEPARATOR: + case LyXParagraph::META_PROTECTED_SEPARATOR: file += '~'; break; @@ -3751,11 +3266,7 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow, file += c; //... but we should avoid ligatures if ((c == '>' || c == '<') -#ifdef NEW_TEXT && i <= size() - 2 -#else - && i <= last - 2 -#endif && GetChar(i+1) == c){ file += "\\textcompwordmark{}"; column += 19; @@ -3786,11 +3297,7 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow, break; case '-': // "--" in Typewriter mode -> "-{}-" -#ifdef NEW_TEXT if (i <= size() - 2 -#else - if (i <= last - 2 -#endif && GetChar(i + 1) == '-' && font.family() == LyXFont::TYPEWRITER_FAMILY) { file += "-{}"; @@ -3849,11 +3356,7 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow, /* idea for labels --- begin*/ /* check for LyX */ if (c == 'L' -#ifdef NEW_TEXT && i <= size() - 3 -#else - && i <= last - 3 -#endif && font.family() != LyXFont::TYPEWRITER_FAMILY && GetChar(i + 1) == 'y' && GetChar(i + 2) == 'X') { @@ -3863,11 +3366,7 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow, } /* check for TeX */ else if (c == 'T' -#ifdef NEW_TEXT && i <= size() - 3 -#else - && i <= last-3 -#endif && font.family() != LyXFont::TYPEWRITER_FAMILY && GetChar(i + 1) == 'e' && GetChar(i + 2) == 'X') { @@ -3877,11 +3376,7 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow, } /* check for LaTeX2e */ else if (c == 'L' -#ifdef NEW_TEXT && i <= size() - 7 -#else - && i <= last-7 -#endif && font.family() != LyXFont::TYPEWRITER_FAMILY && GetChar(i + 1) == 'a' && GetChar(i + 2) == 'T' @@ -3895,11 +3390,7 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow, } /* check for LaTeX */ else if (c == 'L' -#ifdef NEW_TEXT && i <= size() - 5 -#else - && i <= last - 5 -#endif && font.family() != LyXFont::TYPEWRITER_FAMILY && GetChar(i + 1) == 'a' && GetChar(i + 2) == 'T' @@ -3918,13 +3409,10 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow, } } -#ifdef NEW_TEXT + bool LyXParagraph::RoffContTableRows(FILE * fp, LyXParagraph::size_type i, int actcell) -#else -bool LyXParagraph::RoffContTableRows(FILE * fp, int i, int actcell) -#endif { if (!table) return false; @@ -3942,26 +3430,18 @@ bool LyXParagraph::RoffContTableRows(FILE * fp, int i, int actcell) while(cell >= 0) { // first find the right position i = lastpos; -#ifdef NEW_TEXT for (; i < size() && actcell < cell; ++i) { -#else - for (; i < last && actcell < cell; ++i) { -#endif c = GetChar(i); - if (c == LYX_META_NEWLINE) + if (c == LyXParagraph::META_NEWLINE) actcell++; } lastpos = i; c = GetChar(i); - if ((c != ' ') && (c != LYX_META_NEWLINE)) - fprintf(fp," "); -#ifdef NEW_TEXT - for (; i < size() && (c = GetChar(i)) != LYX_META_NEWLINE; - ++i) { -#else - for (; (i < last) && ((c=GetChar(i)) != LYX_META_NEWLINE); + if ((c != ' ') && (c != LyXParagraph::META_NEWLINE)) + fprintf(fp, " "); + for (; i < size() + && (c = GetChar(i)) != LyXParagraph::META_NEWLINE; ++i) { -#endif font2 = GetFontSettings(i); if (font1.latex() != font2.latex()) { if (font2.latex() != LyXFont::OFF) @@ -3969,10 +3449,12 @@ bool LyXParagraph::RoffContTableRows(FILE * fp, int i, int actcell) } c = GetChar(i); switch (c) { - case LYX_META_INSET: + case LyXParagraph::META_INSET: if ((inset = GetInset(i))) { - if (!(fp2=fopen(fname2.c_str(),"w+"))) { - WriteAlert(_("LYX_ERROR:"), _("Cannot open temporary file:"), fname2); + if (!(fp2= fopen(fname2.c_str(), "w+"))) { + WriteAlert(_("LYX_ERROR:"), + _("Cannot open temporary file:"), + fname2); return false; } inset->Latex(fp2,-1); @@ -3980,19 +3462,19 @@ bool LyXParagraph::RoffContTableRows(FILE * fp, int i, int actcell) c = fgetc(fp2); while(!feof(fp2)) { if (c == '\\') - fprintf(fp,"\\\\"); + fprintf(fp, "\\\\"); else - fputc(c,fp); + fputc(c, fp); c = fgetc(fp2); } fclose(fp2); } break; - case LYX_META_NEWLINE: + case LyXParagraph::META_NEWLINE: break; - case LYX_META_HFILL: + case LyXParagraph::META_HFILL: break; - case LYX_META_PROTECTED_SEPARATOR: + case LyXParagraph::META_PROTECTED_SEPARATOR: break; case '\\': fprintf(fp, "\\\\"); @@ -4010,6 +3492,7 @@ bool LyXParagraph::RoffContTableRows(FILE * fp, int i, int actcell) return true; } + LyXParagraph * LyXParagraph::TeXDeeper(string & file, TexRow & texrow, string & foot, TexRow & foot_texrow, int & foot_count) @@ -4054,7 +3537,8 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow, if (IsDummy()) lyxerr << "ERROR (LyXParagraph::TeXEnvironment)" << endl; - LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), layout); + LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(), + layout); if (pextra_type == PEXTRA_INDENT) { if (!pextra_width.empty()) { @@ -4089,7 +3573,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow, file += "\\hfill{}\n"; texrow.newline(); } - if (par_sep == LYX_PARSEP_INDENT) { + if (par_sep == BufferParams::PARSEP_INDENT) { file += "{\\setlength\\parindent{0pt}\n"; texrow.newline(); } @@ -4129,7 +3613,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow, file += "\\columnwidth}\n"; } texrow.newline(); - if (par_sep == LYX_PARSEP_INDENT) { + if (par_sep == BufferParams::PARSEP_INDENT) { file += "\\setlength\\parindent{\\LyXMinipageIndent}\n"; texrow.newline(); } @@ -4184,7 +3668,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow, par->pextra_start_minipage) { file += "\\end{minipage}\n"; texrow.newline(); - if (par_sep == LYX_PARSEP_INDENT) { + if (par_sep == BufferParams::PARSEP_INDENT) { file += "}\n"; texrow.newline(); } @@ -4213,7 +3697,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow, file += "\\hfill{}\n"; texrow.newline(); } - if (par_sep == LYX_PARSEP_INDENT) { + if (par_sep == BufferParams::PARSEP_INDENT) { file += "{\\setlength\\parindent{0pt}\n"; texrow.newline(); } @@ -4254,7 +3738,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow, file += "\\columnwidth}\n"; } texrow.newline(); - if (par_sep == LYX_PARSEP_INDENT) { + if (par_sep == BufferParams::PARSEP_INDENT) { file += "\\setlength\\parindent{\\LyXMinipageIndent}\n"; texrow.newline(); } @@ -4289,7 +3773,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow, par->pextra_type != PEXTRA_MINIPAGE)) { file += "\\end{minipage}\n"; texrow.newline(); - if (par_sep == LYX_PARSEP_INDENT) { + if (par_sep == BufferParams::PARSEP_INDENT) { file += "}\n"; texrow.newline(); } @@ -4304,7 +3788,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow, file += "\\end{LyXParagraphIndent}\n"; texrow.newline(); } - if (!(par && (par->pextra_type==PEXTRA_MINIPAGE) + if (!(par && (par->pextra_type == PEXTRA_MINIPAGE) && par->pextra_hfill)) { file += '\n'; texrow.newline(); @@ -4367,7 +3851,7 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow, foot += "\\stepcounter{footnote}"; } foot += "\\footnotetext{%\n"; - foot_texrow.start(this,0); + foot_texrow.start(this, 0); foot_texrow.newline(); ++foot_count; } @@ -4585,13 +4069,14 @@ void LyXParagraph::SetPExtraType(int type, char const * width, par->pextra_widthp = widthp; par = par->NextAfterFootnote(); if (par && (par->depth > depth)) - par->SetPExtraType(type,width,widthp); + par->SetPExtraType(type, width, widthp); while (par && ((par->depth > depth) || par->IsDummy())) par = par->NextAfterFootnote(); } } } + void LyXParagraph::UnsetPExtraType() { if (pextra_type == PEXTRA_NONE) @@ -4631,3 +4116,72 @@ void LyXParagraph::UnsetPExtraType() } } } + + +bool LyXParagraph::IsHfill(size_type pos) const +{ + return IsHfillChar(GetChar(pos)); +} + + +bool LyXParagraph::IsInset(size_type pos) const +{ + return IsInsetChar(GetChar(pos)); +} + + +bool LyXParagraph::IsFloat(size_type pos) const +{ + return IsFloatChar(GetChar(pos)); +} + + +bool LyXParagraph::IsNewline(size_type pos) const +{ + bool tmp = false; + if (pos >= 0) + tmp = IsNewlineChar(GetChar(pos)); + return tmp; +} + + +bool LyXParagraph::IsSeparator(size_type pos) const +{ + return IsSeparatorChar(GetChar(pos)); +} + + +bool LyXParagraph::IsLineSeparator(size_type pos) const +{ + return IsLineSeparatorChar(GetChar(pos)); +} + + +bool LyXParagraph::IsKomma(size_type pos) const +{ + return IsKommaChar(GetChar(pos)); +} + + +/// Used by the spellchecker +bool LyXParagraph::IsLetter(LyXParagraph::size_type pos) const +{ + unsigned char c = GetChar(pos); + if (IsLetterChar(c)) + return true; + // '\0' is not a letter, allthough every string contains "" (below) + if( c == '\0') + return false; + // We want to pass the ' and escape chars to ispell + string extra = lyxrc->isp_esc_chars + '\''; + char ch[2]; + ch[0] = c; + ch[1] = 0; + return contains(extra, ch); +} + + +bool LyXParagraph::IsWord(size_type pos ) const +{ + return IsWordChar( GetChar(pos) ) ; +} diff --git a/src/print_form.C b/src/print_form.C index fb8d989606..f1b806ca7d 100644 --- a/src/print_form.C +++ b/src/print_form.C @@ -15,78 +15,78 @@ FD_form_print *create_form_form_print(void) FD_form_print *fdui = (FD_form_print *) fl_calloc(1, sizeof(FD_form_print)); fdui->form_print = fl_bgn_form(FL_NO_BOX, 340, 360); - obj = fl_add_box(FL_UP_BOX,0,0,340,360,""); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,215,320,90,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_text(FL_NORMAL_TEXT,20,205,70,20,_("Print to")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->input_printer = obj = fl_add_input(FL_NORMAL_INPUT,90,225,230,30,""); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->input_file = obj = fl_add_input(FL_NORMAL_INPUT,90,265,230,30,""); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_box(FL_UP_BOX, 0, 0, 340, 360, ""); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 215, 320, 90, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 205, 70, 20, _("Print to")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->input_printer = obj = fl_add_input(FL_NORMAL_INPUT, 90, 225, 230, 30, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->input_file = obj = fl_add_input(FL_NORMAL_INPUT, 90, 265, 230, 30, ""); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fdui->group_radio_printto = fl_bgn_group(); - fdui->radio_printer = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,225,80,30,idex(_("Printer|#P")));fl_set_button_shortcut(obj,scex(_("Printer|#P")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->radio_file = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,265,80,30,idex(_("File|#F")));fl_set_button_shortcut(obj,scex(_("File|#F")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_printer = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 225, 80, 30, idex(_("Printer|#P")));fl_set_button_shortcut(obj, scex(_("Printer|#P")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->radio_file = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 265, 80, 30, idex(_("File|#F")));fl_set_button_shortcut(obj, scex(_("File|#F")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_group(); - obj = fl_add_frame(FL_ENGRAVED_FRAME,180,20,150,70,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,20,160,180,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_button(FL_RETURN_BUTTON,10,315,100,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PrintOKCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,120,315,100,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PrintApplyCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,230,315,100,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,PrintCancelCB,0); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 180, 20, 150, 70, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 20, 160, 180, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_button(FL_RETURN_BUTTON, 10, 315, 100, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PrintOKCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 120, 315, 100, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PrintApplyCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 230, 315, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, PrintCancelCB, 0); fdui->group_radio_pages = fl_bgn_group(); - fdui->radio_all_pages = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,30,160,30,idex(_("All Pages|#G")));fl_set_button_shortcut(obj,scex(_("All Pages|#G")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->radio_odd_pages = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,60,160,30,idex(_("Only Odd Pages|#O")));fl_set_button_shortcut(obj,scex(_("Only Odd Pages|#O")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->radio_even_pages = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,90,160,30,idex(_("Only Even Pages|#E")));fl_set_button_shortcut(obj,scex(_("Only Even Pages|#E")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_all_pages = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 30, 160, 30, idex(_("All Pages|#G")));fl_set_button_shortcut(obj, scex(_("All Pages|#G")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->radio_odd_pages = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 60, 160, 30, idex(_("Only Odd Pages|#O")));fl_set_button_shortcut(obj, scex(_("Only Odd Pages|#O")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->radio_even_pages = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 90, 160, 30, idex(_("Only Even Pages|#E")));fl_set_button_shortcut(obj, scex(_("Only Even Pages|#E")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_group(); fdui->group_radio_order = fl_bgn_group(); - fdui->radio_order_normal = obj = fl_add_checkbutton(FL_RADIO_BUTTON,180,30,150,30,idex(_("Normal Order|#N")));fl_set_button_shortcut(obj,scex(_("Normal Order|#N")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->radio_order_reverse = obj = fl_add_checkbutton(FL_RADIO_BUTTON,180,60,150,30,idex(_("Reverse Order|#R")));fl_set_button_shortcut(obj,scex(_("Reverse Order|#R")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_order_normal = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 180, 30, 150, 30, idex(_("Normal Order|#N")));fl_set_button_shortcut(obj, scex(_("Normal Order|#N")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->radio_order_reverse = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 180, 60, 150, 30, idex(_("Reverse Order|#R")));fl_set_button_shortcut(obj, scex(_("Reverse Order|#R")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_group(); - obj = fl_add_text(FL_NORMAL_TEXT,200,10,60,20,_("Order")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - obj = fl_add_text(FL_NORMAL_TEXT,20,10,50,20,_("Print")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->input_pages = obj = fl_add_input(FL_NORMAL_INPUT,20,160,140,30,_("Pages:")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT); - obj = fl_add_frame(FL_ENGRAVED_FRAME,180,110,150,90,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_text(FL_NORMAL_TEXT,200,95,50,20,_("Copies")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->input_copies = obj = fl_add_input(FL_NORMAL_INPUT,190,160,130,30,_("Count:")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT); - fdui->do_unsorted = obj = fl_add_checkbutton(FL_PUSH_BUTTON,180,115,140,30,idex(_("Unsorted|#U")));fl_set_button_shortcut(obj,scex(_("Unsorted|#U")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_text(FL_NORMAL_TEXT, 200, 10, 60, 20, _("Order")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 50, 20, _("Print")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->input_pages = obj = fl_add_input(FL_NORMAL_INPUT, 20, 160, 140, 30, _("Pages:")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 180, 110, 150, 90, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_text(FL_NORMAL_TEXT, 200, 95, 50, 20, _("Copies")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->input_copies = obj = fl_add_input(FL_NORMAL_INPUT, 190, 160, 130, 30, _("Count:")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + fdui->do_unsorted = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 180, 115, 140, 30, idex(_("Unsorted|#U")));fl_set_button_shortcut(obj, scex(_("Unsorted|#U")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_form(); //fdui->form_print->fdui = fdui; @@ -101,38 +101,38 @@ FD_form_sendto *create_form_form_sendto(void) FD_form_sendto *fdui = (FD_form_sendto *) fl_calloc(1, sizeof(FD_form_sendto)); fdui->form_sendto = fl_bgn_form(FL_NO_BOX, 340, 210); - obj = fl_add_box(FL_UP_BOX,0,0,340,210,""); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,20,310,80,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_text(FL_NORMAL_TEXT,20,10,80,20,_("File Type")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - fdui->input_cmd = obj = fl_add_input(FL_NORMAL_INPUT,10,130,320,30,idex(_("Command:|#C")));fl_set_button_shortcut(obj,scex(_("Command:|#C")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_TOP_LEFT); - obj = fl_add_button(FL_RETURN_BUTTON,10,170,100,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,SendtoOKCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,120,170,100,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,SendtoApplyCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,230,170,100,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_callback(obj,SendtoCancelCB,0); + obj = fl_add_box(FL_UP_BOX, 0, 0, 340, 210, ""); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 20, 310, 80, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 80, 20, _("File Type")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + fdui->input_cmd = obj = fl_add_input(FL_NORMAL_INPUT, 10, 130, 320, 30, idex(_("Command:|#C")));fl_set_button_shortcut(obj, scex(_("Command:|#C")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); + obj = fl_add_button(FL_RETURN_BUTTON, 10, 170, 100, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, SendtoOKCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 120, 170, 100, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, SendtoApplyCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 230, 170, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, SendtoCancelCB, 0); fdui->group_ftype = fl_bgn_group(); - fdui->radio_ftype_dvi = obj = fl_add_checkbutton(FL_RADIO_BUTTON,110,30,110,30,idex(_("DVI|#D")));fl_set_button_shortcut(obj,scex(_("DVI|#D")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->radio_ftype_ps = obj = fl_add_checkbutton(FL_RADIO_BUTTON,110,60,110,30,idex(_("Postscript|#P")));fl_set_button_shortcut(obj,scex(_("Postscript|#P")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->radio_ftype_latex = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,60,100,30,idex(_("LaTeX|#T")));fl_set_button_shortcut(obj,scex(_("LaTeX|#T")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_ftype_dvi = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 30, 110, 30, idex(_("DVI|#D")));fl_set_button_shortcut(obj, scex(_("DVI|#D")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->radio_ftype_ps = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 110, 60, 110, 30, idex(_("Postscript|#P")));fl_set_button_shortcut(obj, scex(_("Postscript|#P")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->radio_ftype_latex = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 60, 100, 30, idex(_("LaTeX|#T")));fl_set_button_shortcut(obj, scex(_("LaTeX|#T")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_button(obj, 1); - fdui->radio_ftype_lyx = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,30,100,30,idex(_("LyX|#L")));fl_set_button_shortcut(obj,scex(_("LyX|#L")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->radio_ftype_ascii = obj = fl_add_checkbutton(FL_RADIO_BUTTON,220,30,90,30,idex(_("Ascii|#s")));fl_set_button_shortcut(obj,scex(_("Ascii|#s")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->radio_ftype_lyx = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 30, 100, 30, idex(_("LyX|#L")));fl_set_button_shortcut(obj, scex(_("LyX|#L")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->radio_ftype_ascii = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 220, 30, 90, 30, idex(_("Ascii|#s")));fl_set_button_shortcut(obj, scex(_("Ascii|#s")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_group(); fl_end_form(); diff --git a/src/screen.C b/src/screen.C index 3eb74d34a3..cf8fc9caf0 100644 --- a/src/screen.C +++ b/src/screen.C @@ -1,12 +1,12 @@ /* This file is part of -* ====================================================== +* ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1998 The LyX Team * -*======================================================*/ +* ====================================================== */ #include @@ -29,8 +29,8 @@ LyXScreen::LyXScreen(Window window, Dimension offset_x, Dimension offset_y, LyXText *text_ptr) - : text(text_ptr),_window(window), - _width(width),_height(height), + : text(text_ptr), _window(window), + _width(width), _height(height), _offset_x(offset_x), _offset_y(offset_y) { first = 0; @@ -127,7 +127,7 @@ void LyXScreen::DrawOneRow(Row *row, long &y_text) /* ok there is something visible */ text->GetVisibleRow(*this, y, row, y + first); } - y_text+=row->height; + y_text+= row->height; } @@ -216,7 +216,7 @@ void LyXScreen::ShowCursor() cursor_pixmap_h = y2 - y1 + 1; cursor_pixmap_x = x; cursor_pixmap_y = y1; - cursor_pixmap = + cursor_pixmap = XCreatePixmap(fl_display, fl_root, cursor_pixmap_w, @@ -267,7 +267,7 @@ int LyXScreen::FitManualCursor(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); + ShowManualCursor(x, y, asc, desc); else HideCursor(); } @@ -280,7 +280,7 @@ void LyXScreen::ShowManualCursor(long x, long y, int asc, int desc) y1 = y - first - asc; if (y1 < 0) - y1 =0; + y1 = 0; y2 = y -first + desc; if (y2 > _height) y2 = _height; @@ -305,7 +305,7 @@ void LyXScreen::ShowManualCursor(long x, long y, int asc, int desc) cursor_pixmap_h = y2 - y1 + 1; cursor_pixmap_x = x, cursor_pixmap_y = y1; - cursor_pixmap = + cursor_pixmap = XCreatePixmap (fl_display, fl_root, cursor_pixmap_w, @@ -514,7 +514,7 @@ void LyXScreen::ToggleSelection(bool kill_selection) top = 0; if (bottom > _height) bottom = _height; - XFillRectangle(fl_display,_window, + XFillRectangle(fl_display, _window, getGC(gc_select), text->sel_start_cursor.x +_offset_x, @@ -541,7 +541,7 @@ void LyXScreen::ToggleSelection(bool kill_selection) top = 0; if (bottom > _height) bottom = _height; - XFillRectangle(fl_display,_window, + XFillRectangle(fl_display, _window, getGC(gc_select), text->sel_start_cursor.x +_offset_x, @@ -553,7 +553,7 @@ void LyXScreen::ToggleSelection(bool kill_selection) /* the main body */ - if (text->sel_start_cursor.row->next != + if (text->sel_start_cursor.row->next != text->sel_end_cursor.row) { top = text->sel_start_cursor.y - text->sel_start_cursor.row->baseline @@ -598,7 +598,7 @@ void LyXScreen::ToggleSelection(bool kill_selection) top = 0; if (bottom > _height) bottom = _height; - XFillRectangle(fl_display,_window, + XFillRectangle(fl_display, _window, getGC(gc_select), 0+_offset_x, top+_offset_y, @@ -653,7 +653,7 @@ void LyXScreen::ToggleToggle() bottom = top + text->toggle_cursor.row->height; if (top < 0) top = 0; if (bottom > _height) bottom = _height; - XFillRectangle(fl_display,_window, + XFillRectangle(fl_display, _window, getGC(gc_select), text->toggle_cursor.x+_offset_x, top+_offset_y, @@ -673,7 +673,7 @@ void LyXScreen::ToggleToggle() top = 0; if (bottom > _height) bottom = _height; - XFillRectangle(fl_display,_window, + XFillRectangle(fl_display, _window, getGC(gc_select), text->toggle_cursor.x+_offset_x, top+_offset_y, @@ -683,7 +683,7 @@ void LyXScreen::ToggleToggle() /* the main body */ - if (text->toggle_cursor.row->next != + if (text->toggle_cursor.row->next != text->toggle_end_cursor.row) { top = text->toggle_cursor.y - text->toggle_cursor.row->baseline @@ -702,7 +702,7 @@ void LyXScreen::ToggleToggle() top = first + _height; if (top != bottom) { - XFillRectangle(fl_display,_window, + XFillRectangle(fl_display, _window, getGC(gc_select), 0+_offset_x, top - first+_offset_y, @@ -724,7 +724,7 @@ void LyXScreen::ToggleToggle() top = 0; if (bottom > _height) bottom = _height; - XFillRectangle(fl_display,_window, + XFillRectangle(fl_display, _window, getGC(gc_select), 0+_offset_x, top+_offset_y, @@ -810,9 +810,9 @@ 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]; diff --git a/src/sp_form.C b/src/sp_form.C index c0fbf52a80..fe8d53d950 100644 --- a/src/sp_form.C +++ b/src/sp_form.C @@ -15,54 +15,54 @@ FD_form_spell_options *create_form_form_spell_options(void) FD_form_spell_options *fdui = (FD_form_spell_options *) fl_calloc(1, sizeof(FD_form_spell_options)); fdui->form_spell_options = fl_bgn_form(FL_NO_BOX, 340, 400); - obj = fl_add_box(FL_UP_BOX,0,0,340,400,""); - fl_set_object_lsize(obj,0); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,20,320,110,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); - obj = fl_add_frame(FL_ENGRAVED_FRAME,10,150,320,200,""); - fl_set_object_color(obj,FL_COL1,FL_COL1); + obj = fl_add_box(FL_UP_BOX, 0, 0, 340, 400, ""); + fl_set_object_lsize(obj, 0); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 20, 320, 110, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); + obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 150, 320, 200, ""); + fl_set_object_color(obj, FL_COL1, FL_COL1); fdui->lang_buts = fl_bgn_group(); - fdui->buflang = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,30,320,30,idex(_("Use language of document|#D")));fl_set_button_shortcut(obj,scex(_("Use language of document|#D")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->altlang = obj = fl_add_checkbutton(FL_RADIO_BUTTON,10,60,320,30,idex(_("Use alternate language:|#U")));fl_set_button_shortcut(obj,scex(_("Use alternate language:|#U")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->buflang = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 30, 320, 30, idex(_("Use language of document|#D")));fl_set_button_shortcut(obj, scex(_("Use language of document|#D")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->altlang = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 60, 320, 30, idex(_("Use alternate language:|#U")));fl_set_button_shortcut(obj, scex(_("Use alternate language:|#U")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_group(); - fdui->altlang_input = obj = fl_add_input(FL_NORMAL_INPUT,40,90,240,30,""); - fl_set_object_lsize(obj,0); - fdui->compounds = obj = fl_add_checkbutton(FL_PUSH_BUTTON,10,160,320,30,idex(_("Treat run-together words as legal|#T")));fl_set_button_shortcut(obj,scex(_("Treat run-together words as legal|#T")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->inpenc = obj = fl_add_checkbutton(FL_PUSH_BUTTON,10,190,320,30,idex(_("Input Encoding switch to ispell|#I")));fl_set_button_shortcut(obj,scex(_("Input Encoding switch to ispell|#I")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->ok = obj = fl_add_button(FL_RETURN_BUTTON,10,360,100,30,_("OK")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fdui->altlang_input = obj = fl_add_input(FL_NORMAL_INPUT, 40, 90, 240, 30, ""); + fl_set_object_lsize(obj, 0); + fdui->compounds = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 160, 320, 30, idex(_("Treat run-together words as legal|#T")));fl_set_button_shortcut(obj, scex(_("Treat run-together words as legal|#T")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->inpenc = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 190, 320, 30, idex(_("Input Encoding switch to ispell|#I")));fl_set_button_shortcut(obj, scex(_("Input Encoding switch to ispell|#I")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->ok = obj = fl_add_button(FL_RETURN_BUTTON, 10, 360, 100, 30, _("OK")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,SpellOptionsOKCB,0); - obj = fl_add_button(FL_NORMAL_BUTTON,230,360,100,30,idex(_("Cancel|^[")));fl_set_button_shortcut(obj,scex(_("Cancel|^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, SpellOptionsOKCB, 0); + obj = fl_add_button(FL_NORMAL_BUTTON, 230, 360, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,SpellOptionsCancelCB,0); - fdui->perdict = obj = fl_add_checkbutton(FL_PUSH_BUTTON,10,220,320,30,idex(_("Use alternate personal dictionary:|#P")));fl_set_button_shortcut(obj,scex(_("Use alternate personal dictionary:|#P")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->esc_chars = obj = fl_add_checkbutton(FL_PUSH_BUTTON,10,280,320,30,idex(_("Extra special chars allowed in words:|#E")));fl_set_button_shortcut(obj,scex(_("Extra special chars allowed in words:|#E")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->perdict_input = obj = fl_add_input(FL_NORMAL_INPUT,40,250,240,30,""); - fl_set_object_lsize(obj,0); - fdui->esc_chars_input = obj = fl_add_input(FL_NORMAL_INPUT,40,310,240,30,""); - fl_set_object_lsize(obj,0); - obj = fl_add_text(FL_NORMAL_TEXT,20,10,90,20,_("Dictionary")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - obj = fl_add_text(FL_NORMAL_TEXT,30,140,70,20,_("Options")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); - obj = fl_add_button(FL_NORMAL_BUTTON,120,360,100,30,idex(_("Apply|#A")));fl_set_button_shortcut(obj,scex(_("Apply|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + fl_set_object_callback(obj, SpellOptionsCancelCB, 0); + fdui->perdict = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 220, 320, 30, idex(_("Use alternate personal dictionary:|#P")));fl_set_button_shortcut(obj, scex(_("Use alternate personal dictionary:|#P")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->esc_chars = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 10, 280, 320, 30, idex(_("Extra special chars allowed in words:|#E")));fl_set_button_shortcut(obj, scex(_("Extra special chars allowed in words:|#E")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->perdict_input = obj = fl_add_input(FL_NORMAL_INPUT, 40, 250, 240, 30, ""); + fl_set_object_lsize(obj, 0); + fdui->esc_chars_input = obj = fl_add_input(FL_NORMAL_INPUT, 40, 310, 240, 30, ""); + fl_set_object_lsize(obj, 0); + obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 90, 20, _("Dictionary")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + obj = fl_add_text(FL_NORMAL_TEXT, 30, 140, 70, 20, _("Options")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); + obj = fl_add_button(FL_NORMAL_BUTTON, 120, 360, 100, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj,SpellOptionsApplyCB,0); + fl_set_object_callback(obj, SpellOptionsApplyCB, 0); fl_end_form(); //fdui->form_spell_options->fdui = fdui; @@ -77,45 +77,45 @@ FD_form_spell_check *create_form_form_spell_check(void) FD_form_spell_check *fdui = (FD_form_spell_check *) fl_calloc(1, sizeof(FD_form_spell_check)); fdui->form_spell_check = fl_bgn_form(FL_NO_BOX, 540, 280); - obj = fl_add_box(FL_UP_BOX,0,0,540,280,""); - fl_set_object_lsize(obj,0); - fdui->text = obj = fl_add_text(FL_NORMAL_TEXT,80,10,220,30,""); - fl_set_object_boxtype(obj,FL_DOWN_BOX); - fl_set_object_lsize(obj,0); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fdui->input = obj = fl_add_input(FL_NORMAL_INPUT,80,40,220,30,_("Replace")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->browser = obj = fl_add_browser(FL_SELECT_BROWSER,80,70,220,150,_("Near\nMisses")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT); - fdui->options = obj = fl_add_button(FL_NORMAL_BUTTON,310,210,220,30,idex(_("Spellchecker Options...|#O")));fl_set_button_shortcut(obj,scex(_("Spellchecker Options...|#O")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->start = obj = fl_add_button(FL_NORMAL_BUTTON,310,10,220,30,idex(_("Start spellchecking|#S")));fl_set_button_shortcut(obj,scex(_("Start spellchecking|#S")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->insert = obj = fl_add_button(FL_NORMAL_BUTTON,310,50,220,30,idex(_("Insert in personal dictionary|#I")));fl_set_button_shortcut(obj,scex(_("Insert in personal dictionary|#I")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->ignore = obj = fl_add_button(FL_NORMAL_BUTTON,310,110,220,30,idex(_("Ignore word|#g")));fl_set_button_shortcut(obj,scex(_("Ignore word|#g")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->accept = obj = fl_add_button(FL_NORMAL_BUTTON,310,80,220,30,idex(_("Accept word in this session|#A")));fl_set_button_shortcut(obj,scex(_("Accept word in this session|#A")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->stop = obj = fl_add_button(FL_NORMAL_BUTTON,310,180,220,30,idex(_("Stop spellchecking|#T")));fl_set_button_shortcut(obj,scex(_("Stop spellchecking|#T")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->done = obj = fl_add_button(FL_NORMAL_BUTTON,310,240,220,30,idex(_("Close Spellchecker|#C^[")));fl_set_button_shortcut(obj,scex(_("Close Spellchecker|#C^[")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_box(FL_UP_BOX, 0, 0, 540, 280, ""); + fl_set_object_lsize(obj, 0); + fdui->text = obj = fl_add_text(FL_NORMAL_TEXT, 80, 10, 220, 30, ""); + fl_set_object_boxtype(obj, FL_DOWN_BOX); + fl_set_object_lsize(obj, 0); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fdui->input = obj = fl_add_input(FL_NORMAL_INPUT, 80, 40, 220, 30, _("Replace")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->browser = obj = fl_add_browser(FL_SELECT_BROWSER, 80, 70, 220, 150, _("Near\nMisses")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT); + fdui->options = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 210, 220, 30, idex(_("Spellchecker Options...|#O")));fl_set_button_shortcut(obj, scex(_("Spellchecker Options...|#O")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->start = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 10, 220, 30, idex(_("Start spellchecking|#S")));fl_set_button_shortcut(obj, scex(_("Start spellchecking|#S")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->insert = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 50, 220, 30, idex(_("Insert in personal dictionary|#I")));fl_set_button_shortcut(obj, scex(_("Insert in personal dictionary|#I")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->ignore = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 110, 220, 30, idex(_("Ignore word|#g")));fl_set_button_shortcut(obj, scex(_("Ignore word|#g")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->accept = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 80, 220, 30, idex(_("Accept word in this session|#A")));fl_set_button_shortcut(obj, scex(_("Accept word in this session|#A")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->stop = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 180, 220, 30, idex(_("Stop spellchecking|#T")));fl_set_button_shortcut(obj, scex(_("Stop spellchecking|#T")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->done = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 240, 220, 30, idex(_("Close Spellchecker|#C^[")));fl_set_button_shortcut(obj, scex(_("Close Spellchecker|#C^[")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); // xgettext:no-c-format - obj = fl_add_box(FL_NO_BOX,10,250,50,20,_("0 %")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + obj = fl_add_box(FL_NO_BOX, 10, 250, 50, 20, _("0 %")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); // xgettext:no-c-format - obj = fl_add_box(FL_NO_BOX,250,250,50,20,_("100 %")); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fl_set_object_lalign(obj,FL_ALIGN_RIGHT|FL_ALIGN_INSIDE); - fdui->replace = obj = fl_add_button(FL_NORMAL_BUTTON,310,140,220,30,idex(_("Replace word|#R")));fl_set_button_shortcut(obj,scex(_("Replace word|#R")),1); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); - fdui->slider = obj = fl_add_slider(FL_HOR_FILL_SLIDER,10,230,290,20,""); - fl_set_object_color(obj,FL_BLUE,FL_COL1); - fl_set_object_lsize(obj,0); - fl_set_object_lalign(obj,FL_ALIGN_LEFT); + obj = fl_add_box(FL_NO_BOX, 250, 250, 50, 20, _("100 %")); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_RIGHT|FL_ALIGN_INSIDE); + fdui->replace = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 140, 220, 30, idex(_("Replace word|#R")));fl_set_button_shortcut(obj, scex(_("Replace word|#R")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fdui->slider = obj = fl_add_slider(FL_HOR_FILL_SLIDER, 10, 230, 290, 20, ""); + fl_set_object_color(obj, FL_BLUE, FL_COL1); + fl_set_object_lsize(obj, 0); + fl_set_object_lalign(obj, FL_ALIGN_LEFT); fl_end_form(); //fdui->form_spell_check->fdui = fdui; diff --git a/src/spellchecker.C b/src/spellchecker.C index e534ee81fb..f97e8e4c94 100644 --- a/src/spellchecker.C +++ b/src/spellchecker.C @@ -1,13 +1,13 @@ /* *This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1998 The LyX Team * - *====================================================== + * ====================================================== */ #include @@ -115,11 +115,11 @@ void SpellOptionsUpdate() lyxrc->isp_alt_lang.c_str()); } if (lyxrc->isp_use_alt_lang) { - fl_set_button(fd_form_spell_options->buflang,0); - fl_set_button(fd_form_spell_options->altlang,1); + fl_set_button(fd_form_spell_options->buflang, 0); + fl_set_button(fd_form_spell_options->altlang, 1); } else { - fl_set_button(fd_form_spell_options->buflang,1); - fl_set_button(fd_form_spell_options->altlang,0); + fl_set_button(fd_form_spell_options->buflang, 1); + fl_set_button(fd_form_spell_options->altlang, 0); } // Personal dictionary @@ -153,23 +153,23 @@ void SpellOptionsUpdate() void SpellOptionsApplyCB(FL_OBJECT *, long) { // Build new status from form data - lyxrc->isp_use_alt_lang = + lyxrc->isp_use_alt_lang = fl_get_button(fd_form_spell_options->altlang); - lyxrc->isp_use_pers_dict = + lyxrc->isp_use_pers_dict = fl_get_button(fd_form_spell_options->perdict); - lyxrc->isp_accept_compound = + lyxrc->isp_accept_compound = fl_get_button(fd_form_spell_options->compounds); - lyxrc->isp_use_esc_chars = + lyxrc->isp_use_esc_chars = fl_get_button(fd_form_spell_options->esc_chars); - lyxrc->isp_use_input_encoding = + lyxrc->isp_use_input_encoding = fl_get_button(fd_form_spell_options->inpenc); // Update strings with data from input fields - lyxrc->isp_alt_lang = + lyxrc->isp_alt_lang = fl_get_input(fd_form_spell_options->altlang_input); - lyxrc->isp_pers_dict = + lyxrc->isp_pers_dict = fl_get_input(fd_form_spell_options->perdict_input); - lyxrc->isp_esc_chars = + lyxrc->isp_esc_chars = fl_get_input(fd_form_spell_options->esc_chars_input); // Update form @@ -213,7 +213,7 @@ void SpellCheckerOptions() fl_raise_form(fd_form_spell_options->form_spell_options); } else { fl_show_form(fd_form_spell_options->form_spell_options, - FL_PLACE_MOUSE,FL_FULLBORDER, + FL_PLACE_MOUSE, FL_FULLBORDER, _("Spellchecker Options")); } } @@ -233,18 +233,18 @@ void create_ispell_pipe(string const & lang) isp_pid = -1; - if(pipe(pipein)==-1 || pipe(pipeout)==-1) { + if(pipe(pipein) == -1 || pipe(pipeout) == -1) { lyxerr << "LyX: Can't create pipe for spellchecker!" << endl; return; } - if ((out = fdopen(pipein[1], "w"))==0) { + if ((out = fdopen(pipein[1], "w")) == 0) { lyxerr << "LyX: Can't create stream for pipe for spellchecker!" << endl; return; } - if ((in = fdopen(pipeout[0], "r"))==0) { + if ((in = fdopen(pipeout[0], "r")) == 0) { lyxerr <<"LyX: Can't create stream for pipe for spellchecker!" << endl; return; @@ -256,13 +256,13 @@ void create_ispell_pipe(string const & lang) isp_pid = fork(); - if(isp_pid==-1) { + if(isp_pid == -1) { lyxerr << "LyX: Can't create child process for spellchecker!" << endl; return; } - if(isp_pid==0) { + if(isp_pid == 0) { /* child process */ dup2(pipein[0], STDIN_FILENO); dup2(pipeout[1], STDOUT_FILENO); @@ -317,7 +317,7 @@ void create_ispell_pipe(string const & lang) // Specify an alternate personal dictionary tmp = new char[3]; string("-p").copy(tmp, 2); - tmp[2]='\0'; + tmp[2]= '\0'; argv[argc++] = tmp; tmp = new char[lyxrc->isp_pers_dict.length() + 1]; lyxrc->isp_pers_dict.copy(tmp, lyxrc->isp_pers_dict.length()); @@ -341,7 +341,7 @@ void create_ispell_pipe(string const & lang) // free the memory used by string::copy in the // setup of argv - for (int i=0; i < argc -1; i++) + for (int i= 0; i < argc -1; i++) delete[] argv[i]; lyxerr << "LyX: Failed to start ispell!" << endl; @@ -439,18 +439,18 @@ isp_result *ispell_check_word(char *word) result->str = buf; char * nb = new char[result->str.length() + 1]; result->str.copy(nb, result->str.length()); - nb[result->str.length()]='\0'; + nb[result->str.length()]= '\0'; p = strpbrk(nb+2, " "); sscanf(p, "%d", &count); // Get near misses count result->count = count; if (count) result->misses = new char*[count]; p = strpbrk(nb, ":"); - p +=2; + p += 2; for (i = 0; imisses[i] = p; p = strpbrk(p, ",\n"); *p = 0; - p+=2; + p+= 2; } break; } @@ -459,8 +459,8 @@ isp_result *ispell_check_word(char *word) } *buf = 0; - if (result->flag!=ISP_IGNORE) { - while (*buf!='\n') fgets(buf, 255, in); /* wait for ispell to finish */ + if (result->flag!= ISP_IGNORE) { + while (*buf!= '\n') fgets(buf, 255, in); /* wait for ispell to finish */ } return result; } @@ -506,7 +506,7 @@ inline void ispell_accept_word(char const *word) } static -inline void ispell_store_replacement(const char *mis, string const & cor) { +inline void ispell_store_replacement(char const *mis, string const & cor) { if(actual_spell_checker == ASC_ASPELL) { fputs("$$ra ", out); fputs(mis, out); @@ -544,7 +544,7 @@ void ShowSpellChecker() fl_raise_form(fd_form_spell_check->form_spell_check); } else { fl_show_form(fd_form_spell_check->form_spell_check, - FL_PLACE_MOUSE,FL_FULLBORDER, + FL_PLACE_MOUSE, FL_FULLBORDER, _("Spellchecker")); } fl_deactivate_object(fd_form_spell_check->slider); @@ -667,18 +667,18 @@ bool RunSpellChecker(string const & lang) while (true) { word = NextWord(newval); - if (word==0) break; + if (word == 0) break; word_count++; // Update slider if and only if value has changed newvalue = int(100.0*newval); - if(newvalue!=oldval) { + if(newvalue!= oldval) { oldval = newvalue; fl_set_slider_value(fd_form_spell_check->slider, oldval); } result = ispell_check_word(word); - if (isp_pid==-1) { + if (isp_pid == -1) { delete[] word; break; } @@ -704,34 +704,34 @@ bool RunSpellChecker(string const & lang) fl_set_object_label(fd_form_spell_check->text, word); fl_set_input(fd_form_spell_check->input, word); fl_clear_browser(fd_form_spell_check->browser); - for (i=0; icount; i++) { + for (i= 0; icount; i++) { fl_add_browser_line(fd_form_spell_check->browser, result->misses[i]); } clickline = -1; while (true) { obj = fl_do_forms(); - if (obj==fd_form_spell_check->insert) { + if (obj == fd_form_spell_check->insert) { ispell_insert_word(word); break; } - if (obj==fd_form_spell_check->accept) { + if (obj == fd_form_spell_check->accept) { ispell_accept_word(word); break; } - if (obj==fd_form_spell_check->ignore) { + if (obj == fd_form_spell_check->ignore) { break; } - if (obj==fd_form_spell_check->replace || - obj==fd_form_spell_check->input) { + if (obj == fd_form_spell_check->replace || + obj == fd_form_spell_check->input) { ispell_store_replacement(word, fl_get_input(fd_form_spell_check->input)); ReplaceWord(fl_get_input(fd_form_spell_check->input)); break; } - if (obj==fd_form_spell_check->browser) { + if (obj == fd_form_spell_check->browser) { // implements double click in the browser window. // sent to lyx@via by Mark Burton - if (clickline == + if (clickline == fl_get_browser(fd_form_spell_check->browser)) { ispell_store_replacement(word, fl_get_input(fd_form_spell_check->input)); ReplaceWord(fl_get_input(fd_form_spell_check->input)); @@ -743,14 +743,14 @@ bool RunSpellChecker(string const & lang) fl_get_browser(fd_form_spell_check->browser))); } - if (obj==fd_form_spell_check->stop) { + if (obj == fd_form_spell_check->stop) { delete result; delete[] word; ispell_terminate(); return true; } - if (obj==fd_form_spell_check->done) { + if (obj == fd_form_spell_check->done) { delete result; delete[] word; ispell_terminate(); @@ -763,7 +763,7 @@ bool RunSpellChecker(string const & lang) } } - if(isp_pid!=-1) { + if(isp_pid!= -1) { ispell_terminate(); string word_msg; word_msg += tostr(word_count); @@ -772,7 +772,7 @@ bool RunSpellChecker(string const & lang) } else { word_msg += _(" word checked."); } - fl_show_message("",_("Spellchecking completed!"), + fl_show_message("", _("Spellchecking completed!"), word_msg.c_str()); return false; } else { @@ -790,9 +790,9 @@ void sigchldhandler(pid_t pid, int *status) //int status ; if (isp_pid>0) - //if (waitpid(isp_pid,&status,WNOHANG)==isp_pid) { + //if (waitpid(isp_pid, &status, WNOHANG) == isp_pid) { if (pid == isp_pid) { - isp_pid=-1; + isp_pid= -1; fcntl(isp_fd, F_SETFL, O_NONBLOCK); /* set the file descriptor to nonblocking so we can continue */ diff --git a/src/table.C b/src/table.C index 06ec83ef29..2b585c9395 100644 --- a/src/table.C +++ b/src/table.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995 Matthias Ettrich * Copyright (C) 1995-1998 The LyX Team. * - *====================================================== + * ====================================================== */ #include @@ -45,7 +45,7 @@ LyXTable::~LyXTable() { delete[] columnofcell; delete[] column_info; delete[] row_info; - for (i=0; icell_info[row][column] = cell_info[row][column]; } } - for (row=0; rowrow_info[row] = row_info[row]; } - for (column=0; columncolumn_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; @@ -76,7 +76,7 @@ LyXTable* LyXTable::Clone() } result->SetLongTable(is_long_table); - result->rotate=rotate; + result->rotate = rotate; result->Reinit(); return result; } @@ -85,7 +85,7 @@ 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, cellno; rows = rows_arg; columns = columns_arg; column_info = new columnstruct[columns]; @@ -93,13 +93,13 @@ void LyXTable::Init(int rows_arg, int columns_arg) cell_info = new cellstruct*[rows]; cellno = 0; - for (i=0; i= row; 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) + 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=column; 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= numberofcells) return false; - int row=row_of_cell(cell); + int row = row_of_cell(cell); if (RowHasContRow(cell)) return BottomLine(cell_info[row+1][column_of_cell(cell)].cellno); @@ -445,7 +445,7 @@ int LyXTable::AdditionalHeight(int cell) int bottom = 1; int column; if (row){ - for (column=0;column < columns-1 && bottom;column++){ + for (column = 0;column < columns-1 && bottom;column++){ switch (cell_info[row-1][column].multicolumn){ case LyXTable::CELL_BEGIN_OF_MULTICOLUMN: bottom = cell_info[row-1][column].bottom_line; @@ -454,7 +454,7 @@ int LyXTable::AdditionalHeight(int cell) bottom = row_info[row-1].bottom_line; } } - for (column=0;column < columns-1 && top;column++){ + for (column = 0;column < columns-1 && top;column++){ switch (cell_info[row][column].multicolumn){ case LyXTable::CELL_BEGIN_OF_MULTICOLUMN: top = cell_info[row][column].top_line; @@ -489,8 +489,8 @@ int LyXTable::WidthOfColumn(int cell) int column1 = column_of_cell(cell); int column2 = right_column_of_cell(cell); int i; - int result=0; - for (i=column1; i<=column2;i++){ + int result = 0; + for (i = column1; i<= column2;i++){ result += column_info[i].width_of_column; } return result; @@ -512,19 +512,19 @@ bool LyXTable::SetWidthOfMulticolCell(int cell, int new_width) int column1 = column_of_cell(cell); int column2 = right_column_of_cell(cell); int i; - int width=0; + int width = 0; // first set columns to 0 so we can calculate the right width - for (i=column1; i<=column2;i++) { + for (i = column1; i<= column2;i++) { cell_info[row][i].width_of_cell = 0; } // set the width to MAX_WIDTH until width > 0 width = (new_width + 2*WIDTH_OF_LINE); - for (i=column1; (i 0);i++){ + for (i = column1; (i 0);i++){ cell_info[row][i].width_of_cell = column_info[i].width_of_column; width -= column_info[i].width_of_column; } - if (i==column2) { + if (i == column2) { cell_info[row][i].width_of_cell = width; } return true; @@ -539,13 +539,13 @@ void LyXTable::recalculateMulticolCells(int cell, int new_width) i; // first set columns to 0 so we can calculate the right width - for (i=column1; i<=column2;++i) + for (i = column1; i<= column2;++i) cell_info[row][i].width_of_cell = 0; - for(i=cell+1;(i max) { max = cell_info[i][column].width_of_cell; } @@ -759,8 +759,8 @@ bool LyXTable::calculate_width_of_column_NMC(int column) int i, max; int old_column_width = column_info[column].width_of_column; max = 0; - for (i=0; i max)) { max = cell_info[i][column].width_of_cell; } @@ -771,9 +771,8 @@ bool LyXTable::calculate_width_of_column_NMC(int column) void LyXTable::calculate_width_of_table() { - int i; width_of_table = 0; - for (i=0; i= 0) { - fprintf(file,"\nT}"); + fprintf(file, "\nT}"); ret++; } fprintf(file, "\n"); @@ -1318,14 +1317,14 @@ int LyXTable::RoffEndOfCell(FILE* file, int cell) fprintf(file, ".TE\n.pl 1c"); } else { if (cell < 0){ - int fcell=0; + int fcell = 0; // preamble fprintf(file, "\n.pl 500c\n.TS\n"); - for (j=0; j= 0) { - fprintf(file,"T{\n"); + fprintf(file, "T{\n"); ret++; } } else { // usual cells if (CellHasContRow(cell) >= 0) { - fprintf(file,"\nT}"); + fprintf(file, "\nT}"); ret++; } if (right_column_of_cell(cell) == columns -1){ @@ -1382,7 +1381,7 @@ int LyXTable::RoffEndOfCell(FILE* file, int cell) fprintf(file, "\t"); if ((cell < GetNumberOfCells() - 1) && (CellHasContRow(cell+1) >= 0)) { - fprintf(file,"T{\n"); + fprintf(file, "T{\n"); ret++; } } @@ -1390,7 +1389,7 @@ int LyXTable::RoffEndOfCell(FILE* file, int cell) return ret; } -const char *LyXTable::getDocBookAlign(int cell, bool isColumn) +char const *LyXTable::getDocBookAlign(int cell, bool isColumn) { int i; if (isColumn) @@ -1436,7 +1435,7 @@ const char *LyXTable::getDocBookAlign(int cell, bool isColumn) // cell <0 will tex the preamble // returns the number of printed newlines -int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth) +int LyXTable::DocBookEndOfCell(string & file, int cell, int &depth) { int i; int ret = 0; @@ -1469,14 +1468,14 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth) file += "' COLSEP='1' ROWSEP='1'>"; addNewlineAndDepth(file,++depth); ret++; - for (i=0; itop_line = row_info[row_of_cell(fvcell)].top_line; cellinfo_of_cell(fvcell)->bottom_line = row_info[row_of_cell(fvcell)].bottom_line; for (number--;number>0;number--){ - cellinfo_of_cell(fvcell+number)->multicolumn = + cellinfo_of_cell(fvcell+number)->multicolumn = LyXTable::CELL_PART_OF_MULTICOLUMN; new_width += cellinfo_of_cell(fvcell+number)->width_of_cell; } set_row_column_number_info(); - SetWidthOfCell(fvcell,new_width); + SetWidthOfCell(fvcell, new_width); } @@ -1622,7 +1621,7 @@ int LyXTable::UnsetMultiColumn(int cell) while (column < columns && cell_info[row][column].multicolumn == LyXTable::CELL_PART_OF_MULTICOLUMN){ - cell_info[row][column].multicolumn = + cell_info[row][column].multicolumn = LyXTable::CELL_NORMAL; column++; result++; @@ -1635,27 +1634,27 @@ int LyXTable::UnsetMultiColumn(int cell) void LyXTable::delete_column(int column) { - int i,j; + int i, j; columnstruct *column_info2 = new columnstruct[columns-1]; - for (i=0; i=0)) + if (!RowHasContRow(cell) || (CellHasContRow(cell)>= 0)) AppendRow(cell); row_info[row].is_cont_row = true; row_info[row].top_line = false; @@ -1787,7 +1786,7 @@ bool LyXTable::ShouldBeVeryLastCell(int cell) bool LyXTable::ShouldBeVeryLastRow(int cell) { - if (CellHasContRow(cell)>=0) + if (CellHasContRow(cell)>= 0) return false; int row = row_of_cell(cell)+1; int column = column_of_cell(cell); diff --git a/src/table.h b/src/table.h index 21f67c2112..c35b01c063 100644 --- a/src/table.h +++ b/src/table.h @@ -1,12 +1,12 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995, 1996 Matthias Ettrich * - *======================================================*/ + * ====================================================== */ #ifndef TABLE_H #define TABLE_H @@ -14,8 +14,8 @@ #pragma interface #endif -#include -#include "definitions.h" +#include + #include "lyxlex.h" #include "LString.h" @@ -116,7 +116,7 @@ public: /// bool SetPWidth(int cell, string width); /// - bool SetAlignSpecial(int cell, string special,int what); + bool SetAlignSpecial(int cell, string special, int what); /// char GetAlignment(int cell); // add approp. signedness /// @@ -166,11 +166,11 @@ public: // cell <0 will tex the preamble // returns the number of printed newlines /// - int TexEndOfCell(string& file, int cell); + int TexEndOfCell(string & file, int cell); /// int RoffEndOfCell(FILE* file, int cell); /// - const char *getDocBookAlign(int cell, bool isColumn=false); + char const *getDocBookAlign(int cell, bool isColumn= false); /// int DocBookEndOfCell(string &file, int cell, int &depth); diff --git a/src/tex-accent.C b/src/tex-accent.C index 75535215a6..12ecb90a65 100644 --- a/src/tex-accent.C +++ b/src/tex-accent.C @@ -37,9 +37,9 @@ // I am not sure how some of the XWindows names coresponds to the TeX ones. //static -tex_accent_struct lyx_accent_table[18] ={ +tex_accent_struct lyx_accent_table[18] = { { (tex_accent)0, "", "", "",(kb_action)0}, - {TEX_ACUTE, "\\'", " AEIOUYaeiouySZszRLCNrlcn","acute", LFUN_ACUTE}, + {TEX_ACUTE, "\\'", " AEIOUYaeiouySZszRLCNrlcn", "acute", LFUN_ACUTE}, {TEX_GRAVE, "\\`", " aeiouAEIOU", "grave", LFUN_GRAVE}, {TEX_MACRON, "\\=", " EeAIOUaiou", "macron", LFUN_MACRON}, {TEX_TILDE, "\\~", " ANOanoIiUu", "tilde", LFUN_TILDE}, @@ -51,7 +51,7 @@ tex_accent_struct lyx_accent_table[18] ={ {TEX_TIE, "\\t", " ", "tie", LFUN_TIE}, {TEX_BREVE, "\\u", " AaGgUu", "breve", LFUN_BREVE}, {TEX_CARON, "\\v", " LSTZlstzCEDNRcednr", "caron", LFUN_CARON}, -// {TEX_SPECIAL_CARON, "\\q", "","ooo", LFUN_SPECIAL_CARON}, +// {TEX_SPECIAL_CARON, "\\q", "", "ooo", LFUN_SPECIAL_CARON}, {TEX_HUNGUML, "\\H", " OUou", "hugarian_umlaut", LFUN_HUNG_UMLAUT}, {TEX_UMLAUT, "\\\"", " AEIOUaeiouy", "umlaut", LFUN_UMLAUT}, {TEX_DOT, "\\.", " ZzICGicgEe", "dot", LFUN_DOT}, @@ -61,8 +61,8 @@ tex_accent_struct lyx_accent_table[18] ={ 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++; @@ -72,22 +72,22 @@ tex_accent_struct get_accent(kb_action action) return temp; } -string DoAccent(const string& s,tex_accent accent) +string DoAccent(string const & s, tex_accent accent) { string res; - res+=lyx_accent_table[accent].cmd; - res+='{'; - if (s=="i" || s=="j") { - res+='\\'; + res+= lyx_accent_table[accent].cmd; + res+= '{'; + if (s == "i" || s == "j") { + res+= '\\'; } - res+=s; - res+='}'; + res+= s; + res+= '}'; return res; } -string DoAccent(char c,tex_accent accent) +string DoAccent(char c, tex_accent accent) { - return DoAccent(tostr(c),accent); + return DoAccent(tostr(c), accent); } diff --git a/src/tex-accent.h b/src/tex-accent.h index eb864d7153..94ad888744 100644 --- a/src/tex-accent.h +++ b/src/tex-accent.h @@ -73,7 +73,7 @@ enum tex_accent { /// TEX_OGONEK, /// - TEX_MAX_ACCENT=TEX_OGONEK + TEX_MAX_ACCENT= TEX_OGONEK }; diff --git a/src/tex-strings.C b/src/tex-strings.C index ae2753757c..11eb4ae9c6 100644 --- a/src/tex-strings.C +++ b/src/tex-strings.C @@ -3,44 +3,44 @@ // this file should perhaps be split into even smaller parts -char const* string_paragraph_separation[3] = { +char const * string_paragraph_separation[3] = { "indent", "skip", "" }; -char const* string_quotes_language[7] = { +char const * string_quotes_language[7] = { "english", "swedish", "german", "polish", "french", "danish", "" }; - -char const* string_oldpapersize[10] = { +#if 0 +char const * string_oldpapersize[10] = { "a4paper", "a4", "a4wide", "widemarginsa4", "usletter", - "a5paper", "b5paper", "executivepaper", "legalpaper","" + "a5paper", "b5paper", "executivepaper", "legalpaper", "" }; +#endif - -char const* string_papersize[12] = { +char const * string_papersize[12] = { "Default", "Custom", "letterpaper", "executivepaper", "legalpaper", - "a3paper","a4paper","a5paper","b3paper","b4paper","b5paper","" + "a3paper", "a4paper", "a5paper", "b3paper", "b4paper", "b5paper", "" }; -char const* string_paperpackages[4] = { +char const * string_paperpackages[4] = { "a4", "a4wide", "widemarginsa4", "" }; -char const* string_orientation[3] = { +char const * string_orientation[3] = { "portrait", "landscape", "" }; -char const* string_footnotekinds[8] = { +char const * string_footnotekinds[8] = { "footnote", "margin", "fig", "tab", "alg", "wide-fig", "wide-tab", "" }; -char const* string_align[5] = { +char const * string_align[5] = { "block", "left", "right", "center", "" }; @@ -50,14 +50,14 @@ char const* string_align[5] = { // 27 times in the object file. (Asger) /// -char const *tex_babel[] = {"default","afrikaans", "american", +char const * tex_babel[] = {"default", "afrikaans", "american", "austrian", "bahasa", "brazil", "breton", "catalan", "croatian", "czech", "danish", "dutch", "english", "esperanto", "estonian", "finnish", "francais", "french", "frenchb", "galician", "german", "greek", "hungarian", "irish", - "italian","lsorbian", "magyar", "norsk", + "italian", "lsorbian", "magyar", "norsk", "polish", "portuges", "romanian", "russian", "scottish", "spanish", "slovak", "slovene", "swedish", @@ -65,11 +65,11 @@ char const *tex_babel[] = {"default","afrikaans", "american", ""}; -char const *tex_graphics[] = {"default", "dvips", "dvitops", "emtex", +char const * tex_graphics[] = {"default", "dvips", "dvitops", "emtex", "ln", "oztex", "textures", "none", ""}; -char const *tex_fonts[] = {"default", "times", "palatino", "helvet", "avant", +char const * tex_fonts[] = {"default", "times", "palatino", "helvet", "avant", "newcent", "bookman", ""}; diff --git a/src/tex-strings.h b/src/tex-strings.h index 71755162f6..69a9ee8022 100644 --- a/src/tex-strings.h +++ b/src/tex-strings.h @@ -1,38 +1,38 @@ // -*- C++ -*- -#ifndef _TEX_STRINGS_ -#define _TEX_STRINGS_ +#ifndef TEX_STRINGS +#define TEX_STRINGS // this file should perhaps be split into even smaler parts /// -extern char const* string_paragraph_separation[]; +extern char const * string_paragraph_separation[]; /// -extern char const* string_quotes_language[]; +extern char const * string_quotes_language[]; /// -extern char const* string_oldpapersize[]; +extern char const * string_oldpapersize[]; /// -extern char const* string_papersize[]; +extern char const * string_papersize[]; /// -extern char const* string_paperpackages[]; +extern char const * string_paperpackages[]; /// -extern char const* string_orientation[]; +extern char const * string_orientation[]; /// -extern char const* string_footnotekinds[]; +extern char const * string_footnotekinds[]; /// -extern char const* string_align[]; +extern char const * string_align[]; // The following was moved from tex-defs.h to here, because tex-defs.h is // used all over. As it happens, that meant that these strings were included // 27 times in the object file. (Asger) /// -extern char const *tex_babel[]; +extern char const * tex_babel[]; /// -extern char const *tex_graphics[]; +extern char const * tex_graphics[]; /// -extern char const *tex_fonts[]; +extern char const * tex_fonts[]; #endif diff --git a/src/texoptions.C b/src/texoptions.C index 8b9acc687c..0d05813f80 100644 --- a/src/texoptions.C +++ b/src/texoptions.C @@ -1,5 +1,5 @@ /* This file is part of -* ====================================================== +* ====================================================== * * LyX, The Document Processor * @@ -9,7 +9,7 @@ * This file is Copyleft (C) 1996-1998 * Lars Gullik Bjønnes * -*======================================================*/ +* ====================================================== */ #include #include FORMS_H_LOCATION diff --git a/src/texrow.C b/src/texrow.C index 7399843df0..8b218f23ad 100644 --- a/src/texrow.C +++ b/src/texrow.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995 Matthias Ettrich * Copyright (C) 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -88,7 +88,7 @@ void TexRow::getIdFromRow(int row, int &id, int &pos) } -TexRow & TexRow::operator+=(const TexRow &tr) +TexRow & TexRow::operator+= (const TexRow &tr) { // remember that the lists are stored in reverse // so you've got to turn the second one around diff --git a/src/texrow.h b/src/texrow.h index f71bc20507..ef669d8890 100644 --- a/src/texrow.h +++ b/src/texrow.h @@ -1,6 +1,6 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * @@ -46,7 +46,7 @@ public: void getIdFromRow(int row, int &id, int &pos); /// Appends another TexRow - TexRow & operator+=(const TexRow &); + TexRow & operator+= (const TexRow &); private: /// Linked list of items diff --git a/src/text.C b/src/text.C index 217d54e459..293ad9ebac 100644 --- a/src/text.C +++ b/src/text.C @@ -1,12 +1,12 @@ /* This file is part of -* ====================================================== +* ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995 Matthias Ettrich * Copyright (C) 1995-1998 The LyX Team. * -*======================================================*/ +* ====================================================== */ #include #include @@ -43,24 +43,16 @@ extern int bibitemMaxWidth(LyXFont const &); // dnaber 1999-02-02 extern MiniBuffer * minibuffer; -#ifdef NEW_TEXT int LyXText::SingleWidth(LyXParagraph * par, LyXParagraph::size_type pos) -#else -int LyXText::SingleWidth(LyXParagraph * par, int pos) -#endif { char c = par->GetChar(pos); return SingleWidth(par, pos, c); } -#ifdef NEW_TEXT int LyXText::SingleWidth(LyXParagraph * par, LyXParagraph::size_type pos, char c) -#else -int LyXText::SingleWidth(LyXParagraph * par, int pos, char c) -#endif { LyXFont font = GetFont(par, pos); @@ -72,35 +64,35 @@ int LyXText::SingleWidth(LyXParagraph * par, int pos, char c) return 3; /* because of the representation * as vertical lines */ - } else if (c == LYX_META_FOOTNOTE || - c == LYX_META_MARGIN || - c == LYX_META_FIG || - c == LYX_META_TAB || - c == LYX_META_WIDE_FIG || - c == LYX_META_WIDE_TAB || - c == LYX_META_ALGORITHM) + } else if (c == LyXParagraph::META_FOOTNOTE || + c == LyXParagraph::META_MARGIN || + c == LyXParagraph::META_FIG || + c == LyXParagraph::META_TAB || + c == LyXParagraph::META_WIDE_FIG || + c == LyXParagraph::META_WIDE_TAB || + c == LyXParagraph::META_ALGORITHM) { string fs; switch (c) { - case LYX_META_MARGIN: + case LyXParagraph::META_MARGIN: fs = "margin"; break; - case LYX_META_FIG: + case LyXParagraph::META_FIG: fs = "fig"; break; - case LYX_META_TAB: + case LyXParagraph::META_TAB: fs = "tab"; break; - case LYX_META_ALGORITHM: + case LyXParagraph::META_ALGORITHM: fs = "alg"; break; - case LYX_META_WIDE_FIG: + case LyXParagraph::META_WIDE_FIG: fs = "wide-fig"; break; - case LYX_META_WIDE_TAB: + case LyXParagraph::META_WIDE_TAB: fs = "wide-tab"; break; - case LYX_META_FOOTNOTE: + case LyXParagraph::META_FOOTNOTE: fs = "foot"; break; } @@ -109,8 +101,8 @@ int LyXText::SingleWidth(LyXParagraph * par, int pos, char c) return font.stringWidth(fs); } - else if (c == LYX_META_INSET) { - Inset *tmpinset=par->GetInset(pos); + else if (c == LyXParagraph::META_INSET) { + Inset *tmpinset= par->GetInset(pos); if (tmpinset) return par->GetInset(pos)->Width(font); else @@ -126,11 +118,7 @@ int LyXText::SingleWidth(LyXParagraph * par, int pos, char c) /* returns the paragraph position of the last character in the * specified row */ -#ifdef NEW_TEXT LyXParagraph::size_type LyXText::RowLast(Row * row) -#else -int LyXText::RowLast(Row * row) -#endif { if (row->next == 0) return row->par->Last()-1; @@ -140,13 +128,9 @@ int LyXText::RowLast(Row * row) return row->next->pos - 1; } -#ifdef NEW_TEXT + void LyXText::Draw(Row * row, LyXParagraph::size_type & pos, LyXScreen & scr, int offset, float & x) -#else -void LyXText::Draw(Row * row, int & pos, - LyXScreen & scr, int offset, float & x) -#endif { char c = row->par->GetChar(pos); @@ -162,49 +146,49 @@ void LyXText::Draw(Row * row, int & pos, p[0].x = int(x + wid*0.375); p[0].y = int(y - 0.875*asc*0.75); p[1].x = int(x); p[1].y = int(y - 0.500*asc*0.75); p[2].x = int(x + wid*0.375); p[2].y = int(y - 0.125*asc*0.75); - scr.drawLines(::getGC(gc_new_line),p, 3); + scr.drawLines(::getGC(gc_new_line), p, 3); p[0].x = int(x); p[0].y = int(y - 0.500*asc*0.75); p[1].x = int(x + wid); p[1].y = int(y - 0.500*asc*0.75); p[2].x = int(x + wid); p[2].y = int(y - asc*0.75); - scr.drawLines(::getGC(gc_new_line),p, 3); + scr.drawLines(::getGC(gc_new_line), p, 3); return; } LyXFont font = GetFont(row->par, pos); LyXFont font2 = font; - if (c == LYX_META_FOOTNOTE || - c == LYX_META_MARGIN || - c == LYX_META_FIG || - c == LYX_META_TAB || - c == LYX_META_WIDE_FIG || - c == LYX_META_WIDE_TAB || - c == LYX_META_ALGORITHM) { + if (c == LyXParagraph::META_FOOTNOTE || + c == LyXParagraph::META_MARGIN || + c == LyXParagraph::META_FIG || + c == LyXParagraph::META_TAB || + c == LyXParagraph::META_WIDE_FIG || + c == LyXParagraph::META_WIDE_TAB || + c == LyXParagraph::META_ALGORITHM) { string fs; switch (c) { - case LYX_META_MARGIN: + case LyXParagraph::META_MARGIN: fs = "margin"; /* draw a sign at the left margin! */ scr.drawText(font, "!", 1, offset + row->baseline, (LYX_PAPER_MARGIN - font.width('!'))/2); break; - case LYX_META_FIG: + case LyXParagraph::META_FIG: fs = "fig"; break; - case LYX_META_TAB: + case LyXParagraph::META_TAB: fs = "tab"; break; - case LYX_META_ALGORITHM: + case LyXParagraph::META_ALGORITHM: fs = "alg"; break; - case LYX_META_WIDE_FIG: + case LyXParagraph::META_WIDE_FIG: fs = "wide-fig"; break; - case LYX_META_WIDE_TAB: + case LyXParagraph::META_WIDE_TAB: fs = "wide-tab"; break; - case LYX_META_FOOTNOTE: + case LyXParagraph::META_FOOTNOTE: fs = "foot"; break; } @@ -227,7 +211,7 @@ void LyXText::Draw(Row * row, int & pos, pos++; return; - } else if (c == LYX_META_INSET) { + } else if (c == LyXParagraph::META_INSET) { Inset *tmpinset = row->par->GetInset(pos); if (tmpinset) tmpinset->Draw(font, scr, offset + row->baseline, x); @@ -256,11 +240,7 @@ void LyXText::Draw(Row * row, int & pos, ++pos; #endif -#ifdef NEW_TEXT LyXParagraph::size_type last = RowLast(row); -#else - int last = RowLast(row); -#endif #if 0 // Prevent crash in the extremely unlikely event // that our array is too small @@ -289,7 +269,7 @@ void LyXText::Draw(Row * row, int & pos, // If monochrome and LaTeX mode, provide reverse background if (mono_video && font.latex() == LyXFont::ON) { - int a=font.maxAscent(), d=font.maxDescent(); + int a= font.maxAscent(), d= font.maxDescent(); #if 0 scr.fillRectangle(gc_copy, int(tmpx), offset + row->baseline-a, font.textWidth(textstring, i), a+d); @@ -470,7 +450,7 @@ int LyXText::LeftMargin(Row * row) } break; } - if (row->par->pextra_type == PEXTRA_INDENT) { + if (row->par->pextra_type == LyXParagraph::PEXTRA_INDENT) { if (!row->par->pextra_widthp.empty()) { x += paperwidth * atoi(row->par->pextra_widthp.c_str()) / 100; } else if (!row->par->pextra_width.empty()) { @@ -503,10 +483,10 @@ int LyXText::LeftMargin(Row * row) && align == LYX_ALIGN_BLOCK && !row->par->noindent && (row->par->layout || - parameters->paragraph_separation == LYX_PARSEP_INDENT)) + parameters->paragraph_separation == BufferParams::PARSEP_INDENT)) x += textclasslist.TextClass(parameters->textclass).defaultfont().stringWidth(parindent); else - if (layout.labeltype==LABEL_BIBLIO) { // ale970405 Right width for bibitems + if (layout.labeltype == LABEL_BIBLIO) { // ale970405 Right width for bibitems x += bibitemMaxWidth(textclasslist.TextClass(parameters->textclass).defaultfont()); } } @@ -589,19 +569,11 @@ int LyXText::LabelEnd (Row * row) /* table stuff -- begin*/ -#ifdef NEW_TEXT int LyXText::NumberOfCell(LyXParagraph * par, LyXParagraph::size_type pos) -#else -int LyXText::NumberOfCell(LyXParagraph * par, int pos) -#endif { int cell = 0; -#ifdef NEW_TEXT LyXParagraph::size_type tmp_pos = 0; -#else - int tmp_pos = 0; -#endif while (tmp_pos < pos) { if (par->IsNewline(tmp_pos)) cell++; @@ -610,11 +582,8 @@ int LyXText::NumberOfCell(LyXParagraph * par, int pos) return cell; } -#ifdef NEW_TEXT + int LyXText::WidthOfCell(LyXParagraph * par, LyXParagraph::size_type & pos) -#else -int LyXText::WidthOfCell(LyXParagraph * par, int & pos) -#endif { int w = 0; while (pos < par->Last() && !par->IsNewline(pos)) { @@ -649,43 +618,25 @@ bool LyXText::MouseHitInTable(int x, long y) /* get the next breakpoint in a given paragraph */ -#ifdef NEW_TEXT LyXParagraph::size_type LyXText::NextBreakPoint(Row * row, int width) -#else -int LyXText::NextBreakPoint(Row * row, int width) -#endif { int x = 0; -#ifdef NEW_TEXT LyXParagraph::size_type last_separator = -1; /* position of the last possible breakpoint * -1 isn't a suitable value, but a flag */ -#else - int last_separator = -1; /* position of the last possible breakpoint - * -1 isn't a suitable value, but a flag */ -#endif int left_margin; LyXParagraph * par = row->par; -#ifdef NEW_TEXT LyXParagraph::size_type i = 0; LyXParagraph::size_type pos = row->pos; -#else - int i = 0; - int pos = row->pos; -#endif /* table stuff -- begin*/ if (par->table) { -#ifdef NEW_TEXT while (pos < par->size() -#else - while (poslast -#endif && (!par->IsNewline(pos) || !par->table->IsFirstCell(NumberOfCell(par, pos+1)))) { - if (par->GetChar(pos) == LYX_META_INSET && + if (par->GetChar(pos) == LyXParagraph::META_INSET && par->GetInset(pos) && par->GetInset(pos)->Display()){ par->GetInset(pos)->SetDisplay(false); } @@ -697,12 +648,8 @@ int LyXText::NextBreakPoint(Row * row, int width) left_margin = LabelEnd(row); width -= RightMargin(row); -#ifdef NEW_TEXT - LyXParagraph::size_type main_body = + LyXParagraph::size_type main_body = BeginningOfMainBody(par); -#else - int main_body = BeginningOfMainBody(par); -#endif LyXLayout const & layout = textclasslist.Style(parameters->textclass, par->GetLayout()); i = pos; char c; @@ -714,7 +661,7 @@ int LyXText::NextBreakPoint(Row * row, int width) last_separator = i; i = par->Last() - 1;/* this means break */ x = width; - } else if (par->GetChar(i) == LYX_META_INSET && + } else if (par->GetChar(i) == LyXParagraph::META_INSET && par->GetInset(i) && par->GetInset(i)->Display()){ par->GetInset(i)->SetDisplay(false); } @@ -722,12 +669,8 @@ int LyXText::NextBreakPoint(Row * row, int width) } } else { // Last position is an invariant -#ifdef NEW_TEXT - LyXParagraph::size_type const last = + LyXParagraph::size_type const last = par->Last(); -#else - int const last = par->Last(); -#endif /* this is the usual handling */ x = LeftMargin(row); while (x < width && i < last) { @@ -735,7 +678,7 @@ int LyXText::NextBreakPoint(Row * row, int width) if (IsNewlineChar(c)) { last_separator = i; x = width; /* this means break */ - } else if (c == LYX_META_INSET && + } else if (c == LyXParagraph::META_INSET && par->GetInset(i) && par->GetInset(i)->Display()){ /* check wether a Display() inset is valid here . if not, change it to non-display*/ @@ -747,7 +690,7 @@ int LyXText::NextBreakPoint(Row * row, int width) x += SingleWidth(par, i, c); } else { /* inset is display. So break the line here */ - if (i==pos){ + if (i == pos){ if (pos < last-1) { last_separator = i; if (IsLineSeparatorChar(par->GetChar(i+1))) @@ -796,20 +739,12 @@ int LyXText::Fill(Row * row, int paperwidth) { int w, fill; /* get the pure distance */ -#ifdef NEW_TEXT LyXParagraph::size_type last = RowLast(row); -#else - int last = RowLast(row); -#endif /* table stuff -- begin*/ if (row->par->table) { /* for tables FILL does calculate the widthes of each cell in * the row */ -#ifdef NEW_TEXT LyXParagraph::size_type pos = row->pos; -#else - int pos = row->pos; -#endif int cell = NumberOfCell(row->par, pos); w = 0; do { @@ -850,16 +785,10 @@ int LyXText::Fill(Row * row, int paperwidth) LyXLayout const & layout = textclasslist.Style(parameters->textclass, row->par->GetLayout()); -#ifdef NEW_TEXT - LyXParagraph::size_type main_body = + LyXParagraph::size_type main_body = BeginningOfMainBody(row->par); LyXParagraph::size_type i = row->pos; while (i <= last) { -#else - int main_body = BeginningOfMainBody(row->par); - int i = row->pos; - while (i <= last) { -#endif w += SingleWidth(row->par, i); ++i; if (i == main_body) { @@ -880,11 +809,7 @@ int LyXText::Fill(Row * row, int paperwidth) int LyXText::LabelFill(Row * row) { -#ifdef NEW_TEXT LyXParagraph::size_type last = BeginningOfMainBody(row->par) - 1; -#else - int last = BeginningOfMainBody(row->par) - 1; -#endif /* -1 because a label ends either with a space that is in the label, * or with the beginning of a footnote that is outside the label. */ @@ -965,34 +890,21 @@ int LyXText::NumberOfHfills(Row * row) /* like NumberOfHfills, but only those in the manual label! */ int LyXText::NumberOfLabelHfills(Row * row) { -#ifdef NEW_TEXT LyXParagraph::size_type last = RowLast(row); LyXParagraph::size_type first = row->pos; -#else - int last = RowLast(row); - int first = row->pos; -#endif if (first) { /* hfill *DO* count at the beginning * of paragraphs! */ while(first < last && row->par->IsHfill(first)) first++; } -#ifdef NEW_TEXT - LyXParagraph::size_type main_body = + LyXParagraph::size_type main_body = BeginningOfMainBody(row->par); -#else - int main_body = BeginningOfMainBody(row->par); -#endif if (last > main_body) last = main_body; int n = 0; -#ifdef NEW_TEXT for (LyXParagraph::size_type p = first; p < last; ++p) { // last, because the end is ignored! -#else - for (int p = first; p < last; p++) { // last, because the end is ignored! -#endif if (row->par->IsHfill(p)) { ++n; } @@ -1003,12 +915,8 @@ int LyXText::NumberOfLabelHfills(Row * row) /* returns true, if a expansion is needed. * Rules are given by LaTeX */ -#ifdef NEW_TEXT bool LyXText::HfillExpansion(Row * row_ptr, LyXParagraph::size_type pos) -#else -bool LyXText::HfillExpansion(Row * row_ptr, int pos) -#endif { /* by the way, is it a hfill? */ if (!row_ptr->par->IsHfill(pos)) @@ -1031,11 +939,7 @@ bool LyXText::HfillExpansion(Row * row_ptr, int pos) /* if there is anything between the first char of the row and * the sepcified position that is not a newline and not a hfill, * the hfill will count, otherwise not */ -#ifdef NEW_TEXT LyXParagraph::size_type i = row_ptr->pos; -#else - int i = row_ptr->pos; -#endif while (i < pos && (row_ptr->par->IsNewline(i) || row_ptr->par->IsHfill(i))) i++; @@ -1092,7 +996,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) // Check if any insets are larger for (pos = row_ptr->pos; pos <= pos_end; pos++) { - if (row_ptr->par->GetChar(pos) == LYX_META_INSET) { + if (row_ptr->par->GetChar(pos) == LyXParagraph::META_INSET) { tmpfont = GetFont(row_ptr->par, pos); tmpinset = row_ptr->par->GetInset(pos); if (tmpinset) { @@ -1125,7 +1029,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) if (row_ptr->par->table){ // stretch the rows a bit maxasc += 1; - maxdesc +=1; + maxdesc += 1; } /* table stuff -- end*/ @@ -1140,7 +1044,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) && row_ptr->par == firstpar) { /* some parksips VERY EASY IMPLEMENTATION */ - if (parameters->paragraph_separation == LYX_PARSEP_SKIP) { + if (parameters->paragraph_separation == BufferParams::PARSEP_SKIP) { if (layout.isParagraph() && firstpar->GetDepth() == 0 && firstpar->Previous()) @@ -1173,7 +1077,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) /* this is special code for the chapter, since the label of this * layout is printed in an extra row */ if (layout.labeltype == LABEL_COUNTER_CHAPTER - && parameters->secnumdepth>=0) { + && parameters->secnumdepth>= 0) { labeladdon = int(labelfont.maxDescent() * layout.spacing.getValue() * parameters->spacing.getValue()) @@ -1216,7 +1120,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) tmptop = layout.topsep; if (row_ptr->previous->par->GetDepth() >= row_ptr->par->GetDepth()) - tmptop-=textclasslist.Style(parameters->textclass, row_ptr->previous->par->GetLayout()).bottomsep; + tmptop-= textclasslist.Style(parameters->textclass, row_ptr->previous->par->GetLayout()).bottomsep; if (tmptop > 0) layoutasc = (tmptop * DefaultHeight()); @@ -1278,7 +1182,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) if (comparepar->GetDepth() > nextpar->GetDepth()) { usual = (textclasslist.Style(parameters->textclass, comparepar->GetLayout()).bottomsep * DefaultHeight()); comparepar = comparepar->DepthHook(nextpar->GetDepth()); - if (comparepar->GetLayout()!=nextpar->GetLayout() + if (comparepar->GetLayout()!= nextpar->GetLayout() || nextpar->GetLabelWidthString() != comparepar->GetLabelWidthString()) unusual = (textclasslist.Style(parameters->textclass, comparepar->GetLayout()).bottomsep * DefaultHeight()); @@ -1291,7 +1195,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) else if (comparepar->GetDepth() == nextpar->GetDepth()) { if (comparepar->GetLayout()!= nextpar->GetLayout() - || nextpar->GetLabelWidthString() != + || nextpar->GetLabelWidthString() != comparepar->GetLabelWidthString()) layoutdesc = int(textclasslist.Style(parameters->textclass, comparepar->GetLayout()).bottomsep * DefaultHeight()); } @@ -1312,8 +1216,8 @@ void LyXText::SetHeightOfRow(Row * row_ptr) /* calculate the new height of the text */ height -= row_ptr->height; - row_ptr->height=maxasc+maxdesc+labeladdon; - row_ptr->baseline=maxasc+labeladdon; + row_ptr->height= maxasc+maxdesc+labeladdon; + row_ptr->baseline= maxasc+labeladdon; height += row_ptr->height; } @@ -1359,12 +1263,8 @@ void LyXText::BreakAgain(Row * row) do { /* get the next breakpoint */ -#ifdef NEW_TEXT - LyXParagraph::size_type z = + LyXParagraph::size_type z = NextBreakPoint(row, paperwidth); -#else - int z = NextBreakPoint(row, paperwidth); -#endif Row * tmprow = row; if (z < row->par->Last() ) { @@ -1408,11 +1308,7 @@ void LyXText::BreakAgain(Row * row) void LyXText::BreakAgainOneRow(Row * row) { /* get the next breakpoint */ -#ifdef NEW_TEXT LyXParagraph::size_type z = NextBreakPoint(row, paperwidth); -#else - int z = NextBreakPoint(row, paperwidth); -#endif Row * tmprow = row; if (z < row->par->Last() ) { @@ -1424,7 +1320,7 @@ void LyXText::BreakAgainOneRow(Row * row) row->height = 0; } else { - row=row->next; + row= row->next; z++; if (row->pos != z) row->pos = z; @@ -1457,11 +1353,7 @@ void LyXText::BreakParagraph(char keep_layout) /* table stuff -- begin*/ if (cursor.par->table) { // breaking of tables is only allowed at the beginning or the end */ -#ifdef NEW_TEXT if (cursor.pos && cursor.pos < cursor.par->size() && -#else - if (cursor.pos && cursor.pos < cursor.par->last && -#endif !cursor.par->table->ShouldBeVeryLastCell(NumberOfCell(cursor.par, cursor.pos))) return; /* no breaking of tables allowed */ } @@ -1470,7 +1362,7 @@ void LyXText::BreakParagraph(char keep_layout) /* this is only allowed, if the current paragraph is not empty or caption*/ if ((cursor.par->Last() <= 0 && !cursor.par->IsDummy()) && - layout.labeltype!=LABEL_SENSITIVE) + layout.labeltype!= LABEL_SENSITIVE) return; SetUndo(Undo::INSERT, @@ -1481,11 +1373,7 @@ void LyXText::BreakParagraph(char keep_layout) if (cursor.par->table) { int cell = NumberOfCell(cursor.par, cursor.pos); if (cursor.par->table->ShouldBeVeryLastCell(cell)) -#ifdef NEW_TEXT SetCursor(cursor.par, cursor.par->text.size()); -#else - SetCursor(cursor.par, cursor.par->last); -#endif } /* table stuff -- end*/ /* please break alway behind a space */ @@ -1584,14 +1472,10 @@ void LyXText::OpenFootnote() /* ok, move the cursor right before the footnote */ /* just a little faster than using CursorRight() */ - for (cursor.pos=0; cursor.par->ParFromPos(cursor.pos)!=par; cursor.pos++); + for (cursor.pos= 0; cursor.par->ParFromPos(cursor.pos)!= par; cursor.pos++); /* now the cursor is at the beginning of the physical par */ -#ifdef NEW_TEXT SetCursor(cursor.par, cursor.pos + cursor.par->ParFromPos(cursor.pos)->text.size()); -#else - SetCursor(cursor.par, cursor.pos + cursor.par->ParFromPos(cursor.pos)->last); -#endif /* the cursor must be exactly before the footnote */ par = cursor.par->ParFromPos(cursor.pos); @@ -1638,11 +1522,11 @@ void LyXText::TableFeatures(int feature, string val) switch (feature){ case LyXTable::SET_PWIDTH: - cursor.par->table->SetPWidth(actCell,val); + cursor.par->table->SetPWidth(actCell, val); break; case LyXTable::SET_SPECIAL_COLUMN: case LyXTable::SET_SPECIAL_MULTI: - cursor.par->table->SetAlignSpecial(actCell,val,feature); + cursor.par->table->SetAlignSpecial(actCell, val, feature); break; default: break; @@ -1668,25 +1552,22 @@ void LyXText::TableFeatures(int feature) switch (feature){ case LyXTable::ALIGN_LEFT: - setAlign=LYX_ALIGN_LEFT; + setAlign= LYX_ALIGN_LEFT; break; case LyXTable::ALIGN_RIGHT: - setAlign=LYX_ALIGN_RIGHT; + setAlign= LYX_ALIGN_RIGHT; break; case LyXTable::ALIGN_CENTER: - setAlign=LYX_ALIGN_CENTER; + setAlign= LYX_ALIGN_CENTER; break; default: break; } switch (feature){ case LyXTable::APPEND_ROW: { -#ifdef NEW_TEXT LyXParagraph::size_type pos = cursor.pos; -#else - int pos = cursor.pos; -#endif - /* move to the next row */ + + /* move to the next row */ int cell_org = actCell; int cell = cell_org; @@ -1728,7 +1609,7 @@ void LyXText::TableFeatures(int feature) /* insert the new cells */ int number = cursor.par->table->NumberOfCellsInRow(cell_org); for (int i = 0; i < number; ++i) - cursor.par->InsertChar(pos, LYX_META_NEWLINE); + cursor.par->InsertChar(pos, LyXParagraph::META_NEWLINE); /* append the row into the table */ cursor.par->table->AppendRow(cell_org); @@ -1736,11 +1617,7 @@ void LyXText::TableFeatures(int feature) return; } case LyXTable::APPEND_CONT_ROW: { -#ifdef NEW_TEXT LyXParagraph::size_type pos = cursor.pos; -#else - int pos = cursor.pos; -#endif /* move to the next row */ int cell_org = actCell; int cell = cell_org; @@ -1767,8 +1644,8 @@ void LyXText::TableFeatures(int feature) /* insert the new cells */ int number = cursor.par->table->NumberOfCellsInRow(cell_org); int i; - for (i=0; iInsertChar(pos, LYX_META_NEWLINE); + for (i= 0; iInsertChar(pos, LyXParagraph::META_NEWLINE); /* append the row into the table */ cursor.par->table->AppendContRow(cell_org); @@ -1776,17 +1653,13 @@ void LyXText::TableFeatures(int feature) return; } case LyXTable::APPEND_COLUMN: { -#ifdef NEW_TEXT LyXParagraph::size_type pos = 0; -#else - int pos = 0; -#endif int cell_org = actCell; int cell = 0; do{ if (pos && (cursor.par->IsNewline(pos-1))){ if (cursor.par->table->AppendCellAfterCell(cell_org, cell)){ - cursor.par->InsertChar(pos, LYX_META_NEWLINE); + cursor.par->InsertChar(pos, LyXParagraph::META_NEWLINE); if (pos <= cursor.pos) cursor.pos++; ++pos; @@ -1798,7 +1671,7 @@ void LyXText::TableFeatures(int feature) /* remember that the very last cell doesn't end with a newline. This saves one byte memory per table ;-) */ if (cursor.par->table->AppendCellAfterCell(cell_org, cell)) - cursor.par->InsertChar(cursor.par->Last(), LYX_META_NEWLINE); + cursor.par->InsertChar(cursor.par->Last(), LyXParagraph::META_NEWLINE); /* append the column into the table */ cursor.par->table->AppendColumn(cell_org); @@ -1814,11 +1687,7 @@ void LyXText::TableFeatures(int feature) return; case LyXTable::DELETE_COLUMN: { -#ifdef NEW_TEXT LyXParagraph::size_type pos = 0; -#else - int pos = 0; -#endif int cell_org = actCell; int cell = 0; if (current_view->buffer()->the_locking_inset) @@ -1851,14 +1720,10 @@ void LyXText::TableFeatures(int feature) case LyXTable::TOGGLE_LINE_TOP: lineSet = !cursor.par->table->TopLine(actCell); if (!selection){ - cursor.par->table->SetTopLine(actCell,lineSet); + cursor.par->table->SetTopLine(actCell, lineSet); } else { -#ifdef NEW_TEXT LyXParagraph::size_type i; int n = -1, m = -2; -#else - int i,n=-1,m=-2; -#endif for (i = sel_start_cursor.pos; i <= sel_end_cursor.pos; ++i){ if ((n = NumberOfCell(sel_start_cursor.par, i)) != m) { cursor.par->table->SetTopLine(n, lineSet); @@ -1872,14 +1737,10 @@ void LyXText::TableFeatures(int feature) case LyXTable::TOGGLE_LINE_BOTTOM: lineSet = !cursor.par->table->BottomLine(actCell); if (!selection){ - cursor.par->table->SetBottomLine(actCell,lineSet); + cursor.par->table->SetBottomLine(actCell, lineSet); } else { -#ifdef NEW_TEXT LyXParagraph::size_type i; int n = -1, m = -2; -#else - int i, n = -1, m = -2; -#endif for (i = sel_start_cursor.pos; i <= sel_end_cursor.pos; ++i) { if ((n = NumberOfCell(sel_start_cursor.par, i)) != m) { cursor.par->table->SetBottomLine(n, lineSet); @@ -1893,17 +1754,13 @@ void LyXText::TableFeatures(int feature) case LyXTable::TOGGLE_LINE_LEFT: lineSet = !cursor.par->table->LeftLine(actCell); if (!selection){ - cursor.par->table->SetLeftLine(actCell,lineSet); + cursor.par->table->SetLeftLine(actCell, lineSet); } else { -#ifdef NEW_TEXT LyXParagraph::size_type i; int n = -1, m = -2; -#else - int i,n=-1,m=-2; -#endif for (i = sel_start_cursor.pos; i <= sel_end_cursor.pos; ++i){ - if ((n=NumberOfCell(sel_start_cursor.par,i)) != m) { - cursor.par->table->SetLeftLine(n,lineSet); + if ((n= NumberOfCell(sel_start_cursor.par, i)) != m) { + cursor.par->table->SetLeftLine(n, lineSet); m = n; } } @@ -1914,17 +1771,13 @@ void LyXText::TableFeatures(int feature) case LyXTable::TOGGLE_LINE_RIGHT: lineSet = !cursor.par->table->RightLine(actCell); if (!selection){ - cursor.par->table->SetRightLine(actCell,lineSet); + cursor.par->table->SetRightLine(actCell, lineSet); } else { -#ifdef NEW_TEXT LyXParagraph::size_type i; int n = -1, m = -2; -#else - int i,n=-1,m=-2; -#endif - for (i=sel_start_cursor.pos; i<=sel_end_cursor.pos; i++){ - if ((n=NumberOfCell(sel_start_cursor.par,i)) != m) { - cursor.par->table->SetRightLine(n,lineSet); + for (i= sel_start_cursor.pos; i<= sel_end_cursor.pos; i++){ + if ((n= NumberOfCell(sel_start_cursor.par, i)) != m) { + cursor.par->table->SetRightLine(n, lineSet); m = n; } } @@ -1936,17 +1789,13 @@ void LyXText::TableFeatures(int feature) case LyXTable::ALIGN_RIGHT: case LyXTable::ALIGN_CENTER: if (!selection){ - cursor.par->table->SetAlignment(actCell,setAlign); + cursor.par->table->SetAlignment(actCell, setAlign); } else { -#ifdef NEW_TEXT LyXParagraph::size_type i; int n = -1, m = -2; -#else - int i,n=-1,m=-2; -#endif - for (i=sel_start_cursor.pos; i<=sel_end_cursor.pos; i++){ - if ((n=NumberOfCell(sel_start_cursor.par,i)) != m) { - cursor.par->table->SetAlignment(n,setAlign); + for (i= sel_start_cursor.pos; i<= sel_end_cursor.pos; i++){ + if ((n= NumberOfCell(sel_start_cursor.par, i)) != m) { + cursor.par->table->SetAlignment(n, setAlign); m = n; } } @@ -1961,12 +1810,8 @@ void LyXText::TableFeatures(int feature) // temporary: Should put table in simple_cut_buffer (with before and after // dummy-paragraph !! // not necessar anymore with UNDO :) -#ifdef NEW_TEXT - for (LyXParagraph::size_type i = + for (LyXParagraph::size_type i = cursor.par->text.size() - 1; i >= 0; --i) -#else - for (int i = cursor.par->last-1; i>=0; i--) -#endif cursor.par->Erase(i); RedoParagraph(); return; @@ -1982,15 +1827,11 @@ void LyXText::TableFeatures(int feature) if (multicol){ int newlines = cursor.par->table->UnsetMultiColumn(actCell); -#ifdef NEW_TEXT LyXParagraph::size_type pos = cursor.pos; -#else - int pos = cursor.pos; -#endif while (pos < cursor.par->Last() && !cursor.par->IsNewline(pos)) pos++; for (;newlines;newlines--) - cursor.par->InsertChar(pos, LYX_META_NEWLINE); + cursor.par->InsertChar(pos, LyXParagraph::META_NEWLINE); RedoParagraph(); return; } @@ -2005,11 +1846,7 @@ void LyXText::TableFeatures(int feature) } else { if (sel_start_cursor.row == sel_end_cursor.row){ -#ifdef NEW_TEXT LyXParagraph::size_type i; -#else - int i; -#endif number = 1; for (i = sel_start_cursor.pos; i < sel_end_cursor.pos; ++i){ @@ -2053,15 +1890,11 @@ void LyXText::TableFeatures(int feature) cursor.pos), setLines); } else { -#ifdef NEW_TEXT LyXParagraph::size_type i; int n = -1, m = -2; -#else - int i,n=-1,m=-2; -#endif for (i = sel_start_cursor.pos; i <= sel_end_cursor.pos; ++i) { - if ((n=NumberOfCell(sel_start_cursor.par,i)) != m) { - cursor.par->table->SetAllLines(n,setLines); + if ((n= NumberOfCell(sel_start_cursor.par, i)) != m) { + cursor.par->table->SetAllLines(n, setLines); m = n; } } @@ -2082,17 +1915,13 @@ void LyXText::TableFeatures(int feature) return; case LyXTable::SET_ROTATE_CELL: if (!selection){ - cursor.par->table->SetRotateCell(actCell,true); + cursor.par->table->SetRotateCell(actCell, true); } else { -#ifdef NEW_TEXT LyXParagraph::size_type i; int n = -1, m = -2; -#else - int i,n=-1,m=-2; -#endif for (i = sel_start_cursor.pos; i <= sel_end_cursor.pos; ++i){ - if ((n = NumberOfCell(sel_start_cursor.par,i)) != m) { - cursor.par->table->SetRotateCell(n,true); + if ((n = NumberOfCell(sel_start_cursor.par, i)) != m) { + cursor.par->table->SetRotateCell(n, true); m = n; } } @@ -2100,17 +1929,13 @@ void LyXText::TableFeatures(int feature) return; case LyXTable::UNSET_ROTATE_CELL: if (!selection){ - cursor.par->table->SetRotateCell(actCell,false); + cursor.par->table->SetRotateCell(actCell, false); } else { -#ifdef NEW_TEXT LyXParagraph::size_type i; int n = -1, m = -2; -#else - int i, n = -1, m = -2; -#endif - for (i=sel_start_cursor.pos; i<=sel_end_cursor.pos; i++){ - if ((n=NumberOfCell(sel_start_cursor.par,i)) != m) { - cursor.par->table->SetRotateCell(n,false); + for (i= sel_start_cursor.pos; i<= sel_end_cursor.pos; i++){ + if ((n= NumberOfCell(sel_start_cursor.par, i)) != m) { + cursor.par->table->SetRotateCell(n, false); m = n; } } @@ -2119,37 +1944,33 @@ void LyXText::TableFeatures(int feature) case LyXTable::SET_LINEBREAKS: what = !cursor.par->table->Linebreaks(cursor.par->table->FirstVirtualCell(actCell)); if (!selection){ - cursor.par->table->SetLinebreaks(actCell,what); + cursor.par->table->SetLinebreaks(actCell, what); } else { -#ifdef NEW_TEXT LyXParagraph::size_type i; int n = -1, m = -2; -#else - int i, n = -1, m = -2; -#endif for (i = sel_start_cursor.pos; i <= sel_end_cursor.pos; ++i) { - if ((n = NumberOfCell(sel_start_cursor.par,i)) != m) { - cursor.par->table->SetLinebreaks(n,what); + if ((n = NumberOfCell(sel_start_cursor.par, i)) != m) { + cursor.par->table->SetLinebreaks(n, what); m = n; } } } return; case LyXTable::SET_LTFIRSTHEAD: - cursor.par->table->SetLTHead(actCell,true); + cursor.par->table->SetLTHead(actCell, true); return; case LyXTable::SET_LTHEAD: - cursor.par->table->SetLTHead(actCell,false); + cursor.par->table->SetLTHead(actCell, false); return; case LyXTable::SET_LTFOOT: - cursor.par->table->SetLTFoot(actCell,false); + cursor.par->table->SetLTFoot(actCell, false); return; case LyXTable::SET_LTLASTFOOT: - cursor.par->table->SetLTFoot(actCell,true); + cursor.par->table->SetLTFoot(actCell, true); return; case LyXTable::SET_LTNEWPAGE: what = !cursor.par->table->LTNewPage(actCell); - cursor.par->table->SetLTNewPage(actCell,what); + cursor.par->table->SetLTNewPage(actCell, what); return; } } @@ -2176,12 +1997,8 @@ void LyXText::InsertCharInTable(char c) * current font */ // Get the font that is used to calculate the baselineskip -#ifdef NEW_TEXT - LyXParagraph::size_type const lastpos = + LyXParagraph::size_type const lastpos = cursor.par->Last(); -#else - int const lastpos = cursor.par->Last(); -#endif LyXFont rawparfont = cursor.par->GetFontSettings(lastpos - 1); jumped_over_space = false; @@ -2214,7 +2031,7 @@ void LyXText::InsertCharInTable(char c) row = cursor.row; y = cursor.y - row->baseline; - if (c != LYX_META_INSET) /* in this case LyXText::InsertInset + if (c != LyXParagraph::META_INSET) /* in this case LyXText::InsertInset * already inserted the character */ cursor.par->InsertChar(cursor.pos, c); SetCharFont(cursor.par, cursor.pos, rawtmpfont); @@ -2241,15 +2058,12 @@ void LyXText::InsertCharInTable(char c) RedoHeightOfParagraph(cursor); } -#ifdef NEW_TEXT + void LyXText::CheckParagraphInTable(LyXParagraph * par, LyXParagraph::size_type pos) -#else -void LyXText::CheckParagraphInTable(LyXParagraph * par, int pos) -#endif { - if (par->GetChar(pos) == LYX_META_INSET && + if (par->GetChar(pos) == LyXParagraph::META_INSET && par->GetInset(pos) && par->GetInset(pos)->Display()){ par->GetInset(pos)->SetDisplay(false); } @@ -2260,11 +2074,7 @@ void LyXText::CheckParagraphInTable(LyXParagraph * par, int pos) int tmpheight = row->height; SetHeightOfRow(row); -#ifdef NEW_TEXT LyXParagraph::size_type tmp_pos = pos; -#else - int tmp_pos = pos; -#endif /* update the table information */ while (tmp_pos && !par->IsNewline(tmp_pos - 1)) tmp_pos--; @@ -2322,7 +2132,7 @@ void LyXText::BackspaceInTable() CursorLeftIntern(); /* some insets are undeletable here */ - if (cursor.par->GetChar(cursor.pos)==LYX_META_INSET) { + if (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET) { if (!cursor.par->GetInset(cursor.pos)->Deletable()) return; } @@ -2404,13 +2214,8 @@ void LyXText::InsertChar(char c) bool jumped_over_space; LyXFont realtmpfont; LyXFont rawtmpfont; -#ifdef NEW_TEXT LyXParagraph::size_type z; LyXParagraph::size_type lastpos; -#else - int z; - int lastpos; -#endif LyXFont rawparfont; SetUndo(Undo::INSERT, @@ -2419,13 +2224,13 @@ void LyXText::InsertChar(char c) /* When the free-spacing option is set for the current layout, * all spaces are converted to protected spaces. */ - bool freeSpacingBo = + bool freeSpacingBo = textclasslist.Style(parameters->textclass, cursor.row->par->GetLayout()).free_spacing; if (freeSpacingBo && IsLineSeparatorChar(c) && (!cursor.pos || cursor.par->IsLineSeparator(cursor.pos-1))) - c = LYX_META_PROTECTED_SEPARATOR; + c = LyXParagraph::META_PROTECTED_SEPARATOR; /* table stuff -- begin*/ if (cursor.par->table) { @@ -2508,7 +2313,7 @@ void LyXText::InsertChar(char c) } /* the display inset stuff */ - if (cursor.row->par->GetChar(cursor.row->pos) == LYX_META_INSET + if (cursor.row->par->GetChar(cursor.row->pos) == LyXParagraph::META_INSET && cursor.row->par->GetInset(cursor.row->pos) && cursor.row->par->GetInset(cursor.row->pos)->Display()) cursor.row->fill = -1; // to force a new break @@ -2520,7 +2325,7 @@ void LyXText::InsertChar(char c) /* ok, heres a better way: */ row = cursor.row; y = cursor.y - row->baseline; - if (c != LYX_META_INSET) /* in this case LyXText::InsertInset + if (c != LyXParagraph::META_INSET) /* in this case LyXText::InsertInset * already insertet the character */ cursor.par->InsertChar(cursor.pos, c); SetCharFont(cursor.par, cursor.pos, rawtmpfont); @@ -2696,7 +2501,7 @@ void LyXText::PrepareToPrint(Row * row, float & x, float & fill_separator, align = row->par->FirstPhysicalPar()->align; /* center displayed insets */ - if (row->par->GetChar(row->pos) == LYX_META_INSET + if (row->par->GetChar(row->pos) == LyXParagraph::META_INSET && row->par->GetInset(row->pos) && row->par->GetInset(row->pos)->Display()) align = LYX_ALIGN_CENTER; @@ -2706,7 +2511,7 @@ void LyXText::PrepareToPrint(Row * row, float & x, float & fill_separator, ns = NumberOfSeparators(row); if (ns && row->next && row->next->par == row->par && !(row->next->par->IsNewline(row->next->pos-1)) - && !(row->next->par->GetChar(row->next->pos) == LYX_META_INSET + && !(row->next->par->GetChar(row->next->pos) == LyXParagraph::META_INSET && row->next->par->GetInset(row->next->pos) && row->next->par->GetInset(row->next->pos)->Display()) ) @@ -2747,7 +2552,7 @@ void LyXText::CursorRightOneWord() while ( tmpcursor.pos < tmpcursor.par->Last() && ! tmpcursor.par->IsWord( tmpcursor.pos ) ) { - // printf("Current pos1 %d",tmpcursor.pos) ; + // printf("Current pos1 %d", tmpcursor.pos) ; tmpcursor.pos++; steps++; } @@ -2755,7 +2560,7 @@ void LyXText::CursorRightOneWord() while ( tmpcursor.pos < tmpcursor.par->Last() && tmpcursor.par->IsWord( tmpcursor.pos ) ) { - // printf("Current pos2 %d",tmpcursor.pos) ; + // printf("Current pos2 %d", tmpcursor.pos) ; tmpcursor.pos++; steps++; } @@ -2934,9 +2739,9 @@ char * LyXText::SelectNextWord(float & value) (optional hyphens are part of a word) */ while (cursor.pos < cursor.par->Last() && (cursor.par->IsLetter(cursor.pos)) - || (cursor.par->GetChar(cursor.pos) == LYX_META_INSET && + || (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET && cursor.par->GetInset(cursor.pos) != 0 && - cursor.par->GetInset(cursor.pos)->Latex(latex,0)==0 && + cursor.par->GetInset(cursor.pos)->Latex(latex, 0) == 0 && latex == "\\-")) cursor.pos++; @@ -2945,13 +2750,9 @@ char * LyXText::SelectNextWord(float & value) if (sel_cursor.pos < cursor.pos) { str = new char [cursor.pos - sel_cursor.pos + 2]; -#ifdef NEW_TEXT LyXParagraph::size_type i, j; -#else - int i,j; -#endif for (i = sel_cursor.pos, j = 0; i < cursor.pos; ++i) { - if (cursor.par->GetChar(i) != LYX_META_INSET) + if (cursor.par->GetChar(i) != LyXParagraph::META_INSET) str[j++] = cursor.par->GetChar(i); } str[j] = '\0'; @@ -2974,9 +2775,9 @@ void LyXText::SelectSelectedWord() /* now find the end of the word */ while (cursor.pos < cursor.par->Last() && (cursor.par->IsLetter(cursor.pos) - || (cursor.par->GetChar(cursor.pos) == LYX_META_INSET && + || (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET && cursor.par->GetInset(cursor.pos) != 0 && - cursor.par->GetInset(cursor.pos)->Latex(latex,0)==0 && + cursor.par->GetInset(cursor.pos)->Latex(latex, 0) == 0 && latex == "\\-"))) cursor.pos++; @@ -3068,18 +2869,13 @@ void LyXText::ChangeWordCase(LyXText::TextCase action) SetUndo(Undo::FINISH, tmppar->previous, tmppar->next); -#ifdef NEW_TEXT - LyXParagraph::size_type tmppos = + LyXParagraph::size_type tmppos = cursor.par->PositionInParFromPos(cursor.pos); while (tmppos < tmppar->size()) { -#else - int tmppos = cursor.par->PositionInParFromPos(cursor.pos); - while (tmppos < tmppar->last) { -#endif unsigned char c = tmppar->text[tmppos]; if (IsKommaChar(c) || IsLineSeparatorChar(c)) break; - if (c != LYX_META_INSET) { + if (c != LyXParagraph::META_INSET) { switch (action) { case text_lowercase: c = tolower(c); @@ -3157,9 +2953,9 @@ void LyXText::Backspace() if ((lastpos == 0 || (lastpos == 1 && cursor.par->IsSeparator(0))) && !(cursor.par->Next() - && cursor.par->footnoteflag == + && cursor.par->footnoteflag == LyXParagraph::NO_FOOTNOTE - && cursor.par->Next()->footnoteflag == + && cursor.par->Next()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE)) { if (cursor.par->previous) { @@ -3245,7 +3041,7 @@ void LyXText::Backspace() CursorLeftIntern(); /* some insets are undeletable here */ - if (cursor.par->GetChar(cursor.pos)==LYX_META_INSET) { + if (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET) { if (!cursor.par->GetInset(cursor.pos)->Deletable()) return; /* force complete redo when erasing display insets */ @@ -3259,11 +3055,7 @@ void LyXText::Backspace() row = cursor.row; y = cursor.y - row->baseline; -#ifdef NEW_TEXT LyXParagraph::size_type z; -#else - int z; -#endif /* remember that a space at the end of a row doesnt count * when calculating the fill */ if (cursor.pos < RowLast(row) || @@ -3445,11 +3237,7 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset, Row * row_ptr, long y) { /* returns a printed row */ -#ifdef NEW_TEXT LyXParagraph::size_type pos, pos_end; -#else - int pos, pos_end; -#endif float x, tmpx; int y_top, y_bottom; float fill_separator, fill_hfill, fill_label_hfill; @@ -3465,12 +3253,8 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset, PrepareToPrint(row_ptr, x, fill_separator, fill_hfill, fill_label_hfill); -#ifdef NEW_TEXT - LyXParagraph::size_type main_body = + LyXParagraph::size_type main_body = BeginningOfMainBody(row_ptr->par); -#else - int main_body = BeginningOfMainBody(row_ptr->par); -#endif /* initialize the pixmap */ scr.fillRectangle(gc_clear, @@ -3492,7 +3276,7 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset, paperwidth - sel_start_cursor.x, row_ptr->height); } else if (sel_end_cursor.row == row_ptr) { - scr.fillRectangle(gc_selection,0, offset, + scr.fillRectangle(gc_selection, 0, offset, sel_end_cursor.x, row_ptr->height); } else if (y > sel_start_cursor.y && y < sel_end_cursor.y) { scr.fillRectangle(gc_selection, 0, offset, @@ -3506,7 +3290,7 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset, scr.drawVerticalLine(gc_math, paperwidth-2 , offset, offset+row_ptr->height); } - if (row_ptr->par->pextra_type == PEXTRA_MINIPAGE) { + if (row_ptr->par->pextra_type == LyXParagraph::PEXTRA_MINIPAGE) { /* draw a marker at the left margin! */ LyXFont font = GetFont(row_ptr->par, 0); int asc = font.maxAscent(); @@ -3555,7 +3339,7 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset, if (mono_video) { back = gc_clear; } - scr.fillRectangle(back,LYX_PAPER_MARGIN, offset+1, + scr.fillRectangle(back, LYX_PAPER_MARGIN, offset+1, box_x - LYX_PAPER_MARGIN, int(font.maxAscent())+ int(font.maxDescent())); @@ -3658,7 +3442,7 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset, /* think about the parskip */ /* some parskips VERY EASY IMPLEMENTATION */ - if (parameters->paragraph_separation == LYX_PARSEP_SKIP) { + if (parameters->paragraph_separation == BufferParams::PARSEP_SKIP) { if (layout.latextype == LATEX_PARAGRAPH && firstpar->GetDepth() == 0 && firstpar->Previous()) @@ -3690,7 +3474,7 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset, string tmpstring = row_ptr->par->GetLabestring(); if (layout.labeltype == LABEL_COUNTER_CHAPTER) { - if (parameters->secnumdepth >=0){ + if (parameters->secnumdepth >= 0){ /* this is special code for the chapter layout. This is printed in * an extra row and has a pagebreak at the top. */ maxdesc = int(font.maxDescent() * layout.spacing.getValue() * parameters->spacing.getValue()) @@ -3734,7 +3518,7 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset, } } } - if (layout.labeltype==LABEL_BIBLIO) { // ale970302 + if (layout.labeltype == LABEL_BIBLIO) { // ale970302 if (row_ptr->par->bibkey) { tmpx = x; x -= font.stringWidth(layout.labelsep); @@ -3853,10 +3637,10 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset, } else { if (row_ptr->par->IsSeparator(pos)) { tmpx = x; - x+=SingleWidth(row_ptr->par, pos); + x+= SingleWidth(row_ptr->par, pos); /* -------> Only draw protected spaces when not in * free-spacing mode. */ - if (row_ptr->par->GetChar(pos)==LYX_META_PROTECTED_SEPARATOR && !layout.free_spacing) { + if (row_ptr->par->GetChar(pos) == LyXParagraph::META_PROTECTED_SEPARATOR && !layout.free_spacing) { scr.drawVerticalLine(gc_fill, int(tmpx), offset + row_ptr->baseline - 3, offset + row_ptr->baseline - 1); @@ -3928,7 +3712,7 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset, scr.drawVerticalLine(gc_fill, int(x), offset + row_ptr->baseline - DefaultHeight()/2, offset + row_ptr->baseline); - if (HfillExpansion(row_ptr,pos)) { + if (HfillExpansion(row_ptr, pos)) { if (pos >= main_body) { scr.drawOnOffLine(offset + row_ptr->baseline - DefaultHeight()/4, @@ -3952,12 +3736,12 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset, } else { if (row_ptr->par->IsSeparator(pos)) { tmpx = x; - x+=SingleWidth(row_ptr->par, pos); + x+= SingleWidth(row_ptr->par, pos); if (pos >= main_body) x+= fill_separator; /* -------> Only draw protected spaces when not in * free-spacing mode. */ - if (row_ptr->par->GetChar(pos)==LYX_META_PROTECTED_SEPARATOR && !layout.free_spacing) { + if (row_ptr->par->GetChar(pos) == LyXParagraph::META_PROTECTED_SEPARATOR && !layout.free_spacing) { scr.drawVerticalLine(gc_fill, int(tmpx), offset + row_ptr->baseline - 3, @@ -3999,7 +3783,7 @@ void LyXText::GetVisibleRow(LyXScreen & scr, int offset, /* selection code */ if (sel_start_cursor.row == row_ptr && sel_end_cursor.row == row_ptr) { - scr.fillRectangle(gc_select,sel_start_cursor.x, offset, + scr.fillRectangle(gc_select, sel_start_cursor.x, offset, sel_end_cursor.x - sel_start_cursor.x, row_ptr->height); } else if (sel_start_cursor.row == row_ptr) { @@ -4116,7 +3900,7 @@ int LyXText::GetColumnNearX(Row * row, int& x) tmpx -= SingleWidth(row->par, c - 1); tmpx -= fill_separator; } - c-=row->pos; + c-= row->pos; x = int(tmpx); return c; @@ -4136,7 +3920,7 @@ void LyXText::InsertFootnoteEnvironment(LyXParagraph::footnote_kind kind) } /* no marginpars in minipages */ if (kind == LyXParagraph::MARGIN - && cursor.par->pextra_type == PEXTRA_MINIPAGE) { + && cursor.par->pextra_type == LyXParagraph::PEXTRA_MINIPAGE) { WriteAlert(_("Impossible operation"), _("You can't insert a marginpar in a minipage!"), _("Sorry.")); @@ -4261,11 +4045,7 @@ void LyXText::InsertFootnoteEnvironment(LyXParagraph::footnote_kind kind) /* returns pointer to a specified row */ -#ifdef NEW_TEXT Row * LyXText::GetRow(LyXParagraph * par, LyXParagraph::size_type pos, long &y) -#else -Row * LyXText::GetRow(LyXParagraph * par, int pos, long &y) -#endif { Row * tmprow; diff --git a/src/text2.C b/src/text2.C index dac605c1ea..f284ddabe0 100644 --- a/src/text2.C +++ b/src/text2.C @@ -6,7 +6,7 @@ * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -16,7 +16,6 @@ #ifdef __GNUG__ #pragma implementation "lyxtext.h" -#pragma implementation "undo.h" #endif #include "LString.h" @@ -49,7 +48,7 @@ LyXText::LyXText(int pw, Buffer * p) parameters = &p->params; params = p; number_of_rows = 0; - refresh_y= 0; + refresh_y = 0; status = LyXText::UNCHANGED; LyXParagraph * par = p->paragraph; current_font = GetFont(par, 0); @@ -101,12 +100,8 @@ LyXText::~LyXText() // smaller. (Asger) // If position is -1, we get the layout font of the paragraph. // If position is -2, we get the font of the manual label of the paragraph. -#ifdef NEW_TEXT LyXFont LyXText::GetFont(LyXParagraph * par, LyXParagraph::size_type pos) -#else -LyXFont LyXText::GetFont(LyXParagraph * par, int pos) -#endif { LyXLayout const & layout = textclasslist.Style(parameters->textclass, par->GetLayout()); @@ -182,16 +177,12 @@ LyXFont LyXText::GetFont(LyXParagraph * par, int pos) } -#ifdef NEW_TEXT void LyXText::SetCharFont(LyXParagraph * par, LyXParagraph::size_type pos, LyXFont font) -#else -void LyXText::SetCharFont(LyXParagraph * par, int pos, LyXFont font) -#endif { /* let the insets convert their font */ - if (par->GetChar(pos) == LYX_META_INSET) { + if (par->GetChar(pos) == LyXParagraph::META_INSET) { if (par->GetInset(pos)) font = par->GetInset(pos)->ConvertFont(font); } @@ -235,12 +226,8 @@ void LyXText::SetCharFont(LyXParagraph * par, int pos, LyXFont font) /* inserts a new row behind the specified row, increments * the touched counters */ -#ifdef NEW_TEXT void LyXText::InsertRow(Row * row, LyXParagraph * par, LyXParagraph::size_type pos) -#else -void LyXText::InsertRow(Row * row, LyXParagraph * par, int pos) -#endif { Row * tmprow = new Row; if (!row) { @@ -355,15 +342,15 @@ void LyXText::ToggleFootnote() void LyXText::OpenStuff() { if (cursor.pos == 0 && cursor.par->bibkey){ - cursor.par->bibkey->Edit(0,0); + cursor.par->bibkey->Edit(0, 0); } else if (cursor.pos < cursor.par->Last() - && cursor.par->GetChar(cursor.pos) == LYX_META_INSET + && cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET && cursor.par->GetInset(cursor.pos)->Editable()) { minibuffer->Set(cursor.par->GetInset(cursor.pos)->EditMessage()); if (cursor.par->GetInset(cursor.pos)->Editable() != 2) SetCursorParUndo(); - cursor.par->GetInset(cursor.pos)->Edit(0,0); + cursor.par->GetInset(cursor.pos)->Edit(0, 0); } else { ToggleFootnote(); @@ -391,15 +378,11 @@ void LyXText::CloseFootnote() /* ok, move the cursor right before the footnote */ /* just a little faster than using CursorRight() */ - for (cursor.pos=0; cursor.par->ParFromPos(cursor.pos)!=par; cursor.pos++); + for (cursor.pos = 0; cursor.par->ParFromPos(cursor.pos)!= par; cursor.pos++); /* now the cursor is at the beginning of the physical par */ -#ifdef NEW_TEXT SetCursor(cursor.par, cursor.pos + cursor.par->ParFromPos(cursor.pos)->text.size()); -#else - SetCursor(cursor.par, cursor.pos + cursor.par->ParFromPos(cursor.pos)->last); -#endif } else { /* we are in a footnote, so let us move at the beginning */ @@ -453,12 +436,8 @@ void LyXText::MakeFontEntriesLayoutSpecific(LyXParagraph * par) LyXLayout const & layout = textclasslist.Style(parameters->textclass, par->GetLayout()); -#ifdef NEW_TEXT for (LyXParagraph::size_type pos = 0; pos < par->Last(); ++pos) { -#else - for (int pos = 0; pos < par->Last(); pos++) { -#endif if (pos < BeginningOfMainBody(par)) layoutfont = layout.labelfont; else @@ -712,7 +691,7 @@ void LyXText::SetFont(LyXFont font, bool toggleall) else layoutfont = GetFont(cursor.par, -1); // Update current font - real_current_font.update(font,toggleall); + real_current_font.update(font, toggleall); // Reduce to implicit settings current_font = real_current_font; @@ -740,8 +719,8 @@ void LyXText::SetFont(LyXFont font, bool toggleall) == sel_start_cursor.par->footnoteflag) { /* an open footnote * should behave * like a closed */ - LyXFont newfont = GetFont(cursor.par,cursor.pos); - newfont.update(font,toggleall); + LyXFont newfont = GetFont(cursor.par, cursor.pos); + newfont.update(font, toggleall); SetCharFont(cursor.par, cursor.pos, newfont); cursor.pos++; } else { @@ -1043,7 +1022,7 @@ Row * LyXText::GetRowNearY(long & y) tmpy = 0; } - if (tmpy<=y) + if (tmpy<= y) while (tmprow->next && tmpy + tmprow->height <= y) { tmpy += tmprow->height; tmprow = tmprow->next; @@ -1077,7 +1056,7 @@ void LyXText::ToggleFree(LyXFont font, bool toggleall) int implicitSelection = SelectWordWhenUnderCursor(); // Set font - SetFont(font,toggleall); + SetFont(font, toggleall); //minibuffer->Set(_("Font style changed")); /* Implicit selections are cleared afterwards and cursor is set to the @@ -1091,12 +1070,7 @@ void LyXText::ToggleFree(LyXFont font, bool toggleall) } -#ifdef NEW_TEXT -LyXParagraph::size_type -LyXText::BeginningOfMainBody(LyXParagraph * par) -#else -int LyXText::BeginningOfMainBody(LyXParagraph * par) -#endif +LyXParagraph::size_type LyXText::BeginningOfMainBody(LyXParagraph * par) { if (textclasslist.Style(parameters->textclass, par->GetLayout()).labeltype != LABEL_MANUAL) return 0; @@ -1133,11 +1107,7 @@ void LyXText::MeltFootnoteEnvironment() tmppar = firsttmppar; /* tmppar is now the paragraph right before the footnote */ -#ifdef NEW_TEXT char first_footnote_par_is_not_empty = tmppar->next->text.size(); -#else - char first_footnote_par_is_not_empty = tmppar->next->last; -#endif while (tmppar->next && tmppar->next->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) { tmppar = tmppar->next; /* I use next instead of Next(), @@ -1176,13 +1146,8 @@ void LyXText::MeltFootnoteEnvironment() * (only if the previous par and the footnotepar are not empty!) */ if ((!firsttmppar->next->GetLayout() && !firsttmppar->next->table) || firsttmppar->HasSameLayout(firsttmppar->next)) { -#ifdef NEW_TEXT if (firsttmppar->text.size() && !firsttmppar->IsSeparator(firsttmppar->text.size() - 1) -#else - if (firsttmppar->last - && !firsttmppar->IsSeparator(firsttmppar->last - 1) -#endif && first_footnote_par_is_not_empty) { firsttmppar->next->InsertChar(0, ' '); } @@ -1329,13 +1294,13 @@ void LyXText::SetParagraphExtraOpt(int type, refresh_y = cursor.y - cursor.row->baseline; if (cursor.par->footnoteflag == sel_start_cursor.par->footnoteflag) { - if (type == PEXTRA_NONE) { - if (cursor.par->pextra_type != PEXTRA_NONE) { + if (type == LyXParagraph::PEXTRA_NONE) { + if (cursor.par->pextra_type != LyXParagraph::PEXTRA_NONE) { cursor.par->UnsetPExtraType(); - cursor.par->pextra_type=PEXTRA_NONE; + cursor.par->pextra_type = LyXParagraph::PEXTRA_NONE; } } else { - cursor.par->SetPExtraType(type,width,widthp); + cursor.par->SetPExtraType(type, width, widthp); cursor.par->pextra_hfill = hfill; cursor.par->pextra_start_minipage = start_minipage; cursor.par->pextra_alignment = alignment; @@ -1390,13 +1355,13 @@ void LyXText::SetCounter(LyXParagraph * par) par->Previous()->GetLayout() ).labeltype != LABEL_BIBLIO && layout.labeltype == LABEL_BIBLIO)) { - for (i=0; i<10; i++) { + for (i = 0; i<10; i++) { par->setCounter(i, par->Previous()->GetFirstCounter(i)); } par->appendix = par->Previous()->FirstPhysicalPar()->appendix; if (!par->appendix && par->start_of_appendix){ par->appendix = true; - for (i=0; i<10; i++) { + for (i = 0; i<10; i++) { par->setCounter(i, 0); } } @@ -1404,7 +1369,7 @@ void LyXText::SetCounter(LyXParagraph * par) par->itemdepth = par->Previous()->FirstPhysicalPar()->itemdepth; } else { - for (i=0; i<10; i++) { + for (i = 0; i<10; i++) { par->setCounter(i, 0); } par->appendix = par->start_of_appendix; @@ -1467,7 +1432,7 @@ void LyXText::SetCounter(LyXParagraph * par) /* reset the counters. * A depth change is like a breaking layout */ - for (i=6 + par->enumdepth + 1; i<10;i++) + for (i = 6 + par->enumdepth + 1; i<10;i++) par->setCounter(i, 0); } @@ -1488,7 +1453,7 @@ void LyXText::SetCounter(LyXParagraph * par) if (layout.labeltype >= LABEL_FIRST_COUNTER) { i = layout.labeltype - LABEL_FIRST_COUNTER; - if (i >= 0 && i<=parameters->secnumdepth) { + if (i >= 0 && i<= parameters->secnumdepth) { par->incCounter(i); // increment the counter char * s = new char[50]; @@ -1694,7 +1659,7 @@ void LyXText::SetCounter(LyXParagraph * par) /* reset the enumeration counter. They are always resetted * when there is any other layout between */ - for (i=6 + par->enumdepth; i<10;i++) + for (i = 6 + par->enumdepth; i<10;i++) par->setCounter(i, 0); } } @@ -1760,9 +1725,9 @@ void LyXText::InsertInset(Inset *inset) SetUndo(Undo::INSERT, cursor.par->ParFromPos(cursor.pos)->previous, cursor.par->ParFromPos(cursor.pos)->next); - cursor.par->InsertChar(cursor.pos, LYX_META_INSET); + cursor.par->InsertChar(cursor.pos, LyXParagraph::META_INSET); cursor.par->InsertInset(cursor.pos, inset); - InsertChar(LYX_META_INSET); /* just to rebreak and refresh correctly. + InsertChar(LyXParagraph::META_INSET); /* just to rebreak and refresh correctly. * The character will not be inserted a * second time */ } @@ -1902,13 +1867,8 @@ This is not implemented yet. == sel_end_cursor.par->ParFromPos(sel_end_cursor.pos)) { /* only within one paragraph */ simple_cut_buffer = new LyXParagraph; -#ifdef NEW_TEXT - simple_cut_buffer->text.reserve(500); LyXParagraph::size_type i = sel_start_cursor.pos; -#else - int i = sel_start_cursor.pos; -#endif for (; i< sel_end_cursor.pos; i++){ /* table stuff -- begin*/ if (sel_start_cursor.par->table @@ -2022,11 +1982,7 @@ This is not implemented yet. void LyXText::CopySelection() { -#ifdef NEW_TEXT LyXParagraph::size_type i = 0; -#else - int i = 0; -#endif /* this doesnt make sense, if there is no selection */ if (!selection) { return; @@ -2076,9 +2032,6 @@ void LyXText::CopySelection() == sel_end_cursor.par->ParFromPos(sel_end_cursor.pos)) { /* only within one paragraph */ simple_cut_buffer = new LyXParagraph; -#if NEW_TEXT - simple_cut_buffer->text.reserve(500); -#endif for (i = sel_start_cursor.pos; i < sel_end_cursor.pos; ++i){ sel_start_cursor.par->CopyIntoMinibuffer(i); simple_cut_buffer->InsertFromMinibuffer(i - sel_start_cursor.pos); @@ -2096,7 +2049,7 @@ void LyXText::CopySelection() tmppar = tmppar->next; tmppar2->next = tmppar->Clone(); tmppar2->next->previous = tmppar2; - tmppar2=tmppar2->next; + tmppar2 = tmppar2->next; } tmppar2->next = 0; @@ -2110,28 +2063,17 @@ void LyXText::CopySelection() } /* the simple_cut_buffer paragraph is too big */ -#ifdef NEW_TEXT LyXParagraph::size_type tmpi2 = sel_start_cursor.par->PositionInParFromPos(sel_start_cursor.pos); -#else - int tmpi2 = - sel_start_cursor.par->PositionInParFromPos(sel_start_cursor.pos); -#endif for (;tmpi2;tmpi2--) simple_cut_buffer->Erase(0); /* now tmppar 2 is too big, delete all after sel_end_cursor.pos */ tmpi2 = sel_end_cursor.par->PositionInParFromPos(sel_end_cursor.pos); -#ifdef NEW_TEXT while (tmppar2->size() > tmpi2) { tmppar2->Erase(tmppar2->text.size() - 1); } -#else - while (tmppar2->last > tmpi2) { - tmppar2->Erase(tmppar2->last-1); - } -#endif } } @@ -2192,12 +2134,8 @@ void LyXText::PasteSelection() /* table stuff -- begin*/ bool table_too_small = false; if (tmpcursor.par->table) { -#ifdef NEW_TEXT while (simple_cut_buffer->text.size() && !table_too_small) { -#else - while (simple_cut_buffer->last && !table_too_small){ -#endif if (simple_cut_buffer->IsNewline(0)){ while(tmpcursor.pos < tmpcursor.par->Last() && !tmpcursor.par->IsNewline(tmpcursor.pos)) tmpcursor.pos++; @@ -2215,11 +2153,7 @@ void LyXText::PasteSelection() } } else { /* table stuff -- end*/ -#ifdef NEW_TEXT while (simple_cut_buffer->text.size()){ -#else - while (simple_cut_buffer->last){ -#endif simple_cut_buffer->CutIntoMinibuffer(0); simple_cut_buffer->Erase(0); tmpcursor.par->InsertFromMinibuffer(tmpcursor.pos); @@ -2245,7 +2179,7 @@ void LyXText::PasteSelection() tmppar = tmppar->next; tmppar2->next = tmppar->Clone(); tmppar2->next->previous = tmppar2; - tmppar2=tmppar2->next; + tmppar2 = tmppar2->next; if (cursor.par->footnoteflag){ tmppar->footnoteflag = cursor.par->footnoteflag; tmppar->footnotekind = cursor.par->footnotekind; @@ -2264,12 +2198,12 @@ void LyXText::PasteSelection() /* find the end of the buffer */ LyXParagraph *lastbuffer = simple_cut_buffer; while (lastbuffer->Next()) - lastbuffer=lastbuffer->Next(); + lastbuffer = lastbuffer->Next(); /* find the physical end of the buffer */ lastbuffer = simple_cut_buffer; while (lastbuffer->Next()) - lastbuffer=lastbuffer->Next(); + lastbuffer = lastbuffer->Next(); /* please break behind a space, if there is one. The space * should be copied too */ @@ -2289,11 +2223,7 @@ void LyXText::PasteSelection() if ((!cursor.par->Last() || cursor.par->IsLineSeparator(cursor.pos - 1) || cursor.par->IsNewline(cursor.pos - 1)) -#ifdef NEW_TEXT && simple_cut_buffer->text.size() -#else - && simple_cut_buffer->last -#endif && simple_cut_buffer->IsLineSeparator(0)) simple_cut_buffer->Erase(0); @@ -2386,13 +2316,9 @@ LyXParagraph * LyXText::FirstParagraph() /* returns true if the specified string is at the specified position */ -#ifdef NEW_TEXT bool LyXText::IsStringInText(LyXParagraph * par, LyXParagraph::size_type pos, char const * str) -#else -bool LyXText::IsStringInText(LyXParagraph * par, int pos, char const * str) -#endif { if (par) { int i = 0; @@ -2429,11 +2355,7 @@ void LyXText::ReplaceSelectionWithString(char const * str) } // Get font setting before we cut -#ifdef NEW_TEXT LyXParagraph::size_type pos = sel_end_cursor.pos; -#else - int pos = sel_end_cursor.pos; -#endif LyXFont font = sel_start_cursor.par->GetFontSettings(sel_start_cursor.pos); // Insert the new string @@ -2455,11 +2377,7 @@ void LyXText::ReplaceSelectionWithString(char const * str) bool LyXText::SearchForward(char const * str) { LyXParagraph * par = cursor.par; -#ifdef NEW_TEXT LyXParagraph::size_type pos = cursor.pos; -#else - int pos = cursor.pos; -#endif while (par && !IsStringInText(par, pos, str)) { if (pos < par->Last() - 1) ++pos; @@ -2469,7 +2387,7 @@ bool LyXText::SearchForward(char const * str) } } if (par) { - SetCursor(par,pos); + SetCursor(par, pos); return true; } else @@ -2493,10 +2411,10 @@ bool LyXText::SearchBackward(char const * string) pos = par->Last()-1; } while (par && pos<0); } - } while (par && !IsStringInText(par,pos,string)); + } while (par && !IsStringInText(par, pos, string)); if (par) { - SetCursor(par,pos); + SetCursor(par, pos); return true; } else @@ -2504,7 +2422,6 @@ bool LyXText::SearchBackward(char const * string) } -#ifdef NEW_TEXT void LyXText::InsertStringA(LyXParagraph::TextContainer const & text) { char * str = new char[text.size() + 1]; @@ -2513,19 +2430,14 @@ void LyXText::InsertStringA(LyXParagraph::TextContainer const & text) InsertStringA(str); delete [] str; } -#endif + /* needed to insert the selection */ void LyXText::InsertStringA(char const * str) { LyXParagraph * par = cursor.par; -#ifdef NEW_TEXT LyXParagraph::size_type pos = cursor.pos; LyXParagraph::size_type a = 0; -#else - int pos = cursor.pos; - int a = 0; -#endif int cell = 0; LyXParagraph * endpar = cursor.par->Next(); @@ -2538,55 +2450,42 @@ void LyXText::InsertStringA(char const * str) /* insert the string, don't insert doublespace */ int i = 0; -#ifndef NEW_TEXT - int i2 = 0; - for (i2 = i; str[i2] && str[i2] != '\n'; ++i2); - par->Enlarge(pos, i2 - i); -#endif while (str[i]) { - if (str[i]!='\n') { - if (str[i]==' ' && (str[i+1]!=' ') - && pos && par->GetChar(pos-1)!=' ') { + if (str[i]!= '\n') { + if (str[i] == ' ' && (str[i+1]!= ' ') + && pos && par->GetChar(pos-1)!= ' ') { par->InsertChar(pos,' '); pos++; } else if (par->table) { if (str[i] == '\t') { -#ifdef NEW_TEXT while((pos < par->size()) && - (par->GetChar(pos) != LYX_META_NEWLINE)) + (par->GetChar(pos) != LyXParagraph::META_NEWLINE)) ++pos; if (pos < par->size()) ++pos; -#else - while((pos < par->last) && - (par->GetChar(pos) != LYX_META_NEWLINE)) - ++pos; - if (pos < par->last) - ++pos; -#endif else // no more fields to fill skip the rest break; } else if ((str[i] != 13) && ((str[i] & 127) >= ' ')) { - par->InsertChar(pos,str[i]); + par->InsertChar(pos, str[i]); pos++; } } - else if (str[i]==' ') { - par->InsertChar(pos,LYX_META_PROTECTED_SEPARATOR); + else if (str[i] == ' ') { + par->InsertChar(pos, LyXParagraph::META_PROTECTED_SEPARATOR); pos++; } - else if (str[i]=='\t') { + else if (str[i] == '\t') { for (a = pos; a < (pos/8 + 1) * 8 ; ++a) { - par->InsertChar(a, LYX_META_PROTECTED_SEPARATOR); + par->InsertChar(a, LyXParagraph::META_PROTECTED_SEPARATOR); } pos = a; } - else if (str[i]!=13 && + else if (str[i]!= 13 && // Ignore unprintables (str[i] & 127) >= ' ') { - par->InsertChar(pos,str[i]); + par->InsertChar(pos, str[i]); pos++; } } else { @@ -2595,63 +2494,37 @@ void LyXText::InsertStringA(char const * str) pos++; break; } -#ifdef NEW_TEXT while((pos < par->size()) && -#else - while((pos < par->last) && -#endif - (par->GetChar(pos) != LYX_META_NEWLINE)) + (par->GetChar(pos) != LyXParagraph::META_NEWLINE)) pos++; pos++; - cell=NumberOfCell(par,pos); -#ifdef NEW_TEXT + cell = NumberOfCell(par, pos); while((pos < par->size()) && !(par->table->IsFirstCell(cell))) { while((pos < par->size()) && - (par->GetChar(pos) != LYX_META_NEWLINE)) + (par->GetChar(pos) != LyXParagraph::META_NEWLINE)) ++pos; ++pos; - cell=NumberOfCell(par,pos); + cell = NumberOfCell(par, pos); } if (pos >= par->size()) // no more fields to fill skip the rest break; -#else - while((pos < par->last) && - !(par->table->IsFirstCell(cell))) { - while((pos < par->last) && - (par->GetChar(pos) != LYX_META_NEWLINE)) - pos++; - pos++; - cell=NumberOfCell(par,pos); - } - if (pos >= par->last) - // no more fields to fill skip the rest - break; -#endif } else { -#ifdef NEW_TEXT if (!par->text.size()) { -#else - if (!par->last) { -#endif - par->InsertChar(pos,LYX_META_PROTECTED_SEPARATOR); + par->InsertChar(pos, LyXParagraph::META_PROTECTED_SEPARATOR); pos++; } par->BreakParagraph(pos, flag); par = par->Next(); pos = 0; } -#ifndef NEW_TEXT - for (i2 = i; str[i2] && str[i2] != '\n'; i2++); - par->Enlarge(pos, i2 - i); -#endif } i++; } - RedoParagraphs(cursor,endpar); + RedoParagraphs(cursor, endpar); SetCursor(cursor.par, cursor.pos); sel_cursor = cursor; SetCursor(par, pos); @@ -2659,7 +2532,6 @@ void LyXText::InsertStringA(char const * str) } -#ifdef NEW_TEXT void LyXText::InsertStringB(LyXParagraph::TextContainer const & text) { char * str = new char[text.size() + 1]; @@ -2668,8 +2540,8 @@ void LyXText::InsertStringB(LyXParagraph::TextContainer const & text) InsertStringB(str); delete [] str; } -#endif - + + /* turns double-CR to single CR, others where converted into one blank and 13s * that are ignored .Double spaces are also converted into one. Spaces at * the beginning of a paragraph are forbidden. tabs are converted into one @@ -2707,18 +2579,18 @@ void LyXText::InsertStringB(char const * s) bool LyXText::GotoNextError() { - LyXCursor res=cursor; + LyXCursor res = cursor; do { if (res.pos < res.par->Last() - 1) { res.pos++; } else { - res.par=res.par->Next(); + res.par = res.par->Next(); res.pos = 0; } } while (res.par && - !(res.par->GetChar(res.pos)==LYX_META_INSET + !(res.par->GetChar(res.pos) == LyXParagraph::META_INSET && res.par->GetInset(res.pos)->AutoDelete())); if (res.par) { @@ -2732,19 +2604,19 @@ bool LyXText::GotoNextError() bool LyXText::GotoNextNote() { - LyXCursor res=cursor; + LyXCursor res = cursor; do { if (res.pos < res.par->Last()-1) { res.pos++; } else { - res.par=res.par->Next(); + res.par = res.par->Next(); res.pos = 0; } } while (res.par && - !(res.par->GetChar(res.pos)==LYX_META_INSET - && res.par->GetInset(res.pos)->LyxCode()==Inset::IGNORE_CODE)); + !(res.par->GetChar(res.pos) == LyXParagraph::META_INSET + && res.par->GetInset(res.pos)->LyxCode() == Inset::IGNORE_CODE)); if (res.par) { SetCursor(res.par, res.pos); @@ -2784,7 +2656,7 @@ int LyXText::SwitchLayoutsBetweenClasses(char class1, char class2, + textclasslist.NameOfClass(class1) + " to " + textclasslist.NameOfClass(class2); new_inset = new InsetError(s); - par->InsertChar(0, LYX_META_INSET); + par->InsertChar(0, LyXParagraph::META_INSET); par->InsertInset(0, new_inset); } @@ -2794,12 +2666,8 @@ int LyXText::SwitchLayoutsBetweenClasses(char class1, char class2, } -#ifdef NEW_TEXT void LyXText::CheckParagraph(LyXParagraph * par, LyXParagraph::size_type pos) -#else -void LyXText::CheckParagraph(LyXParagraph * par, int pos) -#endif { LyXCursor tmpcursor; @@ -2813,11 +2681,7 @@ void LyXText::CheckParagraph(LyXParagraph * par, int pos) /* table stuff -- end*/ long y = 0; -#ifdef NEW_TEXT LyXParagraph::size_type z; -#else - int z; -#endif Row * row = GetRow(par, pos, y); /* is there a break one row above */ @@ -2840,11 +2704,7 @@ void LyXText::CheckParagraph(LyXParagraph * par, int pos) } int tmpheight = row->height; -#ifdef NEW_TEXT LyXParagraph::size_type tmplast = RowLast(row); -#else - int tmplast = RowLast(row); -#endif refresh_y = y; refresh_row = row; @@ -2915,12 +2775,8 @@ int LyXText::UpdateInset(Inset * inset) } -#ifdef NEW_TEXT void LyXText::SetCursor(LyXParagraph * par, LyXParagraph::size_type pos) -#else -void LyXText::SetCursor(LyXParagraph * par, int pos) -#endif { LyXCursor old_cursor = cursor; SetCursorIntern(par, pos); @@ -2928,11 +2784,7 @@ void LyXText::SetCursor(LyXParagraph * par, int pos) } -#ifdef NEW_TEXT void LyXText::SetCursorIntern(LyXParagraph * par, LyXParagraph::size_type pos) -#else -void LyXText::SetCursorIntern(LyXParagraph * par, int pos) -#endif { long y; Row * row; @@ -2953,20 +2805,12 @@ void LyXText::SetCursorIntern(LyXParagraph * par, int pos) par = par->previous ; if (par->IsDummy() && par->previous->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) -#ifdef NEW_TEXT pos += par->text.size() + 1; -#else - pos += par->last + 1; -#endif } if (par->previous) { par = par->previous; } -#ifdef NEW_TEXT pos += par->text.size() + 1; -#else - pos += par->last + 1; -#endif } cursor.par = par; @@ -2985,12 +2829,8 @@ void LyXText::SetCursorIntern(LyXParagraph * par, int pos) float fill_separator, fill_hfill, fill_label_hfill; left_margin = LabelEnd(row); PrepareToPrint(row, x, fill_separator, fill_hfill, fill_label_hfill); -#ifdef NEW_TEXT LyXParagraph::size_type main_body = BeginningOfMainBody(row->par); -#else - int main_body = BeginningOfMainBody(row->par); -#endif /* table stuff -- begin*/ if (row->par->table) { int cell = NumberOfCell(row->par, row->pos); @@ -3034,7 +2874,7 @@ void LyXText::SetCursorIntern(LyXParagraph * par, int pos) x += GetFont(row->par, -2).stringWidth( textclasslist.Style(parameters->textclass, row->par->GetLayout()).labelsep); if (row->par->IsLineSeparator(pos)) - x-= SingleWidth(row->par, pos); + x -= SingleWidth(row->par, pos); if (x < left_margin) x = left_margin; } @@ -3197,7 +3037,7 @@ void LyXText::CursorDownParagraph() if (cursor.par->Next()) { SetCursor(cursor.par->Next(), 0); } else { - SetCursor(cursor.par,cursor.par->Last()); + SetCursor(cursor.par, cursor.par->Last()); } } @@ -3425,13 +3265,9 @@ bool LyXText::TextHandleUndo(Undo * undo){ // returns false if no undo possible // is stored in the undo. So restore the text informations. if (undo->kind == Undo::EDIT){ tmppar2->text = tmppar->text; -#ifdef NEW_TEXT - //tmppar->text.clear(); - tmppar->text.erase(tmppar->text.begin(), - tmppar->text.end()); -#else - tmppar->text = 0; -#endif + tmppar->text.clear(); + //tmppar->text.erase(tmppar->text.begin(), + // tmppar->text.end()); tmppar2 = tmppar2->next; } if ( currentrow && currentrow->par == tmppar ) @@ -3465,7 +3301,7 @@ bool LyXText::TextHandleUndo(Undo * undo){ // returns false if no undo possible // check wether before points to a closed float and open it if necessary if (before && before->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE && before->next && before->next->footnoteflag != LyXParagraph::NO_FOOTNOTE){ - tmppar4 =before; + tmppar4 = before; while (tmppar4->previous && tmppar4->previous->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) tmppar4 = tmppar4->previous; @@ -3598,15 +3434,9 @@ Undo * LyXText::CreateUndo(Undo::undo_kind kind, LyXParagraph * before, // a memory optimization: Just store the layout information when only edit if (kind == Undo::EDIT){ -#ifdef NEW_TEXT - //tmppar2->text.clear(); - tmppar2->text.erase(tmppar2->text.begin(), - tmppar2->text.end()); -#else - if (tmppar2->text) - delete[] tmppar2->text; - tmppar2->text = 0; -#endif + tmppar2->text.clear(); + //tmppar2->text.erase(tmppar2->text.begin(), + // tmppar2->text.end()); } undopar = tmppar2; @@ -3617,17 +3447,11 @@ Undo * LyXText::CreateUndo(Undo::undo_kind kind, LyXParagraph * before, tmppar2->next->SetID(tmppar->GetID()); // a memory optimization: Just store the layout information when only edit if (kind == Undo::EDIT){ -#ifdef NEW_TEXT - //tmppar2->next->text.clear(); - tmppar2->next->text.erase(tmppar2->next->text.begin(), tmppar2->next->text.end()); -#else - if (tmppar2->next->text) - delete[] tmppar2->next->text; - tmppar2->next->text = 0; -#endif + tmppar2->next->text.clear(); + //tmppar2->next->text.erase(tmppar2->next->text.begin(), tmppar2->next->text.end()); } tmppar2->next->previous = tmppar2; - tmppar2=tmppar2->next; + tmppar2 = tmppar2->next; } tmppar2->next = 0; } @@ -3741,24 +3565,21 @@ bool LyXText::IsEmptyTableRow(LyXCursor * old_cursor) bool LyXText::IsEmptyTableCell() { -#ifdef NEW_TEXT LyXParagraph::size_type pos = cursor.pos - 1; -#else - int pos = cursor.pos - 1; -#endif while (pos >= 0 && pos < cursor.par->Last() && !cursor.par->IsNewline(pos)) --pos; return cursor.par->IsNewline(pos + 1); } + void LyXText::toggleAppendix(){ LyXParagraph * par = cursor.par->FirstPhysicalPar(); bool start = !par->start_of_appendix; /* ensure that we have only one start_of_appendix in this document */ LyXParagraph * tmp = FirstParagraph(); - for (;tmp;tmp=tmp->next) + for (;tmp;tmp = tmp->next) tmp->start_of_appendix = 0; par->start_of_appendix = start; diff --git a/src/toolbar.C b/src/toolbar.C index 28ff89134d..7a5a68a737 100644 --- a/src/toolbar.C +++ b/src/toolbar.C @@ -1,5 +1,5 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * @@ -9,7 +9,7 @@ * This file is Copyright 1996-1998 * Lars Gullik Bjønnes * - * ======================================================*/ + * ====================================================== */ // Added pseudo-action handling, asierra 180296 @@ -130,7 +130,7 @@ Toolbar::Toolbar(Toolbar const &rct, LyXView *o, int x, int y) add(tmplist->action); lyxerr[Debug::TOOLBAR] << "tool action: " << tmplist->action << endl; - tmplist=tmplist->next; + tmplist= tmplist->next; } } @@ -172,12 +172,12 @@ extern "C" int C_Toolbar_BubblePost(FL_OBJECT *ob, int event, FL_Coord /*mx*/, FL_Coord /*my*/, int key, void *xev) { - return Toolbar::BubblePost(ob,event,0,0,key,xev); + return Toolbar::BubblePost(ob, event, 0, 0, key, xev); } void Toolbar::activate() { - toolbarItem *item, *tmp=0; + toolbarItem *item, *tmp= 0; item = toollist; while(item){ tmp = item->next; @@ -191,7 +191,7 @@ void Toolbar::activate() void Toolbar::deactivate() { - toolbarItem *item, *tmp=0; + toolbarItem *item, *tmp= 0; item = toollist; while(item){ tmp = item->next; @@ -288,7 +288,7 @@ void Toolbar::set(bool doingmain) // add the time if it don't exist if (bubble_timer == 0) bubble_timer = fl_add_timer(FL_HIDDEN_TIMER, - xpos,ypos,0,0,"Timer"); + xpos, ypos, 0, 0, "Timer"); while(item != 0) { switch(item->action){ @@ -309,22 +309,22 @@ void Toolbar::set(bool doingmain) break; default: xpos += standardspacing; - item->icon = obj = + item->icon = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, - xpos,ypos, + xpos, ypos, buttonwidth, - height,""); - fl_set_object_boxtype(obj,FL_UP_BOX); - fl_set_object_color(obj,FL_MCOL,FL_BLUE); + height, ""); + fl_set_object_boxtype(obj, FL_UP_BOX); + fl_set_object_color(obj, FL_MCOL, FL_BLUE); fl_set_object_resize(obj, FL_RESIZE_ALL); fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity); - fl_set_object_callback(obj,C_Toolbar_ToolbarCB, + fl_set_object_callback(obj, C_Toolbar_ToolbarCB, (long)item->action); #if FL_REVISION >85 // Remove the blue feedback rectangle - fl_set_pixmapbutton_focus_outline(obj,0); + fl_set_pixmapbutton_focus_outline(obj, 0); #endif // set the bubble-help (Matthias) @@ -335,7 +335,7 @@ void Toolbar::set(bool doingmain) fl_set_object_posthandler(obj, C_Toolbar_BubblePost); - fl_set_pixmapbutton_data(obj,item->pixmap); + fl_set_pixmapbutton_data(obj, item->pixmap); item = item->next; // we must remember to update the positions xpos += buttonwidth; @@ -441,7 +441,7 @@ void Toolbar::add(int action, bool doclean) // first «hide» the toolbar buttons. This is not a real hide // actually it deletes and frees the button altogether. lyxerr << "Toolbar::add: «hide» the toolbar buttons." << endl; - toolbarItem *item, *tmp=0; + toolbarItem *item, *tmp= 0; item = toollist; lightReset(); @@ -555,7 +555,7 @@ void Toolbar::push(int nth) if (nth == 0) return; - int count=0; + int count= 0; toolbarItem *tmp = toollist; while (tmp) { count++; diff --git a/src/toolbar.h b/src/toolbar.h index f29f2fd024..15b9bcf9ed 100644 --- a/src/toolbar.h +++ b/src/toolbar.h @@ -8,10 +8,10 @@ * This file is Copyright (C) 1996-1998 * Lars Gullik Bjønnes * -*======================================================*/ +* ====================================================== */ -#ifndef _TOOLBAR_H_ -#define _TOOLBAR_H_ +#ifndef TOOLBAR_H +#define TOOLBAR_H #ifdef __GNUG__ #pragma interface @@ -70,15 +70,15 @@ public: /// sets up the default toolbar void init(); /// (re)sets the toolbar - void set(bool doingmain=false); + void set(bool doingmain= false); /** this is to be the entry point to the toolbar frame, where you can change the toolbar realtime. */ void edit(); /// add a new button to the toolbar. - void add(int ,bool doclean=true); + void add(int , bool doclean= true); /// name of func instead of kb_action - void add(string const & , bool doclean=true); + void add(string const & , bool doclean= true); /// invokes the n'th icon in the toolbar void push(int); /// activates the toolbar @@ -152,7 +152,7 @@ private: bool cleaned; /// - char **getPixmap(kb_action, string const & arg=string()); + char **getPixmap(kb_action, string const & arg= string()); /// removes all toolbar buttons from the toolbar. void clean(); diff --git a/src/trans.C b/src/trans.C index d189884938..860bd5755c 100644 --- a/src/trans.C +++ b/src/trans.C @@ -1,7 +1,5 @@ #include -//#include - #ifdef __GNUG__ #pragma implementation "trans.h" #endif @@ -18,48 +16,29 @@ // KmodInfo KmodInfo::KmodInfo() { - exception_list=0; + exception_list = 0; } -KmodInfo::KmodInfo(const KmodInfo& o) -{ - (*this)=o; -} - - -KmodInfo& KmodInfo::operator=(const KmodInfo& o) -{ - if (this!=&o) { - allowed=o.allowed; - accent=o.accent; - data=o.data; - exception_list=o.exception_list; - } - - return *this; -} - - // Default Trans -bool DefaultTrans::init_=false; +bool DefaultTrans::init_ = false; DefaultTrans::DefaultTrans() { - if (init_==false) { + if (init_ == false) { // Do initialization - init_=true; + init_ = true; } } -string DefaultTrans::process(char c,TransManager& k) +string DefaultTrans::process(char c, TransManager & k) { - char dummy[2]="?"; - dummy[0]=c; + char dummy[2] = "?"; + dummy[0] = c; - return k.normalkey(c,dummy); + return k.normalkey(c, dummy); } @@ -69,11 +48,11 @@ Trans::Trans() { int i; - for(i=0; i<256; i++) - keymap_[i]=0; + for(i = 0; i < 256; ++i) + keymap_[i] = 0; - for(i=0; i next = exclist; - p -> c = c; + p->next = exclist; + p->c = c; p->data = data; - p->combined=flag; - p->accent=accent; + p->combined = flag; + p->accent = accent; exclist = p; } -void Trans::FreeException(Trans::keyexc& exclist) +void Trans::FreeException(Trans::keyexc & exclist) { Trans::keyexc p; @@ -117,16 +96,16 @@ void Trans::FreeKeymap() { int i; - for(i=0; i<256; i++) + for(i = 0; i < 256; ++i) if (keymap_[i]) { delete keymap_[i]; - keymap_[i]=0; + keymap_[i] = 0; } - for(i=0; iexception_list); delete kmod_list_[i]; - kmod_list_[i]=0; + kmod_list_[i] = 0; } } @@ -137,14 +116,14 @@ bool Trans::IsDefined() } -const string& Trans::GetName() +string const & Trans::GetName() { return name_; } enum _kmaptags { - KCOMB=1, + KCOMB = 1, KMOD, KMAP, KXMOD, @@ -153,18 +132,18 @@ enum _kmaptags { struct keyword_item kmapTags[K_LAST-1] = { - {"\\kcomb",KCOMB }, + {"\\kcomb", KCOMB }, { "\\kmap", KMAP }, { "\\kmod", KMOD }, { "\\kxmod", KXMOD } }; -tex_accent getkeymod(const string&); +tex_accent getkeymod(string const &); -void Trans::AddDeadkey(tex_accent accent,const string& keys, - const string& allowed) +void Trans::AddDeadkey(tex_accent accent, string const & keys, + string const & allowed) { if (kmod_list_[accent]) { FreeException(kmod_list_[accent]->exception_list); @@ -175,22 +154,24 @@ void Trans::AddDeadkey(tex_accent accent,const string& keys, kmod_list_[accent] = new kmod_list_decl; kmod_list_[accent]->data = keys; kmod_list_[accent]->accent = accent; - if (allowed=="all") { - kmod_list_[accent]->allowed=lyx_accent_table[accent].native; + if (allowed == "all") { + kmod_list_[accent]->allowed= lyx_accent_table[accent].native; } else { kmod_list_[accent]->allowed = allowed; } for(string::size_type i = 0; i < keys.length(); ++i) { char * temp; + if (keys[i] == char(254)) + lyxerr << "check one triggered" << endl; temp = keymap_[keys[i]] = new char[2]; temp[0] = 0; temp[1] = accent; } - kmod_list_[accent]->exception_list=0; + kmod_list_[accent]->exception_list = 0; } -int Trans::Load(LyXLex &lex) +int Trans::Load(LyXLex & lex) { bool error = false; @@ -218,7 +199,7 @@ int Trans::Load(LyXLex &lex) tex_accent accent = getkeymod(lex.GetString()); - if (accent==TEX_NOACCENT) + if (accent == TEX_NOACCENT) return -1; if (lex.next(true)) { @@ -234,57 +215,58 @@ int Trans::Load(LyXLex &lex) break; } case KCOMB: { - const char *str; + char const * str; lyxerr[Debug::KBMAP] << "KCOMB:" << endl; if (lex.next(true)) { - str=lex.text(); + str= lex.text(); lyxerr[Debug::KBMAP] << str << endl; } else return -1; - tex_accent accent_1=getkeymod(str); - if (accent_1==TEX_NOACCENT) return -1; + 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; - tex_accent accent_2=getkeymod(str); - if (accent_2==TEX_NOACCENT) return -1; + 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 check about accent_1 also int key; - for(key=0;key<256;key++) - if (keymap_[key] && keymap_[key][0]==0 && keymap_[key][1]==accent_2) + for(key = 0; key < 256; ++key) { + if (keymap_[key] && keymap_[key][0] == 0 + && keymap_[key][1] == accent_2) break; - + } string allowed; if (lex.next()) { - allowed=lex.GetString(); + allowed = lex.GetString(); lyxerr[Debug::KBMAP] << "allowed: " << allowed << endl; } else return -1; - InsertException(kmod_list_[accent_1]->exception_list,(char)key,allowed,true,accent_2); + InsertException(kmod_list_[accent_1]->exception_list,(char)key, allowed, true, accent_2); } break; case KMAP: { char key_from; - char *string_to; + char * string_to; if (lyxerr.debugging(Debug::KBMAP)) lyxerr << "KMAP:\t" << lex.text() << endl; if (lex.next(true)) { - key_from=lex.text()[0]; + key_from= lex.text()[0]; if (lyxerr.debugging(Debug::KBMAP)) lyxerr << "\t`" << lex.text() << "'" << endl; @@ -292,9 +274,12 @@ int Trans::Load(LyXLex &lex) return -1; if (lex.next(true)) { - char const *t = lex.text(); - string_to = strcpy(new char[strlen(t)+1],t); - keymap_[key_from]=string_to; + char const * t = lex.text(); + string_to = strcpy(new char[strlen(t)+1], t); + if (key_from == char(254)) + lyxerr << "check two triggered" + << endl; + keymap_[key_from] = string_to; if (lyxerr.debugging(Debug::KBMAP)) lyxerr << "\t`" << string_to << "'" << endl; @@ -306,7 +291,7 @@ int Trans::Load(LyXLex &lex) case KXMOD: { tex_accent accent; char key; - const char *str; + char const * str; if (lyxerr.debugging(Debug::KBMAP)) lyxerr << "KXMOD:\t" << lex.text() << endl; @@ -322,7 +307,7 @@ int Trans::Load(LyXLex &lex) if (lyxerr.debugging(Debug::KBMAP)) lyxerr << "\t`" << lex.text() << "'" << endl; - key=lex.text()[0]; + key = lex.text()[0]; } else return -1; @@ -330,11 +315,11 @@ int Trans::Load(LyXLex &lex) if (lyxerr.debugging(Debug::KBMAP)) lyxerr << "\t`" << lex.text() << "'" << endl; - str=lex.text(); + str = lex.text(); } else return -1; - InsertException(kmod_list_[accent]->exception_list,key,str); + InsertException(kmod_list_[accent]->exception_list, key, str); break; } case LyXLex::LEX_FEOF: @@ -350,32 +335,35 @@ int Trans::Load(LyXLex &lex) } -bool Trans::isAccentDefined(tex_accent accent,KmodInfo& i) +bool Trans::isAccentDefined(tex_accent accent, KmodInfo & i) { - if (kmod_list_[accent]!=0) { - i=*kmod_list_[accent]; + if (kmod_list_[accent]!= 0) { + i = *kmod_list_[accent]; return true; } return false; } -string Trans::process(char c,TransManager& k) +string Trans::process(char c, TransManager & k) { - char dummy[2]="?"; - char *dt=dummy; - char *t=Match(c); - + lyxerr << "enter process" << endl; + char dummy[2] = "?"; + char * dt = dummy; + char * t = Match(c); + lyxerr << "finished variables" << endl; - if ((t==0 && (*dt=c)) || (t[0]!=0 && (dt=t)) ){ - return k.normalkey(c,dt); + if ((t == 0 && (dt[0] = c)) || (t[0] != 0 && (dt = t)) ){ + lyxerr << "normalkey" << endl; + return k.normalkey(c, dt); } else { - return k.deadkey(c,*kmod_list_[(tex_accent)t[1]]); + lyxerr << "deadkey" << endl; + return k.deadkey(c, *kmod_list_[(tex_accent)t[1]]); } } -int Trans::Load(string const &language) +int Trans::Load(string const & language) { string filename = LibFileSearch("kbd", language, "kmap"); if (filename.empty()) @@ -385,10 +373,10 @@ int Trans::Load(string const &language) LyXLex lex(kmapTags, K_LAST-1); lex.setFile(filename); - int res=Load(lex); + int res = Load(lex); - if (res==0) { - name_=language; + if (res == 0) { + name_ = language; } else name_.clear(); @@ -396,14 +384,14 @@ int Trans::Load(string const &language) } -tex_accent getkeymod(string const &p) +tex_accent getkeymod(string const & p) /* return modifier - decoded from p and update p */ { - for (int i = 1; i <= TEX_MAX_ACCENT; i++) { + for (int i = 1; i <= TEX_MAX_ACCENT; ++i) { if (lyxerr.debugging(Debug::KBMAP)) lyxerr << "p = " << p << ", lyx_accent_table[" << i - <<"].name = `" << lyx_accent_table[i].name + << "].name = `" << lyx_accent_table[i].name << "'" << endl; if ( lyx_accent_table[i].name && contains(p, lyx_accent_table[i].name)) { diff --git a/src/trans.h b/src/trans.h index 839caa462c..97e8a51595 100644 --- a/src/trans.h +++ b/src/trans.h @@ -1,6 +1,6 @@ // -*- C++ -*- -#ifndef _Trans_h_ -#define _Trans_h_ +#ifndef Trans_h +#define Trans_h #ifdef __GNUG__ #pragma interface @@ -22,16 +22,16 @@ class TransManager; class TransInterface { public: /// - virtual string process(char,TransManager&)=0; + virtual string process(char, TransManager &) = 0; /// - virtual bool isAccentDefined(tex_accent,KmodInfo&)=0; + virtual bool isAccentDefined(tex_accent, KmodInfo &) = 0; }; /** DefaultTrans: the default translation class. Hols info on tex-accents. Monostate */ -class DefaultTrans: public TransInterface { +class DefaultTrans : public TransInterface { private: /// static bool init_; @@ -39,14 +39,14 @@ public: /// DefaultTrans(); /// - virtual string process(char,TransManager&); + virtual string process(char, TransManager &); }; /** Trans: holds a .kmap file */ -class Trans:public TransInterface { +class Trans : public TransInterface { public: /// Trans(); @@ -54,15 +54,15 @@ public: virtual ~Trans(); /// - int Load(string const &language); + int Load(string const & language); /// bool IsDefined(); /// - const string& GetName(); + string const & GetName(); /// - string process(char,TransManager&); + string process(char, TransManager &); /// - bool isAccentDefined(tex_accent,KmodInfo&); + bool isAccentDefined(tex_accent, KmodInfo &); private: /// @@ -71,31 +71,31 @@ private: typedef KmodException keyexc; /// - void AddDeadkey(tex_accent, const string&, const string&); + void AddDeadkey(tex_accent, string const &, string const &); /// void FreeKeymap(); /// int Load(LyXLex &); /// - inline char* Match(char c); + inline char * Match(char c); /// - void InsertException(keyexc &exclist, char c, - const string& data, bool = false, + void InsertException(keyexc & exclist, char c, + string const & data, bool = false, tex_accent = TEX_NOACCENT); /// - void FreeException(keyexc& exclist); + void FreeException(keyexc & exclist); /// string name_; /// - char *keymap_[256]; + char * keymap_[256]; /// - kmod_list_decl *kmod_list_[TEX_MAX_ACCENT+1]; + kmod_list_decl * kmod_list_[TEX_MAX_ACCENT+1]; }; -char* Trans::Match(char c) +char * Trans::Match(char c) { return keymap_[c]; } diff --git a/src/trans_decl.h b/src/trans_decl.h index 5e88992343..1b2937f16a 100644 --- a/src/trans_decl.h +++ b/src/trans_decl.h @@ -1,6 +1,6 @@ // -*- C++ -*- -#ifndef _Trans_Decl_h_ -#define _Trans_Decl_h_ +#ifndef Trans_Decl_h +#define Trans_Decl_h #include "LString.h" #include "tex-accent.h" @@ -8,13 +8,13 @@ struct Keyexc { char c; /* character to make exception */ string data; /* exception data */ - Keyexc *next; + Keyexc * next; bool combined; // Combination with another deadkey tex_accent accent; // The accent combined with }; /// -typedef Keyexc *KmodException; +typedef Keyexc * KmodException; // // @@ -25,11 +25,12 @@ struct KmodInfo { tex_accent accent; string allowed; KmodException exception_list; + - KmodInfo(const KmodInfo&); + //KmodInfo(const KmodInfo&); KmodInfo(); - KmodInfo& operator=(const KmodInfo&); + //KmodInfo& operator= (const KmodInfo&); }; #endif diff --git a/src/trans_mgr.C b/src/trans_mgr.C index d667f6e89d..bb72e02719 100644 --- a/src/trans_mgr.C +++ b/src/trans_mgr.C @@ -4,7 +4,6 @@ #pragma implementation "trans_mgr.h" #endif -//#include #include "trans_mgr.h" #include "trans.h" #include "lyxtext.h" @@ -17,60 +16,53 @@ #include "lyxrc.h" #include "support/lstrings.h" -extern LyXRC* lyxrc; -extern string DoAccent(const string&,tex_accent); +extern LyXRC * lyxrc; +extern string DoAccent(string const &, tex_accent); extern void InsertCorrectQuote(); -extern string DoAccent(char,tex_accent); -extern BufferView* current_view; +extern string DoAccent(char, tex_accent); +extern BufferView * current_view; // TransFSMData TransFSMData::TransFSMData() { - deadkey_=deadkey2_=0; - deadkey_info_.accent=deadkey2_info_.accent=TEX_NOACCENT; - comb_info_=0; + deadkey_ = deadkey2_ = 0; + deadkey_info_.accent = deadkey2_info_.accent = TEX_NOACCENT; + comb_info_ = 0; } // TransState -const char TransState::TOKEN_SEP=4; +char const TransState::TOKEN_SEP = 4; -TransState::~TransState() -{} +TransState::~TransState() {} // TransInitState TransInitState::TransInitState() { - init_state_=this; + init_state_ = this; } -string TransInitState::normalkey(char c,char *t) +string TransInitState::normalkey(char c, char * t) { string res; - if (t!=0) - res=t; + if (t!= 0) + res = t; else - res=c; + res = c; return res; } -//bool TransInitState::backspace() -//{ -// return true; -//} - - -string TransInitState::deadkey(char c,KmodInfo d) +string TransInitState::deadkey(char c, KmodInfo d) { - deadkey_=c; - deadkey_info_=d; - currentState=deadkey_state_; + deadkey_ = c; + deadkey_info_ = d; + currentState = deadkey_state_; return string(); } @@ -78,148 +70,130 @@ string TransInitState::deadkey(char c,KmodInfo d) // TransDeadkeyState TransDeadkeyState::TransDeadkeyState() { - deadkey_state_=this; + deadkey_state_ = this; } -string TransDeadkeyState::normalkey(char c,char *trans) +string TransDeadkeyState::normalkey(char c, char * trans) { string res; // Check if it is an exception - KmodException l=deadkey_info_.exception_list; - while(l!=0) { - if (l->c==c) { - res=l->data; + KmodException l = deadkey_info_.exception_list; + while(l != 0) { + if (l->c == c) { + res = l->data; break; } - l=l->next; + l = l->next; } - if (l==0) { + if (l == 0) { // Not an exception. Check if it allowed - if (current_view->buffer()->params.allowAccents==true || + if (current_view->buffer()->params.allowAccents == true || countChar(deadkey_info_.allowed, c) > 0) { - res=DoAccent(c,deadkey_info_.accent); + res = DoAccent(c, deadkey_info_.accent); } else { // Not allowed - if (deadkey_!=0) - res=deadkey_; - res+=TOKEN_SEP; - res+=trans; + if (deadkey_!= 0) + res = deadkey_; + res+= TOKEN_SEP; + res+= trans; } } - currentState=init_state_; + currentState = init_state_; return res; } -//bool TransDeadkeyState::backspace() -//{ -// currentState=init_state_; -// return false; -//} - - -string TransDeadkeyState::deadkey(char c,KmodInfo d) +string TransDeadkeyState::deadkey(char c, KmodInfo d) { string res; // Check if the same deadkey was typed twice - if (deadkey_==c) { - res=deadkey_; - deadkey_=0; - deadkey_info_.accent=TEX_NOACCENT; - currentState=init_state_; + if (deadkey_ == c) { + res = deadkey_; + deadkey_ = 0; + deadkey_info_.accent = TEX_NOACCENT; + currentState = init_state_; return res; } // Check if it is a combination or an exception KmodException l; - l=deadkey_info_.exception_list; + l = deadkey_info_.exception_list; while(l) { - if (l->combined==true && l->accent==d.accent) { - deadkey2_=c; - deadkey2_info_=d; - comb_info_=l; - currentState=combined_state_; + if (l->combined == true && l->accent == d.accent) { + deadkey2_ = c; + deadkey2_info_ = d; + comb_info_ = l; + currentState = combined_state_; return string(); } - if (l->c==c) { - res=l->data; - deadkey_=0; - deadkey_info_.accent=TEX_NOACCENT; - currentState=init_state_; + if (l->c == c) { + res = l->data; + deadkey_ = 0; + deadkey_info_.accent = TEX_NOACCENT; + currentState = init_state_; return res; } - l=l->next; + l = l->next; } // Not a combination or an exception. // Output deadkey1 and keep deadkey2 - if (deadkey_!=0) - res=deadkey_; - deadkey_=c; - deadkey_info_=d; - currentState=deadkey_state_; + if (deadkey_!= 0) + res = deadkey_; + deadkey_ = c; + deadkey_info_ = d; + currentState = deadkey_state_; return res; } TransCombinedState::TransCombinedState() { - combined_state_=this; + combined_state_ = this; } -string TransCombinedState::normalkey(char c,char *trans) +string TransCombinedState::normalkey(char c, char *trans) { string res; // Check if the key is allowed on the combination if (countChar(comb_info_->data, c) > 0) { string temp; - temp=DoAccent(c,deadkey2_info_.accent); - res=DoAccent(temp,deadkey_info_.accent); - currentState=init_state_; + temp = DoAccent(c, deadkey2_info_.accent); + res = DoAccent(temp, deadkey_info_.accent); + currentState = init_state_; } else { // Not allowed. Output deadkey1 and check deadkey2 + c - if (deadkey_!=0) - res+=deadkey_; - res+=TOKEN_SEP; - deadkey_=deadkey2_; - deadkey_info_=deadkey2_info_; + if (deadkey_!= 0) + res+= deadkey_; + res+= TOKEN_SEP; + deadkey_ = deadkey2_; + deadkey_info_ = deadkey2_info_; // Call deadkey state and leave it to setup the FSM - res+=deadkey_state_->normalkey(c,trans); + res+= deadkey_state_->normalkey(c, trans); } return res; } -// bool TransCombinedState::backspace() -// { -// // cancel the second deadkey -// deadkey2_=0; -// deadkey2_info_.accent=TEX_NOACCENT; -// currentState=deadkey_state_; - -// return false; -// } - - -string TransCombinedState::deadkey(char c,KmodInfo d) +string TransCombinedState::deadkey(char c, KmodInfo d) { // Third key in a row. Output the first one and // reenter with shifted deadkeys string res; - if (deadkey_!=0) - res=deadkey_; - res+=TOKEN_SEP; - deadkey_=deadkey2_; - deadkey_info_=deadkey2_info_; - res+=deadkey_state_->deadkey(c,d); + if (deadkey_!= 0) + res = deadkey_; + res+= TOKEN_SEP; + deadkey_ = deadkey2_; + deadkey_info_ = deadkey2_info_; + res+= deadkey_state_->deadkey(c, d); return res; } @@ -231,31 +205,30 @@ TransFSM::TransFSM(): TransDeadkeyState(), TransCombinedState() { - currentState=init_state_; + currentState = init_state_; } // TransManager TransManager::TransManager() - : active_(0),t1_(new Trans),t2_(new Trans),chset_(new CharacterSet) + : active_(0), t1_(new Trans), t2_(new Trans) {} -Trans* TransManager::default_=new Trans; +Trans * TransManager::default_ = new Trans; TransManager::~TransManager() { delete t1_; delete t2_; - delete chset_; } int TransManager::SetPrimary(string const & language) { - if (t1_->GetName()==language) + if (t1_->GetName() == language) return 0; return t1_->Load(language); @@ -264,23 +237,23 @@ int TransManager::SetPrimary(string const & language) int TransManager::SetSecondary(string const & language) { - if (t2_->GetName()==language) + if (t2_->GetName() == language) return 0; return t2_->Load(language); } -bool TransManager::setCharset(const char *set) +bool TransManager::setCharset(char const * set) { - return chset_->loadFile(set); + return chset_.loadFile(set); } void TransManager::EnablePrimary() { if (t1_->IsDefined()) - active_=t1_; + active_ = t1_; lyxerr[Debug::KBMAP] << "Enabling primary keymap" << endl; } @@ -289,40 +262,40 @@ void TransManager::EnablePrimary() void TransManager::EnableSecondary() { if (t2_->IsDefined( )) - active_=t2_; + active_ = t2_; lyxerr[Debug::KBMAP] << "Enabling secondary keymap" << endl; } void TransManager::DisableKeymap() { - active_=default_; + active_ = default_; lyxerr[Debug::KBMAP] << "Disabling keymap" << endl; } -void TransManager::TranslateAndInsert(char c,LyXText *text) +void TransManager::TranslateAndInsert(char c, LyXText * text) { string res; - res=active_->process(c,*this); + res = active_->process(c,*this); // Process with tokens string temp; while(res.length()>0) { - res=split(res, temp,TransState::TOKEN_SEP); - insert(temp,text); + res = split(res, temp, TransState::TOKEN_SEP); + insert(temp, text); } } -void TransManager::insertVerbatim(const string& str,LyXText *text) +void TransManager::insertVerbatim(string const & str, LyXText * text) { - int l=str.length(); + int l = str.length(); - for (int i=0;iGetFont(text->cursor.par, text->cursor.pos).latex() == LyXFont::OFF) InsertCorrectQuote(); @@ -332,16 +305,16 @@ void TransManager::insertVerbatim(const string& str,LyXText *text) } -void TransManager::insert(string str,LyXText *text) +void TransManager::insert(string str, LyXText * text) { - string t=str; + string t = str; // Go through the character encoding only if the current // encoding (chset_->name()) matches the current font_norm // (lyrxc->font_norm - if (chset_->getName()!=lyxrc->font_norm || - chset_->encodeString(str)==false) { + if (chset_.getName()!= lyxrc->font_norm || + chset_.encodeString(str) == false) { // Could not find an encoding InsetLatexAccent ins(str); if (ins.CanDisplay()) { @@ -350,44 +323,36 @@ void TransManager::insert(string str,LyXText *text) } } - insertVerbatim(str,text); + insertVerbatim(str, text); } -//bool TransManager::backspace() -//{ -// return trans_fsm_.currentState->backspace(); -//} - - -void TransManager::deadkey(char c,tex_accent accent,LyXText *t) +void TransManager::deadkey(char c, tex_accent accent, LyXText * t) { KmodInfo i; string res; - if (c==0 && active_!=default_) { + if (c == 0 && active_!= default_) { // A deadkey was pressed that cannot be printed // or a accent command was typed in the minibuffer - if (active_->isAccentDefined(accent,i)==true) { - res=trans_fsm_.currentState->deadkey(c,i); - insert(res,t); + if (active_->isAccentDefined(accent, i) == true) { + res = trans_fsm_.currentState->deadkey(c, i); + insert(res, t); return; } - }// else { - // Fall through to the next case - //} + } - if (active_==default_ || c==0) { - i.accent=accent; - i.allowed=lyx_accent_table[accent].native; + if (active_ == default_ || c == 0) { + i.accent = accent; + i.allowed = lyx_accent_table[accent].native; i.data.clear(); - i.exception_list=0; + i.exception_list = 0; - string res=trans_fsm_.currentState->deadkey(c,i); - insert(res,t); + string res = trans_fsm_.currentState->deadkey(c, i); + insert(res, t); } else { // Go through the translation - TranslateAndInsert(c,t); + TranslateAndInsert(c, t); } } diff --git a/src/trans_mgr.h b/src/trans_mgr.h index d75a56e871..e393e34790 100644 --- a/src/trans_mgr.h +++ b/src/trans_mgr.h @@ -1,6 +1,6 @@ // -*- C++ -*- -#ifndef _Trans_Manager_h_ -#define _Trans_Manager_h_ +#ifndef Trans_Manager_h +#define Trans_Manager_h #ifdef __GNUG__ #pragma interface @@ -8,10 +8,10 @@ #include "tex-accent.h" #include "trans_decl.h" +#include "chset.h" +#include "LString.h" class LyXText; -class LString; -class CharacterSet; class Trans; /// Translation State @@ -20,13 +20,13 @@ public: /// virtual ~TransState(); /// - virtual string normalkey(char,char*)=0; + virtual string normalkey(char, char *) = 0; /// - virtual bool backspace()=0; + virtual bool backspace() = 0; /// - virtual string deadkey(char,KmodInfo)=0; + virtual string deadkey(char, KmodInfo) = 0; /// - static const char TOKEN_SEP; + static char const TOKEN_SEP; }; @@ -34,8 +34,7 @@ public: class TransFSMData { protected: /// - virtual ~TransFSMData() - {} + virtual ~TransFSMData() {} /// char deadkey_; /// @@ -47,17 +46,17 @@ protected: /// KmodException comb_info_; /// - TransState* init_state_; + TransState * init_state_; /// - TransState* deadkey_state_; + TransState * deadkey_state_; /// - TransState* combined_state_; + TransState * combined_state_; /// public: /// TransFSMData(); /// - TransState* currentState; + TransState * currentState; }; @@ -69,11 +68,11 @@ public: /// TransInitState(); /// - virtual string normalkey(char,char*); + virtual string normalkey(char, char *); /// virtual bool backspace() { return true; } /// - virtual string deadkey(char,KmodInfo); + virtual string deadkey(char, KmodInfo); }; @@ -85,15 +84,15 @@ public: /// TransDeadkeyState(); /// - virtual string normalkey(char,char*); + virtual string normalkey(char, char *); /// virtual bool backspace() { - currentState=init_state_; + currentState = init_state_; return false; } /// - virtual string deadkey(char,KmodInfo); + virtual string deadkey(char, KmodInfo); }; @@ -105,19 +104,19 @@ public: /// TransCombinedState(); /// - virtual string normalkey(char,char*); + virtual string normalkey(char, char *); /// virtual bool backspace() { // cancel the second deadkey - deadkey2_=0; - deadkey2_info_.accent=TEX_NOACCENT; - currentState=deadkey_state_; + deadkey2_ = 0; + deadkey2_info_.accent = TEX_NOACCENT; + currentState = deadkey_state_; return false; } /// - virtual string deadkey(char,KmodInfo); + virtual string deadkey(char, KmodInfo); }; @@ -140,19 +139,19 @@ private: /// TransFSM trans_fsm_; /// - Trans* active_; + Trans * active_; /// - Trans* t1_; + Trans * t1_; /// - Trans* t2_; + Trans * t2_; /// - static Trans* default_; + static Trans * default_; /// - CharacterSet* chset_; + CharacterSet chset_; /// - void insert(string,LyXText*); + void insert(string, LyXText *); /// - void insertVerbatim(const string&,LyXText*); + void insertVerbatim(string const &, LyXText *); public: /// TransManager(); @@ -169,33 +168,33 @@ public: /// void DisableKeymap(); /// - bool setCharset(const char*); + bool setCharset(const char *); /// bool backspace() { return trans_fsm_.currentState->backspace(); } /// - void TranslateAndInsert(char,LyXText*); + void TranslateAndInsert(char, LyXText *); /// - inline string deadkey(char,KmodInfo); + inline string deadkey(char, KmodInfo); /// - inline string normalkey(char,char*); + inline string normalkey(char, char *); /// - void deadkey(char,tex_accent,LyXText*); + void deadkey(char, tex_accent, LyXText *); }; -string TransManager::normalkey(char c,char *t) +string TransManager::normalkey(char c, char * t) { - return trans_fsm_.currentState->normalkey(c,t); + return trans_fsm_.currentState->normalkey(c, t); } -string TransManager::deadkey(char c,KmodInfo t) +string TransManager::deadkey(char c, KmodInfo t) { - return trans_fsm_.currentState->deadkey(c,t); + return trans_fsm_.currentState->deadkey(c, t); } #endif diff --git a/src/undo.C b/src/undo.C new file mode 100644 index 0000000000..1617def3b8 --- /dev/null +++ b/src/undo.C @@ -0,0 +1,71 @@ +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 1995 Matthias Ettrich + * Copyright 1995-1999 The LyX Team. + * + * ====================================================== */ + +#include + +#include "undo.h" + +#ifdef __GNUG__ +#pragma implementation +#endif + +UndoStack::UndoStack() + : limit(100) {} + + +Undo * UndoStack::Pop() +{ + if (stakk.empty()) return 0; + Undo * result = stakk.front(); + stakk.pop_front(); + return result; +} + + +Undo * UndoStack::Top() +{ + if (stakk.empty()) return 0; + return stakk.front(); +} + + +UndoStack::~UndoStack() +{ + Clear(); +} + + +void UndoStack::Clear() +{ + while (!stakk.empty()) { + Undo * tmp = stakk.front(); + stakk.pop_front(); + delete tmp; + } +} + + +void UndoStack::SetStackLimit(Stakk::size_type l) +{ + limit = l; +} + + +void UndoStack::Push(Undo * undo_arg) +{ + if (!undo_arg) return; + + stakk.push_front(undo_arg); + if (stakk.size() > limit) { + Undo * tmp = stakk.back(); + stakk.pop_back(); + delete tmp; + } +} diff --git a/src/undo.h b/src/undo.h index fa3d0bc087..bcd8ee5366 100644 --- a/src/undo.h +++ b/src/undo.h @@ -4,17 +4,21 @@ * * LyX, The Document Processor * - * Copyright (C) 1995 Matthias Ettrich, 1995, 1996 LyX Team + * Copyright 1995 Matthias Ettrich + * Copyright 1995-1999 The LyX Team. * - *======================================================*/ -#ifndef _UNDO_H -#define _UNDO_H + * ====================================================== */ + +#ifndef UNDO_H +#define UNDO_H #ifdef __GNUG__ #pragma interface #endif -#include "definitions.h" +#include +using std::list; + #include "lyxparagraph.h" @@ -43,12 +47,12 @@ public: /// int cursor_pos; // valid if >= 0 /// - LyXParagraph* par; + LyXParagraph * par; /// Undo(undo_kind kind_arg, int number_before_arg, int number_behind_arg, int cursor_par_arg, int cursor_pos_arg, - LyXParagraph* par_arg) + LyXParagraph * par_arg) { kind = kind_arg; number_of_before_par = number_before_arg; @@ -58,8 +62,8 @@ public: par = par_arg; } /// - ~Undo(){ - LyXParagraph* tmppar; + ~Undo() { + LyXParagraph * tmppar; while (par) { tmppar = par; par = par->next; @@ -69,94 +73,30 @@ public: }; -/// A limited Stack for the undo informations. Matthias 290496 +/// A limited Stack for the undo informations. class UndoStack{ private: /// - struct StackAtom{ - /// - StackAtom* previous; - /// - Undo* undo; - }; - /// - StackAtom* current; - /// - StackAtom *tmp; - /// - int size; + typedef list Stakk; /// - int limit; + Stakk stakk; + /// the maximum number of undo steps stored. + Stakk::size_type limit; public: /// - UndoStack(){ - current = 0; - // size must be initialised (thornley) - size = 0; - limit = 100; // the maximum number of undo steps stored. 0 means NO LIMIT. - // Limit can be changed with UndoStack::SetStackLimit(int) - } + UndoStack(); /// - Undo *Pop(){ - Undo* result = 0; - if (current){ - result = current->undo; - tmp = current; - current = current->previous; - delete tmp; - size--; - } - else { - size = 0; // for safety... - } - return result; - } + Undo * Pop(); /// - Undo* Top(){ - if (current) - return current->undo; - else - return 0; - } + Undo * Top(); /// - ~UndoStack(){ - Clear(); - } + ~UndoStack(); /// - void Clear(){ - Undo* tmp_undo = Pop(); - while (tmp_undo){ - delete tmp_undo; - tmp_undo = Pop(); - } - } + void Clear(); /// - void SetStackLimit(int limit_arg) { - limit = limit_arg; - } - - /// - void Push(Undo* undo_arg){ - int i; - StackAtom* tmp2; - if (undo_arg){ - tmp = new StackAtom; - tmp->undo = undo_arg; - tmp->previous = current; - current = tmp; - size++; - if (limit && size > limit){ - for (i=0; iprevious; - while(tmp && tmp->previous){ - tmp2 = tmp->previous->previous; - delete tmp->previous; - size--; - tmp->previous = tmp2; - } - } - } - } + void SetStackLimit(Stakk::size_type l); + /// + void Push(Undo * undo_arg); }; #endif diff --git a/src/vc-backend.C b/src/vc-backend.C index 1d1b5b0732..8d1d6e2989 100644 --- a/src/vc-backend.C +++ b/src/vc-backend.C @@ -223,11 +223,11 @@ void CVS::scanMaster() string tmpf = "/" + OnlyFilename(file_) + "/"; lyxerr[Debug::LYXVC] << "\tlooking for `" << tmpf << "'" << endl; string line; + LRegex reg("/(.*)/(.*)/(.*)/(.*)/(.*)"); while(getline(ifs, line)) { lyxerr[Debug::LYXVC] << "\t line: " << line << endl; if (contains(line, tmpf)) { // Ok extract the fields. - LRegex reg("/(.*)/(.*)/(.*)/(.*)/(.*)"); LRegex::SubMatches const & sm = reg.exec(line); //sm[0]; // whole matched string //sm[1]; // filename @@ -254,14 +254,6 @@ void CVS::scanMaster() locker_ = "Locked"; vcstat = LOCKED; } -#if 0 - for (LRegex::SubMatches::const_iterator cit = sm.begin(); - cit != sm.end(); ++cit) { - if ((*cit).first != string::npos) - lyxerr << string(line, (*cit).first, - (*cit).second) << endl; - } -#endif break; } } @@ -270,19 +262,24 @@ void CVS::scanMaster() void CVS::registrer(string const & msg) { - // cvs add + doVCCommand("cvs -q add -m \"" + msg + "\" \"" + + OnlyFilename(owner_->getFileName()) + "\""); + owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload"); } void CVS::checkIn(string const & msg) { - // cvs commit + doVCCommand("cvs -q commit -m \"" + msg + "\" \"" + + OnlyFilename(owner_->getFileName()) + "\""); + owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload"); } void CVS::checkOut() { - // cvs update + // cvs update or perhaps for cvs this should be a noop + lyxerr << "Sorry not implemented." << endl; } @@ -290,7 +287,8 @@ void CVS::revert() { // not sure how to do this... // rm file - // cvs update + // cvs update + lyxerr << "Sorry not implemented." << endl; } @@ -299,9 +297,11 @@ void CVS::undoLast() // merge the current with the previous version // in a reverse patch kind of way, so that the // result is to revert the last changes. + lyxerr << "Sorry not implemented." << endl; } void CVS::getLog(string const &) { + lyxerr << "Sorry not implemented." << endl; } diff --git a/src/vms_defines.h b/src/vms_defines.h index 8e2d552db1..92545f732c 100644 --- a/src/vms_defines.h +++ b/src/vms_defines.h @@ -4,13 +4,13 @@ * * LyX, the High Level Word Processor * -* Copyright (C) 1995,1996 Matthias Ettrich +* Copyright (C) 1995, 1996 Matthias Ettrich * -*====================================================== +* ====================================================== A few prototypes and definitions needed for VMS / OpenVMS */ -#ifndef _VMS_DEFINES_H -#define _VMS_DEFINES_H +#ifndef VMS_DEFINES_H +#define VMS_DEFINES_H /* Currently empty. */ diff --git a/src/vspace.C b/src/vspace.C index 2d6d7e74f7..00caff9f82 100644 --- a/src/vspace.C +++ b/src/vspace.C @@ -1,13 +1,13 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -41,7 +41,7 @@ static char const * unit_name[num_units] = { "sp", "pt", "bp", "dd", LyXLength::UNIT unitFromString (string const & data) { - int i=0; + int i = 0; while ((i 3) return 'E'; // Error string buffer = data.substr(0, i + 1); @@ -102,7 +102,7 @@ static char nextToken (string & data) return 'n'; } else return 'E'; // Error - } else if ((i=data.find_last_of("abcdefghijklmnopqrstuvwxyz")) + } else if ((i = data.find_last_of("abcdefghijklmnopqrstuvwxyz")) != string::npos) { if (unit_index > 3) return 'E'; // Error string buffer = data.substr(0, i + 1); @@ -303,12 +303,12 @@ LyXGlueLength::LyXGlueLength (string const & data) if (!isValidGlueLength (data, &tmp)) return; // should raise an exception else { - val=tmp.val; - uni=tmp.uni; - plus_val =tmp.plus_val; - plus_uni =tmp.plus_uni; - minus_val=tmp.minus_val; - minus_uni=tmp.minus_uni; + val = tmp.val; + uni = tmp.uni; + plus_val = tmp.plus_val; + plus_uni = tmp.plus_uni; + minus_val = tmp.minus_val; + minus_uni = tmp.minus_uni; } } @@ -433,7 +433,7 @@ VSpace::VSpace (string const & data) } -bool VSpace::operator== (VSpace const & other) const +bool VSpace::operator==(VSpace const & other) const { if (this->kin == other.kin) if (this->kin == LENGTH) diff --git a/src/vspace.h b/src/vspace.h index ee1922d5d0..5c61edc101 100644 --- a/src/vspace.h +++ b/src/vspace.h @@ -1,13 +1,13 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995 1996 Matthias Ettrich * and the LyX Team. * - *======================================================*/ + * ====================================================== */ #ifndef VSPACE_H #define VSPACE_H @@ -71,7 +71,7 @@ public: //@} /// - bool operator==(LyXLength const &) const; + bool operator== (LyXLength const &) const; /// conversion virtual string asString() const; @@ -82,7 +82,7 @@ public: /** If "data" is valid, the length represented by it is stored into "result", if that is not 0. */ friend bool isValidLength(string const & data, - LyXLength * result=0); + LyXLength * result= 0); protected: /// @@ -101,8 +101,8 @@ public: //@{ /// LyXGlueLength(float v, LyXLength::UNIT u, - float pv=0.0, LyXLength::UNIT pu=LyXLength::UNIT_NONE, - float mv=0.0, LyXLength::UNIT mu=LyXLength::UNIT_NONE) + float pv= 0.0, LyXLength::UNIT pu= LyXLength::UNIT_NONE, + float mv= 0.0, LyXLength::UNIT mu= LyXLength::UNIT_NONE) : LyXLength (v, u), plus_val(pv), minus_val(mv), plus_uni(pu), minus_uni(mu) {} @@ -129,7 +129,7 @@ public: //@} /// - bool operator==(LyXGlueLength const &) const; + bool operator == (LyXGlueLength const &) const; /// conversion virtual string asString() const; @@ -140,7 +140,7 @@ public: /** If "data" is valid, the length represented by it is stored into "result", if that is not 0. */ friend bool isValidGlueLength(string const & data, - LyXGlueLength* result=0); + LyXGlueLength* result= 0); protected: /// @@ -192,7 +192,7 @@ public: /// void setKeep(bool val) { kp = val; } /// - bool operator==(VSpace const &) const; + bool operator == (VSpace const &) const; // conversion /// -- 2.39.2