├── .gitignore
├── HalconDotNet
├── HalConVSIXProject
│ ├── FirstCommand.cs
│ ├── FirstCommandPackage.cs
│ ├── FirstCommandPackage.vsct
│ ├── HalConVSIXProject.csproj
│ ├── Key.snk
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Resources
│ │ ├── FirstCommand.png
│ │ └── FirstCommandPackage.ico
│ ├── VSPackage.resx
│ ├── index.html
│ ├── packages.config
│ ├── source.extension.vsixmanifest
│ └── stylesheet.css
├── HalconDotNet.sln
├── HalconDotNet
│ ├── Delegate
│ │ ├── DevClearWindowDelegate.cs
│ │ ├── DevCloseWindowDelegate.cs
│ │ ├── DevDispTextDelegate.cs
│ │ ├── DevDisplayDelegate.cs
│ │ ├── DevGetWindowDelegate.cs
│ │ ├── DevOpenWindowDelegate.cs
│ │ ├── DevSetColorDelegate.cs
│ │ ├── DevSetColoredDelegate.cs
│ │ ├── DevSetDrawDelegate.cs
│ │ ├── DevSetLineWidthDelegate.cs
│ │ ├── DevSetLutDelegate.cs
│ │ ├── DevSetPaintDelegate.cs
│ │ ├── DevSetPartDelegate.cs
│ │ ├── DevSetShapeDelegate.cs
│ │ ├── DevSetWindowDelegate.cs
│ │ ├── DevSetWindowExtentsDelegate.cs
│ │ ├── HInitWindowEventHandler.cs
│ │ └── HMouseEventHandler.cs
│ ├── EngineAPI.cs
│ ├── HBarCode.cs
│ ├── HBarrier.cs
│ ├── HBeadInspectionModel.cs
│ ├── HBgEsti.cs
│ ├── HCalibData.cs
│ ├── HCamPar.cs
│ ├── HCameraSetupModel.cs
│ ├── HClassBox.cs
│ ├── HClassGmm.cs
│ ├── HClassKnn.cs
│ ├── HClassLUT.cs
│ ├── HClassMlp.cs
│ ├── HClassSvm.cs
│ ├── HClassTrainData.cs
│ ├── HColorTransLUT.cs
│ ├── HComponentModel.cs
│ ├── HComponentTraining.cs
│ ├── HComputeDevice.cs
│ ├── HCondition.cs
│ ├── HData.cs
│ ├── HDataCode2D.cs
│ ├── HDeformableModel.cs
│ ├── HDeformableSurfaceMatchingResult.cs
│ ├── HDeformableSurfaceModel.cs
│ ├── HDescriptorModel.cs
│ ├── HDevEngine.cs
│ ├── HDevEngineException.cs
│ ├── HDevOpFixedWindowImpl.cs
│ ├── HDevOpMultiWindowImpl.cs
│ ├── HDevOperatorWrapper.cs
│ ├── HDevProcedure.cs
│ ├── HDevProcedureCall.cs
│ ├── HDevProgram.cs
│ ├── HDevProgramCall.cs
│ ├── HDevWindowStack.cs
│ ├── HDlClassifier.cs
│ ├── HDlClassifierResult.cs
│ ├── HDlClassifierTrainResult.cs
│ ├── HDrawingObject.cs
│ ├── HDualQuaternion.cs
│ ├── HFeatureSet.cs
│ ├── HFile.cs
│ ├── HFramegrabber.cs
│ ├── HFunction1D.cs
│ ├── HGnuplot.cs
│ ├── HHomMat2D.cs
│ ├── HHomMat3D.cs
│ ├── HIOChannel.cs
│ ├── HIODevice.cs
│ ├── HImage.cs
│ ├── HInfo.cs
│ ├── HLexicon.cs
│ ├── HMatrix.cs
│ ├── HMeasure.cs
│ ├── HMessage.cs
│ ├── HMessageQueue.cs
│ ├── HMetrologyModel.cs
│ ├── HMisc.cs
│ ├── HMouseEventArgs.cs
│ ├── HMouseEventArgsWPF.cs
│ ├── HMouseEventHandler.cs
│ ├── HMutex.cs
│ ├── HNCCModel.cs
│ ├── HOCRBox.cs
│ ├── HOCRCnn.cs
│ ├── HOCRKnn.cs
│ ├── HOCRMlp.cs
│ ├── HOCRSvm.cs
│ ├── HOCV.cs
│ ├── HObject.cs
│ ├── HObjectBase.cs
│ ├── HObjectModel3D.cs
│ ├── HObjectVector.cs
│ ├── HOperatorException.cs
│ ├── HOperatorSet.cs
│ ├── HPose.cs
│ ├── HQuaternion.cs
│ ├── HRegion.cs
│ ├── HSampleIdentifier.cs
│ ├── HScatteredDataInterpolator.cs
│ ├── HScene3D.cs
│ ├── HSerial.cs
│ ├── HSerializedItem.cs
│ ├── HShapeModel.cs
│ ├── HShapeModel3D.cs
│ ├── HSheetOfLightModel.cs
│ ├── HSmartWindowControl.cs
│ ├── HSocket.cs
│ ├── HStereoModel.cs
│ ├── HStructuredLightModel.cs
│ ├── HSurfaceMatchingResult.cs
│ ├── HSurfaceModel.cs
│ ├── HSystem.cs
│ ├── HTemplate.cs
│ ├── HTextModel.cs
│ ├── HTextResult.cs
│ ├── HTextureInspectionModel.cs
│ ├── HTextureInspectionResult.cs
│ ├── HTool.cs
│ ├── HTuple.cs
│ ├── HTupleAccessException.cs
│ ├── HTupleDouble.cs
│ ├── HTupleElements.cs
│ ├── HTupleElementsDouble.cs
│ ├── HTupleElementsImplementation.cs
│ ├── HTupleElementsInt32.cs
│ ├── HTupleElementsInt64.cs
│ ├── HTupleElementsMixed.cs
│ ├── HTupleElementsString.cs
│ ├── HTupleImplementation.cs
│ ├── HTupleInt32.cs
│ ├── HTupleInt64.cs
│ ├── HTupleMixed.cs
│ ├── HTupleString.cs
│ ├── HTupleType.cs
│ ├── HTupleVector.cs
│ ├── HTupleVoid.cs
│ ├── HVariationModel.cs
│ ├── HVector.cs
│ ├── HVectorAccessException.cs
│ ├── HWindow.cs
│ ├── HWindowControl.cs
│ ├── HWindowControlDesigner.cs
│ ├── HXLD.cs
│ ├── HXLDCont.cs
│ ├── HXLDDistTrans.cs
│ ├── HXLDExtPara.cs
│ ├── HXLDModPara.cs
│ ├── HXLDPara.cs
│ ├── HXLDPoly.cs
│ ├── HalconAPI.cs
│ ├── HalconDotNet.csproj
│ ├── HalconException.cs
│ ├── HalconWindowLayoutDialog.cs
│ ├── IHDevOperators.cs
│ ├── MyHWindowControl.Designer.cs
│ ├── MyHWindowControl.cs
│ ├── MyHWindowControl.resx
│ ├── OpenCV22Halcon.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
├── HalconNewVSIX
│ ├── HalconNewVSIX.csproj
│ ├── HalconNewVSIXPackage.cs
│ ├── HalconNewVSIXPackage.vsct
│ ├── MyCommand.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Resources
│ │ └── MyCommand.png
│ └── source.extension.vsixmanifest
├── ICSharpCode.TextEditorEx
│ ├── Class1.cs
│ ├── Extensions
│ │ └── ControlExtensions.cs
│ ├── ICSharpCode.TextEditorEx.csproj
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── Resources
│ │ ├── ASPX.xshd
│ │ ├── BAT-Mode.xshd
│ │ ├── Boo.xshd
│ │ ├── CPP-Mode.xshd
│ │ ├── CSharp-Mode.xshd
│ │ ├── Coco-Mode.xshd
│ │ ├── HTML-Mode.xshd
│ │ ├── ICSharpCode.TextEditor.snk
│ │ ├── Java-Mode.xshd
│ │ ├── JavaScript-Mode.xshd
│ │ ├── Lua-Mode.xshd
│ │ ├── Mode.xsd
│ │ ├── PHP-Mode.xshd
│ │ ├── Patch-Mode.xshd
│ │ ├── RightArrow.cur
│ │ ├── SQL-Mode.xshd
│ │ ├── SyntaxModes.xml
│ │ ├── SyntaxModesEx.Readme.txt
│ │ ├── SyntaxModesEx.xml
│ │ ├── Tex-Mode.xshd
│ │ ├── TextEditorControl.bmp
│ │ ├── VBNET-Mode.xshd
│ │ ├── XML-Mode.xshd
│ │ ├── cut.png
│ │ ├── htmlpage.png
│ │ ├── sc_cancel.png
│ │ ├── sc_copy.png
│ │ ├── sc_cut.png
│ │ ├── sc_linearrowend.png
│ │ ├── sc_paste.png
│ │ ├── sc_redo.png
│ │ ├── sc_searchdialog.png
│ │ ├── sc_selectall.png
│ │ ├── sc_undo.png
│ │ └── splitdocument.png
│ ├── Src
│ │ ├── Actions
│ │ │ ├── BookmarkActions.cs
│ │ │ ├── CaretActions.cs
│ │ │ ├── ClipBoardActions.cs
│ │ │ ├── FindAndReplaceFormActions.cs
│ │ │ ├── FoldActions.cs
│ │ │ ├── FormatActions.cs
│ │ │ ├── GoToLineNumberAction.cs
│ │ │ ├── HomeEndActions.cs
│ │ │ ├── IEditAction.cs
│ │ │ ├── MiscActions.cs
│ │ │ └── SelectionActions.cs
│ │ ├── Document
│ │ │ ├── AbstractSegment.cs
│ │ │ ├── BookmarkManager
│ │ │ │ ├── Bookmark.cs
│ │ │ │ ├── BookmarkEventHandler.cs
│ │ │ │ ├── BookmarkManager.cs
│ │ │ │ └── BookmarkManagerMemento.cs
│ │ │ ├── DefaultDocument.cs
│ │ │ ├── DefaultTextEditorProperties.cs
│ │ │ ├── DocumentEventArgs.cs
│ │ │ ├── DocumentFactory.cs
│ │ │ ├── FoldingStrategy
│ │ │ │ ├── CSharpFoldingStrategy.cs
│ │ │ │ ├── FoldMarker.cs
│ │ │ │ ├── FoldingManager.cs
│ │ │ │ ├── IFoldingStrategy.cs
│ │ │ │ ├── IFoldingStrategyEx.cs
│ │ │ │ ├── IndentFoldingStrategy.cs
│ │ │ │ └── XmlFoldingStrategy.cs
│ │ │ ├── FormattingStrategy
│ │ │ │ ├── DefaultFormattingStrategy.cs
│ │ │ │ └── IFormattingStrategy.cs
│ │ │ ├── HighlightingStrategy
│ │ │ │ ├── DefaultHighlightingStrategy.cs
│ │ │ │ ├── FontContainer.cs
│ │ │ │ ├── HighlightBackground.cs
│ │ │ │ ├── HighlightColor.cs
│ │ │ │ ├── HighlightInfo.cs
│ │ │ │ ├── HighlightRuleSet.cs
│ │ │ │ ├── HighlightingColorNotFoundException.cs
│ │ │ │ ├── HighlightingDefinitionInvalidException.cs
│ │ │ │ ├── HighlightingDefinitionParser.cs
│ │ │ │ ├── HighlightingManager.cs
│ │ │ │ ├── HighlightingStrategyFactory.cs
│ │ │ │ ├── IHighlightingStrategy.cs
│ │ │ │ ├── NextMarker.cs
│ │ │ │ ├── PrevMarker.cs
│ │ │ │ ├── Span.cs
│ │ │ │ ├── SpanStack.cs
│ │ │ │ ├── SyntaxModes
│ │ │ │ │ ├── FileSyntaxModeProvider.cs
│ │ │ │ │ ├── ISyntaxModeFileProvider.cs
│ │ │ │ │ ├── ResourceSyntaxModeProvider.cs
│ │ │ │ │ ├── ResourceSyntaxModeProviderEx.cs
│ │ │ │ │ └── SyntaxMode.cs
│ │ │ │ └── TextWord.cs
│ │ │ ├── IDocument.cs
│ │ │ ├── ISegment.cs
│ │ │ ├── ITextEditorProperties.cs
│ │ │ ├── LineManager
│ │ │ │ ├── DeferredEventList.cs
│ │ │ │ ├── LineManager.cs
│ │ │ │ ├── LineManagerEventArgs.cs
│ │ │ │ ├── LineSegment.cs
│ │ │ │ └── LineSegmentTree.cs
│ │ │ ├── MarkerStrategy
│ │ │ │ ├── MarkerStrategy.cs
│ │ │ │ └── TextMarker.cs
│ │ │ ├── Selection
│ │ │ │ ├── ColumnRange.cs
│ │ │ │ ├── DefaultSelection.cs
│ │ │ │ ├── ISelection.cs
│ │ │ │ └── SelectionManager.cs
│ │ │ ├── TextAnchor.cs
│ │ │ ├── TextBufferStrategy
│ │ │ │ ├── GapTextBufferStrategy.cs
│ │ │ │ ├── ITextBufferStrategy.cs
│ │ │ │ └── StringTextBufferStrategy.cs
│ │ │ ├── TextLocation.cs
│ │ │ └── TextUtilities.cs
│ │ ├── Gui
│ │ │ ├── AbstractMargin.cs
│ │ │ ├── BracketHighlighter.cs
│ │ │ ├── BrushRegistry.cs
│ │ │ ├── Caret.cs
│ │ │ ├── CompletionWindow
│ │ │ │ ├── AbstractCompletionWindow.cs
│ │ │ │ ├── CodeCompletionListView.cs
│ │ │ │ ├── CodeCompletionWindow.cs
│ │ │ │ ├── DeclarationViewWindow.cs
│ │ │ │ ├── ICompletionData.cs
│ │ │ │ └── ICompletionDataProvider.cs
│ │ │ ├── DrawableLine.cs
│ │ │ ├── FoldMargin.cs
│ │ │ ├── GutterMargin.cs
│ │ │ ├── HRuler.cs
│ │ │ ├── IconBarMargin.cs
│ │ │ ├── Ime.cs
│ │ │ ├── InsightWindow
│ │ │ │ ├── IInsightDataProvider.cs
│ │ │ │ └── InsightWindow.cs
│ │ │ ├── TextArea.cs
│ │ │ ├── TextAreaClipboardHandler.cs
│ │ │ ├── TextAreaControl.cs
│ │ │ ├── TextAreaDragDropHandler.cs
│ │ │ ├── TextAreaMouseHandler.cs
│ │ │ ├── TextAreaUpdate.cs
│ │ │ ├── TextEditorControl.cs
│ │ │ ├── TextEditorControlBase.cs
│ │ │ ├── TextEditorControlEx.cs
│ │ │ ├── TextView.cs
│ │ │ └── ToolTipRequestEventArgs.cs
│ │ ├── Undo
│ │ │ ├── IUndoableOperation.cs
│ │ │ ├── UndoQueue.cs
│ │ │ ├── UndoStack.cs
│ │ │ ├── UndoableDelete.cs
│ │ │ ├── UndoableInsert.cs
│ │ │ └── UndoableReplace.cs
│ │ └── Util
│ │ │ ├── AugmentableRedBlackTree.cs
│ │ │ ├── CheckedList.cs
│ │ │ ├── FileReader.cs
│ │ │ ├── LoggingService.cs
│ │ │ ├── LookupTable.cs
│ │ │ ├── MouseWheelHandler.cs
│ │ │ ├── RedBlackTreeIterator.cs
│ │ │ ├── RtfWriter.cs
│ │ │ ├── TextUtility.cs
│ │ │ ├── TipPainter.cs
│ │ │ ├── TipPainterTools.cs
│ │ │ ├── TipSection.cs
│ │ │ ├── TipSpacer.cs
│ │ │ ├── TipSplitter.cs
│ │ │ ├── TipText.cs
│ │ │ └── WeakCollection.cs
│ ├── SyntaxModes.cs
│ ├── UserControls
│ │ ├── ContextMenuStripEx.Designer.cs
│ │ ├── ContextMenuStripEx.cs
│ │ ├── FindAndReplaceForm.cs
│ │ ├── FindAndReplaceForm.designer.cs
│ │ ├── FindAndReplaceForm.resx
│ │ ├── FormatCodeHtml.cs
│ │ ├── FormatCodeHtml.designer.cs
│ │ ├── FormatCodeHtml.resx
│ │ ├── GotoForm.Designer.cs
│ │ ├── GotoForm.cs
│ │ ├── GotoForm.resx
│ │ └── Int32TextBox.cs
│ ├── Utils
│ │ ├── EventHelperUtils.cs
│ │ └── WeakEventHandler.cs
│ └── packages.config
├── OpenHalconConsole
│ ├── App.config
│ ├── ImageWnd.Designer.cs
│ ├── ImageWnd.cs
│ ├── ImageWnd.resx
│ ├── Logging
│ │ ├── ExceptionBox.Designer.cs
│ │ ├── ExceptionBox.cs
│ │ └── ExceptionBox.resx
│ ├── MainForm.Designer.cs
│ ├── MainForm.cs
│ ├── MainForm.resx
│ ├── NewImgDlg.Designer.cs
│ ├── NewImgDlg.cs
│ ├── NewImgDlg.resx
│ ├── OpenHalconConsole.csproj
│ ├── Program.cs
│ ├── ProgramWnd.Designer.cs
│ ├── ProgramWnd.cs
│ ├── ProgramWnd.resx
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── Res
│ │ ├── CultureRes.cs
│ │ ├── ResourceCH.Designer.cs
│ │ ├── ResourceCH.resx
│ │ └── logo.ico
│ └── packages.config
├── WFVisionInspection
│ ├── App.config
│ ├── BaseForm.Designer.cs
│ ├── BaseForm.cs
│ ├── BaseForm.resx
│ ├── CameraSetting.Designer.cs
│ ├── CameraSetting.cs
│ ├── CameraSetting.resx
│ ├── DetectionParameterSetting.Designer.cs
│ ├── DetectionParameterSetting.cs
│ ├── DetectionParameterSetting.resx
│ ├── JsonUtil.cs
│ ├── KTDListBox.cs
│ ├── KTDListBox.designer.cs
│ ├── MainForm.Designer.cs
│ ├── MainForm.cs
│ ├── MainForm.resx
│ ├── Program.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── Result
│ │ └── 2016年12月15日.csv
│ ├── StartOption.Designer.cs
│ ├── StartOption.cs
│ ├── StartOption.resx
│ ├── WFVisionInspection.csproj
│ ├── WFVisionInspection.csproj.bak
│ ├── grabImageSequence.Designer.cs
│ ├── grabImageSequence.cs
│ ├── grabImageSequence.resx
│ ├── halcon
│ │ ├── ExampleUtils.cs
│ │ ├── GigEAutoWhiteBalance.cs
│ │ └── detect_indent_fft.cs
│ ├── images
│ │ ├── mental_01.bmp
│ │ ├── mental_02.bmp
│ │ ├── mental_03.bmp
│ │ ├── mental_04.bmp
│ │ ├── mental_05.bmp
│ │ ├── mental_06.bmp
│ │ ├── metal
│ │ │ ├── tube_01.bmp
│ │ │ ├── tube_02.bmp
│ │ │ ├── tube_03.bmp
│ │ │ ├── tube_04.bmp
│ │ │ └── tube_05.bmp
│ │ ├── plastics
│ │ │ ├── mental_01.bmp
│ │ │ ├── mental_02.bmp
│ │ │ ├── mental_03.bmp
│ │ │ ├── mental_04.bmp
│ │ │ ├── mental_05.bmp
│ │ │ ├── mental_06.bmp
│ │ │ ├── plastics_01.bmp
│ │ │ ├── plastics_02.bmp
│ │ │ ├── plastics_03.bmp
│ │ │ ├── plastics_04.bmp
│ │ │ ├── plastics_05.bmp
│ │ │ ├── plastics_06.bmp
│ │ │ ├── plastics_07.bmp
│ │ │ ├── plastics_08.bmp
│ │ │ ├── plastics_09.bmp
│ │ │ ├── plastics_10.bmp
│ │ │ └── plastics_11.bmp
│ │ ├── res.json
│ │ ├── res.json.bak
│ │ ├── result
│ │ │ └── 2016年12月15日20时39分19秒886毫秒.bmp
│ │ └── rotate
│ │ │ ├── rotate_01.bmp
│ │ │ ├── rotate_02.bmp
│ │ │ ├── rotate_03.bmp
│ │ │ ├── rotate_04.bmp
│ │ │ ├── rotate_05.bmp
│ │ │ ├── rotate_06.bmp
│ │ │ ├── rotate_07.bmp
│ │ │ └── rotate_08.bmp
│ ├── packages.config
│ └── z_Dalsa_s2-20-40K40_00.ccf
├── hdevenginedotnetxl
│ ├── HDevEngine.cs
│ ├── HDevEngineException.cs
│ ├── HDevOpFixedWindowImpl.cs
│ ├── HDevOpMultiWindowImpl.cs
│ ├── HDevProcedure.cs
│ ├── HDevProcedureCall.cs
│ ├── HDevProgram.cs
│ ├── HDevProgramCall.cs
│ ├── HTuple.cs
│ ├── HalconException.cs
│ ├── IHDevOperators.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── hdevenginedotnetxl.csproj
└── surface_scratch
│ ├── App.config
│ ├── Form1.Designer.cs
│ ├── Form1.cs
│ ├── Form1.resx
│ ├── Program.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ ├── surface_scratch.cs
│ └── surface_scratch.csproj
├── LICENSE
├── README.md
└── halconop.png
/HalconDotNet/HalConVSIXProject/Key.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/HalConVSIXProject/Key.snk
--------------------------------------------------------------------------------
/HalconDotNet/HalConVSIXProject/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("HalConVSIXProject")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("HalConVSIXProject")]
13 | [assembly: AssemblyCopyright("")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // Version information for an assembly consists of the following four values:
23 | //
24 | // Major Version
25 | // Minor Version
26 | // Build Number
27 | // Revision
28 | //
29 | // You can specify all the values or you can default the Build and Revision Numbers
30 | // by using the '*' as shown below:
31 | // [assembly: AssemblyVersion("1.0.*")]
32 | [assembly: AssemblyVersion("1.0.0.0")]
33 | [assembly: AssemblyFileVersion("1.0.0.0")]
34 |
--------------------------------------------------------------------------------
/HalconDotNet/HalConVSIXProject/Resources/FirstCommand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/HalConVSIXProject/Resources/FirstCommand.png
--------------------------------------------------------------------------------
/HalconDotNet/HalConVSIXProject/Resources/FirstCommandPackage.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/HalConVSIXProject/Resources/FirstCommandPackage.ico
--------------------------------------------------------------------------------
/HalconDotNet/HalConVSIXProject/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/HalconDotNet/HalConVSIXProject/source.extension.vsixmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HalConVSIXProject
6 | Empty VSIX Project.
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/HalconDotNet/HalConVSIXProject/stylesheet.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 0;
4 | border: 0;
5 | color: #1E1E1E;
6 | font-size: 13px;
7 | font-family: "Segoe UI", Helvetica, Arial, sans-serif;
8 | line-height: 1.45;
9 | word-wrap: break-word;
10 | }
11 |
12 | /* General & 'Reset' Stuff */
13 |
14 |
15 | .container {
16 | width: 980px;
17 | margin: 0 auto;
18 | }
19 |
20 | section {
21 | display: block;
22 | margin: 0;
23 | }
24 |
25 | h1, h2, h3, h4, h5, h6 {
26 | margin: 0;
27 | }
28 |
29 | /* Header,
30 | header - container
31 | h1 - project name
32 | h2 - project description
33 | */
34 |
35 | #header {
36 | color: #FFF;
37 | background: #68217a;
38 | position:relative;
39 | }
40 | #hangcloud {
41 | width: 190px;
42 | height: 160px;
43 | background: url("../images/bannerart03.png");
44 | position: absolute;
45 | top: 0;
46 | right: -30px;
47 | }
48 | h1, h2 {
49 | font-family: "Segoe UI Light", "Segoe UI", Helvetica, Arial, sans-serif;
50 | line-height: 1;
51 | margin: 0 18px;
52 | padding: 0;
53 | }
54 | #header h1 {
55 | font-size: 3.4em;
56 | padding-top: 18px;
57 | font-weight: normal;
58 | margin-left: 15px;
59 | }
60 |
61 | #header h2 {
62 | font-size: 1.5em;
63 | margin-top: 10px;
64 | padding-bottom: 18px;
65 | font-weight: normal;
66 | }
67 |
68 |
69 | #main_content {
70 | width: 100%;
71 | display: flex;
72 | flex-direction: row;
73 | }
74 |
75 |
76 | h1, h2, h3, h4, h5, h6 {
77 | font-weight: bolder;
78 | }
79 |
80 | #main_content h1 {
81 | font-size: 1.8em;
82 | margin-top: 34px;
83 | }
84 |
85 | #main_content h1:first-child {
86 | margin-top: 30px;
87 | }
88 |
89 | #main_content h2 {
90 | font-size: 1.4em;
91 | font-weight: bold;
92 | }
93 | p, ul {
94 | margin: 11px 18px;
95 | }
96 |
97 | #main_content a {
98 | color: #06C;
99 | text-decoration: none;
100 | }
101 | ul {
102 | margin-top: 13px;
103 | margin-left: 18px;
104 | padding-left: 0;
105 | }
106 | ul li {
107 | margin-left: 18px;
108 | padding-left: 0;
109 | }
110 | #lpanel {
111 | width: 620px;
112 | float: left;
113 | }
114 | #rpanel ul {
115 | list-style-type: none;
116 | width: 300px;
117 | }
118 | #rpanel ul li {
119 | line-height: 1.8em;
120 | }
121 | #rpanel {
122 | background: #e7e7e7;
123 | width: 360px;
124 | float: right;
125 | }
126 |
127 | #rpanel div {
128 | width: 300px;
129 | }
130 |
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/DevClearWindowDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HalconDotNet
4 | {
5 | internal class DevClearWindowDelegate
6 | {
7 | private Func devClearWindow;
8 |
9 | public DevClearWindowDelegate(Func devClearWindow)
10 | {
11 | this.devClearWindow = devClearWindow;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/DevCloseWindowDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HalconDotNet
4 | {
5 | internal class DevCloseWindowDelegate
6 | {
7 | private Func devCloseWindow;
8 |
9 | public DevCloseWindowDelegate(Func devCloseWindow)
10 | {
11 | this.devCloseWindow = devCloseWindow;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/DevDispTextDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HalconDotNet
4 | {
5 | internal class DevDispTextDelegate
6 | {
7 | private Func devDispText;
8 |
9 | public DevDispTextDelegate(Func devDispText)
10 | {
11 | this.devDispText = devDispText;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/DevDisplayDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HalconDotNet
4 | {
5 | internal class DevDisplayDelegate
6 | {
7 | private Func devDisplay;
8 |
9 | public DevDisplayDelegate(Func devDisplay)
10 | {
11 | this.devDisplay = devDisplay;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/DevGetWindowDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HalconDotNet
4 | {
5 | internal class DevGetWindowDelegate
6 | {
7 | private Func devGetWindow;
8 |
9 | public DevGetWindowDelegate(Func devGetWindow)
10 | {
11 | this.devGetWindow = devGetWindow;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/DevOpenWindowDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HalconDotNet
4 | {
5 | internal class DevOpenWindowDelegate
6 | {
7 | private Func devOpenWindow;
8 |
9 | public DevOpenWindowDelegate(Func devOpenWindow)
10 | {
11 | this.devOpenWindow = devOpenWindow;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/DevSetColorDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HalconDotNet
4 | {
5 | internal class DevSetColorDelegate
6 | {
7 | private Func devSetColor;
8 |
9 | public DevSetColorDelegate(Func devSetColor)
10 | {
11 | this.devSetColor = devSetColor;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/DevSetColoredDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HalconDotNet
4 | {
5 | internal class DevSetColoredDelegate
6 | {
7 | private Func devSetColored;
8 |
9 | public DevSetColoredDelegate(Func devSetColored)
10 | {
11 | this.devSetColored = devSetColored;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/DevSetDrawDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HalconDotNet
4 | {
5 | internal class DevSetDrawDelegate
6 | {
7 | private Func devSetDraw;
8 |
9 | public DevSetDrawDelegate(Func devSetDraw)
10 | {
11 | this.devSetDraw = devSetDraw;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/DevSetLineWidthDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HalconDotNet
4 | {
5 | internal class DevSetLineWidthDelegate
6 | {
7 | private Func devSetLineWidth;
8 |
9 | public DevSetLineWidthDelegate(Func devSetLineWidth)
10 | {
11 | this.devSetLineWidth = devSetLineWidth;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/DevSetLutDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HalconDotNet
4 | {
5 | internal class DevSetLutDelegate
6 | {
7 | private Func devSetLut;
8 |
9 | public DevSetLutDelegate(Func devSetLut)
10 | {
11 | this.devSetLut = devSetLut;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/DevSetPaintDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HalconDotNet
4 | {
5 | internal class DevSetPaintDelegate
6 | {
7 | private Func devSetPaint;
8 |
9 | public DevSetPaintDelegate(Func devSetPaint)
10 | {
11 | this.devSetPaint = devSetPaint;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/DevSetPartDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HalconDotNet
4 | {
5 | internal class DevSetPartDelegate
6 | {
7 | private Func devSetPart;
8 |
9 | public DevSetPartDelegate(Func devSetPart)
10 | {
11 | this.devSetPart = devSetPart;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/DevSetShapeDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HalconDotNet
4 | {
5 | internal class DevSetShapeDelegate
6 | {
7 | private Func devSetShape;
8 |
9 | public DevSetShapeDelegate(Func devSetShape)
10 | {
11 | this.devSetShape = devSetShape;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/DevSetWindowDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HalconDotNet
4 | {
5 | internal class DevSetWindowDelegate
6 | {
7 | private Func devSetWindow;
8 |
9 | public DevSetWindowDelegate(Func devSetWindow)
10 | {
11 | this.devSetWindow = devSetWindow;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/DevSetWindowExtentsDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace HalconDotNet
4 | {
5 | internal class DevSetWindowExtentsDelegate
6 | {
7 | private Func devSetWindowExtents;
8 |
9 | public DevSetWindowExtentsDelegate(Func devSetWindowExtents)
10 | {
11 | this.devSetWindowExtents = devSetWindowExtents;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/HInitWindowEventHandler.cs:
--------------------------------------------------------------------------------
1 | // Decompiled with JetBrains decompiler
2 | // Type: HalconDotNet.HInitWindowEventHandler
3 | // Assembly: halcondotnetxl, Version=17.12.0.0, Culture=neutral, PublicKeyToken=4973bed59ddbf2b8
4 | // MVID: 39799324-2494-4A83-8C57-2731D25BAE81
5 | // Assembly location: C:\Program Files\MVTec\HALCON-17.12-Progress\bin\dotnet35\halcondotnetxl.dll
6 |
7 | using System;
8 |
9 | namespace HalconDotNet
10 | {
11 | ///
12 | /// Represents the method that will handle the InitWindow event
13 | /// of a HWindowControl
14 | ///
15 | public delegate void HInitWindowEventHandler(object sender, EventArgs e);
16 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Delegate/HMouseEventHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace HalconDotNet.Delegate
8 | {
9 | ///
10 | /// Represents the method that will handle the HMouseDown, HMouseUp,
11 | /// or HMouseMove event of a HWindowControl.
12 | ///
13 | public delegate void HMouseEventHandler(object sender, HMouseEventArgs e);
14 | }
15 |
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/HData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace HalconDotNet
8 | {
9 | public class HData
10 | {
11 | internal HTuple tuple;
12 |
13 | internal HData()
14 | {
15 | this.tuple = new HTuple();
16 | }
17 |
18 | internal HData(HTuple t)
19 | {
20 | this.tuple = t;
21 | }
22 |
23 | internal HData(HData data)
24 | {
25 | this.tuple = data.tuple;
26 | }
27 |
28 | internal static HTuple ConcatArray(HData[] data)
29 | {
30 | HTuple htuple = new HTuple();
31 | for (int index = 0; index < data.Length; ++index)
32 | htuple = htuple.TupleConcat(data[index].tuple);
33 | return htuple;
34 | }
35 |
36 | internal void UnpinTuple()
37 | {
38 | this.tuple.UnpinTuple();
39 | }
40 |
41 | internal void Store(IntPtr proc, int parIndex)
42 | {
43 | this.tuple.Store(proc, parIndex);
44 | }
45 |
46 | internal int Load(IntPtr proc, int parIndex, int err)
47 | {
48 | return this.tuple.Load(proc, parIndex, err);
49 | }
50 |
51 | internal int Load(IntPtr proc, int parIndex, HTupleType type, int err)
52 | {
53 | return this.tuple.Load(proc, parIndex, type, err);
54 | }
55 |
56 | /// Provides access to the internally used tuple data
57 | public HTuple RawData
58 | {
59 | get
60 | {
61 | return this.tuple;
62 | }
63 | set
64 | {
65 | this.tuple = new HTuple(value);
66 | }
67 | }
68 |
69 | public static implicit operator HTuple(HData data)
70 | {
71 | return data.tuple;
72 | }
73 |
74 | /// Provides access to the value at the specified index
75 | public HTupleElements this[int index]
76 | {
77 | get
78 | {
79 | return this.tuple[index];
80 | }
81 | set
82 | {
83 | this.tuple[index] = value;
84 | }
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/HMouseEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Decompiled with JetBrains decompiler
2 | // Type: HalconDotNet.HMouseEventArgs
3 | // Assembly: halcondotnetxl, Version=17.12.0.0, Culture=neutral, PublicKeyToken=4973bed59ddbf2b8
4 | // MVID: 39799324-2494-4A83-8C57-2731D25BAE81
5 | // Assembly location: C:\Program Files\MVTec\HALCON-17.12-Progress\bin\dotnet35\halcondotnetxl.dll
6 |
7 | using System;
8 | using System.Windows.Forms;
9 |
10 | namespace HalconDotNet
11 | {
12 | ///
13 | /// Provides data for the HMouseUp, HMouseDown, and HMouseMove events.
14 | ///
15 | public class HMouseEventArgs : EventArgs
16 | {
17 | private readonly MouseButtons button;
18 | private readonly int clicks;
19 | private readonly double x;
20 | private readonly double y;
21 | private readonly int delta;
22 |
23 | internal HMouseEventArgs(MouseButtons button, int clicks, double x, double y, int delta)
24 | {
25 | this.button = button;
26 | this.clicks = clicks;
27 | this.x = x;
28 | this.y = y;
29 | this.delta = delta;
30 | }
31 |
32 | /// Gets which mouse button was pressed.
33 | public MouseButtons Button
34 | {
35 | get
36 | {
37 | return this.button;
38 | }
39 | }
40 |
41 | ///
42 | /// Gets the number of times the mouse button was pressed and released.
43 | ///
44 | public int Clicks
45 | {
46 | get
47 | {
48 | return this.clicks;
49 | }
50 | }
51 |
52 | /// Gets the column coordinate of a mouse click.
53 | public double X
54 | {
55 | get
56 | {
57 | return this.x;
58 | }
59 | }
60 |
61 | /// Gets the row coordinate of a mouse click.
62 | public double Y
63 | {
64 | get
65 | {
66 | return this.y;
67 | }
68 | }
69 |
70 | ///
71 | /// Gets a signed count of the number of detents the mouse wheel
72 | /// has rotated. A detent is one notch of the mouse wheel.
73 | ///
74 | public int Delta
75 | {
76 | get
77 | {
78 | return this.delta;
79 | }
80 | }
81 | }
82 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/HMouseEventArgsWPF.cs:
--------------------------------------------------------------------------------
1 | // Decompiled with JetBrains decompiler
2 | // Type: HalconDotNet.HMouseEventArgsWPF
3 | // Assembly: halcondotnetxl, Version=17.12.0.0, Culture=neutral, PublicKeyToken=4973bed59ddbf2b8
4 | // MVID: 39799324-2494-4A83-8C57-2731D25BAE81
5 | // Assembly location: C:\Program Files\MVTec\HALCON-17.12-Progress\bin\dotnet35\halcondotnetxl.dll
6 |
7 | using System;
8 | using System.Windows.Input;
9 |
10 | namespace HalconDotNet
11 | {
12 | /// Provides data for the HMouse* events.
13 | public class HMouseEventArgsWPF : EventArgs
14 | {
15 | private readonly double x;
16 | private readonly double y;
17 | private readonly double row;
18 | private readonly double column;
19 | private readonly int delta;
20 | private readonly System.Windows.Input.ICommand button;
21 |
22 | internal HMouseEventArgsWPF(
23 | double x,
24 | double y,
25 | double row,
26 | double column,
27 | int delta,
28 | System.Windows.Input.ICommand button)
29 | {
30 | this.x = x;
31 | this.y = y;
32 | this.row = row;
33 | this.column = column;
34 | this.delta = delta;
35 | this.button = button;
36 | }
37 |
38 | /// Gets the window x coordinate of the mouse event.
39 | public double X
40 | {
41 | get
42 | {
43 | return this.x;
44 | }
45 | }
46 |
47 | /// Gets the window y coordinate of the mouse event.
48 | public double Y
49 | {
50 | get
51 | {
52 | return this.y;
53 | }
54 | }
55 |
56 | /// Gets the row image coordinate of the mouse event.
57 | public double Row
58 | {
59 | get
60 | {
61 | return this.row;
62 | }
63 | }
64 |
65 | /// Gets the column image coordinate of the mouse event.
66 | public double Column
67 | {
68 | get
69 | {
70 | return this.column;
71 | }
72 | }
73 |
74 | /// Gets the increment for the mouse wheel change.
75 | public int Delta
76 | {
77 | get
78 | {
79 | return this.delta;
80 | }
81 | }
82 |
83 | /// Gets which mouse button was pressed.
84 | public System.Windows.Input.ICommand Button
85 | {
86 | get
87 | {
88 | return this.button;
89 | }
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/HMouseEventHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace HalconDotNet
8 | {
9 | ///
10 | /// Represents the method that will handle the HMouseDown, HMouseUp,
11 | /// or HMouseMove event of a HWindowControl.
12 | ///
13 | ///
14 | public delegate void HMouseEventHandler(object sender, HMouseEventArgs e);
15 | }
16 |
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/HTupleAccessException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace HalconDotNet
8 | {
9 | ///
10 | /// This exception is thrown whenever an error occurs during tuple access.
11 | ///
12 | public class HTupleAccessException : HalconException
13 | {
14 | private static string BuildMessage(HTupleImplementation sender, string sInfo)
15 | {
16 | string str = sInfo;
17 | if (sender != null)
18 | str = "'" + str + "' when accessing '" + sender.ToString() + "'";
19 | return str;
20 | }
21 |
22 | internal HTupleAccessException(HTupleImplementation sender, string sInfo, Exception inner)
23 | : base(HTupleAccessException.BuildMessage(sender, sInfo), (Exception)null)
24 | {
25 | }
26 |
27 | internal HTupleAccessException(HTupleImplementation sender, string sInfo)
28 | : this(sender, sInfo, (Exception)null)
29 | {
30 | }
31 |
32 | internal HTupleAccessException(HTupleImplementation sender)
33 | : this(sender, "Illegal operation on Tuple")
34 | {
35 | }
36 |
37 | internal HTupleAccessException(string sInfo, Exception inner)
38 | : this((HTupleImplementation)null, sInfo, inner)
39 | {
40 | }
41 |
42 | internal HTupleAccessException(string sInfo)
43 | : this((HTupleImplementation)null, sInfo)
44 | {
45 | }
46 |
47 | internal HTupleAccessException()
48 | : this((HTupleImplementation)null)
49 | {
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/HTupleElementsDouble.cs:
--------------------------------------------------------------------------------
1 | // Decompiled with JetBrains decompiler
2 | // Type: HalconDotNet.HTupleElementsDouble
3 | // Assembly: halcondotnetxl, Version=17.12.0.0, Culture=neutral, PublicKeyToken=4973bed59ddbf2b8
4 | // MVID: 39799324-2494-4A83-8C57-2731D25BAE81
5 | // Assembly location: C:\Program Files\MVTec\HALCON-17.12-Progress\bin\dotnet35\halcondotnetxl.dll
6 |
7 | namespace HalconDotNet
8 | {
9 | internal class HTupleElementsDouble : HTupleElementsImplementation
10 | {
11 | internal HTupleElementsDouble(HTupleDouble source, int index)
12 | : base((HTupleImplementation)source, index)
13 | {
14 | }
15 |
16 | internal HTupleElementsDouble(HTupleDouble source, int[] indices)
17 | : base((HTupleImplementation)source, indices)
18 | {
19 | }
20 |
21 | public override double[] getD()
22 | {
23 | if (this.indices == null)
24 | return (double[])null;
25 | double[] numArray = new double[this.indices.Length];
26 | for (int index = 0; index < this.indices.Length; ++index)
27 | numArray[index] = this.source.DArr[this.indices[index]];
28 | return numArray;
29 | }
30 |
31 | public override void setD(double[] d)
32 | {
33 | if (d == null)
34 | return;
35 | if (d.Length <= 1)
36 | {
37 | for (int index = 0; index < d.Length; ++index)
38 | this.source.DArr[this.indices[index]] = d[0];
39 | }
40 | else
41 | {
42 | if (d.Length != this.indices.Length)
43 | throw new HTupleAccessException(this.source, "Input parameter 2 ('Value') must have one element or the same number of elements as parameter 1 ('Index')");
44 | for (int index = 0; index < d.Length; ++index)
45 | this.source.DArr[this.indices[index]] = d[index];
46 | }
47 | }
48 |
49 | public override object[] getO()
50 | {
51 | if (this.indices == null)
52 | return (object[])null;
53 | object[] objArray = new object[this.indices.Length];
54 | for (int index = 0; index < this.indices.Length; ++index)
55 | objArray[index] = (object)this.source.DArr[this.indices[index]];
56 | return objArray;
57 | }
58 |
59 | public override HTupleType getType()
60 | {
61 | return HTupleType.DOUBLE;
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/HTupleElementsString.cs:
--------------------------------------------------------------------------------
1 | // Decompiled with JetBrains decompiler
2 | // Type: HalconDotNet.HTupleElementsString
3 | // Assembly: halcondotnetxl, Version=17.12.0.0, Culture=neutral, PublicKeyToken=4973bed59ddbf2b8
4 | // MVID: 39799324-2494-4A83-8C57-2731D25BAE81
5 | // Assembly location: C:\Program Files\MVTec\HALCON-17.12-Progress\bin\dotnet35\halcondotnetxl.dll
6 |
7 | namespace HalconDotNet
8 | {
9 | internal class HTupleElementsString : HTupleElementsImplementation
10 | {
11 | internal HTupleElementsString(HTupleString source, int index)
12 | : base((HTupleImplementation)source, index)
13 | {
14 | }
15 |
16 | internal HTupleElementsString(HTupleString source, int[] indices)
17 | : base((HTupleImplementation)source, indices)
18 | {
19 | }
20 |
21 | public override string[] getS()
22 | {
23 | if (this.indices == null)
24 | return (string[])null;
25 | string[] strArray = new string[this.indices.Length];
26 | for (int index = 0; index < this.indices.Length; ++index)
27 | strArray[index] = this.source.SArr[this.indices[index]];
28 | return strArray;
29 | }
30 |
31 | public override void setS(string[] s)
32 | {
33 | if (s == null)
34 | return;
35 | if (s.Length <= 1)
36 | {
37 | for (int index = 0; index < s.Length; ++index)
38 | this.source.SArr[this.indices[index]] = s[0];
39 | }
40 | else
41 | {
42 | if (s.Length != this.indices.Length)
43 | throw new HTupleAccessException(this.source, "Input parameter 2 ('Value') must have one element or the same number of elements as parameter 1 ('Index')");
44 | for (int index = 0; index < s.Length; ++index)
45 | this.source.SArr[this.indices[index]] = s[index];
46 | }
47 | }
48 |
49 | public override object[] getO()
50 | {
51 | if (this.indices == null)
52 | return (object[])null;
53 | object[] objArray = new object[this.indices.Length];
54 | for (int index = 0; index < this.indices.Length; ++index)
55 | objArray[index] = (object)this.source.SArr[this.indices[index]];
56 | return objArray;
57 | }
58 |
59 | public override HTupleType getType()
60 | {
61 | return HTupleType.STRING;
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/HTupleType.cs:
--------------------------------------------------------------------------------
1 | // Decompiled with JetBrains decompiler
2 | // Type: HalconDotNet.HTupleType
3 | // Assembly: halcondotnetxl, Version=17.12.0.0, Culture=neutral, PublicKeyToken=4973bed59ddbf2b8
4 | // MVID: 39799324-2494-4A83-8C57-2731D25BAE81
5 | // Assembly location: C:\Program Files\MVTec\HALCON-17.12-Progress\bin\dotnet35\halcondotnetxl.dll
6 |
7 | namespace HalconDotNet
8 | {
9 | ///
10 | /// Enumeration of tuple types, as returned by HTuple.Type
11 | ///
12 | public enum HTupleType
13 | {
14 | /// Tuple is represented by an array of System.Int32
15 | INTEGER = 1,
16 | /// Tuple is represented by an array of System.Double
17 | DOUBLE = 2,
18 | /// Tuple is represented by an array of strings
19 | STRING = 4,
20 | /// Tuple is represented by an object array of boxed values.
21 | MIXED = 8,
22 | /// Tuple is empty
23 | EMPTY = 15, // 0x0000000F
24 | /// Tuple is represented by an array of System.Int64
25 | LONG = 129, // 0x00000081
26 | }
27 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/HTupleVoid.cs:
--------------------------------------------------------------------------------
1 | // Decompiled with JetBrains decompiler
2 | // Type: HalconDotNet.HTupleVoid
3 | // Assembly: halcondotnetxl, Version=17.12.0.0, Culture=neutral, PublicKeyToken=4973bed59ddbf2b8
4 | // MVID: 39799324-2494-4A83-8C57-2731D25BAE81
5 | // Assembly location: C:\Program Files\MVTec\HALCON-17.12-Progress\bin\dotnet35\halcondotnetxl.dll
6 |
7 | using System;
8 |
9 | namespace HalconDotNet
10 | {
11 | internal class HTupleVoid : HTupleImplementation
12 | {
13 | public static HTupleVoid EMPTY = new HTupleVoid();
14 |
15 | protected override Array CreateArray(int size)
16 | {
17 | return (Array)new int[0];
18 | }
19 |
20 | private HTupleVoid()
21 | {
22 | this.SetArray((Array)null, false);
23 | }
24 |
25 | public override void AssertSize(int index)
26 | {
27 | throw new HTupleAccessException((HTupleImplementation)this);
28 | }
29 |
30 | public override HTupleType Type
31 | {
32 | get
33 | {
34 | return HTupleType.EMPTY;
35 | }
36 | }
37 |
38 | public override int[] ToIArr()
39 | {
40 | return new int[0];
41 | }
42 |
43 | public override long[] ToLArr()
44 | {
45 | return new long[0];
46 | }
47 |
48 | public override double[] ToDArr()
49 | {
50 | return new double[0];
51 | }
52 |
53 | public override float[] ToFArr()
54 | {
55 | return new float[0];
56 | }
57 |
58 | public override IntPtr[] ToIPArr()
59 | {
60 | return new IntPtr[0];
61 | }
62 |
63 | protected override void StoreData(IntPtr proc, IntPtr tuple)
64 | {
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/HVectorAccessException.cs:
--------------------------------------------------------------------------------
1 | // Decompiled with JetBrains decompiler
2 | // Type: HalconDotNet.HVectorAccessException
3 | // Assembly: halcondotnetxl, Version=17.12.0.0, Culture=neutral, PublicKeyToken=4973bed59ddbf2b8
4 | // MVID: 39799324-2494-4A83-8C57-2731D25BAE81
5 | // Assembly location: C:\Program Files\MVTec\HALCON-17.12-Progress\bin\dotnet35\halcondotnetxl.dll
6 |
7 | using System;
8 |
9 | namespace HalconDotNet
10 | {
11 | ///
12 | /// This exception is thrown whenever an error occurs during
13 | /// vector operations
14 | ///
15 | public class HVectorAccessException : HalconException
16 | {
17 | private static string BuildMessage(HVector sender, string sInfo)
18 | {
19 | string str = sInfo;
20 | if (sender != null)
21 | str = "'" + str + "' when accessing '" + sender.ToString() + "'";
22 | return str;
23 | }
24 |
25 | internal HVectorAccessException(HVector sender, string sInfo, Exception inner)
26 | : base(HVectorAccessException.BuildMessage(sender, sInfo), (Exception)null)
27 | {
28 | }
29 |
30 | internal HVectorAccessException(HVector sender, string sInfo)
31 | : this(sender, sInfo, (Exception)null)
32 | {
33 | }
34 |
35 | internal HVectorAccessException(HVector sender)
36 | : this(sender, "Illegal operation on vector")
37 | {
38 | }
39 |
40 | internal HVectorAccessException(string sInfo, Exception inner)
41 | : this((HVector)null, sInfo, inner)
42 | {
43 | }
44 |
45 | internal HVectorAccessException(string sInfo)
46 | : this((HVector)null, sInfo)
47 | {
48 | }
49 |
50 | internal HVectorAccessException()
51 | : this((HVector)null)
52 | {
53 | }
54 | }
55 | }
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/HWindowControlDesigner.cs:
--------------------------------------------------------------------------------
1 | // Decompiled with JetBrains decompiler
2 | // Type: HalconDotNet.HWindowControlDesigner
3 | // Assembly: halcondotnetxl, Version=17.12.0.0, Culture=neutral, PublicKeyToken=4973bed59ddbf2b8
4 | // MVID: 39799324-2494-4A83-8C57-2731D25BAE81
5 | // Assembly location: C:\Program Files\MVTec\HALCON-17.12-Progress\bin\dotnet35\halcondotnetxl.dll
6 |
7 | using System;
8 | using System.Collections;
9 | using System.ComponentModel;
10 | using System.Drawing;
11 | using System.Windows.Forms.Design;
12 |
13 | namespace HalconDotNet
14 | {
15 | public class HWindowControlDesigner : ControlDesigner
16 | {
17 | private HWindowControl windowControl;
18 |
19 | public override void Initialize(IComponent component)
20 | {
21 | base.Initialize(component);
22 | this.windowControl = (HWindowControl)component;
23 | }
24 |
25 | protected override void PreFilterProperties(IDictionary properties)
26 | {
27 | base.PreFilterProperties(properties);
28 | Attribute[] attributeArray = new Attribute[3]
29 | {
30 | (Attribute) CategoryAttribute.Layout,
31 | (Attribute) DesignOnlyAttribute.Yes,
32 | (Attribute) new DescriptionAttribute("This design-time property allows you to configure Size and ImagePart by providing a reference image of the desired size.")
33 | };
34 | properties[(object)"LayoutBitmap"] = (object)TypeDescriptor.CreateProperty(typeof(HWindowControlDesigner), "LayoutBitmap", typeof(Bitmap), attributeArray);
35 | properties.Remove((object)"BorderStyle");
36 | }
37 |
38 | public Bitmap LayoutBitmap
39 | {
40 | get
41 | {
42 | return (Bitmap)null;
43 | }
44 | set
45 | {
46 | if (value == null)
47 | return;
48 | HalconWindowLayoutDialog windowLayoutDialog = new HalconWindowLayoutDialog(value.Size);
49 | int num = (int)windowLayoutDialog.ShowDialog();
50 | if (windowLayoutDialog.resultCancel)
51 | return;
52 | this.windowControl.WindowSize = new Size(value.Size.Width * windowLayoutDialog.resultPercent / 100, value.Size.Height * windowLayoutDialog.resultPercent / 100);
53 | this.windowControl.ImagePart = new Rectangle(Point.Empty, value.Size);
54 | }
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/MyHWindowControl.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace HalconDotNet
2 | {
3 | partial class MyHalconControl
4 | {
5 | ///
6 | /// 必需的设计器变量。
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// 清理所有正在使用的资源。
12 | ///
13 | /// 如果应释放托管资源,为 true;否则为 false。
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region 组件设计器生成的代码
24 |
25 | ///
26 | /// 设计器支持所需的方法 - 不要修改
27 | /// 使用代码编辑器修改此方法的内容。
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.SuspendLayout();
32 | //
33 | // MyHalconControl
34 | //
35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
37 | this.Name = "MyHalconControl";
38 | this.Size = new System.Drawing.Size(388, 322);
39 | this.Load += new System.EventHandler(this.MyHWindowControl_Load);
40 | this.Paint += new System.Windows.Forms.PaintEventHandler(this.MyHWindowControl_Paint);
41 | this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MyHWindowControl_MouseDown);
42 | this.MouseHover += new System.EventHandler(this.MyHWindowControl_MouseHover);
43 | this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MyHWindowControl_MouseMove);
44 | this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.MyHWindowControl_MouseUp);
45 | this.Resize += new System.EventHandler(this.MyHWindowControl_Resize);
46 | this.ResumeLayout(false);
47 |
48 | }
49 |
50 | #endregion
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/OpenCV22Halcon.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace HalconDotNet
8 | {
9 | class OpenCV22Halcon
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("HalconDotNet")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("HalconDotNet")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("f440a4b7-d568-4163-9f6b-f7af409f33ae")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/HalconDotNet/HalconDotNet/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/HalconDotNet/HalconNewVSIX/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("HalconNewVSIX")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("HalconNewVSIX")]
13 | [assembly: AssemblyCopyright("")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // Version information for an assembly consists of the following four values:
23 | //
24 | // Major Version
25 | // Minor Version
26 | // Build Number
27 | // Revision
28 | //
29 | // You can specify all the values or you can default the Build and Revision Numbers
30 | // by using the '*' as shown below:
31 | // [assembly: AssemblyVersion("1.0.*")]
32 | [assembly: AssemblyVersion("1.0.0.0")]
33 | [assembly: AssemblyFileVersion("1.0.0.0")]
34 |
--------------------------------------------------------------------------------
/HalconDotNet/HalconNewVSIX/Resources/MyCommand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/HalconNewVSIX/Resources/MyCommand.png
--------------------------------------------------------------------------------
/HalconDotNet/HalconNewVSIX/source.extension.vsixmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HalconNewVSIX
6 | Empty VSIX Project.
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Class1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ICSharpCode.TextEditorEx
8 | {
9 | public class Class1
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Extensions/ControlExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Reflection;
4 | using System.Windows.Forms;
5 |
6 | namespace ICSharpCode.TextEditor.Extensions
7 | {
8 | public static class ControlExtensions
9 | {
10 | public static EventHandlerList GetEventHandlerList(this Control c)
11 | {
12 | return GetEventHandlerListInternal(c);
13 | }
14 |
15 | public static EventHandlerList GetEventHandlerList(this Component c)
16 | {
17 | return GetEventHandlerListInternal(c);
18 | }
19 |
20 | private static EventHandlerList GetEventHandlerListInternal(object obj)
21 | {
22 | Type type = obj.GetType();
23 | PropertyInfo pi = type.GetProperty("Events", BindingFlags.NonPublic | BindingFlags.Instance);
24 | return (EventHandlerList)pi.GetValue(obj, null);
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("ICSharpCode.TextEditorEx")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ICSharpCode.TextEditorEx")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 会使此程序集中的类型
18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("c1ff415d-8036-45b6-87d5-03b387af4d9c")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
33 | //通过使用 "*",如下所示:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/ASPX.xshd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | <%
7 | %>
8 |
9 |
10 |
11 |
12 |
13 | //
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/BAT-Mode.xshd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/ICSharpCode.TextEditor.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/ICSharpCode.TextEditorEx/Resources/ICSharpCode.TextEditor.snk
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/Patch-Mode.xshd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | ~!%^*()-+=|\#/{}[]:;"'<> , .?
9 |
10 |
11 | Index:
12 |
13 |
14 | ==
15 |
16 |
17 | ---
18 |
19 |
20 | +++
21 |
22 |
23 | @@
24 |
25 |
26 | -
27 |
28 |
29 | +
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/RightArrow.cur:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/ICSharpCode.TextEditorEx/Resources/RightArrow.cur
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/SyntaxModes.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
10 |
13 |
14 |
17 |
18 |
21 |
22 |
25 |
26 |
29 |
30 |
33 |
34 |
37 |
38 |
41 |
42 |
45 |
46 |
49 |
50 |
53 |
54 |
57 |
58 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/SyntaxModesEx.Readme.txt:
--------------------------------------------------------------------------------
1 | Lua syntax highlighting based on http://github.com/nano-byte/ICSharpCode.TextEditor
2 | SQL syntax highlighting based on http://www.codeproject.com/Articles/111969/Extending-ICSharpCode-TextEditor-Syntax-Highlighti
3 |
4 | All supported:
5 | ASP/XHTML
6 | BAT
7 | Boo
8 | Coco
9 | C++.NET
10 | C#
11 | HTML
12 | Java
13 | JavaScript
14 | Patch
15 | PHP
16 | TeX
17 | VBNET
18 | XML
19 | Lua
20 | SQL
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/SyntaxModesEx.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/TextEditorControl.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/ICSharpCode.TextEditorEx/Resources/TextEditorControl.bmp
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/XML-Mode.xshd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | <!--
17 | -->
18 |
19 |
20 | <![CDATA[
21 | ]]>
22 |
23 |
24 | <!DOCTYPE
25 | >
26 |
27 |
28 | <?
29 | ?>
30 |
31 |
32 | <
33 | >
34 |
35 |
36 | &
37 | ;
38 |
39 |
40 |
41 |
42 | /=
43 |
44 | "
45 | "
46 |
47 |
48 | '
49 | '
50 |
51 | =
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/cut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/ICSharpCode.TextEditorEx/Resources/cut.png
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/htmlpage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/ICSharpCode.TextEditorEx/Resources/htmlpage.png
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_cancel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_cancel.png
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_copy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_copy.png
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_cut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_cut.png
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_linearrowend.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_linearrowend.png
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_paste.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_paste.png
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_redo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_redo.png
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_searchdialog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_searchdialog.png
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_selectall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_selectall.png
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_undo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/ICSharpCode.TextEditorEx/Resources/sc_undo.png
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Resources/splitdocument.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanglei50/OpenHalcon/e390f45e06a52d4f01dc5a1de153081c6e08f423/HalconDotNet/ICSharpCode.TextEditorEx/Resources/splitdocument.png
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Actions/BookmarkActions.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using ICSharpCode.TextEditor.Document;
10 |
11 | namespace ICSharpCode.TextEditor.Actions
12 | {
13 | public class ToggleBookmark : AbstractEditAction
14 | {
15 | public override void Execute(TextArea textArea)
16 | {
17 | textArea.Document.BookmarkManager.ToggleMarkAt(textArea.Caret.Position);
18 | textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, textArea.Caret.Line));
19 | textArea.Document.CommitUpdate();
20 |
21 | }
22 | }
23 |
24 | public class GotoPrevBookmark : AbstractEditAction
25 | {
26 | Predicate predicate = null;
27 |
28 | public GotoPrevBookmark(Predicate predicate)
29 | {
30 | this.predicate = predicate;
31 | }
32 |
33 | public override void Execute(TextArea textArea)
34 | {
35 | Bookmark mark = textArea.Document.BookmarkManager.GetPrevMark(textArea.Caret.Line, predicate);
36 | if (mark != null) {
37 | textArea.Caret.Position = mark.Location;
38 | textArea.SelectionManager.ClearSelection();
39 | textArea.SetDesiredColumn();
40 | }
41 | }
42 | }
43 |
44 | public class GotoNextBookmark : AbstractEditAction
45 | {
46 | Predicate predicate = null;
47 |
48 | public GotoNextBookmark(Predicate predicate)
49 | {
50 | this.predicate = predicate;
51 | }
52 |
53 | public override void Execute(TextArea textArea)
54 | {
55 | Bookmark mark = textArea.Document.BookmarkManager.GetNextMark(textArea.Caret.Line, predicate);
56 | if (mark != null) {
57 | textArea.Caret.Position = mark.Location;
58 | textArea.SelectionManager.ClearSelection();
59 | textArea.SetDesiredColumn();
60 | }
61 | }
62 | }
63 |
64 | public class ClearAllBookmarks : AbstractEditAction
65 | {
66 | Predicate predicate = null;
67 |
68 | public ClearAllBookmarks(Predicate predicate)
69 | {
70 | this.predicate = predicate;
71 | }
72 |
73 | public override void Execute(TextArea textArea)
74 | {
75 | textArea.Document.BookmarkManager.RemoveMarks(predicate);
76 | textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea));
77 | textArea.Document.CommitUpdate();
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Actions/ClipBoardActions.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 |
10 | namespace ICSharpCode.TextEditor.Actions
11 | {
12 | public class Cut : AbstractEditAction
13 | {
14 | public override void Execute(TextArea textArea)
15 | {
16 | if (textArea.Document.ReadOnly) {
17 | return;
18 | }
19 | textArea.ClipboardHandler.Cut(null, null);
20 | }
21 | }
22 |
23 | public class Copy : AbstractEditAction
24 | {
25 | public override void Execute(TextArea textArea)
26 | {
27 | textArea.AutoClearSelection = false;
28 | textArea.ClipboardHandler.Copy(null, null);
29 | }
30 | }
31 |
32 | public class Paste : AbstractEditAction
33 | {
34 | public override void Execute(TextArea textArea)
35 | {
36 | if (textArea.Document.ReadOnly) {
37 | return;
38 | }
39 | textArea.ClipboardHandler.Paste(null, null);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Actions/FindAndReplaceFormActions.cs:
--------------------------------------------------------------------------------
1 | using ICSharpCode.TextEditor.Actions;
2 | using ICSharpCode.TextEditor.UserControls;
3 |
4 | namespace ICSharpCode.TextEditor.Src.Actions
5 | {
6 | abstract class FindAndReplaceFormActions : AbstractEditAction
7 | {
8 | protected readonly TextEditorControlEx Control;
9 | protected readonly FindAndReplaceForm FindForm;
10 |
11 | protected FindAndReplaceFormActions(FindAndReplaceForm findForm, TextEditorControlEx control)
12 | {
13 | FindForm = findForm;
14 | Control = control;
15 | }
16 | }
17 |
18 | class FindAgainReverseAction : FindAndReplaceFormActions
19 | {
20 | public FindAgainReverseAction(FindAndReplaceForm findForm, TextEditorControlEx control)
21 | : base(findForm, control)
22 | {
23 | }
24 |
25 | public override void Execute(TextArea textArea)
26 | {
27 | FindForm.FindNext(true, true, string.Format("Search text «{0}» not found.", FindForm.LookFor));
28 | }
29 | }
30 |
31 | class FindAgainAction : FindAndReplaceFormActions
32 | {
33 | public FindAgainAction(FindAndReplaceForm findForm, TextEditorControlEx control)
34 | : base(findForm, control)
35 | {
36 | }
37 |
38 | public override void Execute(TextArea textArea)
39 | {
40 | FindForm.FindNext(true, false, string.Format("Search text «{0}» not found.", FindForm.LookFor));
41 | }
42 | }
43 |
44 | class EditReplaceAction : FindAndReplaceFormActions
45 | {
46 | public EditReplaceAction(FindAndReplaceForm findForm, TextEditorControlEx control)
47 | : base(findForm, control)
48 | {
49 | }
50 |
51 | public override void Execute(TextArea textArea)
52 | {
53 | FindForm.ShowFor(Control, true);
54 | }
55 | }
56 |
57 | class EditFindAction : FindAndReplaceFormActions
58 | {
59 | public EditFindAction(FindAndReplaceForm findForm, TextEditorControlEx control)
60 | : base(findForm, control)
61 | {
62 | }
63 |
64 | public override void Execute(TextArea textArea)
65 | {
66 | FindForm.ShowFor(Control, false);
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Actions/FoldActions.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Collections.Generic;
10 | using ICSharpCode.TextEditor.Document;
11 |
12 | namespace ICSharpCode.TextEditor.Actions
13 | {
14 | public class ToggleFolding : AbstractEditAction
15 | {
16 | public override void Execute(TextArea textArea)
17 | {
18 | List foldMarkers = textArea.Document.FoldingManager.GetFoldingsWithStart(textArea.Caret.Line);
19 | if (foldMarkers.Count != 0) {
20 | foreach (FoldMarker fm in foldMarkers)
21 | fm.IsFolded = !fm.IsFolded;
22 | } else {
23 | foldMarkers = textArea.Document.FoldingManager.GetFoldingsContainsLineNumber(textArea.Caret.Line);
24 | if (foldMarkers.Count != 0) {
25 | FoldMarker innerMost = foldMarkers[0];
26 | for (int i = 1; i < foldMarkers.Count; i++) {
27 | if (new TextLocation(foldMarkers[i].StartColumn, foldMarkers[i].StartLine) >
28 | new TextLocation(innerMost.StartColumn, innerMost.StartLine))
29 | {
30 | innerMost = foldMarkers[i];
31 | }
32 | }
33 | innerMost.IsFolded = !innerMost.IsFolded;
34 | }
35 | }
36 | textArea.Document.FoldingManager.NotifyFoldingsChanged(EventArgs.Empty);
37 | }
38 | }
39 |
40 | public class ToggleAllFoldings : AbstractEditAction
41 | {
42 | public override void Execute(TextArea textArea)
43 | {
44 | bool doFold = true;
45 | foreach (FoldMarker fm in textArea.Document.FoldingManager.FoldMarker) {
46 | if (fm.IsFolded) {
47 | doFold = false;
48 | break;
49 | }
50 | }
51 | foreach (FoldMarker fm in textArea.Document.FoldingManager.FoldMarker) {
52 | fm.IsFolded = doFold;
53 | }
54 | textArea.Document.FoldingManager.NotifyFoldingsChanged(EventArgs.Empty);
55 | }
56 | }
57 |
58 | public class ShowDefinitionsOnly : AbstractEditAction
59 | {
60 | public override void Execute(TextArea textArea)
61 | {
62 | foreach (FoldMarker fm in textArea.Document.FoldingManager.FoldMarker) {
63 | fm.IsFolded = fm.FoldType == FoldType.MemberBody || fm.FoldType == FoldType.Region;
64 | }
65 | textArea.Document.FoldingManager.NotifyFoldingsChanged(EventArgs.Empty);
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Actions/GoToLineNumberAction.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 | using ICSharpCode.TextEditor.Actions;
3 | using ICSharpCode.TextEditor.UserControls;
4 |
5 | namespace ICSharpCode.TextEditor.Src.Actions
6 | {
7 | class GoToLineNumberAction : AbstractEditAction
8 | {
9 | private readonly GotoForm _gotoForm;
10 |
11 | public GoToLineNumberAction()
12 | {
13 | _gotoForm = new GotoForm();
14 | }
15 |
16 | public override void Execute(TextArea textArea)
17 | {
18 | _gotoForm.FirstLineNumber = 1;
19 | _gotoForm.LastLineNumber = textArea.Document.TotalNumberOfLines;
20 | _gotoForm.SelectedLineNumber = textArea.Caret.Line + 1;
21 |
22 | if (DialogResult.OK == _gotoForm.ShowDialogEx() && _gotoForm.SelectedLineNumber > 0)
23 | {
24 | textArea.Caret.Position = new TextLocation(0, _gotoForm.SelectedLineNumber - 1);
25 | }
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Actions/IEditAction.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Windows.Forms;
10 |
11 | namespace ICSharpCode.TextEditor.Actions
12 | {
13 | ///
14 | /// To define a new key for the textarea, you must write a class which
15 | /// implements this interface.
16 | ///
17 | public interface IEditAction
18 | {
19 | ///
20 | /// An array of keys on which this edit action occurs.
21 | ///
22 | Keys[] Keys {
23 | get;
24 | set;
25 | }
26 |
27 | ///
28 | /// When the key which is defined per XML is pressed, this method will be launched.
29 | ///
30 | void Execute(TextArea textArea);
31 | }
32 |
33 | ///
34 | /// To define a new key for the textarea, you must write a class which
35 | /// implements this interface.
36 | ///
37 | public abstract class AbstractEditAction : IEditAction
38 | {
39 | Keys[] keys = null;
40 |
41 | ///
42 | /// An array of keys on which this edit action occurs.
43 | ///
44 | public Keys[] Keys {
45 | get {
46 | return keys;
47 | }
48 | set {
49 | keys = value;
50 | }
51 | }
52 |
53 | ///
54 | /// When the key which is defined per XML is pressed, this method will be launched.
55 | ///
56 | public abstract void Execute(TextArea textArea);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/AbstractSegment.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 |
10 | namespace ICSharpCode.TextEditor.Document
11 | {
12 | ///
13 | /// This interface is used to describe a span inside a text sequence
14 | ///
15 | public class AbstractSegment : ISegment
16 | {
17 | [CLSCompliant(false)]
18 | protected int offset = -1;
19 | [CLSCompliant(false)]
20 | protected int length = -1;
21 |
22 | #region ICSharpCode.TextEditor.Document.ISegment interface implementation
23 | public virtual int Offset {
24 | get {
25 | return offset;
26 | }
27 | set {
28 | offset = value;
29 | }
30 | }
31 |
32 | public virtual int Length {
33 | get {
34 | return length;
35 | }
36 | set {
37 | length = value;
38 | }
39 | }
40 |
41 | #endregion
42 |
43 | public override string ToString()
44 | {
45 | return String.Format("[AbstractSegment: Offset = {0}, Length = {1}]",
46 | Offset,
47 | Length);
48 | }
49 |
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/BookmarkManager/BookmarkEventHandler.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 |
10 | namespace ICSharpCode.TextEditor.Document
11 | {
12 | public delegate void BookmarkEventHandler(object sender, BookmarkEventArgs e);
13 |
14 | ///
15 | /// Description of BookmarkEventHandler.
16 | ///
17 | public class BookmarkEventArgs : EventArgs
18 | {
19 | Bookmark bookmark;
20 |
21 | public Bookmark Bookmark {
22 | get {
23 | return bookmark;
24 | }
25 | }
26 |
27 | public BookmarkEventArgs(Bookmark bookmark)
28 | {
29 | this.bookmark = bookmark;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/DocumentFactory.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Text;
10 |
11 | namespace ICSharpCode.TextEditor.Document
12 | {
13 | ///
14 | /// This interface represents a container which holds a text sequence and
15 | /// all necessary information about it. It is used as the base for a text editor.
16 | ///
17 | public class DocumentFactory
18 | {
19 | ///
20 | /// Creates a new object. Only create
21 | /// with this method.
22 | ///
23 | public IDocument CreateDocument()
24 | {
25 | DefaultDocument doc = new DefaultDocument();
26 | doc.TextBufferStrategy = new GapTextBufferStrategy();
27 | doc.FormattingStrategy = new DefaultFormattingStrategy();
28 | doc.LineManager = new LineManager(doc, null);
29 | doc.FoldingManager = new FoldingManager(doc, doc.LineManager);
30 | doc.FoldingManager.FoldingStrategy = null; //new ParserFoldingStrategy();
31 | doc.MarkerStrategy = new MarkerStrategy(doc);
32 | doc.BookmarkManager = new BookmarkManager(doc, doc.LineManager);
33 | return doc;
34 | }
35 |
36 | ///
37 | /// Creates a new document and loads the given file
38 | ///
39 | public IDocument CreateFromTextBuffer(ITextBufferStrategy textBuffer)
40 | {
41 | DefaultDocument doc = (DefaultDocument)CreateDocument();
42 | doc.TextContent = textBuffer.GetText(0, textBuffer.Length);
43 | doc.TextBufferStrategy = textBuffer;
44 | return doc;
45 | }
46 |
47 | ///
48 | /// Creates a new document and loads the given file
49 | ///
50 | public IDocument CreateFromFile(string fileName)
51 | {
52 | IDocument document = CreateDocument();
53 | document.TextContent = Util.FileReader.ReadFileContent(fileName, Encoding.Default);
54 | return document;
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/FoldingStrategy/IFoldingStrategy.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Collections.Generic;
10 |
11 | namespace ICSharpCode.TextEditor.Document
12 | {
13 | ///
14 | /// This interface is used for the folding capabilities
15 | /// of the textarea.
16 | ///
17 | public interface IFoldingStrategy
18 | {
19 | ///
20 | /// Calculates the fold level of a specific line.
21 | ///
22 | List GenerateFoldMarkers(IDocument document, string fileName, object parseInformation);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/FoldingStrategy/IFoldingStrategyEx.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using ICSharpCode.TextEditor.Document;
3 |
4 | namespace ICSharpCode.TextEditor.Src.Document.FoldingStrategy
5 | {
6 | public interface IFoldingStrategyEx : IFoldingStrategy
7 | {
8 | List GetFoldingErrors();
9 | }
10 | }
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/FoldingStrategy/IndentFoldingStrategy.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Collections.Generic;
10 |
11 | namespace ICSharpCode.TextEditor.Document
12 | {
13 | ///
14 | /// A simple folding strategy which calculates the folding level
15 | /// using the indent level of the line.
16 | ///
17 | public class IndentFoldingStrategy : IFoldingStrategy
18 | {
19 | public List GenerateFoldMarkers(IDocument document, string fileName, object parseInformation)
20 | {
21 | List l = new List();
22 | Stack offsetStack = new Stack();
23 | Stack textStack = new Stack();
24 | //int level = 0;
25 | //foreach (LineSegment segment in document.LineSegmentCollection) {
26 | //
27 | //}
28 | return l;
29 | }
30 |
31 | int GetLevel(IDocument document, int offset)
32 | {
33 | int level = 0;
34 | int spaces = 0;
35 | for (int i = offset; i < document.TextLength; ++i) {
36 | char c = document.GetCharAt(i);
37 | if (c == '\t' || (c == ' ' && ++spaces == 4)) {
38 | spaces = 0;
39 | ++level;
40 | } else {
41 | break;
42 | }
43 | }
44 | return level;
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/HighlightingStrategy/HighlightBackground.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Drawing;
10 | using System.Xml;
11 |
12 | namespace ICSharpCode.TextEditor.Document
13 | {
14 | ///
15 | /// Extens the highlighting color with a background image.
16 | ///
17 | public class HighlightBackground : HighlightColor
18 | {
19 | Image backgroundImage;
20 |
21 | ///
22 | /// The image used as background
23 | ///
24 | public Image BackgroundImage {
25 | get {
26 | return backgroundImage;
27 | }
28 | }
29 |
30 | ///
31 | /// Creates a new instance of
32 | ///
33 | public HighlightBackground(XmlElement el) : base(el)
34 | {
35 | if (el.Attributes["image"] != null) {
36 | backgroundImage = new Bitmap(el.Attributes["image"].InnerText);
37 | }
38 | }
39 |
40 | ///
41 | /// Creates a new instance of
42 | ///
43 | public HighlightBackground(Color color, Color backgroundcolor, bool bold, bool italic) : base(color, backgroundcolor, bold, italic)
44 | {
45 | }
46 |
47 | public HighlightBackground(string systemColor, string systemBackgroundColor, bool bold, bool italic) : base(systemColor, systemBackgroundColor, bold, italic)
48 | {
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/HighlightingStrategy/HighlightInfo.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 |
10 | namespace ICSharpCode.TextEditor.Document
11 | {
12 | public class HighlightInfo
13 | {
14 | public bool BlockSpanOn = false;
15 | public bool Span = false;
16 | public Span CurSpan = null;
17 |
18 | public HighlightInfo(Span curSpan, bool span, bool blockSpanOn)
19 | {
20 | this.CurSpan = curSpan;
21 | this.Span = span;
22 | this.BlockSpanOn = blockSpanOn;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/HighlightingStrategy/HighlightingColorNotFoundException.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Runtime.Serialization;
10 |
11 | namespace ICSharpCode.TextEditor.Document
12 | {
13 | [Serializable()]
14 | public class HighlightingColorNotFoundException : Exception
15 | {
16 | public HighlightingColorNotFoundException() : base()
17 | {
18 | }
19 |
20 | public HighlightingColorNotFoundException(string message) : base(message)
21 | {
22 | }
23 |
24 | public HighlightingColorNotFoundException(string message, Exception innerException) : base(message, innerException)
25 | {
26 | }
27 |
28 | protected HighlightingColorNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context)
29 | {
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/HighlightingStrategy/HighlightingDefinitionInvalidException.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Runtime.Serialization;
10 |
11 | namespace ICSharpCode.TextEditor.Document
12 | {
13 | ///
14 | /// Indicates that the highlighting definition that was tried to load was invalid.
15 | /// You get this exception only once per highlighting definition, after that the definition
16 | /// is replaced with the default highlighter.
17 | ///
18 | [Serializable()]
19 | public class HighlightingDefinitionInvalidException : Exception
20 | {
21 | public HighlightingDefinitionInvalidException() : base()
22 | {
23 | }
24 |
25 | public HighlightingDefinitionInvalidException(string message) : base(message)
26 | {
27 | }
28 |
29 | public HighlightingDefinitionInvalidException(string message, Exception innerException) : base(message, innerException)
30 | {
31 | }
32 |
33 | protected HighlightingDefinitionInvalidException(SerializationInfo info, StreamingContext context) : base(info, context)
34 | {
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/HighlightingStrategy/HighlightingStrategyFactory.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 |
10 | namespace ICSharpCode.TextEditor.Document
11 | {
12 | public class HighlightingStrategyFactory
13 | {
14 | public static IHighlightingStrategy CreateHighlightingStrategy()
15 | {
16 | return (IHighlightingStrategy)HighlightingManager.Manager.HighlightingDefinitions["Default"];
17 | }
18 |
19 | public static IHighlightingStrategy CreateHighlightingStrategy(string name)
20 | {
21 | IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighter(name);
22 |
23 | if (highlightingStrategy == null) {
24 | return CreateHighlightingStrategy();
25 | }
26 | return highlightingStrategy;
27 | }
28 |
29 | public static IHighlightingStrategy CreateHighlightingStrategyForFile(string fileName)
30 | {
31 | IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighterForFile(fileName);
32 | if (highlightingStrategy == null) {
33 | return CreateHighlightingStrategy();
34 | }
35 | return highlightingStrategy;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/HighlightingStrategy/IHighlightingStrategy.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Collections.Generic;
10 |
11 | namespace ICSharpCode.TextEditor.Document
12 | {
13 | ///
14 | /// A highlighting strategy for a buffer.
15 | ///
16 | public interface IHighlightingStrategy
17 | {
18 | ///
19 | /// The name of the highlighting strategy, must be unique
20 | ///
21 | string Name {
22 | get;
23 | }
24 |
25 | ///
26 | /// The file extenstions on which this highlighting strategy gets
27 | /// used
28 | ///
29 | string[] Extensions {
30 | get;
31 | }
32 |
33 | Dictionary Properties {
34 | get;
35 | }
36 |
37 | // returns special color. (BackGround Color, Cursor Color and so on)
38 |
39 | ///
40 | /// Gets the color of an Environment element.
41 | ///
42 | HighlightColor GetColorFor(string name);
43 |
44 | ///
45 | /// Used internally, do not call
46 | ///
47 | void MarkTokens(IDocument document, List lines);
48 |
49 | ///
50 | /// Used internally, do not call
51 | ///
52 | void MarkTokens(IDocument document);
53 | }
54 |
55 | public interface IHighlightingStrategyUsingRuleSets : IHighlightingStrategy
56 | {
57 | ///
58 | /// Used internally, do not call
59 | ///
60 | HighlightRuleSet GetRuleSet(Span span);
61 |
62 | ///
63 | /// Used internally, do not call
64 | ///
65 | HighlightColor GetColor(IDocument document, LineSegment keyWord, int index, int length);
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/HighlightingStrategy/NextMarker.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Xml;
10 |
11 | namespace ICSharpCode.TextEditor.Document
12 | {
13 | ///
14 | /// Used for mark next token
15 | ///
16 | public class NextMarker
17 | {
18 | string what;
19 | HighlightColor color;
20 | bool markMarker = false;
21 |
22 | ///
23 | /// String value to indicate to mark next token
24 | ///
25 | public string What {
26 | get {
27 | return what;
28 | }
29 | }
30 |
31 | ///
32 | /// Color for marking next token
33 | ///
34 | public HighlightColor Color {
35 | get {
36 | return color;
37 | }
38 | }
39 |
40 | ///
41 | /// If true the indication text will be marked with the same color
42 | /// too
43 | ///
44 | public bool MarkMarker {
45 | get {
46 | return markMarker;
47 | }
48 | }
49 |
50 | ///
51 | /// Creates a new instance of
52 | ///
53 | public NextMarker(XmlElement mark)
54 | {
55 | color = new HighlightColor(mark);
56 | what = mark.InnerText;
57 | if (mark.Attributes["markmarker"] != null) {
58 | markMarker = Boolean.Parse(mark.Attributes["markmarker"].InnerText);
59 | }
60 | }
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/HighlightingStrategy/PrevMarker.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Xml;
10 |
11 | namespace ICSharpCode.TextEditor.Document
12 | {
13 | ///
14 | /// Used for mark previous token
15 | ///
16 | public class PrevMarker
17 | {
18 | string what;
19 | HighlightColor color;
20 | bool markMarker = false;
21 |
22 | ///
23 | /// String value to indicate to mark previous token
24 | ///
25 | public string What {
26 | get {
27 | return what;
28 | }
29 | }
30 |
31 | ///
32 | /// Color for marking previous token
33 | ///
34 | public HighlightColor Color {
35 | get {
36 | return color;
37 | }
38 | }
39 |
40 | ///
41 | /// If true the indication text will be marked with the same color
42 | /// too
43 | ///
44 | public bool MarkMarker {
45 | get {
46 | return markMarker;
47 | }
48 | }
49 |
50 | ///
51 | /// Creates a new instance of
52 | ///
53 | public PrevMarker(XmlElement mark)
54 | {
55 | color = new HighlightColor(mark);
56 | what = mark.InnerText;
57 | if (mark.Attributes["markmarker"] != null) {
58 | markMarker = Boolean.Parse(mark.Attributes["markmarker"].InnerText);
59 | }
60 | }
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/HighlightingStrategy/SpanStack.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Collections.Generic;
10 |
11 | namespace ICSharpCode.TextEditor.Document
12 | {
13 | ///
14 | /// A stack of Span instances. Works like Stack<Span>, but can be cloned quickly
15 | /// because it is implemented as linked list.
16 | ///
17 | public sealed class SpanStack : ICloneable, IEnumerable
18 | {
19 | internal sealed class StackNode
20 | {
21 | public readonly StackNode Previous;
22 | public readonly Span Data;
23 |
24 | public StackNode(StackNode previous, Span data)
25 | {
26 | this.Previous = previous;
27 | this.Data = data;
28 | }
29 | }
30 |
31 | StackNode top = null;
32 |
33 | public Span Pop()
34 | {
35 | Span s = top.Data;
36 | top = top.Previous;
37 | return s;
38 | }
39 |
40 | public Span Peek()
41 | {
42 | return top.Data;
43 | }
44 |
45 | public void Push(Span s)
46 | {
47 | top = new StackNode(top, s);
48 | }
49 |
50 | public bool IsEmpty {
51 | get {
52 | return top == null;
53 | }
54 | }
55 |
56 | public SpanStack Clone()
57 | {
58 | SpanStack n = new SpanStack();
59 | n.top = this.top;
60 | return n;
61 | }
62 | object ICloneable.Clone()
63 | {
64 | return this.Clone();
65 | }
66 |
67 | public Enumerator GetEnumerator()
68 | {
69 | return new Enumerator(new StackNode(top, null));
70 | }
71 | IEnumerator IEnumerable.GetEnumerator()
72 | {
73 | return this.GetEnumerator();
74 | }
75 | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
76 | {
77 | return this.GetEnumerator();
78 | }
79 |
80 | public struct Enumerator : IEnumerator
81 | {
82 | StackNode c;
83 |
84 | internal Enumerator(StackNode node)
85 | {
86 | c = node;
87 | }
88 |
89 | public Span Current {
90 | get {
91 | return c.Data;
92 | }
93 | }
94 |
95 | object System.Collections.IEnumerator.Current {
96 | get {
97 | return c.Data;
98 | }
99 | }
100 |
101 | public void Dispose()
102 | {
103 | c = null;
104 | }
105 |
106 | public bool MoveNext()
107 | {
108 | c = c.Previous;
109 | return c != null;
110 | }
111 |
112 | public void Reset()
113 | {
114 | throw new NotSupportedException();
115 | }
116 | }
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/HighlightingStrategy/SyntaxModes/ISyntaxModeFileProvider.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Collections.Generic;
10 | using System.Xml;
11 |
12 | namespace ICSharpCode.TextEditor.Document
13 | {
14 | public interface ISyntaxModeFileProvider
15 | {
16 | ICollection SyntaxModes {
17 | get;
18 | }
19 |
20 | XmlTextReader GetSyntaxModeFile(SyntaxMode syntaxMode);
21 | void UpdateSyntaxModeList();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/HighlightingStrategy/SyntaxModes/ResourceSyntaxModeProvider.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Collections.Generic;
10 | using System.IO;
11 | using System.Reflection;
12 | using System.Xml;
13 |
14 | namespace ICSharpCode.TextEditor.Document
15 | {
16 | public class ResourceSyntaxModeProvider : ISyntaxModeFileProvider
17 | {
18 | List syntaxModes = null;
19 |
20 | public ICollection SyntaxModes {
21 | get {
22 | return syntaxModes;
23 | }
24 | }
25 |
26 | public ResourceSyntaxModeProvider()
27 | {
28 | Assembly assembly = typeof(SyntaxMode).Assembly;
29 | Stream syntaxModeStream = assembly.GetManifestResourceStream("ICSharpCode.TextEditorEx.Resources.SyntaxModes.xml");
30 | if (syntaxModeStream != null) {
31 | syntaxModes = SyntaxMode.GetSyntaxModes(syntaxModeStream);
32 | } else {
33 | syntaxModes = new List();
34 | }
35 | }
36 |
37 | public XmlTextReader GetSyntaxModeFile(SyntaxMode syntaxMode)
38 | {
39 | Assembly assembly = typeof(SyntaxMode).Assembly;
40 | return new XmlTextReader(assembly.GetManifestResourceStream("ICSharpCode.TextEditorEx.Resources." + syntaxMode.FileName));
41 | }
42 |
43 | public void UpdateSyntaxModeList()
44 | {
45 | // resources don't change during runtime
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/HighlightingStrategy/SyntaxModes/ResourceSyntaxModeProviderEx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Reflection;
5 | using System.Xml;
6 | using ICSharpCode.TextEditor.Document;
7 |
8 | namespace ICSharpCode.TextEditor.Src.Document.HighlightingStrategy.SyntaxModes
9 | {
10 | public class ResourceSyntaxModeProviderEx : ISyntaxModeFileProvider
11 | {
12 | private string ResourcesDir = "ICSharpCode.TextEditorEx.Resources.";
13 |
14 | readonly List _syntaxModes;
15 |
16 | public ICollection SyntaxModes
17 | {
18 | get
19 | {
20 | return _syntaxModes;
21 | }
22 | }
23 |
24 | public ResourceSyntaxModeProviderEx()
25 | {
26 | var syntaxModeStream = GetSyntaxModeStream("SyntaxModesEx.xml");
27 |
28 | _syntaxModes = syntaxModeStream != null ? SyntaxMode.GetSyntaxModes(syntaxModeStream) : new List();
29 | }
30 |
31 | public XmlTextReader GetSyntaxModeFile(SyntaxMode syntaxMode)
32 | {
33 | var stream = GetSyntaxModeStream(syntaxMode.FileName);
34 |
35 | return stream != null ? new XmlTextReader(stream) : null;
36 | }
37 |
38 | public void UpdateSyntaxModeList()
39 | {
40 | // resources don't change during runtime
41 | }
42 |
43 | private Stream GetSyntaxModeStream(string filename)
44 | {
45 | Assembly assembly = Assembly.GetExecutingAssembly();
46 | //String projectName = Assembly.GetExecutingAssembly().GetName().Name.ToString();
47 | //ResourcesDir = Assembly.GetExecutingAssembly().GetName().Name.ToString();
48 | //Stream stmMode = Assembly.GetExecutingAssembly().GetManifestResourceStream(projectName + ".Resources" + "."+ filename);
49 | Stream stmMode = assembly.GetManifestResourceStream(string.Format("{0}{1}", ResourcesDir, filename));
50 | return stmMode;
51 | //return assembly.GetManifestResourceStream(string.Format("{0}{1}", ResourcesDir, filename));
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/ISegment.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | namespace ICSharpCode.TextEditor.Document
9 | {
10 | ///
11 | /// This interface is used to describe a span inside a text sequence
12 | ///
13 | public interface ISegment
14 | {
15 | ///
16 | /// The offset where the span begins
17 | ///
18 | int Offset {
19 | get;
20 | set;
21 | }
22 |
23 | ///
24 | /// The length of the span
25 | ///
26 | int Length {
27 | get;
28 | set;
29 | }
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/LineManager/DeferredEventList.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 | using System;
8 | using System.Collections.Generic;
9 |
10 | namespace ICSharpCode.TextEditor.Document
11 | {
12 | ///
13 | /// A list of events that are fired after the line manager has finished working.
14 | ///
15 | struct DeferredEventList
16 | {
17 | internal List removedLines;
18 | internal List textAnchor;
19 |
20 | public void AddRemovedLine(LineSegment line)
21 | {
22 | if (removedLines == null)
23 | removedLines = new List();
24 | removedLines.Add(line);
25 | }
26 |
27 | public void AddDeletedAnchor(TextAnchor anchor)
28 | {
29 | if (textAnchor == null)
30 | textAnchor = new List();
31 | textAnchor.Add(anchor);
32 | }
33 |
34 | public void RaiseEvents()
35 | {
36 | // removedLines is raised by the LineManager
37 | if (textAnchor != null) {
38 | foreach (TextAnchor a in textAnchor) {
39 | a.RaiseDeleted();
40 | }
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/LineManager/LineManagerEventArgs.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 |
10 | namespace ICSharpCode.TextEditor.Document
11 | {
12 | public class LineCountChangeEventArgs : EventArgs
13 | {
14 | IDocument document;
15 | int start;
16 | int moved;
17 |
18 | ///
19 | /// always a valid Document which is related to the Event.
20 | ///
21 | public IDocument Document {
22 | get {
23 | return document;
24 | }
25 | }
26 |
27 | ///
28 | /// -1 if no offset was specified for this event
29 | ///
30 | public int LineStart {
31 | get {
32 | return start;
33 | }
34 | }
35 |
36 | ///
37 | /// -1 if no length was specified for this event
38 | ///
39 | public int LinesMoved {
40 | get {
41 | return moved;
42 | }
43 | }
44 |
45 | public LineCountChangeEventArgs(IDocument document, int lineStart, int linesMoved)
46 | {
47 | this.document = document;
48 | this.start = lineStart;
49 | this.moved = linesMoved;
50 | }
51 | }
52 |
53 | public class LineEventArgs : EventArgs
54 | {
55 | IDocument document;
56 | LineSegment lineSegment;
57 |
58 | public IDocument Document {
59 | get { return document; }
60 | }
61 |
62 | public LineSegment LineSegment {
63 | get { return lineSegment; }
64 | }
65 |
66 | public LineEventArgs(IDocument document, LineSegment lineSegment)
67 | {
68 | this.document = document;
69 | this.lineSegment = lineSegment;
70 | }
71 |
72 | public override string ToString()
73 | {
74 | return string.Format("[LineEventArgs Document={0} LineSegment={1}]", this.document, this.lineSegment);
75 | }
76 | }
77 |
78 | public class LineLengthChangeEventArgs : LineEventArgs
79 | {
80 | int lengthDelta;
81 |
82 | public int LengthDelta {
83 | get { return lengthDelta; }
84 | }
85 |
86 | public LineLengthChangeEventArgs(IDocument document, LineSegment lineSegment, int moved)
87 | : base(document, lineSegment)
88 | {
89 | this.lengthDelta = moved;
90 | }
91 |
92 | public override string ToString()
93 | {
94 | return string.Format("[LineLengthEventArgs Document={0} LineSegment={1} LengthDelta={2}]", this.Document, this.LineSegment, this.lengthDelta);
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/MarkerStrategy/TextMarker.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Drawing;
10 |
11 | namespace ICSharpCode.TextEditor.Document
12 | {
13 | public enum TextMarkerType
14 | {
15 | Invisible,
16 | SolidBlock,
17 | Underlined,
18 | WaveLine
19 | }
20 |
21 | ///
22 | /// Marks a part of a document.
23 | ///
24 | public class TextMarker : AbstractSegment
25 | {
26 | TextMarkerType textMarkerType;
27 | Color color;
28 | Color foreColor;
29 | string toolTip = null;
30 | bool overrideForeColor = false;
31 |
32 | public TextMarkerType TextMarkerType {
33 | get {
34 | return textMarkerType;
35 | }
36 | }
37 |
38 | public Color Color {
39 | get {
40 | return color;
41 | }
42 | }
43 |
44 | public Color ForeColor {
45 | get {
46 | return foreColor;
47 | }
48 | }
49 |
50 | public bool OverrideForeColor {
51 | get {
52 | return overrideForeColor;
53 | }
54 | }
55 |
56 | ///
57 | /// Marks the text segment as read-only.
58 | ///
59 | public bool IsReadOnly { get; set; }
60 |
61 | public string ToolTip {
62 | get {
63 | return toolTip;
64 | }
65 | set {
66 | toolTip = value;
67 | }
68 | }
69 |
70 | ///
71 | /// Gets the last offset that is inside the marker region.
72 | ///
73 | public int EndOffset {
74 | get {
75 | return Offset + Length - 1;
76 | }
77 | }
78 |
79 | public TextMarker(int offset, int length, TextMarkerType textMarkerType) : this(offset, length, textMarkerType, Color.Red)
80 | {
81 | }
82 |
83 | public TextMarker(int offset, int length, TextMarkerType textMarkerType, Color color)
84 | {
85 | if (length < 1) length = 1;
86 | this.offset = offset;
87 | this.length = length;
88 | this.textMarkerType = textMarkerType;
89 | this.color = color;
90 | }
91 |
92 | public TextMarker(int offset, int length, TextMarkerType textMarkerType, Color color, Color foreColor)
93 | {
94 | if (length < 1) length = 1;
95 | this.offset = offset;
96 | this.length = length;
97 | this.textMarkerType = textMarkerType;
98 | this.color = color;
99 | this.foreColor = foreColor;
100 | this.overrideForeColor = true;
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/Selection/ColumnRange.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 |
10 | namespace ICSharpCode.TextEditor.Document
11 | {
12 | public class ColumnRange
13 | {
14 | public static readonly ColumnRange NoColumn = new ColumnRange(-2, -2);
15 | public static readonly ColumnRange WholeColumn = new ColumnRange(-1, -1);
16 |
17 | int startColumn;
18 | int endColumn;
19 |
20 | public int StartColumn {
21 | get {
22 | return startColumn;
23 | }
24 | set {
25 | startColumn = value;
26 | }
27 | }
28 |
29 | public int EndColumn {
30 | get {
31 | return endColumn;
32 | }
33 | set {
34 | endColumn = value;
35 | }
36 | }
37 |
38 | public ColumnRange(int startColumn, int endColumn)
39 | {
40 | this.startColumn = startColumn;
41 | this.endColumn = endColumn;
42 |
43 | }
44 |
45 | public override int GetHashCode()
46 | {
47 | return startColumn + (endColumn << 16);
48 | }
49 |
50 | public override bool Equals(object obj)
51 | {
52 | if (obj is ColumnRange) {
53 | return ((ColumnRange)obj).startColumn == startColumn &&
54 | ((ColumnRange)obj).endColumn == endColumn;
55 |
56 | }
57 | return false;
58 | }
59 |
60 | public override string ToString()
61 | {
62 | return String.Format("[ColumnRange: StartColumn={0}, EndColumn={1}]", startColumn, endColumn);
63 | }
64 |
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/Selection/ISelection.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System.Drawing;
9 |
10 | namespace ICSharpCode.TextEditor.Document
11 | {
12 | ///
13 | /// An interface representing a portion of the current selection.
14 | ///
15 | public interface ISelection
16 | {
17 | TextLocation StartPosition {
18 | get;
19 | set;
20 | }
21 |
22 | TextLocation EndPosition {
23 | get;
24 | set;
25 | }
26 |
27 | int Offset {
28 | get;
29 | }
30 |
31 | int EndOffset {
32 | get;
33 | }
34 |
35 | int Length {
36 | get;
37 | }
38 |
39 | ///
40 | /// Returns true, if the selection is rectangular
41 | ///
42 | bool IsRectangularSelection {
43 | get;
44 | }
45 |
46 | ///
47 | /// Returns true, if the selection is empty
48 | ///
49 | bool IsEmpty {
50 | get;
51 | }
52 |
53 | ///
54 | /// The text which is selected by this selection.
55 | ///
56 | string SelectedText {
57 | get;
58 | }
59 |
60 | bool ContainsOffset(int offset);
61 |
62 | bool ContainsPosition(TextLocation position);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/TextBufferStrategy/ITextBufferStrategy.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | namespace ICSharpCode.TextEditor.Document
9 | {
10 | ///
11 | /// Interface to describe a sequence of characters that can be edited.
12 | ///
13 | public interface ITextBufferStrategy
14 | {
15 | ///
16 | /// The current length of the sequence of characters that can be edited.
17 | ///
18 | int Length {
19 | get;
20 | }
21 |
22 | ///
23 | /// Inserts a string of characters into the sequence.
24 | ///
25 | ///
26 | /// offset where to insert the string.
27 | ///
28 | ///
29 | /// text to be inserted.
30 | ///
31 | void Insert(int offset, string text);
32 |
33 | ///
34 | /// Removes some portion of the sequence.
35 | ///
36 | ///
37 | /// offset of the remove.
38 | ///
39 | ///
40 | /// number of characters to remove.
41 | ///
42 | void Remove(int offset, int length);
43 |
44 | ///
45 | /// Replace some portion of the sequence.
46 | ///
47 | ///
48 | /// offset.
49 | ///
50 | ///
51 | /// number of characters to replace.
52 | ///
53 | ///
54 | /// text to be replaced with.
55 | ///
56 | void Replace(int offset, int length, string text);
57 |
58 | ///
59 | /// Fetches a string of characters contained in the sequence.
60 | ///
61 | ///
62 | /// Offset into the sequence to fetch
63 | ///
64 | ///
65 | /// number of characters to copy.
66 | ///
67 | string GetText(int offset, int length);
68 |
69 | ///
70 | /// Returns a specific char of the sequence.
71 | ///
72 | ///
73 | /// Offset of the char to get.
74 | ///
75 | char GetCharAt(int offset);
76 |
77 | ///
78 | /// This method sets the stored content.
79 | ///
80 | ///
81 | /// The string that represents the character sequence.
82 | ///
83 | void SetContent(string text);
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Document/TextBufferStrategy/StringTextBufferStrategy.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.IO;
10 | using System.Text;
11 |
12 | namespace ICSharpCode.TextEditor.Document
13 | {
14 | ///
15 | /// Simple implementation of the ITextBuffer interface implemented using a
16 | /// string.
17 | /// Only for fall-back purposes.
18 | ///
19 | public class StringTextBufferStrategy : ITextBufferStrategy
20 | {
21 | string storedText = "";
22 |
23 | public int Length {
24 | get {
25 | return storedText.Length;
26 | }
27 | }
28 |
29 | public void Insert(int offset, string text)
30 | {
31 | if (text != null) {
32 | storedText = storedText.Insert(offset, text);
33 | }
34 | }
35 |
36 | public void Remove(int offset, int length)
37 | {
38 | storedText = storedText.Remove(offset, length);
39 | }
40 |
41 | public void Replace(int offset, int length, string text)
42 | {
43 | Remove(offset, length);
44 | Insert(offset, text);
45 | }
46 |
47 | public string GetText(int offset, int length)
48 | {
49 | if (length == 0) {
50 | return "";
51 | }
52 | if (offset == 0 && length >= storedText.Length) {
53 | return storedText;
54 | }
55 | return storedText.Substring(offset, Math.Min(length, storedText.Length - offset));
56 | }
57 |
58 | public char GetCharAt(int offset)
59 | {
60 | if (offset == Length) {
61 | return '\0';
62 | }
63 | return storedText[offset];
64 | }
65 |
66 | public void SetContent(string text)
67 | {
68 | storedText = text;
69 | }
70 |
71 | public StringTextBufferStrategy()
72 | {
73 | }
74 |
75 | public static ITextBufferStrategy CreateTextBufferFromFile(string fileName)
76 | {
77 | if (!File.Exists(fileName)) {
78 | throw new System.IO.FileNotFoundException(fileName);
79 | }
80 | StringTextBufferStrategy s = new StringTextBufferStrategy();
81 | s.SetContent(Util.FileReader.ReadFileContent(fileName, Encoding.Default));
82 | return s;
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Gui/BracketHighlighter.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Drawing;
10 | using ICSharpCode.TextEditor.Document;
11 |
12 | namespace ICSharpCode.TextEditor
13 | {
14 | public class Highlight
15 | {
16 | public TextLocation OpenBrace { get; set; }
17 | public TextLocation CloseBrace { get; set; }
18 |
19 | public Highlight(TextLocation openBrace, TextLocation closeBrace)
20 | {
21 | this.OpenBrace = openBrace;
22 | this.CloseBrace = closeBrace;
23 | }
24 | }
25 |
26 | public class BracketHighlightingSheme
27 | {
28 | char opentag;
29 | char closingtag;
30 |
31 | public char OpenTag {
32 | get {
33 | return opentag;
34 | }
35 | set {
36 | opentag = value;
37 | }
38 | }
39 |
40 | public char ClosingTag {
41 | get {
42 | return closingtag;
43 | }
44 | set {
45 | closingtag = value;
46 | }
47 | }
48 |
49 | public BracketHighlightingSheme(char opentag, char closingtag)
50 | {
51 | this.opentag = opentag;
52 | this.closingtag = closingtag;
53 | }
54 |
55 | public Highlight GetHighlight(IDocument document, int offset)
56 | {
57 | int searchOffset;
58 | if (document.TextEditorProperties.BracketMatchingStyle == BracketMatchingStyle.After) {
59 | searchOffset = offset;
60 | } else {
61 | searchOffset = offset + 1;
62 | }
63 | char word = document.GetCharAt(Math.Max(0, Math.Min(document.TextLength - 1, searchOffset)));
64 |
65 | TextLocation endP = document.OffsetToPosition(searchOffset);
66 | if (word == opentag) {
67 | if (searchOffset < document.TextLength) {
68 | int bracketOffset = TextUtilities.SearchBracketForward(document, searchOffset + 1, opentag, closingtag);
69 | if (bracketOffset >= 0) {
70 | TextLocation p = document.OffsetToPosition(bracketOffset);
71 | return new Highlight(p, endP);
72 | }
73 | }
74 | } else if (word == closingtag) {
75 | if (searchOffset > 0) {
76 | int bracketOffset = TextUtilities.SearchBracketBackward(document, searchOffset - 1, opentag, closingtag);
77 | if (bracketOffset >= 0) {
78 | TextLocation p = document.OffsetToPosition(bracketOffset);
79 | return new Highlight(p, endP);
80 | }
81 | }
82 | }
83 | return null;
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Gui/BrushRegistry.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Collections;
10 | using System.Collections.Generic;
11 | using System.Drawing;
12 | using System.Drawing.Drawing2D;
13 |
14 | namespace ICSharpCode.TextEditor
15 | {
16 | ///
17 | /// Contains brushes/pens for the text editor to speed up drawing. Re-Creation of brushes and pens
18 | /// seems too costly.
19 | ///
20 | public class BrushRegistry
21 | {
22 | static Dictionary brushes = new Dictionary();
23 | static Dictionary pens = new Dictionary();
24 | static Dictionary dotPens = new Dictionary();
25 |
26 | public static Brush GetBrush(Color color)
27 | {
28 | lock (brushes) {
29 | Brush brush;
30 | if (!brushes.TryGetValue(color, out brush)) {
31 | brush = new SolidBrush(color);
32 | brushes.Add(color, brush);
33 | }
34 | return brush;
35 | }
36 | }
37 |
38 | public static Pen GetPen(Color color)
39 | {
40 | lock (pens) {
41 | Pen pen;
42 | if (!pens.TryGetValue(color, out pen)) {
43 | pen = new Pen(color);
44 | pens.Add(color, pen);
45 | }
46 | return pen;
47 | }
48 | }
49 |
50 | static readonly float[] dotPattern = { 1, 1, 1, 1 };
51 |
52 | public static Pen GetDotPen(Color color)
53 | {
54 | lock (dotPens) {
55 | Pen pen;
56 | if (!dotPens.TryGetValue(color, out pen)) {
57 | pen = new Pen(color);
58 | pen.DashPattern = dotPattern;
59 | dotPens.Add(color, pen);
60 | }
61 | return pen;
62 | }
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Gui/CompletionWindow/ICompletionDataProvider.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Windows.Forms;
10 |
11 | namespace ICSharpCode.TextEditor.Gui.CompletionWindow
12 | {
13 | public interface ICompletionDataProvider
14 | {
15 | ImageList ImageList {
16 | get;
17 | }
18 | string PreSelection {
19 | get;
20 | }
21 | ///
22 | /// Gets the index of the element in the list that is chosen by default.
23 | ///
24 | int DefaultIndex {
25 | get;
26 | }
27 |
28 | ///
29 | /// Processes a keypress. Returns the action to be run with the key.
30 | ///
31 | CompletionDataProviderKeyResult ProcessKey(char key);
32 |
33 | ///
34 | /// Executes the insertion. The provider should set the caret position and then
35 | /// call data.InsertAction.
36 | ///
37 | bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key);
38 |
39 | ///
40 | /// Generates the completion data. This method is called by the text editor control.
41 | ///
42 | ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped);
43 | }
44 |
45 | public enum CompletionDataProviderKeyResult
46 | {
47 | ///
48 | /// Normal key, used to choose an entry from the completion list
49 | ///
50 | NormalKey,
51 | ///
52 | /// This key triggers insertion of the completed expression
53 | ///
54 | InsertionKey,
55 | ///
56 | /// Increment both start and end offset of completion region when inserting this
57 | /// key. Can be used to insert whitespace (or other characters) in front of the expression
58 | /// while the completion window is open.
59 | ///
60 | BeforeStartKey
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Gui/HRuler.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Drawing;
10 | using System.Windows.Forms;
11 |
12 | namespace ICSharpCode.TextEditor
13 | {
14 | ///
15 | /// Horizontal ruler - text column measuring ruler at the top of the text area.
16 | ///
17 | public class HRuler : Control
18 | {
19 | TextArea textArea;
20 |
21 | public HRuler(TextArea textArea)
22 | {
23 | this.textArea = textArea;
24 | }
25 |
26 | protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
27 | {
28 | Graphics g = e.Graphics;
29 | int num = 0;
30 | for (float x = textArea.TextView.DrawingPosition.Left; x < textArea.TextView.DrawingPosition.Right; x += textArea.TextView.WideSpaceWidth) {
31 | int offset = (Height * 2) / 3;
32 | if (num % 5 == 0) {
33 | offset = (Height * 4) / 5;
34 | }
35 |
36 | if (num % 10 == 0) {
37 | offset = 1;
38 | }
39 | ++num;
40 | g.DrawLine(Pens.Black,
41 | (int)x, offset, (int)x, Height - offset);
42 | }
43 | }
44 |
45 | protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs e)
46 | {
47 | e.Graphics.FillRectangle(Brushes.White,
48 | new Rectangle(0,
49 | 0,
50 | Width,
51 | Height));
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Gui/InsightWindow/IInsightDataProvider.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 |
10 | namespace ICSharpCode.TextEditor.Gui.InsightWindow
11 | {
12 | public interface IInsightDataProvider
13 | {
14 | ///
15 | /// Tells the insight provider to prepare its data.
16 | ///
17 | /// The name of the edited file
18 | /// The text area in which the file is being edited
19 | void SetupDataProvider(string fileName, TextArea textArea);
20 |
21 | ///
22 | /// Notifies the insight provider that the caret offset has changed.
23 | ///
24 | /// Return true to close the insight window (e.g. when the
25 | /// caret was moved outside the region where insight is displayed for).
26 | /// Return false to keep the window open.
27 | bool CaretOffsetChanged();
28 |
29 | ///
30 | /// Gets the text to display in the insight window.
31 | ///
32 | /// The number of the active insight entry.
33 | /// Multiple insight entries might be multiple overloads of the same method.
34 | /// The text to display, e.g. a multi-line string where
35 | /// the first line is the method definition, followed by a description.
36 | string GetInsightData(int number);
37 |
38 | ///
39 | /// Gets the number of available insight entries, e.g. the number of available
40 | /// overloads to call.
41 | ///
42 | int InsightDataCount {
43 | get;
44 | }
45 |
46 | ///
47 | /// Gets the index of the entry to initially select.
48 | ///
49 | int DefaultIndex {
50 | get;
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Gui/TextAreaUpdate.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Drawing;
10 |
11 | namespace ICSharpCode.TextEditor
12 | {
13 | ///
14 | /// This enum describes all implemented request types
15 | ///
16 | public enum TextAreaUpdateType {
17 | WholeTextArea,
18 | SingleLine,
19 | SinglePosition,
20 | PositionToLineEnd,
21 | PositionToEnd,
22 | LinesBetween
23 | }
24 |
25 | ///
26 | /// This class is used to request an update of the textarea
27 | ///
28 | public class TextAreaUpdate
29 | {
30 | TextLocation position;
31 | TextAreaUpdateType type;
32 |
33 | public TextAreaUpdateType TextAreaUpdateType {
34 | get {
35 | return type;
36 | }
37 | }
38 |
39 | public TextLocation Position {
40 | get {
41 | return position;
42 | }
43 | }
44 |
45 | ///
46 | /// Creates a new instance of
47 | ///
48 | public TextAreaUpdate(TextAreaUpdateType type)
49 | {
50 | this.type = type;
51 | }
52 |
53 | ///
54 | /// Creates a new instance of
55 | ///
56 | public TextAreaUpdate(TextAreaUpdateType type, TextLocation position)
57 | {
58 | this.type = type;
59 | this.position = position;
60 | }
61 |
62 | ///
63 | /// Creates a new instance of
64 | ///
65 | public TextAreaUpdate(TextAreaUpdateType type, int startLine, int endLine)
66 | {
67 | this.type = type;
68 | this.position = new TextLocation(startLine, endLine);
69 | }
70 |
71 | ///
72 | /// Creates a new instance of
73 | ///
74 | public TextAreaUpdate(TextAreaUpdateType type, int singleLine)
75 | {
76 | this.type = type;
77 | this.position = new TextLocation(0, singleLine);
78 | }
79 |
80 | public override string ToString()
81 | {
82 | return String.Format("[TextAreaUpdate: Type={0}, Position={1}]", type, position);
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Gui/ToolTipRequestEventArgs.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Drawing;
10 |
11 | namespace ICSharpCode.TextEditor
12 | {
13 | public delegate void ToolTipRequestEventHandler(object sender, ToolTipRequestEventArgs e);
14 |
15 | public class ToolTipRequestEventArgs
16 | {
17 | Point mousePosition;
18 | TextLocation logicalPosition;
19 | bool inDocument;
20 |
21 | public Point MousePosition {
22 | get {
23 | return mousePosition;
24 | }
25 | }
26 |
27 | public TextLocation LogicalPosition {
28 | get {
29 | return logicalPosition;
30 | }
31 | }
32 |
33 | public bool InDocument {
34 | get {
35 | return inDocument;
36 | }
37 | }
38 |
39 | ///
40 | /// Gets if some client handling the event has already shown a tool tip.
41 | ///
42 | public bool ToolTipShown {
43 | get {
44 | return toolTipText != null;
45 | }
46 | }
47 |
48 | internal string toolTipText;
49 |
50 | public void ShowToolTip(string text)
51 | {
52 | toolTipText = text;
53 | }
54 |
55 | public ToolTipRequestEventArgs(Point mousePosition, TextLocation logicalPosition, bool inDocument)
56 | {
57 | this.mousePosition = mousePosition;
58 | this.logicalPosition = logicalPosition;
59 | this.inDocument = inDocument;
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Undo/IUndoableOperation.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | namespace ICSharpCode.TextEditor.Undo
9 | {
10 | ///
11 | /// This Interface describes a the basic Undo/Redo operation
12 | /// all Undo Operations must implement this interface.
13 | ///
14 | public interface IUndoableOperation
15 | {
16 | ///
17 | /// Undo the last operation
18 | ///
19 | void Undo();
20 |
21 | ///
22 | /// Redo the last operation
23 | ///
24 | void Redo();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Undo/UndoQueue.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Collections.Generic;
10 | using System.Diagnostics;
11 |
12 | namespace ICSharpCode.TextEditor.Undo
13 | {
14 | ///
15 | /// This class stacks the last x operations from the undostack and makes
16 | /// one undo/redo operation from it.
17 | ///
18 | internal sealed class UndoQueue : IUndoableOperation
19 | {
20 | List undolist = new List();
21 |
22 | ///
23 | ///
24 | public UndoQueue(Stack stack, int numops)
25 | {
26 | if (stack == null) {
27 | throw new ArgumentNullException("stack");
28 | }
29 |
30 | Debug.Assert(numops > 0 , "ICSharpCode.TextEditor.Undo.UndoQueue : numops should be > 0");
31 | if (numops > stack.Count) {
32 | numops = stack.Count;
33 | }
34 |
35 | for (int i = 0; i < numops; ++i) {
36 | undolist.Add(stack.Pop());
37 | }
38 | }
39 | public void Undo()
40 | {
41 | for (int i = 0; i < undolist.Count; ++i) {
42 | undolist[i].Undo();
43 | }
44 | }
45 |
46 | public void Redo()
47 | {
48 | for (int i = undolist.Count - 1 ; i >= 0 ; --i) {
49 | undolist[i].Redo();
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Undo/UndoableDelete.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Diagnostics;
10 | using ICSharpCode.TextEditor.Document;
11 |
12 | namespace ICSharpCode.TextEditor.Undo
13 | {
14 | ///
15 | /// This class is for the undo of Document insert operations
16 | ///
17 | public class UndoableDelete : IUndoableOperation
18 | {
19 | IDocument document;
20 | // int oldCaretPos;
21 | int offset;
22 | string text;
23 |
24 | ///
25 | /// Creates a new instance of
26 | ///
27 | public UndoableDelete(IDocument document, int offset, string text)
28 | {
29 | if (document == null) {
30 | throw new ArgumentNullException("document");
31 | }
32 | if (offset < 0 || offset > document.TextLength) {
33 | throw new ArgumentOutOfRangeException("offset");
34 | }
35 |
36 | Debug.Assert(text != null, "text can't be null");
37 | // oldCaretPos = document.Caret.Offset;
38 | this.document = document;
39 | this.offset = offset;
40 | this.text = text;
41 | }
42 |
43 | ///
44 | /// Undo last operation
45 | ///
46 | public void Undo()
47 | {
48 | // we clear all selection direct, because the redraw
49 | // is done per refresh at the end of the action
50 | // textArea.SelectionManager.SelectionCollection.Clear();
51 | document.UndoStack.AcceptChanges = false;
52 | document.Insert(offset, text);
53 | // document.Caret.Offset = Math.Min(document.TextLength, Math.Max(0, oldCaretPos));
54 | document.UndoStack.AcceptChanges = true;
55 | }
56 |
57 | ///
58 | /// Redo last undone operation
59 | ///
60 | public void Redo()
61 | {
62 | // we clear all selection direct, because the redraw
63 | // is done per refresh at the end of the action
64 | // textArea.SelectionManager.SelectionCollection.Clear();
65 |
66 | document.UndoStack.AcceptChanges = false;
67 | document.Remove(offset, text.Length);
68 | // document.Caret.Offset = Math.Min(document.TextLength, Math.Max(0, document.Caret.Offset));
69 | document.UndoStack.AcceptChanges = true;
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Undo/UndoableInsert.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Diagnostics;
10 | using ICSharpCode.TextEditor.Document;
11 |
12 | namespace ICSharpCode.TextEditor.Undo
13 | {
14 | ///
15 | /// This class is for the undo of Document insert operations
16 | ///
17 | public class UndoableInsert : IUndoableOperation
18 | {
19 | IDocument document;
20 | // int oldCaretPos;
21 | int offset;
22 | string text;
23 |
24 | ///
25 | /// Creates a new instance of
26 | ///
27 | public UndoableInsert(IDocument document, int offset, string text)
28 | {
29 | if (document == null) {
30 | throw new ArgumentNullException("document");
31 | }
32 | if (offset < 0 || offset > document.TextLength) {
33 | throw new ArgumentOutOfRangeException("offset");
34 | }
35 |
36 | Debug.Assert(text != null, "text can't be null");
37 | // oldCaretPos = document.Caret.Offset;
38 | this.document = document;
39 | this.offset = offset;
40 | this.text = text;
41 | }
42 |
43 | ///
44 | /// Undo last operation
45 | ///
46 | public void Undo()
47 | {
48 | // we clear all selection direct, because the redraw
49 | // is done per refresh at the end of the action
50 | // document.SelectionCollection.Clear();
51 |
52 | document.UndoStack.AcceptChanges = false;
53 | document.Remove(offset, text.Length);
54 | // document.Caret.Offset = Math.Min(document.TextLength, Math.Max(0, oldCaretPos));
55 | document.UndoStack.AcceptChanges = true;
56 | }
57 |
58 | ///
59 | /// Redo last undone operation
60 | ///
61 | public void Redo()
62 | {
63 | // we clear all selection direct, because the redraw
64 | // is done per refresh at the end of the action
65 | // document.SelectionCollection.Clear();
66 |
67 | document.UndoStack.AcceptChanges = false;
68 | document.Insert(offset, text);
69 | // document.Caret.Offset = Math.Min(document.TextLength, Math.Max(0, document.Caret.Offset));
70 | document.UndoStack.AcceptChanges = true;
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Undo/UndoableReplace.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Diagnostics;
10 | using ICSharpCode.TextEditor.Document;
11 |
12 | namespace ICSharpCode.TextEditor.Undo
13 | {
14 | ///
15 | /// This class is for the undo of Document insert operations
16 | ///
17 | public class UndoableReplace : IUndoableOperation
18 | {
19 | IDocument document;
20 | // int oldCaretPos;
21 | int offset;
22 | string text;
23 | string origText;
24 |
25 | ///
26 | /// Creates a new instance of
27 | ///
28 | public UndoableReplace(IDocument document, int offset, string origText, string text)
29 | {
30 | if (document == null) {
31 | throw new ArgumentNullException("document");
32 | }
33 | if (offset < 0 || offset > document.TextLength) {
34 | throw new ArgumentOutOfRangeException("offset");
35 | }
36 |
37 | Debug.Assert(text != null, "text can't be null");
38 | // oldCaretPos = document.Caret.Offset;
39 | this.document = document;
40 | this.offset = offset;
41 | this.text = text;
42 | this.origText = origText;
43 | }
44 |
45 | ///
46 | /// Undo last operation
47 | ///
48 | public void Undo()
49 | {
50 | // we clear all selection direct, because the redraw
51 | // is done per refresh at the end of the action
52 | // document.SelectionCollection.Clear();
53 |
54 | document.UndoStack.AcceptChanges = false;
55 | document.Replace(offset, text.Length, origText);
56 | // document.Caret.Offset = Math.Min(document.TextLength, Math.Max(0, oldCaretPos));
57 | document.UndoStack.AcceptChanges = true;
58 | }
59 |
60 | ///
61 | /// Redo last undone operation
62 | ///
63 | public void Redo()
64 | {
65 | // we clear all selection direct, because the redraw
66 | // is done per refresh at the end of the action
67 | // document.SelectionCollection.Clear();
68 |
69 | document.UndoStack.AcceptChanges = false;
70 | document.Replace(offset, origText.Length, text);
71 | // document.Caret.Offset = Math.Min(document.TextLength, Math.Max(0, document.Caret.Offset));
72 | document.UndoStack.AcceptChanges = true;
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Util/LoggingService.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 |
10 | namespace ICSharpCode.TextEditor.Util
11 | {
12 | ///
13 | /// Central location for logging calls in the text editor.
14 | ///
15 | static class LoggingService
16 | {
17 | public static void Debug(string text)
18 | {
19 | #if DEBUG
20 | Console.WriteLine(text);
21 | #endif
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Util/MouseWheelHandler.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Windows.Forms;
10 |
11 | namespace ICSharpCode.TextEditor.Util
12 | {
13 | ///
14 | /// Accumulates mouse wheel deltas and reports the actual number of lines to scroll.
15 | ///
16 | class MouseWheelHandler
17 | {
18 | // CODE DUPLICATION: See ICSharpCode.SharpDevelop.Widgets.MouseWheelHandler
19 |
20 | const int WHEEL_DELTA = 120;
21 |
22 | int mouseWheelDelta;
23 |
24 | public int GetScrollAmount(MouseEventArgs e)
25 | {
26 | // accumulate the delta to support high-resolution mice
27 | mouseWheelDelta += e.Delta;
28 |
29 | int linesPerClick = Math.Max(SystemInformation.MouseWheelScrollLines, 1);
30 |
31 | int scrollDistance = mouseWheelDelta * linesPerClick / WHEEL_DELTA;
32 | mouseWheelDelta %= Math.Max(1, WHEEL_DELTA / linesPerClick);
33 | return scrollDistance;
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Util/RedBlackTreeIterator.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Diagnostics;
10 | using System.Collections.Generic;
11 |
12 | namespace ICSharpCode.TextEditor.Util
13 | {
14 | internal struct RedBlackTreeIterator : IEnumerator
15 | {
16 | internal RedBlackTreeNode node;
17 |
18 | internal RedBlackTreeIterator(RedBlackTreeNode node)
19 | {
20 | this.node = node;
21 | }
22 |
23 | public bool IsValid {
24 | get { return node != null; }
25 | }
26 |
27 | public T Current {
28 | get {
29 | if (node != null)
30 | return node.val;
31 | else
32 | throw new InvalidOperationException();
33 | }
34 | }
35 |
36 | object System.Collections.IEnumerator.Current {
37 | get {
38 | return this.Current;
39 | }
40 | }
41 |
42 | void IDisposable.Dispose()
43 | {
44 | }
45 |
46 | void System.Collections.IEnumerator.Reset()
47 | {
48 | throw new NotSupportedException();
49 | }
50 |
51 | public bool MoveNext()
52 | {
53 | if (node == null)
54 | return false;
55 | if (node.right != null) {
56 | node = node.right.LeftMost;
57 | } else {
58 | RedBlackTreeNode oldNode;
59 | do {
60 | oldNode = node;
61 | node = node.parent;
62 | // we are on the way up from the right part, don't output node again
63 | } while (node != null && node.right == oldNode);
64 | }
65 | return node != null;
66 | }
67 |
68 | public bool MoveBack()
69 | {
70 | if (node == null)
71 | return false;
72 | if (node.left != null) {
73 | node = node.left.RightMost;
74 | } else {
75 | RedBlackTreeNode oldNode;
76 | do {
77 | oldNode = node;
78 | node = node.parent;
79 | // we are on the way up from the left part, don't output node again
80 | } while (node != null && node.left == oldNode);
81 | }
82 | return node != null;
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Util/TextUtility.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 |
10 | using ICSharpCode.TextEditor.Document;
11 |
12 | namespace ICSharpCode.TextEditor.Util
13 | {
14 | public class TextUtility
15 | {
16 |
17 | public static bool RegionMatches(IDocument document, int offset, int length, string word)
18 | {
19 | if (length != word.Length || document.TextLength < offset + length) {
20 | return false;
21 | }
22 |
23 | for (int i = 0; i < length; ++i) {
24 | if (document.GetCharAt(offset + i) != word[i]) {
25 | return false;
26 | }
27 | }
28 | return true;
29 | }
30 |
31 | public static bool RegionMatches(IDocument document, bool casesensitive, int offset, int length, string word)
32 | {
33 | if (casesensitive) {
34 | return RegionMatches(document, offset, length, word);
35 | }
36 |
37 | if (length != word.Length || document.TextLength < offset + length) {
38 | return false;
39 | }
40 |
41 | for (int i = 0; i < length; ++i) {
42 | if (Char.ToUpper(document.GetCharAt(offset + i)) != Char.ToUpper(word[i])) {
43 | return false;
44 | }
45 | }
46 | return true;
47 | }
48 |
49 | public static bool RegionMatches(IDocument document, int offset, int length, char[] word)
50 | {
51 | if (length != word.Length || document.TextLength < offset + length) {
52 | return false;
53 | }
54 |
55 | for (int i = 0; i < length; ++i) {
56 | if (document.GetCharAt(offset + i) != word[i]) {
57 | return false;
58 | }
59 | }
60 | return true;
61 | }
62 |
63 | public static bool RegionMatches(IDocument document, bool casesensitive, int offset, int length, char[] word)
64 | {
65 | if (casesensitive) {
66 | return RegionMatches(document, offset, length, word);
67 | }
68 |
69 | if (length != word.Length || document.TextLength < offset + length) {
70 | return false;
71 | }
72 |
73 | for (int i = 0; i < length; ++i) {
74 | if (Char.ToUpper(document.GetCharAt(offset + i)) != Char.ToUpper(word[i])) {
75 | return false;
76 | }
77 | }
78 | return true;
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Util/TipSection.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Diagnostics;
10 | using System.Drawing;
11 |
12 | namespace ICSharpCode.TextEditor.Util
13 | {
14 | abstract class TipSection
15 | {
16 | SizeF tipAllocatedSize;
17 | Graphics tipGraphics;
18 | SizeF tipMaxSize;
19 | SizeF tipRequiredSize;
20 |
21 | protected TipSection(Graphics graphics)
22 | {
23 | tipGraphics = graphics;
24 | }
25 |
26 | public abstract void Draw(PointF location);
27 |
28 | public SizeF GetRequiredSize()
29 | {
30 | return tipRequiredSize;
31 | }
32 |
33 | public void SetAllocatedSize(SizeF allocatedSize)
34 | {
35 | Debug.Assert(allocatedSize.Width >= tipRequiredSize.Width &&
36 | allocatedSize.Height >= tipRequiredSize.Height);
37 |
38 | tipAllocatedSize = allocatedSize; OnAllocatedSizeChanged();
39 | }
40 |
41 | public void SetMaximumSize(SizeF maximumSize)
42 | {
43 | tipMaxSize = maximumSize; OnMaximumSizeChanged();
44 | }
45 |
46 | protected virtual void OnAllocatedSizeChanged()
47 | {
48 |
49 | }
50 |
51 | protected virtual void OnMaximumSizeChanged()
52 | {
53 |
54 | }
55 |
56 | protected void SetRequiredSize(SizeF requiredSize)
57 | {
58 | requiredSize.Width = Math.Max(0, requiredSize.Width);
59 | requiredSize.Height = Math.Max(0, requiredSize.Height);
60 | requiredSize.Width = Math.Min(tipMaxSize.Width, requiredSize.Width);
61 | requiredSize.Height = Math.Min(tipMaxSize.Height, requiredSize.Height);
62 |
63 | tipRequiredSize = requiredSize;
64 | }
65 |
66 | protected Graphics Graphics {
67 | get {
68 | return tipGraphics;
69 | }
70 | }
71 |
72 | protected SizeF AllocatedSize {
73 | get {
74 | return tipAllocatedSize;
75 | }
76 | }
77 |
78 | protected SizeF MaximumSize {
79 | get {
80 | return tipMaxSize;
81 | }
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Src/Util/TipSpacer.cs:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | //
5 | // $Revision$
6 | //
7 |
8 | using System;
9 | using System.Drawing;
10 |
11 | namespace ICSharpCode.TextEditor.Util
12 | {
13 | class TipSpacer: TipSection
14 | {
15 | SizeF spacerSize;
16 |
17 | public TipSpacer(Graphics graphics, SizeF size): base(graphics)
18 | {
19 | spacerSize = size;
20 | }
21 |
22 | public override void Draw(PointF location)
23 | {
24 |
25 | }
26 |
27 | protected override void OnMaximumSizeChanged()
28 | {
29 | base.OnMaximumSizeChanged();
30 |
31 | SetRequiredSize(new SizeF
32 | (Math.Min(MaximumSize.Width, spacerSize.Width),
33 | Math.Min(MaximumSize.Height, spacerSize.Height)));
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/SyntaxModes.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace ICSharpCode.TextEditorEx
3 | {
4 | public static class SyntaxModes
5 | {
6 | public const string ASP_XHTML = "ASP/XHTML";
7 | public const string BAT = "BAT";
8 | public const string Boo = "Boo";
9 | public const string Coco = "Coco";
10 | public const string CPPNET = "C++.NET";
11 | public const string CSharp = "C#";
12 | public const string HTML = "HTML";
13 | public const string Java = "Java";
14 | public const string JavaScript = "JavaScript";
15 | public const string Patch = "Patch";
16 | public const string PHP = "PHP";
17 | public const string TeX = "TeX";
18 | public const string VBNET = "VBNET";
19 | public const string XML = "XML";
20 | public const string Lua = "Lua";
21 | public const string SQL = "SQL";
22 | }
23 | }
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/UserControls/ContextMenuStripEx.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ICSharpCode.TextEditor.UserControls
2 | {
3 | partial class ContextMenuStripEx
4 | {
5 | ///
6 | /// Clean up any resources being used.
7 | ///
8 | /// true if managed resources should be disposed; otherwise, false.
9 | protected override void Dispose(bool disposing)
10 | {
11 | //DisposeEventsHandlers();
12 |
13 | base.Dispose(disposing);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/UserControls/ContextMenuStripEx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 | using ICSharpCode.TextEditor.Utils;
5 |
6 | namespace ICSharpCode.TextEditor.UserControls
7 | {
8 | public partial class ContextMenuStripEx : ContextMenuStrip
9 | {
10 | public ToolStripMenuItem AddToolStripMenuItem(string text, Bitmap bitmap, EventHandler clickEvent, Keys keys, Func enabled)
11 | {
12 | var menuItem = new ToolStripMenuItem(text);
13 | if (bitmap != null)
14 | {
15 | menuItem.Image = bitmap;
16 | }
17 |
18 | if (keys != Keys.None)
19 | {
20 | menuItem.ShortcutKeys = keys;
21 | }
22 |
23 | if (clickEvent != null)
24 | {
25 | menuItem.Click += new WeakEventHandler(clickEvent).Handler;
26 | }
27 |
28 | Items.Add(menuItem);
29 |
30 | EventHandler toolstripOpening = (sender, args) =>
31 | {
32 | menuItem.Enabled = enabled();
33 | };
34 | Opening += new WeakEventHandler(toolstripOpening).Handler;
35 |
36 | return menuItem;
37 | }
38 |
39 | public ToolStripSeparator AddToolStripSeparator()
40 | {
41 | var strip = new ToolStripSeparator();
42 | Items.Add(strip);
43 |
44 | return strip;
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/UserControls/GotoForm.cs:
--------------------------------------------------------------------------------
1 | using System.Globalization;
2 | using System.Windows.Forms;
3 |
4 | namespace ICSharpCode.TextEditor.UserControls
5 | {
6 | public partial class GotoForm : Form
7 | {
8 | private int _firstLineNumber;
9 | public int FirstLineNumber
10 | {
11 | get { return _firstLineNumber; }
12 | set
13 | {
14 | _firstLineNumber = value;
15 | UpdateLineNumberLabel();
16 | }
17 | }
18 |
19 | private int _lastLineNumber;
20 | public int LastLineNumber
21 | {
22 | get { return _lastLineNumber; }
23 | set
24 | {
25 | _lastLineNumber = value;
26 | UpdateLineNumberLabel();
27 | }
28 | }
29 |
30 | public int SelectedLineNumber
31 | {
32 | get
33 | {
34 | int selectedLineNumber;
35 | if (!string.IsNullOrEmpty(txtLineNumber.Text) && int.TryParse(txtLineNumber.Text, out selectedLineNumber))
36 | {
37 | return selectedLineNumber;
38 | }
39 |
40 | return 0;
41 | }
42 |
43 | set
44 | {
45 | txtLineNumber.Text = value.ToString(CultureInfo.InvariantCulture);
46 | }
47 | }
48 |
49 | public GotoForm()
50 | {
51 | InitializeComponent();
52 | }
53 |
54 | public DialogResult ShowDialogEx()
55 | {
56 | txtLineNumber.Min = _firstLineNumber;
57 | txtLineNumber.Max = _lastLineNumber;
58 |
59 | return ShowDialog();
60 | }
61 |
62 | private void UpdateLineNumberLabel()
63 | {
64 | lblLineNumber.Text = string.Format("Line number ({0} - {1}):", _firstLineNumber, _lastLineNumber);
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/UserControls/Int32TextBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace ICSharpCode.TextEditor.UserControls
5 | {
6 | class Int32TextBox : TextBox
7 | {
8 | public int Min { get; set; }
9 | public int Max { get; set; }
10 |
11 | public Int32TextBox()
12 | : this(1, int.MaxValue)
13 | {
14 | }
15 |
16 | public Int32TextBox(int min, int max)
17 | {
18 | Min = min;
19 | Max = max;
20 | }
21 |
22 | protected override void OnTextChanged(EventArgs e)
23 | {
24 | base.OnTextChanged(e);
25 |
26 | if (!IsValidNumber(Text))
27 | {
28 | Text = string.Empty;
29 | }
30 | }
31 |
32 | protected override void WndProc(ref Message m)
33 | {
34 | const int WM_PASTE = 0x0302;
35 |
36 | if (m.Msg == WM_PASTE)
37 | {
38 | string text = Clipboard.GetText();
39 |
40 | if (!IsValidNumber(text))
41 | return;
42 | }
43 |
44 | base.WndProc(ref m);
45 | }
46 |
47 | private bool IsValidNumber(string text)
48 | {
49 | int i;
50 | if (int.TryParse(text, out i))
51 | {
52 | return i <= Max && i >= Min;
53 | }
54 |
55 | return false;
56 | }
57 | }
58 | }
--------------------------------------------------------------------------------
/HalconDotNet/ICSharpCode.TextEditorEx/Utils/WeakEventHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Reflection;
4 |
5 | namespace ICSharpCode.TextEditor.Utils
6 | {
7 | ///
8 | /// http://paulstovell.com/blog/weakevents
9 | ///
10 | /// The type of the event args.
11 | [DebuggerNonUserCode]
12 | public sealed class WeakEventHandler where TEventArgs : EventArgs
13 | {
14 | private readonly WeakReference _targetReference;
15 | private readonly MethodInfo _method;
16 |
17 | public WeakEventHandler(EventHandler callback)
18 | {
19 | _method = callback.Method;
20 | _targetReference = new WeakReference(callback.Target, true);
21 | }
22 |
23 | [DebuggerNonUserCode]
24 | public void Handler(object sender, TEventArgs e)
25 | {
26 | var target = _targetReference.Target;
27 | if (target != null)
28 | {
29 | var callback = (Action