cleanups from John and Juergen, bib files parsing fix from Herbert

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3586 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2002-02-26 10:50:48 +00:00
parent 635fea0855
commit 1120aa806c
37 changed files with 327 additions and 235 deletions

View File

@ -1,3 +1,7 @@
2002-02-26 John Levon <moz@compsoc.man.ac.uk>
* acconfig.h: nt/os2 defines moved
2002-02-04 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr> 2002-02-04 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* README: change reference to bugtracker * README: change reference to bugtracker

View File

@ -96,15 +96,11 @@ int mkstemp(char*);
#endif #endif
#ifdef __EMX__ #ifdef __EMX__
#include "os2_defines.h" #include "support/os2_defines.h"
#endif
#ifdef VMS
#include "vms_defines.h"
#endif #endif
#if defined(__CYGWIN__) || defined( __CYGWIN32__) #if defined(__CYGWIN__) || defined( __CYGWIN32__)
#include "nt_defines.h" #include "support/nt_defines.h"
#endif #endif
/* Some support for the boost library. */ /* Some support for the boost library. */

View File

@ -1,3 +1,7 @@
2002-02-21 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* ui/default.ui: change Layout>LaTeX Preamble to Layout>Preamble.
2002-02-13 José Matos <jamatos@fep.up.pt> 2002-02-13 José Matos <jamatos@fep.up.pt>
* examples/linuxdoc_manpage.lyx: added * examples/linuxdoc_manpage.lyx: added

View File

@ -284,7 +284,7 @@ Menuset
# Item "TeX Style|X" "tex-mode" # Item "TeX Style|X" "tex-mode"
Separator Separator
Item "Change Environment Depth|v" "depth-increment" Item "Change Environment Depth|v" "depth-increment"
Item "LaTeX Preamble...|L" "layout-preamble" Item "Preamble...|r" "layout-preamble"
Item "Start Appendix here|A" "appendix" Item "Start Appendix here|A" "appendix"
End End

View File

@ -9,7 +9,6 @@ src/converter.C
src/CutAndPaste.C src/CutAndPaste.C
src/debug.C src/debug.C
src/exporter.C src/exporter.C
src/ext_l10n.h
src/figure_form.C src/figure_form.C
src/figureForm.C src/figureForm.C
src/FontLoader.C src/FontLoader.C

View File

@ -1,3 +1,36 @@
2002-02-26 John Levon <moz@compsoc.man.ac.uk>
* Makefile.am:
* lyxserver.C:
* os2_defines.h:
* os2_errortable.h:
* nt_defines.h: move .h into support/
* vms_defines.h: remove
* WorkArea.C: add space in debug output
* text2.C:
* paragraph.C:
* buffer.C: add WITH_WARNINGS
* vc-backend.h:
* vc-backend.C:
* bufferlist.C: s/retrive/retrieve/, add docs
* vspace.h:
* vspace.C:
* kbmap.h:
* lyxlength.h:
* lyxgluelength.h:
* length_common.h:
* chset.h:
* chset.C: add docs
* lyxgui.C: add ID to X error handler
* lyxtestclass.c: fix typo
2002-02-26 Juergen Vigna <jug@sad.it> 2002-02-26 Juergen Vigna <jug@sad.it>
* tabular_funcs.C (write_attribute): changed so that some default * tabular_funcs.C (write_attribute): changed so that some default

View File

@ -187,9 +187,6 @@ lyx_SOURCES = \
main.C \ main.C \
minibuffer.C \ minibuffer.C \
minibuffer.h \ minibuffer.h \
nt_defines.h \
os2_defines.h \
os2_errortable.h \
paragraph.C \ paragraph.C \
paragraph.h \ paragraph.h \
paragraph_pimpl.C \ paragraph_pimpl.C \

View File

@ -299,7 +299,9 @@ std::stack<ErtComp> ert_stack;
ErtComp ert_comp; ErtComp ert_comp;
#endif #endif
#ifdef WITH_WARNINGS
#warning And _why_ is this here? (Lgb) #warning And _why_ is this here? (Lgb)
#endif
int unknown_layouts; int unknown_layouts;
int unknown_tokens; int unknown_tokens;

View File

@ -542,7 +542,7 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
// How can we know _how_ to do the checkout? // How can we know _how_ to do the checkout?
// With the current VC support it has to be, // With the current VC support it has to be,
// a RCS file since CVS do not have special ,v files. // a RCS file since CVS do not have special ,v files.
RCS::retrive(s); RCS::retrieve(s);
return loadLyXFile(filename, tolastfiles); return loadLyXFile(filename, tolastfiles);
} }
} }

View File

