1 /* AbiWord
2 * Copyright (C) 1998 AbiSource, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301 USA.
18 */
19
20
21 // ********************************************************************************
22 // ********************************************************************************
23 // *** THIS FILE DEFINES THE BINDINGS TO HANG OFF THE Control-x PREFIX KEY IN ***
24 // *** THE Emacs BINDINGS TABLE. ***
25 // ********************************************************************************
26 // ********************************************************************************
27
28 #include "ut_assert.h"
29 #include "ut_types.h"
30 #include "ev_EditBits.h"
31 #include "ev_EditBinding.h"
32 #include "ev_EditMethod.h"
33 #include "ev_NamedVirtualKey.h"
34 #include "ap_LoadBindings.h"
35 #include "ap_LB_EmacsCtrlX.h"
36
37 #define _S | EV_EMS_SHIFT
38 #define _C | EV_EMS_CONTROL
39 #define _A | EV_EMS_ALT
40
41 /*****************************************************************
42 ******************************************************************
43 ** load bindings for the non-nvk
44 ** (character keys). note that SHIFT-state is implicit in the
45 ** character value and is not included in the table. note that
46 ** we do not include the ASCII control characters (\x00 -- \x1f
47 ** and others) since we don't map keystrokes into them.
48 ******************************************************************
49 *****************************************************************/
50
51 static struct ap_bs_Char s_CharTable[] =
52 {
53 // {char, /* desc */ { none, _C, _A, _A_C }},
54 {0x3c, /* < */ { "scrollLineLeft", "", "", "" }},
55 {0x3e, /* < */ { "scrollLineRight", "", "", "" }},
56 {0x5b, /* [ */ { "scrollPageUp", "", "", "" }},
57 {0x5d, /* [ */ { "scrollPageDown", "", "", "" }},
58 {0x63, /* c */ { "", "querySaveAndExit", "", "" }},
59 {0x66, /* f */ { "", "fileOpen", "", "" }},
60 {0x66, /* h */ { "selectAll", "", "", "" }},
61 {0x6b, /* k */ { "closeWindow", "", "", "" }},
62 {0x73, /* s */ { "", "fileSave", "", "" }},
63 {0x77, /* w */ { "", "fileSaveAs", "", "" }},
64 {0x75, /* u */ { "undo", "", "", "" }},
65 };
66
67
68 /*****************************************************************
69 ******************************************************************
70 ** put it all together and load the default bindings.
71 ******************************************************************
72 *****************************************************************/
73
ap_LoadBindings_EmacsCtrlX(AP_BindingSet * pThis,EV_EditBindingMap * pebm)74 bool ap_LoadBindings_EmacsCtrlX(AP_BindingSet * pThis,
75 EV_EditBindingMap * pebm)
76 {
77 pThis->_loadChar(pebm,s_CharTable,G_N_ELEMENTS(s_CharTable),NULL,0);
78
79 return true;
80 }
81