3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 // Too hard to make concept checks work with this file
14 #ifdef _GLIBCXX_CONCEPT_CHECKS
15 #undef _GLIBCXX_CONCEPT_CHECKS
17 #ifdef _GLIBCPP_CONCEPT_CHECKS
18 #undef _GLIBCPP_CONCEPT_CHECKS
23 #include "GWorkArea.h"
26 #include "BufferView.h"
33 #include "frontends/screen.h"
34 #include "frontends/font_metrics.h"
35 #include "frontends/Painter.h"
36 #include "frontends/WorkArea.h"
38 #include "insets/insettext.h"
45 GScreen::GScreen(GWorkArea & o)
46 : LyXScreen(), owner_(o)
48 // the cursor isnt yet visible
61 WorkArea & GScreen::workarea()
67 void GScreen::setCursorColor(Glib::RefPtr<Gdk::GC> gc)
69 Gdk::Color * clr = owner_.getColorHandler().
70 getGdkColor(LColor::cursor);
71 gc->set_foreground(*clr);
75 void GScreen::showCursor(int x, int y, int h, Cursor_Shape shape)
77 // Update the cursor color.
78 setCursorColor(owner_.getGC());
89 cursorW_ = cursorH_ / 3;
91 case REVERSED_L_SHAPE:
92 cursorW_ = cursorH_ / 3;
93 cursorX_ = x - cursorW_ + 1;
97 int fx, fy, fwidth, fheight, fdepth;
98 owner_.getWindow()->get_geometry(fx, fy, fwidth, fheight, fdepth);
99 cursorPixmap_ = Gdk::Pixmap::create(owner_.getWindow(),
103 cursorPixmap_->draw_drawable(owner_.getGC(),
105 owner_.xpos() + cursorX_,
106 owner_.ypos() + cursorY_,
110 owner_.getWindow()->draw_line(owner_.getGC(),
114 y + h - 1 + owner_.ypos());
119 case REVERSED_L_SHAPE:
120 owner_.getWindow()->draw_line(owner_.getGC(),
121 owner_.xpos() + cursorX_,
122 owner_.ypos() + y + h - 1,
123 owner_.xpos() + cursorX_ + cursorW_ - 1,
124 owner_.xpos() + y + h - 1);
130 void GScreen::removeCursor()
133 owner_.getWindow()->draw_drawable(owner_.getGC(),
136 cursorX_ + owner_.xpos(),
137 cursorY_ + owner_.ypos(),
143 void GScreen::expose(int x, int y, int w, int h)
145 lyxerr[Debug::GUI] << "expose " << w << 'x' << h
146 << '+' << x << '+' << y << std::endl;
147 owner_.getWindow()->draw_drawable(owner_.getGC(),
155 } // namespace frontend