// -*- C++ -*- /* This file is part of * ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995 Matthias Ettrich * Copyright (C) 1995-1998 The LyX Team. *
*======================================================*/
/// Redraw the main form. void LyXView::redraw() {
lyxerr.debug("LyXView::redraw()");
fl_redraw_form(_form);
minibuffer->Activate();
}
// Callback for update timer void LyXView::UpdateTimerCB(FL_OBJECT *ob, long)
{
LyXView *view = (LyXView*) ob->u_vdata; if (!view->currentView()->available()) return; if (!view->currentView()->getScreen() || !updatetimer) return;
view->currentView()->getScreen()->HideCursor();
view->currentBuffer()->update(-2); /* This update can happen, even when the work area has lost
* the focus. So suppress the cursor in that case */
updatetimer = 0;
}
FD_form_main *LyXView::create_form_form_main(int width, int height) /* to make this work as it should, .lyxrc should have been * read first; OR maybe this one should be made dynamic. * Hmmmm. Lgb. * We will probably not have lyxrc before the main form is * initialized, because error messages from lyxrc parsing * are presented (and rightly so) in GUI popups. Asger.
*/
{
FL_OBJECT *obj;
// assign an icon to main form unsignedint w, h;
Pixmap lyx_p, lyx_mask;
lyx_p = fl_create_from_pixmapdata(fl_root,
lyx_xpm,
&w,
&h,
&lyx_mask,
0,
0,
0); // this leaks
fl_set_form_icon(fdui->form_main, lyx_p, lyx_mask);
// set min size
fl_set_form_minsize(fdui->form_main, 50, 50);
fl_end_form();
return fdui;
}
void LyXView::init()
{ // Set the textclass choice
invalidateLayoutChoice();
updateLayoutChoice();
UpdateDocumentClassChoice();
// Start autosave timer 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,
KeyPressMask_raw_callback);
intl->InitKeyMapper(lyxrc->use_kbmap);
}
void LyXView::updateLayoutChoice()
{ /* update the layout display */ if (!toolbar->combox) return;
// this has a bi-effect that the layouts are not showed when no // document is loaded. if (bufferview==0 || bufferview->currentBuffer()==0) {
toolbar->combox->clear();
toolbar->combox->Redraw(); return;
}
// If textclass is different, we need to update the list if (toolbar->combox->empty() ||
(last_textclass != currentBuffer()->params.textclass)) {
toolbar->combox->clear(); for (int i = 0;
lyxstyle.NameOfLayout(currentBuffer()->
params.textclass, i) !="@@end@@";
i++) {
LyXLayout *layout = lyxstyle.
Style(currentBuffer()->params.textclass, i); if (layout->obsoleted_by.empty())
toolbar->combox->addline(layout->name.c_str()); else
toolbar->combox->addline(("@N"+layout->name).c_str());
}
last_textclass = currentBuffer()->params.textclass;
current_layout = 0;
} // we need to do this.
toolbar->combox->Redraw();
void LyXView::UpdateDocumentClassChoice()
{ /* update the document class display in the document form */ int i; if (fd_form_document) {
fl_clear_choice(fd_form_document->choice_class); for (i = 0; lyxstyle.DescOfClass (i)!="@@end@@"; i++) {
fl_addto_choice(fd_form_document->choice_class,
lyxstyle.DescOfClass(i).c_str());
}
}
}
// This is necessary, since FL_FREE-Objects doesn't get all keypress events // as FL_KEYBOARD events :-( Matthias 280596 int LyXView::KeyPressMask_raw_callback(FL_FORM *fl, void *xev)
{
LyXView *view = (LyXView*) fl->u_vdata; int retval = 0; // 0 means XForms should have a look at this event
// 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 (((XEvent*)xev)->type == KeyPress
&& view->bufferview->getWorkArea()->focus
&& view->bufferview->getWorkArea()->active)
retval = view->getLyXFunc()->processKeyEvent((XEvent*)xev);
return retval;
}
// Updates the title of the window with the filename of the current document void LyXView::updateWindowTitle() { static LString last_title="LyX";
LString title = "LyX";
if (currentView()->available()) {
LString cur_title = currentBuffer()->getFileName(); if (!cur_title.empty()){
title += ": " + OnlyFilename(cur_title); if (!currentBuffer()->isLyxClean())
title += _(" (Changed)"); if (currentBuffer()->isReadonly())
title += _(" (read only)");
}
} // Don't update title if it's the same as last time if (title != last_title) {
fl_set_form_title(_form, title.c_str());
last_title = title;
}
}
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.