merge from the string-switch branch and ready for a prelease.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@162 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 1999-10-02 16:21:10 +00:00
parent 79db9fbd20
commit 0eccdd1c36
225 changed files with 26176 additions and 22738 deletions

View File

@ -2,3 +2,8 @@ config.cache
config.log config.log
config.status config.status
Makefile Makefile
Makefile.in
configure
aclocal.m4
lyx.1

100
ChangeLog
View File

@ -1,7 +1,107 @@
1999-10-02 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/layout.C (Add): Changed to use compare_no_case instead of
strcasecmp.
* src/FontInfo.C: changed loop variable type too string::size_type.
1999-10-01 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/Makefile.am: added -I${srcdir}/../ to INCLUDES and
set ETAGS_ARGS to --c++
1999-09-30 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/table.C (DocBookEndOfCell): commented out two unused variables
* src/paragraph.C: commented out four unused variables.
* src/lyx_cb.C (TocUpdateCB): moved variable i and added a new i
insed a if clause with type string::size_type.
* src/lyxfr1.C (IsSearchStringInText): changed iSrch from int to
string::size_type.
* src/lyxfunc.C (Dispatch): use string::size_type as loop variable.
* src/lyx_cb.C (ReplaceWord): use string::size_type as loop
variable, also changed loop to go from 0 to lenght + 1, instead of
-1 to length. This should be correct.
* src/LaTeX.C (scanError): use string::size_type as loop variable
type.
* src/BufferView.C (WorkAreaButtonPress): moved #if 0 up two lines
(l.896) since y_tmp and row was not used anyway.
* src/insets/insetref.C (escape): use string::size_type as loop
variable type.
* src/insets/insetquotes.C (Width): use string::size_type as loop
variable type.
(Draw): use string::size_type as loop variable type.
* src/insets/insetlatexaccent.C (checkContents): use
string::size_type as loop variable type.
* src/insets/insetlabel.C (escape): use string::size_type as loop
variable type.
* src/insets/insetinfo.C: added an extern for current_view.
* src/insets/insetcommand.C (scanCommand): use string::size_type
as loop variable type.
* most files: removed the RCS tags. With them we had to recompile
a lot of files after a simple cvs commit. Also we have never used
them for anything meaningful.
* most files: tags-query-replace NULL 0. As adviced several plases
we now use "0" instead of "NULL" in our code.
* src/support/filetools.C (SpaceLess): use string::size_type as
loop variable type.
1999-09-29 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/paragraph.C: fixed up some more string stuff.
1999-09-28 Lars Gullik Bjønnes <larsbj@lyx.org> 1999-09-28 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/filetools.h: make modestr a std::string.
* src/filetools.C (GetEnv): made ch really const.
* src/lyxlib.h: removed the Maximum and Minimum inline functions,
made code that used these use max/min from <algorithm> instead.
* changed several c library include files to their equivalent c++
library include files. All is not changed yet.
* created a support subdir in src, put lyxstring and lstrings
there + the extra files atexit, fileblock, strerror. Created
Makefile.am. edited configure.in and src/Makefile.am to use this
new subdir. More files moved to support.
* imported som of the functions from repository lyx, filetools
* ran tags-query-replace on LString -> string, corrected the bogus
cases. Tried to make use of lstrings.[hC], debugged a lot. There
is still some errors in there. This is errors where too much or
too litle get deleted from strings (string::erase, string::substr,
string::replace), there can also be some off by one errors, or
just plain wrong use of functions from lstrings. Viewing of quotes
is wrong.
* LyX is now running fairly well with string, but there are
certainly some bugs yet (see above) also string is quite different
from LString among others in that it does not allow null pointers
passed in and will abort if it gets any.
* Added the revtex4 files I forgot when setting up the repository. * Added the revtex4 files I forgot when setting up the repository.
1999-09-27 Lars Gullik Bjønnes <larsbj@lyx.org> 1999-09-27 Lars Gullik Bjønnes <larsbj@lyx.org>
* All over: Tried to clean everything up so that only the files * All over: Tried to clean everything up so that only the files
that we really need are included in the cvs repository. that we really need are included in the cvs repository.
* Switched to use automake. * Switched to use automake.

View File

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

View File

@ -217,6 +217,7 @@ AC_OUTPUT([Makefile \
src/Makefile \ src/Makefile \
src/mathed/Makefile \ src/mathed/Makefile \
src/insets/Makefile \ src/insets/Makefile \
src/support/Makefile \
], [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile]) ], [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])

View File

@ -1,4 +1,5 @@
Makefile Makefile
Makefile.in
textclass.lst textclass.lst
packages.lst packages.lst
lyxrc.defaults lyxrc.defaults

View File

@ -1,2 +1,8 @@
reLyX reLyX
noweb2lyx noweb2lyx
Makefile.in
Makefile
config.log
config.status
reLyX.1

View File

@ -28,7 +28,6 @@ src/combox.C
src/credits.C src/credits.C
src/credits_form.C src/credits_form.C
src/filedlg.C src/filedlg.C
src/filetools.C
src/form1.C src/form1.C
src/gettext.h src/gettext.h
src/insets/figinset.C src/insets/figinset.C
@ -62,7 +61,6 @@ src/lyxfont.C
src/lyxfr0.C src/lyxfr0.C
src/lyxfr1.C src/lyxfr1.C
src/lyxfunc.C src/lyxfunc.C
src/lyxlib.h
src/lyxvc.C src/lyxvc.C
src/mathed/formula.C src/mathed/formula.C
src/mathed/formula.h src/mathed/formula.h
@ -77,6 +75,8 @@ src/pathstack.C
src/print_form.C src/print_form.C
src/sp_form.C src/sp_form.C
src/spellchecker.C src/spellchecker.C
src/support/filetools.C
src/support/lyxlib.h
src/text.C src/text.C
src/text2.C src/text2.C

2082
po/ca.po

File diff suppressed because it is too large Load Diff

2080
po/cs.po

File diff suppressed because it is too large Load Diff

2082
po/da.po

File diff suppressed because it is too large Load Diff

2086
po/de.po

File diff suppressed because it is too large Load Diff

2079
po/es.po

File diff suppressed because it is too large Load Diff

2080
po/fi.po

File diff suppressed because it is too large Load Diff

2086
po/fr.po

File diff suppressed because it is too large Load Diff

2078
po/hu.po

File diff suppressed because it is too large Load Diff

2080
po/it.po

File diff suppressed because it is too large Load Diff

2079
po/nl.po

File diff suppressed because it is too large Load Diff

2080
po/no.po

File diff suppressed because it is too large Load Diff

2260
po/pl.po

File diff suppressed because it is too large Load Diff

2080
po/pt.po

File diff suppressed because it is too large Load Diff

2080
po/ru.po

File diff suppressed because it is too large Load Diff

2080
po/sl.po

File diff suppressed because it is too large Load Diff

2080
po/sv.po

File diff suppressed because it is too large Load Diff

2081
po/tr.po

File diff suppressed because it is too large Load Diff

2081
po/wa.po

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,8 @@
config.h config.h
lyx lyx
Makefile Makefile
Makefile.in
config.h.in
stamp-h
*.deps

View File

