}
-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);
}
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;
#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"
}
}
- // 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;
}
-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.
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
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();
}
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;
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.
#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 {
bool GuiView::reloadBuffer()
{
- Buffer * buf = &documentBufferView()->buffer();
- return buf->reload();
+ Buffer * buffer = documentBufferView()
+ ? &(documentBufferView()->buffer()) : 0;
+ if (buffer)
+ return buffer->reload();
+ return false;
}
case LFUN_FILE_INSERT:
insertLyXFile(cmd.argument());
break;
+
case LFUN_FILE_INSERT_PLAINTEXT_PARA:
insertPlaintextFile(cmd.argument(), true);
break;
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
}
/// 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
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; }
// 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)
{}
{
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)
class Counter;
-class InsetLabel : public InsetCommand {
+class InsetLabel : public InsetCommand
+{
public:
///
InsetLabel(Buffer * buf, InsetCommandParams const &);
#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 {