X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyXView.C;h=86316604667a70e7a74d9ada5f8c7166bf83f22c;hb=91a2ea274e9c27f571a3cd4798d2e8ecc1b982a7;hp=148ff63ddabcd97d8c02116f1ba6309445894824;hpb=53b464c5e95ed708e9464db0499826894be450fd;p=lyx.git diff --git a/src/LyXView.C b/src/LyXView.C index 148ff63dda..8631660466 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ @@ -29,7 +29,6 @@ #include "layout_forms.h" #include "intl.h" #include "lyxrc.h" -#include "lyxscreen.h" #include "support/filetools.h" // OnlyFilename() #include "layout.h" #include "lyxtext.h" @@ -39,7 +38,7 @@ extern FD_form_document * fd_form_document; extern void AutoSave(); extern char updatetimer; extern void QuitLyX(); -int current_layout = 0; +LyXTextClass::size_type current_layout = 0; // This is very temporary BufferView * current_view; @@ -81,10 +80,10 @@ void LyXView::UpdateTimerCB(FL_OBJECT * ob, long) LyXView * view = static_cast(ob->u_vdata); if (!view->view()->available()) return; - if (!view->view()->getScreen() || !updatetimer) + if (!updatetimer) return; - view->view()->getScreen()->HideCursor(); + view->view()->hideCursor(); view->view()->update(-2); /* This update can happen, even when the work area has lost @@ -118,8 +117,8 @@ extern "C" void C_LyXView_AutosaveTimerCB(FL_OBJECT * ob, long data) /// Reset autosave timer void LyXView::resetAutosaveTimer() { - if (lyxrc->autosave) - fl_set_timer(_form_main->timer_autosave, lyxrc->autosave); + if (lyxrc.autosave) + fl_set_timer(_form_main->timer_autosave, lyxrc.autosave); } @@ -186,7 +185,7 @@ void LyXView::create_form_form_main(int width, int height) // TOOLBAR // - toolbar = new Toolbar(lyxrc->toolbar, this, air, 30 + air + bw); + toolbar = new Toolbar(this, air, 30 + air + bw); // Setup the toolbar toolbar->set(true); @@ -258,15 +257,15 @@ void LyXView::init() UpdateDocumentClassChoice(); // Start autosave timer - if (lyxrc->autosave) - fl_set_timer(_form_main->timer_autosave, lyxrc->autosave); + if (lyxrc.autosave) + fl_set_timer(_form_main->timer_autosave, lyxrc.autosave); // Install the raw callback for keyboard events fl_register_raw_callback(_form, KeyPressMask, C_LyXView_KeyPressMask_raw_callback); - intl->InitKeyMapper(lyxrc->use_kbmap); + intl->InitKeyMapper(lyxrc.use_kbmap); } @@ -307,7 +306,7 @@ void LyXView::updateLayoutChoice() // we need to do this. toolbar->combox->Redraw(); - char layout = bufferview->text->cursor.par->GetLayout(); + LyXTextClass::size_type layout = bufferview->text->cursor.par->GetLayout(); if (layout != current_layout){ toolbar->combox->select(layout + 1); @@ -337,8 +336,6 @@ int LyXView::KeyPressMask_raw_callback(FL_FORM * fl, void * xev) LyXView * view = static_cast(fl->u_vdata); int retval = 0; // 0 means XForms should have a look at this event -#define USE_XSYNC 1 -#ifdef USE_XSYNC XKeyEvent * xke = static_cast(xev); static Time last_time_pressed = 0; static Time last_time_released = 0; @@ -346,25 +343,24 @@ int LyXView::KeyPressMask_raw_callback(FL_FORM * fl, void * xev) static unsigned int last_key_released = 0; static unsigned int last_state_pressed = 0; static unsigned int last_state_released = 0; -#endif + // funny. Even though the raw_callback is registered with KeyPressMask, // also KeyRelease-events are passed through:-( // [It seems that XForms puts them in pairs... (JMarc)] if (static_cast(xev)->type == KeyPress - && view->bufferview->getWorkArea()->focus - && view->bufferview->getWorkArea()->active) { -#ifdef USE_XSYNC + && view->bufferview->focus() + && view->bufferview->active()) + { last_time_pressed = xke->time; last_key_pressed = xke->keycode; last_state_pressed = xke->state; -#endif retval = view->getLyXFunc() ->processKeyEvent(static_cast(xev)); } -#ifdef USE_XSYNC else if (static_cast(xev)->type == KeyRelease - && view->bufferview->getWorkArea()->focus - && view->bufferview->getWorkArea()->active) { + && view->bufferview->focus() + && view->bufferview->active()) +{ last_time_released = xke->time; last_key_released = xke->keycode; last_state_released = xke->state; @@ -384,7 +380,6 @@ int LyXView::KeyPressMask_raw_callback(FL_FORM * fl, void * xev) // purging of XEvents can cause any harm...after some testing // I can see no problems, but I'd like other reports too. } -#endif return retval; }