Add more C++ samples

Closes #225
This commit is contained in:
Joshua Peek
2012-08-15 11:57:55 -07:00
parent a41f40a30e
commit 657adaabec
3 changed files with 1066 additions and 66 deletions

View File

@@ -257,8 +257,8 @@
".gemrc"
]
},
"tokens_total": 333210,
"languages_total": 261,
"tokens_total": 335263,
"languages_total": 263,
"tokens": {
"Apex": {
"/*": 15,
@@ -3656,19 +3656,19 @@
"yajl_free_error": 1
},
"C++": {
"class": 19,
"class": 31,
"Bar": 2,
"{": 283,
"{": 293,
"protected": 4,
"char": 32,
"char": 34,
"*name": 2,
";": 793,
"public": 20,
"void": 58,
";": 829,
"public": 23,
"void": 65,
"hello": 2,
"(": 842,
")": 843,
"}": 285,
"(": 880,
")": 881,
"}": 295,
"foo": 2,
"cudaArray*": 1,
"cu_array": 4,
@@ -3677,13 +3677,13 @@
"2": 1,
"cudaReadModeElementType": 1,
"tex": 4,
"//": 457,
"//": 675,
"cudaChannelFormatDesc": 1,
"description": 2,
"description": 5,
"cudaCreateChannelDesc": 1,
"<float>": 1,
"cudaMallocArray": 1,
"&": 74,
"&": 84,
"width": 5,
"height": 5,
"cudaMemcpyToArray": 1,
@@ -3705,7 +3705,7 @@
"gridDim": 2,
"+": 40,
"blockDim.x": 2,
"-": 114,
"-": 119,
"/": 9,
"blockDim.y": 2,
"kernel": 2,
@@ -3717,7 +3717,7 @@
"__global__": 1,
"float*": 1,
"odata": 2,
"int": 62,
"int": 80,
"unsigned": 16,
"x": 19,
"blockIdx.x*blockDim.x": 1,
@@ -3725,40 +3725,40 @@
"y": 4,
"blockIdx.y*blockDim.y": 1,
"threadIdx.y": 1,
"if": 132,
"if": 137,
"&&": 13,
"c": 33,
"c": 51,
"tex2D": 1,
"y*width": 1,
"/*": 9,
"*/": 9,
"#include": 71,
"#include": 77,
"<QCoreApplication>": 1,
"<QString>": 1,
"<QVariantMap>": 2,
"static": 56,
"static": 57,
"Env": 13,
"*env_instance": 1,
"*": 13,
"NULL": 49,
"*Env": 1,
"instance": 3,
"instance": 4,
"env_instance": 3,
"new": 2,
"return": 107,
"return": 112,
"QObject": 2,
"QCoreApplication": 1,
"parse": 3,
"const": 91,
"const": 103,
"**envp": 1,
"**env": 1,
"**": 2,
"QString": 18,
"QString": 19,
"envvar": 2,
"name": 3,
"value": 3,
"value": 5,
"indexOfEquals": 5,
"for": 9,
"for": 13,
"env": 3,
"envp": 4,
"*env": 1,
@@ -3772,14 +3772,14 @@
"QVariantMap": 3,
"asVariantMap": 2,
"m_map": 2,
"#ifndef": 5,
"#ifndef": 7,
"ENV_H": 2,
"#define": 5,
"#define": 7,
"<QObject>": 1,
"Q_OBJECT": 1,
"*instance": 1,
"private": 8,
"#endif": 12,
"private": 10,
"#endif": 18,
"<iostream>": 1,
"using": 1,
"namespace": 10,
@@ -3878,7 +3878,7 @@
"pkey": 14,
"POINT_CONVERSION_COMPRESSED": 1,
"fCompressedPubKey": 5,
"true": 31,
"true": 34,
"Reset": 5,
"EC_KEY_new_by_curve_name": 2,
"NID_secp256k1": 2,
@@ -3889,7 +3889,7 @@
"EC_KEY_dup": 1,
"b.pkey": 2,
"b.fSet": 2,
"operator": 5,
"operator": 7,
"EC_KEY_copy": 1,
"hash": 20,
"sizeof": 6,
@@ -3897,7 +3897,7 @@
"nSize": 2,
"vchSig.clear": 2,
"vchSig.resize": 2,
"bool": 89,
"bool": 91,
"SignCompact": 2,
"uint256": 10,
"vector": 14,
@@ -3915,7 +3915,7 @@
"keyRec": 5,
"1": 2,
"GetPubKey": 5,
"this": 2,
"this": 3,
"break": 30,
"BN_bn2bin": 2,
"/8": 2,
@@ -3929,7 +3929,7 @@
"Verify": 2,
"ECDSA_verify": 1,
"VerifyCompact": 2,
"key": 1,
"key": 23,
"key.SetCompactSignature": 1,
"key.GetPubKey": 1,
"IsValid": 4,
@@ -3950,13 +3950,13 @@
"str": 2,
"CKeyID": 5,
"uint160": 8,
"in": 4,
"in": 8,
"CScriptID": 3,
"CPubKey": 11,
"vchPubKey": 6,
"friend": 4,
"friend": 5,
"vchPubKeyIn": 2,
"a": 3,
"a": 33,
"a.vchPubKey": 3,
"b.vchPubKey": 3,
"IMPLEMENT_SERIALIZE": 1,
@@ -3985,7 +3985,7 @@
"GetPrivKey": 1,
"SetPubKey": 1,
"Sign": 1,
"#ifdef": 3,
"#ifdef": 7,
"Q_OS_LINUX": 2,
"<QApplication>": 1,
"#if": 4,
@@ -3993,14 +3993,14 @@
"QT_VERSION_CHECK": 1,
"#error": 2,
"Something": 1,
"is": 1,
"is": 30,
"wrong": 1,
"with": 1,
"the": 5,
"with": 3,
"the": 176,
"setup.": 1,
"Please": 1,
"report": 2,
"to": 3,
"to": 72,
"mailing": 1,
"list": 1,
"argc": 2,
@@ -4031,15 +4031,502 @@
"phantom.execute": 1,
"app.exec": 1,
"phantom.returnValue": 1,
"QSCICOMMAND_H": 2,
"__APPLE__": 4,
"extern": 2,
"<qstring.h>": 1,
"<Qsci/qsciglobal.h>": 2,
"<Qsci/qsciscintillabase.h>": 1,
"QsciScintilla": 7,
"brief": 2,
"The": 8,
"QsciCommand": 7,
"represents": 1,
"an": 1,
"internal": 6,
"editor": 1,
"command": 9,
"that": 7,
"may": 2,
"have": 1,
"one": 41,
"or": 10,
"two": 1,
"keys": 3,
"bound": 4,
"it.": 2,
"Methods": 1,
"are": 3,
"provided": 1,
"change": 1,
"and": 12,
"remove": 1,
"binding.": 1,
"Each": 1,
"has": 2,
"user": 2,
"friendly": 2,
"of": 43,
"use": 1,
"mapping": 1,
"dialogs.": 1,
"QSCINTILLA_EXPORT": 2,
"This": 3,
"enum": 5,
"defines": 1,
"different": 1,
"commands": 1,
"can": 3,
"be": 9,
"assigned": 1,
"key.": 1,
"Command": 4,
"Move": 26,
"down": 12,
"line.": 33,
"LineDown": 1,
"QsciScintillaBase": 100,
"SCI_LINEDOWN": 1,
"Extend": 33,
"selection": 39,
"LineDownExtend": 1,
"SCI_LINEDOWNEXTEND": 1,
"rectangular": 9,
"LineDownRectExtend": 1,
"SCI_LINEDOWNRECTEXTEND": 1,
"Scroll": 5,
"view": 2,
"LineScrollDown": 1,
"SCI_LINESCROLLDOWN": 1,
"up": 13,
"LineUp": 1,
"SCI_LINEUP": 1,
"LineUpExtend": 1,
"SCI_LINEUPEXTEND": 1,
"LineUpRectExtend": 1,
"SCI_LINEUPRECTEXTEND": 1,
"LineScrollUp": 1,
"SCI_LINESCROLLUP": 1,
"start": 11,
"document.": 8,
"ScrollToStart": 1,
"SCI_SCROLLTOSTART": 1,
"end": 15,
"ScrollToEnd": 1,
"SCI_SCROLLTOEND": 1,
"vertically": 1,
"centre": 1,
"current": 8,
"VerticalCentreCaret": 1,
"SCI_VERTICALCENTRECARET": 1,
"paragraph.": 4,
"ParaDown": 1,
"SCI_PARADOWN": 1,
"ParaDownExtend": 1,
"SCI_PARADOWNEXTEND": 1,
"ParaUp": 1,
"SCI_PARAUP": 1,
"ParaUpExtend": 1,
"SCI_PARAUPEXTEND": 1,
"left": 7,
"character.": 8,
"CharLeft": 1,
"SCI_CHARLEFT": 1,
"CharLeftExtend": 1,
"SCI_CHARLEFTEXTEND": 1,
"CharLeftRectExtend": 1,
"SCI_CHARLEFTRECTEXTEND": 1,
"right": 8,
"CharRight": 1,
"SCI_CHARRIGHT": 1,
"CharRightExtend": 1,
"SCI_CHARRIGHTEXTEND": 1,
"CharRightRectExtend": 1,
"SCI_CHARRIGHTRECTEXTEND": 1,
"word.": 9,
"WordLeft": 1,
"SCI_WORDLEFT": 1,
"WordLeftExtend": 1,
"SCI_WORDLEFTEXTEND": 1,
"WordRight": 1,
"SCI_WORDRIGHT": 1,
"WordRightExtend": 1,
"SCI_WORDRIGHTEXTEND": 1,
"previous": 5,
"WordLeftEnd": 1,
"SCI_WORDLEFTEND": 1,
"WordLeftEndExtend": 1,
"SCI_WORDLEFTENDEXTEND": 1,
"next": 5,
"WordRightEnd": 1,
"SCI_WORDRIGHTEND": 1,
"WordRightEndExtend": 1,
"SCI_WORDRIGHTENDEXTEND": 1,
"word": 6,
"part.": 4,
"WordPartLeft": 1,
"SCI_WORDPARTLEFT": 1,
"WordPartLeftExtend": 1,
"SCI_WORDPARTLEFTEXTEND": 1,
"WordPartRight": 1,
"SCI_WORDPARTRIGHT": 1,
"WordPartRightExtend": 1,
"SCI_WORDPARTRIGHTEXTEND": 1,
"document": 16,
"Home": 1,
"SCI_HOME": 1,
"HomeExtend": 1,
"SCI_HOMEEXTEND": 1,
"HomeRectExtend": 1,
"SCI_HOMERECTEXTEND": 1,
"displayed": 10,
"HomeDisplay": 1,
"SCI_HOMEDISPLAY": 1,
"HomeDisplayExtend": 1,
"SCI_HOMEDISPLAYEXTEND": 1,
"HomeWrap": 1,
"SCI_HOMEWRAP": 1,
"HomeWrapExtend": 1,
"SCI_HOMEWRAPEXTEND": 1,
"first": 8,
"visible": 6,
"character": 8,
"VCHome": 1,
"SCI_VCHOME": 1,
"VCHomeExtend": 1,
"SCI_VCHOMEEXTEND": 1,
"VCHomeRectExtend": 1,
"SCI_VCHOMERECTEXTEND": 1,
"VCHomeWrap": 1,
"SCI_VCHOMEWRAP": 1,
"VCHomeWrapExtend": 1,
"SCI_VCHOMEWRAPEXTEND": 1,
"LineEnd": 1,
"SCI_LINEEND": 1,
"LineEndExtend": 1,
"SCI_LINEENDEXTEND": 1,
"LineEndRectExtend": 1,
"SCI_LINEENDRECTEXTEND": 1,
"LineEndDisplay": 1,
"SCI_LINEENDDISPLAY": 1,
"LineEndDisplayExtend": 1,
"SCI_LINEENDDISPLAYEXTEND": 1,
"LineEndWrap": 1,
"SCI_LINEENDWRAP": 1,
"LineEndWrapExtend": 1,
"SCI_LINEENDWRAPEXTEND": 1,
"DocumentStart": 1,
"SCI_DOCUMENTSTART": 1,
"DocumentStartExtend": 1,
"SCI_DOCUMENTSTARTEXTEND": 1,
"DocumentEnd": 1,
"SCI_DOCUMENTEND": 1,
"DocumentEndExtend": 1,
"SCI_DOCUMENTENDEXTEND": 1,
"page.": 13,
"PageUp": 1,
"SCI_PAGEUP": 1,
"PageUpExtend": 1,
"SCI_PAGEUPEXTEND": 1,
"PageUpRectExtend": 1,
"SCI_PAGEUPRECTEXTEND": 1,
"PageDown": 1,
"SCI_PAGEDOWN": 1,
"PageDownExtend": 1,
"SCI_PAGEDOWNEXTEND": 1,
"PageDownRectExtend": 1,
"SCI_PAGEDOWNRECTEXTEND": 1,
"Stuttered": 4,
"move": 2,
"StutteredPageUp": 1,
"SCI_STUTTEREDPAGEUP": 1,
"extend": 2,
"StutteredPageUpExtend": 1,
"SCI_STUTTEREDPAGEUPEXTEND": 1,
"StutteredPageDown": 1,
"SCI_STUTTEREDPAGEDOWN": 1,
"StutteredPageDownExtend": 1,
"SCI_STUTTEREDPAGEDOWNEXTEND": 1,
"Delete": 10,
"SCI_CLEAR": 1,
"DeleteBack": 1,
"SCI_DELETEBACK": 1,
"not": 1,
"at": 4,
"DeleteBackNotLine": 1,
"SCI_DELETEBACKNOTLINE": 1,
"left.": 2,
"DeleteWordLeft": 1,
"SCI_DELWORDLEFT": 1,
"right.": 2,
"DeleteWordRight": 1,
"SCI_DELWORDRIGHT": 1,
"DeleteWordRightEnd": 1,
"SCI_DELWORDRIGHTEND": 1,
"line": 10,
"DeleteLineLeft": 1,
"SCI_DELLINELEFT": 1,
"DeleteLineRight": 1,
"SCI_DELLINERIGHT": 1,
"LineDelete": 1,
"SCI_LINEDELETE": 1,
"Cut": 2,
"clipboard.": 5,
"LineCut": 1,
"SCI_LINECUT": 1,
"Copy": 2,
"LineCopy": 1,
"SCI_LINECOPY": 1,
"Transpose": 1,
"lines.": 1,
"LineTranspose": 1,
"SCI_LINETRANSPOSE": 1,
"Duplicate": 2,
"LineDuplicate": 1,
"SCI_LINEDUPLICATE": 1,
"Select": 33,
"whole": 2,
"SelectAll": 1,
"SCI_SELECTALL": 1,
"selected": 2,
"lines": 3,
"MoveSelectedLinesUp": 1,
"SCI_MOVESELECTEDLINESUP": 1,
"MoveSelectedLinesDown": 1,
"SCI_MOVESELECTEDLINESDOWN": 1,
"selection.": 1,
"SelectionDuplicate": 1,
"SCI_SELECTIONDUPLICATE": 1,
"Convert": 2,
"lower": 1,
"case.": 2,
"SelectionLowerCase": 1,
"SCI_LOWERCASE": 1,
"upper": 1,
"SelectionUpperCase": 1,
"SCI_UPPERCASE": 1,
"SelectionCut": 1,
"SCI_CUT": 1,
"SelectionCopy": 1,
"SCI_COPY": 1,
"Paste": 2,
"from": 4,
"SCI_PASTE": 1,
"Toggle": 1,
"insert/overtype.": 1,
"EditToggleOvertype": 1,
"SCI_EDITTOGGLEOVERTYPE": 1,
"Insert": 2,
"platform": 1,
"dependent": 1,
"newline.": 1,
"Newline": 1,
"SCI_NEWLINE": 1,
"formfeed.": 1,
"Formfeed": 1,
"SCI_FORMFEED": 1,
"Indent": 1,
"level.": 2,
"Tab": 1,
"SCI_TAB": 1,
"De": 1,
"indent": 1,
"Backtab": 1,
"SCI_BACKTAB": 1,
"Cancel": 2,
"any": 5,
"operation.": 1,
"SCI_CANCEL": 1,
"Undo": 2,
"last": 4,
"command.": 5,
"SCI_UNDO": 1,
"Redo": 2,
"SCI_REDO": 1,
"Zoom": 2,
"in.": 1,
"ZoomIn": 1,
"SCI_ZOOMIN": 1,
"out.": 1,
"ZoomOut": 1,
"SCI_ZOOMOUT": 1,
"Return": 3,
"will": 2,
"executed": 1,
"by": 2,
"instance.": 2,
"scicmd": 2,
"Execute": 1,
"execute": 1,
"Binds": 2,
"If": 4,
"then": 6,
"binding": 3,
"removed.": 2,
"invalid": 5,
"unchanged.": 1,
"Valid": 1,
"control": 1,
"Key_Down": 1,
"Key_Up": 1,
"Key_Left": 1,
"Key_Right": 1,
"Key_Home": 1,
"Key_End": 1,
"Key_PageUp": 1,
"Key_PageDown": 1,
"Key_Delete": 1,
"Key_Insert": 1,
"Key_Escape": 1,
"Key_Backspace": 1,
"Key_Tab": 1,
"Key_Return.": 1,
"Keys": 1,
"modified": 2,
"combination": 1,
"SHIFT": 1,
"CTRL": 1,
"ALT": 1,
"META.": 1,
"sa": 8,
"setAlternateKey": 3,
"validKey": 3,
"setKey": 3,
"alternate": 3,
"altkey": 3,
"alternateKey": 3,
"currently": 2,
"returned.": 4,
"qkey": 2,
"qaltkey": 2,
"valid": 2,
"QsciCommandSet": 1,
"*qs": 1,
"cmd": 1,
"*desc": 1,
"bindKey": 1,
"qk": 1,
"scik": 1,
"*qsCmd": 1,
"scikey": 1,
"scialtkey": 1,
"*descCmd": 1,
"QSCIPRINTER_H": 2,
"<qprinter.h>": 1,
"<Qsci/qsciscintilla.h>": 1,
"QT_BEGIN_NAMESPACE": 1,
"QRect": 2,
"QPainter": 2,
"QT_END_NAMESPACE": 1,
"QsciPrinter": 9,
"sub": 2,
"Qt": 1,
"QPrinter": 3,
"able": 1,
"print": 4,
"text": 5,
"Scintilla": 2,
"further": 1,
"classed": 1,
"alter": 1,
"layout": 1,
"adding": 2,
"headers": 2,
"footers": 2,
"example.": 1,
"Constructs": 1,
"printer": 1,
"paint": 1,
"device": 1,
"mode": 4,
"mode.": 1,
"PrinterMode": 1,
"ScreenResolution": 1,
"Destroys": 1,
"virtual": 9,
"Format": 1,
"page": 4,
"example": 1,
"before": 1,
"drawn": 2,
"on": 1,
"painter": 4,
"used": 4,
"add": 3,
"customised": 2,
"graphics.": 2,
"drawing": 4,
"actually": 1,
"being": 2,
"rather": 1,
"than": 1,
"sized.": 1,
"methods": 1,
"must": 1,
"only": 1,
"called": 1,
"when": 5,
"true.": 1,
"area": 5,
"draw": 1,
"text.": 3,
"should": 1,
"it": 1,
"necessary": 1,
"reserve": 1,
"space": 1,
"By": 1,
"default": 3,
"relative": 1,
"printable": 1,
"Use": 1,
"setFullPage": 1,
"because": 2,
"calling": 1,
"printRange": 2,
"you": 1,
"want": 2,
"try": 1,
"over": 1,
"pagenr": 2,
"number": 3,
"numbered": 1,
"formatPage": 1,
"points": 2,
"each": 2,
"font": 2,
"printing.": 2,
"setMagnification": 2,
"magnification": 3,
"mag": 2,
"Sets": 2,
"printing": 2,
"magnification.": 1,
"Print": 1,
"range": 1,
"qsb.": 1,
"negative": 2,
"signifies": 2,
"returned": 1,
"there": 1,
"was": 1,
"no": 1,
"error.": 1,
"*qsb": 1,
"wrap": 4,
"WrapWord.": 1,
"setWrapMode": 2,
"WrapMode": 3,
"wrapMode": 2,
"wmode.": 1,
"wmode": 1,
"v8": 5,
"internal": 5,
"Scanner": 16,
"UnicodeCache*": 4,
"unicode_cache": 3,
"unicode_cache_": 10,
"octal_pos_": 5,
"Location": 14,
"invalid": 4,
"harmony_scoping_": 4,
"harmony_modules_": 4,
"Initialize": 4,
@@ -4112,7 +4599,6 @@
"switch": 2,
"case": 32,
"ScanString": 3,
"Select": 32,
"LTE": 1,
"else": 32,
"ASSIGN_SHL": 1,
@@ -4152,7 +4638,6 @@
"IsDecimalDigit": 2,
"ScanNumber": 3,
"PERIOD": 1,
"default": 1,
"IsIdentifierStart": 2,
"ScanIdentifierOrKeyword": 2,
"EOS": 1,
@@ -4169,10 +4654,8 @@
"xxx": 1,
"error": 1,
"immediately": 1,
"because": 1,
"octal": 1,
"escape": 1,
"can": 1,
"quote": 2,
"LiteralScope": 4,
"literal": 2,
@@ -4183,16 +4666,11 @@
"p": 1,
"w": 1,
"keyword": 1,
"valid": 1,
"and": 2,
"character": 1,
"has": 1,
"in_character_class": 2,
"AddLiteralCharAdvance": 3,
"literal.Complete": 2,
"ScanLiteralUnicodeEscape": 3,
"V8_SCANNER_H_": 2,
"enum": 3,
"ParsingFlags": 1,
"kNoParsingFlags": 1,
"kLanguageModeMask": 4,
@@ -4205,7 +4683,6 @@
"|": 2,
"Utf16CharacterStream": 3,
"pos_": 6,
"virtual": 4,
"buffer_cursor_": 5,
"buffer_end_": 3,
"ReadBlock": 2,
@@ -4347,8 +4824,6 @@
"literal_buffer2_": 2,
"AddLiteralChar": 2,
"tok": 2,
"next": 2,
"then": 2,
"else_": 2,
"ScanDecimalDigits": 1,
"seen_period": 1,
@@ -4388,18 +4863,14 @@
"jsFromScriptFile": 1,
"scriptPath": 1,
"enc": 1,
"This": 1,
"shouldn": 1,
"be": 1,
"instantiated": 1,
"QTemporaryFile*": 2,
"m_tempHarness": 1,
"We": 1,
"want": 1,
"make": 1,
"sure": 1,
"clean": 1,
"up": 1,
"after": 1,
"ourselves": 1,
"m_tempWrapper": 1,
@@ -4479,7 +4950,6 @@
"AddCallCompletedCallback": 2,
"CallCompletedCallback": 4,
"callback": 7,
"at": 3,
"Add": 1,
"RemoveCallCompletedCallback": 2,
"Remove": 1,
@@ -4532,7 +5002,6 @@
"NDEBUG": 4,
"#undef": 1,
"both": 1,
"are": 1,
"set": 1,
"Deserializer": 1,
"AllStatic": 1,
@@ -26734,7 +27203,7 @@
"Arduino": 20,
"AutoHotkey": 3,
"C": 29074,
"C++": 7851,
"C++": 9904,
"Ceylon": 50,
"CoffeeScript": 3070,
"Coq": 18461,
@@ -26804,7 +27273,7 @@
"Arduino": 1,
"AutoHotkey": 1,
"C": 18,
"C++": 14,
"C++": 16,
"Ceylon": 1,
"CoffeeScript": 9,
"Coq": 12,
@@ -26868,5 +27337,5 @@
"XSLT": 1,
"YAML": 1
},
"md5": "4e15c989e08fea5b847096e54a7a5eb4"
"md5": "17bbfcb96e8e5f6c34e6d28b9653e122"
}