@ -22,11 +22,11 @@ public:
/// ///
struct BackStackItem { struct BackStackItem {
/// ///
void set(LString f, int xx, int yy) { void set(string f, int xx, int yy) {
fname = f; x = xx; y = yy; fname = f; x = xx; y = yy;
} }
/// Filename /// Filename
LString fname; string fname;
/// Cursor x-position /// Cursor x-position
int x; int x;
/// Cursor y-position /// Cursor y-position
@ -42,12 +42,12 @@ public:
delete[] item; delete[] item;
} }
/// ///
void push(LString f, int x, int y) { void push(string f, int x, int y) {
if (i<imax) if (i<imax)
item[i++].set(f, x, y); item[i++].set(f, x, y);
} }
/// ///
LString &pop(int *x, int *y) { string &pop(int *x, int *y) {
if (i>0) i--; if (i>0) i--;
*x = item[i].x; *x = item[i].x;
*y = item[i].y; *y = item[i].y;

View File

@ -1,21 +1,24 @@
// -*- C++ -*- // -*- C++ -*-
/* This file is part of /* This file is part of
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
*======================================================*/ * ======================================================*/
#include <config.h> #include <config.h>
#include <stdlib.h> #include <cstdlib>
#include <csignal>
#include <unistd.h> #include <unistd.h>
#include <signal.h>
#include <sys/wait.h> #include <sys/wait.h>
#include "support/lstrings.h"
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
@ -38,12 +41,6 @@
#include "lyx_cb.h" #include "lyx_cb.h"
#include "gettext.h" #include "gettext.h"
// $Id: BufferView.C,v 1.2 1999/10/02 14:01:03 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: BufferView.C,v 1.2 1999/10/02 14:01:03 larsbj Exp $";
#endif /* lint */
extern BufferList bufferlist; extern BufferList bufferlist;
void sigchldhandler(pid_t pid, int *status); void sigchldhandler(pid_t pid, int *status);
@ -115,7 +112,7 @@ void BufferView::setBuffer(Buffer *b)
} }
if (_buffer) { if (_buffer) {
lyxerr.debug(LString(" Buffer addr: ") + PTR_AS_INT(_buffer)); lyxerr.debug(string(" Buffer addr: ") + tostr(_buffer));
_buffer->addUser(this); _buffer->addUser(this);
_owner->getMenus()->showMenus(); _owner->getMenus()->showMenus();
// If we don't have a text object for this, we make one // If we don't have a text object for this, we make one
@ -896,9 +893,11 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
// Hit above or below the table? // Hit above or below the table?
if (doit) { if (doit) {
long y_tmp = y + screen->first;
Row* row = _buffer->text->GetRowNearY(y_tmp);
#if 0 #if 0
long y_tmp = y + screen->first;
Row* row = _buffer->text->GetRowNearY(y_tmp);
// Isn't this empty code anyway? (Lgb) // Isn't this empty code anyway? (Lgb)
if (row->par != _buffer->text->cursor.par) if (row->par != _buffer->text->cursor.par)
doit = true; doit = true;
@ -1353,13 +1352,13 @@ void BufferView::CursorToggleCB(FL_OBJECT *ob, long)
Window tmpwin; Window tmpwin;
int tmp; int tmp;
XGetInputFocus(fl_display, &tmpwin, &tmp); XGetInputFocus(fl_display, &tmpwin, &tmp);
lyxerr.debug(LString("tmpwin: ") + int(tmpwin)); lyxerr.debug(string("tmpwin: ") + tostr(tmpwin));
lyxerr.debug(LString("window: ") lyxerr.debug(string("window: ")
+ int(view->_owner->getForm()->window)); + tostr(view->_owner->getForm()->window));
lyxerr.debug(LString("work_area_focus: ") lyxerr.debug(string("work_area_focus: ")
+ int(view->work_area_focus)); + tostr(view->work_area_focus));
lyxerr.debug(LString("lyx_focus : ") lyxerr.debug(string("lyx_focus : ")
+ int(view->lyx_focus)); + tostr(view->lyx_focus));
if (tmpwin != view->_owner->getForm()->window) { if (tmpwin != view->_owner->getForm()->window) {
view->lyx_focus = false; view->lyx_focus = false;
goto skip_timer; goto skip_timer;
@ -1517,7 +1516,7 @@ void BufferView::savePosition()
void BufferView::restorePosition() void BufferView::restorePosition()
{ {
int x, y; int x, y;
LString fname = backstack->pop(&x, &y); string fname = backstack->pop(&x, &y);
BeforeChange(); BeforeChange();
Buffer *b = (bufferlist.exists(fname)) ? bufferlist.getBuffer(fname): Buffer *b = (bufferlist.exists(fname)) ? bufferlist.getBuffer(fname):

View File

@ -45,7 +45,7 @@ Bullet::Bullet(const int f, const int c, const int s)
} }
LString Bullet::getText() string Bullet::getText()
{ {
if (user_text == 0) { if (user_text == 0) {
generateText(); generateText();
@ -101,14 +101,14 @@ void Bullet::generateText()
} }
const LString & Bullet::bulletSize(const short & s) const string & Bullet::bulletSize(const short & s)
{ {
// use a parameter rather than hard code `size' in here // use a parameter rather than hard code `size' in here
// in case some future function may want to retrieve // in case some future function may want to retrieve
// an arbitrary entry. // an arbitrary entry.
// See additional comments in bulletEntry() below. // See additional comments in bulletEntry() below.
static LString const BulletSize[SIZEMAX] = { static string const BulletSize[SIZEMAX] = {
"\\tiny", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\tiny", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize",
"\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge" "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"
}; };
@ -117,7 +117,7 @@ const LString & Bullet::bulletSize(const short & s)
} }
const LString & Bullet::bulletEntry(const short & f, const short & c) const string & Bullet::bulletEntry(const short & f, const short & c)
{ {
// Despite how this may at first appear the static local variables // Despite how this may at first appear the static local variables
// are only initialized once.. // are only initialized once..
@ -130,8 +130,8 @@ const LString & Bullet::bulletEntry(const short & f, const short & c)
// The single 2-dim array had to be changed to multiple 1-dim arrays // The single 2-dim array had to be changed to multiple 1-dim arrays
// to get around a compiler bug in an earler version of gcc (< 2.7.2.1) // to get around a compiler bug in an earler version of gcc (< 2.7.2.1)
// static LString const BulletPanels[FONTMAX][CHARMAX] = { // static string const BulletPanels[FONTMAX][CHARMAX] = {
static LString const BulletPanel0[CHARMAX] = { static string const BulletPanel0[CHARMAX] = {
/* standard */ /* standard */
"\\normalfont\\bfseries{--}", "\\(\\vdash\\)", "\\normalfont\\bfseries{--}", "\\(\\vdash\\)",
"\\(\\dashv\\)", "\\(\\flat\\)", "\\(\\natural\\)", "\\(\\dashv\\)", "\\(\\flat\\)", "\\(\\natural\\)",
@ -148,7 +148,7 @@ const LString & Bullet::bulletEntry(const short & f, const short & c)
"\\(\\rightharpoonup\\)", "\\(\\rightharpoondown\\)", "\\(\\rightharpoonup\\)", "\\(\\rightharpoondown\\)",
"\\(\\Rightarrow\\)", "\\(\\succ\\)" "\\(\\Rightarrow\\)", "\\(\\succ\\)"
}; };
static LString const BulletPanel1[CHARMAX] = { static string const BulletPanel1[CHARMAX] = {
/* amssymb */ /* amssymb */
"\\(\\Rrightarrow\\)", "\\(\\rightarrowtail\\)", "\\(\\Rrightarrow\\)", "\\(\\rightarrowtail\\)",
"\\(\\twoheadrightarrow\\)", "\\(\\rightsquigarrow\\)", "\\(\\twoheadrightarrow\\)", "\\(\\rightsquigarrow\\)",
@ -167,7 +167,7 @@ const LString & Bullet::bulletEntry(const short & f, const short & c)
"\\(\\blacktriangledown\\)", "\\(\\blacklozenge\\)", "\\(\\blacktriangledown\\)", "\\(\\blacklozenge\\)",
"\\(\\blacksquare\\)" "\\(\\blacksquare\\)"
}; };
static LString const BulletPanel2[CHARMAX] = { static string const BulletPanel2[CHARMAX] = {
/* psnfss1 */ /* psnfss1 */
"\\ding{108}", "\\ding{109}", "\\ding{108}", "\\ding{109}",
"\\ding{119}", "\\Pisymbol{psy}{197}", "\\ding{119}", "\\Pisymbol{psy}{197}",
@ -188,7 +188,7 @@ const LString & Bullet::bulletEntry(const short & f, const short & c)
"\\ding{166}", "\\ding{167}", "\\ding{166}", "\\ding{167}",
"\\ding{226}", "\\ding{227}" "\\ding{226}", "\\ding{227}"
}; };
static LString const BulletPanel3[CHARMAX] = { static string const BulletPanel3[CHARMAX] = {
/* psnfss2 */ /* psnfss2 */
"\\ding{37}", "\\ding{38}", "\\ding{37}", "\\ding{38}",
"\\ding{34}", "\\ding{36}", "\\ding{34}", "\\ding{36}",
@ -209,7 +209,7 @@ const LString & Bullet::bulletEntry(const short & f, const short & c)
"\\ding{171}", "\\ding{168}", "\\ding{171}", "\\ding{168}",
"\\ding{169}", "\\ding{170}" "\\ding{169}", "\\ding{170}"
}; };
static LString const BulletPanel4[CHARMAX] = { static string const BulletPanel4[CHARMAX] = {
/* psnfss3 */ /* psnfss3 */
"\\ding{65}", "\\ding{76}", "\\ding{65}", "\\ding{76}",
"\\ding{75}", "\\ding{72}", "\\ding{75}", "\\ding{72}",
@ -230,7 +230,7 @@ const LString & Bullet::bulletEntry(const short & f, const short & c)
"\\ding{102}", "\\ding{96}", "\\ding{102}", "\\ding{96}",
"\\ding{95}", "\\ding{97}" "\\ding{95}", "\\ding{97}"
}; };
static LString const BulletPanel5[CHARMAX] = { static string const BulletPanel5[CHARMAX] = {
/* psnfss4 */ /* psnfss4 */
"\\ding{223}", "\\ding{224}", "\\ding{223}", "\\ding{224}",
"\\ding{225}", "\\ding{232}", "\\ding{225}", "\\ding{232}",
@ -250,9 +250,9 @@ const LString & Bullet::bulletEntry(const short & f, const short & c)
"\\Pisymbol{psy}{174}", "\\Pisymbol{psy}{222}", "\\Pisymbol{psy}{174}", "\\Pisymbol{psy}{222}",
"\\ding{254}", "\\ding{242}", "\\ding{254}", "\\ding{242}",
"\\ding{231}", "\\Pisymbol{psy}{45}" "\\ding{231}", "\\Pisymbol{psy}{45}"
}; /* LString const BulletPanels[][] */ }; /* string const BulletPanels[][] */
static LString const * BulletPanels[FONTMAX] = { static string const * BulletPanels[FONTMAX] = {
BulletPanel0, BulletPanel1, BulletPanel0, BulletPanel1,
BulletPanel2, BulletPanel3, BulletPanel2, BulletPanel3,
BulletPanel4, BulletPanel5 BulletPanel4, BulletPanel5

View File

@ -1,19 +1,19 @@
// -*- C++ -*- // -*- C++ -*-
/* This is the bullet class definition file. /* This is the bullet class definition file.
* This file is part of * This file is part of
*====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1997-1998 Allan Rae * Copyright 1995 Matthias Ettrich
* and the LyX Team * Copyright 1995-1999 The LyX Team.
* *
*======================================================*/ * This file Copyright 1997-1999
* Allan Rae
* ======================================================*/
// $Id: Bullet.h,v 1.1 1999/09/27 18:44:36 larsbj Exp $ #ifndef BULLET_H
#define BULLET_H
#ifndef BULLET_H_
#define BULLET_H_
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
@ -22,7 +22,7 @@
#include "LString.h" #include "LString.h"
#ifdef DEBUG_AS_DEFAULT #ifdef DEBUG_AS_DEFAULT
#include <assert.h> #include <cassert>
#endif #endif
/// ///
@ -32,7 +32,7 @@ public:
Bullet(const int f = -1, const int c = -1, const int s = -1); Bullet(const int f = -1, const int c = -1, const int s = -1);
/// ///
Bullet(const LString &); Bullet(const string &);
/// ///
~Bullet(); ~Bullet();
@ -44,7 +44,7 @@ public:
/// ///
void setSize(const int); void setSize(const int);
/// ///
void setText(const LString &); void setText(const string &);
/// ///
int getCharacter() const; int getCharacter() const;
/// ///
@ -52,9 +52,9 @@ public:
/// ///
int getSize() const; int getSize() const;
/// ///
LString getText() const; string getText() const;
/// ///
LString getText(); string getText();
/// ///
char const * c_str(); char const * c_str();
/// ///
@ -118,9 +118,9 @@ private:
/// ///
void generateText(); void generateText();
/// ///
static const LString & bulletSize(const short &); static const string & bulletSize(const short &);
/// ///
static const LString & bulletEntry(const short &, const short &); static const string & bulletEntry(const short &, const short &);
/// ///
short font; short font;
@ -133,7 +133,7 @@ private:
// the predefined arrays of LaTeX equivalent strings. // the predefined arrays of LaTeX equivalent strings.
/** flag indicates if user has control of text (1) /** flag indicates if user has control of text (1)
or if I can use it to generate LStrings (0) or if I can use it to generate strings (0)
or have already (-1) or have already (-1)
*/ */
short user_text; short user_text;
@ -145,13 +145,13 @@ private:
or one generated internally from the font, character or one generated internally from the font, character
and size settings. and size settings.
*/ */
LString text; string text;
}; };
/*----------------Inline Bullet Member Functions------------------*/ /*----------------Inline Bullet Member Functions------------------*/
inline Bullet::Bullet(const LString & t) inline Bullet::Bullet(const string & t)
: font(MIN), character(MIN), size(MIN), user_text(1), text(t) : font(MIN), character(MIN), size(MIN), user_text(1), text(t)
{ {
#ifdef DEBUG_AS_DEFAULT #ifdef DEBUG_AS_DEFAULT
@ -209,7 +209,7 @@ inline void Bullet::setSize(const int s)
} }
inline void Bullet::setText(const LString & t) inline void Bullet::setText(const string & t)
{ {
font = character = size = MIN; font = character = size = MIN;
user_text = 1; user_text = 1;
@ -238,7 +238,7 @@ inline int Bullet::getSize() const
} }
inline LString Bullet::getText() const inline string Bullet::getText() const
{ {
return text; return text;
} }

View File

@ -2,10 +2,10 @@
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
* This file is Copyright (C) 1997-1998 * This file is Copyright 1997-1998
* Asger Alstrup * Asger Alstrup
* *
*====================================================== *======================================================
@ -13,7 +13,7 @@
#include <config.h> #include <config.h>
#include <stdlib.h> // atoi #include <cstdlib> // atoi
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
@ -21,27 +21,20 @@
#include "Chktex.h" #include "Chktex.h"
#include "LaTeX.h" // TeXErrors #include "LaTeX.h" // TeXErrors
#include "filetools.h" #include "support/filetools.h"
#include "lyxlex.h" #include "lyxlex.h"
#include "FileInfo.h" #include "support/FileInfo.h"
#include "error.h" #include "error.h"
#include "syscall.h" #include "support/syscall.h"
#include "syscontr.h" #include "support/syscontr.h"
#include "pathstack.h" #include "pathstack.h"
#include "gettext.h" #include "gettext.h"
// $Id: Chktex.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: Chktex.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $";
#endif /* lint */
/* /*
* CLASS Chktex * CLASS Chktex
*/ */
Chktex::Chktex(LString const & chktex, LString const & f, LString const & p) Chktex::Chktex(string const & chktex, string const & f, string const & p)
: cmd(chktex), file(f), path(p) : cmd(chktex), file(f), path(p)
{ {
} }
@ -50,8 +43,8 @@ Chktex::Chktex(LString const & chktex, LString const & f, LString const & p)
int Chktex::run(TeXErrors &terr) int Chktex::run(TeXErrors &terr)
{ {
// run bibtex // run bibtex
LString log = ChangeExtension(file, ".log", true); string log = ChangeExtension(file, ".log", true);
LString tmp = cmd + " -q -v0 -b0 -x " + file + " -o " + log; string tmp = cmd + " -q -v0 -b0 -x " + file + " -o " + log;
Systemcalls one; Systemcalls one;
int result= one.Startscript(Systemcalls::System, tmp); int result= one.Startscript(Systemcalls::System, tmp);
if (result == 0) { if (result == 0) {
@ -65,12 +58,12 @@ int Chktex::run(TeXErrors &terr)
int Chktex::scanLogFile(TeXErrors &terr) int Chktex::scanLogFile(TeXErrors &terr)
{ {
LString token; string token;
int retval = 0; int retval = 0;
LyXLex lex(NULL, 0); LyXLex lex(0, 0);
LString tmp = ChangeExtension(file, ".log", true); string tmp = ChangeExtension(file, ".log", true);
if (!lex.setFile(tmp)) { if (!lex.setFile(tmp)) {
// Unable to open file. Return at once // Unable to open file. Return at once
@ -83,12 +76,12 @@ int Chktex::scanLogFile(TeXErrors &terr)
else // blank line in the file being read else // blank line in the file being read
continue; continue;
LString srcfile, line, pos, warno, warning; string srcfile, line, pos, warno, warning;
token.split(srcfile, ':'); token=split(token, srcfile, ':');
token.split(line, ':'); token=split(token, line, ':');
token.split(pos, ':'); token=split(token, pos, ':');
token.split(warno, ':'); token=split(token, warno, ':');
token.split(warning, ':'); token=split(token, warning, ':');
int lineno = atoi(line.c_str()); int lineno = atoi(line.c_str());
warno = _("ChkTeX warning id #") + warno; warno = _("ChkTeX warning id #") + warno;

View File

@ -4,17 +4,17 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
* This file is Copyright (C) 1997 * This file is Copyright 1997
* Asger Alstrup * Asger Alstrup
* *
*====================================================== * ======================================================
*/ */
#ifndef _CHKTEX_H #ifndef CHKTEX_H
#define _CHKTEX_H #define CHKTEX_H
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
@ -32,8 +32,8 @@ public:
cmd = the chktex command, file = name of the (temporary) latex file, cmd = the chktex command, file = name of the (temporary) latex file,
path = name of the files original path. path = name of the files original path.
*/ */
Chktex(LString const & cmd, LString const & file, Chktex(string const & cmd, string const & file,
LString const & path); string const & path);
/** Runs chktex. /** Runs chktex.
Returns -1 if fail, number of messages otherwise. Returns -1 if fail, number of messages otherwise.
@ -44,13 +44,13 @@ private:
int scanLogFile(TeXErrors &); int scanLogFile(TeXErrors &);
/// ///
LString cmd; string cmd;
/// ///
LString file; string file;
/// ///
LString path; string path;
}; };
#endif #endif

View File

@ -14,18 +14,18 @@
#include <config.h> #include <config.h>
#include "DepTable.h" #include "DepTable.h"
#include "lyxlib.h" #include "support/lyxlib.h"
#include "filetools.h" #include "support/filetools.h"
DepTable::DepTable() DepTable::DepTable()
{ {
new_sum = 0; new_sum = 0;
old_sum = 0; old_sum = 0;
next = NULL; next = 0;
} }
DepTable::DepTable(LString const & f, DepTable::DepTable(string const & f,
bool upd, bool upd,
unsigned long one, unsigned long one,
unsigned long two) unsigned long two)
@ -50,17 +50,17 @@ DepTable::DepTable(LString const & f,
file + " " + file + " " +
tmp1 + " " + tmp2); tmp1 + " " + tmp2);
} }
next = NULL; next = 0;
} }
void DepTable::insert(LString const & fi, void DepTable::insert(string const & fi,
bool upd, bool upd,
unsigned long one, unsigned long one,
unsigned long two) unsigned long two)
{ {
// not quite sure if this is the correct place for MakeAbsPath // not quite sure if this is the correct place for MakeAbsPath
LString f = MakeAbsPath(fi); string f = MakeAbsPath(fi);
if (f == file) return; // exist already in the log if (f == file) return; // exist already in the log
if (next) if (next)
next->insert(f, upd, one, two); next->insert(f, upd, one, two);
@ -100,10 +100,10 @@ bool DepTable::sumchange()
} }
bool DepTable::haschanged(LString const & f) bool DepTable::haschanged(string const & f)
{ {
// not quite sure if this is the correct place for MakeAbsPath // not quite sure if this is the correct place for MakeAbsPath
LString fil = MakeAbsPath(f); string fil = MakeAbsPath(f);
bool ret = false; bool ret = false;
if (!fil.empty() && !file.empty() && fil == file) { if (!fil.empty() && !file.empty() && fil == file) {
@ -115,14 +115,14 @@ bool DepTable::haschanged(LString const & f)
} }
void DepTable::write(LString const&f) void DepTable::write(string const&f)
{ {
FilePtr fp(f, FilePtr::write); FilePtr fp(f, FilePtr::write);
if (fp() && next) next->write(fp()); if (fp() && next) next->write(fp());
} }
void DepTable::read(LString const &f) void DepTable::read(string const &f)
{ {
FilePtr fp(f, FilePtr::read); FilePtr fp(f, FilePtr::read);
if (fp()) { // file opened if (fp()) { // file opened
@ -141,11 +141,11 @@ void DepTable::read(LString const &f)
char tmp2[255]; char tmp2[255];
sprintf(tmp1, "%lu", one); sprintf(tmp1, "%lu", one);
sprintf(tmp2, "%lu", two); sprintf(tmp2, "%lu", two);
lyxerr.debug(LString("read dep: ") + lyxerr.debug(string("read dep: ") +
nome + " " + tmp1 + nome + " " + tmp1 +
" " + tmp2); " " + tmp2);
} }
insert(LString(nome), false, one, two); insert(string(nome), false, one, two);
} }
} }
} }

View File

@ -11,11 +11,11 @@
* ====================================================== * ======================================================
*/ */
#ifndef _DEP_TABLE_H #ifndef DEP_TABLE_H
#define _DEP_TABLE_H #define DEP_TABLE_H
#include "LString.h" #include "LString.h"
#include <stdio.h> #include <cstdio>
/// ///
class DepTable { class DepTable {
@ -26,7 +26,7 @@ public:
/** This one is a little bit harder since we need the absolute /** This one is a little bit harder since we need the absolute
filename. Should we insert files with .sty .cls etc as filename. Should we insert files with .sty .cls etc as
extension? */ extension? */
void insert(LString const &f, void insert(string const &f,
bool upd = false, bool upd = false,
unsigned long one = 0, unsigned long one = 0,
unsigned long two = 0); unsigned long two = 0);
@ -34,21 +34,21 @@ public:
void update(); void update();
/// ///
void write(LString const &f); void write(string const &f);
/// ///
void read(LString const &f); void read(string const &f);
/// returns true if any of the files has changed /// returns true if any of the files has changed
bool sumchange(); bool sumchange();
/// ///
bool haschanged(LString const &fil); bool haschanged(string const &fil);
private: private:
/// ///
DepTable(LString const &f, DepTable(string const &f,
bool upd, bool upd,
unsigned long one, unsigned long one,
unsigned long two); unsigned long two);
/// ///
LString file; string file;
/// The files new checksum /// The files new checksum
unsigned long new_sum; unsigned long new_sum;
/// The files old checksum /// The files old checksum

View File

@ -10,8 +10,8 @@
*======================================================*/ *======================================================*/
#include <config.h> #include <config.h>
#include <math.h> // fabs() #include <cmath> // fabs()
#include <stdlib.h> // atoi() #include <cstdlib> // atoi()
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "FontInfo.h" #pragma implementation "FontInfo.h"
@ -20,13 +20,15 @@
#include "FontInfo.h" #include "FontInfo.h"
#include "error.h" #include "error.h"
#include "lyxrc.h" // lyxrc.use_scalable_fonts #include "lyxrc.h" // lyxrc.use_scalable_fonts
#include "support/lstrings.h"
extern LyXRC * lyxrc; extern LyXRC * lyxrc;
/// Load font close to this size /// Load font close to this size
LString FontInfo::getFontname(int size) string FontInfo::getFontname(int size)
{ {
if (!exist()) if (!exist())
return LString(); return string();
int closestind = -1; int closestind = -1;
double error = 100000; double error = 100000;
@ -35,7 +37,7 @@ LString FontInfo::getFontname(int size)
if (sizes[i] == 0) { if (sizes[i] == 0) {
// Scalable font should not be considered close // Scalable font should not be considered close
} else if (sizes[i] == size) { } else if (sizes[i] == size) {
lyxerr.debug(LString("Exact font match with\n") lyxerr.debug(string("Exact font match with\n")
+ strings[i], Error::FONT); + strings[i], Error::FONT);
return strings[i]; return strings[i];
} else if (fabs(sizes[i] - size - 0.1) < error) { } else if (fabs(sizes[i] - size - 0.1) < error) {
@ -46,7 +48,7 @@ LString FontInfo::getFontname(int size)
if (scalable && lyxrc->use_scalable_fonts) { if (scalable && lyxrc->use_scalable_fonts) {
// We can use scalable // We can use scalable
LString font = resize(strings[scaleindex], size); string font = resize(strings[scaleindex], size);
lyxerr.debug("Using scalable font to get\n" lyxerr.debug("Using scalable font to get\n"
+ font, Error::FONT); + font, Error::FONT);
return font; return font;
@ -55,40 +57,42 @@ LString FontInfo::getFontname(int size)
// Did any fonts get close? // Did any fonts get close?
if (closestind == -1) { if (closestind == -1) {
// No, and we are not allowed to use scalables, so... // No, and we are not allowed to use scalables, so...
return LString(); return string();
} }
// We use the closest match // We use the closest match
lyxerr.debug(LString("Using closest font match to get size ") + size lyxerr.debug(string("Using closest font match to get size ")
+ " with\n" + strings[closestind], Error::FONT); + tostr(size)
+ " with\n" + strings[closestind], Error::FONT);
return strings[closestind]; return strings[closestind];
} }
/// Build newly sized font string /// Build newly sized font string
LString FontInfo::resize(LString const & font, int size) const { string FontInfo::resize(string const & font, int size) const {
// Find the position of the size spec // Find the position of the size spec
int cut=0, before=0, after=0; #warning rewrite to use std::string constructs
for (int i=0; i<font.length(); i++) { int cut = 0, before = 0, after = 0;
for (string::size_type i = 0; i < font.length(); ++i) {
if (font[i] == '-') { if (font[i] == '-') {
cut++; ++cut;
if (cut==7) { if (cut == 7) {
before = i; before = i;
} else if (cut==8) { } else if (cut == 8) {
after = i; after = i;
break; break;
} }
} }
} }
LString head = font; string head = font;
head.substring(0, before); head.erase(before + 1, string::npos);
LString tail = font; string tail = font;
tail.substring(after,tail.length()-1); tail.erase(0, after);
return head + size + tail; return head + tostr(size) + tail;
} }
/// Set new pattern /// Set new pattern
void FontInfo::setPattern(LString const & pat) void FontInfo::setPattern(string const & pat)
{ {
release(); release();
init(); init();
@ -116,12 +120,12 @@ void FontInfo::query()
} else { } else {
release(); release();
sizes = new int[matches]; sizes = new int[matches];
strings = new LString[matches]; strings = new string[matches];
// We have matches. Run them through // We have matches. Run them through
for(int i=0; i<matches; i++) { for(int i=0; i<matches; i++) {
LString name(list[i]); string name(list[i]);
sizes[i] = atoi(name.token('-',7).c_str()); sizes[i] = atoi(token(name, '-',7).c_str());
strings[i] = name; strings[i] = name;
if (sizes[i] == 0) { if (sizes[i] == 0) {
if (scaleindex == -1) { if (scaleindex == -1) {

View File

@ -30,7 +30,7 @@ public:
FontInfo() { init(); } FontInfo() { init(); }
/// ///
FontInfo(LString const & pat) FontInfo(string const & pat)
: pattern(pat) { init(); } : pattern(pat) { init(); }
/// Destructor /// Destructor
@ -49,23 +49,23 @@ public:
} }
/// Get existing pattern /// Get existing pattern
LString getPattern() const { return pattern; } string getPattern() const { return pattern; }
/// Set new pattern /// Set new pattern
void setPattern(LString const & pat); void setPattern(string const & pat);
/** Return full name of font close to this size. /** Return full name of font close to this size.
If impossible, result is the empty string */ If impossible, result is the empty string */
LString getFontname(int size); string getFontname(int size);
private: private:
/// Font pattern (with wildcard for size) /// Font pattern (with wildcard for size)
LString pattern; string pattern;
/// Available size list /// Available size list
int * sizes; int * sizes;
/// Corresponding name list /// Corresponding name list
LString * strings; string * strings;
/// Number of matches /// Number of matches
int matches; int matches;
@ -97,6 +97,6 @@ private:
void query(); void query();
/// Build newly sized font string /// Build newly sized font string
LString resize(LString const &, int size) const; string resize(string const &, int size) const;
}; };
#endif #endif

View File

@ -98,11 +98,11 @@ void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family,
} }
// Normal font. Let's search for an existing name that matches. // Normal font. Let's search for an existing name that matches.
LString ffamily; string ffamily;
LString fseries; string fseries;
LString fshape; string fshape;
LString norm = lyxrc->font_norm; string norm = lyxrc->font_norm;
LString fontname; string fontname;
FontInfo * fi = new FontInfo(); FontInfo * fi = new FontInfo();
fontinfo[family][series][shape] = fi; fontinfo[family][series][shape] = fi;
@ -205,7 +205,7 @@ XFontStruct* FontLoader::doLoad(LyXFont::FONT_FAMILY family,
int fsize = (int) ( (lyxrc->font_sizes[size] * lyxrc->dpi * int fsize = (int) ( (lyxrc->font_sizes[size] * lyxrc->dpi *
(lyxrc->zoom/100.0) ) / 72.27 + 0.5 ); (lyxrc->zoom/100.0) ) / 72.27 + 0.5 );
LString font = fontinfo[family][series][shape]->getFontname(fsize); string font = fontinfo[family][series][shape]->getFontname(fsize);
if (font.empty()) { if (font.empty()) {
lyxerr.print("No font matches request. Using 'fixed'."); lyxerr.print("No font matches request. Using 'fixed'.");
@ -239,7 +239,7 @@ XFontStruct* FontLoader::doLoad(LyXFont::FONT_FAMILY family,
f.setNoun(LyXFont::INHERIT); f.setNoun(LyXFont::INHERIT);
f.setLatex(LyXFont::INHERIT); f.setLatex(LyXFont::INHERIT);
f.setColor(LyXFont::INHERIT_COLOR); f.setColor(LyXFont::INHERIT_COLOR);
lyxerr.print(LString("Font '") + f.stateText() lyxerr.print(string("Font '") + f.stateText()
+ "' matched by\n" + font + '\n'); + "' matched by\n" + font + '\n');
} }
} }

View File

@ -2,10 +2,10 @@
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
* This file is Copyright (C) 1998 * This file is Copyright 1998
* Asger Alstrup * Asger Alstrup
* *
*====================================================== *======================================================
@ -19,25 +19,18 @@
#include "ImportLaTeX.h" #include "ImportLaTeX.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "syscall.h" #include "support/syscall.h"
#include "filetools.h" #include "support/filetools.h"
#include "bufferlist.h" #include "bufferlist.h"
extern LyXRC * lyxrc; extern LyXRC * lyxrc;
extern BufferList bufferlist; extern BufferList bufferlist;
// $Id: ImportLaTeX.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: ImportLaTeX.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $";
#endif /* lint */
/* /*
* CLASS ImportLaTeX * CLASS ImportLaTeX
*/ */
ImportLaTeX::ImportLaTeX(LString const & file) ImportLaTeX::ImportLaTeX(string const & file)
: file(file) : file(file)
{ {
} }
@ -46,12 +39,12 @@ ImportLaTeX::ImportLaTeX(LString const & file)
Buffer * ImportLaTeX::run() Buffer * ImportLaTeX::run()
{ {
// run reLyX // run reLyX
LString tmp = lyxrc->relyx_command + " -f " + file; string tmp = lyxrc->relyx_command + " -f " + file;
Systemcalls one; Systemcalls one;
Buffer * buf = 0; Buffer * buf = 0;
int result= one.Startscript(Systemcalls::System, tmp); int result= one.Startscript(Systemcalls::System, tmp);
if (result==0) { if (result==0) {
LString filename = ChangeExtension(file, ".lyx", false); string filename = ChangeExtension(file, ".lyx", false);
// File was generated without problems. Load it. // File was generated without problems. Load it.
buf = bufferlist.loadLyXFile(filename); buf = bufferlist.loadLyXFile(filename);
} }

View File

@ -29,7 +29,7 @@ public:
/** /**
file = name and path of the latex file file = name and path of the latex file
*/ */
ImportLaTeX(LString const & file); ImportLaTeX(string const & file);
/** Imports the document. /** Imports the document.
Return 0 if fail. Return 0 if fail.
@ -37,7 +37,7 @@ public:
Buffer * run(); Buffer * run();
private: private:
/// ///
LString file; string file;
}; };
#endif #endif

View File

@ -2,13 +2,13 @@
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1999 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
* This file is Copyright (C) 1999 * This file is Copyright 1999
* Kayvan A. Sylvan * Kayvan A. Sylvan
* *
*====================================================== * ======================================================
*/ */
#include <config.h> #include <config.h>
@ -19,19 +19,13 @@
#include "ImportNoweb.h" #include "ImportNoweb.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "syscall.h" #include "support/syscall.h"
#include "filetools.h" #include "support/filetools.h"
#include "bufferlist.h" #include "bufferlist.h"
extern LyXRC * lyxrc; extern LyXRC * lyxrc;
extern BufferList bufferlist; extern BufferList bufferlist;
// $Id: ImportNoweb.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: ImportNoweb.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $";
#endif /* lint */
/* /*
* Implementation the ImportNoweb methods. * Implementation the ImportNoweb methods.
*/ */
@ -39,13 +33,13 @@ static char vcid[] = "$Id: ImportNoweb.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $"
Buffer * ImportNoweb::run() Buffer * ImportNoweb::run()
{ {
// run reLyX -n // run reLyX -n
LString tmp = lyxrc->relyx_command + " -n -c " + string tmp = lyxrc->relyx_command + " -n -c " +
documentclass() + " -f " + file; documentclass() + " -f " + file;
Systemcalls one; Systemcalls one;
Buffer * buf = 0; Buffer * buf = 0;
int result= one.Startscript(Systemcalls::System, tmp); int result= one.Startscript(Systemcalls::System, tmp);
if (result==0) { if (result==0) {
LString filename = file + ".lyx"; string filename = file + ".lyx";
// File was generated without problems. Load it. // File was generated without problems. Load it.
buf = bufferlist.loadLyXFile(filename); buf = bufferlist.loadLyXFile(filename);
} }
@ -54,9 +48,9 @@ Buffer * ImportNoweb::run()
// Provide the literate documentclass by parsing the file. // Provide the literate documentclass by parsing the file.
// //
LString ImportNoweb::documentclass() string ImportNoweb::documentclass()
{ {
LString result = "literate-article"; // Default string result = "literate-article"; // Default
FilePtr inputfile(file, FilePtr::read); FilePtr inputfile(file, FilePtr::read);
if (!inputfile()) return "nofile"; // Should not happen! if (!inputfile()) return "nofile"; // Should not happen!

View File

@ -12,8 +12,8 @@
*====================================================== *======================================================
*/ */
#ifndef _IMPORTNOWEB_H #ifndef IMPORTNOWEB_H
#define _IMPORTNOWEB_H #define IMPORTNOWEB_H
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
@ -29,7 +29,7 @@ public:
/** /**
file = name and path of the noweb file to import file = name and path of the noweb file to import
*/ */
ImportNoweb(LString const & file) : file(file) {}; ImportNoweb(string const & file) : file(file) {};
/** Imports the document. /** Imports the document.
Return 0 if fail. Return 0 if fail.
@ -37,9 +37,9 @@ public:
Buffer * run(); Buffer * run();
private: private:
/// ///
LString file; string file;
/// ///
LString documentclass(); string documentclass();
/// ///
enum{ enum{
BUFSIZE = 512 BUFSIZE = 512

View File

@ -4,393 +4,22 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 1996 Matthias Ettrich * Copyright (C) 1995 Matthias Ettrich
* and the LyX Team. * Copyright (C) 1995-1999 The LyX Team.
* *
*======================================================*/ *======================================================*/
// This one is heavily based on the string class in The C++ #ifndef LSTRING_H
// Programming Language by Bjarne Stroustrup #define LSTRING_H
#ifndef _LSTRING_H_ #ifndef USE_INCLUDED_STRING
#define _LSTRING_H_ #include <string>
using std::string;
#ifdef __GNUG__ //using std::wstring;
#pragma interface
#endif
#include <config.h> // needed at least for compiler that do not
// understand 'explicit' (JMarc)
#ifdef _AIX
// AIX has strange ideas about where definitions like strcasecmp
// should go (JMarc)
#include <strings.h>
#else #else
#include <string.h> #include "support/lyxstring.h"
typedef lyxstring string;
//typedef lyxwstring wstring;
#endif
#endif #endif
/** A string class for LyX
This is a permanent String class. It was supposed to be superseeded
with QString when we switch to the Qt library, but now it's so developed
that it is as good as theirs (or maybe even better :-)
Notes for usage:
When you declare an LString, it is initially empty. There is no need to
do things like #LString a= "";#, especially not in constructors.
If you want to use a default empty LString as a parameter, use
#void foo(LString par = LString()); // Correct#
rather than
#void foo(LString par = ""); // WRONG!#
#void foo(LString par = 0); // WRONG!#
(The last one is only wrong because some compilers can't handle it.)
Methods that take an index as parameter all follow this rule: Valid indexes
go from 0 to length()-1.
\begin{tabular}{rl}
Correct: & #foo.substring(0, length()-1);# \\
Wrong: & #bar.substring(0, length());#
\end{tabular}
It is important that you declare LStrings as const if possible, because
some methods are much more efficient in const versions.
If you want to check whether a string is empty, do
#if (foo.empty()) something right#
rather than something along the lines of
#if (!foo) completely wrong#
When you use the #.copy()# method, LString calls "#new []#", so you have to
release the memory with #delete[]#. Don't preallocate memory.
When you want to copy an LString, just do
#LString a, b = "String";#
#a = b; // That's it!#
not something like
#LString a, b = "String";#
#a = b.copy(); // This leaks.#
The class automatically handles deep copying when required.
*/
class LString {
public:
/**@name Constructors and Deconstructors */
//@{
/// #LString x;#
LString();
/// #LString x(LString ...)#
LString(LString const &);
/// #LString x("abc")#
LString(char const*);
/// #LString x('a')#
explicit LString(char const);
// not all C++ compilers understands explicit as of now
///
~LString();
//@}
/**@name Operators */
//@{
///
LString& operator=(LString const &);
///
LString& operator=(char const *);
///
LString& operator=(char);
///
char& operator[](int);
#ifndef const
///
char const& operator[](int) const;
#endif
///
LString& operator+=(LString const &);
///
LString& operator+=(char const*);
///
LString& operator+=(char);
///
LString& operator+=(int);
///
LString& operator+=(long);
//@}
/**@name Methods */
//@{
/// to comply with the STL strings
bool empty() const;
///
//bool isEmpty() const;
///
//bool notEmpty() const;
///
int length() const;
// should be renamed to erase() (STL)
/** equivalent to *this = empty. But usable outside LString
implementation */
LString &clean();
/// This should be renamed to c_str()
char const* c_str() const;
// we should make the caller supply the storage to copy into. (STL)
/** This one returns a verbatim copy. Only temporary.
The caller should call delete [] when done with the string
*/
char * copy() const;
///
bool contains(char const *) const;
// Remove and replace (STL)
/// Truncate to substring. I.e. #"abcdef".substring(2,4)="cde"#
LString& substring(int i1, int i2);
/** Splits the string by the first delim.
Splits the string by the first appearance of delim.
The leading string up to delim is returned in piece (not including
delim), while the original string is cut from after the delimiter.
Example:
#s1=""; s2="a;bc".split(s1, ';') -> s1=="a"; s2 == "bc";#
*/
LString& split(LString& piece, char delim);
/// Same as split but does not return a piece
LString& split(char delim);
/// Same as split but uses the last delim.
LString& rsplit(LString& piece, char delim);
/** Extracts a token from this string at the nth delim.
Doesn't modify the original string. Similar to strtok.
Example:
#"a;bc;d".token(';', 1) == "bc";#
#"a;bc;d".token(';', 2) == "d";#
*/
LString token(char delim, int n=0) const;
/** Search a token in this string using the delim.
Doesn't modify the original string. Returns -1 in case of
failure.
Example:
#"a;bc;d".tokenPos(';', "bc") == 1;#
#"a;bc;d".token(';', "d") == 2;#
*/
int tokenPos(char delim, LString const &tok);
/** Strips characters off the end of a string.
#"abccc".strip('c') = "ab".#
*/
LString& strip(char const c = ' ');
/** Strips characters of the beginning of a string.
#"cccba".frontstrip('c') = "ba"#. */
LString& frontStrip(char const c = ' ');
/// Does the string start with this prefix?
bool prefixIs(char const *) const;
/// Does the string end with this char?
bool suffixIs(char) const;
/// Does the string end with this suffix?
bool suffixIs(char const *) const;
/// Substitute all "oldchar"s with "newchar"
LString& subst(char oldchar, char newchar);
/// Substitutes all instances of oldstr with newstr
LString& subst(char const * oldstr, LString const & newstr);
/** Compares a string and a (simple) regular expression
The only element allowed is "*" for any string of characters
*/
bool regexMatch(LString const & pattern) const;
/// Lowercases a string
LString& lowercase();
/// Counts how many of character c there is in string
int countChar(const char c) const;
/// Position of the character c from the beggining
int charPos(const char c) const;
//@}
/**@name Friends */
//@{
///
friend bool operator==(LString const &x, char const *s)
{
if (s == 0 || !(*s))
return x.p->s[0] == '\0';
else
return strcmp(x.p->s, s) == 0;
}
///
friend bool operator==(LString const &x, LString const &y)
{
return strcmp(x.p->s, y.p->s) == 0;
}
///
friend bool operator!=(LString const &x, char const *s)
{
if (s == 0 || !(*s))
return x.p->s[0] != '\0';
else
return strcmp(x.p->s, s) != 0;
}
///
friend bool operator!=(LString const &x, LString const &y)
{
return strcmp(x.p->s, y.p->s) != 0;
}
//@}
protected:
private:
/// A string representation
struct srep {
/// Length
unsigned int l;
/// Reference count (number of references - 1)
unsigned short n;
/// Extra space at end of allocated string
unsigned short e;
/// Data. At least 1 char for trailing null.
char s[1];
///
srep() { n = 0; l = 0; e = 0; s[0] = '\0'; }
};
/** The empty srep is a local static in each function that
needs one. There is no "global" empty srep but LString
doesn't need one (no code actually relies upon a single
empty srep).
This overcomes *all* "static initialization" problems,
at maximum speed, with a small overhead of 6 local static
empty_reps.
*/
// This is the only other option (or a variant of this anyway)
// I originally offered this style of empty_rep in 9709 but
// it was rejected for requiring too many function calls and pointer operations(!)
// and because another implementation was to be trialed (which has since
// apparently failed for some compilers). ARRae
// static srep& empty_rep()
// {
// static srep mt;
// return mt;
// }
/// A string is a pointer to it's representation
srep *p;
///
void lose();
};
inline LString::LString(LString const &x)
{
x.p->n++;
p = x.p;
}
inline void LString::lose()
{
if (p->n-- == 0) {
delete[] (char*)p;
}
}
inline LString::~LString()
{
lose();
}
inline int LString::length() const
{
return p->l;
}
inline bool LString::empty() const
{
return p->l == 0;
}
inline int LString::countChar(const char c) const
{
int n = 0;
for (int i=0; i < length(); i++)
if (operator[](i) == c) n++;
return n;
}
inline LString operator+(LString const &x, LString const &y)
{
LString str(x);
str += y;
return str;
}
inline LString operator+(LString const &x, char const &y)
{
LString str(x);
str += y;
return str;
}
inline LString operator+(LString const &x, int const &y)
{
LString str(x);
str += y;
return str;
}
inline LString operator+(LString const &x, long const &y)
{
LString str(x);
str += y;
return str;
}
inline char const* LString::c_str() const
{
return (char const*)p->s;
}
inline int LString::charPos(const char c) const
{
for (int i=0; i < length(); i++) {
if (operator[](i) == c) return i;
}
return -1;
}
#endif

View File

@ -2,43 +2,37 @@
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1999 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
* This file is Copyright (C) 1996-1999 * This file is Copyright 1996-1999
* Lars Gullik Bjønnes * Lars Gullik Bjønnes
* *
*====================================================== * ======================================================
*/ */
#include <config.h> #include <config.h>
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
#include "filetools.h" #include "support/filetools.h"
#include "LaTeX.h" #include "LaTeX.h"
#include "lyxlex.h" #include "lyxlex.h"
#include "FileInfo.h" #include "support/FileInfo.h"
#include "error.h" #include "error.h"
#include "lyxlib.h" #include "support/lyxlib.h"
#include "syscall.h" #include "support/syscall.h"
#include "syscontr.h" #include "support/syscontr.h"
#include "pathstack.h" #include "pathstack.h"
#include "bufferlist.h" #include "bufferlist.h"
#include "minibuffer.h" #include "minibuffer.h"
#include "gettext.h" #include "gettext.h"
// $Id: LaTeX.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: LaTeX.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $";
#endif /* lint */
extern BufferList bufferlist; extern BufferList bufferlist;
struct texfile_struct { struct texfile_struct {
@ -65,10 +59,10 @@ const texfile_struct all_files[] = {
// This should perhaps be placed in LyXLex // This should perhaps be placed in LyXLex
static static
LString readLine(FILE *file) string readLine(FILE *file)
{ {
if (feof(file)) if (feof(file))
return LString(); return string();
int i = 0; int i = 0;
char s[512]; char s[512];
@ -78,7 +72,7 @@ LString readLine(FILE *file)
i++; i++;
} while (!feof(file) && s[i-1] != '\n' && i<510); } while (!feof(file) && s[i-1] != '\n' && i<510);
s[i] = '\0'; s[i] = '\0';
LString tmp; string tmp;
if (i == 1 && feof(file)) if (i == 1 && feof(file))
; ;
else else
@ -108,27 +102,27 @@ TeXErrors::~TeXErrors()
void TeXErrors::scanError(LyXLex &lex) void TeXErrors::scanError(LyXLex &lex)
{ {
LString token = lex.GetString(); string token = lex.GetString();
// Sometimes the error string goes over more than one // Sometimes the error string goes over more than one
// line, and we need to get them all. // line, and we need to get them all.
LString errstr; string errstr;
LString tmp = readLine(lex.getFile()).frontStrip(); string tmp = frontStrip(readLine(lex.getFile()));
if (tmp == "\n" || tmp.empty()) { if (tmp == "\n" || tmp.empty()) {
tmp = readLine(lex.getFile()).frontStrip(); tmp = frontStrip(readLine(lex.getFile()));
if (tmp.contains("See the LaTeX manual")) { if (contains(tmp, "See the LaTeX manual")) {
do { do {
tmp = readLine(lex.getFile()); tmp = readLine(lex.getFile());
} while (!tmp.empty() && !tmp.contains("...")); } while (!tmp.empty() && !contains(tmp, "..."));
} }
tmp = readLine(lex.getFile()).frontStrip(); tmp = frontStrip(readLine(lex.getFile()));
} }
while ((tmp != "\n" || !errstr.contains("l.")) while ((tmp != "\n" || !contains(errstr, "l."))
&& !tmp.prefixIs("! ") && !prefixIs(tmp, "! ")
&& !tmp.contains("(job aborted") && !contains(tmp, "(job aborted")
&& !tmp.empty()) { && !tmp.empty()) {
errstr += tmp; errstr += tmp;
tmp = readLine(lex.getFile()).frontStrip(); tmp = frontStrip(readLine(lex.getFile()));
} }
lyxerr.debug("tmp: " + errstr); lyxerr.debug("tmp: " + errstr);
int line = 0; int line = 0;
@ -136,10 +130,10 @@ void TeXErrors::scanError(LyXLex &lex)
// by "l.###" in the beginning of the error string // by "l.###" in the beginning of the error string
// therefore we must search for "l.###" in the error // therefore we must search for "l.###" in the error
// msg. // msg.
if (errstr.contains("l.")) { if (contains(errstr, "l.")) {
// We make a const copy to make [] fast. (Asger) // We make a const copy to make [] fast. (Asger)
LString const es = errstr; string const es = errstr;
for (int i = 2; i < es.length(); i++) { for (string::size_type i = 2; i < es.length(); ++i) {
if (es[i-2] == 'l' && es[i-1] == '.' && if (es[i-2] == 'l' && es[i-1] == '.' &&
(es[i] >= '0' && es[i]<= '9')) { (es[i] >= '0' && es[i]<= '9')) {
line = atoi(es.c_str() + i); line = atoi(es.c_str() + i);
@ -149,13 +143,13 @@ void TeXErrors::scanError(LyXLex &lex)
} }
insertError(line, token, errstr); insertError(line, token, errstr);
if (tmp.prefixIs("! ")) { if (prefixIs(tmp, "! ")) {
scanError(lex); scanError(lex);
} }
} }
bool TeXErrors::getFirstError(int *line, LString *text) bool TeXErrors::getFirstError(int *line, string *text)
{ {
next_error = errors; next_error = errors;
if (next_error) { if (next_error) {
@ -168,7 +162,7 @@ bool TeXErrors::getFirstError(int *line, LString *text)
} }
bool TeXErrors::getNextError(int *line, LString *text) bool TeXErrors::getNextError(int *line, string *text)
{ {
if (next_error) { if (next_error) {
*line = next_error->error_in_line; *line = next_error->error_in_line;
@ -180,8 +174,8 @@ bool TeXErrors::getNextError(int *line, LString *text)
} }
void TeXErrors::insertError(int line, LString const &error_desc, void TeXErrors::insertError(int line, string const &error_desc,
LString const &error_text) string const &error_text)
{ {
Error *newerr = new Error(line, error_desc, error_text); Error *newerr = new Error(line, error_desc, error_text);
if (errors) { if (errors) {
@ -200,8 +194,8 @@ void TeXErrors::printErrors()
if (errors) { if (errors) {
Error *tmperr = errors; Error *tmperr = errors;
do { do {
lyxerr.print(LString("Error in line ") lyxerr.print(string("Error in line ")
+ tmperr->error_in_line + tostr(tmperr->error_in_line)
+ ": " + tmperr->error_desc + ": " + tmperr->error_desc
+ '\n' + tmperr->error_text); + '\n' + tmperr->error_text);
//%d: %s\n%s\n", tmperr->error_in_line, //%d: %s\n%s\n", tmperr->error_in_line,
@ -221,8 +215,8 @@ void TeXErrors::printWarnings()
void TeXErrors::printStatus() void TeXErrors::printStatus()
{ {
lyxerr.print("Error struct:"); lyxerr.print("Error struct:");
lyxerr.print(LString(" status: ") + int(status)); lyxerr.print(string(" status: ") + tostr(status));
lyxerr.print(LString(" no err: ") + int(number_of_errors)); lyxerr.print(string(" no err: ") + tostr(number_of_errors));
if (status == LaTeX::NO_ERRORS) lyxerr.print("NO_ERRORS"); if (status == LaTeX::NO_ERRORS) lyxerr.print("NO_ERRORS");
if (status & LaTeX::NO_LOGFILE) lyxerr.print("NO_LOGFILE"); if (status & LaTeX::NO_LOGFILE) lyxerr.print("NO_LOGFILE");
if (status & LaTeX::NO_OUTPUT) lyxerr.print("NO_OUTPUT"); if (status & LaTeX::NO_OUTPUT) lyxerr.print("NO_OUTPUT");
@ -238,7 +232,7 @@ void TeXErrors::printStatus()
* CLASS LaTeX * CLASS LaTeX
*/ */
LaTeX::LaTeX(LString const & latex, LString const & f, LString const & p) LaTeX::LaTeX(string const & latex, string const & f, string const & p)
: cmd(latex), file(f), path(p) : cmd(latex), file(f), path(p)
{ {
tex_files = NO_FILES; tex_files = NO_FILES;
@ -293,9 +287,9 @@ int LaTeX::run(TeXErrors &terr, MiniBuffer *minib)
if (head.sumchange()) { if (head.sumchange()) {
lyxerr.debug("Dependency file has changed", lyxerr.debug("Dependency file has changed",
Error::LATEX); Error::LATEX);
lyxerr.debug(LString(_("Run #")) + int(++count), lyxerr.debug(string(_("Run #")) + tostr(++count),
Error::LATEX); Error::LATEX);
minib->Set(LString(_("LaTeX run number ")) + int(count)); minib->Set(string(_("LaTeX run number ")) + tostr(count));
minib->Store(); minib->Store();
this->operator()(); this->operator()();
scanres = scanLogFile(terr); scanres = scanLogFile(terr);
@ -307,10 +301,10 @@ int LaTeX::run(TeXErrors &terr, MiniBuffer *minib)
} else { } else {
lyxerr.debug("Dependency file does not exist", lyxerr.debug("Dependency file does not exist",
Error::LATEX); Error::LATEX);
lyxerr.debug(LString(_("Run #")) + int(++count), lyxerr.debug(string(_("Run #")) + tostr(++count),
Error::LATEX); Error::LATEX);
head.insert(file, true); head.insert(file, true);
minib->Set(LString(_("LaTeX run number ")) + int(count)); minib->Set(string(_("LaTeX run number ")) + tostr(count));
minib->Store(); minib->Store();
this->operator()(); this->operator()();
scanres = scanLogFile(terr); scanres = scanLogFile(terr);
@ -364,9 +358,9 @@ int LaTeX::run(TeXErrors &terr, MiniBuffer *minib)
rerun = false; rerun = false;
lyxerr.debug("Dep. file has changed or rerun requested", lyxerr.debug("Dep. file has changed or rerun requested",
Error::LATEX); Error::LATEX);
lyxerr.debug(LString("Run #") + int(++count), lyxerr.debug(string("Run #") + tostr(++count),
Error::LATEX); Error::LATEX);
minib->Set(LString(_("LaTeX run number ")) + int(count)); minib->Set(string(_("LaTeX run number ")) + tostr(count));
minib->Store(); minib->Store();
this->operator()(); this->operator()();
scanres = scanLogFile(terr); scanres = scanLogFile(terr);
@ -409,8 +403,8 @@ int LaTeX::run(TeXErrors &terr, MiniBuffer *minib)
// Yes rerun until message goes away, or until // Yes rerun until message goes away, or until
// MAX_RUNS are reached. // MAX_RUNS are reached.
rerun = false; rerun = false;
lyxerr.debug(LString(_("Run #")) + int(++count), Error::LATEX); lyxerr.debug(string(_("Run #")) + tostr(++count), Error::LATEX);
minib->Set(LString(_("LaTeX run number ")) + int(count)); minib->Set(string(_("LaTeX run number ")) + tostr(count));
minib->Store(); minib->Store();
this->operator()(); this->operator()();
scanres = scanLogFile(terr); scanres = scanLogFile(terr);
@ -429,16 +423,16 @@ int LaTeX::run(TeXErrors &terr, MiniBuffer *minib)
int LaTeX::operator()() int LaTeX::operator()()
{ {
#ifndef __EMX__ #ifndef __EMX__
LString tmp = cmd + ' ' + file + " > /dev/null"; string tmp = cmd + ' ' + file + " > /dev/null";
#else // cmd.exe (OS/2) causes SYS0003 error at "/dev/null" #else // cmd.exe (OS/2) causes SYS0003 error at "/dev/null"
LString tmp = cmd + ' ' + file + " > nul"; string tmp = cmd + ' ' + file + " > nul";
#endif #endif
Systemcalls one; Systemcalls one;
return one.Startscript(Systemcalls::System, tmp); return one.Startscript(Systemcalls::System, tmp);
} }
bool LaTeX::runMakeIndex(LString const &file) bool LaTeX::runMakeIndex(string const &file)
{ {
lyxerr.debug("idx file has been made," lyxerr.debug("idx file has been made,"
" running makeindex on file " " running makeindex on file "
@ -448,7 +442,7 @@ bool LaTeX::runMakeIndex(LString const &file)
// sorting style and such. It would also be very convenient // sorting style and such. It would also be very convenient
// to be able to make style files from within LyX. This has // to be able to make style files from within LyX. This has
// to come for a later time. (0.13 perhaps?) // to come for a later time. (0.13 perhaps?)
LString tmp = "makeindex -c -q "; string tmp = "makeindex -c -q ";
tmp += file; tmp += file;
Systemcalls one; Systemcalls one;
one.Startscript(Systemcalls::System, tmp); one.Startscript(Systemcalls::System, tmp);
@ -456,10 +450,10 @@ bool LaTeX::runMakeIndex(LString const &file)
} }
bool LaTeX::runBibTeX(LString const &file) bool LaTeX::runBibTeX(string const &file)
{ {
LyXLex lex(NULL, 0); LyXLex lex(0, 0);
LString token; string token;
if (!lex.setFile(file)) { if (!lex.setFile(file)) {
// unable to open .aux file // unable to open .aux file
// return at once // return at once
@ -472,10 +466,10 @@ bool LaTeX::runBibTeX(LString const &file)
else // blank line in the file being read else // blank line in the file being read
continue; continue;
if (token.contains("\\bibdata{")) { if (contains(token, "\\bibdata{")) {
// run bibtex and // run bibtex and
LString tmp="bibtex "; string tmp="bibtex ";
tmp += ChangeExtension(file, LString(), true); tmp += ChangeExtension(file, string(), true);
Systemcalls one; Systemcalls one;
one.Startscript(Systemcalls::System, tmp); one.Startscript(Systemcalls::System, tmp);
return true; return true;
@ -489,12 +483,12 @@ bool LaTeX::runBibTeX(LString const &file)
int LaTeX::scanLogFile(TeXErrors &terr) int LaTeX::scanLogFile(TeXErrors &terr)
{ {
LString token; string token;
int retval = NO_ERRORS; int retval = NO_ERRORS;
LyXLex lex(NULL, 0); LyXLex lex(0, 0);
LString tmp = ChangeExtension(file, ".log", true); string tmp = ChangeExtension(file, ".log", true);
if (!lex.setFile(tmp)) { if (!lex.setFile(tmp)) {
// unable to open file // unable to open file
@ -511,34 +505,34 @@ int LaTeX::scanLogFile(TeXErrors &terr)
lyxerr.debug(token, Error::LATEX); lyxerr.debug(token, Error::LATEX);
if (token.prefixIs("LaTeX Warning:")) { if (prefixIs(token, "LaTeX Warning:")) {
// Here shall we handle different // Here shall we handle different
// types of warnings // types of warnings
retval |= LATEX_WARNING; retval |= LATEX_WARNING;
lyxerr.debug("LaTeX Warning.", Error::LATEX); lyxerr.debug("LaTeX Warning.", Error::LATEX);
if (token.contains("Rerun to get cross-references")) { if (contains(token, "Rerun to get cross-references")) {
retval |= RERUN; retval |= RERUN;
lyxerr.debug("We should rerun.", Error::LATEX); lyxerr.debug("We should rerun.", Error::LATEX);
} else if (token.contains("Citation") } else if (contains(token, "Citation")
&& token.contains("on page") && contains(token, "on page")
&& token.contains("undefined")) { && contains(token, "undefined")) {
retval |= UNDEF_CIT; retval |= UNDEF_CIT;
} }
} else if (token.prefixIs("Package")) { } else if (prefixIs(token, "Package")) {
// Package warnings // Package warnings
retval |= PACKAGE_WARNING; retval |= PACKAGE_WARNING;
if (token.contains("natbib Warning:")) { if (contains(token, "natbib Warning:")) {
// Natbib warnings // Natbib warnings
if (token.contains("Citation") if (contains(token, "Citation")
&& token.contains("on page") && contains(token, "on page")
&& token.contains("undefined")) { && contains(token, "undefined")) {
retval |= UNDEF_CIT; retval |= UNDEF_CIT;
} }
} else if (token.contains("Rerun LaTeX.")) { } else if (contains(token, "Rerun LaTeX.")) {
// at least longtable.sty might use this. // at least longtable.sty might use this.
retval |= RERUN; retval |= RERUN;
} }
} else if (token.prefixIs("! LaTeX Error:")) { } else if (prefixIs(token, "! LaTeX Error:")) {
// Here shall we handle different // Here shall we handle different
// types of errors // types of errors
retval |= LATEX_ERROR; retval |= LATEX_ERROR;
@ -546,15 +540,15 @@ int LaTeX::scanLogFile(TeXErrors &terr)
// this is not correct yet // this is not correct yet
terr.scanError(lex); terr.scanError(lex);
num_errors++; num_errors++;
} else if (token.prefixIs("! ")) { } else if (prefixIs(token, "! ")) {
// Ok, we have something that looks like a TeX Error // Ok, we have something that looks like a TeX Error
// but what do we really have. // but what do we really have.
// Just get the error description: // Just get the error description:
LString desc(token); string desc(token);
desc.substring(2, desc.length() - 1); desc.erase(0, 2);
if (desc.contains("Undefined control sequence")) { if (contains(desc, "Undefined control sequence")) {
retval |= TEX_ERROR; retval |= TEX_ERROR;
lyxerr.debug("TeX Error.", Error::LATEX); lyxerr.debug("TeX Error.", Error::LATEX);
terr.scanError(lex); terr.scanError(lex);
@ -562,8 +556,8 @@ int LaTeX::scanLogFile(TeXErrors &terr)
} else { } else {
// get the next line // get the next line
lex.next(); lex.next();
LString tmp = lex.GetString(); string tmp = lex.GetString();
if (tmp.prefixIs("l.")) { if (prefixIs(tmp, "l.")) {
// we have a latex error // we have a latex error
retval |= TEX_ERROR; retval |= TEX_ERROR;
lyxerr.debug("TeX Error.", Error::LATEX); lyxerr.debug("TeX Error.", Error::LATEX);
@ -571,12 +565,12 @@ int LaTeX::scanLogFile(TeXErrors &terr)
int line = 0; int line = 0;
sscanf(tmp.c_str(), "l.%d", &line); sscanf(tmp.c_str(), "l.%d", &line);
// get the rest of the message: // get the rest of the message:
LString errstr; string errstr;
lex.EatLine(); lex.EatLine();
tmp = lex.GetString(); tmp = lex.GetString();
while ((tmp != "\n" || !errstr.contains("l.")) while ((tmp != "\n" || !contains(errstr, "l."))
&& !tmp.prefixIs("! ") && !prefixIs(tmp, "! ")
&& !tmp.contains("(job aborted") && !contains(tmp, "(job aborted")
&& !tmp.empty()) { && !tmp.empty()) {
errstr += tmp; errstr += tmp;
errstr += "\n"; errstr += "\n";
@ -590,17 +584,17 @@ int LaTeX::scanLogFile(TeXErrors &terr)
} else { } else {
// information messages, TeX warnings and other // information messages, TeX warnings and other
// warnings we have not caught earlier. // warnings we have not caught earlier.
if (token.prefixIs("Overfull ")) { if (prefixIs(token, "Overfull ")) {
retval |= TEX_WARNING; retval |= TEX_WARNING;
} else if (token.prefixIs("Underfull ")) { } else if (prefixIs(token, "Underfull ")) {
retval |= TEX_WARNING; retval |= TEX_WARNING;
} else if (token.contains("Rerun to get citations")) { } else if (contains(token, "Rerun to get citations")) {
// Natbib seems to use this. // Natbib seems to use this.
retval |= RERUN; retval |= RERUN;
} else if (token.contains("No pages of output")) { } else if (contains(token, "No pages of output")) {
// A dvi file was not created // A dvi file was not created
retval |= NO_OUTPUT; retval |= NO_OUTPUT;
} else if (token.contains("That makes 100 errors")) { } else if (contains(token, "That makes 100 errors")) {
// More than 100 errors were reprted // More than 100 errors were reprted
retval |= TOO_MANY_ERRORS; retval |= TOO_MANY_ERRORS;
} }
@ -616,7 +610,7 @@ void LaTeX::deplog(DepTable & head)
// files used by the LaTeX run. The files are then entered into the // files used by the LaTeX run. The files are then entered into the
// dependency file. // dependency file.
LString logfile = ChangeExtension(file, ".log", true); string logfile = ChangeExtension(file, ".log", true);
FilePtr in(logfile, FilePtr::read); FilePtr in(logfile, FilePtr::read);
bool not_eof = true; bool not_eof = true;
if (in()) while (not_eof) { // We were able to open the file if (in()) while (not_eof) { // We were able to open the file
@ -634,7 +628,7 @@ void LaTeX::deplog(DepTable & head)
// We now have c == '(', we now read the the sequence of // We now have c == '(', we now read the the sequence of
// chars until reaching EOL, or ' ' and put that into a string. // chars until reaching EOL, or ' ' and put that into a string.
LString foundfile; string foundfile;
c = fgetc(in()); c = fgetc(in());
while (c != '\n' && c != ' ' && c != ')') { while (c != '\n' && c != ' ' && c != ')') {
foundfile += char(c); foundfile += char(c);
@ -667,12 +661,12 @@ void LaTeX::deplog(DepTable & head)
// (2) foundfile is in the tmpdir // (2) foundfile is in the tmpdir
// insert it into head // insert it into head
if (FileInfo(OnlyFilename(foundfile)).exist()) { if (FileInfo(OnlyFilename(foundfile)).exist()) {
if (foundfile.suffixIs(".aux")) { if (suffixIs(foundfile, ".aux")) {
lyxerr.debug("We don't want " lyxerr.debug("We don't want "
+ OnlyFilename(foundfile) + OnlyFilename(foundfile)
+ " in the dep file", + " in the dep file",
Error::LATEX); Error::LATEX);
} else if (foundfile.suffixIs(".tex")) { } else if (suffixIs(foundfile, ".tex")) {
// This is a tex file generated by LyX // This is a tex file generated by LyX
// and latex is not likely to change this // and latex is not likely to change this
// during its runs. // during its runs.
@ -718,7 +712,7 @@ void LaTeX::deplog(DepTable & head)
void LaTeX::deptex(DepTable &head) void LaTeX::deptex(DepTable &head)
{ {
int except = AUX|LOG|DVI|BBL|IND|GLO; int except = AUX|LOG|DVI|BBL|IND|GLO;
LString tmp; string tmp;
FileInfo fi; FileInfo fi;
for (int i = 0; i < file_count; i++) { for (int i = 0; i < file_count; i++) {
if (!(all_files[i].file & except)) { if (!(all_files[i].file & except)) {

View File

@ -30,8 +30,8 @@ class TeXErrors {
public: public:
/// ///
TeXErrors() { TeXErrors() {
errors = NULL; errors = 0;
next_error = NULL; next_error = 0;
status = 0; status = 0;
number_of_errors = 0; number_of_errors = 0;
} }
@ -40,12 +40,12 @@ public:
/// ///
void scanError(LyXLex &); void scanError(LyXLex &);
/// ///
bool getFirstError(int *line, LString *text); bool getFirstError(int *line, string *text);
/// ///
bool getNextError(int *line, LString *text); bool getNextError(int *line, string *text);
/// ///
void insertError(int line, LString const &error_desc, void insertError(int line, string const &error_desc,
LString const &error_text); string const &error_text);
/// ///
void printErrors(); void printErrors();
/// ///
@ -65,12 +65,12 @@ private:
struct Error { struct Error {
/// ///
Error () { Error () {
next_error = NULL; next_error = 0;
error_in_line = 0; error_in_line = 0;
} }
/// ///
Error(int line, LString const &desc, LString const &text) { Error(int line, string const &desc, string const &text) {
next_error = NULL; next_error = 0;
error_in_line = line; error_in_line = line;
error_desc = desc; error_desc = desc;
error_text = text; error_text = text;
@ -83,9 +83,9 @@ private:
/// what line in the TeX file the error occured in /// what line in the TeX file the error occured in
int error_in_line; int error_in_line;
/// The kind of error /// The kind of error
LString error_desc; string error_desc;
/// The line/cmd that caused the error. /// The line/cmd that caused the error.
LString error_text; string error_text;
}; };
/// ///
Error *errors; Error *errors;
@ -178,7 +178,7 @@ public:
cmd = the latex command, file = name of the (temporary) latex file, cmd = the latex command, file = name of the (temporary) latex file,
path = name of the files original path. path = name of the files original path.
*/ */
LaTeX(LString const & cmd, LString const & file, LString const & path); LaTeX(string const & cmd, string const & file, string const & path);
/// runs LaTeX several times /// runs LaTeX several times
int run(TeXErrors &, MiniBuffer *); int run(TeXErrors &, MiniBuffer *);
@ -195,7 +195,7 @@ protected:
the depency file is on the format: the depency file is on the format:
<file> <new checksum> <old checksum> <file> <new checksum> <old checksum>
*/ */
LString depfile; string depfile;
/// ///
LaTeX() {} LaTeX() {}
@ -213,19 +213,19 @@ protected:
int scanLogFile(TeXErrors &); int scanLogFile(TeXErrors &);
/// ///
bool runMakeIndex(LString const &); bool runMakeIndex(string const &);
/// ///
bool runBibTeX(LString const &); bool runBibTeX(string const &);
/// ///
LString cmd; string cmd;
/// ///
LString file; string file;
/// ///
LString path; string path;
/// ///
TEX_FILES tex_files; TEX_FILES tex_files;

View File

@ -1,13 +1,13 @@
// -*- C++ -*- // -*- C++ -*-
/* This file is part of /* This file is part of
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 the LyX Team. * Copyright 1995-1999 the LyX Team.
* *
*======================================================*/ * ======================================================*/
#include <config.h> #include <config.h>
@ -23,7 +23,7 @@
#include "bufferparams.h" #include "bufferparams.h"
#include "layout.h" #include "layout.h"
extern LyXRC* lyxrc; extern LyXRC * lyxrc;
LaTeXFeatures::LaTeXFeatures(int n) LaTeXFeatures::LaTeXFeatures(int n)
{ {
@ -74,9 +74,9 @@ LaTeXFeatures::LaTeXFeatures(int n)
} }
LString LaTeXFeatures::getPackages(BufferParams const &params) string LaTeXFeatures::getPackages(BufferParams const &params)
{ {
LString packages; string packages;
LyXTextClass *tclass = lyxstyle.TextClass(params.textclass); LyXTextClass *tclass = lyxstyle.TextClass(params.textclass);
// color.sty // color.sty
@ -133,7 +133,7 @@ LString LaTeXFeatures::getPackages(BufferParams const &params)
case Spacing::Other: case Spacing::Other:
char value[30]; char value[30];
sprintf(value, "%.2f", params.spacing.getValue()); sprintf(value, "%.2f", params.spacing.getValue());
packages += LString("\\setstretch{") packages += string("\\setstretch{")
+ value + "}\n"; + value + "}\n";
break; break;
} }
@ -175,9 +175,9 @@ LString LaTeXFeatures::getPackages(BufferParams const &params)
} }
LString LaTeXFeatures::getMacros(BufferParams const & /* params */) string LaTeXFeatures::getMacros(BufferParams const & /* params */)
{ {
LString macros; string macros;
// always include this // always include this
if (true || lyx) if (true || lyx)
@ -226,11 +226,11 @@ LString LaTeXFeatures::getMacros(BufferParams const & /* params */)
} }
LString LaTeXFeatures::getTClassPreamble(BufferParams const &params) string LaTeXFeatures::getTClassPreamble(BufferParams const &params)
{ {
// the text class specific preamble // the text class specific preamble
LyXTextClass *tclass = lyxstyle.TextClass(params.textclass); LyXTextClass *tclass = lyxstyle.TextClass(params.textclass);
LString tcpreamble = tclass->preamble; string tcpreamble = tclass->preamble;
int l; int l;
for (l = 0 ; l < tclass->number_of_defined_layouts ; l++) { for (l = 0 ; l < tclass->number_of_defined_layouts ; l++) {

View File

@ -5,22 +5,24 @@
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 the LyX Team. * Copyright (C) 1995-1999 the LyX Team.
* *
*======================================================*/ *======================================================*/
#ifndef _LATEXFEATURES_H #ifndef LATEXFEATURES_H
#define _LATEXFEATURES_H #define LATEXFEATURES_H
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
#endif #endif
class LString; #include "LString.h"
class BufferParams; class BufferParams;
class LyXTextClass; class LyXTextClass;
/** The packages and commands that a buffer needs. This struct /** The packages and commands that a buffer needs. This struct
contains an entry for each of the latex packages and contains an entry for each of the latex packages and
commands that a buffer might need. This struct is supposed to be commands that a buffer might need. This struct is supposed to be
@ -34,11 +36,11 @@ struct LaTeXFeatures {
delete[] layout; delete[] layout;
} }
/// The packaes needed by the document /// The packaes needed by the document
LString getPackages(BufferParams const &params); string getPackages(BufferParams const &params);
/// The macros definitions needed by the document /// The macros definitions needed by the document
LString getMacros(BufferParams const &params); string getMacros(BufferParams const &params);
/// The definitions needed by the document's textclass /// The definitions needed by the document's textclass
LString getTClassPreamble(BufferParams const &params); string getTClassPreamble(BufferParams const &params);
/// ///
void showStruct(BufferParams &params); void showStruct(BufferParams &params);

View File

@ -1,31 +1,24 @@
#include <config.h> #include <config.h>
#include <stdlib.h> #include <cstdlib>
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
#include "buffer.h" #include "buffer.h"
#include "latexoptions.h" #include "latexoptions.h"
#include "lyx_main.h" #include "lyx_main.h"
#include "LString.h" #include "LString.h"
#include "FileInfo.h" #include "support/FileInfo.h"
#include "filetools.h" #include "support/filetools.h"
#include "pathstack.h" #include "pathstack.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "BufferView.h" #include "BufferView.h"
#include "gettext.h" #include "gettext.h"
// $Id: LaTeXLog.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: LaTeXLog.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $";
#endif /* lint */
/* Prototypes */
extern FD_LaTeXLog *fd_latex_log; extern FD_LaTeXLog *fd_latex_log;
extern BufferView *current_view; extern BufferView *current_view;
void ShowLatexLog() void ShowLatexLog()
{ {
LString filename, fname, bname, path; string filename, fname, bname, path;
bool use_build = false; bool use_build = false;
filename = current_view->currentBuffer()->getFileName(); filename = current_view->currentBuffer()->getFileName();

View File

@ -2,50 +2,41 @@
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
* This file is Copyright (C) 1996-1998 * ======================================================
* Lars Gullik Bjønnes
*
*======================================================
*/ */
#include <config.h> #include <config.h>
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
#include "filetools.h" #include "support/filetools.h"
#include "LaTeX.h" #include "LaTeX.h"
#include "Literate.h" #include "Literate.h"
#include "lyxlex.h" #include "lyxlex.h"
#include "FileInfo.h" #include "support/FileInfo.h"
#include "error.h" #include "error.h"
#include "lyxlib.h" #include "support/lyxlib.h"
#include "syscall.h" #include "support/syscall.h"
#include "syscontr.h" #include "support/syscontr.h"
#include "pathstack.h" #include "pathstack.h"
#include "bufferlist.h" #include "bufferlist.h"
#include "minibuffer.h" #include "minibuffer.h"
#include "gettext.h" #include "gettext.h"
// $Id: Literate.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: Literate.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $";
#endif /* lint */
extern BufferList bufferlist; extern BufferList bufferlist;
Literate::Literate(LString const & latex, LString const & f, LString const & p, Literate::Literate(string const & latex, string const & f, string const & p,
LString const & l, string const & l,
LString const & literate, LString const & literate_f, string const & literate, string const & literate_f,
LString const & build, LString const & build_f) string const & build, string const & build_f)
: LaTeX (latex, f, p), : LaTeX (latex, f, p),
litfile(l), litfile(l),
literate_cmd(literate), literate_filter(literate_f), literate_cmd(literate), literate_filter(literate_f),
@ -57,16 +48,16 @@ Literate::Literate(LString const & latex, LString const & f, LString const & p,
int Literate::weave(TeXErrors &terr, MiniBuffer *minib) int Literate::weave(TeXErrors &terr, MiniBuffer *minib)
{ {
int scanres = Literate::NO_ERRORS; int scanres = Literate::NO_ERRORS;
LString tmp1, tmp2; string tmp1, tmp2;
int ret1, ret2; int ret1, ret2;
Systemcalls one, two; Systemcalls one, two;
// The class LaTeX does not know the temp path. // The class LaTeX does not know the temp path.
bufferlist.updateIncludedTeXfiles(GetCWD()); bufferlist.updateIncludedTeXfiles(GetCWD());
lyxerr.debug(LString(_("Weaving document")), lyxerr.debug(string(_("Weaving document")),
Error::LATEX); Error::LATEX);
minib->Set(LString(_("Weaving document"))); minib->Set(string(_("Weaving document")));
minib->Store(); minib->Store();
// Run the literate program to convert \literate_extension file to .tex file // Run the literate program to convert \literate_extension file to .tex file
@ -75,7 +66,7 @@ int Literate::weave(TeXErrors &terr, MiniBuffer *minib)
tmp2 = literate_filter + " < " + litfile + ".out" + " > " + litfile + ".log"; tmp2 = literate_filter + " < " + litfile + ".out" + " > " + litfile + ".log";
ret1 = one.Startscript(Systemcalls::System, tmp1); ret1 = one.Startscript(Systemcalls::System, tmp1);
ret2 = two.Startscript(Systemcalls::System, tmp2); ret2 = two.Startscript(Systemcalls::System, tmp2);
lyxerr.debug(LString(_("LITERATE")) + " {" + tmp1 + "} {" + tmp2 + "}"); lyxerr.debug(string(_("LITERATE")) + " {" + tmp1 + "} {" + tmp2 + "}");
scanres = scanLiterateLogFile(terr); scanres = scanLiterateLogFile(terr);
if (scanres & Literate::ERRORS) return scanres; // return on literate error if (scanres & Literate::ERRORS) return scanres; // return on literate error
@ -91,16 +82,16 @@ int Literate::build(TeXErrors &terr, MiniBuffer *minib)
num_errors = 0; // just to make sure. num_errors = 0; // just to make sure.
// DepTable head; // empty head // unused // DepTable head; // empty head // unused
// bool rerun = false; // rerun requested // unused // bool rerun = false; // rerun requested // unused
LString tmp1, tmp2; string tmp1, tmp2;
int ret1, ret2; int ret1, ret2;
Systemcalls one, two; Systemcalls one, two;
// The class LaTeX does not know the temp path. // The class LaTeX does not know the temp path.
bufferlist.updateIncludedTeXfiles(GetCWD()); bufferlist.updateIncludedTeXfiles(GetCWD());
lyxerr.debug(LString(_("Building program")), lyxerr.debug(string(_("Building program")),
Error::LATEX); Error::LATEX);
minib->Set(LString(_("Building program"))); minib->Set(string(_("Building program")));
minib->Store(); minib->Store();
// Run the build program // Run the build program
@ -118,12 +109,12 @@ int Literate::build(TeXErrors &terr, MiniBuffer *minib)
int Literate::scanLiterateLogFile(TeXErrors &terr) int Literate::scanLiterateLogFile(TeXErrors &terr)
{ {
LString token; string token;
int retval = NO_ERRORS; int retval = NO_ERRORS;
LyXLex lex(NULL, 0); LyXLex lex(0, 0);
LString tmp = litfile + ".log"; string tmp = litfile + ".log";
if (!lex.setFile(tmp)) { if (!lex.setFile(tmp)) {
// unable to open file // unable to open file
@ -140,12 +131,12 @@ int Literate::scanLiterateLogFile(TeXErrors &terr)
lyxerr.debug(token, Error::LATEX); lyxerr.debug(token, Error::LATEX);
if (token.prefixIs("Build Warning:")) { if (prefixIs(token, "Build Warning:")) {
// Here shall we handle different // Here shall we handle different
// types of warnings // types of warnings
retval |= LATEX_WARNING; retval |= LATEX_WARNING;
lyxerr.debug("Build Warning.", Error::LATEX); lyxerr.debug("Build Warning.", Error::LATEX);
} else if (token.prefixIs("! Build Error:")) { } else if (prefixIs(token, "! Build Error:")) {
// Here shall we handle different // Here shall we handle different
// types of errors // types of errors
retval |= LATEX_ERROR; retval |= LATEX_ERROR;
@ -161,12 +152,12 @@ int Literate::scanLiterateLogFile(TeXErrors &terr)
int Literate::scanBuildLogFile(TeXErrors &terr) int Literate::scanBuildLogFile(TeXErrors &terr)
{ {
LString token; string token;
int retval = NO_ERRORS; int retval = NO_ERRORS;
LyXLex lex(NULL, 0); LyXLex lex(0, 0);
LString tmp = litfile + ".log"; string tmp = litfile + ".log";
if (!lex.setFile(tmp)) { if (!lex.setFile(tmp)) {
// unable to open file // unable to open file
@ -183,12 +174,12 @@ int Literate::scanBuildLogFile(TeXErrors &terr)
lyxerr.debug(token, Error::LATEX); lyxerr.debug(token, Error::LATEX);
if (token.prefixIs("Build Warning:")) { if (prefixIs(token, "Build Warning:")) {
// Here shall we handle different // Here shall we handle different
// types of warnings // types of warnings
retval |= LATEX_WARNING; retval |= LATEX_WARNING;
lyxerr.debug("Build Warning.", Error::LATEX); lyxerr.debug("Build Warning.", Error::LATEX);
} else if (token.prefixIs("! Build Error:")) { } else if (prefixIs(token, "! Build Error:")) {
// Here shall we handle different // Here shall we handle different
// types of errors // types of errors
retval |= LATEX_ERROR; retval |= LATEX_ERROR;

View File

@ -24,10 +24,10 @@
/// ///
class Literate: public LaTeX { class Literate: public LaTeX {
public: public:
Literate(LString const & cmd, LString const & file, LString const & path, Literate(string const & cmd, string const & file, string const & path,
LString const & litfile, string const & litfile,
LString const & literate_cmd, LString const & literate_filter, string const & literate_cmd, string const & literate_filter,
LString const & build_cmd, LString const & build_filter); string const & build_cmd, string const & build_filter);
/// runs literate and latex /// runs literate and latex
int weave(TeXErrors &, MiniBuffer *); int weave(TeXErrors &, MiniBuffer *);
@ -43,19 +43,19 @@ public:
private: private:
/// ///
LString litfile; string litfile;
/// ///
LString literate_cmd; string literate_cmd;
/// ///
LString literate_filter; string literate_filter;
/// ///
LString build_cmd; string build_cmd;
/// ///
LString build_filter; string build_filter;
}; };
#endif #endif

View File

@ -10,10 +10,10 @@
#include <config.h> #include <config.h>
#include <stdlib.h> #include <cstdlib>
#include <stdio.h> #include <cstdio>
#include <ctype.h> #include <cctype>
#include <string.h> #include <cstring>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
@ -22,6 +22,7 @@
#include "LyXAction.h" #include "LyXAction.h"
#include "error.h" #include "error.h"
#include "gettext.h" #include "gettext.h"
#include "support/lstrings.h"
/* /*
NAMING RULES FOR USER-COMMANDS NAMING RULES FOR USER-COMMANDS
@ -451,9 +452,9 @@ int LyXAction::searchActionArg(kb_action action, char const *arg)
for (int i=0; i<psd_idx; i++) { for (int i=0; i<psd_idx; i++) {
if (action==tb->action && !strcmp(tb->name, arg)) { if (action==tb->action && !strcmp(tb->name, arg)) {
lyxerr.debug(LString("Pseudoaction already exist[") lyxerr.debug(string("Pseudoaction already exist[")
+ int(action) + '|' + tostr(action) + '|'
+ PTR_AS_INT(arg) + ']', + tostr(arg) + ']',
Error::KEY); Error::KEY);
return LFUN_LASTACTION+i; return LFUN_LASTACTION+i;
@ -525,9 +526,9 @@ int LyXAction::LookupFunc(char const *func)
} }
if (arg && action >= 0) { if (arg && action >= 0) {
action = getPseudoAction((kb_action)action, arg); action = getPseudoAction((kb_action)action, arg);
lyxerr.debug(LString("Pseudo action_arg[") lyxerr.debug(string("Pseudo action_arg[")
+ int(action) + '|' + tostr(action) + '|'
+ PTR_AS_INT(arg) + ']',Error::KEY); + tostr(arg) + ']',Error::KEY);
} }
return action; return action;
} }
@ -709,7 +710,7 @@ char const *LyXAction::helpText(kb_action action) const
if (helpTexts[action].action == action) { if (helpTexts[action].action == action) {
return helpTexts[action].name; return helpTexts[action].name;
} }
// + LString(' ') + int(is_ro) + LString(']')); // + string(' ') + int(is_ro) + string(']'));
no_desc: no_desc:
// In an ideal world, this never happens: // In an ideal world, this never happens:
return _("No description available!"); return _("No description available!");
@ -748,8 +749,8 @@ bool LyXAction::isFuncRO(kb_action action) const
} else } else
if (k<0) l = m+1; else r = m; if (k<0) l = m+1; else r = m;
} }
lyxerr.debug(LString("RO[") + int(action) lyxerr.debug(string("RO[") + tostr(action)
+ LString(" ") + int(is_ro) + LString("]")); + string(" ") + tostr(is_ro) + string("]"));
return is_ro; return is_ro;
} }

View File

@ -5,21 +5,14 @@
#include "lyx_main.h" #include "lyx_main.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "LString.h" #include "LString.h"
#include "filetools.h" #include "support/filetools.h"
#include "pathstack.h" #include "pathstack.h"
#include "buffer.h" #include "buffer.h"
#include "lyx_gui_misc.h" #include "lyx_gui_misc.h"
#include "syscall.h" #include "support/syscall.h"
#include "gettext.h" #include "gettext.h"
#include "lyx_cb.h" #include "lyx_cb.h"
// $Id: LyXSendto.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: LyXSendto.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $";
#endif /* lint */
/* Prototypes */
extern FD_form_sendto *fd_form_sendto; extern FD_form_sendto *fd_form_sendto;
extern BufferView *current_view; extern BufferView *current_view;
extern int MakeDVIOutput(Buffer *buffer); extern int MakeDVIOutput(Buffer *buffer);
@ -49,7 +42,7 @@ void SendtoApplyCB(FL_OBJECT *, long)
if (!current_view->available()) if (!current_view->available())
return; return;
LString command = fl_get_input(fd_form_sendto->input_cmd); string command = fl_get_input(fd_form_sendto->input_cmd);
if (command.empty()) if (command.empty())
return; return;
Buffer *buffer = current_view->currentBuffer(); Buffer *buffer = current_view->currentBuffer();
@ -63,7 +56,7 @@ void SendtoApplyCB(FL_OBJECT *, long)
} }
AllowInput(); AllowInput();
} }
LString ftypeext; string ftypeext;
if (fl_get_button(fd_form_sendto->radio_ftype_lyx)) if (fl_get_button(fd_form_sendto->radio_ftype_lyx))
ftypeext = ".lyx"; ftypeext = ".lyx";
else if (fl_get_button(fd_form_sendto->radio_ftype_latex)) else if (fl_get_button(fd_form_sendto->radio_ftype_latex))
@ -78,14 +71,14 @@ void SendtoApplyCB(FL_OBJECT *, long)
return; return;
} }
} }
LString fname = SpaceLess(ChangeExtension(buffer->getFileName(), string fname = SpaceLess(ChangeExtension(buffer->getFileName(),
ftypeext, true)); ftypeext, true));
if (!command.contains("$$FName")) if (!contains(command, "$$FName"))
command = "( " + command + " ) <$$FName"; command = "( " + command + " ) <$$FName";
command.subst("$$FName",fname); subst(command, "$$FName",fname);
command += " &"; // execute in background command += " &"; // execute in background
// push directorypath, if necessary // push directorypath, if necessary
LString path = OnlyPath(buffer->getFileName()); string path = OnlyPath(buffer->getFileName());
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)){ if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)){
path = buffer->tmppath; path = buffer->tmppath;
} }

View File

@ -1,13 +1,13 @@
// -*- C++ -*- // -*- C++ -*-
/* This file is part of /* This file is part of
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
*======================================================*/ * ======================================================*/
#include <config.h> #include <config.h>
@ -27,16 +27,10 @@
#include "intl.h" #include "intl.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "lyxscreen.h" #include "lyxscreen.h"
#include "filetools.h" // OnlyFilename() #include "support/filetools.h" // OnlyFilename()
#include "layout.h" #include "layout.h"
#include "lyxtext.h" #include "lyxtext.h"
// $Id: LyXView.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: LyXView.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $";
#endif /* lint */
extern FD_form_document *fd_form_document; extern FD_form_document *fd_form_document;
FD_form_main *fd_form_main; /* a pointer to the one in LyXView FD_form_main *fd_form_main; /* a pointer to the one in LyXView
should be removed as soon as possible */ should be removed as soon as possible */
@ -56,7 +50,7 @@ BufferView *current_view;
LyXView::LyXView(int width, int height) LyXView::LyXView(int width, int height)
{ {
fd_form_main = create_form_form_main(width,height); fd_form_main = create_form_form_main(width,height);
fl_set_form_atclose(_form, atCloseMainFormCB, NULL); fl_set_form_atclose(_form, atCloseMainFormCB, 0);
lyxerr.debug("Initializing LyXFunc"); lyxerr.debug("Initializing LyXFunc");
lyxfunc = new LyXFunc(this); lyxfunc = new LyXFunc(this);
intl = new Intl; intl = new Intl;
@ -342,11 +336,11 @@ int LyXView::KeyPressMask_raw_callback(FL_FORM *fl, void *xev)
// Updates the title of the window with the filename of the current document // Updates the title of the window with the filename of the current document
void LyXView::updateWindowTitle() { void LyXView::updateWindowTitle() {
static LString last_title="LyX"; static string last_title="LyX";
LString title = "LyX"; string title = "LyX";
if (currentView()->available()) { if (currentView()->available()) {
LString cur_title = currentBuffer()->getFileName(); string cur_title = currentBuffer()->getFileName();
if (!cur_title.empty()){ if (!cur_title.empty()){
title += ": " + OnlyFilename(cur_title); title += ": " + OnlyFilename(cur_title);
if (!currentBuffer()->isLyxClean()) if (!currentBuffer()->isLyxClean())

View File

@ -1,10 +1,11 @@
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
SUBDIRS = mathed insets SUBDIRS = mathed insets support
DISTCLEANFILES = libintl.h config.h DISTCLEANFILES = libintl.h config.h
MAINTAINERCLEANFILES = Makefile.in config.h.in MAINTAINERCLEANFILES = Makefile.in config.h.in
bin_PROGRAMS = lyx bin_PROGRAMS = lyx
lyx_LDADD = mathed/mathed.o insets/insets.o @INTLLIBS@ @LYX_LIBS@ lyx_LDADD = mathed/mathed.o insets/insets.o support/libsupport.a \
lyx_DEPENDENCIES = mathed insets @INTLLIBS@ @LYX_LIBS@
lyx_DEPENDENCIES = mathed insets support/libsupport.a
EXTRA_DIST = config.h.in stamp-h.in EXTRA_DIST = config.h.in stamp-h.in
ETAGS_ARGS = --c++ ETAGS_ARGS = --c++
INCLUDES = -I${top_srcdir}/images INCLUDES = -I${top_srcdir}/images
@ -18,8 +19,6 @@ lyx_SOURCES = \
Chktex.h \ Chktex.h \
DepTable.C \ DepTable.C \
DepTable.h \ DepTable.h \
FileInfo.C \
FileInfo.h \
FontInfo.C \ FontInfo.C \
FontInfo.h \ FontInfo.h \
FontLoader.C \ FontLoader.C \
@ -28,7 +27,6 @@ lyx_SOURCES = \
ImportLaTeX.h \ ImportLaTeX.h \
ImportNoweb.C \ ImportNoweb.C \
ImportNoweb.h \ ImportNoweb.h \
LString.C \
LString.h \ LString.h \
LaTeX.C \ LaTeX.C \
LaTeX.h \ LaTeX.h \
@ -45,7 +43,6 @@ lyx_SOURCES = \
Makefile.in \ Makefile.in \
PaperLayout.C \ PaperLayout.C \
ParagraphExtra.C \ ParagraphExtra.C \
Redraw \
Spacing.C \ Spacing.C \
Spacing.h \ Spacing.h \
TableLayout.C \ TableLayout.C \
@ -79,8 +76,6 @@ lyx_SOURCES = \
figure.h \ figure.h \
filedlg.C \ filedlg.C \
filedlg.h \ filedlg.h \
filetools.C \
filetools.h \
form1.C \ form1.C \
form1.h \ form1.h \
gettext.h \ gettext.h \
@ -125,7 +120,6 @@ lyx_SOURCES = \
lyxfunc.h \ lyxfunc.h \
lyxlex.C \ lyxlex.C \
lyxlex.h \ lyxlex.h \
lyxlib.h \
lyxlookup.C \ lyxlookup.C \
lyxlookup.h \ lyxlookup.h \
lyxparagraph.h \ lyxparagraph.h \
@ -135,7 +129,6 @@ lyx_SOURCES = \
lyxscreen.h \ lyxscreen.h \
lyxserver.C \ lyxserver.C \
lyxserver.h \ lyxserver.h \
lyxsum.C \
lyxtext.h \ lyxtext.h \
lyxvc.C \ lyxvc.C \
lyxvc.h \ lyxvc.h \
@ -157,11 +150,6 @@ lyx_SOURCES = \
sp_form.h \ sp_form.h \
spellchecker.C \ spellchecker.C \
spellchecker.h \ spellchecker.h \
syscall.C \
syscall.h \
syscontr.C \
syscontr.h \
syssingleton.C \
table.C \ table.C \
table.h \ table.h \
tex-accent.C \ tex-accent.C \
@ -174,7 +162,6 @@ lyx_SOURCES = \
texrow.h \ texrow.h \
text.C \ text.C \
text2.C \ text2.C \
textutils.h \
toolbar.C \ toolbar.C \
toolbar.h \ toolbar.h \
trans.C \ trans.C \
@ -192,6 +179,6 @@ lyx_main.o: lyx_main.C lyx_main.h config.h version.h error.h gettext.h
$(CXXCOMPILE) -DLYX_DIR=\"$(LYX_DIR)\" -DTOP_SRCDIR=\"$(top_srcdir)\" \ $(CXXCOMPILE) -DLYX_DIR=\"$(LYX_DIR)\" -DTOP_SRCDIR=\"$(top_srcdir)\" \
-DLYX_NAME=\"$(PACKAGE)\" -c $(top_srcdir)/src/lyx_main.C -DLYX_NAME=\"$(PACKAGE)\" -c $(top_srcdir)/src/lyx_main.C
main.o: main.C config.h lyx_main.h gettext.h LString.h filetools.h main.o: main.C config.h lyx_main.h gettext.h LString.h support/filetools.h
$(CXXCOMPILE) -DPACKAGE=\"$(PACKAGE)\" -DLOCALEDIR=\"$(localedir)\" \ $(CXXCOMPILE) -DPACKAGE=\"$(PACKAGE)\" -DLOCALEDIR=\"$(localedir)\" \
-c ${top_srcdir}/src/main.C -c ${top_srcdir}/src/main.C

View File

@ -1,6 +1,6 @@
#include <config.h> #include <config.h>
#include <stdlib.h> #include <cstdlib>
#include "definitions.h" #include "definitions.h"
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
@ -8,7 +8,7 @@
#include "lyx_main.h" #include "lyx_main.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "LString.h" #include "LString.h"
#include "filetools.h" #include "support/filetools.h"
#include "buffer.h" #include "buffer.h"
#include "minibuffer.h" #include "minibuffer.h"
#include "vspace.h" #include "vspace.h"
@ -16,13 +16,6 @@
#include "BufferView.h" #include "BufferView.h"
#include "gettext.h" #include "gettext.h"
// $Id: PaperLayout.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: PaperLayout.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $";
#endif /* lint */
/* Prototypes */
extern FD_form_paper *fd_form_paper; extern FD_form_paper *fd_form_paper;
extern MiniBuffer *minibuffer; extern MiniBuffer *minibuffer;
extern BufferView *current_view; extern BufferView *current_view;
@ -241,7 +234,7 @@ void PaperMarginsCB(FL_OBJECT *ob, long)
{ {
const FD_form_paper const FD_form_paper
*fd = fd_form_paper; *fd = fd_form_paper;
LString string
str; str;
char char
val; val;

View File

@ -1,6 +1,6 @@
#include <config.h> #include <config.h>
#include <stdlib.h> #include <cstdlib>
#include "definitions.h" #include "definitions.h"
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
#include "layout_forms.h" #include "layout_forms.h"
@ -13,13 +13,6 @@
#include "gettext.h" #include "gettext.h"
#include "lyxtext.h" #include "lyxtext.h"
// $Id: ParagraphExtra.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: ParagraphExtra.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $";
#endif /* lint */
/* Prototypes */
extern FD_form_paragraph_extra *fd_form_paragraph_extra; extern FD_form_paragraph_extra *fd_form_paragraph_extra;
extern MiniBuffer *minibuffer; extern MiniBuffer *minibuffer;
extern BufferView *current_view; extern BufferView *current_view;
@ -226,7 +219,7 @@ void CheckPExtraOptCB(FL_OBJECT *ob, long)
{ {
int int
n; n;
LString string
s1, s2; s1, s2;
ActivateParagraphExtraButtons(); ActivateParagraphExtraButtons();
@ -288,7 +281,7 @@ void CheckPExtraOptCB(FL_OBJECT *ob, long)
static bool CheckInputWidth() static bool CheckInputWidth()
{ {
LString string
s1,s2; s1,s2;
s1 = fl_get_input(fd_form_paragraph_extra->input_pextra_width); s1 = fl_get_input(fd_form_paragraph_extra->input_pextra_width);

View File

@ -1,13 +1,13 @@
#include <config.h> #include <config.h>
#include <stdlib.h> #include <cstdlib>
#include "definitions.h" #include "definitions.h"
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
#include "layout_forms.h" #include "layout_forms.h"
#include "lyx_main.h" #include "lyx_main.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "LString.h" #include "LString.h"
#include "filetools.h" #include "support/filetools.h"
#include "buffer.h" #include "buffer.h"
#include "vspace.h" #include "vspace.h"
#include "lyx_gui_misc.h" #include "lyx_gui_misc.h"
@ -16,12 +16,6 @@
#include "gettext.h" #include "gettext.h"
#include "lyxtext.h" #include "lyxtext.h"
// $Id: TableLayout.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: TableLayout.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $";
#endif /* lint */
extern void BeforeChange(); extern void BeforeChange();
/* Prototypes */ /* Prototypes */
@ -55,7 +49,7 @@ bool UpdateLayoutTable(int flag)
column,row; column,row;
char char
buf[12]; buf[12];
LString string
pwidth, special; pwidth, special;
LyXTable *table = current_view->currentBuffer()->text->cursor.par->table; LyXTable *table = current_view->currentBuffer()->text->cursor.par->table;
@ -259,7 +253,7 @@ void TableOptionsCB(FL_OBJECT *ob, long)
cell, cell,
s, s,
num = 0; num = 0;
LString string
special, special,
str; str;
@ -458,7 +452,7 @@ void SetPWidthCB(FL_OBJECT *ob, long)
fl_set_object_label(fd_form_table_options->text_warning,""); fl_set_object_label(fd_form_table_options->text_warning,"");
Confirmed = false; Confirmed = false;
if (ob == fd_form_table_options->input_column_width) { if (ob == fd_form_table_options->input_column_width) {
LString string
str; str;
str = fl_get_input(ob); str = fl_get_input(ob);
if (!str.empty() && !isValidLength(str)) { if (!str.empty() && !isValidLength(str)) {

View File

@ -6,7 +6,7 @@
* Description: A bitmap table uses a single bitmap to simulate a 2d array * Description: A bitmap table uses a single bitmap to simulate a 2d array
* of bitmap buttons. It can be used to build bitmap menus. * of bitmap buttons. It can be used to build bitmap menus.
* *
* Copyright (C) 1995,1996 Alejandro Aguilar Sierra * Copyright 1995,1996 Alejandro Aguilar Sierra
* *
* You are free to use and modify this code under the terms of * You are free to use and modify this code under the terms of
* the GNU General Public Licence version 2 or later. * the GNU General Public Licence version 2 or later.
@ -15,13 +15,7 @@
#include <config.h> #include <config.h>
// $Id: bmtable.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $ #include <cstdlib>
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: bmtable.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $";
#endif /* lint */
#include <stdlib.h>
#include "bmtable.h" #include "bmtable.h"
#include XPM_H_LOCATION #include XPM_H_LOCATION

File diff suppressed because it is too large Load Diff

View File

@ -45,7 +45,7 @@ struct DEPCLEAN {
/// ///
bool clean; bool clean;
/// ///
LString master; string master;
/// ///
DEPCLEAN *next; DEPCLEAN *next;
}; };
@ -60,7 +60,7 @@ public:
/**@name Constructors and destructor */ /**@name Constructors and destructor */
//@{ //@{
/// ///
Buffer(LString const & file, LyXRC * lyxrc = NULL, bool b= false); Buffer(string const & file, LyXRC * lyxrc = 0, bool b= false);
/// ///
~Buffer(); ~Buffer();
@ -131,17 +131,17 @@ public:
bool readLyXformat2(LyXLex &,LyXParagraph *par = 0); bool readLyXformat2(LyXLex &,LyXParagraph *par = 0);
/// Inserts a lyx file at cursor position. Returns false if it fails. /// Inserts a lyx file at cursor position. Returns false if it fails.
bool insertLyXFile(LString const & filename); bool insertLyXFile(string const & filename);
/// Write file. Returns false if unsuccesful. /// Write file. Returns false if unsuccesful.
bool writeFile(LString const &, bool); bool writeFile(string const &, bool);
/// ///
void writeFileAscii(LString const & , int); void writeFileAscii(string const & , int);
/// ///
void makeLaTeXFile(LString const & filename, void makeLaTeXFile(string const & filename,
LString const & original_path, string const & original_path,
bool nice, bool only_body = false); bool nice, bool only_body = false);
/// ///
@ -157,12 +157,12 @@ public:
int runChktex(); int runChktex();
/// ///
void makeLinuxDocFile(LString const & filename, int column); void makeLinuxDocFile(string const & filename, int column);
/// ///
void makeDocBookFile(LString const & filename, int column); void makeDocBookFile(string const & filename, int column);
/// returns the main language for the buffer (document) /// returns the main language for the buffer (document)
LString GetLanguage() const { string GetLanguage() const {
return params.language; return params.language;
} }
@ -179,7 +179,7 @@ public:
bool isBakClean() const { return bak_clean; } bool isBakClean() const { return bak_clean; }
/// ///
bool isDepClean(LString const & name) const; bool isDepClean(string const & name) const;
/// ///
void markLyxClean() { void markLyxClean() {
@ -202,7 +202,7 @@ public:
void markBakClean() { bak_clean = true; } void markBakClean() { bak_clean = true; }
/// ///
void markDepClean(LString const & name); void markDepClean(string const & name);
/// ///
void markDviDirty(); void markDviDirty();
@ -228,13 +228,13 @@ public:
} }
/// ///
LString getFileName() const { return filename; } string getFileName() const { return filename; }
/// Change name of buffer. Updates "read-only" flag. /// Change name of buffer. Updates "read-only" flag.
void setFileName(LString const & newfile); void setFileName(string const & newfile);
/// Name of the document's parent /// Name of the document's parent
void setParentName(LString const &); void setParentName(string const &);
/// Is buffer read-only? /// Is buffer read-only?
bool isReadonly() { return read_only; } bool isReadonly() { return read_only; }
@ -283,20 +283,20 @@ public:
/** Insert an inset into the buffer /** Insert an inset into the buffer
Insert inset into buffer, placing it in a layout of lout, Insert inset into buffer, placing it in a layout of lout,
if no_table make sure that it doesn't end up in a table. */ if no_table make sure that it doesn't end up in a table. */
void insertInset(Inset *, LString const &lout=LString(), void insertInset(Inset *, string const &lout=string(),
bool no_table = false); bool no_table = false);
/// ///
void setCursorFromRow (int); void setCursorFromRow (int);
/// ///
LString getIncludeonlyList(char delim=','); string getIncludeonlyList(char delim=',');
/// ///
LString getReferenceList(char delim='|'); string getReferenceList(char delim='|');
/// ///
LString getBibkeyList(char delim='|'); string getBibkeyList(char delim='|');
/// ///
bool gotoLabel(const LString&); bool gotoLabel(const string&);
/// removes all autodeletable insets /// removes all autodeletable insets
bool removeAutoInsets(); bool removeAutoInsets();
@ -332,10 +332,10 @@ public:
LyXVC lyxvc; LyXVC lyxvc;
/// where the temporaries go if we want them /// where the temporaries go if we want them
LString tmppath; string tmppath;
/// ///
LString filepath; string filepath;
/** While writing as LaTeX, tells whether we are /** While writing as LaTeX, tells whether we are
doing a 'nice' LaTeX file */ doing a 'nice' LaTeX file */
@ -364,21 +364,21 @@ private:
/// ///
void linuxDocHandleFootnote(FILE *file,LyXParagraph* &par, int const depth); void linuxDocHandleFootnote(FILE *file,LyXParagraph* &par, int const depth);
/// ///
void DocBookHandleCaption(FILE *file, LString &inner_tag, void DocBookHandleCaption(FILE *file, string &inner_tag,
int const depth, int desc_on, int const depth, int desc_on,
LyXParagraph* &par); LyXParagraph* &par);
/// ///
void DocBookHandleFootnote(FILE *file,LyXParagraph* &par, int const depth); void DocBookHandleFootnote(FILE *file,LyXParagraph* &par, int const depth);
/// ///
void sgmlOpenTag(FILE * file,int depth,LString & latexname); void sgmlOpenTag(FILE * file,int depth,string & latexname);
/// ///
void sgmlCloseTag(FILE * file,int depth,LString & latexname); void sgmlCloseTag(FILE * file,int depth,string & latexname);
/// ///
void LinuxDocError(LyXParagraph *par, int pos, char const *message); void LinuxDocError(LyXParagraph *par, int pos, char const *message);
/// ///
void SimpleLinuxDocOnePar(FILE *file, LyXParagraph *par, int desc_on, int const depth); void SimpleLinuxDocOnePar(FILE *file, LyXParagraph *par, int desc_on, int const depth);
/// ///
void SimpleDocBookOnePar(LString &file, LString &extra, LyXParagraph *par, int & desc_on, int const depth); void SimpleDocBookOnePar(string &file, string &extra, LyXParagraph *par, int & desc_on, int const depth);
/// LinuxDoc. /// LinuxDoc.
void push_tag(FILE *file, char const *tag, int& pos, char stack[5][3]); void push_tag(FILE *file, char const *tag, int& pos, char stack[5][3]);
@ -413,7 +413,7 @@ private:
bool read_only; bool read_only;
/// name of the file the buffer is associated with. /// name of the file the buffer is associated with.
LString filename; string filename;
/// Format number of buffer /// Format number of buffer
float format; float format;
@ -459,7 +459,7 @@ void Buffer::InsetWakeup()
inline inline
void Buffer::setParentName(LString const &name) void Buffer::setParentName(string const &name)
{ {
params.parentname = name; params.parentname = name;
} }

View File

@ -3,10 +3,10 @@
* *
* LyX, The Document Word Processor * LyX, The Document Word Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
* This file is Copyleft (C) 1996-1998 * This file is Copyright 1996-1999
* Lars Gullik Bjønnes * Lars Gullik Bjønnes
* *
*====================================================== *======================================================
@ -22,8 +22,8 @@
#include "bufferlist.h" #include "bufferlist.h"
#include "lyx_main.h" #include "lyx_main.h"
#include "minibuffer.h" #include "minibuffer.h"
#include "FileInfo.h" #include "support/FileInfo.h"
#include "filetools.h" #include "support/filetools.h"
#include "lyx_gui_misc.h" #include "lyx_gui_misc.h"
#include "lastfiles.h" #include "lastfiles.h"
#include "error.h" #include "error.h"
@ -33,17 +33,11 @@
#include "lyx_cb.h" #include "lyx_cb.h"
#include "gettext.h" #include "gettext.h"
// $Id: bufferlist.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: bufferlist.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $";
#endif /* lint */
extern BufferView *current_view; extern BufferView *current_view;
extern MiniBuffer *minibuffer; extern MiniBuffer *minibuffer;
extern void SmallUpdate(signed char); extern void SmallUpdate(signed char);
extern void BeforeChange(); extern void BeforeChange();
extern int RunLinuxDoc(int, LString const &); extern int RunLinuxDoc(int, string const &);
// //
// Class BufferStorage // Class BufferStorage
@ -78,7 +72,7 @@ void BufferStorage::release(Buffer* buf)
} }
Buffer* BufferStorage::newBuffer(LString const &s, Buffer* BufferStorage::newBuffer(string const &s,
LyXRC *lyxrc, LyXRC *lyxrc,
bool ronly) bool ronly)
{ {
@ -87,7 +81,7 @@ Buffer* BufferStorage::newBuffer(LString const &s,
&& buffer[i]) i++; && buffer[i]) i++;
buffer[i] = new Buffer(s, lyxrc, ronly); buffer[i] = new Buffer(s, lyxrc, ronly);
buffer[i]->params.useClassDefaults(); buffer[i]->params.useClassDefaults();
lyxerr.debug(LString("Assigning to buffer ") + i, Error::ANY); lyxerr.debug(string("Assigning to buffer ") + tostr(i), Error::ANY);
return buffer[i]; return buffer[i];
} }
@ -149,7 +143,7 @@ extern void MenuWrite(Buffer*);
bool BufferList::QwriteAll() bool BufferList::QwriteAll()
{ {
bool askMoreConfirmation = false; bool askMoreConfirmation = false;
LString unsaved; string unsaved;
BufferStorage_Iter biter(bstore); BufferStorage_Iter biter(bstore);
Buffer *b=0; Buffer *b=0;
while ((b=biter())) { while ((b=biter())) {
@ -192,7 +186,7 @@ bool BufferList::write(Buffer *buf, bool makeBackup)
// make a backup // make a backup
if (makeBackup) { if (makeBackup) {
LString s = buf->filename + '~'; string s = buf->filename + '~';
// Rename is the wrong way of making a backup, // Rename is the wrong way of making a backup,
// this is the correct way. // this is the correct way.
/* truss cp fil fil2: /* truss cp fil fil2:
@ -226,7 +220,7 @@ bool BufferList::write(Buffer *buf, bool makeBackup)
times->actime = finfo.getAccessTime(); times->actime = finfo.getAccessTime();
times->modtime = finfo.getModificationTime(); times->modtime = finfo.getModificationTime();
long blksize = finfo.getBlockSize(); long blksize = finfo.getBlockSize();
lyxerr.debug(LString("BlockSize: ") + int(blksize)); lyxerr.debug(string("BlockSize: ") + tostr(blksize));
FilePtr fin(buf->filename,FilePtr::read); FilePtr fin(buf->filename,FilePtr::read);
FilePtr fout(s,FilePtr::truncate); FilePtr fout(s,FilePtr::truncate);
if (fin() && fout()) { if (fin() && fout()) {
@ -261,7 +255,7 @@ bool BufferList::write(Buffer *buf, bool makeBackup)
MakeDisplayPath(buf->filename)); MakeDisplayPath(buf->filename));
// now delete the autosavefile // now delete the autosavefile
LString a = OnlyPath(buf->filename); string a = OnlyPath(buf->filename);
a += '#'; a += '#';
a += OnlyFilename(buf->filename); a += OnlyFilename(buf->filename);
a += '#'; a += '#';
@ -275,7 +269,7 @@ bool BufferList::write(Buffer *buf, bool makeBackup)
} else { } else {
// Saving failed, so backup is not backup // Saving failed, so backup is not backup
if (makeBackup) { if (makeBackup) {
LString s = buf->filename + '~'; string s = buf->filename + '~';
rename(s.c_str(), buf->filename.c_str()); rename(s.c_str(), buf->filename.c_str());
} }
minibuffer->Set(_("Save failed!")); minibuffer->Set(_("Save failed!"));
@ -347,7 +341,7 @@ void BufferList::makePup(int pup)
BufferStorage_Iter biter(bstore); BufferStorage_Iter biter(bstore);
Buffer *b=0; Buffer *b=0;
while ((b=biter())) { while ((b=biter())) {
LString relbuf = MakeDisplayPath(b->filename,30); string relbuf = MakeDisplayPath(b->filename,30);
fl_addtopup(pup, relbuf.c_str()); fl_addtopup(pup, relbuf.c_str());
ant++; ant++;
} }
@ -403,13 +397,13 @@ int BufferList::unlockInset(UpdatableInset *inset)
} }
void BufferList::updateIncludedTeXfiles(LString const & mastertmpdir) void BufferList::updateIncludedTeXfiles(string const & mastertmpdir)
{ {
BufferStorage_Iter biter(bstore); BufferStorage_Iter biter(bstore);
Buffer *b=0; Buffer *b=0;
while ((b=biter())) { while ((b=biter())) {
if (!b->isDepClean(mastertmpdir)) { if (!b->isDepClean(mastertmpdir)) {
LString writefile = mastertmpdir; string writefile = mastertmpdir;
writefile += '/'; writefile += '/';
writefile += ChangeExtension(b->getFileName(), ".tex", true); writefile += ChangeExtension(b->getFileName(), ".tex", true);
b->makeLaTeXFile(writefile,mastertmpdir,false,true); b->makeLaTeXFile(writefile,mastertmpdir,false,true);
@ -433,7 +427,7 @@ void BufferList::emergencyWriteAll()
+ _(" as...")); + _(" as..."));
for (int i=0; i<3 && !madeit; i++) { for (int i=0; i<3 && !madeit; i++) {
LString s; string s;
// We try to save three places: // We try to save three places:
// 1) Same place as document. // 1) Same place as document.
@ -442,7 +436,7 @@ void BufferList::emergencyWriteAll()
if (i==0) { if (i==0) {
s = b->filename; s = b->filename;
} else if (i==1) { } else if (i==1) {
s = AddName(getEnvPath("HOME"), s = AddName(GetEnvPath("HOME"),
b->filename); b->filename);
} else { // MakeAbsPath to prepend the current drive letter on OS/2 } else { // MakeAbsPath to prepend the current drive letter on OS/2
s = AddName(MakeAbsPath("/tmp/"), s = AddName(MakeAbsPath("/tmp/"),
@ -450,7 +444,7 @@ void BufferList::emergencyWriteAll()
} }
s += ".emergency"; s += ".emergency";
lyxerr.print(LString(" ") + (i+1) + ") " + s); lyxerr.print(string(" ") + tostr(i+1) + ") " + s);
if (b->writeFile(s,true)) { if (b->writeFile(s,true)) {
b->markLyxClean(); b->markLyxClean();
@ -467,13 +461,13 @@ void BufferList::emergencyWriteAll()
} }
Buffer* BufferList::readFile(LString const & s, bool ronly) Buffer* BufferList::readFile(string const & s, bool ronly)
{ {
Buffer *b = bstore.newBuffer(s, lyxrc, ronly); Buffer *b = bstore.newBuffer(s, lyxrc, ronly);
LString ts = s; string ts = s;
LString e = OnlyPath(s); string e = OnlyPath(s);
LString a = e; string a = e;
// File information about normal file // File information about normal file
FileInfo fileInfo2(s); FileInfo fileInfo2(s);
@ -525,7 +519,7 @@ Buffer* BufferList::readFile(LString const & s, bool ronly)
} }
} }
// not sure if this is the correct place to begin LyXLex // not sure if this is the correct place to begin LyXLex
LyXLex lex(NULL, 0); LyXLex lex(0, 0);
lex.setFile(ts); lex.setFile(ts);
if (b->readFile(lex)) if (b->readFile(lex))
return b; return b;
@ -536,7 +530,7 @@ Buffer* BufferList::readFile(LString const & s, bool ronly)
} }
bool BufferList::exists(LString const & s) bool BufferList::exists(string const & s)
{ {
BufferStorage_Iter biter(bstore); BufferStorage_Iter biter(bstore);
Buffer *b=0; Buffer *b=0;
@ -548,7 +542,7 @@ bool BufferList::exists(LString const & s)
} }
Buffer* BufferList::getBuffer(LString const &s) Buffer* BufferList::getBuffer(string const &s)
{ {
BufferStorage_Iter biter(bstore); BufferStorage_Iter biter(bstore);
Buffer *b=0; Buffer *b=0;
@ -560,7 +554,7 @@ Buffer* BufferList::getBuffer(LString const &s)
} }
Buffer* BufferList::newFile(LString const & name, LString tname) Buffer* BufferList::newFile(string const & name, string tname)
{ {
/* get a free buffer */ /* get a free buffer */
Buffer *b = bstore.newBuffer(name, lyxrc); Buffer *b = bstore.newBuffer(name, lyxrc);
@ -571,7 +565,7 @@ Buffer* BufferList::newFile(LString const & name, LString tname)
} }
if (!tname.empty() && IsLyXFilename(tname)){ if (!tname.empty() && IsLyXFilename(tname)){
bool templateok = false; bool templateok = false;
LyXLex lex(NULL,0); LyXLex lex(0,0);
lex.setFile(tname); lex.setFile(tname);
if (lex.IsOK()) { if (lex.IsOK()) {
if (b->readFile(lex)) { if (b->readFile(lex)) {
@ -596,10 +590,10 @@ Buffer* BufferList::newFile(LString const & name, LString tname)
} }
Buffer* BufferList::loadLyXFile(LString const & filename, bool tolastfiles) Buffer* BufferList::loadLyXFile(string const & filename, bool tolastfiles)
{ {
// make sure our path is absolute // make sure our path is absolute
LString s = MakeAbsPath(filename); string s = MakeAbsPath(filename);
// Is this done too early? // Is this done too early?
// Is it LinuxDoc? // Is it LinuxDoc?
@ -663,7 +657,7 @@ Buffer* BufferList::loadLyXFile(LString const & filename, bool tolastfiles)
_("Create new document with this name?"))) _("Create new document with this name?")))
{ {
// Find a free buffer // Find a free buffer
b = newFile(s,LString()); b = newFile(s,string());
} }
break; break;
} }

View File

@ -37,7 +37,7 @@ public:
/// ///
void release(Buffer* buf); void release(Buffer* buf);
/// ///
Buffer* newBuffer(LString const &s, LyXRC *, bool =false); Buffer* newBuffer(string const &s, LyXRC *, bool =false);
private: private:
enum { enum {
/** The max number of buffers there are possible to have /** The max number of buffers there are possible to have
@ -103,7 +103,7 @@ public:
true), the file name will not be added to the last opened true), the file name will not be added to the last opened
files list files list
*/ */
Buffer* loadLyXFile(LString const & filename, Buffer* loadLyXFile(string const & filename,
bool tolastfiles = true); bool tolastfiles = true);
/// ///
@ -122,10 +122,10 @@ public:
void resize(); void resize();
/// Read a file into a buffer readonly or not. /// Read a file into a buffer readonly or not.
Buffer* readFile(LString const &, bool ro); Buffer* readFile(string const &, bool ro);
/// Make a new file (buffer) using a template /// Make a new file (buffer) using a template
Buffer* newFile(LString const &, LString); Buffer* newFile(string const &, string);
/** This one must be moved to some other place. /** This one must be moved to some other place.
*/ */
@ -142,7 +142,7 @@ public:
int unlockInset(UpdatableInset*); int unlockInset(UpdatableInset*);
/// ///
void updateIncludedTeXfiles(LString const &); void updateIncludedTeXfiles(string const &);
/// ///
void emergencyWriteAll(); void emergencyWriteAll();
@ -156,10 +156,10 @@ public:
Buffer* first(); Buffer* first();
/// returns true if the buffer exists already /// returns true if the buffer exists already
bool exists(LString const &); bool exists(string const &);
/// returns a pointer to the buffer with the given name. /// returns a pointer to the buffer with the given name.
Buffer* getBuffer(LString const &); Buffer* getBuffer(string const &);
/// returns a pointer to the buffer with the given number. /// returns a pointer to the buffer with the given number.
Buffer* getBuffer(int); Buffer* getBuffer(int);

View File

@ -1,15 +1,15 @@
/* This file is part of /* This file is part of
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
*======================================================*/ * ======================================================*/
#include <config.h> #include <config.h>
#include <stdlib.h> #include <cstdlib>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "bufferparams.h" #pragma implementation "bufferparams.h"
@ -20,14 +20,8 @@
#include "layout.h" #include "layout.h"
#include "vspace.h" #include "vspace.h"
#include "error.h" #include "error.h"
#include "lyxlib.h" #include "support/lyxlib.h"
#include "support/lstrings.h"
// $Id: bufferparams.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: bufferparams.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $";
#endif /* lint */
BufferParams::BufferParams() BufferParams::BufferParams()
{ {
@ -125,7 +119,7 @@ void BufferParams::writeFile(FILE *file)
fprintf(file, "\\begin_preamble\n"); fprintf(file, "\\begin_preamble\n");
{ {
// remove '\n' from the end of preamble // remove '\n' from the end of preamble
preamble.strip('\n'); preamble = strip(preamble, '\n');
// write out the whole preamble in one go // write out the whole preamble in one go
fwrite(preamble.c_str(), fwrite(preamble.c_str(),
@ -251,8 +245,8 @@ void BufferParams::readPreamble(LyXLex &lex)
void BufferParams::readLanguage(LyXLex &lex) void BufferParams::readLanguage(LyXLex &lex)
{ {
LString tmptok; string tmptok;
LString test; string test;
int n = 0; int n = 0;
if (!lex.next()) return; if (!lex.next()) return;
@ -279,8 +273,8 @@ void BufferParams::readLanguage(LyXLex &lex)
void BufferParams::readGraphicsDriver(LyXLex &lex) void BufferParams::readGraphicsDriver(LyXLex &lex)
{ {
LString tmptok; string tmptok;
LString test; string test;
int n=0; int n=0;

View File

@ -63,7 +63,7 @@ public:
/// ///
InsetQuotes::quote_times quotes_times; InsetQuotes::quote_times quotes_times;
/// ///
LString fontsize; string fontsize;
/// ///
signed char textclass; signed char textclass;
@ -79,29 +79,29 @@ public:
/// ///
bool use_geometry; bool use_geometry;
/// ///
LString paperwidth; string paperwidth;
/// ///
LString paperheight; string paperheight;
/// ///
LString leftmargin; string leftmargin;
/// ///
LString topmargin; string topmargin;
/// ///
LString rightmargin; string rightmargin;
/// ///
LString bottommargin; string bottommargin;
/// ///
LString headheight; string headheight;
/// ///
LString headsep; string headsep;
/// ///
LString footskip; string footskip;
/* some LaTeX options */ /* some LaTeX options */
/// The graphics driver /// The graphics driver
LString graphicsDriver; string graphicsDriver;
/// ///
LString fonts; string fonts;
/// ///
Spacing spacing; Spacing spacing;
/// ///
@ -109,21 +109,21 @@ public:
/// ///
signed char tocdepth; signed char tocdepth;
/// ///
LString language; string language;
/// ///
LString inputenc; string inputenc;
/// ///
LString preamble; string preamble;
/// ///
LString options; string options;
/// ///
LString float_placement; string float_placement;
/// ///
char columns; // add approp. signedness char columns; // add approp. signedness
/// ///
char sides; // add approp. signedness char sides; // add approp. signedness
/// ///
LString pagestyle; string pagestyle;
/// ///
Bullet temp_bullets[4]; Bullet temp_bullets[4];
/// ///
@ -141,7 +141,7 @@ public:
/// ///
bool use_amsmath; bool use_amsmath;
/// Time ago we agreed that this was a buffer property [ale990407] /// Time ago we agreed that this was a buffer property [ale990407]
LString parentname; string parentname;
protected: protected:
private: private:
/// ///

View File

@ -6,10 +6,10 @@
/* Form definition file generated with fdesign. */ /* Form definition file generated with fdesign. */
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
#include <stdlib.h> #include <cstdlib>
#include "bullet_forms.h" #include "bullet_forms.h"
#include "bmtable.h" #include "bmtable.h"
#include "filetools.h" #include "support/filetools.h"
extern int mono_video; extern int mono_video;

View File

@ -1,13 +1,13 @@
/* Bullet form callbacks */ /* Bullet form callbacks */
#include <config.h> #include <config.h>
#include <stdlib.h> #include <cstdlib>
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
#include XPM_H_LOCATION #include XPM_H_LOCATION
#include "bullet_forms.h" #include "bullet_forms.h"
#include "bmtable.h" #include "bmtable.h"
#include "buffer.h" #include "buffer.h"
#include "bufferparams.h" #include "bufferparams.h"
#include "filetools.h" #include "support/filetools.h"
#include "gettext.h" #include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB + WriteAlert #include "lyx_gui_misc.h" // CancelCloseBoxCB + WriteAlert
@ -37,7 +37,7 @@ void bulletForm()
" normal | large | Large | LARGE | huge | Huge")); " normal | large | Large | LARGE | huge | Huge"));
fl_set_choice(fd_form_bullet->choice_bullet_size, 1); fl_set_choice(fd_form_bullet->choice_bullet_size, 1);
fl_set_form_atclose(fd_form_bullet->form_bullet, fl_set_form_atclose(fd_form_bullet->form_bullet,
CancelCloseBoxCB, NULL); CancelCloseBoxCB, 0);
} }
if (updateBulletForm()) { if (updateBulletForm()) {
@ -192,7 +192,7 @@ void BulletPanelCB(FL_OBJECT * /*ob*/, long data)
/* free the current pixmap */ /* free the current pixmap */
fl_free_bmtable_pixmap(fd_form_bullet->bmtable_bullet_panel); fl_free_bmtable_pixmap(fd_form_bullet->bmtable_bullet_panel);
LString new_panel; string new_panel;
switch (data) { switch (data) {
/* display the new one */ /* display the new one */
case 0 : case 0 :

View File

@ -5,14 +5,14 @@
#endif #endif
#include "chset.h" #include "chset.h"
#include "filetools.h" #include "support/filetools.h"
#include "lyxlex.h" #include "lyxlex.h"
#include "error.h" #include "error.h"
CharacterSet::CharacterSet() CharacterSet::CharacterSet()
{ {
map_=NULL; map_=0;
} }
@ -31,11 +31,11 @@ void CharacterSet::freeMap()
delete t; delete t;
} }
name_.clean(); name_.erase();
} }
bool CharacterSet::loadFile(const LString& fname) bool CharacterSet::loadFile(const string& fname)
{ {
freeMap(); freeMap();
@ -44,7 +44,7 @@ bool CharacterSet::loadFile(const LString& fname)
// open definition file // open definition file
lyxerr.debug("Opening keymap file "+ fname+ ".cdef",Error::KBMAP); lyxerr.debug("Opening keymap file "+ fname+ ".cdef",Error::KBMAP);
LString filename = LibFileSearch("kbd", fname.c_str(), "cdef"); string filename = LibFileSearch("kbd", fname.c_str(), "cdef");
FilePtr f(filename, FilePtr::read); FilePtr f(filename, FilePtr::read);
if (filename.empty() || !f()) { if (filename.empty() || !f()) {
lyxerr.print("Unable to open keymap file"); lyxerr.print("Unable to open keymap file");
@ -54,11 +54,11 @@ bool CharacterSet::loadFile(const LString& fname)
name_=fname; name_=fname;
// now read the file // now read the file
LyXLex lex(NULL,0); LyXLex lex(0,0);
lex.setFile(f()); lex.setFile(f());
bool error=false; bool error=false;
LString str; string str;
int n; int n;
while(lex.IsOK() && !error) { while(lex.IsOK() && !error) {
@ -97,22 +97,22 @@ bool CharacterSet::loadFile(const LString& fname)
} }
bool CharacterSet::encodeString(LString& str) bool CharacterSet::encodeString(string& str)
{ {
Cdef *t=map_; Cdef *t=map_;
while(t) { while(t) {
if (t->str==str) { if (t->str==str) {
str=LString(t->ic); str = tostr(t->ic);
break; break;
} }
t=t->next; t=t->next;
} }
return (t!=NULL); return (t!=0);
} }
LString CharacterSet::getName() string CharacterSet::getName()
{ {
return name_; return name_;
} }

View File

@ -17,21 +17,21 @@ public:
~CharacterSet(); ~CharacterSet();
/// ///
bool loadFile(const LString&); bool loadFile(const string&);
/// ///
LString getName(); string getName();
/// ///
bool encodeString(LString&); bool encodeString(string&);
private: private:
/// ///
LString name_; string name_;
/// ///
struct Cdef { struct Cdef {
/// ///
unsigned char ic; unsigned char ic;
/// ///
LString str; string str;
/// ///
Cdef *next; Cdef *next;
}; };

View File

@ -36,17 +36,10 @@
#endif #endif
#include "combox.h" #include "combox.h"
#include <string.h> #include <cstring>
#include "error.h" #include "error.h"
// $Id: combox.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: combox.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $";
#endif /* lint */
Combox::Combox(combox_type t): type(t) Combox::Combox(combox_type t): type(t)
{ {
browser = button = 0; browser = button = 0;
@ -80,20 +73,20 @@ void Combox::clear()
void Combox::remove() void Combox::remove()
{ {
//lyxerr.print(LString("Button: ") + int(button)); //lyxerr.print(string("Button: ") + int(button));
if (button) { if (button) {
fl_delete_object(button); fl_delete_object(button);
fl_free_object(button); fl_free_object(button);
} }
//lyxerr.print(LString("Label: ") + int(label)); //lyxerr.print(string("Label: ") + int(label));
if (label && label!=button) { if (label && label!=button) {
fl_delete_object(label); fl_delete_object(label);
fl_free_object(label); fl_free_object(label);
} }
//lyxerr.print(LString("Form: ") + int(form)); //lyxerr.print(string("Form: ") + int(form));
//lyxerr.print(LString("Browser: ") + int(browser)); //lyxerr.print(string("Browser: ") + int(browser));
if (form && browser) { if (form && browser) {
fl_delete_object(browser); fl_delete_object(browser);
fl_free_object(browser); fl_free_object(browser);
@ -379,7 +372,7 @@ int Combox::peek_event(FL_FORM * form, void *xev)
static int num_bytes; static int num_bytes;
KeySym keysym_return; KeySym keysym_return;
num_bytes = XLookupString(&((XEvent*)xev)->xkey, s_r, 10, num_bytes = XLookupString(&((XEvent*)xev)->xkey, s_r, 10,
&keysym_return, NULL); &keysym_return, 0);
XFlush(fl_display); XFlush(fl_display);
switch (keysym_return) { switch (keysym_return) {
case XK_Down: case XK_Down:

View File

@ -178,7 +178,7 @@ void Combox::shortcut(char const* s, int i)
} }
inline inline
void Combox::setcallback(FL_COMBO_CB cb, void *a = NULL) void Combox::setcallback(FL_COMBO_CB cb, void *a = 0)
{ {
callback = cb; callback = cb;
cb_arg = a; cb_arg = a;
@ -208,7 +208,7 @@ char const*Combox::getline()
if (type==FL_COMBOX_INPUT) if (type==FL_COMBOX_INPUT)
return fl_get_input(label); return fl_get_input(label);
else else
return ((browser) ? fl_get_browser_line(browser, sel): (char const*)NULL); return ((browser) ? fl_get_browser_line(browser, sel): (char const*)0);
} }
#endif #endif

View File

@ -1,44 +1,37 @@
/* This file is part of /* This file is part of
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
*======================================================*/ * ======================================================*/
#include <config.h> #include <config.h>
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
#include <stdlib.h> #include <cstdlib>
#include "credits.h" #include "credits.h"
#include "credits_form.h" #include "credits_form.h"
#include "LString.h" #include "LString.h"
#include "filetools.h" #include "support/filetools.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB #include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "gettext.h" #include "gettext.h"
// $Id: credits.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $ extern string system_lyxdir;
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: credits.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $";
#endif /* lint */
/* extern */
extern LString system_lyxdir;
/**** Forms and Objects ****/ /**** Forms and Objects ****/
static FD_form_credits *fd_form_credits = NULL; static FD_form_credits *fd_form_credits = 0;
static FD_copyright *fd_form_copyright = NULL; static FD_copyright *fd_form_copyright = 0;
void CreditsOKCB(FL_OBJECT *, long) { void CreditsOKCB(FL_OBJECT *, long) {
fl_hide_form(fd_form_credits->form_credits); fl_hide_form(fd_form_credits->form_credits);
fl_free_form(fd_form_credits->form_credits); fl_free_form(fd_form_credits->form_credits);
fd_form_credits->form_credits = NULL; fd_form_credits->form_credits = 0;
} }
/*---------------------------------------*/ /*---------------------------------------*/
@ -51,10 +44,10 @@ void ShowCredits()
/* read the credits into the browser */ /* read the credits into the browser */
/* try file LYX_DIR/CREDITS */ /* try file LYX_DIR/CREDITS */
LString real_file = AddName (system_lyxdir, "CREDITS"); string real_file = AddName (system_lyxdir, "CREDITS");
fd_form_credits = create_form_form_credits(); fd_form_credits = create_form_form_credits();
fl_set_form_atclose(fd_form_credits->form_credits, fl_set_form_atclose(fd_form_credits->form_credits,
CancelCloseBoxCB, NULL); CancelCloseBoxCB, 0);
if (!fl_load_browser(fd_form_credits->browser_credits, if (!fl_load_browser(fd_form_credits->browser_credits,
real_file.c_str())) { real_file.c_str())) {
@ -84,7 +77,7 @@ void ShowCredits()
void CopyrightOKCB(FL_OBJECT *, long) { void CopyrightOKCB(FL_OBJECT *, long) {
fl_hide_form(fd_form_copyright->copyright); fl_hide_form(fd_form_copyright->copyright);
fl_free_form(fd_form_copyright->copyright); fl_free_form(fd_form_copyright->copyright);
fd_form_copyright->copyright = NULL; fd_form_copyright->copyright = 0;
} }
// Show copyright and warranty form // Show copyright and warranty form
@ -93,7 +86,7 @@ void ShowCopyright()
if (!fd_form_copyright || !fd_form_copyright->copyright) { if (!fd_form_copyright || !fd_form_copyright->copyright) {
fd_form_copyright = create_form_copyright(); fd_form_copyright = create_form_copyright();
fl_set_form_atclose(fd_form_copyright->copyright, fl_set_form_atclose(fd_form_copyright->copyright,
CancelCloseBoxCB, NULL); CancelCloseBoxCB, 0);
} }
// Funny emotional remark by Asger deleted. (Lgb) // Funny emotional remark by Asger deleted. (Lgb)

View File

@ -5,13 +5,7 @@
#endif #endif
#include "error.h" #include "error.h"
#include <stdio.h> #include <cstdio>
// $Id: error.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: error.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $";
#endif /* lint */
Error::Error(int level) // should loglevel also be an argument? Error::Error(int level) // should loglevel also be an argument?
{ {
@ -26,14 +20,14 @@ void Error::setDebugLevel(int level)
} }
void Error::debug(LString const & msg, int level) void Error::debug(string const & msg, int level)
{ {
if (debuglevel & level) if (debuglevel & level)
print(msg); print(msg);
// should also print to the logfile // should also print to the logfile
} }
void Error::print(LString const & msg) void Error::print(string const & msg)
{ {
if (!msg.empty()) if (!msg.empty())
fprintf(stderr, "%s\n", msg.c_str()); fprintf(stderr, "%s\n", msg.c_str());

View File

@ -55,16 +55,16 @@ public:
/// Not implemented yet. /// Not implemented yet.
void setLogLevel(int level); void setLogLevel(int level);
/// Not implemented yet. /// Not implemented yet.
void setLogFile(LString const & filename); void setLogFile(string const & filename);
/// ///
void debug(LString const & msg, int level = INFO); // or ANY? void debug(string const & msg, int level = INFO); // or ANY?
/// ///
bool debugging(int level = INFO) // or ANY? bool debugging(int level = INFO) // or ANY?
{ {
return (bool)(debuglevel & level); return (bool)(debuglevel & level);
} }
/// ///
void print(LString const & msg); void print(string const & msg);
protected: protected:
private: private:
/// ///

View File

@ -1,35 +1,29 @@
// -*- C++ -*- // -*- C++ -*-
/* This file is part of /* This file is part of
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
*======================================================*/ * ======================================================*/
#include <config.h> #include <config.h>
// $Id: filedlg.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: filedlg.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $";
#endif /* lint */
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
#include <pwd.h> #include <pwd.h>
#include <grp.h> #include <grp.h>
#include <string.h> #include <cstring>
#include "lyx_gui_misc.h" // CancelCloseCB #include "lyx_gui_misc.h" // CancelCloseCB
#include "FileInfo.h" #include "support/FileInfo.h"
#include "gettext.h" #include "gettext.h"
#ifdef HAVE_ERRNO_H #ifdef HAVE_ERRNO_H
#include <errno.h> #include <cerrno>
#endif #endif
#if HAVE_DIRENT_H #if HAVE_DIRENT_H
@ -51,12 +45,12 @@ static char vcid[] = "$Id: filedlg.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $";
#if TIME_WITH_SYS_TIME #if TIME_WITH_SYS_TIME
# include <sys/time.h> # include <sys/time.h>
# include <time.h> # include <ctime>
#else #else
# if HAVE_SYS_TIME_H # if HAVE_SYS_TIME_H
# include <sys/time.h> # include <sys/time.h>
# else # else
# include <time.h> # include <ctime>
# endif # endif
#endif #endif
@ -69,7 +63,7 @@ extern "C" int gettimeofday(struct timeval *,struct timezone *);
#pragma implementation #pragma implementation
#endif #endif
#include "filetools.h" #include "support/filetools.h"
#include "filedlg.h" #include "filedlg.h"
#include "definitions.h" #include "definitions.h"
@ -79,20 +73,20 @@ static const long ONE_HOUR_SEC = 60L * 60L;
// *** User cache class implementation // *** User cache class implementation
// global instance (user cache root) // global instance (user cache root)
UserCache lyxUserCache = UserCache(LString(),0,0); UserCache lyxUserCache = UserCache(string(),0,0);
// Add: creates a new user entry // Add: creates a new user entry
UserCache *UserCache::Add(uid_t ID) UserCache * UserCache::Add(uid_t ID)
{ {
LString pszNewName; string pszNewName;
struct passwd *pEntry; struct passwd * pEntry;
// gets user name // gets user name
if ((pEntry = getpwuid(ID))) if ((pEntry = getpwuid(ID)))
pszNewName = pEntry->pw_name; pszNewName = pEntry->pw_name;
else { else {
pszNewName = LString() + int(ID); // We don't have int cast to LString pszNewName = tostr(ID);
} }
// adds new node // adds new node
@ -100,7 +94,7 @@ UserCache *UserCache::Add(uid_t ID)
} }
UserCache::UserCache(LString const & pszName, uid_t ID, UserCache *pRoot) UserCache::UserCache(string const & pszName, uid_t ID, UserCache * pRoot)
{ {
// links node // links node
if (pRoot) { if (pRoot) {
@ -109,7 +103,7 @@ UserCache::UserCache(LString const & pszName, uid_t ID, UserCache *pRoot)
pRoot->pNext = this; pRoot->pNext = this;
} else { } else {
this->pRoot = this; this->pRoot = this;
pNext = NULL; pNext = 0;
} }
// stores data // stores data
@ -125,7 +119,7 @@ UserCache::~UserCache()
// Find: seeks user name from user ID // Find: seeks user name from user ID
LString UserCache::Find(uid_t ID) string UserCache::Find(uid_t ID)
{ {
if ((!pszName.empty()) && (this->ID == ID)) return pszName; if ((!pszName.empty()) && (this->ID == ID)) return pszName;
if (pNext) return pNext->Find(ID); if (pNext) return pNext->Find(ID);
@ -137,18 +131,18 @@ LString UserCache::Find(uid_t ID)
// *** Group cache class implementation // *** Group cache class implementation
// global instance (group cache root) // global instance (group cache root)
GroupCache lyxGroupCache = GroupCache(LString(),0,0); GroupCache lyxGroupCache = GroupCache(string(),0,0);
// Add: creates a new group entry // Add: creates a new group entry
GroupCache *GroupCache::Add(gid_t ID) GroupCache * GroupCache::Add(gid_t ID)
{ {
LString pszNewName; string pszNewName;
struct group *pEntry; struct group * pEntry;
// gets user name // gets user name
if ((pEntry = getgrgid(ID))) pszNewName = pEntry->gr_name; if ((pEntry = getgrgid(ID))) pszNewName = pEntry->gr_name;
else { else {
pszNewName = LString() + int(ID); // We don't have int cast to LString pszNewName = tostr(ID);
} }
// adds new node // adds new node
@ -156,7 +150,7 @@ GroupCache *GroupCache::Add(gid_t ID)
} }
GroupCache::GroupCache(LString const & pszName, gid_t ID, GroupCache *pRoot) GroupCache::GroupCache(string const & pszName, gid_t ID, GroupCache * pRoot)
{ {
// links node // links node
if (pRoot) { if (pRoot) {
@ -165,7 +159,7 @@ GroupCache::GroupCache(LString const & pszName, gid_t ID, GroupCache *pRoot)
pRoot->pNext = this; pRoot->pNext = this;
} else { } else {
this->pRoot = this; this->pRoot = this;
pNext = NULL; pNext = 0;
} }
// stores data // stores data
@ -181,7 +175,7 @@ GroupCache::~GroupCache()
// Find: seeks group name from group ID // Find: seeks group name from group ID
LString GroupCache::Find(gid_t ID) string GroupCache::Find(gid_t ID)
{ {
if ((!pszName.empty()) && (this->ID == ID)) return pszName; if ((!pszName.empty()) && (this->ID == ID)) return pszName;
if (pNext) return pNext->Find(ID); if (pNext) return pNext->Find(ID);
@ -192,31 +186,33 @@ LString GroupCache::Find(gid_t ID)
// *** LyXDirEntry internal structure implementation // *** LyXDirEntry internal structure implementation
// ldeCompProc: compares two LyXDirEntry objects content (used for qsort) // ldeCompProc: compares two LyXDirEntry objects content (used for qsort)
int LyXDirEntry::ldeCompProc(const LyXDirEntry *r1, int LyXDirEntry::ldeCompProc(const LyXDirEntry * r1,
const LyXDirEntry *r2) const LyXDirEntry * r2)
{ {
bool r1d = r1->pszName.suffixIs('/'); bool r1d = suffixIs(r1->pszName, '/');
bool r2d = r2->pszName.suffixIs('/'); bool r2d = suffixIs(r2->pszName, '/');
if (r1d && !r2d) return -1; if (r1d && !r2d) return -1;
if (!r1d && r2d) return 1; if (!r1d && r2d) return 1;
return strcmp(r1->pszName.c_str(), r2->pszName.c_str()); return r1->pszName.compare(r2->pszName);
} }
// *** LyXFileDlg class implementation // *** LyXFileDlg class implementation
// static members // static members
FD_FileDlg *LyXFileDlg::pFileDlgForm = NULL; FD_FileDlg * LyXFileDlg::pFileDlgForm = 0;
LyXFileDlg *LyXFileDlg::pCurrentDlg = NULL; LyXFileDlg * LyXFileDlg::pCurrentDlg = 0;
// Reread: updates dialog list to match class directory // Reread: updates dialog list to match class directory
void LyXFileDlg::Reread() void LyXFileDlg::Reread()
{ {
int i; int i;
DIR *pDirectory; DIR * pDirectory;
struct dirent *pDirEntry; struct dirent * pDirEntry;
LString File, Buffer; string File;
char szMode[15], szTime[40]; string Buffer;
string Time;
char szMode[15];
FileInfo fileInfo; FileInfo fileInfo;
// Opens directory // Opens directory
@ -241,17 +237,17 @@ void LyXFileDlg::Reread()
// Splits complete directory name into directories and compute depth // Splits complete directory name into directories and compute depth
iDepth = 0; iDepth = 0;
LString line, Temp; string line, Temp;
File = pszDirectory; File = pszDirectory;
if (File != "/") { if (File != "/") {
File.split(Temp, '/'); File = split(File, Temp, '/');
} }
while (!File.empty() || !Temp.empty()) { while (!File.empty() || !Temp.empty()) {
LString dline = "@b"+line + Temp + '/'; string dline = "@b"+line + Temp + '/';
fl_add_browser_line(pFileDlgForm->List, dline.c_str()); fl_add_browser_line(pFileDlgForm->List, dline.c_str());
File.split(Temp, '/'); File = split(File, Temp, '/');
line += ' '; line += ' ';
iDepth++; ++iDepth;
} }
// Allocate names array // Allocate names array
@ -262,7 +258,7 @@ void LyXFileDlg::Reread()
// Parses all entries of the given subdirectory // Parses all entries of the given subdirectory
iNumNames = 0; iNumNames = 0;
time_t curTime = time(NULL); time_t curTime = time(0);
rewinddir(pDirectory); rewinddir(pDirectory);
while ((pDirEntry = readdir(pDirectory))) { while ((pDirEntry = readdir(pDirectory))) {
@ -274,7 +270,7 @@ void LyXFileDlg::Reread()
continue; continue;
// Gets filename // Gets filename
LString fname = pDirEntry->d_name; string fname = pDirEntry->d_name;
// Under all circumstances, "." and ".." are not wanted // Under all circumstances, "." and ".." are not wanted
if (fname == "." || fname == "..") if (fname == "." || fname == "..")
@ -287,11 +283,11 @@ void LyXFileDlg::Reread()
fileInfo.modeString(szMode); fileInfo.modeString(szMode);
unsigned int nlink = fileInfo.getNumberOfLinks(); unsigned int nlink = fileInfo.getNumberOfLinks();
LString user = lyxUserCache.Find(fileInfo.getUid()); string user = lyxUserCache.Find(fileInfo.getUid());
LString group = lyxGroupCache.Find(fileInfo.getGid()); string group = lyxGroupCache.Find(fileInfo.getGid());
time_t modtime = fileInfo.getModificationTime(); time_t modtime = fileInfo.getModificationTime();
strcpy(szTime, ctime(&modtime)); Time += ctime(&modtime);
if (curTime > fileInfo.getModificationTime() + SIX_MONTH_SEC if (curTime > fileInfo.getModificationTime() + SIX_MONTH_SEC
|| curTime < fileInfo.getModificationTime() || curTime < fileInfo.getModificationTime()
@ -301,24 +297,22 @@ void LyXFileDlg::Reread()
// factor for what is considered "the future", to // factor for what is considered "the future", to
// allow for NFS server/client clock disagreement. // allow for NFS server/client clock disagreement.
// Show the year instead of the time of day. // Show the year instead of the time of day.
strcpy(szTime+10, szTime+19); #warning fix!
szTime[15] = 0;
} else Time.erase(10, 9);
szTime[16] = 0; }
char szHeadBuf[128]; Buffer = szMode + ' ' +
sprintf(szHeadBuf, "%s %u %s %s %s ", szMode, nlink + ' ' +
nlink, user + ' ' +
user.c_str(), group + ' ' +
group.c_str(), Time.substr(4, string::npos) + ' ';
szTime + 4);
Buffer = szHeadBuf;
Buffer += pDirEntry->d_name; Buffer += pDirEntry->d_name;
Buffer += fileInfo.typeIndicator(); Buffer += fileInfo.typeIndicator();
if ((isLink = fileInfo.isLink())) { if ((isLink = fileInfo.isLink())) {
LString Link; string Link;
if (LyXReadLink(File,Link)) { if (LyXReadLink(File,Link)) {
Buffer += " -> "; Buffer += " -> ";
@ -340,16 +334,16 @@ void LyXFileDlg::Reread()
|| fileInfo.isChar() || fileInfo.isChar()
|| fileInfo.isBlock() || fileInfo.isBlock()
|| fileInfo.isFifo()) { || fileInfo.isFifo()) {
if (!fname.regexMatch(pszMask)) if (!regexMatch(fname, pszMask))
continue; continue;
} else if (!(isDir = fileInfo.isDir())) } else if (!(isDir = fileInfo.isDir()))
continue; continue;
// Note pszLsEntry is an LString! // Note pszLsEntry is an string!
pCurrentNames[iNumNames].pszLsEntry = Buffer; pCurrentNames[iNumNames].pszLsEntry = Buffer;
// creates used name // creates used name
LString temp = fname; string temp = fname;
if (isDir) temp += '/'; if (isDir) temp += '/';
pCurrentNames[iNumNames].pszName = temp; pCurrentNames[iNumNames].pszName = temp;
@ -371,7 +365,7 @@ void LyXFileDlg::Reread()
// Add them to directory box // Add them to directory box
for (i = 0; i < iNumNames; ++i) { for (i = 0; i < iNumNames; ++i) {
LString temp = line + pCurrentNames[i].pszDisplayed; string temp = line + pCurrentNames[i].pszDisplayed;
fl_add_browser_line(pFileDlgForm->List, temp.c_str()); fl_add_browser_line(pFileDlgForm->List, temp.c_str());
} }
fl_set_browser_topline(pFileDlgForm->List,iDepth); fl_set_browser_topline(pFileDlgForm->List,iDepth);
@ -381,10 +375,10 @@ void LyXFileDlg::Reread()
// SetDirectory: sets dialog current directory // SetDirectory: sets dialog current directory
void LyXFileDlg::SetDirectory(LString const & Path) void LyXFileDlg::SetDirectory(string const & Path)
{ {
if (!pszDirectory.empty()) { if (!pszDirectory.empty()) {
LString TempPath = ExpandPath(Path); // Expand ~/ string TempPath = ExpandPath(Path); // Expand ~/
TempPath = MakeAbsPath(TempPath, pszDirectory); TempPath = MakeAbsPath(TempPath, pszDirectory);
pszDirectory = MakeAbsPath(TempPath); pszDirectory = MakeAbsPath(TempPath);
} else pszDirectory = MakeAbsPath(Path); } else pszDirectory = MakeAbsPath(Path);
@ -392,7 +386,7 @@ void LyXFileDlg::SetDirectory(LString const & Path)
// SetMask: sets dialog file mask // SetMask: sets dialog file mask
void LyXFileDlg::SetMask(LString const & NewMask) void LyXFileDlg::SetMask(string const & NewMask)
{ {
pszMask = NewMask; pszMask = NewMask;
fl_set_input(pFileDlgForm->PatBox, pszMask.c_str()); fl_set_input(pFileDlgForm->PatBox, pszMask.c_str());
@ -400,7 +394,7 @@ void LyXFileDlg::SetMask(LString const & NewMask)
// SetInfoLine: sets dialog information line // SetInfoLine: sets dialog information line
void LyXFileDlg::SetInfoLine(LString const & Line) void LyXFileDlg::SetInfoLine(string const & Line)
{ {
pszInfoLine = Line; pszInfoLine = Line;
fl_set_object_label(pFileDlgForm->FileInfo, pszInfoLine.c_str()); fl_set_object_label(pFileDlgForm->FileInfo, pszInfoLine.c_str());
@ -410,7 +404,7 @@ void LyXFileDlg::SetInfoLine(LString const & Line)
LyXFileDlg::LyXFileDlg() LyXFileDlg::LyXFileDlg()
{ {
pCurrentNames = 0; pCurrentNames = 0;
pszDirectory = MakeAbsPath(LString('.')); pszDirectory = MakeAbsPath(string("."));
pszMask = '*'; pszMask = '*';
// Creates form if necessary. // Creates form if necessary.
@ -435,7 +429,7 @@ LyXFileDlg::LyXFileDlg()
LyXFileDlg::FileDlgCB,13); LyXFileDlg::FileDlgCB,13);
// Make sure pressing the close box doesn't crash LyX. (RvdK) // Make sure pressing the close box doesn't crash LyX. (RvdK)
fl_set_form_atclose(pFileDlgForm->FileDlg, CancelCB, NULL); fl_set_form_atclose(pFileDlgForm->FileDlg, CancelCB, 0);
// Register doubleclick callback // Register doubleclick callback
fl_set_browser_dblclick_callback(pFileDlgForm->List, fl_set_browser_dblclick_callback(pFileDlgForm->List,
DoubleClickCB,0); DoubleClickCB,0);
@ -455,11 +449,11 @@ LyXFileDlg::~LyXFileDlg()
// SetButton: sets file selector user button action // SetButton: sets file selector user button action
void LyXFileDlg::SetButton(int iIndex, LString const & pszName, void LyXFileDlg::SetButton(int iIndex, string const & pszName,
LString const & pszPath) string const & pszPath)
{ {
FL_OBJECT *pObject; FL_OBJECT *pObject;
LString *pTemp; string *pTemp;
if (iIndex == 0) { if (iIndex == 0) {
pObject = pFileDlgForm->User1; pObject = pFileDlgForm->User1;
@ -475,18 +469,18 @@ void LyXFileDlg::SetButton(int iIndex, LString const & pszName,
*pTemp = pszPath; *pTemp = pszPath;
} else { } else {
fl_hide_object(pObject); fl_hide_object(pObject);
*pTemp = LString(); (*pTemp).erase();
} }
} }
// GetDirectory: gets last dialog directory // GetDirectory: gets last dialog directory
LString LyXFileDlg::GetDirectory() string LyXFileDlg::GetDirectory()
{ {
if (!pszDirectory.empty()) if (!pszDirectory.empty())
return pszDirectory; return pszDirectory;
else else
return LString('.'); return string(".");
} }
@ -541,7 +535,7 @@ void LyXFileDlg::FileDlgCB(FL_OBJECT *, long lArgument)
break; break;
case 11: // home case 11: // home
pCurrentDlg->SetDirectory(getEnvPath("HOME")); pCurrentDlg->SetDirectory(GetEnvPath("HOME"));
pCurrentDlg->SetMask(fl_get_input(pFileDlgForm->PatBox)); pCurrentDlg->SetMask(fl_get_input(pFileDlgForm->PatBox));
pCurrentDlg->Reread(); pCurrentDlg->Reread();
break; break;
@ -574,7 +568,7 @@ void LyXFileDlg::HandleListHit()
if (iSelect > iDepth) { if (iSelect > iDepth) {
SetInfoLine(pCurrentNames[iSelect - iDepth - 1].pszLsEntry); SetInfoLine(pCurrentNames[iSelect - iDepth - 1].pszLsEntry);
} else { } else {
SetInfoLine(LString()); SetInfoLine(string());
} }
} }
@ -592,7 +586,7 @@ void LyXFileDlg::DoubleClickCB(FL_OBJECT *, long)
bool LyXFileDlg::HandleDoubleClick() bool LyXFileDlg::HandleDoubleClick()
{ {
bool isDir; bool isDir;
LString pszTemp; string pszTemp;
int iSelect; int iSelect;
// set info line // set info line
@ -601,12 +595,12 @@ bool LyXFileDlg::HandleDoubleClick()
if (iSelect > iDepth) { if (iSelect > iDepth) {
pszTemp = pCurrentNames[iSelect - iDepth - 1].pszName; pszTemp = pCurrentNames[iSelect - iDepth - 1].pszName;
SetInfoLine(pCurrentNames[iSelect - iDepth - 1].pszLsEntry); SetInfoLine(pCurrentNames[iSelect - iDepth - 1].pszLsEntry);
if (!pszTemp.suffixIs('/')) { if (!suffixIs(pszTemp, '/')) {
isDir = false; isDir = false;
fl_set_input(pFileDlgForm->Filename, pszTemp.c_str()); fl_set_input(pFileDlgForm->Filename, pszTemp.c_str());
} }
} else if (iSelect !=0) { } else if (iSelect !=0) {
SetInfoLine(LString()); SetInfoLine(string());
} else } else
return true; return true;
@ -614,23 +608,23 @@ bool LyXFileDlg::HandleDoubleClick()
if (isDir) { if (isDir) {
int i; int i;
LString Temp; string Temp;
// builds new directory name // builds new directory name
if (iSelect > iDepth) { if (iSelect > iDepth) {
// Directory deeper down // Directory deeper down
// First, get directory with trailing / // First, get directory with trailing /
Temp = fl_get_input(pFileDlgForm->DirBox); Temp = fl_get_input(pFileDlgForm->DirBox);
if (!Temp.suffixIs('/')) if (!suffixIs(Temp, '/'))
Temp += '/'; Temp += '/';
Temp += pszTemp; Temp += pszTemp;
} else { } else {
// Directory higher up // Directory higher up
Temp.clean(); Temp.erase();
for (i = 0; i < iSelect; ++i) { for (i = 0; i < iSelect; ++i) {
LString piece = fl_get_browser_line(pFileDlgForm->List, i+1); string piece = fl_get_browser_line(pFileDlgForm->List, i+1);
// The '+2' is here to count the '@b' (JMarc) // The '+2' is here to count the '@b' (JMarc)
Temp += piece.substring(i+2, piece.length()-1); Temp += piece.substr(i + 2);
} }
} }
@ -646,7 +640,7 @@ bool LyXFileDlg::HandleDoubleClick()
// Handle OK button call // Handle OK button call
bool LyXFileDlg::HandleOK() bool LyXFileDlg::HandleOK()
{ {
LString pszTemp; string pszTemp;
// mask was changed // mask was changed
pszTemp = fl_get_input(pFileDlgForm->PatBox); pszTemp = fl_get_input(pFileDlgForm->PatBox);
@ -667,10 +661,10 @@ bool LyXFileDlg::HandleOK()
// Handle return from list // Handle return from list
int select = fl_get_browser(pFileDlgForm->List); int select = fl_get_browser(pFileDlgForm->List);
if (select > iDepth) { if (select > iDepth) {
LString temp = pCurrentNames[select - iDepth - 1].pszName; string temp = pCurrentNames[select - iDepth - 1].pszName;
if (!temp.suffixIs('/')) { if (!suffixIs(temp, '/')) {
// If user didn't type anything, use browser // If user didn't type anything, use browser
LString name = fl_get_input(pFileDlgForm->Filename); string name = fl_get_input(pFileDlgForm->Filename);
if (name.empty()) { if (name.empty()) {
fl_set_input(pFileDlgForm->Filename, temp.c_str()); fl_set_input(pFileDlgForm->Filename, temp.c_str());
} }
@ -708,8 +702,8 @@ void LyXFileDlg::Force(bool cancel)
// Select: launches dialog and returns selected file // Select: launches dialog and returns selected file
LString LyXFileDlg::Select(LString const & title, LString const & path, string LyXFileDlg::Select(string const & title, string const & path,
LString const & mask, LString const & suggested) string const & mask, string const & suggested)
{ {
bool isOk; bool isOk;
@ -730,11 +724,11 @@ LString LyXFileDlg::Select(LString const & title, LString const & path,
} }
// checks whether dialog can be started // checks whether dialog can be started
if (pCurrentDlg) return LString(); if (pCurrentDlg) return string();
pCurrentDlg = this; pCurrentDlg = this;
// runs dialog // runs dialog
SetInfoLine (LString()); SetInfoLine (string());
fl_set_input(pFileDlgForm->Filename, suggested.c_str()); fl_set_input(pFileDlgForm->Filename, suggested.c_str());
fl_set_button(pFileDlgForm->Cancel, 0); fl_set_button(pFileDlgForm->Cancel, 0);
fl_set_button(pFileDlgForm->Ready, 0); fl_set_button(pFileDlgForm->Ready, 0);
@ -747,10 +741,10 @@ LString LyXFileDlg::Select(LString const & title, LString const & path,
fl_hide_form(pFileDlgForm->FileDlg); fl_hide_form(pFileDlgForm->FileDlg);
fl_activate_all_forms(); fl_activate_all_forms();
pCurrentDlg = NULL; pCurrentDlg = 0;
// Returns filename or LString() if no valid selection was made // Returns filename or string() if no valid selection was made
if (!isOk || !fl_get_input(pFileDlgForm->Filename)[0]) return LString(); if (!isOk || !fl_get_input(pFileDlgForm->Filename)[0]) return string();
pszFileName = fl_get_input(pFileDlgForm->Filename); pszFileName = fl_get_input(pFileDlgForm->Filename);

View File

@ -28,18 +28,18 @@ class UserCache
{ {
public: public:
/// ///
UserCache(LString const & pszName = LString(), uid_t ID = 0, UserCache(string const & pszName = string(), uid_t ID = 0,
UserCache *pRoot = NULL); UserCache *pRoot = 0);
/// ///
~UserCache(); ~UserCache();
// interface // interface
/// seeks user name from user ID /// seeks user name from user ID
LString Find(uid_t ID); string Find(uid_t ID);
private: private:
/// ///
uid_t ID; uid_t ID;
/// ///
LString pszName; string pszName;
/// ///
UserCache *pNext, *pRoot; UserCache *pNext, *pRoot;
// internal methods // internal methods
@ -54,19 +54,19 @@ class GroupCache
{ {
public: public:
/// ///
GroupCache(LString const & pszName = LString(), gid_t ID = 0, GroupCache(string const & pszName = string(), gid_t ID = 0,
GroupCache *pRoot = NULL); GroupCache *pRoot = 0);
/// ///
~GroupCache(); ~GroupCache();
// interface // interface
/// seeks group name from group ID /// seeks group name from group ID
LString Find(gid_t ID); string Find(gid_t ID);
private: private:
/// ///
gid_t ID; gid_t ID;
/// ///
LString pszName; string pszName;
/// ///
GroupCache *pNext, *pRoot; GroupCache *pNext, *pRoot;
// internal methods // internal methods
@ -81,9 +81,9 @@ class LyXDirEntry
{ {
private: private:
friend class LyXFileDlg; friend class LyXFileDlg;
LString pszName; string pszName;
LString pszDisplayed; string pszDisplayed;
LString pszLsEntry; string pszLsEntry;
/// compares two LyXDirEntry objects content (used by qsort) /// compares two LyXDirEntry objects content (used by qsort)
static int ldeCompProc(const LyXDirEntry *r1, const LyXDirEntry *r2); static int ldeCompProc(const LyXDirEntry *r1, const LyXDirEntry *r2);
LyXDirEntry() {}; LyXDirEntry() {};
@ -99,15 +99,15 @@ public:
/// ///
~LyXFileDlg(); ~LyXFileDlg();
/// sets file selector user button action /// sets file selector user button action
void SetButton(int iIndex, LString const & pszName = LString(), void SetButton(int iIndex, string const & pszName = string(),
LString const & pszPath = LString()); string const & pszPath = string());
/// gets last dialog directory /// gets last dialog directory
LString GetDirectory(); string GetDirectory();
/// launches dialog and returns selected file /// launches dialog and returns selected file
LString Select(LString const & pszTitle = LString(), string Select(string const & pszTitle = string(),
LString const & pszPath = LString(), string const & pszPath = string(),
LString const & pszMask = LString(), string const & pszMask = string(),
LString const & pszSuggested = LString()); string const & pszSuggested = string());
/// XForms objects callback (static) /// XForms objects callback (static)
static void FileDlgCB(FL_OBJECT *, long); static void FileDlgCB(FL_OBJECT *, long);
/// Callback for double click in list /// Callback for double click in list
@ -116,15 +116,15 @@ private:
// data // data
static FD_FileDlg *pFileDlgForm; static FD_FileDlg *pFileDlgForm;
static LyXFileDlg *pCurrentDlg; static LyXFileDlg *pCurrentDlg;
LString pszUserPath1; string pszUserPath1;
LString pszUserPath2; string pszUserPath2;
LString pszDirectory; string pszDirectory;
LString pszMask; string pszMask;
LString pszFileName; string pszFileName;
int iDepth; int iDepth;
int iLastSel; int iLastSel;
long lLastTime; long lLastTime;
LString pszInfoLine; string pszInfoLine;
LyXDirEntry *pCurrentNames; LyXDirEntry *pCurrentNames;
int iNumNames; int iNumNames;
@ -135,11 +135,11 @@ private:
/// updates dialog list to match class directory /// updates dialog list to match class directory
void Reread(); void Reread();
/// sets dialog current directory /// sets dialog current directory
void SetDirectory(LString const & pszPath); void SetDirectory(string const & pszPath);
/// sets dialog file mask /// sets dialog file mask
void SetMask(LString const & pszNewMask); void SetMask(string const & pszNewMask);
/// sets dialog information line /// sets dialog information line
void SetInfoLine(LString const & pszLine); void SetInfoLine(string const & pszLine);
/// handle dialog during file selection /// handle dialog during file selection
bool RunDialog(); bool RunDialog();
/// Handle callback from list /// Handle callback from list

3
src/insets/.cvsignore Normal file
View File

@ -0,0 +1,3 @@
Makefile.in
Makefile
*.deps

View File

@ -32,13 +32,13 @@ extern long int background_pixels;
#include <config.h> #include <config.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <csignal>
#include <sys/wait.h> #include <sys/wait.h>
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
#include <stdlib.h> #include <cstdlib>
#include <ctype.h> #include <cctype>
#include <math.h> #include <cmath>
#include "form1.h" #include "form1.h"
#include "figinset.h" #include "figinset.h"
@ -46,7 +46,7 @@ extern long int background_pixels;
#include "lyx_main.h" #include "lyx_main.h"
#include "buffer.h" #include "buffer.h"
#include "filedlg.h" #include "filedlg.h"
#include "filetools.h" #include "support/filetools.h"
#include "LyXView.h" // just because of form_main #include "LyXView.h" // just because of form_main
#include "error.h" #include "error.h"
#include "lyxdraw.h" #include "lyxdraw.h"
@ -54,13 +54,7 @@ extern long int background_pixels;
#include "lyxrc.h" #include "lyxrc.h"
#include "gettext.h" #include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB #include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "FileInfo.h" #include "support/FileInfo.h"
// $Id: figinset.C,v 1.1 1999/09/27 18:44:38 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: figinset.C,v 1.1 1999/09/27 18:44:38 larsbj Exp $";
#endif /* lint */
extern BufferView *current_view; extern BufferView *current_view;
static volatile bool alarmed; static volatile bool alarmed;
@ -103,7 +97,7 @@ struct pidwait {
static Figref **figures; /* all the figures */ static Figref **figures; /* all the figures */
static figdata **bitmaps; /* all the bitmaps */ static figdata **bitmaps; /* all the bitmaps */
static queue *gsqueue = NULL; /* queue for ghostscripting */ static queue *gsqueue = 0; /* queue for ghostscripting */
static int gsrunning = 0; /* currently so many gs's are running */ static int gsrunning = 0; /* currently so many gs's are running */
static bool bitmap_waiting = false; /* bitmaps are waiting finished */ static bool bitmap_waiting = false; /* bitmaps are waiting finished */
static char bittable[256]; /* bit reversion table */ static char bittable[256]; /* bit reversion table */
@ -117,7 +111,7 @@ static int gs_spc; // shades per color
static bool gs_gray; // is grayscale? static bool gs_gray; // is grayscale?
static int gs_allcolors; // number of all colors static int gs_allcolors; // number of all colors
static pidwait *pw = NULL; // pid wait list static pidwait *pw = 0; // pid wait list
extern FD_form_main *fd_form_main; extern FD_form_main *fd_form_main;
@ -133,10 +127,10 @@ void addpidwait(int pid)
pw = p; pw = p;
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr.print(LString("Pids to wait for: ") + int(p->pid)); lyxerr.print(string("Pids to wait for: ") + tostr(p->pid));
while (p->next) { while (p->next) {
p = p->next; p = p->next;
lyxerr.print(LString() + int(p->pid)); lyxerr.print(string() + tostr(p->pid));
} }
} }
} }
@ -195,13 +189,13 @@ int GhostscriptMsg(FL_OBJECT *, Window, int, int,
// register child // register child
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr.print( lyxerr.print(
LString("Spawned child ") string("Spawned child ")
+ int(forkstat)); + tostr(forkstat));
} }
addpidwait(forkstat); addpidwait(forkstat);
break; // in parent process break; // in parent process
} else { } else {
tmpdisp = XOpenDisplay(XDisplayName(NULL)); tmpdisp = XOpenDisplay(XDisplayName(0));
XFlush(tmpdisp); XFlush(tmpdisp);
} }
im = XGetImage(tmpdisp, p->bitmap, 0, 0, im = XGetImage(tmpdisp, p->bitmap, 0, 0,
@ -247,8 +241,8 @@ int GhostscriptMsg(FL_OBJECT *, Window, int, int,
} }
noim: noim:
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr.print(LString("Killing gs ") lyxerr.print(string("Killing gs ")
+ int(p->gspid)); + tostr(p->gspid));
} }
kill(p->gspid, SIGHUP); kill(p->gspid, SIGHUP);
@ -262,8 +256,8 @@ int GhostscriptMsg(FL_OBJECT *, Window, int, int,
} }
} else { } else {
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr.print(LString("Killing gs ") lyxerr.print(string("Killing gs ")
+int(p->gspid)); +tostr(p->gspid));
} }
kill(p->gspid, SIGHUP); kill(p->gspid, SIGHUP);
@ -303,8 +297,8 @@ static void AllocColors(int num)
if (i) XFreeColors(fl_display, color_map, if (i) XFreeColors(fl_display, color_map,
gs_pixels, i, 0); gs_pixels, i, 0);
if(lyxerr.debugging()) { if(lyxerr.debugging()) {
lyxerr.print(LString("Cannot allocate color cube " ) lyxerr.print(string("Cannot allocate color cube " )
+ int(num)); + tostr(num));
} }
AllocColors(num-1); AllocColors(num-1);
return; return;
@ -325,8 +319,8 @@ static void AllocGrays(int num)
int i; int i;
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr.print(LString("Allocating grayscale ramp ") lyxerr.print(string("Allocating grayscale ramp ")
+ int(num)); + tostr(num));
} }
if (num < 4) { if (num < 4) {
@ -342,8 +336,8 @@ static void AllocGrays(int num)
if (i) XFreeColors(fl_display, color_map, if (i) XFreeColors(fl_display, color_map,
gs_pixels, i, 0); gs_pixels, i, 0);
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr.print(LString("Cannot allocate grayscale ") lyxerr.print(string("Cannot allocate grayscale ")
+ int(num)); + tostr(num));
} }
AllocGrays(num/2); AllocGrays(num/2);
return; return;
@ -441,7 +435,7 @@ int FindBmpIndex(figdata *tmpdata)
static void chpixmap(Pixmap, int, int) static void chpixmap(Pixmap, int, int)
{ {
Display* tempdisp = XOpenDisplay(XDisplayName(NULL)); Display* tempdisp = XOpenDisplay(XDisplayName(0));
// here read the pixmap and change all colors to those we // here read the pixmap and change all colors to those we
// have allocated // have allocated
@ -525,7 +519,7 @@ static void runqueue()
if (pid == 0) { // child if (pid == 0) { // child
char **env, rbuf[80], gbuf[40]; char **env, rbuf[80], gbuf[40];
int ne = 0; int ne = 0;
Display* tempdisp = XOpenDisplay(XDisplayName(NULL)); Display* tempdisp = XOpenDisplay(XDisplayName(0));
// create translation file // create translation file
sprintf(tbuf, "%s/~lyxgs%d.ps", system_tempdir.c_str(), sprintf(tbuf, "%s/~lyxgs%d.ps", system_tempdir.c_str(),
@ -561,7 +555,7 @@ static void runqueue()
//#warning BUG seems that the only bug here might be the hardcoded dpi.. Bummer! //#warning BUG seems that the only bug here might be the hardcoded dpi.. Bummer!
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr.print(LString("Will set GHOSTVIEW" lyxerr.print(string("Will set GHOSTVIEW"
" property to [") + " property to [") +
tbuf + "]"); tbuf + "]");
} }
@ -596,8 +590,8 @@ static void runqueue()
// deletes it // deletes it
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr.print("Releasing the server"); lyxerr.print("Releasing the server");
lyxerr.print(LString('[') + lyxerr.print(string("[") +
int(getpid()) + tostr(getpid()) +
"] GHOSTVIEW property" "] GHOSTVIEW property"
" found. Waiting."); " found. Waiting.");
} }
@ -685,20 +679,20 @@ static void runqueue()
"-dSAFER", "-dSAFER",
rbuf, gbuf, tbuf, rbuf, gbuf, tbuf,
p->data->fname.c_str(), p->data->fname.c_str(),
"showpage.ps", "quit.ps", "-", NULL); "showpage.ps", "quit.ps", "-", 0);
// if we are still there, an error occurred. // if we are still there, an error occurred.
lyxerr.print(LString("Error executing ghostscript. ") lyxerr.print(string("Error executing ghostscript. ")
+"Code: "+err); + "Code: " + tostr(err));
lyxerr.debug("Cmd: " lyxerr.debug("Cmd: "
+ lyxrc->ps_command + lyxrc->ps_command
+" -sDEVICE=x11 " +" -sDEVICE=x11 "
+ tbuf + LString(' ') + tbuf + tostr(' ')
+ p->data->fname); + p->data->fname);
_exit(0); // no gs? _exit(0); // no gs?
} }
// normal process (parent) // normal process (parent)
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr.print(LString("GS [") + int(pid) + "] started"); lyxerr.print(string("GS [") + tostr(pid) + "] started");
} }
gsqueue = gsqueue->next; gsqueue = gsqueue->next;
gsrunning++; gsrunning++;
@ -719,7 +713,7 @@ static void addwait(int psx, int psy, int pswid, int pshgh, figdata *data)
p->ry = ((float)data->raw_hgh*72)/pshgh; p->ry = ((float)data->raw_hgh*72)/pshgh;
p->data = data; p->data = data;
p->next = NULL; p->next = 0;
// now put into queue // now put into queue
p2 = gsqueue; p2 = gsqueue;
@ -734,7 +728,7 @@ static void addwait(int psx, int psy, int pswid, int pshgh, figdata *data)
} }
static figdata *getfigdata(int wid, int hgh, LString const & fname, static figdata *getfigdata(int wid, int hgh, string const & fname,
int psx, int psy, int pswid, int pshgh, int psx, int psy, int pswid, int pshgh,
int raw_wid, int raw_hgh, float angle, char flags) int raw_wid, int raw_hgh, float angle, char flags)
{ {
@ -743,7 +737,7 @@ static figdata *getfigdata(int wid, int hgh, LString const & fname,
figdata *p; figdata *p;
XWindowAttributes wa; XWindowAttributes wa;
if (fname.empty()) return NULL; if (fname.empty()) return 0;
while (i < bmpinsref) { while (i < bmpinsref) {
if (bitmaps[i]->wid == wid && bitmaps[i]->hgh == hgh && if (bitmaps[i]->wid == wid && bitmaps[i]->hgh == hgh &&
@ -754,7 +748,7 @@ static figdata *getfigdata(int wid, int hgh, LString const & fname,
} }
++i; ++i;
} }
/* not found -> create new record or return NULL if no record */ /* not found -> create new record or return 0 if no record */
++bmpinsref; ++bmpinsref;
if (bmpinsref > bmparrsize) { if (bmpinsref > bmparrsize) {
// allocate more space // allocate more space
@ -831,7 +825,7 @@ void sigchldchecker(pid_t pid, int *status)
bool pid_handled = false; bool pid_handled = false;
lyxerr.debug(LString("Got pid = ") + long (pid)); lyxerr.debug(string("Got pid = ") + tostr(pid));
pid_handled = false; pid_handled = false;
for (i = bmpinsref - 1; i >= 0; --i) { for (i = bmpinsref - 1; i >= 0; --i) {
if (bitmaps[i]->reading && pid == bitmaps[i]->gspid) { if (bitmaps[i]->reading && pid == bitmaps[i]->gspid) {
@ -841,7 +835,7 @@ void sigchldchecker(pid_t pid, int *status)
p->reading = false; p->reading = false;
if (bitmaps[i]->gsdone) *status = 0; if (bitmaps[i]->gsdone) *status = 0;
if (*status == 0) { if (*status == 0) {
lyxerr.debug(LString("GS [") + int(pid) + lyxerr.debug(string("GS [") + tostr(pid) +
"] exit OK."); "] exit OK.");
} else { } else {
fprintf(stderr, "GS [%ld] error %d E:%d %d S:%d %d\n", long(pid), fprintf(stderr, "GS [%ld] error %d E:%d %d S:%d %d\n", long(pid),
@ -869,11 +863,11 @@ void sigchldchecker(pid_t pid, int *status)
} }
if (!pid_handled) { if (!pid_handled) {
lyxerr.debug("Checking pid in pidwait"); lyxerr.debug("Checking pid in pidwait");
pidwait *p = pw, *prev = NULL; pidwait *p = pw, *prev = 0;
while (p) { while (p) {
if (pid == p->pid) { if (pid == p->pid) {
lyxerr.debug("Found pid in pidwait"); lyxerr.debug("Found pid in pidwait");
lyxerr.debug(LString("Caught child pid of recompute routine ") + int(pid)); lyxerr.debug(string("Caught child pid of recompute routine ") + tostr(pid));
if (prev) if (prev)
prev->next = p->next; prev->next = p->next;
else else
@ -932,7 +926,7 @@ static void RegisterFigure(InsetFig *fi)
Figref *tmpfig; Figref *tmpfig;
if (figinsref == 0) InitFigures(); if (figinsref == 0) InitFigures();
fi->form = NULL; fi->form = 0;
++figinsref; ++figinsref;
if (figinsref > figarrsize) { if (figinsref > figarrsize) {
// allocate more space // allocate more space
@ -943,14 +937,14 @@ static void RegisterFigure(InsetFig *fi)
figures = tmp; figures = tmp;
} }
tmpfig = new Figref; tmpfig = new Figref;
tmpfig->data = NULL; tmpfig->data = 0;
tmpfig->inset = fi; tmpfig->inset = fi;
figures[figinsref-1] = tmpfig; figures[figinsref-1] = tmpfig;
fi->figure = tmpfig; fi->figure = tmpfig;
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr.print(LString("Register Figure: buffer:[") + lyxerr.print(string("Register Figure: buffer:[") +
long(current_view->currentBuffer()) + "]"); tostr(current_view->currentBuffer()) + "]");
} }
} }
@ -977,7 +971,7 @@ static void UnregisterFigure(InsetFig *fi)
fl_hide_form(tmpfig->inset->form->Figure); fl_hide_form(tmpfig->inset->form->Figure);
fl_free_form(tmpfig->inset->form->Figure); fl_free_form(tmpfig->inset->form->Figure);
free(tmpfig->inset->form); free(tmpfig->inset->form);
tmpfig->inset->form = NULL; tmpfig->inset->form = 0;
} }
i = FindFigIndex(tmpfig); i = FindFigIndex(tmpfig);
--figinsref; --figinsref;
@ -993,7 +987,7 @@ static void UnregisterFigure(InsetFig *fi)
static char* NextToken(FILE *myfile) static char* NextToken(FILE *myfile)
{ {
char* token = NULL; char* token = 0;
char c; char c;
int i = 0; int i = 0;
@ -1091,7 +1085,7 @@ void InsetFig::Draw(LyXFont font, LyXScreen &scr, int baseline, float &x)
font.setFamily (LyXFont::SANS_FAMILY); font.setFamily (LyXFont::SANS_FAMILY);
font.setSize (LyXFont::SIZE_FOOTNOTE); font.setSize (LyXFont::SIZE_FOOTNOTE);
LString justname = OnlyFilename (fname); string justname = OnlyFilename (fname);
font.drawString(justname,pm, font.drawString(justname,pm,
baseline - font.maxAscent() - 4, baseline - font.maxAscent() - 4,
(int) x + 8); (int) x + 8);
@ -1110,8 +1104,8 @@ void InsetFig::Write(FILE *file)
Regenerate(); Regenerate();
fprintf(file, "Figure size %d %d\n", wid, hgh); fprintf(file, "Figure size %d %d\n", wid, hgh);
if (!fname.empty()) { if (!fname.empty()) {
LString buf1 = OnlyPath(owner->getFileName()); string buf1 = OnlyPath(owner->getFileName());
LString fname2 = MakeRelPath(fname, buf1); string fname2 = MakeRelPath(fname, buf1);
fprintf(file, "file %s\n", fname2.c_str()); fprintf(file, "file %s\n", fname2.c_str());
} }
if (!subcaption.empty()) if (!subcaption.empty())
@ -1126,13 +1120,13 @@ void InsetFig::Write(FILE *file)
void InsetFig::Read(LyXLex &lex) void InsetFig::Read(LyXLex &lex)
{ {
LString buf; string buf;
bool finished = false; bool finished = false;
while (lex.IsOK() && !finished) { while (lex.IsOK() && !finished) {
lex.next(); lex.next();
LString const token = lex.GetString(); string const token = lex.GetString();
lyxerr.debug("Token: " + token); lyxerr.debug("Token: " + token);
if (token.empty()) if (token.empty())
@ -1142,7 +1136,7 @@ void InsetFig::Read(LyXLex &lex)
} else if (token == "file") { } else if (token == "file") {
if (lex.next()) { if (lex.next()) {
buf = lex.GetString(); buf = lex.GetString();
LString buf1 = OnlyPath(owner->getFileName()); string buf1 = OnlyPath(owner->getFileName());
fname = MakeAbsPath(buf, buf1); fname = MakeAbsPath(buf, buf1);
changedfname = true; changedfname = true;
} }
@ -1216,7 +1210,7 @@ int InsetFig::Latex(FILE *file, signed char /* fragile*/ )
} }
int InsetFig::Latex(LString &file, signed char /* fragile*/ ) int InsetFig::Latex(string &file, signed char /* fragile*/ )
{ {
Regenerate(); Regenerate();
file += cmd + ' '; file += cmd + ' ';
@ -1224,18 +1218,18 @@ int InsetFig::Latex(LString &file, signed char /* fragile*/ )
} }
int InsetFig::Linuxdoc(LString &/*file*/) int InsetFig::Linuxdoc(string &/*file*/)
{ {
return 0; return 0;
} }
int InsetFig::DocBook(LString &file) int InsetFig::DocBook(string &file)
{ {
LString figurename=fname; string figurename=fname;
if(figurename.suffixIs(".eps")) if(suffixIs(figurename, ".eps"))
figurename=figurename.substring(0,fname.length()-5); figurename.erase(fname.length() - 5);
file += "@<graphic fileref=\"" + figurename + "\"></graphic>"; file += "@<graphic fileref=\"" + figurename + "\"></graphic>";
return 0; return 0;
@ -1274,7 +1268,7 @@ void InsetFig::Edit(int, int)
if (!form) { if (!form) {
form = create_form_Figure(); form = create_form_Figure();
fl_set_form_atclose(form->Figure, CancelCloseBoxCB, NULL); fl_set_form_atclose(form->Figure, CancelCloseBoxCB, 0);
fl_set_object_return(form->Angle,FL_RETURN_ALWAYS); fl_set_object_return(form->Angle,FL_RETURN_ALWAYS);
fl_set_object_return(form->Width,FL_RETURN_ALWAYS); fl_set_object_return(form->Width,FL_RETURN_ALWAYS);
fl_set_object_return(form->Height,FL_RETURN_ALWAYS); fl_set_object_return(form->Height,FL_RETURN_ALWAYS);
@ -1321,7 +1315,7 @@ Inset *InsetFig::Clone()
tmp->figure->data = getfigdata(wid, hgh, fname, psx, psy, tmp->figure->data = getfigdata(wid, hgh, fname, psx, psy,
pswid, pshgh, raw_wid, raw_hgh, pswid, pshgh, raw_wid, raw_hgh,
angle, flags & (3|8)); angle, flags & (3|8));
} else tmp->figure->data = NULL; } else tmp->figure->data = 0;
tmp->subcaption = subcaption; tmp->subcaption = subcaption;
tmp->changedfname = false; tmp->changedfname = false;
tmp->owner = owner; tmp->owner = owner;
@ -1338,10 +1332,10 @@ Inset::Code InsetFig::LyxCode() const
void InsetFig::Regenerate() void InsetFig::Regenerate()
{ {
LString cmdbuf; string cmdbuf;
LString gcmd; string gcmd;
LString resizeW, resizeH; string resizeW, resizeH;
LString rotate, recmd; string rotate, recmd;
if (fname.empty()) { if (fname.empty()) {
cmd = "\\fbox{\\rule[-0.5in]{0pt}{1in}"; cmd = "\\fbox{\\rule[-0.5in]{0pt}{1in}";
@ -1351,8 +1345,8 @@ void InsetFig::Regenerate()
return; return;
} }
LString buf1 = OnlyPath(owner->getFileName()); string buf1 = OnlyPath(owner->getFileName());
LString fname2 = MakeRelPath(fname, buf1); string fname2 = MakeRelPath(fname, buf1);
gcmd = "\\includegraphics{" + fname2 + '}'; gcmd = "\\includegraphics{" + fname2 + '}';
@ -1464,11 +1458,11 @@ void InsetFig::Regenerate()
void InsetFig::TempRegenerate() void InsetFig::TempRegenerate()
{ {
LString gcmd; string gcmd;
LString cmdbuf; string cmdbuf;
LString resizeW, resizeH; string resizeW, resizeH;
LString rotate, recmd; string rotate, recmd;
LString tsubcap; string tsubcap;
char const *tfname; // *textra; char const *tfname; // *textra;
float tangle, txwid, txhgh; float tangle, txwid, txhgh;
@ -1488,8 +1482,8 @@ void InsetFig::TempRegenerate()
return; return;
} }
LString buf1 = OnlyPath(owner->getFileName()); string buf1 = OnlyPath(owner->getFileName());
LString fname2 = MakeRelPath(tfname, buf1); string fname2 = MakeRelPath(tfname, buf1);
// \includegraphics*[<llx,lly>][<urx,ury>]{file} // \includegraphics*[<llx,lly>][<urx,ury>]{file}
gcmd = "\\includegraphics{" + fname2 + '}'; gcmd = "\\includegraphics{" + fname2 + '}';
@ -1586,8 +1580,8 @@ void InsetFig::TempRegenerate()
if (!rotate.empty()) cmdbuf += '}'; if (!rotate.empty()) cmdbuf += '}';
if (!recmd.empty()) cmdbuf += '}'; if (!recmd.empty()) cmdbuf += '}';
if (psubfigure && !tsubcap.empty()) { if (psubfigure && !tsubcap.empty()) {
cmdbuf = LString("\\subfigure{") + tsubcap cmdbuf = string("\\subfigure{") + tsubcap
+ LString("}{") + cmdbuf + "}"; + string("}{") + cmdbuf + "}";
} }
@ -1697,7 +1691,7 @@ void InsetFig::Recompute()
psx, psy, pswid, pshgh, psx, psy, pswid, pshgh,
raw_wid, raw_hgh, raw_wid, raw_hgh,
angle, flags & (3|8)); angle, flags & (3|8));
} else figure->data = NULL; } else figure->data = 0;
// free the old data // free the old data
if (pf) freefigdata(pf); if (pf) freefigdata(pf);
@ -1711,7 +1705,7 @@ void InsetFig::GetPSSizes()
{ {
/* get %%BoundingBox: from postscript file */ /* get %%BoundingBox: from postscript file */
int lastchar, c; int lastchar, c;
char *p = NULL; char *p = 0;
/* defaults to associated size /* defaults to associated size
* ..just in case the PS-file is not readable (Henner,24-Aug-97) * ..just in case the PS-file is not readable (Henner,24-Aug-97)
@ -1764,7 +1758,7 @@ void InsetFig::GetPSSizes()
} }
c = 0; c = 0;
delete[] p; delete[] p;
p = NULL; p = 0;
} }
lastchar = c; lastchar = c;
} }
@ -1896,13 +1890,13 @@ void InsetFig::CallbackFig(long arg)
angle = atof(fl_get_input(form->Angle)); angle = atof(fl_get_input(form->Angle));
p = fl_get_input(form->EpsFile); p = fl_get_input(form->EpsFile);
if (p && *p) { if (p && *p) {
LString buf1 = OnlyPath(owner->getFileName()); string buf1 = OnlyPath(owner->getFileName());
fname = MakeAbsPath(p, buf1); fname = MakeAbsPath(p, buf1);
changedfname = true; changedfname = true;
} else { } else {
if (!fname.empty()) { if (!fname.empty()) {
changedfname = true; changedfname = true;
fname.clean(); fname.erase();
} }
} }
subcaption = fl_get_input(form->Subcaption); subcaption = fl_get_input(form->Subcaption);
@ -1918,7 +1912,7 @@ void InsetFig::CallbackFig(long arg)
fl_hide_form(form->Figure); fl_hide_form(form->Figure);
fl_free_form(form->Figure); fl_free_form(form->Figure);
free(form); free(form);
form = NULL; form = 0;
} }
break; break;
} //if not readonly } //if not readonly
@ -1930,7 +1924,7 @@ void InsetFig::CallbackFig(long arg)
fl_hide_form(form->Figure); fl_hide_form(form->Figure);
fl_free_form(form->Figure); fl_free_form(form->Figure);
free(form); free(form);
form = NULL; form = 0;
break; break;
} }
@ -2056,8 +2050,8 @@ void InsetFig::RestoreForm()
sprintf(buf, "%g", angle); sprintf(buf, "%g", angle);
fl_set_input(form->Angle, buf); fl_set_input(form->Angle, buf);
if (!fname.empty()){ if (!fname.empty()){
LString buf1 = OnlyPath(owner->getFileName()); string buf1 = OnlyPath(owner->getFileName());
LString fname2 = MakeRelPath(fname, buf1); string fname2 = MakeRelPath(fname, buf1);
fl_set_input(form->EpsFile, fname2.c_str()); fl_set_input(form->EpsFile, fname2.c_str());
} }
else fl_set_input(form->EpsFile, ""); else fl_set_input(form->EpsFile, "");
@ -2084,29 +2078,29 @@ void InsetFig::Preview(char const *p)
return; // parent process return; // parent process
} }
LString buf1 = OnlyPath(owner->getFileName()); string buf1 = OnlyPath(owner->getFileName());
LString buf2 = MakeAbsPath(p, buf1); string buf2 = MakeAbsPath(p, buf1);
lyxerr.print(LString("Error during rendering ") + lyxerr.print(string("Error during rendering ") +
int(execlp(lyxrc->view_pspic_command.c_str(), tostr(execlp(lyxrc->view_pspic_command.c_str(),
lyxrc->view_pspic_command.c_str(), lyxrc->view_pspic_command.c_str(),
buf2.c_str(), buf2.c_str(),
NULL))); 0)));
_exit(0); _exit(0);
} }
void InsetFig::BrowseFile() void InsetFig::BrowseFile()
{ {
LString buf, buf2, bufclip; string buf, buf2, bufclip;
static LString current_figure_path; static string current_figure_path;
static int once = 0; static int once = 0;
LyXFileDlg fileDlg; LyXFileDlg fileDlg;
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
fprintf(stderr, "Filename: %s\n", owner->getFileName().c_str()); fprintf(stderr, "Filename: %s\n", owner->getFileName().c_str());
} }
LString p = fl_get_input(form->EpsFile); string p = fl_get_input(form->EpsFile);
buf = MakeAbsPath(owner->getFileName()); buf = MakeAbsPath(owner->getFileName());
buf2 = OnlyPath(buf); buf2 = OnlyPath(buf);
@ -2133,10 +2127,10 @@ void InsetFig::BrowseFile()
ProhibitInput(); ProhibitInput();
if (once) { if (once) {
p =fileDlg.Select(_("EPS Figure"), current_figure_path, p =fileDlg.Select(_("EPS Figure"), current_figure_path,
"*ps", LString()); "*ps", string());
} else { } else {
p = fileDlg.Select(_("EPS Figure"), buf, p = fileDlg.Select(_("EPS Figure"), buf,
"*ps", LString()); "*ps", string());
} }
AllowInput(); AllowInput();
@ -2146,8 +2140,8 @@ void InsetFig::BrowseFile()
current_figure_path = OnlyPath(p); current_figure_path = OnlyPath(p);
once = 1; once = 1;
if (p.contains("#") || p.contains("~") || p.contains("$") if (contains(p, "#") || contains(p, "~") || contains(p, "$")
|| p.contains("%") || p.contains(" ")) || contains(p, "%") || contains(p, " "))
{ {
WriteAlert(_("Filename can't contain any of these characters:"), // xgettext:no-c-format WriteAlert(_("Filename can't contain any of these characters:"), // xgettext:no-c-format
_("space, '#', '~', '$' or '%'.")); _("space, '#', '~', '$' or '%'."));
@ -2164,7 +2158,7 @@ void GraphicsCB(FL_OBJECT *obj, long arg)
/* obj->form contains the form */ /* obj->form contains the form */
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr.print(LString("GraphicsCB callback: ") + long(arg)); lyxerr.print(string("GraphicsCB callback: ") + tostr(arg));
} }
/* find inset we were reacting to */ /* find inset we were reacting to */
@ -2173,8 +2167,8 @@ void GraphicsCB(FL_OBJECT *obj, long arg)
== obj->form) { == obj->form) {
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr.print(LString("Calling back figure ") lyxerr.print(string("Calling back figure ")
+int(i)); + tostr(i));
} }
figures[i]->inset->CallbackFig(arg); figures[i]->inset->CallbackFig(arg);
return; return;
@ -2188,8 +2182,8 @@ void HideFiguresPopups()
if (figures[i]->inset->form if (figures[i]->inset->form
&& figures[i]->inset->form->Figure->visible) { && figures[i]->inset->form->Figure->visible) {
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr.print(LString("Hiding figure ") lyxerr.print(string("Hiding figure ")
+int(i)); + tostr(i));
} }
// hide and free the form // hide and free the form
figures[i]->inset->CallbackFig(9); figures[i]->inset->CallbackFig(9);

View File

@ -38,11 +38,11 @@ public:
/// ///
int Latex(FILE *file, signed char fragile); int Latex(FILE *file, signed char fragile);
/// ///
int Latex(LString &file, signed char fragile); int Latex(string &file, signed char fragile);
/// ///
int Linuxdoc(LString &file); int Linuxdoc(string &file);
/// ///
int DocBook(LString &file); int DocBook(string &file);
/// Updates needed features for this inset. /// Updates needed features for this inset.
void Validate(LaTeXFeatures &features) const; void Validate(LaTeXFeatures &features) const;
@ -79,7 +79,7 @@ public:
int psx, psy; int psx, psy;
/// .eps file name /// .eps file name
LString fname; string fname;
/// changed filename -> for recompute /// changed filename -> for recompute
bool changedfname; bool changedfname;
@ -115,10 +115,10 @@ public:
float angle; float angle;
/// graphics command, latex version /// graphics command, latex version
LString cmd; string cmd;
/// Caption for subfigure package /// Caption for subfigure package
LString subcaption; string subcaption;
/// various flags /// various flags
int flags; int flags;
@ -160,7 +160,7 @@ struct figdata {
/// width and height on screen /// width and height on screen
int wid, hgh; int wid, hgh;
/// pointer to file name /// pointer to file name
LString fname; string fname;
/// type; 0-none, 1-B/W, 2-Grayscale, 3-Color /// type; 0-none, 1-B/W, 2-Grayscale, 3-Color
char flags; char flags;
/// reading request is pending on this figure /// reading request is pending on this figure

View File

@ -3,10 +3,10 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
*======================================================*/ * ======================================================*/
#include <config.h> #include <config.h>
@ -16,12 +16,7 @@
#include "lyxinset.h" #include "lyxinset.h"
#include "error.h" #include "error.h"
#include "support/lstrings.h"
// $Id: inset.C,v 1.1 1999/09/27 18:44:38 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: inset.C,v 1.1 1999/09/27 18:44:38 larsbj Exp $";
#endif /* lint */
/* Insets default methods */ /* Insets default methods */
@ -76,15 +71,15 @@ LyXFont Inset::ConvertFont(LyXFont font)
void UpdatableInset::InsetButtonPress(int x, int y, int button) void UpdatableInset::InsetButtonPress(int x, int y, int button)
{ {
lyxerr.debug(LString("Inset Button Press x=")+ x + lyxerr.debug(string("Inset Button Press x=")+ tostr(x) +
", y=" + y + ", button=" + button); ", y=" + tostr(y) + ", button=" + tostr(button));
} }
void UpdatableInset::InsetButtonRelease(int x, int y, int button) void UpdatableInset::InsetButtonRelease(int x, int y, int button)
{ {
lyxerr.debug(LString("Inset Button Release x=")+ x + lyxerr.debug(string("Inset Button Release x=")+ tostr(x) +
", y=" + y + ", button=" + button); ", y=" + tostr(y) + ", button=" + tostr(button));
} }
@ -96,8 +91,8 @@ void UpdatableInset::InsetKeyPress(XKeyEvent *)
void UpdatableInset::InsetMotionNotify(int x, int y, int state) void UpdatableInset::InsetMotionNotify(int x, int y, int state)
{ {
lyxerr.debug(LString("Inset Motion Notify x=")+ x + lyxerr.debug(string("Inset Motion Notify x=")+ tostr(x) +
", y=" + y + ", state=" + state); ", y=" + tostr(y) + ", state=" + tostr(state));
} }

View File

@ -1,7 +1,7 @@
#include <config.h> #include <config.h>
#include <stdlib.h> #include <cstdlib>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
@ -17,13 +17,13 @@
#include "gettext.h" #include "gettext.h"
#include "bibforms.h" #include "bibforms.h"
#include "lyxtext.h" #include "lyxtext.h"
#include "filetools.h" #include "support/filetools.h"
extern BufferView *current_view; extern BufferView *current_view;
FD_citation_form *citation_form=0; FD_citation_form *citation_form=0;
FD_bibitem_form *bibitem_form=0; FD_bibitem_form *bibitem_form=0;
static Combox *bibcombox = NULL; static Combox *bibcombox = 0;
extern void UpdateInset(Inset* inset, bool mark_dirty = true); extern void UpdateInset(Inset* inset, bool mark_dirty = true);
void BibitemUpdate(Combox *); void BibitemUpdate(Combox *);
@ -151,7 +151,7 @@ FD_bibitem_form *create_form_bibitem_form(void)
/*---------------------------------------*/ /*---------------------------------------*/
InsetCitation::InsetCitation(LString const & key, LString const & note): InsetCitation::InsetCitation(string const & key, string const & note):
InsetCommand("cite", key, note) InsetCommand("cite", key, note)
{ {
@ -173,7 +173,7 @@ void InsetCitation::Edit(int, int)
if (!citation_form) { if (!citation_form) {
citation_form = create_form_citation_form(); citation_form = create_form_citation_form();
fl_set_form_atclose(citation_form->citation_form, fl_set_form_atclose(citation_form->citation_form,
CancelCloseBoxCB, NULL); CancelCloseBoxCB, 0);
} }
citation_form->vdata = this; citation_form->vdata = this;
@ -191,21 +191,21 @@ void InsetCitation::Edit(int, int)
} }
LString InsetCitation::getScreenLabel() const string InsetCitation::getScreenLabel() const
{ {
LString temp('['); string temp("[");
temp+=contents; temp += contents;
if (!options.empty()) { if (!options.empty()) {
temp+=","+options; temp += "," + options;
} }
return temp+']'; return temp + ']';
} }
InsetBibKey::InsetBibKey(LString const & key, LString const & label): InsetBibKey::InsetBibKey(string const & key, string const & label):
InsetCommand("bibitem", key, label) InsetCommand("bibitem", key, label)
{ {
counter = 1; counter = 1;
@ -242,7 +242,7 @@ void InsetBibKey::setCounter(int c)
// of time cause LyX3 won't use lyxlex anyway. (ale) // of time cause LyX3 won't use lyxlex anyway. (ale)
void InsetBibKey::Write(FILE *file) void InsetBibKey::Write(FILE *file)
{ {
LString s; string s;
if (!options.empty()) { if (!options.empty()) {
s += '['; s += '[';
s += options + ']'; s += options + ']';
@ -253,13 +253,12 @@ void InsetBibKey::Write(FILE *file)
} }
LString InsetBibKey::getScreenLabel() const string InsetBibKey::getScreenLabel() const
{ {
if (!options.empty()) if (!options.empty())
return options; return options;
LString s; return tostr(counter);
return s + counter;
} }
@ -276,7 +275,7 @@ void InsetBibKey::Edit(int, int)
if (!bibitem_form) { if (!bibitem_form) {
bibitem_form = create_form_bibitem_form(); bibitem_form = create_form_bibitem_form();
fl_set_form_atclose(bibitem_form->bibitem_form, fl_set_form_atclose(bibitem_form->bibitem_form,
CancelCloseBoxCB, NULL); CancelCloseBoxCB, 0);
} }
bibitem_form->vdata = this; bibitem_form->vdata = this;
// InsetBibtex uses the same form, with different labels // InsetBibtex uses the same form, with different labels
@ -297,7 +296,7 @@ void InsetBibKey::Edit(int, int)
InsetBibtex::InsetBibtex(LString const & dbase, LString const & style, InsetBibtex::InsetBibtex(string const & dbase, string const & style,
Buffer *o) Buffer *o)
:InsetCommand("BibTeX", dbase, style), owner(o) :InsetCommand("BibTeX", dbase, style), owner(o)
{ {
@ -309,7 +308,7 @@ InsetBibtex::~InsetBibtex()
} }
LString InsetBibtex::getScreenLabel() const string InsetBibtex::getScreenLabel() const
{ {
return _("BibTeX Generated References"); return _("BibTeX Generated References");
} }
@ -317,7 +316,7 @@ LString InsetBibtex::getScreenLabel() const
int InsetBibtex::Latex(FILE *file, signed char /*fragile*/) int InsetBibtex::Latex(FILE *file, signed char /*fragile*/)
{ {
LString bib; string bib;
signed char dummy = 0; signed char dummy = 0;
int result = Latex(bib, dummy); int result = Latex(bib, dummy);
fprintf(file, "%s", bib.c_str()); fprintf(file, "%s", bib.c_str());
@ -325,7 +324,7 @@ int InsetBibtex::Latex(FILE *file, signed char /*fragile*/)
} }
int InsetBibtex::Latex(LString &file, signed char /*fragile*/) int InsetBibtex::Latex(string &file, signed char /*fragile*/)
{ {
// this looks like an horrible hack and it is :) The problem // this looks like an horrible hack and it is :) The problem
// is that owner is not initialized correctly when the bib // is that owner is not initialized correctly when the bib
@ -337,21 +336,20 @@ int InsetBibtex::Latex(LString &file, signed char /*fragile*/)
// If we generate in a temp dir, we might need to give an // If we generate in a temp dir, we might need to give an
// absolute path there. This is a bit complicated since we can // absolute path there. This is a bit complicated since we can
// have a comma-separated list of bibliographies // have a comma-separated list of bibliographies
LString db_in, adb, db_out; string db_in, adb, db_out;
db_in = getContents(); db_in = getContents();
db_in.split(adb, ','); db_in=split(db_in, adb, ',');
while(!adb.empty()) { while(!adb.empty()) {
if (!owner->niceFile && if (!owner->niceFile &&
IsFileReadable(MakeAbsPath(adb,owner->filepath)+".bib")) IsFileReadable(MakeAbsPath(adb,owner->filepath)+".bib"))
adb = MakeAbsPath(adb,owner->filepath); adb = MakeAbsPath(adb,owner->filepath);
db_out += adb; db_out += adb;
db_out += ','; db_out += ',';
db_in.split(adb,','); db_in=split(db_in, adb,',');
} }
db_out.strip(','); db_out = strip(db_out, ',');
// Idem, but simpler // Idem, but simpler
LString style; string style;
if (!owner->niceFile if (!owner->niceFile
&& IsFileReadable(MakeAbsPath(getOptions(), owner->filepath) && IsFileReadable(MakeAbsPath(getOptions(), owner->filepath)
+ ".bst")) + ".bst"))
@ -369,7 +367,7 @@ int InsetBibtex::Latex(LString &file, signed char /*fragile*/)
} }
// This method returns a comma separated list of Bibtex entries // This method returns a comma separated list of Bibtex entries
LString InsetBibtex::getKeys() string InsetBibtex::getKeys()
{ {
// This hack is copied from InsetBibtex::Latex. // This hack is copied from InsetBibtex::Latex.
// Is it still needed? Probably yes. // Is it still needed? Probably yes.
@ -381,16 +379,16 @@ LString InsetBibtex::getKeys()
// First look for bib-file in same directory as document, // First look for bib-file in same directory as document,
// then in all directories listed in environment variable // then in all directories listed in environment variable
// BIBINPUTS // BIBINPUTS
LString bibfiles, linebuf, tmp, keys; string bibfiles, linebuf, tmp, keys;
bibfiles = getContents(); bibfiles = getContents();
bibfiles.split(tmp, ','); bibfiles=split(bibfiles, tmp, ',');
while(!tmp.empty()) { while(!tmp.empty()) {
if (IsFileReadable(MakeAbsPath(tmp,owner->filepath)+".bib")) if (IsFileReadable(MakeAbsPath(tmp,owner->filepath)+".bib"))
tmp = MakeAbsPath(tmp,owner->filepath)+".bib"; tmp = MakeAbsPath(tmp,owner->filepath)+".bib";
else { else {
tmp = FileOpenSearch(getEnvPath("BIBINPUTS"),tmp,"bib"); tmp = FileOpenSearch(GetEnvPath("BIBINPUTS"),tmp,"bib");
if (tmp.empty()) if (tmp.empty())
tmp = FileOpenSearch(getEnvPath("BIBINPUT"), tmp = FileOpenSearch(GetEnvPath("BIBINPUT"),
tmp, "bib"); tmp, "bib");
} }
// If we didn't find a matching file name just fail silently // If we didn't find a matching file name just fail silently
@ -410,24 +408,24 @@ LString InsetBibtex::getKeys()
// At end of each line check if line begins with '@' // At end of each line check if line begins with '@'
if ( c == '\n') { if ( c == '\n') {
if ( linebuf.prefixIs("@") ) { if (prefixIs(linebuf, "@") ) {
linebuf.subst('{','('); subst(linebuf, '{','(');
linebuf.split(tmp,'('); linebuf=split(linebuf, tmp,'(');
tmp.lowercase(); tmp = lowercase(tmp);
if ( ! tmp.prefixIs("@string") && !tmp.prefixIs("@preamble") ) { if (!prefixIs(tmp, "@string") && !prefixIs(tmp, "@preamble") ) {
linebuf.split(tmp,','); linebuf = split(linebuf, tmp,',');
if (!tmp.empty()) if (!tmp.empty())
keys +=tmp.strip()+","; keys += strip(tmp) + ",";
} }
} }
linebuf.clean(); linebuf.erase();
} else { } else {
linebuf += c; linebuf += c;
} }
} }
} }
// Get next file name // Get next file name
bibfiles.split(tmp, ','); bibfiles=split(bibfiles, tmp, ',');
} }
return keys; return keys;
} }
@ -438,7 +436,7 @@ void InsetBibtex::Edit(int, int)
if (!bibitem_form) { if (!bibitem_form) {
bibitem_form = create_form_bibitem_form(); bibitem_form = create_form_bibitem_form();
fl_set_form_atclose(bibitem_form->bibitem_form, fl_set_form_atclose(bibitem_form->bibitem_form,
CancelCloseBoxCB, NULL); CancelCloseBoxCB, 0);
} }
bibitem_form->vdata = this; bibitem_form->vdata = this;
@ -455,9 +453,9 @@ void InsetBibtex::Edit(int, int)
} }
bool InsetBibtex::addDatabase(LString const &db) bool InsetBibtex::addDatabase(string const &db)
{ {
if (!contents.contains(db.c_str())) { if (!contains(contents, db.c_str())) {
if (!contents.empty()) if (!contents.empty())
contents += ','; contents += ',';
contents += db; contents += db;
@ -467,17 +465,17 @@ bool InsetBibtex::addDatabase(LString const &db)
} }
bool InsetBibtex::delDatabase(LString const &db) bool InsetBibtex::delDatabase(string const &db)
{ {
if (contents.contains(db.c_str())) { if (contains(contents, db.c_str())) {
LString bd = db; string bd = db;
int n = contents.tokenPos(',', bd); int n = tokenPos(contents, ',', bd);
if (n > 0) { if (n > 0) {
LString tmp(','); string tmp(",");
tmp += bd; tmp += bd;
contents.subst(tmp.c_str(), ","); subst(contents, tmp.c_str(), ",");
} else if (n==0) } else if (n==0)
contents.split(bd, ','); contents = split(contents, bd, ',');
else else
return false; return false;
} }
@ -493,11 +491,11 @@ void BibitemUpdate(Combox* combox)
if (!current_view->available()) if (!current_view->available())
return; return;
LString tmp, bibkeys = current_view->currentBuffer()->getBibkeyList(','); string tmp, bibkeys = current_view->currentBuffer()->getBibkeyList(',');
bibkeys.split(tmp,','); bibkeys=split(bibkeys, tmp,',');
while (!tmp.empty()) { while (!tmp.empty()) {
combox->addto(tmp.c_str()); combox->addto(tmp.c_str());
bibkeys.split(tmp,','); bibkeys=split(bibkeys, tmp,',');
} }
} }
@ -522,7 +520,7 @@ int bibitemMaxWidth(const class LyXFont &font)
// ale070405 // ale070405
LString bibitemWidthest() string bibitemWidthest()
{ {
int w = 0; int w = 0;
// Does look like a hack? It is! (but will change at 0.13) // Does look like a hack? It is! (but will change at 0.13)

View File

@ -28,13 +28,13 @@ public:
/// ///
InsetCitation(): InsetCommand("cite") { } InsetCitation(): InsetCommand("cite") { }
/// ///
InsetCitation(LString const & key, LString const & note=LString()); InsetCitation(string const & key, string const & note=string());
/// ///
~InsetCitation(); ~InsetCitation();
/// ///
Inset* Clone() { return new InsetCitation(contents, options); } Inset* Clone() { return new InsetCitation(contents, options); }
/// ///
LString getScreenLabel()const; string getScreenLabel()const;
/// ///
void Edit(int, int); void Edit(int, int);
/// ///
@ -54,7 +54,7 @@ public:
/// ///
InsetBibKey(): InsetCommand("bibitem") { counter = 1; } InsetBibKey(): InsetCommand("bibitem") { counter = 1; }
/// ///
InsetBibKey(LString const & key, LString const & label=LString()); InsetBibKey(string const & key, string const & label=string());
/// ///
InsetBibKey(InsetBibKey const*); InsetBibKey(InsetBibKey const*);
/// ///
@ -64,7 +64,7 @@ public:
/// Currently \bibitem is used as a LyX2.x command, so we need this method. /// Currently \bibitem is used as a LyX2.x command, so we need this method.
void Write(FILE *); void Write(FILE *);
/// ///
virtual LString getScreenLabel() const; virtual string getScreenLabel() const;
/// ///
void Edit(int, int); void Edit(int, int);
/// ///
@ -91,37 +91,37 @@ public:
class InsetBibtex: public InsetCommand { class InsetBibtex: public InsetCommand {
public: public:
/// ///
InsetBibtex(): InsetCommand("BibTeX") { owner = NULL; } InsetBibtex(): InsetCommand("BibTeX") { owner = 0; }
/// ///
InsetBibtex(LString const & dbase, LString const & style, InsetBibtex(string const & dbase, string const & style,
Buffer *); Buffer *);
/// ///
~InsetBibtex(); ~InsetBibtex();
/// ///
Inset* Clone() { return new InsetBibtex(contents, options, NULL); } Inset* Clone() { return new InsetBibtex(contents, options, 0); }
/// ///
Inset::Code LyxCode() const Inset::Code LyxCode() const
{ {
return Inset::BIBTEX_CODE; return Inset::BIBTEX_CODE;
} }
/// ///
LString getScreenLabel() const; string getScreenLabel() const;
/// ///
void Edit(int, int); void Edit(int, int);
/// ///
int Latex(FILE *, signed char); int Latex(FILE *, signed char);
/// ///
int Latex(LString &file, signed char fragile); int Latex(string &file, signed char fragile);
/// ///
LString getKeys(); string getKeys();
/// ///
unsigned char Editable() const { unsigned char Editable() const {
return 1; return 1;
} }
/// ///
bool addDatabase(LString const&); bool addDatabase(string const&);
/// ///
bool delDatabase(LString const&); bool delDatabase(string const&);
/// ///
bool Display() const { return true; } bool Display() const { return true; }
private: private:

View File

@ -3,10 +3,10 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
*======================================================*/ * ======================================================*/
#include <config.h> #include <config.h>
@ -18,20 +18,13 @@
#include "lyxdraw.h" #include "lyxdraw.h"
#include "error.h" #include "error.h"
// $Id: insetcommand.C,v 1.1 1999/09/27 18:44:38 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: insetcommand.C,v 1.1 1999/09/27 18:44:38 larsbj Exp $";
#endif /* lint */
InsetCommand::InsetCommand() InsetCommand::InsetCommand()
{ {
} }
InsetCommand::InsetCommand(LString const & cmd, LString const & arg, InsetCommand::InsetCommand(string const & cmd, string const & arg,
LString const & opt) string const & opt)
: command(cmd), options(opt), contents(arg) : command(cmd), options(opt), contents(arg)
{ {
} }
@ -62,7 +55,7 @@ int InsetCommand::Width(LyXFont const&font) const
{ {
LyXFont f = font; LyXFont f = font;
f.decSize(); f.decSize();
LString s = getScreenLabel(); string s = getScreenLabel();
return 10 + f.stringWidth(s); return 10 + f.stringWidth(s);
} }
@ -95,7 +88,7 @@ void InsetCommand::Draw(LyXFont font, LyXScreen &scr,
Width(font)-6, Width(font)-6,
Ascent(font)+Descent(font)-2); Ascent(font)+Descent(font)-2);
} }
LString s = getScreenLabel(); string s = getScreenLabel();
LyXFont f = font; LyXFont f = font;
f.decSize(); f.decSize();
f.setColor(LyXFont::NONE); f.setColor(LyXFont::NONE);
@ -113,9 +106,9 @@ void InsetCommand::Write(FILE *file)
} }
void InsetCommand::scanCommand(LString const &cmd) void InsetCommand::scanCommand(string const &cmd)
{ {
LString tcommand, toptions, tcontents; string tcommand, toptions, tcontents;
if (cmd.empty()) return; if (cmd.empty()) return;
@ -124,7 +117,7 @@ void InsetCommand::scanCommand(LString const &cmd)
// Used to handle things like \command[foo[bar]]{foo{bar}} // Used to handle things like \command[foo[bar]]{foo{bar}}
int nestdepth = 0; int nestdepth = 0;
for (int i=0; i<cmd.length(); i++) { for (string::size_type i = 0; i < cmd.length(); ++i) {
char c = cmd[i]; char c = cmd[i];
if ((state==Command && c == ' ') || if ((state==Command && c == ' ') ||
(state==Command && c == '[') || (state==Command && c == '[') ||
@ -180,7 +173,7 @@ void InsetCommand::scanCommand(LString const &cmd)
void InsetCommand::Read(LyXLex &lex) void InsetCommand::Read(LyXLex &lex)
{ {
if (lex.EatLine()) { if (lex.EatLine()) {
LString t = lex.GetString(); string t = lex.GetString();
scanCommand(t); scanCommand(t);
} else } else
lex.printError("InsetCommand: Parse error: `$$Token'"); lex.printError("InsetCommand: Parse error: `$$Token'");
@ -194,20 +187,20 @@ int InsetCommand::Latex(FILE *file, signed char /*fragile*/)
} }
int InsetCommand::Latex(LString &file, signed char /*fragile*/) int InsetCommand::Latex(string &file, signed char /*fragile*/)
{ {
file += getCommand(); file += getCommand();
return 0; return 0;
} }
int InsetCommand::Linuxdoc(LString &/*file*/) int InsetCommand::Linuxdoc(string &/*file*/)
{ {
return 0; return 0;
} }
int InsetCommand::DocBook(LString &/*file*/) int InsetCommand::DocBook(string &/*file*/)
{ {
return 0; return 0;
} }
@ -220,9 +213,9 @@ Inset* InsetCommand::Clone()
} }
LString InsetCommand::getCommand() const string InsetCommand::getCommand() const
{ {
LString s; string s;
if (!command.empty()) s += "\\"+command; if (!command.empty()) s += "\\"+command;
if (!options.empty()) s += "["+options+']'; if (!options.empty()) s += "["+options+']';
s += "{"+contents+'}'; s += "{"+contents+'}';

View File

@ -30,8 +30,8 @@ public:
/// ///
InsetCommand(); InsetCommand();
/// ///
InsetCommand(LString const & name, LString const & arg = LString(), InsetCommand(string const & name, string const & arg = string(),
LString const & opt = LString()); string const & opt = string());
/// ///
~InsetCommand(); ~InsetCommand();
/// ///
@ -45,17 +45,17 @@ public:
/// ///
void Write(FILE *file); void Write(FILE *file);
/// Parse the command. /// Parse the command.
void scanCommand(LString const &cmd); void scanCommand(string const &cmd);
/// Will not be used when lyxf3 /// 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(LString &file, signed char fragile); virtual int Latex(string &file, signed char fragile);
/// ///
virtual int Linuxdoc(LString &file); virtual int Linuxdoc(string &file);
/// ///
virtual int DocBook(LString &file); virtual int DocBook(string &file);
/// ///
Inset* Clone(); Inset* Clone();
/// ///
@ -70,44 +70,44 @@ public:
confusion with lyxinset::getLabel(int), but I've seen that confusion with lyxinset::getLabel(int), but I've seen that
it wasn't. I hope you never confuse again both methods. (ale) it wasn't. I hope you never confuse again both methods. (ale)
*/ */
virtual LString getScreenLabel() const virtual string getScreenLabel() const
{ {
return getCommand(); return getCommand();
} }
/// Build the complete LaTeX command /// Build the complete LaTeX command
LString getCommand() const; string getCommand() const;
/// ///
LString const &getCmdName() const { string const &getCmdName() const {
return command; return command;
} }
/// ///
LString const &getOptions() const { string const &getOptions() const {
return options; return options;
} }
/// ///
LString const &getContents() const { string const &getContents() const {
return contents; return contents;
} }
/// ///
void setCmdName(LString const & n) { void setCmdName(string const & n) {
command = n; command = n;
} }
/// ///
void setOptions(LString const & o) { void setOptions(string const & o) {
options = o; options = o;
} }
/// ///
virtual void setContents(LString const & c) { virtual void setContents(string const & c) {
contents = c; contents = c;
} }
protected: protected:
/// ///
LString command; string command;
/// ///
LString options; string options;
/// ///
LString contents; string contents;
}; };
#endif #endif

View File

@ -3,10 +3,10 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
*======================================================*/ * ======================================================*/
#include <config.h> #include <config.h>
@ -14,30 +14,23 @@
#pragma implementation #pragma implementation
#endif #endif
#include "definitions.h" #include "definitions.h"
#include "inseterror.h" #include "inseterror.h"
#include "lyxdraw.h" #include "lyxdraw.h"
#include "gettext.h" #include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB #include "lyx_gui_misc.h" // CancelCloseBoxCB
// $Id: inseterror.C,v 1.1 1999/09/27 18:44:39 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: inseterror.C,v 1.1 1999/09/27 18:44:39 larsbj Exp $";
#endif /* lint */
/* Error, used for the LaTeX-Error Messages */ /* Error, used for the LaTeX-Error Messages */
InsetError::InsetError() InsetError::InsetError()
{ {
form = NULL; form = 0;
} }
InsetError::InsetError(LString const & string) InsetError::InsetError(string const & string)
: contents(string) : contents(string)
{ {
form = NULL; form = 0;
} }
@ -46,7 +39,7 @@ InsetError::~InsetError()
if (form) { if (form) {
fl_hide_form(form); fl_hide_form(form);
fl_free_form(form); fl_free_form(form);
form = NULL; form = 0;
} }
} }
@ -117,19 +110,19 @@ int InsetError::Latex(FILE *, signed char /*fragile*/)
} }
int InsetError::Latex(LString &, signed char /*fragile*/) int InsetError::Latex(string &, signed char /*fragile*/)
{ {
return 0; return 0;
} }
int InsetError::Linuxdoc(LString &) int InsetError::Linuxdoc(string &)
{ {
return 0; return 0;
} }
int InsetError::DocBook(LString &) int InsetError::DocBook(string &)
{ {
return 0; return 0;
} }
@ -153,7 +146,7 @@ void InsetError::CloseErrorCB(FL_OBJECT *, long data)
if (inset->form) { if (inset->form) {
fl_hide_form(inset->form); fl_hide_form(inset->form);
fl_free_form(inset->form); fl_free_form(inset->form);
inset->form = NULL; inset->form = 0;
} }
} }
@ -170,7 +163,7 @@ void InsetError::Edit(int, int)
fl_set_object_gravity(obj, FL_South, FL_South); fl_set_object_gravity(obj, FL_South, FL_South);
fl_set_object_resize(obj, FL_RESIZE_NONE); fl_set_object_resize(obj, FL_RESIZE_NONE);
fl_end_form(); fl_end_form();
fl_set_form_atclose(form, CancelCloseBoxCB, NULL); fl_set_form_atclose(form, CancelCloseBoxCB, 0);
} }
fl_set_object_label(strobj, contents.c_str()); fl_set_object_label(strobj, contents.c_str());
if (form->visible) { if (form->visible) {

View File

@ -28,7 +28,7 @@
class InsetError: public Inset { class InsetError: public Inset {
public: public:
/// ///
InsetError(LString const & string); InsetError(string const & string);
/// ///
InsetError(); InsetError();
/// ///
@ -48,11 +48,11 @@ public:
/// ///
int Latex(FILE *file, signed char fragile); int Latex(FILE *file, signed char fragile);
/// ///
int Latex(LString &file, signed char fragile); int Latex(string &file, signed char fragile);
/// ///
int Linuxdoc(LString &file); int Linuxdoc(string &file);
/// ///
int DocBook(LString &file); int DocBook(string &file);
/// ///
bool AutoDelete() const; bool AutoDelete() const;
/// what appears in the minibuffer when opening /// what appears in the minibuffer when opening
@ -69,7 +69,7 @@ public:
bool DirectWrite() const { return true; }; bool DirectWrite() const { return true; };
private: private:
/// ///
LString contents; string contents;
/// ///
FL_FORM *form; FL_FORM *form;
/// ///

View File

@ -1,6 +1,6 @@
#include <config.h> #include <config.h>
#include <stdlib.h> #include <cstdlib>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
@ -12,14 +12,14 @@
#include "buffer.h" #include "buffer.h"
#include "bufferlist.h" #include "bufferlist.h"
#include "error.h" #include "error.h"
#include "filetools.h" #include "support/filetools.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "LyXView.h" #include "LyXView.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB #include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "gettext.h" #include "gettext.h"
#include "include_form.h" #include "include_form.h"
#include "FileInfo.h" #include "support/FileInfo.h"
extern BufferView *current_view; extern BufferView *current_view;
@ -97,8 +97,8 @@ void include_cb(FL_OBJECT *, long arg)
{ {
// Should browsing too be disabled in RO-mode? // Should browsing too be disabled in RO-mode?
LyXFileDlg fileDlg; LyXFileDlg fileDlg;
LString mpath = OnlyPath(inset->getMasterFilename()); string mpath = OnlyPath(inset->getMasterFilename());
LString ext; string ext;
if (fl_get_button(form->flag2)) // Use Input Button if (fl_get_button(form->flag2)) // Use Input Button
ext = "*.tex"; ext = "*.tex";
@ -110,16 +110,16 @@ void include_cb(FL_OBJECT *, long arg)
fileDlg.SetButton(0, _("Documents"), lyxrc->document_path); fileDlg.SetButton(0, _("Documents"), lyxrc->document_path);
// Use by default the master's path // Use by default the master's path
LString filename = fileDlg.Select(_("Select Child Document"), string filename = fileDlg.Select(_("Select Child Document"),
mpath, ext, mpath, ext,
inset->getContents()); inset->getContents());
XFlush(fl_get_display()); XFlush(fl_get_display());
// check selected filename // check selected filename
if (!filename.empty()) { if (!filename.empty()) {
LString filename2 = MakeRelPath(filename, string filename2 = MakeRelPath(filename,
mpath); mpath);
if (filename2.prefixIs("..")) if (prefixIs(filename2, ".."))
fl_set_input(form->input, fl_set_input(form->input,
filename.c_str()); filename.c_str());
else else
@ -183,7 +183,7 @@ void include_cb(FL_OBJECT *, long arg)
} }
InsetInclude::InsetInclude(LString const & fname, Buffer *bf) InsetInclude::InsetInclude(string const & fname, Buffer *bf)
: InsetCommand("include") : InsetCommand("include")
{ {
master = bf; master = bf;
@ -231,7 +231,7 @@ void InsetInclude::Edit(int, int)
if (!form) { if (!form) {
form = create_form_include(); form = create_form_include();
fl_set_form_atclose(form->include, IgnoreCloseBoxCB, NULL); fl_set_form_atclose(form->include, IgnoreCloseBoxCB, 0);
} }
form->vdata = this; form->vdata = this;
@ -271,7 +271,7 @@ void InsetInclude::Read(LyXLex &lex)
setInclude(); setInclude();
else if (getCmdName() == "input") else if (getCmdName() == "input")
setInput(); setInput();
else if (getCmdName().contains("verbatim")) { else if (contains(getCmdName(), "verbatim")) {
setVerb(); setVerb();
if (getCmdName() == "verbatiminput*") if (getCmdName() == "verbatiminput*")
setVisibleSpace(true); setVisibleSpace(true);
@ -279,9 +279,9 @@ void InsetInclude::Read(LyXLex &lex)
} }
LString InsetInclude::getScreenLabel() const string InsetInclude::getScreenLabel() const
{ {
LString temp; string temp;
if (isInput()) if (isInput())
temp += _("Input"); temp += _("Input");
else if (isVerb()) { else if (isVerb()) {
@ -309,13 +309,13 @@ bool InsetInclude::loadIfNeeded() const
// the readonly flag can/will be wrong, not anymore I think. // the readonly flag can/will be wrong, not anymore I think.
FileInfo finfo(getFileName()); FileInfo finfo(getFileName());
bool ro = !finfo.writable(); bool ro = !finfo.writable();
return ( bufferlist.readFile(getFileName(), ro) != NULL ); return ( bufferlist.readFile(getFileName(), ro) != 0 );
} }
int InsetInclude::Latex(FILE *file, signed char /*fragile*/) int InsetInclude::Latex(FILE *file, signed char /*fragile*/)
{ {
LString include_file; string include_file;
signed char dummy = 0; signed char dummy = 0;
Latex(include_file, dummy); Latex(include_file, dummy);
fprintf(file, "%s", include_file.c_str()); fprintf(file, "%s", include_file.c_str());
@ -323,9 +323,9 @@ int InsetInclude::Latex(FILE *file, signed char /*fragile*/)
} }
int InsetInclude::Latex(LString &file, signed char /*fragile*/) int InsetInclude::Latex(string &file, signed char /*fragile*/)
{ {
LString writefile, incfile; string writefile, incfile;
// Do nothing if no file name has been specified // Do nothing if no file name has been specified
if (contents.empty()) if (contents.empty())
@ -352,9 +352,9 @@ int InsetInclude::Latex(LString &file, signed char /*fragile*/)
writefile = ChangeExtension(getFileName(), ".tex", false); writefile = ChangeExtension(getFileName(), ".tex", false);
if (!master->tmppath.empty() if (!master->tmppath.empty()
&& !master->niceFile) { && !master->niceFile) {
incfile.subst('/','@'); subst(incfile, '/','@');
#ifdef __EMX__ #ifdef __EMX__
incfile.subst(':', '$'); subst(incfile, ':', '$');
#endif #endif
writefile = AddName(master->tmppath, incfile); writefile = AddName(master->tmppath, incfile);
} else } else
@ -392,7 +392,7 @@ int InsetInclude::Latex(LString &file, signed char /*fragile*/)
// file really have .tex // file really have .tex
file += '\\'; file += '\\';
file += command + '{'; file += command + '{';
file += ChangeExtension(incfile, LString(), false) file += ChangeExtension(incfile, string(), false)
+ '}'; + '}';
} }
@ -416,10 +416,10 @@ void InsetInclude::Validate(LaTeXFeatures& features) const
} }
LString InsetInclude::getLabel(int) const string InsetInclude::getLabel(int) const
{ {
LString label; string label;
LString parentname; string parentname;
if (loadIfNeeded()) { if (loadIfNeeded()) {
@ -434,7 +434,7 @@ LString InsetInclude::getLabel(int) const
int InsetInclude::GetNumberOfLabels() const { int InsetInclude::GetNumberOfLabels() const {
LString label; string label;
int nl; int nl;
if (loadIfNeeded()) { if (loadIfNeeded()) {
@ -449,9 +449,9 @@ int InsetInclude::GetNumberOfLabels() const {
} }
LString InsetInclude::getKeys() const string InsetInclude::getKeys() const
{ {
LString list; string list;
if (loadIfNeeded()) { if (loadIfNeeded()) {
Buffer *tmp = bufferlist.getBuffer(getFileName()); Buffer *tmp = bufferlist.getBuffer(getFileName());

View File

@ -8,8 +8,8 @@
* *
*======================================================*/ *======================================================*/
#ifndef _INSET_INCLUDE_H #ifndef INSET_INCLUDE_H
#define _INSET_INCLUDE_H #define INSET_INCLUDE_H
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface #pragma interface
@ -17,7 +17,7 @@
#include "insetcommand.h" #include "insetcommand.h"
#include "buffer.h" #include "buffer.h"
#include "filetools.h" #include "support/filetools.h"
struct LaTeXFeatures; struct LaTeXFeatures;
@ -33,7 +33,7 @@ public:
flag = InsetInclude::INCLUDE; flag = InsetInclude::INCLUDE;
} }
/// ///
InsetInclude(LString const &, Buffer*); InsetInclude(string const &, Buffer*);
/// ///
~InsetInclude(); ~InsetInclude();
/// ///
@ -43,9 +43,9 @@ public:
/// This is 1 if the childs have labels, 0 otherwise /// This is 1 if the childs have labels, 0 otherwise
int GetNumberOfLabels() const; int GetNumberOfLabels() const;
/// This returns the list of labels on the child buffer /// This returns the list of labels on the child buffer
LString getLabel(int) const; string getLabel(int) const;
/// This returns the list of bibkeys on the child buffer /// This returns the list of bibkeys on the child buffer
LString getKeys() const; string getKeys() const;
/// ///
void Edit(int, int); void Edit(int, int);
/// ///
@ -60,7 +60,7 @@ public:
/// ///
int Latex(FILE *file, signed char fragile); int Latex(FILE *file, signed char fragile);
/// ///
int Latex(LString &file, signed char fragile); int Latex(string &file, signed char fragile);
/// ///
void Validate(LaTeXFeatures &) const; void Validate(LaTeXFeatures &) const;
@ -68,19 +68,19 @@ public:
/// Input inserts anything inside a paragraph, Display can give some visual feedback /// Input inserts anything inside a paragraph, Display can give some visual feedback
bool Display() const { return !(isInput()); } bool Display() const { return !(isInput()); }
/// ///
LString getScreenLabel() const; string getScreenLabel() const;
/// ///
void setContents(LString const & c) { void setContents(string const & c) {
InsetCommand::setContents(c); InsetCommand::setContents(c);
filename = MakeAbsPath(contents, filename = MakeAbsPath(contents,
OnlyPath(getMasterFilename())); OnlyPath(getMasterFilename()));
} }
/// ///
void setFilename(LString const & n) { setContents(n); } void setFilename(string const & n) { setContents(n); }
/// ///
LString getMasterFilename() const { return master->getFileName(); } string getMasterFilename() const { return master->getFileName(); }
/// ///
LString getFileName() const { string getFileName() const {
return filename; return filename;
} }
/// In "input" mode uses \input instead of \include. /// In "input" mode uses \input instead of \include.
@ -128,7 +128,7 @@ private:
/// ///
Buffer *master; Buffer *master;
/// ///
LString filename; string filename;
}; };

View File

@ -36,7 +36,7 @@ void index_cb(FL_OBJECT *, long data)
// - } // - }
case 1: // OK case 1: // OK
if(!current_view->currentBuffer()->isReadonly()) { if(!current_view->currentBuffer()->isReadonly()) {
LString tmp = fl_get_input(index_form->key); string tmp = fl_get_input(index_form->key);
if(tmp != inset->getContents()) { if(tmp != inset->getContents()) {
inset->setContents(tmp); inset->setContents(tmp);
fl_hide_form(index_form->index_form); fl_hide_form(index_form->index_form);
@ -80,7 +80,7 @@ FD_index_form *create_form_index_form()
/*---------------------------------------*/ /*---------------------------------------*/
InsetIndex::InsetIndex(LString const & key) InsetIndex::InsetIndex(string const & key)
: InsetCommand("index", key) : InsetCommand("index", key)
{ {
} }
@ -115,7 +115,7 @@ void InsetIndex::Edit(int, int)
} }
LString InsetIndex::getScreenLabel() const string InsetIndex::getScreenLabel() const
{ {
return _("Idx"); return _("Idx");
} }
@ -128,7 +128,7 @@ LString InsetIndex::getScreenLabel() const
InsetPrintIndex::InsetPrintIndex() InsetPrintIndex::InsetPrintIndex()
: InsetCommand("printindex") : InsetCommand("printindex")
{ {
owner = NULL; owner = 0;
} }
@ -143,7 +143,7 @@ InsetPrintIndex::~InsetPrintIndex()
} }
LString InsetPrintIndex::getScreenLabel() const string InsetPrintIndex::getScreenLabel() const
{ {
return _("PrintIndex"); return _("PrintIndex");
} }

View File

@ -31,7 +31,7 @@ public:
/// ///
InsetIndex(): InsetCommand("index") {;} InsetIndex(): InsetCommand("index") {;}
/// ///
InsetIndex(LString const & key); InsetIndex(string const & key);
/// ///
~InsetIndex(); ~InsetIndex();
/// ///
@ -44,7 +44,7 @@ public:
return 1; return 1;
} }
/// ///
LString getScreenLabel() const; string getScreenLabel() const;
}; };
@ -69,7 +69,7 @@ public:
/// ///
Inset::Code LyxCode() const; Inset::Code LyxCode() const;
/// ///
LString getScreenLabel() const; string getScreenLabel() const;
private: private:
/// ///
Buffer *owner; Buffer *owner;

View File

@ -3,13 +3,14 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
*======================================================*/ * ======================================================*/
#include <config.h> #include <config.h>
#include <ctype.h>
#include <cctype>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
@ -22,27 +23,22 @@
#include "gettext.h" #include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB #include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "buffer.h" #include "buffer.h"
#include "support/lstrings.h"
// $Id: insetinfo.C,v 1.1 1999/09/27 18:44:39 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: insetinfo.C,v 1.1 1999/09/27 18:44:39 larsbj Exp $";
#endif /* lint */
extern BufferView *current_view;
/* Info, used for the Info boxes */ /* Info, used for the Info boxes */
extern BufferView * current_view;
InsetInfo::InsetInfo() InsetInfo::InsetInfo()
{ {
form = NULL; form = 0;
} }
InsetInfo::InsetInfo(LString const & string) InsetInfo::InsetInfo(string const & string)
: contents(string) : contents(string)
{ {
form = NULL; form = 0;
} }
@ -51,7 +47,7 @@ InsetInfo::~InsetInfo()
if (form){ if (form){
fl_hide_form(form); fl_hide_form(form);
fl_free_form(form); fl_free_form(form);
form = NULL; form = 0;
} }
} }
@ -102,7 +98,7 @@ void InsetInfo::Write(FILE *file)
void InsetInfo::Read(LyXLex &lex) void InsetInfo::Read(LyXLex &lex)
{ {
LString tmp = lex.GetString(); // should be "Info" string tmp = lex.GetString(); // should be "Info"
if (tmp != "Info") if (tmp != "Info")
lyxerr.print("ERROR (InsetInfo::Read): " lyxerr.print("ERROR (InsetInfo::Read): "
"consistency check 1 failed."); "consistency check 1 failed.");
@ -113,7 +109,7 @@ void InsetInfo::Read(LyXLex &lex)
// should we skip blank lines? // should we skip blank lines?
continue; continue;
LString const token = lex.GetString().strip(); string const token = strip(lex.GetString());
lyxerr.debug("Note: " + token, Error::LEX_PARSER); lyxerr.debug("Note: " + token, Error::LEX_PARSER);
if (token != "\\end_inset") { if (token != "\\end_inset") {
@ -123,7 +119,7 @@ void InsetInfo::Read(LyXLex &lex)
break; break;
} }
// now remove the last '\n's // now remove the last '\n's
contents.strip('\n'); contents = strip(contents, '\n');
} }
@ -133,19 +129,19 @@ int InsetInfo::Latex(FILE *, signed char /*fragile*/)
} }
int InsetInfo::Latex(LString &, signed char /*fragile*/) int InsetInfo::Latex(string &, signed char /*fragile*/)
{ {
return 0; return 0;
} }
int InsetInfo::Linuxdoc(LString &) int InsetInfo::Linuxdoc(string &)
{ {
return 0; return 0;
} }
int InsetInfo::DocBook(LString &) int InsetInfo::DocBook(string &)
{ {
return 0; return 0;
} }
@ -161,7 +157,7 @@ void InsetInfo::CloseInfoCB(FL_OBJECT *, long data)
{ {
InsetInfo *inset = (InsetInfo*) data; InsetInfo *inset = (InsetInfo*) data;
// inset->contents = fl_get_input(inset->strobj); // inset->contents = fl_get_input(inset->strobj);
LString tmp = fl_get_input(inset->strobj); string tmp = fl_get_input(inset->strobj);
Buffer *buffer = current_view->currentBuffer(); Buffer *buffer = current_view->currentBuffer();
if(tmp != inset->contents && !(buffer->isReadonly()) ) { if(tmp != inset->contents && !(buffer->isReadonly()) ) {
buffer->markDirty(); buffer->markDirty();
@ -170,7 +166,7 @@ void InsetInfo::CloseInfoCB(FL_OBJECT *, long data)
if (inset->form) { if (inset->form) {
fl_hide_form(inset->form); fl_hide_form(inset->form);
fl_free_form(inset->form); fl_free_form(inset->form);
inset->form = NULL; inset->form = 0;
} }
} }
@ -193,7 +189,7 @@ void InsetInfo::Edit(int, int)
fl_set_object_callback(obj, CloseInfoCB, (long)this); fl_set_object_callback(obj, CloseInfoCB, (long)this);
fl_set_object_shortcut(obj, scex(_("Close|#C^[")), (long)this); fl_set_object_shortcut(obj, scex(_("Close|#C^[")), (long)this);
fl_end_form(); fl_end_form();
fl_set_form_atclose(form, CancelCloseBoxCB, NULL); fl_set_form_atclose(form, CancelCloseBoxCB, 0);
} }
fl_set_input(strobj, contents.c_str()); fl_set_input(strobj, contents.c_str());
if (form->visible) { if (form->visible) {

View File

@ -32,7 +32,7 @@ public:
/// ///
InsetInfo(); InsetInfo();
/// ///
InsetInfo(LString const & string); InsetInfo(string const & string);
/// ///
~InsetInfo(); ~InsetInfo();
/// ///
@ -50,11 +50,11 @@ public:
/// ///
int Latex(FILE *file, signed char fragile); int Latex(FILE *file, signed char fragile);
/// ///
int Latex(LString &file, signed char fragile); int Latex(string &file, signed char fragile);
/// ///
int Linuxdoc(LString &file); int Linuxdoc(string &file);
/// ///
int DocBook(LString &file); int DocBook(string &file);
/// what appears in the minibuffer when opening /// what appears in the minibuffer when opening
char const* EditMessage() {return "Opened note";} char const* EditMessage() {return "Opened note";}
/// ///
@ -67,7 +67,7 @@ public:
Inset* Clone(); Inset* Clone();
private: private:
/// ///
LString contents; string contents;
/// ///
FL_FORM *form; FL_FORM *form;
/// ///

View File

@ -3,10 +3,10 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
*======================================================*/ * ======================================================*/
#include <config.h> #include <config.h>
@ -16,16 +16,10 @@
#include "insetlabel.h" #include "insetlabel.h"
// $Id: insetlabel.C,v 1.1 1999/09/27 18:44:39 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: insetlabel.C,v 1.1 1999/09/27 18:44:39 larsbj Exp $";
#endif /* lint */
/* Label. Used to insert a label automatically */ /* Label. Used to insert a label automatically */
InsetLabel::InsetLabel(LString const & cmd) InsetLabel::InsetLabel(string const & cmd)
{ {
scanCommand(cmd); scanCommand(cmd);
} }
@ -49,7 +43,7 @@ int InsetLabel::GetNumberOfLabels() const
} }
LString InsetLabel::getLabel(int) const string InsetLabel::getLabel(int) const
{ {
return contents; return contents;
} }
@ -61,21 +55,21 @@ int InsetLabel::Latex(FILE *file, signed char /*fragile*/)
} }
int InsetLabel::Latex(LString &file, signed char /*fragile*/) int InsetLabel::Latex(string &file, signed char /*fragile*/)
{ {
file += escape(getCommand()); file += escape(getCommand());
return 0; return 0;
} }
int InsetLabel::Linuxdoc(LString &file) int InsetLabel::Linuxdoc(string &file)
{ {
file += "<label id=\"" + getContents() +"\" >"; file += "<label id=\"" + getContents() +"\" >";
return 0; return 0;
} }
int InsetLabel::DocBook(LString &file) int InsetLabel::DocBook(string &file)
{ {
file += "<anchor id=\"" + getContents() +"\" >"; file += "<anchor id=\"" + getContents() +"\" >";
return 0; return 0;
@ -84,11 +78,11 @@ int InsetLabel::DocBook(LString &file)
// This function escapes 8-bit characters and other problematic characters // This function escapes 8-bit characters and other problematic characters
// It's exactly the same code as in insetref.C. // It's exactly the same code as in insetref.C.
LString InsetLabel::escape(LString const & lab) const { string InsetLabel::escape(string const & lab) const {
char hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7', char hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
LString enc; string enc;
for (int i=0; i<lab.length(); i++) { for (string::size_type i=0; i<lab.length(); i++) {
unsigned char c=lab[i]; unsigned char c=lab[i];
if (c >= 128 || c=='=' || c=='%') { if (c >= 128 || c=='=' || c=='%') {
enc += '='; enc += '=';

View File

@ -23,7 +23,7 @@
class InsetLabel: public InsetCommand { class InsetLabel: public InsetCommand {
public: public:
/// ///
InsetLabel(LString const & cmd); InsetLabel(string const & cmd);
/// ///
InsetLabel() : InsetCommand("label") {;} InsetLabel() : InsetCommand("label") {;}
/// ///
@ -35,22 +35,22 @@ public:
/// ///
int GetNumberOfLabels() const; int GetNumberOfLabels() const;
/// ///
LString getLabel(int) const; string getLabel(int) const;
/// ///
LString getScreenLabel() const { return getContents(); } string getScreenLabel() const { return getContents(); }
/// ///
unsigned char Editable() const { return 0; } unsigned char Editable() const { return 0; }
/// ///
int Latex(FILE *file, signed char fragile); int Latex(FILE *file, signed char fragile);
/// ///
int Latex(LString &file, signed char fragile); int Latex(string &file, signed char fragile);
/// ///
int Linuxdoc(LString &file); int Linuxdoc(string &file);
/// ///
int DocBook(LString &file); int DocBook(string &file);
private: private:
/// This function escapes 8-bit characters /// This function escapes 8-bit characters
LString escape(LString const &) const; string escape(string const &) const;
}; };
#endif #endif

View File

@ -3,8 +3,8 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
*======================================================*/ *======================================================*/
@ -18,12 +18,6 @@
#include "insetlatex.h" #include "insetlatex.h"
#include "lyxdraw.h" #include "lyxdraw.h"
// $Id: insetlatex.C,v 1.1 1999/09/27 18:44:39 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: insetlatex.C,v 1.1 1999/09/27 18:44:39 larsbj Exp $";
#endif /* lint */
/* Latex. Used to insert Latex-Code automatically */ /* Latex. Used to insert Latex-Code automatically */
@ -32,7 +26,7 @@ InsetLatex::InsetLatex()
} }
InsetLatex::InsetLatex(LString const & string) InsetLatex::InsetLatex(string const & string)
: contents(string) : contents(string)
{ {
} }
@ -115,21 +109,21 @@ int InsetLatex::Latex(FILE *file, signed char /*fragile*/)
} }
int InsetLatex::Latex(LString &file, signed char /*fragile*/) int InsetLatex::Latex(string &file, signed char /*fragile*/)
{ {
file += contents; file += contents;
return 0; return 0;
} }
int InsetLatex::Linuxdoc(LString &file) int InsetLatex::Linuxdoc(string &file)
{ {
file += contents; file += contents;
return 0; return 0;
} }
int InsetLatex::DocBook(LString &file) int InsetLatex::DocBook(string &file)
{ {
file += contents; file += contents;
return 0; return 0;

View File

@ -29,7 +29,7 @@ public:
/// ///
InsetLatex(); InsetLatex();
/// ///
InsetLatex(LString const & string); InsetLatex(string const & string);
/// ///
~InsetLatex(); ~InsetLatex();
/// ///
@ -47,11 +47,11 @@ public:
/// ///
int Latex(FILE *file, signed char fragile); int Latex(FILE *file, signed char fragile);
/// ///
int Latex(LString &file, signed char fragile); int Latex(string &file, signed char fragile);
/// ///
int Linuxdoc(LString &file); int Linuxdoc(string &file);
/// ///
int DocBook(LString &file); int DocBook(string &file);
/// ///
bool Deletable() const; bool Deletable() const;
/// ///
@ -60,7 +60,7 @@ public:
Inset::Code LyxCode() const; Inset::Code LyxCode() const;
private: private:
/// ///
LString contents; string contents;
}; };
#endif #endif

View File

@ -3,8 +3,8 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-1999 The LyX Team.
* *
*======================================================*/ *======================================================*/
@ -18,15 +18,10 @@
#include "error.h" #include "error.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "lyxdraw.h" #include "lyxdraw.h"
#include "support/lstrings.h"
extern LyXRC * lyxrc; extern LyXRC * lyxrc;
// $Id: insetlatexaccent.C,v 1.1 1999/09/27 18:44:39 larsbj Exp $
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: insetlatexaccent.C,v 1.1 1999/09/27 18:44:39 larsbj Exp $";
#endif /* lint */
/* LatexAccent. Proper handling of accented characters */ /* LatexAccent. Proper handling of accented characters */
/* This part is done by Ivan Schreter, schreter@ccsun.tuke.sk */ /* This part is done by Ivan Schreter, schreter@ccsun.tuke.sk */
/* Later modified by Lars G. Bjonnes, larsbj@ifi.uio.no */ /* Later modified by Lars G. Bjonnes, larsbj@ifi.uio.no */
@ -48,7 +43,7 @@ InsetLatexAccent::InsetLatexAccent(InsetLatexAccent const & other)
{} {}
InsetLatexAccent::InsetLatexAccent(LString const & string) InsetLatexAccent::InsetLatexAccent(string const & string)
: contents(string) : contents(string)
{ {
checkContents(); checkContents();
@ -69,17 +64,16 @@ void InsetLatexAccent::checkContents()
// REMOVE IN 0.13 // REMOVE IN 0.13
// Dirty Hack for backward compability. remove in 0.13 (Lgb) // Dirty Hack for backward compability. remove in 0.13 (Lgb)
contents.strip(); contents = frontStrip(strip(contents));
contents.frontStrip(); if (!contains(contents, "{") && !contains(contents, "}")) {
if (!contents.contains("{") && !contents.contains("}")) {
if (contents.length() == 2) { if (contents.length() == 2) {
LString tmp; string tmp;
tmp += contents[0]; tmp += contents[0];
tmp += contents[1]; tmp += contents[1];
tmp += "{}"; tmp += "{}";
contents = tmp; contents = tmp;
} else if (contents.length() == 3) { } else if (contents.length() == 3) {
LString tmp; string tmp;
tmp += contents[0]; tmp += contents[0];
tmp += contents[1]; tmp += contents[1];
tmp += '{'; tmp += '{';
@ -87,7 +81,7 @@ void InsetLatexAccent::checkContents()
tmp += '}'; tmp += '}';
contents = tmp; contents = tmp;
} else if (contents.length()==4 && contents[2] == ' ') { } else if (contents.length()==4 && contents[2] == ' ') {
LString tmp; string tmp;
tmp += contents[0]; tmp += contents[0];
tmp += contents[1]; tmp += contents[1];
tmp += '{'; tmp += '{';
@ -96,7 +90,7 @@ void InsetLatexAccent::checkContents()
contents = tmp; contents = tmp;
} else if (contents.length()==4 && contents[2] == '\\' } else if (contents.length()==4 && contents[2] == '\\'
&& (contents[3]== 'i' || contents[3]== 'j')) { && (contents[3]== 'i' || contents[3]== 'j')) {
LString tmp; string tmp;
tmp += contents[0]; tmp += contents[0];
tmp += contents[1]; tmp += contents[1];
tmp += '{'; tmp += '{';
@ -224,10 +218,10 @@ void InsetLatexAccent::checkContents()
} }
//ic = (modtype == DOT_LESS_J ? 'j' : 'i'); //ic = (modtype == DOT_LESS_J ? 'j' : 'i');
lyxerr.debug("Contents: [" + contents + "], ic: " + ic lyxerr.debug("Contents: [" + contents + "], ic: " + ic
+ ", top: " + long(plusasc) + ", top: " + tostr(plusasc)
+ ", bot: " + long(plusdesc) + ", bot: " + tostr(plusdesc)
+ ", dot: " + long(remdot) + ", dot: " + tostr(remdot)
+ ", mod: " + long(modtype)); + ", mod: " + tostr(modtype));
// Special case for space // Special case for space
} else if (contents[3] == '}') { } else if (contents[3] == '}') {
ic = ' '; ic = ' ';
@ -246,11 +240,11 @@ void InsetLatexAccent::checkContents()
return; return;
} else if ( (ic=='i'|| ic=='j') && contents[4]=='}') { } else if ( (ic=='i'|| ic=='j') && contents[4]=='}') {
// Do a rewrite: \<foo>{i} --> \<foo>{\i} // Do a rewrite: \<foo>{i} --> \<foo>{\i}
LString temp=contents; string temp=contents;
temp.substring(0,2); temp.erase(3, string::npos);
temp+='\\'; temp+='\\';
temp+=char(ic); temp+=char(ic);
for(int j=4;j<contents.length();j++) for(string::size_type j = 4; j < contents.length(); ++j)
temp+=contents[j]; temp+=contents[j];
contents=temp; contents=temp;
i++; i++;
@ -262,10 +256,10 @@ void InsetLatexAccent::checkContents()
// fine, the char is properly decoded now (hopefully) // fine, the char is properly decoded now (hopefully)
lyxerr.debug("Contents: [" + contents + "], ic: " + ic lyxerr.debug("Contents: [" + contents + "], ic: " + ic
+ ", top: " + long(plusasc) + ", top: " + tostr(plusasc)
+ ", bot: " + long(plusdesc) + ", bot: " + tostr(plusdesc)
+ ", dot: " + long(remdot) + ", dot: " + tostr(remdot)
+ ", mod: " + long(modtype)); + ", mod: " + tostr(modtype));
} }
candisp = true; candisp = true;
} }
@ -615,21 +609,21 @@ int InsetLatexAccent::Latex(FILE *file, signed char /*fragile*/)
} }
int InsetLatexAccent::Latex(LString &file, signed char /*fragile*/) int InsetLatexAccent::Latex(string &file, signed char /*fragile*/)
{ {
file += contents; file += contents;
return 0; return 0;
} }
int InsetLatexAccent::Linuxdoc(LString &file) int InsetLatexAccent::Linuxdoc(string &file)
{ {
file += contents; file += contents;
return 0; return 0;
} }
int InsetLatexAccent::DocBook(LString &file) int InsetLatexAccent::DocBook(string &file)
{ {
file += contents; file += contents;
return 0; return 0;

View File

@ -32,7 +32,7 @@ public:
/// ///
InsetLatexAccent(); InsetLatexAccent();
/// ///
InsetLatexAccent(LString const & string); InsetLatexAccent(string const & string);
/// ///
InsetLatexAccent(InsetLatexAccent const&); InsetLatexAccent(InsetLatexAccent const&);
/// ///
@ -55,11 +55,11 @@ public:
/// ///
int Latex(FILE *file, signed char fragile); int Latex(FILE *file, signed char fragile);
/// ///
int Latex(LString &file, signed char fragile); int Latex(string &file, signed char fragile);
/// ///
int Linuxdoc(LString &file); int Linuxdoc(string &file);
/// ///
int DocBook(LString &file); int DocBook(string &file);
/// ///
bool Deletable() const; bool Deletable() const;
/// ///
@ -122,7 +122,7 @@ private:
/// Check if we know the modifier and can display it ok on screen. /// Check if we know the modifier and can display it ok on screen.
void checkContents(); void checkContents();
/// ///
LString contents; string contents;
/// can display as proper char /// can display as proper char
bool candisp; bool candisp;
/// modifier type /// modifier type

View File

@ -34,7 +34,7 @@ public:
/// ///
Inset* Clone() { return new InsetLOA(owner); } Inset* Clone() { return new InsetLOA(owner); }
/// ///
LString getScreenLabel() const { return _("List of Algorithms"); } string getScreenLabel() const { return _("List of Algorithms"); }
//void Edit(int, int); //void Edit(int, int);

View File

@ -32,7 +32,7 @@ public:
/// ///
Inset* Clone() { return new InsetLOF(owner); } Inset* Clone() { return new InsetLOF(owner); }
/// ///
LString getScreenLabel() const { return _("List of Figures"); } string getScreenLabel() const { return _("List of Figures"); }
//void Edit(int, int); //void Edit(int, int);
/// ///

View File

@ -32,7 +32,7 @@ public:
/// ///
Inset* Clone() { return new InsetLOT(owner); } Inset* Clone() { return new InsetLOT(owner); }
/// ///
LString getScreenLabel() const { return _("List of Tables"); } string getScreenLabel() const { return _("List of Tables"); }
//void Edit(int, int); //void Edit(int, int);
/// ///

View File

@ -18,7 +18,7 @@
#endif #endif
#include "insetparent.h" #include "insetparent.h"
#include "filetools.h" #include "support/filetools.h"
#include "BufferView.h" #include "BufferView.h"
#include "LyXView.h" #include "LyXView.h"
#include "lyxfunc.h" #include "lyxfunc.h"
@ -28,7 +28,7 @@
extern BufferView *current_view; extern BufferView *current_view;
InsetParent::InsetParent(LString fn, Buffer* owner): InsetCommand("lyxparent") InsetParent::InsetParent(string fn, Buffer* owner): InsetCommand("lyxparent")
{ {
if (owner) if (owner)
setContents(MakeAbsPath(fn, OnlyPath(owner->getFileName()))); setContents(MakeAbsPath(fn, OnlyPath(owner->getFileName())));
@ -51,7 +51,7 @@ int InsetParent::Latex(FILE *file, signed char fragile)
} }
// LaTeX must just ignore this command // LaTeX must just ignore this command
int InsetParent::Latex(LString &file, signed char fragile) int InsetParent::Latex(string &file, signed char fragile)
{ {
file += "%%#{lyx}"; file += "%%#{lyx}";
InsetCommand::Latex(file, fragile); InsetCommand::Latex(file, fragile);

Some files were not shown because too many files have changed in this diff Show More