@ -24,8 +24,9 @@ bool CharacterSet::loadFile(string const & fname)
map_.clear(); map_.clear();
name_.erase(); name_.erase();
// ascii 7-bit
if (fname.empty() || fname == "ascii") if (fname.empty() || fname == "ascii")
return true; // ascii 7-bit return true;
// open definition file // open definition file
lyxerr[Debug::KBMAP] lyxerr[Debug::KBMAP]

View File

@ -1,4 +1,10 @@
// -*- C++ -*- // -*- C++ -*-
/**
* \file chset.h
* Copyright 2002 the LyX Team
* Read the file COPYING
*/
#ifndef CHSET_H #ifndef CHSET_H
#define CHSET_H #define CHSET_H
@ -11,21 +17,33 @@
#include "LString.h" #include "LString.h"
/// /// a class for mapping char strings such as "\^{A}" to the integer value
class CharacterSet { class CharacterSet {
public: public:
/// /**
bool loadFile(string const &); * initialise this charset from the given .cdef file
/// * param charset the charset to look for
*
* Finds a .cdef file corresponding to the named charset
* and parses it. This function is only intended to be
* called once.
*/
bool loadFile(string const & charset);
/// return the name of the current charset
string const & getName() const; string const & getName() const;
/// /**
* Return the encoded charset value of the given string.
*
* The bool value is false if an encoding could not be found
* in this charset, and true otherwise.
*/
std::pair<bool, int> const encodeString(string const &) const; std::pair<bool, int> const encodeString(string const &) const;
private: private:
/// /// charset name
string name_; string name_;
/// ///
typedef std::map<string, unsigned char> Cdef; typedef std::map<string, unsigned char> Cdef;
/// /// mapping from string representation to encoded value
Cdef map_; Cdef map_;
}; };
#endif #endif

View File

@ -1,3 +1,7 @@
2002-02-21 Herbert Voss <voss@lyx.org>
* biblio.C: fix bug with commentlines in a bibentry
2002-02-20 Lars Gullik Bjønnes <larsbj@birdstep.com> 2002-02-20 Lars Gullik Bjønnes <larsbj@birdstep.com>
* Makefile.am: simpler obj. file compile * Makefile.am: simpler obj. file compile

View File

@ -320,18 +320,29 @@ searchKeys(InfoMap const & theMap,
string const parseBibTeX(string data, string const & findkey) string const parseBibTeX(string data, string const & findkey)
{ {
string keyvalue; string keyvalue;
for (string::iterator it = data.begin(); it < data.end(); ++it) { // at first we delete all characters right of '%' and
if ((*it) == '\n' || (*it) == '\t') // replace tabs through a space and remove leading spaces
(*it)= ' '; string data_;
int Entries = 0;
string dummy = token(data,'\n', Entries);
while (!dummy.empty()) {
dummy = subst(dummy, '\t', ' '); // no tabs
dummy = frontStrip(dummy); // no leading spaces
if (dummy.find('%') != string::npos) {
if (dummy.find('%') > 0)
data_ += dummy.substr(0,data.find('%'));
} }
data = frontStrip(data); else
data_ += dummy;
dummy = token(data, '\n', ++Entries);
}
data = data_;
// now get only the important line of the bibtex entry. // now get only the important line of the bibtex entry.
// all entries are devided by ',' except the last one. // all entries are devided by ',' except the last one.
data += ','; // now we have same behaviour for all entries data += ','; // now we have same behaviour for all entries
// because the last one is "blah ... }" // because the last one is "blah ... }"
int Entries = 0; Entries = 0;
string dummy = token(data, ',', Entries); dummy = token(data, ',', Entries);
while (!contains(lowercase(dummy), findkey) && !dummy.empty()) while (!contains(lowercase(dummy), findkey) && !dummy.empty())
dummy = token(data, ',', ++Entries); dummy = token(data, ',', ++Entries);
if (dummy.empty()) if (dummy.empty())

View File

@ -1,3 +1,8 @@
2002-02-24 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* forms/form_graphics.fd: Enlarge Restore button.
* FormGraphics.C: Set filter to bounding box input fields.
2002-02-20 Lars Gullik Bjønnes <larsbj@birdstep.com> 2002-02-20 Lars Gullik Bjønnes <larsbj@birdstep.com>
* Makefile.am: simpler obj. file compiling * Makefile.am: simpler obj. file compiling

View File

@ -143,6 +143,10 @@ void FormGraphics::build()
fl_set_input_return (bbox_->input_bb_x1, FL_RETURN_CHANGED); fl_set_input_return (bbox_->input_bb_x1, FL_RETURN_CHANGED);
fl_set_input_return (bbox_->input_bb_y1, FL_RETURN_CHANGED); fl_set_input_return (bbox_->input_bb_y1, FL_RETURN_CHANGED);
fl_set_input_filter(bbox_->input_bb_x0, fl_unsigned_float_filter);
fl_set_input_filter(bbox_->input_bb_y0, fl_unsigned_float_filter);
fl_set_input_filter(bbox_->input_bb_x1, fl_unsigned_float_filter);
string const bb_units = "pt|cm|in"; string const bb_units = "pt|cm|in";
fl_addto_choice(bbox_->choice_bb_units, bb_units.c_str()); fl_addto_choice(bbox_->choice_bb_units, bb_units.c_str());
bc().addReadOnly(bbox_->button_getBB); bc().addReadOnly(bbox_->button_getBB);

View File

@ -22,9 +22,9 @@ FD_form_graphics * FormGraphics::build_graphics()
FL_OBJECT *obj; FL_OBJECT *obj;
FD_form_graphics *fdui = new FD_form_graphics; FD_form_graphics *fdui = new FD_form_graphics;
fdui->form = fl_bgn_form(FL_NO_BOX, 510, 360); fdui->form = fl_bgn_form(FL_NO_BOX, 510, 345);
fdui->form->u_vdata = this; fdui->form->u_vdata = this;
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 510, 360, ""); obj = fl_add_box(FL_FLAT_BOX, 0, 0, 510, 345, "");
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fdui->tabFolder = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 5, 5, 500, 270, _("Tabbed folder")); fdui->tabFolder = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 5, 5, 500, 270, _("Tabbed folder"));
fl_set_object_boxtype(obj, FL_FRAME_BOX); fl_set_object_boxtype(obj, FL_FRAME_BOX);
@ -32,7 +32,7 @@ FD_form_graphics * FormGraphics::build_graphics()
fl_set_object_resize(obj, FL_RESIZE_ALL); fl_set_object_resize(obj, FL_RESIZE_ALL);
{ {
char const * const dummy = N_("Restore|#R"); char const * const dummy = N_("Restore|#R");
fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 5, 310, 80, 30, idex(_(dummy))); fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 5, 310, 100, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, scex(_(dummy)), 1); fl_set_button_shortcut(obj, scex(_(dummy)), 1);
} }
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);

