qeditor keymap

Roberto Raggi raggi at cli.di.unipi.it
Fri Jun 14 01:26:02 UTC 2002

Hi All,

in the last few days i've tried to implement emacs-style keymap in
qeditor.. the current implementation is very simple

this is the definition of the QEditorKeymap

typedef void (*QEditorCommand)( QEditor* e, int ascii, int arg );

class QEditorKeymap{
    QEditorKeymap( QEditor* );
    virtual ~QEditorKeymap();

    void bind( QEditorCommand f, const KKey& key );
    void unbind( const KKey& key );
    QEditorCommand entry( const KKey& id ) const;

    QEditor* m_editor;
    QMap<KKey, QEditorCommand> m_entryList;

this is the definition of the global and buffer keymap

    m_globalKeymap = new QEditorKeymap( this );
    m_bufferKeymap = new QEditorKeymap( this );

    m_globalKeymap->bind( qe_SetGlobalKeymap, KKey("Ctrl+G") );
    m_globalKeymap->bind( qe_SetBufferKeymap, KKey("Ctrl+X") );
    m_globalKeymap->bind( qe_Backspace, KKey("Backspace") );
    m_globalKeymap->bind( qe_StartSelectMode, KKey("Ctrl+Space") );
    m_globalKeymap->bind( qe_Cut, KKey("Ctrl+W") );
    m_globalKeymap->bind( qe_Paste, KKey("Ctrl+Y") );
    m_globalKeymap->bind( qe_MoveForward, KKey("Right") );
    m_globalKeymap->bind( qe_MoveBackward, KKey("Left") );
    m_globalKeymap->bind( qe_MoveUp, KKey("Up") );
    m_globalKeymap->bind( qe_MoveDown, KKey("Down") );
    m_bufferKeymap->bind( qe_SaveBuffer, KKey("Ctrl+S") );
    m_bufferKeymap->bind( qe_SetGlobalKeymap, KKey("Ctrl+G") );

and this is a piece of code from QEditor::keyPressEvent() 

   if( m_currentKeymap ){
        QEditorCommand cmd = m_currentKeymap->entry( key );
        if( cmd ){
            (*cmd)( this, e->ascii(), 0 );
        } else if( isprint(e->ascii()) ){
            qe_SelfInsert( this, e->ascii(), 0 );
        } else

the main problem of my implementation is that many keys are already
binded in gideon(i.e. CTRL+Space, CTRL+W, ...), so my keymap support is
unusable :-( 

i've noticed rumors about "emacs integration" in gideon, 
so my question is: 
  how embedded emacs can solve this problem?

ciao robe

More information about the KDevelop-devel mailing list