some futher cleanup add new LFUN

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2006 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-05-18 07:37:14 +00:00
parent cdcb9b2cc0
commit e5dfa0b9ac
11 changed files with 130 additions and 147 deletions

View File

@ -1,3 +1,7 @@
2001-05-18 Lars Gullik Bjønnes <larsbj@birdstep.com>
* bind/math.bind: add bindign for escape
2001-05-16 Ruurd Reitsma <r.a.reitsma@wbmt.tudelft.nl>
* configure.m4: detect cygwin, windvi and yap

View File

@ -73,3 +73,5 @@
\bind "M-m ~S-plus" "math-insert pm"
\bind "M-m ~S-equal" "math-insert neq"
\bind "Escape" "escape"

View File

@ -10,8 +10,8 @@ src/CutAndPaste.C
src/debug.C
src/exporter.C
src/ext_l10n.h
src/figureForm.C
src/figure_form.C
src/figureForm.C
src/FontLoader.C
src/frontends/controllers/ButtonController.h
src/frontends/controllers/character.C
@ -90,67 +90,67 @@ src/frontends/qt2/paragraphdlgimpl.C
src/frontends/qt2/tabularcreatedlgimpl.C
src/frontends/xforms/combox.C
src/frontends/xforms/FileDialog.C
src/frontends/xforms/FormBibitem.C
src/frontends/xforms/form_bibitem.C
src/frontends/xforms/FormBibtex.C
src/frontends/xforms/FormBibitem.C
src/frontends/xforms/form_bibtex.C
src/frontends/xforms/FormBibtex.C
src/frontends/xforms/form_browser.C
src/frontends/xforms/FormCharacter.C
src/frontends/xforms/form_character.C
src/frontends/xforms/FormCitation.C
src/frontends/xforms/FormCharacter.C
src/frontends/xforms/form_citation.C
src/frontends/xforms/FormCopyright.C
src/frontends/xforms/FormCitation.C
src/frontends/xforms/form_copyright.C
src/frontends/xforms/FormCredits.C
src/frontends/xforms/FormCopyright.C
src/frontends/xforms/form_credits.C
src/frontends/xforms/FormDocument.C
src/frontends/xforms/FormCredits.C
src/frontends/xforms/form_document.C
src/frontends/xforms/FormError.C
src/frontends/xforms/FormDocument.C
src/frontends/xforms/form_error.C
src/frontends/xforms/FormExternal.C
src/frontends/xforms/FormError.C
src/frontends/xforms/form_external.C
src/frontends/xforms/FormFiledialog.C
src/frontends/xforms/FormExternal.C
src/frontends/xforms/form_filedialog.C
src/frontends/xforms/FormGraphics.C
src/frontends/xforms/FormFiledialog.C
src/frontends/xforms/form_graphics.C
src/frontends/xforms/FormInclude.C
src/frontends/xforms/FormGraphics.C
src/frontends/xforms/form_include.C
src/frontends/xforms/FormIndex.C
src/frontends/xforms/FormInclude.C
src/frontends/xforms/form_index.C
src/frontends/xforms/FormIndex.C
src/frontends/xforms/FormLog.C
src/frontends/xforms/FormMathsBitmap.C
src/frontends/xforms/FormMathsDeco.C
src/frontends/xforms/form_maths_deco.C
src/frontends/xforms/FormMathsDelim.C
src/frontends/xforms/FormMathsDeco.C
src/frontends/xforms/form_maths_delim.C
src/frontends/xforms/FormMathsMatrix.C
src/frontends/xforms/FormMathsDelim.C
src/frontends/xforms/form_maths_matrix.C
src/frontends/xforms/FormMathsPanel.C
src/frontends/xforms/FormMathsMatrix.C
src/frontends/xforms/form_maths_panel.C
src/frontends/xforms/FormMathsSpace.C
src/frontends/xforms/FormMathsPanel.C
src/frontends/xforms/form_maths_space.C
src/frontends/xforms/FormMinipage.C
src/frontends/xforms/FormMathsSpace.C
src/frontends/xforms/form_minipage.C
src/frontends/xforms/FormParagraph.C
src/frontends/xforms/FormMinipage.C
src/frontends/xforms/form_paragraph.C
src/frontends/xforms/FormPreamble.C
src/frontends/xforms/FormParagraph.C
src/frontends/xforms/form_preamble.C
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/FormPreamble.C
src/frontends/xforms/form_preferences.C
src/frontends/xforms/FormPrint.C
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/form_print.C
src/frontends/xforms/FormRef.C
src/frontends/xforms/FormPrint.C
src/frontends/xforms/form_ref.C
src/frontends/xforms/FormSearch.C
src/frontends/xforms/FormRef.C
src/frontends/xforms/form_search.C
src/frontends/xforms/FormTabular.C
src/frontends/xforms/FormSearch.C
src/frontends/xforms/form_tabular.C
src/frontends/xforms/FormTabularCreate.C
src/frontends/xforms/FormTabular.C
src/frontends/xforms/form_tabular_create.C
src/frontends/xforms/FormToc.C
src/frontends/xforms/FormTabularCreate.C
src/frontends/xforms/form_toc.C
src/frontends/xforms/FormUrl.C
src/frontends/xforms/FormToc.C
src/frontends/xforms/form_url.C
src/frontends/xforms/FormUrl.C
src/frontends/xforms/FormVCLog.C
src/frontends/xforms/input_validators.C
src/frontends/xforms/Menubar_pimpl.C