415
samples/C++/qscicommand.h Normal file
View File

@@ -0,0 +1,415 @@
// This defines the interface to the QsciCommand class.
//
// Copyright (c) 2011 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public
// License versions 2.0 or 3.0 as published by the Free Software
// Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
// included in the packaging of this file. Alternatively you may (at
// your option) use any later version of the GNU General Public
// License if such license has been publicly approved by Riverbank
// Computing Limited (or its successors, if any) and the KDE Free Qt
// Foundation. In addition, as a special exception, Riverbank gives you
// certain additional rights. These rights are described in the Riverbank
// GPL Exception version 1.1, which can be found in the file
// GPL_EXCEPTION.txt in this package.
//
// If you are unsure which license is appropriate for your use, please
// contact the sales department at sales@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCICOMMAND_H
#define QSCICOMMAND_H
#ifdef __APPLE__
extern "C++" {
#endif
#include <qstring.h>
#include <Qsci/qsciglobal.h>
#include <Qsci/qsciscintillabase.h>
class QsciScintilla;
//! \brief The QsciCommand class represents an internal editor command that may
//! have one or two keys bound to it.
//!
//! Methods are provided to change the keys bound to the command and to remove
//! a key binding. Each command has a user friendly description of the command
//! for use in key mapping dialogs.
class QSCINTILLA_EXPORT QsciCommand
{
public:
//! This enum defines the different commands that can be assigned to a key.
enum Command {
//! Move down one line.
LineDown = QsciScintillaBase::SCI_LINEDOWN,
//! Extend the selection down one line.
LineDownExtend = QsciScintillaBase::SCI_LINEDOWNEXTEND,
//! Extend the rectangular selection down one line.
LineDownRectExtend = QsciScintillaBase::SCI_LINEDOWNRECTEXTEND,
//! Scroll the view down one line.
LineScrollDown = QsciScintillaBase::SCI_LINESCROLLDOWN,
//! Move up one line.
LineUp = QsciScintillaBase::SCI_LINEUP,
//! Extend the selection up one line.
LineUpExtend = QsciScintillaBase::SCI_LINEUPEXTEND,
//! Extend the rectangular selection up one line.
LineUpRectExtend = QsciScintillaBase::SCI_LINEUPRECTEXTEND,
//! Scroll the view up one line.
LineScrollUp = QsciScintillaBase::SCI_LINESCROLLUP,
//! Scroll to the start of the document.
ScrollToStart = QsciScintillaBase::SCI_SCROLLTOSTART,
//! Scroll to the end of the document.
ScrollToEnd = QsciScintillaBase::SCI_SCROLLTOEND,
//! Scroll vertically to centre the current line.
VerticalCentreCaret = QsciScintillaBase::SCI_VERTICALCENTRECARET,
//! Move down one paragraph.
ParaDown = QsciScintillaBase::SCI_PARADOWN,
//! Extend the selection down one paragraph.
ParaDownExtend = QsciScintillaBase::SCI_PARADOWNEXTEND,
//! Move up one paragraph.
ParaUp = QsciScintillaBase::SCI_PARAUP,
//! Extend the selection up one paragraph.
ParaUpExtend = QsciScintillaBase::SCI_PARAUPEXTEND,
//! Move left one character.
CharLeft = QsciScintillaBase::SCI_CHARLEFT,
//! Extend the selection left one character.
CharLeftExtend = QsciScintillaBase::SCI_CHARLEFTEXTEND,
//! Extend the rectangular selection left one character.
CharLeftRectExtend = QsciScintillaBase::SCI_CHARLEFTRECTEXTEND,
//! Move right one character.
CharRight = QsciScintillaBase::SCI_CHARRIGHT,
//! Extend the selection right one character.
CharRightExtend = QsciScintillaBase::SCI_CHARRIGHTEXTEND,
//! Extend the rectangular selection right one character.
CharRightRectExtend = QsciScintillaBase::SCI_CHARRIGHTRECTEXTEND,
//! Move left one word.
WordLeft = QsciScintillaBase::SCI_WORDLEFT,
//! Extend the selection left one word.
WordLeftExtend = QsciScintillaBase::SCI_WORDLEFTEXTEND,
//! Move right one word.
WordRight = QsciScintillaBase::SCI_WORDRIGHT,
//! Extend the selection right one word.
WordRightExtend = QsciScintillaBase::SCI_WORDRIGHTEXTEND,
//! Move to the end of the previous word.
WordLeftEnd = QsciScintillaBase::SCI_WORDLEFTEND,
//! Extend the selection to the end of the previous word.
WordLeftEndExtend = QsciScintillaBase::SCI_WORDLEFTENDEXTEND,
//! Move to the end of the next word.
WordRightEnd = QsciScintillaBase::SCI_WORDRIGHTEND,
//! Extend the selection to the end of the next word.
WordRightEndExtend = QsciScintillaBase::SCI_WORDRIGHTENDEXTEND,
//! Move left one word part.
WordPartLeft = QsciScintillaBase::SCI_WORDPARTLEFT,
//! Extend the selection left one word part.
WordPartLeftExtend = QsciScintillaBase::SCI_WORDPARTLEFTEXTEND,
//! Move right one word part.
WordPartRight = QsciScintillaBase::SCI_WORDPARTRIGHT,
//! Extend the selection right one word part.
WordPartRightExtend = QsciScintillaBase::SCI_WORDPARTRIGHTEXTEND,
//! Move to the start of the document line.
Home = QsciScintillaBase::SCI_HOME,
//! Extend the selection to the start of the document line.
HomeExtend = QsciScintillaBase::SCI_HOMEEXTEND,
//! Extend the rectangular selection to the start of the document line.
HomeRectExtend = QsciScintillaBase::SCI_HOMERECTEXTEND,
//! Move to the start of the displayed line.
HomeDisplay = QsciScintillaBase::SCI_HOMEDISPLAY,
//! Extend the selection to the start of the displayed line.
HomeDisplayExtend = QsciScintillaBase::SCI_HOMEDISPLAYEXTEND,
//! Move to the start of the displayed or document line.
HomeWrap = QsciScintillaBase::SCI_HOMEWRAP,
//! Extend the selection to the start of the displayed or document
//! line.
HomeWrapExtend = QsciScintillaBase::SCI_HOMEWRAPEXTEND,
//! Move to the first visible character in the document line.
VCHome = QsciScintillaBase::SCI_VCHOME,
//! Extend the selection to the first visible character in the document
//! line.
VCHomeExtend = QsciScintillaBase::SCI_VCHOMEEXTEND,
//! Extend the rectangular selection to the first visible character in
//! the document line.
VCHomeRectExtend = QsciScintillaBase::SCI_VCHOMERECTEXTEND,
//! Move to the first visible character of the displayed or document
//! line.
VCHomeWrap = QsciScintillaBase::SCI_VCHOMEWRAP,
//! Extend the selection to the first visible character of the
//! displayed or document line.
VCHomeWrapExtend = QsciScintillaBase::SCI_VCHOMEWRAPEXTEND,
//! Move to the end of the document line.
LineEnd = QsciScintillaBase::SCI_LINEEND,
//! Extend the selection to the end of the document line.
LineEndExtend = QsciScintillaBase::SCI_LINEENDEXTEND,
//! Extend the rectangular selection to the end of the document line.
LineEndRectExtend = QsciScintillaBase::SCI_LINEENDRECTEXTEND,
//! Move to the end of the displayed line.
LineEndDisplay = QsciScintillaBase::SCI_LINEENDDISPLAY,
//! Extend the selection to the end of the displayed line.
LineEndDisplayExtend = QsciScintillaBase::SCI_LINEENDDISPLAYEXTEND,
//! Move to the end of the displayed or document line.
LineEndWrap = QsciScintillaBase::SCI_LINEENDWRAP,
//! Extend the selection to the end of the displayed or document line.
LineEndWrapExtend = QsciScintillaBase::SCI_LINEENDWRAPEXTEND,
//! Move to the start of the document.
DocumentStart = QsciScintillaBase::SCI_DOCUMENTSTART,
//! Extend the selection to the start of the document.
DocumentStartExtend = QsciScintillaBase::SCI_DOCUMENTSTARTEXTEND,
//! Move to the end of the document.
DocumentEnd = QsciScintillaBase::SCI_DOCUMENTEND,
//! Extend the selection to the end of the document.
DocumentEndExtend = QsciScintillaBase::SCI_DOCUMENTENDEXTEND,
//! Move up one page.
PageUp = QsciScintillaBase::SCI_PAGEUP,
//! Extend the selection up one page.
PageUpExtend = QsciScintillaBase::SCI_PAGEUPEXTEND,
//! Extend the rectangular selection up one page.
PageUpRectExtend = QsciScintillaBase::SCI_PAGEUPRECTEXTEND,
//! Move down one page.
PageDown = QsciScintillaBase::SCI_PAGEDOWN,
//! Extend the selection down one page.
PageDownExtend = QsciScintillaBase::SCI_PAGEDOWNEXTEND,
//! Extend the rectangular selection down one page.
PageDownRectExtend = QsciScintillaBase::SCI_PAGEDOWNRECTEXTEND,
//! Stuttered move up one page.
StutteredPageUp = QsciScintillaBase::SCI_STUTTEREDPAGEUP,
//! Stuttered extend the selection up one page.
StutteredPageUpExtend = QsciScintillaBase::SCI_STUTTEREDPAGEUPEXTEND,
//! Stuttered move down one page.
StutteredPageDown = QsciScintillaBase::SCI_STUTTEREDPAGEDOWN,
//! Stuttered extend the selection down one page.
StutteredPageDownExtend = QsciScintillaBase::SCI_STUTTEREDPAGEDOWNEXTEND,
//! Delete the current character.
Delete = QsciScintillaBase::SCI_CLEAR,
//! Delete the previous character.
DeleteBack = QsciScintillaBase::SCI_DELETEBACK,
//! Delete the previous character if not at start of line.
DeleteBackNotLine = QsciScintillaBase::SCI_DELETEBACKNOTLINE,
//! Delete the word to the left.
DeleteWordLeft = QsciScintillaBase::SCI_DELWORDLEFT,
//! Delete the word to the right.
DeleteWordRight = QsciScintillaBase::SCI_DELWORDRIGHT,
//! Delete right to the end of the next word.
DeleteWordRightEnd = QsciScintillaBase::SCI_DELWORDRIGHTEND,
//! Delete the line to the left.
DeleteLineLeft = QsciScintillaBase::SCI_DELLINELEFT,
//! Delete the line to the right.
DeleteLineRight = QsciScintillaBase::SCI_DELLINERIGHT,
//! Delete the current line.
LineDelete = QsciScintillaBase::SCI_LINEDELETE,
//! Cut the current line to the clipboard.
LineCut = QsciScintillaBase::SCI_LINECUT,
//! Copy the current line to the clipboard.
LineCopy = QsciScintillaBase::SCI_LINECOPY,
//! Transpose the current and previous lines.
LineTranspose = QsciScintillaBase::SCI_LINETRANSPOSE,
//! Duplicate the current line.
LineDuplicate = QsciScintillaBase::SCI_LINEDUPLICATE,
//! Select the whole document.
SelectAll = QsciScintillaBase::SCI_SELECTALL,
//! Move the selected lines up one line.
MoveSelectedLinesUp = QsciScintillaBase::SCI_MOVESELECTEDLINESUP,
//! Move the selected lines down one line.
MoveSelectedLinesDown = QsciScintillaBase::SCI_MOVESELECTEDLINESDOWN,
//! Duplicate the selection.
SelectionDuplicate = QsciScintillaBase::SCI_SELECTIONDUPLICATE,
//! Convert the selection to lower case.
SelectionLowerCase = QsciScintillaBase::SCI_LOWERCASE,
//! Convert the selection to upper case.
SelectionUpperCase = QsciScintillaBase::SCI_UPPERCASE,
//! Cut the selection to the clipboard.
SelectionCut = QsciScintillaBase::SCI_CUT,
//! Copy the selection to the clipboard.
SelectionCopy = QsciScintillaBase::SCI_COPY,
//! Paste from the clipboard.
Paste = QsciScintillaBase::SCI_PASTE,
//! Toggle insert/overtype.
EditToggleOvertype = QsciScintillaBase::SCI_EDITTOGGLEOVERTYPE,
//! Insert a platform dependent newline.
Newline = QsciScintillaBase::SCI_NEWLINE,
//! Insert a formfeed.
Formfeed = QsciScintillaBase::SCI_FORMFEED,
//! Indent one level.
Tab = QsciScintillaBase::SCI_TAB,
//! De-indent one level.
Backtab = QsciScintillaBase::SCI_BACKTAB,
//! Cancel any current operation.
Cancel = QsciScintillaBase::SCI_CANCEL,
//! Undo the last command.
Undo = QsciScintillaBase::SCI_UNDO,
//! Redo the last command.
Redo = QsciScintillaBase::SCI_REDO,
//! Zoom in.
ZoomIn = QsciScintillaBase::SCI_ZOOMIN,
//! Zoom out.
ZoomOut = QsciScintillaBase::SCI_ZOOMOUT,
};
//! Return the command that will be executed by this instance.
Command command() const {return scicmd;}
//! Execute the command.
void execute();
//! Binds the key \a key to the command. If \a key is 0 then the key
//! binding is removed. If \a key is invalid then the key binding is
//! unchanged. Valid keys are any visible or control character or any
//! of \c Key_Down, \c Key_Up, \c Key_Left, \c Key_Right, \c Key_Home,
//! \c Key_End, \c Key_PageUp, \c Key_PageDown, \c Key_Delete,
//! \c Key_Insert, \c Key_Escape, \c Key_Backspace, \c Key_Tab and
//! \c Key_Return. Keys may be modified with any combination of \c SHIFT,
//! \c CTRL, \c ALT and \c META.
//!
//! \sa key(), setAlternateKey(), validKey()
void setKey(int key);
//! Binds the alternate key \a altkey to the command. If \a key is 0
//! then the alternate key binding is removed.
//!
//! \sa alternateKey(), setKey(), validKey()
void setAlternateKey(int altkey);
//! The key that is currently bound to the command is returned.
//!
//! \sa setKey(), alternateKey()
int key() const {return qkey;}
//! The alternate key that is currently bound to the command is
//! returned.
//!
//! \sa setAlternateKey(), key()
int alternateKey() const {return qaltkey;}
//! If the key \a key is valid then true is returned.
static bool validKey(int key);
//! The user friendly description of the command is returned.
QString description() const;
private:
friend class QsciCommandSet;
QsciCommand(QsciScintilla *qs, Command cmd, int key, int altkey,
const char *desc);
void bindKey(int key,int &qk,int &scik);
QsciScintilla *qsCmd;
Command scicmd;
int qkey, scikey, qaltkey, scialtkey;
const char *descCmd;
QsciCommand(const QsciCommand &);
QsciCommand &operator=(const QsciCommand &);
};
#ifdef __APPLE__
}
#endif
#endif

