]> git.lyx.org Git - features.git/commitdiff
the qtclean-2 patch with some very small changes
authorLars Gullik Bjønnes <larsbj@gullik.org>
Sun, 20 Oct 2002 01:48:28 +0000 (01:48 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Sun, 20 Oct 2002 01:48:28 +0000 (01:48 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5447 a592a061-630c-0410-9148-cb99ea01b6c8

197 files changed:
src/frontends/ChangeLog
src/frontends/Liason.C
src/frontends/Liason.h
src/frontends/LyXKeySym.h
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlCharacter.C
src/frontends/controllers/ControlDocument.C
src/frontends/controllers/ControlDocument.h
src/frontends/controllers/ControlParagraph.C
src/frontends/controllers/ControlPreamble.C
src/frontends/controllers/ControlSearch.C
src/frontends/controllers/ControlThesaurus.C
src/frontends/qt2/Alert_pimpl.C
src/frontends/qt2/BulletsModule.C
src/frontends/qt2/BulletsModule.h
src/frontends/qt2/ChangeLog
src/frontends/qt2/Dialogs.C
src/frontends/qt2/Dialogs2.C
src/frontends/qt2/Dialogs_impl.h
src/frontends/qt2/FileDialog.C
src/frontends/qt2/FileDialog_private.C
src/frontends/qt2/FileDialog_private.h
src/frontends/qt2/LyXKeySymFactory.C
src/frontends/qt2/LyXScreenFactory.C
src/frontends/qt2/Menubar_pimpl.C
src/frontends/qt2/Menubar_pimpl.h
src/frontends/qt2/QAbout.C
src/frontends/qt2/QAbout.h
src/frontends/qt2/QAboutDialog.C
src/frontends/qt2/QAboutDialog.h
src/frontends/qt2/QBibitem.C
src/frontends/qt2/QBibitem.h
src/frontends/qt2/QBibitemDialog.C
src/frontends/qt2/QBibitemDialog.h
src/frontends/qt2/QBibtex.C
src/frontends/qt2/QBibtex.h
src/frontends/qt2/QBibtexDialog.C
src/frontends/qt2/QBibtexDialog.h
src/frontends/qt2/QBrowseBox.C
src/frontends/qt2/QBrowseBox.h
src/frontends/qt2/QCharacter.C
src/frontends/qt2/QCharacter.h
src/frontends/qt2/QCharacterDialog.C
src/frontends/qt2/QCharacterDialog.h
src/frontends/qt2/QCitation.C
src/frontends/qt2/QCitation.h
src/frontends/qt2/QCitationDialog.C
src/frontends/qt2/QCitationDialog.h
src/frontends/qt2/QCommandBuffer.C
src/frontends/qt2/QCommandBuffer.h
src/frontends/qt2/QCommandEdit.C
src/frontends/qt2/QCommandEdit.h
src/frontends/qt2/QContentPane.C
src/frontends/qt2/QContentPane.h
src/frontends/qt2/QDelimiterDialog.C
src/frontends/qt2/QDelimiterDialog.h
src/frontends/qt2/QDocument.C
src/frontends/qt2/QDocument.h
src/frontends/qt2/QDocumentDialog.C
src/frontends/qt2/QDocumentDialog.h
src/frontends/qt2/QERT.C
src/frontends/qt2/QERT.h
src/frontends/qt2/QERTDialog.C
src/frontends/qt2/QERTDialog.h
src/frontends/qt2/QError.C
src/frontends/qt2/QError.h
src/frontends/qt2/QErrorDialog.C
src/frontends/qt2/QErrorDialog.h
src/frontends/qt2/QExternal.C
src/frontends/qt2/QExternal.h
src/frontends/qt2/QExternalDialog.C
src/frontends/qt2/QExternalDialog.h
src/frontends/qt2/QFloat.C
src/frontends/qt2/QFloatDialog.C
src/frontends/qt2/QFloatDialog.h
src/frontends/qt2/QGraphics.C
src/frontends/qt2/QGraphics.h
src/frontends/qt2/QGraphicsDialog.C
src/frontends/qt2/QGraphicsDialog.h
src/frontends/qt2/QInclude.C
src/frontends/qt2/QInclude.h
src/frontends/qt2/QIncludeDialog.C
src/frontends/qt2/QIncludeDialog.h
src/frontends/qt2/QIndex.C
src/frontends/qt2/QIndex.h
src/frontends/qt2/QIndexDialog.C
src/frontends/qt2/QIndexDialog.h
src/frontends/qt2/QLImage.C
src/frontends/qt2/QLImage.h
src/frontends/qt2/QLPainter.C
src/frontends/qt2/QLPainter.h
src/frontends/qt2/QLPopupMenu.C
src/frontends/qt2/QLPopupMenu.h
src/frontends/qt2/QLog.C
src/frontends/qt2/QLog.h
src/frontends/qt2/QLogDialog.C
src/frontends/qt2/QLogDialog.h
src/frontends/qt2/QLyXKeySym.C
src/frontends/qt2/QLyXKeySym.h
src/frontends/qt2/QMath.C
src/frontends/qt2/QMath.h
src/frontends/qt2/QMathDialog.C
src/frontends/qt2/QMathDialog.h
src/frontends/qt2/QMinipage.C
src/frontends/qt2/QMinipage.h
src/frontends/qt2/QMinipageDialog.C
src/frontends/qt2/QMinipageDialog.h
src/frontends/qt2/QParagraph.C
src/frontends/qt2/QParagraph.h
src/frontends/qt2/QParagraphDialog.C
src/frontends/qt2/QParagraphDialog.h
src/frontends/qt2/QPreamble.C
src/frontends/qt2/QPreamble.h
src/frontends/qt2/QPreambleDialog.C
src/frontends/qt2/QPreambleDialog.h
src/frontends/qt2/QPrint.C
src/frontends/qt2/QPrint.h
src/frontends/qt2/QPrintDialog.C
src/frontends/qt2/QPrintDialog.h
src/frontends/qt2/QRef.C
src/frontends/qt2/QRef.h
src/frontends/qt2/QRefDialog.C
src/frontends/qt2/QRefDialog.h
src/frontends/qt2/QSearch.C
src/frontends/qt2/QSearch.h
src/frontends/qt2/QSearchDialog.C
src/frontends/qt2/QSearchDialog.h
src/frontends/qt2/QSendto.C
src/frontends/qt2/QSendto.h
src/frontends/qt2/QSendtoDialog.h
src/frontends/qt2/QShowFile.C
src/frontends/qt2/QShowFile.h
src/frontends/qt2/QShowFileDialog.C
src/frontends/qt2/QShowFileDialog.h
src/frontends/qt2/QSpellchecker.C
src/frontends/qt2/QSpellchecker.h
src/frontends/qt2/QSpellcheckerDialog.C
src/frontends/qt2/QSpellcheckerDialog.h
src/frontends/qt2/QTabularCreate.C
src/frontends/qt2/QTabularCreate.h
src/frontends/qt2/QTabularCreateDialog.C
src/frontends/qt2/QTabularCreateDialog.h
src/frontends/qt2/QTexinfo.C
src/frontends/qt2/QTexinfo.h
src/frontends/qt2/QTexinfoDialog.C
src/frontends/qt2/QTexinfoDialog.h
src/frontends/qt2/QThesaurus.C
src/frontends/qt2/QThesaurus.h
src/frontends/qt2/QThesaurusDialog.C
src/frontends/qt2/QThesaurusDialog.h
src/frontends/qt2/QToc.C
src/frontends/qt2/QToc.h
src/frontends/qt2/QTocDialog.C
src/frontends/qt2/QTocDialog.h
src/frontends/qt2/QURL.C
src/frontends/qt2/QURL.h
src/frontends/qt2/QURLDialog.C
src/frontends/qt2/QURLDialog.h
src/frontends/qt2/QVCLog.C
src/frontends/qt2/QVCLog.h
src/frontends/qt2/QVCLogDialog.C
src/frontends/qt2/QVCLogDialog.h
src/frontends/qt2/QWorkArea.C
src/frontends/qt2/QWorkArea.h
src/frontends/qt2/QWrap.C
src/frontends/qt2/QWrap.h
src/frontends/qt2/QWrapDialog.C
src/frontends/qt2/QWrapDialog.h
src/frontends/qt2/Qt2BC.C
src/frontends/qt2/Qt2BC.h
src/frontends/qt2/Qt2Base.C
src/frontends/qt2/Qt2Base.h
src/frontends/qt2/QtView.C
src/frontends/qt2/QtView.h
src/frontends/qt2/README
src/frontends/qt2/Timeout_pimpl.h
src/frontends/qt2/Toolbar_pimpl.C
src/frontends/qt2/Toolbar_pimpl.h
src/frontends/qt2/WorkAreaFactory.C
src/frontends/qt2/emptytable.C
src/frontends/qt2/emptytable.h
src/frontends/qt2/iconpalette.C
src/frontends/qt2/iconpalette.h
src/frontends/qt2/io_callback.C
src/frontends/qt2/io_callback.h
src/frontends/qt2/lengthcombo.C
src/frontends/qt2/lengthcombo.h
src/frontends/qt2/lyx_gui.C
src/frontends/qt2/qfont_loader.C
src/frontends/qt2/qfont_loader.h
src/frontends/qt2/qfont_metrics.C
src/frontends/qt2/qlkey.h
src/frontends/qt2/qscreen.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormDocument.C
src/frontends/xforms/XLyXKeySym.C
src/frontends/xforms/XLyXKeySym.h

index 1eea2397141b50f3498f0edaaecc59ec75d95194..b6fce46ccd1ccbd0ff690375610de1cb8a1086bd 100644 (file)
@@ -1,3 +1,11 @@
+2002-10-20  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * LyXKeySym.h: move operator== out of class. Separate
+       implementations for xforms and qt.
+
+       * Liason.[Ch]: get rid of setMinibuffer, where used call message
+       directly through LyXView::message instead.
+
 2002-09-25  Angus Leeming  <leeming@lyx.org>
 
        * Dialogs.C: doxygen fix.
index 1c962dec523d303d6868d2ebc30581d2758c25b4..eeddabae8f8222482909f5231297615d5d1a8bb2 100644 (file)
@@ -87,7 +87,7 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp)
                command += tostr(pp.count_copies);
                command += ' ';
        }
-       
+
        if (pp.reverse_order) {
                command += lyxrc.print_reverse_flag + ' ';
        }
@@ -154,11 +154,4 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp)
        return res == 0;
 }
 
-
-void setMinibuffer(LyXView * lv, string const & msg)
-{
-       lyx::Assert(lv);
-       lv->message(msg);
-}
-
 } // namespace Liason
index 817397bb25dab28c2796fb2b7e5d1e0aa191cf1b..bfab7fc22ef9550021916c08439bb62cddbe4193 100644 (file)
@@ -52,8 +52,6 @@ namespace Liason {
        PrinterParams getPrinterParams(Buffer *);
        /// print the current buffer
        bool printBuffer(Buffer *, PrinterParams const &);
-       /// set the minibuffer
-       void setMinibuffer(LyXView *, string const & msg);
        //@}
 
 } // namespace Liason
index 9841f06b4e73026ca1d9ca2c4ace2f1ae2eda8e3..7c60b169eef5e267d05f5867ec255adc2d78c99f 100644 (file)
@@ -45,14 +45,15 @@ public:
         * This relies on user to use the right encoding.
         */
        virtual char getISOEncoded() const = 0;
-
-       /**
-        * We need to be able to equality compare these for the
-        * sake of the keymap business.
-        */
-       virtual bool operator==(LyXKeySym const & k) const = 0;
 };
 
+
+/**
+ * We need to be able to equality compare these for the
+ * sake of the keymap business.
+ */
+bool operator==(LyXKeySym const & k1, LyXKeySym const & k1);
+
 typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
 
 #endif
index f2255bd00a636659f670d5603f1aee584140a930..dda37955aa211e22a3a5a37c0a96b12593bb854f 100644 (file)
@@ -1,3 +1,13 @@
+2002-10-20  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * ControlCharacter.C (apply): setMinibuffer change
+       * ControlDocument.C (apply): ditto
+       (classApply): ditto
+       * ControlThesaurus.C (replace): ditto
+       * ControlSearch.C (find): ditto
+       (replace): ditto
+       * ControlPreamble.C (apply): ditto
+       * ControlParagraph.C (apply): ditto
 
 2002-10-14  André Pönitz <poenitz@gmx.net>
 
@@ -8,7 +18,7 @@
        * ControlDocument.h:
        * ControlDocument.C:
        * Makefile.am: New document parameters controller
-       
+
 2002-09-24  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * Makefile.am (INCLUDES): loose SIGC_INCLUDES
index 3dca5cb302c49a3b6e6c5641c5921b4a84d499ed..55182ad36b708bc8a8e533c735b9b6dffca85c2f 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Angus Leeming 
+ * \author Angus Leeming
  *
  * Full author contact details are available in file CREDITS
  */
 #include "gettext.h"
 #include "language.h"
 
-#include "frontends/Liason.h"
 #include "frontends/LyXView.h"
 
-using Liason::setMinibuffer;
-
 
 ControlCharacter::ControlCharacter(LyXView & lv, Dialogs & d)
        : ControlDialogBD(lv, d),
@@ -68,7 +65,7 @@ void ControlCharacter::apply()
        toggleAndShow(bufferview(), *(font_.get()), toggleall_);
        lv_.view_state_changed();
        buffer()->markDirty();
-       setMinibuffer(&lv_, _("Character set"));
+       lv_.message(_("Character set"));
 }
 
 
index 8b4c9ae4848adb87cb606379a055d03f6f18e34e..55c05315d1d9d8115c36f816897424396435e812 100644 (file)
@@ -4,7 +4,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Edwin Leuven 
+ * \author Edwin Leuven
  *
  * Full author contact details are available in file CREDITS
  */
 #include "lyxtextclasslist.h"
 #include "CutAndPaste.h"
 
-#include "frontends/Liason.h"
 #include "frontends/LyXView.h"
 #include "frontends/Alert.h"
 
 #include "support/lstrings.h"
 #include "support/filetools.h"
 
-using Liason::setMinibuffer;
-
 
 ControlDocument::ControlDocument(LyXView & lv, Dialogs & d)
        : ControlDialogBD(lv, d), bp_(0)
@@ -58,27 +55,30 @@ BufferParams & ControlDocument::params()
        return *bp_;
 }
 
+
 LyXTextClass ControlDocument::textClass()
 {
        return textclasslist[bp_->textclass];
 }
 
-       
+
 void ControlDocument::apply()
 {
        if (!bufferIsAvailable())
                return;
-   
+
        setLanguage();
-       bool succes = classApply();
-        lv_.view()->redoCurrentBuffer();
-       
+
+       // FIXME: do we need to use return value from classApply() here? (Lgb)
+       classApply();
+       lv_.view()->redoCurrentBuffer();
+
        view().apply();
        buffer()->params = *bp_;
 
        buffer()->markDirty();
-       
-       Liason::setMinibuffer(&lv_, _("Document Settings Applied"));
+
+       lv_.message(_("Document Settings Applied"));
 }
 
 
@@ -86,7 +86,7 @@ void ControlDocument::setParams()
 {
        if (!bp_.get())
                bp_.reset(new BufferParams());
-       
+
        /// Set the buffer parameters
        *bp_ = buffer()->params;
 }
@@ -95,7 +95,7 @@ void ControlDocument::setLanguage()
 {
        Language const * oldL = buffer()->params.language;
        Language const * newL = bp_->language;
-       
+
        if (oldL != newL
            && oldL->RightToLeft() == newL->RightToLeft()
            && !lv_.buffer()->isMultiLingual())
@@ -105,7 +105,7 @@ void ControlDocument::setLanguage()
 
 bool ControlDocument::classApply()
 {
-       BufferParams &params = lv_.buffer()->params;
+       BufferParams & params = lv_.buffer()->params;
        unsigned int const old_class = bp_->textclass;
        // exit if nothing changes
        if (params.textclass == old_class)
@@ -120,10 +120,9 @@ bool ControlDocument::classApply()
                             _("Reverting to original document class."));
                return false;
        }
-       
+
        // successfully loaded
-       Liason::setMinibuffer(&lv_,
-                             _("Converting document to new document class..."));
+       lv_.message(_("Converting document to new document class..."));
        int ret = CutAndPaste::SwitchLayoutsBetweenClasses(
                old_class, params.textclass,
                &*(lv_.buffer()->paragraphs.begin()),
@@ -146,7 +145,7 @@ bool ControlDocument::classApply()
 void ControlDocument::saveAsDefault()
 {
        lv_.buffer()->params.preamble = bp_->preamble;
-       
+
        string const fname = AddName(AddPath(user_lyxdir, "templates/"),
                                     "defaults.lyx");
        Buffer defaults(fname);
@@ -156,7 +155,7 @@ void ControlDocument::saveAsDefault()
        Paragraph * par = new Paragraph;
        par->layout(params().getLyXTextClass().defaultLayout());
        defaults.paragraphs.set(par);
-       
+
        defaults.writeFile(defaults.fileName());
 
 }
index 796a7d644f5289cdbf6f69e18711d3f14de74011..fc36386bb63f2598d2a033b698c759e6e885cc2b 100644 (file)
@@ -32,6 +32,7 @@ class ControlDocument : public ControlDialogBD {
 public:
        ///
        ControlDocument(LyXView &, Dialogs &);
+       ///
        ~ControlDocument();
        /// show latex preamble
        void showPreamble();
@@ -43,9 +44,8 @@ public:
        BufferParams & params();
        ///
        void saveAsDefault();
-        ///
-        bool classApply();
-   
+       ///
+       bool classApply();
 private:
        /// apply settings
        void apply();
@@ -56,5 +56,3 @@ private:
 };
 
 #endif // CONTROLDOCUMENT_H
-
-
index a0d96f6798f2bfaa0d5ac5c3b3694895a07392c6..8b41e4b95a1d3aff5f80a07fb15f943a510a2630 100644 (file)
@@ -4,7 +4,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Edwin Leuven 
+ * \author Edwin Leuven
  *
  * Full author contact details are available in file CREDITS
  */
 #include "lyxtext.h"
 #include "ParagraphParameters.h"
 
-#include "frontends/Liason.h"
+#include "frontends/LyXView.h"
 
 #include "support/LAssert.h"
 
-using Liason::setMinibuffer;
-
 
 ControlParagraph::ControlParagraph(LyXView & lv, Dialogs & d)
        : ControlDialogBD(lv, d), pp_(0), ininset_(false)
@@ -89,7 +87,7 @@ void ControlParagraph::apply()
 
        buffer()->markDirty();
 
-       setMinibuffer(&lv_, _("Paragraph layout set"));
+       lv_.message(_("Paragraph layout set"));
 }
 
 
index 25319b1c83a9ce40dc0787311a77ac8016a09aff..779c9a7f819ab7d2de0b79238d592ed850731874 100644 (file)
@@ -21,7 +21,7 @@
 #include "buffer.h"
 #include "gettext.h"
 
-#include "frontends/Liason.h"
+#include "frontends/LyXView.h"
 
 
 ControlPreamble::ControlPreamble(LyXView & lv, Dialogs & d)
@@ -39,7 +39,7 @@ void ControlPreamble::apply()
 
        buffer()->params.preamble = params();
        buffer()->markDirty();
-       Liason::setMinibuffer(&lv_, _("LaTeX preamble set"));
+       lv_.message(_("LaTeX preamble set"));
 }
 
 
index 218335cded3b8d536f3ee400220260ad7872352b..bfc42f2364c29bd22aaef8945f4541a5592ed034 100644 (file)
 #include "gettext.h"
 #include "lyxfind.h"
 
-#include "frontends/Liason.h"
+#include "frontends/LyXView.h"
 
 #include "support/lstrings.h"
 
-using Liason::setMinibuffer;
-
 
 ControlSearch::ControlSearch(LyXView & lv, Dialogs & d)
        : ControlDialogBD(lv, d)
@@ -39,7 +37,7 @@ void ControlSearch::find(string const & search,
                                            matchword);
 
        if (!found)
-               setMinibuffer(&lv_, _("String not found!"));
+               lv_.message(_("String not found!"));
 }
 
 
@@ -56,14 +54,14 @@ void ControlSearch::replace(string const & search, string const & replace,
                                    matchword, all, once);
 
        if (replace_count == 0) {
-               setMinibuffer(&lv_, _("String not found!"));
+               lv_.message(_("String not found!"));
        } else {
                if (replace_count == 1) {
-                       setMinibuffer(&lv_, _("String has been replaced."));
+                       lv_.message(_("String has been replaced."));
                } else {
                        string str = tostr(replace_count);
                        str += _(" strings have been replaced.");
-                       setMinibuffer(&lv_, str.c_str());
+                       lv_.message(str.c_str());
                }
        }
 }
index 0f9616d1388020e9efc9879fb8e3e77a67a368bf..fce1fd661ac3cd28a4627a7e9b4dd0b1a159bf7d 100644 (file)
 #include "gettext.h"
 #include "lyxfind.h"
 
-#include "frontends/Liason.h"
-
-
-using Liason::setMinibuffer;
+#include "frontends/LyXView.h"
 
 
 ControlThesaurus::ControlThesaurus(LyXView & lv, Dialogs & d)
@@ -50,9 +47,9 @@ void ControlThesaurus::replace(string const & newstr)
        oldstr_ = newstr;
 
        if (replace_count == 0)
-               setMinibuffer(&lv_, _("String not found!"));
+               lv_.message(_("String not found!"));
        else
-               setMinibuffer(&lv_, _("String has been replaced."));
+               lv_.message(_("String has been replaced."));
 }
 
 
index 657b473103ae5d63ad3c60585b10068c647855b3..ea523bfda886341fc29e45f176e4bb8c4f7f22d5 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 using std::pair;
 using std::make_pair;
 
+
 void alert_pimpl(string const & s1, string const & s2, string const & s3)
 {
-       QMessageBox::warning(0, "LyX", (s1 + "\n" + "\n" + s2 + "\n" + s3).c_str());
+       QMessageBox::warning(0, "LyX",
+                            (s1 + "\n" + "\n" + s2 + "\n" + s3).c_str());
 }
 
 
@@ -49,7 +51,8 @@ int askConfirmation_pimpl(string const & s1, string const & s2, string const & s
 }
 
 
