Some cosmetics (from my local cosmetics branch).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35708 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-10-18 14:20:03 +00:00
parent 5b2ede473e
commit 152491f916
12 changed files with 48 additions and 33 deletions

View 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);
}

View 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;

View 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"

View 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;

View 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.

View File

@ -13,12 +13,13 @@
#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 {

View 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;

View 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
}

View 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; }

View 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)

View File

@ -19,7 +19,8 @@ namespace lyx {
class Counter;
class InsetLabel : public InsetCommand {
class InsetLabel : public InsetCommand
{
public:
///
InsetLabel(Buffer * buf, InsetCommandParams const &);

View 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 {