From 7086f52fc8eabd0b20d5fa9f20c279528aed0f99 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Sat, 20 Jul 2002 15:25:41 +0000 Subject: [PATCH] small unimportant cleanups git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4723 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 4 + configure.in | 13 +-- lib/ChangeLog | 3 + lib/bind/sciword.bind | 126 -------------------- lib/bind/sv_menus.bind | 167 +-------------------------- po/POTFILES.in | 1 + src/ChangeLog | 4 + src/buffer.C | 11 +- src/frontends/xforms/ChangeLog | 7 ++ src/frontends/xforms/Menubar_pimpl.C | 15 ++- src/frontends/xforms/Menubar_pimpl.h | 5 +- src/graphics/ChangeLog | 4 + src/graphics/GraphicsParams.C | 3 + src/support/ChangeLog | 5 + src/support/lyxstring.C | 63 +++------- 15 files changed, 73 insertions(+), 358 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5b55bef07d..dfe35ed479 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2002-07-20 Jean-Marc Lasgouttes + + * configure.in: yet another try at the same thing + 2002-07-18 Jean-Marc Lasgouttes * configure.in: try (again) to fix EOF handling in VERSION_INFO diff --git a/configure.in b/configure.in index 410dcf0463..5a14138657 100644 --- a/configure.in +++ b/configure.in @@ -176,10 +176,8 @@ case "$lyx_use_frontend" in FRONTEND_LIBS="@XFORMS_IMAGE_LIB@ @XFORMS_LIB@ @XPM_LIB@" ;; esac - FRONTEND_INFO=`cat < + * bind/sv_menus.bind: + * bind/sciword.bind: remove some cruft + * tex/iletter.cls: * layout/iletter.layout: * templates/iletter.lyx: removed all traces of the iletter bundle diff --git a/lib/bind/sciword.bind b/lib/bind/sciword.bind index 8e995fbaf2..db4a56ab6c 100644 --- a/lib/bind/sciword.bind +++ b/lib/bind/sciword.bind @@ -137,7 +137,6 @@ \bind "M-m l" "math-limits" \bind "M-m n" "math-number" \bind "M-m v" "accent-vector" -\bind "M-m space" "menu-open Math" # Sciword mnemonics for math editing: @@ -249,131 +248,6 @@ \bind "Escape" "cancel" \bind "F9" "meta-prefix" -# -# Visible Menu access menu -# - -#\bind "F10 d" "menu-open Documents" -#\bind "F10 e" "menu-open Edit" -#\bind "F10 f" "menu-open File" -#\bind "F10 h" "menu-open Help" -#\bind "F10 i" "menu-open Insert" -#\bind "F10 l" "menu-open Layout" -#\bind "F10 m" "menu-open Math" -#\bind "F10 o" "menu-open Options" - - - -# -# File menu -# - -#\bind "M-f a" "buffer-write-as" -#\bind "M-f c" "buffer-close" -#\bind "M-f n" "buffer-new" -#\bind "M-f l" "file-last" # Not yet implemented. -#\bind "M-f o" "file-open" -#\bind "M-f p" "buffer-print" -#\bind "M-f q" "lyx-quit" -#\bind "M-f r" "buffer-update dvi" - # Obsolete -#\bind "M-f s" "buffer-write" -#\bind "M-f t" "buffer-update dvi" - -#\bind "M-f x" "buffer-view dvi" -#\bind "M-f g" "buffer-view ps" -#\bind "M-f space" "menu-open File" - - -# -# Edit menu -# - -##\bind "M-e b" "table" # Not yet implemented! -#\bind "M-e c" "cut" -#\bind "M-e e" "error-next" -#\bind "M-e f" "find-replace" -#\bind "M-e k" "line-delete-forward" -#\bind "M-e m" "mark-on" -#\bind "M-e S-M" "mark-off" -#\bind "M-e n" "note-next" -#\bind "M-e o" "copy" -#\bind "M-e p" "paste" -#\bind "M-e r" "redo" -#\bind "M-e s" "spellchecker" -#\bind "M-e t" "toc-update" -#\bind "M-e u" "undo" -#\bind "M-e space" "menu-open Edit" - - -# -# Layout menu -# - -#\bind "M-l c" "layout-character" -#\bind "M-l p" "layout-paragraph" -#\bind "M-l d" "layout-document" -#\bind "M-l q" "layout-quotes" -#\bind "M-l l" "layout-preamble" -#\bind "M-l e" "font-emph" -#\bind "M-l n" "font-smallcaps" -#\bind "M-l b" "font-bold" -#\bind "M-l t" "ert-insert" -#\bind "M-l v" "depth-increment" -#\bind "M-l space" "menu-open Layout" - - - -# -# Insert menu -# - -#\bind "M-i c" "citation-insert" -#\bind "M-i f" "footnote-insert" -#\bind "M-i h" "hfill-insert" -#\bind "M-i m" "marginpar-insert" -#\bind "M-i n" "note-insert" -#\bind "M-i l" "label-insert" -#\bind "M-i r" "reference-insert" -#\bind "M-i minus" "hyphenation-point-insert" -#\bind "M-i apostrophe" "quote-insert" -#\bind "M-i S-quotedbl" "quote-insert" -#\bind "M-i space" "menu-open Insert" - - - -# -# Options menu -# - -#\bind "M-o f" "screen-font-options" # Not yet implemented! -#\bind "M-o s" "spellcheck-options" # Not yet implemented! -#\bind "M-o k" "keyboard-options" # Not yet implemented! -#\bind "M-o l" "latex-options" # Not yet implemented! -#\bind "M-o space" "menu-open Options" - - - -# -# Documents menu -# - -#\bind "M-d p" "buffer-previous" -#\bind "M-d space" "menu-open Documents" - - - -# -# Help menu -# - -#\bind "M-h d" "help-documentation" # Not yet implemented! -#\bind "M-h o" "help-copyright" # Not yet implemented! -#\bind "M-h w" "help-warranty" # Not yet implemented! -#\bind "M-h c" "help-credits" # Not yet implemented! -#\bind "M-h v" "help-version" # Not yet implemented! -#\bind "M-h space" "menu-open Help" - # diff --git a/lib/bind/sv_menus.bind b/lib/bind/sv_menus.bind index 07b0c2e41e..d977bab7da 100644 --- a/lib/bind/sv_menus.bind +++ b/lib/bind/sv_menus.bind @@ -19,176 +19,11 @@ # laddas automatiskt av LyX i stället för menus.bind då LANG=sv # Dessa bindningar kan krocka med andra bindningar; betrakta detta som ett # prov. Observera att namnen på menyerna måste stämma med de översatta -# (File/Fil, Edit/Redigera osv.), för "menu-open" +# (File/Fil, Edit/Redigera osv.), för "menu-open" # Wed Dec 9 17:15:45 GMT+0100 1998, Joacim Persson # # -#\bind "F10 f" "menu-open Fil" -#\bind "F10 r" "menu-open Redigera" -#\bind "F10 s" "menu-open Stil" -#\bind "F10 l" "menu-open Lägg in" -#\bind "F10 m" "menu-open Matematik" -#\bind "F10 i" "menu-open Inställningar" -#\bind "F10 d" "menu-open Dokument" -#\bind "F10 h" "menu-open Hjälp" - -# -# Fil -# - -#\bind "M-f n" "buffer-new" -#\bind "M-f m" "buffer-new-template" -#\bind "M-f p" "file-open" -#\bind "M-f g" "buffer-close" -#\bind "M-f s" "buffer-write" -#\bind "M-f o" "buffer-write-as" -#\bind "M-f t" "buffer-reload" -#\bind "M-f v" "buffer-view dvi" -#\bind "M-f i" "buffer-view ps" -#\bind "M-f u" "buffer-update dvi" -#\bind "M-f d" "buffer-update ps" -#\bind "M-f k" "buffer-print" -#\bind "M-f f" "buffer-fax" -#\bind "M-f l" "buffer-export latex" -#\bind "M-f x" "buffer-export linuxdoc" -#\bind "M-f S-T" "buffer-export ascii" -#\bind "M-f h" "buffer-export html" -#\bind "M-f S-A" "buffer-export custom" -#\bind "M-f a" "lyx-quit" -#\bind "M-f space" "menu-open Fil" -#bind "M-f l" "file-last" # Not yet implemented. - - -# -# Edit menu -# - -#\bind "M-r a" "table" -#\bind "M-r k" "cut" -#\bind "M-r f" "error-next" -#\bind "M-r s" "find-replace" -#\bind "M-r k" "line-delete-forward" -#\bind "M-r m" "mark-on" -#\bind "M-r S-M" "mark-off" -#\bind "M-r t" "note-next" -#\bind "M-r o" "copy" -#\bind "M-r i" "paste" -#\bind "M-r g" "redo" -#\bind "M-r r" "spellchecker" -#\bind "M-r e" "buffer-chktex" -#\bind "M-r h" "toc-view" -#\bind "M-r n" "undo" -#\bind "M-r x" "latex-view-log" -#\bind "M-r space" "menu-open Redigera" - - -# -# Layout menu -# - -#\bind "M-s c" "layout-character" -#\bind "M-s p" "layout-paragraph" -#\bind "M-s d" "layout-document" -#\bind "M-s a" "layout-paper" -#\bind "M-s q" "layout-quotes" -#\bind "M-s l" "layout-preamble" -#\bind "M-s e" "font-emph" -#\bind "M-s n" "font-noun" -#\bind "M-s b" "font-bold" -#\bind "M-s t" "ert-insert" -#\bind "M-s v" "depth-increment" -#\bind "M-s space" "menu-open Stil" -#\bind "M-s i" "buffer-itemize-bullets-select" - - -# -# Insert menu -# - -#\bind "M-i g" "graphics-insert" -#\bind "M-i b" "table-insert" -#\bind "M-i c" "buffer-child-insert" -#\bind "M-i f" "footnote-insert" -#\bind "M-i m" "marginpar-insert" - -#\bind "M-i minus" "hyphenation-point-insert" -#\bind "M-i p" "dots-insert" -#\bind "M-i e" "end-of-sentence-period-insert" -#\bind "M-i q" "quote-insert" -#\bind "M-i apostrophe" "quote-insert" -#\bind "M-i S-quotedbl" "quote-insert" -#\bind "M-i s h" "hfill-insert" -#\bind "M-i s minus" "hyphenation-point-insert" -#\bind "M-i s b" "protected-space-insert" -#\bind "M-i s l" "break-line" -#\bind "M-i s p" "dots-insert" -#\bind "M-i s e" "end-of-sentence-period-insert" -#\bind "M-i s q" "quote-insert" - -#\bind "M-i a" "loa-insert" -#\bind "M-i t c" "toc-insert" -#\bind "M-i t f" "lof-insert" -#\bind "M-i t t" "lot-insert" -#\bind "M-i t i" "index-print" -#\bind "M-i t b" "bibtex-insert" -#\bind "M-i t a" "loa-insert" - -#\bind "M-i n" "note-insert" -#\bind "M-i l" "label-insert" -#\bind "M-i r" "reference-insert" -#\bind "M-i i" "citation-insert" -#\bind "M-i d" "index-insert" - -#\bind "M-l space" "menu-open Lägg in" - - - -# -# Math menu -# - -#\bind "M-m space" "menu-open Matematik" - -# -# Options menu -# - -#bind "M-o s" "screen-font-options" # Not yet implemented! -#bind "M-o r" "spellcheck-options" # Not yet implemented! -#bind "M-o t" "keyboard-options" # Not yet implemented! -#bind "M-o l" "latex-options" # Not yet implemented! -#\bind "M-i space" "menu-open Inställningar" - - -# -# Documents menu -# -# These are now defined in cua or emacs bind files so their "standard" -# bindings are available. (eg M-d "word-delete-forward" in emacs) ARRae -#\bind "M-d p" "buffer-previous" -#\bind "M-d space" "menu-open Dokument" - - -# -# Help menu -# - -#bind "M-h i" "help-introduction" # Not yet implemented! -#bind "M-h t" "help-tutorial" # Not yet implemented! -#bind "M-h u" "help-user-guide" # Not yet implemented! -#bind "M-h r" "help-reference-guide" # Not yet implemented! -#bind "M-h h" "help-how-do-i-" # Not yet implemented! -#bind "M-h c" "help-customization" # Not yet implemented! -#bind "M-h s" "help-special-tools" # Not yet implemented! -#bind "M-h k" "help-known-bugs" # Not yet implemented! -#bind "M-h a" "help-latex-config" # Not yet implemented! -#bind "M-h o" "help-copyright" # Not yet implemented! -#bind "M-h e" "help-credits" # Not yet implemented! -#bind "M-h v" "help-version" # Not yet implemented! -#\bind "M-h space" "menu-open Hjälp" - - # # Font size menu # diff --git a/po/POTFILES.in b/po/POTFILES.in index b32f886323..532fdf1208 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -40,6 +40,7 @@ src/frontends/qt2/QBibtexDialog.C src/frontends/qt2/QCharacter.C src/frontends/qt2/QCitation.C src/frontends/qt2/QCitationDialog.C +src/frontends/qt2/QCommandBuffer.C src/frontends/qt2/QDocument.C src/frontends/qt2/QError.C src/frontends/qt2/QERT.C diff --git a/src/ChangeLog b/src/ChangeLog index 55eb43b94a..68cbe3c5bf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2002-07-20 Jean-Marc Lasgouttes + + * buffer.C (getLists): ws cleanup + 2002-07-20 Dekel Tsur * language.C (read): Use iso8859-1 encoding in latex_lang diff --git a/src/buffer.C b/src/buffer.C index 03f5c042ac..26898f514c 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -3772,19 +3772,20 @@ Buffer::Lists const Buffer::getLists() const string const layout("Caption"); while (par) { +#ifdef WITH_WARNINGS #warning bogus type (Lgb) +#endif char const labeltype = par->layout()->labeltype; if (labeltype >= LABEL_COUNTER_CHAPTER && labeltype <= LABEL_COUNTER_CHAPTER + params.tocdepth) { // insert this into the table of contents SingleList & item = l["TOC"]; - int depth = max(0, - labeltype - - textclass.maxcounter()); - item.push_back(TocItem(par, depth, par->asString(this, true))); + int depth = max(0, labeltype - textclass.maxcounter()); + item.push_back(TocItem(par, depth, + par->asString(this, true))); } - // For each paragrph, traverse its insets and look for + // For each paragraph, traverse its insets and look for // FLOAT_CODE if (found) { diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 15c1720270..f97cb60f12 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,10 @@ +2002-07-20 Jean-Marc Lasgouttes + + * Menubar_pimpl.C (add_toc): avoid crash when there is no document + open + + * Menubar_pimpl.[Ch]: turn owner_ into a XFormsView, to avoid casting + 2002-04-28 Herbert Voss * FormGraphics.C: diff --git a/src/frontends/xforms/Menubar_pimpl.C b/src/frontends/xforms/Menubar_pimpl.C index cf4799c6c9..415c7509c7 100644 --- a/src/frontends/xforms/Menubar_pimpl.C +++ b/src/frontends/xforms/Menubar_pimpl.C @@ -87,7 +87,8 @@ extern "C" { Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mb) - : owner_(view), menubackend_(&mb), current_group_(0) + : owner_(static_cast(view)), menubackend_(&mb), + current_group_(0) { for (MenuBackend::const_iterator menu = menubackend_->begin(); menu != menubackend_->end() ; ++menu) { @@ -108,7 +109,7 @@ Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mb) void Menubar::Pimpl::makeMenubar(Menu const & menu) { - FL_FORM * form = static_cast(owner_)->getForm(); + FL_FORM * form = owner_->getForm(); int moffset = 0; // Create menu frame if there is non yet. @@ -331,6 +332,8 @@ void add_toc2(int menu, string const & extra_label, void Menubar::Pimpl::add_toc(int menu, string const & extra_label, vector & smn, Window win) { + if (!owner_->buffer()) + return; Buffer::Lists toc_list = owner_->buffer()->getLists(); Buffer::Lists::const_iterator cit = toc_list.begin(); Buffer::Lists::const_iterator end = toc_list.end(); @@ -381,7 +384,7 @@ void Menubar::Pimpl::add_toc(int menu, string const & extra_label, } -int Menubar::Pimpl::create_submenu(Window win, LyXView * view, +int Menubar::Pimpl::create_submenu(Window win, XFormsView * view, string const & menu_name, vector & smn) { @@ -548,7 +551,7 @@ void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button) // << ", item_=" << iteminfo->item_ // << ", obj_=" << iteminfo->obj_ << ")" <pimpl_->owner_; + XFormsView * view = iteminfo->pimpl_->owner_; MenuItem const * item = iteminfo->item_.get(); if (button == 1) { @@ -569,8 +572,8 @@ void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button) item->submenu(), submenus); if (menu != -1) { // place popup - fl_setpup_position(static_cast(view)->getForm()->x + ob->x, - static_cast(view)->getForm()->y + ob->y + ob->h + 10); + fl_setpup_position(view->getForm()->x + ob->x, + view->getForm()->y + ob->y + ob->h + 10); int choice = fl_dopup(menu); if (button == 1) { diff --git a/src/frontends/xforms/Menubar_pimpl.h b/src/frontends/xforms/Menubar_pimpl.h index 85d895bba9..94b96b43d5 100644 --- a/src/frontends/xforms/Menubar_pimpl.h +++ b/src/frontends/xforms/Menubar_pimpl.h @@ -30,6 +30,7 @@ #include class LyXView; +class XFormsView; /** The LyX GUI independent menubar class The GUI interface is implemented in the corresponding Menubar_pimpl class. @@ -53,7 +54,7 @@ public: void add_references(int menu, string const & extra_label, std::vector & smn, Window win); /// - int create_submenu(Window win, LyXView * view, + int create_submenu(Window win, XFormsView * view, string const & menuname, std::vector & smn); @@ -64,7 +65,7 @@ private: void makeMenubar(Menu const &menu); /// - LyXView * owner_; + XFormsView * owner_; /// MenuBackend const * menubackend_; /// diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index ddf0b89cea..9f59ce1112 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -1,3 +1,7 @@ +2002-07-20 Jean-Marc Lasgouttes + + * GraphicsParams.C: include + 2002-07-19 Jean-Marc Lasgouttes * PreviewLoader.C (startLoading): use LibScriptSearch to find the diff --git a/src/graphics/GraphicsParams.C b/src/graphics/GraphicsParams.C index 230b662812..c8e106efa9 100644 --- a/src/graphics/GraphicsParams.C +++ b/src/graphics/GraphicsParams.C @@ -12,10 +12,13 @@ #pragma implementation #endif +#include + #include "GraphicsParams.h" #include "Lsstream.h" #include "lyxlength.h" +using std::abs; namespace grfx { diff --git a/src/support/ChangeLog b/src/support/ChangeLog index 69d62acebf..efa10968e6 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,8 @@ +2002-07-20 Dekel Tsur + + * lyxstring.C (operator>>): replace code which works only with + _some_ versions of GNU STL with generic one + 2002-07-18 Angus Leeming * FileMonitor.[Ch]: new files. Monitor a file for any change and emit a diff --git a/src/support/lyxstring.C b/src/support/lyxstring.C index c31fd08bde..869451135e 100644 --- a/src/support/lyxstring.C +++ b/src/support/lyxstring.C @@ -1732,64 +1732,37 @@ void swap(lyxstring & str1, lyxstring & str2) #include -#if 0 istream & operator>>(istream & is, lyxstring & s) { +#if 0 + // very bad solution + char * nome = new char[1024]; + is >> nome; + lyxstring tmp(nome); + delete [] nome; + if (!tmp.empty()) s = tmp; +#else // better solution int w = is.width(0); s.clear(); char c = 0; + bool skipspace = true; while (is.get(c)) { - if (isspace(c)) { is.putback(c); break; } - s += c; + if (isspace(c)) { + if (!skipspace) { + is.putback(c); + break; + } + } else { + s += c; + skipspace = false; + } if (--w == 1) break; } if (s.empty()) is.setstate(std::ios::failbit); - return is; -} -#else -istream & operator>>(istream & is, lyxstring & str) -{ - typedef istream istream_type; - typedef int int_type; - typedef std::streambuf streambuf_type; - typedef string string_type; - typedef string::size_type size_type; - size_type extracted = 0; - -#if 0 - istream_type::sentry cerb(is, false); - if (cerb) { -#else - if (is.ipfx0()) { #endif - str.erase(); - std::streamsize w = is.width(); - size_type n; - n = w > 0 ? static_cast(w) : str.max_size(); - - int_type const eof = EOF; - streambuf_type * sb = is.rdbuf(); - int_type c = sb->sgetc(); - - while (extracted < n - && c != eof && !isspace(c)) { - str += c; - ++extracted; - c = sb->snextc(); - } - if (c == eof) - is.setstate(std::ios::eofbit); - is.width(0); - } -#if 1 - is.isfx(); -#endif - if (!extracted) - is.setstate(std::ios::failbit); return is; } -#endif ostream & operator<<(ostream & o, lyxstring const & s) -- 2.39.2