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.status
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>
* 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.
1999-09-27 Lars Gullik Bjønnes <larsbj@lyx.org>
* All over: Tried to clean everything up so that only the files
that we really need are included in the cvs repository.
* 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
case $gxx_version in
2.7*) CXXFLAGS="$lyx_opt";;
*) CXXFLAGS="-g $lyx_opt -fno-exceptions";;
*) CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";;
esac
else
CXXFLAGS="$lyx_opt"

View File

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

View File

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

View File

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

View File

@ -28,7 +28,6 @@ src/combox.C
src/credits.C
src/credits_form.C
src/filedlg.C
src/filetools.C
src/form1.C
src/gettext.h
src/insets/figinset.C
@ -62,7 +61,6 @@ src/lyxfont.C
src/lyxfr0.C
src/lyxfr1.C
src/lyxfunc.C
src/lyxlib.h
src/lyxvc.C
src/mathed/formula.C
src/mathed/formula.h
@ -77,6 +75,8 @@ src/pathstack.C
src/print_form.C
src/sp_form.C
src/spellchecker.C
src/support/filetools.C
src/support/lyxlib.h
src/text.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
lyx
Makefile
Makefile.in
config.h.in
stamp-h
*.deps

View File

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

View File

@ -1,21 +1,24 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
*
*======================================================*/
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
* ======================================================*/
#include <config.h>
#include <stdlib.h>
#include <cstdlib>
#include <csignal>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
#include "support/lstrings.h"
#ifdef __GNUG__
#pragma implementation
#endif
@ -38,12 +41,6 @@
#include "lyx_cb.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;
void sigchldhandler(pid_t pid, int *status);
@ -115,7 +112,7 @@ void BufferView::setBuffer(Buffer *b)
}
if (_buffer) {
lyxerr.debug(LString(" Buffer addr: ") + PTR_AS_INT(_buffer));
lyxerr.debug(string(" Buffer addr: ") + tostr(_buffer));
_buffer->addUser(this);
_owner->getMenus()->showMenus();
// 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?
if (doit) {
long y_tmp = y + screen->first;
Row* row = _buffer->text->GetRowNearY(y_tmp);
#if 0
long y_tmp = y + screen->first;
Row* row = _buffer->text->GetRowNearY(y_tmp);
// Isn't this empty code anyway? (Lgb)
if (row->par != _buffer->text->cursor.par)
doit = true;
@ -1353,13 +1352,13 @@ void BufferView::CursorToggleCB(FL_OBJECT *ob, long)
Window tmpwin;
int tmp;
XGetInputFocus(fl_display, &tmpwin, &tmp);
lyxerr.debug(LString("tmpwin: ") + int(tmpwin));
lyxerr.debug(LString("window: ")
+ int(view->_owner->getForm()->window));
lyxerr.debug(LString("work_area_focus: ")
+ int(view->work_area_focus));
lyxerr.debug(LString("lyx_focus : ")
+ int(view->lyx_focus));
lyxerr.debug(string("tmpwin: ") + tostr(tmpwin));
lyxerr.debug(string("window: ")
+ tostr(view->_owner->getForm()->window));
lyxerr.debug(string("work_area_focus: ")
+ tostr(view->work_area_focus));
lyxerr.debug(string("lyx_focus : ")
+ tostr(view->lyx_focus));
if (tmpwin != view->_owner->getForm()->window) {
view->lyx_focus = false;
goto skip_timer;
@ -1517,7 +1516,7 @@ void BufferView::savePosition()
void BufferView::restorePosition()
{
int x, y;
LString fname = backstack->pop(&x, &y);
string fname = backstack->pop(&x, &y);
BeforeChange();
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) {
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
// in case some future function may want to retrieve
// an arbitrary entry.
// See additional comments in bulletEntry() below.
static LString const BulletSize[SIZEMAX] = {
static string const BulletSize[SIZEMAX] = {
"\\tiny", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize",
"\\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
// 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
// to get around a compiler bug in an earler version of gcc (< 2.7.2.1)
// static LString const BulletPanels[FONTMAX][CHARMAX] = {
static LString const BulletPanel0[CHARMAX] = {
// static string const BulletPanels[FONTMAX][CHARMAX] = {
static string const BulletPanel0[CHARMAX] = {
/* standard */
"\\normalfont\\bfseries{--}", "\\(\\vdash\\)",
"\\(\\dashv\\)", "\\(\\flat\\)", "\\(\\natural\\)",
@ -148,7 +148,7 @@ const LString & Bullet::bulletEntry(const short & f, const short & c)
"\\(\\rightharpoonup\\)", "\\(\\rightharpoondown\\)",
"\\(\\Rightarrow\\)", "\\(\\succ\\)"
};
static LString const BulletPanel1[CHARMAX] = {
static string const BulletPanel1[CHARMAX] = {
/* amssymb */
"\\(\\Rrightarrow\\)", "\\(\\rightarrowtail\\)",
"\\(\\twoheadrightarrow\\)", "\\(\\rightsquigarrow\\)",
@ -167,7 +167,7 @@ const LString & Bullet::bulletEntry(const short & f, const short & c)
"\\(\\blacktriangledown\\)", "\\(\\blacklozenge\\)",
"\\(\\blacksquare\\)"
};
static LString const BulletPanel2[CHARMAX] = {
static string const BulletPanel2[CHARMAX] = {
/* psnfss1 */
"\\ding{108}", "\\ding{109}",
"\\ding{119}", "\\Pisymbol{psy}{197}",
@ -188,7 +188,7 @@ const LString & Bullet::bulletEntry(const short & f, const short & c)
"\\ding{166}", "\\ding{167}",
"\\ding{226}", "\\ding{227}"
};
static LString const BulletPanel3[CHARMAX] = {
static string const BulletPanel3[CHARMAX] = {
/* psnfss2 */
"\\ding{37}", "\\ding{38}",
"\\ding{34}", "\\ding{36}",
@ -209,7 +209,7 @@ const LString & Bullet::bulletEntry(const short & f, const short & c)
"\\ding{171}", "\\ding{168}",
"\\ding{169}", "\\ding{170}"
};
static LString const BulletPanel4[CHARMAX] = {
static string const BulletPanel4[CHARMAX] = {
/* psnfss3 */
"\\ding{65}", "\\ding{76}",
"\\ding{75}", "\\ding{72}",
@ -230,7 +230,7 @@ const LString & Bullet::bulletEntry(const short & f, const short & c)
"\\ding{102}", "\\ding{96}",
"\\ding{95}", "\\ding{97}"
};
static LString const BulletPanel5[CHARMAX] = {
static string const BulletPanel5[CHARMAX] = {
/* psnfss4 */
"\\ding{223}", "\\ding{224}",
"\\ding{225}", "\\ding{232}",
@ -250,9 +250,9 @@ const LString & Bullet::bulletEntry(const short & f, const short & c)
"\\Pisymbol{psy}{174}", "\\Pisymbol{psy}{222}",
"\\ding{254}", "\\ding{242}",
"\\ding{231}", "\\Pisymbol{psy}{45}"
}; /* LString const BulletPanels[][] */
}; /* string const BulletPanels[][] */
static LString const * BulletPanels[FONTMAX] = {
static string const * BulletPanels[FONTMAX] = {
BulletPanel0, BulletPanel1,
BulletPanel2, BulletPanel3,
BulletPanel4, BulletPanel5

View File

@ -1,19 +1,19 @@
// -*- C++ -*-
/* This is the bullet class definition file.
* This file is part of
*======================================================
* ======================================================
*
* LyX, The Document Processor
*
* Copyright (C) 1997-1998 Allan Rae
* and the LyX Team
* Copyright 1995 Matthias Ettrich
* 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__
#pragma interface
@ -22,7 +22,7 @@
#include "LString.h"
#ifdef DEBUG_AS_DEFAULT
#include <assert.h>
#include <cassert>
#endif
///
@ -32,7 +32,7 @@ public:
Bullet(const int f = -1, const int c = -1, const int s = -1);
///
Bullet(const LString &);
Bullet(const string &);
///
~Bullet();
@ -44,7 +44,7 @@ public:
///
void setSize(const int);
///
void setText(const LString &);
void setText(const string &);
///
int getCharacter() const;
///
@ -52,9 +52,9 @@ public:
///
int getSize() const;
///
LString getText() const;
string getText() const;
///
LString getText();
string getText();
///
char const * c_str();
///
@ -118,9 +118,9 @@ private:
///
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;
@ -133,7 +133,7 @@ private:
// the predefined arrays of LaTeX equivalent strings.
/** 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)
*/
short user_text;
@ -145,13 +145,13 @@ private:
or one generated internally from the font, character
and size settings.
*/
LString text;
string text;
};
/*----------------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)
{
#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;
user_text = 1;
@ -238,7 +238,7 @@ inline int Bullet::getSize() const
}
inline LString Bullet::getText() const
inline string Bullet::getText() const
{
return text;
}

View File

@ -2,10 +2,10 @@
* ======================================================
*
* LyX, The Document Processor
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
* This file is Copyright (C) 1997-1998
* This file is Copyright 1997-1998
* Asger Alstrup
*
*======================================================
@ -13,7 +13,7 @@
#include <config.h>
#include <stdlib.h> // atoi
#include <cstdlib> // atoi
#ifdef __GNUG__
#pragma implementation
@ -21,27 +21,20 @@
#include "Chktex.h"
#include "LaTeX.h" // TeXErrors
#include "filetools.h"
#include "support/filetools.h"
#include "lyxlex.h"
#include "FileInfo.h"
#include "support/FileInfo.h"
#include "error.h"
#include "syscall.h"
#include "syscontr.h"
#include "support/syscall.h"
#include "support/syscontr.h"
#include "pathstack.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
*/
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)
{
}
@ -50,8 +43,8 @@ Chktex::Chktex(LString const & chktex, LString const & f, LString const & p)
int Chktex::run(TeXErrors &terr)
{
// run bibtex
LString log = ChangeExtension(file, ".log", true);
LString tmp = cmd + " -q -v0 -b0 -x " + file + " -o " + log;
string log = ChangeExtension(file, ".log", true);
string tmp = cmd + " -q -v0 -b0 -x " + file + " -o " + log;
Systemcalls one;
int result= one.Startscript(Systemcalls::System, tmp);
if (result == 0) {
@ -65,12 +58,12 @@ int Chktex::run(TeXErrors &terr)
int Chktex::scanLogFile(TeXErrors &terr)
{
LString token;
string token;
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)) {
// Unable to open file. Return at once
@ -83,12 +76,12 @@ int Chktex::scanLogFile(TeXErrors &terr)
else // blank line in the file being read
continue;
LString srcfile, line, pos, warno, warning;
token.split(srcfile, ':');
token.split(line, ':');
token.split(pos, ':');
token.split(warno, ':');
token.split(warning, ':');
string srcfile, line, pos, warno, warning;
token=split(token, srcfile, ':');
token=split(token, line, ':');
token=split(token, pos, ':');
token=split(token, warno, ':');
token=split(token, warning, ':');
int lineno = atoi(line.c_str());
warno = _("ChkTeX warning id #") + warno;

View File

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

View File

@ -14,18 +14,18 @@
#include <config.h>
#include "DepTable.h"
#include "lyxlib.h"
#include "filetools.h"
#include "support/lyxlib.h"
#include "support/filetools.h"
DepTable::DepTable()
{
new_sum = 0;
old_sum = 0;
next = NULL;
next = 0;
}
DepTable::DepTable(LString const & f,
DepTable::DepTable(string const & f,
bool upd,
unsigned long one,
unsigned long two)
@ -50,17 +50,17 @@ DepTable::DepTable(LString const & f,
file + " " +
tmp1 + " " + tmp2);
}
next = NULL;
next = 0;
}
void DepTable::insert(LString const & fi,
void DepTable::insert(string const & fi,
bool upd,
unsigned long one,
unsigned long two)
{
// 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 (next)
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
LString fil = MakeAbsPath(f);
string fil = MakeAbsPath(f);
bool ret = false;
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);
if (fp() && next) next->write(fp());
}
void DepTable::read(LString const &f)
void DepTable::read(string const &f)
{
FilePtr fp(f, FilePtr::read);
if (fp()) { // file opened
@ -141,11 +141,11 @@ void DepTable::read(LString const &f)
char tmp2[255];
sprintf(tmp1, "%lu", one);
sprintf(tmp2, "%lu", two);
lyxerr.debug(LString("read dep: ") +
lyxerr.debug(string("read dep: ") +
nome + " " + tmp1 +
" " + tmp2);
}
insert(LString(nome), false, one, two);
insert(string(nome), false, one, two);
}
}
}

View File

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

View File

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

View File

@ -30,7 +30,7 @@ public:
FontInfo() { init(); }
///
FontInfo(LString const & pat)
FontInfo(string const & pat)
: pattern(pat) { init(); }
/// Destructor
@ -49,23 +49,23 @@ public:
}
/// Get existing pattern
LString getPattern() const { return pattern; }
string getPattern() const { return pattern; }
/// Set new pattern
void setPattern(LString const & pat);
void setPattern(string const & pat);
/** Return full name of font close to this size.
If impossible, result is the empty string */
LString getFontname(int size);
string getFontname(int size);
private:
/// Font pattern (with wildcard for size)
LString pattern;
string pattern;
/// Available size list
int * sizes;
/// Corresponding name list
LString * strings;
string * strings;
/// Number of matches
int matches;
@ -97,6 +97,6 @@ private:
void query();
/// Build newly sized font string
LString resize(LString const &, int size) const;
string resize(string const &, int size) const;
};
#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.
LString ffamily;
LString fseries;
LString fshape;
LString norm = lyxrc->font_norm;
LString fontname;
string ffamily;
string fseries;
string fshape;
string norm = lyxrc->font_norm;
string fontname;
FontInfo * fi = new FontInfo();
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 *
(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()) {
lyxerr.print("No font matches request. Using 'fixed'.");
@ -239,7 +239,7 @@ XFontStruct* FontLoader::doLoad(LyXFont::FONT_FAMILY family,
f.setNoun(LyXFont::INHERIT);
f.setLatex(LyXFont::INHERIT);
f.setColor(LyXFont::INHERIT_COLOR);
lyxerr.print(LString("Font '") + f.stateText()
lyxerr.print(string("Font '") + f.stateText()
+ "' matched by\n" + font + '\n');
}
}

View File

@ -2,10 +2,10 @@
* ======================================================
*
* LyX, The Document Processor
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
* This file is Copyright (C) 1998
* This file is Copyright 1998
* Asger Alstrup
*
*======================================================
@ -19,25 +19,18 @@
#include "ImportLaTeX.h"
#include "lyxrc.h"
#include "syscall.h"
#include "filetools.h"
#include "support/syscall.h"
#include "support/filetools.h"
#include "bufferlist.h"
extern LyXRC * lyxrc;
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
*/
ImportLaTeX::ImportLaTeX(LString const & file)
ImportLaTeX::ImportLaTeX(string const & file)
: file(file)
{
}
@ -46,12 +39,12 @@ ImportLaTeX::ImportLaTeX(LString const & file)
Buffer * ImportLaTeX::run()
{
// run reLyX
LString tmp = lyxrc->relyx_command + " -f " + file;
string tmp = lyxrc->relyx_command + " -f " + file;
Systemcalls one;
Buffer * buf = 0;
int result= one.Startscript(Systemcalls::System, tmp);
if (result==0) {
LString filename = ChangeExtension(file, ".lyx", false);
string filename = ChangeExtension(file, ".lyx", false);
// File was generated without problems. Load it.
buf = bufferlist.loadLyXFile(filename);
}

View File

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

View File

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

View File

@ -12,8 +12,8 @@
*======================================================
*/
#ifndef _IMPORTNOWEB_H
#define _IMPORTNOWEB_H
#ifndef IMPORTNOWEB_H
#define IMPORTNOWEB_H
#ifdef __GNUG__
#pragma interface
@ -29,7 +29,7 @@ public:
/**
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.
Return 0 if fail.
@ -37,9 +37,9 @@ public:
Buffer * run();
private:
///
LString file;
string file;
///
LString documentclass();
string documentclass();
///
enum{
BUFSIZE = 512

View File

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

View File

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

View File

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

View File

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

View File

@ -1,31 +1,24 @@
#include <config.h>
#include <stdlib.h>
#include <cstdlib>
#include FORMS_H_LOCATION
#include "buffer.h"
#include "latexoptions.h"
#include "lyx_main.h"
#include "LString.h"
#include "FileInfo.h"
#include "filetools.h"
#include "support/FileInfo.h"
#include "support/filetools.h"
#include "pathstack.h"
#include "lyxrc.h"
#include "BufferView.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 BufferView *current_view;
void ShowLatexLog()
{
LString filename, fname, bname, path;
string filename, fname, bname, path;
bool use_build = false;
filename = current_view->currentBuffer()->getFileName();

View File

@ -2,50 +2,41 @@
* ======================================================
*
* LyX, The Document Processor
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
* This file is Copyright (C) 1996-1998
* Lars Gullik Bjønnes
*
*======================================================
* ======================================================
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#ifdef __GNUG__
#pragma implementation
#endif
#include "filetools.h"
#include "support/filetools.h"
#include "LaTeX.h"
#include "Literate.h"
#include "lyxlex.h"
#include "FileInfo.h"
#include "support/FileInfo.h"
#include "error.h"
#include "lyxlib.h"
#include "syscall.h"
#include "syscontr.h"
#include "support/lyxlib.h"
#include "support/syscall.h"
#include "support/syscontr.h"
#include "pathstack.h"
#include "bufferlist.h"
#include "minibuffer.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;
Literate::Literate(LString const & latex, LString const & f, LString const & p,
LString const & l,
LString const & literate, LString const & literate_f,
LString const & build, LString const & build_f)
Literate::Literate(string const & latex, string const & f, string const & p,
string const & l,
string const & literate, string const & literate_f,
string const & build, string const & build_f)
: LaTeX (latex, f, p),
litfile(l),
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 scanres = Literate::NO_ERRORS;
LString tmp1, tmp2;
string tmp1, tmp2;
int ret1, ret2;
Systemcalls one, two;
// The class LaTeX does not know the temp path.
bufferlist.updateIncludedTeXfiles(GetCWD());
lyxerr.debug(LString(_("Weaving document")),
lyxerr.debug(string(_("Weaving document")),
Error::LATEX);
minib->Set(LString(_("Weaving document")));
minib->Set(string(_("Weaving document")));
minib->Store();
// 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";
ret1 = one.Startscript(Systemcalls::System, tmp1);
ret2 = two.Startscript(Systemcalls::System, tmp2);
lyxerr.debug(LString(_("LITERATE")) + " {" + tmp1 + "} {" + tmp2 + "}");
lyxerr.debug(string(_("LITERATE")) + " {" + tmp1 + "} {" + tmp2 + "}");
scanres = scanLiterateLogFile(terr);
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.
// DepTable head; // empty head // unused
// bool rerun = false; // rerun requested // unused
LString tmp1, tmp2;
string tmp1, tmp2;
int ret1, ret2;
Systemcalls one, two;
// The class LaTeX does not know the temp path.
bufferlist.updateIncludedTeXfiles(GetCWD());
lyxerr.debug(LString(_("Building program")),
lyxerr.debug(string(_("Building program")),
Error::LATEX);
minib->Set(LString(_("Building program")));
minib->Set(string(_("Building program")));
minib->Store();
// Run the build program
@ -118,12 +109,12 @@ int Literate::build(TeXErrors &terr, MiniBuffer *minib)
int Literate::scanLiterateLogFile(TeXErrors &terr)
{
LString token;
string token;
int retval = NO_ERRORS;
LyXLex lex(NULL, 0);
LyXLex lex(0, 0);
LString tmp = litfile + ".log";
string tmp = litfile + ".log";
if (!lex.setFile(tmp)) {
// unable to open file
@ -140,12 +131,12 @@ int Literate::scanLiterateLogFile(TeXErrors &terr)
lyxerr.debug(token, Error::LATEX);
if (token.prefixIs("Build Warning:")) {
if (prefixIs(token, "Build Warning:")) {
// Here shall we handle different
// types of warnings
retval |= LATEX_WARNING;
lyxerr.debug("Build Warning.", Error::LATEX);
} else if (token.prefixIs("! Build Error:")) {
} else if (prefixIs(token, "! Build Error:")) {
// Here shall we handle different
// types of errors
retval |= LATEX_ERROR;
@ -161,12 +152,12 @@ int Literate::scanLiterateLogFile(TeXErrors &terr)
int Literate::scanBuildLogFile(TeXErrors &terr)
{
LString token;
string token;
int retval = NO_ERRORS;
LyXLex lex(NULL, 0);
LyXLex lex(0, 0);
LString tmp = litfile + ".log";
string tmp = litfile + ".log";
if (!lex.setFile(tmp)) {
// unable to open file
@ -183,12 +174,12 @@ int Literate::scanBuildLogFile(TeXErrors &terr)
lyxerr.debug(token, Error::LATEX);
if (token.prefixIs("Build Warning:")) {
if (prefixIs(token, "Build Warning:")) {
// Here shall we handle different
// types of warnings
retval |= LATEX_WARNING;
lyxerr.debug("Build Warning.", Error::LATEX);
} else if (token.prefixIs("! Build Error:")) {
} else if (prefixIs(token, "! Build Error:")) {
// Here shall we handle different
// types of errors
retval |= LATEX_ERROR;

View File

@ -24,10 +24,10 @@
///
class Literate: public LaTeX {
public:
Literate(LString const & cmd, LString const & file, LString const & path,
LString const & litfile,
LString const & literate_cmd, LString const & literate_filter,
LString const & build_cmd, LString const & build_filter);
Literate(string const & cmd, string const & file, string const & path,
string const & litfile,
string const & literate_cmd, string const & literate_filter,
string const & build_cmd, string const & build_filter);
/// runs literate and latex
int weave(TeXErrors &, MiniBuffer *);
@ -43,19 +43,19 @@ public:
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

View File

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

View File

@ -5,21 +5,14 @@
#include "lyx_main.h"
#include "lyxrc.h"
#include "LString.h"
#include "filetools.h"
#include "support/filetools.h"
#include "pathstack.h"
#include "buffer.h"
#include "lyx_gui_misc.h"
#include "syscall.h"
#include "support/syscall.h"
#include "gettext.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 BufferView *current_view;
extern int MakeDVIOutput(Buffer *buffer);
@ -49,7 +42,7 @@ void SendtoApplyCB(FL_OBJECT *, long)
if (!current_view->available())
return;
LString command = fl_get_input(fd_form_sendto->input_cmd);
string command = fl_get_input(fd_form_sendto->input_cmd);
if (command.empty())
return;
Buffer *buffer = current_view->currentBuffer();
@ -63,7 +56,7 @@ void SendtoApplyCB(FL_OBJECT *, long)
}
AllowInput();
}
LString ftypeext;
string ftypeext;
if (fl_get_button(fd_form_sendto->radio_ftype_lyx))
ftypeext = ".lyx";
else if (fl_get_button(fd_form_sendto->radio_ftype_latex))
@ -78,14 +71,14 @@ void SendtoApplyCB(FL_OBJECT *, long)
return;
}
}
LString fname = SpaceLess(ChangeExtension(buffer->getFileName(),
string fname = SpaceLess(ChangeExtension(buffer->getFileName(),
ftypeext, true));
if (!command.contains("$$FName"))
if (!contains(command, "$$FName"))
command = "( " + command + " ) <$$FName";
command.subst("$$FName",fname);
subst(command, "$$FName",fname);
command += " &"; // execute in background
// push directorypath, if necessary
LString path = OnlyPath(buffer->getFileName());
string path = OnlyPath(buffer->getFileName());
if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)){
path = buffer->tmppath;
}

View File

@ -1,13 +1,13 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
*
*======================================================*/
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
* ======================================================*/
#include <config.h>
@ -27,16 +27,10 @@
#include "intl.h"
#include "lyxrc.h"
#include "lyxscreen.h"
#include "filetools.h" // OnlyFilename()
#include "support/filetools.h" // OnlyFilename()
#include "layout.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;
FD_form_main *fd_form_main; /* a pointer to the one in LyXView
should be removed as soon as possible */
@ -56,7 +50,7 @@ BufferView *current_view;
LyXView::LyXView(int width, int 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");
lyxfunc = new LyXFunc(this);
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
void LyXView::updateWindowTitle() {
static LString last_title="LyX";
LString title = "LyX";
static string last_title="LyX";
string title = "LyX";
if (currentView()->available()) {
LString cur_title = currentBuffer()->getFileName();
string cur_title = currentBuffer()->getFileName();
if (!cur_title.empty()){
title += ": " + OnlyFilename(cur_title);
if (!currentBuffer()->isLyxClean())

View File

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

View File

@ -1,6 +1,6 @@
#include <config.h>
#include <stdlib.h>
#include <cstdlib>
#include "definitions.h"
#include FORMS_H_LOCATION
@ -8,7 +8,7 @@
#include "lyx_main.h"
#include "lyxrc.h"
#include "LString.h"
#include "filetools.h"
#include "support/filetools.h"
#include "buffer.h"
#include "minibuffer.h"
#include "vspace.h"
@ -16,13 +16,6 @@
#include "BufferView.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 MiniBuffer *minibuffer;
extern BufferView *current_view;
@ -241,7 +234,7 @@ void PaperMarginsCB(FL_OBJECT *ob, long)
{
const FD_form_paper
*fd = fd_form_paper;
LString
string
str;
char
val;

View File

@ -1,6 +1,6 @@
#include <config.h>
#include <stdlib.h>
#include <cstdlib>
#include "definitions.h"
#include FORMS_H_LOCATION
#include "layout_forms.h"
@ -13,13 +13,6 @@
#include "gettext.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 MiniBuffer *minibuffer;
extern BufferView *current_view;
@ -226,7 +219,7 @@ void CheckPExtraOptCB(FL_OBJECT *ob, long)
{
int
n;
LString
string
s1, s2;
ActivateParagraphExtraButtons();
@ -288,7 +281,7 @@ void CheckPExtraOptCB(FL_OBJECT *ob, long)
static bool CheckInputWidth()
{
LString
string
s1,s2;
s1 = fl_get_input(fd_form_paragraph_extra->input_pextra_width);

View File

@ -1,13 +1,13 @@
#include <config.h>
#include <stdlib.h>
#include <cstdlib>
#include "definitions.h"
#include FORMS_H_LOCATION
#include "layout_forms.h"
#include "lyx_main.h"
#include "lyxrc.h"
#include "LString.h"
#include "filetools.h"
#include "support/filetools.h"
#include "buffer.h"
#include "vspace.h"
#include "lyx_gui_misc.h"
@ -16,12 +16,6 @@
#include "gettext.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();
/* Prototypes */
@ -55,7 +49,7 @@ bool UpdateLayoutTable(int flag)
column,row;
char
buf[12];
LString
string
pwidth, special;
LyXTable *table = current_view->currentBuffer()->text->cursor.par->table;
@ -259,7 +253,7 @@ void TableOptionsCB(FL_OBJECT *ob, long)
cell,
s,
num = 0;
LString
string
special,
str;
@ -458,7 +452,7 @@ void SetPWidthCB(FL_OBJECT *ob, long)
fl_set_object_label(fd_form_table_options->text_warning,"");
Confirmed = false;
if (ob == fd_form_table_options->input_column_width) {
LString
string
str;
str = fl_get_input(ob);
if (!str.empty() && !isValidLength(str)) {

View File

@ -6,7 +6,7 @@
* Description: A bitmap table uses a single bitmap to simulate a 2d array
* of bitmap buttons. It can be used to build bitmap menus.
*
* Copyright (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
* the GNU General Public Licence version 2 or later.
@ -15,13 +15,7 @@
#include <config.h>
// $Id: bmtable.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $
#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 <cstdlib>
#include "bmtable.h"
#include XPM_H_LOCATION

File diff suppressed because it is too large Load Diff

View File

@ -45,7 +45,7 @@ struct DEPCLEAN {
///
bool clean;
///
LString master;
string master;
///
DEPCLEAN *next;
};
@ -60,7 +60,7 @@ public:
/**@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();
@ -131,17 +131,17 @@ public:
bool readLyXformat2(LyXLex &,LyXParagraph *par = 0);
/// 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.
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,
LString const & original_path,
void makeLaTeXFile(string const & filename,
string const & original_path,
bool nice, bool only_body = false);
///
@ -157,12 +157,12 @@ public:
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)
LString GetLanguage() const {
string GetLanguage() const {
return params.language;
}
@ -179,7 +179,7 @@ public:
bool isBakClean() const { return bak_clean; }
///
bool isDepClean(LString const & name) const;
bool isDepClean(string const & name) const;
///
void markLyxClean() {
@ -202,7 +202,7 @@ public:
void markBakClean() { bak_clean = true; }
///
void markDepClean(LString const & name);
void markDepClean(string const & name);
///
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.
void setFileName(LString const & newfile);
void setFileName(string const & newfile);
/// Name of the document's parent
void setParentName(LString const &);
void setParentName(string const &);
/// Is buffer read-only?
bool isReadonly() { return read_only; }
@ -283,20 +283,20 @@ public:
/** Insert an inset into the buffer
Insert inset into buffer, placing it in a layout of lout,
if no_table make sure that it doesn't end up in a table. */
void insertInset(Inset *, LString const &lout=LString(),
void insertInset(Inset *, string const &lout=string(),
bool no_table = false);
///
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
bool removeAutoInsets();
@ -332,10 +332,10 @@ public:
LyXVC lyxvc;
/// where the temporaries go if we want them
LString tmppath;
string tmppath;
///
LString filepath;
string filepath;
/** While writing as LaTeX, tells whether we are
doing a 'nice' LaTeX file */
@ -364,21 +364,21 @@ private:
///
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,
LyXParagraph* &par);
///
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 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.
void push_tag(FILE *file, char const *tag, int& pos, char stack[5][3]);
@ -413,7 +413,7 @@ private:
bool read_only;
/// name of the file the buffer is associated with.
LString filename;
string filename;
/// Format number of buffer
float format;
@ -459,7 +459,7 @@ void Buffer::InsetWakeup()
inline
void Buffer::setParentName(LString const &name)
void Buffer::setParentName(string const &name)
{
params.parentname = name;
}

View File

@ -3,10 +3,10 @@
*
* LyX, The Document Word Processor
*
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
* This file is Copyleft (C) 1996-1998
* This file is Copyright 1996-1999
* Lars Gullik Bjønnes
*
*======================================================
@ -22,8 +22,8 @@
#include "bufferlist.h"
#include "lyx_main.h"
#include "minibuffer.h"
#include "FileInfo.h"
#include "filetools.h"
#include "support/FileInfo.h"
#include "support/filetools.h"
#include "lyx_gui_misc.h"
#include "lastfiles.h"
#include "error.h"
@ -33,17 +33,11 @@
#include "lyx_cb.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 MiniBuffer *minibuffer;
extern void SmallUpdate(signed char);
extern void BeforeChange();
extern int RunLinuxDoc(int, LString const &);
extern int RunLinuxDoc(int, string const &);
//
// 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,
bool ronly)
{
@ -87,7 +81,7 @@ Buffer* BufferStorage::newBuffer(LString const &s,
&& buffer[i]) i++;
buffer[i] = new Buffer(s, lyxrc, ronly);
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];
}
@ -149,7 +143,7 @@ extern void MenuWrite(Buffer*);
bool BufferList::QwriteAll()
{
bool askMoreConfirmation = false;
LString unsaved;
string unsaved;
BufferStorage_Iter biter(bstore);
Buffer *b=0;
while ((b=biter())) {
@ -192,7 +186,7 @@ bool BufferList::write(Buffer *buf, bool makeBackup)
// make a backup
if (makeBackup) {
LString s = buf->filename + '~';
string s = buf->filename + '~';
// Rename is the wrong way of making a backup,
// this is the correct way.
/* truss cp fil fil2:
@ -226,7 +220,7 @@ bool BufferList::write(Buffer *buf, bool makeBackup)
times->actime = finfo.getAccessTime();
times->modtime = finfo.getModificationTime();
long blksize = finfo.getBlockSize();
lyxerr.debug(LString("BlockSize: ") + int(blksize));
lyxerr.debug(string("BlockSize: ") + tostr(blksize));
FilePtr fin(buf->filename,FilePtr::read);
FilePtr fout(s,FilePtr::truncate);
if (fin() && fout()) {
@ -261,7 +255,7 @@ bool BufferList::write(Buffer *buf, bool makeBackup)
MakeDisplayPath(buf->filename));
// now delete the autosavefile
LString a = OnlyPath(buf->filename);
string a = OnlyPath(buf->filename);
a += '#';
a += OnlyFilename(buf->filename);
a += '#';
@ -275,7 +269,7 @@ bool BufferList::write(Buffer *buf, bool makeBackup)
} else {
// Saving failed, so backup is not backup
if (makeBackup) {
LString s = buf->filename + '~';
string s = buf->filename + '~';
rename(s.c_str(), buf->filename.c_str());
}
minibuffer->Set(_("Save failed!"));
@ -347,7 +341,7 @@ void BufferList::makePup(int pup)
BufferStorage_Iter biter(bstore);
Buffer *b=0;
while ((b=biter())) {
LString relbuf = MakeDisplayPath(b->filename,30);
string relbuf = MakeDisplayPath(b->filename,30);
fl_addtopup(pup, relbuf.c_str());
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);
Buffer *b=0;
while ((b=biter())) {
if (!b->isDepClean(mastertmpdir)) {
LString writefile = mastertmpdir;
string writefile = mastertmpdir;
writefile += '/';
writefile += ChangeExtension(b->getFileName(), ".tex", true);
b->makeLaTeXFile(writefile,mastertmpdir,false,true);
@ -433,7 +427,7 @@ void BufferList::emergencyWriteAll()
+ _(" as..."));
for (int i=0; i<3 && !madeit; i++) {
LString s;
string s;
// We try to save three places:
// 1) Same place as document.
@ -442,7 +436,7 @@ void BufferList::emergencyWriteAll()
if (i==0) {
s = b->filename;
} else if (i==1) {
s = AddName(getEnvPath("HOME"),
s = AddName(GetEnvPath("HOME"),
b->filename);
} else { // MakeAbsPath to prepend the current drive letter on OS/2
s = AddName(MakeAbsPath("/tmp/"),
@ -450,7 +444,7 @@ void BufferList::emergencyWriteAll()
}
s += ".emergency";
lyxerr.print(LString(" ") + (i+1) + ") " + s);
lyxerr.print(string(" ") + tostr(i+1) + ") " + s);
if (b->writeFile(s,true)) {
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);
LString ts = s;
LString e = OnlyPath(s);
LString a = e;
string ts = s;
string e = OnlyPath(s);
string a = e;
// File information about normal file
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
LyXLex lex(NULL, 0);
LyXLex lex(0, 0);
lex.setFile(ts);
if (b->readFile(lex))
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);
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);
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 */
Buffer *b = bstore.newBuffer(name, lyxrc);
@ -571,7 +565,7 @@ Buffer* BufferList::newFile(LString const & name, LString tname)
}
if (!tname.empty() && IsLyXFilename(tname)){
bool templateok = false;
LyXLex lex(NULL,0);
LyXLex lex(0,0);
lex.setFile(tname);
if (lex.IsOK()) {
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
LString s = MakeAbsPath(filename);
string s = MakeAbsPath(filename);
// Is this done too early?
// Is it LinuxDoc?
@ -663,7 +657,7 @@ Buffer* BufferList::loadLyXFile(LString const & filename, bool tolastfiles)
_("Create new document with this name?")))
{
// Find a free buffer
b = newFile(s,LString());
b = newFile(s,string());
}
break;
}

View File

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

View File

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

View File

@ -63,7 +63,7 @@ public:
///
InsetQuotes::quote_times quotes_times;
///
LString fontsize;
string fontsize;
///
signed char textclass;
@ -79,29 +79,29 @@ public:
///
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 */
/// The graphics driver
LString graphicsDriver;
string graphicsDriver;
///
LString fonts;
string fonts;
///
Spacing spacing;
///
@ -109,21 +109,21 @@ public:
///
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 sides; // add approp. signedness
///
LString pagestyle;
string pagestyle;
///
Bullet temp_bullets[4];
///
@ -141,7 +141,7 @@ public:
///
bool use_amsmath;
/// Time ago we agreed that this was a buffer property [ale990407]
LString parentname;
string parentname;
protected:
private:
///

View File

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

View File

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

View File

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

View File

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

View File

@ -36,17 +36,10 @@
#endif
#include "combox.h"
#include <string.h>
#include <cstring>
#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)
{
browser = button = 0;
@ -80,20 +73,20 @@ void Combox::clear()
void Combox::remove()
{
//lyxerr.print(LString("Button: ") + int(button));
//lyxerr.print(string("Button: ") + int(button));
if (button) {
fl_delete_object(button);
fl_free_object(button);
}
//lyxerr.print(LString("Label: ") + int(label));
//lyxerr.print(string("Label: ") + int(label));
if (label && label!=button) {
fl_delete_object(label);
fl_free_object(label);
}
//lyxerr.print(LString("Form: ") + int(form));
//lyxerr.print(LString("Browser: ") + int(browser));
//lyxerr.print(string("Form: ") + int(form));
//lyxerr.print(string("Browser: ") + int(browser));
if (form && browser) {
fl_delete_object(browser);
fl_free_object(browser);
@ -379,7 +372,7 @@ int Combox::peek_event(FL_FORM * form, void *xev)
static int num_bytes;
KeySym keysym_return;
num_bytes = XLookupString(&((XEvent*)xev)->xkey, s_r, 10,
&keysym_return, NULL);
&keysym_return, 0);
XFlush(fl_display);
switch (keysym_return) {
case XK_Down:

View File

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

View File

@ -1,44 +1,37 @@
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
*
*======================================================*/
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
* ======================================================*/
#include <config.h>
#include FORMS_H_LOCATION
#include <stdlib.h>
#include <cstdlib>
#include "credits.h"
#include "credits_form.h"
#include "LString.h"
#include "filetools.h"
#include "support/filetools.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "gettext.h"
// $Id: credits.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $
#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;
extern string system_lyxdir;
/**** Forms and Objects ****/
static FD_form_credits *fd_form_credits = NULL;
static FD_copyright *fd_form_copyright = NULL;
static FD_form_credits *fd_form_credits = 0;
static FD_copyright *fd_form_copyright = 0;
void CreditsOKCB(FL_OBJECT *, long) {
fl_hide_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 */
/* 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();
fl_set_form_atclose(fd_form_credits->form_credits,
CancelCloseBoxCB, NULL);
CancelCloseBoxCB, 0);
if (!fl_load_browser(fd_form_credits->browser_credits,
real_file.c_str())) {
@ -84,7 +77,7 @@ void ShowCredits()
void CopyrightOKCB(FL_OBJECT *, long) {
fl_hide_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
@ -93,7 +86,7 @@ void ShowCopyright()
if (!fd_form_copyright || !fd_form_copyright->copyright) {
fd_form_copyright = create_form_copyright();
fl_set_form_atclose(fd_form_copyright->copyright,
CancelCloseBoxCB, NULL);
CancelCloseBoxCB, 0);
}
// Funny emotional remark by Asger deleted. (Lgb)

View File

@ -5,13 +5,7 @@
#endif
#include "error.h"
#include <stdio.h>
// $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 */
#include <cstdio>
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)
print(msg);
// should also print to the logfile
}
void Error::print(LString const & msg)
void Error::print(string const & msg)
{
if (!msg.empty())
fprintf(stderr, "%s\n", msg.c_str());

View File

@ -55,16 +55,16 @@ public:
/// Not implemented yet.
void setLogLevel(int level);
/// 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?
{
return (bool)(debuglevel & level);
}
///
void print(LString const & msg);
void print(string const & msg);
protected:
private:
///

View File

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

View File

@ -28,18 +28,18 @@ class UserCache
{
public:
///
UserCache(LString const & pszName = LString(), uid_t ID = 0,
UserCache *pRoot = NULL);
UserCache(string const & pszName = string(), uid_t ID = 0,
UserCache *pRoot = 0);
///
~UserCache();
// interface
/// seeks user name from user ID
LString Find(uid_t ID);
string Find(uid_t ID);
private:
///
uid_t ID;
///
LString pszName;
string pszName;
///
UserCache *pNext, *pRoot;
// internal methods
@ -54,19 +54,19 @@ class GroupCache
{
public:
///
GroupCache(LString const & pszName = LString(), gid_t ID = 0,
GroupCache *pRoot = NULL);
GroupCache(string const & pszName = string(), gid_t ID = 0,
GroupCache *pRoot = 0);
///
~GroupCache();
// interface
/// seeks group name from group ID
LString Find(gid_t ID);
string Find(gid_t ID);
private:
///
gid_t ID;
///
LString pszName;
string pszName;
///
GroupCache *pNext, *pRoot;
// internal methods
@ -81,9 +81,9 @@ class LyXDirEntry
{
private:
friend class LyXFileDlg;
LString pszName;
LString pszDisplayed;
LString pszLsEntry;
string pszName;
string pszDisplayed;
string pszLsEntry;
/// compares two LyXDirEntry objects content (used by qsort)
static int ldeCompProc(const LyXDirEntry *r1, const LyXDirEntry *r2);
LyXDirEntry() {};
@ -99,15 +99,15 @@ public:
///
~LyXFileDlg();
/// sets file selector user button action
void SetButton(int iIndex, LString const & pszName = LString(),
LString const & pszPath = LString());
void SetButton(int iIndex, string const & pszName = string(),
string const & pszPath = string());
/// gets last dialog directory
LString GetDirectory();
string GetDirectory();
/// launches dialog and returns selected file
LString Select(LString const & pszTitle = LString(),
LString const & pszPath = LString(),
LString const & pszMask = LString(),
LString const & pszSuggested = LString());
string Select(string const & pszTitle = string(),
string const & pszPath = string(),
string const & pszMask = string(),
string const & pszSuggested = string());
/// XForms objects callback (static)
static void FileDlgCB(FL_OBJECT *, long);
/// Callback for double click in list
@ -116,15 +116,15 @@ private:
// data
static FD_FileDlg *pFileDlgForm;
static LyXFileDlg *pCurrentDlg;
LString pszUserPath1;
LString pszUserPath2;
LString pszDirectory;
LString pszMask;
LString pszFileName;
string pszUserPath1;
string pszUserPath2;
string pszDirectory;
string pszMask;
string pszFileName;
int iDepth;
int iLastSel;
long lLastTime;
LString pszInfoLine;
string pszInfoLine;
LyXDirEntry *pCurrentNames;
int iNumNames;
@ -135,11 +135,11 @@ private:
/// updates dialog list to match class directory
void Reread();
/// sets dialog current directory
void SetDirectory(LString const & pszPath);
void SetDirectory(string const & pszPath);
/// sets dialog file mask
void SetMask(LString const & pszNewMask);
void SetMask(string const & pszNewMask);
/// sets dialog information line
void SetInfoLine(LString const & pszLine);
void SetInfoLine(string const & pszLine);
/// handle dialog during file selection
bool RunDialog();
/// 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 <unistd.h>
#include <signal.h>
#include <csignal>
#include <sys/wait.h>
#include FORMS_H_LOCATION
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include "form1.h"
#include "figinset.h"
@ -46,7 +46,7 @@ extern long int background_pixels;
#include "lyx_main.h"
#include "buffer.h"
#include "filedlg.h"
#include "filetools.h"
#include "support/filetools.h"
#include "LyXView.h" // just because of form_main
#include "error.h"
#include "lyxdraw.h"
@ -54,13 +54,7 @@ extern long int background_pixels;
#include "lyxrc.h"
#include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "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 */
#include "support/FileInfo.h"
extern BufferView *current_view;
static volatile bool alarmed;
@ -103,7 +97,7 @@ struct pidwait {
static Figref **figures; /* all the figures */
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 bool bitmap_waiting = false; /* bitmaps are waiting finished */
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 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;
@ -133,10 +127,10 @@ void addpidwait(int pid)
pw = p;
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) {
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
if (lyxerr.debugging()) {
lyxerr.print(
LString("Spawned child ")
+ int(forkstat));
string("Spawned child ")
+ tostr(forkstat));
}
addpidwait(forkstat);
break; // in parent process
} else {
tmpdisp = XOpenDisplay(XDisplayName(NULL));
tmpdisp = XOpenDisplay(XDisplayName(0));
XFlush(tmpdisp);
}
im = XGetImage(tmpdisp, p->bitmap, 0, 0,
@ -247,8 +241,8 @@ int GhostscriptMsg(FL_OBJECT *, Window, int, int,
}
noim:
if (lyxerr.debugging()) {
lyxerr.print(LString("Killing gs ")
+ int(p->gspid));
lyxerr.print(string("Killing gs ")
+ tostr(p->gspid));
}
kill(p->gspid, SIGHUP);
@ -262,8 +256,8 @@ int GhostscriptMsg(FL_OBJECT *, Window, int, int,
}
} else {
if (lyxerr.debugging()) {
lyxerr.print(LString("Killing gs ")
+int(p->gspid));
lyxerr.print(string("Killing gs ")
+tostr(p->gspid));
}
kill(p->gspid, SIGHUP);
@ -303,8 +297,8 @@ static void AllocColors(int num)
if (i) XFreeColors(fl_display, color_map,
gs_pixels, i, 0);
if(lyxerr.debugging()) {
lyxerr.print(LString("Cannot allocate color cube " )
+ int(num));
lyxerr.print(string("Cannot allocate color cube " )
+ tostr(num));
}
AllocColors(num-1);
return;
@ -325,8 +319,8 @@ static void AllocGrays(int num)
int i;
if (lyxerr.debugging()) {
lyxerr.print(LString("Allocating grayscale ramp ")
+ int(num));
lyxerr.print(string("Allocating grayscale ramp ")
+ tostr(num));
}
if (num < 4) {
@ -342,8 +336,8 @@ static void AllocGrays(int num)
if (i) XFreeColors(fl_display, color_map,
gs_pixels, i, 0);
if (lyxerr.debugging()) {
lyxerr.print(LString("Cannot allocate grayscale ")
+ int(num));
lyxerr.print(string("Cannot allocate grayscale ")
+ tostr(num));
}
AllocGrays(num/2);
return;
@ -441,7 +435,7 @@ int FindBmpIndex(figdata *tmpdata)
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
// have allocated
@ -525,7 +519,7 @@ static void runqueue()
if (pid == 0) { // child
char **env, rbuf[80], gbuf[40];
int ne = 0;
Display* tempdisp = XOpenDisplay(XDisplayName(NULL));
Display* tempdisp = XOpenDisplay(XDisplayName(0));
// create translation file
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!
if (lyxerr.debugging()) {
lyxerr.print(LString("Will set GHOSTVIEW"
lyxerr.print(string("Will set GHOSTVIEW"
" property to [") +
tbuf + "]");
}
@ -596,8 +590,8 @@ static void runqueue()
// deletes it
if (lyxerr.debugging()) {
lyxerr.print("Releasing the server");
lyxerr.print(LString('[') +
int(getpid()) +
lyxerr.print(string("[") +
tostr(getpid()) +
"] GHOSTVIEW property"
" found. Waiting.");
}
@ -685,20 +679,20 @@ static void runqueue()
"-dSAFER",
rbuf, gbuf, tbuf,
p->data->fname.c_str(),
"showpage.ps", "quit.ps", "-", NULL);
"showpage.ps", "quit.ps", "-", 0);
// if we are still there, an error occurred.
lyxerr.print(LString("Error executing ghostscript. ")
+"Code: "+err);
lyxerr.print(string("Error executing ghostscript. ")
+ "Code: " + tostr(err));
lyxerr.debug("Cmd: "
+ lyxrc->ps_command
+" -sDEVICE=x11 "
+ tbuf + LString(' ')
+ tbuf + tostr(' ')
+ p->data->fname);
_exit(0); // no gs?
}
// normal process (parent)
if (lyxerr.debugging()) {
lyxerr.print(LString("GS [") + int(pid) + "] started");
lyxerr.print(string("GS [") + tostr(pid) + "] started");
}
gsqueue = gsqueue->next;
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->data = data;
p->next = NULL;
p->next = 0;
// now put into queue
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 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;
XWindowAttributes wa;
if (fname.empty()) return NULL;
if (fname.empty()) return 0;
while (i < bmpinsref) {
if (bitmaps[i]->wid == wid && bitmaps[i]->hgh == hgh &&
@ -754,7 +748,7 @@ static figdata *getfigdata(int wid, int hgh, LString const & fname,
}
++i;
}
/* not found -> create new record or return NULL if no record */
/* not found -> create new record or return 0 if no record */
++bmpinsref;
if (bmpinsref > bmparrsize) {
// allocate more space
@ -831,7 +825,7 @@ void sigchldchecker(pid_t pid, int *status)
bool pid_handled = false;
lyxerr.debug(LString("Got pid = ") + long (pid));
lyxerr.debug(string("Got pid = ") + tostr(pid));
pid_handled = false;
for (i = bmpinsref - 1; i >= 0; --i) {
if (bitmaps[i]->reading && pid == bitmaps[i]->gspid) {
@ -841,7 +835,7 @@ void sigchldchecker(pid_t pid, int *status)
p->reading = false;
if (bitmaps[i]->gsdone) *status = 0;
if (*status == 0) {
lyxerr.debug(LString("GS [") + int(pid) +
lyxerr.debug(string("GS [") + tostr(pid) +
"] exit OK.");
} else {
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) {
lyxerr.debug("Checking pid in pidwait");
pidwait *p = pw, *prev = NULL;
pidwait *p = pw, *prev = 0;
while (p) {
if (pid == p->pid) {
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)
prev->next = p->next;
else
@ -932,7 +926,7 @@ static void RegisterFigure(InsetFig *fi)
Figref *tmpfig;
if (figinsref == 0) InitFigures();
fi->form = NULL;
fi->form = 0;
++figinsref;
if (figinsref > figarrsize) {
// allocate more space
@ -943,14 +937,14 @@ static void RegisterFigure(InsetFig *fi)
figures = tmp;
}
tmpfig = new Figref;
tmpfig->data = NULL;
tmpfig->data = 0;
tmpfig->inset = fi;
figures[figinsref-1] = tmpfig;
fi->figure = tmpfig;
if (lyxerr.debugging()) {
lyxerr.print(LString("Register Figure: buffer:[") +
long(current_view->currentBuffer()) + "]");
lyxerr.print(string("Register Figure: buffer:[") +
tostr(current_view->currentBuffer()) + "]");
}
}
@ -977,7 +971,7 @@ static void UnregisterFigure(InsetFig *fi)
fl_hide_form(tmpfig->inset->form->Figure);
fl_free_form(tmpfig->inset->form->Figure);
free(tmpfig->inset->form);
tmpfig->inset->form = NULL;
tmpfig->inset->form = 0;
}
i = FindFigIndex(tmpfig);
--figinsref;
@ -993,7 +987,7 @@ static void UnregisterFigure(InsetFig *fi)
static char* NextToken(FILE *myfile)
{
char* token = NULL;
char* token = 0;
char c;
int i = 0;
@ -1091,7 +1085,7 @@ void InsetFig::Draw(LyXFont font, LyXScreen &scr, int baseline, float &x)
font.setFamily (LyXFont::SANS_FAMILY);
font.setSize (LyXFont::SIZE_FOOTNOTE);
LString justname = OnlyFilename (fname);
string justname = OnlyFilename (fname);
font.drawString(justname,pm,
baseline - font.maxAscent() - 4,
(int) x + 8);
@ -1110,8 +1104,8 @@ void InsetFig::Write(FILE *file)
Regenerate();
fprintf(file, "Figure size %d %d\n", wid, hgh);
if (!fname.empty()) {
LString buf1 = OnlyPath(owner->getFileName());
LString fname2 = MakeRelPath(fname, buf1);
string buf1 = OnlyPath(owner->getFileName());
string fname2 = MakeRelPath(fname, buf1);
fprintf(file, "file %s\n", fname2.c_str());
}
if (!subcaption.empty())
@ -1126,13 +1120,13 @@ void InsetFig::Write(FILE *file)
void InsetFig::Read(LyXLex &lex)
{
LString buf;
string buf;
bool finished = false;
while (lex.IsOK() && !finished) {
lex.next();
LString const token = lex.GetString();
string const token = lex.GetString();
lyxerr.debug("Token: " + token);
if (token.empty())
@ -1142,7 +1136,7 @@ void InsetFig::Read(LyXLex &lex)
} else if (token == "file") {
if (lex.next()) {
buf = lex.GetString();
LString buf1 = OnlyPath(owner->getFileName());
string buf1 = OnlyPath(owner->getFileName());
fname = MakeAbsPath(buf, buf1);
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();
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;
}
int InsetFig::DocBook(LString &file)
int InsetFig::DocBook(string &file)
{
LString figurename=fname;
string figurename=fname;
if(figurename.suffixIs(".eps"))
figurename=figurename.substring(0,fname.length()-5);
if(suffixIs(figurename, ".eps"))
figurename.erase(fname.length() - 5);
file += "@<graphic fileref=\"" + figurename + "\"></graphic>";
return 0;
@ -1274,7 +1268,7 @@ void InsetFig::Edit(int, int)
if (!form) {
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->Width,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,
pswid, pshgh, raw_wid, raw_hgh,
angle, flags & (3|8));
} else tmp->figure->data = NULL;
} else tmp->figure->data = 0;
tmp->subcaption = subcaption;
tmp->changedfname = false;
tmp->owner = owner;
@ -1338,10 +1332,10 @@ Inset::Code InsetFig::LyxCode() const
void InsetFig::Regenerate()
{
LString cmdbuf;
LString gcmd;
LString resizeW, resizeH;
LString rotate, recmd;
string cmdbuf;
string gcmd;
string resizeW, resizeH;
string rotate, recmd;
if (fname.empty()) {
cmd = "\\fbox{\\rule[-0.5in]{0pt}{1in}";
@ -1351,8 +1345,8 @@ void InsetFig::Regenerate()
return;
}
LString buf1 = OnlyPath(owner->getFileName());
LString fname2 = MakeRelPath(fname, buf1);
string buf1 = OnlyPath(owner->getFileName());
string fname2 = MakeRelPath(fname, buf1);
gcmd = "\\includegraphics{" + fname2 + '}';
@ -1464,11 +1458,11 @@ void InsetFig::Regenerate()
void InsetFig::TempRegenerate()
{
LString gcmd;
LString cmdbuf;
LString resizeW, resizeH;
LString rotate, recmd;
LString tsubcap;
string gcmd;
string cmdbuf;
string resizeW, resizeH;
string rotate, recmd;
string tsubcap;
char const *tfname; // *textra;
float tangle, txwid, txhgh;
@ -1488,8 +1482,8 @@ void InsetFig::TempRegenerate()
return;
}
LString buf1 = OnlyPath(owner->getFileName());
LString fname2 = MakeRelPath(tfname, buf1);
string buf1 = OnlyPath(owner->getFileName());
string fname2 = MakeRelPath(tfname, buf1);
// \includegraphics*[<llx,lly>][<urx,ury>]{file}
gcmd = "\\includegraphics{" + fname2 + '}';
@ -1586,8 +1580,8 @@ void InsetFig::TempRegenerate()
if (!rotate.empty()) cmdbuf += '}';
if (!recmd.empty()) cmdbuf += '}';
if (psubfigure && !tsubcap.empty()) {
cmdbuf = LString("\\subfigure{") + tsubcap
+ LString("}{") + cmdbuf + "}";
cmdbuf = string("\\subfigure{") + tsubcap
+ string("}{") + cmdbuf + "}";
}
@ -1697,7 +1691,7 @@ void InsetFig::Recompute()
psx, psy, pswid, pshgh,
raw_wid, raw_hgh,
angle, flags & (3|8));
} else figure->data = NULL;
} else figure->data = 0;
// free the old data
if (pf) freefigdata(pf);
@ -1711,7 +1705,7 @@ void InsetFig::GetPSSizes()
{
/* get %%BoundingBox: from postscript file */
int lastchar, c;
char *p = NULL;
char *p = 0;
/* defaults to associated size
* ..just in case the PS-file is not readable (Henner,24-Aug-97)
@ -1764,7 +1758,7 @@ void InsetFig::GetPSSizes()
}
c = 0;
delete[] p;
p = NULL;
p = 0;
}
lastchar = c;
}
@ -1896,13 +1890,13 @@ void InsetFig::CallbackFig(long arg)
angle = atof(fl_get_input(form->Angle));
p = fl_get_input(form->EpsFile);
if (p && *p) {
LString buf1 = OnlyPath(owner->getFileName());
string buf1 = OnlyPath(owner->getFileName());
fname = MakeAbsPath(p, buf1);
changedfname = true;
} else {
if (!fname.empty()) {
changedfname = true;
fname.clean();
fname.erase();
}
}
subcaption = fl_get_input(form->Subcaption);
@ -1918,7 +1912,7 @@ void InsetFig::CallbackFig(long arg)
fl_hide_form(form->Figure);
fl_free_form(form->Figure);
free(form);
form = NULL;
form = 0;
}
break;
} //if not readonly
@ -1930,7 +1924,7 @@ void InsetFig::CallbackFig(long arg)
fl_hide_form(form->Figure);
fl_free_form(form->Figure);
free(form);
form = NULL;
form = 0;
break;
}
@ -2056,8 +2050,8 @@ void InsetFig::RestoreForm()
sprintf(buf, "%g", angle);
fl_set_input(form->Angle, buf);
if (!fname.empty()){
LString buf1 = OnlyPath(owner->getFileName());
LString fname2 = MakeRelPath(fname, buf1);
string buf1 = OnlyPath(owner->getFileName());
string fname2 = MakeRelPath(fname, buf1);
fl_set_input(form->EpsFile, fname2.c_str());
}
else fl_set_input(form->EpsFile, "");
@ -2084,29 +2078,29 @@ void InsetFig::Preview(char const *p)
return; // parent process
}
LString buf1 = OnlyPath(owner->getFileName());
LString buf2 = MakeAbsPath(p, buf1);
string buf1 = OnlyPath(owner->getFileName());
string buf2 = MakeAbsPath(p, buf1);
lyxerr.print(LString("Error during rendering ") +
int(execlp(lyxrc->view_pspic_command.c_str(),
lyxerr.print(string("Error during rendering ") +
tostr(execlp(lyxrc->view_pspic_command.c_str(),
lyxrc->view_pspic_command.c_str(),
buf2.c_str(),
NULL)));
0)));
_exit(0);
}
void InsetFig::BrowseFile()
{
LString buf, buf2, bufclip;
static LString current_figure_path;
string buf, buf2, bufclip;
static string current_figure_path;
static int once = 0;
LyXFileDlg fileDlg;
if (lyxerr.debugging()) {
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());
buf2 = OnlyPath(buf);
@ -2133,10 +2127,10 @@ void InsetFig::BrowseFile()
ProhibitInput();
if (once) {
p =fileDlg.Select(_("EPS Figure"), current_figure_path,
"*ps", LString());
"*ps", string());
} else {
p = fileDlg.Select(_("EPS Figure"), buf,
"*ps", LString());
"*ps", string());
}
AllowInput();
@ -2146,8 +2140,8 @@ void InsetFig::BrowseFile()
current_figure_path = OnlyPath(p);
once = 1;
if (p.contains("#") || p.contains("~") || p.contains("$")
|| p.contains("%") || p.contains(" "))
if (contains(p, "#") || contains(p, "~") || contains(p, "$")
|| contains(p, "%") || contains(p, " "))
{
WriteAlert(_("Filename can't contain any of these characters:"), // xgettext:no-c-format
_("space, '#', '~', '$' or '%'."));
@ -2164,7 +2158,7 @@ void GraphicsCB(FL_OBJECT *obj, long arg)
/* obj->form contains the form */
if (lyxerr.debugging()) {
lyxerr.print(LString("GraphicsCB callback: ") + long(arg));
lyxerr.print(string("GraphicsCB callback: ") + tostr(arg));
}
/* find inset we were reacting to */
@ -2173,8 +2167,8 @@ void GraphicsCB(FL_OBJECT *obj, long arg)
== obj->form) {
if (lyxerr.debugging()) {
lyxerr.print(LString("Calling back figure ")
+int(i));
lyxerr.print(string("Calling back figure ")
+ tostr(i));
}
figures[i]->inset->CallbackFig(arg);
return;
@ -2188,8 +2182,8 @@ void HideFiguresPopups()
if (figures[i]->inset->form
&& figures[i]->inset->form->Figure->visible) {
if (lyxerr.debugging()) {
lyxerr.print(LString("Hiding figure ")
+int(i));
lyxerr.print(string("Hiding figure ")
+ tostr(i));
}
// hide and free the form
figures[i]->inset->CallbackFig(9);

View File

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

View File

@ -3,10 +3,10 @@
*
* LyX, The Document Processor
*
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
*======================================================*/
* ======================================================*/
#include <config.h>
@ -16,12 +16,7 @@
#include "lyxinset.h"
#include "error.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 */
#include "support/lstrings.h"
/* Insets default methods */
@ -76,15 +71,15 @@ LyXFont Inset::ConvertFont(LyXFont font)
void UpdatableInset::InsetButtonPress(int x, int y, int button)
{
lyxerr.debug(LString("Inset Button Press x=")+ x +
", y=" + y + ", button=" + button);
lyxerr.debug(string("Inset Button Press x=")+ tostr(x) +
", y=" + tostr(y) + ", button=" + tostr(button));
}
void UpdatableInset::InsetButtonRelease(int x, int y, int button)
{
lyxerr.debug(LString("Inset Button Release x=")+ x +
", y=" + y + ", button=" + button);
lyxerr.debug(string("Inset Button Release x=")+ tostr(x) +
", y=" + tostr(y) + ", button=" + tostr(button));
}
@ -96,8 +91,8 @@ void UpdatableInset::InsetKeyPress(XKeyEvent *)
void UpdatableInset::InsetMotionNotify(int x, int y, int state)
{
lyxerr.debug(LString("Inset Motion Notify x=")+ x +
", y=" + y + ", state=" + state);
lyxerr.debug(string("Inset Motion Notify x=")+ tostr(x) +
", y=" + tostr(y) + ", state=" + tostr(state));
}

View File

@ -1,7 +1,7 @@
#include <config.h>
#include <stdlib.h>
#include <cstdlib>
#ifdef __GNUG__
#pragma implementation
@ -17,13 +17,13 @@
#include "gettext.h"
#include "bibforms.h"
#include "lyxtext.h"
#include "filetools.h"
#include "support/filetools.h"
extern BufferView *current_view;
FD_citation_form *citation_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);
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)
{
@ -173,7 +173,7 @@ void InsetCitation::Edit(int, int)
if (!citation_form) {
citation_form = create_form_citation_form();
fl_set_form_atclose(citation_form->citation_form,
CancelCloseBoxCB, NULL);
CancelCloseBoxCB, 0);
}
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()) {
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)
{
counter = 1;
@ -242,7 +242,7 @@ void InsetBibKey::setCounter(int c)
// of time cause LyX3 won't use lyxlex anyway. (ale)
void InsetBibKey::Write(FILE *file)
{
LString s;
string s;
if (!options.empty()) {
s += '[';
s += options + ']';
@ -253,13 +253,12 @@ void InsetBibKey::Write(FILE *file)
}
LString InsetBibKey::getScreenLabel() const
string InsetBibKey::getScreenLabel() const
{
if (!options.empty())
return options;
LString s;
return s + counter;
return tostr(counter);
}
@ -276,7 +275,7 @@ void InsetBibKey::Edit(int, int)
if (!bibitem_form) {
bibitem_form = create_form_bibitem_form();
fl_set_form_atclose(bibitem_form->bibitem_form,
CancelCloseBoxCB, NULL);
CancelCloseBoxCB, 0);
}
bibitem_form->vdata = this;
// 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)
:InsetCommand("BibTeX", dbase, style), owner(o)
{
@ -309,7 +308,7 @@ InsetBibtex::~InsetBibtex()
}
LString InsetBibtex::getScreenLabel() const
string InsetBibtex::getScreenLabel() const
{
return _("BibTeX Generated References");
}
@ -317,7 +316,7 @@ LString InsetBibtex::getScreenLabel() const
int InsetBibtex::Latex(FILE *file, signed char /*fragile*/)
{
LString bib;
string bib;
signed char dummy = 0;
int result = Latex(bib, dummy);
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
// 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
// absolute path there. This is a bit complicated since we can
// have a comma-separated list of bibliographies
LString db_in, adb, db_out;
string db_in, adb, db_out;
db_in = getContents();
db_in.split(adb, ',');
db_in=split(db_in, adb, ',');
while(!adb.empty()) {
if (!owner->niceFile &&
IsFileReadable(MakeAbsPath(adb,owner->filepath)+".bib"))
adb = MakeAbsPath(adb,owner->filepath);
db_out += adb;
db_out += ',';
db_in.split(adb,',');
db_in=split(db_in, adb,',');
}
db_out.strip(',');
db_out = strip(db_out, ',');
// Idem, but simpler
LString style;
string style;
if (!owner->niceFile
&& IsFileReadable(MakeAbsPath(getOptions(), owner->filepath)
+ ".bst"))
@ -369,7 +367,7 @@ int InsetBibtex::Latex(LString &file, signed char /*fragile*/)
}
// This method returns a comma separated list of Bibtex entries
LString InsetBibtex::getKeys()
string InsetBibtex::getKeys()
{
// This hack is copied from InsetBibtex::Latex.
// Is it still needed? Probably yes.
@ -381,16 +379,16 @@ LString InsetBibtex::getKeys()
// First look for bib-file in same directory as document,
// then in all directories listed in environment variable
// BIBINPUTS
LString bibfiles, linebuf, tmp, keys;
string bibfiles, linebuf, tmp, keys;
bibfiles = getContents();
bibfiles.split(tmp, ',');
bibfiles=split(bibfiles, tmp, ',');
while(!tmp.empty()) {
if (IsFileReadable(MakeAbsPath(tmp,owner->filepath)+".bib"))
tmp = MakeAbsPath(tmp,owner->filepath)+".bib";
else {
tmp = FileOpenSearch(getEnvPath("BIBINPUTS"),tmp,"bib");
tmp = FileOpenSearch(GetEnvPath("BIBINPUTS"),tmp,"bib");
if (tmp.empty())
tmp = FileOpenSearch(getEnvPath("BIBINPUT"),
tmp = FileOpenSearch(GetEnvPath("BIBINPUT"),
tmp, "bib");
}
// 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 '@'
if ( c == '\n') {
if ( linebuf.prefixIs("@") ) {
linebuf.subst('{','(');
linebuf.split(tmp,'(');
tmp.lowercase();
if ( ! tmp.prefixIs("@string") && !tmp.prefixIs("@preamble") ) {
linebuf.split(tmp,',');
if (prefixIs(linebuf, "@") ) {
subst(linebuf, '{','(');
linebuf=split(linebuf, tmp,'(');
tmp = lowercase(tmp);
if (!prefixIs(tmp, "@string") && !prefixIs(tmp, "@preamble") ) {
linebuf = split(linebuf, tmp,',');
if (!tmp.empty())
keys +=tmp.strip()+",";
keys += strip(tmp) + ",";
}
}
linebuf.clean();
linebuf.erase();
} else {
linebuf += c;
}
}
}
// Get next file name
bibfiles.split(tmp, ',');
bibfiles=split(bibfiles, tmp, ',');
}
return keys;
}
@ -438,7 +436,7 @@ void InsetBibtex::Edit(int, int)
if (!bibitem_form) {
bibitem_form = create_form_bibitem_form();
fl_set_form_atclose(bibitem_form->bibitem_form,
CancelCloseBoxCB, NULL);
CancelCloseBoxCB, 0);
}
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())
contents += ',';
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())) {
LString bd = db;
int n = contents.tokenPos(',', bd);
if (contains(contents, db.c_str())) {
string bd = db;
int n = tokenPos(contents, ',', bd);
if (n > 0) {
LString tmp(',');
string tmp(",");
tmp += bd;
contents.subst(tmp.c_str(), ",");
subst(contents, tmp.c_str(), ",");
} else if (n==0)
contents.split(bd, ',');
contents = split(contents, bd, ',');
else
return false;
}
@ -493,11 +491,11 @@ void BibitemUpdate(Combox* combox)
if (!current_view->available())
return;
LString tmp, bibkeys = current_view->currentBuffer()->getBibkeyList(',');
bibkeys.split(tmp,',');
string tmp, bibkeys = current_view->currentBuffer()->getBibkeyList(',');
bibkeys=split(bibkeys, tmp,',');
while (!tmp.empty()) {
combox->addto(tmp.c_str());
bibkeys.split(tmp,',');
bibkeys=split(bibkeys, tmp,',');
}
}
@ -522,7 +520,7 @@ int bibitemMaxWidth(const class LyXFont &font)
// ale070405
LString bibitemWidthest()
string bibitemWidthest()
{
int w = 0;
// Does look like a hack? It is! (but will change at 0.13)

View File

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

View File

@ -3,10 +3,10 @@
*
* LyX, The Document Processor
*
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
*======================================================*/
* ======================================================*/
#include <config.h>
@ -18,20 +18,13 @@
#include "lyxdraw.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(LString const & cmd, LString const & arg,
LString const & opt)
InsetCommand::InsetCommand(string const & cmd, string const & arg,
string const & opt)
: command(cmd), options(opt), contents(arg)
{
}
@ -62,7 +55,7 @@ int InsetCommand::Width(LyXFont const&font) const
{
LyXFont f = font;
f.decSize();
LString s = getScreenLabel();
string s = getScreenLabel();
return 10 + f.stringWidth(s);
}
@ -95,7 +88,7 @@ void InsetCommand::Draw(LyXFont font, LyXScreen &scr,
Width(font)-6,
Ascent(font)+Descent(font)-2);
}
LString s = getScreenLabel();
string s = getScreenLabel();
LyXFont f = font;
f.decSize();
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;
@ -124,7 +117,7 @@ void InsetCommand::scanCommand(LString const &cmd)
// Used to handle things like \command[foo[bar]]{foo{bar}}
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];
if ((state==Command && c == ' ') ||
(state==Command && c == '[') ||
@ -180,7 +173,7 @@ void InsetCommand::scanCommand(LString const &cmd)
void InsetCommand::Read(LyXLex &lex)
{
if (lex.EatLine()) {
LString t = lex.GetString();
string t = lex.GetString();
scanCommand(t);
} else
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();
return 0;
}
int InsetCommand::Linuxdoc(LString &/*file*/)
int InsetCommand::Linuxdoc(string &/*file*/)
{
return 0;
}
int InsetCommand::DocBook(LString &/*file*/)
int InsetCommand::DocBook(string &/*file*/)
{
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 (!options.empty()) s += "["+options+']';
s += "{"+contents+'}';

View File

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

View File

@ -3,10 +3,10 @@
*
* LyX, The Document Processor
*
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
*======================================================*/
* ======================================================*/
#include <config.h>
@ -14,30 +14,23 @@
#pragma implementation
#endif
#include "definitions.h"
#include "inseterror.h"
#include "lyxdraw.h"
#include "gettext.h"
#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 */
InsetError::InsetError()
{
form = NULL;
form = 0;
}
InsetError::InsetError(LString const & string)
InsetError::InsetError(string const & string)
: contents(string)
{
form = NULL;
form = 0;
}
@ -46,7 +39,7 @@ InsetError::~InsetError()
if (form) {
fl_hide_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;
}
int InsetError::Linuxdoc(LString &)
int InsetError::Linuxdoc(string &)
{
return 0;
}
int InsetError::DocBook(LString &)
int InsetError::DocBook(string &)
{
return 0;
}
@ -153,7 +146,7 @@ void InsetError::CloseErrorCB(FL_OBJECT *, long data)
if (inset->form) {
fl_hide_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_resize(obj, FL_RESIZE_NONE);
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());
if (form->visible) {

View File

@ -28,7 +28,7 @@
class InsetError: public Inset {
public:
///
InsetError(LString const & string);
InsetError(string const & string);
///
InsetError();
///
@ -48,11 +48,11 @@ public:
///
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;
/// what appears in the minibuffer when opening
@ -69,7 +69,7 @@ public:
bool DirectWrite() const { return true; };
private:
///
LString contents;
string contents;
///
FL_FORM *form;
///

View File

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

View File

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

View File

@ -36,7 +36,7 @@ void index_cb(FL_OBJECT *, long data)
// - }
case 1: // OK
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()) {
inset->setContents(tmp);
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)
{
}
@ -115,7 +115,7 @@ void InsetIndex::Edit(int, int)
}
LString InsetIndex::getScreenLabel() const
string InsetIndex::getScreenLabel() const
{
return _("Idx");
}
@ -128,7 +128,7 @@ LString InsetIndex::getScreenLabel() const
InsetPrintIndex::InsetPrintIndex()
: InsetCommand("printindex")
{
owner = NULL;
owner = 0;
}
@ -143,7 +143,7 @@ InsetPrintIndex::~InsetPrintIndex()
}
LString InsetPrintIndex::getScreenLabel() const
string InsetPrintIndex::getScreenLabel() const
{
return _("PrintIndex");
}

View File

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

View File

@ -3,13 +3,14 @@
*
* LyX, The Document Processor
*
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
*======================================================*/
* ======================================================*/
#include <config.h>
#include <ctype.h>
#include <cctype>
#ifdef __GNUG__
#pragma implementation
@ -22,27 +23,22 @@
#include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "buffer.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;
#include "support/lstrings.h"
/* Info, used for the Info boxes */
extern BufferView * current_view;
InsetInfo::InsetInfo()
{
form = NULL;
form = 0;
}
InsetInfo::InsetInfo(LString const & string)
InsetInfo::InsetInfo(string const & string)
: contents(string)
{
form = NULL;
form = 0;
}
@ -51,7 +47,7 @@ InsetInfo::~InsetInfo()
if (form){
fl_hide_form(form);
fl_free_form(form);
form = NULL;
form = 0;
}
}
@ -102,7 +98,7 @@ void InsetInfo::Write(FILE *file)
void InsetInfo::Read(LyXLex &lex)
{
LString tmp = lex.GetString(); // should be "Info"
string tmp = lex.GetString(); // should be "Info"
if (tmp != "Info")
lyxerr.print("ERROR (InsetInfo::Read): "
"consistency check 1 failed.");
@ -113,7 +109,7 @@ void InsetInfo::Read(LyXLex &lex)
// should we skip blank lines?
continue;
LString const token = lex.GetString().strip();
string const token = strip(lex.GetString());
lyxerr.debug("Note: " + token, Error::LEX_PARSER);
if (token != "\\end_inset") {
@ -123,7 +119,7 @@ void InsetInfo::Read(LyXLex &lex)
break;
}
// 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;
}
int InsetInfo::Linuxdoc(LString &)
int InsetInfo::Linuxdoc(string &)
{
return 0;
}
int InsetInfo::DocBook(LString &)
int InsetInfo::DocBook(string &)
{
return 0;
}
@ -161,7 +157,7 @@ void InsetInfo::CloseInfoCB(FL_OBJECT *, long data)
{
InsetInfo *inset = (InsetInfo*) data;
// 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();
if(tmp != inset->contents && !(buffer->isReadonly()) ) {
buffer->markDirty();
@ -170,7 +166,7 @@ void InsetInfo::CloseInfoCB(FL_OBJECT *, long data)
if (inset->form) {
fl_hide_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_shortcut(obj, scex(_("Close|#C^[")), (long)this);
fl_end_form();
fl_set_form_atclose(form, CancelCloseBoxCB, NULL);
fl_set_form_atclose(form, CancelCloseBoxCB, 0);
}
fl_set_input(strobj, contents.c_str());
if (form->visible) {

View File

@ -32,7 +32,7 @@ public:
///
InsetInfo();
///
InsetInfo(LString const & string);
InsetInfo(string const & string);
///
~InsetInfo();
///
@ -50,11 +50,11 @@ public:
///
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
char const* EditMessage() {return "Opened note";}
///
@ -67,7 +67,7 @@ public:
Inset* Clone();
private:
///
LString contents;
string contents;
///
FL_FORM *form;
///

View File

@ -3,10 +3,10 @@
*
* LyX, The Document Processor
*
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
*======================================================*/
* ======================================================*/
#include <config.h>
@ -16,16 +16,10 @@
#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 */
InsetLabel::InsetLabel(LString const & cmd)
InsetLabel::InsetLabel(string const & cmd)
{
scanCommand(cmd);
}
@ -49,7 +43,7 @@ int InsetLabel::GetNumberOfLabels() const
}
LString InsetLabel::getLabel(int) const
string InsetLabel::getLabel(int) const
{
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());
return 0;
}
int InsetLabel::Linuxdoc(LString &file)
int InsetLabel::Linuxdoc(string &file)
{
file += "<label id=\"" + getContents() +"\" >";
return 0;
}
int InsetLabel::DocBook(LString &file)
int InsetLabel::DocBook(string &file)
{
file += "<anchor id=\"" + getContents() +"\" >";
return 0;
@ -84,11 +78,11 @@ int InsetLabel::DocBook(LString &file)
// This function escapes 8-bit characters and other problematic characters
// 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',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
LString enc;
for (int i=0; i<lab.length(); i++) {
string enc;
for (string::size_type i=0; i<lab.length(); i++) {
unsigned char c=lab[i];
if (c >= 128 || c=='=' || c=='%') {
enc += '=';

View File

@ -23,7 +23,7 @@
class InsetLabel: public InsetCommand {
public:
///
InsetLabel(LString const & cmd);
InsetLabel(string const & cmd);
///
InsetLabel() : InsetCommand("label") {;}
///
@ -35,22 +35,22 @@ public:
///
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; }
///
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:
/// This function escapes 8-bit characters
LString escape(LString const &) const;
string escape(string const &) const;
};
#endif

View File

@ -3,8 +3,8 @@
*
* LyX, The Document Processor
*
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
*======================================================*/
@ -18,12 +18,6 @@
#include "insetlatex.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 */
@ -32,7 +26,7 @@ InsetLatex::InsetLatex()
}
InsetLatex::InsetLatex(LString const & string)
InsetLatex::InsetLatex(string const & 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;
return 0;
}
int InsetLatex::Linuxdoc(LString &file)
int InsetLatex::Linuxdoc(string &file)
{
file += contents;
return 0;
}
int InsetLatex::DocBook(LString &file)
int InsetLatex::DocBook(string &file)
{
file += contents;
return 0;

View File

@ -29,7 +29,7 @@ public:
///
InsetLatex();
///
InsetLatex(LString const & string);
InsetLatex(string const & string);
///
~InsetLatex();
///
@ -47,11 +47,11 @@ public:
///
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;
///
@ -60,7 +60,7 @@ public:
Inset::Code LyxCode() const;
private:
///
LString contents;
string contents;
};
#endif

View File

@ -3,8 +3,8 @@
*
* LyX, The Document Processor
*
* Copyright (C) 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team.
* Copyright 1995 Matthias Ettrich
* Copyright 1995-1999 The LyX Team.
*
*======================================================*/
@ -18,15 +18,10 @@
#include "error.h"
#include "lyxrc.h"
#include "lyxdraw.h"
#include "support/lstrings.h"
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 */
/* This part is done by Ivan Schreter, schreter@ccsun.tuke.sk */
/* 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)
{
checkContents();
@ -69,17 +64,16 @@ void InsetLatexAccent::checkContents()
// REMOVE IN 0.13
// Dirty Hack for backward compability. remove in 0.13 (Lgb)
contents.strip();
contents.frontStrip();
if (!contents.contains("{") && !contents.contains("}")) {
contents = frontStrip(strip(contents));
if (!contains(contents, "{") && !contains(contents, "}")) {
if (contents.length() == 2) {
LString tmp;
string tmp;
tmp += contents[0];
tmp += contents[1];
tmp += "{}";
contents = tmp;
} else if (contents.length() == 3) {
LString tmp;
string tmp;
tmp += contents[0];
tmp += contents[1];
tmp += '{';
@ -87,7 +81,7 @@ void InsetLatexAccent::checkContents()
tmp += '}';
contents = tmp;
} else if (contents.length()==4 && contents[2] == ' ') {
LString tmp;
string tmp;
tmp += contents[0];
tmp += contents[1];
tmp += '{';
@ -96,7 +90,7 @@ void InsetLatexAccent::checkContents()
contents = tmp;
} else if (contents.length()==4 && contents[2] == '\\'
&& (contents[3]== 'i' || contents[3]== 'j')) {
LString tmp;
string tmp;
tmp += contents[0];
tmp += contents[1];
tmp += '{';
@ -224,10 +218,10 @@ void InsetLatexAccent::checkContents()
}
//ic = (modtype == DOT_LESS_J ? 'j' : 'i');
lyxerr.debug("Contents: [" + contents + "], ic: " + ic
+ ", top: " + long(plusasc)
+ ", bot: " + long(plusdesc)
+ ", dot: " + long(remdot)
+ ", mod: " + long(modtype));
+ ", top: " + tostr(plusasc)
+ ", bot: " + tostr(plusdesc)
+ ", dot: " + tostr(remdot)
+ ", mod: " + tostr(modtype));
// Special case for space
} else if (contents[3] == '}') {
ic = ' ';
@ -246,11 +240,11 @@ void InsetLatexAccent::checkContents()
return;
} else if ( (ic=='i'|| ic=='j') && contents[4]=='}') {
// Do a rewrite: \<foo>{i} --> \<foo>{\i}
LString temp=contents;
temp.substring(0,2);
string temp=contents;
temp.erase(3, string::npos);
temp+='\\';
temp+=char(ic);
for(int j=4;j<contents.length();j++)
for(string::size_type j = 4; j < contents.length(); ++j)
temp+=contents[j];
contents=temp;
i++;
@ -262,10 +256,10 @@ void InsetLatexAccent::checkContents()
// fine, the char is properly decoded now (hopefully)
lyxerr.debug("Contents: [" + contents + "], ic: " + ic
+ ", top: " + long(plusasc)
+ ", bot: " + long(plusdesc)
+ ", dot: " + long(remdot)
+ ", mod: " + long(modtype));
+ ", top: " + tostr(plusasc)
+ ", bot: " + tostr(plusdesc)
+ ", dot: " + tostr(remdot)
+ ", mod: " + tostr(modtype));
}
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;
return 0;
}
int InsetLatexAccent::Linuxdoc(LString &file)
int InsetLatexAccent::Linuxdoc(string &file)
{
file += contents;
return 0;
}
int InsetLatexAccent::DocBook(LString &file)
int InsetLatexAccent::DocBook(string &file)
{
file += contents;
return 0;

View File

@ -32,7 +32,7 @@ public:
///
InsetLatexAccent();
///
InsetLatexAccent(LString const & string);
InsetLatexAccent(string const & string);
///
InsetLatexAccent(InsetLatexAccent const&);
///
@ -55,11 +55,11 @@ public:
///
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;
///
@ -122,7 +122,7 @@ private:
/// Check if we know the modifier and can display it ok on screen.
void checkContents();
///
LString contents;
string contents;
/// can display as proper char
bool candisp;
/// modifier type

View File

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

View File

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

View File

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

View File

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

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