// TODO cleanup, remove the singleton, handle multiple Windows?
progress_ = ProgressInterface::instance();
- if (!dynamic_cast<GuiProgress*>(progress_)) {
+ if (!dynamic_cast<GuiProgress*>(progress_)) {
progress_ = new GuiProgress(); // TODO who deletes it
- ProgressInterface::setInstance(progress_);
+ ProgressInterface::setInstance(progress_);
}
QObject::connect(
- dynamic_cast<GuiProgress*>(progress_),
- SIGNAL(updateStatusBarMessage(QString const&)),
+ dynamic_cast<GuiProgress*>(progress_),
+ SIGNAL(updateStatusBarMessage(QString const&)),
gv, SLOT(updateStatusBarMessage(QString const&)));
QObject::connect(
- dynamic_cast<GuiProgress*>(progress_),
- SIGNAL(clearMessageText()),
+ dynamic_cast<GuiProgress*>(progress_),
+ SIGNAL(clearMessageText()),
gv, SLOT(clearMessageText()));
}
ToolbarMap toolbars_;
ProgressInterface* progress_;
/// The main layout box.
- /**
+ /**
* \warning Don't Delete! The layout box is actually owned by
* whichever toolbar contains it. All the GuiView class needs is a
* means of accessing it.
///
string last_export_format;
#else
- struct DummyWatcher { bool isRunning(){return false;} };
+ struct DummyWatcher { bool isRunning(){return false;} };
DummyWatcher preview_watcher_;
#endif
// filling, at least for the static special menu item on Mac. Otherwise
// they are greyed out.
guiApp->setCurrentView(this);
-
+
// Fill up the menu bar.
guiApp->menus().fillMenuBar(menuBar(), this, true);
vector<const Format *> found_formats;
// Find all formats that have the correct extension.
- vector<const Format *> const & import_formats
+ vector<const Format *> const & import_formats
= theConverters().importableFormats();
vector<const Format *>::const_iterator it = import_formats.begin();
for (; it != import_formats.end(); ++it)
}
string const arg = found_formats[0]->name() + " " + file;
cmd = FuncRequest(LFUN_BUFFER_IMPORT, arg);
- }
+ }
else {
//FIXME: do we have to explicitly check whether it's a lyx file?
LYXERR(Debug::FILES,
{
if (ForkedProcess::iAmAChild())
return;
-
+
// call is moved to GUI-thread by GuiProgress
d.progress_->appendMessage(toqstr(str));
}
GuiWorkArea * GuiView::addWorkArea(Buffer & buffer)
{
// Automatically create a TabWorkArea if there are none yet.
- TabWorkArea * tab_widget = d.splitter_->count()
+ TabWorkArea * tab_widget = d.splitter_->count()
? d.currentTabWorkArea() : addTabWorkArea();
return tab_widget->addWorkArea(buffer, *this);
}
// FIXME: I've no clue why this is here and why it accesses
// theGuiApp()->currentView, which might be 0 (bug 6464).
// See also 27525 (vfr).
- if (theGuiApp()->currentView() == this
- && theGuiApp()->currentView()->currentWorkArea() == wa)
+ if (theGuiApp()->currentView() == this
+ && theGuiApp()->currentView()->currentWorkArea() == wa)
return;
if (currentBufferView())
}
-BufferView const * GuiView::documentBufferView() const
+BufferView const * GuiView::documentBufferView() const
{
return currentMainWorkArea()
? ¤tMainWorkArea()->bufferView()
break;
case LFUN_MASTER_BUFFER_UPDATE:
- case LFUN_MASTER_BUFFER_VIEW:
+ case LFUN_MASTER_BUFFER_VIEW:
enable = doc_buffer && doc_buffer->parent() != 0
&& !d.preview_watcher_.isRunning();
break;
break;
}
b = theBufferList().next(b);
- } while (b != first);
+ } while (b != first);
break;
}
flag.setOnOff(t->isVisible());
else {
enable = false;
- docstring const msg =
+ docstring const msg =
bformat(_("Unknown toolbar \"%1$s\""), from_utf8(name));
flag.message(msg);
}
}
case LFUN_DROP_LAYOUTS_CHOICE:
- enable = buf;
+ enable = buf;
break;
case LFUN_UI_TOGGLE:
case LFUN_BUFFER_ZOOM_IN:
enable = doc_buffer;
break;
-
+
case LFUN_BUFFER_NEXT:
case LFUN_BUFFER_PREVIOUS:
// FIXME: should we check is there is an previous or next buffer?
setBusy(false);
return 0;
}
-
+
setBuffer(newBuffer);
// scroll to the position when the file was last closed
filename = fname;
// get absolute path of file and add ".lyx" to the filename if
- // necessary.
- FileName const fullname =
+ // necessary.
+ FileName const fullname =
fileSearch(string(), filename, "lyx", support::may_not_exist);
if (!fullname.empty())
filename = fullname.absFileName();
return;
}
- // if the file doesn't exist and isn't already open (bug 6645),
+ // if the file doesn't exist and isn't already open (bug 6645),
// let the user create one
if (!fullname.exists() && !theBufferList().exists(fullname)) {
// the user specifically chose this name. Believe him.
if (templatefile.empty())
return;
}
-
+
Buffer * b;
if (filename.empty())
b = newUnnamedFile(initpath, to_utf8(_("newfile")), templatefile);
if (b)
setBuffer(b);
- // If no new document could be created, it is unsure
+ // If no new document could be created, it is unsure
// whether there is a valid BufferView.
if (currentBufferView())
// Ensure the cursor is correctly positioned on screen.
// FIXME UNICODE
FileName filename(to_utf8(fname));
-
+
if (!filename.empty()) {
bv->insertLyXFile(filename);
return;
// FIXME UNICODE
FileName filename(to_utf8(fname));
-
+
if (!filename.empty()) {
bv->insertPlaintextFile(filename, asParagraph);
return;
docstring const file = makeDisplayPath(fname.absFileName(), 30);
docstring text = bformat(_("The document %1$s already "
"exists.\n\nDo you want to "
- "overwrite that document?"),
+ "overwrite that document?"),
file);
int const ret = Alert::prompt(_("Overwrite document?"),
text, 0, 2, _("&Overwrite"), _("&Rename"), _("&Cancel"));
// bring the autosave file with us, just in case.
b.moveAutosaveFile(oldauto);
-
+
if (!saveBuffer(b)) {
oldauto = b.getAutosaveFileName();
b.setFileName(oldname.absFileName());
setCurrentWorkArea(currentMainWorkArea());
// We might be in a situation that there is still a tabWorkArea, but
- // there are no tabs anymore. This can happen when we get here after a
+ // there are no tabs anymore. This can happen when we get here after a
// TabWorkArea::lastWorkAreaRemoved() signal. Therefore we count how
// many TabWorkArea's have no documents anymore.
int empty_twa = 0;
// We only want to close the buffer if the same buffer is not visible
// in another view, and if this is not a child and if we are closing
// a view (not a tabgroup).
- bool const close_buffer =
+ bool const close_buffer =
!inMultiViews(wa) && !b.parent() && closing_;
if (!closeWorkArea(wa, close_buffer))
docstring const text = bformat(_("The document %1$s has not been "
"saved yet.\n\nDo you want to save "
"the document?"), file);
- ret = Alert::prompt(_("Save new document?"),
+ ret = Alert::prompt(_("Save new document?"),
text, 0, 1, _("&Save"), _("&Cancel"));
if (ret == 1)
++ret;
for (int i = 0; i != ids.size() && found_twa <= 1; ++i) {
if (id_ == ids[i])
continue;
-
+
if (guiApp->view(ids[i]).workArea(buf))
return true;
}
"changes.\n\nDo you want to save "
"the document?"), file);
title = _("Save changed document?");
-
+
} else {
text = bformat(_("The document %1$s has not been "
"saved yet.\n\nDo you want to save "
// when the target is in the parent or another child document.
child->setParent(&buffer);
- // I don't think this is needed, since it will be called in
+ // I don't think this is needed, since it will be called in
// setBuffer().
// child->masterBuffer()->updateBuffer();
setBuffer(child);
break;
// GCC only sees strfwd.h when building merged
if (::lyx::operator==(cmd.argument(), "custom")) {
- dispatch(FuncRequest(LFUN_DIALOG_SHOW, "sendto"),
+ dispatch(FuncRequest(LFUN_DIALOG_SHOW, "sendto"),
dr);
break;
}
dr.setError(true);
dr.setMessage(_("Document not loaded"));
break;
- }
+ }
// Do we open or switch to the buffer in this view ?
- if (workArea(*buffer)
+ if (workArea(*buffer)
|| lyxrc.open_buffers_in_tabs || !documentBufferView()) {
setBuffer(buffer);
break;
- }
-
+ }
+
// Look for the buffer in other views
QList<int> const ids = guiApp->viewIds();
int i = 0;
LYXERR(Debug::ACTION, "Saved " << b->absFileName());
}
b = theBufferList().next(b);
- } while (b != first);
+ } while (b != first);
dr.setMessage(_("All documents saved."));
break;
}
if (!data.empty())
showDialog("character", data);
} else if (name == "latexlog") {
- Buffer::LogType type;
+ Buffer::LogType type;
string const logfile = doc_buffer->logName(&type);
switch (type) {
case Buffer::latexlog:
}
}
break;
-
+
case LFUN_COMPLETION_INLINE:
if (d.current_work_area_)
d.current_work_area_->completer().showInline();
if (lyxrc.zoom < 10)
lyxrc.zoom = 10;
-
+
// The global QPixmapCache is used in GuiPainter to cache text
// painting so we must reset it.
QPixmapCache::clear();
currentBufferView()->editInset(name, inset);
// We only set the focus to the new dialog if it was not yet
// visible in order not to change the existing previous behaviour
- if (visible) {
+ if (visible) {
// activateWindow is needed for floating dockviews
dialog->asQWidget()->raise();
dialog->asQWidget()->activateWindow();
return createGuiIndex(*this);
if (name == "index_print")
return createGuiPrintindex(*this);
- if (name == "label")
- return createGuiLabel(*this);
if (name == "line")
return createGuiLine(*this);
+ if (name == "label")
+ return createGuiLabel(*this);
if (name == "listings")
return createGuiListings(*this);
if (name == "log")