* lyxfunc.h:
- theLyXFunc(): new function in the global namespace.
- lyx::dispatch(): new function in the lyx namespace.
- lyx::getStatus(): new function in the lyx namespace.
* bufferlist.h:
- theBufferList(): new function in the global namespace.
* Clipboard.h:
- theClipboard(): new function in the global namespace.
* Selection.h:
- theSelection(): new function in the global namespace.
* FontLoader.h:
- theFontLoader(): new function in the global namespace.
* FontMetrics.h:
- theFontMetrics(LyXFont const &): new function in the global namespace.
* Application.C: implements the functions defined above.
* LyXView.h:
- getLyXFunc(): deleted.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15298
a592a061-630c-0410-9148-
cb99ea01b6c8
68 files changed:
#include "insets/insettext.h"
#include "frontends/Alert.h"
#include "insets/insettext.h"
#include "frontends/Alert.h"
-#include "frontends/Application.h"
#include "frontends/FileDialog.h"
#include "frontends/FileDialog.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "graphics/Previews.h"
#include "frontends/FontMetrics.h"
#include "graphics/Previews.h"
lyxerr[Debug::INFO] << BOOST_CURRENT_FUNCTION
<< " No Buffer!" << endl;
// We are closing the buffer, use the first buffer as current
lyxerr[Debug::INFO] << BOOST_CURRENT_FUNCTION
<< " No Buffer!" << endl;
// We are closing the buffer, use the first buffer as current
- buffer_ = theApp->bufferList().first();
+ buffer_ = theBufferList().first();
} else {
// Set current buffer
buffer_ = b;
} else {
// Set current buffer
buffer_ = b;
s = filename;
// File already open?
s = filename;
// File already open?
- if (theApp->bufferList().exists(s)) {
+ if (theBufferList().exists(s)) {
docstring const file = makeDisplayPath(s, 20);
docstring text = bformat(_("The document %1$s is already "
"loaded.\n\nDo you want to revert "
docstring const file = makeDisplayPath(s, 20);
docstring text = bformat(_("The document %1$s is already "
"loaded.\n\nDo you want to revert "
text, 0, 1, _("&Revert"), _("&Switch to document"));
if (ret != 0) {
text, 0, 1, _("&Revert"), _("&Switch to document"));
if (ret != 0) {
- setBuffer(theApp->bufferList().getBuffer(s));
+ setBuffer(theBufferList().getBuffer(s));
return true;
}
// FIXME: should be LFUN_REVERT
return true;
}
// FIXME: should be LFUN_REVERT
- if (!theApp->bufferList().close(theApp->bufferList().getBuffer(s), false))
+ if (!theBufferList().close(theBufferList().getBuffer(s), false))
return false;
// Fall through to new load. (Asger)
}
return false;
// Fall through to new load. (Asger)
}
Buffer * b = 0;
if (found) {
Buffer * b = 0;
if (found) {
- b = theApp->bufferList().newBuffer(s);
+ b = theBufferList().newBuffer(s);
if (!::loadLyXFile(b, s)) {
if (!::loadLyXFile(b, s)) {
- theApp->bufferList().release(b);
+ theBufferList().release(b);
void BufferView::reload()
{
string const fn = buffer_->fileName();
void BufferView::reload()
{
string const fn = buffer_->fileName();
- if (theApp->bufferList().close(buffer_, false))
+ if (theBufferList().close(buffer_, false))
bool BufferView::fitCursor()
{
if (bv_funcs::status(this, cursor_) == bv_funcs::CUR_INSIDE) {
bool BufferView::fitCursor()
{
if (bv_funcs::status(this, cursor_) == bv_funcs::CUR_INSIDE) {
- lyx::frontend::FontMetrics const & fm
- = theApp->fontLoader().metrics(cursor_.getFont());
+ lyx::frontend::FontMetrics const & fm =
+ theFontMetrics(cursor_.getFont());
int const asc = fm.maxAscent();
int const des = fm.maxDescent();
Point const p = bv_funcs::getPos(cursor_, cursor_.boundary());
int const asc = fm.maxAscent();
int const des = fm.maxDescent();
Point const p = bv_funcs::getPos(cursor_, cursor_.boundary());
if (fname != buffer_->fileName()) {
Buffer * b = 0;
if (fname != buffer_->fileName()) {
Buffer * b = 0;
- if (theApp->bufferList().exists(fname))
- b = theApp->bufferList().getBuffer(fname);
+ if (theBufferList().exists(fname))
+ b = theBufferList().getBuffer(fname);
- b = theApp->bufferList().newBuffer(fname);
+ b = theBufferList().newBuffer(fname);
// Don't ask, just load it
::loadLyXFile(b, fname);
}
// Don't ask, just load it
::loadLyXFile(b, fname);
}
#include "support/lstrings.h"
#include "support/lstrings.h"
-#include "frontends/Application.h"
#include "frontends/Clipboard.h"
#include <boost/tuple/tuple.hpp>
#include "frontends/Clipboard.h"
#include <boost/tuple/tuple.hpp>
// solved by running the line below only when the selection has
// finished. The solution used currently just works, to make it
// faster we need to be more clever and probably also have more
// solved by running the line below only when the selection has
// finished. The solution used currently just works, to make it
// faster we need to be more clever and probably also have more
- // calls to theApp->selection().put. (Lgb)
-// theApp->selection().put(cur.selectionAsString(true));
+ // calls to theSelection().put. (Lgb)
+// theSelection().put(cur.selectionAsString(true));
// make sure that the depth behind the selection are restored, too
// make sure that the depth behind the selection are restored, too
void copySelection(LCursor & cur)
{
// stuff the selection onto the X clipboard, from an explicit copy request
void copySelection(LCursor & cur)
{
// stuff the selection onto the X clipboard, from an explicit copy request
- theApp->clipboard().put(cur.selectionAsString(true));
+ theClipboard().put(cur.selectionAsString(true));
// this doesn't make sense, if there is no selection
if (!cur.selection())
// this doesn't make sense, if there is no selection
if (!cur.selection())
#include "debug.h"
#include "DepTable.h"
#include "debug.h"
#include "DepTable.h"
-#include "frontends/Application.h"
-
#include "support/filetools.h"
#include "support/convert.h"
#include "support/lstrings.h"
#include "support/filetools.h"
#include "support/convert.h"
#include "support/lstrings.h"
bool rerun = false; // rerun requested
// The class LaTeX does not know the temp path.
bool rerun = false; // rerun requested
// The class LaTeX does not know the temp path.
- theApp->bufferList().updateIncludedTeXfiles(getcwd(), runparams);
+ theBufferList().updateIncludedTeXfiles(getcwd(), runparams);
// Never write the depfile if an error was encountered.
// Never write the depfile if an error was encountered.
#include "lyxlex.h"
#include "toc.h"
#include "lyxlex.h"
#include "toc.h"
-#include "frontends/Application.h"
-
#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/convert.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/convert.h"
case MenuItem::Command: {
FuncStatus status =
case MenuItem::Command: {
FuncStatus status =
- theApp->lyxFunc().getStatus(i.func());
+ lyx::getStatus(i.func());
if (status.unknown()
|| (!status.enabled() && i.optional()))
break;
if (status.unknown()
|| (!status.enabled() && i.optional()))
break;
void expandDocuments(Menu & tomenu)
{
typedef vector<string> Strings;
void expandDocuments(Menu & tomenu)
{
typedef vector<string> Strings;
- Strings const names = theApp->bufferList().getFileNames();
+ Strings const names = theBufferList().getFileNames();
if (names.empty()) {
tomenu.add(MenuItem(MenuItem::Command, _("No Documents Open!"),
if (names.empty()) {
tomenu.add(MenuItem(MenuItem::Command, _("No Documents Open!"),
#include "mathed/MathSupport.h"
#include "frontends/Alert.h"
#include "mathed/MathSupport.h"
#include "frontends/Alert.h"
-#include "frontends/Application.h"
#include "graphics/Previews.h"
#include "graphics/Previews.h"
Buffer const * Buffer::getMasterBuffer() const
{
if (!params().parentname.empty()
Buffer const * Buffer::getMasterBuffer() const
{
if (!params().parentname.empty()
- && theApp->bufferList().exists(params().parentname)) {
- Buffer const * buf = theApp->bufferList().getBuffer(params().parentname);
+ && theBufferList().exists(params().parentname)) {
+ Buffer const * buf = theBufferList().getBuffer(params().parentname);
if (buf)
return buf->getMasterBuffer();
}
if (buf)
return buf->getMasterBuffer();
}
Buffer * Buffer::getMasterBuffer()
{
if (!params().parentname.empty()
Buffer * Buffer::getMasterBuffer()
{
if (!params().parentname.empty()
- && theApp->bufferList().exists(params().parentname)) {
- Buffer * buf = theApp->bufferList().getBuffer(params().parentname);
+ && theBufferList().exists(params().parentname)) {
+ Buffer * buf = theBufferList().getBuffer(params().parentname);
if (buf)
return buf->getMasterBuffer();
}
if (buf)
return buf->getMasterBuffer();
}
#include "toc.h"
#include "frontends/Alert.h"
#include "toc.h"
#include "frontends/Alert.h"
-#include "frontends/Application.h"
#include "insets/insetbibitem.h"
#include "insets/insetbibitem.h"
bool const isNamed)
{
// get a free buffer
bool const isNamed)
{
// get a free buffer
- Buffer * b = theApp->bufferList().newBuffer(filename);
+ Buffer * b = theBufferList().newBuffer(filename);
BOOST_ASSERT(b);
string tname;
BOOST_ASSERT(b);
string tname;
_("The specified document template\n%1$s\ncould not be read."),
file);
Alert::error(_("Could not read template"), text);
_("The specified document template\n%1$s\ncould not be read."),
file);
Alert::error(_("Could not read template"), text);
- theApp->bufferList().release(b);
+ theBufferList().release(b);
void emergencyWrite(Buffer * buf);
};
void emergencyWrite(Buffer * buf);
};
+extern BufferList & theBufferList();
+
#include "support/limited_stack.h"
#include "support/limited_stack.h"
-#include "frontends/Application.h"
-
#include <boost/assert.hpp>
#include <boost/bind.hpp>
#include <boost/current_function.hpp>
#include <boost/assert.hpp>
#include <boost/bind.hpp>
#include <boost/current_function.hpp>
void LCursor::message(docstring const & msg) const
{
void LCursor::message(docstring const & msg) const
{
- theApp->lyxFunc().setMessage(msg);
+ theLyXFunc().setMessage(msg);
}
void LCursor::errorMessage(docstring const & msg) const
{
}
void LCursor::errorMessage(docstring const & msg) const
{
- theApp->lyxFunc().setErrorMessage(msg);
+ theLyXFunc().setErrorMessage(msg);
#include <config.h>
#include "dimension.h"
#include <config.h>
#include "dimension.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/FontMetrics.h"
void Dimension::clear(LyXFont const & font)
{
void Dimension::clear(LyXFont const & font)
{
- lyx::frontend::FontMetrics const & fm = theApp->fontLoader().metrics(font);
+ lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
asc = fm.maxAscent();
des = fm.maxDescent();
wid = 0;
asc = fm.maxAscent();
des = fm.maxDescent();
wid = 0;
-#include "Application.h"
+#include "frontends/Application.h"
-#include "Gui.h"
-#include "LyXView.h"
-#include "WorkArea.h"
+#include "frontends/FontLoader.h"
+#include "frontends/FontMetrics.h"
+#include "frontends/Gui.h"
+#include "frontends/LyXView.h"
+#include "frontends/WorkArea.h"
#include "bufferlist.h"
#include "funcrequest.h"
#include "bufferlist.h"
#include "funcrequest.h"
#include "lyxfunc.h"
#include "lyxrc.h"
#include "lyxserver.h"
#include "lyxfunc.h"
#include "lyxrc.h"
#include "lyxserver.h"
+
+
+FuncStatus getStatus(FuncRequest const & action)
+{
+ return theApp->lyxFunc().getStatus(action);
+}
+
+
+void dispatch(FuncRequest const & action)
+{
+ theApp->lyxFunc().dispatch(action);
+}
+
+
+
+LyXFunc & theLyXFunc()
+{
+ return theApp->lyxFunc();
+}
+
+
+BufferList & theBufferList()
+{
+ return theApp->bufferList();
+}
+
+
+lyx::frontend::FontLoader & theFontLoader()
+{
+ return theApp->fontLoader();
+}
+
+
+lyx::frontend::FontMetrics const & theFontMetrics(LyXFont const & f)
+{
+ return theApp->fontLoader().metrics(f);
+}
+
+
+lyx::frontend::Clipboard & theClipboard()
+{
+ return theApp->clipboard();
+}
+
+
+lyx::frontend::Selection & theSelection()
+{
+ return theApp->selection();
+}
} // namespace frontend
} // namespace lyx
} // namespace frontend
} // namespace lyx
+extern lyx::frontend::Clipboard & theClipboard();
+
#endif // BASE_CLIPBOARD_H
#endif // BASE_CLIPBOARD_H
} // namespace frontend
} // namespace lyx
} // namespace frontend
} // namespace lyx
+extern lyx::frontend::FontLoader & theFontLoader();
+
} // namespace frontend
} // namespace lyx
} // namespace frontend
} // namespace lyx
+class LyXFont;
+
+extern lyx::frontend::FontMetrics const & theFontMetrics(LyXFont const & f);
+
{
bool const math = work_area_->bufferView().cursor().inMathed();
bool const table =
{
bool const math = work_area_->bufferView().cursor().inMathed();
bool const table =
- getLyXFunc().getStatus(FuncRequest(LFUN_LAYOUT_TABULAR)).enabled();
+ lyx::getStatus(FuncRequest(LFUN_LAYOUT_TABULAR)).enabled();
toolbars_->update(math, table);
// update redaonly status of open dialogs. This could also be in
// updateMenubar(), but since updateToolbars() and updateMenubar()
toolbars_->update(math, table);
// update redaonly status of open dialogs. This could also be in
// updateMenubar(), but since updateToolbars() and updateMenubar()
void LyXView::dispatch(FuncRequest const & cmd)
{
void LyXView::dispatch(FuncRequest const & cmd)
{
- getLyXFunc().dispatch(cmd);
/// return the buffer currently shown in this window
Buffer * buffer() const;
/// return the buffer currently shown in this window
Buffer * buffer() const;
- /* FIXME: Abdel 22/09/71
- there is only one lyxFunc() for now but there is maybe a need
- for more in the feature. Something like that:
-
- LyXFunc & getLyXFunc() { return theApp->lyxFunc(id_); }
-
- where id_ would be the this LyXView ID.
- That's the reason why I didn't remove these methods for now.
- */
- /// return the LyX function handler for this view
- LyXFunc & getLyXFunc() { return theApp->lyxFunc(); }
- ///
- LyXFunc const & getLyXFunc() const { return theApp->lyxFunc(); }
-
/// return the toolbar for this view
Toolbars & getToolbars() { return *toolbars_.get(); }
///
/// return the toolbar for this view
Toolbars & getToolbars() { return *toolbars_.get(); }
///
#include "frontends/Painter.h"
#include "frontends/Painter.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "LColor.h"
#include "frontends/FontMetrics.h"
#include "LColor.h"
- FontMetrics const & fm = theApp->fontLoader().metrics(font);
+ FontMetrics const & fm = theFontMetrics(font);
fm.rectText(str, width, ascent, descent);
if (back != LColor::none)
fm.rectText(str, width, ascent, descent);
if (back != LColor::none)
- FontMetrics const & fm = theApp->fontLoader().metrics(font);
+ FontMetrics const & fm = theFontMetrics(font);
fm.buttonText(str, width, ascent, descent);
button(x, y - ascent, width, descent + ascent);
fm.buttonText(str, width, ascent, descent);
button(x, y - ascent, width, descent + ascent);
void Painter::underline(LyXFont const & f, int x, int y, int width)
{
void Painter::underline(LyXFont const & f, int x, int y, int width)
{
- FontMetrics const & fm = theApp->fontLoader().metrics(f);
+ FontMetrics const & fm = theFontMetrics(f);
int const below = max(fm.maxDescent() / 2, 2);
int const height = max((fm.maxDescent() / 4) - 1, 1);
int const below = max(fm.maxDescent() / 2, 2);
int const height = max((fm.maxDescent() / 4) - 1, 1);
} // namespace frontend
} // namespace lyx
} // namespace frontend
} // namespace lyx
+extern lyx::frontend::Selection & theSelection();
+
#endif // BASE_SELECTION_H
#endif // BASE_SELECTION_H
for (; it != end; ++it)
it->second->update();
for (; it != end; ++it)
it->second->update();
- bool const enable = owner_.getLyXFunc().
- getStatus(FuncRequest(LFUN_LAYOUT)).enabled();
+ bool const enable =
+ lyx::getStatus(FuncRequest(LFUN_LAYOUT)).enabled();
if (layout_)
layout_->setEnabled(enable);
if (layout_)
layout_->setEnabled(enable);
if (lyx::to_utf8(_(itname)) == name) {
FuncRequest const func(LFUN_LAYOUT, itname,
FuncRequest::UI);
if (lyx::to_utf8(_(itname)) == name) {
FuncRequest const func(LFUN_LAYOUT, itname,
FuncRequest::UI);
- lv.getLyXFunc().dispatch(func);
#include "frontends/WorkArea.h"
#include "frontends/Application.h"
#include "frontends/WorkArea.h"
#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "funcrequest.h"
#include "frontends/FontMetrics.h"
#include "funcrequest.h"
key_modifier::state state)
{
hideCursor();
key_modifier::state state)
{
hideCursor();
- lyx_view_.getLyXFunc().processKeySym(key, state);
+ theLyXFunc().processKeySym(key, state);
/* This is perhaps a bit of a hack. When we move
* around, or type, it's nice to be able to see
/* This is perhaps a bit of a hack. When we move
* around, or type, it's nice to be able to see
shape = BAR_SHAPE;
LyXFont const font = buffer_view_->cursor().getFont();
shape = BAR_SHAPE;
LyXFont const font = buffer_view_->cursor().getFont();
- FontMetrics const & fm = theApp->fontLoader().metrics(font);
+ FontMetrics const & fm = theFontMetrics(font);
int const asc = fm.maxAscent();
int const des = fm.maxDescent();
int h = asc + des;
int const asc = fm.maxAscent();
int const des = fm.maxDescent();
int h = asc + des;
history_pos_ = history_.end();
FuncRequest func = lyxaction.lookupFunc(str);
func.origin = FuncRequest::COMMANDBUFFER;
history_pos_ = history_.end();
FuncRequest func = lyxaction.lookupFunc(str);
func.origin = FuncRequest::COMMANDBUFFER;
- lv_.getLyXFunc().dispatch(func);
}
} // namespace frontend
}
} // namespace frontend
#include "paper.h"
#include "LColor.h"
#include "paper.h"
#include "LColor.h"
-#include "frontends/Application.h"
-
#include "support/filefilterlist.h"
#include <sstream>
#include "support/filefilterlist.h"
#include <sstream>
kernel().dispatch(FuncRequest(LFUN_LYXRC_APPLY, ss.str()));
// FIXME: these need lfuns
kernel().dispatch(FuncRequest(LFUN_LYXRC_APPLY, ss.str()));
// FIXME: these need lfuns
- theApp->bufferList().setCurrentAuthor(rc_.user_name, rc_.user_email);
+ theBufferList().setCurrentAuthor(rc_.user_name, rc_.user_email);
#include "bufferlist.h"
#include "funcrequest.h"
#include "bufferlist.h"
#include "funcrequest.h"
-#include "frontends/Application.h"
-
#include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
using std::vector;
#include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
using std::vector;
vector<string> const ControlRef::getLabelList(string const & name) const
{
vector<string> const ControlRef::getLabelList(string const & name) const
{
- Buffer const & buf = *theApp->bufferList().getBuffer(makeAbsPath(name));
+ Buffer const & buf = *theBufferList().getBuffer(makeAbsPath(name));
vector<string> list;
buf.getLabelList(list);
return list;
vector<string> list;
buf.getLabelList(list);
return list;
vector<string> const ControlRef::getBufferList() const
{
vector<string> const ControlRef::getBufferList() const
{
- vector<string> buffers = theApp->bufferList().getFileNames();
+ vector<string> buffers = theBufferList().getFileNames();
for (vector<string>::iterator it = buffers.begin();
it != buffers.end(); ++it) {
*it = lyx::to_utf8(makeDisplayPath(*it));
for (vector<string>::iterator it = buffers.begin();
it != buffers.end(); ++it) {
*it = lyx::to_utf8(makeDisplayPath(*it));
int ControlRef::getBufferNum() const
{
int ControlRef::getBufferNum() const
{
- vector<string> buffers = theApp->bufferList().getFileNames();
+ vector<string> buffers = theBufferList().getFileNames();
string const name = kernel().buffer().fileName();
vector<string>::const_iterator cit =
find(buffers.begin(), buffers.end(), name);
string const name = kernel().buffer().fileName();
vector<string>::const_iterator cit =
find(buffers.begin(), buffers.end(), name);
string const ControlRef::getBufferName(int num) const
{
string const ControlRef::getBufferName(int num) const
{
- return theApp->bufferList().getFileNames()[num];
+ return theBufferList().getFileNames()[num];
}
} // namespace frontend
}
} // namespace frontend
bool Dialog::Controller::canApply() const
{
FuncRequest const fr(getLfun(), dialog().name());
bool Dialog::Controller::canApply() const
{
FuncRequest const fr(getLfun(), dialog().name());
- FuncStatus const fs(kernel().lyxview().getLyXFunc().getStatus(fr));
+ FuncStatus const fs(lyx::getStatus(fr));
void Kernel::dispatch(FuncRequest const & fr) const
{
void Kernel::dispatch(FuncRequest const & fr) const
{
- lyxview_.getLyXFunc().dispatch(fr);
void GMenubar::onCommandActivate(MenuItem const * item,
Gtk::MenuItem * /*gitem*/)
{
void GMenubar::onCommandActivate(MenuItem const * item,
Gtk::MenuItem * /*gitem*/)
{
- view_->getLyXFunc().dispatch(item->func());
+ view_.dispatch(item->func());
}
} // namespace frontend
}
} // namespace frontend
void GToolbar::clicked(FuncRequest func)
{
void GToolbar::clicked(FuncRequest func)
{
- owner_.getLyXFunc().dispatch(func);
FuncRequest const * func = reinterpret_cast<FuncRequest *>(
item->get_data(gToolData));
if (func) {
FuncRequest const * func = reinterpret_cast<FuncRequest *>(
item->get_data(gToolData));
if (func) {
- FuncStatus const status = owner_.getLyXFunc().getStatus(*func);
+ FuncStatus const status = lyx::getStatus(*func);
item->set_sensitive(status.enabled());
}
}
item->set_sensitive(status.enabled());
}
}
// trigger LFUN_LYX_QUIT instead of quit directly
// since LFUN_LYX_QUIT may have more cleanup stuff
//
// trigger LFUN_LYX_QUIT instead of quit directly
// since LFUN_LYX_QUIT may have more cleanup stuff
//
- getLyXFunc().dispatch(FuncRequest(LFUN_LYX_QUIT));
+ dispatch(FuncRequest(LFUN_LYX_QUIT));
void GView::updateStatusBar()
{
void GView::updateStatusBar()
{
- message(lyx::from_utf8(getLyXFunc().viewStatusMessage()));
+ message(lyx::from_utf8(theLyXFunc().viewStatusMessage()));
void GView::clearMessage()
{
void GView::clearMessage()
{
- message(lyx::from_utf8(getLyXFunc().viewStatusMessage()));
+ message(lyx::from_utf8(theLyXFunc().viewStatusMessage()));
toolbar_->setHorizontalStretchable(true);
break;
default: {
toolbar_->setHorizontalStretchable(true);
break;
default: {
- if (owner_.getLyXFunc().getStatus(func).unknown())
+ if (lyx::getStatus(func).unknown())
break;
QPixmap p = QPixmap(toolbarbackend.getIcon(func).c_str());
QToolButton * button =
break;
QPixmap p = QPixmap(toolbarbackend.getIcon(func).c_str());
QToolButton * button =
QToolButton * button = p->first;
FuncRequest const & func = p->second;
QToolButton * button = p->first;
FuncRequest const & func = p->second;
- FuncStatus const status =
- owner_.getLyXFunc().getStatus(func);
+ FuncStatus const status = lyx::getStatus(func);
button->setToggleButton(true);
button->setOn(status.onoff(true));
button->setToggleButton(true);
button->setOn(status.onoff(true));
ButtonMap::const_iterator it = map_.find(button);
if (it != map_.end())
ButtonMap::const_iterator it = map_.find(button);
if (it != map_.end())
- owner_.getLyXFunc().dispatch(it->second);
+ owner_.dispatch(it->second);
else
lyxerr << "non existent tool button selected !" << endl;
}
else
lyxerr << "non existent tool button selected !" << endl;
}
void QtView::update_view_state_qt()
{
void QtView::update_view_state_qt()
{
- statusBar()->message(toqstr(getLyXFunc().viewStatusMessage()));
+ statusBar()->message(toqstr(theLyXFunc().viewStatusMessage()));
statusbar_timer_.stop();
}
statusbar_timer_.stop();
}
if (statusbar_timer_.isActive())
return;
if (statusbar_timer_.isActive())
return;
- statusBar()->message(toqstr(getLyXFunc().viewStatusMessage()));
+ statusBar()->message(toqstr(theLyXFunc().viewStatusMessage()));
}
void QtView::activated(FuncRequest const & func)
{
}
void QtView::activated(FuncRequest const & func)
{
- getLyXFunc().dispatch(func);
}
// trigger LFUN_LYX_QUIT instead of quit directly
// since LFUN_LYX_QUIT may have more cleanup stuff
}
// trigger LFUN_LYX_QUIT instead of quit directly
// since LFUN_LYX_QUIT may have more cleanup stuff
- getLyXFunc().dispatch(FuncRequest(LFUN_LYX_QUIT));
+ dispatch(FuncRequest(LFUN_LYX_QUIT));
- FuncStatus const status = lyxView_.getLyXFunc().getStatus(func_);
+ FuncStatus const status = lyx::getStatus(func_);
if (status.onoff(true)) {
setCheckable(true);
if (status.onoff(true)) {
setCheckable(true);
{
// lyxerr[Debug::ACTION] << "calling LyXFunc::dispatch: func_: " << func_ << endl;
{
// lyxerr[Debug::ACTION] << "calling LyXFunc::dispatch: func_: " << func_ << endl;
- lyxView_.getLyXFunc().dispatch(func_);
+ lyxView_.dispatch(func_);
}
} // namespace frontend
}
} // namespace frontend
#include "GuiView.h"
#include "QLMenubar.h"
#include "QLToolbar.h"
#include "GuiView.h"
#include "QLMenubar.h"
#include "QLToolbar.h"
#include "QCommandBuffer.h"
#include "qt_helpers.h"
#include "QCommandBuffer.h"
#include "qt_helpers.h"
void GuiView::update_view_state_qt()
{
void GuiView::update_view_state_qt()
{
- statusBar()->showMessage(toqstr(getLyXFunc().viewStatusMessage()));
+ statusBar()->showMessage(toqstr(theLyXFunc().viewStatusMessage()));
statusbar_timer_.stop();
}
statusbar_timer_.stop();
}
if (statusbar_timer_.isActive())
return;
if (statusbar_timer_.isActive())
return;
- statusBar()->showMessage(toqstr(getLyXFunc().viewStatusMessage()));
+ statusBar()->showMessage(toqstr(theLyXFunc().viewStatusMessage()));
}
void GuiView::activated(FuncRequest const & func)
{
}
void GuiView::activated(FuncRequest const & func)
{
- getLyXFunc().dispatch(func);
}
// trigger LFUN_LYX_QUIT instead of quit directly
// since LFUN_LYX_QUIT may have more cleanup stuff
}
// trigger LFUN_LYX_QUIT instead of quit directly
// since LFUN_LYX_QUIT may have more cleanup stuff
- getLyXFunc().dispatch(FuncRequest(LFUN_LYX_QUIT));
+ dispatch(FuncRequest(LFUN_LYX_QUIT));
{
if (underMouse_) {
QString const data = QString("%1 %2").arg(bottom_).arg(right_);
{
if (underMouse_) {
QString const data = QString("%1 %2").arg(bottom_).arg(right_);
- lyxView_.getLyXFunc().dispatch(FuncRequest(LFUN_TABULAR_INSERT, fromqstr(data)));
+ lyxView_.dispatch(FuncRequest(LFUN_TABULAR_INSERT, fromqstr(data)));
}
// emit signal
visible(false);
}
// emit signal
visible(false);
void InsertTableWidget::updateParent()
{
void InsertTableWidget::updateParent()
{
- bool status = lyxView_.getLyXFunc().getStatus(FuncRequest(LFUN_TABULAR_INSERT)).enabled();
+ bool status = lyx::getStatus(FuncRequest(LFUN_TABULAR_INSERT)).enabled();
parentWidget()->setEnabled(status);
}
parentWidget()->setEnabled(status);
}
#include "GuiApplication.h"
#include "GuiWorkArea.h"
#include "QLImage.h"
#include "GuiApplication.h"
#include "GuiWorkArea.h"
#include "QLImage.h"
#include "GuiApplication.h"
#include "qt_helpers.h"
#include "GuiApplication.h"
#include "qt_helpers.h"
- if (owner_.getLyXFunc().getStatus(func).unknown())
+ if (lyx::getStatus(func).unknown())
break;
Action * action = new Action(owner_, toolbarbackend.getIcon(func), lyx::docstring(), func, tooltip);
break;
Action * action = new Action(owner_, toolbarbackend.getIcon(func), lyx::docstring(), func, tooltip);
#include "paragraph.h"
#include "ParagraphList.h"
#include "paragraph.h"
#include "ParagraphList.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "support/lstrings.h"
#include "frontends/FontMetrics.h"
#include "support/lstrings.h"
InsetBibitem const * bitem = 0;
// FIXME font is used unitialized, is that correct?
LyXFont font;
InsetBibitem const * bitem = 0;
// FIXME font is used unitialized, is that correct?
LyXFont font;
- lyx::frontend::FontMetrics const & fm =
- theApp->fontLoader().metrics(font);
+ lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
ParagraphList::const_iterator it = buffer.paragraphs().begin();
ParagraphList::const_iterator end = buffer.paragraphs().end();
ParagraphList::const_iterator it = buffer.paragraphs().begin();
ParagraphList::const_iterator end = buffer.paragraphs().end();
#include "metricsinfo.h"
#include "paragraph.h"
#include "metricsinfo.h"
#include "paragraph.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
LCursor cur = mi.base.bv->cursor();
setLabel(cur);
docstring dlab(label.begin(), label.end());
LCursor cur = mi.base.bv->cursor();
setLabel(cur);
docstring dlab(label.begin(), label.end());
- labelwidth_ = theApp->fontLoader().metrics(mi.base.font).width(dlab);
+ labelwidth_ = theFontMetrics(mi.base.font).width(dlab);
dim.wid = labelwidth_;
Dimension textdim;
InsetText::metrics(mi, textdim);
dim.wid = labelwidth_;
Dimension textdim;
InsetText::metrics(mi, textdim);
docstring dlab(label.begin(), label.end());
// FXIME: instead of using the fontLoader metrics, we should make
// painter::text() returns the drawn text witdh.
docstring dlab(label.begin(), label.end());
// FXIME: instead of using the fontLoader metrics, we should make
// painter::text() returns the drawn text witdh.
- labelwidth_ = theApp->fontLoader().metrics(pi.base.font).width(dlab);
+ labelwidth_ = theFontMetrics(pi.base.font).width(dlab);
pi.pain.text(x, y, dlab, pi.base.font);
InsetText::draw(pi, x + labelwidth_, y);
setPosCache(pi, x, y);
pi.pain.text(x, y, dlab, pi.base.font);
InsetText::draw(pi, x + labelwidth_, y);
setPosCache(pi, x, y);
#include "paragraph_funcs.h"
#include "sgml.h"
#include "paragraph_funcs.h"
#include "sgml.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
// FIXME UNICODE
s = lyx::to_utf8(_("Undef: ")) + s;
docstring ds(s.begin(), s.end());
// FIXME UNICODE
s = lyx::to_utf8(_("Undef: ")) + s;
docstring ds(s.begin(), s.end());
- theApp->fontLoader().metrics(font).rectText(ds, w, a, d);
+ theFontMetrics(font).rectText(ds, w, a, d);
dim.wid = max(dim.wid, w);
}
dim.asc += TEXT_TO_INSET_OFFSET;
dim.wid = max(dim.wid, w);
}
dim.asc += TEXT_TO_INSET_OFFSET;
// FIXME UNICODE
s = lyx::to_utf8(_("Undef: ")) + s;
docstring ds(s.begin(), s.end());
// FIXME UNICODE
s = lyx::to_utf8(_("Undef: ")) + s;
docstring ds(s.begin(), s.end());
- theApp->fontLoader().metrics(font).rectText(ds, w, a, d);
+ theFontMetrics(font).rectText(ds, w, a, d);
pi.pain.rectText(x + (dim_.wid - w) / 2, y + desc + a,
ds, font, LColor::none, LColor::none);
}
pi.pain.rectText(x + (dim_.wid - w) / 2, y + desc + a,
ds, font, LColor::none, LColor::none);
}
#include "metricsinfo.h"
#include "paragraph.h"
#include "metricsinfo.h"
#include "paragraph.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
{
Dimension dim;
docstring dlab(label.begin(), label.end());
{
Dimension dim;
docstring dlab(label.begin(), label.end());
- theApp->fontLoader().metrics(labelfont_).buttonText(
+ theFontMetrics(labelfont_).buttonText(
dlab, dim.wid, dim.asc, dim.des);
return dim;
}
dlab, dim.wid, dim.asc, dim.des);
return dim;
}
#include "outputparams.h"
#include "frontends/Alert.h"
#include "outputparams.h"
#include "frontends/Alert.h"
-#include "frontends/Application.h"
#include "frontends/Painter.h"
#include "graphics/PreviewImage.h"
#include "frontends/Painter.h"
#include "graphics/PreviewImage.h"
if (!isLyXFilename(included_file))
return 0;
if (!isLyXFilename(included_file))
return 0;
- return theApp->bufferList().getBuffer(included_file);
+ return theBufferList().getBuffer(included_file);
if (!isLyXFilename(included_file))
return false;
if (!isLyXFilename(included_file))
return false;
- Buffer * buf = theApp->bufferList().getBuffer(included_file);
+ Buffer * buf = theBufferList().getBuffer(included_file);
if (!buf) {
// the readonly flag can/will be wrong, not anymore I think.
if (!fs::exists(included_file))
return false;
if (!buf) {
// the readonly flag can/will be wrong, not anymore I think.
if (!fs::exists(included_file))
return false;
- buf = theApp->bufferList().newBuffer(included_file);
+ buf = theBufferList().newBuffer(included_file);
if (!loadLyXFile(buf, included_file))
return false;
}
if (!loadLyXFile(buf, included_file))
return false;
}
// Don't try to load or copy the file
;
else if (loadIfNeeded(buffer, params_)) {
// Don't try to load or copy the file
;
else if (loadIfNeeded(buffer, params_)) {
- Buffer * tmp = theApp->bufferList().getBuffer(included_file);
+ Buffer * tmp = theBufferList().getBuffer(included_file);
if (tmp->params().textclass != m_buffer->params().textclass) {
// FIXME UNICODE
if (tmp->params().textclass != m_buffer->params().textclass) {
// FIXME UNICODE
string writefile = changeExtension(included_file, ".sgml");
if (loadIfNeeded(buffer, params_)) {
string writefile = changeExtension(included_file, ".sgml");
if (loadIfNeeded(buffer, params_)) {
- Buffer * tmp = theApp->bufferList().getBuffer(included_file);
+ Buffer * tmp = theBufferList().getBuffer(included_file);
string const mangled = FileName(writefile).mangledFilename();
writefile = makeAbsPath(mangled,
string const mangled = FileName(writefile).mangledFilename();
writefile = makeAbsPath(mangled,
// to be loaded:
if (loadIfNeeded(buffer, params_)) {
// a file got loaded
// to be loaded:
if (loadIfNeeded(buffer, params_)) {
// a file got loaded
- Buffer * const tmp = theApp->bufferList().getBuffer(included_file);
+ Buffer * const tmp = theBufferList().getBuffer(included_file);
if (tmp) {
// We must temporarily change features.buffer,
// otherwise it would always be the master buffer,
if (tmp) {
// We must temporarily change features.buffer,
// otherwise it would always be the master buffer,
{
if (loadIfNeeded(buffer, params_)) {
string const included_file = includedFilename(buffer, params_);
{
if (loadIfNeeded(buffer, params_)) {
string const included_file = includedFilename(buffer, params_);
- Buffer * tmp = theApp->bufferList().getBuffer(included_file);
+ Buffer * tmp = theBufferList().getBuffer(included_file);
tmp->setParentName("");
tmp->getLabelList(list);
tmp->setParentName(parentFilename(buffer));
tmp->setParentName("");
tmp->getLabelList(list);
tmp->setParentName(parentFilename(buffer));
{
if (loadIfNeeded(buffer, params_)) {
string const included_file = includedFilename(buffer, params_);
{
if (loadIfNeeded(buffer, params_)) {
string const included_file = includedFilename(buffer, params_);
- Buffer * tmp = theApp->bufferList().getBuffer(included_file);
+ Buffer * tmp = theBufferList().getBuffer(included_file);
tmp->setParentName("");
tmp->fillWithBibKeys(keys);
tmp->setParentName(parentFilename(buffer));
tmp->setParentName("");
tmp->fillWithBibKeys(keys);
tmp->setParentName(parentFilename(buffer));
#include "lyxrc.h"
#include "metricsinfo.h"
#include "lyxrc.h"
#include "metricsinfo.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
void InsetLatexAccent::metrics(MetricsInfo & mi, Dimension & dim) const
{
LyXFont & font = mi.base.font;
void InsetLatexAccent::metrics(MetricsInfo & mi, Dimension & dim) const
{
LyXFont & font = mi.base.font;
- lyx::frontend::FontMetrics const & fm =
- theApp->fontLoader().metrics(font);
+ lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
// This function is a bit too simplistic and is just a
// "try to make a fit for all accents" approach, to
// This function is a bit too simplistic and is just a
// "try to make a fit for all accents" approach, to
char_type accent) const
{
LyXFont const & font = pi.base.font;
char_type accent) const
{
LyXFont const & font = pi.base.font;
- lyx::frontend::FontMetrics const & fm =
- theApp->fontLoader().metrics(font);
+ lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
x -= fm.center(accent);
y -= fm.ascent(ic);
x -= fm.center(accent);
y -= fm.ascent(ic);
if (lyxrc.font_norm_type == LyXRC::ISO_10646_1)
font.setLanguage(english_language);
if (lyxrc.font_norm_type == LyXRC::ISO_10646_1)
font.setLanguage(english_language);
- lyx::frontend::FontMetrics const & fm =
- theApp->fontLoader().metrics(font);
+ lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
if (candisp) {
int x2 = int(x + (fm.rbearing(ic) - fm.lbearing(ic)) / 2);
if (candisp) {
int x2 = int(x + (fm.rbearing(ic) - fm.lbearing(ic)) / 2);
#include "paragraph.h"
#include "paragraph_funcs.h"
#include "paragraph.h"
#include "paragraph_funcs.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
void InsetNewline::metrics(MetricsInfo & mi, Dimension & dim) const
{
void InsetNewline::metrics(MetricsInfo & mi, Dimension & dim) const
{
- lyx::frontend::FontMetrics const & fm =
- theApp->fontLoader().metrics(mi.base.font);
+ lyx::frontend::FontMetrics const & fm
+ = theFontMetrics(mi.base.font);
dim.asc = fm.maxAscent();
dim.des = fm.maxDescent();
dim.wid = fm.width('n');
dim.asc = fm.maxAscent();
dim.des = fm.maxDescent();
dim.wid = fm.width('n');
void InsetNewline::draw(PainterInfo & pi, int x, int y) const
{
lyx::frontend::FontMetrics const & fm =
void InsetNewline::draw(PainterInfo & pi, int x, int y) const
{
lyx::frontend::FontMetrics const & fm =
- theApp->fontLoader().metrics(pi.base.font);
+ theFontMetrics(pi.base.font);
int const wid = fm.width('n');
int const asc = fm.maxAscent();
int const wid = fm.width('n');
int const asc = fm.maxAscent();
#include "metricsinfo.h"
#include "gettext.h"
#include "metricsinfo.h"
#include "gettext.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
int w = 0;
int a = 0;
int d = 0;
int w = 0;
int a = 0;
int d = 0;
- theApp->fontLoader().metrics(font).rectText(label, w, a, d);
+ theFontMetrics(font).rectText(label, w, a, d);
int const text_start = int(x + (dim_.wid - w) / 2);
int const text_end = text_start + w;
int const text_start = int(x + (dim_.wid - w) / 2);
int const text_end = text_start + w;
#include "paragraph.h"
#include "paragraph_funcs.h"
#include "paragraph.h"
#include "paragraph_funcs.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
{
LyXFont & font = mi.base.font;
lyx::frontend::FontMetrics const & fm =
{
LyXFont & font = mi.base.font;
lyx::frontend::FontMetrics const & fm =
- theApp->fontLoader().metrics(font);
dim.asc = fm.maxAscent();
dim.des = fm.maxDescent();
dim.wid = 0;
dim.asc = fm.maxAscent();
dim.des = fm.maxDescent();
dim.wid = 0;
if (text.length() == 2 && text[0] == text[1]) {
pi.pain.text(x, y, text[0], pi.base.font);
if (text.length() == 2 && text[0] == text[1]) {
pi.pain.text(x, y, text[0], pi.base.font);
- int const t = theApp->fontLoader().metrics(pi.base.font)
+ int const t = theFontMetrics(pi.base.font)
.width(',');
pi.pain.text(x + t, y, text[0], pi.base.font);
} else {
.width(',');
pi.pain.text(x + t, y, text[0], pi.base.font);
} else {
#include "outputparams.h"
#include "sgml.h"
#include "outputparams.h"
#include "sgml.h"
-#include "frontends/Application.h"
-
#include "support/lstrings.h"
#include "support/lstrings.h"
case LFUN_MOUSE_PRESS:
// Eventually trigger dialog with button 3 not 1
if (cmd.button() == mouse_button::button3)
case LFUN_MOUSE_PRESS:
// Eventually trigger dialog with button 3 not 1
if (cmd.button() == mouse_button::button3)
- theApp->lyxFunc().dispatch(FuncRequest(LFUN_LABEL_GOTO, getContents()));
+ lyx::dispatch(FuncRequest(LFUN_LABEL_GOTO, getContents()));
else {
InsetCommandMailer("ref", *this).showDialog(&cur.bv());
cur.undispatched();
else {
InsetCommandMailer("ref", *this).showDialog(&cur.bv());
cur.undispatched();
#include "metricsinfo.h"
#include "outputparams.h"
#include "metricsinfo.h"
#include "outputparams.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
{
lyx::frontend::FontMetrics const & fm =
void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
{
lyx::frontend::FontMetrics const & fm =
- theApp->fontLoader().metrics(mi.base.font);
+ theFontMetrics(mi.base.font);
dim.asc = fm.maxAscent();
dim.des = fm.maxDescent();
dim.asc = fm.maxAscent();
dim.des = fm.maxDescent();
void InsetSpace::draw(PainterInfo & pi, int x, int y) const
{
int const w = width();
void InsetSpace::draw(PainterInfo & pi, int x, int y) const
{
int const w = width();
- int const h = theApp->fontLoader().metrics(pi.base.font)
+ int const h = theFontMetrics(pi.base.font)
.ascent('x');
int xp[4], yp[4];
.ascent('x');
int xp[4], yp[4];
#include "lyxlex.h"
#include "metricsinfo.h"
#include "lyxlex.h"
#include "metricsinfo.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
void InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
{
lyx::frontend::FontMetrics const & fm =
void InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
{
lyx::frontend::FontMetrics const & fm =
- theApp->fontLoader().metrics(mi.base.font);
+ theFontMetrics(mi.base.font);
dim.asc = fm.maxAscent();
dim.des = fm.maxDescent();
dim.asc = fm.maxAscent();
dim.des = fm.maxDescent();
case MENU_SEPARATOR:
{
lyx::frontend::FontMetrics const & fm =
case MENU_SEPARATOR:
{
lyx::frontend::FontMetrics const & fm =
- theApp->fontLoader().metrics(font);
// A triangle the width and height of an 'x'
int w = fm.width(lyx::char_type('x'));
// A triangle the width and height of an 'x'
int w = fm.width(lyx::char_type('x'));
#include "support/convert.h"
#include "frontends/Alert.h"
#include "support/convert.h"
#include "frontends/Alert.h"
-#include "frontends/Application.h"
#include "frontends/Clipboard.h"
#include "frontends/Painter.h"
#include "frontends/Selection.h"
#include "frontends/Clipboard.h"
#include "frontends/Painter.h"
#include "frontends/Selection.h"
case LFUN_CLIPBOARD_PASTE:
case LFUN_PRIMARY_SELECTION_PASTE: {
docstring const clip = (cmd.action == LFUN_CLIPBOARD_PASTE) ?
case LFUN_CLIPBOARD_PASTE:
case LFUN_PRIMARY_SELECTION_PASTE: {
docstring const clip = (cmd.action == LFUN_CLIPBOARD_PASTE) ?
- theApp->clipboard().get() :
- theApp->selection().get();
+ theClipboard().get() :
+ theSelection().get();
if (clip.empty())
break;
// pass to InsertAsciiString, but
if (clip.empty())
break;
// pass to InsertAsciiString, but
ostringstream os;
OutputParams const runparams;
paste_tabular->plaintext(cur.buffer(), os, runparams, 0, true, '\t');
ostringstream os;
OutputParams const runparams;
paste_tabular->plaintext(cur.buffer(), os, runparams, 0, true, '\t');
- theApp->clipboard().put(lyx::from_utf8(os.str()));
+ theClipboard().put(lyx::from_utf8(os.str()));
// mark tabular stack dirty
// FIXME: this is a workaround for bug 1919. Should be removed for 1.5,
// when we (hopefully) have a one-for-all paste mechanism.
// mark tabular stack dirty
// FIXME: this is a workaround for bug 1919. Should be removed for 1.5,
// when we (hopefully) have a one-for-all paste mechanism.
#include "lyxtext.h"
#include "metricsinfo.h"
#include "lyxtext.h"
#include "metricsinfo.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
int d = 0;
string lab = label();
docstring dlab(lab.begin(), lab.end());
int d = 0;
string lab = label();
docstring dlab(lab.begin(), lab.end());
- theApp->fontLoader().metrics(font).rectText(dlab, w, a, d);
+ theFontMetrics(font).rectText(dlab, w, a, d);
height = max(height, a + d);
height = max(height, a + d);
font.decSize();
string lab = label();
docstring dlab(lab.begin(), lab.end());
font.decSize();
string lab = label();
docstring dlab(lab.begin(), lab.end());
- theApp->fontLoader().metrics(font).rectText(dlab, w, a, d);
+ theFontMetrics(font).rectText(dlab, w, a, d);
pi.pain.rectText(x + 2 * arrow_size + 5,
start + (end - start) / 2 + (a - d) / 2,
pi.pain.rectText(x + 2 * arrow_size + 5,
start + (end - start) / 2 + (a - d) / 2,
#include "LColor.h"
#include "metricsinfo.h"
#include "LColor.h"
#include "metricsinfo.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
lyx::frontend::FontMetrics const & fm =
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
lyx::frontend::FontMetrics const & fm =
- theApp->fontLoader().metrics(font);
docstring dtext(text_.begin(), text_.end());
docstring dtext(text_.begin(), text_.end());
#include "lyxrc.h"
#include "metricsinfo.h"
#include "lyxrc.h"
#include "metricsinfo.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
docstring djust(justname.begin(), justname.end());
if (!justname.empty()) {
msgFont.setSize(LyXFont::SIZE_FOOTNOTE);
docstring djust(justname.begin(), justname.end());
if (!justname.empty()) {
msgFont.setSize(LyXFont::SIZE_FOOTNOTE);
- font_width = theApp->fontLoader().metrics(msgFont)
+ font_width = theFontMetrics(msgFont)
if (!msg.empty()) {
docstring dmsg(msg.begin(), msg.end());
msgFont.setSize(LyXFont::SIZE_TINY);
if (!msg.empty()) {
docstring dmsg(msg.begin(), msg.end());
msgFont.setSize(LyXFont::SIZE_TINY);
- font_width = std::max(font_width, theApp->fontLoader()
- .metrics(msgFont).width(dmsg));
+ font_width = std::max(font_width,
+ theFontMetrics(msgFont).width(dmsg));
}
dim.wid = std::max(50, font_width + 15);
}
dim.wid = std::max(50, font_width + 15);
docstring djust(justname.begin(), justname.end());
msgFont.setSize(LyXFont::SIZE_FOOTNOTE);
pi.pain.text(x + InsetOld::TEXT_TO_INSET_OFFSET + 6,
docstring djust(justname.begin(), justname.end());
msgFont.setSize(LyXFont::SIZE_FOOTNOTE);
pi.pain.text(x + InsetOld::TEXT_TO_INSET_OFFSET + 6,
- y - theApp->fontLoader().metrics(msgFont).maxAscent() - 4,
+ y - theFontMetrics(msgFont).maxAscent() - 4,
#include "lyxrc.h"
#include "metricsinfo.h"
#include "lyxrc.h"
#include "metricsinfo.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
font.setSize(LyXFont::SIZE_FOOTNOTE);
string stat = statusMessage(mi.base.bv, snippet_);
docstring dstat(stat.begin(), stat.end());
font.setSize(LyXFont::SIZE_FOOTNOTE);
string stat = statusMessage(mi.base.bv, snippet_);
docstring dstat(stat.begin(), stat.end());
- dim.wid = 15 + theApp->fontLoader().metrics(font).width(dstat);
+ dim.wid = 15 + theFontMetrics(font).width(dstat);
string stat = statusMessage(pi.base.bv, snippet_);
docstring dstat(stat.begin(), stat.end());
pi.pain.text(x + offset + 6,
string stat = statusMessage(pi.base.bv, snippet_);
docstring dstat(stat.begin(), stat.end());
pi.pain.text(x + offset + 6,
- y - theApp->fontLoader().metrics(font).maxAscent() - 4,
+ y - theFontMetrics(font).maxAscent() - 4,
lyxerr[Debug::INFO] << "Running QuitLyX." << endl;
if (lyx_gui::use_gui) {
lyxerr[Debug::INFO] << "Running QuitLyX." << endl;
if (lyx_gui::use_gui) {
- if (!noask && !theApp->bufferList().quitWriteAll())
+ if (!noask && !theBufferList().quitWriteAll())
return;
LyX::cref().session().writeFile();
return;
LyX::cref().session().writeFile();
quitting = true;
// close buffers first
quitting = true;
// close buffers first
- theApp->bufferList().closeAll();
+ theBufferList().closeAll();
// do any other cleanup procedures now
lyxerr[Debug::INFO] << "Deleting tmp dir " << package().temp_dir() << endl;
// do any other cleanup procedures now
lyxerr[Debug::INFO] << "Deleting tmp dir " << package().temp_dir() << endl;
if (b)
last_loaded = b;
} else {
if (b)
last_loaded = b;
} else {
- Buffer * buf = theApp->bufferList().newBuffer(s, false);
+ Buffer * buf = theBufferList().newBuffer(s, false);
if (loadLyXFile(buf, s)) {
last_loaded = buf;
ErrorList const & el = buf->errorList("Parse");
if (loadLyXFile(buf, s)) {
last_loaded = buf;
ErrorList const & el = buf->errorList("Parse");
boost::bind(&LyX::printError, this, _1));
}
else
boost::bind(&LyX::printError, this, _1));
}
else
- theApp->bufferList().release(buf);
+ theBufferList().release(buf);
// contain documents etc. which might be helpful on
// a crash
// contain documents etc. which might be helpful on
// a crash
- theApp->bufferList().emergencyWriteAll();
+ theBufferList().emergencyWriteAll();
theApp->server().emergencyCleanup();
}
theApp->server().emergencyCleanup();
}
// --- buffers ----------------------------------------
case LFUN_BUFFER_SWITCH:
// --- buffers ----------------------------------------
case LFUN_BUFFER_SWITCH:
- owner->setBuffer(theApp->bufferList().getBuffer(argument));
+ owner->setBuffer(theBufferList().getBuffer(argument));
break;
case LFUN_BUFFER_NEXT:
break;
case LFUN_BUFFER_NEXT:
- owner->setBuffer(theApp->bufferList().next(view()->buffer()));
+ owner->setBuffer(theBufferList().next(view()->buffer()));
break;
case LFUN_BUFFER_PREVIOUS:
break;
case LFUN_BUFFER_PREVIOUS:
- owner->setBuffer(theApp->bufferList().previous(view()->buffer()));
+ owner->setBuffer(theBufferList().previous(view()->buffer()));
break;
case LFUN_FILE_NEW:
break;
case LFUN_FILE_NEW:
if (prefixIs(file_name, package().temp_dir())) {
// Needed by inverse dvi search. If it is a file
// in tmpdir, call the apropriated function
if (prefixIs(file_name, package().temp_dir())) {
// Needed by inverse dvi search. If it is a file
// in tmpdir, call the apropriated function
- owner->setBuffer(theApp->bufferList().getBufferFromTmp(file_name));
+ owner->setBuffer(theBufferList().getBufferFromTmp(file_name));
} else {
// Must replace extension of the file to be .lyx
// and get full path
string const s = changeExtension(file_name, ".lyx");
// Either change buffer or load the file
} else {
// Must replace extension of the file to be .lyx
// and get full path
string const s = changeExtension(file_name, ".lyx");
// Either change buffer or load the file
- if (theApp->bufferList().exists(s)) {
- owner->setBuffer(theApp->bufferList().getBuffer(s));
+ if (theBufferList().exists(s)) {
+ owner->setBuffer(theBufferList().getBuffer(s));
} else {
owner->loadLyXFile(s);
}
} else {
owner->loadLyXFile(s);
}
makeDisplayPath(filename) + lyx::from_ascii("..."));
view()->savePosition(0);
string const parentfilename = owner->buffer()->fileName();
makeDisplayPath(filename) + lyx::from_ascii("..."));
view()->savePosition(0);
string const parentfilename = owner->buffer()->fileName();
- if (theApp->bufferList().exists(filename))
- owner->setBuffer(theApp->bufferList().getBuffer(filename));
+ if (theBufferList().exists(filename))
+ owner->setBuffer(theBufferList().getBuffer(filename));
else
owner->loadLyXFile(filename);
// Set the parent name of the child document.
else
owner->loadLyXFile(filename);
// Set the parent name of the child document.
case LFUN_SCREEN_FONT_UPDATE:
// handle the screen font changes.
lyxrc.set_font_norm_type();
case LFUN_SCREEN_FONT_UPDATE:
// handle the screen font changes.
lyxrc.set_font_norm_type();
- theApp->fontLoader().update();
+ theFontLoader().update();
// All visible buffers will need resize
view()->resize();
break;
// All visible buffers will need resize
view()->resize();
break;
if (filename.empty()) {
filename = addName(lyxrc.document_path,
"newfile" + convert<string>(++newfile_number) + ".lyx");
if (filename.empty()) {
filename = addName(lyxrc.document_path,
"newfile" + convert<string>(++newfile_number) + ".lyx");
- while (theApp->bufferList().exists(filename) || fs::is_readable(filename)) {
+ while (theBufferList().exists(filename) || fs::is_readable(filename)) {
++newfile_number;
filename = addName(lyxrc.document_path,
"newfile" + convert<string>(newfile_number) +
++newfile_number;
filename = addName(lyxrc.document_path,
"newfile" + convert<string>(newfile_number) +
string const lyxfile = changeExtension(filename, ".lyx");
// Check if the document already is open
string const lyxfile = changeExtension(filename, ".lyx");
// Check if the document already is open
- if (lyx_gui::use_gui && theApp->bufferList().exists(lyxfile)) {
- if (!theApp->bufferList().close(theApp->bufferList().getBuffer(lyxfile), true)) {
+ if (lyx_gui::use_gui && theBufferList().exists(lyxfile)) {
+ if (!theBufferList().close(theBufferList().getBuffer(lyxfile), true)) {
owner->message(_("Canceled."));
return;
}
owner->message(_("Canceled."));
return;
}
// save current cursor position
LyX::ref().session().saveFilePosition(owner->buffer()->fileName(),
boost::tie(view()->cursor().pit(), view()->cursor().pos()) );
// save current cursor position
LyX::ref().session().saveFilePosition(owner->buffer()->fileName(),
boost::tie(view()->cursor().pit(), view()->cursor().pos()) );
- if (theApp->bufferList().close(owner->buffer(), true) && !quitting) {
- if (theApp->bufferList().empty()) {
+ if (theBufferList().close(owner->buffer(), true) && !quitting) {
+ if (theBufferList().empty()) {
// need this otherwise SEGV may occur while
// trying to set variables that don't exist
// since there's no current buffer
owner->getDialogs().hideBufferDependent();
} else {
// need this otherwise SEGV may occur while
// trying to set variables that don't exist
// since there's no current buffer
owner->getDialogs().hideBufferDependent();
} else {
- owner->setBuffer(theApp->bufferList().first());
+ owner->setBuffer(theBufferList().first());
bool ensureBufferClean(BufferView * bv);
};
bool ensureBufferClean(BufferView * bv);
};
+extern LyXFunc & theLyXFunc();
+
+namespace lyx {
+
+extern FuncStatus getStatus(FuncRequest const & action);
+
+extern void dispatch(FuncRequest const & action);
+}
+
? em_width_base
: 10*(dpi/72.27)*zoom;
// A different estimate for em_width is
? em_width_base
: 10*(dpi/72.27)*zoom;
// A different estimate for em_width is
- // theApp->fontLoader().metrics(LyXFont(LyXFont::ALL_SANE)).width('M')
+ // theFontMetrics(LyXFont(LyXFont::ALL_SANE)).width('M')
// but this estimate might not be more accurate as the screen font
// is different then the latex font.
// but this estimate might not be more accurate as the screen font
// is different then the latex font.
#include "lyxlex.h"
#include "outputparams.h"
#include "lyxlex.h"
#include "outputparams.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
tmpl()->metrics(mi, dim);
dim.asc += 5;
dim.des += 5;
tmpl()->metrics(mi, dim);
dim.asc += 5;
dim.des += 5;
- dim.wid += 10
- + theApp->fontLoader().metrics(mi.base.font).width(prefix());
+ dim.wid += 10 + theFontMetrics(mi.base.font).width(prefix());
- x + theApp->fontLoader().metrics(p.base.font).width(prefix()) + 5,
+ x + theFontMetrics(p.base.font).width(prefix()) + 5,
y);
setPosCache(pi, x, y);
y);
setPosCache(pi, x, y);
#include "MathMLStream.h"
#include "MathStream.h"
#include "MathMLStream.h"
#include "MathStream.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "support/lstrings.h"
#include "frontends/FontMetrics.h"
#include "support/lstrings.h"
void InsetMathBig::metrics(MetricsInfo & mi, Dimension & dim) const
{
void InsetMathBig::metrics(MetricsInfo & mi, Dimension & dim) const
{
- double const h
- = theApp->fontLoader().metrics(mi.base.font).ascent('I');
+ double const h = theFontMetrics(mi.base.font).ascent('I');
double const f = increase();
dim_.wid = 6;
dim_.asc = int(h + f * h);
double const f = increase();
dim_.wid = 6;
dim_.asc = int(h + f * h);
#include "support/lstrings.h"
#include "TextPainter.h"
#include "support/lstrings.h"
#include "TextPainter.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
using std::auto_ptr;
#include "frontends/FontMetrics.h"
using std::auto_ptr;
whichFont(font_, code_, mi);
mathed_char_dim(font_, char_, dim_);
if (isBinaryOp(char_, code_))
whichFont(font_, code_, mi);
mathed_char_dim(font_, char_, dim_);
if (isBinaryOp(char_, code_))
- width_ += 2 * theApp->fontLoader().metrics(font_).width(' ');
+ width_ += 2 * theFontMetrics(font_).width(' ');
lyxerr << "InsetMathChar::metrics: " << dim << endl;
#endif
width_ = dim.wid;
lyxerr << "InsetMathChar::metrics: " << dim << endl;
#endif
width_ = dim.wid;
view_->getIntl()->getTransManager().TranslateAndInsert(*cit, lt);
// remove ourselves
view_->getIntl()->getTransManager().TranslateAndInsert(*cit, lt);
// remove ourselves
- //theApp->lyxFunc().dispatch(LFUN_ESCAPE);
+ //lyx::dispatch(LFUN_ESCAPE);
#include "support/lstrings.h"
#include "support/lstrings.h"
-#include "frontends/Application.h"
#include "frontends/Painter.h"
#include "frontends/Selection.h"
#include "frontends/nullpainter.h"
#include "frontends/Painter.h"
#include "frontends/Selection.h"
#include "frontends/nullpainter.h"
-//#include "bufferlist.h"
#include "funcrequest.h"
#include "lyxserver.h"
#include "lyxsocket.h"
#include "funcrequest.h"
#include "lyxserver.h"
#include "lyxsocket.h"
using lyx::cap::replaceSelection;
using lyx::cap::selClearOrDel;
using lyx::cap::replaceSelection;
using lyx::cap::selClearOrDel;
-using lyx::frontend::Clipboard;
-
using std::endl;
using std::string;
using std::istringstream;
using std::endl;
using std::string;
using std::istringstream;
if (cur.selection())
asArray(lyx::to_utf8(bv.cursor().selectionAsString(false)), ar);
else
if (cur.selection())
asArray(lyx::to_utf8(bv.cursor().selectionAsString(false)), ar);
else
- asArray(lyx::to_utf8(theApp->selection().get()), ar);
+ asArray(lyx::to_utf8(theSelection().get()), ar);
cur.insert(ar);
bv.mouseSetCursor(cur);
cur.insert(ar);
bv.mouseSetCursor(cur);
//lyxerr << "## lfunMouseRelease: buttons: " << cmd.button() << endl;
if (cmd.button() == mouse_button::button1) {
//lyxerr << "## lfunMouseRelease: buttons: " << cmd.button() << endl;
if (cmd.button() == mouse_button::button1) {
- //theApp->selection().put(cur.grabSelection());
+ //theSelection().put(cur.grabSelection());
#include "support/filetools.h" // LibFileSearch
#include "support/lstrings.h"
#include "support/filetools.h" // LibFileSearch
#include "support/lstrings.h"
-#include "frontends/Application.h"
#include "frontends/FontLoader.h"
#include <fstream>
#include "frontends/FontLoader.h"
#include <fstream>
augmentFont(f, name);
// Do we have the font proper?
augmentFont(f, name);
// Do we have the font proper?
- if (theApp->fontLoader().available(f))
+ if (theFontLoader().available(f))
return true;
// can we fake it?
return true;
// can we fake it?
#include "lyxlex.h"
#include "LColor.h"
#include "lyxlex.h"
#include "LColor.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
cell(1).metrics(mi);
docstring dp = prefix();
dim.wid = cell(0).width() + cell(1).width() + 20
cell(1).metrics(mi);
docstring dp = prefix();
dim.wid = cell(0).width() + cell(1).width() + 20
- + theApp->fontLoader().metrics(mi.base.font).width(dp);
+ + theFontMetrics(mi.base.font).width(dp);
dim.asc = std::max(cell(0).ascent(), cell(1).ascent()) + 7;
dim.des = std::max(cell(0).descent(), cell(1).descent()) + 7;
dim_ = dim;
dim.asc = std::max(cell(0).ascent(), cell(1).ascent()) + 7;
dim.des = std::max(cell(0).descent(), cell(1).descent()) + 7;
dim_ = dim;
docstring dp = prefix();
pi.pain.text(x + 2, y, dp, font);
// FIXME: Painter text should retain the drawn text width
docstring dp = prefix();
pi.pain.text(x + 2, y, dp, font);
// FIXME: Painter text should retain the drawn text width
- x += theApp->fontLoader().metrics(font).width(dp) + 6;
+ x += theFontMetrics(font).width(dp) + 6;
int const w0 = cell(0).width();
int const w1 = cell(1).width();
int const w0 = cell(0).width();
int const w1 = cell(1).width();
#include "debug.h"
#include "LColor.h"
#include "debug.h"
#include "LColor.h"
-#include "frontends/Application.h"
#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
void mathed_char_dim(LyXFont const & font, unsigned char c, Dimension & dim)
{
void mathed_char_dim(LyXFont const & font, unsigned char c, Dimension & dim)
{
- lyx::frontend::FontMetrics const & fm =
- theApp->fontLoader().metrics(font);
+ lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
dim.des = fm.descent(c);
dim.asc = fm.ascent(c);
dim.wid = fm.width(c);
dim.des = fm.descent(c);
dim.asc = fm.ascent(c);
dim.wid = fm.width(c);
int mathed_char_width(LyXFont const & font, unsigned char c)
{
int mathed_char_width(LyXFont const & font, unsigned char c)
{
- return theApp->fontLoader().metrics(font).width(c);
+ return theFontMetrics(font).width(c);
}
void mathed_string_dim(LyXFont const & font, string const & s, Dimension & dim)
{
}
void mathed_string_dim(LyXFont const & font, string const & s, Dimension & dim)
{
- lyx::frontend::FontMetrics const & fm =
- theApp->fontLoader().metrics(font);
+ lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
#if 1
dim.asc = 0;
dim.des = 0;
#if 1
dim.asc = 0;
dim.des = 0;
int mathed_string_width(LyXFont const & font, string const & s)
{
docstring ds(s.begin(), s.end());
int mathed_string_width(LyXFont const & font, string const & s)
{
docstring ds(s.begin(), s.end());
- return theApp->fontLoader().metrics(font).width(ds);
+ return theFontMetrics(font).width(ds);
void math_font_max_dim(LyXFont const & font, int & asc, int & des)
{
void math_font_max_dim(LyXFont const & font, int & asc, int & des)
{
- lyx::frontend::FontMetrics const & fm =
- theApp->fontLoader().metrics(font);
+ lyx::frontend::FontMetrics const & fm = theFontMetrics(font);
asc = fm.maxAscent();
des = fm.maxDescent();
}
asc = fm.maxAscent();
des = fm.maxDescent();
}
if (!initialized) {
initialized = true;
// fake fonts if necessary
if (!initialized) {
initialized = true;
// fake fonts if necessary
- if (!theApp->fontLoader().available(getFont("mathfrak")))
+ if (!theFontLoader().available(getFont("mathfrak")))
fakeFont("mathfrak", "lyxfakefrak");
fakeFont("mathfrak", "lyxfakefrak");
- if (!theApp->fontLoader().available(getFont("mathcal")))
+ if (!theFontLoader().available(getFont("mathcal")))
fakeFont("mathcal", "lyxfakecal");
}
fontinfo * info = searchFont(name);
fakeFont("mathcal", "lyxfakecal");
}
fontinfo * info = searchFont(name);
#include "ParagraphParameters.h"
#include "vspace.h"
#include "ParagraphParameters.h"
#include "vspace.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/nullpainter.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/nullpainter.h"
#include "frontends/Painter.h"
- int const width = theApp->fontLoader().metrics(font).width(c);
+ int const width = theFontMetrics(font).width(c);
int dx = 0;
for (pos_type i = pos - 1; i >= 0; --i) {
int dx = 0;
for (pos_type i = pos - 1; i >= 0; --i) {
- int const width = theApp->fontLoader().metrics(font).width(c);
+ int const width = theFontMetrics(font).width(c);
int dx = 0;
for (pos_type i = pos - 1; i >= 0; --i) {
int dx = 0;
for (pos_type i = pos - 1; i >= 0; --i) {
int a = 0;
int d = 0;
docstring dlab(label.begin(), label.end());
int a = 0;
int d = 0;
docstring dlab(label.begin(), label.end());
- theApp->fontLoader().metrics(pb_font).rectText(dlab, w, a, d);
+ theFontMetrics(pb_font).rectText(dlab, w, a, d);
int const text_start = int(xo_ + (width_ - w) / 2);
int const text_end = text_start + w;
int const text_start = int(xo_ + (width_ - w) / 2);
int const text_end = text_start + w;
|| is_seq)) {
LyXFont const font = getLabelFont();
|| is_seq)) {
LyXFont const font = getLabelFont();
- FontMetrics const & fm =
- theApp->fontLoader().metrics(font);
+ FontMetrics const & fm = theFontMetrics(font);
string const str = par_.getLabelstring();
if (!str.empty()) {
string const str = par_.getLabelstring();
if (!str.empty()) {
else
spacing_val = buffer.params().spacing().getValue();
else
spacing_val = buffer.params().spacing().getValue();
- FontMetrics const & fm =
- theApp->fontLoader().metrics(font);
+ FontMetrics const & fm = theFontMetrics(font);
int const labeladdon = int(fm.maxHeight()
* layout->spacing.getValue() * spacing_val);
int const labeladdon = int(fm.maxHeight()
* layout->spacing.getValue() * spacing_val);
case END_LABEL_BOX:
case END_LABEL_FILLED_BOX: {
LyXFont const font = getLabelFont();
case END_LABEL_BOX:
case END_LABEL_FILLED_BOX: {
LyXFont const font = getLabelFont();
- FontMetrics const & fm = theApp->fontLoader().metrics(font);
+ FontMetrics const & fm = theFontMetrics(font);
int const size = int(0.75 * fm.maxAscent());
int const y = yo_ - size;
int x = is_rtl ? nestMargin() + changebarMargin() : width_ - size;
int const size = int(0.75 * fm.maxAscent());
int const y = yo_ - size;
int x = is_rtl ? nestMargin() + changebarMargin() : width_ - size;
case END_LABEL_STATIC: {
LyXFont font = getLabelFont();
case END_LABEL_STATIC: {
LyXFont font = getLabelFont();
- FontMetrics const & fm = theApp->fontLoader().metrics(font);
+ FontMetrics const & fm = theFontMetrics(font);
string const & str = par_.layout()->endlabelstring();
docstring dstr(str.begin(), str.end());
double const x = is_rtl ?
string const & str = par_.layout()->endlabelstring();
docstring dstr(str.begin(), str.end());
double const x = is_rtl ?
// We also don't paint across things like tables
if (running_strikeout && (highly_editable_inset || !is_struckout)) {
// Calculate 1/3 height of the buffer's default font
// We also don't paint across things like tables
if (running_strikeout && (highly_editable_inset || !is_struckout)) {
// Calculate 1/3 height of the buffer's default font
- FontMetrics const & fm = theApp->fontLoader().metrics(
- bv_.buffer()->params().getFont());
+ FontMetrics const & fm
+ = theFontMetrics(bv_.buffer()->params().getFont());
int const middle = yo_ - fm.maxAscent() / 3;
pain_.line(last_strikeout_x, middle, int(x_), middle,
LColor::strikeout, Painter::line_solid, Painter::line_thin);
int const middle = yo_ - fm.maxAscent() / 3;
pain_.line(last_strikeout_x, middle, int(x_), middle,
LColor::strikeout, Painter::line_solid, Painter::line_thin);
if (body_pos > 0 && pos == body_pos - 1) {
string lab = layout->labelsep;
docstring dlab(lab.begin(), lab.end());
if (body_pos > 0 && pos == body_pos - 1) {
string lab = layout->labelsep;
docstring dlab(lab.begin(), lab.end());
- int const lwidth =
- theApp->fontLoader().metrics(getLabelFont()).width(dlab);
+ int const lwidth
+ = theFontMetrics(getLabelFont()).width(dlab);
x_ += label_hfill_ + lwidth - width_pos;
}
x_ += label_hfill_ + lwidth - width_pos;
}
// if we reach the end of a struck out range, paint it
if (running_strikeout) {
// calculate 1/3 height of the buffer's default font
// if we reach the end of a struck out range, paint it
if (running_strikeout) {
// calculate 1/3 height of the buffer's default font
- FontMetrics const & fm = theApp->fontLoader().metrics(
- bv_.buffer()->params().getFont());
+ FontMetrics const & fm
+ = theFontMetrics(bv_.buffer()->params().getFont());
int const middle = yo_ - fm.maxAscent() / 3;
pain_.line(last_strikeout_x, middle, int(x_), middle,
LColor::strikeout, Painter::line_solid, Painter::line_thin);
int const middle = yo_ - fm.maxAscent() / 3;
pain_.line(last_strikeout_x, middle, int(x_), middle,
LColor::strikeout, Painter::line_solid, Painter::line_thin);
#include "vspace.h"
#include "WordLangTuple.h"
#include "vspace.h"
#include "WordLangTuple.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
Encodings::isComposeChar_hebrew(c))
return 0;
}
Encodings::isComposeChar_hebrew(c))
return 0;
}
- return theApp->fontLoader().metrics(font).width(c);
+ return theFontMetrics(font).width(c);
}
if (c == Paragraph::META_INSET)
return par.getInset(pos)->width();
}
if (c == Paragraph::META_INSET)
return par.getInset(pos)->width();
- return theApp->fontLoader().metrics(font).width(c);
+ return theFontMetrics(font).width(c);
string leftm = tclass.leftmargin();
docstring dleft(leftm.begin(), leftm.end());
string leftm = tclass.leftmargin();
docstring dleft(leftm.begin(), leftm.end());
- l_margin += theApp->fontLoader().metrics(params.getFont()).signedWidth(dleft);
+ l_margin += theFontMetrics(params.getFont()).signedWidth(dleft);
if (par.getDepth() != 0) {
// find the next level paragraph
if (par.getDepth() != 0) {
// find the next level paragraph
parindent.erase();
LyXFont const labelfont = getLabelFont(par);
parindent.erase();
LyXFont const labelfont = getLabelFont(par);
- FontMetrics const & labelfont_metrics = theApp->fontLoader().metrics(labelfont);
+ FontMetrics const & labelfont_metrics = theFontMetrics(labelfont);
switch (layout->margintype) {
case MARGIN_DYNAMIC:
if (!layout->leftmargin.empty()) {
string leftm = layout->leftmargin;
docstring dleft(leftm.begin(), leftm.end());
switch (layout->margintype) {
case MARGIN_DYNAMIC:
if (!layout->leftmargin.empty()) {
string leftm = layout->leftmargin;
docstring dleft(leftm.begin(), leftm.end());
- l_margin += theApp->fontLoader().metrics(params.getFont()).signedWidth(dleft);
+ l_margin += theFontMetrics(params.getFont()).signedWidth(dleft);
}
if (!par.getLabelstring().empty()) {
string labin = layout->labelindent;
}
if (!par.getLabelstring().empty()) {
string labin = layout->labelindent;
case MARGIN_STATIC: {
string leftm = layout->leftmargin;
docstring dleft(leftm.begin(), leftm.end());
case MARGIN_STATIC: {
string leftm = layout->leftmargin;
docstring dleft(leftm.begin(), leftm.end());
- l_margin +=
- theApp->fontLoader().metrics(params.getFont()).signedWidth(dleft)
+ l_margin += theFontMetrics(params.getFont()).signedWidth(dleft)
* 4 / (par.getDepth() + 4);
break;
}
* 4 / (par.getDepth() + 4);
break;
}
for ( ; rit != end; ++rit)
if (rit->fill() < minfill)
minfill = rit->fill();
for ( ; rit != end; ++rit)
if (rit->fill() < minfill)
minfill = rit->fill();
- l_margin += theApp->fontLoader().metrics(params.getFont()).signedWidth(layout->leftmargin);
+ l_margin += theFontMetrics(params.getFont()).signedWidth(layout->leftmargin);
l_margin += minfill;
#endif
// also wrong, but much shorter.
l_margin += minfill;
#endif
// also wrong, but much shorter.
BufferParams::PARSEP_INDENT))
{
docstring din(parindent.begin(), parindent.end());
BufferParams::PARSEP_INDENT))
{
docstring din(parindent.begin(), parindent.end());
- l_margin += theApp->fontLoader().metrics(params.getFont()).signedWidth(din);
+ l_margin += theFontMetrics(params.getFont()).signedWidth(din);
docstring dtrmarg(trmarg.begin(), trmarg.end());
string lrmarg = par.layout()->rightmargin;
docstring dlrmarg(lrmarg.begin(), lrmarg.end());
docstring dtrmarg(trmarg.begin(), trmarg.end());
string lrmarg = par.layout()->rightmargin;
docstring dlrmarg(lrmarg.begin(), lrmarg.end());
- FontMetrics const & fm = theApp->fontLoader().metrics(params.getFont());
+ FontMetrics const & fm = theFontMetrics(params.getFont());
int const r_margin =
::rightMargin()
+ fm.signedWidth(dtrmarg)
int const r_margin =
::rightMargin()
+ fm.signedWidth(dtrmarg)
FontIterator fi = FontIterator(*this, par, pos);
pos_type point = end;
pos_type i = pos;
FontIterator fi = FontIterator(*this, par, pos);
pos_type point = end;
pos_type i = pos;
- FontMetrics const & fm = theApp->fontLoader().metrics(getLabelFont(par));
+ FontMetrics const & fm = theFontMetrics(getLabelFont(par));
for ( ; i < end; ++i, ++fi) {
char_type const c = par.getChar(i);
int thiswidth = singleWidth(par, i, c, *fi);
for ( ; i < end; ++i, ++fi) {
char_type const c = par.getChar(i);
int thiswidth = singleWidth(par, i, c, *fi);
pos_type const body_pos = par.beginOfBody();
pos_type i = row.pos();
pos_type const body_pos = par.beginOfBody();
pos_type i = row.pos();
- FontMetrics const & fm = theApp->fontLoader().metrics(getLabelFont(par));
+ FontMetrics const & fm = theFontMetrics(getLabelFont(par));
if (i < end) {
FontIterator fi = FontIterator(*this, par, i);
if (i < end) {
FontIterator fi = FontIterator(*this, par, i);
docstring dlab(label.begin(), label.end());
docstring dlab(label.begin(), label.end());
- FontMetrics const & fm = theApp->fontLoader().metrics(getLabelFont(par));
+ FontMetrics const & fm = theFontMetrics(getLabelFont(par));
return max(0, fm.width(dlab) - w);
}
return max(0, fm.width(dlab) - w);
}
LyXFont labelfont = getLabelFont(par);
LyXFont labelfont = getLabelFont(par);
- FontMetrics const & labelfont_metrics = theApp->fontLoader().metrics(labelfont);
- FontMetrics const & fontmetrics = theApp->fontLoader().metrics(font);
+ FontMetrics const & labelfont_metrics = theFontMetrics(labelfont);
+ FontMetrics const & fontmetrics = theFontMetrics(font);
// these are minimum values
double const spacing_val = layout->spacing.getValue() * spacing(par);
// these are minimum values
double const spacing_val = layout->spacing.getValue() * spacing(par);
{
string lsep = layout->labelsep;
docstring dlsep(lsep.begin(), lsep.end());
{
string lsep = layout->labelsep;
docstring dlsep(lsep.begin(), lsep.end());
- result.x += theApp->fontLoader().metrics(getLabelFont(par)).width(dlsep);
+ result.x += theFontMetrics(getLabelFont(par)).width(dlsep);
if (body_pos <= end)
result.x += result.label_hfill;
}
if (body_pos <= end)
result.x += result.label_hfill;
}
// Use font span to speed things up, see below
FontSpan font_span;
LyXFont font;
// Use font span to speed things up, see below
FontSpan font_span;
LyXFont font;
- FontMetrics const & labelfm = theApp->fontLoader().metrics(getLabelFont(par));
+ FontMetrics const & labelfm = theFontMetrics(getLabelFont(par));
for (pos_type vpos = row_pos; vpos < cursor_vpos; ++vpos) {
pos_type pos = bidi.vis2log(vpos);
for (pos_type vpos = row_pos; vpos < cursor_vpos; ++vpos) {
pos_type pos = bidi.vis2log(vpos);
#include "undo.h"
#include "vspace.h"
#include "undo.h"
#include "vspace.h"
-#include "frontends/Application.h"
-#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "insets/insetenv.h"
#include "frontends/FontMetrics.h"
#include "insets/insetenv.h"
if (lyxlayout->is_environment) {
// move everything in a new environment inset
lyxerr[Debug::DEBUG] << "setting layout " << layout << endl;
if (lyxlayout->is_environment) {
// move everything in a new environment inset
lyxerr[Debug::DEBUG] << "setting layout " << layout << endl;
- theApp->lyxFunc().dispatch(FuncRequest(LFUN_LINE_BEGIN));
- theApp->lyxFunc().dispatch(FuncRequest(LFUN_LINE_END_SELECT));
- theApp->lyxFunc().dispatch(FuncRequest(LFUN_CUT));
+ lyx::dispatch(FuncRequest(LFUN_LINE_BEGIN));
+ lyx::dispatch(FuncRequest(LFUN_LINE_END_SELECT));
+ lyx::dispatch(FuncRequest(LFUN_CUT));
InsetBase * inset = new InsetEnvironment(params, layout);
insertInset(cur, inset);
//inset->edit(cur, true);
InsetBase * inset = new InsetEnvironment(params, layout);
insertInset(cur, inset);
//inset->edit(cur, true);
- //theApp->lyxFunc().dispatch(FuncRequest(LFUN_PASTE));
+ //lyx::dispatch(FuncRequest(LFUN_PASTE));
- lyx::frontend::FontMetrics const & fm = theApp->fontLoader().metrics(
- getLabelFont(par));
+ lyx::frontend::FontMetrics const & fm
+ = theFontMetrics(getLabelFont(par));
while (vc < end && tmpx <= x) {
c = bidi.vis2log(vc);
while (vc < end && tmpx <= x) {
c = bidi.vis2log(vc);
- return int(theApp->fontLoader().metrics(LyXFont(LyXFont::ALL_SANE)).maxHeight() * 1.2);
+ return int(theFontMetrics(LyXFont(LyXFont::ALL_SANE)).maxHeight() * 1.2);
#include "vspace.h"
#include "pariterator.h"
#include "vspace.h"
#include "pariterator.h"
-#include "frontends/Application.h"
#include "frontends/Clipboard.h"
#include "frontends/Selection.h"
#include "frontends/Clipboard.h"
#include "frontends/Selection.h"
if (selecting || cur.mark())
cur.setSelection();
if (!cur.selection())
if (selecting || cur.mark())
cur.setSelection();
if (!cur.selection())
- theApp->selection().haveSelection(false);
+ theSelection().haveSelection(false);
cur.bv().switchKeyMap();
}
cur.bv().switchKeyMap();
}
recordUndo(cur);
bool gotsel = false;
if (cur.selection()) {
recordUndo(cur);
bool gotsel = false;
if (cur.selection()) {
- theApp->lyxFunc().dispatch(FuncRequest(LFUN_CUT));
+ lyx::dispatch(FuncRequest(LFUN_CUT));
gotsel = true;
}
text->insertInset(cur, inset);
gotsel = true;
}
text->insertInset(cur, inset);
inset->edit(cur, true);
if (gotsel && pastesel) {
inset->edit(cur, true);
if (gotsel && pastesel) {
- theApp->lyxFunc().dispatch(FuncRequest(LFUN_PASTE));
+ lyx::dispatch(FuncRequest(LFUN_PASTE));
// reset first par to default
if (cur.lastpit() != 0 || cur.lastpos() != 0) {
LyXLayout_ptr const layout =
// reset first par to default
if (cur.lastpit() != 0 || cur.lastpos() != 0) {
LyXLayout_ptr const layout =
case LFUN_CLIPBOARD_PASTE: {
cur.clearSelection();
case LFUN_CLIPBOARD_PASTE: {
cur.clearSelection();
- docstring const clip = theApp->clipboard().get();
+ docstring const clip = theClipboard().get();
if (!clip.empty()) {
recordUndo(cur);
if (cmd.argument() == "paragraph")
if (!clip.empty()) {
recordUndo(cur);
if (cmd.argument() == "paragraph")
case LFUN_PRIMARY_SELECTION_PASTE: {
cur.clearSelection();
case LFUN_PRIMARY_SELECTION_PASTE: {
cur.clearSelection();
- docstring const clip = theApp->selection().get();
+ docstring const clip = theSelection().get();
if (!clip.empty()) {
recordUndo(cur);
if (cmd.argument() == "paragraph")
if (!clip.empty()) {
recordUndo(cur);
if (cmd.argument() == "paragraph")
- theApp->lyxFunc().dispatch(FuncRequest(LFUN_SELF_INSERT, "\""));
+ lyx::dispatch(FuncRequest(LFUN_SELF_INSERT, "\""));
break;
}
case LFUN_DATE_INSERT:
if (cmd.argument().empty())
break;
}
case LFUN_DATE_INSERT:
if (cmd.argument().empty())
- theApp->lyxFunc().dispatch(FuncRequest(LFUN_SELF_INSERT,
+ lyx::dispatch(FuncRequest(LFUN_SELF_INSERT,
lyx::formatted_time(lyx::current_time())));
else
lyx::formatted_time(lyx::current_time())));
else
- theApp->lyxFunc().dispatch(FuncRequest(LFUN_SELF_INSERT,
+ lyx::dispatch(FuncRequest(LFUN_SELF_INSERT,
lyx::formatted_time(lyx::current_time(), lyx::to_utf8(cmd.argument()))));
break;
lyx::formatted_time(lyx::current_time(), lyx::to_utf8(cmd.argument()))));
break;
cursorEnd(cur);
cur.setSelection();
bv->cursor() = cur;
cursorEnd(cur);
cur.setSelection();
bv->cursor() = cur;
- theApp->selection().haveSelection(cur.selection());
+ theSelection().haveSelection(cur.selection());
if (cmd.button() == mouse_button::button1) {
selectWord(cur, lyx::WHOLE_WORD_STRICT);
bv->cursor() = cur;
if (cmd.button() == mouse_button::button1) {
selectWord(cur, lyx::WHOLE_WORD_STRICT);
bv->cursor() = cur;
- theApp->selection().haveSelection(cur.selection());
+ theSelection().haveSelection(cur.selection());
// we have to check this first
bool paste_internally = false;
if (cmd.button() == mouse_button::button2 && cur.selection()) {
// we have to check this first
bool paste_internally = false;
if (cmd.button() == mouse_button::button2 && cur.selection()) {
- theApp->lyxFunc().dispatch(FuncRequest(LFUN_COPY));
+ lyx::dispatch(FuncRequest(LFUN_COPY));
paste_internally = true;
}
paste_internally = true;
}
// insert this
if (cmd.button() == mouse_button::button2) {
if (paste_internally)
// insert this
if (cmd.button() == mouse_button::button2) {
if (paste_internally)
- theApp->lyxFunc().dispatch(FuncRequest(LFUN_PASTE));
+ lyx::dispatch(FuncRequest(LFUN_PASTE));
- theApp->lyxFunc().dispatch(FuncRequest(LFUN_PRIMARY_SELECTION_PASTE, "paragraph"));
+ lyx::dispatch(FuncRequest(LFUN_PRIMARY_SELECTION_PASTE, "paragraph"));
// finish selection
if (cmd.button() == mouse_button::button1)
// finish selection
if (cmd.button() == mouse_button::button1)
- theApp->selection().haveSelection(cur.selection());
+ theSelection().haveSelection(cur.selection());
bv->switchKeyMap();
break;
bv->switchKeyMap();
break;
if (lyxrc.auto_region_delete) {
if (cur.selection())
cutSelection(cur, false, false);
if (lyxrc.auto_region_delete) {
if (cur.selection())
cutSelection(cur, false, false);
- theApp->selection().haveSelection(false);
+ theSelection().haveSelection(false);
case LFUN_ACCENT_HUNGARIAN_UMLAUT:
case LFUN_ACCENT_CIRCLE:
case LFUN_ACCENT_OGONEK:
case LFUN_ACCENT_HUNGARIAN_UMLAUT:
case LFUN_ACCENT_CIRCLE:
case LFUN_ACCENT_OGONEK:
- theApp->lyxFunc().handleKeyFunc(cmd.action);
+ theLyXFunc().handleKeyFunc(cmd.action);
if (!cmd.argument().empty())
// FIXME: Are all these characters encoded in one byte in utf8?
bv->getIntl().getTransManager()
if (!cmd.argument().empty())
// FIXME: Are all these characters encoded in one byte in utf8?
bv->getIntl().getTransManager()