mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
This commit replaces BufferView->LyXView->Gui->[selection,clipboard] with theApp->[selection,clipboard]
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15125 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4fcccf0672
commit
12a82dd4f2
@ -64,7 +64,6 @@
|
||||
#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"
|
||||
|
||||
@ -84,7 +83,6 @@
|
||||
|
||||
|
||||
using lyx::frontend::Clipboard;
|
||||
using lyx::frontend::Gui;
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::pos_type;
|
||||
|
@ -45,7 +45,6 @@
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include "frontends/Gui.h"
|
||||
#include "frontends/LyXView.h"
|
||||
#include "frontends/Clipboard.h"
|
||||
|
||||
@ -57,7 +56,6 @@ using lyx::textclass_type;
|
||||
|
||||
using lyx::support::bformat;
|
||||
|
||||
using lyx::frontend::Gui;
|
||||
using lyx::frontend::Clipboard;
|
||||
|
||||
using std::endl;
|
||||
@ -513,8 +511,8 @@ void cutSelection(LCursor & cur, bool doclear, bool realcut)
|
||||
// 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
|
||||
@ -578,7 +576,7 @@ void cutSelection(LCursor & cur, bool doclear, bool realcut)
|
||||
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())
|
||||
|
@ -25,8 +25,9 @@ class LyXView;
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
//class GuiWorkArea;
|
||||
class Clipboard;
|
||||
class Gui;
|
||||
class Selection;
|
||||
|
||||
|
||||
/// The main application class
|
||||
@ -50,6 +51,11 @@ public:
|
||||
///
|
||||
virtual void exit(int status) = 0;
|
||||
|
||||
///
|
||||
virtual Clipboard & clipboard() = 0;
|
||||
///
|
||||
virtual Selection & selection() = 0;
|
||||
|
||||
///
|
||||
LyXFunc & lyxFunc();
|
||||
LyXFunc const & lyxFunc() const;
|
||||
|
@ -24,8 +24,6 @@ class BufferView;
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class Clipboard;
|
||||
class Selection;
|
||||
class WorkArea;
|
||||
|
||||
|
||||
@ -37,11 +35,6 @@ class Gui
|
||||
public:
|
||||
virtual ~Gui() {}
|
||||
|
||||
///
|
||||
virtual Clipboard & clipboard() = 0;
|
||||
///
|
||||
virtual Selection & selection() = 0;
|
||||
|
||||
///
|
||||
virtual int newView(unsigned int width, unsigned int height) = 0;
|
||||
///
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "LyXView.h"
|
||||
#include "Gui.h"
|
||||
#include "Dialogs.h"
|
||||
#include "Timeout.h"
|
||||
#include "Toolbars.h"
|
||||
@ -50,7 +49,6 @@
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
using lyx::frontend::Gui;
|
||||
using lyx::frontend::WorkArea;
|
||||
|
||||
using lyx::docstring;
|
||||
@ -65,15 +63,9 @@ using lyx::frontend::ControlCommandBuffer;
|
||||
|
||||
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)),
|
||||
|
@ -58,7 +58,7 @@ class ControlCommandBuffer;
|
||||
class LyXView : public boost::signals::trackable, boost::noncopyable {
|
||||
public:
|
||||
|
||||
LyXView(lyx::frontend::Gui & owner);
|
||||
LyXView();
|
||||
|
||||
virtual ~LyXView();
|
||||
|
||||
@ -162,9 +162,6 @@ public:
|
||||
/// 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();
|
||||
|
||||
@ -191,7 +188,6 @@ protected:
|
||||
boost::scoped_ptr<Menubar> menubar_;
|
||||
|
||||
private:
|
||||
lyx::frontend::Gui & owner_;
|
||||
/**
|
||||
* setWindowTitle - set title of window
|
||||
* @param t main window title
|
||||
|
@ -137,6 +137,18 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
|
||||
}
|
||||
|
||||
|
||||
Clipboard& GuiApplication::clipboard()
|
||||
{
|
||||
return clipboard_;
|
||||
}
|
||||
|
||||
|
||||
Selection& GuiApplication::selection()
|
||||
{
|
||||
return selection_;
|
||||
}
|
||||
|
||||
|
||||
int const GuiApplication::exec()
|
||||
{
|
||||
return QApplication::exec();
|
||||
|
@ -13,8 +13,10 @@
|
||||
#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"
|
||||
|
||||
@ -50,6 +52,8 @@ public:
|
||||
|
||||
/// 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);
|
||||
@ -65,7 +69,10 @@ public:
|
||||
private:
|
||||
///
|
||||
GuiImplementation gui_;
|
||||
|
||||
///
|
||||
GuiClipboard clipboard_;
|
||||
///
|
||||
GuiSelection selection_;
|
||||
///
|
||||
FontLoader font_loader_;
|
||||
|
||||
|
@ -31,24 +31,12 @@ GuiImplementation::GuiImplementation(): max_view_id_(0), max_wa_id_(0)
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -14,8 +14,6 @@
|
||||
#define GUI_H
|
||||
|
||||
#include "frontends/Gui.h"
|
||||
#include "GuiClipboard.h"
|
||||
#include "GuiSelection.h"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
@ -38,9 +36,6 @@ public:
|
||||
GuiImplementation();
|
||||
virtual ~GuiImplementation() {}
|
||||
|
||||
Clipboard& clipboard();
|
||||
Selection& selection();
|
||||
|
||||
int newView(unsigned int width, unsigned int height);
|
||||
LyXView& view(int id);
|
||||
void destroyView(int id);
|
||||
@ -51,10 +46,6 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
///
|
||||
GuiClipboard clipboard_;
|
||||
///
|
||||
GuiSelection selection_;
|
||||
///
|
||||
std::map<int, boost::shared_ptr<GuiView> > views_;
|
||||
///
|
||||
|
@ -68,8 +68,8 @@ int const statusbar_timer_value = 3000;
|
||||
} // namespace anon
|
||||
|
||||
|
||||
GuiView::GuiView(Gui & owner)
|
||||
: QMainWindow(), LyXView(owner), commandbuffer_(0)
|
||||
GuiView::GuiView()
|
||||
: QMainWindow(), LyXView(), commandbuffer_(0)
|
||||
{
|
||||
// setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
// setIconSize(QSize(12,12));
|
||||
|
@ -47,7 +47,7 @@ class GuiView : public QMainWindow, public LyXView {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/// create a main window of the given dimensions
|
||||
GuiView(Gui & owner);
|
||||
GuiView();
|
||||
|
||||
~GuiView();
|
||||
|
||||
|
@ -38,7 +38,6 @@
|
||||
|
||||
#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"
|
||||
@ -59,7 +58,6 @@ using lyx::graphics::PreviewLoader;
|
||||
using lyx::support::ltrim;
|
||||
|
||||
using lyx::frontend::Painter;
|
||||
using lyx::frontend::Gui;
|
||||
using lyx::frontend::Clipboard;
|
||||
|
||||
using boost::shared_ptr;
|
||||
@ -700,8 +698,8 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
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
|
||||
@ -1780,7 +1778,7 @@ bool InsetTabular::copySelection(LCursor & cur)
|
||||
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.
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "frontends/Gui.h"
|
||||
#include "frontends/LyXView.h"
|
||||
#include "frontends/Painter.h"
|
||||
#include "frontends/Selection.h"
|
||||
@ -64,7 +63,6 @@ using lyx::cap::cutSelection;
|
||||
using lyx::cap::replaceSelection;
|
||||
using lyx::cap::selClearOrDel;
|
||||
|
||||
using lyx::frontend::Gui;
|
||||
using lyx::frontend::Clipboard;
|
||||
|
||||
using std::endl;
|
||||
@ -1089,7 +1087,7 @@ void InsetMathNest::lfunMousePress(LCursor & cur, FuncRequest & cmd)
|
||||
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);
|
||||
@ -1120,7 +1118,7 @@ void InsetMathNest::lfunMouseRelease(LCursor & cur, FuncRequest & cmd)
|
||||
//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;
|
||||
}
|
||||
|
||||
|
15
src/text3.C
15
src/text3.C
@ -48,7 +48,6 @@
|
||||
#include "pariterator.h"
|
||||
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "frontends/Gui.h"
|
||||
#include "frontends/LyXView.h"
|
||||
#include "frontends/Clipboard.h"
|
||||
#include "frontends/Selection.h"
|
||||
@ -125,7 +124,7 @@ namespace {
|
||||
if (selecting || cur.mark())
|
||||
cur.setSelection();
|
||||
if (!cur.selection())
|
||||
cur.bv().owner()->gui().selection().haveSelection(false);
|
||||
theApp->selection().haveSelection(false);
|
||||
cur.bv().switchKeyMap();
|
||||
}
|
||||
|
||||
@ -883,7 +882,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
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")
|
||||
@ -896,7 +895,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
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")
|
||||
@ -956,7 +955,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
cursorEnd(cur);
|
||||
cur.setSelection();
|
||||
bv->cursor() = cur;
|
||||
bv->owner()->gui().selection().haveSelection(cur.selection());
|
||||
theApp->selection().haveSelection(cur.selection());
|
||||
}
|
||||
break;
|
||||
|
||||
@ -964,7 +963,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
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;
|
||||
|
||||
@ -1046,7 +1045,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
// 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();
|
||||
@ -1067,7 +1066,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
if (lyxrc.auto_region_delete) {
|
||||
if (cur.selection())
|
||||
cutSelection(cur, false, false);
|
||||
bv->owner()->gui().selection().haveSelection(false);
|
||||
theApp->selection().haveSelection(false);
|
||||
}
|
||||
|
||||
cur.clearSelection();
|
||||
|
Loading…
Reference in New Issue
Block a user