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%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, "%s>", 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, "%s>", stack[j]);
// closes the tag
fprintf(file, "%s>", 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