mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 03:03:06 +00:00
Push latest Andre's changes toward their true direction:
* WorkArea.h and LyXView.h: remove unneeded pure virtual interface. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21575 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
066de606d2
commit
c4db1d0f5a
@ -83,7 +83,6 @@
|
|||||||
#include "frontends/KeySymbol.h"
|
#include "frontends/KeySymbol.h"
|
||||||
#include "frontends/LyXView.h"
|
#include "frontends/LyXView.h"
|
||||||
#include "frontends/Selection.h"
|
#include "frontends/Selection.h"
|
||||||
#include "frontends/WorkArea.h"
|
|
||||||
|
|
||||||
#include "support/environment.h"
|
#include "support/environment.h"
|
||||||
#include "support/FileFilterList.h"
|
#include "support/FileFilterList.h"
|
||||||
@ -186,7 +185,7 @@ bool import(LyXView * lv, FileName const & filename,
|
|||||||
}
|
}
|
||||||
updateLabels(*buf);
|
updateLabels(*buf);
|
||||||
lv->setBuffer(buf);
|
lv->setBuffer(buf);
|
||||||
lv->showErrorList("Parse");
|
lv->errors("Parse");
|
||||||
} else {
|
} else {
|
||||||
Buffer * const b = newFile(lyxfile.absFilename(), string(), true);
|
Buffer * const b = newFile(lyxfile.absFilename(), string(), true);
|
||||||
if (b)
|
if (b)
|
||||||
@ -384,17 +383,6 @@ void LyXFunc::gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
void restartCursor(LyXView * lv)
|
|
||||||
{
|
|
||||||
/* When we move around, or type, it's nice to be able to see
|
|
||||||
* the cursor immediately after the keypress.
|
|
||||||
*/
|
|
||||||
if (lv && lv->currentWorkArea())
|
|
||||||
lv->currentWorkArea()->startBlinkingCursor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state)
|
void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state)
|
||||||
{
|
{
|
||||||
LYXERR(Debug::KEY) << "KeySym is " << keysym.getSymbolName() << endl;
|
LYXERR(Debug::KEY) << "KeySym is " << keysym.getSymbolName() << endl;
|
||||||
@ -403,13 +391,13 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state)
|
|||||||
if (!keysym.isOK()) {
|
if (!keysym.isOK()) {
|
||||||
LYXERR(Debug::KEY) << "Empty kbd action (probably composing)"
|
LYXERR(Debug::KEY) << "Empty kbd action (probably composing)"
|
||||||
<< endl;
|
<< endl;
|
||||||
restartCursor(lyx_view_);
|
lyx_view_->restartCursor();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keysym.isModifier()) {
|
if (keysym.isModifier()) {
|
||||||
LYXERR(Debug::KEY) << "isModifier true" << endl;
|
LYXERR(Debug::KEY) << "isModifier true" << endl;
|
||||||
restartCursor(lyx_view_);
|
lyx_view_->restartCursor();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,7 +467,7 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state)
|
|||||||
} else {
|
} else {
|
||||||
LYXERR(Debug::KEY) << "Unknown, !isText() - giving up" << endl;
|
LYXERR(Debug::KEY) << "Unknown, !isText() - giving up" << endl;
|
||||||
lyx_view_->message(_("Unknown function."));
|
lyx_view_->message(_("Unknown function."));
|
||||||
restartCursor(lyx_view_);
|
lyx_view_->restartCursor();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -496,7 +484,7 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state)
|
|||||||
dispatch(func);
|
dispatch(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
restartCursor(lyx_view_);
|
lyx_view_->restartCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1292,7 +1280,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
|||||||
if (buf) {
|
if (buf) {
|
||||||
updateLabels(*buf);
|
updateLabels(*buf);
|
||||||
lyx_view_->setBuffer(buf);
|
lyx_view_->setBuffer(buf);
|
||||||
lyx_view_->showErrorList("Parse");
|
lyx_view_->errors("Parse");
|
||||||
}
|
}
|
||||||
updateFlags = Update::None;
|
updateFlags = Update::None;
|
||||||
break;
|
break;
|
||||||
@ -1438,7 +1426,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
|||||||
lyx_view_->setBuffer(buf);
|
lyx_view_->setBuffer(buf);
|
||||||
view()->setCursorFromRow(row);
|
view()->setCursorFromRow(row);
|
||||||
if (loaded)
|
if (loaded)
|
||||||
lyx_view_->showErrorList("Parse");
|
lyx_view_->errors("Parse");
|
||||||
updateFlags = Update::FitCursor;
|
updateFlags = Update::FitCursor;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1654,7 +1642,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
|||||||
updateLabels(*child->masterBuffer());
|
updateLabels(*child->masterBuffer());
|
||||||
lyx_view_->setBuffer(child);
|
lyx_view_->setBuffer(child);
|
||||||
if (parsed)
|
if (parsed)
|
||||||
lyx_view_->showErrorList("Parse");
|
lyx_view_->errors("Parse");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a screen update is required (in case where auto_open is false),
|
// If a screen update is required (in case where auto_open is false),
|
||||||
@ -2272,7 +2260,7 @@ void LyXFunc::open(string const & fname)
|
|||||||
if (buf) {
|
if (buf) {
|
||||||
updateLabels(*buf);
|
updateLabels(*buf);
|
||||||
lyx_view_->setBuffer(buf);
|
lyx_view_->setBuffer(buf);
|
||||||
lyx_view_->showErrorList("Parse");
|
lyx_view_->errors("Parse");
|
||||||
str2 = bformat(_("Document %1$s opened."), disp_fn);
|
str2 = bformat(_("Document %1$s opened."), disp_fn);
|
||||||
} else {
|
} else {
|
||||||
str2 = bformat(_("Could not open document %1$s"), disp_fn);
|
str2 = bformat(_("Could not open document %1$s"), disp_fn);
|
||||||
@ -2387,7 +2375,7 @@ void LyXFunc::reloadBuffer()
|
|||||||
if (buf) {
|
if (buf) {
|
||||||
updateLabels(*buf);
|
updateLabels(*buf);
|
||||||
lyx_view_->setBuffer(buf);
|
lyx_view_->setBuffer(buf);
|
||||||
lyx_view_->showErrorList("Parse");
|
lyx_view_->errors("Parse");
|
||||||
str = bformat(_("Document %1$s reloaded."), disp_fn);
|
str = bformat(_("Document %1$s reloaded."), disp_fn);
|
||||||
} else {
|
} else {
|
||||||
str = bformat(_("Could not reload document %1$s"), disp_fn);
|
str = bformat(_("Could not reload document %1$s"), disp_fn);
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "frontends/FontMetrics.h"
|
#include "frontends/FontMetrics.h"
|
||||||
#include "frontends/Gui.h"
|
#include "frontends/Gui.h"
|
||||||
#include "frontends/LyXView.h"
|
#include "frontends/LyXView.h"
|
||||||
#include "frontends/WorkArea.h"
|
|
||||||
|
|
||||||
#include "FuncRequest.h"
|
#include "FuncRequest.h"
|
||||||
#include "FuncStatus.h"
|
#include "FuncStatus.h"
|
||||||
|
@ -31,7 +31,6 @@ class ToolbarInfo;
|
|||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
class Dialogs;
|
class Dialogs;
|
||||||
class WorkArea;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LyXView - main LyX window
|
* LyXView - main LyX window
|
||||||
@ -53,7 +52,7 @@ public:
|
|||||||
///
|
///
|
||||||
LyXView(int id) : id_(id) {}
|
LyXView(int id) : id_(id) {}
|
||||||
///
|
///
|
||||||
virtual ~LyXView();
|
virtual ~LyXView() {}
|
||||||
///
|
///
|
||||||
int id() const { return id_; }
|
int id() const { return id_; }
|
||||||
///
|
///
|
||||||
@ -61,20 +60,6 @@ public:
|
|||||||
///
|
///
|
||||||
virtual void setFocus() = 0;
|
virtual void setFocus() = 0;
|
||||||
|
|
||||||
///
|
|
||||||
virtual WorkArea * workArea(Buffer & buffer) = 0;
|
|
||||||
///
|
|
||||||
virtual WorkArea * addWorkArea(Buffer & buffer) = 0;
|
|
||||||
///
|
|
||||||
virtual void setCurrentWorkArea(WorkArea * work_area) = 0;
|
|
||||||
///
|
|
||||||
virtual void removeWorkArea(WorkArea * work_area) = 0;
|
|
||||||
/// return the current WorkArea (the one that has the focus).
|
|
||||||
virtual WorkArea const * currentWorkArea() const = 0;
|
|
||||||
/// FIXME: This non-const access is needed because of
|
|
||||||
/// a mis-designed \c ControlSpellchecker.
|
|
||||||
virtual WorkArea * currentWorkArea() = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is called after the concrete view has been created.
|
* This is called after the concrete view has been created.
|
||||||
* We have to have the toolbar and the other stuff created
|
* We have to have the toolbar and the other stuff created
|
||||||
@ -98,9 +83,6 @@ public:
|
|||||||
unsigned int iconSizeXY,
|
unsigned int iconSizeXY,
|
||||||
const std::string & geometryArg) = 0;
|
const std::string & geometryArg) = 0;
|
||||||
|
|
||||||
/// save the geometry state in the session manager.
|
|
||||||
virtual void saveGeometry() = 0;
|
|
||||||
|
|
||||||
/// show busy cursor
|
/// show busy cursor
|
||||||
virtual void setBusy(bool) = 0;
|
virtual void setBusy(bool) = 0;
|
||||||
|
|
||||||
@ -152,9 +134,6 @@ public:
|
|||||||
/// clear any temporary message and replace with current status
|
/// clear any temporary message and replace with current status
|
||||||
virtual void clearMessage() = 0;
|
virtual void clearMessage() = 0;
|
||||||
|
|
||||||
/// reset autosave timer
|
|
||||||
virtual void resetAutosaveTimer() = 0;
|
|
||||||
|
|
||||||
/// dispatch to current BufferView
|
/// dispatch to current BufferView
|
||||||
virtual void dispatch(FuncRequest const & cmd) = 0;
|
virtual void dispatch(FuncRequest const & cmd) = 0;
|
||||||
|
|
||||||
@ -166,28 +145,14 @@ public:
|
|||||||
/// returns true if this view has the focus.
|
/// returns true if this view has the focus.
|
||||||
virtual bool hasFocus() const = 0;
|
virtual bool hasFocus() const = 0;
|
||||||
|
|
||||||
/// show the error list to the user
|
|
||||||
virtual void showErrorList(std::string const &) = 0;
|
|
||||||
|
|
||||||
|
///
|
||||||
|
virtual void restartCursor() = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// GuiBufferDelegate
|
// GuiBufferDelegate
|
||||||
//
|
//
|
||||||
/// This function is called when the buffer structure is changed.
|
virtual void errors(std::string const &) = 0;
|
||||||
virtual void structureChanged() = 0;
|
|
||||||
/// This function is called when some parsing error shows up.
|
|
||||||
void errors(std::string const & err) { showErrorList(err); }
|
|
||||||
/// Reset autosave timers for all users.
|
|
||||||
void resetAutosaveTimers() { resetAutosaveTimer(); }
|
|
||||||
|
|
||||||
/// connect to signals in the given BufferView
|
|
||||||
virtual void connectBufferView(BufferView & bv) = 0;
|
|
||||||
/// disconnect from signals in the given BufferView
|
|
||||||
virtual void disconnectBufferView() = 0;
|
|
||||||
/// connect to signals in the given buffer
|
|
||||||
virtual void connectBuffer(Buffer & buf) = 0;
|
|
||||||
/// disconnect from signals in the given buffer
|
|
||||||
virtual void disconnectBuffer() = 0;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// noncopyable
|
/// noncopyable
|
||||||
|
@ -36,41 +36,10 @@ public:
|
|||||||
///
|
///
|
||||||
WorkArea() {}
|
WorkArea() {}
|
||||||
///
|
///
|
||||||
virtual ~WorkArea();
|
virtual ~WorkArea() {}
|
||||||
|
|
||||||
///
|
|
||||||
virtual BufferView & bufferView() = 0;
|
|
||||||
///
|
|
||||||
virtual BufferView const & bufferView() const = 0;
|
|
||||||
|
|
||||||
/// return true if has the keyboard input focus.
|
|
||||||
virtual bool hasFocus() const = 0;
|
|
||||||
|
|
||||||
/// return true if has this WorkArea is visible.
|
|
||||||
virtual bool isVisible() const = 0;
|
|
||||||
|
|
||||||
/// return the width of the work area in pixels
|
|
||||||
virtual int width() const = 0;
|
|
||||||
|
|
||||||
/// return the height of the work area in pixels
|
|
||||||
virtual int height() const = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the scrollbar.
|
|
||||||
* @param height the total document height in pixels
|
|
||||||
* @param pos the current position in the document, in pixels
|
|
||||||
* @param line_height the line-scroll amount, in pixels
|
|
||||||
*/
|
|
||||||
virtual void setScrollbarParams(int height, int pos, int line_height) = 0;
|
|
||||||
|
|
||||||
///
|
|
||||||
virtual void scheduleRedraw() = 0;
|
|
||||||
|
|
||||||
/// redraw the screen, without using existing pixmap
|
/// redraw the screen, without using existing pixmap
|
||||||
virtual void redraw() = 0;
|
virtual void redraw() = 0;
|
||||||
///
|
|
||||||
virtual void stopBlinkingCursor() = 0;
|
|
||||||
virtual void startBlinkingCursor() = 0;
|
|
||||||
|
|
||||||
/// Process Key pressed event.
|
/// Process Key pressed event.
|
||||||
/// This needs to be public because it is accessed externally by GuiView.
|
/// This needs to be public because it is accessed externally by GuiView.
|
||||||
|
@ -40,12 +40,6 @@
|
|||||||
#include "TextClassList.h"
|
#include "TextClassList.h"
|
||||||
#include "Validator.h"
|
#include "Validator.h"
|
||||||
|
|
||||||
|
|
||||||
// FIXME: those two headers are needed because of the
|
|
||||||
// WorkArea::redraw() call below.
|
|
||||||
#include "frontends/LyXView.h"
|
|
||||||
#include "frontends/WorkArea.h"
|
|
||||||
|
|
||||||
#include "insets/InsetListingsParams.h"
|
#include "insets/InsetListingsParams.h"
|
||||||
|
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
|
@ -21,11 +21,6 @@
|
|||||||
|
|
||||||
#include "qt_helpers.h"
|
#include "qt_helpers.h"
|
||||||
|
|
||||||
// FIXME: those two headers are needed because of the
|
|
||||||
// WorkArea::redraw() call below.
|
|
||||||
#include "frontends/LyXView.h"
|
|
||||||
#include "frontends/WorkArea.h"
|
|
||||||
|
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
|
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
|
@ -53,10 +53,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "frontends/alert.h"
|
#include "frontends/alert.h"
|
||||||
// FIXME: those two headers are needed because of the
|
|
||||||
// WorkArea::redraw() call below.
|
|
||||||
#include "frontends/LyXView.h"
|
|
||||||
#include "frontends/WorkArea.h"
|
|
||||||
|
|
||||||
using std::advance;
|
using std::advance;
|
||||||
using std::distance;
|
using std::distance;
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include "GuiToolbar.h"
|
#include "GuiToolbar.h"
|
||||||
#include "GuiToolbars.h"
|
#include "GuiToolbars.h"
|
||||||
#include "Dialogs.h"
|
#include "Dialogs.h"
|
||||||
#include "WorkArea.h"
|
|
||||||
#include "Gui.h"
|
#include "Gui.h"
|
||||||
|
|
||||||
#include "qt_helpers.h"
|
#include "qt_helpers.h"
|
||||||
@ -30,7 +29,6 @@
|
|||||||
#include "frontends/Application.h"
|
#include "frontends/Application.h"
|
||||||
#include "frontends/Dialogs.h"
|
#include "frontends/Dialogs.h"
|
||||||
#include "frontends/Gui.h"
|
#include "frontends/Gui.h"
|
||||||
#include "frontends/WorkArea.h"
|
|
||||||
|
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "support/convert.h"
|
#include "support/convert.h"
|
||||||
@ -270,10 +268,6 @@ public:
|
|||||||
unsigned int GuiView::GuiViewPrivate::lastIconSize = 0;
|
unsigned int GuiView::GuiViewPrivate::lastIconSize = 0;
|
||||||
|
|
||||||
|
|
||||||
/// FIXME
|
|
||||||
LyXView::~LyXView() {}
|
|
||||||
|
|
||||||
|
|
||||||
GuiView::GuiView(int id)
|
GuiView::GuiView(int id)
|
||||||
: QMainWindow(), LyXView(id),
|
: QMainWindow(), LyXView(id),
|
||||||
d(*new GuiViewPrivate),
|
d(*new GuiViewPrivate),
|
||||||
@ -869,7 +863,7 @@ GuiToolbar * GuiView::makeToolbar(ToolbarInfo const & tbinfo, bool newline)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WorkArea * GuiView::workArea(Buffer & buffer)
|
GuiWorkArea * GuiView::workArea(Buffer & buffer)
|
||||||
{
|
{
|
||||||
for (int i = 0; i != d.splitter_->count(); ++i) {
|
for (int i = 0; i != d.splitter_->count(); ++i) {
|
||||||
GuiWorkArea * wa = d.tabWorkArea(i)->workArea(buffer);
|
GuiWorkArea * wa = d.tabWorkArea(i)->workArea(buffer);
|
||||||
@ -880,7 +874,7 @@ WorkArea * GuiView::workArea(Buffer & buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WorkArea * GuiView::addWorkArea(Buffer & buffer)
|
GuiWorkArea * GuiView::addWorkArea(Buffer & buffer)
|
||||||
{
|
{
|
||||||
GuiWorkArea * wa = new GuiWorkArea(buffer, *this);
|
GuiWorkArea * wa = new GuiWorkArea(buffer, *this);
|
||||||
wa->setUpdatesEnabled(false);
|
wa->setUpdatesEnabled(false);
|
||||||
@ -912,19 +906,19 @@ void GuiView::addTabWorkArea()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WorkArea * GuiView::currentWorkArea()
|
GuiWorkArea * GuiView::currentWorkArea()
|
||||||
{
|
{
|
||||||
return d.current_work_area_;
|
return d.current_work_area_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WorkArea const * GuiView::currentWorkArea() const
|
GuiWorkArea const * GuiView::currentWorkArea() const
|
||||||
{
|
{
|
||||||
return d.current_work_area_;
|
return d.current_work_area_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiView::setCurrentWorkArea(WorkArea * work_area)
|
void GuiView::setCurrentWorkArea(GuiWorkArea * work_area)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(work_area);
|
BOOST_ASSERT(work_area);
|
||||||
|
|
||||||
@ -941,7 +935,7 @@ void GuiView::setCurrentWorkArea(WorkArea * work_area)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiView::removeWorkArea(WorkArea * work_area)
|
void GuiView::removeWorkArea(GuiWorkArea * work_area)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(work_area);
|
BOOST_ASSERT(work_area);
|
||||||
GuiWorkArea * gwa = static_cast<GuiWorkArea *>(work_area);
|
GuiWorkArea * gwa = static_cast<GuiWorkArea *>(work_area);
|
||||||
@ -962,7 +956,7 @@ void GuiView::removeWorkArea(WorkArea * work_area)
|
|||||||
// Not found in this tab group.
|
// Not found in this tab group.
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// We found and removed the WorkArea.
|
// We found and removed the GuiWorkArea.
|
||||||
if (twa->count()) {
|
if (twa->count()) {
|
||||||
// No more WorkAreas in this tab group, so delete it.
|
// No more WorkAreas in this tab group, so delete it.
|
||||||
delete twa;
|
delete twa;
|
||||||
@ -970,10 +964,10 @@ void GuiView::removeWorkArea(WorkArea * work_area)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (d.current_work_area_)
|
if (d.current_work_area_)
|
||||||
// This means that we are not closing the current WorkArea;
|
// This means that we are not closing the current GuiWorkArea;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Switch to the next WorkArea in the found TabWorkArea.
|
// Switch to the next GuiWorkArea in the found TabWorkArea.
|
||||||
d.current_work_area_ = twa->currentWorkArea();
|
d.current_work_area_ = twa->currentWorkArea();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1072,18 +1066,16 @@ void GuiView::toggleToolbarState(string const & name, bool allowauto)
|
|||||||
|
|
||||||
Buffer * GuiView::buffer()
|
Buffer * GuiView::buffer()
|
||||||
{
|
{
|
||||||
WorkArea * work_area = currentWorkArea();
|
if (d.current_work_area_)
|
||||||
if (work_area)
|
return &d.current_work_area_->bufferView().buffer();
|
||||||
return &work_area->bufferView().buffer();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Buffer const * GuiView::buffer() const
|
Buffer const * GuiView::buffer() const
|
||||||
{
|
{
|
||||||
WorkArea const * work_area = currentWorkArea();
|
if (d.current_work_area_)
|
||||||
if (work_area)
|
return &d.current_work_area_->bufferView().buffer();
|
||||||
return &work_area->bufferView().buffer();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1093,7 +1085,7 @@ void GuiView::setBuffer(Buffer * newBuffer)
|
|||||||
BOOST_ASSERT(newBuffer);
|
BOOST_ASSERT(newBuffer);
|
||||||
setBusy(true);
|
setBusy(true);
|
||||||
|
|
||||||
WorkArea * wa = workArea(*newBuffer);
|
GuiWorkArea * wa = workArea(*newBuffer);
|
||||||
if (wa == 0) {
|
if (wa == 0) {
|
||||||
updateLabels(*newBuffer->masterBuffer());
|
updateLabels(*newBuffer->masterBuffer());
|
||||||
wa = addWorkArea(*newBuffer);
|
wa = addWorkArea(*newBuffer);
|
||||||
@ -1122,7 +1114,7 @@ Buffer * GuiView::loadLyXFile(FileName const & filename, bool tolastfiles)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkArea * wa = workArea(*newBuffer);
|
GuiWorkArea * wa = workArea(*newBuffer);
|
||||||
if (wa == 0)
|
if (wa == 0)
|
||||||
wa = addWorkArea(*newBuffer);
|
wa = addWorkArea(*newBuffer);
|
||||||
|
|
||||||
@ -1151,8 +1143,8 @@ void GuiView::connectBuffer(Buffer & buf)
|
|||||||
|
|
||||||
void GuiView::disconnectBuffer()
|
void GuiView::disconnectBuffer()
|
||||||
{
|
{
|
||||||
if (WorkArea * work_area = currentWorkArea())
|
if (d.current_work_area_)
|
||||||
work_area->bufferView().setGuiDelegate(0);
|
d.current_work_area_->bufferView().setGuiDelegate(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1164,12 +1156,12 @@ void GuiView::connectBufferView(BufferView & bv)
|
|||||||
|
|
||||||
void GuiView::disconnectBufferView()
|
void GuiView::disconnectBufferView()
|
||||||
{
|
{
|
||||||
if (WorkArea * work_area = currentWorkArea())
|
if (d.current_work_area_)
|
||||||
work_area->bufferView().setGuiDelegate(0);
|
d.current_work_area_->bufferView().setGuiDelegate(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiView::showErrorList(string const & error_type)
|
void GuiView::errors(string const & error_type)
|
||||||
{
|
{
|
||||||
ErrorList & el = buffer()->errorList(error_type);
|
ErrorList & el = buffer()->errorList(error_type);
|
||||||
if (!el.empty())
|
if (!el.empty())
|
||||||
@ -1205,8 +1197,7 @@ void GuiView::updateDialog(string const & name, string const & data)
|
|||||||
|
|
||||||
BufferView * GuiView::view()
|
BufferView * GuiView::view()
|
||||||
{
|
{
|
||||||
WorkArea * wa = currentWorkArea();
|
return d.current_work_area_ ? &d.current_work_area_->bufferView() : 0;
|
||||||
return wa ? &wa->bufferView() : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1231,7 +1222,7 @@ void GuiView::autoSave()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiView::resetAutosaveTimer()
|
void GuiView::resetAutosaveTimers()
|
||||||
{
|
{
|
||||||
if (lyxrc.autosave)
|
if (lyxrc.autosave)
|
||||||
autosave_timeout_->restart();
|
autosave_timeout_->restart();
|
||||||
@ -1254,15 +1245,23 @@ void GuiView::dispatch(FuncRequest const & cmd)
|
|||||||
|
|
||||||
Buffer const * GuiView::updateInset(Inset const * inset)
|
Buffer const * GuiView::updateInset(Inset const * inset)
|
||||||
{
|
{
|
||||||
WorkArea * work_area = currentWorkArea();
|
if (!d.current_work_area_)
|
||||||
if (!work_area)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (inset) {
|
if (inset)
|
||||||
BOOST_ASSERT(work_area);
|
d.current_work_area_->scheduleRedraw();
|
||||||
work_area->scheduleRedraw();
|
|
||||||
}
|
return &d.current_work_area_->bufferView().buffer();
|
||||||
return &work_area->bufferView().buffer();
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiView::restartCursor()
|
||||||
|
{
|
||||||
|
/* When we move around, or type, it's nice to be able to see
|
||||||
|
* the cursor immediately after the keypress.
|
||||||
|
*/
|
||||||
|
if (d.current_work_area_)
|
||||||
|
d.current_work_area_->startBlinkingCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
|
@ -65,6 +65,7 @@ public:
|
|||||||
int maximized,
|
int maximized,
|
||||||
unsigned int iconSizeXY,
|
unsigned int iconSizeXY,
|
||||||
const std::string & geometryArg);
|
const std::string & geometryArg);
|
||||||
|
/// save the geometry state in the session manager.
|
||||||
virtual void saveGeometry();
|
virtual void saveGeometry();
|
||||||
virtual void setBusy(bool);
|
virtual void setBusy(bool);
|
||||||
/// add toolbar, if newline==true, add a toolbar break before the toolbar
|
/// add toolbar, if newline==true, add a toolbar break before the toolbar
|
||||||
@ -122,6 +123,8 @@ public Q_SLOTS:
|
|||||||
void bigSizedIcons();
|
void bigSizedIcons();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
friend GuiWorkArea;
|
||||||
|
|
||||||
/// make sure we quit cleanly
|
/// make sure we quit cleanly
|
||||||
virtual void closeEvent(QCloseEvent * e);
|
virtual void closeEvent(QCloseEvent * e);
|
||||||
///
|
///
|
||||||
@ -131,31 +134,39 @@ private:
|
|||||||
|
|
||||||
/// \return the \c Workarea associated to \p Buffer
|
/// \return the \c Workarea associated to \p Buffer
|
||||||
/// \retval 0 if no \c WorkArea is found.
|
/// \retval 0 if no \c WorkArea is found.
|
||||||
WorkArea * workArea(Buffer & buffer);
|
GuiWorkArea * workArea(Buffer & buffer);
|
||||||
|
|
||||||
/// Add a \c WorkArea
|
/// Add a \c WorkArea
|
||||||
/// \return the \c Workarea associated to \p Buffer
|
/// \return the \c Workarea associated to \p Buffer
|
||||||
/// \retval 0 if no \c WorkArea is found.
|
/// \retval 0 if no \c WorkArea is found.
|
||||||
WorkArea * addWorkArea(Buffer & buffer);
|
GuiWorkArea * addWorkArea(Buffer & buffer);
|
||||||
void setCurrentWorkArea(WorkArea * work_area);
|
///
|
||||||
void removeWorkArea(WorkArea * work_area);
|
void setCurrentWorkArea(GuiWorkArea * work_area);
|
||||||
WorkArea const * currentWorkArea() const;
|
///
|
||||||
WorkArea * currentWorkArea();
|
void removeWorkArea(GuiWorkArea * work_area);
|
||||||
|
/// return the current WorkArea (the one that has the focus).
|
||||||
|
GuiWorkArea const * currentWorkArea() const;
|
||||||
|
/// FIXME: This non-const access is needed because of
|
||||||
|
/// a mis-designed \c ControlSpellchecker.
|
||||||
|
GuiWorkArea * currentWorkArea();
|
||||||
|
|
||||||
///
|
/// GuiBufferDelegate.
|
||||||
void resetAutosaveTimer();
|
///@{
|
||||||
///
|
void resetAutosaveTimers();
|
||||||
void showErrorList(std::string const & error_type);
|
void errors(std::string const &);
|
||||||
///
|
|
||||||
void structureChanged() { updateToc(); }
|
void structureChanged() { updateToc(); }
|
||||||
///
|
///@}
|
||||||
void connectBuffer(Buffer & buf);
|
|
||||||
///
|
|
||||||
void disconnectBuffer();
|
/// connect to signals in the given BufferView
|
||||||
///
|
|
||||||
void connectBufferView(BufferView & bv);
|
void connectBufferView(BufferView & bv);
|
||||||
///
|
/// disconnect from signals in the given BufferView
|
||||||
void disconnectBufferView();
|
void disconnectBufferView();
|
||||||
|
/// connect to signals in the given buffer
|
||||||
|
void connectBuffer(Buffer & buf);
|
||||||
|
/// disconnect from signals in the given buffer
|
||||||
|
void disconnectBuffer();
|
||||||
|
|
||||||
////
|
////
|
||||||
void showDialog(std::string const & name);
|
void showDialog(std::string const & name);
|
||||||
void showDialogWithData(std::string const & name,
|
void showDialogWithData(std::string const & name,
|
||||||
@ -201,6 +212,8 @@ private:
|
|||||||
* visible. If successful return a pointer to the owning Buffer.
|
* visible. If successful return a pointer to the owning Buffer.
|
||||||
*/
|
*/
|
||||||
Buffer const * updateInset(Inset const *);
|
Buffer const * updateInset(Inset const *);
|
||||||
|
///
|
||||||
|
void restartCursor();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "GuiApplication.h"
|
#include "GuiApplication.h"
|
||||||
#include "GuiKeySymbol.h"
|
#include "GuiKeySymbol.h"
|
||||||
#include "GuiPainter.h"
|
#include "GuiPainter.h"
|
||||||
|
#include "GuiView.h"
|
||||||
#include "KeySymbol.h"
|
#include "KeySymbol.h"
|
||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
#include "LyXFunc.h"
|
#include "LyXFunc.h"
|
||||||
@ -42,7 +43,6 @@
|
|||||||
#include "frontends/Application.h"
|
#include "frontends/Application.h"
|
||||||
#include "frontends/Dialogs.h" // only used in setReadOnly
|
#include "frontends/Dialogs.h" // only used in setReadOnly
|
||||||
#include "frontends/FontMetrics.h"
|
#include "frontends/FontMetrics.h"
|
||||||
#include "frontends/LyXView.h"
|
|
||||||
#include "frontends/WorkAreaManager.h"
|
#include "frontends/WorkAreaManager.h"
|
||||||
|
|
||||||
#include <QInputContext>
|
#include <QInputContext>
|
||||||
@ -199,11 +199,8 @@ SyntheticMouseEvent::SyntheticMouseEvent()
|
|||||||
|
|
||||||
static boost::signals::connection timecon;
|
static boost::signals::connection timecon;
|
||||||
|
|
||||||
// HACK: FIXME
|
|
||||||
WorkArea::~WorkArea() {}
|
|
||||||
|
|
||||||
|
GuiWorkArea::GuiWorkArea(Buffer & buffer, GuiView & lv)
|
||||||
GuiWorkArea::GuiWorkArea(Buffer & buffer, LyXView & lv)
|
|
||||||
: buffer_view_(new BufferView(buffer)), lyx_view_(&lv),
|
: buffer_view_(new BufferView(buffer)), lyx_view_(&lv),
|
||||||
cursor_visible_(false), cursor_timeout_(400),
|
cursor_visible_(false), cursor_timeout_(400),
|
||||||
need_resize_(false), schedule_redraw_(false),
|
need_resize_(false), schedule_redraw_(false),
|
||||||
|
@ -44,7 +44,7 @@ class Buffer;
|
|||||||
|
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
class LyXView;
|
class GuiView;
|
||||||
|
|
||||||
/// types of cursor in work area
|
/// types of cursor in work area
|
||||||
enum CursorShape {
|
enum CursorShape {
|
||||||
@ -106,22 +106,19 @@ class GuiWorkArea : public QAbstractScrollArea, public WorkArea
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
GuiWorkArea(Buffer & buffer, LyXView & lv);
|
GuiWorkArea(Buffer & buffer, GuiView & lv);
|
||||||
///
|
///
|
||||||
~GuiWorkArea();
|
~GuiWorkArea();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the scrollbar.
|
||||||
|
* @param height the total document height in pixels
|
||||||
|
* @param pos the current position in the document, in pixels
|
||||||
|
* @param line_height the line-scroll amount, in pixels
|
||||||
|
*/
|
||||||
|
void setScrollbarParams(int height, int pos, int line_height);
|
||||||
///
|
///
|
||||||
bool hasFocus() const { return QAbstractScrollArea::hasFocus(); }
|
void scheduleRedraw() { schedule_redraw_ = true; }
|
||||||
bool isVisible() const { return QAbstractScrollArea::isVisible(); }
|
|
||||||
|
|
||||||
/// return the width of the content pane
|
|
||||||
virtual int width() const { return viewport()->width(); }
|
|
||||||
/// return the height of the content pane
|
|
||||||
virtual int height() const { return viewport()->height(); }
|
|
||||||
///
|
|
||||||
virtual void setScrollbarParams(int height, int pos, int line_height);
|
|
||||||
///
|
|
||||||
virtual void scheduleRedraw() { schedule_redraw_ = true; }
|
|
||||||
|
|
||||||
/// update the passed area.
|
/// update the passed area.
|
||||||
void update(int x, int y, int w, int h);
|
void update(int x, int y, int w, int h);
|
||||||
@ -144,7 +141,8 @@ public:
|
|||||||
void stopBlinkingCursor();
|
void stopBlinkingCursor();
|
||||||
///
|
///
|
||||||
void startBlinkingCursor();
|
void startBlinkingCursor();
|
||||||
///
|
/// Process Key pressed event.
|
||||||
|
/// This needs to be public because it is accessed externally by GuiView.
|
||||||
void processKeySym(KeySymbol const & key, KeyModifier mod);
|
void processKeySym(KeySymbol const & key, KeyModifier mod);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
@ -217,7 +215,7 @@ private:
|
|||||||
///
|
///
|
||||||
BufferView * buffer_view_;
|
BufferView * buffer_view_;
|
||||||
///
|
///
|
||||||
LyXView * lyx_view_;
|
GuiView * lyx_view_;
|
||||||
/// is the cursor currently displayed
|
/// is the cursor currently displayed
|
||||||
bool cursor_visible_;
|
bool cursor_visible_;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user