#include "frontends/Dialogs.h"
#include "frontends/FileDialog.h"
#include "frontends/font_metrics.h"
-#include "frontends/Gui.h"
#include "frontends/LyXView.h"
#include "frontends/Selection.h"
using lyx::frontend::Clipboard;
-using lyx::frontend::Gui;
using lyx::docstring;
using lyx::pos_type;
#include "support/lstrings.h"
-#include "frontends/Gui.h"
#include "frontends/LyXView.h"
#include "frontends/Clipboard.h"
using lyx::support::bformat;
-using lyx::frontend::Gui;
using lyx::frontend::Clipboard;
using std::endl;
// 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 cur.bv().owner()->gui().selection().put. (Lgb)
-// cur.bv().owner()->gui().selection().put(cur.selectionAsString(true));
+ // calls to theApp->selection().put. (Lgb)
+// theApp->selection().put(cur.selectionAsString(true));
// 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
- cur.bv().owner()->gui().clipboard().put(cur.selectionAsString(true));
+ theApp->clipboard().put(cur.selectionAsString(true));
// this doesn't make sense, if there is no selection
if (!cur.selection())
namespace lyx {\r
namespace frontend {\r
\r
-//class GuiWorkArea;\r
+class Clipboard;\r
class Gui;\r
+class Selection;\r
\r
\r
/// The main application class\r
///\r
virtual void exit(int status) = 0;\r
\r
+ ///\r
+ virtual Clipboard & clipboard() = 0;\r
+ ///\r
+ virtual Selection & selection() = 0;\r
+\r
///\r
LyXFunc & lyxFunc();\r
LyXFunc const & lyxFunc() const;\r
namespace lyx {
namespace frontend {
-class Clipboard;
-class Selection;
class WorkArea;
public:
virtual ~Gui() {}
- ///
- virtual Clipboard & clipboard() = 0;
- ///
- virtual Selection & selection() = 0;
-
///
virtual int newView(unsigned int width, unsigned int height) = 0;
///
#include <config.h>
#include "LyXView.h"
-#include "Gui.h"
#include "Dialogs.h"
#include "Timeout.h"
#include "Toolbars.h"
# include <unistd.h>
#endif
-using lyx::frontend::Gui;
using lyx::frontend::WorkArea;
using lyx::docstring;
string current_layout;
-Gui & LyXView::gui()
-{
- return owner_;
-}
-
-LyXView::LyXView(Gui & owner)
+LyXView::LyXView()
: work_area_(0),
- owner_(owner),
toolbars_(new Toolbars(*this)),
autosave_timeout_(new Timeout(5000)),
lyxfunc_(new LyXFunc(this)),
class LyXView : public boost::signals::trackable, boost::noncopyable {
public:
- LyXView(lyx::frontend::Gui & owner);
+ LyXView();
virtual ~LyXView();
/// returns true if this view has the focus.
virtual bool hasFocus() const = 0;
- ///
- virtual lyx::frontend::Gui & gui();
-
/// Temporary method used by the kernel to redraw the work area.
virtual void redrawWorkArea();
boost::scoped_ptr<Menubar> menubar_;
private:
- lyx::frontend::Gui & owner_;
/**
* setWindowTitle - set title of window
* @param t main window title
}
+Clipboard& GuiApplication::clipboard()
+{
+ return clipboard_;
+}
+
+
+Selection& GuiApplication::selection()
+{
+ return selection_;
+}
+
+
int const GuiApplication::exec()
{
return QApplication::exec();
#ifndef QT4_APPLICATION_H
#define QT4_APPLICATION_H
-#include "GuiImplementation.h"
#include "FontLoader.h"
+#include "GuiClipboard.h"
+#include "GuiImplementation.h"
+#include "GuiSelection.h"
#include "frontends/Application.h"
/// Method inherited from \c Application class
//@{
+ virtual Clipboard& clipboard();
+ virtual Selection& selection();
virtual int const exec();
virtual Gui & gui() { return gui_; }
virtual void exit(int status);
private:
///
GuiImplementation gui_;
-
+ ///
+ GuiClipboard clipboard_;
+ ///
+ GuiSelection selection_;
///
FontLoader font_loader_;
}
-Clipboard& GuiImplementation::clipboard()
-{
- return clipboard_;
-}
-
-
-Selection& GuiImplementation::selection()
-{
- return selection_;
-}
-
-
int GuiImplementation::newView(unsigned int /*w*/, unsigned int /*h*/)
{
size_t const id = max_view_id_;
++max_view_id_;
- views_[id].reset(new GuiView(*this));
+ views_[id].reset(new GuiView());
return id;
}
#define GUI_H
#include "frontends/Gui.h"
-#include "GuiClipboard.h"
-#include "GuiSelection.h"
#include <boost/shared_ptr.hpp>
GuiImplementation();
virtual ~GuiImplementation() {}
- Clipboard& clipboard();
- Selection& selection();
-
int newView(unsigned int width, unsigned int height);
LyXView& view(int id);
void destroyView(int id);
private:
- ///
- GuiClipboard clipboard_;
- ///
- GuiSelection selection_;
///
std::map<int, boost::shared_ptr<GuiView> > views_;
///
} // namespace anon
-GuiView::GuiView(Gui & owner)
- : QMainWindow(), LyXView(owner), commandbuffer_(0)
+GuiView::GuiView()
+ : QMainWindow(), LyXView(), commandbuffer_(0)
{
// setToolButtonStyle(Qt::ToolButtonIconOnly);
// setIconSize(QSize(12,12));
Q_OBJECT
public:
/// create a main window of the given dimensions
- GuiView(Gui & owner);
+ GuiView();
~GuiView();
#include "frontends/Alert.h"
#include "frontends/font_metrics.h"
-#include "frontends/Gui.h"
#include "frontends/LyXView.h"
#include "frontends/Clipboard.h"
#include "frontends/Painter.h"
using lyx::support::ltrim;
using lyx::frontend::Painter;
-using lyx::frontend::Gui;
using lyx::frontend::Clipboard;
using boost::shared_ptr;
case LFUN_CLIPBOARD_PASTE:
case LFUN_PRIMARY_SELECTION_PASTE: {
docstring const clip = (cmd.action == LFUN_CLIPBOARD_PASTE) ?
- cur.bv().owner()->gui().clipboard().get() :
- cur.bv().owner()->gui().selection().get();
+ theApp->clipboard().get() :
+ theApp->selection().get();
if (clip.empty())
break;
// pass to InsertAsciiString, but
ostringstream os;
OutputParams const runparams;
paste_tabular->plaintext(cur.buffer(), os, runparams, 0, true, '\t');
- cur.bv().owner()->gui().clipboard().put(lyx::from_utf8(os.str()));
+ theApp->clipboard().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.
#include "support/lstrings.h"
#include "frontends/Dialogs.h"
-#include "frontends/Gui.h"
#include "frontends/LyXView.h"
#include "frontends/Painter.h"
#include "frontends/Selection.h"
using lyx::cap::replaceSelection;
using lyx::cap::selClearOrDel;
-using lyx::frontend::Gui;
using lyx::frontend::Clipboard;
using std::endl;
if (cur.selection())
asArray(lyx::to_utf8(bv.cursor().selectionAsString(false)), ar);
else
- asArray(lyx::to_utf8(bv.owner()->gui().selection().get()), ar);
+ asArray(lyx::to_utf8(theApp->selection().get()), ar);
cur.insert(ar);
bv.mouseSetCursor(cur);
//lyxerr << "## lfunMouseRelease: buttons: " << cmd.button() << endl;
if (cmd.button() == mouse_button::button1) {
- //cur.bv().owner()->gui().selection().put(cur.grabSelection());
+ //theApp->selection().put(cur.grabSelection());
return;
}
#include "pariterator.h"
#include "frontends/Dialogs.h"
-#include "frontends/Gui.h"
#include "frontends/LyXView.h"
#include "frontends/Clipboard.h"
#include "frontends/Selection.h"
if (selecting || cur.mark())
cur.setSelection();
if (!cur.selection())
- cur.bv().owner()->gui().selection().haveSelection(false);
+ theApp->selection().haveSelection(false);
cur.bv().switchKeyMap();
}
case LFUN_CLIPBOARD_PASTE: {
cur.clearSelection();
- docstring const clip = bv->owner()->gui().clipboard().get();
+ docstring const clip = theApp->clipboard().get();
if (!clip.empty()) {
recordUndo(cur);
if (cmd.argument() == "paragraph")
case LFUN_PRIMARY_SELECTION_PASTE: {
cur.clearSelection();
- docstring const clip = bv->owner()->gui().selection().get();
+ docstring const clip = theApp->selection().get();
if (!clip.empty()) {
recordUndo(cur);
if (cmd.argument() == "paragraph")
cursorEnd(cur);
cur.setSelection();
bv->cursor() = cur;
- bv->owner()->gui().selection().haveSelection(cur.selection());
+ theApp->selection().haveSelection(cur.selection());
}
break;
if (cmd.button() == mouse_button::button1) {
selectWord(cur, lyx::WHOLE_WORD_STRICT);
bv->cursor() = cur;
- bv->owner()->gui().selection().haveSelection(cur.selection());
+ theApp->selection().haveSelection(cur.selection());
}
break;
// finish selection
if (cmd.button() == mouse_button::button1)
- bv->owner()->gui().selection().haveSelection(cur.selection());
+ theApp->selection().haveSelection(cur.selection());
bv->switchKeyMap();
bv->owner()->updateMenubar();
if (lyxrc.auto_region_delete) {
if (cur.selection())
cutSelection(cur, false, false);
- bv->owner()->gui().selection().haveSelection(false);
+ theApp->selection().haveSelection(false);
}
cur.clearSelection();