VirtualBox

source: kBuild/trunk/VSlickMacros/kkeys.e@ 1810

Last change on this file since 1810 was 1590, checked in by bird, 17 years ago

mac aliases and fixes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.6 KB
Line 
1/* $Id: kkeys.e 1590 2008-05-01 19:31:04Z bird $ */
2/** @file
3 * Bird's key additions to Visual Slickedit.
4 */
5
6/*
7 *
8 * Copyright (c) 2004-2008 knut st. osmundsen <[email protected]>
9 *
10 * This file is part of kBuild.
11 *
12 * kBuild is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * kBuild is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with kBuild; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
28defeventtab default_keys
29def 'A-UP' = find_prev
30def 'A-DOWN' = find_next
31def 'A-PGUP' = prev_proc
32def 'A-PGDN' = next_proc
33def 'A-d' = delete_line
34def 'A-o' = kkeys_duplicate_line
35def 'A-s' = kkeys_switch_lines
36def 'A-u' = undo_cursor /* will cursor movement in one undo step. */
37def 'A-g' = goto_line
38def 'A-z' = kkeys_fullscreen
39def 'INS' = boxer_paste
40def 'S-INS' = insert_toggle
41def 'C-UP' = kkeys_scroll_down
42def 'C-DOWN' = kkeys_scroll_up
43def 'C-PGUP' = prev_window
44def 'C-PGDN' = next_window
45def 'C-DEL' = kkeys_delete_right
46/* For the mac (A/M mix, all except A-z): */
47def 'M-UP' = find_prev
48def 'M-DOWN' = find_next
49def 'M-PGUP' = prev_proc
50def 'M-PGDN' = next_proc
51def 'M-d' = delete_line
52def 'M-o' = kkeys_duplicate_line
53def 'M-s' = kkeys_switch_lines
54def 'M-u' = undo_cursor
55def 'M-g' = goto_line
56/* Fixing brainfucked slickedit silliness: */
57def 'M-v' = paste
58
59_command kkeys_switch_lines()
60{
61 /* Allocate a selection for copying the current line. */
62 cursor_down();
63 mark_id= _alloc_selection();
64 if (mark_id>=0)
65 {
66 _select_line(mark_id);
67 cursor_up();
68 cursor_up();
69 _move_to_cursor(mark_id);
70 cursor_down();
71 _free_selection(mark_id);
72 // This selection can be freed because it is not the active selection.
73 }
74 else
75 message(get_message(mark_id));
76}
77
78_command kkeys_duplicate_line()
79{
80 /* Allocate a selection for copying the current line. */
81 mark_id= _alloc_selection();
82 if (mark_id>=0)
83 {
84 _select_line(mark_id);
85 _copy_to_cursor(mark_id);
86 // This selection can be freed because it is not the active selection.
87 _free_selection(mark_id);
88 cursor_down();
89 }
90 else
91 message(get_message(mark_id));
92}
93
94_command kkeys_delete_right()
95{
96 col=p_col
97 search('[ \t]#|?|$|^','r+');
98 if ( match_length()&& get_text(1,match_length('s'))=='' )
99 {
100 _nrseek(match_length('s'));
101 _delete_text(match_length());
102 }
103 else
104 delete_word();
105 p_col=col
106 //retrieve_command_results()
107
108}
109
110_command kkeys_delete_left()
111{
112 //denne virker ikkje som den skal!!!
113 message "not implemented"
114/*
115 return;
116 col=p_col
117 search('[ \t]#|?|$|^','r-');
118 if ( match_length()&& get_text(1,match_length('s'))=='' )
119 {
120 _nrseek(match_length('s'));
121 _delete_text(match_length());
122 }
123 else
124 delete_word();
125 p_col=col
126*/
127}
128
129_command kkeys_scroll_up()
130{
131 if (p_cursor_y == 0)
132 down();
133 set_scroll_pos(p_left_edge, p_cursor_y-1);
134}
135
136_command kkeys_scroll_down()
137{
138 if (p_cursor_y intdiv p_font_height == p_char_height-1)
139 up()
140 set_scroll_pos(p_left_edge, p_cursor_y+p_font_height);
141}
142
143_command boxer_paste()
144{
145 int rc;
146 offset = _QROffset();
147 message(offset);
148 rc = paste();
149 _GoToROffset(offset);
150}
151
152_command kkeys_fullscreen()
153{
154 fullscreen();
155}
156
157
158/* for later, not used yet. */
159
160_command boxer_select()
161{
162 if (command_state())
163 fSelected = (p_sel_length != 0);
164 else
165 fSelected = select_active();
166
167 key = last_event();
168 if (key :== name2event('s-down'))
169 {
170 if (!fSelected)
171 select_line();
172 else
173 cursor_down();
174 }
175 else if (key :== name2event('s-up'))
176 {
177 if (!fSelected)
178 select_line();
179 else
180 cursor_up();
181 }
182 else if (key :== name2event('s-left'))
183 {
184 if (!fSelected)
185 select_char();
186 else
187 cursor_left();
188 }
189 else if (key :== name2event('s-right'))
190 {
191 if (!fSelected)
192 select_char();
193 else
194 cursor_right();
195 }
196 else if (key :== name2event('s-home'))
197 {
198 if (!fSelected) select_char();
199 begin_line_text_toggle();
200 }
201 else if (key :== name2event('s-end'))
202 {
203 if (!fSelected) select_char();
204 end_line();
205 if (p_col > 0) //this is not identical with boxer...
206 cursor_left();
207 }
208 else if (key :== name2event('c-s-home'))
209 {
210 if (!fSelected) select_char();
211 top_of_buffer();
212 }
213 else if (key :== name2event('c-s-end'))
214 {
215 if (!fSelected) select_char();
216 bottom_of_buffer();
217 }
218 else if (key :== name2event('c-s-left'))
219 {
220 if (!fSelected)
221 {
222 cursor_left();
223 select_char(); /* start this selection non-inclusive */
224 }
225 prev_word();
226 }
227 else if (key :== name2event('c-s-right'))
228 {
229 if (!fSelected)
230 {
231 select_char(); /* start this selection non-inclusive */
232 }
233 /* temporary hack */
234 prevpos = p_col;
235 prevline = p_line;
236 p_col++;
237 next_word();
238 if ((p_line == prevline && p_col > prevpos + 1) || (p_line != prevline && p_col > 0))
239 p_col--;
240 }
241}
242
243
244void nop()
245{
246
247}
248
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette