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.
16 #include "GWorkArea.h"
19 #include "BufferView.h"
26 #include "frontends/screen.h"
27 #include "frontends/font_metrics.h"
28 #include "frontends/Painter.h"
29 #include "frontends/WorkArea.h"
31 #include "insets/insettext.h"
36 GScreen::GScreen(GWorkArea & o)
37 : LyXScreen(), owner_(o)
39 // the cursor isnt yet visible
52 void GScreen::setCursorColor(Glib::RefPtr<Gdk::GC> gc)
54 Gdk::Color * clr = owner_.getColorHandler().
55 getGdkColor(LColor::cursor);
56 gc->set_foreground(*clr);
60 void GScreen::showCursor(int x, int y,
61 int h, Cursor_Shape shape)
63 // Update the cursor color.
64 setCursorColor(owner_.getGC());
75 cursorW_ = cursorH_ / 3;
77 case REVERSED_L_SHAPE:
78 cursorW_ = cursorH_ / 3;
79 cursorX_ = x - cursorW_ + 1;
83 int fx, fy, fwidth, fheight, fdepth;
84 owner_.getWindow()->get_geometry(fx, fy, fwidth, fheight, fdepth);
85 cursorPixmap_ = Gdk::Pixmap::create(owner_.getWindow(),
89 cursorPixmap_->draw_drawable(owner_.getGC(),
91 owner_.xpos() + cursorX_,
92 owner_.ypos() + cursorY_,
96 owner_.getWindow()->draw_line(owner_.getGC(),
100 y + h - 1 + owner_.ypos());
105 case REVERSED_L_SHAPE:
106 owner_.getWindow()->draw_line(owner_.getGC(),
107 owner_.xpos() + cursorX_,
108 owner_.ypos() + y + h - 1,
109 owner_.xpos() + cursorX_ + cursorW_ - 1,
110 owner_.xpos() + y + h - 1);
116 void GScreen::removeCursor()
119 owner_.getWindow()->draw_drawable(owner_.getGC(),
122 cursorX_ + owner_.xpos(),
123 cursorY_ + owner_.ypos(),
129 void GScreen::expose(int x, int y, int w, int h)
131 lyxerr[Debug::GUI] << "expose " << w << 'x' << h
132 << '+' << x << '+' << y << std::endl;
133 owner_.getWindow()->draw_drawable(owner_.getGC(),