Mercurial > octave
comparison libgui/languages/build_ts/octave-qsci/Qsci/qscicommand.h @ 31537:5ceb4bfcdb0f stable
add tools and files for updating the gui's language files for translation
* libgui/languages/build_ts/README.md: readme for updating language files
* libgui/languages/build_ts/octave-qsci: QScintilla source files for
languages without translation provided by QScintilla
* libgui/languages/build_ts/octave-qt: Qt source files for languages
without translation provided by Qt
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Thu, 24 Nov 2022 06:48:25 +0100 |
parents | |
children | dd5ece3664ed |
comparison
equal
deleted
inserted
replaced
31535:4b80982e0af8 | 31537:5ceb4bfcdb0f |
---|---|
1 // This defines the interface to the QsciCommand class. | |
2 // | |
3 // Copyright (c) 2019 Riverbank Computing Limited <info@riverbankcomputing.com> | |
4 // | |
5 // This file is part of QScintilla. | |
6 // | |
7 // This file may be used under the terms of the GNU General Public License | |
8 // version 3.0 as published by the Free Software Foundation and appearing in | |
9 // the file LICENSE included in the packaging of this file. Please review the | |
10 // following information to ensure the GNU General Public License version 3.0 | |
11 // requirements will be met: http://www.gnu.org/copyleft/gpl.html. | |
12 // | |
13 // If you do not wish to use this file under the terms of the GPL version 3.0 | |
14 // then you may purchase a commercial license. For more information contact | |
15 // info@riverbankcomputing.com. | |
16 // | |
17 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | |
18 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
19 | |
20 | |
21 #ifndef QSCICOMMAND_H | |
22 #define QSCICOMMAND_H | |
23 | |
24 #include <qstring.h> | |
25 | |
26 #include <Qsci/qsciglobal.h> | |
27 #include <Qsci/qsciscintillabase.h> | |
28 | |
29 | |
30 class QsciScintilla; | |
31 | |
32 | |
33 //! \brief The QsciCommand class represents an internal editor command that may | |
34 //! have one or two keys bound to it. | |
35 //! | |
36 //! Methods are provided to change the keys bound to the command and to remove | |
37 //! a key binding. Each command has a user friendly description of the command | |
38 //! for use in key mapping dialogs. | |
39 class QSCINTILLA_EXPORT QsciCommand | |
40 { | |
41 public: | |
42 //! This enum defines the different commands that can be assigned to a key. | |
43 enum Command { | |
44 //! Move down one line. | |
45 LineDown = QsciScintillaBase::SCI_LINEDOWN, | |
46 | |
47 //! Extend the selection down one line. | |
48 LineDownExtend = QsciScintillaBase::SCI_LINEDOWNEXTEND, | |
49 | |
50 //! Extend the rectangular selection down one line. | |
51 LineDownRectExtend = QsciScintillaBase::SCI_LINEDOWNRECTEXTEND, | |
52 | |
53 //! Scroll the view down one line. | |
54 LineScrollDown = QsciScintillaBase::SCI_LINESCROLLDOWN, | |
55 | |
56 //! Move up one line. | |
57 LineUp = QsciScintillaBase::SCI_LINEUP, | |
58 | |
59 //! Extend the selection up one line. | |
60 LineUpExtend = QsciScintillaBase::SCI_LINEUPEXTEND, | |
61 | |
62 //! Extend the rectangular selection up one line. | |
63 LineUpRectExtend = QsciScintillaBase::SCI_LINEUPRECTEXTEND, | |
64 | |
65 //! Scroll the view up one line. | |
66 LineScrollUp = QsciScintillaBase::SCI_LINESCROLLUP, | |
67 | |
68 //! Scroll to the start of the document. | |
69 ScrollToStart = QsciScintillaBase::SCI_SCROLLTOSTART, | |
70 | |
71 //! Scroll to the end of the document. | |
72 ScrollToEnd = QsciScintillaBase::SCI_SCROLLTOEND, | |
73 | |
74 //! Scroll vertically to centre the current line. | |
75 VerticalCentreCaret = QsciScintillaBase::SCI_VERTICALCENTRECARET, | |
76 | |
77 //! Move down one paragraph. | |
78 ParaDown = QsciScintillaBase::SCI_PARADOWN, | |
79 | |
80 //! Extend the selection down one paragraph. | |
81 ParaDownExtend = QsciScintillaBase::SCI_PARADOWNEXTEND, | |
82 | |
83 //! Move up one paragraph. | |
84 ParaUp = QsciScintillaBase::SCI_PARAUP, | |
85 | |
86 //! Extend the selection up one paragraph. | |
87 ParaUpExtend = QsciScintillaBase::SCI_PARAUPEXTEND, | |
88 | |
89 //! Move left one character. | |
90 CharLeft = QsciScintillaBase::SCI_CHARLEFT, | |
91 | |
92 //! Extend the selection left one character. | |
93 CharLeftExtend = QsciScintillaBase::SCI_CHARLEFTEXTEND, | |
94 | |
95 //! Extend the rectangular selection left one character. | |
96 CharLeftRectExtend = QsciScintillaBase::SCI_CHARLEFTRECTEXTEND, | |
97 | |
98 //! Move right one character. | |
99 CharRight = QsciScintillaBase::SCI_CHARRIGHT, | |
100 | |
101 //! Extend the selection right one character. | |
102 CharRightExtend = QsciScintillaBase::SCI_CHARRIGHTEXTEND, | |
103 | |
104 //! Extend the rectangular selection right one character. | |
105 CharRightRectExtend = QsciScintillaBase::SCI_CHARRIGHTRECTEXTEND, | |
106 | |
107 //! Move left one word. | |
108 WordLeft = QsciScintillaBase::SCI_WORDLEFT, | |
109 | |
110 //! Extend the selection left one word. | |
111 WordLeftExtend = QsciScintillaBase::SCI_WORDLEFTEXTEND, | |
112 | |
113 //! Move right one word. | |
114 WordRight = QsciScintillaBase::SCI_WORDRIGHT, | |
115 | |
116 //! Extend the selection right one word. | |
117 WordRightExtend = QsciScintillaBase::SCI_WORDRIGHTEXTEND, | |
118 | |
119 //! Move to the end of the previous word. | |
120 WordLeftEnd = QsciScintillaBase::SCI_WORDLEFTEND, | |
121 | |
122 //! Extend the selection to the end of the previous word. | |
123 WordLeftEndExtend = QsciScintillaBase::SCI_WORDLEFTENDEXTEND, | |
124 | |
125 //! Move to the end of the next word. | |
126 WordRightEnd = QsciScintillaBase::SCI_WORDRIGHTEND, | |
127 | |
128 //! Extend the selection to the end of the next word. | |
129 WordRightEndExtend = QsciScintillaBase::SCI_WORDRIGHTENDEXTEND, | |
130 | |
131 //! Move left one word part. | |
132 WordPartLeft = QsciScintillaBase::SCI_WORDPARTLEFT, | |
133 | |
134 //! Extend the selection left one word part. | |
135 WordPartLeftExtend = QsciScintillaBase::SCI_WORDPARTLEFTEXTEND, | |
136 | |
137 //! Move right one word part. | |
138 WordPartRight = QsciScintillaBase::SCI_WORDPARTRIGHT, | |
139 | |
140 //! Extend the selection right one word part. | |
141 WordPartRightExtend = QsciScintillaBase::SCI_WORDPARTRIGHTEXTEND, | |
142 | |
143 //! Move to the start of the document line. | |
144 Home = QsciScintillaBase::SCI_HOME, | |
145 | |
146 //! Extend the selection to the start of the document line. | |
147 HomeExtend = QsciScintillaBase::SCI_HOMEEXTEND, | |
148 | |
149 //! Extend the rectangular selection to the start of the document line. | |
150 HomeRectExtend = QsciScintillaBase::SCI_HOMERECTEXTEND, | |
151 | |
152 //! Move to the start of the displayed line. | |
153 HomeDisplay = QsciScintillaBase::SCI_HOMEDISPLAY, | |
154 | |
155 //! Extend the selection to the start of the displayed line. | |
156 HomeDisplayExtend = QsciScintillaBase::SCI_HOMEDISPLAYEXTEND, | |
157 | |
158 //! Move to the start of the displayed or document line. | |
159 HomeWrap = QsciScintillaBase::SCI_HOMEWRAP, | |
160 | |
161 //! Extend the selection to the start of the displayed or document | |
162 //! line. | |
163 HomeWrapExtend = QsciScintillaBase::SCI_HOMEWRAPEXTEND, | |
164 | |
165 //! Move to the first visible character in the document line. | |
166 VCHome = QsciScintillaBase::SCI_VCHOME, | |
167 | |
168 //! Extend the selection to the first visible character in the document | |
169 //! line. | |
170 VCHomeExtend = QsciScintillaBase::SCI_VCHOMEEXTEND, | |
171 | |
172 //! Extend the rectangular selection to the first visible character in | |
173 //! the document line. | |
174 VCHomeRectExtend = QsciScintillaBase::SCI_VCHOMERECTEXTEND, | |
175 | |
176 //! Move to the first visible character of the displayed or document | |
177 //! line. | |
178 VCHomeWrap = QsciScintillaBase::SCI_VCHOMEWRAP, | |
179 | |
180 //! Extend the selection to the first visible character of the | |
181 //! displayed or document line. | |
182 VCHomeWrapExtend = QsciScintillaBase::SCI_VCHOMEWRAPEXTEND, | |
183 | |
184 //! Move to the end of the document line. | |
185 LineEnd = QsciScintillaBase::SCI_LINEEND, | |
186 | |
187 //! Extend the selection to the end of the document line. | |
188 LineEndExtend = QsciScintillaBase::SCI_LINEENDEXTEND, | |
189 | |
190 //! Extend the rectangular selection to the end of the document line. | |
191 LineEndRectExtend = QsciScintillaBase::SCI_LINEENDRECTEXTEND, | |
192 | |
193 //! Move to the end of the displayed line. | |
194 LineEndDisplay = QsciScintillaBase::SCI_LINEENDDISPLAY, | |
195 | |
196 //! Extend the selection to the end of the displayed line. | |
197 LineEndDisplayExtend = QsciScintillaBase::SCI_LINEENDDISPLAYEXTEND, | |
198 | |
199 //! Move to the end of the displayed or document line. | |
200 LineEndWrap = QsciScintillaBase::SCI_LINEENDWRAP, | |
201 | |
202 //! Extend the selection to the end of the displayed or document line. | |
203 LineEndWrapExtend = QsciScintillaBase::SCI_LINEENDWRAPEXTEND, | |
204 | |
205 //! Move to the start of the document. | |
206 DocumentStart = QsciScintillaBase::SCI_DOCUMENTSTART, | |
207 | |
208 //! Extend the selection to the start of the document. | |
209 DocumentStartExtend = QsciScintillaBase::SCI_DOCUMENTSTARTEXTEND, | |
210 | |
211 //! Move to the end of the document. | |
212 DocumentEnd = QsciScintillaBase::SCI_DOCUMENTEND, | |
213 | |
214 //! Extend the selection to the end of the document. | |
215 DocumentEndExtend = QsciScintillaBase::SCI_DOCUMENTENDEXTEND, | |
216 | |
217 //! Move up one page. | |
218 PageUp = QsciScintillaBase::SCI_PAGEUP, | |
219 | |
220 //! Extend the selection up one page. | |
221 PageUpExtend = QsciScintillaBase::SCI_PAGEUPEXTEND, | |
222 | |
223 //! Extend the rectangular selection up one page. | |
224 PageUpRectExtend = QsciScintillaBase::SCI_PAGEUPRECTEXTEND, | |
225 | |
226 //! Move down one page. | |
227 PageDown = QsciScintillaBase::SCI_PAGEDOWN, | |
228 | |
229 //! Extend the selection down one page. | |
230 PageDownExtend = QsciScintillaBase::SCI_PAGEDOWNEXTEND, | |
231 | |
232 //! Extend the rectangular selection down one page. | |
233 PageDownRectExtend = QsciScintillaBase::SCI_PAGEDOWNRECTEXTEND, | |
234 | |
235 //! Stuttered move up one page. | |
236 StutteredPageUp = QsciScintillaBase::SCI_STUTTEREDPAGEUP, | |
237 | |
238 //! Stuttered extend the selection up one page. | |
239 StutteredPageUpExtend = QsciScintillaBase::SCI_STUTTEREDPAGEUPEXTEND, | |
240 | |
241 //! Stuttered move down one page. | |
242 StutteredPageDown = QsciScintillaBase::SCI_STUTTEREDPAGEDOWN, | |
243 | |
244 //! Stuttered extend the selection down one page. | |
245 StutteredPageDownExtend = QsciScintillaBase::SCI_STUTTEREDPAGEDOWNEXTEND, | |
246 | |
247 //! Delete the current character. | |
248 Delete = QsciScintillaBase::SCI_CLEAR, | |
249 | |
250 //! Delete the previous character. | |
251 DeleteBack = QsciScintillaBase::SCI_DELETEBACK, | |
252 | |
253 //! Delete the previous character if not at start of line. | |
254 DeleteBackNotLine = QsciScintillaBase::SCI_DELETEBACKNOTLINE, | |
255 | |
256 //! Delete the word to the left. | |
257 DeleteWordLeft = QsciScintillaBase::SCI_DELWORDLEFT, | |
258 | |
259 //! Delete the word to the right. | |
260 DeleteWordRight = QsciScintillaBase::SCI_DELWORDRIGHT, | |
261 | |
262 //! Delete right to the end of the next word. | |
263 DeleteWordRightEnd = QsciScintillaBase::SCI_DELWORDRIGHTEND, | |
264 | |
265 //! Delete the line to the left. | |
266 DeleteLineLeft = QsciScintillaBase::SCI_DELLINELEFT, | |
267 | |
268 //! Delete the line to the right. | |
269 DeleteLineRight = QsciScintillaBase::SCI_DELLINERIGHT, | |
270 | |
271 //! Delete the current line. | |
272 LineDelete = QsciScintillaBase::SCI_LINEDELETE, | |
273 | |
274 //! Cut the current line to the clipboard. | |
275 LineCut = QsciScintillaBase::SCI_LINECUT, | |
276 | |
277 //! Copy the current line to the clipboard. | |
278 LineCopy = QsciScintillaBase::SCI_LINECOPY, | |
279 | |
280 //! Transpose the current and previous lines. | |
281 LineTranspose = QsciScintillaBase::SCI_LINETRANSPOSE, | |
282 | |
283 //! Duplicate the current line. | |
284 LineDuplicate = QsciScintillaBase::SCI_LINEDUPLICATE, | |
285 | |
286 //! Select the whole document. | |
287 SelectAll = QsciScintillaBase::SCI_SELECTALL, | |
288 | |
289 //! Move the selected lines up one line. | |
290 MoveSelectedLinesUp = QsciScintillaBase::SCI_MOVESELECTEDLINESUP, | |
291 | |
292 //! Move the selected lines down one line. | |
293 MoveSelectedLinesDown = QsciScintillaBase::SCI_MOVESELECTEDLINESDOWN, | |
294 | |
295 //! Duplicate the selection. | |
296 SelectionDuplicate = QsciScintillaBase::SCI_SELECTIONDUPLICATE, | |
297 | |
298 //! Convert the selection to lower case. | |
299 SelectionLowerCase = QsciScintillaBase::SCI_LOWERCASE, | |
300 | |
301 //! Convert the selection to upper case. | |
302 SelectionUpperCase = QsciScintillaBase::SCI_UPPERCASE, | |
303 | |
304 //! Cut the selection to the clipboard. | |
305 SelectionCut = QsciScintillaBase::SCI_CUT, | |
306 | |
307 //! Copy the selection to the clipboard. | |
308 SelectionCopy = QsciScintillaBase::SCI_COPY, | |
309 | |
310 //! Paste from the clipboard. | |
311 Paste = QsciScintillaBase::SCI_PASTE, | |
312 | |
313 //! Toggle insert/overtype. | |
314 EditToggleOvertype = QsciScintillaBase::SCI_EDITTOGGLEOVERTYPE, | |
315 | |
316 //! Insert a platform dependent newline. | |
317 Newline = QsciScintillaBase::SCI_NEWLINE, | |
318 | |
319 //! Insert a formfeed. | |
320 Formfeed = QsciScintillaBase::SCI_FORMFEED, | |
321 | |
322 //! Indent one level. | |
323 Tab = QsciScintillaBase::SCI_TAB, | |
324 | |
325 //! De-indent one level. | |
326 Backtab = QsciScintillaBase::SCI_BACKTAB, | |
327 | |
328 //! Cancel any current operation. | |
329 Cancel = QsciScintillaBase::SCI_CANCEL, | |
330 | |
331 //! Undo the last command. | |
332 Undo = QsciScintillaBase::SCI_UNDO, | |
333 | |
334 //! Redo the last command. | |
335 Redo = QsciScintillaBase::SCI_REDO, | |
336 | |
337 //! Zoom in. | |
338 ZoomIn = QsciScintillaBase::SCI_ZOOMIN, | |
339 | |
340 //! Zoom out. | |
341 ZoomOut = QsciScintillaBase::SCI_ZOOMOUT, | |
342 | |
343 //! Reverse the selected lines. | |
344 ReverseLines = QsciScintillaBase::SCI_LINEREVERSE, | |
345 }; | |
346 | |
347 //! Return the command that will be executed by this instance. | |
348 Command command() const {return scicmd;} | |
349 | |
350 //! Execute the command. | |
351 void execute(); | |
352 | |
353 //! Binds the key \a key to the command. If \a key is 0 then the key | |
354 //! binding is removed. If \a key is invalid then the key binding is | |
355 //! unchanged. Valid keys are any visible or control character or any | |
356 //! of \c Qt::Key_Down, \c Qt::Key_Up, \c Qt::Key_Left, \c Qt::Key_Right, | |
357 //! \c Qt::Key_Home, \c Qt::Key_End, \c Qt::Key_PageUp, | |
358 //! \c Qt::Key_PageDown, \c Qt::Key_Delete, \c Qt::Key_Insert, | |
359 //! \c Qt::Key_Escape, \c Qt::Key_Backspace, \c Qt::Key_Tab, | |
360 //! \c Qt::Key_Backtab, \c Qt::Key_Return, \c Qt::Key_Enter, | |
361 //! \c Qt::Key_Super_L, \c Qt::Key_Super_R or \c Qt::Key_Menu. Keys may be | |
362 //! modified with any combination of \c Qt::ShiftModifier, | |
363 //! \c Qt::ControlModifier, \c Qt::AltModifier and \c Qt::MetaModifier. | |
364 //! | |
365 //! \sa key(), setAlternateKey(), validKey() | |
366 void setKey(int key); | |
367 | |
368 //! Binds the alternate key \a altkey to the command. If \a key is 0 | |
369 //! then the alternate key binding is removed. | |
370 //! | |
371 //! \sa alternateKey(), setKey(), validKey() | |
372 void setAlternateKey(int altkey); | |
373 | |
374 //! The key that is currently bound to the command is returned. | |
375 //! | |
376 //! \sa setKey(), alternateKey() | |
377 int key() const {return qkey;} | |
378 | |
379 //! The alternate key that is currently bound to the command is | |
380 //! returned. | |
381 //! | |
382 //! \sa setAlternateKey(), key() | |
383 int alternateKey() const {return qaltkey;} | |
384 | |
385 //! If the key \a key is valid then true is returned. | |
386 static bool validKey(int key); | |
387 | |
388 //! The user friendly description of the command is returned. | |
389 QString description() const; | |
390 | |
391 private: | |
392 friend class QsciCommandSet; | |
393 | |
394 QsciCommand(QsciScintilla *qs, Command cmd, int key, int altkey, | |
395 const char *desc); | |
396 | |
397 void bindKey(int key,int &qk,int &scik); | |
398 | |
399 QsciScintilla *qsCmd; | |
400 Command scicmd; | |
401 int qkey, scikey, qaltkey, scialtkey; | |
402 const char *descCmd; | |
403 | |
404 QsciCommand(const QsciCommand &); | |
405 QsciCommand &operator=(const QsciCommand &); | |
406 }; | |
407 | |
408 #endif |