View File

@ -10,13 +10,13 @@ SnapGrid: 5
=============== FORM =============== =============== FORM ===============
Name: form_graphics Name: form_graphics
Width: 510 Width: 510
Height: 360 Height: 345
Number of Objects: 7 Number of Objects: 7
-------------------- --------------------
class: FL_BOX class: FL_BOX
type: FLAT_BOX type: FLAT_BOX
box: 0 0 510 360 box: 0 0 510 345
boxtype: FL_FLAT_BOX boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1 colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER alignment: FL_ALIGN_CENTER
@ -52,7 +52,7 @@ argument:
-------------------- --------------------
class: FL_BUTTON class: FL_BUTTON
type: NORMAL_BUTTON type: NORMAL_BUTTON
box: 5 310 80 30 box: 5 310 100 30
boxtype: FL_UP_BOX boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1 colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER alignment: FL_ALIGN_CENTER

View File

@ -1,10 +1,12 @@
// -*- C++ -*- // -*- C++ -*-
/* ======================================================================= *\ /**
File : kbmap.h, kbmap.h,v 1.3 1996/12/10 04:35:57 larsbj Exp * \file kbmap.h
Author : chb, 30.Oct.1995 * Copyright 1995-2002 the LyX Team
Docu : see kbmap.C * Read the file COPYING
Purpose: class definitions for XKeyEvent keymap handling *
\* ==================================================================== */ * \author Lars Gullik Bjønnes <larsbj@lyx.org>
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#ifndef KBMAP_H #ifndef KBMAP_H
#define KBMAP_H #define KBMAP_H
@ -93,4 +95,4 @@ private:
Table table; Table table;
}; };
#endif #endif // KBMAP_H

View File

@ -1,16 +1,22 @@
// -*- C++ -*- // -*- C++ -*-
#ifndef LENGHT_COMMON_H #ifndef LENGTH_COMMON_H
#define LENGHT_COMMON_H #define LENGTH_COMMON_H
#include "LString.h" #include "LString.h"
#include "lyxlength.h" #include "lyxlength.h"
/// the number of units possible
extern int const num_units; extern int const num_units;
// I am not sure if "mu" should be possible to select (Lgb) /**
* array of unit names
*
* FIXME: I am not sure if "mu" should be possible to select (Lgb)
*/
extern char const *unit_name[]; extern char const *unit_name[];
/// return the unit given a string representation such as "cm"
LyXLength::UNIT unitFromString(string const & data); LyXLength::UNIT unitFromString(string const & data);
#endif #endif // LENGTH_COMMON_H