-pair<bool, string> const askForText_pimpl(string const & msg, string const & dflt)
+pair<bool, string> const
+askForText_pimpl(string const & msg, string const & dflt)
 {
        string title = _("LyX: ");
        title += msg;
index 55afd125088b4703ec9de25f99e73dfc701efac3..5822e4cf66b66907859b480f7fb2178361786ef1 100644 (file)
 #include "ui/BulletsModuleBase.h"
 #include "QBrowseBox.h"
 
-BulletsModule::BulletsModule( QWidget* parent,  const char* name, WFlags fl )
+
+BulletsModule::BulletsModule(QWidget * parent,  char const * name, WFlags fl)
        : BulletsModuleBase(parent, name, fl)
 {
-   standard = new QBrowseBox(6,6);
-   standard->insertItem(QPixmap("standard.xpm"));
-
-   maths = new QBrowseBox(6,6);
-   maths->insertItem(QPixmap("amssymb.xpm"));
-
-   QPopupMenu * pm = new QPopupMenu();
-   
-   QPopupMenu * pm1 = new QPopupMenu(pm);
-   pm1->insertItem(standard);
-
-   QPopupMenu * pm2 = new QPopupMenu(pm);
-   pm2->insertItem(maths);
-   
-   
-   pm->insertItem("Standard",pm1);
-   pm->insertItem("Maths",pm2);
-   pm->insertItem("Ding 1");
-   pm->insertItem("Ding 2");
-   pm->insertItem("Ding 3");
-   pm->insertItem("Ding 4");
-   
-   setbullet1TB->setPopup(pm); 
-
-   connect( standard, SIGNAL( selected(int,int) ),
-                this , SLOT( checkThis(int,int) ) );
-   
+       standard = new QBrowseBox(6, 6);
+       standard->insertItem(QPixmap("standard.xpm"));
+
+       maths = new QBrowseBox(6, 6);
+       maths->insertItem(QPixmap("amssymb.xpm"));
+
+       QPopupMenu * pm = new QPopupMenu;
+
+       QPopupMenu * pm1 = new QPopupMenu(pm);
+       pm1->insertItem(standard);
+
+       QPopupMenu * pm2 = new QPopupMenu(pm);
+       pm2->insertItem(maths);
+
+       pm->insertItem("Standard", pm1);
+       pm->insertItem("Maths", pm2);
+       pm->insertItem("Ding 1");
+       pm->insertItem("Ding 2");
+       pm->insertItem("Ding 3");
+       pm->insertItem("Ding 4");
+
+       setbullet1TB->setPopup(pm);
+
+       connect(standard, SIGNAL(selected(int, int)),
+               this, SLOT(checkThis(int, int)));
+
 }
 
+
 BulletsModule::~BulletsModule()
 {
-   delete standard;
-   delete maths;
-     
+       delete standard;
+       delete maths;
 }
 
+
 void BulletsModule::setLevel1()
 {
-   qWarning("no setLevel1() yet");
+       qWarning("no setLevel1() yet");
 }
 
+
 void BulletsModule::checkThis(int x, int y)
 {
-   qWarning("Check, x: %d y: %d ",x,y);
+       qWarning("Check, x: %d y: %d ", x, y);
 }
-
index 3938f910f7efedf9f319f9ef3b593685e6791e06..1e42fea016e78fd8630a324728be54a389a4fc1d 100644 (file)
 
 #include "ui/BulletsModuleBase.h"
 #include "LString.h"
+
 class QBrowseBox;
 
-class BulletsModule : public BulletsModuleBase
-{ 
+class BulletsModule : public BulletsModuleBase {
        Q_OBJECT
 public:
-       
-   BulletsModule( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+       BulletsModule(QWidget* parent = 0, const char* name = 0,
+                     WFlags fl = 0);
        ~BulletsModule();
-       
 public slots:
-
    void checkThis(int,int);
    void setLevel1();
-
 private:
        QBrowseBox * standard;
        QBrowseBox * maths;
index e4f94a5331e6fafc35284140ad5f0537af74494c..2a4ea8a5608a81d5f6667275b9dea475181fb434 100644 (file)
@@ -1,3 +1,84 @@
+2002-10-20  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * Toolbar_pimpl.C (setLayout): initialize i to 0, don't
+       reinitialize.
+
+       * README: add a comment about the strange moc behaviour.
+
+       * QWrap.C (apply): local ref to params
+       (update_contents): ditto
+       (numtostr): use erase to clear string
+
+       * QWorkArea.C (setScrollbarParams): use explicit std::max
+
+       * QURL.C (update_contents): local ref to params
+       (apply): ditto
+
+       * QRef.C (update_contents): local ref to params
+       (apply): ditto
+
+       * QPreambleDialog.C (editClicked): no need to explicitly
+       initialize an std::string.
+       (editClicked): read file with smaller overhead.
+
+       * QParagraph.C (apply): local ref to params
+       (update_contents): ditto
+
+       * QMinipage.C (apply): local ref to params
+       (update_contents): ditto
+       (update_contents): handle InsetMinipage::top in switch
+
+       * QMath.C (createMathPanel): use "new Type" not "new Type()"
+
+       * QLyXKeySym.h: adda key_ accessor key().
+
+       * QLyXKeySym.C (operator=): out of class version.
+
+       * QLog.C (update_contents): use a simpler and faster way to fill
+       the log dialog.
+
+       * QLPopupMenu.C (getLabel): use subst directly on mi.label()
+
+       * QLPainter.C (QLPainter): use "new Type" not "new Type()"
+       (lines): put int i inside for scope
+       (fillPolygon): put j insize for scope
+
+       * QInclude.C (update_contents): local ref to params
+       (apply): ditto
+
+       * QGraphics.C (update_contents): initialize item to 0
+       (apply): use erase to clear string
+
+       * QFloat.C (update_contents): local ref to params
+       (apply): ditto
+
+       * QExternal.C (update_contents): local ref to params
+       (helpText): ditto
+       (apply): ditto
+
+       * QERT.C (apply): local reference to params
+
+       * QDocument.C (apply): have a local reference to the params
+       (update_contents): ditto
+
+       * QCommandEdit.C: add missing include config.h
+
+       * QCommandBuffer.C (QCommandBuffer): call method directly on
+       unnamed pointer objects.
+       (complete): use "new Type", not "new Type()"
+       (complete): use explict std::max
+
+       * QCharacter.C (update_contents): use a local reference as
+       controller cache
+       (apply): ditto
+
+       * QBibtex.C (update_contents): use erase to clear a string.
+
+       * QAbout.C (build_dialog): fill the credits view in a bit more
+       elegant way
+
+       * almost all files: clean up formatting and indenting. 
+
 2002-10-19  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * qfont_loader.C (update): move loop vars into for scopes.
index bff0b0265c56c10a2db0f2f899645a2643956d81..566117e504f006c8b22c7061dd0d0c0b759c7ed0 100644 (file)
@@ -5,7 +5,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Allan Rae
- * \author Angus Leeming 
+ * \author Angus Leeming
  *
  * Full author contact details are available in file CREDITS
  */
index 479dae737e232c151dfd4ea35b83c075c425a39c..0c5cb49adcce9d179e229f65f06d55656f1f95af 100644 (file)
@@ -5,7 +5,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Allan Rae
- * \author Angus Leeming 
+ * \author Angus Leeming
  *
  * Full author contact details are available in file CREDITS
  */
@@ -18,6 +18,7 @@
 
 #include "Dialogs_impl.h"
 
+
 void Dialogs::showAboutlyx()
 {
        pimpl_->aboutlyx.controller().show();
@@ -215,11 +216,11 @@ void Dialogs::showSpellchecker()
 }
 
 
-void Dialogs::showTabular(InsetTabular * it)
+void Dialogs::showTabular(InsetTabular *)
 {}
 
 
-void Dialogs::updateTabular(InsetTabular * it)
+void Dialogs::updateTabular(InsetTabular *)
 {}
 
 
index d91b502d6687f16b24a7cf5674872efd6e68d9be..90617f27b4f3e33161bce681d59efb33ff221caa 100644 (file)
@@ -223,20 +223,20 @@ WrapDialog;
 struct Dialogs::Impl {
        Impl(LyXView & lv, Dialogs & d);
 
-        AboutlyxDialog      aboutlyx;
+       AboutlyxDialog      aboutlyx;
        BibitemDialog       bibitem;
-        BibtexDialog        bibtex;
-        CharacterDialog     character;
+       BibtexDialog        bibtex;
+       CharacterDialog     character;
        CitationDialog      citation;
        DocumentDialog      document;
-        ErrorDialog         error;
+       ErrorDialog         error;
        ERTDialog           ert;
-        ExternalDialog      external;
+       ExternalDialog      external;
        FileDialog          file;
-        FloatDialog         floats;
-        GraphicsDialog      graphics;
+       FloatDialog         floats;
+       GraphicsDialog      graphics;
        IncludeDialog       include;
-        IndexDialog         index;
+       IndexDialog         index;
        LogFileDialog       logfile;
        MinipageDialog      minipage;
        ParagraphDialog     paragraph;
index a09eed329fa4af21b756963000b682208a15833e..48c726bc237134f6bcb655d1458221db76dfc15a 100644 (file)
@@ -29,12 +29,15 @@ using std::make_pair;
 using std::pair;
 using std::endl;
 
+
 struct FileDialog::Private {
        Button b1;
        Button b2;
 };
 
-FileDialog::FileDialog(LyXView *lv, string const & t, kb_action s, Button b1, Button b2)
+
+FileDialog::FileDialog(LyXView * lv, string const & t,
+                      kb_action s, Button b1, Button b2)
        : private_(new FileDialog::Private), lv_(lv), title_(t), success_(s)
 {
        private_->b1 = b1;
@@ -48,14 +51,18 @@ FileDialog::~FileDialog()
 }
 
 
-FileDialog::Result const FileDialog::Select(string const & path, string const & mask, string const & suggested)
+FileDialog::Result const FileDialog::Select(string const & path,
+                                           string const & mask,
+                                           string const & suggested)
 {
-       string filter = mask;
+       string filter(mask);
        if (mask.empty())
                filter = _("*|All files");
 
        LyXFileDialog dlg(path, filter, title_, private_->b1, private_->b2);
-       lyxerr[Debug::GUI] << "Select with path \"" << path << "\", mask \"" << filter << "\", suggested \"" << suggested << endl;
+       lyxerr[Debug::GUI] << "Select with path \"" << path
+                          << "\", mask \"" << filter
+                          << "\", suggested \"" << suggested << endl;
 
        dlg.setMode(QFileDialog::AnyFile);
 
index 60d0f054a50e7ea87df3246206469f927c88b1d2..f8e915f3d8001d3d482924b3e62ca1ed0d7cbf67 100644 (file)
 
 
 namespace {
-       /// return the Qt form of the label
-       string const getLabel(string const & str) {
-               string label;
-               string sc(split(str, label, '|'));
-               if (sc.length() < 2)
-                       return label;
-               string::size_type pos = label.find(sc[1]);
-               if (pos == string::npos)
-                       return label;
-               label.insert(pos, "&");
+
+/// return the Qt form of the label
+string const getLabel(string const & str) {
+       string label;
+       string sc(split(str, label, '|'));
+       if (sc.length() < 2)
                return label;
-       }
+       string::size_type pos = label.find(sc[1]);
+       if (pos == string::npos)
+               return label;
+       label.insert(pos, "&");
+       return label;
 }
 
+} // namespace anon
+
 
 LyXFileDialog::LyXFileDialog(string const & p, string const & m,
                             string const & t,
index 5062f226b2c711a2c131c155cb920704e6711f09..1a7878da15439004ba7b56f6c8d32e91f520de6b 100644 (file)
@@ -27,11 +27,10 @@ class LyXFileDialog : public QFileDialog
        Q_OBJECT
 public:
        LyXFileDialog(string const & p, string const & m, string const & t,
-               FileDialog::Button const & b1, FileDialog::Button const & b2);
-
+                     FileDialog::Button const & b1,
+                     FileDialog::Button const & b2);
 public slots:
        void buttonClicked();
-
 private:
        QToolButton * b1_;
        string b1_dir_;
index 8ec2d007ed6c9dcf03a97d14d0fa677bb1b9c449..b5e3f9e513343e00b0d038a7f461bf76fcfb0f77 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
@@ -24,5 +24,5 @@ LyXKeySym * create()
 {
        return new QLyXKeySym();
 }
-}
+
+} // namespace LyXKeySymFactory
index effea4d52ea68988b8bddaeb71b76b937e0d433e..3acfe6ed8c2ff8cd82dae578ed79816c41d7ebfe 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -26,4 +26,4 @@ LyXScreen * create(WorkArea & owner)
        return new QScreen(static_cast<QWorkArea &>(owner));
 }
 
-}
+} // namespace LyXScreenFactory
index 03fec17cf7cc25d9144c612af44551bf67209c6e..b4c70ced499d1a3d04f53da77fe6014124eda778 100644 (file)
@@ -10,8 +10,6 @@
 
 #include <config.h>
 
-#include <algorithm>
-
 #ifdef __GNUG__
 #pragma implementation
 #endif
@@ -34,6 +32,8 @@
 #include <qmenubar.h>
 #include <qcursor.h>
 
+#include <algorithm>
+
 using std::endl;
 using std::vector;
 using std::max;
@@ -41,6 +41,7 @@ using std::min;
 using std::for_each;
 using std::pair;
 
+
 Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mbe)
        : owner_(static_cast<QtView*>(view)), menubackend_(mbe)
 {
index fc249e0d26901e761f38b6ff3072c3ce11d7876c..6937bc0612d1f6cbcecd258a9c044236aa1c3323 100644 (file)
@@ -35,7 +35,7 @@ public:
        void openByName(string const &);
 
        /// update the state of the menuitems - not needed
-       void update() {};
+       void update() {}
 
        /// return the owning view
        QtView * view() { return owner_; }
index b342235839851e72b890a4bcd07c5c6ee0ac1fc1..8c7dfd943d6f689847c449c585f574ace248325e 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Kalle Dalheimer 
+ * \author Kalle Dalheimer
  *
  * Full author contact details are available in file CREDITS
  */
@@ -21,7 +21,7 @@
 #include "LyXView.h"
 #include "ButtonControllerBase.h"
 #include "ControlAboutlyx.h"
+
 #include <qlabel.h>
 #include <qpushbutton.h>
 #include <qtextview.h>
@@ -34,6 +34,7 @@ using std::getline;
 
 typedef Qt2CB<ControlAboutlyx, Qt2DB<QAboutDialog> > base_class;
 
+
 QAbout::QAbout()
        : base_class(_("About LyX"))
 {
@@ -42,7 +43,7 @@ QAbout::QAbout()
 
 void QAbout::build_dialog()
 {
-       dialog_.reset(new QAboutDialog());
+       dialog_.reset(new QAboutDialog);
        connect(dialog_.get()->closePB, SIGNAL(clicked()),
                this, SLOT(slotClose()));
 
@@ -54,32 +55,59 @@ void QAbout::build_dialog()
 
        dialog_->versionLA->setText(controller().getVersion().c_str());
 
-       stringstream in;
+       // The code below should depend on a autoconf test. (Lgb)
+#if 0
+       // There are a lot of buggy stringstream implementations..., but the
+       // code below will work on all of them (I hope). The drawback with
+       // this solutions os the extra copying. (Lgb)
+
+       ostringstream in;
        controller().getCredits(in);
 
        istringstream ss(in.str().c_str());
 
        string s;
-       string out;
+       ostringstream out;
 
        while (getline(ss, s)) {
                if (prefixIs(s, "@b"))
-                       out += "<b>" + s.substr(2) + "</b>";
+                       out << "<b>" << s.substr(2) << "</b>";
+               else if (prefixIs(s, "@i"))
+                       out << "<i>" << s.substr(2) << "</i>";
+               else
+                       out << s;
+               out << "<br>";
+       }
+#else
+       // Good stringstream implementations can handle this. It avoids
+       // some copying, and should thus be faster and use less memory. (Lgb)
+       // I'll make this the default for a short while to see if anyone
+       // see the error...
+       stringstream in;
+       controller().getCredits(in);
+       in.seekg(0);
+       string s;
+       ostringstream out;
+
+       while (getline(in, s)) {
+               if (prefixIs(s, "@b"))
+                       out << "<b>" << s.substr(2) << "</b>";
                else if (prefixIs(s, "@i"))
-                       out += "<i>" + s.substr(2) + "</i>";
+                       out << "<i>" << s.substr(2) << "</i>";
                else
-                       out += s;
-               out += "<br>";
+                       out << s;
+               out << "<br>";
        }
+#endif
 
-       dialog_->creditsTV->setText(out.c_str());
+       dialog_->creditsTV->setText(out.str().c_str());
 
        // try to resize to a good size
        dialog_->copyright->hide();
        dialog_->setMinimumSize(dialog_->copyright->sizeHint());
        dialog_->copyright->show();
        dialog_->setMinimumSize(dialog_->sizeHint());
+
        // Manage the cancel/close button
        bc().setCancel(dialog_->closePB);
        bc().refresh();
index 3ae8d76b63f7711b6d4cb65f9be98443175ce683..622510c755de4d5c2ae14f7364ca364810d10584 100644 (file)
@@ -26,7 +26,6 @@ class QAbout
 {
 public:
        QAbout();
-
 private:
        /// not needed
        virtual void apply() {}
index e1b843c6ac57303bb9af4752aa2a3b7074b546aa..079888ccd1190218d3b17573d74f35807eb262fb 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Kalle Dalheimer 
+ * \author Kalle Dalheimer
  *
  * Full author contact details are available in file CREDITS
  */
@@ -16,7 +16,9 @@
 
 #include "QAboutDialog.h"
 
-QAboutDialog::QAboutDialog(QWidget * parent,  const char * name, bool modal, WFlags fl)
+
+QAboutDialog::QAboutDialog(QWidget * parent, char const * name,
+                          bool modal, WFlags fl)
     : QAboutDialogBase(parent, name, modal, fl)
 {
 }
index d14c568594dd44bf850af178a50a3e3a5390460c..e990af3bd6d84b2cd2f0603915e3d276d458d9fc 100644 (file)
 
 #include "ui/QAboutDialogBase.h"
 
-class QAboutDialog : public QAboutDialogBase
-{
-Q_OBJECT
+class QAboutDialog : public QAboutDialogBase {
+       Q_OBJECT
 public:
-       QAboutDialog(QWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags fl = 0);
+       QAboutDialog(QWidget * parent = 0, const char * name = 0,
+                    bool modal = FALSE, WFlags fl = 0);
        ~QAboutDialog();
 };
 
index 1b6c65caf3edfb3ed900ac1fc81bad48ad69220b..b901c83540531d189ef60f0c7d6064bb09a50100 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 #include "QBibitemDialog.h"
 #include "QBibitem.h"
 #include "Qt2BC.h"
+
 typedef Qt2CB<ControlBibitem, Qt2DB<QBibitemDialog> > base_class;
 
+
 QBibitem::QBibitem()
        : base_class(_("Bibliography Item"))
 {
index e1310d6bcb2f69ada3b75b2058bf1ea192fae44f..a6db3bc11eb2c6ca87579c415905710a603b1788 100644 (file)
 class ControlBibitem;
 class QBibitemDialog;
 
-class QBibitem :
-       public Qt2CB<ControlBibitem, Qt2DB<QBibitemDialog> >
+class QBibitem
+       public Qt2CB<ControlBibitem, Qt2DB<QBibitemDialog> >
 {
+public:
        friend class QBibitemDialog;
 
-public:
        QBibitem();
-
 protected:
        virtual bool isValid();
-
 private:
        /// Apply changes
        virtual void apply();
index 6029549722d76322fdc8229004b08ad9a1645967..92d1cf8b2c0e69b32f116dbcd19bc423f8fa5080 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -21,7 +21,8 @@
 
 #include "QBibitemDialog.h"
 #include "QBibitem.h"
+
+
 QBibitemDialog::QBibitemDialog(QBibitem * form)
        : QBibitemDialogBase(0, 0, false, 0),
        form_(form)
index f64b3bda3f7aad25995ed69be4ec173e47ab3a73..249a88348f83561b8d3354e9f11d1ac963b13832 100644 (file)
 
 class QBibitem;
 
-class QBibitemDialog : public QBibitemDialogBase
-{ Q_OBJECT
-
+class QBibitemDialog : public QBibitemDialogBase {
+       Q_OBJECT
 public:
        QBibitemDialog(QBibitem * form);
-
 protected slots:
        virtual void change_adaptor();
-
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QBibitem * form_;
 };
index d425ca1c89d217e7afdeb2558632ee63a6d6faac..c4294e36cd0fc1458df49fc50c03db1256960b66 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 #include "ControlBibtex.h"
 #include "gettext.h"
 #include "debug.h"
+
 #include "support/filetools.h" // ChangeExtension
 #include "support/lstrings.h" // getVectorFromString
+
 #include <qlineedit.h>
 #include <qcombobox.h>
 #include <qpushbutton.h>
@@ -35,6 +37,7 @@ using std::vector;
 
 typedef Qt2CB<ControlBibtex, Qt2DB<QBibtexDialog> > base_class;
 
+
 QBibtex::QBibtex()
        : base_class(_("BibTeX"))
 {
@@ -82,7 +85,7 @@ void QBibtex::update_contents()
                if (contains(bibstyle,','))
                        bibstyle = split(bibstyle, bibtotoc, ',');
                else
-                       bibstyle = "";
+                       bibstyle.erase();
        } else
                dialog_->bibtocCB->setChecked(false);
 
@@ -91,7 +94,7 @@ void QBibtex::update_contents()
                controller().getBibStyles(),"\n");
        for (vector<string>::const_iterator it = str.begin();
                it != str.end(); ++it) {
-               dialog_->styleCB->insertItem(ChangeExtension(*it,"").c_str());
+               dialog_->styleCB->insertItem(ChangeExtension(*it, "").c_str());
        }
        dialog_->styleCB->insertItem(bibstyle.c_str(),0);
 }
index bea81b16455607ecf1f8809aeef483db2bd44b4a..66c5eaf7211991e2877d773e4e0f1d89924f17bb 100644 (file)
 class ControlBibtex;
 class QBibtexDialog;
 
-class QBibtex :
-       public Qt2CB<ControlBibtex, Qt2DB<QBibtexDialog> >
+class QBibtex
+       public Qt2CB<ControlBibtex, Qt2DB<QBibtexDialog> >
 {
+public:
        friend class QBibtexDialog;
 
-public:
        QBibtex();
-
 protected:
        virtual bool isValid();
-
 private:
        /// Apply changes
        virtual void apply();
index 460e319f135a52392b95bd20cfe551a237416031..38469d6f22b49808cbb0c0904555fbe007d40a01 100644 (file)
@@ -14,7 +14,6 @@
 #pragma implementation
 #endif
 
-#include <vector>
 #include "ControlBibtex.h"
 #include "gettext.h"
 #include "debug.h"
@@ -32,6 +31,9 @@
 #include "QBibtexDialog.h"
 #include "QBibtex.h"
 
+#include <vector>
+
+
 QBibtexDialog::QBibtexDialog(QBibtex * form)
        : QBibtexDialogBase(0, 0, false, 0),
        form_(form)
@@ -90,7 +92,7 @@ void QBibtexDialog::deletePressed()
 }
 
 
-void QBibtexDialog::styleChanged(const QString & sel)
+void QBibtexDialog::styleChanged(QString const & sel)
 {
        styleCB->insertItem(sel,0);
 }
index 1363871ac5eddfeced4c744a0544541f224c1ee9..6e927a4202495ce7e30741943cc530db67222994 100644 (file)
 
 class QBibtex;
 
-class QBibtexDialog : public QBibtexDialogBase
-{
+class QBibtexDialog : public QBibtexDialogBase {
        Q_OBJECT
-
 public:
        QBibtexDialog(QBibtex * form);
-
 protected slots:
        virtual void change_adaptor();
        virtual void browsePressed();
@@ -34,10 +31,8 @@ protected slots:
        virtual void deletePressed();
        virtual void styleChanged(const QString &);
        virtual void databaseChanged();
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QBibtex * form_;
 };
index 86cdd25c73e14914b853a855fb2f9ca17b3d6914..533da0e6da88906457b8bb9ae1202e1a68f79a98 100644 (file)
@@ -2,13 +2,14 @@
  * \file QBrowseBox.C
  *
  * Original file taken from klyx 0.10 sources:
- * $Id: QBrowseBox.C,v 1.5 2002/10/17 13:31:04 leeming Exp $
+ * $Id: QBrowseBox.C,v 1.6 2002/10/20 01:48:27 larsbj Exp $
  *
  * \author Kalle Dalheimer ?
  *
  * Full author contact details are available in file CREDITS
  */
 
+#include <config.h>
 
 #include <qstring.h>
 #include <qpixmap.h>
 #include <qstyle.h>
 #include <qimage.h>
 
-#include <stdio.h>
-#include <math.h>
-
 #include "QBrowseBox.h"
 
+#include <cstdio>
+#include <cmath>
+
 
 QBrowseBox::QBrowseBox(int rows, int cols)
        : QGridView()
@@ -182,19 +183,19 @@ void QBrowseBox::paintCell(QPainter * painter, int row, int col)
        if (activecell_.x() == row && activecell_.y() == col) {
                if (ispixmap)
                        qDrawShadeRect(painter, 0, 0, cellWidth(),
-                                      cellHeight(), colorGroup(), false, 1);
+                                      cellHeight(), colorGroup(), false, 1);
                else
                        qDrawShadePanel(painter, 0, 0, cellWidth(),
-                                       cellHeight(), colorGroup(), false, 1);
+                                       cellHeight(), colorGroup(), false, 1);
        } else {
                qDrawPlainRect(painter, 0, 0, cellWidth(),
-                              cellHeight(), colorGroup().background(), 1);
+                              cellHeight(), colorGroup().background(), 1);
        }
 
        if (!texts_[coordsToIndex(row, col)].isEmpty()) {
                painter->drawText(0, 0, cellWidth(),
-                                 cellHeight(), AlignLeft,
-                                 texts_[coordsToIndex(row, col)]);
+                                 cellHeight(), AlignLeft,
+                                 texts_[coordsToIndex(row, col)]);
        }
        painter->setClipping(false);
 }
@@ -290,4 +291,3 @@ void QBrowseBox::moveDown()
        updateCell(x, activecell_.y());
        updateCell(activecell_.x(), activecell_.y());
 }
-
index 6372874ad9c385ec0c890061d413bc584e28cfd4..83cb745b69199eac820e340114c4535366237f34 100644 (file)
@@ -3,7 +3,7 @@
  * \file QBrowseBox.h
  *
  * Original file taken from klyx 0.10 sources:
- * $Id: QBrowseBox.h,v 1.3 2002/10/17 13:31:04 leeming Exp $
+ * $Id: QBrowseBox.h,v 1.4 2002/10/20 01:48:27 larsbj Exp $
  *
  * \author Kalle Dalheimer ?
  *
@@ -25,52 +25,49 @@ class QPixmap;
 
 class QBrowseBox : public QGridView
 {
-  Q_OBJECT
+       Q_OBJECT
 public:
-  QBrowseBox(int rows, int cols);
-  ~QBrowseBox();
-  
-  void insertItem(QString const & text, int x, int y);
-  void insertItem(char const * text, int x, int y);
-  void insertItem(QPixmap pixmap, int x, int y);
-  void insertItem(QPixmap pixmap);
-  void removeItem(int x, int y);
-  void clear();
-
-  QString text(int x, int y);
-  QPixmap pixmap(int x, int y);
-
-//  int exec(QPoint const & pos);
-//  int exec(int x, int y);
-//  int exec(QWidget * trigger);
-
+       QBrowseBox(int rows, int cols);
+       ~QBrowseBox();
+       
+       void insertItem(QString const & text, int x, int y);
+       void insertItem(char const * text, int x, int y);
+       void insertItem(QPixmap pixmap, int x, int y);
+       void insertItem(QPixmap pixmap);
+       void removeItem(int x, int y);
+       void clear();
+       
+       QString text(int x, int y);
+       QPixmap pixmap(int x, int y);
+       
+       //  int exec(QPoint const & pos);
+       //  int exec(int x, int y);
+       //  int exec(QWidget * trigger);
+       
 signals:
-  void selected(int, int);
-    
+        void selected(int, int);
+       
 protected:
-  virtual void keyPressEvent(QKeyEvent * e);
-  virtual void resizeEvent(QResizeEvent * e);
-  virtual void mouseReleaseEvent(QMouseEvent * e);
-//  virtual void closeEvent(QCloseEvent * e);
-  virtual void mouseMoveEvent(QMouseEvent * e);
-  virtual void paintCell(QPainter *, int x, int y);
-
+       virtual void keyPressEvent(QKeyEvent * e);
+       virtual void resizeEvent(QResizeEvent * e);
+       virtual void mouseReleaseEvent(QMouseEvent * e);
+       //  virtual void closeEvent(QCloseEvent * e);
+       virtual void mouseMoveEvent(QMouseEvent * e);
+       virtual void paintCell(QPainter *, int x, int y);
+       
 private:
        // make sure the automatically generated one is not used
-       QBrowseBox & operator=(QBrowseBox const &);
-
+       QBrowseBox & operator=(QBrowseBox const &);
+       
        void moveLeft();
        void moveRight();
        void moveUp();
        void moveDown();
-    
-  int coordsToIndex(int x, int y);
-
-  QString * texts_;
-  QPixmap* pixmaps_;
-  QPoint activecell_;
-    
+       
+       int coordsToIndex(int x, int y);
+       
+       QString * texts_;
+       QPixmap* pixmaps_;
+       QPoint activecell_;
 };
-
-
 #endif
index 6812350db542ea9d9b5782e9659d2e7610027b1e..b6ebdf7b1d69ba5e6f32f9c96987baa97fc5ef5c 100644 (file)
@@ -34,6 +34,7 @@ using std::vector;
 
 typedef Qt2CB<ControlCharacter, Qt2DB<QCharacterDialog> > base_class;
 
+
 QCharacter::QCharacter()
        : base_class(_("Character"))
 {
@@ -56,6 +57,7 @@ void QCharacter::build_dialog()
                cit != family.end(); ++cit) {
                dialog_->familyCO->insertItem(cit->first.c_str(), -1);
        }
+
        for (vector<SeriesPair>::const_iterator cit = series.begin();
                cit != series.end(); ++cit) {
                dialog_->seriesCO->insertItem(cit->first.c_str(), -1);
@@ -117,27 +119,34 @@ int findPos2nd(vector<std::pair<A,B> > const & vec, B const & val)
 
 void QCharacter::update_contents()
 {
-       dialog_->familyCO->setCurrentItem(findPos2nd(family, controller().getFamily()));
-       dialog_->seriesCO->setCurrentItem(findPos2nd(series, controller().getSeries()));
-       dialog_->shapeCO->setCurrentItem(findPos2nd(shape, controller().getShape()));
-       dialog_->sizeCO->setCurrentItem(findPos2nd(size, controller().getSize()));
-       dialog_->miscCO->setCurrentItem(findPos2nd(bar, controller().getBar()));
-       dialog_->colorCO->setCurrentItem(findPos2nd(color, controller().getColor()));
-       dialog_->langCO->setCurrentItem(findPos2nd(language, controller().getLanguage()));
-
-       dialog_->toggleallCB->setChecked(controller().getToggleAll());
+       ControlCharacter const & ctrl = controller();
+
+       dialog_->familyCO->setCurrentItem(findPos2nd(family,
+                                                    ctrl.getFamily()));
+       dialog_->seriesCO->setCurrentItem(findPos2nd(series,
+                                                    ctrl.getSeries()));
+       dialog_->shapeCO->setCurrentItem(findPos2nd(shape, ctrl.getShape()));
+       dialog_->sizeCO->setCurrentItem(findPos2nd(size, ctrl.getSize()));
+       dialog_->miscCO->setCurrentItem(findPos2nd(bar, ctrl.getBar()));
+       dialog_->colorCO->setCurrentItem(findPos2nd(color, ctrl.getColor()));
+       dialog_->langCO->setCurrentItem(findPos2nd(language,
+                                                  ctrl.getLanguage()));
+
+       dialog_->toggleallCB->setChecked(ctrl.getToggleAll());
 }
 
 
 void QCharacter::apply()
 {
-       controller().setFamily(family[dialog_->familyCO->currentItem()].second);
-       controller().setSeries(series[dialog_->seriesCO->currentItem()].second);
-       controller().setShape(shape[dialog_->shapeCO->currentItem()].second);
-       controller().setSize(size[dialog_->sizeCO->currentItem()].second);
-       controller().setBar(bar[dialog_->miscCO->currentItem()].second);
-       controller().setColor(color[dialog_->colorCO->currentItem()].second);
-       controller().setLanguage(language[dialog_->langCO->currentItem()].second);
-
-       controller().setToggleAll(dialog_->toggleallCB->isChecked());
+       ControlCharacter & ctrl = controller();
+
+       ctrl.setFamily(family[dialog_->familyCO->currentItem()].second);
+       ctrl.setSeries(series[dialog_->seriesCO->currentItem()].second);
+       ctrl.setShape(shape[dialog_->shapeCO->currentItem()].second);
+       ctrl.setSize(size[dialog_->sizeCO->currentItem()].second);
+       ctrl.setBar(bar[dialog_->miscCO->currentItem()].second);
+       ctrl.setColor(color[dialog_->colorCO->currentItem()].second);
+       ctrl.setLanguage(language[dialog_->langCO->currentItem()].second);
+
+       ctrl.setToggleAll(dialog_->toggleallCB->isChecked());
 }
index e760d99bbecc62826fe7a4f8541c0d057a7e226f..4bb83ce8a50ac85bc4e044c76c81d12b6ae7644d 100644 (file)
@@ -22,6 +22,7 @@
 #include "controllers/frnt_lang.h"
 
 #include "LString.h"
+
 #include <vector>
 
 
@@ -29,14 +30,13 @@ class ControlCharacter;
 class QCharacterDialog;
 
 
-class QCharacter :
-       public Qt2CB<ControlCharacter, Qt2DB<QCharacterDialog> >
+class QCharacter
+       public Qt2CB<ControlCharacter, Qt2DB<QCharacterDialog> >
 {
+public:
        friend class QCharacterDialog;
 
-public:
        QCharacter();
-
 private:
        /// Apply changes
        virtual void apply();
index 8afcf1ae7e0a9efb0d197dbe2d6cea8e29b42027..620caa42f0137780d2feead20907e2446b2ec115 100644 (file)
@@ -21,6 +21,7 @@
 #include <qpushbutton.h>
 #include <qgroupbox.h>
 
+
 QCharacterDialog::QCharacterDialog(QCharacter * form)
        : QCharacterDialogBase(0, 0, false, 0),
        form_(form)
index 0827c66a581dadec92e0dafd69dbaf21c1f0e2e8..135715483ec2b765a5ffed416640f8d282ab2492 100644 (file)
 
 class LyXFont;
 
-class QCharacterDialog : public QCharacterDialogBase
-{ Q_OBJECT
-
+class QCharacterDialog : public QCharacterDialogBase {
+       Q_OBJECT
 public:
        QCharacterDialog(QCharacter * form);
-
 protected:
        void closeEvent(QCloseEvent * e);
-
 private:
        QCharacter * form_;
-
 protected slots:
        void change_adaptor();
 };
index e8b9d2048a5d33db67f8d4ddba4a4387ff04a4c6..03fcd326c64c000033028cb9659832d5e3d2c76a 100644 (file)
@@ -3,8 +3,8 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Angus Leeming 
- * \author Kalle Dalheimer 
+ * \author Angus Leeming
+ * \author Kalle Dalheimer
  *
  * Full author contact details are available in file CREDITS
  */
@@ -43,6 +43,7 @@ using std::vector;
 
 typedef Qt2CB<ControlCitation, Qt2DB<QCitationDialog> > base_class;
 
+
 QCitation::QCitation()
        : base_class(_("Citation"))
 {}
@@ -63,7 +64,7 @@ void QCitation::apply()
        controller().params().setCmdName(command);
        controller().params().setContents(getStringFromVector(citekeys));
 
-       string const after  = dialog_->textAfterED->text().latin1();
+       string const after = dialog_->textAfterED->text().latin1();
        controller().params().setOptions(after);
 }
 
@@ -174,7 +175,7 @@ void QCitation::update_contents()
 }
 
 
-void QCitation::updateBrowser(QListBox* browser,
+void QCitation::updateBrowser(QListBox * browser,
                                  vector<string> const & keys) const
 {
        browser->clear();
index 88af469afcaa75f87f9a5f51a4ed3e63b2e32e81..101f92655789e899b6ad61252e1e7d6948396d33 100644 (file)
@@ -24,14 +24,13 @@ class ControlCitation;
 class QCitationDialog;
 
 
-class QCitation : public Qt2CB<ControlCitation, Qt2DB<QCitationDialog> >
+class QCitation
+       : public Qt2CB<ControlCitation, Qt2DB<QCitationDialog> >
 {
-       friend class QCitationDialog;
-
 public:
+       friend class QCitationDialog;
        ///
        QCitation();
-
 private:
        ///
        enum State {
index 74d45f960c56523383f06794369793918f1921b0..282aa21f68900703a976a6e8d1eb14284ea53403 100644 (file)
@@ -36,6 +36,7 @@ using std::vector;
 using std::find;
 using std::max;
 
+
 QCitationDialog::QCitationDialog(QCitation * form)
        : QCitationDialogBase(0, 0, false, 0),
        form_(form)
index c1581ed4cb7a388845b30ee75c83a18961a8a116..707d00463bad264ac3493ed06cda31335f2d32f4 100644 (file)
 
 class QCitation;
 
-class QCitationDialog : public QCitationDialogBase
-{ Q_OBJECT
-
+class QCitationDialog : public QCitationDialogBase {
+       Q_OBJECT
 public:
        QCitationDialog(QCitation * form);
        ~QCitationDialog();
-
 protected slots:
        virtual void slotBibHighlighted(int sel);
        virtual void slotBibSelected(int sel);
@@ -39,10 +37,8 @@ protected slots:
        virtual void slotPreviousClicked();
        virtual void slotNextClicked();
        virtual void changed_adaptor();
-
 private:
        void doFind(biblio::Direction dir);
-
 private:
        QCitation * form_;
 };
index 65bee21cf8a4bcb1e705f4824dd1774883ec4f93..e0b02d4b944aeae889f57e3e756c49a7c9c00e65 100644 (file)
@@ -38,14 +38,13 @@ class QTempListBox : public QListBox {
 public:
        QTempListBox()
                : QListBox(0, 0,
-               WType_Modal | WType_Popup | WDestructiveClose) {
+                          WType_Modal | WType_Popup | WDestructiveClose) {
                setHScrollBarMode(AlwaysOff);
        }
-
 protected:
        void mouseReleaseEvent(QMouseEvent * e) {
                if (e->x() < 0 || e->y() < 0
-                       || e->x() > width() || e->y() > height()) {
+                   || e->x() > width() || e->y() > height()) {
                        hide();
                } else {
                        emit selected(currentText());
@@ -61,7 +60,8 @@ protected:
        }
 };
 
-}
+} // end of anon
+
 
 QCommandBuffer::QCommandBuffer(QtView * view, ControlCommandBuffer & control)
        : QToolBar(view), view_(view), controller_(control)
@@ -70,11 +70,8 @@ QCommandBuffer::QCommandBuffer(QtView * view, ControlCommandBuffer & control)
 
        QPixmap qp(LibFileSearch("images", "unknown", "xpm").c_str());
 
-       QToolButton * upb = new QToolButton(qp, _("Up"), "", this, SLOT(up()), this);
-       upb->show();
-
-       QToolButton * downb = new QToolButton(qp, _("Down"), "", this, SLOT(down()), this);
-       downb->show();
+       (new QToolButton(qp, _("Up"), "", this, SLOT(up()), this))->show();
+       (new QToolButton(qp, _("Down"), "", this, SLOT(down()), this))->show();
 
        edit_ = new QCommandEdit(this);
        edit_->setMinimumSize(edit_->sizeHint());
@@ -132,7 +129,7 @@ void QCommandBuffer::complete()
 
        edit_->setText(new_input.c_str());
 
-       QTempListBox * list = new QTempListBox();
+       QTempListBox * list = new QTempListBox;
 
        // For some reason the scrollview's contents are larger
        // than the number of actual items...
@@ -147,9 +144,9 @@ void QCommandBuffer::complete()
 
        list->resize(list->sizeHint());
        QPoint pos(edit_->mapToGlobal(QPoint(0, 0)));
-       int y = pos.y() - list->height();
-       if (y < 0)
-               y = 0;
+
+       int y = std::max(0, pos.y() - list->height());
+
        list->move(pos.x(), y);
 
        connect(list, SIGNAL(selected(const QString &)),
@@ -160,7 +157,7 @@ void QCommandBuffer::complete()
 }
 
 
-void QCommandBuffer::complete_selected(const QString & str)
+void QCommandBuffer::complete_selected(QString const & str)
 {
        edit_->setText(str + " ");
        QWidget const * widget = static_cast<QWidget const *>(sender());
@@ -170,7 +167,7 @@ void QCommandBuffer::complete_selected(const QString & str)
 
 void QCommandBuffer::up()
 {
-       string const input = edit_->text().latin1();
+       string const input(edit_->text().latin1());
        string const h(controller_.historyUp());
 
        if (h.empty()) {
@@ -183,7 +180,7 @@ void QCommandBuffer::up()
 
 void QCommandBuffer::down()
 {
-       string const input = edit_->text().latin1();
+       string const input(edit_->text().latin1());
        string const h(controller_.historyDown());
 
        if (h.empty()) {
index c59c0dfcd543ae9e0d30b681da21a5b4be67f4f3..313242e6660c4ed09d10ea9490a20c991b5a4041 100644 (file)
@@ -26,12 +26,10 @@ class ControlCommandBuffer;
 class QCommandBuffer : public QToolBar {
        Q_OBJECT
 public:
-
        QCommandBuffer(QtView * view, ControlCommandBuffer & control);
 
        /// focus the edit widget
        void focus_command();
-
 public slots:
        /// cancel command compose
        void cancel();
@@ -40,12 +38,11 @@ public slots:
        /// tab-complete
        void complete();
        /// select-complete
-       void complete_selected(const QString & str);
+       void complete_selected(QString const & str);
        /// up
        void up();
        /// down
        void down();
-
 private:
        /// owning view
        QtView * view_;
index 1b4bbd4805ad95e38a76e55278263d94a48e45a2..cc9836f61795ed6b7226cd202ba6ec6ce64c964f 100644 (file)
@@ -3,44 +3,47 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 
+#include <config.h>
+
 #include "QCommandEdit.h"
+
+
 QCommandEdit::QCommandEdit(QWidget * parent)
        : QLineEdit(parent)
-{ 
-       setFocusPolicy(QWidget::ClickFocus); 
+{
+       setFocusPolicy(QWidget::ClickFocus);
 }
 
 
 void QCommandEdit::keyPressEvent(QKeyEvent * e)
 {
        switch (e->key()) {
-               case Key_Escape:
-                       emit escapePressed();
-                       break;
-               case Key_Up:
-                       emit upPressed();
-                       break;
+       case Key_Escape:
+               emit escapePressed();
+               break;
 
-               case Key_Down:
-                       emit downPressed();
+       case Key_Up:
+               emit upPressed();
                        break;
 
-               case Key_Right:
-                       if (cursorPosition() == text().length())
-                               emit rightPressed();
-                       else
-                               QLineEdit::keyPressEvent(e);
-                       break;
+       case Key_Down:
+               emit downPressed();
+               break;
 
-               default:
+       case Key_Right:
+               if (cursorPosition() == text().length())
+                       emit rightPressed();
+               else
                        QLineEdit::keyPressEvent(e);
-                       break;
+               break;
+
+       default:
+               QLineEdit::keyPressEvent(e);
+               break;
        }
 }
index 7b82677596b1801ef367281b76e2951a0309fab2..da8b34d47fc834b36416993082eae46b728dbfba 100644 (file)
@@ -17,9 +17,7 @@
 class QCommandEdit : public QLineEdit {
        Q_OBJECT
 public:
-
        QCommandEdit(QWidget * parent);
-
 signals:
        /// cancel
        void escapePressed();
@@ -32,7 +30,6 @@ signals:
 
        /// complete
        void rightPressed();
-
 protected:
        virtual void keyPressEvent(QKeyEvent * e);
 };
index 6eb624e2027cf663a0cbcf89b68532ef1328051b..ccf92d74c2ca04185b6132d8345461551ff754c9 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 #include <qpainter.h>
 #include <qtimer.h>
 #include <qapplication.h>
+
 using std::endl;
 
 namespace {
+
 /// return the LyX key state from Qt's
 key_modifier::state q_key_state(Qt::ButtonState state)
 {
@@ -42,6 +42,7 @@ key_modifier::state q_key_state(Qt::ButtonState state)
        return k;
 }
 
+
 /// return the LyX mouse button state from Qt's
 mouse_button::state q_button_state(Qt::ButtonState button)
 {
@@ -61,8 +62,8 @@ mouse_button::state q_button_state(Qt::ButtonState button)
        }
        return b;
 }
+
+
 /// return the LyX mouse button state from Qt's
 mouse_button::state q_motion_state(Qt::ButtonState state)
 {
@@ -77,28 +78,28 @@ mouse_button::state q_motion_state(Qt::ButtonState state)
 }
 
 } // namespace anon
+
 
 QContentPane::QContentPane(QWorkArea * parent)
-       : QWidget(parent, "content_pane", WRepaintNoErase), 
+       : QWidget(parent, "content_pane", WRepaintNoErase),
        wa_(parent)
 {
        setFocusPolicy(QWidget::WheelFocus);
        setFocus();
 
        // stupid moc strikes again
-       connect(wa_->scrollbar_, SIGNAL(valueChanged(int)), 
+       connect(wa_->scrollbar_, SIGNAL(valueChanged(int)),
                this, SLOT(scrollBarChanged(int)));
+
 }
 
 
 void QContentPane::scrollBarChanged(int val)
 {
-       wa_->scrollDocView(val); 
+       wa_->scrollDocView(val);
 }
+
+
 void QContentPane::mousePressEvent(QMouseEvent * e)
 {
        if (dc_event_.active && dc_event_ == *e) {
@@ -109,21 +110,21 @@ void QContentPane::mousePressEvent(QMouseEvent * e)
                wa_->dispatch(cmd);
                return;
        }
-       FuncRequest cmd
-               (LFUN_MOUSE_PRESS, e->x(), e->y(), q_button_state(e->button()));
+
+       FuncRequest cmd(LFUN_MOUSE_PRESS, e->x(), e->y(),
+                       q_button_state(e->button()));
        wa_->dispatch(cmd);
 }
 
 
 void QContentPane::mouseReleaseEvent(QMouseEvent * e)
 {
-       FuncRequest cmd
-               (LFUN_MOUSE_RELEASE, e->x(), e->y(), q_button_state(e->button()));
+       FuncRequest cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(),
+                       q_button_state(e->button()));
        wa_->dispatch(cmd);
 }
 
+
 void QContentPane::mouseMoveEvent(QMouseEvent * e)
 {
        FuncRequest cmd
@@ -142,14 +143,14 @@ void QContentPane::keyPressEvent(QKeyEvent * e)
        wa_->workAreaKeyPress(LyXKeySymPtr(sym), q_key_state(e->state()));
 }
 
+
 void QContentPane::doubleClickTimeout()
 {
        if (!dc_event_.active)
                return;
 
        dc_event_.active = false;
+
        FuncRequest cmd(LFUN_MOUSE_DOUBLE,
                dc_event_.x, dc_event_.y,
                q_button_state(dc_event_.state));
@@ -165,8 +166,8 @@ void QContentPane::mouseDoubleClickEvent(QMouseEvent * e)
        QTimer::singleShot(int(QApplication::doubleClickInterval() / 1.5),
                this, SLOT(doubleClickTimeout()));
 }
+
+
 void QContentPane::resizeEvent(QResizeEvent *)
 {
        if (!pixmap_.get()) {
@@ -177,7 +178,7 @@ void QContentPane::resizeEvent(QResizeEvent *)
        wa_->workAreaResize();
 }
 
+
 void QContentPane::paintEvent(QPaintEvent * e)
 {
        if (!pixmap_.get()) {
@@ -187,11 +188,11 @@ void QContentPane::paintEvent(QPaintEvent * e)
        }
 
        QRect r(e->rect());
-       lyxerr[Debug::GUI] << "repainting " << r.x() 
-               << "," << r.y() << " " << r.width() 
+
+       lyxerr[Debug::GUI] << "repainting " << r.x()
+               << "," << r.y() << " " << r.width()
                << "," << r.height() << endl;
        QPainter q(this);
        q.drawPixmap(QPoint(r.x(), r.y()),
-               *pixmap_.get(), r); 
+               *pixmap_.get(), r);
 }
index d8a7e6c4a39bcc01d565f4a2b71e8fcd7756168d..c0f9278b54326c9cff1a43f5233565bef3ca1e17 100644 (file)
@@ -19,6 +19,7 @@
 #include <qwidget.h>
 #include <qevent.h>
 #include <qpixmap.h>
+
 #include <boost/scoped_ptr.hpp>
 
 class QWorkArea;
@@ -43,18 +44,17 @@ struct double_click {
                state(e->button()), active(true) {}
 };
 
+
 /**
  * Widget for actually drawing the document on
  */
 class QContentPane : public QWidget {
        Q_OBJECT
-
 public:
        QContentPane(QWorkArea * parent);
 
        /// return the backing pixmap
        QPixmap * pixmap() const { return pixmap_.get(); }
-
 protected:
        /// repaint part of the widget
        void paintEvent(QPaintEvent * e);
@@ -72,12 +72,10 @@ protected:
 
        /// key press
        void keyPressEvent(QKeyEvent * e);
-
 public slots:
        void doubleClickTimeout();
 
        void scrollBarChanged(int);
-
 private:
        /// owning widget
        QWorkArea * wa_;
index 4be8063d0c0f666df2e59264b2942fa68ddd6169..f4f84666ca649146583c07f41f401443b95b63ab 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 #include "support/filetools.h"
 #include "gettext.h"
 #include "debug.h"
+
 #include "QMath.h"
 #include "QDelimiterDialog.h"
 
 #include "iconpalette.h"
+
 #include <qlabel.h>
 #include <qpixmap.h>
 #include <qpushbutton.h>
 #include <qcheckbox.h>
+
 namespace {
-       char const * delim[] = {
-               "(", ")", "{", "}", "[", "]",
-               "lceil", "rceil", "lfloor", "rfloor", "langle", "rangle",
-               "uparrow", "Uparrow", "downarrow", "Downarrow", 
-               "|", "Vert", "slash", "backslash", ""
-       };
-
-       string do_match(string str) {
-               if (str == "(") return ")";
-               if (str == ")") return "(";
-               if (str == "[") return "]";
-               if (str == "]") return "[";
-               if (str == "{") return "}";
-               if (str == "}") return "{";
-               if (str == "l") return "r";
-               if (str == "rceil") return "lceil";
-               if (str == "lceil") return "rceil";
-               if (str == "rfloor") return "lfloor";
-               if (str == "lfloor") return "rfloor";
-               if (str == "rangle") return "langle";
-               if (str == "langle") return "rangle";
-               if (str == "backslash") return "slash";
-               if (str == "slash") return "backslash";
-               return str;
-       }
+
+char const * delim[] = {
+       "(", ")", "{", "}", "[", "]",
+       "lceil", "rceil", "lfloor", "rfloor", "langle", "rangle",
+       "uparrow", "Uparrow", "downarrow", "Downarrow",
+       "|", "Vert", "slash", "backslash", ""
+};
+
+
+string do_match(string const & str)
+{
+       if (str == "(") return ")";
+       if (str == ")") return "(";
+       if (str == "[") return "]";
+       if (str == "]") return "[";
+       if (str == "{") return "}";
+       if (str == "}") return "{";
+       if (str == "l") return "r";
+       if (str == "rceil") return "lceil";
+       if (str == "lceil") return "rceil";
+       if (str == "rfloor") return "lfloor";
+       if (str == "lfloor") return "rfloor";
+       if (str == "rangle") return "langle";
+       if (str == "langle") return "rangle";
+       if (str == "backslash") return "slash";
+       if (str == "slash") return "backslash";
+       return str;
+}
+
+
+string fix_name(string const & str)
+{
+       if (str == "slash")
+               return "/";
+       if (str == "backslash")
+               return "\\";
+       if (str == "empty")
+               return ".";
+       return str;
 }
 
+} // namespace anon
+
+
 QDelimiterDialog::QDelimiterDialog(QMath * form)
        : QDelimiterDialogBase(0, 0, false, 0),
        form_(form)
 {
        setCaption(_("LyX: Delimiters"));
+
        for (int i = 0; *delim[i]; ++i) {
                string xpm_name = LibFileSearch("images/math/", delim[i], "xpm");
                leftIP->add(QPixmap(xpm_name.c_str()), delim[i], delim[i]);
@@ -80,25 +96,13 @@ QDelimiterDialog::QDelimiterDialog(QMath * form)
        rdelim_clicked(")");
 }
 
-namespace {
-       string fix_name(string const & str) {
-               if (str == "slash")
-                       return "/";
-               if (str == "backslash")
-                       return "\\";
-               if (str == "empty")
-                       return ".";
-               return str;
-       }
-}
+
 void QDelimiterDialog::insertClicked()
 {
        form_->insertDelim(fix_name(left_) + " " + fix_name(right_));
 }
 
+
 void QDelimiterDialog::set_label(QLabel * label, string const & str)
 {
        string xpm_name = LibFileSearch("images/math/", str, "xpm");
@@ -108,11 +112,11 @@ void QDelimiterDialog::set_label(QLabel * label, string const & str)
        label->update();
 }
 
+
 void QDelimiterDialog::ldelim_clicked(string str)
 {
        left_ = str;
+
        set_label(leftPI, left_);
        if (matchCB->isChecked()) {
                right_ = do_match(left_);
@@ -124,7 +128,7 @@ void QDelimiterDialog::ldelim_clicked(string str)
 void QDelimiterDialog::rdelim_clicked(string str)
 {
        right_ = str;
+
        set_label(rightPI, right_);
        if (matchCB->isChecked()) {
                left_ = do_match(right_);
index 7c265259c2b42a1193a7b4c9fdd57dc2f9ddacef..b6213b0ea5c49d9d9c284f6be82001f97baf6cd7 100644 (file)
@@ -23,21 +23,16 @@ class QMath;
 class IconPalette;
 class QLabel;
 
-class QDelimiterDialog : public QDelimiterDialogBase
-{
+class QDelimiterDialog : public QDelimiterDialogBase {
        Q_OBJECT
-
 public:
        QDelimiterDialog(QMath * form);
-
 public slots:
        void ldelim_clicked(string str);
        void rdelim_clicked(string str);
        void insertClicked();
-
 protected:
        //needed ? virtual void closeEvent(QCloseEvent * e);
-
 private:
        void set_label(QLabel * label, string const & str);
 
index ab70d9e47adf8f2b430ae901d15422ce47e1a576..b1b7b2ff1d0ceec15a47f1c1a2a43b4edb1aa1fb 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "gettext.h"
 
-
 #include "ControlDocument.h"
 #include "QDocument.h"
 #include "QDocumentDialog.h"
@@ -49,6 +48,7 @@ using std::vector;
 
 typedef Qt2CB<ControlDocument, Qt2DB<QDocumentDialog> > base_class;
 
+
 QDocument::QDocument()
        : base_class(_("Document Settings"))
 {
@@ -56,16 +56,17 @@ QDocument::QDocument()
        lang_ = getSecond(langs);
 }
 
+
 void QDocument::build_dialog()
 {
        dialog_.reset(new QDocumentDialog(this));
 
-       /* biblio */
+       // biblio
        dialog_->biblioModule->citeStyleCO->insertItem(_("Author-year"));
        dialog_->biblioModule->citeStyleCO->insertItem(_("Numerical"));
        dialog_->biblioModule->citeStyleCO->setCurrentItem(0);
 
-       /* language & quotes */
+       // language & quotes
        vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
        vector<frnt::LanguagePair>::const_iterator lit  = langs.begin();
        vector<frnt::LanguagePair>::const_iterator lend = langs.end();
@@ -81,7 +82,7 @@ void QDocument::build_dialog()
        dialog_->langModule->quoteStyleCO->insertItem(_("«text»"));
        dialog_->langModule->quoteStyleCO->insertItem(_("»text«"));
 
-       /* packages */
+       // packages
        char const * items[] = {"default","auto","latin1","latin2",
                             "latin3","latin4","latin5","latin9",
                             "koi8-r","koi8-u","cp866","cp1251",
@@ -89,27 +90,27 @@ void QDocument::build_dialog()
        dialog_->packagesModule->encodingCO->insertStrList(items);
 
        dialog_->packagesModule->lspacingCO->insertItem(
-               _("Single"),Spacing::Single);
+               _("Single"), Spacing::Single);
        dialog_->packagesModule->lspacingCO->insertItem(
-               _("OneHalf"),Spacing::Onehalf);
+               _("OneHalf"), Spacing::Onehalf);
        dialog_->packagesModule->lspacingCO->insertItem(
-               _("Double"),Spacing::Double);
+               _("Double"), Spacing::Double);
        dialog_->packagesModule->lspacingCO->insertItem(
-               _("Custom"),Spacing::Other);
+               _("Custom"), Spacing::Other);
 
        for (int n = 0; tex_graphics[n][0]; ++n) {
                QString enc = tex_graphics[n];
                dialog_->packagesModule->psdriverCO->insertItem(enc);
        }
 
-       /* paper */
+       // paper
        QStringList papersize_;
        papersize_ << _("Default") << _("Custom") << _("US letter") << _("US legal")
                   << _("US executive") << _("A3") << _("A4") << _("A5")
                   << _("B3") << _("B4") << _("B5");
        dialog_->paperModule->papersizeCO->insertStringList(papersize_);
 
-       /* layout */
+       // layout
        for (LyXTextClassList::const_iterator cit = textclasslist.begin();
             cit != textclasslist.end(); ++cit) {
                dialog_->layoutModule->classCO->insertItem(cit->description().c_str());
@@ -136,12 +137,11 @@ void QDocument::build_dialog()
        dialog_->layoutModule->pagestyleCO->insertItem(_("headings"));
        dialog_->layoutModule->pagestyleCO->insertItem(_("fancy"));
 
-       /* margins */
+       // margins
        dialog_->setMargins(0);
 
        string const bmtablefile = LibFileSearch("images", "standard", "xpm");
        QString s = bmtablefile.c_str();
-       qWarning("%d", s);
 
        // Manage the restore, ok, apply, restore and cancel/close buttons
        bc().setOK(dialog_->okPB);
@@ -153,21 +153,23 @@ void QDocument::build_dialog()
 
 void QDocument::apply()
 {
-       /* preamble */
-       controller().params().preamble =
+       BufferParams & params = controller().params();
+
+       // preamble
+       params.preamble =
                dialog_->preambleModule->preambleMLE->text().latin1();
 
-       /* biblio */
-       controller().params().use_natbib =
+       // biblio
+       params.use_natbib =
                dialog_->biblioModule->natbibCB->isChecked();
-       controller().params().use_numerical_citations  =
+       params.use_numerical_citations  =
                dialog_->biblioModule->citeStyleCO->currentItem();
 
-       /* language & quotes */
+       // language & quotes
        if (dialog_->langModule->singleQuoteRB->isChecked())
-               controller().params().quotes_times = InsetQuotes::SingleQ;
+               params.quotes_times = InsetQuotes::SingleQ;
        else
-               controller().params().quotes_times = InsetQuotes::DoubleQ;
+               params.quotes_times = InsetQuotes::DoubleQ;
 
 
        InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
@@ -191,74 +193,74 @@ void QDocument::apply()
                lga = InsetQuotes::DanishQ;
                break;
        }
-       controller().params().quotes_language = lga;
+       params.quotes_language = lga;
 
        int const pos = dialog_->langModule->languageCO->currentItem();
-       controller().params().language = languages.getLanguage(lang_[pos]);
+       params.language = languages.getLanguage(lang_[pos]);
 
-       /* numbering */
-       controller().params().secnumdepth =
+       // numbering
+       params.secnumdepth =
                dialog_->numberingModule->tocDepthSB->value();
-       controller().params().tocdepth =
+       params.tocdepth =
                dialog_->numberingModule->sectionnrDepthSB->value();
 
-       /* packages */
+       // packages
        switch (dialog_->packagesModule->lspacingCO->currentItem()) {
        case 0:
-               controller().params().spacing.set(Spacing::Single);
+               params.spacing.set(Spacing::Single);
                break;
        case 1:
-               controller().params().spacing.set(Spacing::Onehalf);
+               params.spacing.set(Spacing::Onehalf);
                break;
        case 2:
-               controller().params().spacing.set(Spacing::Double);
+               params.spacing.set(Spacing::Double);
                break;
        case 3:
-               controller().params().spacing.set(Spacing::Other,
+               params.spacing.set(Spacing::Other,
                                   dialog_->packagesModule->
                                   lspacingLE->text().toFloat()
                                   );
                break;
        }
 
-       controller().params().graphicsDriver =
+       params.graphicsDriver =
                dialog_->packagesModule->psdriverCO->currentText().latin1();
 
-       controller().params().use_amsmath =
+       params.use_amsmath =
                dialog_->packagesModule->amsCB->isChecked();
 
-       controller().params().inputenc =
+       params.inputenc =
                dialog_->packagesModule->encodingCO->currentText().latin1();
 
-       /* layout */
-       controller().params().textclass =
+       // layout
+       params.textclass =
                dialog_->layoutModule->classCO->currentItem();
 
        //bool succes = controller().classApply();
 
-       controller().params().fonts =
+       params.fonts =
                dialog_->layoutModule->fontsCO->currentText().latin1();
 
-       controller().params().fontsize =
+       params.fontsize =
                dialog_->layoutModule->fontsizeCO->currentText().latin1();
 
-       controller().params().pagestyle =
+       params.pagestyle =
                dialog_->layoutModule->pagestyleCO->currentText().latin1();
 
        if (dialog_->layoutModule->indentRB->isChecked())
-               controller().params().paragraph_separation = BufferParams::PARSEP_INDENT;
+               params.paragraph_separation = BufferParams::PARSEP_INDENT;
        else
-               controller().params().paragraph_separation = BufferParams::PARSEP_SKIP;
+               params.paragraph_separation = BufferParams::PARSEP_SKIP;
 
        switch (dialog_->layoutModule->skipCO->currentItem()) {
        case 0:
-               controller().params().setDefSkip(VSpace(VSpace::SMALLSKIP));
+               params.setDefSkip(VSpace(VSpace::SMALLSKIP));
                break;
        case 1:
-               controller().params().setDefSkip(VSpace(VSpace::MEDSKIP));
+               params.setDefSkip(VSpace(VSpace::MEDSKIP));
                break;
        case 2:
-               controller().params().setDefSkip(VSpace(VSpace::BIGSKIP));
+               params.setDefSkip(VSpace(VSpace::BIGSKIP));
                break;
        case 3:
        {
@@ -268,102 +270,103 @@ void QDocument::apply()
                double length =
                        dialog_->layoutModule->skipLE->text().toDouble();
                VSpace vs = VSpace(LyXGlueLength(LyXLength(length,unit)));
-               controller().params().setDefSkip(vs);
+               params.setDefSkip(vs);
                break;
        }
        default:
                // DocumentDefskipCB assures that this never happens
-               controller().params().setDefSkip(VSpace(VSpace::MEDSKIP));
+               params.setDefSkip(VSpace(VSpace::MEDSKIP));
                break;
        }
 
-       controller().params().options =
+       params.options =
                dialog_->layoutModule->optionsLE->text().latin1();
 
-       controller().params().float_placement =
+       params.float_placement =
                dialog_->layoutModule->floatPlacementLE->text().latin1();
 
-       /* paper */
-       controller().params().papersize2 =
+       // paper
+       params.papersize2 =
                dialog_->paperModule->papersizeCO->currentItem();
 
-       controller().params().paperwidth =
+       params.paperwidth =
                LyXLength(dialog_->paperModule->paperwidthLE->text().toDouble(),
                          dialog_->paperModule->paperwidthUnitCO->currentLengthItem()
                        ).asString();
 
-       controller().params().paperheight =
+       params.paperheight =
                LyXLength(dialog_->paperModule->paperheightLE->text().toDouble(),
                          dialog_->paperModule->paperheightUnitCO->currentLengthItem()
                        ).asString();
 
        if (dialog_->paperModule->twoColumnCB->isChecked())
-               controller().params().columns = 2;
+               params.columns = 2;
        else
-               controller().params().columns = 1;
+               params.columns = 1;
 
        if (dialog_->paperModule->facingPagesCB->isChecked())
-               controller().params().sides = LyXTextClass::TwoSides;
+               params.sides = LyXTextClass::TwoSides;
        else
-               controller().params().sides = LyXTextClass::OneSide;
+               params.sides = LyXTextClass::OneSide;
 
        if (dialog_->paperModule->landscapeRB->isChecked())
-               controller().params().orientation = BufferParams::ORIENTATION_LANDSCAPE;
+               params.orientation = BufferParams::ORIENTATION_LANDSCAPE;
        else
-               controller().params().orientation = BufferParams::ORIENTATION_PORTRAIT;
+               params.orientation = BufferParams::ORIENTATION_PORTRAIT;
 
-       /* margins */
-       controller().params().use_geometry =
-               dialog_->marginsModule->marginCO->currentItem()==1;
+       // margins
+       params.use_geometry =
+               (dialog_->marginsModule->marginCO->currentItem() == 1);
 
        int margin = dialog_->marginsModule->marginCO->currentItem();
-       if (margin>0) {
+       if (margin > 0) {
                margin = margin - 1;
        }
-       controller().params().paperpackage = char(margin);
+       params.paperpackage = char(margin);
 
-       controller().params().leftmargin =
+       params.leftmargin =
                LyXLength(dialog_->marginsModule->innerLE->text().toDouble(),
                          dialog_->marginsModule->innerUnit->currentLengthItem()
                          ).asString();
 
-       controller().params().topmargin =
+       params.topmargin =
                LyXLength(dialog_->marginsModule->topLE->text().toDouble(),
                          dialog_->marginsModule->topUnit->currentLengthItem()
                          ).asString();
 
 
-       controller().params().rightmargin =
+       params.rightmargin =
                LyXLength(dialog_->marginsModule->outerLE->text().toDouble(),
                          dialog_->marginsModule->outerUnit->currentLengthItem()
                          ).asString();
 
 
-       controller().params().bottommargin =
+       params.bottommargin =
                LyXLength(dialog_->marginsModule->bottomLE->text().toDouble(),
                          dialog_->marginsModule->bottomUnit->currentLengthItem()
                          ).asString();
 
 
-       controller().params().headheight =
+       params.headheight =
                LyXLength(dialog_->marginsModule->headheightLE->text().toDouble(),
                          dialog_->marginsModule->headheightUnit->currentLengthItem()
                          ).asString();
 
 
-       controller().params().headsep =
+       params.headsep =
                LyXLength(dialog_->marginsModule->headsepLE->text().toDouble(),
                          dialog_->marginsModule->headsepUnit->currentLengthItem()
                          ).asString();
 
 
-       controller().params().footskip =
+       params.footskip =
                LyXLength(dialog_->marginsModule->footskipLE->text().toDouble(),
                          dialog_->marginsModule->footskipUnit->currentLengthItem()
                          ).asString();
 
 }
 
+
 namespace {
 
 /** Return the position of val in the vector if found.
@@ -382,41 +385,44 @@ findPos(std::vector<A> const & vec, A const & val)
 
 } // namespace anom
 
+
 void QDocument::update_contents()
 {
        if (!dialog_.get())
                return;
 
-       /* preamble */
-       QString preamble = controller().params().preamble.c_str();
+       BufferParams const & params = controller().params();
+
+       // preamble
+       QString preamble = params.preamble.c_str();
        dialog_->preambleModule->preambleMLE->setText(preamble);
 
-       /* biblio */
+       // biblio
        dialog_->biblioModule->natbibCB->setChecked(
-               controller().params().use_natbib);
+               params.use_natbib);
        dialog_->biblioModule->citeStyleCO->setCurrentItem(
-               controller().params().use_numerical_citations ? 1 : 0);
+               params.use_numerical_citations ? 1 : 0);
 
-       /* language & quotes */
+       // language & quotes
        dialog_->langModule->singleQuoteRB->setChecked(
-               controller().params().quotes_times == InsetQuotes::SingleQ);
+               params.quotes_times == InsetQuotes::SingleQ);
        dialog_->langModule->doubleQuoteRB->setChecked(
-               controller().params().quotes_times == InsetQuotes::DoubleQ);
+               params.quotes_times == InsetQuotes::DoubleQ);
 
        int const pos = int(findPos(lang_,
-                                   controller().params().language->lang()));
+                                   params.language->lang()));
        dialog_->langModule->languageCO->setCurrentItem(pos);
 
        dialog_->langModule->quoteStyleCO->setCurrentItem(
-               controller().params().quotes_language);
+               params.quotes_language);
 
-       /* numbering */
+       // numbering
        dialog_->numberingModule->tocDepthSB->setValue(
-               controller().params().secnumdepth);
+               params.secnumdepth);
        dialog_->numberingModule->sectionnrDepthSB->setValue(
-               controller().params().tocdepth);
+               params.tocdepth);
 
-       /* packages */
+       // packages
        QStringList enc;
        enc <<  "default" << "auto" << "latin1" << "latin2" << "latin3" <<
                "latin4" << "latin5" << "latin9" << "koi8-r" << "koi8-u" <<
@@ -424,14 +430,14 @@ void QDocument::update_contents()
        int pos2 = 0;
        for (QStringList::Iterator it = enc.begin();
             it!=enc.end(); ++it) {
-               if (*it==controller().params().inputenc.c_str()) {
+               if (*it == params.inputenc.c_str()) {
                        dialog_->packagesModule->encodingCO->setCurrentItem(pos2);
                }
                ++pos2;
        }
 
 
-       QString text = controller().params().graphicsDriver.c_str();
+       QString text = params.graphicsDriver.c_str();
        int nitem = dialog_->packagesModule->psdriverCO->count();
        for (int n = 0; n < nitem ; ++n) {
                QString enc = tex_graphics[n];
@@ -442,20 +448,19 @@ void QDocument::update_contents()
 
 
        dialog_->packagesModule->amsCB->setChecked(
-               controller().params().use_amsmath);
+               params.use_amsmath);
 
        dialog_->packagesModule->lspacingCO->
-               setCurrentItem(controller().params().spacing.getSpace());
-       if (controller().params().spacing.getSpace()==
-           Spacing::Other) {
+               setCurrentItem(params.spacing.getSpace());
+       if (params.spacing.getSpace() == Spacing::Other) {
                dialog_->packagesModule->lspacingLE->setText(
-                       tostr(controller().params().spacing.getValue()).c_str());
+                       tostr(params.spacing.getValue()).c_str());
                dialog_->setLSpacing(3);
        }
 
-       /* layout */
+       // layout
        for (int n = 0; n<dialog_->layoutModule->classCO->count(); ++n) {
-               if (dialog_->layoutModule->classCO->text(n)==
+               if (dialog_->layoutModule->classCO->text(n) ==
                    controller().textClass().description().c_str()) {
                        dialog_->layoutModule->classCO->setCurrentItem(n);
                        break;
@@ -463,19 +468,19 @@ void QDocument::update_contents()
        }
 
        dialog_->updateFontsize(controller().textClass().opt_fontsize(),
-                               controller().params().fontsize);
+                               params.fontsize);
 
        dialog_->updatePagestyle(controller().textClass().opt_pagestyle(),
-                                controller().params().pagestyle);
+                                params.pagestyle);
 
        for (int n = 0; tex_fonts[n][0]; ++n) {
-               if (tex_fonts[n]==controller().params().fonts) {
+               if (tex_fonts[n] == params.fonts) {
                        dialog_->layoutModule->fontsCO->setCurrentItem(n);
                        break;
                }
        }
 
-       if (controller().params().paragraph_separation
+       if (params.paragraph_separation
            == BufferParams::PARSEP_INDENT) {
                dialog_->layoutModule->indentRB->setChecked(true);
        } else {
@@ -483,7 +488,7 @@ void QDocument::update_contents()
        }
 
        int skip = 0;
-       switch (controller().params().getDefSkip().kind()) {
+       switch (params.getDefSkip().kind()) {
        case VSpace::SMALLSKIP:
                skip = 0;
                break;
@@ -496,7 +501,7 @@ void QDocument::update_contents()
        case VSpace::LENGTH:
        {
                skip = 3;
-               string const length = controller().params().getDefSkip().asLyXCommand();
+               string const length = params.getDefSkip().asLyXCommand();
                dialog_->layoutModule->skipLengthCO->setCurrentItem(LyXLength(length).unit());
                dialog_->layoutModule->skipLE->setText(tostr(LyXLength(length).value()).c_str());
                break;
@@ -508,45 +513,45 @@ void QDocument::update_contents()
        dialog_->layoutModule->skipCO->setCurrentItem(skip);
        dialog_->setSkip(skip);
 
-       if (!controller().params().options.empty()) {
+       if (!params.options.empty()) {
                dialog_->layoutModule->optionsLE->setText(
-                       controller().params().options.c_str());
+                       params.options.c_str());
        } else {
                dialog_->layoutModule->optionsLE->setText("");
        }
 
-       /* paper */
-       int const psize = controller().params().papersize2;
+       // paper
+       int const psize = params.papersize2;
        dialog_->paperModule->papersizeCO->setCurrentItem(psize);
        dialog_->setMargins(psize);
        dialog_->setCustomPapersize(psize);
 
        bool const landscape =
-               controller().params().orientation == BufferParams::ORIENTATION_LANDSCAPE;
+               params.orientation == BufferParams::ORIENTATION_LANDSCAPE;
        dialog_->paperModule->landscapeRB->setChecked(landscape);
        dialog_->paperModule->portraitRB->setChecked(!landscape);
 
        dialog_->paperModule->facingPagesCB->setChecked(
-               controller().params().sides == LyXTextClass::TwoSides);
+               params.sides == LyXTextClass::TwoSides);
 
        dialog_->paperModule->twoColumnCB->setChecked(
-               controller().params().columns == 2);
+               params.columns == 2);
 
        dialog_->paperModule->paperwidthUnitCO->setCurrentItem(
-               LyXLength(controller().params().paperwidth).unit());
+               LyXLength(params.paperwidth).unit());
 
        dialog_->paperModule->paperwidthLE->setText(
-               tostr(LyXLength(controller().params().paperwidth).value()).c_str());
+               tostr(LyXLength(params.paperwidth).value()).c_str());
 
        dialog_->paperModule->paperheightUnitCO->setCurrentItem(
-               LyXLength(controller().params().paperheight).unit());
+               LyXLength(params.paperheight).unit());
 
        dialog_->paperModule->paperheightLE->setText(
-               tostr(LyXLength(controller().params().paperheight).value()).c_str());
+               tostr(LyXLength(params.paperheight).value()).c_str());
 
-       /* margins */
-       int item = controller().params().paperpackage;
-       if (controller().params().use_geometry) {
+       // margins
+       int item = params.paperpackage;
+       if (params.use_geometry) {
                item = 1;
        } else if (item > 0) {
                item = item + 1;
@@ -555,39 +560,37 @@ void QDocument::update_contents()
        dialog_->setCustomMargins(item);
 
        dialog_->marginsModule->topUnit->setCurrentItem(
-               LyXLength(controller().params().topmargin).unit());
+               LyXLength(params.topmargin).unit());
        dialog_->marginsModule->topLE->setText(
-               tostr(LyXLength(controller().params().topmargin).value()).c_str());
+               tostr(LyXLength(params.topmargin).value()).c_str());
 
        dialog_->marginsModule->bottomUnit->setCurrentItem(
-               LyXLength(controller().params().bottommargin).unit());
+               LyXLength(params.bottommargin).unit());
        dialog_->marginsModule->bottomLE->setText(
-               tostr(LyXLength(controller().params().bottommargin).value()).c_str());
+               tostr(LyXLength(params.bottommargin).value()).c_str());
 
        dialog_->marginsModule->innerUnit->setCurrentItem(
-               LyXLength(controller().params().leftmargin).unit());
+               LyXLength(params.leftmargin).unit());
        dialog_->marginsModule->innerLE->setText(
-               tostr(LyXLength(controller().params().leftmargin).value()).c_str());
+               tostr(LyXLength(params.leftmargin).value()).c_str());
 
        dialog_->marginsModule->outerUnit->setCurrentItem(
-               LyXLength(controller().params().rightmargin).unit());
+               LyXLength(params.rightmargin).unit());
        dialog_->marginsModule->outerLE->setText(
-               tostr(LyXLength(controller().params().rightmargin).value()).c_str());
+               tostr(LyXLength(params.rightmargin).value()).c_str());
 
        dialog_->marginsModule->headheightUnit->setCurrentItem(
-               LyXLength(controller().params().headheight).unit());
+               LyXLength(params.headheight).unit());
        dialog_->marginsModule->headheightLE->setText(
-               tostr(LyXLength(controller().params().headheight).value()).c_str());
+               tostr(LyXLength(params.headheight).value()).c_str());
 
        dialog_->marginsModule->headsepUnit->setCurrentItem(
-               LyXLength(controller().params().headsep).unit());
+               LyXLength(params.headsep).unit());
        dialog_->marginsModule->headsepLE->setText(
-               tostr(LyXLength(controller().params().headsep).value()).c_str());
+               tostr(LyXLength(params.headsep).value()).c_str());
 
        dialog_->marginsModule->footskipUnit->setCurrentItem(
-               LyXLength(controller().params().footskip).unit());
+               LyXLength(params.footskip).unit());
        dialog_->marginsModule->footskipLE->setText(
-               tostr(LyXLength(controller().params().footskip).value()).c_str());
-
-
+               tostr(LyXLength(params.footskip).value()).c_str());
 }
