From 1120aa806c16aac6942760f244a1dbbe30c744be Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Tue, 26 Feb 2002 10:50:48 +0000 Subject: [PATCH] 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 --- ChangeLog | 4 + acconfig.h | 8 +- lib/ChangeLog | 4 + lib/ui/default.ui | 2 +- po/POTFILES.in | 1 - src/ChangeLog | 33 ++++++ src/Makefile.am | 3 - src/buffer.C | 2 + src/bufferlist.C | 2 +- src/chset.C | 7 +- src/chset.h | 32 +++-- src/frontends/controllers/ChangeLog | 4 + src/frontends/controllers/biblio.C | 25 ++-- src/frontends/xforms/ChangeLog | 5 + src/frontends/xforms/FormGraphics.C | 4 + src/frontends/xforms/form_graphics.C | 6 +- src/frontends/xforms/forms/form_graphics.fd | 6 +- src/kbmap.h | 16 +-- src/lengthcommon.h | 14 ++- src/lyx_gui.C | 2 +- src/lyxgluelength.h | 17 ++- src/lyxlength.h | 82 +++++-------- src/lyxserver.C | 2 +- src/lyxtextclass.C | 2 +- src/paragraph.C | 6 +- src/support/ChangeLog | 7 ++ src/support/Makefile.am | 3 + src/{ => support}/nt_defines.h | 0 src/{ => support}/os2_defines.h | 0 src/{ => support}/os2_errortable.h | 0 src/text2.C | 2 + src/undo.C | 2 - src/vc-backend.C | 4 +- src/vc-backend.h | 125 ++++++++++++-------- src/vms_defines.h | 18 --- src/vspace.C | 62 ++++++---- src/vspace.h | 50 ++++---- 37 files changed, 327 insertions(+), 235 deletions(-) rename src/{ => support}/nt_defines.h (100%) rename src/{ => support}/os2_defines.h (100%) rename src/{ => support}/os2_errortable.h (100%) delete mode 100644 src/vms_defines.h diff --git a/ChangeLog b/ChangeLog index 9f2ed701a4..4556361d0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2002-02-26 John Levon + + * acconfig.h: nt/os2 defines moved + 2002-02-04 Jean-Marc Lasgouttes * README: change reference to bugtracker diff --git a/acconfig.h b/acconfig.h index ab7c54953b..8d0cbf7b64 100644 --- a/acconfig.h +++ b/acconfig.h @@ -96,15 +96,11 @@ int mkstemp(char*); #endif #ifdef __EMX__ -#include "os2_defines.h" -#endif - -#ifdef VMS -#include "vms_defines.h" +#include "support/os2_defines.h" #endif #if defined(__CYGWIN__) || defined( __CYGWIN32__) -#include "nt_defines.h" +#include "support/nt_defines.h" #endif /* Some support for the boost library. */ diff --git a/lib/ChangeLog b/lib/ChangeLog index aede1d201f..cace336a48 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2002-02-21 Jean-Marc Lasgouttes + + * ui/default.ui: change Layout>LaTeX Preamble to Layout>Preamble. + 2002-02-13 José Matos * examples/linuxdoc_manpage.lyx: added diff --git a/lib/ui/default.ui b/lib/ui/default.ui index b1a3fd3dfc..7c5aa5bdeb 100644 --- a/lib/ui/default.ui +++ b/lib/ui/default.ui @@ -284,7 +284,7 @@ Menuset # Item "TeX Style|X" "tex-mode" Separator Item "Change Environment Depth|v" "depth-increment" - Item "LaTeX Preamble...|L" "layout-preamble" + Item "Preamble...|r" "layout-preamble" Item "Start Appendix here|A" "appendix" End diff --git a/po/POTFILES.in b/po/POTFILES.in index 5585e5ec15..3570609547 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -9,7 +9,6 @@ src/converter.C src/CutAndPaste.C src/debug.C src/exporter.C -src/ext_l10n.h src/figure_form.C src/figureForm.C src/FontLoader.C diff --git a/src/ChangeLog b/src/ChangeLog index a8daf974c3..a85eaec9cf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,36 @@ +2002-02-26 John Levon + + * 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 * tabular_funcs.C (write_attribute): changed so that some default diff --git a/src/Makefile.am b/src/Makefile.am index f1fe39f425..13818ac81e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -187,9 +187,6 @@ lyx_SOURCES = \ main.C \ minibuffer.C \ minibuffer.h \ - nt_defines.h \ - os2_defines.h \ - os2_errortable.h \ paragraph.C \ paragraph.h \ paragraph_pimpl.C \ diff --git a/src/buffer.C b/src/buffer.C index 14094621af..52c05a24fd 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -299,7 +299,9 @@ std::stack ert_stack; ErtComp ert_comp; #endif +#ifdef WITH_WARNINGS #warning And _why_ is this here? (Lgb) +#endif int unknown_layouts; int unknown_tokens; diff --git a/src/bufferlist.C b/src/bufferlist.C index 060e6269fc..86c632cee3 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -542,7 +542,7 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles) // How can we know _how_ to do the checkout? // With the current VC support it has to be, // a RCS file since CVS do not have special ,v files. - RCS::retrive(s); + RCS::retrieve(s); return loadLyXFile(filename, tolastfiles); } } diff --git a/src/chset.C b/src/chset.C index 277f7db184..c912b31149 100644 --- a/src/chset.C +++ b/src/chset.C @@ -23,9 +23,10 @@ bool CharacterSet::loadFile(string const & fname) { map_.clear(); name_.erase(); - - if (fname.empty() || fname == "ascii") - return true; // ascii 7-bit + + // ascii 7-bit + if (fname.empty() || fname == "ascii") + return true; // open definition file lyxerr[Debug::KBMAP] diff --git a/src/chset.h b/src/chset.h index 90d9affad4..a3691af1df 100644 --- a/src/chset.h +++ b/src/chset.h @@ -1,4 +1,10 @@ // -*- C++ -*- +/** + * \file chset.h + * Copyright 2002 the LyX Team + * Read the file COPYING + */ + #ifndef CHSET_H #define CHSET_H @@ -11,21 +17,33 @@ #include "LString.h" -/// +/// a class for mapping char strings such as "\^{A}" to the integer value class CharacterSet { 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; - /// + /** + * 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 const encodeString(string const &) const; private: - /// + /// charset name string name_; /// typedef std::map Cdef; - /// + /// mapping from string representation to encoded value Cdef map_; }; #endif diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index ff2756a20f..ac150815c4 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,7 @@ +2002-02-21 Herbert Voss + + * biblio.C: fix bug with commentlines in a bibentry + 2002-02-20 Lars Gullik Bjønnes * Makefile.am: simpler obj. file compile diff --git a/src/frontends/controllers/biblio.C b/src/frontends/controllers/biblio.C index 658160f581..3d8aa28979 100644 --- a/src/frontends/controllers/biblio.C +++ b/src/frontends/controllers/biblio.C @@ -320,18 +320,29 @@ searchKeys(InfoMap const & theMap, string const parseBibTeX(string data, string const & findkey) { string keyvalue; - for (string::iterator it = data.begin(); it < data.end(); ++it) { - if ((*it) == '\n' || (*it) == '\t') - (*it)= ' '; + // at first we delete all characters right of '%' and + // replace tabs through a space and remove leading spaces + 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('%')); + } + else + data_ += dummy; + dummy = token(data, '\n', ++Entries); } - data = frontStrip(data); - + data = data_; // now get only the important line of the bibtex entry. // all entries are devided by ',' except the last one. data += ','; // now we have same behaviour for all entries // because the last one is "blah ... }" - int Entries = 0; - string dummy = token(data, ',', Entries); + Entries = 0; + dummy = token(data, ',', Entries); while (!contains(lowercase(dummy), findkey) && !dummy.empty()) dummy = token(data, ',', ++Entries); if (dummy.empty()) diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 9defce8992..78fe413384 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,8 @@ +2002-02-24 Juergen Spitzmueller + + * forms/form_graphics.fd: Enlarge Restore button. + * FormGraphics.C: Set filter to bounding box input fields. + 2002-02-20 Lars Gullik Bjønnes * Makefile.am: simpler obj. file compiling diff --git a/src/frontends/xforms/FormGraphics.C b/src/frontends/xforms/FormGraphics.C index 5cb9d4345b..419d44052a 100644 --- a/src/frontends/xforms/FormGraphics.C +++ b/src/frontends/xforms/FormGraphics.C @@ -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_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"; fl_addto_choice(bbox_->choice_bb_units, bb_units.c_str()); bc().addReadOnly(bbox_->button_getBB); diff --git a/src/frontends/xforms/form_graphics.C b/src/frontends/xforms/form_graphics.C index ca5222e954..dea86faf11 100644 --- a/src/frontends/xforms/form_graphics.C +++ b/src/frontends/xforms/form_graphics.C @@ -22,9 +22,9 @@ FD_form_graphics * FormGraphics::build_graphics() FL_OBJECT *obj; 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; - 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); fdui->tabFolder = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 5, 5, 500, 270, _("Tabbed folder")); 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); { 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_object_lsize(obj, FL_NORMAL_SIZE); diff --git a/src/frontends/xforms/forms/form_graphics.fd b/src/frontends/xforms/forms/form_graphics.fd index e32cc62a42..7d0645dba5 100644 --- a/src/frontends/xforms/forms/form_graphics.fd +++ b/src/frontends/xforms/forms/form_graphics.fd @@ -10,13 +10,13 @@ SnapGrid: 5 =============== FORM =============== Name: form_graphics Width: 510 -Height: 360 +Height: 345 Number of Objects: 7 -------------------- class: FL_BOX type: FLAT_BOX -box: 0 0 510 360 +box: 0 0 510 345 boxtype: FL_FLAT_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -52,7 +52,7 @@ argument: -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 5 310 80 30 +box: 5 310 100 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER diff --git a/src/kbmap.h b/src/kbmap.h index 7852e586c5..e7f35d7236 100644 --- a/src/kbmap.h +++ b/src/kbmap.h @@ -1,10 +1,12 @@ // -*- C++ -*- -/* ======================================================================= *\ - File : kbmap.h, kbmap.h,v 1.3 1996/12/10 04:35:57 larsbj Exp - Author : chb, 30.Oct.1995 - Docu : see kbmap.C - Purpose: class definitions for XKeyEvent keymap handling - \* ==================================================================== */ +/** + * \file kbmap.h + * Copyright 1995-2002 the LyX Team + * Read the file COPYING + * + * \author Lars Gullik Bjønnes + * \author John Levon + */ #ifndef KBMAP_H #define KBMAP_H @@ -93,4 +95,4 @@ private: Table table; }; -#endif +#endif // KBMAP_H diff --git a/src/lengthcommon.h b/src/lengthcommon.h index 7991f2c573..71d72ea988 100644 --- a/src/lengthcommon.h +++ b/src/lengthcommon.h @@ -1,16 +1,22 @@ // -*- C++ -*- -#ifndef LENGHT_COMMON_H -#define LENGHT_COMMON_H +#ifndef LENGTH_COMMON_H +#define LENGTH_COMMON_H #include "LString.h" #include "lyxlength.h" +/// the number of units possible 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[]; +/// return the unit given a string representation such as "cm" LyXLength::UNIT unitFromString(string const & data); -#endif +#endif // LENGTH_COMMON_H diff --git a/src/lyx_gui.C b/src/lyx_gui.C index 552819fdd7..21312bad5d 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -88,7 +88,7 @@ int LyX_XErrHandler(Display * display, XErrorEvent * xeev) // Get the reason for the crash. char etxt[513]; 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) lyx::abort(); return 0; // Solaris CC wants us to return something diff --git a/src/lyxgluelength.h b/src/lyxgluelength.h index e07b0fa664..e392093cf0 100644 --- a/src/lyxgluelength.h +++ b/src/lyxgluelength.h @@ -1,13 +1,12 @@ // -*- C++ -*- -/* This file is part of - * ====================================================== +/** + * \file lyxgluelength.h + * Copyright 1995-2002 the LyX Team + * Read the file COPYING * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. - * - * ====================================================== */ + * \author Matthias Ettrich + */ + #ifndef 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); -#endif +#endif // LYXGLUELENGTH_H diff --git a/src/lyxlength.h b/src/lyxlength.h index a4d71aef2c..6c79982f23 100644 --- a/src/lyxlength.h +++ b/src/lyxlength.h @@ -1,13 +1,12 @@ // -*- C++ -*- -/* This file is part of - * ====================================================== +/** + * \file lyxlength.h + * Copyright 1995-2002 the LyX Team + * Read the file COPYING * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. - * - * ====================================================== */ + * \author Matthias Ettrich + */ + #ifndef LYX_LENGTH_H #define LYX_LENGTH_H @@ -18,47 +17,30 @@ #include "LString.h" -// -/// LyXLength Class -// +/** + * LyXLength - Represents latex length measurement + */ class LyXLength { public: /// length units enum UNIT { - /// Scaled point (65536sp = 1pt) TeX's smallest unit. - SP, - /// Point = 1/72.27in = 0.351mm - PT, - /// Big point (72bp = 1in), also PostScript point - BP, - /// Didot point = 1/72 of a French inch, = 0.376mm - DD, - /// Millimeter = 2.845pt - MM, - /// Pica = 12pt = 4.218mm - PC, - /// Cicero = 12dd = 4.531mm - CC, - /// Centimeter = 10mm = 2.371pc - CM, - /// Inch = 25.4mm = 72.27pt = 6.022pc - 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 + SP, ///< Scaled point (65536sp = 1pt) TeX's smallest unit. + PT, ///< Point = 1/72.27in = 0.351mm + BP, ///< Big point (72bp = 1in), also PostScript point + DD, ///< Didot point = 1/72 of a French inch, = 0.376mm + MM, ///< Millimeter = 2.845pt + PC, ///< Pica = 12pt = 4.218mm + CC, ///< Cicero = 12dd = 4.531mm + CM, ///< Centimeter = 10mm = 2.371pc + IN, ///< Inch = 25.4mm = 72.27pt = 6.022pc + EX, ///< Height of a small "x" for the current font. + EM, ///< Width of capital "M" in current font. + MU, ///< Math unit (18mu = 1em) for positioning in math mode + PW, ///< Percent of columnwidth both "%" or "%c" + PE, ///< FIXME + PP, ///< Percent of pagewidth + PL, ///< Percent of linewidth + UNIT_NONE ///< no unit }; /// @@ -79,11 +61,11 @@ public: void unit(LyXLength::UNIT unit); /// bool zero() const; - /// conversion + /// return string representation string const asString() const; - /// + /// return string representation for LaTeX string const asLatexString() const; - /// + /// return the on-screen size of this length int inPixels(int default_width, int default_height) const; /** 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 isValidLength(string const & data, LyXLength * result); -/// +/// return the name of the given unit number char const * stringFromUnit(int unit); -#endif +#endif // LYXLENGTH_H diff --git a/src/lyxserver.C b/src/lyxserver.C index 69fa710eea..64d0c15622 100644 --- a/src/lyxserver.C +++ b/src/lyxserver.C @@ -62,7 +62,7 @@ #define INCL_DOSNMPIPES #define INCL_DOSERRORS #include -#include "os2_errortable.h" +#include "support/os2_errortable.h" #endif using std::endl; diff --git a/src/lyxtextclass.C b/src/lyxtextclass.C index 110f2c7d89..e449feaa66 100644 --- a/src/lyxtextclass.C +++ b/src/lyxtextclass.C @@ -57,7 +57,7 @@ bool LyXTextClass::do_readStyle(LyXLex & lexrc, LyXLayout & lay) { lyxerr[Debug::TCLASS] << "Reading style " << lay.name() << endl; if (!lay.Read(lexrc, *this)) { - // Reslove fonts + // Resolve fonts lay.resfont = lay.font; #ifndef INHERIT_LANGUAGE lay.resfont.realize(defaultfont()); diff --git a/src/paragraph.C b/src/paragraph.C index fd27bfb846..3f29163e4a 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -1615,13 +1615,13 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf, // Fully instantiated font 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 // outside font change, i.e. we write "\textXX{text} " // rather than "\textXX{text }". (Asger) 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 && next_font != font) { font = next_font; @@ -1943,7 +1943,9 @@ Paragraph::getParLanguage(BufferParams const & bparams) const return getFirstFontSettings().language(); #else Language const * lang = getFirstFontSettings().language(); +#ifdef WITH_WARNINGS #warning We should make this somewhat better, any ideas? (Jug) +#endif if (lang == inherit_language || lang == ignore_language) lang = bparams.language; return lang; diff --git a/src/support/ChangeLog b/src/support/ChangeLog index c12d709ad5..1e72a15a0d 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,10 @@ +2002-02-26 John Levon + + * Makefile.am: + * os2_defines.h: + * os2_errortable.h: + * nt_defines.h: moved from src/ + 2002-02-18 Herbert Voss * filetools.C: (getExtFromContents) return the fileextension diff --git a/src/support/Makefile.am b/src/support/Makefile.am index 7d5070b096..4670add509 100644 --- a/src/support/Makefile.am +++ b/src/support/Makefile.am @@ -54,6 +54,9 @@ libsupport_la_SOURCES = \ lyxmanip.h \ $(LYXSTRING) lyxsum.C \ mkdir.C \ + nt_defines.h \ + os2_defines.h \ + os2_errortable.h \ path.C \ path.h \ putenv.C \ diff --git a/src/nt_defines.h b/src/support/nt_defines.h similarity index 100% rename from src/nt_defines.h rename to src/support/nt_defines.h diff --git a/src/os2_defines.h b/src/support/os2_defines.h similarity index 100% rename from src/os2_defines.h rename to src/support/os2_defines.h diff --git a/src/os2_errortable.h b/src/support/os2_errortable.h similarity index 100% rename from src/os2_errortable.h rename to src/support/os2_errortable.h diff --git a/src/text2.C b/src/text2.C index ca8502196e..f83a41fbde 100644 --- a/src/text2.C +++ b/src/text2.C @@ -2207,10 +2207,12 @@ void LyXText::setCursorIntern(BufferView * bview, Paragraph * par, if (it != inset_owner) { lyxerr << "InsetText is " << it << endl; lyxerr << "inset_owner is " << inset_owner << endl; +#ifdef WITH_WARNINGS #warning I believe this code is wrong. (Lgb) #warning Jürgen, have a look at this. (Lgb) #warning Hmmm, I guess you are right but we #warning should verify when this is needed +#endif // Jürgen, would you like to have a look? // I guess we need to move the outer cursor // and open and lock the inset (bla bla bla) diff --git a/src/undo.C b/src/undo.C index f2c0228508..289bf32fd3 100644 --- a/src/undo.C +++ b/src/undo.C @@ -42,5 +42,3 @@ Undo::~Undo() delete tmppar; } } - - diff --git a/src/vc-backend.C b/src/vc-backend.C index 23d36b25b6..33a59362cd 100644 --- a/src/vc-backend.C +++ b/src/vc-backend.C @@ -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 \"" + file + "\"", string()); diff --git a/src/vc-backend.h b/src/vc-backend.h index 065276b44b..45508ca0c2 100644 --- a/src/vc-backend.h +++ b/src/vc-backend.h @@ -1,4 +1,12 @@ // -*- C++ -*- +/** + * \file vc-backend.h + * Copyright 1995-2002 the LyX Team + * Read the file COPYING + * + * \author Lars Gullik Bjønnes + */ + #ifndef VC_BACKEND_H #define VC_BACKEND_H @@ -11,61 +19,71 @@ class Buffer; -/// +/// A simple version control system interface class VCS { public: - /// + /// the status of the managed file enum VCStatus { - /// UNLOCKED, - /// LOCKED }; - /// + virtual ~VCS() {} - /// - virtual void scanMaster() = 0; - /// + + /// register a file for version control virtual void registrer(string const & msg) = 0; - /// + /// check in the current revision virtual void checkIn(string const & msg) = 0; - /// + /// check out for editing virtual void checkOut() = 0; - /// + /// revert current edits virtual void revert() = 0; - /// + /// FIXME 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; - /// + /// return the current version description virtual string const versionString() const = 0; - /// + /// return the current version string const & version() const { return version_; } - /// + /// return the user who has locked the file string const & locker() const { return locker_; } - /// + /// set the owning buffer void owner(Buffer * b) { owner_ = b; } - /// + /// return the owning buffer Buffer * owner() const { return owner_; } - /// + /// return the lock status of this file VCStatus status() const { return vcstatus; } protected: - /// - static int doVCCommand(string const &, string const &); + /// parse information from the version file + virtual void scanMaster() = 0; + + /** + * 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. - */ + /** + * The master VC file. For RCS this is *,v or RCS/ *,v. master should + * have full path. + */ string master_; /// The status of the VC controlled file. VCStatus vcstatus; - /** The version of the VC file. I am not sure if this can be a - string of if it must be a - float/int. */ + /** + * The version of the VC file. I am not sure if this can be a + * string or if it must be a float/int. + */ string version_; /// The user currently keeping the lock on the VC file. @@ -78,31 +96,33 @@ protected: /// class RCS : public VCS { public: - /// + explicit RCS(string const & m); - /// + + /// return the revision file for the given file, if found static string const find_file(string const & file); - /// - static void retrive(string const & file); - /// - virtual void scanMaster(); - /// + + static void retrieve(string const & file); + virtual void registrer(string const & msg); - /// + virtual void checkIn(string const & msg); - /// + virtual void checkOut(); - /// + virtual void revert(); - /// + virtual void undoLast(); - /// + virtual void getLog(string const &); - /// + virtual string const versionString() const { return "RCS: " + version_; } + +protected: + virtual void scanMaster(); }; @@ -112,27 +132,30 @@ public: /// explicit 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); - /// - virtual void scanMaster(); - /// + virtual void registrer(string const & msg); - /// + virtual void checkIn(string const & msg); - /// + virtual void checkOut(); - /// + virtual void revert(); - /// + virtual void undoLast(); - /// + virtual void getLog(string const &); - /// + virtual string const versionString() const { return "CVS: " + version_; } + +protected: + virtual void scanMaster(); + private: string file_; }; -#endif +#endif // VCBACKEND_H diff --git a/src/vms_defines.h b/src/vms_defines.h deleted file mode 100644 index 14609082c9..0000000000 --- a/src/vms_defines.h +++ /dev/null @@ -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 */ diff --git a/src/vspace.C b/src/vspace.C index c93722d99e..50b28231bc 100644 --- a/src/vspace.C +++ b/src/vspace.C @@ -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 - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. - * - * ====================================================== */ + * \author Matthias Ettrich + */ #include @@ -21,6 +19,7 @@ #include "lyxrc.h" #include "lyxtext.h" #include "BufferView.h" +#include "support/LAssert.h" #include "support/lstrings.h" @@ -29,29 +28,45 @@ namespace { -double number[4] = { 0, 0, 0, 0 }; -LyXLength::UNIT unit[4] = { LyXLength::UNIT_NONE, - LyXLength::UNIT_NONE, - LyXLength::UNIT_NONE, - LyXLength::UNIT_NONE }; +/// used to return numeric values in parsing vspace +double number[4] = { 0, 0, 0, 0 }; +/// used to return unit types in parsing vspace +LyXLength::UNIT unit[4] = { LyXLength::UNIT_NONE, + LyXLength::UNIT_NONE, + LyXLength::UNIT_NONE, + LyXLength::UNIT_NONE }; +/// the current position in the number array int number_index; +/// the current position in the unit array int unit_index; +/// skip n characters of input inline void lyx_advance(string & data, string::size_type n) { data.erase(0, n); } - +/// return true when the input is at the end inline bool isEndOfData(string const & data) { 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) { data = frontStrip(data); @@ -125,6 +140,7 @@ char nextToken(string & data) } +/// latex representation of a vspace struct LaTeXLength { char const * pattern; int plus_val_index; @@ -134,6 +150,7 @@ struct LaTeXLength { }; +/// the possible formats for a vspace string LaTeXLength table[] = { { "nu", 0, 0, 0, 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) { - /// This is a trimmed down version of isValidGlueLength. - /// The parser may seem overkill for lengths without - /// glue, but since we already have it, using it is - /// easier than writing something from scratch. + // This is a trimmed down version of isValidGlueLength. + // The parser may seem overkill for lengths without + // glue, but since we already have it, using it is + // easier than writing something from scratch. if (data.empty()) return true; @@ -425,7 +442,8 @@ string const VSpace::asLatexCommand(BufferParams const & params) const case LENGTH: return keep_ ? "\\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; break; - case LENGTH: - { + case LENGTH: { int const default_width = bv->workWidth(); retval = len_.len().inPixels(default_width, default_height); break; } } - return retval; } diff --git a/src/vspace.h b/src/vspace.h index 266e04196d..b2b18bcfe7 100644 --- a/src/vspace.h +++ b/src/vspace.h @@ -1,13 +1,11 @@ // -*- C++ -*- -/* This file is part of - * ====================================================== +/** + * \file vspace.h + * Copyright 1995-2002 the LyX Team + * Read the file COPYING * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. - * - * ====================================================== */ + * \author Matthias Ettrich + */ #ifndef VSPACE_H #define VSPACE_H @@ -24,63 +22,57 @@ class BufferParams; class BufferView; -/// +/// A class representing latex vertical spacing class VSpace { public: /// The different kinds of spaces. enum vspace_kind { - /// - NONE, - /// + NONE, ///< no added vertical space DEFSKIP, - /// SMALLSKIP, - /// MEDSKIP, - /// BIGSKIP, - /// VFILL, - /// - LENGTH + LENGTH ///< user-defined length }; - /// Constructor + VSpace(); - /// Constructor + explicit VSpace(vspace_kind k); - /// Constructor + explicit VSpace(LyXLength const & l); - /// Constructor + explicit VSpace(LyXGlueLength const & l); /// Constructor for reading from a .lyx file explicit VSpace(string const & data); - /// access functions + /// return the type of vertical space vspace_kind kind() const; - /// + /// return the length of this space LyXGlueLength length() const; // a flag that switches between \vspace and \vspace* bool keep() const; - /// + /// if set true, use \vspace* when type is not DEFSKIP void setKeep(bool val); /// bool operator==(VSpace const &) const; // conversion + /// how it goes into the LyX file string const asLyXCommand() const; - /// + /// the latex representation string const asLatexCommand(BufferParams const & params) const; - /// + /// the size of the space on-screen int inPixels(BufferView * bv) const; private: /// This VSpace kind vspace_kind kind_; - /// + /// the specified length LyXGlueLength len_; - /// + /// if true, use \vspace* type bool keep_; }; -- 2.39.2