View File

@ -88,7 +88,7 @@ int LyX_XErrHandler(Display * display, XErrorEvent * xeev)
// Get the reason for the crash. // Get the reason for the crash.
char etxt[513]; char etxt[513];
XGetErrorText(display, xeev->error_code, etxt, 512); XGetErrorText(display, xeev->error_code, etxt, 512);
lyxerr << etxt << endl; lyxerr << etxt << " id: " << xeev->resourceid << endl;
// By doing an abort we get a nice backtrace. (hopefully) // By doing an abort we get a nice backtrace. (hopefully)
lyx::abort(); lyx::abort();
return 0; // Solaris CC wants us to return something return 0; // Solaris CC wants us to return something

View File

@ -1,13 +1,12 @@
// -*- C++ -*- // -*- C++ -*-
/* This file is part of /**
* ====================================================== * \file lyxgluelength.h
* Copyright 1995-2002 the LyX Team
* Read the file COPYING
* *
* LyX, The Document Processor * \author Matthias Ettrich
* */
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
* ====================================================== */
#ifndef LYX_GLUE_LENGTH_H #ifndef LYX_GLUE_LENGTH_H
#define LYX_GLUE_LENGTH_H #define LYX_GLUE_LENGTH_H
@ -78,4 +77,4 @@ bool operator!=(LyXGlueLength const & l1, LyXGlueLength const & l2);
/// ///
bool isValidGlueLength(string const & data, LyXGlueLength * result); bool isValidGlueLength(string const & data, LyXGlueLength * result);
#endif #endif // LYXGLUELENGTH_H

View File