index 3fec721fb3826c75fc09e7b4b43dcbe415beccbc..cceb8636bcafc81a37965fa9b9ed5654be9fb4b1 100644 (file)
@@ -30,10 +30,10 @@ class QDocument
        : public Qt2CB<ControlDocument, Qt2DB<QDocumentDialog> >
 {
 public:
-       ///
-       QDocument();
        ///
        friend class QDocumentDialog;
+       ///
+       QDocument();
 private:
        /// Apply changes
        void apply();
index 7dd89a7a244ff51b734c14e6c645ba9e7428c416..8147388bffa97411f309929ce4214fc9290762f6 100644 (file)
 #include <qcheckbox.h>
 #include <qspinbox.h>
 #include "lengthcombo.h"
-/* 
- *  Constructs a DocumentDialog which is a child of 'parent', with the 
- *  name 'name' and widget flags set to 'f' 
+
+
+/*
+ *  Constructs a DocumentDialog which is a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'
  *
  *  The dialog will by default be modeless, unless you set 'modal' to
  *  TRUE to construct a modal dialog.
@@ -69,7 +71,7 @@ QDocumentDialog::QDocumentDialog( QDocument * form)
                form, SLOT(slotClose()));
        connect(restorePB, SIGNAL(clicked()),
                form, SLOT(slotRestore()));
-       
+
        moduleLB->clear();
        moduleLB->insertItem( _("Layout"), LAYOUT );
        moduleLB->insertItem( _("Packages"), PACKAGES );
@@ -101,7 +103,7 @@ QDocumentDialog::QDocumentDialog( QDocument * form)
        moduleStack->addWidget(numberingModule,NUMBERING);
        moduleStack->addWidget(biblioModule,BIBLIOGRAPHY);
        moduleStack->addWidget(preambleModule,PREAMBLE);
-       
+
        moduleStack->raiseWidget(LAYOUT);
 
        //QPixmap image("standard.xpm");
@@ -112,7 +114,7 @@ QDocumentDialog::QDocumentDialog( QDocument * form)
        f.setWeight( QFont::Bold );
        titleL->setFont( f );
        setTitle(LAYOUT);
-       
+
        /* preamble */
        connect( preambleModule->preambleMLE, SIGNAL( textChanged() ),
                 this , SLOT( change_adaptor() ) );
@@ -177,18 +179,18 @@ QDocumentDialog::QDocumentDialog( QDocument * form)
                 this , SLOT( change_adaptor() ) );
        connect( layoutModule->skipLengthCO, SIGNAL( activated(int) ),
                 this , SLOT( change_adaptor() ) );
