#include "frontends/alert.h"
#include "frontends/Application.h"
-#include "frontends/Gui.h"
#include "frontends/LyXView.h"
#include "support/environment.h"
}
-Buffer const * LyX::updateInset(Inset const * inset) const
-{
- if (quitting || !inset)
- return 0;
- return application().gui().updateInset(inset);
-}
-
-
-void LyX::hideDialogs(std::string const & name, Inset * inset) const
-{
- if (quitting || !use_gui)
- return;
- application().gui().hideDialogs(name, inset);
-}
-
-
int LyX::exec(int & argc, char * argv[])
{
// Here we need to parse the command line. At least
///
frontend::LyXView * newLyXView();
- /** redraw \c inset in all the BufferViews in which it is currently
- * visible. If successful return a pointer to the owning Buffer.
- */
- Buffer const * updateInset(Inset const *) const;
-
- void hideDialogs(std::string const & name, Inset * inset) const;
-
/// Execute batch commands if available.
void execBatchCommands();
}
case LFUN_DIALOG_HIDE: {
- LyX::cref().hideDialogs(argument, 0);
+ if (quitting || !use_gui)
+ break;
+ theApp()->gui().hideDialogs(argument, 0);
break;
}
#include "MetricsInfo.h"
#include "frontends/Painter.h"
+#include "frontends/Application.h"
+#include "frontends/Gui.h"
#include "support/convert.h"
namespace lyx {
+extern bool quitting;
+
class InsetName {
public:
- InsetName(std::string const & n, InsetCode c)
- : name(n), code(c) {}
+ InsetName(std::string const & n, InsetCode c) : name(n), code(c) {}
std::string name;
InsetCode code;
};
mi.base.bv->coordCache().insets().add(this, dim);
}
+
+Buffer const * Inset::updateFrontend() const
+{
+ if (quitting)
+ return 0;
+ return theApp()->gui().updateInset(this);
+}
+
} // namespace lyx
/// Update the counters of this inset and of its contents
virtual void updateLabels(Buffer const &, ParIterator const &) {}
+ /// Updates the inset's dialog
+ virtual Buffer const * updateFrontend() const;
public:
/// returns LyX code associated with the inset. Used for TOC, ...)
#include "FuncRequest.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
-#include "LyX.h"
#include "Lexer.h"
#include "LyXRC.h"
#include "MetricsInfo.h"
namespace lyx {
+extern bool use_gui;
+
namespace external {
TempName::TempName()
}
-TempName &
-TempName::operator=(TempName const & other)
+TempName & TempName::operator=(TempName const & other)
{
if (this != &other)
tempname_ = TempName()();
break;
default:
- lex.printError("ExternalInset::read: "
- "Wrong tag: $$Token");
+ lex.printError("ExternalInset::read: Wrong tag: $$Token");
read_error = true;
break;
}
void InsetExternal::statusChanged() const
{
- LyX::cref().updateInset(this);
+ updateFrontend();
}
button_ptr->update(getScreenLabel(params_, buffer), true);
break;
+ }
- } case RENDERGRAPHIC: {
+ case RENDERGRAPHIC: {
RenderGraphic * graphic_ptr = renderer_->asGraphic();
if (!graphic_ptr) {
renderer_.reset(new RenderGraphic(this));
graphic_ptr->update(get_grfx_params(params_));
break;
+ }
- } case RENDERPREVIEW: {
+ case RENDERPREVIEW: {
RenderMonitoredPreview * preview_ptr =
renderer_->asMonitoredPreview();
if (!preview_ptr) {
void InsetExternal::fileChanged() const
{
- Buffer const * const buffer_ptr = LyX::cref().updateInset(this);
- if (!buffer_ptr)
+ Buffer const * const buffer = updateFrontend();
+ if (!buffer)
return;
RenderMonitoredPreview * const ptr = renderer_->asMonitoredPreview();
BOOST_ASSERT(ptr);
- Buffer const & buffer = *buffer_ptr;
- ptr->removePreview(buffer);
- add_preview_and_start_loading(*ptr, *this, buffer);
+ ptr->removePreview(*buffer);
+ add_preview_and_start_loading(*ptr, *this, *buffer);
}
void InsetInclude::fileChanged() const
{
- Buffer const * const buffer_ptr = LyX::cref().updateInset(this);
- if (!buffer_ptr)
+ Buffer const * const buffer = updateFrontend();
+ if (!buffer)
return;
- Buffer const & buffer = *buffer_ptr;
- preview_->removePreview(buffer);
- add_preview(*preview_.get(), *this, buffer);
- preview_->startLoading(buffer);
+ preview_->removePreview(*buffer);
+ add_preview(*preview_.get(), *this, *buffer);
+ preview_->startLoading(*buffer);
}
#include "BufferView.h"
#include "debug.h"
-#include "LyX.h"
+
+#include "frontends/Application.h"
+#include "frontends/Gui.h"
#include <boost/assert.hpp>
void MailInset::hideDialog() const
{
- LyX::cref().hideDialogs(name(), &inset());
+ theApp()->gui().hideDialogs(name(), &inset());
}
namespace lyx {
-using support::onlyFilename;
-
-using std::string;
-
RenderGraphic::RenderGraphic(Inset const * inset)
{
- loader_.connect(boost::bind(&LyX::updateInset,
- boost::cref(LyX::cref()), inset));
+ loader_.connect(boost::bind(&Inset::updateFrontend, inset));
}
-RenderGraphic::RenderGraphic(RenderGraphic const & other,
- Inset const * inset)
- : RenderBase(other),
- loader_(other.loader_),
- params_(other.params_)
+RenderGraphic::RenderGraphic(RenderGraphic const & other, Inset const * inset)
+ : RenderBase(other), loader_(other.loader_), params_(other.params_)
{
- loader_.connect(boost::bind(&LyX::updateInset,
- boost::cref(LyX::cref()), inset));
+ loader_.connect(boost::bind(&Inset::updateFrontend, inset));
}
{
params_ = params;
- if (!params_.filename.empty()) {
+ if (!params_.filename.empty())
loader_.reset(params_.filename, params_);
- }
}
msgFont.setFamily(SANS_FAMILY);
// FIXME UNICODE
- docstring const justname =
- from_utf8(onlyFilename(params_.filename.absFilename()));
+ docstring const justname = from_utf8(params_.filename.onlyFileName());
if (!justname.empty()) {
msgFont.setSize(FONT_SIZE_FOOTNOTE);
- font_width = theFontMetrics(msgFont)
- .width(justname);
+ font_width = theFontMetrics(msgFont).width(justname);
}
docstring const msg = statusMessage(params_, loader_.status());
// Print the file name.
FontInfo msgFont = pi.base.font;
msgFont.setFamily(SANS_FAMILY);
- string const justname = onlyFilename(params_.filename.absFilename());
+ std::string const justname = params_.filename.onlyFileName();
if (!justname.empty()) {
msgFont.setSize(FONT_SIZE_FOOTNOTE);
{
// Check the current snippet is the same as that previewed.
if (snippet_ == pimage.snippet())
- LyX::cref().updateInset(parent_);
+ parent_->updateFrontend();
}
RenderMonitoredPreview::RenderMonitoredPreview(Inset const * inset)
- : RenderPreview(inset),
- monitor_(FileName(), 2000)
+ : RenderPreview(inset), monitor_(FileName(), 2000)
{}