if (!the_buffer->focus) {
fl_set_input(the_buffer, ntext.c_str());
XFlush(fl_display);
text = ntext;
}
}
void MiniBuffer::Init()
{ // If we have focus, we don't want to change anything. if (the_buffer->focus) return;
// When meta-fake key is pressed, show the key sequence so far + "M-". if (owner->getLyXFunc()->wasMetaKey()) {
text = owner->getLyXFunc()->keyseqStr();
text += " M-";
}
// Else, when a non-complete key sequence is pressed, // show the available options. elseif (owner->getLyXFunc()->keyseqUncomplete())
text = owner->getLyXFunc()->keyseqOptions();
// Else, show the buffer state. elseif (owner->currentView()->available()) {
LString nicename =
MakeDisplayPath(owner->currentBuffer()->
getFileName()); // Should we do this instead? (kindo like emacs) // leaves more room for other information
text = "LyX: ";
text += nicename; if (owner->currentBuffer()->lyxvc.inUse()) {
text += " [RCS:";
text += owner->currentBuffer()->lyxvc.getVersion();
text += ' ';
text += owner->currentBuffer()->lyxvc.getLocker(); if (owner->currentBuffer()->isReadonly())
text += " (RO)";
text += ']';
} elseif (owner->currentBuffer()->isReadonly())
text += " [RO]"; if (!owner->currentBuffer()->isLyxClean())
text += _(" (Changed)");
} else { if (text != "Welcome to LyX!") // this is a hack
text = _("* No document open *");
}
// allows to store and reset the contents one time. Usefull for // status messages like "load font" (Matthias) void MiniBuffer::Store()
{
text_stored = fl_get_input(the_buffer);
}
void MiniBuffer::Reset()
{ if (!text_stored.empty()){
Set(text_stored);
text_stored.clean();
}
}
// This is not as dirty as it seems, the hidden buttons removed by this // function were just kludges for an uncomplete keyboard callback (ale) int MiniBuffer::peek_event(FL_OBJECT *ob, int event, FL_Coord, FL_Coord, int key, void */*xev*/)
{
MiniBuffer *mini = (MiniBuffer*)ob->u_vdata;
if (event==FL_KEYBOARD){ switch (key) { case XK_Down:
mini->history_idx++; if (!mini->getHistory().empty()) {
fl_set_input(ob, mini->getHistory().c_str());
} else
mini->history_idx--; return 1; case XK_Up: if (mini->history_idx > 0) mini->history_idx--;
fl_set_input(ob, mini->getHistory().c_str()); return 1; case 9: case XK_Tab:
{ // complete or increment the command constchar *s = lyxaction.getApproxFuncName(fl_get_input(ob)); if (s && s[0])
fl_set_input(ob, s); return 1;
} case 27: case XK_Escape: // Abort
fl_set_focus_object(mini->owner->getForm(),
mini->owner->currentView()->getWorkArea());
mini->Init(); return 1; case 13: case XK_Return: // Execute a command.
mini->cur_cmd = LString(fl_get_input(ob));
ExecutingCB(ob, 0); return 1; default: return 0;
}
} return 0;
}
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.