-       
+
        connect( layoutModule->classCO, SIGNAL( activated(int) ),
                 this , SLOT( classChanged() ) );
        connect( layoutModule->skipCO, SIGNAL( activated(int) ),
                 this , SLOT( setSkip(int) ) );
        connect( layoutModule->skipRB, SIGNAL( toggled(bool) ),
                 this , SLOT( enableSkip(bool) ) );
-       
+
        /* margins */
        connect( marginsModule->marginCO, SIGNAL( activated(int) ),
                 this , SLOT( setCustomMargins(int) ) );
-       
+
        connect( marginsModule->marginCO, SIGNAL( activated(int) ),
                 this , SLOT( change_adaptor() ) );
        connect( marginsModule->topLE, SIGNAL( textChanged(const QString&) ),
@@ -219,7 +221,7 @@ QDocumentDialog::QDocumentDialog( QDocument * form)
                 this , SLOT( change_adaptor() ) );
        connect( marginsModule->footskipUnit, SIGNAL( activated(int) ),
                 this , SLOT( change_adaptor() ) );
-       
+
        /* paper */
        connect( paperModule->papersizeCO, SIGNAL( activated(int) ),
                 this , SLOT( setMargins(int) ) );
@@ -227,7 +229,7 @@ QDocumentDialog::QDocumentDialog( QDocument * form)
                 this , SLOT( setCustomPapersize(int) ) );
        connect( paperModule->papersizeCO, SIGNAL( activated(int) ),
                 this , SLOT( setCustomPapersize(int) ) );
-       
+
        connect( paperModule->papersizeCO, SIGNAL( activated(int) ),
                 this , SLOT( change_adaptor() ) );
        connect( paperModule->paperheightLE, SIGNAL( textChanged(const QString&) ),
@@ -246,9 +248,10 @@ QDocumentDialog::QDocumentDialog( QDocument * form)
                 this , SLOT( change_adaptor() ) );
        connect( paperModule->facingPagesCB, SIGNAL( toggled(bool) ),
                 this , SLOT( change_adaptor() ) );
-       
+
 }
 
+
 void QDocumentDialog::showPreamble()
 {
        moduleStack->raiseWidget(PREAMBLE);
@@ -256,7 +259,8 @@ void QDocumentDialog::showPreamble()
        QDocumentDialogBase::show();
 }
 
-/*  
+
+/*
  *  Destroys the object and frees any allocated resources
  */
 QDocumentDialog::~QDocumentDialog()
@@ -264,7 +268,8 @@ QDocumentDialog::~QDocumentDialog()
     // no need to delete child widgets, Qt does it all for us
 }
 
-/* 
+
+/*
  * public slot
  */
 
@@ -301,51 +306,59 @@ void QDocumentDialog::setTitle(int item)
        }
 }
 
-/* 
+
+/*
  * public slot
  */
 void QDocumentDialog::saveDocDefault()
 {}
 
-/* 
+
+/*
  * public slot
  */
 void QDocumentDialog::restore()
 {
-    qWarning( "DocumentDialog::restore() not yet implemented!" ); 
+    qWarning( "DocumentDialog::restore() not yet implemented!" );
 }
 
-/* 
+
+/*
  * public slot
  */
 void QDocumentDialog::useClassDefaults()
 {
-    qWarning( "DocumentDialog::useClassDefaults() not yet implemented!" ); 
+    qWarning( "DocumentDialog::useClassDefaults() not yet implemented!" );
 }
 
+
 void QDocumentDialog::change_adaptor()
 {
        form_->changed();
 }
 
+
 void QDocumentDialog::closeEvent(QCloseEvent * e)
 {
        form_->slotWMHide();
        e->accept();
 }
 
+
 void QDocumentDialog::setLSpacing(int item)
 {
-       packagesModule->lspacingLE->setEnabled(item==3);
+       packagesModule->lspacingLE->setEnabled(item == 3);
 }
 
+
 void QDocumentDialog::setSkip(int item)
 {
-       bool enable = (item==3);
+       bool enable = (item == 3);
        layoutModule->skipLE->setEnabled(enable);
        layoutModule->skipLengthCO->setEnabled(enable);
 }
 
+
 void QDocumentDialog::enableSkip(bool skip)
 {
        layoutModule->skipCO->setEnabled(skip);
@@ -355,6 +368,7 @@ void QDocumentDialog::enableSkip(bool skip)
                setSkip(layoutModule->skipCO->currentItem());
 }
 
+
 void QDocumentDialog::setMargins(int papersize)
 {
        QStringList a4only;
@@ -362,7 +376,7 @@ void QDocumentDialog::setMargins(int papersize)
        a4only << _("Small Margins") << _( "Very small Margins")
               << _("Very wide Margins ");
        normal << _("Default") << _("Custom");
-       
+
        int olditem = marginsModule->marginCO->currentItem();
        marginsModule->marginCO->clear();
        marginsModule->marginCO->insertStringList(normal);
@@ -376,8 +390,8 @@ void QDocumentDialog::setMargins(int papersize)
 
 void QDocumentDialog::setCustomPapersize(int papersize)
 {
-       bool const custom = (papersize==1);
-       
+       bool const custom = (papersize == 1);
+
        paperModule->paperwidthL->setEnabled(custom);
        paperModule->paperwidthLE->setEnabled(custom);
        paperModule->paperwidthUnitCO->setEnabled(custom);
@@ -390,8 +404,8 @@ void QDocumentDialog::setCustomPapersize(int papersize)
 
 void QDocumentDialog::setCustomMargins(int margin)
 {
-       bool const custom = (margin==1);
-       
+       bool const custom = (margin == 1);
+
        marginsModule->topL->setEnabled(custom);
        marginsModule->topLE->setEnabled(custom);
        marginsModule->topUnit->setEnabled(custom);
@@ -422,11 +436,12 @@ void QDocumentDialog::setCustomMargins(int margin)
 
 }
 
+
 void QDocumentDialog::updateFontsize(string const & items, string const & sel)
 {
        layoutModule->fontsizeCO->clear();
        layoutModule->fontsizeCO->insertItem("default");
-       
+
        for (int n=0; !token(items,'|',n).empty(); ++n)
                layoutModule->fontsizeCO->
                        insertItem(token(items,'|',n).c_str());
@@ -439,6 +454,7 @@ void QDocumentDialog::updateFontsize(string const & items, string const & sel)
        }
 }
 
+
 void QDocumentDialog::updatePagestyle(string const & items, string const & sel)
 {
        layoutModule->pagestyleCO->clear();
@@ -456,14 +472,13 @@ void QDocumentDialog::updatePagestyle(string const & items, string const & sel)
        }
 }
 
+
 void QDocumentDialog::classChanged()
 {
        updateFontsize(form_->controller().textClass().opt_fontsize(),
                       form_->controller().params().fontsize);
-       
+
        updatePagestyle(form_->controller().textClass().opt_pagestyle(),
                        form_->controller().params().pagestyle);
-       
-}
-
 
+}
index 630a4d02771889d982737c869a6c5bf701231640..708c8eee9cefa58bfee12d3ca2cdf55777dc68ff 100644 (file)
 
 class QDocument;
 
