]> git.lyx.org Git - lyx.git/commitdiff
Extracted from r14281
authorLars Gullik Bjønnes <larsbj@gullik.org>
Sat, 8 Jul 2006 22:55:22 +0000 (22:55 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Sat, 8 Jul 2006 22:55:22 +0000 (22:55 +0000)
* BufferView:
    - hideCursor(): deleted (for real)
* frontends/GuiCursor:
    - deleted. Functionality transfered to WorkArea.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14389 a592a061-630c-0410-9148-cb99ea01b6c8

13 files changed:
src/BufferView.C
src/BufferView.h
src/frontends/Gui.h
src/frontends/GuiCursor.C [deleted file]
src/frontends/GuiCursor.h [deleted file]
src/frontends/Makefile.am
src/frontends/WorkArea.h
src/frontends/gtk/GScreen.C
src/frontends/gtk/GScreen.h
src/frontends/gtk/GView.C
src/frontends/gtk/GuiImplementation.C
src/frontends/qt3/GuiImplementation.h
src/frontends/qt4/GuiImplementation.C

index aba91428770c2082bd58cb4c47892bf005caa336..8da4777884c1f197e23e955c306dafd557457792 100644 (file)
@@ -43,7 +43,6 @@
 #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"
@@ -299,11 +298,6 @@ void BufferView::gotoLabel(string const & label)
 }
 
 
-void BufferView::hideCursor()
-{
-       pimpl_->gui().guiCursor().hide();
-}
-
 LyXText * BufferView::getLyXText()
 {
        LyXText * text = cursor().innerText();
index a967a2fed479fe916fe95b98f05de712756718ff..a05c38e84cac282c18549eb1715528adf461ce61 100644 (file)
@@ -160,9 +160,6 @@ public:
        /// 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
index 9676e62f4947b210de58af98ccf361b61e200095..76321770486a02d07eeb850e57d79832ffc60d09 100644 (file)
 #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 {
@@ -54,16 +53,9 @@ public:
        ///
        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
diff --git a/src/frontends/GuiCursor.C b/src/frontends/GuiCursor.C
deleted file mode 100644 (file)
index 77f6eae..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- * \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
diff --git a/src/frontends/GuiCursor.h b/src/frontends/GuiCursor.h
deleted file mode 100644 (file)
index e6ee467..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-// -*- 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
index 69d2f0623b3415b5e123093ccb303a7f3e33e565..2e6d5c5a6dfe3bbc6c81d508fa20a1e305c04d87 100644 (file)
@@ -32,8 +32,6 @@ libfrontends_la_SOURCES = \
        Toolbars.h \
        Clipboard.h \
        Gui.h \
-       GuiCursor.C \
-       GuiCursor.h \
        WorkArea.C \
        WorkArea.h \
        font_metrics.h \
index c8a846c9f537dc9924e6225708d3c61aab3e94ca..ffa8b2bc42e13db610dbbcb47876a2517813ddb9 100644 (file)
  * 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"
@@ -27,6 +41,17 @@ namespace frontend {
 
 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
index b5a48bab06888fbef2d2a3612dd47ec19b831446..702b5bb44d64bb87841668733a6c439449c4a5f4 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "frontends/font_metrics.h"
 #include "frontends/Painter.h"
-#include "frontends/GuiCursor.h"
+#include "frontends/WorkArea.h"
 
 #include "insets/insettext.h"
 
@@ -41,6 +41,8 @@
 namespace lyx {
 namespace frontend {
 
+using lyx::frontend::CursorShape;
+
 GScreen::GScreen(GWorkArea & o)
        : owner_(o)
 {
index 1aae24e9cb9b7b464bfd399221af1ac51db685f1..fc717ae71e2b1b18c4fdea374d67bcb0628adb66 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef GSCREEN_H
 #define GSCREEN_H
 
-#include "frontends/GuiCursor.h"
+#include "frontends/WorkArea.h"
 
 #include <gtkmm.h>
 
index edaa95f8537f98a7738cb9151d3b5ffee30cefdd..6765f2197eb44a7d975e5b3ffa718b79397479b3 100644 (file)
@@ -32,6 +32,7 @@
 #include "funcrequest.h"
 
 #include "frontends/Toolbars.h"
+#include "frontends/WorkArea.h"
 
 #include "support/filetools.h"
 #include "support/convert.h"
@@ -159,7 +160,7 @@ bool GView::onFocusIn(GdkEventFocus * /*event*/)
 
 void GView::prohibitInput() const
 {
-       view()->hideCursor();
+       workArea()->hideCursor();
        const_cast<GView*>(this)->set_sensitive(false);
 }
 
@@ -191,7 +192,7 @@ void GView::setWindowTitle(string const & t, string const & /*it*/)
 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);
index c61aa6aa9ab90d8189869260434da740d819ab8b..27123c79d4b251e91e12379d9dd453f832fde1fb 100644 (file)
@@ -32,7 +32,6 @@ int GuiImplementation::newWorkArea(unsigned int w, unsigned int h, int /*view_id
        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()));
index 55a4e34f791e69d478dd88bb0ae3e6f2cd61c6ad..28aa612ec602376924d0120fb40640fc57bf2502 100644 (file)
@@ -75,7 +75,6 @@ public:
                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()));
index d85fa83512df2af8e2181f94250cdfcc412b0ff8..ee720bf6596de585933a5ff805e3e3340160f5e3 100644 (file)
@@ -78,8 +78,6 @@ int GuiImplementation::newWorkArea(unsigned int w, unsigned int h, int view_id)
 
        view->mainWidget()->setCentralWidget(work_areas_[id].get());
 
-       guiCursor().connect(work_areas_[id].get());
-
        return id;
 }