]> git.lyx.org Git - features.git/commitdiff
Some cosmetics (from my local cosmetics branch).
authorVincent van Ravesteijn <vfr@lyx.org>
Mon, 18 Oct 2010 14:20:03 +0000 (14:20 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Mon, 18 Oct 2010 14:20:03 +0000 (14:20 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35708 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
src/BufferParams.cpp
src/BufferParams.h
src/BufferView.cpp
src/Text2.cpp
src/frontends/qt4/GuiApplication.cpp
src/frontends/qt4/GuiCompare.h
src/frontends/qt4/GuiView.cpp
src/frontends/qt4/GuiWorkArea.cpp
src/insets/Inset.h
src/insets/InsetCommand.cpp
src/insets/InsetLabel.h
src/mathed/MathParser.cpp

index cbab310859cc3f2eec6d8bba309e675f21da5c01..5455847e963f08887e0e168a2e64b9452e026d11 100644 (file)
@@ -1946,12 +1946,14 @@ DocumentClass const & BufferParams::documentClass() const
 }
 
 
-DocumentClass const * BufferParams::documentClassPtr() const {
+DocumentClass const * BufferParams::documentClassPtr() const
+{
        return doc_class_;
 }
 
 
-void BufferParams::setDocumentClass(DocumentClass const * const tc) {
+void BufferParams::setDocumentClass(DocumentClass const * const tc)
+{
        // evil, but this function is evil
        doc_class_ = const_cast<DocumentClass *>(tc);
 }
index 4aab4c714d7d5dac5b06c5392000357fc49383a9..66e09f907e44b67ed075a12c4843d80bb0add42f 100644 (file)
@@ -109,7 +109,7 @@ public:
        InsetQuotes::QuoteTimes quotes_times;
        ///
        std::string fontsize;
-       ///Get the LayoutFile this document is using.
+       /// Get the LayoutFile this document is using.
        LayoutFile const * baseClass() const;
        ///
        LayoutFileIndex const & baseClassID() const;
index b58a980ecc6bf2c945118a05dc9ff74e0309b682..b0dc5d47b5ca7224f406d9f5b3cfaa1d3a9de20c 100644 (file)
@@ -58,9 +58,9 @@
 #include "insets/InsetCommand.h" // ChangeRefs
 #include "insets/InsetExternal.h"
 #include "insets/InsetGraphics.h"
+#include "insets/InsetNote.h"
 #include "insets/InsetRef.h"
 #include "insets/InsetText.h"
-#include "insets/InsetNote.h"
 
 #include "frontends/alert.h"
 #include "frontends/Application.h"
index 9ce5d98fa9330ebf94c12a5b03a9444719effd55..24a3317cf7cafcf14c7438dcd739b22574ea3d8b 100644 (file)
@@ -919,8 +919,9 @@ void Text::deleteEmptyParagraphMechanism(pit_type first, pit_type last, bool tra
                        }
                }
 
-               // don't delete anything if this is the only remaining paragraph within the given range
-               // note: Text::acceptOrRejectChanges() sets the cursor to 'first' after calling DEPM
+               // don't delete anything if this is the only remaining paragraph
+               // within the given range. Note: Text::acceptOrRejectChanges()
+               // sets the cursor to 'first' after calling DEPM
                if (first == last)
                        continue;
 
index cf6d4d7c8253ace56185955fea75f941bc68cd8e..571e30c9d6c0a25f1e5bd5ff461949cc16c2b557 100644 (file)
@@ -1124,12 +1124,14 @@ void GuiApplication::dispatch(FuncRequest const & cmd)
 }
 
 
-void GuiApplication::gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer)
+void GuiApplication::gotoBookmark(unsigned int idx, bool openFile,
+       bool switchToBuffer)
 {
        LASSERT(current_view_, /**/);
        if (!theSession().bookmarks().isValid(idx))
                return;
-       BookmarksSection::Bookmark const & bm = theSession().bookmarks().bookmark(idx);
+       BookmarksSection::Bookmark const & bm =
+               theSession().bookmarks().bookmark(idx);
        LASSERT(!bm.filename.empty(), /**/);
        string const file = bm.filename.absFileName();
        // if the file is not opened, open it.
@@ -1151,16 +1153,18 @@ void GuiApplication::gotoBookmark(unsigned int idx, bool openFile, bool switchTo
                dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"));
 
        // if the current buffer is not that one, switch to it.
-       if (!current_view_->documentBufferView()
-               || current_view_->documentBufferView()->buffer().fileName() != tmp.filename) {
-               if (!switchToBuffer)
+       BufferView * doc_bv = current_view_->documentBufferView();
+       if (!doc_bv || doc_bv->buffer().fileName() != tmp.filename) {
+               if (switchToBuffer) {
+                       dispatch(FuncRequest(LFUN_BUFFER_SWITCH, file));
+                       doc_bv = current_view_->documentBufferView();
+               } else
                        return;
-               dispatch(FuncRequest(LFUN_BUFFER_SWITCH, file));
        }
 
        // moveToPosition try paragraph id first and then paragraph (pit, pos).
-       if (!current_view_->documentBufferView()->moveToPosition(
-               tmp.bottom_pit, tmp.bottom_pos, tmp.top_id, tmp.top_pos))
+       if (!doc_bv->moveToPosition(
+                       tmp.bottom_pit, tmp.bottom_pos, tmp.top_id, tmp.top_pos))
                return;
 
        // bm changed
@@ -1168,7 +1172,7 @@ void GuiApplication::gotoBookmark(unsigned int idx, bool openFile, bool switchTo
                return;
 
        // Cursor jump succeeded!
-       Cursor const & cur = current_view_->documentBufferView()->cursor();
+       Cursor const & cur = doc_bv->cursor();
        pit_type new_pit = cur.pit();
        pos_type new_pos = cur.pos();
        int new_id = cur.paragraph().id();
@@ -1310,11 +1314,11 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                }
                break;
 
-       case LFUN_FILE_OPEN:
+       case LFUN_FILE_OPEN: {
                // FIXME: create a new method shared with LFUN_HELP_OPEN.
-               if (d->views_.empty()
-                       || (!lyxrc.open_buffers_in_tabs && current_view_->documentBufferView() != 0)) {
-                       string const fname = to_utf8(cmd.argument());
+               string const fname = to_utf8(cmd.argument());
+               if (d->views_.empty() || (!lyxrc.open_buffers_in_tabs 
+                         && current_view_->documentBufferView() != 0)) {
                        // We want the ui session to be saved per document and not per
                        // window number. The filename crc is a good enough identifier.
                        boost::crc_32_type crc;
@@ -1324,8 +1328,9 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                        if (current_view_ && !current_view_->documentBufferView())
                                current_view_->close();
                } else
-                       current_view_->openDocument(to_utf8(cmd.argument()));
+                       current_view_->openDocument(fname);
                break;
+       }
 
        case LFUN_HELP_OPEN: {
                // FIXME: create a new method shared with LFUN_FILE_OPEN.
index aa5f701ebb7e3fb7fd56435632fbd3530f6a4bc7..025d2da9895caa8680384935aef7e0c8dd820005 100644 (file)
 #define GUICOMPARE_H
 
 #include "GuiDialog.h"
-#include "ui_CompareUi.h"
-#include "qt_helpers.h"
 
-#include "Compare.h"
+#include "ui_CompareUi.h"
 
 namespace lyx {
+
+class Compare;
+
 namespace frontend {
 
 
index eb2dfc308010ac2b1b24d5f57fb7d773939cdcfe..0d878badfe832f06935639b6fe596de8822384fd 100644 (file)
@@ -2533,8 +2533,11 @@ static bool ensureBufferClean(Buffer * buffer)
 
 bool GuiView::reloadBuffer()
 {
-       Buffer * buf = &documentBufferView()->buffer();
-       return buf->reload();
+       Buffer * buffer = documentBufferView()
+               ? &(documentBufferView()->buffer()) : 0;
+       if (buffer)
+               return buffer->reload();
+       return false;
 }
 
 
@@ -3046,6 +3049,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                case LFUN_FILE_INSERT:
                        insertLyXFile(cmd.argument());
                        break;
+
                case LFUN_FILE_INSERT_PLAINTEXT_PARA:
                        insertPlaintextFile(cmd.argument(), true);
                        break;
index 718872b6f869aec86522b2b9f8f18fca59ebb386..cc1c8091dcb93394fb1fb170c2248df494cb791d 100644 (file)
@@ -1319,7 +1319,7 @@ EmbeddedWorkArea::EmbeddedWorkArea(QWidget * w): GuiWorkArea(w)
 EmbeddedWorkArea::~EmbeddedWorkArea()
 {
        // No need to destroy buffer and bufferview here, because it is done
-       // in theBuffeerList() destruction loop at application exit
+       // in theBufferList() destruction loop at application exit
 }
 
 
index fca566f29daab1a3b9eecf656fd44ef77ca0f673..5ff1d53275c79045172e5e6e0dd4d14f12d79e99 100644 (file)
@@ -280,7 +280,8 @@ public:
        /// Returns true if cursor is now invalid, e.g. if former 
        /// insets in higher cursor slices of \c old do not exist 
        /// anymore.
-       /// \c cur is the new cursor, some slice points to this. Use the update flags to cause a redraw.
+       /// \c cur is the new cursor, some slice points to this. Use the update
+       /// flags to cause a redraw.
        virtual bool notifyCursorEnters(Cursor & /*cur*/)
                { return false; }
        /// is called when the mouse enters or leaves this inset
@@ -381,7 +382,8 @@ public:
        virtual bool forcePlainLayout(idx_type = 0) const { return false; }
        /// if this inset has paragraphs should the user be allowed to
        /// customize alignment, etc?
-       virtual bool allowParagraphCustomization(idx_type = 0) const { return true; }
+       virtual bool allowParagraphCustomization(idx_type = 0) const
+               { return true; }
        /// Is the width forced to some value?
        virtual bool hasFixedWidth() const { return false; }
 
index 065bd383e5f81eea455be6625c51a76547b96357..f02477afab86996b435b7bbf5a141c8f19c22673 100644 (file)
@@ -54,9 +54,7 @@ namespace lyx {
 // place of the mailer name and recover that information?
 InsetCommand::InsetCommand(Buffer * buf, InsetCommandParams const & p,
                           string const & mailer_name)
-       : Inset(buf), p_(p),
-         mailer_name_(mailer_name),
-         mouse_hover_()
+       : Inset(buf), p_(p), mailer_name_(mailer_name)
 {}
 
 
@@ -71,6 +69,7 @@ InsetCommand::~InsetCommand()
 {
        if (!mailer_name_.empty())
                hideDialogs(mailer_name_, this);
+
        map<BufferView const *, bool>::iterator it = mouse_hover_.begin();
        map<BufferView const *, bool>::iterator end = mouse_hover_.end();
        for (; it != end; ++it)
index 37b9cdb27c2d9bf2c9389daf748fe582d5b54ab9..375430b7bfd38e4187a250da1c130b6c071768ad 100644 (file)
@@ -19,7 +19,8 @@ namespace lyx {
 
 class Counter;
 
-class InsetLabel : public InsetCommand {
+class InsetLabel : public InsetCommand 
+{
 public:
        ///
        InsetLabel(Buffer * buf, InsetCommandParams const &);
index c4fad04b46838467b835e8eb9a2be11d58d526d0..4767dc1536cc6ae5bce7de6896307d7e6641902a 100644 (file)
@@ -1348,7 +1348,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
 #endif
 
                else if (t.cs() == "limits" || t.cs() == "nolimits") {
-                       CatCode cat = nextToken().cat();
+                       CatCode const cat = nextToken().cat();
                        if (cat == catSuper || cat == catSub)
                                limits = t.cs() == "limits" ? 1 : -1;
                        else {