-class QDocumentDialog : public QDocumentDialogBase
-{ 
+class QDocumentDialog : public QDocumentDialogBase {
        Q_OBJECT
-
 public:
-       
-       QDocumentDialog( QDocument * );
-       
+       friend class QDocument;
+
+       QDocumentDialog(QDocument *);
+
        ~QDocumentDialog();
 
        void showPreamble();
-       
-       friend class QDocument;
 
-       void updateFontsize(string const & , string const & );
-       
-       void updatePagestyle(string const & , string const & );
-       
-public slots:
+       void updateFontsize(string const & , string const &);
 
+       void updatePagestyle(string const & , string const &);
+public slots:
        void setTitle(int);
        void change_adaptor();
        void saveDocDefault();
        void restore();
        void useClassDefaults();
-
 protected slots:
-
        void setLSpacing(int);
        void setMargins(int);
        void setCustomPapersize(int);
@@ -68,11 +61,8 @@ protected slots:
        void setSkip(int);
        void enableSkip(bool);
        void classChanged();
-       
 protected:
-    
     void closeEvent(QCloseEvent * e);
-
 private:
        enum Module {
                LAYOUT,
@@ -85,7 +75,7 @@ private:
                BIBLIOGRAPHY,
                PREAMBLE
        };
-       
+
        ClassModuleBase * layoutModule;
        PackagesModuleBase * packagesModule;
        PaperModuleBase * paperModule;
index 7507382aea070cce4855d215a173c04e6144297c..d52ac30cb29500fbedf5ff4405351fbd5e3a5691 100644 (file)
@@ -26,6 +26,7 @@
 
 typedef Qt2CB<ControlERT, Qt2DB<QERTDialog> > base_class;
 
+
 QERT::QERT()
        : base_class(_("LaTeX ERT"))
 {
@@ -43,12 +44,14 @@ void QERT::build_dialog()
 
 void QERT::apply()
 {
+       ERTParams & params = controller().params();
+
        if (dialog_->openRB->isChecked())
-               controller().params().status = InsetERT::Open;
+               params.status = InsetERT::Open;
        else if (dialog_->inlineRB->isChecked())
-               controller().params().status = InsetERT::Inlined;
+               params.status = InsetERT::Inlined;
        else
-               controller().params().status = InsetERT::Collapsed;
+               params.status = InsetERT::Collapsed;
 }
 
 
index f9d95e4b0fcf85617e9e729bf662a2d8c8926fa5..cd0d8583ab5a86fb84425a7525789167fa71a2de 100644 (file)
 class ControlERT;
 class QERTDialog;
 
-
-class QERT :
-       public Qt2CB<ControlERT, Qt2DB<QERTDialog> >
+class QERT
+       : public Qt2CB<ControlERT, Qt2DB<QERTDialog> >
 {
+public:
        friend class QERTDialog;
 
-public:
        QERT();
-
 private:
        /// Apply changes
        virtual void apply();
index 809ef57d1cf77a871b5c8ddc0f5658e5f019953c..5492da53fda1c74f1fab366a19170fc7fa1b7ddb 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <qpushbutton.h>
 
+
 QERTDialog::QERTDialog(QERT * form)
        : QERTDialogBase(0, 0, false, 0),
        form_(form)
index 70078da3a1610c0debe49adc2e9e33e167f6d1e2..3281b666d770d094409cebdc6dc25b2a8de0cfd0 100644 (file)
 
 class QERT;
 
-class QERTDialog : public QERTDialogBase
-{ Q_OBJECT
-
+class QERTDialog : public QERTDialogBase {
+       Q_OBJECT
 public:
        QERTDialog(QERT * form);
-
 protected slots:
        virtual void change_adaptor();
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QERT * form_;
 };
index 5ada44dee9d2d3d0fee0b75a42c56b71cbc5e352..6adab2d68171f466d4e78c74a84d299e8f10ccd4 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 #include "QErrorDialog.h"
 #include "QError.h"
 #include "Qt2BC.h"
+
 typedef Qt2CB<ControlError, Qt2DB<QErrorDialog> > base_class;
 
+
 QError::QError()
        : base_class(_("LaTeX Error"))
 {
index 9187a7274328cf14ab484a7688ee1c5ee1663cbc..dd58f80a5e9d5c018bbb38ef5b429aefcee4cdd1 100644 (file)
@@ -22,17 +22,16 @@ class ControlError;
 class QErrorDialog;
 
 
-class QError :
-       public Qt2CB<ControlError, Qt2DB<QErrorDialog> >
+class QError
+       public Qt2CB<ControlError, Qt2DB<QErrorDialog> >
 {
+public:
        friend class QErrorDialog;
 
-public:
        QError();
-
 private:
        /// Apply changes
-       virtual void apply() {};
+       virtual void apply() {}
        /// update
        virtual void update_contents();
        /// build the dialog
index 2fa04f64577c959ebec3375416ce213ab40f5448..a223bd52e2f5a1a566cb49c2b6fa787911cc57bc 100644 (file)
@@ -3,24 +3,25 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
 #include "QError.h"
+
 #include <qwidget.h>
 #include <qpushbutton.h>
 
 #include "QErrorDialog.h"
 
+
 QErrorDialog::QErrorDialog(QError * form)
        : QErrorDialogBase(0, 0, false, 0),
        form_(form)
index 012ee442d66d8bdb1cfc34542f0e05e986f1a0f8..9f0ac4d5a23d881f9204e21093cacf76e171205f 100644 (file)
 
 class QError;
 
-class QErrorDialog : public QErrorDialogBase
-{ Q_OBJECT
-
+class QErrorDialog : public QErrorDialogBase {
+       Q_OBJECT
 public:
        QErrorDialog(QError * form);
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QError * form_;
 };
index 5fa7eadfa3cd2e1c9d9b20bba6a34931bc0882e3..90042d0370395dc9b95be1202107c41d0f38b40e 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -14,8 +14,6 @@
 #pragma implementation
 #endif
 
-#include <vector>
-
 #include "ControlExternal.h"
 #include "gettext.h"
 
 #include "QExternalDialog.h"
 #include "QExternal.h"
 #include "Qt2BC.h"
+
+#include <vector>
+
 typedef Qt2CB<ControlExternal, Qt2DB<QExternalDialog> > base_class;
 
+
 QExternal::QExternal()
        : base_class(_("External"))
 {
@@ -64,26 +65,28 @@ void QExternal::update_contents()
        dialog_->paramsED->setText(params.parameters.c_str());
 
        dialog_->externalCO->setCurrentItem(controller().getTemplateNumber(params.templ.lyxName));
-       dialog_->externalTV->setText(controller().params().templ.helpText.c_str());
+       dialog_->externalTV->setText(params.templ.helpText.c_str());
        isValid();
 }
 
 
 string const & QExternal::helpText()
 {
-       controller().params().templ = controller().getTemplate(dialog_->externalCO->currentItem() + 1);
-       return controller().params().templ.helpText;
+       InsetExternal::Params & params = controller().params();
+
+       params.templ = controller().getTemplate(dialog_->externalCO->currentItem() + 1);
+       return params.templ.helpText;
 }
 
 
 void QExternal::apply()
 {
-       controller().params().filename =
-               string(dialog_->fileED->text().latin1());
-       controller().params().parameters =
-               string(dialog_->paramsED->text().latin1());
+       InsetExternal::Params & params = controller().params();
+
+       params.filename = dialog_->fileED->text().latin1();
+       params.parameters = dialog_->paramsED->text().latin1();
 
-       controller().params().templ = controller().getTemplate(dialog_->externalCO->currentItem() + 1);
+       params.templ = controller().getTemplate(dialog_->externalCO->currentItem() + 1);
 }
 
 
index 7810952c4dace20b8c3bb63bcae5c95e2f2d8b5c..b8da14c6569be03c82fd354575746003e2111c88 100644 (file)
 class ControlExternal;
 class QExternalDialog;
 
-class QExternal :
-       public Qt2CB<ControlExternal, Qt2DB<QExternalDialog> >
+class QExternal
+       public Qt2CB<ControlExternal, Qt2DB<QExternalDialog> >
 {
+public:
        friend class QExternalDialog;
 
-public:
        QExternal();
-
 protected:
        virtual bool isValid();
-
 private:
        /// Apply changes
        virtual void apply();
index fab00475ccbeb807b676dd9b14fd1836f6ba4054..179ab0e7034b72d201e3995a2a3bbde58dcf5c2f 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -16,7 +16,7 @@
 
 #include "gettext.h"
 #include "ControlExternal.h"
+
 #include <qwidget.h>
 #include <qpushbutton.h>
 #include <qfiledialog.h>
@@ -27,6 +27,7 @@
 #include "QExternalDialog.h"
 #include "QExternal.h"
 
+
 QExternalDialog::QExternalDialog(QExternal * form)
        : QExternalDialogBase(0, 0, false, 0),
        form_(form)
@@ -44,7 +45,7 @@ void QExternalDialog::show()
        fileED->setFocus();
 }
 
+
 void QExternalDialog::change_adaptor()
 {
        form_->changed();
@@ -81,8 +82,11 @@ void QExternalDialog::updateClicked()
 
 void QExternalDialog::browseClicked()
 {
-       QString file = QFileDialog::getOpenFileName(QString::null,
-               _("External material (*)"), this, 0, _("Select external material"));
+       QString file =
+               QFileDialog::getOpenFileName(QString::null,
+                                            _("External material (*)"),
+                                            this, 0,
+                                            _("Select external material"));
        if (!file.isNull()) {
                fileED->setText(file.latin1());
                form_->changed();
index b698d26d91ebb2e3e53a96bcddf48863f5c30dff..a71d3b70e578c15f322cf71ada3daaf40cf25731 100644 (file)
 
 class QExternal;
 
-class QExternalDialog : public QExternalDialogBase
-{ Q_OBJECT
-
+class QExternalDialog : public QExternalDialogBase {
+       Q_OBJECT
 public:
        QExternalDialog(QExternal * form);
 
        virtual void show();
-
 protected slots:
        virtual void change_adaptor();
        virtual void editClicked();
@@ -35,10 +33,8 @@ protected slots:
        virtual void updateClicked();
        virtual void browseClicked();
        virtual void templateChanged();
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QExternal * form_;
 };
index df8ba889f4db8e33f87e163d3c3ccb6aa857bb97..fe947a2506a2f2690fcd7f620deb4656e75c167d 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Edwin Leuven 
+ * \author Edwin Leuven
  *
  * Full author contact details are available in file CREDITS
  */
@@ -27,6 +27,7 @@
 
 typedef Qt2CB<ControlFloat, Qt2DB<QFloatDialog> > base_class;
 
+
 QFloat::QFloat()
        : base_class(_("Float Settings"))
 {
@@ -63,7 +64,9 @@ void QFloat::update_contents()
        bool force = false;
        bool here_definitely = false;
 
-       string const placement(controller().params().placement);
+       FloatParams const & params = controller().params();
+
+       string const & placement = params.placement;
 
        if (placement.empty()) {
                def_placement = true;
@@ -86,7 +89,7 @@ void QFloat::update_contents()
                        here = true;
                }
        }
+
        dialog_->defaultsCB->setChecked(def_placement);
        dialog_->topCB->setChecked(top);
        dialog_->bottomCB->setChecked(bottom);
@@ -95,25 +98,27 @@ void QFloat::update_contents()
        dialog_->ignoreCB->setChecked(force);
        dialog_->ignoreCB->setEnabled(top || bottom || page || here);
        dialog_->heredefinitelyCB->setChecked(here_definitely);
-       if (controller().params().wide) {
+
+       if (params.wide) {
                dialog_->herepossiblyCB->setChecked(false);
                dialog_->bottomCB->setChecked(false);
        }
-       dialog_->spanCB->setChecked(controller().params().wide);
+
+       dialog_->spanCB->setChecked(params.wide);
 }
 
+
 void QFloat::apply()
 {
-       controller().params().wide = dialog_->spanCB->isChecked(); 
+       FloatParams & params = controller().params();
+
+       params.wide = dialog_->spanCB->isChecked();
 
        if (dialog_->defaultsCB->isChecked()) {
-               controller().params().placement = "";
+               params.placement.erase();
                return;
        }
+
        string placement;
 
        if (dialog_->heredefinitelyCB->isChecked()) {
@@ -135,5 +140,5 @@ void QFloat::apply()
                        placement += "h";
                }
        }
-       controller().params().placement = placement;
+       params.placement = placement;
 }
index c1af77b02136f076c31c19975a7a83a4f4dc5e92..4e589e849ab913b928f1867dd4e35b738ad8e087 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Edwin Leuven 
+ * \author Edwin Leuven
  *
  * Full author contact details are available in file CREDITS
  */
@@ -23,7 +23,8 @@
 
 #include "QFloatDialog.h"
 #include "QFloat.h"
+
+
 QFloatDialog::QFloatDialog(QFloat * form)
        : QFloatDialogBase(0, 0, false, 0),
        form_(form)
@@ -60,7 +61,7 @@ void QFloatDialog::tbhpClicked()
        allow |= herepossiblyCB->isChecked();
        ignoreCB->setEnabled(allow);
 }
+
 
 void QFloatDialog::heredefinitelyClicked()
 {
@@ -80,13 +81,13 @@ void QFloatDialog::spanClicked()
        bool const span(spanCB->isChecked());
 
        if (!defaultsCB->isChecked()) {
-               herepossiblyCB->setEnabled(!span);
-               heredefinitelyCB->setEnabled(!span);
+               herepossiblyCB->setEnabled(!span);
+               heredefinitelyCB->setEnabled(!span);
        }
 
        if (!span)
                return;
+
        herepossiblyCB->setChecked(false);
        heredefinitelyCB->setChecked(false);
 }
index 86f698f7672940960c3e9ce18d50730501f5c904..ae47773c2e6c7b50f42b876f5ee60482352c3157 100644 (file)
 
 class QFloat;
 
-class QFloatDialog : public QFloatDialogBase
-{ Q_OBJECT
-
+class QFloatDialog : public QFloatDialogBase {
+       Q_OBJECT
 public:
        QFloatDialog(QFloat * form);
-
 protected slots:
        virtual void change_adaptor();
        virtual void tbhpClicked();
        virtual void heredefinitelyClicked();
        virtual void spanClicked();
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QFloat * form_;
 };
index 8a615bbeb7a96c9ce54674e225de48e4df12233e..8ced02f2aef4834a29fa381efb9dbba07c4b09d6 100644 (file)
@@ -3,8 +3,8 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
- * \author Edwin Leuven 
+ * \author John Levon
+ * \author Edwin Leuven
  *
  * Full author contact details are available in file CREDITS
  */
@@ -43,6 +43,7 @@
 
 typedef Qt2CB<ControlGraphics, Qt2DB<QGraphicsDialog> > base_class;
 
+
 QGraphics::QGraphics()
        : base_class(_("Graphics"))
 {
@@ -103,15 +104,19 @@ void QGraphics::update_contents()
        string unit = "cm";
        switch (lyxrc.default_papersize) {
                case BufferParams::PAPER_DEFAULT: break;
-       
+
                case BufferParams::PAPER_USLETTER:
                case BufferParams::PAPER_LEGALPAPER:
-               case BufferParams::PAPER_EXECUTIVEPAPER: unit = "in"; break;
-       
+               case BufferParams::PAPER_EXECUTIVEPAPER:
+                       unit = "in";
+                       break;
+
                case BufferParams::PAPER_A3PAPER:
                case BufferParams::PAPER_A4PAPER:
                case BufferParams::PAPER_A5PAPER:
-               case BufferParams::PAPER_B5PAPER: unit = "cm"; break;
+               case BufferParams::PAPER_B5PAPER:
+                       unit = "cm";
+                       break;
        }
 
        dialog_->filename->setText(igp.filename.c_str());
@@ -148,7 +153,7 @@ void QGraphics::update_contents()
        dialog_->subfigure->setChecked(igp.subcaption);
        dialog_->subcaption->setText(igp.subcaptionText.c_str());
 
-       int item;
+       int item = 0;
        switch (igp.display) {
                case grfx::DefaultDisplay: item = 0; break;
                case grfx::MonochromeDisplay: item = 1; break;
@@ -187,7 +192,7 @@ void QGraphics::apply()
        igp.filename = dialog_->filename->text();
 
        if (!controller().bbChanged) {
-               igp.bb = string();
+               igp.bb.erase();
        } else {
                string bb;
                string lbX(dialog_->lbX->text());
@@ -230,7 +235,7 @@ void QGraphics::apply()
 
        if (!dialog_->displayCB->isChecked())
                igp.display = grfx::NoDisplay;
+
        string value(dialog_->width->text());
        igp.width = LyXLength(strToDbl(value), dialog_->widthUnit->currentLengthItem());
        value = string(dialog_->height->text());
@@ -239,7 +244,7 @@ void QGraphics::apply()
        igp.keepAspectRatio = dialog_->aspectratio->isChecked();
 
        igp.noUnzip = dialog_->unzipCB->isChecked();
+
        igp.lyxscale = strToInt(string(dialog_->displayscale->text()));
 
        igp.rotateAngle = strToDbl(string(dialog_->angle->text()));
@@ -251,7 +256,7 @@ void QGraphics::apply()
        if ((dialog_->origin->currentItem()) > 0)
                igp.rotateOrigin = dialog_->origin->currentText();
        else
-           igp.rotateOrigin = string();
+           igp.rotateOrigin.erase();
 
        igp.special = dialog_->latexoptions->text();
 }
@@ -284,6 +289,6 @@ void QGraphics::get()
 
 bool QGraphics::isValid()
 {
-       // FIXME: we need more here. 
+       // FIXME: we need more here.
        return !string(dialog_->filename->text().latin1()).empty();
 }
index 0e3a4a15da43b393d37f376c44b0ea7511d19bf6..c73a3223b1596e366e9ed0b6ef3da1fc03af2b2b 100644 (file)
@@ -31,10 +31,8 @@ public:
        friend class QGraphicsDialog;
        ///
        QGraphics();
-
 protected:
        virtual bool isValid();
-
 private:
        /// Apply changes
        virtual void apply();
index 695aeb0066883079bc2616867d9b083a84ffc3d6..c78c770aa56090920a3ec15a2c07b06b8bfe0fc6 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -14,8 +14,6 @@
 #pragma implementation
 #endif
 
-#include <vector>
-
 #include "ControlGraphics.h"
 #include "debug.h"
 #include "LString.h"
@@ -28,6 +26,9 @@
 #include "QGraphicsDialog.h"
 #include "QGraphics.h"
 
+#include <vector>
+
+
 QGraphicsDialog::QGraphicsDialog(QGraphics * form)
        : QGraphicsDialogBase(0, 0, false, 0),
        form_(form)
@@ -44,12 +45,12 @@ QGraphicsDialog::QGraphicsDialog(QGraphics * form)
 
 
 void QGraphicsDialog::show()
-{ 
+{
        QGraphicsDialogBase::show();
        filename->setFocus();
 }
 
+
 void QGraphicsDialog::change_adaptor()
 {
        form_->changed();
index 520a5d0e833666c1782f4aab549aa577e8f6b064..b1b601dec89842cb5d3cfe122af27b02b59b97d7 100644 (file)
 
 class QGraphics;
 
-class QGraphicsDialog : public QGraphicsDialogBase
-{ Q_OBJECT
-
+class QGraphicsDialog : public QGraphicsDialogBase {
+       Q_OBJECT
 public:
        QGraphicsDialog(QGraphics * form);
 
        virtual void show();
-
 protected slots:
        virtual void change_adaptor();
        virtual void browse_clicked();
        virtual void get_clicked();
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QGraphics * form_;
 };
index a71ffdc6dff830f1ae7974ae23a19c911c19ad5e..09238f778c911886c4bfbb80bdd4df7ac17e9276 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -17,7 +17,7 @@
 #include "ControlInclude.h"
 #include "gettext.h"
 #include "debug.h"
+
 #include "QIncludeDialog.h"
 #include "QInclude.h"
 #include "Qt2BC.h"
 #include <qcheckbox.h>
 #include <qcombobox.h>
 
+
 typedef Qt2CB<ControlInclude, Qt2DB<QIncludeDialog> > base_class;
 
+
 QInclude::QInclude()
        : base_class(_("Include"))
 {
@@ -50,9 +52,11 @@ void QInclude::build_dialog()
 
 void QInclude::update_contents()
 {
-       dialog_->filenameED->setText(controller().params().cparams.getContents().c_str());
+       InsetInclude::Params const & params = controller().params();
+
+       dialog_->filenameED->setText(params.cparams.getContents().c_str());
 
-       string const cmdname = controller().params().cparams.getCmdName();
+       string const & cmdname = params.cparams.getCmdName();
 
        dialog_->visiblespaceCB->setChecked(false);
        dialog_->visiblespaceCB->setEnabled(false);
@@ -71,19 +75,20 @@ void QInclude::update_contents()
 
 void QInclude::apply()
 {
-       controller().params().cparams.
-               setContents(dialog_->filenameED->text().latin1());
+       InsetInclude::Params & params = controller().params();
+
+       params.cparams.setContents(dialog_->filenameED->text().latin1());
 
        int const item = dialog_->typeCO->currentItem();
        if (item == 0)
-               controller().params().flag = InsetInclude::INPUT;
+               params.flag = InsetInclude::INPUT;
        else if (item == 1)
-               controller().params().flag = InsetInclude::INCLUDE;
+               params.flag = InsetInclude::INCLUDE;
        else {
                if (dialog_->visiblespaceCB->isChecked())
-                       controller().params().flag = InsetInclude::VERBAST;
+                       params.flag = InsetInclude::VERBAST;
                else
-                       controller().params().flag = InsetInclude::VERB;
+                       params.flag = InsetInclude::VERB;
        }
 }
 
@@ -93,9 +98,9 @@ void QInclude::browse()
        ControlInclude::Type type;
 
        int const item = dialog_->typeCO->currentItem();
-       if (item==0)
+       if (item == 0)
                type = ControlInclude::INPUT;
-       else if (item==1)
+       else if (item == 1)
                type = ControlInclude::INCLUDE;
        else
                type = ControlInclude::VERBATIM;
index 22458cc3d8bad44659489442af2f67a0b2aa37a1..21c0049659240b15d9eab4845f700466c7590896 100644 (file)
@@ -30,10 +30,8 @@ public:
        friend class QIncludeDialog;
        ///
        QInclude();
-
 protected:
        virtual bool isValid();
-
 private:
        /// Apply changes
        virtual void apply();
index 88ac17522578286050a7548c1318f645ed0d70fb..37c9959b0493b7a8e82d59a22a871eeaa4bbbfcf 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -14,8 +14,6 @@
 #pragma implementation
 #endif
 
-#include <vector>
-
 #include "ControlInclude.h"
 #include "debug.h"
 #include "LString.h"
@@ -28,6 +26,9 @@
 #include "QIncludeDialog.h"
 #include "QInclude.h"
 
+#include <vector>
+
+
 QIncludeDialog::QIncludeDialog(QInclude * form)
        : QIncludeDialogBase(0, 0, false, 0),
        form_(form)
@@ -43,8 +44,8 @@ void QIncludeDialog::show()
 {
        QIncludeDialogBase::show();
        filenameED->setFocus();
-} 
+}
+
 
 void QIncludeDialog::change_adaptor()
 {
index a704ab09c65cbdd505a500bd04aa3804ff507870..cb0e31d9d3eab83edba903b128bf06178dfe9e75 100644 (file)
 
 class QInclude;
 
-class QIncludeDialog : public QIncludeDialogBase
-{ Q_OBJECT
-
+class QIncludeDialog : public QIncludeDialogBase {
+       Q_OBJECT
 public:
        QIncludeDialog(QInclude * form);
 
        void updateLists();
 
        virtual void show();
-
 protected slots:
        virtual void change_adaptor();
        virtual void loadClicked();
        virtual void browseClicked();
        virtual void typeChanged(int v);
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QInclude * form_;
 };
index db885c9794a3c0f721c845e94695ccb96a3f4b44..17afb215973e1ee9c7346a9174ce67d16fe114c3 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -25,6 +25,7 @@
 
 typedef Qt2CB<ControlIndex, Qt2DB<QIndexDialog> > base_class;
 
+
 QIndex::QIndex()
        : base_class(_("Index"))
 {
index e785bfd46189f80b6afa8b4e90b81380aabeef47..5256380a619359f51dc63762a2e83999d678545b 100644 (file)
@@ -26,14 +26,12 @@ class QIndexDialog;
 class QIndex :
        public Qt2CB<ControlIndex, Qt2DB<QIndexDialog> >
 {
+public:
        friend class QIndexDialog;
 
-public:
        QIndex();
-
 protected:
        virtual bool isValid();
-
 private:
        /// Apply changes
        virtual void apply();
index 06ae362e2e63091e804bfb1c1505bd5a53c64919..7dced6a366887dc04ada56f43f7f91da631966a1 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 
 #include "QIndex.h"
 #include "QIndexDialog.h"
+
 #include <qpushbutton.h>
 #include <qlineedit.h>
 #include <qwhatsthis.h>
 
+
 QIndexDialog::QIndexDialog(QIndex * form)
        : QIndexDialogBase(0, 0, false, 0),
        form_(form)
@@ -51,11 +52,11 @@ QIndexDialog::QIndexDialog(QIndex * form)
 
 void QIndexDialog::show()
 {
-       QIndexDialogBase::show(); 
+       QIndexDialogBase::show();
        keywordED->setFocus();
 }
 
+
 void QIndexDialog::change_adaptor()
 {
        form_->changed();
index e78d0b61eaf35e608ec860e7529247b2a0d394c3..5ee70d21dbc32190bd6860914a3357cd6174e2cf 100644 (file)
 
 class QIndex;
 
-class QIndexDialog : public QIndexDialogBase
-{ Q_OBJECT
-
+class QIndexDialog : public QIndexDialogBase {
+       Q_OBJECT
 public:
        QIndexDialog(QIndex * form);
 
        virtual void show();
-
 protected slots:
        virtual void change_adaptor();
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QIndex * form_;
 };
index 15577b4305e580b49e3a37c11b6affef1e2481b4..787bc17aa8cbdfdcb51e2f1499d7c54fdad18c5c 100644 (file)
@@ -4,7 +4,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Angus Leeming
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -46,7 +46,7 @@ Image::ImagePtr QLImage::newImage()
 Image::FormatList QLImage::loadableFormats()
 {
        static FormatList fmts;
+
        if (!fmts.empty())
                return fmts;
 
@@ -58,14 +58,14 @@ Image::FormatList QLImage::loadableFormats()
                << "\nThe image loader can load the following directly:\n";
 
        QStrList qt_formats = QImageIO::inputFormats();
+
        QStrListIterator it(qt_formats);
 
        for (; it.current(); ++it) {
           lyxerr[Debug::GRAPHICS] << it.current() << endl;
 
                string ext = lowercase(it.current());
-        
+
                // special case
                if (ext == "jpeg")
                        ext = "jpg";
@@ -99,7 +99,8 @@ QLImage::QLImage()
 
 
 QLImage::QLImage(QLImage const & other)
-       : Image(other), pixmap_(other.pixmap_), xformed_pixmap_(other.xformed_pixmap_)
+       : Image(other), pixmap_(other.pixmap_),
+         xformed_pixmap_(other.xformed_pixmap_)
 {
 }
 
@@ -142,11 +143,11 @@ void QLImage::load(string const & filename)
                finishedLoading(false);
                return;
        }
-       lyxerr[Debug::GRAPHICS] << "just Loaded." << endl; 
+       lyxerr[Debug::GRAPHICS] << "just Loaded." << endl;
        xformed_pixmap_ = pixmap_;
        lyxerr[Debug::GRAPHICS] << "pixmap isNull " << pixmap_.isNull()
                << " xformed_pixmap_ isNull " << xformed_pixmap_.isNull() << endl;
-       finishedLoading(true); 
+       finishedLoading(true);
 }
 
 
@@ -158,9 +159,9 @@ bool QLImage::setPixmap(Params const & params)
                return false;
 
        lyxerr[Debug::GRAPHICS] << "setPixmap()" << endl;
+
 // FIXME
-#if 0  
+#if 0
        int color_key;
        switch (params.display) {
        case MonochromeDisplay:
@@ -187,7 +188,7 @@ bool QLImage::setPixmap(Params const & params)
                flimage_replace_pixel(image_, image_->fill_color, fill);
                image_->fill_color = fill;
        }
-#endif 
+#endif
 
        return true;
 }
@@ -239,7 +240,7 @@ void QLImage::rotate(Params const & params)
        // degree units.
 
        lyxerr[Debug::GRAPHICS] << "rotating image by " << params.angle << " degrees" << endl;
+
        QWMatrix m;
        m.rotate(-params.angle);
        xformed_pixmap_ = xformed_pixmap_.xForm(m);
index 16aad2453dd6c1b5eabcfe72b5bf28fd8e11380e..2e0f7f7f2512ed8e7e6f06de43d50e91fed7a5d4 100644 (file)
@@ -23,8 +23,7 @@
 
 namespace grfx {
 
-class QLImage : public Image
-{
+class QLImage : public Image {
 public:
        /// Access to this class is through this static method.
        static ImagePtr newImage();
@@ -71,7 +70,6 @@ public:
 
        /// Scale the image using params.
        virtual void scale(Params const & params);
-
 private:
        /// Access to the class is through newImage() and clone.
        QLImage();
index 197f39f3159a2349473ba2e255c98de2c0267751..07d6a085c527b12f15f6db33ea0d7b24a0485346 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 #pragma implementation
 #endif
 
-#include <iostream>
-#include <boost/scoped_array.hpp>
 #include "font_metrics.h"
-#include "support/lstrings.h" 
+#include "support/lstrings.h"
 #include "lyxrc.h"
 #include "debug.h"
 #include "LyXView.h"
 #include "qfont_loader.h"
 #include "QLPainter.h"
 #include "QLImage.h"
+
+#include <boost/scoped_array.hpp>
+
 #include <qpainter.h>
-#include <qbrush.h> 
+#include <qbrush.h>
 #include <qcolor.h>
 
+#include <iostream>
+
 using std::endl;
 
+
 QLPainter::QLPainter(QWorkArea & qwa)
        : Painter(), owner_(qwa), paint_check_(0)
 {
-       qp_.reset(new QPainter());
+       qp_.reset(new QPainter);
 }
 
 
@@ -49,7 +51,7 @@ void QLPainter::start()
                qp_->begin(owner_.getPixmap());
 }
 
+
 void QLPainter::end()
 {
        if (paint_check_ == 0) {
@@ -59,7 +61,7 @@ void QLPainter::end()
        }
 }
 
+
 int QLPainter::paperWidth() const
 {
        return owner_.workWidth();
@@ -71,29 +73,29 @@ int QLPainter::paperHeight() const
        return owner_.workHeight();
 }
 
-QPainter & QLPainter::setPen(LColor::color c, 
+
+QPainter & QLPainter::setPen(LColor::color c,
        Painter::line_style ls, Painter::line_width lw)
 {
        QPen pen = qp_->pen();
+
        pen.setColor(lcolor.getX11Name(c).c_str());
+
        switch (ls) {
                case line_solid: pen.setStyle(QPen::SolidLine); break;
                case line_onoffdash: pen.setStyle(QPen::DotLine); break;
        }
+
        switch (lw) {
                case line_thin: pen.setWidth(0); break;
                case line_thick: pen.setWidth(3); break;
        }
+
        qp_->setPen(pen);
        return *qp_;
 }
+
+
 Painter & QLPainter::point(int x, int y, LColor::color c)
 {
        setPen(c).drawPoint(x, y);
@@ -101,7 +103,7 @@ Painter & QLPainter::point(int x, int y, LColor::color c)
 }
 
 
-Painter & QLPainter::line(int x1, int y1, 
+Painter & QLPainter::line(int x1, int y1,
        int x2, int y2,
        LColor::color col,
        line_style ls,
@@ -112,7 +114,7 @@ Painter & QLPainter::line(int x1, int y1,
 }
 
 
-Painter & QLPainter::lines(int const * xp, int const * yp, 
+Painter & QLPainter::lines(int const * xp, int const * yp,
        int np,
        LColor::color col,
        line_style ls,
@@ -123,9 +125,7 @@ Painter & QLPainter::lines(int const * xp, int const * yp,
        // Must use new as np is not known at compile time.
        boost::scoped_array<QCOORD> points(new QCOORD[np * 2]);
 
-       int j = 0;
-       for (int i = 0; i < np; ++i) {
+       for (int i = 0, j = 0; i < np; ++i) {
                points[j++] = xp[i];
                points[j++] = yp[i];
        }
@@ -136,51 +136,50 @@ Painter & QLPainter::lines(int const * xp, int const * yp,
 }
 
 
-Painter & QLPainter::rectangle(int x, int y, 
+Painter & QLPainter::rectangle(int x, int y,
        int w, int h,
        LColor::color col,
        line_style ls,
        line_width lw)
 {
-       //lyxerr << "rectangle " << x<<","<<y << " " <<w<<","<<h<<endl; 
+       //lyxerr << "rectangle " << x<<","<<y << " " <<w<<","<<h<<endl;
        setPen(col, ls, lw).drawRect(x, y, w, h);
        return *this;
 }
 
 
-Painter & QLPainter::fillRectangle(int x, int y, 
+Painter & QLPainter::fillRectangle(int x, int y,
        int w, int h,
        LColor::color col)
 {
-       //lyxerr << "fillRectangle " << x<<","<<y << " " <<w<<","<<h<<endl; 
+       //lyxerr << "fillRectangle " << x<<","<<y << " " <<w<<","<<h<<endl;
        qp_->fillRect(x, y, w, h, QColor(lcolor.getX11Name(col).c_str()));
        return *this;
 }
 
 
-Painter & QLPainter::fillPolygon(int const * xp, int const * yp, 
+Painter & QLPainter::fillPolygon(int const * xp, int const * yp,
        int np, LColor::color col)
 {
        // Must use new as np is not known at compile time.
        boost::scoped_array<QCOORD> points(new QCOORD[np * 2]);
 
-       //if (1) return *this; 
-       int j = 0;
-       for (int i = 0; i < np; ++i) {
+       //if (1) return *this;
+
+       for (int i = 0, j = 0; i < np; ++i) {
                points[j++] = xp[i];
                points[j++] = yp[i];
        }
 
        setPen(col);
-       qp_->setBrush(lcolor.getX11Name(col).c_str()); 
+       qp_->setBrush(lcolor.getX11Name(col).c_str());
        qp_->drawPolygon(QPointArray(np, points.get()));
        qp_->setBrush(Qt::NoBrush);
 
        return *this;
 }
 
+
 Painter & QLPainter::arc(int x, int y,
        unsigned int w, unsigned int h,
        int a1, int a2, LColor::color col)
@@ -188,13 +187,13 @@ Painter & QLPainter::arc(int x, int y,
        lyxerr[Debug::GUI] << "arc: " << x<<","<<y
                << " " << w<<","<<h << ", angles "
                << a1 << " - " << a2 << endl;
-       // LyX usings 1/64ths degree, Qt usings 1/16th 
+       // LyX usings 1/64ths degree, Qt usings 1/16th
        setPen(col).drawArc(x, y, w, h, a1 / 4, a2 / 4);
-        return *this;
+       return *this;
 }
 
-Painter & QLPainter::image(int x, int y, 
+
+Painter & QLPainter::image(int x, int y,
        int w, int h,
        grfx::Image const & i)
 {
@@ -203,14 +202,14 @@ Painter & QLPainter::image(int x, int y,
 }
 
 
-Painter & QLPainter::text(int x, int y, 
+Painter & QLPainter::text(int x, int y,
        string const & s, LyXFont const & f)
 {
        return text(x, y, s.data(), s.length(), f);
 }
 
 
-Painter & QLPainter::text(int x, int y, 
+Painter & QLPainter::text(int x, int y,
        char c, LyXFont const & f)
 {
        char s[2] = { c, '\0' };
@@ -228,7 +227,7 @@ void QLPainter::smallCapsText(int x, int y,
        QFont const & qsmallfont = fontloader.get(smallfont);
        QFontMetrics const & qfontm = QFontMetrics(qfont);
        QFontMetrics const & qsmallfontm = QFontMetrics(qsmallfont);
+
        int tmpx = x;
        size_t ls = s.length();
        for (size_t i = 0; i < ls; ++i) {
@@ -245,8 +244,8 @@ void QLPainter::smallCapsText(int x, int y,
        }
 }
 
-Painter & QLPainter::text(int x, int y, 
+
+Painter & QLPainter::text(int x, int y,
        char const * s, size_t ls,
        LyXFont const & f)
 {
@@ -263,7 +262,7 @@ Painter & QLPainter::text(int x, int y,
                str[i] = QChar(encoding->ucs(s[i]));
        // HACK: QT3 refuses to show single compose characters
        if (ls = 1 && str[0].unicode() >= 0x05b0 && str[0].unicode() <= 0x05c2)
-               str = ' '+str;
+               str = ' ' + str;
 #else
        for (size_t i = 0; i < ls; ++i)
                str += QChar(encoding->ucs(s[i]));
@@ -285,6 +284,6 @@ Painter & QLPainter::text(int x, int y,
        if (f.underbar() == LyXFont::ON) {
                underline(f, x, y, font_metrics::width(s, ls, f));
        }
-       
+
        return *this;
 }
index 5a3b8375b2382c5cc8d6a95d1222eba4594eb677..b69bc8575baf8883115a56469b6f7a23d5dd58a1 100644 (file)
@@ -119,7 +119,6 @@ public:
        /// draw a char at position x, y (y is the baseline)
        virtual Painter & text(int x, int y,
                char c, LyXFont const & f);
-
 private:
        /// draw small caps text
        void smallCapsText(int x, int y,
index 4f99d1d44d003407f2ad536c21c74c90f6ef9af1..be720517a5621db003ccd3eda3709436b43def8d 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 #include "MenuBackend.h"
 #include "lyxfunc.h"
 #include "debug.h"
+
 #include "QtView.h"
+
 #include "QLPopupMenu.h"
 
 #include "support/lstrings.h"
 
 using std::pair;
 using std::make_pair;
+
 namespace {
+
 string const getLabel(MenuItem const & mi)
 {
        string const shortcut = mi.shortcut();
-       string label = mi.label();
+       string label = subst(mi.label(), "&", "&&");
 
-       label = subst(label, "&", "&&");
        if (shortcut.empty())
                return label;
+
        string::size_type pos = label.find(shortcut);
        if (pos == string::npos)
                return label;
        label.insert(pos, "&");
+
        return label;
 }
 
-} 
+} // namespace anon
 
 
-pair<int, QLPopupMenu *> createMenu(QMenuData * parent, MenuItem const * item, Menubar::Pimpl * owner, bool is_toplevel)
+pair<int, QLPopupMenu *>
+createMenu(QMenuData * parent, MenuItem const * item, Menubar::Pimpl * owner, bool is_toplevel)
 {
        // FIXME: leaks ??
        QLPopupMenu * pm = new QLPopupMenu(owner, item->submenuname(), is_toplevel);
        int id = parent->insertItem(getLabel(*item).c_str(), pm);
        return make_pair(id, pm);
 }
-QLPopupMenu::QLPopupMenu(Menubar::Pimpl * owner, string const & name, bool toplevel)
+
+
+QLPopupMenu::QLPopupMenu(Menubar::Pimpl * owner,
+                        string const & name, bool toplevel)
        : owner_(owner), name_(name)
 {
        if (toplevel)
@@ -67,27 +67,29 @@ QLPopupMenu::QLPopupMenu(Menubar::Pimpl * owner, string const & name, bool tople
        connect(this, SIGNAL(activated(int)),
                owner_->view(), SLOT(activated(int)));
 }
+
 
 bool QLPopupMenu::disabled(Menu * menu)
 {
        bool disable = true;
+
        Menu::const_iterator m = menu->begin();
        Menu::const_iterator end = menu->end();
        for (; m != end; ++m) {
-               if (m->kind() == MenuItem::Submenu && !disabled(m->submenu())) {
+               if (m->kind() == MenuItem::Submenu
+                   && !disabled(m->submenu())) {
                        disable = false;
                } else {
                        FuncStatus const status =
-                               owner_->view()->getLyXFunc().getStatus(m->action());
+                               owner_->view()->getLyXFunc()
+                               .getStatus(m->action());
                        if (!status.disabled())
                                disable = false;
                }
        }
        return disable;
 }
+
 
 void QLPopupMenu::populate(Menu * menu)
 {
@@ -112,12 +114,12 @@ void QLPopupMenu::populate(Menu * menu)
        }
 }
 
+
 void QLPopupMenu::showing()
 {
        clear();
        Menu tomenu;
        Menu const frommenu = owner_->backend().getMenu(name_);
        owner_->backend().expand(frommenu, tomenu, owner_->view()->buffer());
-       populate(&tomenu); 
+       populate(&tomenu);
 }
index 3a0726f95731dc20128d5d4cd1d40fee649b9267..b996780364f25a7a583aa5e7edd295fb45ac87b6 100644 (file)
@@ -30,21 +30,21 @@ class QLPopupMenu;
 
 /// create a sub-menu
 std::pair<int, QLPopupMenu *>
-       createMenu(QMenuData * parent, MenuItem const * item, Menubar::Pimpl * owner, bool is_toplevel = false);
+createMenu(QMenuData * parent, MenuItem const * item,
+          Menubar::Pimpl * owner, bool is_toplevel = false);
 
 /// a submenu
 class QLPopupMenu : public QPopupMenu {
        Q_OBJECT
 public:
-       QLPopupMenu(Menubar::Pimpl * owner, string const & name, bool toplevel);
+       QLPopupMenu(Menubar::Pimpl * owner,
+                   string const & name, bool toplevel);
 
        /// populate the menu
        void populate(Menu * menu);
-
 public slots:
        /// populate the toplevel menu and all children
        void showing();
-
 private:
        /// return true if the given submenu is disabled
        bool disabled(Menu * menu);
index 535ce1bf3d3c9ff363ed0461a2feb71aeb3c8ebd..4018ef82371d85f22f7b34b20df04921cf2d9b02 100644 (file)
@@ -3,13 +3,12 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
-#include <fstream>
 
 #ifdef __GNUG__
 #pragma implementation
@@ -18,6 +17,7 @@
 #include "LyXView.h"
 #include "gettext.h"
 #include "ControlLog.h"
+#include "Lsstream.h"
 
 #include <qtextview.h>
 #include <qpushbutton.h>
@@ -26,6 +26,8 @@
 #include "QLog.h"
 #include "Qt2BC.h"
 
+#include <fstream>
+
 using std::ifstream;
 using std::getline;
 
@@ -47,7 +49,8 @@ void QLog::build_dialog()
 
 void QLog::update_contents()
 {
-       std::pair<Buffer::LogType, string> const logfile = controller().logfile();
+       std::pair<Buffer::LogType, string> const & logfile =
+               controller().logfile();
 
        if (logfile.first == Buffer::buildlog)
                dialog_->setCaption(_("Build log"));
@@ -65,11 +68,8 @@ void QLog::update_contents()
                return;
        }
 
-       string text;
-       string line;
-
-       while (getline(ifstr, line))
-               text += line + "\n";
+       ostringstream ost;
+       ost << ifstr.rdbuf();
 
-       dialog_->logTV->setText(text.c_str());
+       dialog_->logTV->setText(ost.str().c_str());
 }
index 20bc00f4339a948d97394fba293b72b3091beebf..ce2d16166eda1861f6f3bb9e3f427903e11db3ff 100644 (file)
@@ -30,10 +30,9 @@ public:
        friend class QLogDialog;
        ///
        QLog();
-
 private:
        /// Apply changes
-       virtual void apply() {};
+       virtual void apply() {}
        /// update
        virtual void update_contents();
        /// build the dialog
index 8f72a76ee25fab8b4331f3007cdeffc489b612f7..a9a19dc0bc0991eb9b6ffc0f39c84c4894e087ac 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 #pragma implementation
 #endif
 
-#include <vector>
-
 #include "LyXView.h"
 #include "ControlLog.h"
 
 #include <qpushbutton.h>
 #include <qtextview.h>
+
 #include "QLogDialog.h"
 #include "QLog.h"
 
+#include <vector>
+
+
 QLogDialog::QLogDialog(QLog * form)
        : QLogDialogBase(0, 0, false, 0),
        form_(form)
index e5483990c62a02ba05ca744a1e488681667a6f5c..3d5ecc040544ca686a5eeff6f73a461adfbde391 100644 (file)
 
 class QLog;
 
-class QLogDialog : public QLogDialogBase
-{ Q_OBJECT
-
+class QLogDialog : public QLogDialogBase {
+       Q_OBJECT
 public:
        QLogDialog(QLog * form);
-
 protected slots:
        virtual void updateClicked();
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QLog * form_;
 };
index 042da02ce99c32d8ba1c7453835ee6b35edb2305..afe75d39a923b1365f62255327e3b60ce8346acd 100644 (file)
@@ -4,7 +4,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Asger and Juergen
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 #include "QLyXKeySym.h"
 #include "qlkey.h"
 #include "debug.h"
+
 #include <qevent.h>
 
 using std::endl;
 
+
 QLyXKeySym::QLyXKeySym()
        : LyXKeySym(), key_(0)
 {
 }
+
+
 void QLyXKeySym::set(QKeyEvent * ev)
 {
        key_ = ev->key();
-       text_ = ev->text(); 
+       text_ = ev->text();
 }
+
 
 void QLyXKeySym::init(string const & symbolname)
 {
@@ -43,12 +44,12 @@ void QLyXKeySym::init(string const & symbolname)
        lyxerr[Debug::KEY] << "Init key to " << key_ << ", " << text_ << endl;
 }
 
+
 bool QLyXKeySym::isOK() const
 {
        return ! key_ == 0;
 }
+
 
 bool QLyXKeySym::isModifier() const
 {
@@ -68,17 +69,20 @@ string QLyXKeySym::getSymbolName() const
        return sym;
 }
 
+
 char QLyXKeySym::getISOEncoded() const
 {
        lyxerr[Debug::KEY] << "getISO returning " << text_.latin1()[0] << endl;
-       return text_.latin1()[0]; 
+       return text_.latin1()[0];
 }
 
-bool QLyXKeySym::operator==(LyXKeySym const & k) const
+
+bool operator==(LyXKeySym const & k1, LyXKeySym const & k2)
 {
-       QLyXKeySym const & o = static_cast<QLyXKeySym const &>(k);
-       // ignore text_ ! 
-       return o.key_ == key_;
+       // note we ignore text_ here (non-strict ==), because
+       // text_ is not filled out by keymap initialisation
+
+       return static_cast<QLyXKeySym const &>(k1).key()
+               == static_cast<QLyXKeySym const &>(k2).key();
+
 }
index 76355de577761da13766da1461f689c2f4c9bbcd..e104b262f9720206966a1c92d0b05645c2cfbcc7 100644 (file)
@@ -56,9 +56,10 @@ public:
         * This relies on user to use the right encoding.
         */
        virtual char getISOEncoded() const;
-
-       virtual bool operator==(LyXKeySym const & k) const;
-
+       ///
+       int key() const {
+               return key_;
+       }
 private:
        /// the Qt sym value
        int key_;
index b0b2346848dce6c6e5f1f6a4c963648140550f7c..a031238b948dac45dfda18190ca1a9f65dd42ba0 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 #endif
 
 #include "debug.h"
+
 #include "commandtags.h"
 #include "funcrequest.h"
 #include "LyXView.h"
 #include "BufferView.h"
+
 #include "QMathDialog.h"
 #include "QMath.h"
 
 #include "iconpalette.h"
 
-// FIXME temporary HACK ! 
+// needless to say, this can't last for long
+extern BufferView * current_view;
+
+
+// FIXME temporary HACK !
 void createMathPanel()
 {
-       static QMath * dialog = 0; 
+       static QMath * dialog = 0;
        if (!dialog) {
-               dialog = new QMath();
+               dialog = new QMath;
                dialog->build_dialog();
        }
        dialog->do_show();
 }
+
+
 QMath::QMath()
 {
 }
@@ -47,16 +51,13 @@ void QMath::do_show()
 {
        dialog_->show();
 }
+
+
 void QMath::build_dialog()
 {
        dialog_ = new QMathDialog(this);
 }
 
-// needless to say, this can't last for long
-extern BufferView * current_view;
 
 void QMath::subscript()
 {
@@ -74,7 +75,7 @@ void QMath::insert(string const & name)
 {
        current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATH, '\\' + name));
 }
+
 
 void QMath::insertCubeRoot()
 {
@@ -89,13 +90,13 @@ void QMath::insertMatrix()
        current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATRIX, "2 2"));
 }
 
+
 void QMath::insertDelim(string const & str)
 {
        current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DELIM, str));
 }
 
+
 void QMath::toggleDisplay()
 {
        current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DISPLAY));
index 0856de37650c3fd89bfbbb959133495e84d52ed3..5fd1763d721b996a5bf16b512413aae4b1993a57 100644 (file)
@@ -20,8 +20,7 @@
 
 class QMathDialog;
 
-class QMath
-{
+class QMath {
 public:
        friend class QMathDialog;
 
@@ -53,7 +52,6 @@ public:
 
        /// switch between display and inline
        void toggleDisplay();
-
 private:
        /// Apply changes
        virtual void apply() {}
index 26f4e75a47d9f632a27e6d0177ca82322370ea51..99a612e4c842ea43ec403f6cece6331ae6a1d88a 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 #include "support/filetools.h"
 #include "gettext.h"
 #include "debug.h"
+
 #include "QMathDialog.h"
 #include "QMath.h"
 
 #include "ControlMath.h"
 #include "iconpalette.h"
 #include "QDelimiterDialog.h"
+
 #include <qapplication.h>
 #include <qwidgetstack.h>
 #include <qcombobox.h>
 #include <qlayout.h>
 #include <qpopupmenu.h>
 #include <qcursor.h>
+
 using std::min;
 using std::max;
 using std::endl;
+
+
 class QScrollViewSingle : public QScrollView {
 public:
        QScrollViewSingle(QWidget * p)
@@ -50,53 +51,54 @@ public:
                setBackgroundMode(PaletteBackground);
                viewport()->setBackgroundMode(PaletteBackground);
        }
+
        void setChild(QWidget * w) {
-               w_ = w; 
+               w_ = w;
                setMinimumWidth(verticalScrollBar()->width() + w_->width() + 4);
                addChild(w_);
        }
-
 protected:
        virtual void resizeEvent(QResizeEvent * e) {
                QScrollView::resizeEvent(e);
                if (!w_)
                        return;
+
                w_->resize(viewport()->width(), w_->height());
                // force the resize to get accurate scrollbars
                qApp->processEvents();
                resizeContents(w_->width(), w_->height());
        }
-
 private:
-       QWidget * w_; 
+       QWidget * w_;
 };
-namespace { 
-       char const ** panels[] = {
-               latex_bop, latex_varsz, latex_brel, latex_greek, latex_arrow,
-               latex_dots, latex_deco, latex_misc, latex_ams_ops,
-               latex_ams_rel, latex_ams_nrel, latex_ams_arrows,
-               latex_ams_misc
-       };
-       int const nr_panels = sizeof(panels)/sizeof(panels[0]);
+
+namespace {
+
+char const ** panels[] = {
+       latex_bop, latex_varsz, latex_brel, latex_greek, latex_arrow,
+       latex_dots, latex_deco, latex_misc, latex_ams_ops,
+       latex_ams_rel, latex_ams_nrel, latex_ams_arrows,
+       latex_ams_misc
+};
+
+int const nr_panels = sizeof(panels)/sizeof(panels[0]);
 
 bool panel_initialised[nr_panels];
-}
+
+} // namespace anon
+
+
 QMathDialog::QMathDialog(QMath * form)
        : QMathDialogBase(0, 0, false, 0),
        form_(form)
 {
-       connect(symbolsCO, SIGNAL(activated(int)), symbolsWS, SLOT(raiseWidget(int))); 
+       connect(symbolsCO, SIGNAL(activated(int)), symbolsWS, SLOT(raiseWidget(int)));
 
        for (int i = 0; *function_names[i]; ++i) {
                functionsLB->insertItem(function_names[i]);
        }
-       for (int i = 0; i < nr_panels; ++i) { 
+
+       for (int i = 0; i < nr_panels; ++i) {
                QScrollViewSingle * view = new QScrollViewSingle(symbolsWS);
                symbolsWS->addWidget(view, i);
        }
@@ -105,17 +107,17 @@ QMathDialog::QMathDialog(QMath * form)
        symbolsWS->raiseWidget(0);
        addPanel(0);
        panel_initialised[0] = true;
+
        connect(symbolsWS, SIGNAL(aboutToShow(int)), this, SLOT(showingPanel(int)));
+
        QPopupMenu * m = new QPopupMenu(spacePB);
        m->setCaption(_("LyX: Insert space"));
        m->insertTearOffHandle();
-       m->insertItem(_("Thin space     \\,"), 1); 
-       m->insertItem(_("Medium space   \\:"), 2); 
-       m->insertItem(_("Thick space    \\;"), 3); 
-       m->insertItem(_("Quadratin space        \\quad"), 4); 
-       m->insertItem(_("Double quadratin space \\qquad"), 5); 
+       m->insertItem(_("Thin space     \\,"), 1);
+       m->insertItem(_("Medium space   \\:"), 2);
+       m->insertItem(_("Thick space    \\;"), 3);
+       m->insertItem(_("Quadratin space        \\quad"), 4);
+       m->insertItem(_("Double quadratin space \\qquad"), 5);
        m->insertItem(_("Negative space \\!"), 6);
        connect(m, SIGNAL(activated(int)), this, SLOT(insertSpace(int)));
        spacePB->setPopup(m);
@@ -126,7 +128,7 @@ QMathDialog::QMathDialog(QMath * form)
        m->insertItem(_("Square root    \\sqrt"), 1);
        m->insertItem(_("Cube root      \\root"), 2);
        m->insertItem(_("Other root     \\root"), 3);
-       connect(m, SIGNAL(activated(int)), this, SLOT(insertRoot(int))); 
+       connect(m, SIGNAL(activated(int)), this, SLOT(insertRoot(int)));
        sqrtPB->setPopup(m);
 
        m = new QPopupMenu(stylePB);
@@ -163,13 +165,13 @@ void QMathDialog::showingPanel(int num)
 
        addPanel(num);
 
-       // Qt needs to catch up. Dunno why. 
+       // Qt needs to catch up. Dunno why.
        qApp->processEvents();
+
        panel_initialised[num] = true;
 }
 
+
 IconPalette * QMathDialog::makePanel(QWidget * parent, char const ** entries)
 {
        IconPalette * p = new IconPalette(parent);
@@ -178,11 +180,11 @@ IconPalette * QMathDialog::makePanel(QWidget * parent, char const ** entries)
                p->add(QPixmap(xpm_name.c_str()), entries[i], string("\\") + entries[i]);
        }
        connect(p, SIGNAL(button_clicked(string)), this, SLOT(symbol_clicked(string)));
+
        return p;
 }
 
+
 void QMathDialog::addPanel(int num)
 {
        QScrollViewSingle * view = static_cast<QScrollViewSingle*>(symbolsWS->visibleWidget());
@@ -190,64 +192,64 @@ void QMathDialog::addPanel(int num)
        view->setChild(p);
 }
 
-void QMathDialog::symbol_clicked(string str)
+
+void QMathDialog::symbol_clicked(string const & str)
 {
        form_->insert(str);
 }
 
+
 void QMathDialog::fracClicked()
 {
        form_->insert("frac");
 }
+
 
 void QMathDialog::delimiterClicked()
 {
-       // FIXME: leak 
+       // FIXME: leak
        QDelimiterDialog * d = new QDelimiterDialog(form_);
        d->show();
 }
 
+
 void QMathDialog::expandClicked()
 {
        int const id = symbolsWS->id(symbolsWS->visibleWidget());
        IconPalette * p = makePanel(0, panels[id]);
-       string s = "LyX: "; 
+       string s = "LyX: ";
        s += symbolsCO->text(id).latin1();
        p->setCaption(s.c_str());
        p->resize(40 * 5, p->height());
        p->show();
        p->setMaximumSize(p->width(), p->height());
 }
+
+
 void QMathDialog::functionSelected(const QString & str)
 {
-       form_->insert(str.latin1()); 
+       form_->insert(str.latin1());
 }
 
+
 void QMathDialog::matrixClicked()
 {
        form_->insertMatrix();
 }
 
+
 void QMathDialog::equationClicked()
 {
        form_->toggleDisplay();
 }
 
+
 void QMathDialog::subscriptClicked()
 {
        form_->subscript();
 }
 
+
 void QMathDialog::superscriptClicked()
 {
        form_->superscript();
@@ -268,7 +270,7 @@ void QMathDialog::insertSpace(int id)
        form_->insert(str);
 }
 
+
 void QMathDialog::insertRoot(int id)
 {
        switch (id) {
@@ -284,7 +286,7 @@ void QMathDialog::insertRoot(int id)
        }
 }
 
+
 void QMathDialog::insertStyle(int id)
 {
        string str;
@@ -293,11 +295,11 @@ void QMathDialog::insertStyle(int id)
                case 2: str = "textstyle"; break;
                case 3: str = "scriptstyle"; break;
                case 4: str = "scriptscriptstyle"; break;
-       } 
+       }
        form_->insert(str);
 }
 
+
 void QMathDialog::insertFont(int id)
 {
        string str;
index 72e1753ec0dddb808dcaadd5a547a740ddd7167a..fdf4763ab1a1142fd5bfaa0bd576289f317c52df 100644 (file)
@@ -25,20 +25,18 @@ class IconPalette;
 class QMathDialog : public QMathDialogBase
 {
        Q_OBJECT
-
 public:
        QMathDialog(QMath * form);
-
 public slots:
        virtual void delimiterClicked();
        virtual void expandClicked();
        virtual void fracClicked();
-       virtual void functionSelected(const QString &);
+       virtual void functionSelected(QString const &);
        virtual void matrixClicked();
        virtual void subscriptClicked();
        virtual void superscriptClicked();
        virtual void equationClicked();
-       void symbol_clicked(string str);
+       void symbol_clicked(string const & str);
        void insertSpace(int id);
        void insertRoot(int id);
        void insertStyle(int id);
@@ -46,10 +44,8 @@ public slots:
 
        /// about to show a symbol panel
        void showingPanel(int);
-
 protected:
        //needed ? virtual void closeEvent(QCloseEvent * e);
-
 private:
        /// make a symbol panel
        IconPalette * makePanel(QWidget * parent, char const ** entries);
index 70631991b77915b2d5084ddc77ad988a142831ce..95b996ea0a5823009416399c98179b7e6991e569 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 #include "QMinipageDialog.h"
 #include "Qt2BC.h"
 #include "lengthcombo.h"
+
 #include <qpushbutton.h>
 #include <qcombobox.h>
 #include <qlineedit.h>
 
 typedef Qt2CB<ControlMinipage, Qt2DB<QMinipageDialog> > base_class;
 
+
 QMinipage::QMinipage()
        : base_class(_("Minipage"))
 {
@@ -54,52 +55,63 @@ void QMinipage::build_dialog()
 
 void QMinipage::apply()
 {
-       double value = strToDbl(dialog_->widthED->text().latin1());
+       double const value = strToDbl(dialog_->widthED->text().latin1());
        LyXLength::UNIT unit = dialog_->unitsLC->currentLengthItem();
        if (string(dialog_->widthED->text().latin1()).empty())
                unit = LyXLength::UNIT_NONE;
 
-       controller().params().pageWidth = LyXLength(value, unit);
+       MinipageParams & params = controller().params();
+
+       params.pageWidth = LyXLength(value, unit);
 
        switch (dialog_->valignCO->currentItem()) {
        case 0:
-               controller().params().pos = InsetMinipage::top;
+               params.pos = InsetMinipage::top;
                break;
        case 1:
-               controller().params().pos = InsetMinipage::center;
+               params.pos = InsetMinipage::center;
                break;
        case 2:
-               controller().params().pos = InsetMinipage::bottom;
+               params.pos = InsetMinipage::bottom;
                break;
        }
 }
 
 
 namespace {
-       string const numtostr(double val) {
-               string a(tostr(val));
-               if (a == "0")
-                       a = "";
-               return a;
-       }
+
+string const numtostr(double val)
+{
+       string a(tostr(val));
+       if (a == "0")
+               a.erase();
+       return a;
+}
+
 } // namespace anon
 
 
 void QMinipage::update_contents()
 {
-       LyXLength len(controller().params().pageWidth);
+       MinipageParams const & params = controller().params();
+
+       LyXLength len(params.pageWidth);
        dialog_->widthED->setText(numtostr(len.value()).c_str());
        dialog_->unitsLC->setCurrentItem(len.unit());
-       lyxerr << "width " << numtostr(len.value()).c_str() << " units " << len.unit() << std::endl;
+       lyxerr << "width " << numtostr(len.value())
+              << " units " << len.unit() << std::endl;
 
        int item = 0;
-       switch (controller().params().pos) {
-               case InsetMinipage::center:
-                       item = 1;
-                       break;
-               case InsetMinipage::bottom:
-                       item = 2;
-                       break;
+       switch (params.pos) {
+       case InsetMinipage::top:
+               item = 0;
+               break;
+       case InsetMinipage::center:
+               item = 1;
+               break;
+       case InsetMinipage::bottom:
+               item = 2;
+               break;
        }
        dialog_->valignCO->setCurrentItem(item);
 }
index 6684d7c4139b9e35f5e388985be6717caf3e2466..e686f22c4d129a076d161746522413d81fc3bf2a 100644 (file)
@@ -30,7 +30,6 @@ public:
        friend class QMinipageDialog;
        ///
        QMinipage();
-
 private:
        /// Apply changes
        virtual void apply();
index 626fa0e39b65419f5fbe79dd51ab3e9a0ead9779..abb4f15935cbe4d1dbddd837e66a3c1c73115653 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -14,8 +14,6 @@
 #pragma implementation
 #endif
 
-#include <vector>
-
 #include "ControlMinipage.h"
 
 #include "QMinipage.h"
@@ -25,6 +23,9 @@
 #include <qtextview.h>
 #include "lengthcombo.h"
 
+#include <vector>
+
+
 QMinipageDialog::QMinipageDialog(QMinipage * form)
        : QMinipageDialogBase(0, 0, false, 0),
        form_(form)
index abe7111b91815c7e13ffffc670e1b39a838fe39b..4b46da3993335df3dbce2244c9bd006cd3fa538d 100644 (file)
 
 class QMinipage;
 
-class QMinipageDialog : public QMinipageDialogBase
-{ Q_OBJECT
-
+class QMinipageDialog : public QMinipageDialogBase {
+       Q_OBJECT
 public:
        QMinipageDialog(QMinipage * form);
-
 protected slots:
        virtual void change_adaptor();
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QMinipage * form_;
 };
index fe15456411fbf1a64f6e103e04c48e60804556af..bceb180cc3721e93f07f29b55651b10b1db9be4f 100644 (file)
@@ -29,8 +29,6 @@
 #include "support/lstrings.h"
 #include "support/LAssert.h"
 
-#include <functional>
-
 #include <qcombobox.h>
 #include <qlineedit.h>
 #include <qcheckbox.h>
 #include <qtabwidget.h>
 #include <qbuttongroup.h>
 
+#include <functional>
+
 using std::vector;
 using std::bind2nd;
 using std::remove_if;
 
 typedef Qt2CB<ControlParagraph, Qt2DB<QParagraphDialog> > base_class;
 
+
 QParagraph::QParagraph()
        : base_class(_("Paragraph Layout"))
 {}
 
+
 void QParagraph::build_dialog()
 {
        // the tabbed folder
@@ -56,8 +58,9 @@ void QParagraph::build_dialog()
        // Create the contents of the unit choices
        // Don't include the "%" terms...
        units_ = getLatexUnits();
-       vector<string>::iterator del = remove_if(units_.begin(), units_.end(),
-                                                bind2nd(contains_functor(), "%"));
+       vector<string>::iterator del =
+               remove_if(units_.begin(), units_.end(),
+                         bind2nd(contains_functor(), "%"));
        units_.erase(del, units_.end());
 
        for (vector<string>::const_iterator it = units_.begin();
@@ -74,6 +77,7 @@ void QParagraph::build_dialog()
        bc().addReadOnly(dialog_->paragraphTab);
 }
 
+
 namespace {
 
 VSpace setVSpaceFromWidgets(int spacing,
@@ -123,12 +127,15 @@ VSpace setVSpaceFromWidgets(int spacing,
 
 } // namespace anon
 
+
 void QParagraph::apply()
 {
-       /* SPACING ABOVE */
+       ParagraphParameters & params = controller().params();
+
+       // SPACING ABOVE
        // If a vspace kind is "Length" but there's no text in
        // the input field, reset the kind to "None".
-       if (dialog_->spacingAbove->currentItem()==5
+       if (dialog_->spacingAbove->currentItem() == 5
            && dialog_->valueAbove->text().isEmpty())
                dialog_->spacingAbove->setCurrentItem(0);
 
@@ -138,11 +145,10 @@ void QParagraph::apply()
                                     string(dialog_->unitAbove->currentText()),
                                     dialog_->keepAbove->isChecked());
 
+       params.spaceTop(space_top);
 
-       controller().params().spaceTop(space_top);
-
-       /* SPACING BELOW */
-       if (dialog_->spacingBelow->currentItem()==5
+       // SPACING BELOW
+       if (dialog_->spacingBelow->currentItem() == 5
            && dialog_->valueBelow->text().isEmpty())
                dialog_->spacingBelow->setCurrentItem(0);
 
@@ -152,9 +158,9 @@ void QParagraph::apply()
                             string(dialog_->unitBelow->currentText()),
                             dialog_->keepBelow->isChecked());
 
-       controller().params().spaceBottom(space_bottom);
+       params.spaceBottom(space_bottom);
 
-       /* alignment */
+       // alignment
        LyXAlignment align;
        switch (dialog_->align->currentItem()) {
        case 0:
@@ -172,9 +178,9 @@ void QParagraph::apply()
        default:
                align = LYX_ALIGN_BLOCK;
        }
-       controller().params().align(align);
+       params.align(align);
 
-       /* get spacing */
+       // get spacing
        Spacing::Space linespacing = Spacing::Default;
        string other;
        switch (dialog_->linespacing->currentItem()) {
@@ -197,20 +203,21 @@ void QParagraph::apply()
        }
 
        Spacing const spacing(linespacing, other);
-       controller().params().spacing(spacing);
-
-       /* lines and pagebreaks */
-       controller().params().lineTop(dialog_->lineAbove->isChecked());
-       controller().params().lineBottom(dialog_->lineBelow->isChecked());
-       controller().params().pagebreakTop(dialog_->pagebreakAbove->isChecked());
-       controller().params().pagebreakBottom(dialog_->pagebreakBelow->isChecked());
-       /* label width */
-       controller().params().labelWidthString(string(dialog_->labelWidth->text()));
-       /* indendation */
-       controller().params().noindent(dialog_->noindent->isChecked());
+       params.spacing(spacing);
+
+       // lines and pagebreaks
+       params.lineTop(dialog_->lineAbove->isChecked());
+       params.lineBottom(dialog_->lineBelow->isChecked());
+       params.pagebreakTop(dialog_->pagebreakAbove->isChecked());
+       params.pagebreakBottom(dialog_->pagebreakBelow->isChecked());
+       // label width
+       params.labelWidthString(string(dialog_->labelWidth->text()));
+       // indendation
+       params.noindent(dialog_->noindent->isChecked());
 
 }
 
+
 namespace {
 
 void setWidgetsFromVSpace(VSpace const & space,
@@ -248,23 +255,27 @@ void setWidgetsFromVSpace(VSpace const & space,
                value->setEnabled(true);
                unit->setEnabled(true);
                string length = space.length().asString();
-               string const default_unit = (lyxrc.default_papersize>3) ? "cm" : "in";
+               string const default_unit =
+                       (lyxrc.default_papersize > 3) ? "cm" : "in";
                string supplied_unit = default_unit;
                LyXLength len(length);
-               if ((isValidLength(length) || isStrDbl(length)) && !len.zero()) {
+               if ((isValidLength(length)
+                    || isStrDbl(length)) && !len.zero()) {
                        ostringstream buffer;
                        buffer << len.value();
                        length = buffer.str();
-                       supplied_unit = subst(stringFromUnit(len.unit()),"%","%%");
+                       supplied_unit = subst(stringFromUnit(len.unit()),
+                                             "%", "%%");
                }
+
                int unit_item = 0;
                int i = 0;
                for (vector<string>::const_iterator it = units_.begin();
                     it != units_.end(); ++it) {
-                       if (*it==default_unit) {
+                       if (*it == default_unit) {
                                unit_item = i;
                        }
-                       if (*it==supplied_unit) {
+                       if (*it == supplied_unit) {
                                unit_item = i;
                                break;
                        }
@@ -280,17 +291,20 @@ void setWidgetsFromVSpace(VSpace const & space,
 
 } // namespace anon
 
+
 void QParagraph::update_contents()
 {
-       /* label width */
-       string labelwidth = controller().params().labelWidthString();
+       ParagraphParameters const & params = controller().params();
+
+       // label width
+       string const & labelwidth = params.labelWidthString();
        dialog_->labelWidth->setText(labelwidth.c_str());
        dialog_->labelwidthGB->setEnabled(
                labelwidth != _("Senseless with this layout!"));
 
-       /* alignment */
+       // alignment
        int i;
-       switch (controller().params().align()) {
+       switch (params.align()) {
        case LYX_ALIGN_LEFT:
                i = 1;
                break;
@@ -314,16 +328,16 @@ void QParagraph::update_contents()
        dialog_->pagebreakAbove->setEnabled(!ininset);
        dialog_->pagebreakBelow->setEnabled(!ininset);
 
-       /* lines, pagebreaks and indent */
-       dialog_->lineAbove->setChecked(controller().params().lineTop());
-       dialog_->lineBelow->setChecked(controller().params().lineBottom());
-       dialog_->pagebreakAbove->setChecked(controller().params().pagebreakTop());
-       dialog_->pagebreakBelow->setChecked(controller().params().pagebreakBottom());
-       dialog_->noindent->setChecked(controller().params().noindent());
+       // lines, pagebreaks and indent
+       dialog_->lineAbove->setChecked(params.lineTop());
+       dialog_->lineBelow->setChecked(params.lineBottom());
+       dialog_->pagebreakAbove->setChecked(params.pagebreakTop());
+       dialog_->pagebreakBelow->setChecked(params.pagebreakBottom());
+       dialog_->noindent->setChecked(params.noindent());
 
-       /* linespacing */
+       // linespacing
        int linespacing;
-       Spacing const space = controller().params().spacing();
+       Spacing const & space = params.spacing();
        switch (space.getSpace()) {
        case Spacing::Single:
                linespacing = 1;
@@ -351,20 +365,20 @@ void QParagraph::update_contents()
                dialog_->linespacingValue->setEnabled(false);
        }
 
-       /* vspace top */
-       setWidgetsFromVSpace(controller().params().spaceTop(),
+       // vspace top
+       setWidgetsFromVSpace(params.spaceTop(),
                             dialog_->spacingAbove,
                             dialog_->valueAbove,
                             dialog_->unitAbove,
                             dialog_->keepAbove,units_);
 
-       /* vspace bottom */
-       setWidgetsFromVSpace(controller().params().spaceBottom(),
+       // vspace bottom
+       setWidgetsFromVSpace(params.spaceBottom(),
                             dialog_->spacingBelow,
                             dialog_->valueBelow,
                             dialog_->unitBelow,
                             dialog_->keepBelow,units_);
 
-       /* no indent */
-       dialog_->noindent->setChecked(controller().params().noindent());
+       // no indent
+       dialog_->noindent->setChecked(params.noindent());
 }
index 30e789b60d790360752764a16c8812b1f2a17313..f51890f76e8d86d2da1342098c889da31c5fcbe7 100644 (file)
@@ -24,14 +24,13 @@ class ControlParagraph;
 class QParagraphDialog;
 
 
-class QParagraph :
-       public Qt2CB<ControlParagraph, Qt2DB<QParagraphDialog> >
+class QParagraph
+       public Qt2CB<ControlParagraph, Qt2DB<QParagraphDialog> >
 {
+public:
        friend class QParagraphDialog;
 
-public:
        QParagraph();
-
 private:
        /// Apply changes
        virtual void apply();
index 345a87c611c8c06334e8b802f85205ac70679e7a..6aaa7d5582bd123be6d758b2be98770aa1056146 100644 (file)
@@ -27,6 +27,7 @@
 
 using std::vector;
 
+
 QParagraphDialog::QParagraphDialog(QParagraph * form)
        : QParagraphDialogBase(0, 0, false, 0),
        form_(form)
@@ -45,6 +46,7 @@ QParagraphDialog::QParagraphDialog(QParagraph * form)
        //valueBelow->setValidator(new QDoubleValidator(valueBelow));
 }
 
+
 void QParagraphDialog::closeEvent(QCloseEvent * e)
 {
        form_->slotWMHide();
@@ -57,6 +59,7 @@ void QParagraphDialog::change_adaptor()
        form_->changed();
 }
 
+
 void QParagraphDialog::enableAbove(int)
 {
        bool const enable = spacingAbove->currentItem()==6;
@@ -65,6 +68,7 @@ void QParagraphDialog::enableAbove(int)
 
 }
 
+
 void QParagraphDialog::enableBelow(int)
 {
        bool const enable = spacingBelow->currentItem()==6;
@@ -72,6 +76,7 @@ void QParagraphDialog::enableBelow(int)
        unitBelow->setEnabled(enable);
 }
 
+
 void QParagraphDialog::enableLinespacingValue(int)
 {
        bool const enable = linespacing->currentItem()==4;
index cb8924d98845664670b920e5db2443c8a0618752..2159f5a18401fbf12db81e5ab2a8acb9eff569a4 100644 (file)
 
 class QParagraph;
 
-class QParagraphDialog : public QParagraphDialogBase
-{
+class QParagraphDialog : public QParagraphDialogBase {
        Q_OBJECT
 public:
        QParagraphDialog(QParagraph * form);
-
 protected:
        void closeEvent (QCloseEvent * e);
 private:
        QParagraph * form_;
-
 protected slots:
        void change_adaptor();
        void enableAbove(int);
index 66af4aff4241da1d94089c66916d919a099b26a9..719a5af6d024e5be13ccfbf8b6bb96f67c54ee96 100644 (file)
@@ -3,13 +3,12 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
-#include <fstream>
 
 #ifdef __GNUG__
 #pragma implementation
@@ -18,7 +17,7 @@
 #include "gettext.h"
 #include "LyXView.h"
 #include "ControlPreamble.h"
+
 #include "QPreamble.h"
 #include "QPreambleDialog.h"
 #include "Qt2BC.h"
@@ -28,6 +27,7 @@
 
 typedef Qt2CB<ControlPreamble, Qt2DB<QPreambleDialog> > base_class;
 
+
 QPreamble::QPreamble()
        : base_class(_("LaTeX Preamble"))
 {
index 30257b757dac8ccc699ed61b30a654ced6e70d7a..d2132d8b76c5a88459dcdff166ce4cd7b5a0b5ec 100644 (file)
@@ -30,7 +30,6 @@ public:
        friend class QPreambleDialog;
        ///
        QPreamble();
-
 private:
        /// Apply changes
        virtual void apply();
index e1eda7b5965187be3f2a3637d4074da28f635821..35311067e4303f16319f93dd6edf3b490d5ca833 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -14,8 +14,7 @@
 #pragma implementation
 #endif
 
-#include <fstream>
-
+#include "Lsstream.h"
 #include "support/lyxlib.h"
 #include "support/forkedcall.h"
 #include "support/filetools.h"
@@ -30,6 +29,8 @@
 #include <qmultilineedit.h>
 #include <qinputdialog.h>
 
+#include <fstream>
+
 using std::getline;
 
 QPreambleDialog::QPreambleDialog(QPreamble * form)
@@ -63,7 +64,7 @@ void QPreambleDialog::editClicked()
        // find an editor
        string editor = GetEnv("EDITOR");
        if (editor.empty()) {
-               static string lastentry = "";
+               static string lastentry;
                editor = QInputDialog::getText(
                        _("Enter editor program"), _("Editor"), QLineEdit::Normal,
                        lastentry.c_str()).latin1();
@@ -101,14 +102,12 @@ void QPreambleDialog::editClicked()
                return;
        }
 
-       string newtext;
-       string line;
-
-       while (getline(in, line)) {
-               newtext += line + "\n";
-       }
+       ostringstream newtext;
+       newtext << in.rdbuf();
 
+       // close the files before we delete the file
        in.close();
+
        lyx::unlink(filename);
-       preambleLE->setText(newtext.c_str());
+       preambleLE->setText(newtext.str().c_str());
 }
index 0e6e078dfc3db1da74a417b6ce52b92b31d3950c..8b5292c37dc1ea6395ecfffdf0739883da97c65a 100644 (file)
 
 class QPreamble;
 
-class QPreambleDialog : public QPreambleDialogBase
-{ Q_OBJECT
-
+class QPreambleDialog : public QPreambleDialogBase {
+       Q_OBJECT
 public:
        QPreambleDialog(QPreamble * form);
-
 protected slots:
        virtual void editClicked();
        virtual void change_adaptor();
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QPreamble * form_;
 };
index 4a1b030a56f8bc9265d23c6b48c5b7d5dbce14bd..bff49751814a83c7e53719c34b6002d8067e87e6 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  * \author Edwin Leuven
  *
  * Full author contact details are available in file CREDITS
 #include <qpushbutton.h>
 
 // FIXME FIXME QPrintDialog is getting destructed twice !!!!
+
+
 typedef Qt2CB<ControlPrint, Qt2DB<QPrintDialog> > base_class;
 
+
 QPrint::QPrint()
        : base_class(_("Print"))
 {
@@ -57,7 +59,7 @@ void QPrint::update_contents()
        // only reset params if a different buffer
        if (!pp.file_name.empty() && pp.file_name == dialog_->fileED->text().latin1())
                return;
+
        dialog_->printerED->setText(pp.printer_name.c_str());
        dialog_->fileED->setText(pp.file_name.c_str());
 
@@ -68,19 +70,19 @@ void QPrint::update_contents()
        dialog_->reverseCB->setChecked(pp.reverse_order);
 
        dialog_->copiesSB->setValue(pp.count_copies);
+
        dialog_->oddCB->setChecked(pp.odd_pages);
        dialog_->evenCB->setChecked(pp.even_pages);
+
        dialog_->collateCB->setChecked(pp.sorted_copies);
+
        if (pp.all_pages) {
                dialog_->allRB->setChecked(true);
                return;
        }
 
        dialog_->rangeRB->setChecked(true);
+
        QString s;
        s.setNum(pp.from_page);
        dialog_->fromED->setText(s);
@@ -98,9 +100,9 @@ void QPrint::apply()
        PrinterParams const pp(t,
                dialog_->printerED->text().latin1(),
                dialog_->fileED->text().latin1(),
-               dialog_->allRB->isChecked(), 
+               dialog_->allRB->isChecked(),
                dialog_->fromED->text().toUInt(),
-               dialog_->toED->text().toUInt(), 
+               dialog_->toED->text().toUInt(),
                dialog_->oddCB->isChecked(),
                dialog_->evenCB->isChecked(),
                dialog_->copiesSB->text().toUInt(),
index cb8e5149cfd2a863f0d67211677d754cfe4a33cd..f036a15a2acde8b1bfac8c3e48a3b3fe0bb106ee 100644 (file)
@@ -31,7 +31,6 @@ public:
        friend class QPrintDialog;
        ///
        QPrint();
-
 private:
        /// Apply changes
        virtual void apply();
index 42b2e40cd1fc4efba6f8927e87b818530a8ddc68..573fb710f1a38b1baf2a235d18ae817d0930956e 100644 (file)
@@ -15,7 +15,7 @@
 #pragma implementation
 #endif
 
-#include <gettext.h>
+#include "gettext.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
 
@@ -30,6 +30,7 @@
 #include <qradiobutton.h>
 #include <qspinbox.h>
 
+
 QPrintDialog::QPrintDialog(QPrint * f)
        : QPrintDialogBase(0, 0, false, 0),
        form_(f)
@@ -49,8 +50,11 @@ void QPrintDialog::change_adaptor()
 
 void QPrintDialog::browseClicked()
 {
-       QString file = QFileDialog::getOpenFileName(QString::null,
-               _("PostScript files (*.ps)"), this, 0, _("Select a file to print to"));
+       QString file =
+               QFileDialog::getOpenFileName(QString::null,
+                                            _("PostScript files (*.ps)"),
+                                            this, 0,
+                                            _("Select a file to print to"));
        if (!file.isNull()) {
                fileED->setText(file);
                form_->changed();
@@ -82,8 +86,8 @@ void QPrintDialog::printerChanged()
 
 void QPrintDialog::pagerangeChanged()
 {
-       int from = strToUnsignedInt(fromED->text().latin1());
-       int to = strToUnsignedInt(toED->text().latin1());
+       int const from = strToUnsignedInt(fromED->text().latin1());
+       int const to = strToUnsignedInt(toED->text().latin1());
 
        if (!toED->text().isEmpty() && from > to)
                fromED->setText(toED->text());
index 595badac739e3bcf68bba19ea7497971bcb25301..b28f872c702977625b131078798ace12325b5a0e 100644 (file)
 
 class QPrint;
 
-class QPrintDialog : public QPrintDialogBase
-{ Q_OBJECT
-
+class QPrintDialog : public QPrintDialogBase {
+       Q_OBJECT
 public:
        QPrintDialog(QPrint * f);
-
 protected slots:
        virtual void change_adaptor();
        virtual void browseClicked();
@@ -34,7 +32,6 @@ protected slots:
        virtual void copiesChanged(int);
        virtual void printerChanged();
        virtual void pagerangeChanged();
-
 private:
        QPrint * form_;
 };
index 52028535eb77c766f5d5e17ed5cb64a7d41c4985..6870d6ffb5eb6492bcca686c28d4bf77afc946f2 100644 (file)
 #include "support/lstrings.h" // frontStrip, strip
 #include "gettext.h"
 #include "insets/insetref.h"
+
 using std::find;
 using std::max;
 using std::sort;
 using std::vector;
 using std::endl;
 
+
 typedef Qt2CB<ControlRef, Qt2DB<QRefDialog> > base_class;
 
+
 QRef::QRef()
        : base_class(_("Cross Reference")),
        sort_(false), at_ref_(false)
@@ -63,19 +65,21 @@ void QRef::build_dialog()
 
 void QRef::update_contents()
 {
-       dialog_->referenceED->setText(controller().params().getContents().c_str());
+       InsetCommandParams const & params = controller().params();
 
-       dialog_->nameED->setText(controller().params().getOptions().c_str());
+       dialog_->referenceED->setText(params.getContents().c_str());
+
+       dialog_->nameED->setText(params.getOptions().c_str());
        dialog_->nameED->setReadOnly(!nameAllowed() && !readOnly());
 
-       dialog_->typeCO->setCurrentItem(InsetRef::getType(controller().params().getCmdName()));
+       dialog_->typeCO->setCurrentItem(InsetRef::getType(params.getCmdName()));
        dialog_->typeCO->setEnabled(!typeAllowed() && !readOnly());
        if (!typeAllowed())
                dialog_->typeCO->setCurrentItem(0);
 
        dialog_->sortCB->setChecked(sort_);
 
-       /* insert buffer list */
+       // insert buffer list
        dialog_->bufferCO->clear();
        vector<string> const buffers = controller().getBufferList();
        for (vector<string>::const_iterator it = buffers.begin();
@@ -83,16 +87,18 @@ void QRef::update_contents()
                dialog_->bufferCO->insertItem(it->c_str());
        }
        dialog_->bufferCO->setCurrentItem(controller().getBufferNum());
-       
+
        updateRefs();
 }
 
 
 void QRef::apply()
 {
-       controller().params().setCmdName(InsetRef::getName(dialog_->typeCO->currentItem()));
-       controller().params().setContents(dialog_->referenceED->text().latin1());
-       controller().params().setOptions(dialog_->nameED->text().latin1());
+       InsetCommandParams & params = controller().params();
+
+       params.setCmdName(InsetRef::getName(dialog_->typeCO->currentItem()));
+       params.setContents(dialog_->referenceED->text().latin1());
+       params.setOptions(dialog_->nameED->text().latin1());
 }
 
 
@@ -149,7 +155,7 @@ void QRef::redoRefs()
 
        // need this because Qt will send a highlight() here for
        // the first item inserted
-       string tmp(dialog_->referenceED->text());
+       string const tmp(dialog_->referenceED->text());
 
        for (std::vector<string>::const_iterator iter = refs_.begin();
                iter != refs_.end(); ++iter) {
index 093feab24b0355319e7c58dd5228ff08f68c9e5a..6c25870a9819b2520ba7b17c0f26876dacb2a079 100644 (file)
@@ -24,14 +24,13 @@ class ControlRef;
 class QRefDialog;
 
 
-class QRef :
-       public Qt2CB<ControlRef, Qt2DB<QRefDialog> >
+class QRef
+       public Qt2CB<ControlRef, Qt2DB<QRefDialog> >
 {
+public:
        friend class QRefDialog;
 
-public:
        QRef();
-
 private:
        /// apply changes
        virtual void apply();
index c3ecea3b4ef5ae597a3c11054c4b735cd7776420..61f17d64ee3b1467672f9443c5ac6e2fe03d51b4 100644 (file)
@@ -3,8 +3,8 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Kalle Dalheimer 
- * \author John Levon 
+ * \author Kalle Dalheimer
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 
 #include "QRef.h"
 #include "QRefDialog.h"
+
 #include <qpushbutton.h>
 #include <qlineedit.h>
 #include <qcombobox.h>
 #include <qlistbox.h>
 
+
 QRefDialog::QRefDialog(QRef * form)
        : QRefDialogBase(0, 0, false, 0),
        form_(form)
index 0a1571c4f150977f30d08b2ecd69ac468ce4c438..81ea9bd23dd36cabba77f15f20eb3d95b206b7ea 100644 (file)
 
 class QRef;
 
-class QRefDialog : public QRefDialogBase
-{ Q_OBJECT
-
+class QRefDialog : public QRefDialogBase {
+       Q_OBJECT
 public:
        QRefDialog(QRef * form);
-
 public slots:
        void changed_adaptor();
        void gotoClicked();
-       void refHighlighted(const QString &);
-       void refSelected(const QString &);
+       void refHighlighted(QString const &);
+       void refSelected(QString const &);
        void sortToggled(bool);
        void updateClicked();
-
 protected:
        void closeEvent(QCloseEvent * e);
-
 private:
        QRef * form_;
 };
index 34a0d4ed963eef11b545e230c89b6da99edc18b5..d4ecf42e2f0e466c0ca9f6d407e74d6944f11102 100644 (file)
@@ -3,13 +3,12 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
-#include <fstream>
 
 #ifdef __GNUG__
 #pragma implementation
 #include <qcheckbox.h>
 #include <qcombobox.h>
 
+
 typedef Qt2CB<ControlSearch, Qt2DB<QSearchDialog> > base_class;
 
+
 QSearch::QSearch()
        : base_class(_("Search"))
 {
@@ -52,7 +53,8 @@ void QSearch::build_dialog()
 }
 
 
-void QSearch::find(string const & str, bool casesens, bool words, bool backwards)
+void QSearch::find(string const & str, bool casesens,
+                  bool words, bool backwards)
 {
        controller().find(str, casesens, words, !backwards);
 }
index 5674d2258d68e683882b67b798e6cf5e89208dc7..3b27a639913033e68000ee959371810e66ba8fbe 100644 (file)
@@ -31,21 +31,19 @@ public:
        friend class QSearchDialog;
        ///
        QSearch();
-
 private:
        /// Apply changes
-       virtual void apply() {};
+       virtual void apply() {}
        /// update
-       virtual void update_contents() {};
+       virtual void update_contents() {}
        /// build the dialog
        virtual void build_dialog();
 
-
-       void find(string const & str, bool casesens, bool words, bool backwards);
+       void find(string const & str, bool casesens,
+                 bool words, bool backwards);
 
        void replace(string const & findstr, string const & replacestr,
                bool casesens, bool words, bool all);
-
 };
 
 #endif // QSEARCH_H
index 5586610bd6db6acae776a9f158a145536f8345be..cbf882877dde0423bc9bb9761c281b18d197c594 100644 (file)
@@ -25,6 +25,7 @@
 #include <qlineedit.h>
 #include <qlabel.h>
 
+
 QSearchDialog::QSearchDialog(QSearch * form)
        : QSearchDialogBase(0, 0, false, 0),
        form_(form)
@@ -41,7 +42,7 @@ void QSearchDialog::show()
        findCO->lineEdit()->setSelection(0, findCO->lineEdit()->text().length());
 }
 
+
 void QSearchDialog::closeEvent(QCloseEvent * e)
 {
        form_->slotWMHide();
index 1bbe6ae19b79649b023a9e1d2e128e31982f309e..95d365344a3a4800c5efc563fc731507610770aa 100644 (file)
@@ -23,20 +23,17 @@ class QSearch;
 class QCloseEvent;
 class QComboBox;
 
-class QSearchDialog : public QSearchDialogBase
-{ Q_OBJECT
-
+class QSearchDialog : public QSearchDialogBase {
+       Q_OBJECT
 public:
        QSearchDialog(QSearch * form);
 
        virtual void show();
-
 protected slots:
        void findChanged();
        void findClicked();
        void replaceClicked();
        void replaceallClicked();
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
 
index c0917d54128e2299e751f3875626283c49adbdc5..cc129cb0c5cec821318cbf84048f1b681b80ea02 100644 (file)
@@ -32,6 +32,7 @@ using std::vector;
 
 typedef Qt2CB<ControlSendto, Qt2DB<QSendtoDialog> > base_class;
 
+
 QSendto::QSendto()
        : base_class(_("Send document to command"))
 {
@@ -76,6 +77,7 @@ void QSendto::update_contents()
        dialog_->commandCO->insertItem(controller().getCommand().c_str());
 }
 
+
 void QSendto::apply()
 {
        int const line(dialog_->formatLB->currentItem());
@@ -89,13 +91,14 @@ void QSendto::apply()
        controller().setCommand(cmd);
 }
 
+
 bool QSendto::isValid()
 {
        int const line(dialog_->formatLB->currentItem());
 
        if (line < 0 || line > dialog_->formatLB->count())
                return false;
-       
+
        else return dialog_->formatLB->count() != 0 &&
                !string(dialog_->commandCO->currentText()).empty();
 }
index fc50d495ee7bcf59ac2b5c48d9128f53a82493ba..61cacdf71f9a6a3e531f8cf5409386cab9e2fe4b 100644 (file)
@@ -17,6 +17,7 @@
 #endif
 
 #include "Qt2Base.h"
+
 #include <vector>
 
 class ControlSendto;
@@ -33,10 +34,8 @@ public:
        friend class QSendtoDialog;
        ///
        QSendto();
-
 protected:
        virtual bool isValid();
-
 private:
        /// Apply from dialog
        virtual void apply();
index fff32b871f20cbe905762912247aca1db118aaac..47a34505993b9d301a03dacc85fcbd4def16151c 100644 (file)
 
 class QSendto;
 
-class QSendtoDialog : public QSendtoDialogBase
-{
+class QSendtoDialog : public QSendtoDialogBase {
        Q_OBJECT
-
 public:
        QSendtoDialog(QSendto * form);
-
 protected slots:
        virtual void changed_adaptor();
-       virtual void slotFormatHighlighted(const QString&) {};
-       virtual void slotFormatSelected(const QString&) {};
-
+       virtual void slotFormatHighlighted(const QString&) {}
+       virtual void slotFormatSelected(const QString&) {}
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QSendto * form_;
 };
index e099ddc5743251c2a9bd103dd3a32a7c9bb5aeac..11fff4398c3a16fcdaacd1790b66ae8c87c48154 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 #include "QShowFile.h"
 #include "QShowFileDialog.h"
 #include "Qt2BC.h"
+
 #include <qtextview.h>
 #include <qpushbutton.h>
 
 typedef Qt2CB<ControlShowFile, Qt2DB<QShowFileDialog> > base_class;
 
+
 QShowFile::QShowFile()
        : base_class(_("ShowFile"))
 {
index c0418bf2f29a5cc10a0371056dff6854e35751d8..fa6db8f891bc0fd448059f5b0fb802b245672dd6 100644 (file)
@@ -22,17 +22,16 @@ class ControlShowFile;
 class QShowFileDialog;
 
 
-class QShowFile :
-       public Qt2CB<ControlShowFile, Qt2DB<QShowFileDialog> >
+class QShowFile
+       public Qt2CB<ControlShowFile, Qt2DB<QShowFileDialog> >
 {
+public:
        friend class QShowFileDialog;
 
-public:
        QShowFile();
-
 private:
        /// Apply changes
-       virtual void apply() {};
+       virtual void apply() {}
        /// update
        virtual void update_contents();
        /// build the dialog
index 1afcf2454439d73c2522090429a56d6d1a348ec0..f1c9916a431ac917c2deec340c390b5f2cf8abc7 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -20,6 +20,7 @@
 #include <qwidget.h>
 #include <qpushbutton.h>
 
+
 QShowFileDialog::QShowFileDialog(QShowFile * form)
        : QShowFileDialogBase(0, 0, false, 0),
        form_(form)
index df603ae215d2eea4d6c66482ae642b6d3f9019d5..c4819f1cf416d564ad934d89616ac8754e3fc244 100644 (file)
 
 class QShowFile;
 
-class QShowFileDialog : public QShowFileDialogBase
-{ Q_OBJECT
-
+class QShowFileDialog : public QShowFileDialogBase {
+       Q_OBJECT
 public:
        QShowFileDialog(QShowFile * form);
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QShowFile * form_;
 };
index 29d19cd0d8528a5fec7f6859d53a5e7be4bb9b9a..adeb9f643a4cd276022439b1ea86595e96b13511 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -29,6 +29,7 @@
 
 typedef Qt2CB<ControlSpellchecker, Qt2DB<QSpellcheckerDialog> > base_class;
 
+
 QSpellchecker::QSpellchecker()
        : base_class(_("Spellchecker"))
 {
@@ -111,7 +112,9 @@ void QSpellchecker::partialUpdate(int id)
        case 2:
                dialog_->spellcheckPB->setEnabled(true);
                hide();
-               QMessageBox::information(0, _("Spellcheck complete"), controller().getMessage().c_str() , _("OK"));
+               QMessageBox::information(0, _("Spellcheck complete"),
+                                        controller().getMessage().c_str(),
+                                        _("OK"));
                break;
        }
 }
index ba3466d888306dbadf91c598e6359182504e7991..ce82827e29f541028d7cc07d8c876a25ddbbb3ea 100644 (file)
@@ -23,17 +23,16 @@ class ControlSpellchecker;
 class QSpellcheckerDialog;
 
 
-class QSpellchecker :
-       public Qt2CB<ControlSpellchecker, Qt2DB<QSpellcheckerDialog> >
+class QSpellchecker
+       public Qt2CB<ControlSpellchecker, Qt2DB<QSpellcheckerDialog> >
 {
+public:
        friend class QSpellcheckerDialog;
 
-public:
        QSpellchecker();
 
        /// update from controller
        void partialUpdate(int id);
-
 private:
        void stop();
        void accept();
@@ -43,7 +42,7 @@ private:
        void spellcheck();
 
        /// Apply changes
-       virtual void apply() {};
+       virtual void apply() {}
        /// update
        virtual void update_contents();
        /// build the dialog
index 0e134b7d94f63b5f76bee2eddd1bc18887554f8a..6e78cc267da2f2ee9a4f041d4e4be16be2e3cd17 100644 (file)
@@ -23,6 +23,7 @@
 #include <qlistbox.h>
 #include <qcombobox.h>
 
+
 QSpellcheckerDialog::QSpellcheckerDialog(QSpellchecker * form)
        : QSpellcheckerDialogBase(0, 0, false, 0),
        form_(form)
@@ -68,7 +69,7 @@ void QSpellcheckerDialog::ignoreClicked()
 }
 
 
-void QSpellcheckerDialog::suggestionChanged(const QString & str)
+void QSpellcheckerDialog::suggestionChanged(QString const & str)
 {
        if (replaceCO->count() != 0)
                replaceCO->changeItem(str, 0);
@@ -79,7 +80,7 @@ void QSpellcheckerDialog::suggestionChanged(const QString & str)
 }
 
 
-void QSpellcheckerDialog::replaceChanged(const QString & str)
+void QSpellcheckerDialog::replaceChanged(QString const & str)
 {
        if (suggestionsLB->currentText() == str)
                return;
index 08ffeae40604ddd99a6ae3586aa89f1c3aaee059..eb895602d9268cfc91b7125884cab0c65c2eb625 100644 (file)
 
 class QSpellchecker;
 
-class QSpellcheckerDialog : public QSpellcheckerDialogBase
-{ Q_OBJECT
-
+class QSpellcheckerDialog : public QSpellcheckerDialogBase {
+       Q_OBJECT
 public:
        QSpellcheckerDialog(QSpellchecker * form);
-
 protected slots:
        virtual void stop();
        virtual void acceptClicked();
@@ -35,7 +33,6 @@ protected slots:
        virtual void ignoreClicked();
        virtual void suggestionChanged(const QString &);
        virtual void replaceChanged(const QString &);
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
 
index 5de46e3398294b982efa0616dbe92fde18020f60..5ada6b6c737342a0ae376b9f3b907bc179992076 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -26,6 +26,7 @@
 
 typedef Qt2CB<ControlTabularCreate, Qt2DB<QTabularCreateDialog> > base_class;
 
+
 QTabularCreate::QTabularCreate()
        : base_class(_("Insert table"))
 {
index e4dbfa1ec5a3e7d66f4fcdeea82e97b81baca211..6297d4887027dce3b7bbc63b67d4e55df699257b 100644 (file)
@@ -31,12 +31,11 @@ public:
        friend class QTabularCreateDialog;
        ///
        QTabularCreate();
-
 private:
        /// Apply changes
        virtual void apply();
        /// update
-       virtual void update_contents() {};
+       virtual void update_contents() {}
        /// build the dialog
        virtual void build_dialog();
 };
index 4e9f0e27cbfce80ce7194409fcf080d9ddf76662..579ef07fbb4095f33778e74099a9586268052d8d 100644 (file)
@@ -15,7 +15,7 @@
 #pragma implementation
 #endif
 
-#include <gettext.h>
+#include "gettext.h"
 
 #include "support/lstrings.h"
 
@@ -26,6 +26,7 @@
 #include <qspinbox.h>
 #include "emptytable.h"
 
+
 QTabularCreateDialog::QTabularCreateDialog(QTabularCreate * form)
        : QTabularCreateDialogBase(0, 0, false, 0),
        form_(form)
index 0cf12397e634cc303ea180751f27579420aad29a..0eecc66b7246d9513cd6fab56d535328ef192d6e 100644 (file)
 
 class QTabularCreate;
 
-class QTabularCreateDialog : public QTabularCreateDialogBase
-{ Q_OBJECT
-
+class QTabularCreateDialog : public QTabularCreateDialogBase {
+       Q_OBJECT
 public:
        QTabularCreateDialog(QTabularCreate * form);
-
 protected slots:
        virtual void columnsChanged(int);
        virtual void rowsChanged(int);
-
 private:
        QTabularCreate * form_;
 };
index 776a4be3ebe3c817ae3f265a4aef4a676e305788..c85deff0083acc8bf8bfef86ed0a3cc97ad6ab10 100644 (file)
@@ -3,15 +3,13 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Edwin Leuven 
+ * \author Edwin Leuven
  *
  * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
 
-#include <vector>
-
 #ifdef __GNUG__
 #pragma implementation
 #endif
@@ -24,7 +22,7 @@
 #include "helper_funcs.h"
 
 #include "support/lstrings.h"
+
 #include <qlistbox.h>
 #include <qpushbutton.h>
 #include <qcheckbox.h>
@@ -33,9 +31,9 @@ using std::vector;
 
 typedef Qt2CB<ControlTexinfo, Qt2DB<QTexinfoDialog> > base_class;
 
+
 QTexinfo::QTexinfo()
        : base_class(_("LaTeX Information")), warningPosted(false), activeStyle(ControlTexinfo::cls)
-
 {
 }
 
@@ -53,9 +51,9 @@ void QTexinfo::build_dialog()
 void QTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
 {
        string const fstr =  controller().getContents(whichStyle, true);
-       
+
        switch (whichStyle) {
-           case ControlTexinfo::bst: 
+           case ControlTexinfo::bst:
                bst_ = getVectorFromString(fstr, "\n");
                break;
            case ControlTexinfo::cls:
@@ -84,9 +82,3 @@ void QTexinfo::updateStyles()
 {
        updateStyles(activeStyle);
 }
-
-
-
-
-
-
index cadb749a7ba9e27df6d860a90101773b83286436..da04aeb79f09a46d3506ec54f495bb382058a350 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "ControlTexinfo.h"
 
+#include <vector>
+
 class QTexinfoDialog;
 
 ///
@@ -33,9 +35,9 @@ public:
        QTexinfo();
 private:
        /// Apply changes
-       virtual void apply() { };
+       virtual void apply() {}
        /// update (do we need this?)
-       virtual void update_contents() {};
+       virtual void update_contents() {}
        /// build the dialog
        virtual void build_dialog();
        ///
index bf6261c97b29b778a9c6f577f08e7703d586c87b..934270114d6177c3e6f77796c9ea7cd47a63a207 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Edwin Leuven 
+ * \author Edwin Leuven
  *
  * Full author contact details are available in file CREDITS
  */
@@ -14,8 +14,6 @@
 #pragma implementation
 #endif
 
-#include <vector>
-
 #include "LString.h"
 
 #include "ControlTexinfo.h"
@@ -26,6 +24,9 @@
 #include <qpushbutton.h>
 #include <qcombobox.h>
 
+#include <vector>
+
+
 QTexinfoDialog::QTexinfoDialog(QTexinfo * form)
        : QTexinfoDialogBase(0, 0, false, 0),
        form_(form)
@@ -47,6 +48,7 @@ void QTexinfoDialog::closeEvent(QCloseEvent * e)
        e->accept();
 }
 
+
 void QTexinfoDialog::rescanClicked()
 {
        // build new *Files.lst
@@ -55,6 +57,7 @@ void QTexinfoDialog::rescanClicked()
        enableViewPB();
 }
 
+
 void QTexinfoDialog::viewClicked()
 {
        int const fitem = fileList->currentItem();
@@ -73,13 +76,14 @@ void QTexinfoDialog::viewClicked()
        default:
                break;
        }
-       
+
        // a valid entry?
        if (!sel.empty()) {
                form_->controller().viewFile(sel.c_str());
        }
 }
 
+
 void QTexinfoDialog::update()
 {
        switch (whatStyle->currentItem()) {
@@ -95,14 +99,12 @@ void QTexinfoDialog::update()
        default:
                break;
        }
-       
+
        enableViewPB();
 }
 
+
 void QTexinfoDialog::enableViewPB()
 {
-       viewPB->setEnabled(fileList->currentItem()>-1);
+       viewPB->setEnabled(fileList->currentItem() > -1);
 }
-
-
-
index cd83bb7d1c3bc9f0e74f9f23b2f0bedecd0bcb3f..fa2661b2950180221281063ca03a8403bc797ffe 100644 (file)
 
 class QTexinfo;
 
-class QTexinfoDialog : public QTexinfoDialogBase
-{ Q_OBJECT
-
+class QTexinfoDialog : public QTexinfoDialogBase {
+       Q_OBJECT
 public:
        QTexinfoDialog(QTexinfo * form);
-
 protected slots:
        virtual void change_adaptor();
        virtual void rescanClicked();
        virtual void viewClicked();
        virtual void update();
        virtual void enableViewPB();
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
 private:
index 4dd9a6ddfbeecf447d7e8407c3c9575b4a50bb60..76b2578c7e80c1c3a04d04f1f0254351c95503f9 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -26,6 +26,7 @@
 
 typedef Qt2CB<ControlThesaurus, Qt2DB<QThesaurusDialog> > base_class;
 
+
 QThesaurus::QThesaurus()
        : base_class(_("Thesaurus"))
 {
index 6a29a8b6d00ee1d59ac070d57919e92fe8d3bff0..4e355c0ace2fcbe8e7d6c159992a573a4f944280 100644 (file)
@@ -32,7 +32,7 @@ public:
        QThesaurus();
 private:
        /// Apply changes
-       virtual void apply() { };
+       virtual void apply() {}
        /// update
        virtual void update_contents();
        /// build the dialog
index b90e9c0b8891fdbf076f4e02227927e57003856f..a4c195f2482d2b74aeb00d02f0976413eeba8074 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -14,8 +14,6 @@
 #pragma implementation
 #endif
 
-#include <vector>
-
 #include "LString.h"
 
 #include "ControlThesaurus.h"
@@ -26,6 +24,9 @@
 #include <qlistview.h>
 #include <qlineedit.h>
 
+#include <vector>
+
+
 QThesaurusDialog::QThesaurusDialog(QThesaurus * form)
        : QThesaurusDialogBase(0, 0, false, 0),
        form_(form)
index 1bc413de5dea14bd1bba837c20bfb3da5ca3253f..cca4c2e45b45ce30747dce4318a81b1d4e1b20e5 100644 (file)
 class QThesaurus;
 class QListViewItem;
 
-class QThesaurusDialog : public QThesaurusDialogBase
-{ Q_OBJECT
-
+class QThesaurusDialog : public QThesaurusDialogBase {
+       Q_OBJECT
 public:
        QThesaurusDialog(QThesaurus * form);
 
        void updateLists();
-
 protected slots:
        virtual void change_adaptor();
        virtual void entryChanged();
        virtual void replaceClicked();
        virtual void selectionChanged(QListViewItem *);
        virtual void selectionClicked(QListViewItem *);
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QThesaurus * form_;
 };
index bba3d3f1b690bc479704e36ebdd138e0ed0d2d66..174db3adf87c9d8340ab3acdb9a1905da5defdc9 100644 (file)
@@ -101,33 +101,33 @@ void QToc::updateToc(int newdepth)
        dialog_->tocLV->setUpdatesEnabled(false);
 
        int curdepth = 0;
-       stack< pair< QListViewItem *, QListViewItem *> > istack;
-       QListViewItem *last = 0;
-       QListViewItem *parent = 0;
-       QListViewItem *item;
+       stack<pair<QListViewItem *, QListViewItem *> > istack;
+       QListViewItem * last = 0;
+       QListViewItem * parent = 0;
+       QListViewItem * item;
 
-       // Yes, it is this ugly. Two reasons - root items must have a QListView parent,
-       // rather than QListViewItem; and the TOC can move in and out an arbitrary number
-       // of levels
+       // Yes, it is this ugly. Two reasons - root items must have
+       // a QListView parent, rather than QListViewItem; and the
+       // TOC can move in and out an arbitrary number of levels
 
        for (toc::Toc::const_iterator iter = toclist.begin();
-               iter != toclist.end(); ++iter) {
+            iter != toclist.end(); ++iter) {
                if (iter->depth == curdepth) {
                        // insert it after the last one we processed
                        if (!parent)
-                               item = (last) ? (new QListViewItem(dialog_->tocLV,last)) : (new QListViewItem(dialog_->tocLV));
+                               item = (last ? new QListViewItem(dialog_->tocLV,last) : new QListViewItem(dialog_->tocLV));
                        else
-                               item = (last) ? (new QListViewItem(parent,last)) : (new QListViewItem(parent));
+                               item = (last ? new QListViewItem(parent,last) : new QListViewItem(parent));
                } else if (iter->depth > curdepth) {
                        int diff = iter->depth - curdepth;
                        // first save old parent and last
                        while (diff--)
                                istack.push(pair< QListViewItem *, QListViewItem * >(parent,last));
-                       item = (last) ? (new QListViewItem(last)) : (new QListViewItem(dialog_->tocLV));
+                       item = (last ? new QListViewItem(last) : new QListViewItem(dialog_->tocLV));
                        parent = last;
                } else {
                        int diff = curdepth - iter->depth;
-                       pair< QListViewItem *, QListViewItem * > top;
+                       pair<QListViewItem *, QListViewItem * > top;
                        // restore context
                        while (diff--) {
                                top = istack.top();
@@ -137,14 +137,20 @@ void QToc::updateToc(int newdepth)
                        last = top.second;
                        // insert it after the last one we processed
                        if (!parent)
-                               item = (last) ? (new QListViewItem(dialog_->tocLV,last)) : (new QListViewItem(dialog_->tocLV));
+                               item = (last ? new QListViewItem(dialog_->tocLV,last) : new QListViewItem(dialog_->tocLV));
                        else
-                               item = (last) ? (new QListViewItem(parent,last)) : (new QListViewItem(parent));
+                               item = (last ? new QListViewItem(parent,last) : new QListViewItem(parent));
                }
 
-               lyxerr[Debug::GUI] << "Table of contents" << endl << "Added item " << iter->str.c_str()
-                       << " at depth " << iter->depth << ", previous sibling \"" << (last ? last->text(0).latin1() : "0")
-                       << "\", parent \"" << (parent ? parent->text(0).latin1() : "0") << "\"" << endl;
+               lyxerr[Debug::GUI]
+                       << "Table of contents\n"
+                       << "Added item " << iter->str.c_str()
+                       << " at depth " << iter->depth
+                       << ", previous sibling \""
+                       << (last ? last->text(0).latin1() : "0")
+                       << "\", parent \""
+                       << (parent ? parent->text(0).latin1() : "0") << "\""
+                       << endl;
                item->setText(0,iter->str.c_str());
                item->setOpen(iter->depth < depth_);
                curdepth = iter->depth;
index 15e707cdfc944f30492e06021489835c7f5593c0..d3a8caf5f612b9f488b92cf7ac0c1c82d602abeb 100644 (file)
@@ -27,10 +27,9 @@ class QToc :
        public Qt2CB<ControlToc, Qt2DB<QTocDialog> >
 {
 public:
-       QToc();
-
        friend class QTocDialog;
 
+       QToc();
 private:
        /// update the listview
        void updateToc(int newdepth);
@@ -44,7 +43,7 @@ private:
        /// set the depth
        void set_depth(int depth);
 
-       virtual void apply() {};
+       virtual void apply() {}
 
        /// update dialog
        virtual void update_contents();
index 9db0e95276a5c0f52bae05362a786df6df80677d..7c01d81548935997de1c6e77d93abdfaabca547e 100644 (file)
@@ -3,13 +3,13 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
@@ -20,6 +20,7 @@
 #include <qlistview.h>
 #include <qpushbutton.h>
 
+
 QTocDialog::QTocDialog(QToc * form)
        : QTocDialogBase(0, 0, false, 0),
        form_(form)
index 8f5626203308909acb0957363bc0046a98c08d40..474427fac04e8e375cf2c0dbd9452a2d8d76ff4c 100644 (file)
 
 class QToc;
 
-class QTocDialog : public QTocDialogBase
-{ Q_OBJECT
-
+class QTocDialog : public QTocDialogBase {
+       Q_OBJECT
 public:
        QTocDialog(QToc * form);
        ~QTocDialog();
-
 public slots:
        void activate_adaptor(int);
        void depth_adaptor(int);
        void select_adaptor(QListViewItem *);
        void update_adaptor();
-
 protected:
        void closeEvent(QCloseEvent * e);
-
 private:
        QToc * form_;
 };
index ad6a1c275bad63ba720e28e892da1478513cad15..67b8023b90194b330eeddde81d867c51b1ee8e4f 100644 (file)
@@ -17,7 +17,7 @@
 #include "ControlUrl.h"
 #include "debug.h"
 #include "gettext.h"
+
 #include "QURL.h"
 #include "QURLDialog.h"
 #include "Qt2BC.h"
@@ -28,6 +28,7 @@
 
 typedef Qt2CB<ControlUrl, Qt2DB<QURLDialog> > base_class;
 
+
 QURL::QURL()
        : base_class(_("URL"))
 {
@@ -48,21 +49,25 @@ void QURL::build_dialog()
 
 void QURL::update_contents()
 {
-       dialog_->urlED->setText(controller().params().getContents().c_str());
-       dialog_->nameED->setText(controller().params().getOptions().c_str());
-       dialog_->hyperlinkCB->setChecked(controller().params().getCmdName() != "url");
+       InsetCommandParams const & params = controller().params();
+
+       dialog_->urlED->setText(params.getContents().c_str());
+       dialog_->nameED->setText(params.getOptions().c_str());
+       dialog_->hyperlinkCB->setChecked(params.getCmdName() != "url");
 }
 
 
 void QURL::apply()
 {
-       controller().params().setContents(dialog_->urlED->text().latin1());
-       controller().params().setOptions(dialog_->nameED->text().latin1());
+       InsetCommandParams & params = controller().params();
+
+       params.setContents(dialog_->urlED->text().latin1());
+       params.setOptions(dialog_->nameED->text().latin1());
 
        if (dialog_->hyperlinkCB->isChecked())
-               controller().params().setCmdName("htmlurl");
+               params.setCmdName("htmlurl");
        else
-               controller().params().setCmdName("url");
+               params.setCmdName("url");
 }
 
 
index eb4bb341a54ee52f55c836969b733b9ba6d123d5..ef65400af39c9a6f64088b382e0040b221f91c7d 100644 (file)
@@ -25,13 +25,11 @@ class QURLDialog;
 class QURL :
        public Qt2CB<ControlUrl, Qt2DB<QURLDialog> >
 {
-       friend class QURLDialog;
 public:
+       friend class QURLDialog;
        QURL();
-
 protected:
        virtual bool isValid();
-
 private:
        /// apply dialog
        virtual void apply();
index 0e9334f6485b85deb7b5168e972552dadf1ed4f0..db345e37cd7047ed6f5664d3f1b89a8e152a4899 100644 (file)
@@ -19,7 +19,8 @@
 
 #include <qpushbutton.h>
 #include <qlineedit.h>
+
+
 QURLDialog::QURLDialog(QURL * form)
        : QURLDialogBase(0, 0, false, 0),
        form_(form)
@@ -42,7 +43,7 @@ void QURLDialog::show()
        urlED->setFocus();
 }
 
+
 void QURLDialog::changed_adaptor()
 {
        form_->changed();
index f97c5e481e49334407693ef28524e4fea4cf5393..865e4a79506d21bcc1f80d8f37797ca9e0c06ff5 100644 (file)
 
 class QURL;
 
-class QURLDialog : public QURLDialogBase
-{ Q_OBJECT
-
+class QURLDialog : public QURLDialogBase {
+       Q_OBJECT
 public:
        QURLDialog(QURL * form);
        ~QURLDialog();
 
        virtual void show();
-
 public slots:
        void changed_adaptor();
-
 protected:
        void closeEvent(QCloseEvent *);
-
 private:
        QURL * form_;
 };
index a7cad7ca10f1a03ca10999ec45312799c553b8c5..986769de202370eae850d716dbc81a676dbe4ab1 100644 (file)
@@ -3,22 +3,22 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
-#include "Lsstream.h"
 
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
+#include "Lsstream.h"
 #include "gettext.h"
 #include "LyXView.h"
 #include "ControlVCLog.h"
+
 #include "QVCLog.h"
 #include "QVCLogDialog.h"
 #include "Qt2BC.h"
@@ -28,6 +28,7 @@
 
 typedef Qt2CB<ControlVCLog, Qt2DB<QVCLogDialog> > base_class;
 
+
 QVCLog::QVCLog()
        : base_class(_("VCLog"))
 {
index 070a1063020fd91ffb0573aca2c19e48ff1ce77f..066c114062b8596aa3b25ba56a2af704f604001f 100644 (file)
@@ -30,10 +30,9 @@ public:
        friend class QVCLogDialog;
        ///
        QVCLog();
-
 private:
        /// Apply changes
-       virtual void apply() {};
+       virtual void apply() {}
        /// update
        virtual void update_contents();
        /// build the dialog
index 7f7bd8ac3790e701013c983cd4ee40908a2678a4..d29e134d4f50990239abf813c3373dab6e3a9c5e 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -24,7 +24,8 @@
 
 #include <qpushbutton.h>
 #include <qtextview.h>
+
+
 QVCLogDialog::QVCLogDialog(QVCLog * form)
        : QVCLogDialogBase(0, 0, false, 0),
        form_(form)
index 405d1ae3a5dbb6cfa8f0f9f735b8875835ab8f91..f86f3256d7523099cea703008b0f670500259e7e 100644 (file)
 
 class QVCLog;
 
-class QVCLogDialog : public QVCLogDialogBase
-{ Q_OBJECT
-
+class QVCLogDialog : public QVCLogDialogBase {
+       Q_OBJECT
 public:
        QVCLogDialog(QVCLog * form);
-
 protected slots:
        virtual void updateClicked();
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QVCLog * form_;
 };
index 6f23701f10ed8bd1da85ca52df3a44cdc46727d2..15af3200e361bf0bd0586f151b2f4b0ed9a52a90 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 #include "support/lstrings.h"
 #include "support/LAssert.h"
 
-#include <cmath>
-#include <cctype>
-
 #include "QWorkArea.h"
+
 #include <qapplication.h>
-#include <qevent.h> 
+#include <qevent.h>
 #include <qpainter.h>
 #include <qmainwindow.h>
 #include <qlayout.h>
 #include <qclipboard.h>
+
+#include <cmath>
+#include <cctype>
+
 using std::endl;
 using std::abs;
 using std::hex;
 
+
 QWorkArea::QWorkArea(int, int, int, int)
        : WorkArea(), QWidget(qApp->mainWidget()), painter_(*this)
 {
@@ -46,9 +46,9 @@ QWorkArea::QWorkArea(int, int, int, int)
        content_ = new QContentPane(this);
 
        (static_cast<QMainWindow*>(qApp->mainWidget()))->setCentralWidget(this);
+
        setFocusProxy(content_);
+
        content_->show();
 
        content_->setBackgroundColor(lcolor.getX11Name(LColor::background).c_str());
@@ -56,7 +56,7 @@ QWorkArea::QWorkArea(int, int, int, int)
        QHBoxLayout * vl = new QHBoxLayout(this);
        vl->addWidget(content_, 5);
        vl->addWidget(scrollbar_, 0);
+
        show();
 }
 
@@ -70,10 +70,9 @@ void QWorkArea::setScrollbarParams(int h, int pos, int line_h)
 {
        // do what cursor movement does (some grey)
        h += height() / 4;
-       int max = h - height();
-       if (max < 0)
-               max = 0;
+
+       int max = std::max(0, h - height());
+
        scrollbar_->setRange(0, max);
        scrollbar_->setValue(pos);
        scrollbar_->setLineStep(line_h);
@@ -86,16 +85,16 @@ void QWorkArea::haveSelection(bool) const
        // not possible in Qt !
 }
 
-string const QWorkArea::getClipboard() const 
+
+string const QWorkArea::getClipboard() const
 {
-       QString str = QApplication::clipboard()->text(); 
+       QString str = QApplication::clipboard()->text();
        if (str.isNull())
                return string();
        return str.latin1();
 }
 
-       
+
 void QWorkArea::putClipboard(string const & str) const
 {
        QApplication::clipboard()->setText(str.c_str());
index 900b5f7c6b6249d016cfa4d916a8800c753e0711..d397a91bc24ff5450b67d957712863651e376de3 100644 (file)
  * Hopefully soon we can just use QScrollView ...
  */
 class QWorkArea : public WorkArea, public QWidget {
-
-       friend class QContentPane;
-
 public:
+       friend class QContentPane;
 
        QWorkArea(int x, int y, int w, int h);
 
@@ -63,7 +61,6 @@ public:
 
        /// get the content pane widget
        QWidget * getContent() const { return content_; }
-
 private:
        /// scroll bar
        QScrollBar * scrollbar_;
index 458896226b331369ac77ff30ba74dfa5624fb98f..e09deb3f77b220fd8b924b65b4ca354dec2b6adf 100644 (file)
 #include "QWrapDialog.h"
 #include "Qt2BC.h"
 #include "lengthcombo.h"
+
 #include <qpushbutton.h>
 #include <qcombobox.h>
 #include <qlineedit.h>
 
 typedef Qt2CB<ControlWrap, Qt2DB<QWrapDialog> > base_class;
 
+
 QWrap::QWrap()
        : base_class(_("Wrap Options"))
 {
@@ -59,47 +60,53 @@ void QWrap::apply()
        if (string(dialog_->widthED->text().latin1()).empty())
                unit = LyXLength::UNIT_NONE;
 
-       controller().params().pageWidth = LyXLength(value, unit);
+       WrapParams & params = controller().params();
+
+       params.pageWidth = LyXLength(value, unit);
 
        switch (dialog_->valignCO->currentItem()) {
        case 0:
-               controller().params().placement.erase();
+               params.placement.erase();
                break;
        case 1:
-               controller().params().placement = "l";
+               params.placement = "l";
                break;
        case 2:
-               controller().params().placement = "r";
+               params.placement = "r";
                break;
        case 3:
-               controller().params().placement = "p";
+               params.placement = "p";
                break;
        }
 }
 
 
 namespace {
-       string const numtostr(double val) {
-               string a(tostr(val));
-               if (a == "0")
-                       a = "";
-               return a;
-       }
+
+string const numtostr(double val) {
+       string a(tostr(val));
+       if (a == "0")
+               a.erase();
+       return a;
+}
+
 } // namespace anon
 
 
 void QWrap::update_contents()
 {
-       LyXLength len(controller().params().pageWidth);
+       WrapParams & params = controller().params();
+
+       LyXLength len(params.pageWidth);
        dialog_->widthED->setText(numtostr(len.value()).c_str());
        dialog_->unitsLC->setCurrentItem(len.unit());
 
        int item = 0;
-       if (controller().params().placement == "l")
+       if (params.placement == "l")
                item = 1;
-       else if (controller().params().placement == "r")
+       else if (params.placement == "r")
                item = 2;
-       else if (controller().params().placement == "p")
+       else if (params.placement == "p")
                item = 3;
 
        dialog_->valignCO->setCurrentItem(item);
index 3fc085df1116034397501d8b1f4006d410e1e9b9..a451e8608550b021461caaf3678a736fa4759ec0 100644 (file)
@@ -26,11 +26,9 @@ class QWrap
        : public Qt2CB<ControlWrap, Qt2DB<QWrapDialog> >
 {
 public:
-
        friend class QWrapDialog;
 
        QWrap();
-
 private:
        /// Apply changes
        virtual void apply();
index ea0bef8ff9690ed7ba429dc9494c1c7e374d71e4..65a365dc59a67d4189833f7a1b52068246a62fa4 100644 (file)
@@ -14,8 +14,6 @@
 #pragma implementation
 #endif
 
-#include <vector>
-
 #include "ControlWrap.h"
 
 #include "QWrap.h"
@@ -25,6 +23,9 @@
 #include <qtextview.h>
 #include "lengthcombo.h"
 
+#include <vector>
+
+
 QWrapDialog::QWrapDialog(QWrap * form)
        : QWrapDialogBase(0, 0, false, 0),
        form_(form)
index def8301d0ce5f0754333a8accc94fc0d15da5ea6..3b2e59b4908a7b9641239d205fb1e017f1171aef 100644 (file)
 
 class QWrap;
 
-class QWrapDialog : public QWrapDialogBase
-{ Q_OBJECT
-
+class QWrapDialog : public QWrapDialogBase {
+       Q_OBJECT
 public:
        QWrapDialog(QWrap * form);
-
 protected slots:
        virtual void change_adaptor();
-
 protected:
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        QWrap * form_;
 };
index 83adf1e452730941531677b5e9998598620b969c..cd152b3c4a0771a95495efeff8937a65496fb45c 100644 (file)
@@ -3,8 +3,8 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Allan Rae 
- * \author Angus Leeming 
+ * \author Allan Rae
+ * \author Angus Leeming
  *
  * Full author contact details are available in file CREDITS
  */
@@ -21,6 +21,7 @@
 #include <qbutton.h>
 #include <qlineedit.h>
 
+
 Qt2BC::Qt2BC(string const & cancel, string const & close)
        : GuiBC<QButton, QWidget>(cancel, close)
 {}
index 9051fcbddd3def239cd84b1ff78b547a120a6b0d..08f8d7af2996cadba2509fd9ac717cc40984a1e5 100644 (file)
@@ -29,12 +29,10 @@ class QButton;
     the activation policy and which buttons correspond to which output of the
     state machine.
 */
-class Qt2BC : public GuiBC<QButton, QWidget>
-{
+class Qt2BC : public GuiBC<QButton, QWidget> {
 public:
        ///
        Qt2BC(string const &, string const &);
-
 private:
        /// Updates the button sensitivity (enabled/disabled)
        void setButtonEnabled(QButton *, bool enabled);
index 424aa764ae81bb0a0359e839d74d9f0125c74fdf..94f63475f9c02ef829b02011da73885c41bfa9d2 100644 (file)
@@ -25,6 +25,7 @@
 #include "ControlButtons.h"
 #include "support/LAssert.h"
 
+
 Qt2Base::Qt2Base(QString const & t)
        : ViewBase(), updating_(false), title_(t)
 {}
index e771848b7d6f88312f2bbad8c86296c7e1f0d753..2491a9895c448ddb5f9f5ea12836b97198be5eda 100644 (file)
@@ -28,15 +28,13 @@ class Qt2BC;
 
 /** This class is an Qt2 GUI base class.
  */
-class Qt2Base : public QObject, public ViewBase
-{
+class Qt2Base : public QObject, public ViewBase {
        Q_OBJECT
 public:
        ///
        Qt2Base(QString const &);
        ///
        virtual ~Qt2Base() {}
-
 protected:
        /// build the actual dialog
        virtual void build_dialog() = 0;
@@ -58,7 +56,6 @@ protected:
 
        /// are we updating ?
        bool updating_;
-
 protected slots:
        // dialog closed from WM
        void slotWMHide();
@@ -74,7 +71,6 @@ protected slots:
 
        // Close button clicked
        void slotClose();
-
 private:
        /// Pointer to the actual instantiation of xform's form
        virtual QDialog * form() const = 0;
@@ -86,8 +82,7 @@ private:
 
 
 template <class Dialog>
-class Qt2DB: public Qt2Base
-{
+class Qt2DB: public Qt2Base {
 protected:
        Qt2DB(QString const &);
 
index 90b4e0f70472236fde07ced027e9448084f590e7..4496cec0ce0279a496f9fd3d3cd84590d2b31328 100644 (file)
@@ -3,8 +3,8 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Lars Gullik Bjornes 
- * \author John Levon 
+ * \author Lars Gullik Bjornes
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 #include "frontends/Menubar.h"
 #include "frontends/Dialogs.h"
 #include "frontends/Timeout.h"
+
 #include <boost/bind.hpp>
+
 #include "QtView.h"
 #include "qfont_loader.h"
 #include "QCommandBuffer.h"
+
 #include <qapplication.h>
 #include <qpixmap.h>
 #include <qmenubar.h>
 #include <qstatusbar.h>
+
 using std::endl;
 
 namespace {
-       int const idle_timer_value = 3000;
-}
+
+int const idle_timer_value = 3000;
+
+} // namespace anon
+
 // FIXME: this has to go away
 BufferView * current_view;
 
 qfont_loader fontloader;
 
+
 QtView::QtView(unsigned int width, unsigned int height)
        : QMainWindow(), LyXView()
 {
        resize(width, height);
+
        qApp->setMainWidget(this);
+
        bufferview_.reset(new BufferView(this, 0, 0, width, height));
        ::current_view = bufferview_.get();
 
@@ -66,19 +69,19 @@ QtView::QtView(unsigned int width, unsigned int height)
        toolbar_.reset(new Toolbar(this, 0, 0, toolbardefaults));
 
        statusBar()->setSizeGripEnabled(false);
+
        view_state_changed.connect(boost::bind(&QtView::update_view_state, this));
        connect(&idle_timer_, SIGNAL(timeout()), this, SLOT(update_view_state_qt()));
-       idle_timer_.start(idle_timer_value); 
+
+       idle_timer_.start(idle_timer_value);
+
        focus_command_buffer.connect(boost::bind(&QtView::focus_command_widget, this));
+
        commandbuffer_ = new QCommandBuffer(this, *controlcommand_);
+
        addToolBar(commandbuffer_, Bottom, true);
-        //  assign an icon to main form
+
+       //  assign an icon to main form
        string const iconname = LibFileSearch("images", "lyx", "xpm");
        if (!iconname.empty())
                setIcon(QPixmap(iconname.c_str()));
@@ -95,12 +98,12 @@ QtView::~QtView()
 
 void QtView::message(string const & str)
 {
-       statusBar()->message(str.c_str()); 
+       statusBar()->message(str.c_str());
        idle_timer_.stop();
        idle_timer_.start(idle_timer_value);
 }
 
+
 void QtView::focus_command_widget()
 {
        commandbuffer_->focus_command();
@@ -112,25 +115,25 @@ void QtView::update_view_state_qt()
        statusBar()->message(currentState(view().get()).c_str());
 }
 
+
 void QtView::update_view_state()
 {
        statusBar()->message(currentState(view().get()).c_str());
 }
 
+
 void QtView::activated(int id)
 {
        getLyXFunc().dispatch(id, true);
 }
+
+
 void QtView::closeEvent(QCloseEvent *)
 {
        QuitLyX();
 }
 
+
 void QtView::show(int x, int y, string const & title)
 {
        move(x, y);
index 69909fd61719242127e22c1c3e27c7d6edae4654..381c0b5e717596b1a3f055b8bb226eccc2649aa3 100644 (file)
@@ -52,18 +52,15 @@ public:
 
        /// display a status message
        virtual void message(string const & str);
-
 public slots:
        /// menu item has been selected
        void activated(int id);
 
        /// idle timeout
        void update_view_state_qt();
-
 protected:
        /// make sure we quit cleanly
        virtual void closeEvent(QCloseEvent * e);
-
 private:
        /// focus the command buffer widget
        void focus_command_widget();
index 97a79cef448c5af9428e5efc53fc944f0a4a280f..904dfce4745aff5d29ed9f46292437d275643465 100644 (file)
@@ -83,3 +83,23 @@ Thesaurus    John            Done
 Toc            Kalle           Waiting to be updated
 Url            Kalle           Done
 VCLog          John            Done
+
+
+Stuff to be aware of
+--------------------
+
+The connect statement in Qt is a macro and its arguments does not follow
+the C++ standard as it should. Using the construct "Type const &" as
+argument will lead to runtime-errors, use "const Type &" instead.
+
+ex.
+
+--right--
+
+       connect(list, SIGNAL(selected(const QString &)),
+               this, SLOT(complete_selected(const QString &)));
+
+--wrong--
+
+       connect(list, SIGNAL(selected(QString const &)),
+               this, SLOT(complete_selected(QString const &)));
index f35141aa749c5d2114289a33370d5b7bd35e57ba..e1b3c4bd28949c808ae6ff3d0d4d42140ed1dca4 100644 (file)
@@ -38,11 +38,9 @@ public:
        void reset();
        /// is the timer running ?
        bool running() const;
-
 protected:
        /// slot
        virtual void timerEvent(QTimerEvent *);
-
 private:
        /// the owning timer
        Timeout * owner_;
index 80c5de749d01b0c93400485645fbb7f7823c3cb9..43ba1b62300a0c3441113d80f25009a5ac449de1 100644 (file)
@@ -63,7 +63,7 @@ QPixmap getIconPixmap(int action)
 
        if (!fullname.empty()) {
                lyxerr[Debug::GUI] << "Full icon name is `"
-                                      << fullname << "'" << endl;
+                                  << fullname << "'" << endl;
                return QPixmap(fullname.c_str());
        }
 
@@ -71,7 +71,7 @@ QPixmap getIconPixmap(int action)
        fullname = LibFileSearch("images", "unknown", "xpm");
        if (!fullname.empty()) {
                lyxerr[Debug::GUI] << "Using default `unknown' icon"
-                                      << endl;
+                                  << endl;
        }
        return QPixmap(fullname.c_str());
 }
@@ -161,9 +161,8 @@ void Toolbar::Pimpl::setLayout(string const & layout)
 
        string const & name = _(tc[layout]->name());
 
-       int i;
-
-       for (i = 0; i < combo_->count(); ++i) {
+       int i = 0;
+       for (; i < combo_->count(); ++i) {
                if (name == combo_->text(i).latin1())
                        break;
        }
index 3be574cfe0cc5bce897ee79028a8ab446effa150..f9133508072ad54dd6c7c64ce973647a4e48cc14 100644 (file)
@@ -31,16 +31,15 @@ class QLComboBox;
 class ToolbarProxy;
 
 struct Toolbar::Pimpl {
-
+public:
        friend class ToolbarProxy;
 
-public:
        Pimpl(LyXView * o, int x, int y);
 
        ~Pimpl();
 
        /// add a new button to the toolbar.
-       void add(int action);
+       void add(int action);
 
        /// update the state of the icons
        void update();
@@ -53,7 +52,6 @@ public:
        void openLayoutList();
        /// Erase the layout list
        void clearLayoutList();
-
 private:
        void changed_layout(string const & sel);
 
@@ -70,18 +68,15 @@ private:
        typedef std::map<QToolButton *, int> ButtonMap;
 
        ButtonMap map_;
-
 };
 
 
 // moc is mind-numbingly stupid
 class ToolbarProxy : public QObject {
        Q_OBJECT
-
 public:
        ToolbarProxy(Toolbar::Pimpl & owner)
-               : owner_(owner) { };
-
+               : owner_(owner) {}
 public slots:
 
        void layout_selected(const QString & str) {
@@ -94,7 +89,6 @@ public slots:
                        static_cast<QToolButton const *>(sender()))
                );
        }
-
 private:
        Toolbar::Pimpl & owner_;
 };
index 9123cd4e9118e0a92b9181818738dad9210422e2..21a6fc9ddb5d6db02e5e87543a09613e5e4a693c 100644 (file)
@@ -3,26 +3,26 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
 #include "frontends/WorkAreaFactory.h"
+
 #include "QWorkArea.h"
+
 namespace WorkAreaFactory {
+
 WorkArea * create(int x, int y, int w, int h)
 {
        return new QWorkArea(x, y, w, h);
 }
 
-}
+} // namespace WorkAreaFactory
index 4c413129a9902e6c065ef74f596e4c4af8ec8c0f..4f99a215e813ad5473becdd0353a6e3623930650 100644 (file)
@@ -20,7 +20,8 @@
  * A simple widget for a quick "preview" in TabularCreateDialog
  */
 
-const unsigned int cellsize = 20;
+unsigned int const cellsize = 20;
+
 
 EmptyTable::EmptyTable(QWidget * parent, const char * name)
        : QtTableView(parent, name, WRepaintNoErase)
@@ -32,13 +33,14 @@ EmptyTable::EmptyTable(QWidget * parent, const char * name)
        setTableFlags(Tbl_autoScrollBars);
 }
 
+
 QSize EmptyTable::sizeHint() const
 {
        return QSize(cellsize * numCols(), cellsize * numRows());
 }
 
 
-void EmptyTable::paintCell(QPainter *p, int row, int col)
+void EmptyTable::paintCell(QPainter * p, int row, int col)
 {
        int const x2 = cellWidth(col) - 1;
        int const y2 = cellHeight(row) - 1;
@@ -49,7 +51,7 @@ void EmptyTable::paintCell(QPainter *p, int row, int col)
 
        if (row + 1 != numRows() || col + 1 != numCols())
                return;
+
        // draw handle
        int const step = cellsize / 5;
        int const space = 4;
@@ -64,6 +66,7 @@ void EmptyTable::paintCell(QPainter *p, int row, int col)
        }
 }
 
+
 void EmptyTable::setNumberColumns(int nr_cols)
 {
        if (nr_cols < 1)
@@ -78,6 +81,7 @@ void EmptyTable::setNumberColumns(int nr_cols)
        emit colsChanged(nr_cols);
 }
 
+
 void EmptyTable::setNumberRows(int nr_rows)
 {
        if (nr_rows < 1)
@@ -92,6 +96,7 @@ void EmptyTable::setNumberRows(int nr_rows)
        emit rowsChanged(nr_rows);
 }
 
+
 void EmptyTable::mouseMoveEvent(QMouseEvent *ev)
 {
        int const x = ev->pos().x();
index 1f18fd09e10e07c1afbf97c257ba4ac42c72cc82..d00e33bb033408b983ec1e0e5be0513752e73638 100644 (file)
@@ -28,27 +28,23 @@ class EmptyTable : public QtTableView {
 public:
        EmptyTable(QWidget * parent = 0, const char * name = 0);
 
-       ~EmptyTable() {};
+       ~EmptyTable() {}
 
        virtual QSize sizeHint() const;
-
 public slots:
        /// set the number of columns in the table and emit colsChanged() signal
        void setNumberColumns(int nr_cols);
        /// set the number of rows in the table and emit rowsChanged() signal
        void setNumberRows(int nr_rows);
-
 signals:
        /// the number of columns changed
        void colsChanged(int);
        /// the number of rows changed
        void rowsChanged(int);
-
 protected:
        /// fill in a cell
        virtual void paintCell(class QPainter *, int, int);
        virtual void mouseMoveEvent(QMouseEvent *);
-
 private:
        /// number of current columns
        unsigned int cols;
index 202ed6b686d1675b43e67829e4d32ca650c2c0eb..8f09504414eca60732800bafa4de4d01325117c1 100644 (file)
@@ -15,7 +15,7 @@
 #endif
 
 #include "debug.h"
+
 #include "iconpalette.h"
 
 #include <qlayout.h>
@@ -27,9 +27,10 @@ using std::endl;
 using std::make_pair;
 using std::vector;
 using std::max;
+
 int const button_size = 40;
+
+
 IconPalette::IconPalette(QWidget * parent, char const * name)
        : QWidget(parent, name), maxcol_(-1)
 {
@@ -47,7 +48,7 @@ void IconPalette::add(QPixmap const & pixmap, string name, string tooltip)
        p->setFixedSize(button_size, button_size);
        p->setPixmap(pixmap);
        QToolTip::add(p, tooltip.c_str());
-       connect(p, SIGNAL(clicked()), this, SLOT(clicked())); 
+       connect(p, SIGNAL(clicked()), this, SLOT(clicked()));
        buttons_.push_back(make_pair(p, name));
 }
 
@@ -68,12 +69,12 @@ void IconPalette::clicked()
 void IconPalette::resizeEvent(QResizeEvent * e)
 {
        QWidget::resizeEvent(e);
+
        lyxerr[Debug::GUI] << "resize panel to "
                << e->size().width() << "," << e->size().height() << endl;
+
        int maxcol = e->size().width() / button_size;
+
        if (!layout_->isEmpty() && maxcol == maxcol_)
                return;
 
@@ -84,17 +85,17 @@ void IconPalette::resizeEvent(QResizeEvent * e)
 
        lyxerr[Debug::GUI] << "Laying out " << buttons_.size() << " widgets in a "
                << cols << "x" << rows << " grid." << endl;
+
        setUpdatesEnabled(false);
+
        // clear layout
        QLayoutIterator lit = layout_->iterator();
        while (lit.current()) {
                lit.takeCurrent();
        }
-                
+
        layout_->invalidate();
+
        vector<Button>::const_iterator it(buttons_.begin());
        vector<Button>::const_iterator const end(buttons_.end());
 
@@ -108,11 +109,11 @@ void IconPalette::resizeEvent(QResizeEvent * e)
        }
 
 out:
+
        resize(cols * button_size, rows * button_size);
 
        maxcol_ = cols;
+
        setUpdatesEnabled(true);
        update();
 }
index d5cf47d2bc2604c4c449d32925222a1fd77eef07..a4f6af76d1a6224f2fedb4f613ffc3c4117d1a58 100644 (file)
@@ -35,16 +35,12 @@ public:
 
        /// add a button
        void add(QPixmap const & pixmap, string name, string tooltip);
-
 signals:
        void button_clicked(string);
-
 protected:
        virtual void resizeEvent(QResizeEvent * e);
-
 protected slots:
        virtual void clicked();
-
 private:
        int maxcol_;
 
index 8ac3fc2f56bd5e8aba81216e7caec0b82ac2b002..c183a8fb7f84b4efcbc529a7752e09be3c550528 100644 (file)
@@ -18,6 +18,7 @@
 #include "lyxserver.h"
 #include "io_callback.h"
 
+
 io_callback::io_callback(int fd, LyXComm * comm)
        : comm_(comm)
 {
index 5c3a81b26d632f4720c9b7983bbf24230a8585c2..efa4103746565793a7c74fe447029c9b52487916 100644 (file)
@@ -36,10 +36,8 @@ class io_callback : public QObject {
 public:
        /// connect a read ready notification for fd to the LyXComm
        io_callback(int fd, LyXComm * comm);
-
 public slots:
        void data_received();
-
 private:
        /// our notifier
        boost::scoped_ptr<QSocketNotifier> sn_;
index 9b3ca31849edc31f5142105b8e6b2c4b2a4cb6f5..5a726bf1194d4831d5203d2078a3249310ec4622 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <qwhatsthis.h>
 
+
 LengthCombo::LengthCombo(QWidget * parent, char * name)
        : QComboBox(parent, name)
 {
index d9e7220b7168e51d51800092960d6e5384599a38..93b8b64f48d1c560fced80b98606040f83e80dcc 100644 (file)
@@ -33,10 +33,8 @@ public:
 
        /// get the current item
        LyXLength::UNIT currentLengthItem() const;
-
 protected slots:
        virtual void has_activated(int index);
-
 signals:
        /// the current selection has changed
        void selectionChanged(LyXLength::UNIT unit);
index 21dfd7261871649681f66db79e156cf25e63df41..5c990c18194061112b8dc7ce306bb3d4f3857ec4 100644 (file)
@@ -48,8 +48,8 @@
 #include "io_callback.h"
 
 #include <qapplication.h>
-#include <qwidget.h> 
-#include <qpaintdevicemetrics.h> 
+#include <qwidget.h>
+#include <qpaintdevicemetrics.h>
 
 #ifndef CXX_GLOBAL_CSTD
 using std::exit;
@@ -64,17 +64,21 @@ extern BufferList bufferlist;
 namespace {
 
 float getDPI()
-{ 
+{
        QWidget w;
        QPaintDeviceMetrics pdm(&w);
        return 0.5 * (pdm.logicalDpiX() + pdm.logicalDpiY());
 }
 
-}
+map<int, io_callback *> io_callbacks;
+
+} // namespace anon
+
 
 // FIXME: wrong place !
 LyXServer * lyxserver;
 
+
 void lyx_gui::parse_init(int & argc, char * argv[])
 {
        static QApplication a(argc, argv);
@@ -169,11 +173,6 @@ bool lyx_gui::font_available(LyXFont const & font)
 }
 
 
-namespace {
-       map<int, io_callback *> io_callbacks;
-}
-
-
 void lyx_gui::set_read_callback(int fd, LyXComm * comm)
 {
        io_callbacks[fd] = new io_callback(fd, comm);
index 462f485536287ba37e2486404c99ab0beb834be3..ec6e18621a43da9922236690c14cf3805aa35f04 100644 (file)
@@ -28,6 +28,7 @@
 
 using std::endl;
 
+
 qfont_loader::qfont_loader()
 {
 }
index 31f5030a23b1eb19144814e6e7a0c40cef4715f3..12dd7dc92f621521bacc42ad277346d6e37b392f 100644 (file)
@@ -46,7 +46,6 @@ public:
        QFontMetrics const & metrics(LyXFont const & f) {
                return getfontinfo(f)->metrics;
        }
-
 private:
        /// hold info about a particular font
        struct font_info {
index 44992d504917449832e9ed44d864de320272ebd9..c6b6bcebb0d82deafe5b01652e77c3e20d216814 100644 (file)
@@ -4,14 +4,13 @@
  * Licence details can be found in the file COPYING.
  *
  * \author unknown
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
 
-
 #ifdef __GNUG__
 #pragma implementation "frontends/font_metrics.h"
 #endif
 #include <qfontmetrics.h>
 #include <qfont.h>
 
+
 namespace {
-       QFontMetrics const & metrics(LyXFont const & f) {
-               return fontloader.metrics(f);
-       }
+
+QFontMetrics const & metrics(LyXFont const & f)
+{
+       return fontloader.metrics(f);
 }
 
+} // namespace anon
+
 
 namespace font_metrics {
 
index 6ba705f0d2e95e713e93d87532e3c54d6069c9b3..6b0a0708294124fe991bd00cd9c840ec3a055465 100644 (file)
@@ -49,6 +49,8 @@ bool q_is_modifier(int qkey)
  */
 int string_to_qkey(string const & str)
 {
+       // FIX! (Lgb)
+       
        if (str == "Escape") return Qt::Key_Escape;
        if (str == "Tab") return Qt::Key_Tab;
        if (str == "BackSpace") return Qt::Key_BackSpace;
index 5f28ad5b073fe68f692168485305b180c7da4d3d..2fa83b7079e83a1c5ee33a27b9ad7534c4256e11 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author John Levon 
+ * \author John Levon
  *
  * Full author contact details are available in file CREDITS
  */
@@ -15,9 +15,9 @@
 #endif
 
 #include <algorithm>
-#include <iostream> 
+#include <iostream>
 
-#include "LColor.h" 
+#include "LColor.h"
 #include "QWorkArea.h"
 #include "qscreen.h"
 #include "lyxtext.h"
@@ -27,7 +27,7 @@
 #include "debug.h"
 
 #include <qapplication.h>
+
 using std::endl;
 using std::max;
 using std::min;
@@ -37,15 +37,12 @@ namespace {
 /// copy some horizontal regions about inside a pixmap
 void copyInPixmap(QPixmap * p, int dest_y, int src_y, int src_w, int src_h)
 {
-       bitBlt(p,
-               0, dest_y,   // dest x,y
-               p, 0, src_y, // source x, y
-               src_w, src_h // source w, h
-               );
+       // bitBlt(dest, dest_x, dest_y, source, src_x, src_y, src_w, src_h)
+       bitBlt(p, 0, dest_y, p, 0, src_y, src_w, src_h);
 }
+
 } // namespace anon
+
 
 QScreen::QScreen(QWorkArea & o)
        : LyXScreen(), owner_(o)
@@ -57,15 +54,15 @@ QScreen::~QScreen()
 {
 }
 
+
 void QScreen::showManualCursor(LyXText const * text, int x, int y,
                                 int asc, int desc, Cursor_Shape shape)
 {
        if (!qApp->focusWidget())
                return;
+
        string const focusname(qApp->focusWidget()->name());
+
        // Probably a hack
        if (focusname != "content_pane")
                return;
@@ -74,9 +71,9 @@ void QScreen::showManualCursor(LyXText const * text, int x, int y,
        int const y_tmp = min(y - text->first_y + desc, owner_.height());
 
        // secure against very strange situations
-       // which would be when .... ? 
+       // which would be when .... ?
        int const y2 = max(y_tmp, y1);
-       
+
        if (y2 > 0 && y1 < owner_.height()) {
                cursor_h_ = y2 - y1 + 1;
                cursor_y_ = y1;
@@ -96,18 +93,18 @@ void QScreen::showManualCursor(LyXText const * text, int x, int y,
                        break;
                }
 
-               if (!nocursor_pixmap_.get() 
+               if (!nocursor_pixmap_.get()
                        || cursor_w_ != nocursor_pixmap_->width()
                        || cursor_h_ != nocursor_pixmap_->height()) {
                        nocursor_pixmap_.reset(new QPixmap(cursor_w_, cursor_h_));
                }
+
                owner_.getPainter().start();
 
-               // save old area 
+               // save old area
                bitBlt(nocursor_pixmap_.get(), 0, 0, owner_.getPixmap(),
                        cursor_x_, cursor_y_, cursor_w_, cursor_h_);
+
                owner_.getPainter().line(x, y1, x, y2);
                switch (shape) {
                case BAR_SHAPE:
@@ -120,12 +117,12 @@ void QScreen::showManualCursor(LyXText const * text, int x, int y,
                                cursor_w_ - 1, rectangle_h, LColor::cursor);
                        break;
                }
+
                owner_.getPainter().end();
+
                owner_.getContent()->repaint(
                        cursor_x_, cursor_y_,
-                       cursor_w_, cursor_h_); 
+                       cursor_w_, cursor_h_);
 
        }
        cursor_visible_ = true;
@@ -134,32 +131,32 @@ void QScreen::showManualCursor(LyXText const * text, int x, int y,
 
 void QScreen::hideCursor()
 {
-       if (!cursor_visible_) 
+       if (!cursor_visible_)
                return;
 
-       bitBlt(owner_.getPixmap(), cursor_x_, cursor_y_, 
+       bitBlt(owner_.getPixmap(), cursor_x_, cursor_y_,
                nocursor_pixmap_.get(), 0, 0, cursor_w_, cursor_h_);
+
        owner_.getContent()->repaint(
                cursor_x_, cursor_y_,
-               cursor_w_, cursor_h_); 
+               cursor_w_, cursor_h_);
+
        cursor_visible_ = false;
 }
 
+
 void QScreen::repaint()
 {
        QWidget * content(owner_.getContent());
        content->repaint(0, 0, content->width(), content->height());
 }
 
+
 void QScreen::expose(int x, int y, int w, int h)
 {
        lyxerr[Debug::GUI] << "expose " << w << "x" << h
                << "+" << x << "+" << y << endl;
+
        owner_.getContent()->update(x, y, w, h);
 }
 
@@ -167,9 +164,9 @@ void QScreen::expose(int x, int y, int w, int h)
 void QScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
 {
        QPixmap * p(owner_.getPixmap());
+
        owner_.getPainter().start();
+
        if (cursor_visible_) hideCursor();
 
        int const old_first = text->first_y;
@@ -178,7 +175,7 @@ void QScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
 
        // If you want to fix the warning below, fix it so it
        // actually scrolls properly. Hint: a cast won't do.
+
        // is any optimization possible?
        if (y - old_first < owner_.workHeight()
            && old_first - y < owner_.workHeight()) {
@@ -194,10 +191,10 @@ void QScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
                        expose(0, owner_.height() - src_y, owner_.workWidth(), src_y);
                }
        } else {
-               lyxerr[Debug::GUI] << "dumb full redraw" << endl; 
+               lyxerr[Debug::GUI] << "dumb full redraw" << endl;
                drawFromTo(text, bv, 0, owner_.height(), 0, 0, internal);
                repaint();
        }
+
        owner_.getPainter().end();
 }
index 758527a623907ceff442acd543b8d0f70abf5aa8..9ed0611e36e28c92ed2db13acf7de9c22eb16c16 100644 (file)
@@ -1,3 +1,11 @@
+2002-10-20  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * XLyXKeySym.h: rename private var keysym to keysym_, add accessor
+       function keysym().
+
+       * FormDocument.C (class_apply): setMessage change
+       (apply): ditto
+
 2002-10-16  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * Menubar_pimpl.C (create_submenu): do not create a "More..."
@@ -38,7 +46,7 @@
 2002-10-09  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * xforms_helpers.C (formatted): fix small typo, spotted by Rob
-       Lahaye 
+       Lahaye
 
 2002-10-08  Dekel Tsur  <dekelts@tau.ac.il>
 
index 6f276f462c14b42227cc75b8bcb8cd9060ba5df4..f5ebf9da252a4d10afc1c99d992ede2363915cbf 100644 (file)
@@ -33,7 +33,6 @@
 #include "lyxrc.h"
 #include "BufferView.h"
 #include "buffer.h"
-#include "Liason.h"
 #include "CutAndPaste.h"
 #include "bufferview_funcs.h"
 #include "xforms_helpers.h"
 #include <functional>
 
 using std::bind2nd;
-
-using Liason::setMinibuffer;
 using std::vector;
 
+
 FormDocument::FormDocument(LyXView & lv, Dialogs & d)
        : FormBaseBD(lv, d, _("Document Layout")),
          ActCell(0), Confirmed(0),
@@ -358,7 +356,7 @@ void FormDocument::apply()
                lv_.view()->redoCurrentBuffer();
        }
        lv_.buffer()->markDirty();
-       setMinibuffer(&lv_, _("Document layout set"));
+       lv_.message(_("Document layout set"));
 }
 
 
@@ -752,7 +750,7 @@ bool FormDocument::class_apply()
                if (textclasslist[params.textclass].load()) {
                        // successfully loaded
                        redo = true;
-                       setMinibuffer(&lv_, _("Converting document to new document class..."));
+                       lv_.message(_("Converting document to new document class..."));
                        int ret = CutAndPaste::SwitchLayoutsBetweenClasses(
                                old_class, params.textclass,
                                &*(lv_.buffer()->paragraphs.begin()),
index bd1500e4a594944ff5a60a884312d965012e7a51..d8597fb29ecfa976e747ceda65123c7edad91d5f 100644 (file)
 using std::endl;
 
 XLyXKeySym::XLyXKeySym()
-       : LyXKeySym(), keysym(NoSymbol)
+       : LyXKeySym(), keysym_(NoSymbol)
 {
 }
+
 
 void XLyXKeySym::initFromKeySym(KeySym ks)
 {
-       keysym = ks;
+       keysym_ = ks;
 }
+
 
 void XLyXKeySym::init(string const & symbolname)
 {
-       keysym = XStringToKeysym(symbolname.c_str());
-       if (keysym == NoSymbol) {
+       keysym_ = XStringToKeysym(symbolname.c_str());
+       if (keysym_ == NoSymbol) {
                lyxerr[Debug::KBMAP]
                        << "XLyXKeySym.C: No such keysym: "
                        << symbolname << endl;
@@ -48,7 +48,7 @@ void XLyXKeySym::init(string const & symbolname)
 
 bool XLyXKeySym::isOK() const
 {
-       return keysym != NoSymbol;
+       return keysym_ != NoSymbol;
 }
 
 
@@ -57,25 +57,25 @@ bool XLyXKeySym::isModifier() const
        // Can we be sure that this will work for all X Window
        // implementations? (Lgb)
        // Perhaps all of them should be explictly mentioned?
-       return ((keysym >= XK_Shift_L && keysym <= XK_Hyper_R)
-           || keysym == XK_Mode_switch || keysym == 0x0);
+       return ((keysym_ >= XK_Shift_L && keysym_ <= XK_Hyper_R)
+           || keysym_ == XK_Mode_switch || keysym_ == 0x0);
 }
 
 
 string XLyXKeySym::getSymbolName() const
 {
-       char * name = XKeysymToString(keysym);
+       char * name = XKeysymToString(keysym_);
        return name ? name : string();
 }
 
+
 char XLyXKeySym::getISOEncoded() const
 {
-       if (keysym == NoSymbol) {
+       if (keysym_ == NoSymbol) {
                return 0;
        }
 
-       unsigned int c = keysym;
+       unsigned int c = keysym_;
 
        switch (c & 0x0000FF00) {
                // latin 1 byte 3 = 0
@@ -102,12 +102,9 @@ char XLyXKeySym::getISOEncoded() const
        return c;
 }
 
-bool XLyXKeySym::operator==(LyXKeySym const & k) const
+
+bool operator==(LyXKeySym const & k1, LyXKeySym const & k2)
 {
-       // This is dangerous! Ideally, we should use dynamic_cast instead,
-       // but on the other hand, we are sure that we will always get
-       // the right type, because we decide at compile time which
-       // frontend we use. (Asger)
-       return keysym == static_cast<XLyXKeySym const &>(k).keysym;
+       return static_cast<XLyXKeySym const &>(k1).keysym()
+               == static_cast<XLyXKeySym const &>(k2).keysym();
 }
index 0cb2bd7405eac9b4ddb3f89c1113135da2dc46b3..3cd74ed57a682a79172464c56c9f73879be3b51c 100644 (file)
@@ -39,7 +39,7 @@ public:
 
        /// Is this a modifier key only?
        virtual bool isModifier() const;
-       
+
        virtual string getSymbolName() const;
 
        /**
@@ -49,10 +49,12 @@ public:
         */
        virtual char getISOEncoded() const;
 
-       virtual bool operator==(LyXKeySym const & k) const;
-
+       ///
+       unsigned int keysym() const {
+               return keysym_;
+       }
 private:
-       unsigned int keysym;
+       unsigned int keysym_;
 };
 
 #endif // XLYXKEYSYM_H