@ -1,13 +1,12 @@
// -*- C++ -*- // -*- C++ -*-
/* This file is part of /**
* ====================================================== * \file lyxlength.h
* Copyright 1995-2002 the LyX Team
* Read the file COPYING
* *
* LyX, The Document Processor * \author Matthias Ettrich
* */
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
* ====================================================== */
#ifndef LYX_LENGTH_H #ifndef LYX_LENGTH_H
#define LYX_LENGTH_H #define LYX_LENGTH_H
@ -18,47 +17,30 @@
#include "LString.h" #include "LString.h"
// /**
/// LyXLength Class * LyXLength - Represents latex length measurement
// */
class LyXLength { class LyXLength {
public: public:
/// length units /// length units
enum UNIT { enum UNIT {
/// Scaled point (65536sp = 1pt) TeX's smallest unit. SP, ///< Scaled point (65536sp = 1pt) TeX's smallest unit.
SP, PT, ///< Point = 1/72.27in = 0.351mm
/// Point = 1/72.27in = 0.351mm BP, ///< Big point (72bp = 1in), also PostScript point
PT, DD, ///< Didot point = 1/72 of a French inch, = 0.376mm
/// Big point (72bp = 1in), also PostScript point MM, ///< Millimeter = 2.845pt
BP, PC, ///< Pica = 12pt = 4.218mm
/// Didot point = 1/72 of a French inch, = 0.376mm CC, ///< Cicero = 12dd = 4.531mm
DD, CM, ///< Centimeter = 10mm = 2.371pc
/// Millimeter = 2.845pt IN, ///< Inch = 25.4mm = 72.27pt = 6.022pc
MM, EX, ///< Height of a small "x" for the current font.
/// Pica = 12pt = 4.218mm EM, ///< Width of capital "M" in current font.
PC, MU, ///< Math unit (18mu = 1em) for positioning in math mode
/// Cicero = 12dd = 4.531mm PW, ///< Percent of columnwidth both "%" or "%c"
CC, PE, ///< FIXME
/// Centimeter = 10mm = 2.371pc PP, ///< Percent of pagewidth
CM, PL, ///< Percent of linewidth
/// Inch = 25.4mm = 72.27pt = 6.022pc UNIT_NONE ///< no unit
IN,
/// Height of a small "x" for the current font.
EX,
/// Width of capital "M" in current font.
EM,
/// Math unit (18mu = 1em) for positioning in math mode
MU,
/// Percent of columnwidth both "%" or "%c"
PW,
///
PE,
/// Percent of pagewidth
PP,
/// Percent of linewidth
PL,
/// no unit
UNIT_NONE
}; };
/// ///
@ -79,11 +61,11 @@ public:
void unit(LyXLength::UNIT unit); void unit(LyXLength::UNIT unit);
/// ///
bool zero() const; bool zero() const;
/// conversion /// return string representation
string const asString() const; string const asString() const;
/// /// return string representation for LaTeX
string const asLatexString() const; string const asLatexString() const;
/// /// return the on-screen size of this length
int inPixels(int default_width, int default_height) const; int inPixels(int default_width, int default_height) const;
/** If "data" is valid, the length represented by it is /** If "data" is valid, the length represented by it is
@ -103,7 +85,7 @@ bool operator==(LyXLength const & l1, LyXLength const & l2);
bool operator!=(LyXLength const & l1, LyXLength const & l2); bool operator!=(LyXLength const & l1, LyXLength const & l2);
/// ///
bool isValidLength(string const & data, LyXLength * result); bool isValidLength(string const & data, LyXLength * result);
/// /// return the name of the given unit number
char const * stringFromUnit(int unit); char const * stringFromUnit(int unit);
#endif #endif // LYXLENGTH_H

View File

@ -62,7 +62,7 @@
#define INCL_DOSNMPIPES #define INCL_DOSNMPIPES
#define INCL_DOSERRORS #define INCL_DOSERRORS
#include <os2.h> #include <os2.h>
#include "os2_errortable.h" #include "support/os2_errortable.h"
#endif #endif
using std::endl; using std::endl;

View File

@ -57,7 +57,7 @@ bool LyXTextClass::do_readStyle(LyXLex & lexrc, LyXLayout & lay)
{ {
lyxerr[Debug::TCLASS] << "Reading style " << lay.name() << endl; lyxerr[Debug::TCLASS] << "Reading style " << lay.name() << endl;
if (!lay.Read(lexrc, *this)) { if (!lay.Read(lexrc, *this)) {
// Reslove fonts // Resolve fonts
lay.resfont = lay.font; lay.resfont = lay.font;
#ifndef INHERIT_LANGUAGE #ifndef INHERIT_LANGUAGE
lay.resfont.realize(defaultfont()); lay.resfont.realize(defaultfont());

View File

@ -1615,13 +1615,13 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
// Fully instantiated font // Fully instantiated font
LyXFont font = getFont(bparams, i); LyXFont font = getFont(bparams, i);
LyXFont const last_font = running_font; LyXFont const & last_font = running_font;
// Spaces at end of font change are simulated to be // Spaces at end of font change are simulated to be
// outside font change, i.e. we write "\textXX{text} " // outside font change, i.e. we write "\textXX{text} "
// rather than "\textXX{text }". (Asger) // rather than "\textXX{text }". (Asger)
if (open_font && c == ' ' && i <= size() - 2) { if (open_font && c == ' ' && i <= size() - 2) {
LyXFont const next_font = getFont(bparams, i + 1); LyXFont const & next_font = getFont(bparams, i + 1);
if (next_font != running_font if (next_font != running_font
&& next_font != font) { && next_font != font) {
font = next_font; font = next_font;
@ -1943,7 +1943,9 @@ Paragraph::getParLanguage(BufferParams const & bparams) const
return getFirstFontSettings().language(); return getFirstFontSettings().language();
#else #else
Language const * lang = getFirstFontSettings().language(); Language const * lang = getFirstFontSettings().language();
#ifdef WITH_WARNINGS
#warning We should make this somewhat better, any ideas? (Jug) #warning We should make this somewhat better, any ideas? (Jug)
#endif
if (lang == inherit_language || lang == ignore_language) if (lang == inherit_language || lang == ignore_language)
lang = bparams.language; lang = bparams.language;
return lang; return lang;

View File

@ -1,3 +1,10 @@
2002-02-26 John Levon <moz@compsoc.man.ac.uk>
* Makefile.am:
* os2_defines.h:
* os2_errortable.h:
* nt_defines.h: moved from src/
2002-02-18 Herbert Voss <voss@perce.de> 2002-02-18 Herbert Voss <voss@perce.de>
* filetools.C: (getExtFromContents) return the fileextension * filetools.C: (getExtFromContents) return the fileextension

View File

@ -54,6 +54,9 @@ libsupport_la_SOURCES = \
lyxmanip.h \ lyxmanip.h \
$(LYXSTRING) lyxsum.C \ $(LYXSTRING) lyxsum.C \
mkdir.C \ mkdir.C \
nt_defines.h \
os2_defines.h \
os2_errortable.h \
path.C \ path.C \
path.h \ path.h \
putenv.C \ putenv.C \

View File

@ -2207,10 +2207,12 @@ void LyXText::setCursorIntern(BufferView * bview, Paragraph * par,
if (it != inset_owner) { if (it != inset_owner) {
lyxerr << "InsetText is " << it << endl; lyxerr << "InsetText is " << it << endl;
lyxerr << "inset_owner is " << inset_owner << endl; lyxerr << "inset_owner is " << inset_owner << endl;
#ifdef WITH_WARNINGS
#warning I believe this code is wrong. (Lgb) #warning I believe this code is wrong. (Lgb)
#warning Jürgen, have a look at this. (Lgb) #warning Jürgen, have a look at this. (Lgb)
#warning Hmmm, I guess you are right but we #warning Hmmm, I guess you are right but we
#warning should verify when this is needed #warning should verify when this is needed
#endif
// Jürgen, would you like to have a look? // Jürgen, would you like to have a look?
// I guess we need to move the outer cursor // I guess we need to move the outer cursor
// and open and lock the inset (bla bla bla) // and open and lock the inset (bla bla bla)

View File

@ -42,5 +42,3 @@ Undo::~Undo()
delete tmppar; delete tmppar;
} }
} }

View File

@ -70,9 +70,9 @@ string const RCS::find_file(string const & file)
} }
void RCS::retrive(string const & file) void RCS::retrieve(string const & file)
{ {
lyxerr[Debug::LYXVC] << "LyXVC::RCS: retrive.\n\t" << file << endl; lyxerr[Debug::LYXVC] << "LyXVC::RCS: retrieve.\n\t" << file << endl;
VCS::doVCCommand("co -q -r \"" VCS::doVCCommand("co -q -r \""
+ file + "\"", + file + "\"",
string()); string());

View File

@ -1,4 +1,12 @@
// -*- C++ -*- // -*- C++ -*-
/**
* \file vc-backend.h
* Copyright 1995-2002 the LyX Team
* Read the file COPYING
*
* \author Lars Gullik Bjønnes
*/
#ifndef VC_BACKEND_H #ifndef VC_BACKEND_H
#define VC_BACKEND_H #define VC_BACKEND_H
@ -11,61 +19,71 @@
class Buffer; class Buffer;
/// /// A simple version control system interface
class VCS { class VCS {
public: public:
/// /// the status of the managed file
enum VCStatus { enum VCStatus {
///
UNLOCKED, UNLOCKED,
///
LOCKED LOCKED
}; };
///
virtual ~VCS() {} virtual ~VCS() {}
///
virtual void scanMaster() = 0; /// register a file for version control
///
virtual void registrer(string const & msg) = 0; virtual void registrer(string const & msg) = 0;
/// /// check in the current revision
virtual void checkIn(string const & msg) = 0; virtual void checkIn(string const & msg) = 0;
/// /// check out for editing
virtual void checkOut() = 0; virtual void checkOut() = 0;
/// /// revert current edits
virtual void revert() = 0; virtual void revert() = 0;
/// /// FIXME
virtual void undoLast() = 0; virtual void undoLast() = 0;
/// /**
* getLog - read the revision log into the given file
* @param fname file name to read into
*/
virtual void getLog(string const &) = 0; virtual void getLog(string const &) = 0;
/// /// return the current version description
virtual string const versionString() const = 0; virtual string const versionString() const = 0;
/// /// return the current version
string const & version() const { string const & version() const {
return version_; return version_;
} }
/// /// return the user who has locked the file
string const & locker() const { return locker_; } string const & locker() const { return locker_; }
/// /// set the owning buffer
void owner(Buffer * b) { owner_ = b; } void owner(Buffer * b) { owner_ = b; }
/// /// return the owning buffer
Buffer * owner() const { return owner_; } Buffer * owner() const { return owner_; }
/// /// return the lock status of this file
VCStatus status() const { return vcstatus; } VCStatus status() const { return vcstatus; }
protected: protected:
/// /// parse information from the version file
static int doVCCommand(string const &, string const &); virtual void scanMaster() = 0;
/** The master VC file. For RCS this is *,v or RCS/ *,v. master should /**
have full path. * doVCCommand - call out to the version control utility
* @param cmd the command to execute
* @param path the path from which to execute
* @return exit status
*/
static int doVCCommand(string const & cmd, string const & path);
/**
* The master VC file. For RCS this is *,v or RCS/ *,v. master should
* have full path.
*/ */
string master_; string master_;
/// The status of the VC controlled file. /// The status of the VC controlled file.
VCStatus vcstatus; VCStatus vcstatus;
/** The version of the VC file. I am not sure if this can be a /**
string of if it must be a * The version of the VC file. I am not sure if this can be a
float/int. */ * string or if it must be a float/int.
*/
string version_; string version_;
/// The user currently keeping the lock on the VC file. /// The user currently keeping the lock on the VC file.
@ -78,31 +96,33 @@ protected:
/// ///
class RCS : public VCS { class RCS : public VCS {
public: public:
///
explicit explicit
RCS(string const & m); RCS(string const & m);
///
/// return the revision file for the given file, if found
static string const find_file(string const & file); static string const find_file(string const & file);
///
static void retrive(string const & file); static void retrieve(string const & file);
///
virtual void scanMaster();
///
virtual void registrer(string const & msg); virtual void registrer(string const & msg);
///
virtual void checkIn(string const & msg); virtual void checkIn(string const & msg);
///
virtual void checkOut(); virtual void checkOut();
///
virtual void revert(); virtual void revert();
///
virtual void undoLast(); virtual void undoLast();
///
virtual void getLog(string const &); virtual void getLog(string const &);
///
virtual string const versionString() const { virtual string const versionString() const {
return "RCS: " + version_; return "RCS: " + version_;
} }
protected:
virtual void scanMaster();
}; };
@ -112,27 +132,30 @@ public:
/// ///
explicit explicit
CVS(string const & m, string const & f); CVS(string const & m, string const & f);
///
/// return the revision file for the given file, if found
static string const find_file(string const & file); static string const find_file(string const & file);
///
virtual void scanMaster();
///
virtual void registrer(string const & msg); virtual void registrer(string const & msg);
///
virtual void checkIn(string const & msg); virtual void checkIn(string const & msg);
///
virtual void checkOut(); virtual void checkOut();
///
virtual void revert(); virtual void revert();
///
virtual void undoLast(); virtual void undoLast();
///
virtual void getLog(string const &); virtual void getLog(string const &);
///
virtual string const versionString() const { virtual string const versionString() const {
return "CVS: " + version_; return "CVS: " + version_;
} }
protected:
virtual void scanMaster();
private: private:
string file_; string file_;
}; };
#endif #endif // VCBACKEND_H

View File

@ -1,18 +0,0 @@
/* -*- C++ -*- */
/* This file is part of
* ======================================================
*
* LyX, the High Level Word Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
* ======================================================
A few prototypes and definitions needed for VMS / OpenVMS */
#ifndef VMS_DEFINES_H
#define VMS_DEFINES_H
/* Currently empty. */
#endif /* _VMS_DEFINES_H */

View File

@ -1,12 +1,10 @@
/* This file is part of /**
* ====================================================== * \file vspace.C
* Copyright 1995-2002 the LyX Team
* Read the file COPYING
* *
* LyX, The Document Processor * \author Matthias Ettrich
* */
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
* ====================================================== */
#include <config.h> #include <config.h>
@ -21,6 +19,7 @@
#include "lyxrc.h" #include "lyxrc.h"
#include "lyxtext.h" #include "lyxtext.h"
#include "BufferView.h" #include "BufferView.h"
#include "support/LAssert.h"
#include "support/lstrings.h" #include "support/lstrings.h"
@ -29,29 +28,45 @@
namespace { namespace {
/// used to return numeric values in parsing vspace
double number[4] = { 0, 0, 0, 0 }; double number[4] = { 0, 0, 0, 0 };
/// used to return unit types in parsing vspace
LyXLength::UNIT unit[4] = { LyXLength::UNIT_NONE, LyXLength::UNIT unit[4] = { LyXLength::UNIT_NONE,
LyXLength::UNIT_NONE, LyXLength::UNIT_NONE,
LyXLength::UNIT_NONE, LyXLength::UNIT_NONE,
LyXLength::UNIT_NONE }; LyXLength::UNIT_NONE };
/// the current position in the number array
int number_index; int number_index;
/// the current position in the unit array
int unit_index; int unit_index;
/// skip n characters of input
inline inline
void lyx_advance(string & data, string::size_type n) void lyx_advance(string & data, string::size_type n)
{ {
data.erase(0, n); data.erase(0, n);
} }
/// return true when the input is at the end
inline inline
bool isEndOfData(string const & data) bool isEndOfData(string const & data)
{ {
return frontStrip(data).empty(); return frontStrip(data).empty();
} }
/**
* nextToken - return the next token in the input
* @param data input string
* @return a char representing the type of token returned
*
* The possible return values are :
* + stretch indicator for glue length
* - shrink indicator for glue length
* n a numeric value (stored in number array)
* u a unit type (stored in unit array)
* E parse error
*/
char nextToken(string & data) char nextToken(string & data)
{ {
data = frontStrip(data); data = frontStrip(data);
@ -125,6 +140,7 @@ char nextToken(string & data)
} }
/// latex representation of a vspace
struct LaTeXLength { struct LaTeXLength {
char const * pattern; char const * pattern;
int plus_val_index; int plus_val_index;
@ -134,6 +150,7 @@ struct LaTeXLength {
}; };
/// the possible formats for a vspace string
LaTeXLength table[] = { LaTeXLength table[] = {
{ "nu", 0, 0, 0, 0 }, { "nu", 0, 0, 0, 0 },
{ "nu+nu", 2, 0, 2, 0 }, { "nu+nu", 2, 0, 2, 0 },
@ -242,10 +259,10 @@ bool isValidGlueLength(string const & data, LyXGlueLength * result)
bool isValidLength(string const & data, LyXLength * result) bool isValidLength(string const & data, LyXLength * result)
{ {
/// This is a trimmed down version of isValidGlueLength. // This is a trimmed down version of isValidGlueLength.
/// The parser may seem overkill for lengths without // The parser may seem overkill for lengths without
/// glue, but since we already have it, using it is // glue, but since we already have it, using it is
/// easier than writing something from scratch. // easier than writing something from scratch.
if (data.empty()) if (data.empty())
return true; return true;
@ -425,7 +442,8 @@ string const VSpace::asLatexCommand(BufferParams const & params) const
case LENGTH: return keep_ ? "\\vspace*{" + len_.asLatexString() + '}' case LENGTH: return keep_ ? "\\vspace*{" + len_.asLatexString() + '}'
: "\\vspace{" + len_.asLatexString() + '}'; : "\\vspace{" + len_.asLatexString() + '}';
} }
return string(); // should never be reached
lyx::Assert(0);
} }
@ -464,14 +482,12 @@ int VSpace::inPixels(BufferView * bv) const
retval = 3 * default_height; retval = 3 * default_height;
break; break;
case LENGTH: case LENGTH: {
{
int const default_width = bv->workWidth(); int const default_width = bv->workWidth();
retval = len_.len().inPixels(default_width, default_height); retval = len_.len().inPixels(default_width, default_height);
break; break;
} }
} }
return retval; return retval;
} }

View File

@ -1,13 +1,11 @@
// -*- C++ -*- // -*- C++ -*-
/* This file is part of /**
* ====================================================== * \file vspace.h
* Copyright 1995-2002 the LyX Team
* Read the file COPYING
* *
* LyX, The Document Processor * \author Matthias Ettrich
* */
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
* ====================================================== */
#ifndef VSPACE_H #ifndef VSPACE_H
#define VSPACE_H #define VSPACE_H
@ -24,63 +22,57 @@ class BufferParams;
class BufferView; class BufferView;
/// /// A class representing latex vertical spacing
class VSpace { class VSpace {
public: public:
/// The different kinds of spaces. /// The different kinds of spaces.
enum vspace_kind { enum vspace_kind {
/// NONE, ///< no added vertical space
NONE,
///
DEFSKIP, DEFSKIP,
///
SMALLSKIP, SMALLSKIP,
///
MEDSKIP, MEDSKIP,
///
BIGSKIP, BIGSKIP,
///
VFILL, VFILL,
/// LENGTH ///< user-defined length
LENGTH
}; };
/// Constructor
VSpace(); VSpace();
/// Constructor
explicit VSpace(vspace_kind k); explicit VSpace(vspace_kind k);
/// Constructor
explicit VSpace(LyXLength const & l); explicit VSpace(LyXLength const & l);
/// Constructor
explicit VSpace(LyXGlueLength const & l); explicit VSpace(LyXGlueLength const & l);
/// Constructor for reading from a .lyx file /// Constructor for reading from a .lyx file
explicit VSpace(string const & data); explicit VSpace(string const & data);
/// access functions /// return the type of vertical space
vspace_kind kind() const; vspace_kind kind() const;
/// /// return the length of this space
LyXGlueLength length() const; LyXGlueLength length() const;
// a flag that switches between \vspace and \vspace* // a flag that switches between \vspace and \vspace*
bool keep() const; bool keep() const;
/// /// if set true, use \vspace* when type is not DEFSKIP
void setKeep(bool val); void setKeep(bool val);
/// ///
bool operator==(VSpace const &) const; bool operator==(VSpace const &) const;
// conversion // conversion
/// how it goes into the LyX file /// how it goes into the LyX file
string const asLyXCommand() const; string const asLyXCommand() const;
/// /// the latex representation
string const asLatexCommand(BufferParams const & params) const; string const asLatexCommand(BufferParams const & params) const;
/// /// the size of the space on-screen
int inPixels(BufferView * bv) const; int inPixels(BufferView * bv) const;
private: private:
/// This VSpace kind /// This VSpace kind
vspace_kind kind_; vspace_kind kind_;
/// /// the specified length
LyXGlueLength len_; LyXGlueLength len_;
/// /// if true, use \vspace* type
bool keep_; bool keep_;
}; };