View File

@ -168,8 +168,6 @@ public:
void menuUndo();
///
void menuRedo();
///
void insertNote();
/// removes all autodeletable insets
bool removeAutoInsets();
///
@ -182,8 +180,6 @@ public:
*/
bool insertInset(Inset * inset, string const & lout = string(),
bool no_table = false);
/// open and lock an updatable inset
bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
/** Inserts a lyx file at cursor position.
@return #false# if it fails.
*/

View File

@ -252,23 +252,6 @@ bool BufferView::insertInset(Inset * inset, string const & lout,
}
// Open and lock an updatable inset
bool BufferView::open_new_inset(UpdatableInset * new_inset, bool behind)
{
beforeChange(text);
text->FinishUndo();
if (!insertInset(new_inset)) {
delete new_inset;
return false;
}
if (behind) {
LyXFont & font = getLyXText()->real_current_font;
new_inset->Edit(this, new_inset->width(this, font), 0, 0);
} else
new_inset->Edit(this, 0, 0, 0);
return true;
}
/* This is also a buffer property (ale) */
// Not so sure about that. a goto Label function can not be buffer local, just
// think how this will work in a multiwindo/buffer environment, all the
@ -293,14 +276,6 @@ bool BufferView::gotoLabel(string const & label)
}
void BufferView::insertNote()
{
InsetInfo * new_inset = new InsetInfo();
insertInset(new_inset);
new_inset->Edit(this, 0, 0, 0);
}
void BufferView::menuUndo()
{
if (available()) {

View File

@ -40,6 +40,7 @@
#include "insets/insetref.h"
#include "insets/insetparent.h"
#include "insets/insetindex.h"
#include "insets/insetinfo.h"
#include "insets/insetinclude.h"
#include "insets/insetcite.h"
#include "insets/insetert.h"
@ -2565,7 +2566,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
new InsetTabular(*buffer_, r, c);
bool rtl =
TEXT(bv_)->real_current_font.isRightToLeft();
if (!bv_->open_new_inset(new_inset, rtl))
if (!open_new_inset(new_inset, rtl))
delete new_inset;
}
break;
@ -2664,8 +2665,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
case LFUN_INSERT_MATRIX:
{
if (available()) {
if (bv_->open_new_inset(new InsetFormula(false)))
{
if (open_new_inset(new InsetFormula(false))) {
bv_->theLockingInset()
->LocalDispatch(bv_, action, argument);
}
@ -2679,7 +2679,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
break;
InsetFormula * f = new InsetFormula(true);
bv_->open_new_inset(f);
open_new_inset(f);
f->LocalDispatch(bv_, LFUN_INSERT_MATH, argument);
}
break;
@ -2687,7 +2687,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
case LFUN_MATH_DISPLAY:
{
if (available())
bv_->open_new_inset(new InsetFormula(true));
open_new_inset(new InsetFormula(true));
break;
}
@ -2700,7 +2700,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
else {
string const s1 = token(s, ' ', 1);
int const na = s1.empty() ? 0 : lyx::atoi(s1);
bv_->open_new_inset(new InsetFormulaMacro(token(s, ' ', 0), na));
open_new_inset(new InsetFormulaMacro(token(s, ' ', 0), na));
}
}
}
@ -2709,7 +2709,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
case LFUN_MATH_MODE: // Open or create a math inset
{
if (available())
bv_->open_new_inset(new InsetFormula);
open_new_inset(new InsetFormula);
owner_->getLyXFunc()->setMessage(N_("Math editor mode"));
}
break;
@ -2882,7 +2882,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
break;
case LFUN_INSERT_NOTE:
bv_->insertNote();
insertNote();
break;
case LFUN_SELFINSERT:
@ -2932,67 +2932,39 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
break;
case LFUN_UNKNOWN_ACTION:
{
// Ok what does this break.
#if 0
if (!buffer_) {
owner_->getLyXFunc()->setErrorMessage(N_("No document open"));
break;
}
if (buffer_->isReadonly()) {
owner_->getLyXFunc()->setErrorMessage(N_("Document is read only"));
break;
}
if (!argument.empty()) {
/* Automatically delete the currently selected
* text and replace it with what is being
* typed in now. Depends on lyxrc settings
* "auto_region_delete", which defaults to
* true (on). */
if (lyxrc.auto_region_delete) {
if (TEXT(bv_)->selection){
TEXT(bv_)->CutSelection(bv_, false);
update(TEXT(bv_),
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
}
beforeChange(TEXT(bv_));
LyXFont const old_font(TEXT(bv_)->real_current_font);
for (string::size_type i = 0;
i < argument.length(); ++i) {
if (greek_kb_flag) {
if (!math_insert_greek(bv_, argument[i]))
owner_->getIntl()->getTrans().TranslateAndInsert(argument[i], TEXT(bv_));
} else
owner_->getIntl()->getTrans().TranslateAndInsert(argument[i], TEXT(bv_));
}
update(TEXT(bv_),BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
TEXT(bv_)->sel_cursor = TEXT(bv_)->cursor;
moveCursorUpdate(false);
// real_current_font.number can change so we need to
// update the minibuffer
if (old_font != TEXT(bv_)->real_current_font)
owner_->showState();
} else {
// if we don't have an argument there was something
// strange going on so we just tell this to someone!
owner_->getLyXFunc()->setErrorMessage(N_("No argument given"));
}
#else
owner_->getLyXFunc()->setErrorMessage(N_("Unknow function!"));
#endif
break;
}
default:
return false;
} // end of switch
return true;
}
void BufferView::Pimpl::insertNote()
{
InsetInfo * new_inset = new InsetInfo();
bv_->insertInset(new_inset);
new_inset->Edit(bv_, 0, 0, 0);
}
// Open and lock an updatable inset
bool BufferView::Pimpl::open_new_inset(UpdatableInset * new_inset, bool behind)
{
beforeChange(TEXT(bv_));
TEXT(bv_)->FinishUndo();
if (!bv_->insertInset(new_inset)) {
delete new_inset;
return false;
}
if (behind) {
LyXFont & font = bv_->getLyXText()->real_current_font;
new_inset->Edit(bv_, new_inset->width(bv_, font), 0, 0);
} else
new_inset->Edit(bv_, 0, 0, 0);
return true;
}

View File

@ -122,7 +122,10 @@ struct BufferView::Pimpl : public SigC::Object {
private:
///
friend class BufferView;
/// open and lock an updatable inset
bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
///
void insertNote();
///
BufferView * bv_;
///

View File

@ -1,3 +1,21 @@
2001-05-18 Lars Gullik Bjønnes <larsbj@birdstep.com>
* lyxfunc.C (processKeySym): comment the Escape handling, remove
commented code.
(Dispatch): implement LFUN_ESCAPE
* commandtags.h: add LFUN_ESCAPE
* LyXAction.C (init): add entry for LFUN_ESCAPE
* BufferView_pimpl.C (Dispatch): adjust for open_new_inset move.
Remove commented code.
(insertNote): moved here
(open_new_inset): moved here
* BufferView[2].[Ch]: move insertNote and open_new_inset to
BufferView_pimpl
2001-05-16 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* kbmap.C (findbinding): clean it up and make it work correctly.

View File

@ -407,6 +407,7 @@ void LyXAction::init()
NoBuffer },
{ LFUN_TRANSPOSE_CHARS, "chars-transpose", "", Noop },
{ LFUN_FLOAT_LIST, "float-list", "Insert a float list", Noop },
{ LFUN_ESCAPE, "escape", "", Noop },
{ LFUN_NOACTION, "", "", Noop }
};

View File

@ -279,8 +279,13 @@ enum kb_action {
LFUN_MESSAGE_PUSH, // Lgb 20010410
LFUN_MESSAGE_POP, // Lgb 20010410
LFUN_TRANSPOSE_CHARS, // Lgb 20010425
LFUN_ESCAPE, // Lgb 20010517
LFUN_LASTACTION /* this marks the end of the table */
};
std::ostream & operator<<(std::ostream &, kb_action);
#endif

View File

@ -237,6 +237,10 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state)
return;
}
#if 0
// This if clause should not be here, but should rather be changed
// to a lyxfunc and get XK_Escape bound to it (Lgb)
#warning Fix this please. (Lgb)
if (owner->view()->available()) {
// this function should be used always [asierra060396]
UpdatableInset * tli = owner->view()->theLockingInset();
@ -256,6 +260,7 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state)
return;
}
}
#endif
// Can we be sure that this will work for all X-Windows
// implementations? (Lgb)
@ -321,27 +326,6 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state)
}
if (action == -1) {
#if 0
if (keyseq.length < -1) { // unknown key sequence...
string buf;
keyseq.print(buf);
owner->message(_("Unknown sequence:") + ' ' + buf);
return 0;
}
char const isochar = keyseq.getiso();
if (!(state & ControlMask) &&
!(state & Mod1Mask) &&
(isochar && keysym < 0xF000)) {
argument += isochar;
}
if (argument.empty()) {
lyxerr.debug() << "Empty argument!" << endl;
// This can`t possibly be of any use
// so we`ll skip the dispatch.
return 0;
}
#else
// It is unknown, but what if we remove all
// the modifiers? (Lgb)
action = keyseq.addkey(keysym, 0);
@ -360,7 +344,6 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state)
//return 0;
return;
}
#endif
}
if (action == LFUN_SELFINSERT) {
@ -775,6 +758,31 @@ string const LyXFunc::Dispatch(int ac,
lyx::Assert(action != LFUN_SELECT_FILE_SYNC);
switch (action) {
case LFUN_ESCAPE:
{
if (!owner->view()->available()) break;
// this function should be used always [asierra060396]
UpdatableInset * tli =
owner->view()->theLockingInset();
if (tli) {
UpdatableInset * lock = tli->GetLockingInset();
if (tli == lock) {
owner->view()->unlockInset(tli);
TEXT()->CursorRight(owner->view());
moveCursorUpdate(true, false);
owner->showState();
} else {
tli->UnlockInsetInInset(owner->view(),
lock,
true);
}
}
}
break;
// --- Misc -------------------------------------------
case LFUN_WORDFINDFORWARD :
case LFUN_WORDFINDBACKWARD : {
@ -826,7 +834,6 @@ string const LyXFunc::Dispatch(int ac,
}
string buf;
keyseq.print(buf, true);
//owner->getMiniBuffer()->Set(buf, string(), string(), 1);
owner->message(buf);
}
break;