]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/gtk/GWorkArea.C
make it compile again
[lyx.git] / src / frontends / gtk / GWorkArea.C
index 5eda32f7397ccbd0cb48b0b0135cfe0d58567715..9b4e3585fbe2d00fcd1b4607e2101c5348414422 100644 (file)
@@ -27,6 +27,9 @@
 #include "debug.h"
 #include "funcrequest.h"
 #include "LColor.h"
+#include "WorkArea.h"
+#include "Gui.h"
+#include "Selection.h"
 
 using boost::shared_ptr;
 
@@ -332,7 +335,7 @@ bool GWorkArea::onConfigure(GdkEventConfigure * /*event*/)
                gtk_im_context_set_client_window(
                        imContext_, workArea_.get_window()->gobj());
        }
-       view_.view()->workAreaResize(workArea_.get_width(), workArea_.get_height());
+       view_.workArea()->resizeBufferView();
        return true;
 }
 
@@ -375,7 +378,7 @@ void GWorkArea::onScroll()
        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;
 }
 
@@ -421,7 +424,7 @@ bool GWorkArea::onButtonPress(GdkEventButton * event)
        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)));
@@ -432,7 +435,7 @@ bool GWorkArea::onButtonPress(GdkEventButton * event)
 
 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)));
@@ -457,7 +460,7 @@ bool GWorkArea::onMotionNotify(GdkEventMotion * event)
                }
                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)));
@@ -473,73 +476,22 @@ void GWorkArea::inputCommit(gchar * str)
 
 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