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 "frontends/screen.h"
17 #include "frontends/font_metrics.h"
18 #include "GWorkArea.h"
25 #include "BufferView.h"
26 #include "insets/insettext.h"
31 GScreen::GScreen(GWorkArea & o)
32 : LyXScreen(), owner_(o)
34 // the cursor isnt yet visible
47 void GScreen::setCursorColor(Glib::RefPtr<Gdk::GC> gc)
49 Gdk::Color * clr = owner_.getColorHandler().
50 getGdkColor(LColor::cursor);
51 gc->set_foreground(*clr);
55 void GScreen::showCursor(int x, int y,
56 int h, Cursor_Shape shape)
58 // Update the cursor color.
59 setCursorColor(owner_.getGC());
70 cursorW_ = cursorH_ / 3;
72 case REVERSED_L_SHAPE:
73 cursorW_ = cursorH_ / 3;
74 cursorX_ = x - cursorW_ + 1;
78 int fx, fy, fwidth, fheight, fdepth;
79 owner_.getWindow()->get_geometry(fx, fy, fwidth, fheight, fdepth);
80 cursorPixmap_ = Gdk::Pixmap::create(owner_.getWindow(),
84 cursorPixmap_->draw_drawable(owner_.getGC(),
86 owner_.xpos() + cursorX_,
87 owner_.ypos() + cursorY_,
91 owner_.getWindow()->draw_line(owner_.getGC(),
95 y + h - 1 + owner_.ypos());
100 case REVERSED_L_SHAPE:
101 owner_.getWindow()->draw_line(owner_.getGC(),
102 owner_.xpos() + cursorX_,
103 owner_.ypos() + y + h - 1,
104 owner_.xpos() + cursorX_ + cursorW_ - 1,
105 owner_.xpos() + y + h - 1);
111 void GScreen::removeCursor()
114 owner_.getWindow()->draw_drawable(owner_.getGC(),
117 cursorX_ + owner_.xpos(),
118 cursorY_ + owner_.ypos(),
124 void GScreen::expose(int x, int y, int w, int h)
126 lyxerr[Debug::GUI] << "expose " << w << 'x' << h
127 << '+' << x << '+' << y << std::endl;
128 owner_.getWindow()->draw_drawable(owner_.getGC(),