VirtualBox

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

Last change on this file since 561 was 561, checked in by bird, 19 years ago

made key functions commands.

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

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