#include "frontends/Clipboard.h"
#include "frontends/Dialogs.h"
#include "frontends/LyXView.h"
-#include "frontends/Gui.h"
#include "insets/insetcommand.h" // ChangeRefs
#include "insets/insettext.h"
}
-void BufferView::hideCursor()
-{
- pimpl_->gui().guiCursor().hide();
-}
-
LyXText * BufferView::getLyXText()
{
LyXText * text = cursor().innerText();
/// set the cursor based on the given TeX source row
void setCursorFromRow(int row);
- /// hide the cursor if it is visible
- void hideCursor();
-
/// center the document view around the cursor
void center();
/// scroll document by the given number of lines of default height
#ifndef BASE_GUI_H
#define BASE_GUI_H
-#include "frontends/GuiCursor.h"
-
#include <boost/shared_ptr.hpp>
#include <map>
class LyXView;
+class BufferView;
namespace lyx {
namespace frontend {
///
virtual void destroyWorkArea(int id) = 0;
- ///
- GuiCursor & guiCursor() {return cursor_;}
-
protected:
/// view of a buffer. Eventually there will be several.
std::map<int, boost::shared_ptr<BufferView> > buffer_views_;
-
-private:
- ///
- GuiCursor cursor_;
};
} // namespace frontend
+++ /dev/null
-/**
- * \file GuiCursor.C
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author John Levon
- * \author Abdelrazak Younes
- *
- * Full author contact details are available in file CREDITS.
- *
- * Splash screen code added by Angus Leeming
- */
-
-#include <config.h>
-
-#include "frontends/GuiCursor.h"
-
-#include "font_metrics.h"
-#include "lyx_gui.h"
-#include "frontends/Painter.h"
-#include "frontends/WorkArea.h"
-
-#include "BufferView.h"
-#include "buffer.h"
-#include "bufferparams.h"
-#include "coordcache.h"
-#include "cursor.h"
-#include "debug.h"
-#include "language.h"
-#include "LColor.h"
-#include "lyxfont.h"
-#include "lyxrc.h"
-#include "lyxrow.h"
-#include "lyxtext.h"
-#include "metricsinfo.h"
-#include "paragraph.h"
-#include "rowpainter.h"
-#include "version.h"
-
-#include "graphics/GraphicsImage.h"
-#include "graphics/GraphicsLoader.h"
-
-#include "support/filetools.h" // LibFileSearch
-
-using lyx::support::libFileSearch;
-
-using std::endl;
-using std::min;
-using std::max;
-using std::string;
-
-namespace lyx {
-namespace frontend {
-
-GuiCursor::GuiCursor()
- : cursor_visible_(false), work_area_(0)
-{
-}
-
-
-GuiCursor::~GuiCursor()
-{
-}
-
-void GuiCursor::connect(WorkArea * work_area)
-{
- work_area_ = work_area;
-}
-
-
-void GuiCursor::show(BufferView & bv)
-{
- if (cursor_visible_)
- return;
-
- if (!bv.available())
- return;
-
- CursorShape shape = BAR_SHAPE;
-
- LyXText const & text = *bv.getLyXText();
- LyXFont const & realfont = text.real_current_font;
- BufferParams const & bp = bv.buffer()->params();
- bool const samelang = realfont.language() == bp.language;
- bool const isrtl = realfont.isVisibleRightToLeft();
-
- if (!samelang || isrtl != bp.language->rightToLeft()) {
- shape = L_SHAPE;
- if (isrtl)
- shape = REVERSED_L_SHAPE;
- }
-
- // The ERT language hack needs fixing up
- if (realfont.language() == latex_language)
- shape = BAR_SHAPE;
-
- LyXFont const font = bv.cursor().getFont();
- int const asc = font_metrics::maxAscent(font);
- int const des = font_metrics::maxDescent(font);
- int h = asc + des;
- int x = 0;
- int y = 0;
- bv.cursor().getPos(x, y);
- y -= asc;
- //lyxerr << "Cursor::show x: " << x << " y: " << y << endl;
-
- BOOST_ASSERT(work_area_);
-
- // if it doesn't touch the screen, don't try to show it
- if (y + h < 0 || y >= work_area_->height())
- return;
-
- cursor_visible_ = true;
- work_area_->showCursor(x, y, h, shape);
-}
-
-
-void GuiCursor::hide()
-{
- if (!cursor_visible_)
- return;
-
- cursor_visible_ = false;
- BOOST_ASSERT(work_area_);
- work_area_->removeCursor();
-}
-
-
-void GuiCursor::toggle(BufferView & bv)
-{
- if (cursor_visible_)
- hide();
- else
- show(bv);
-}
-
-
-void GuiCursor::prepare()
-{
- cursor_visible_ = false;
-}
-
-} // namespace frontend
-} // namespace lyx
+++ /dev/null
-// -*- C++ -*-
-/**
- * \file GuiCursor.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author unknown
- * \author John Levon
- * \author Abdelrazak Younes
- *
- * Full author contact details are available in file CREDITS.
- */
-
-// X11 use a define called CursorShape, and we really want to use
-// that name our selves. Therefore we do something similar to what is done
-// in kde/fixx11h.h:
-namespace X {
-#ifdef CursorShape
-#ifndef FIXX11H_CursorShape
-#define FIXX11H_CursorShape
-int const XCursorShape = CursorShape;
-#undef CursorShape
-int const CursorShape = CursorShape;
-#endif
-#undef CursorShape
-#endif
-
-} // namespace X
-
-#ifndef GUI_CURSOR_H
-#define GUI_CURSOR_H
-
-
-class LyXText;
-class CursorSlice;
-class BufferView;
-class ViewMetricsInfo;
-
-namespace lyx {
-namespace frontend {
-
-class WorkArea;
-
-/// types of cursor in work area
-enum CursorShape {
- /// normal I-beam
- BAR_SHAPE,
- /// L-shape for locked insets of a different language
- L_SHAPE,
- /// reverse L-shape for RTL text
- REVERSED_L_SHAPE
-};
-
-/**
- * GuiCursor - document rendering management
- *
- * The blinking cursor is handled here.
- */
-class GuiCursor {
-public:
- GuiCursor();
-
- virtual ~GuiCursor();
-
- void connect(WorkArea * work_area);
-
- /// hide the visible cursor, if it is visible
- void hide();
-
- /// show the cursor if it is not visible
- void show(BufferView & bv);
-
- /// toggle the cursor's visibility
- void toggle(BufferView & bv);
-
- /// set cursor_visible_ to false in prep for re-display
- void prepare();
-
-private:
- /// is the cursor currently displayed
- bool cursor_visible_;
-
- WorkArea * work_area_;
-};
-
-} // namespace frontend
-} // namespace lyx
-
-#endif // GUI_CURSOR_H
Toolbars.h \
Clipboard.h \
Gui.h \
- GuiCursor.C \
- GuiCursor.h \
WorkArea.C \
WorkArea.h \
font_metrics.h \
* Full author contact details are available in file CREDITS.
*/
+// X11 use a define called CursorShape, and we really want to use
+// that name our selves. Therefore we do something similar to what is done
+// in kde/fixx11h.h:
+namespace X {
+#ifdef CursorShape
+#ifndef FIXX11H_CursorShape
+#define FIXX11H_CursorShape
+int const XCursorShape = CursorShape;
+#undef CursorShape
+int const CursorShape = CursorShape;
+#endif
+#undef CursorShape
+#endif
+} // namespace X
+
+
#ifndef BASE_WORKAREA_H
#define BASE_WORKAREA_H
-#include "frontends/GuiCursor.h"
-
#include "frontends/key_state.h"
#include "frontends/LyXKeySym.h"
#include "frontends/Timeout.h"
class Painter;
+/// types of cursor in work area
+enum CursorShape {
+ /// normal I-beam
+ BAR_SHAPE,
+ /// L-shape for locked insets of a different language
+ L_SHAPE,
+ /// reverse L-shape for RTL text
+ REVERSED_L_SHAPE
+};
+
+
/**
* The work area class represents the widget that provides the
* view onto a document. It is owned by the BufferView, and
#include "frontends/font_metrics.h"
#include "frontends/Painter.h"
-#include "frontends/GuiCursor.h"
+#include "frontends/WorkArea.h"
#include "insets/insettext.h"
namespace lyx {
namespace frontend {
+using lyx::frontend::CursorShape;
+
GScreen::GScreen(GWorkArea & o)
: owner_(o)
{
#ifndef GSCREEN_H
#define GSCREEN_H
-#include "frontends/GuiCursor.h"
+#include "frontends/WorkArea.h"
#include <gtkmm.h>
#include "funcrequest.h"
#include "frontends/Toolbars.h"
+#include "frontends/WorkArea.h"
#include "support/filetools.h"
#include "support/convert.h"
void GView::prohibitInput() const
{
- view()->hideCursor();
+ workArea()->hideCursor();
const_cast<GView*>(this)->set_sensitive(false);
}
void GView::busy(bool yes) const
{
if (yes ) {
- view()->hideCursor();
+ workArea()->hideCursor();
Gdk::Cursor cursor(Gdk::WATCH);
const_cast<GView *>(this)->get_window()->set_cursor(cursor);
const_cast<GView *>(this)->set_sensitive(false);
old_screen_.reset(new GScreen(*old_work_area_.get()));
work_area_.reset(new GuiWorkArea(old_screen_.get(), old_work_area_.get()));
clipboard_.reset(new GuiClipboard(old_work_area_.get()));
- guiCursor().connect(work_area_.get());
// FIXME BufferView creation should be independant of WorkArea creation
buffer_views_[0].reset(new BufferView(view_.get()));
old_screen_.reset(new FScreen(*old_work_area_.get()));
work_area_.reset(new GuiWorkArea(old_screen_.get(), old_work_area_.get()));
clipboard_.reset(new GuiClipboard(old_work_area_.get()));
- guiCursor().connect(work_area_.get());
// FIXME BufferView creation should be independant of WorkArea creation
buffer_views_[0].reset(new BufferView(view_.get()));
view->mainWidget()->setCentralWidget(work_areas_[id].get());
- guiCursor().connect(work_areas_[id].get());
-
return id;
}