VirtualBox

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

Last change on this file since 358 was 252, checked in by bird, 20 years ago

Fullscreen alt-z.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
1/* $Id: kkeys.e 252 2005-04-20 21:05:38Z bird $ */
2/** @file
3 *
4 * Birds key additions to Visual Slickedit.
5 *
6 * Copyright (c) 2004 knut st. osmundsen <[email protected]>
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
48void 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
67void 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
83void 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
99void kkeys_delete_left()
100{
101 //denne virker ikkje som den skal!!!
102 message "not implemented"
103 return;
104 col=p_col
105 search('[ \t]#|?|$|^','r-');
106 if ( match_length()&& get_text(1,match_length('s'))=='' )
107 {
108 _nrseek(match_length('s'));
109 _delete_text(match_length());
110 }
111 else
112 delete_word();
113 p_col=col
114}
115
116void kkeys_scroll_up()
117{
118 if (p_cursor_y == 0)
119 down();
120 set_scroll_pos(p_left_edge, p_cursor_y-1);
121}
122
123void kkeys_scroll_down()
124{
125 if (p_cursor_y intdiv p_font_height == p_char_height-1)
126 up()
127 set_scroll_pos(p_left_edge, p_cursor_y+p_font_height);
128}
129
130int boxer_paste()
131{
132 int rc;
133 offset=_QROffset();
134 message(offset);
135 rc = paste();
136 _GoToROffset(offset);
137 return rc;
138}
139
140_command kkeys_fullscreen()
141{
142 fullscreen();
143}
144
145
146/* for later, not used yet. */
147
148_command boxer_select()
149{
150 if (command_state())
151 fSelected = (p_sel_length != 0);
152 else
153 fSelected = select_active();
154
155 key = last_event();
156 if (key :== name2event('s-down'))
157 {
158 if (!fSelected)
159 select_line();
160 else
161 cursor_down();
162 }
163 else if (key :== name2event('s-up'))
164 {
165 if (!fSelected)
166 select_line();
167 else
168 cursor_up();
169 }
170 else if (key :== name2event('s-left'))
171 {
172 if (!fSelected)
173 select_char();
174 else
175 cursor_left();
176 }
177 else if (key :== name2event('s-right'))
178 {
179 if (!fSelected)
180 select_char();
181 else
182 cursor_right();
183 }
184 else if (key :== name2event('s-home'))
185 {
186 if (!fSelected) select_char();
187 begin_line_text_toggle();
188 }
189 else if (key :== name2event('s-end'))
190 {
191 if (!fSelected) select_char();
192 end_line();
193 if (p_col > 0) //this is not identical with boxer...
194 cursor_left();
195 }
196 else if (key :== name2event('c-s-home'))
197 {
198 if (!fSelected) select_char();
199 top_of_buffer();
200 }
201 else if (key :== name2event('c-s-end'))
202 {
203 if (!fSelected) select_char();
204 bottom_of_buffer();
205 }
206 else if (key :== name2event('c-s-left'))
207 {
208 if (!fSelected)
209 {
210 cursor_left();
211 select_char(); /* start this selection non-inclusive */
212 }
213 prev_word();
214 }
215 else if (key :== name2event('c-s-right'))
216 {
217 if (!fSelected)
218 {
219 select_char(); /* start this selection non-inclusive */
220 }
221 /* temporary hack */
222 prevpos = p_col;
223 prevline = p_line;
224 p_col++;
225 next_word();
226 if ((p_line == prevline && p_col > prevpos + 1) || (p_line != prevline && p_col > 0))
227 p_col--;
228 }
229}
230
231
232void nop()
233{
234
235}
236
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