diff --git a/ChangeLog b/ChangeLog
index 9b18bad7ff..3fb7552597 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,10 @@
1999-11-02 Lars Gullik Bjønnes
+ * src/layout.C (less_textclass_desc): functor for use in sorting
+ of textclasses.
+ (LyXTextClass::Read): sort the textclasses after reading.
+
* src/support/filetools.C (SpaceLess): new version of the
SpaceLess functions. What problems does this one give? Please
report.
@@ -68,6 +72,12 @@
* added patch for OS/2 from SMiyata.
+1999-10-29 Lars Gullik Bjønnes
+
+ * src/text2.C (CutSelection): make space_wrapped a bool
+ (CutSelection): dont declare int i until we have to.
+ (alphaCounter): return a char const *.
+
1999-10-28 Jean-Marc Lasgouttes
* src/support/syscall.C (Systemcalls::kill):
@@ -79,6 +89,11 @@
1999-10-28 Lars Gullik Bjønnes
+ * src/layout.[Ch] + several files: access to class variables
+ limited and made accessor functions instead a lot of code changed
+ becuase of this. Also instead of returning pointers often a const
+ reference is returned instead.
+
* src/form1.C (create_form_Figure): added a couple fo "no-c-format"
* src/Makefile.am (dist-hook): added used to remove the CVS from
@@ -93,6 +108,32 @@
1999-10-27 Lars Gullik Bjønnes
+ * src/layout.[Ch] src/BufferView.C src/LaTeXFeatures.C
+ src/LyXView.C src/buffer.C src/bufferparams.C
+ src/lyx_cb.C src/lyxfunc.C src/paragraph.C src/text.C
+ src/text2.C src/insets/insetinclude.C:
+ lyxlayout renamed to textclasslist.
+
+ * src/layout.C: some lyxerr changes.
+
+ * src/layout.[Ch] (LyXLayout::Read): changed second paramter to
+ LyXTextClass. rewrote LT_COPYSTYLE, rewrote LT_OBSOLETEDBY
+ (LyXLayoutList): removed all traces of this class.
+ (LyXTextClass::Read): rewrote LT_STYLE
+ (LyXTextClass::hasLayout): new function
+ (LyXTextClass::GetLayout): rewritten to return an iterator + has
+ both const and nonconst version.
+ (LyXTextClass::delete_layout): new function.
+ (LyXTextClassList::Style): bug fix. do the right thing if layout
+ is to big.
+ (LyXTextClassList::NumberOfLayout): new acces to layoutlist.
+ (LyXTextClassList::NameOfLayout): ditto
+ (LyXTextClassList::Load): ditto
+
+ * src/buffer.C (makeLaTeXFile): new access to layoutlist
+
+ * src/LaTeXFeatures.C (getTClassPreamble): new access to layoutlist
+
* src/LyXAction.C (LookupFunc): added a workaround for sun
compiler, on the other hand...we don't know if the current code
compiles on sun at all...
@@ -122,8 +163,130 @@
* src/lyx_cb.C (MenuFax): subst fix
(PrintApplyCB): subst fix
+1999-10-26 Juergen Vigna
+
+ * src/table.C (TexEndOfCell) + (DocBookEndOfCell): removed some #if 0
+
+ (Read): Cleaned up this code so now we read only format vestion >= 5
+
1999-10-26 Lars Gullik Bjønnes
+ * src/support/filetools.C (PutEnvPath): subst fix for EMX, how
+ come nobody has complained about this one?
+
+ * src/insets/insetinclude.C (Latex): subst fix
+
+ * src/insets/insetbib.C (getKeys): subst fix
+
+ * src/lyx_main.C (init): subst fix
+
+ * src/layout.C (Read): subst fix
+
+ * src/buffer.C (RoffAsciiTable): subst fix
+
+ * src/lyx_cb.C (MenuFax): subst fix.
+
+ * src/layout.[hC] + some other files: rewrote to use
+ std::container to store textclasses and layouts in.
+ Simplified, removed a lot of code. Make all classes
+ assignable. Further simplifications and review of type
+ use still to be one.
+
+ * src/menus.C (ShowFileMenu/ShowFileMenu2): Use the iterators from
+ lastfiles to create the lastfiles partr of the menu.
+
+ * src/lastfiles.[Ch]: rewritten to use deque to store the
+ lastfiles in. Uses fstream for reading and writing. Simplifies
+ code.
+
+ * src/support/syscall.C: remove explicit cast.
+
+ * src/BufferView.C (CursorToggleCB): removed code snippets that
+ were commented out.
+ use explicat C++ style casts instead of C style casts. also use
+ u_vdata instea of passing pointers in longs.
+
+ * src/PaperLayout.C: removed code snippets that were commented out.
+
+ * src/lyx_gui_misc.C: removed code snippets that were commented out.
+
+ * src/lyx_main.C: removed code snippets that wer commented out.
+
+ * src/paragraph.C: removed code snippets that were commented out.
+
+ * src/lyxvc.C (logClose): use static_cast
+ (logUpdate): ditto
+ (viewLog): remove explicit cast to void*
+ (showLog): removed old commented code
+
+ * src/menus.C: use static_cast instead of C style casts. use
+ u_vdata instead of u_ldata. remove explicit cast to (long) for
+ pointers. Removed old code that was commented out.
+
+ * src/insets/inset.C: removed old commented func
+
+ * src/insets/insetref.C (InsetRef): removed old code that had been
+ commented out for a long time.
+ (Edit): ditto
+ (escape): removed C style cast
+
+ * src/insets/insetlatexaccent.C (Draw): removed old commented code
+
+ * src/insets/insetlatex.C (Draw): removed old commented code
+ (Read): rewritten to use string
+
+ * src/insets/insetlabel.C (escape): removed C style cast
+
+ * src/insets/insetindex.h: removed vdata and ldata from FD_index_form
+
+ * src/insets/insetindex.C: use static_cast and u_vdata, removed
+ old commented code.
+
+ * src/insets/insetinclude.h: removed a couple of stupid bools
+
+ * src/insets/insetinclude.C (include_cb): use static_cast and u_data.
+ (Clone): remove C style cast
+ (getKeys): changed list to lst because of std::list
+
+ * src/insets/inseterror.C (Draw): removed som old commented code.
+
+ * src/insets/insetcommand.C (Draw): removed some old commented code.
+
+ * src/insets/insetbib.C (bibitem_cb): removed code that has been
+ commented out forever.
+ (bibitem_cb): use static_cast instead of C style cast
+ use of vdata changed to u_vdata.
+
+ * src/insets/inseturl.C (C_InsetUrl_CloseUrlCB): forward the data
+ parameter.
+ (CloseUrlCB): use static_cast instead of C style cast.
+ (CloseUrlCB): added a fl_free form...it seemed to be missing.
+
+ * src/insets/insetinfo.C (Edit): pass object in u_vdata instead
+ (C_InsetInfo_CloseInfoCB): forward the ob parameter
+ (CloseInfoCB): static_cast from ob->u_vdata instead.
+ (Edit): removed bogus arg from fl_set_object_shortcut, set to 1
+ instead.
+
+ * src/insets/inseterror.C (Edit): pass object in u_vdata instead
+ (C_InsetError_CloseErrorCB): forward the ob parameter
+ (CloseErrorCB): static_cast from ob->u_vdata instead.
+
+ * src/vspace.h: include LString.h since we use string in this class.
+
+ * src/vspace.C (lyx_advance): changed name from advance because of
+ nameclash with stl. And since we cannot use namespaces yet...I
+ used a lyx_ prefix instead. Expect this to change when we begin
+ using namespaces.
+
+ * src/BufferView.[Ch] (BufferView::~BufferView): removed
+
+ * src/BackStack.h: rewrote to use std::stack. made BackStackItem
+ and removed now defunct constructor and deconstructor.
+
+ * src/BufferView.h: have backstack as a object not as a pointer.
+ removed initialization from constructor. added include for BackStack
+
* development/lyx.spec.in (%build): add CFLAGS also.
* src/screen.C (drawFrame): removed another warning.
@@ -208,6 +371,13 @@
1999-10-24 Lars Gullik Bjønnes
+1999-10-24 Lars Gullik Bjønnes
+
+ * src/LaTeX.C (run): made run_bibtex also depend on files with
+ extension ".bst"
+ (runBibTeX): added scans for "\\bibstyle", now also ".bst" files
+ are put into the dependency file.
+
* src/spellchecker.C (create_ispell_pipe): removed old #warning,
the code has shown itself to work
(create_ispell_pipe): removed another warning, added a comment
@@ -316,6 +486,21 @@
1999-10-22 Lars Gullik Bjønnes
+ * src/LaTeX.C (run): added a check in 0 sumchange so that if it
+ was a bib file that had been changed we ensure that bibtex is run.
+ (runBibTeX): enhanced to extract the names of the bib files and
+ getting their absolute path and enter them into the dep file.
+ (findtexfile): static func that is used to look for tex-files,
+ checks for absolute patchs and tries also with kpsewhich.
+ Alternative ways of finding the correct files are wanted. Will
+ probably be moved.
+ (do_popen): function that runs a command using popen and returns
+ the whole output of that command in a string. Should be moved to
+ somewhere else.
+
+ * src/DepTable.[Ch] (extchanged): new function that returns true if a
+ file with extension ext has changed.
+
* src/insets/figinset.C: added ifdef guards around the fl_free
code that jug commented out. Now it is commented out when
compiling with XForms == 0.89.
@@ -359,6 +544,27 @@
1999-10-20 Lars Gullik Bjønnes
+ * src/support/lyxstring.C (getline): reads now _all_ chars. uses
+ get instead of >>
+
+ * src/Literate.h: some funcs moved from public to private to make
+ interface clearer. Unneeded args removed.
+
+ * src/Literate.C (scanLiterateLogFile): rewritten to use iostream
+ instead of lyxlex.
+ (scanBuildLogFile): ditto
+
+ * src/LaTeX.C (scanLogFile): merged LaTeX Error handling into
+ normal TeX Error. Still room for improvement.
+
+ * src/LaTeX.[Ch]: removed scanError. Wrong place and not needed.
+
+ * src/buffer.C (insertErrors): changes to make the error
+ desctription show properly.
+
+ * src/LaTeX.C (deplog): removed the test for file in lyx doc dir.
+ could never happen
+
* src/support/lyxstring.C (helper): changed to use
sizeof(object->rep->ref).
(operator>>): changed to use a pointer instead.
@@ -469,8 +675,20 @@
* src/lyxrc.C (Read): RC_PRINTEXSTRAOPTIONS now uses
LyXLex::next() and not eatline() to get its argument.
+1999-10-17 Lars Gullik Bjønnes
+
+ * src/DepTable.[Ch]: rewritten to store the dependencies in a map
+ instead, use fstreams for io of the depfile, removed unneeded
+ functions and variables.
+
+ * src/LaTeX.[Ch] (class TeXErrors): rewrote to store the errors in a
+ vector instead, removed all functions and variables that is not in
+ use.
+
1999-10-16 Lars Gullik Bjønnes
+ * src/buffer.C (insertErrors): use new interface to TeXError
+
* Makefile.am (rpmdist): added a rpmdist target
* lib/reLyX/Makefile.am: added RelyxFigure.pm and Verbatim.pm as
diff --git a/Makefile.am b/Makefile.am
index f1a91f2310..5da61745cf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,3 +22,4 @@ rpmdist: dist
ln -s images/lyx.xpm . ; \
rpm -ta ${PACKAGE}-${VERSION}.tar.gz ; \
rm lyx.xpm
+
diff --git a/src/BackStack.h b/src/BackStack.h
index 5ca40451a3..b56bb64147 100644
--- a/src/BackStack.h
+++ b/src/BackStack.h
@@ -11,6 +11,7 @@
#ifndef BACK_STACK_H
#define BACK_STACK_H
+#include
#include "LString.h"
// Created by Alejandro Aguilar Sierra, 970806
@@ -18,13 +19,15 @@
/** Utility to get back from a reference or from a child document.
*/
class BackStack {
-public:
+private:
///
struct BackStackItem {
+ BackStackItem(string const & f, int xx, int yy)
+ : fname(f), x(xx), y(yy) {}
///
- void set(string f, int xx, int yy) {
- fname = f; x = xx; y = yy;
- }
+ //void set(string f, int xx, int yy) {
+ // fname = f; x = xx; y = yy;
+ //}
/// Filename
string fname;
/// Cursor x-position
@@ -32,35 +35,27 @@ public:
/// Cursor y-position
int y;
};
- ///
- BackStack(int n) : item(new BackStackItem[n]) , i(0), imax(n) {}
- ///
- ~BackStack() {
- delete[] item;
- }
+public:
///
void push(string f, int x, int y) {
- if (i < imax)
- item[i++].set(f, x, y);
+ BackStackItem bit(f, x, y);
+ stakk.push(bit);
}
///
- string & pop(int *x, int *y) {
- if (i > 0) i--;
- *x = item[i].x;
- *y = item[i].y;
- return item[i].fname;
+ string pop(int * x, int * y) {
+ BackStackItem bit = stakk.top();
+ *x = bit.x;
+ *y = bit.y;
+ stakk.pop();
+ return bit.fname;
}
///
bool empty() const {
- return i == 0;
+ return stakk.empty();
}
private:
///
- BackStackItem *item;
- ///
- int i;
- ///
- int imax;
+ stack stakk;
};
#endif
diff --git a/src/BufferView.C b/src/BufferView.C
index a9abd9ff9c..e8f2fd63e2 100644
--- a/src/BufferView.C
+++ b/src/BufferView.C
@@ -40,6 +40,7 @@
#include "lyxtext.h"
#include "lyx_cb.h"
#include "gettext.h"
+#include "layout.h"
extern BufferList bufferlist;
void sigchldhandler(pid_t pid, int *status);
@@ -56,7 +57,7 @@ extern InsetUpdateStruct *InsetUpdateList;
extern void UpdateInsetUpdateList();
// This is _very_ temporary
-FL_OBJECT *figinset_canvas;
+FL_OBJECT * figinset_canvas;
BufferView::BufferView(LyXView *o, int xpos, int ypos,
int width, int height)
@@ -78,16 +79,9 @@ BufferView::BufferView(LyXView *o, int xpos, int ypos,
fl_set_focus_object(_owner->getForm(), work_area);
work_area_focus = true;
lyx_focus = false;
- backstack = new BackStack(16);
}
-BufferView::~BufferView()
-{
- delete backstack;
-}
-
-
void BufferView::setBuffer(Buffer *b)
{
lyxerr.debug() << "Setting buffer in BufferView" << endl;
@@ -129,7 +123,6 @@ void BufferView::setBuffer(Buffer *b)
} else {
lyxerr.debug() << " No Buffer!" << endl;
_owner->getMenus()->hideMenus();
- //workAreaExpose();
updateScrollbar();
fl_redraw_object(work_area);
}
@@ -241,9 +234,9 @@ void BufferView::updateScrollbar()
fl_set_slider_increment(scrollbar,work_area->h-lineh,lineh);
#endif
if (maxfloat>0){
- if ((hfloat/maxfloat) * (float) height2 < 3)
+ if ((hfloat/maxfloat) * float(height2) < 3)
fl_set_slider_size(scrollbar,
- 3/(float)height2);
+ 3/float(height2));
else
fl_set_slider_size(scrollbar,
hfloat/maxfloat);
@@ -267,9 +260,9 @@ int BufferView::resizeCurrentBuffer()
{
lyxerr.debug() << "resizeCurrentBuffer" << endl;
- LyXParagraph *par = 0;
- LyXParagraph *selstartpar = 0;
- LyXParagraph *selendpar = 0;
+ LyXParagraph * par = 0;
+ LyXParagraph * selstartpar = 0;
+ LyXParagraph * selendpar = 0;
int pos = 0;
int selstartpos = 0;
int selendpos = 0;
@@ -364,33 +357,34 @@ void BufferView::gotoError()
_buffer->text->cursor;
}
+
// Just a bunch of C wrappers around static members of BufferView
-extern "C" void C_BufferView_UpCB(FL_OBJECT *ob, long buf) {
- BufferView::UpCB(ob,buf);
+extern "C" void C_BufferView_UpCB(FL_OBJECT * ob, long buf) {
+ BufferView::UpCB(ob, buf);
}
-extern "C" void C_BufferView_DownCB(FL_OBJECT *ob, long buf) {
- BufferView::DownCB(ob,buf);
+extern "C" void C_BufferView_DownCB(FL_OBJECT * ob, long buf) {
+ BufferView::DownCB(ob, buf);
}
-extern "C" void C_BufferView_ScrollCB(FL_OBJECT *ob, long buf) {
- BufferView::ScrollCB(ob,buf);
+extern "C" void C_BufferView_ScrollCB(FL_OBJECT * ob, long buf) {
+ BufferView::ScrollCB(ob, buf);
}
-extern "C" void C_BufferView_CursorToggleCB(FL_OBJECT *ob, long buf) {
- BufferView::CursorToggleCB(ob,buf);
+extern "C" void C_BufferView_CursorToggleCB(FL_OBJECT * ob, long buf) {
+ BufferView::CursorToggleCB(ob, buf);
}
-extern "C" int C_BufferView_work_area_handler(FL_OBJECT *ob, int event,
+extern "C" int C_BufferView_work_area_handler(FL_OBJECT * ob, int event,
FL_Coord, FL_Coord,
- int key, void *xev) {
+ int key, void * xev) {
return BufferView::work_area_handler(ob, event, 0, 0, key, xev);
}
void BufferView::create_view(int xpos, int ypos, int width, int height)
{
- FL_OBJECT *obj;
+ FL_OBJECT * obj;
const int bw = abs(fl_get_border_width());
// a hack for the figinsets (Matthias)
@@ -441,7 +435,8 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
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_callback(obj,C_BufferView_UpCB,(long)this);
+ fl_set_object_callback(obj, C_BufferView_UpCB, 0);
+ obj->u_vdata = this;
fl_set_pixmapbutton_data(obj, up_xpm);
#if FL_REVISION >85
@@ -459,7 +454,8 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
fl_set_object_boxtype(obj, FL_UP_BOX);
fl_set_object_resize(obj, FL_RESIZE_ALL);
fl_set_object_gravity(obj, NorthEastGravity, SouthEastGravity);
- fl_set_object_callback(obj,C_BufferView_ScrollCB,(long)this);
+ fl_set_object_callback(obj, C_BufferView_ScrollCB, 0);
+ obj->u_vdata = this;
// down - scrollbar button
#if FL_REVISION > 85
@@ -475,7 +471,8 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
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,(long)this);
+ fl_set_object_callback(obj, C_BufferView_DownCB, 0);
+ obj->u_vdata = this;
fl_set_pixmapbutton_data(obj, down_xpm);
fl_set_border_width(-bw);
@@ -497,13 +494,13 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
// Callback for scrollbar up button
-void BufferView::UpCB(FL_OBJECT *ob, long buf)
+void BufferView::UpCB(FL_OBJECT * ob, long)
{
- BufferView *view = (BufferView*) buf;
+ BufferView * view = static_cast(ob->u_vdata);
if (view->_buffer == 0) return;
- const XEvent*ev2;
+ XEvent const * ev2;
static long time = 0;
ev2 = fl_last_event();
if (ev2->type == ButtonPress || ev2->type == ButtonRelease)
@@ -540,20 +537,20 @@ void waitForX()
}
static XEvent ev;
XChangeProperty(fl_display, w, a, a, 8,
- PropModeAppend, (unsigned char *)"", 0);
+ PropModeAppend, reinterpret_cast(""), 0);
XWindowEvent(fl_display, w, PropertyChangeMask, &ev);
}
// Callback for scrollbar slider
-void BufferView::ScrollCB(FL_OBJECT *ob, long buf)
+void BufferView::ScrollCB(FL_OBJECT * ob, long)
{
- BufferView *view = (BufferView*) buf;
+ BufferView *view = static_cast(ob->u_vdata);
extern bool cursor_follows_scrollbar;
if (view->_buffer == 0) return;
- view->current_scrollbar_value = (long)fl_get_slider_value(ob);
+ view->current_scrollbar_value = long(fl_get_slider_value(ob));
if (view->current_scrollbar_value < 0)
view->current_scrollbar_value = 0;
@@ -584,13 +581,13 @@ void BufferView::ScrollCB(FL_OBJECT *ob, long buf)
// Callback for scrollbar down button
-void BufferView::DownCB(FL_OBJECT *ob, long buf)
+void BufferView::DownCB(FL_OBJECT * ob, long)
{
- BufferView *view = (BufferView*) buf;
+ BufferView * view = static_cast(ob->u_vdata);
if (view->_buffer == 0) return;
- const XEvent*ev2;
+ XEvent const *ev2;
static long time = 0;
ev2 = fl_last_event();
if (ev2->type == ButtonPress || ev2->type == ButtonRelease)
@@ -619,11 +616,11 @@ int BufferView::ScrollUp(long time)
return 0;
float add_value = (_buffer->text->DefaultHeight()
- + (float)(time) * (float)(time) * 0.125);
+ + float(time) * float(time) * 0.125);
if (add_value > work_area->h)
- add_value = (float) (work_area->h -
- _buffer->text->DefaultHeight());
+ add_value = float(work_area->h -
+ _buffer->text->DefaultHeight());
value -= add_value;
@@ -632,7 +629,7 @@ int BufferView::ScrollUp(long time)
fl_set_slider_value(scrollbar, value);
- ScrollCB(scrollbar,(long)this);
+ ScrollCB(scrollbar, 0);
return 0;
}
@@ -651,11 +648,11 @@ int BufferView::ScrollDown(long time)
return 0;
float add_value = (_buffer->text->DefaultHeight()
- + (float)(time) * (float)(time) * 0.125);
+ + float(time) * float(time) * 0.125);
if (add_value > work_area->h)
- add_value = (float) (work_area->h -
- _buffer->text->DefaultHeight());
+ add_value = float(work_area->h -
+ _buffer->text->DefaultHeight());
value += add_value;
@@ -664,7 +661,7 @@ int BufferView::ScrollDown(long time)
fl_set_slider_value(scrollbar, value);
- ScrollCB(scrollbar,(long)this);
+ ScrollCB(scrollbar, 0);
return 0;
}
@@ -684,7 +681,7 @@ void BufferView::ScrollUpOnePage(long /*time*/)
fl_set_slider_value(scrollbar, y);
- ScrollCB(scrollbar,(long)this);
+ ScrollCB(scrollbar, 0);
}
@@ -706,7 +703,7 @@ void BufferView::ScrollDownOnePage(long /*time*/)
fl_set_slider_value(scrollbar, y);
- ScrollCB(scrollbar,(long)this);
+ ScrollCB(scrollbar, 0);
}
@@ -718,8 +715,8 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event,
static int y_old = -1;
static long scrollbar_value_old = -1;
- XEvent* ev = (XEvent*) xev;
- BufferView *view = (BufferView*) ob->u_vdata;
+ XEvent * ev = static_cast(xev);
+ BufferView * view = static_cast(ob->u_vdata);
// If we don't have a view yet; return
if (!view || quitting) return 0;
@@ -858,7 +855,7 @@ int BufferView::WorkAreaMotionNotify(FL_OBJECT *ob, Window,
}
-extern int bibitemMaxWidth(const class LyXFont &);
+extern int bibitemMaxWidth(LyXFont const &);
// Single-click on work area
int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
@@ -1163,8 +1160,8 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
// Maybe we want to edit a bibitem ale970302
if (_buffer->text->cursor.par->bibkey && x < 20 +
- bibitemMaxWidth(lyxstyle.TextClass(_buffer->
- params.textclass)->defaultfont)) {
+ bibitemMaxWidth(textclasslist.TextClass(_buffer->
+ params.textclass).defaultfont())) {
_buffer->text->cursor.par->bibkey->Edit(0, 0);
}
@@ -1177,7 +1174,7 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
* If hit, the coordinates are changed relative to the inset.
* Otherwise coordinates are not changed, and false is returned.
*/
-Inset * BufferView::checkInsetHit(int &x, int &y)
+Inset * BufferView::checkInsetHit(int & x, int & y)
{
if (!getScreen())
return 0;
@@ -1272,19 +1269,17 @@ int BufferView::workAreaExpose()
// Callback for cursor timer
-void BufferView::CursorToggleCB(FL_OBJECT *ob, long)
+void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
{
- BufferView *view = (BufferView*) ob->u_vdata;
+ BufferView *view = static_cast(ob->u_vdata);
/* quite a nice place for asyncron Inset updating, isn't it? */
// actually no! This is run even if no buffer exist... so (Lgb)
if (view && !view->_buffer) {
goto set_timer_and_return;
}
-#ifdef WITH_WARNINGS
-#warning NOTE!
-#endif
+ // NOTE:
// On my quest to solve the gs rendre hangups I am now
// disabling the SIGHUP completely, and will do a wait
// now and then instead. If the guess that xforms somehow
@@ -1312,7 +1307,6 @@ void BufferView::CursorToggleCB(FL_OBJECT *ob, long)
// rendering process.
// these comments posted to lyx@via
-//#if 0
{
int status = 1;
int pid = waitpid((pid_t)0, &status, WNOHANG);
@@ -1321,7 +1315,6 @@ void BufferView::CursorToggleCB(FL_OBJECT *ob, long)
else if (pid > 0)
sigchldhandler(pid, &status);
}
-//#endif
if (InsetUpdateList)
UpdateInsetUpdateList();
@@ -1387,7 +1380,7 @@ int BufferView::WorkAreaSelectionNotify(FL_OBJECT *, Window win,
Atom tmpatom;
unsigned long ul1;
unsigned long ul2;
- unsigned char* uc = 0;
+ unsigned char * uc = 0;
int tmpint;
screen->HideCursor();
BeforeChange();
@@ -1436,12 +1429,13 @@ int BufferView::WorkAreaSelectionNotify(FL_OBJECT *, Window win,
XFlush(fl_display);
if (uc){
- if (!ascii_type)
+ if (!ascii_type) {
_buffer->text->
- InsertStringA((char*)uc);
- else
+ InsertStringA(reinterpret_cast(uc));
+ } else {
_buffer->text->
- InsertStringB((char*)uc);
+ InsertStringB(reinterpret_cast(uc));
+ }
free(uc);
uc = 0;
}
@@ -1457,7 +1451,7 @@ void BufferView::cursorPrevious()
if (!currentBuffer()->text->cursor.row->previous) return;
long y = getScreen()->first;
- Row* cursorrow = currentBuffer()->text->cursor.row;
+ Row * cursorrow = currentBuffer()->text->cursor.row;
currentBuffer()->text->
SetCursorFromCoordinates(currentBuffer()->text->
cursor.x_fix,
@@ -1506,7 +1500,7 @@ bool BufferView::available() const
void BufferView::savePosition()
{
- backstack->push(currentBuffer()->getFileName(),
+ backstack.push(currentBuffer()->getFileName(),
currentBuffer()->text->cursor.x,
currentBuffer()->text->cursor.y);
}
@@ -1514,13 +1508,13 @@ void BufferView::savePosition()
void BufferView::restorePosition()
{
- if (backstack->empty()) return;
+ if (backstack.empty()) return;
int x, y;
- string fname = backstack->pop(&x, &y);
+ string fname = backstack.pop(&x, &y);
BeforeChange();
- Buffer *b = (bufferlist.exists(fname)) ? bufferlist.getBuffer(fname):
+ Buffer * b = (bufferlist.exists(fname)) ? bufferlist.getBuffer(fname):
bufferlist.loadLyXFile(fname); // don't ask, just load it
setBuffer(b);
currentBuffer()->text->SetCursorFromCoordinates(x, y);
diff --git a/src/BufferView.h b/src/BufferView.h
index 25157ba325..07bc95f88a 100644
--- a/src/BufferView.h
+++ b/src/BufferView.h
@@ -1,27 +1,27 @@
// -*- C++ -*-
/* This file is part of
-* ======================================================
-*
-* LyX, The Document Processor
-*
-* Copyright (C) 1995 Matthias Ettrich
-* Copyright (C) 1995-1998 The LyX Team.
-*
-*======================================================*/
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright (C) 1995 Matthias Ettrich
+ * Copyright (C) 1995-1998 The LyX Team.
+ *
+ * ======================================================*/
-#ifndef _BUFFER_VIEW_H
-#define _BUFFER_VIEW_H
+#ifndef BUFFER_VIEW_H
+#define BUFFER_VIEW_H
#ifdef __GNUG__
#pragma interface
#endif
#include FORMS_H_LOCATION
+#include "BackStack.h"
class LyXView;
class Buffer;
class LyXScreen;
-class BackStack;
class Inset;
///
@@ -29,8 +29,6 @@ class BufferView {
public:
///
BufferView(LyXView *owner, int ,int ,int, int);
- ///
- ~BufferView();
///
Buffer *currentBuffer() { return _buffer; }
///
@@ -152,7 +150,7 @@ private:
///
FL_OBJECT *timer_cursor;
///
- BackStack *backstack;
+ BackStack backstack;
///
int last_click_x, last_click_y;
};
diff --git a/src/Chktex.C b/src/Chktex.C
index dc94696ace..f4f9cf22da 100644
--- a/src/Chktex.C
+++ b/src/Chktex.C
@@ -61,32 +61,21 @@ int Chktex::scanLogFile(TeXErrors &terr)
string token;
int retval = 0;
- LyXLex lex(0, 0);
-
string tmp = ChangeExtension(file, ".log", true);
- if (!lex.setFile(tmp)) {
- // Unable to open file. Return at once
- return -1;
- }
-
- while (lex.IsOK()) {
- if (lex.EatLine())
- token = lex.GetString();
- else // blank line in the file being read
- continue;
-
+ ifstream ifs(tmp.c_str());
+ while (getline(ifs, token)) {
string srcfile, line, pos, warno, warning;
- token=split(token, srcfile, ':');
- token=split(token, line, ':');
- token=split(token, pos, ':');
- token=split(token, warno, ':');
- token=split(token, warning, ':');
+ token = split(token, srcfile, ':');
+ token = split(token, line, ':');
+ token = split(token, pos, ':');
+ token = split(token, warno, ':');
+ token = split(token, warning, ':');
int lineno = atoi(line.c_str());
warno = _("ChkTeX warning id #") + warno;
terr.insertError(lineno, warno, warning);
- retval++;
+ ++retval;
}
return retval;
}
diff --git a/src/DepTable.C b/src/DepTable.C
index e3a5acc262..dd15f5d042 100644
--- a/src/DepTable.C
+++ b/src/DepTable.C
@@ -13,46 +13,14 @@
#include
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
#include "DepTable.h"
#include "support/lyxlib.h"
#include "support/filetools.h"
-
-DepTable::DepTable()
-{
- new_sum = 0;
- old_sum = 0;
- next = 0;
-}
-
-
-DepTable::DepTable(string const & f,
- bool upd,
- unsigned long one,
- unsigned long two)
-{
- // not quite sure if this is the correct place for MakeAbsPath
- file = MakeAbsPath(f);
- new_sum = 0; old_sum = 0;
- if (one != 0)
- new_sum = one;
- if (two != 0)
- old_sum = two;
- if (upd) {
- old_sum = new_sum;
- new_sum = lyxsum(file.c_str());
- }
- if (lyxerr.debugging()) {
- char tmp1[256];
- char tmp2[256];
- sprintf(tmp1, "%lu", new_sum);
- sprintf(tmp2, "%lu", old_sum);
- lyxerr.debug() << "New file inserted in deplog: "
- << file << " "
- << tmp1 << " " << tmp2 << endl;
- }
- next = 0;
-}
-
+#include
void DepTable::insert(string const & fi,
bool upd,
@@ -61,42 +29,40 @@ void DepTable::insert(string const & fi,
{
// not quite sure if this is the correct place for MakeAbsPath
string f = MakeAbsPath(fi);
- if (f == file) return; // exist already in the log
- if (next)
- next->insert(f, upd, one, two);
- else
- next = new DepTable(f, upd, one, two);
+ if (deplist.find(f) == deplist.end()) {
+ if (upd) {
+ one = two;
+ two = lyxsum(f.c_str());
+ }
+ deplist[f] = make_pair(one, two);
+ }
}
void DepTable::update()
{
- if (!file.empty()) {
- old_sum = new_sum;
- new_sum = lyxsum(file.c_str());
+ for(DepList::iterator itr = deplist.begin();
+ itr != deplist.end();
+ ++itr) {
+ unsigned long one = (*itr).second.second;
+ unsigned long two = lyxsum((*itr).first.c_str());
+ (*itr).second = make_pair(one, two);
if (lyxerr.debugging()) {
- char tmp1[256];
- char tmp2[256];
- sprintf(tmp1, "%lu", new_sum);
- sprintf(tmp2, "%lu", old_sum);
- lyxerr.debug() << "update: " << file << " "
- << tmp1 << " " << tmp2 << endl;
+ lyxerr << "update: " << (*itr).first << " "
+ << one << " " << two << endl;
}
}
- if (next) next->update();
}
bool DepTable::sumchange()
{
- bool ret = false;
-
- if (!file.empty()) {
- if (old_sum != new_sum) ret = true;
+ for (DepList::const_iterator cit = deplist.begin();
+ cit != deplist.end();
+ ++cit) {
+ if ((*cit).second.first != (*cit).second.second) return true;
}
- if (!ret && next) ret = next->sumchange();
-
- return ret;
+ return false;
}
@@ -104,65 +70,62 @@ bool DepTable::haschanged(string const & f)
{
// not quite sure if this is the correct place for MakeAbsPath
string fil = MakeAbsPath(f);
- bool ret = false;
-
- if (!fil.empty() && !file.empty() && fil == file) {
- if (new_sum != old_sum && new_sum != 0)
- ret = true;
+ DepList::const_iterator cit = deplist.find(fil);
+ if (cit != deplist.end()) {
+ if ((*cit).second.first != (*cit).second.second
+ && (*cit).second.second != 0)
+ return true;
}
- if (!ret && next) ret = next->haschanged(fil);
- return ret;
+ return false;
}
-void DepTable::write(string const&f)
+bool DepTable::extchanged(string const & ext)
{
- FilePtr fp(f, FilePtr::write);
- if (fp() && next) next->write(fp());
+ for (DepList::const_iterator cit = deplist.begin();
+ cit != deplist.end();
+ ++cit) {
+ if (suffixIs((*cit).first, ext.c_str())) {
+ if ((*cit).second.first != (*cit).second.second)
+ return true;
+ }
+ }
+
+ return false;
}
+void DepTable::write(string const & f)
+{
+ ofstream ofs(f.c_str());
+ for (DepList::const_iterator cit = deplist.begin();
+ cit != deplist.end();
+ ++cit) {
+ if (lyxerr.debugging()) {
+ lyxerr << "Write dep: "
+ << (*cit).first << " "
+ << (*cit).second.first << " "
+ << (*cit).second.second << endl;
+ }
+ ofs << (*cit).first << " "
+ << (*cit).second.first << " "
+ << (*cit).second.second << endl;
+ }
+}
+
void DepTable::read(string const &f)
{
- FilePtr fp(f, FilePtr::read);
- if (fp()) { // file opened
- char nome[256];
- unsigned long one = 0;
- unsigned long two = 0;
- // scan the file line by line
- // return true if the two numbers on the line is different
- int ret = 0;
- while (!feof(fp())) {
- ret = fscanf(fp(), "%s %lu %lu",
- nome, &one, &two);
- if (ret !=3) continue;
- if (lyxerr.debugging()) {
- char tmp1[255];
- char tmp2[255];
- sprintf(tmp1, "%lu", one);
- sprintf(tmp2, "%lu", two);
- lyxerr.debug() << "read dep: "
- << nome << " " << tmp1
- << " " << tmp2 << endl;
- }
- insert(string(nome), false, one, two);
+ ifstream ifs(f.c_str());
+ string nome;
+ unsigned long one = 0;
+ unsigned long two = 0;
+ while(ifs >> nome >> one >> two) {
+ if (lyxerr.debugging()) {
+ lyxerr << "read dep: "
+ << nome << " "
+ << one << " "
+ << two << endl;
}
+ deplist[nome] = make_pair(one, two);
}
}
-
-
-void DepTable::write(FILE * f)
-{
- if (lyxerr.debugging()) {
- char tmp1[255];
- char tmp2[255];
- sprintf(tmp1, "%lu", new_sum);
- sprintf(tmp2, "%lu", old_sum);
- lyxerr << "Write dep: " << file << " "
- << tmp1 << " " << tmp2 << endl;
- }
- fprintf(f, "%s %lu %lu\n", file.c_str(),
- new_sum, old_sum);
- if (next)
- next->write(f);
-}
diff --git a/src/DepTable.h b/src/DepTable.h
index f23e66adb2..0f9b4827fe 100644
--- a/src/DepTable.h
+++ b/src/DepTable.h
@@ -15,18 +15,19 @@
#define DEP_TABLE_H
#include "LString.h"
-#include
+#include
");
}
- sgmlOpenTag(file,depth,style->latexname);
+ sgmlOpenTag(file,depth,style.latexname());
break;
case LATEX_COMMAND:
@@ -2193,13 +2220,13 @@ void Buffer::makeLinuxDocFile(string const & filename, int column)
}
environment_stack[depth].clear();
- sgmlOpenTag(file,depth, style->latexname);
+ sgmlOpenTag(file,depth, style.latexname());
break;
case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT:
if(depth == par->depth
- && environment_stack[depth]!=style->latexname
+ && environment_stack[depth] != style.latexname()
&& !environment_stack[depth].empty()) {
sgmlCloseTag(file,depth,environment_stack[depth]);
@@ -2209,17 +2236,17 @@ void Buffer::makeLinuxDocFile(string const & filename, int column)
depth = par->depth;
environment_stack[depth].clear();
}
- if (environment_stack[depth] != style->latexname) {
+ if (environment_stack[depth] != style.latexname()) {
if(depth==0) {
string temp="p";
sgmlOpenTag(file,depth,temp);
}
- environment_stack[depth]= style->latexname;
+ environment_stack[depth] = style.latexname();
sgmlOpenTag(file,depth,environment_stack[depth]);
}
- if(style->latextype == LATEX_ENVIRONMENT) break;
+ if(style.latextype == LATEX_ENVIRONMENT) break;
- desc_on =(style->labeltype == LABEL_MANUAL);
+ desc_on =(style.labeltype == LABEL_MANUAL);
if(desc_on)
item_name="tag";
@@ -2229,7 +2256,7 @@ void Buffer::makeLinuxDocFile(string const & filename, int column)
sgmlOpenTag(file,depth+1,item_name);
break;
default:
- sgmlOpenTag(file,depth,style->latexname);
+ sgmlOpenTag(file, depth, style.latexname());
break;
}
@@ -2243,13 +2270,13 @@ void Buffer::makeLinuxDocFile(string const & filename, int column)
fprintf(file,"\n");
/* write closing SGML tags */
- switch(style->latextype) {
+ switch(style.latextype) {
case LATEX_COMMAND:
case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT:
break;
default:
- sgmlCloseTag(file,depth,style->latexname);
+ sgmlCloseTag(file, depth, style.latexname());
break;
}
@@ -2293,10 +2320,10 @@ void Buffer::DocBookHandleCaption(FILE *file, string &inner_tag,
LyXParagraph *tpar = par;
string tmp_par, extra_par;
while (tpar && (tpar->footnoteflag != LyXParagraph::NO_FOOTNOTE) &&
- (tpar->layout != lyxstyle.NumberOfLayout(params.textclass,"Caption")))
+ (tpar->layout != textclasslist.NumberOfLayout(params.textclass,"Caption").second))
tpar = tpar->next;
if (tpar &&
- tpar->layout==lyxstyle.NumberOfLayout(params.textclass,"Caption")) {
+ 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);
@@ -2384,8 +2411,8 @@ void Buffer::DocBookHandleFootnote(FILE *file,LyXParagraph* &par, int const dept
}
}
// ignore all caption here, we processed them above!!!
- if (par->layout != lyxstyle.NumberOfLayout(params.textclass,
- "Caption")) {
+ if (par->layout != textclasslist.NumberOfLayout(params.textclass,
+ "Caption").second) {
SimpleDocBookOnePar(tmp_par,extra_par,par,
desc_on,depth+2);
}
@@ -2462,9 +2489,14 @@ void Buffer::SimpleLinuxDocOnePar(FILE *file, LyXParagraph *par, int desc_on, in
{
LyXFont font1,font2;
char c;
- Inset *inset;
+ Inset * inset;
+#ifdef NEW_TEXT
+ LyXParagraph::size_type main_body;
+ int j;
+#else
int main_body, j;
- LyXLayout * style = lyxstyle.Style(params.textclass, par->GetLayout());
+#endif
+ LyXLayout const & style = textclasslist.Style(params.textclass, par->GetLayout());
char family_type = 0; // family font flag
bool is_bold = false; // series font flag
@@ -2475,25 +2507,30 @@ void Buffer::SimpleLinuxDocOnePar(FILE *file, LyXParagraph *par, int desc_on, in
char stack[5][3]; // style stack
unsigned int char_line_count = 5; // Heuristic choice ;-)
- if (style->labeltype != LABEL_MANUAL)
+ if (style.labeltype != LABEL_MANUAL)
main_body = 0;
else
main_body = par->BeginningOfMainBody();
/* gets paragraph main font */
if (main_body > 0)
- font1 = style->labelfont;
+ font1 = style.labelfont;
else
- font1 = style->font;
+ font1 = style.font;
/* 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()) {
if (main_body > 0)
- font1 = style->font;
+ font1 = style.font;
}
font2 = par->getFont(i);
@@ -2605,7 +2642,7 @@ void Buffer::SimpleLinuxDocOnePar(FILE *file, LyXParagraph *par, int desc_on, in
else {
string sgml_string;
if (par->linuxDocConvertChar(c, sgml_string)
- && !style->free_spacing) { // in freespacing
+ && !style.free_spacing) { // in freespacing
// mode, spaces are
// non-breaking characters
// char is ' '
@@ -2628,13 +2665,18 @@ void Buffer::SimpleLinuxDocOnePar(FILE *file, LyXParagraph *par, int desc_on, in
font1 = font2;
}
- /* needed if there is an optional argument but no contents */
- if (main_body > 0 && main_body == par->last) {
- font1 = style->font;
+ /* 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--) {
+ for (j = stack_num; j >= 0; j--) {
linux_doc_line_break(file,
char_line_count,
3+strlen(stack[j]));
@@ -2656,10 +2698,10 @@ void Buffer::SimpleLinuxDocOnePar(FILE *file, LyXParagraph *par, int desc_on, in
/* print an error message */
-void Buffer::LinuxDocError(LyXParagraph *par, int pos,
- char const *message)
+void Buffer::LinuxDocError(LyXParagraph * par, int pos,
+ char const * message)
{
- InsetError *new_inset;
+ InsetError * new_inset;
/* insert an error marker in text */
new_inset = new InsetError(message);
@@ -2677,9 +2719,9 @@ enum { MAX_NEST_LEVEL = 25};
void Buffer::makeDocBookFile(string const & filename, int column)
{
- LyXParagraph *par = paragraph;
+ LyXParagraph * par = paragraph;
- string top_element=lyxstyle.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];
@@ -2702,7 +2744,9 @@ void Buffer::makeDocBookFile(string const & filename, int column)
//ResetTexRow();
texrow.reset();
- fprintf(file, "\n\n");
@@ -2725,7 +2769,7 @@ void Buffer::makeDocBookFile(string const & filename, int column)
while (par) {
int desc_on=0; /* description mode*/
- LyXLayout * style = lyxstyle.Style(GetCurrentTextClass(),
+ LyXLayout const & style = textclasslist.Style(GetCurrentTextClass(),
par->layout);
par->AutoDeleteInsets();
@@ -2746,7 +2790,7 @@ void Buffer::makeDocBookFile(string const & filename, int column)
}
if(depth == par->depth
- && environment_stack[depth]!=style->latexname
+ && environment_stack[depth] != style.latexname()
&& !environment_stack[depth].empty()) {
if(environment_inner[depth] != "!-- --") {
item_name="listitem";
@@ -2765,11 +2809,11 @@ void Buffer::makeDocBookFile(string const & filename, int column)
}
// Write opening SGML tags.
- switch(style->latextype) {
+ switch(style.latextype) {
case LATEX_PARAGRAPH:
- if(style->latexname != "dummy")
+ if(style.latexname() != "dummy")
sgmlOpenTag(file, depth+command_depth,
- style->latexname);
+ style.latexname());
break;
case LATEX_COMMAND:
@@ -2778,10 +2822,10 @@ void Buffer::makeDocBookFile(string const & filename, int column)
_("Error : Wrong depth for "
"LatexType Command.\n"));
- command_name=style->latexname;
+ command_name = style.latexname();
- tmps=style->latexparam;
- c_params= split(tmps, c_depth,'|');
+ tmps = style.latexparam();
+ c_params = split(tmps, c_depth,'|');
cmd_depth=atoi(c_depth.c_str());
@@ -2835,8 +2879,8 @@ void Buffer::makeDocBookFile(string const & filename, int column)
environment_stack[depth].clear();
}
- if (environment_stack[depth] != style->latexname) {
- environment_stack[depth]= style->latexname;
+ if (environment_stack[depth] != style.latexname()) {
+ environment_stack[depth]= style.latexname();
environment_inner[depth]= "!-- --";
sgmlOpenTag(file, depth + command_depth,
environment_stack[depth]);
@@ -2853,14 +2897,14 @@ void Buffer::makeDocBookFile(string const & filename, int column)
}
}
- if(style->latextype == LATEX_ENVIRONMENT) {
- if(!style->latexparam.empty())
+ if(style.latextype == LATEX_ENVIRONMENT) {
+ if(!style.latexparam().empty())
sgmlOpenTag(file, depth+command_depth,
- style->latexparam);
+ style.latexparam());
break;
}
- desc_on =(style->labeltype == LABEL_MANUAL);
+ desc_on =(style.labeltype == LABEL_MANUAL);
if(desc_on)
environment_inner[depth]="varlistentry";
@@ -2882,7 +2926,8 @@ void Buffer::makeDocBookFile(string const & filename, int column)
}
break;
default:
- sgmlOpenTag(file,depth+command_depth,style->latexname);
+ sgmlOpenTag(file, depth + command_depth,
+ style.latexname());
break;
}
@@ -2900,15 +2945,15 @@ void Buffer::makeDocBookFile(string const & filename, int column)
string end_tag;
/* write closing SGML tags */
- switch(style->latextype) {
+ switch(style.latextype) {
case LATEX_COMMAND:
- end_tag="title";
- sgmlCloseTag(file,depth+command_depth,end_tag);
+ end_tag = "title";
+ sgmlCloseTag(file, depth + command_depth, end_tag);
break;
case LATEX_ENVIRONMENT:
- if(!style->latexparam.empty())
- sgmlCloseTag(file,depth+command_depth,
- style->latexparam);
+ if(!style.latexparam().empty())
+ sgmlCloseTag(file, depth + command_depth,
+ style.latexparam());
break;
case LATEX_ITEM_ENVIRONMENT:
if(desc_on==1) break;
@@ -2916,13 +2961,13 @@ void Buffer::makeDocBookFile(string const & filename, int column)
sgmlCloseTag(file,depth+1+command_depth,end_tag);
break;
case LATEX_PARAGRAPH:
- if( style->latexname != "dummy")
- sgmlCloseTag(file,depth+command_depth,
- style->latexname);
+ if(style.latexname() != "dummy")
+ sgmlCloseTag(file, depth + command_depth,
+ style.latexname());
break;
default:
sgmlCloseTag(file,depth+command_depth,
- style->latexname);
+ style.latexname());
break;
}
}
@@ -2969,32 +3014,41 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra,
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;
- LyXLayout * style = lyxstyle.Style(params.textclass, par->GetLayout());
+ LyXLayout const & style = textclasslist.Style(params.textclass, par->GetLayout());
- if (style->labeltype != LABEL_MANUAL)
+ if (style.labeltype != LABEL_MANUAL)
main_body = 0;
else
main_body = par->BeginningOfMainBody();
/* gets paragraph main font */
if (main_body > 0)
- font1 = style->labelfont;
+ font1 = style.labelfont;
else
- font1 = style->font;
+ font1 = style.font;
char_line_count = depth;
- if(!style->free_spacing)
+ if(!style.free_spacing)
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 */
@@ -3043,7 +3097,7 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra,
else {
string sgml_string;
if (par->linuxDocConvertChar(c, sgml_string)
- && !style->free_spacing) { // in freespacing
+ && !style.free_spacing) { // in freespacing
// mode, spaces are
// non-breaking characters
// char is ' '
@@ -3064,11 +3118,16 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra,
font1 = font2;
}
- /* needed if there is an optional argument but no contents */
- if (main_body > 0 && main_body == par->last) {
- font1 = style->font;
+ /* 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 += "";
}
@@ -3138,12 +3197,6 @@ int Buffer::runLaTeX()
// Remove all error insets
bool a = removeAutoInsets();
- // generate the LaTeX file if necessary
- //if (!isDviClean() || a) {
- // makeLaTeXFile(name, org_path, false);
- // markDviDirty();
- //}
-
// Always generate the LaTeX file
makeLaTeXFile(name, org_path, false);
markDviDirty();
@@ -3214,12 +3267,12 @@ int Buffer::runLiterate()
markDviDirty();
}
- TeXErrors terr;
Literate literate(lyxrc->latex_command, name, filepath,
lit_name,
lyxrc->literate_command, lyxrc->literate_error_filter,
lyxrc->build_command, lyxrc->build_error_filter);
- int res = literate.weave(terr,users->getOwner()->getMiniBuffer());
+ TeXErrors terr;
+ int res = literate.weave(terr, users->getOwner()->getMiniBuffer());
// check return value from literate.weave().
if ((res & Literate::NO_LOGFILE)) {
@@ -3282,12 +3335,12 @@ int Buffer::buildProgram()
markNwDirty();
}
- TeXErrors terr;
Literate literate(lyxrc->latex_command, name, filepath,
lit_name,
lyxrc->literate_command, lyxrc->literate_error_filter,
lyxrc->build_command, lyxrc->build_error_filter);
- int res = literate.build(terr,users->getOwner()->getMiniBuffer());
+ TeXErrors terr;
+ int res = literate.build(terr, users->getOwner()->getMiniBuffer());
// check return value from literate.build().
if ((res & Literate::NO_LOGFILE)) {
@@ -3377,32 +3430,22 @@ int Buffer::runChktex()
extern void AllFloats(char, char);
-void Buffer::insertErrors(TeXErrors &terr)
+void Buffer::insertErrors(TeXErrors & terr)
{
// Save the cursor position
LyXCursor cursor = text->cursor;
- // Now traverse all the errors and insert them
- bool firsterror = true;
- bool more = true;
-
// This is drastic, but it's the only fix, I could find. (Asger)
AllFloats(1,0);
AllFloats(1,1);
- while (more) {
- string errortext;
- int errorrow = 0;
-
- if (firsterror) {
- more = terr.getFirstError(&errorrow, &errortext);
- firsterror = false;
- } else {
- more = terr.getNextError(&errorrow, &errortext);
- }
-
- if (!more)
- break;
+ for (TeXErrors::Errors::const_iterator cit = terr.begin();
+ cit != terr.end();
+ ++cit) {
+ string desctext((*cit).error_desc);
+ string errortext((*cit).error_text);
+ string msgtxt = desctext + '\n' + errortext;
+ int errorrow = (*cit).error_in_line;
// Insert error string for row number
int tmpid = -1;
@@ -3422,7 +3465,7 @@ void Buffer::insertErrors(TeXErrors &terr)
if (texrowpar == 0)
continue;
- InsetError *new_inset = new InsetError(errortext);
+ InsetError *new_inset = new InsetError(msgtxt);
text->SetCursorIntern(texrowpar, tmppos);
text->InsertInset(new_inset);
@@ -3452,33 +3495,38 @@ void Buffer::setCursorFromRow (int row)
}
-void Buffer::RoffAsciiTable(FILE *file, LyXParagraph *par)
+void Buffer::RoffAsciiTable(FILE * file, LyXParagraph * par)
{
LyXFont
font1 = LyXFont(LyXFont::ALL_INHERIT),
font2;
- Inset
- *inset;
+ Inset * inset;
+#ifdef NEW_TEXT
+ LyXParagraph::size_type i;
+#else
+ int i;
+#endif
int
- i,j,
+ j,
cell = 0;
char
c;
- string
- fname1,
- fname2;
FILE
- *fp,*fp2;
+ * fp, * fp2;
- fname1 = TmpFileName(string(),"RAT1");
- fname2 = TmpFileName(string(),"RAT2");
+ 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);
- for (i = 0; i < par->last; i++) {
+#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)
@@ -3573,6 +3621,7 @@ void Buffer::RoffAsciiTable(FILE *file, LyXParagraph *par)
remove(fname2.c_str());
}
+
/// changed Heinrich Bauer, 23/03/98
bool Buffer::isDviClean()
{
@@ -3582,6 +3631,7 @@ bool Buffer::isDviClean()
return dvi_clean_orgd;
}
+
/// changed Heinrich Bauer, 23/03/98
void Buffer::markDviClean()
{
@@ -3591,6 +3641,7 @@ void Buffer::markDviClean()
dvi_clean_orgd = true;
}
+
/// changed Heinrich Bauer, 23/03/98
void Buffer::markDviDirty()
{
@@ -3600,6 +3651,7 @@ void Buffer::markDviDirty()
dvi_clean_orgd = false;
}
+
void Buffer::update(signed char f)
{
if (!users) return;
@@ -3629,15 +3681,16 @@ void Buffer::update(signed char f)
}
-void Buffer::validate(LaTeXFeatures &features)
+void Buffer::validate(LaTeXFeatures & features)
{
- LyXParagraph *par = paragraph;
- LyXTextClass *tclass = lyxstyle.TextClass(params.textclass);
+ LyXParagraph * par = paragraph;
+ LyXTextClass const & tclass =
+ textclasslist.TextClass(params.textclass);
// AMS Style is at document level
features.amsstyle = (params.use_amsmath ||
- tclass->provides_amsmath);
+ tclass.provides(LyXTextClass::amsmath));
while (par) {
// We don't use "lyxerr.debug" because of speed. (Asger)
@@ -3658,7 +3711,9 @@ void Buffer::validate(LaTeXFeatures &features)
if (params.user_defined_bullets[i] != ITEMIZE_DEFAULTS[i]) {
int font = params.user_defined_bullets[i].getFont();
if (font == 0) {
- int c = params.user_defined_bullets[i].getCharacter();
+ int c = params
+ .user_defined_bullets[i]
+ .getCharacter();
if (c == 16
|| c == 17
|| c == 25
@@ -3684,12 +3739,10 @@ void Buffer::validate(LaTeXFeatures &features)
void Buffer::setPaperStuff()
{
- char c1, c2;
-
params.papersize = PAPER_DEFAULT;
- c1 = params.paperpackage;
+ char c1 = params.paperpackage;
if (c1 == PACKAGE_NONE) {
- c2 = params.papersize2;
+ char c2 = params.papersize2;
if (c2 == VM_PAPER_USLETTER)
params.papersize = PAPER_USLETTER;
else if (c2 == VM_PAPER_USLEGAL)
@@ -3713,9 +3766,7 @@ void Buffer::setPaperStuff()
void Buffer::setOldPaperStuff()
{
- char c;
-
- c = params.papersize = params.papersize2;
+ char c = params.papersize = params.papersize2;
params.papersize2 = VM_PAPER_DEFAULT;
params.paperpackage = PACKAGE_NONE;
if (c == OLD_PAPER_A4PAPER)
@@ -3740,7 +3791,7 @@ void Buffer::setOldPaperStuff()
}
-void Buffer::insertInset(Inset *inset, string const &lout,
+void Buffer::insertInset(Inset * inset, string const & lout,
bool no_table)
{
// check for table/list in tables
@@ -3767,7 +3818,8 @@ void Buffer::insertInset(Inset *inset, string const &lout,
update(-1);
}
- int lay = lyxstyle.NumberOfLayout(params.textclass, lout);
+ int lay = textclasslist.NumberOfLayout(params.textclass,
+ lout).second;
if (lay == -1) // layout not found
// use default layout "Standard" (0)
lay = 0;
@@ -3788,17 +3840,12 @@ void Buffer::insertInset(Inset *inset, string const &lout,
text->InsertInset(inset);
update(-1);
-// Commenting these two lines fixes the problem with new display inset
-// inside a paragraph, not sure why. (ale 971117)
-// if (inset->Display())
-// text->CursorRight();
-
text->UnFreezeUndo();
}
// Open and lock an updatable inset
-void Buffer::open_new_inset(UpdatableInset* new_inset)
+void Buffer::open_new_inset(UpdatableInset * new_inset)
{
BeforeChange();
text->FinishUndo();
@@ -3812,28 +3859,33 @@ void Buffer::open_new_inset(UpdatableInset* new_inset)
/* This function should be in Buffer because it's a buffer's property (ale) */
string Buffer::getIncludeonlyList(char delim)
{
- string list;
- LyXParagraph *par = paragraph;
+ string lst;
+ LyXParagraph * par = paragraph;
+#ifdef NEW_TEXT
+ LyXParagraph::size_type pos;
+#else
int pos;
- Inset* inset;
+#endif
+ Inset * inset;
while (par){
pos = -1;
while ((inset = par->ReturnNextInsetPointer(pos))){
if (inset->LyxCode()==Inset::INCLUDE_CODE) {
- InsetInclude *insetinc = (InsetInclude*)inset;
+ InsetInclude * insetinc =
+ static_cast(inset);
if (insetinc->isInclude()
&& insetinc->isNoLoad()) {
- if (!list.empty())
- list += delim;
- list += ChangeExtension(insetinc->getContents(), string(), true);
+ if (!lst.empty())
+ lst += delim;
+ lst += ChangeExtension(insetinc->getContents(), string(), true);
}
}
pos++;
}
par = par->next;
}
- lyxerr.debug() << "Includeonly(" << list << ')' << endl;
- return list;
+ lyxerr.debug() << "Includeonly(" << lst << ')' << endl;
+ return lst;
}
@@ -3849,23 +3901,27 @@ string Buffer::getReferenceList(char delim)
}
LyXParagraph *par = paragraph;
+#ifdef NEW_TEXT
+ LyXParagraph::size_type pos;
+#else
int pos;
- Inset* inset;
- string list;
+#endif
+ Inset * inset;
+ string lst;
while (par){
pos = -1;
while ((inset = par->ReturnNextInsetPointer(pos))){
for (int i = 0; i < inset->GetNumberOfLabels(); i++) {
- if (!list.empty())
- list += delim;
- list += inset->getLabel(i);
+ if (!lst.empty())
+ lst += delim;
+ lst += inset->getLabel(i);
}
pos++;
}
par = par->next;
}
- lyxerr.debug() << "References(" << list << ")" << endl;
- return list;
+ lyxerr.debug() << "References(" << lst << ")" << endl;
+ return lst;
}
@@ -3881,7 +3937,7 @@ string Buffer::getBibkeyList(char delim)
}
string bibkeys;
- LyXParagraph *par = paragraph;
+ LyXParagraph * par = paragraph;
while (par) {
if (par->bibkey) {
if (!bibkeys.empty())
@@ -3895,8 +3951,12 @@ string Buffer::getBibkeyList(char delim)
if (bibkeys.empty()) {
par = paragraph;
while (par) {
- Inset *inset;
+ 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))) {
@@ -3928,13 +3988,16 @@ string Buffer::getBibkeyList(char delim)
// think how this will work in a multiwindo/buffer environment, all the
// cursors in all the views showing this buffer will move. (Lgb)
// OK, then no cursor action should be allowed in buffer. (ale)
-bool Buffer::gotoLabel(const string &label)
+bool Buffer::gotoLabel(string const & label)
{
- LyXParagraph *par = paragraph;
+ LyXParagraph * par = paragraph;
+#ifdef NEW_TEXT
+ LyXParagraph::size_type pos;
+#else
int pos;
- Inset* inset;
- string list;
+#endif
+ Inset * inset;
while (par) {
pos = -1;
while ((inset = par->ReturnNextInsetPointer(pos))){
@@ -3957,7 +4020,7 @@ bool Buffer::gotoLabel(const string &label)
bool Buffer::isDepClean(string const & name) const
{
- DEPCLEAN* item = dep_clean;
+ DEPCLEAN * item = dep_clean;
while (item && item->master != name)
item = item->next;
if (!item) return true;
@@ -3985,5 +4048,4 @@ void Buffer::markDepClean(string const & name)
item->next = 0;;
}
}
- //return false; // why use that in a void method??
}
diff --git a/src/buffer.h b/src/buffer.h
index e1866b7e73..91f0d79153 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -19,8 +19,8 @@
// every time the LyX-file was left unchanged between the two actions mentioned
// above.
-#ifndef _BUFFER_H_
-#define _BUFFER_H_
+#ifndef BUFFER_H
+#define BUFFER_H
#ifdef __GNUG__
#pragma interface
@@ -370,9 +370,9 @@ private:
///
void DocBookHandleFootnote(FILE *file,LyXParagraph* &par, int const depth);
///
- void sgmlOpenTag(FILE * file,int depth,string & latexname);
+ void sgmlOpenTag(FILE * file,int depth,string const & latexname) const;
///
- void sgmlCloseTag(FILE * file,int depth,string & latexname);
+ void sgmlCloseTag(FILE * file,int depth,string const & latexname) const;
///
void LinuxDocError(LyXParagraph *par, int pos, char const *message);
///
diff --git a/src/bufferlist.h b/src/bufferlist.h
index aadda105f1..093871714c 100644
--- a/src/bufferlist.h
+++ b/src/bufferlist.h
@@ -60,8 +60,8 @@ private:
class BufferStorage_Iter {
public:
///
- BufferStorage_Iter(const BufferStorage & bs)
- { cs=&bs; index=0;}
+ BufferStorage_Iter(BufferStorage const & bs)
+ { cs =& bs; index = 0;}
/// next
Buffer* operator() ();
///
diff --git a/src/bufferparams.C b/src/bufferparams.C
index 5ac2f74584..ff656f2024 100644
--- a/src/bufferparams.C
+++ b/src/bufferparams.C
@@ -44,7 +44,7 @@ BufferParams::BufferParams()
fonts = "default";
inputenc = "latin1";
graphicsDriver = "default";
- sides = 1;
+ sides = LyXTextClass::OneSide;
columns = 1;
pagestyle = "default";
for(int iter = 0; iter < 4; iter++) {
@@ -112,7 +112,7 @@ void BufferParams::writeFile(FILE *file)
// the textclass
fprintf(file, "\\textclass %s\n",
- lyxstyle.NameOfClass(textclass).c_str());
+ textclasslist.NameOfClass(textclass).c_str());
// then the the preamble
if (!preamble.empty()) {
@@ -222,14 +222,14 @@ void BufferParams::writeFile(FILE *file)
void BufferParams::useClassDefaults() {
- LyXTextClass *tclass = lyxstyle.TextClass(textclass);
+ LyXTextClass const & tclass = textclasslist.TextClass(textclass);
- sides = tclass->sides;
- columns = tclass->columns;
- pagestyle = tclass->pagestyle;
- options = tclass->options;
- secnumdepth = tclass->secnumdepth;
- tocdepth = tclass->tocdepth;
+ sides = tclass.sides();
+ columns = tclass.columns();
+ pagestyle = tclass.pagestyle();
+ options = tclass.options();
+ secnumdepth = tclass.secnumdepth();
+ tocdepth = tclass.tocdepth();
}
diff --git a/src/bufferparams.h b/src/bufferparams.h
index f7176b1eac..1940b5f0f4 100644
--- a/src/bufferparams.h
+++ b/src/bufferparams.h
@@ -4,13 +4,13 @@
*
* LyX, The Document Processor
*
- * Copyright (C) 1995 1996 Matthias Ettrich
- * and the LyX Team.
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-1999 The LyX Team.
*
- *======================================================*/
+ * ====================================================== */
-#ifndef _BUFFERPARAMS_H
-#define _BUFFERPARAMS_H
+#ifndef BUFFERPARAMS_H
+#define BUFFERPARAMS_H
#ifdef __GNUG__
#pragma interface
@@ -22,6 +22,7 @@
#include "Spacing.h"
#include "Bullet.h"
#include "insets/insetquotes.h"
+#include "layout.h"
/**
This class contains all the parameters for this a buffer uses. Some
@@ -34,8 +35,6 @@ public:
//@{
///
BufferParams();
- // ///
- //BufferParams(const BufferParams&);
//@}
/// Dummy destructor to shut up gcc
@@ -65,7 +64,7 @@ public:
///
string fontsize;
///
- signed char textclass;
+ LyXTextClassList::ClassList::size_type textclass;
/* this are for the PaperLayout */
///
@@ -105,9 +104,9 @@ public:
///
Spacing spacing;
///
- signed char secnumdepth;
+ int secnumdepth;
///
- signed char tocdepth;
+ int tocdepth;
///
string language;
///
@@ -119,9 +118,9 @@ public:
///
string float_placement;
///
- char columns; // add approp. signedness
+ unsigned int columns;
///
- char sides; // add approp. signedness
+ LyXTextClass::PageSides sides;
///
string pagestyle;
///
diff --git a/src/debug.h b/src/debug.h
index 0dd2501c60..ce584db816 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -48,12 +48,14 @@ struct Debug {
PARSER | LYXRC | KBMAP | LATEX |
MATHED | FONT | TCLASS | LYXVC |
LYXSERVER | ROFF);
-
+ ///
+ friend inline void operator|=(Debug::type & d1, Debug::type d2);
+
/** A function to convert symbolic string names on debug levels
to their numerical value.
*/
static Debug::type value(string const & val) {
- int l = Debug::NONE;
+ type l = Debug::NONE;
string v(val);
while (!v.empty()) {
string::size_type st = v.find(',');
@@ -78,9 +80,14 @@ struct Debug {
if (st == string::npos) break;
v.erase(0, st + 1);
}
- return Debug::type(l);
+ return l;
}
};
+///
+inline void operator|=(Debug::type & d1, Debug::type d2)
+{
+ d1 = static_cast(d1 | d2);
+}
#include "support/DebugStream.h"
diff --git a/src/insets/figinset.C b/src/insets/figinset.C
index 4fb1b106e0..48ba4d3b72 100644
--- a/src/insets/figinset.C
+++ b/src/insets/figinset.C
@@ -611,7 +611,7 @@ static void runqueue()
XInternAtom(tempdisp, "GHOSTVIEW", false),
XInternAtom(tempdisp, "STRING", false),
8, PropModeAppend,
- (unsigned char *) tbuf,
+ reinterpret_cast(tbuf),
strlen(tbuf));
switch (p->data->flags & 3) {
@@ -641,7 +641,7 @@ static void runqueue()
XInternAtom(tempdisp, "GHOSTVIEW_COLORS", false),
XInternAtom(tempdisp, "STRING", false),
8, PropModeReplace,
- (unsigned char *) tbuf,
+ reinterpret_cast(tbuf),
strlen(tbuf));
XUngrabServer(tempdisp);
XFlush(tempdisp);
diff --git a/src/insets/inset.C b/src/insets/inset.C
index 8216147c35..cad6369463 100644
--- a/src/insets/inset.C
+++ b/src/insets/inset.C
@@ -37,13 +37,12 @@ unsigned char Inset::Editable() const
return 0;
}
+
void Inset::Validate(LaTeXFeatures &) const
{
- // nothing by default
}
-
bool Inset::AutoDelete() const
{
return false;
@@ -61,14 +60,8 @@ LyXFont Inset::ConvertFont(LyXFont font)
}
-// Inset::Code Inset::LyxCode() const
-// {
-// return Inset::NO_CODE;
-// }
-
/* some stuff for inset locking */
-
void UpdatableInset::InsetButtonPress(int x, int y, int button)
{
lyxerr.debug() << "Inset Button Press x=" << x
@@ -111,5 +104,4 @@ unsigned char UpdatableInset::Editable() const
void UpdatableInset::ToggleInsetCursor()
{
- // nothing
}
diff --git a/src/insets/insetbib.C b/src/insets/insetbib.C
index c95b013648..ec5f1c064e 100644
--- a/src/insets/insetbib.C
+++ b/src/insets/insetbib.C
@@ -19,11 +19,11 @@
#include "lyxtext.h"
#include "support/filetools.h"
-extern BufferView *current_view;
+extern BufferView * current_view;
-FD_citation_form *citation_form=0;
-FD_bibitem_form *bibitem_form=0;
-static Combox *bibcombox = 0;
+FD_citation_form * citation_form = 0;
+FD_bibitem_form * bibitem_form = 0;
+static Combox * bibcombox = 0;
extern void UpdateInset(Inset* inset, bool mark_dirty = true);
void BibitemUpdate(Combox *);
@@ -34,19 +34,10 @@ FD_bibitem_form * create_form_bibitem_form(void);
extern "C" void bibitem_cb(FL_OBJECT *, long data)
{
switch (data) {
-// case 0: fl_hide_form(citation_form->citation_form);
-// break;
-// case 1:
case 1: // OK, citation
{
-// InsetCommand *inset = (InsetCommand*)citation_form->vdata;
-// inset->setContents(bibcombox->getline());
-// inset->setOptions(fl_get_input(citation_form->label));
-// fl_hide_form(citation_form->citation_form);
-// UpdateInset(inset);
-// break;
if(!current_view->currentBuffer()->isReadonly()) {
- InsetCommand *inset = (InsetCommand*)citation_form->vdata;
+ InsetCommand *inset = static_cast(citation_form->citation_form->u_vdata);
inset->setContents(bibcombox->getline());
inset->setOptions(fl_get_input(citation_form->label));
fl_hide_form(citation_form->citation_form);
@@ -57,23 +48,12 @@ extern "C" void bibitem_cb(FL_OBJECT *, long data)
}
// fall through to Cancel on RO-mode
}
-// case 2: fl_hide_form(bibitem_form->bibitem_form);
case 0: fl_hide_form(citation_form->citation_form);
break;
-// case 3:
-
case 3: // OK, bibitem
{
-// InsetCommand *inset = (InsetCommand *)bibitem_form->vdata;
-// inset->setContents(fl_get_input(bibitem_form->key));
-// inset->setOptions(fl_get_input(bibitem_form->label));
-// fl_hide_form(bibitem_form->bibitem_form);
-// // Does look like a hack? It is! (but will change at 0.13)
-// current_view->currentBuffer()->text->RedoParagraph();
-// current_view->currentBuffer()->update(1);
-// break;
if(!current_view->currentBuffer()->isReadonly()) {
- InsetCommand *inset = (InsetCommand *)bibitem_form->vdata;
+ InsetCommand *inset = static_cast(bibitem_form->bibitem_form->u_vdata);
inset->setContents(fl_get_input(bibitem_form->key));
inset->setOptions(fl_get_input(bibitem_form->label));
fl_hide_form(bibitem_form->bibitem_form);
@@ -159,7 +139,7 @@ InsetCitation::~InsetCitation()
{
if(citation_form && citation_form->citation_form
&& citation_form->citation_form->visible
- && citation_form->vdata == this)
+ && citation_form->citation_form->u_vdata == this)
fl_hide_form(citation_form->citation_form);
}
@@ -174,7 +154,7 @@ void InsetCitation::Edit(int, int)
fl_set_form_atclose(citation_form->citation_form,
CancelCloseBoxCB, 0);
}
- citation_form->vdata = this;
+ citation_form->citation_form->u_vdata = this;
BibitemUpdate(bibcombox);
if (!bibcombox->select_text(getContents().c_str()))
@@ -276,7 +256,7 @@ void InsetBibKey::Edit(int, int)
fl_set_form_atclose(bibitem_form->bibitem_form,
CancelCloseBoxCB, 0);
}
- bibitem_form->vdata = this;
+ bibitem_form->bibitem_form->u_vdata = this;
// InsetBibtex uses the same form, with different labels
fl_set_object_label(bibitem_form->key, idex(_("Key:|#K")));
fl_set_button_shortcut(bibitem_form->key,scex(_("Key:|#K")),1);
@@ -411,7 +391,7 @@ string InsetBibtex::getKeys()
linebuf = subst(linebuf,
'{', '(');
linebuf = split(linebuf,
- tmp, '(');
+ tmp,'(');
tmp = lowercase(tmp);
if (!prefixIs(tmp, "@string") && !prefixIs(tmp, "@preamble") ) {
linebuf = split(linebuf, tmp,',');
@@ -440,7 +420,7 @@ void InsetBibtex::Edit(int, int)
CancelCloseBoxCB, 0);
}
- bibitem_form->vdata = this;
+ bibitem_form->bibitem_form->u_vdata = this;
fl_set_object_label(bibitem_form->key, _("Database:"));
fl_set_object_label(bibitem_form->label, _("Style: "));
fl_set_input(bibitem_form->key, getContents().c_str());
@@ -448,13 +428,14 @@ void InsetBibtex::Edit(int, int)
if (bibitem_form->bibitem_form->visible) {
fl_raise_form(bibitem_form->bibitem_form);
} else {
- fl_show_form(bibitem_form->bibitem_form,FL_PLACE_MOUSE, FL_FULLBORDER,
+ fl_show_form(bibitem_form->bibitem_form,
+ FL_PLACE_MOUSE, FL_FULLBORDER,
_("BibTeX"));
}
}
-bool InsetBibtex::addDatabase(string const &db)
+bool InsetBibtex::addDatabase(string const & db)
{
if (!contains(contents, db.c_str())) {
if (!contents.empty())
@@ -466,7 +447,7 @@ bool InsetBibtex::addDatabase(string const &db)
}
-bool InsetBibtex::delDatabase(string const &db)
+bool InsetBibtex::delDatabase(string const & db)
{
if (contains(contents, db.c_str())) {
string bd = db;
@@ -486,7 +467,7 @@ bool InsetBibtex::delDatabase(string const &db)
// This function should be in LyXView when multiframe works ale970302
-void BibitemUpdate(Combox* combox)
+void BibitemUpdate(Combox * combox)
{
combox->clear();
@@ -504,7 +485,7 @@ void BibitemUpdate(Combox* combox)
// ale070405 This function maybe shouldn't be here. We'll fix this at 0.13.
-int bibitemMaxWidth(const class LyXFont &font)
+int bibitemMaxWidth(LyXFont const & font)
{
int w = 0;
// Does look like a hack? It is! (but will change at 0.13)
@@ -526,8 +507,8 @@ string bibitemWidthest()
{
int w = 0;
// Does look like a hack? It is! (but will change at 0.13)
- LyXParagraph *par = current_view->currentBuffer()->paragraph;
- InsetBibKey *bkey=0;
+ LyXParagraph * par = current_view->currentBuffer()->paragraph;
+ InsetBibKey * bkey=0;
LyXFont font;
while (par) {
diff --git a/src/insets/insetbib.h b/src/insets/insetbib.h
index b0dfb75d2f..3c07f55a29 100644
--- a/src/insets/insetbib.h
+++ b/src/insets/insetbib.h
@@ -5,12 +5,12 @@
* LyX, The Document Processor
*
* Copyright (C) 1995 Matthias Ettrich
- * Copyright (C) 1995-1998 The LyX Team.
+ * Copyright (C) 1995-1999 The LyX Team.
*
- *======================================================*/
+ * ======================================================*/
-#ifndef _INSET_BIB_H
-#define _INSET_BIB_H
+#ifndef INSET_BIB_H
+#define INSET_BIB_H
#ifdef __GNUG__
#pragma interface
@@ -28,11 +28,11 @@ public:
///
InsetCitation(): InsetCommand("cite") { }
///
- InsetCitation(string const & key, string const & note=string());
+ InsetCitation(string const & key, string const & note = string());
///
~InsetCitation();
///
- Inset* Clone() { return new InsetCitation(contents, options); }
+ Inset * Clone() { return new InsetCitation(contents, options); }
///
string getScreenLabel()const;
///
@@ -54,13 +54,13 @@ public:
///
InsetBibKey(): InsetCommand("bibitem") { counter = 1; }
///
- InsetBibKey(string const & key, string const & label=string());
+ InsetBibKey(string const & key, string const & label = string());
///
- InsetBibKey(InsetBibKey const*);
+ InsetBibKey(InsetBibKey const *);
///
~InsetBibKey();
///
- Inset* Clone() { return new InsetBibKey(this); }
+ Inset * Clone() { return new InsetBibKey(this); }
/// Currently \bibitem is used as a LyX2.x command, so we need this method.
void Write(FILE *);
///
@@ -98,7 +98,7 @@ public:
///
~InsetBibtex();
///
- Inset* Clone() { return new InsetBibtex(contents, options, 0); }
+ Inset * Clone() { return new InsetBibtex(contents, options, 0); }
///
Inset::Code LyxCode() const
{
@@ -111,7 +111,7 @@ public:
///
int Latex(FILE *, signed char);
///
- int Latex(string &file, signed char fragile);
+ int Latex(string & file, signed char fragile);
///
string getKeys();
///
diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C
index b2f939134e..1457cad889 100644
--- a/src/insets/insetcommand.C
+++ b/src/insets/insetcommand.C
@@ -35,7 +35,7 @@ InsetCommand::~InsetCommand()
}
-int InsetCommand::Ascent(LyXFont const&font) const
+int InsetCommand::Ascent(LyXFont const & font) const
{
LyXFont f = font;
f.decSize();
@@ -43,7 +43,7 @@ int InsetCommand::Ascent(LyXFont const&font) const
}
-int InsetCommand::Descent(LyXFont const&font) const
+int InsetCommand::Descent(LyXFont const & font) const
{
LyXFont f = font;
f.decSize();
@@ -51,7 +51,7 @@ int InsetCommand::Descent(LyXFont const&font) const
}
-int InsetCommand::Width(LyXFont const&font) const
+int InsetCommand::Width(LyXFont const & font) const
{
LyXFont f = font;
f.decSize();
@@ -60,15 +60,12 @@ int InsetCommand::Width(LyXFont const&font) const
}
-void InsetCommand::Draw(LyXFont font, LyXScreen &scr,
- int baseline, float &x)
+void InsetCommand::Draw(LyXFont font, LyXScreen & scr,
+ int baseline, float & x)
{
// Draw it as a box with the LaTeX text
x += 3;
- //scr.drawFilledRectangle(int(x), baseline - Ascent(font) + 1,
- // Width(font) - 2, Ascent(font) + Descent(font)-2,
- // FL_GRAY80);
scr.fillRectangle(gc_lighted,
int(x), baseline - Ascent(font) + 1,
Width(font) - 6,
@@ -80,9 +77,6 @@ void InsetCommand::Draw(LyXFont font, LyXScreen &scr,
h = (Ascent(font)+Descent(font)-2);
scr.drawFrame(FL_UP_FRAME, int(x), y, w, h, FL_BLACK, -1);
} else {
- //scr.drawRectangle(int(x), baseline - Ascent(font)+1,
- // Width(font)-2, Ascent(font)+Descent(font)-2,
- // FL_BLACK);
scr.drawRectangle(gc_note_frame,
int(x), baseline - Ascent(font)+1,
Width(font)-6,
@@ -100,13 +94,13 @@ void InsetCommand::Draw(LyXFont font, LyXScreen &scr,
// In lyxf3 this will be just LaTeX
-void InsetCommand::Write(FILE *file)
+void InsetCommand::Write(FILE * file)
{
fprintf(file, "LatexCommand %s\n", getCommand().c_str());
}
-void InsetCommand::scanCommand(string const &cmd)
+void InsetCommand::scanCommand(string const & cmd)
{
string tcommand, toptions, tcontents;
@@ -170,7 +164,7 @@ void InsetCommand::scanCommand(string const &cmd)
// This function will not be necessary when lyx3
-void InsetCommand::Read(LyXLex &lex)
+void InsetCommand::Read(LyXLex & lex)
{
if (lex.EatLine()) {
string t = lex.GetString();
@@ -180,14 +174,14 @@ void InsetCommand::Read(LyXLex &lex)
}
-int InsetCommand::Latex(FILE *file, signed char /*fragile*/)
+int InsetCommand::Latex(FILE * file, signed char /*fragile*/)
{
fprintf(file, "%s", getCommand().c_str());
return 0;
}
-int InsetCommand::Latex(string &file, signed char /*fragile*/)
+int InsetCommand::Latex(string & file, signed char /*fragile*/)
{
file += getCommand();
return 0;
@@ -206,9 +200,9 @@ int InsetCommand::DocBook(string &/*file*/)
}
-Inset* InsetCommand::Clone()
+Inset * InsetCommand::Clone()
{
- InsetCommand *result = new InsetCommand(command, contents, options);
+ InsetCommand * result = new InsetCommand(command, contents, options);
return result;
}
diff --git a/src/insets/insetcommand.h b/src/insets/insetcommand.h
index 1657ce931c..b1a53e82bf 100644
--- a/src/insets/insetcommand.h
+++ b/src/insets/insetcommand.h
@@ -5,12 +5,12 @@
* LyX, The Document Processor
*
* Copyright (C) 1995 Matthias Ettrich
- * Copyright (C) 1996-1998 The LyX Team.
+ * Copyright (C) 1996-1999 The LyX Team.
*
- *======================================================*/
+ * ======================================================*/
-#ifndef _INSET_LATEXCOMMAND_H
-#define _INSET_LATEXCOMMAND_H
+#ifndef INSET_LATEXCOMMAND_H
+#define INSET_LATEXCOMMAND_H
#ifdef __GNUG__
#pragma interface
@@ -35,29 +35,29 @@ public:
///
~InsetCommand();
///
- int Ascent(LyXFont const &font) const;
+ int Ascent(LyXFont const & font) const;
///
- int Descent(LyXFont const &font) const;
+ int Descent(LyXFont const & font) const;
///
- int Width(LyXFont const &font) const;
+ int Width(LyXFont const & font) const;
///
- void Draw(LyXFont, LyXScreen &scr, int baseline, float &x);
+ void Draw(LyXFont, LyXScreen & scr, int baseline, float & x);
///
- void Write(FILE *file);
+ void Write(FILE * file);
/// Parse the command.
- void scanCommand(string const &cmd);
+ void scanCommand(string const & cmd);
/// Will not be used when lyxf3
- void Read(LyXLex &lex);
+ void Read(LyXLex & lex);
///
- virtual int Latex(FILE *file, signed char fragile);
+ virtual int Latex(FILE * file, signed char fragile);
///
- virtual int Latex(string &file, signed char fragile);
+ virtual int Latex(string & file, signed char fragile);
///
- virtual int Linuxdoc(string &file);
+ virtual int Linuxdoc(string & file);
///
- virtual int DocBook(string &file);
+ virtual int DocBook(string & file);
///
- Inset* Clone();
+ Inset * Clone();
///
Inset::Code LyxCode() const
{
@@ -78,15 +78,15 @@ public:
/// Build the complete LaTeX command
string getCommand() const;
///
- string const &getCmdName() const {
+ string const & getCmdName() const {
return command;
}
///
- string const &getOptions() const {
+ string const & getOptions() const {
return options;
}
///
- string const &getContents() const {
+ string const & getContents() const {
return contents;
}
///
diff --git a/src/insets/inseterror.C b/src/insets/inseterror.C
index 42f3a1e63d..1d4bd36a1d 100644
--- a/src/insets/inseterror.C
+++ b/src/insets/inseterror.C
@@ -27,8 +27,8 @@ InsetError::InsetError()
form = 0;
}
-InsetError::InsetError(string const & string)
- : contents(string)
+InsetError::InsetError(string const & str)
+ : contents(str)
{
form = 0;
}
@@ -44,7 +44,7 @@ InsetError::~InsetError()
}
-int InsetError::Ascent(LyXFont const &font) const
+int InsetError::Ascent(LyXFont const & font) const
{
LyXFont efont;
efont.setSize(font.size()).decSize();
@@ -52,7 +52,7 @@ int InsetError::Ascent(LyXFont const &font) const
}
-int InsetError::Descent(LyXFont const &font) const
+int InsetError::Descent(LyXFont const & font) const
{
LyXFont efont;
efont.setSize(font.size()).decSize();
@@ -60,7 +60,7 @@ int InsetError::Descent(LyXFont const &font) const
}
-int InsetError::Width(LyXFont const &font) const
+int InsetError::Width(LyXFont const & font) const
{
LyXFont efont;
efont.setSize(font.size()).decSize();
@@ -68,8 +68,8 @@ int InsetError::Width(LyXFont const &font) const
}
-void InsetError::Draw(LyXFont font, LyXScreen &scr,
- int baseline, float &x)
+void InsetError::Draw(LyXFont font, LyXScreen & scr,
+ int baseline, float & x)
{
LyXFont efont;
efont.setSize(font.size()).decSize();
@@ -77,15 +77,9 @@ void InsetError::Draw(LyXFont font, LyXScreen &scr,
// Draw as "Error" in a framed box
x += 1;
- //scr.drawFilledRectangle(int(x), baseline - Ascent(font)+1,
- // Width(font)-2,Ascent(font)+ Descent(font)-2,
- // FL_GRAY80);
scr.fillRectangle(gc_lighted,
int(x), baseline - Ascent(font)+1,
Width(font)-2,Ascent(font)+ Descent(font)-2);
- //scr.drawRectangle(int(x), baseline-Ascent(font)+1,
- // Width(font)-2, Ascent(font)+Descent(font)-2,
- // FL_RED);
scr.drawRectangle(gc_foot,
int(x), baseline-Ascent(font)+1,
Width(font)-2, Ascent(font)+Descent(font)-2);
@@ -140,9 +134,9 @@ unsigned char InsetError::Editable() const
}
-void InsetError::CloseErrorCB(FL_OBJECT *, long data)
+void InsetError::CloseErrorCB(FL_OBJECT * ob, long)
{
- InsetError *inset = (InsetError*) data;
+ InsetError * inset = static_cast(ob->u_vdata);
if (inset->form) {
fl_hide_form(inset->form);
fl_free_form(inset->form);
@@ -150,10 +144,11 @@ void InsetError::CloseErrorCB(FL_OBJECT *, long data)
}
}
+
// A C wrapper
-extern "C" void C_InsetError_CloseErrorCB(FL_OBJECT *, long data)
+extern "C" void C_InsetError_CloseErrorCB(FL_OBJECT * ob, long data)
{
- InsetError::CloseErrorCB(0,data);
+ InsetError::CloseErrorCB(ob , data);
}
@@ -162,13 +157,14 @@ void InsetError::Edit(int, int)
static int ow = 400, oh = 240;
if (!form) {
- FL_OBJECT *obj;
- form = fl_bgn_form(FL_UP_BOX,ow,oh);
+ FL_OBJECT * obj;
+ form = fl_bgn_form(FL_UP_BOX, ow, oh);
strobj = fl_add_box(FL_FRAME_BOX,10,10,380,180,"");
fl_set_object_color(strobj,FL_MCOL,FL_MCOL);
fl_set_object_gravity(strobj, FL_NorthWest, FL_SouthEast);
obj = fl_add_button(FL_RETURN_BUTTON,140,200,120,30,_("Close"));
- fl_set_object_callback(obj, C_InsetError_CloseErrorCB, (long)this);
+ fl_set_object_callback(obj, C_InsetError_CloseErrorCB, 0);
+ obj->u_vdata = this;
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_resize(obj, FL_RESIZE_NONE);
fl_end_form();
@@ -187,6 +183,6 @@ void InsetError::Edit(int, int)
Inset* InsetError::Clone()
{
- InsetError *result = new InsetError(contents);
+ InsetError * result = new InsetError(contents);
return result;
}
diff --git a/src/insets/inseterror.h b/src/insets/inseterror.h
index cdc03f41dc..1bde3a4d03 100644
--- a/src/insets/inseterror.h
+++ b/src/insets/inseterror.h
@@ -8,8 +8,8 @@
*
*======================================================*/
-#ifndef _INSET_ERROR_H
-#define _INSET_ERROR_H
+#ifndef INSET_ERROR_H
+#define INSET_ERROR_H
#ifdef __GNUG__
#pragma interface
@@ -34,35 +34,35 @@ public:
///
~InsetError();
///
- int Ascent(LyXFont const &font) const;
+ int Ascent(LyXFont const & font) const;
///
- int Descent(LyXFont const &font) const;
+ int Descent(LyXFont const & font) const;
///
- int Width(LyXFont const &font) const;
+ int Width(LyXFont const & font) const;
///
- void Draw(LyXFont font, LyXScreen &scr, int baseline, float &x);
+ void Draw(LyXFont font, LyXScreen & scr, int baseline, float & x);
///
- void Write(FILE *file);
+ void Write(FILE * file);
///
- void Read(LyXLex &lex);
+ void Read(LyXLex & lex);
///
- int Latex(FILE *file, signed char fragile);
+ int Latex(FILE * file, signed char fragile);
///
- int Latex(string &file, signed char fragile);
+ int Latex(string & file, signed char fragile);
///
- int Linuxdoc(string &file);
+ int Linuxdoc(string & file);
///
- int DocBook(string &file);
+ int DocBook(string & file);
///
bool AutoDelete() const;
/// what appears in the minibuffer when opening
- char const* EditMessage() {return _("Opened error");}
+ char const * EditMessage() {return _("Opened error");}
///
void Edit(int, int);
///
unsigned char Editable() const;
///
- Inset* Clone();
+ Inset * Clone();
///
Inset::Code LyxCode() const { return Inset::NO_CODE; }
/// We don't want "begin" and "end inset" in lyx-file
@@ -73,8 +73,8 @@ private:
///
string contents;
///
- FL_FORM *form;
+ FL_FORM * form;
///
- FL_OBJECT *strobj;
+ FL_OBJECT * strobj;
};
#endif
diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C
index 283eb0a1f1..f881d9b103 100644
--- a/src/insets/insetinclude.C
+++ b/src/insets/insetinclude.C
@@ -20,18 +20,19 @@
#include "gettext.h"
#include "include_form.h"
#include "support/FileInfo.h"
+#include "layout.h"
-extern BufferView *current_view;
+extern BufferView * current_view;
-extern LyXRC *lyxrc;
+extern LyXRC * lyxrc;
extern BufferList bufferlist;
-extern void UpdateInset(Inset* inset, bool mark_dirty = true);
+extern void UpdateInset(Inset * inset, bool mark_dirty = true);
-FD_include *create_form_include(void)
+FD_include * create_form_include(void)
{
- FL_OBJECT *obj;
- FD_include *fdui = (FD_include *) fl_calloc(1, sizeof(FD_include));
+ FL_OBJECT * obj;
+ FD_include * fdui = (FD_include *) fl_calloc(1, sizeof(FD_include));
fdui->include = fl_bgn_form(FL_NO_BOX, 340, 210);
obj = fl_add_box(FL_UP_BOX,0,0,340,210,"");
@@ -86,12 +87,12 @@ FD_include *create_form_include(void)
/*---------------------------------------*/
-FD_include *form = 0;
+FD_include * form = 0;
extern "C" void include_cb(FL_OBJECT *, long arg)
{
- InsetInclude *inset = (InsetInclude*)form->vdata;
+ InsetInclude * inset = static_cast(form->include->u_vdata);
switch (arg) {
case 0:
{
@@ -183,7 +184,7 @@ extern "C" void include_cb(FL_OBJECT *, long arg)
}
-InsetInclude::InsetInclude(string const & fname, Buffer *bf)
+InsetInclude::InsetInclude(string const & fname, Buffer * bf)
: InsetCommand("include")
{
master = bf;
@@ -195,7 +196,7 @@ InsetInclude::InsetInclude(string const & fname, Buffer *bf)
InsetInclude::~InsetInclude()
{
- if (form && form->vdata == this) {
+ if (form && form->include->u_vdata == this) {
// this inset is in the popup so hide the popup
// and remove the reference to this inset. ARRae
if (form->include) {
@@ -221,7 +222,7 @@ Inset * InsetInclude::Clone()
ii->setVerb();
ii->setVisibleSpace(isVerbVisibleSpace());
}
- return (Inset*)ii;
+ return ii;
}
void InsetInclude::Edit(int, int)
@@ -233,7 +234,7 @@ void InsetInclude::Edit(int, int)
form = create_form_include();
fl_set_form_atclose(form->include, IgnoreCloseBoxCB, 0);
}
- form->vdata = this;
+ form->include->u_vdata = this;
fl_set_input(form->input, contents.c_str());
fl_set_button(form->flag1, int(isNoLoad()));
@@ -257,13 +258,13 @@ void InsetInclude::Edit(int, int)
}
-void InsetInclude::Write(FILE *file)
+void InsetInclude::Write(FILE * file)
{
fprintf(file, "Include %s\n", getCommand().c_str());
}
-void InsetInclude::Read(LyXLex &lex)
+void InsetInclude::Read(LyXLex & lex)
{
InsetCommand::Read(lex);
@@ -313,7 +314,7 @@ bool InsetInclude::loadIfNeeded() const
}
-int InsetInclude::Latex(FILE *file, signed char /*fragile*/)
+int InsetInclude::Latex(FILE * file, signed char /*fragile*/)
{
string include_file;
signed char dummy = 0;
@@ -323,7 +324,7 @@ int InsetInclude::Latex(FILE *file, signed char /*fragile*/)
}
-int InsetInclude::Latex(string &file, signed char /*fragile*/)
+int InsetInclude::Latex(string & file, signed char /*fragile*/)
{
string writefile, incfile;
@@ -341,9 +342,9 @@ int InsetInclude::Latex(string &file, signed char /*fragile*/)
lyxerr << "ERROR: Cannot handle include file `"
<< MakeDisplayPath(getFileName())
<< "' which has textclass `"
- << lyxstyle.NameOfClass(tmp->params.textclass)
+ << textclasslist.NameOfClass(tmp->params.textclass)
<< "' instead of `"
- << lyxstyle.NameOfClass(master->params.textclass)
+ << textclasslist.NameOfClass(master->params.textclass)
<< "'." << endl;
return 0;
}
@@ -400,7 +401,7 @@ int InsetInclude::Latex(string &file, signed char /*fragile*/)
}
-void InsetInclude::Validate(LaTeXFeatures& features) const
+void InsetInclude::Validate(LaTeXFeatures & features) const
{
if (isVerb())
features.verbatim = true;
@@ -410,7 +411,7 @@ void InsetInclude::Validate(LaTeXFeatures& features) const
// to be loaded:
if (loadIfNeeded()) {
// a file got loaded
- Buffer *tmp = bufferlist.getBuffer(getFileName());
+ Buffer * tmp = bufferlist.getBuffer(getFileName());
tmp->validate(features);
}
}
@@ -423,7 +424,7 @@ string InsetInclude::getLabel(int) const
if (loadIfNeeded()) {
- Buffer *tmp = bufferlist.getBuffer(getFileName());
+ Buffer * tmp = bufferlist.getBuffer(getFileName());
tmp->setParentName("");
label = tmp->getReferenceList('\n');
tmp->setParentName(getMasterFilename());
@@ -438,7 +439,7 @@ int InsetInclude::GetNumberOfLabels() const {
int nl;
if (loadIfNeeded()) {
- Buffer *tmp = bufferlist.getBuffer(getFileName());
+ Buffer * tmp = bufferlist.getBuffer(getFileName());
tmp->setParentName("");
label = tmp->getReferenceList('\n');
tmp->setParentName(getMasterFilename());
@@ -451,14 +452,14 @@ int InsetInclude::GetNumberOfLabels() const {
string InsetInclude::getKeys() const
{
- string list;
+ string lst;
if (loadIfNeeded()) {
Buffer *tmp = bufferlist.getBuffer(getFileName());
tmp->setParentName("");
- list = tmp->getBibkeyList(',');
+ lst = tmp->getBibkeyList(',');
tmp->setParentName(getMasterFilename());
}
- return list;
+ return lst;
}
diff --git a/src/insets/insetinclude.h b/src/insets/insetinclude.h
index 4919819f62..a37d9a2b79 100644
--- a/src/insets/insetinclude.h
+++ b/src/insets/insetinclude.h
@@ -6,7 +6,7 @@
*
* Copyright (C) 1997 LyX Team (this file was created this year)
*
- *======================================================*/
+ * ======================================================*/
#ifndef INSET_INCLUDE_H
#define INSET_INCLUDE_H
@@ -33,11 +33,11 @@ public:
flag = InsetInclude::INCLUDE;
}
///
- InsetInclude(string const &, Buffer*);
+ InsetInclude(string const &, Buffer *);
///
~InsetInclude();
///
- Inset* Clone();
+ Inset * Clone();
///
Inset::Code LyxCode() const { return Inset::INCLUDE_CODE; }
/// This is 1 if the childs have labels, 0 otherwise
@@ -58,9 +58,9 @@ public:
///
void Read(LyXLex &);
///
- int Latex(FILE *file, signed char fragile);
+ int Latex(FILE * file, signed char fragile);
///
- int Latex(string &file, signed char fragile);
+ int Latex(string & file, signed char fragile);
///
void Validate(LaTeXFeatures &) const;
@@ -84,18 +84,18 @@ public:
return filename;
}
/// In "input" mode uses \input instead of \include.
- bool isInput() const { return (bool)(flag == InsetInclude::INPUT); }
+ bool isInput() const { return flag == InsetInclude::INPUT; }
/// If this is true, the child file shouldn't be loaded by lyx
- bool isNoLoad() const { return (bool)(noload); }
+ bool isNoLoad() const { return noload; }
/** A verbatim file shouldn't be loaded by LyX
* No need to generate LaTeX code of a verbatim file
*/
bool isVerb() const;
///
- bool isVerbVisibleSpace() const { return (bool)(flag==InsetInclude::VERBAST);}
+ bool isVerbVisibleSpace() const { return flag==InsetInclude::VERBAST;}
///
- bool isInclude() const { return (bool)(flag == InsetInclude::INCLUDE);}
+ bool isInclude() const { return flag == InsetInclude::INCLUDE;}
///
void setInput();
///
@@ -126,7 +126,7 @@ private:
///
int flag;
///
- Buffer *master;
+ Buffer * master;
///
string filename;
};
diff --git a/src/insets/insetindex.C b/src/insets/insetindex.C
index 035c3dd511..a46d471e2d 100644
--- a/src/insets/insetindex.C
+++ b/src/insets/insetindex.C
@@ -1,6 +1,6 @@
#include
-#include
+#include
#ifdef __GNUG__
#pragma implementation
@@ -15,24 +15,16 @@
#include "LString.h"
#include "lyx_gui_misc.h" // WarnReadonly()
-extern BufferView *current_view;
-extern void UpdateInset(Inset* inset, bool mark_dirty = true);
+extern BufferView * current_view;
+extern void UpdateInset(Inset * inset, bool mark_dirty = true);
-FD_index_form *index_form = 0;
+FD_index_form * index_form = 0;
extern "C" void index_cb(FL_OBJECT *, long data)
{
- InsetIndex *inset = (InsetIndex*)index_form->vdata;
+ InsetIndex * inset = static_cast(index_form->index_form->u_vdata);
switch (data) {
-// - case 0: fl_hide_form(index_form->index_form); break;
-// - case 1:
-// - {
-// - inset->setContents(fl_get_input(index_form->key));
-// - fl_hide_form(index_form->index_form);
-// - UpdateInset(inset);
-// - break;
-// - }
case 1: // OK
if(!current_view->currentBuffer()->isReadonly()) {
string tmp = fl_get_input(index_form->key);
@@ -50,9 +42,9 @@ extern "C" void index_cb(FL_OBJECT *, long data)
static
-FD_index_form *create_form_index_form()
+FD_index_form * create_form_index_form()
{
- FL_OBJECT *obj;
+ FL_OBJECT * obj;
FD_index_form *fdui = (FD_index_form *) fl_calloc(1, sizeof(FD_index_form));
fdui->index_form = fl_bgn_form(FL_NO_BOX, 258, 196);
@@ -89,7 +81,7 @@ InsetIndex::~InsetIndex()
{
if(index_form && index_form->index_form
&& index_form->index_form->visible
- && index_form->vdata == this)
+ && index_form->index_form->u_vdata == this)
fl_hide_form(index_form->index_form);
}
@@ -102,7 +94,7 @@ void InsetIndex::Edit(int, int)
if (!index_form)
index_form = create_form_index_form();
- index_form->vdata = this;
+ index_form->index_form->u_vdata = this;
fl_set_input(index_form->key, getContents().c_str());
if (index_form->index_form->visible) {
fl_raise_form(index_form->index_form);
@@ -131,7 +123,7 @@ InsetPrintIndex::InsetPrintIndex()
}
-InsetPrintIndex::InsetPrintIndex(Buffer *o)
+InsetPrintIndex::InsetPrintIndex(Buffer * o)
: InsetCommand("printindex"), owner(o)
{
}
@@ -148,7 +140,7 @@ string InsetPrintIndex::getScreenLabel() const
}
-void InsetPrintIndex::Validate(LaTeXFeatures &features) const
+void InsetPrintIndex::Validate(LaTeXFeatures & features) const
{
features.makeidx = true;
}
diff --git a/src/insets/insetindex.h b/src/insets/insetindex.h
index 76db96764f..6470404e28 100644
--- a/src/insets/insetindex.h
+++ b/src/insets/insetindex.h
@@ -4,13 +4,13 @@
*
* LyX, The Document Processor
*
- * Copyright (C) 1995 Matthias Ettrich
- * 1996-1998 LyX Team
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1996-1999 the LyX Team.
*
- *======================================================*/
+ * ======================================================*/
-#ifndef _INSET_INDEX_H
-#define _INSET_INDEX_H
+#ifndef INSET_INDEX_H
+#define INSET_INDEX_H
#ifdef __GNUG__
#pragma interface
@@ -35,7 +35,7 @@ public:
///
~InsetIndex();
///
- Inset *Clone() { return new InsetIndex(contents);}
+ Inset * Clone() { return new InsetIndex(contents);}
///
void Edit(int, int);
///
@@ -53,13 +53,13 @@ public:
///
InsetPrintIndex();
///
- InsetPrintIndex(Buffer*);
+ InsetPrintIndex(Buffer *);
///
~InsetPrintIndex();
/// Updates needed features for this inset.
- void Validate(LaTeXFeatures &features) const;
+ void Validate(LaTeXFeatures & features) const;
///
- void Edit(int, int){;}
+ void Edit(int, int) {}
///
unsigned char Editable() const{
return 1;
@@ -72,18 +72,16 @@ public:
string getScreenLabel() const;
private:
///
- Buffer *owner;
+ Buffer * owner;
};
// this was shifted here rather than a separate
// file because its little and only need by
// insetindex.C and lyx_gui_misc.C ARRae 981020
struct FD_index_form {
- FL_FORM *index_form;
- FL_OBJECT *key;
- void *vdata;
- long ldata;
+ FL_FORM * index_form;
+ FL_OBJECT * key;
};
-extern FD_index_form *index_form;
+extern FD_index_form * index_form;
#endif
diff --git a/src/insets/insetinfo.C b/src/insets/insetinfo.C
index 52e8935c17..139d32167d 100644
--- a/src/insets/insetinfo.C
+++ b/src/insets/insetinfo.C
@@ -52,26 +52,26 @@ InsetInfo::~InsetInfo()
}
-int InsetInfo::Ascent(LyXFont const &font) const
+int InsetInfo::Ascent(LyXFont const & font) const
{
- return font.maxAscent()+1;
+ return font.maxAscent() + 1;
}
-int InsetInfo::Descent(LyXFont const &font) const
+int InsetInfo::Descent(LyXFont const & font) const
{
- return font.maxDescent()+1;
+ return font.maxDescent() + 1;
}
-int InsetInfo::Width(LyXFont const &font) const
+int InsetInfo::Width(LyXFont const & font) const
{
return 6 + font.textWidth(_("Note"), strlen(_("Note")));
}
-void InsetInfo::Draw(LyXFont font, LyXScreen &scr,
- int baseline, float &x)
+void InsetInfo::Draw(LyXFont font, LyXScreen & scr,
+ int baseline, float & x)
{
/* Info-insets are never LaTeX, so just correct the font */
font.setLatex(LyXFont::OFF);
@@ -90,13 +90,13 @@ void InsetInfo::Draw(LyXFont font, LyXScreen &scr,
}
-void InsetInfo::Write(FILE *file)
+void InsetInfo::Write(FILE * file)
{
fprintf(file, "Info %s", contents.c_str());
}
-void InsetInfo::Read(LyXLex &lex)
+void InsetInfo::Read(LyXLex & lex)
{
string tmp = lex.GetString(); // should be "Info"
if (tmp != "Info")
@@ -153,12 +153,11 @@ unsigned char InsetInfo::Editable() const
}
-void InsetInfo::CloseInfoCB(FL_OBJECT *, long data)
+void InsetInfo::CloseInfoCB(FL_OBJECT * ob, long)
{
- InsetInfo *inset = (InsetInfo*) data;
-// inset->contents = fl_get_input(inset->strobj);
+ InsetInfo * inset = static_cast(ob->u_vdata);
string tmp = fl_get_input(inset->strobj);
- Buffer *buffer = current_view->currentBuffer();
+ Buffer * buffer = current_view->currentBuffer();
if(tmp != inset->contents && !(buffer->isReadonly()) ) {
buffer->markDirty();
inset->contents = tmp;
@@ -170,12 +169,14 @@ void InsetInfo::CloseInfoCB(FL_OBJECT *, long data)
}
}
+
// This is just a wrapper.
-extern "C" void C_InsetInfo_CloseInfoCB(FL_OBJECT *, long data)
+extern "C" void C_InsetInfo_CloseInfoCB(FL_OBJECT * ob, long data)
{
- InsetInfo::CloseInfoCB(0, data);
+ InsetInfo::CloseInfoCB(ob, data);
}
+
void InsetInfo::Edit(int, int)
{
static int ow = -1, oh;
@@ -193,8 +194,9 @@ void InsetInfo::Edit(int, int)
obj = fl_add_button(FL_NORMAL_BUTTON,130,140,120,30,idex(_("Close|#C^[")));
fl_set_object_resize(obj, FL_RESIZE_NONE);
fl_set_object_gravity(obj, SouthEastGravity, SouthEastGravity);
- fl_set_object_callback(obj, C_InsetInfo_CloseInfoCB, (long)this);
- fl_set_object_shortcut(obj, scex(_("Close|#C^[")), (long)this);
+ fl_set_object_callback(obj, C_InsetInfo_CloseInfoCB, 0);
+ obj->u_vdata = this;
+ fl_set_object_shortcut(obj, scex(_("Close|#C^[")), 1);
fl_end_form();
fl_set_form_atclose(form, CancelCloseBoxCB, 0);
}
@@ -215,7 +217,7 @@ void InsetInfo::Edit(int, int)
Inset* InsetInfo::Clone()
{
- InsetInfo *result = new InsetInfo(contents);
+ InsetInfo * result = new InsetInfo(contents);
return result;
}
diff --git a/src/insets/insetinfo.h b/src/insets/insetinfo.h
index edd3e9fa1e..5023a069fd 100644
--- a/src/insets/insetinfo.h
+++ b/src/insets/insetinfo.h
@@ -4,12 +4,13 @@
*
* LyX, The Document Processor
*
- * Copyright (C) 1995 Matthias Ettrich
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-1999 the LyX Team.
*
- *======================================================*/
+ * ======================================================*/
-#ifndef _INSET_INFO_H
-#define _INSET_INFO_H
+#ifndef INSET_INFO_H
+#define INSET_INFO_H
#ifdef __GNUG__
#pragma interface
@@ -36,27 +37,27 @@ public:
///
~InsetInfo();
///
- int Ascent(LyXFont const &font) const;
+ int Ascent(LyXFont const & font) const;
///
- int Descent(LyXFont const &font) const;
+ int Descent(LyXFont const & font) const;
///
- int Width(LyXFont const &font) const;
+ int Width(LyXFont const & font) const;
///
- void Draw(LyXFont font, LyXScreen &scr, int baseline, float &x);
+ void Draw(LyXFont font, LyXScreen & scr, int baseline, float & x);
///
- void Write(FILE *file);
+ void Write(FILE * file);
///
- void Read(LyXLex &lex);
+ void Read(LyXLex & lex);
///
- int Latex(FILE *file, signed char fragile);
+ int Latex(FILE * file, signed char fragile);
///
- int Latex(string &file, signed char fragile);
+ int Latex(string & file, signed char fragile);
///
- int Linuxdoc(string &file);
+ int Linuxdoc(string & file);
///
- int DocBook(string &file);
+ int DocBook(string & file);
/// what appears in the minibuffer when opening
- char const* EditMessage() {return "Opened note";}
+ char const * EditMessage() {return "Opened note";}
///
void Edit(int, int);
///
@@ -64,16 +65,15 @@ public:
///
Inset::Code LyxCode() const;
///
- Inset* Clone();
+ Inset * Clone();
///
static void CloseInfoCB(FL_OBJECT *, long data);
private:
///
string contents;
///
- FL_FORM *form;
+ FL_FORM * form;
///
- FL_OBJECT *strobj;
+ FL_OBJECT * strobj;
};
-
#endif
diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C
index 2ebb685295..6ef9e342a8 100644
--- a/src/insets/insetlabel.C
+++ b/src/insets/insetlabel.C
@@ -30,9 +30,9 @@ InsetLabel::~InsetLabel()
}
-Inset* InsetLabel::Clone()
+Inset * InsetLabel::Clone()
{
- InsetLabel *result = new InsetLabel(getCommand());
+ InsetLabel * result = new InsetLabel(getCommand());
return result;
}
@@ -48,28 +48,28 @@ string InsetLabel::getLabel(int) const
return contents;
}
-int InsetLabel::Latex(FILE *file, signed char /*fragile*/)
+int InsetLabel::Latex(FILE * file, signed char /*fragile*/)
{
fprintf(file, "%s", escape(getCommand()).c_str());
return 0;
}
-int InsetLabel::Latex(string &file, signed char /*fragile*/)
+int InsetLabel::Latex(string & file, signed char /*fragile*/)
{
file += escape(getCommand());
return 0;
}
-int InsetLabel::Linuxdoc(string &file)
+int InsetLabel::Linuxdoc(string & file)
{
file += "