#include "debug.h"
#include "funcrequest.h"
#include "LColor.h"
+#include "WorkArea.h"
+#include "Gui.h"
+#include "Selection.h"
using boost::shared_ptr;
gtk_im_context_set_client_window(
imContext_, workArea_.get_window()->gobj());
}
- view_.view()->workAreaResize();
+ view_.workArea()->resizeBufferView();
return true;
}
adjusting_ = true;
double val = vscrollbar_.get_adjustment()->get_value();
- view_.view()->scrollDocView(static_cast<int>(val));
+ view_.workArea()->scrollBufferView(static_cast<int>(val));
adjusting_ = false;
}
default:
break;
}
- view_.view()->workAreaDispatch(FuncRequest(ka,
+ view_.workArea()->dispatch(FuncRequest(ka,
static_cast<int>(event->x),
static_cast<int>(event->y),
gButtonToLyx(event->button)));
bool GWorkArea::onButtonRelease(GdkEventButton * event)
{
- view_.view()->workAreaDispatch(FuncRequest(LFUN_MOUSE_RELEASE,
+ view_.workArea()->dispatch(FuncRequest(LFUN_MOUSE_RELEASE,
static_cast<int>(event->x),
static_cast<int>(event->y),
gButtonToLyx(event->button)));
}
timeBefore = event->time;
}
- view_.view()->workAreaDispatch(FuncRequest(LFUN_MOUSE_MOTION,
+ view_.workArea()->dispatch(FuncRequest(LFUN_MOUSE_MOTION,
static_cast<int>(event->x),
static_cast<int>(event->y),
gtkButtonState(event->state)));
bool GWorkArea::onKeyPress(GdkEventKey * event)
{
-#ifdef I18N
- inputCache_ = "";
- bool inputGet = gtk_im_context_filter_keypress(imContext_, event);
- // cope with ascii
- if ((inputGet && inputCache_.size() == 1 && inputCache_[0] < 128) ||
- !inputGet) {
-#endif
+// #ifdef I18N
+// inputCache_ = "";
+// bool inputGet = gtk_im_context_filter_keypress(imContext_, event);
+// // cope with ascii
+// if ((inputGet && inputCache_.size() == 1 && inputCache_[0] < 128) ||
+// !inputGet) {
+// #endif
GLyXKeySym *glk = new GLyXKeySym(event->keyval);
- view_.view()->workAreaKeyPress(LyXKeySymPtr(glk),
- gtkKeyState(event->state));
-#ifdef I18N
- } else if (!inputCache_.empty())
- workAreaCJK_IMprocess(inputCache_.size(), inputCache_.data());
-#endif
+ view_.workArea()->processKeySym(LyXKeySymPtr(glk),
+ gtkKeyState(event->state));
+// #ifdef I18N
+// } else if (!inputCache_.empty())
+// workAreaCJK_IMprocess(inputCache_.size(), inputCache_.data());
+// #endif
return true;
}
-
-void GWorkArea::onClipboardGet(Gtk::SelectionData & /*selection_data*/,
- guint /*info*/)
-{
- view_.view()->selectionRequested();
-}
-
-
-void GWorkArea::onClipboardClear()
-{
-// selectionLost();
-}
-
-
-void GWorkArea::haveSelection(bool toHave)
-{
- if (toHave) {
- Glib::RefPtr<Gtk::Clipboard> clipboard =
- Gtk::Clipboard::get(GDK_SELECTION_PRIMARY);
- std::vector<Gtk::TargetEntry> listTargets;
- listTargets.push_back(Gtk::TargetEntry("UTF8_STRING"));
- clipboard->set(listTargets,
- sigc::mem_fun(const_cast<GWorkArea&>(*this),
- &GWorkArea::onClipboardGet),
- sigc::mem_fun(const_cast<GWorkArea&>(*this),
- &GWorkArea::onClipboardClear));
- }
-}
-
-
-// ENCODING: Gtk::Clipboard returns UTF-8, we assume that the backend
-// wants ISO-8859-1 and convert it to that.
-string const GWorkArea::getClipboard() const
-{
- Glib::RefPtr<Gtk::Clipboard> clipboard =
- Gtk::Clipboard::get(GDK_SELECTION_PRIMARY);
- return Glib::convert_with_fallback(
- clipboard->wait_for_text(), "ISO-8859-1", "UTF-8");
-}
-
-
-// ENCODING: we assume that the backend passes us ISO-8859-1 and
-// convert from that to UTF-8 before passing to GTK
-void GWorkArea::putClipboard(string const & str)
-{
- Glib::RefPtr<Gtk::Clipboard> clipboard =
- Gtk::Clipboard::get(GDK_SELECTION_PRIMARY);
- clipboard->set_text(Glib::convert(str, "UTF-8", "ISO-8859-1"));
-}
-
-
} // namespace frontend
} // namespace lyx