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 WorkArea & GScreen::workarea() const
58 void GScreen::setCursorColor(Glib::RefPtr<Gdk::GC> gc)
60 Gdk::Color * clr = owner_.getColorHandler().
61 getGdkColor(LColor::cursor);
62 gc->set_foreground(*clr);
66 void GScreen::showCursor(int x, int y,
67 int h, Cursor_Shape shape)
69 // Update the cursor color.
70 setCursorColor(owner_.getGC());
81 cursorW_ = cursorH_ / 3;
83 case REVERSED_L_SHAPE:
84 cursorW_ = cursorH_ / 3;
85 cursorX_ = x - cursorW_ + 1;
89 int fx, fy, fwidth, fheight, fdepth;
90 owner_.getWindow()->get_geometry(fx, fy, fwidth, fheight, fdepth);
91 cursorPixmap_ = Gdk::Pixmap::create(owner_.getWindow(),
95 cursorPixmap_->draw_drawable(owner_.getGC(),
97 owner_.xpos() + cursorX_,
98 owner_.ypos() + cursorY_,
102 owner_.getWindow()->draw_line(owner_.getGC(),
106 y + h - 1 + owner_.ypos());
111 case REVERSED_L_SHAPE:
112 owner_.getWindow()->draw_line(owner_.getGC(),
113 owner_.xpos() + cursorX_,
114 owner_.ypos() + y + h - 1,
115 owner_.xpos() + cursorX_ + cursorW_ - 1,
116 owner_.xpos() + y + h - 1);
122 void GScreen::removeCursor()
125 owner_.getWindow()->draw_drawable(owner_.getGC(),
128 cursorX_ + owner_.xpos(),
129 cursorY_ + owner_.ypos(),
135 void GScreen::expose(int x, int y, int w, int h)
137 lyxerr[Debug::GUI] << "expose " << w << 'x' << h
138 << '+' << x << '+' << y << std::endl;
139 owner_.getWindow()->draw_drawable(owner_.getGC(),