116
samples/C++/qsciprinter.h Normal file
View File

@@ -0,0 +1,116 @@
// This module defines interface to the QsciPrinter class.
//
// Copyright (c) 2011 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public
// License versions 2.0 or 3.0 as published by the Free Software
// Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
// included in the packaging of this file. Alternatively you may (at
// your option) use any later version of the GNU General Public
// License if such license has been publicly approved by Riverbank
// Computing Limited (or its successors, if any) and the KDE Free Qt
// Foundation. In addition, as a special exception, Riverbank gives you
// certain additional rights. These rights are described in the Riverbank
// GPL Exception version 1.1, which can be found in the file
// GPL_EXCEPTION.txt in this package.
//
// If you are unsure which license is appropriate for your use, please
// contact the sales department at sales@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCIPRINTER_H
#define QSCIPRINTER_H
#ifdef __APPLE__
extern "C++" {
#endif
#include <qprinter.h>
#include <Qsci/qsciglobal.h>
#include <Qsci/qsciscintilla.h>
QT_BEGIN_NAMESPACE
class QRect;
class QPainter;
QT_END_NAMESPACE
class QsciScintillaBase;
//! \brief The QsciPrinter class is a sub-class of the Qt QPrinter class that
//! is able to print the text of a Scintilla document.
//!
//! The class can be further sub-classed to alter to layout of the text, adding
//! headers and footers for example.
class QSCINTILLA_EXPORT QsciPrinter : public QPrinter
{
public:
//! Constructs a printer paint device with mode \a mode.
QsciPrinter(PrinterMode mode = ScreenResolution);
//! Destroys the QsciPrinter instance.
virtual ~QsciPrinter();
//! Format a page, by adding headers and footers for example, before the
//! document text is drawn on it. \a painter is the painter to be used to
//! add customised text and graphics. \a drawing is true if the page is
//! actually being drawn rather than being sized. \a painter drawing
//! methods must only be called when \a drawing is true. \a area is the
//! area of the page that will be used to draw the text. This should be
//! modified if it is necessary to reserve space for any customised text or
//! graphics. By default the area is relative to the printable area of the
//! page. Use QPrinter::setFullPage() because calling printRange() if you
//! want to try and print over the whole page. \a pagenr is the number of
//! the page. The first page is numbered 1.
virtual void formatPage(QPainter &painter, bool drawing, QRect &area,
int pagenr);
//! Return the number of points to add to each font when printing.
//!
//! \sa setMagnification()
int magnification() const {return mag;}
//! Sets the number of points to add to each font when printing to \a
//! magnification.
//!
//! \sa magnification()
virtual void setMagnification(int magnification);
//! Print a range of lines from the Scintilla instance \a qsb. \a from is
//! the first line to print and a negative value signifies the first line
//! of text. \a to is the last line to print and a negative value
//! signifies the last line of text. true is returned if there was no
//! error.
virtual int printRange(QsciScintillaBase *qsb, int from = -1, int to = -1);
//! Return the line wrap mode used when printing. The default is
//! QsciScintilla::WrapWord.
//!
//! \sa setWrapMode()
QsciScintilla::WrapMode wrapMode() const {return wrap;}
//! Sets the line wrap mode used when printing to \a wmode.
//!
//! \sa wrapMode()
virtual void setWrapMode(QsciScintilla::WrapMode wmode);
private:
int mag;
QsciScintilla::WrapMode wrap;
QsciPrinter(const QsciPrinter &);
QsciPrinter &operator=(const QsciPrinter &);
};
#ifdef __APPLE__
}
#endif
#endif