mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
nullptr
This commit is contained in:
parent
e31eadfd37
commit
4cee3478f7
@ -689,7 +689,7 @@ public:
|
|||||||
QString translate(const char * /* context */,
|
QString translate(const char * /* context */,
|
||||||
const char *sourceText,
|
const char *sourceText,
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
const char * /* disambiguation */ = 0, int /* n */ = -1) const override
|
const char * /* disambiguation */ = nullptr, int /* n */ = -1) const override
|
||||||
#else
|
#else
|
||||||
const char * /*comment*/ = 0) const override
|
const char * /*comment*/ = 0) const override
|
||||||
#endif
|
#endif
|
||||||
@ -1463,7 +1463,7 @@ DispatchResult const & GuiApplication::dispatch(FuncRequest const & cmd)
|
|||||||
{
|
{
|
||||||
DispatchResult dr;
|
DispatchResult dr;
|
||||||
|
|
||||||
Buffer * buffer = 0;
|
Buffer * buffer = nullptr;
|
||||||
if (cmd.view_origin() && current_view_ != cmd.view_origin()) {
|
if (cmd.view_origin() && current_view_ != cmd.view_origin()) {
|
||||||
//setCurrentView(cmd.view_origin); //does not work
|
//setCurrentView(cmd.view_origin); //does not work
|
||||||
dr.setError(true);
|
dr.setError(true);
|
||||||
@ -1553,8 +1553,8 @@ void GuiApplication::gotoBookmark(unsigned int idx, bool openFile,
|
|||||||
|
|
||||||
// if the current buffer is not that one, switch to it.
|
// if the current buffer is not that one, switch to it.
|
||||||
BufferView * doc_bv = current_view_ ?
|
BufferView * doc_bv = current_view_ ?
|
||||||
current_view_->documentBufferView() : 0;
|
current_view_->documentBufferView() : nullptr;
|
||||||
Cursor const * old = doc_bv ? &doc_bv->cursor() : 0;
|
Cursor const * old = doc_bv ? &doc_bv->cursor() : nullptr;
|
||||||
if (!doc_bv || doc_bv->buffer().fileName() != tmp.filename) {
|
if (!doc_bv || doc_bv->buffer().fileName() != tmp.filename) {
|
||||||
if (switchToBuffer) {
|
if (switchToBuffer) {
|
||||||
dispatch(FuncRequest(LFUN_BUFFER_SWITCH, file));
|
dispatch(FuncRequest(LFUN_BUFFER_SWITCH, file));
|
||||||
@ -1631,7 +1631,7 @@ void GuiApplication::validateCurrentView()
|
|||||||
// currently at least one view exists but no view has the focus.
|
// currently at least one view exists but no view has the focus.
|
||||||
// choose the last view to make it current.
|
// choose the last view to make it current.
|
||||||
// a view without any open document is preferred.
|
// a view without any open document is preferred.
|
||||||
GuiView * candidate = 0;
|
GuiView * candidate = nullptr;
|
||||||
QHash<int, GuiView *>::const_iterator it = d->views_.begin();
|
QHash<int, GuiView *>::const_iterator it = d->views_.begin();
|
||||||
QHash<int, GuiView *>::const_iterator end = d->views_.end();
|
QHash<int, GuiView *>::const_iterator end = d->views_.end();
|
||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
@ -1718,7 +1718,7 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
case LFUN_BUFFER_NEW:
|
case LFUN_BUFFER_NEW:
|
||||||
validateCurrentView();
|
validateCurrentView();
|
||||||
if (!current_view_
|
if (!current_view_
|
||||||
|| (!lyxrc.open_buffers_in_tabs && current_view_->documentBufferView() != 0)) {
|
|| (!lyxrc.open_buffers_in_tabs && current_view_->documentBufferView() != nullptr)) {
|
||||||
createView(QString(), false); // keep hidden
|
createView(QString(), false); // keep hidden
|
||||||
current_view_->newDocument(to_utf8(cmd.argument()));
|
current_view_->newDocument(to_utf8(cmd.argument()));
|
||||||
current_view_->show();
|
current_view_->show();
|
||||||
@ -1733,7 +1733,7 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
string const temp = cmd.getArg(1);
|
string const temp = cmd.getArg(1);
|
||||||
validateCurrentView();
|
validateCurrentView();
|
||||||
if (!current_view_
|
if (!current_view_
|
||||||
|| (!lyxrc.open_buffers_in_tabs && current_view_->documentBufferView() != 0)) {
|
|| (!lyxrc.open_buffers_in_tabs && current_view_->documentBufferView() != nullptr)) {
|
||||||
createView();
|
createView();
|
||||||
current_view_->newDocument(file, temp, true);
|
current_view_->newDocument(file, temp, true);
|
||||||
if (!current_view_->documentBufferView())
|
if (!current_view_->documentBufferView())
|
||||||
@ -1754,7 +1754,7 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
&& theBufferList().getBuffer(FileName(fname));
|
&& theBufferList().getBuffer(FileName(fname));
|
||||||
if (!current_view_
|
if (!current_view_
|
||||||
|| (!lyxrc.open_buffers_in_tabs
|
|| (!lyxrc.open_buffers_in_tabs
|
||||||
&& current_view_->documentBufferView() != 0
|
&& current_view_->documentBufferView() != nullptr
|
||||||
&& !is_open)) {
|
&& !is_open)) {
|
||||||
// We want the ui session to be saved per document and not per
|
// We want the ui session to be saved per document and not per
|
||||||
// window number. The filename crc is a good enough identifier.
|
// window number. The filename crc is a good enough identifier.
|
||||||
@ -1780,7 +1780,7 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
|
|
||||||
case LFUN_HELP_OPEN: {
|
case LFUN_HELP_OPEN: {
|
||||||
// FIXME: create a new method shared with LFUN_FILE_OPEN.
|
// FIXME: create a new method shared with LFUN_FILE_OPEN.
|
||||||
if (current_view_ == 0)
|
if (current_view_ == nullptr)
|
||||||
createView();
|
createView();
|
||||||
string const arg = to_utf8(cmd.argument());
|
string const arg = to_utf8(cmd.argument());
|
||||||
if (arg.empty()) {
|
if (arg.empty()) {
|
||||||
@ -1953,7 +1953,7 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
string arg = argument;
|
string arg = argument;
|
||||||
// FIXME: this LFUN should also work without any view.
|
// FIXME: this LFUN should also work without any view.
|
||||||
Buffer * buffer = (current_view_ && current_view_->documentBufferView())
|
Buffer * buffer = (current_view_ && current_view_->documentBufferView())
|
||||||
? &(current_view_->documentBufferView()->buffer()) : 0;
|
? &(current_view_->documentBufferView()->buffer()) : nullptr;
|
||||||
// This handles undo groups automagically
|
// This handles undo groups automagically
|
||||||
UndoGroupHelper ugh(buffer);
|
UndoGroupHelper ugh(buffer);
|
||||||
while (!arg.empty()) {
|
while (!arg.empty()) {
|
||||||
@ -1983,7 +1983,7 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
// all of the buffers might be locally hidden. That is, there is no
|
// all of the buffers might be locally hidden. That is, there is no
|
||||||
// active buffer.
|
// active buffer.
|
||||||
if (!view || !view->currentBufferView())
|
if (!view || !view->currentBufferView())
|
||||||
activeBuffers[view] = 0;
|
activeBuffers[view] = nullptr;
|
||||||
else
|
else
|
||||||
activeBuffers[view] = &view->currentBufferView()->buffer();
|
activeBuffers[view] = &view->currentBufferView()->buffer();
|
||||||
|
|
||||||
@ -2008,7 +2008,7 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
|
|
||||||
GuiView * const homeView = currentView();
|
GuiView * const homeView = currentView();
|
||||||
Buffer * b = theBufferList().first();
|
Buffer * b = theBufferList().first();
|
||||||
Buffer * nextBuf = 0;
|
Buffer * nextBuf = nullptr;
|
||||||
int numProcessed = 0;
|
int numProcessed = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (b != last)
|
if (b != last)
|
||||||
@ -2159,7 +2159,7 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
// is not terminated when closing the last view.
|
// is not terminated when closing the last view.
|
||||||
// Create a new one to be able to dispatch the
|
// Create a new one to be able to dispatch the
|
||||||
// LFUN_DIALOG_SHOW to this view.
|
// LFUN_DIALOG_SHOW to this view.
|
||||||
if (current_view_ == 0)
|
if (current_view_ == nullptr)
|
||||||
createView();
|
createView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2434,7 +2434,7 @@ void GuiApplication::resetGui()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (d->global_menubar_)
|
if (d->global_menubar_)
|
||||||
d->menus_.fillMenuBar(d->global_menubar_, 0, false);
|
d->menus_.fillMenuBar(d->global_menubar_, nullptr, false);
|
||||||
|
|
||||||
QHash<int, GuiView *>::iterator it;
|
QHash<int, GuiView *>::iterator it;
|
||||||
for (it = d->views_.begin(); it != d->views_.end(); ++it) {
|
for (it = d->views_.begin(); it != d->views_.end(); ++it) {
|
||||||
@ -2722,7 +2722,7 @@ void GuiApplication::restoreGuiSession()
|
|||||||
for (auto const & last : lastopened) {
|
for (auto const & last : lastopened) {
|
||||||
FileName const & file_name = last.file_name;
|
FileName const & file_name = last.file_name;
|
||||||
if (!current_view_ || (!lyxrc.open_buffers_in_tabs
|
if (!current_view_ || (!lyxrc.open_buffers_in_tabs
|
||||||
&& current_view_->documentBufferView() != 0)) {
|
&& current_view_->documentBufferView() != nullptr)) {
|
||||||
string const & fname = file_name.absFileName();
|
string const & fname = file_name.absFileName();
|
||||||
createView(support::checksum(fname));
|
createView(support::checksum(fname));
|
||||||
}
|
}
|
||||||
@ -2986,7 +2986,7 @@ void GuiApplication::unregisterView(GuiView * gv)
|
|||||||
if(d->views_.contains(gv->id()) && d->views_.value(gv->id()) == gv) {
|
if(d->views_.contains(gv->id()) && d->views_.value(gv->id()) == gv) {
|
||||||
d->views_.remove(gv->id());
|
d->views_.remove(gv->id());
|
||||||
if (current_view_ == gv)
|
if (current_view_ == gv)
|
||||||
current_view_ = 0;
|
current_view_ = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3043,7 +3043,7 @@ void GuiApplication::hideDialogs(string const & name, Inset * inset) const
|
|||||||
|
|
||||||
Buffer const * GuiApplication::updateInset(Inset const * inset) const
|
Buffer const * GuiApplication::updateInset(Inset const * inset) const
|
||||||
{
|
{
|
||||||
Buffer const * buf = 0;
|
Buffer const * buf = nullptr;
|
||||||
QHash<int, GuiView *>::const_iterator end = d->views_.end();
|
QHash<int, GuiView *>::const_iterator end = d->views_.end();
|
||||||
for (QHash<int, GuiView *>::iterator it = d->views_.begin(); it != end; ++it) {
|
for (QHash<int, GuiView *>::iterator it = d->views_.begin(); it != end; ++it) {
|
||||||
if (Buffer const * ptr = (*it)->updateInset(inset))
|
if (Buffer const * ptr = (*it)->updateInset(inset))
|
||||||
@ -3056,7 +3056,7 @@ Buffer const * GuiApplication::updateInset(Inset const * inset) const
|
|||||||
bool GuiApplication::searchMenu(FuncRequest const & func,
|
bool GuiApplication::searchMenu(FuncRequest const & func,
|
||||||
docstring_list & names) const
|
docstring_list & names) const
|
||||||
{
|
{
|
||||||
BufferView * bv = 0;
|
BufferView * bv = nullptr;
|
||||||
if (current_view_)
|
if (current_view_)
|
||||||
bv = current_view_->currentBufferView();
|
bv = current_view_->currentBufferView();
|
||||||
return d->menus_.searchMenu(func, names, bv);
|
return d->menus_.searchMenu(func, names, bv);
|
||||||
|
Loading…
Reference in New Issue
Block a user