|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article
For a binary release go at DotNetFireball SourceForge.net page
IntroductionFireball.CodeEditor is an source code editor control derived from the best compona SyntaxBox Control, because compona as recently released it as LGPL, i have imported it on my framework,because imported? because i need to add some changes and solve some issue, example; BUG: The original source code of the compona don't work on C#, Visual Studio 2005. FIXED: Fireball.CodeEditor work correctly on C# 2.0 and on Visual Studio 2005 Designer! Removed some bad try catch statment and replaced with if statment because are more speedly. BUG: The original compona code, caret don't position correctly on presence of { and ( FIXED: This is a p/invoke issue because C# 2.0 don't work on the same mode as C# 1.0 for p/invoke, i have find this bug simply removing all try catch! On the Fireball Framework the needed dll's are this Fireball.CodeEditor ( this contains the CodeEditorControl ), Fireball.Windows.Forms ( this contains some widgets use by the CodeEditorControl ),Fireball.SyntaxDocument ( this contain the SyntaxDocument used by the CodeEditorControl) and Fireball.Core! that contains some low level api like GDIObject, it is also present another library the Fireball.CodeEditor.SyntaxFiles this is only a utils library that contains some standard syntax files for common programming languages and a class for fast loading this. BackgroundOn this article i explain the basic usage of this control, this article article can't cover advanced use of this control, it is only an introduction, i can write more about the CodeEditorControl on the future, for use the example on this article you need to download and compile all libraries, the compile order is this,
Next you can compile the example of this article. Note: You need to change the build output directory because it set for working with fireball repository structure. Using the codeN.B The demo illustrated on this article is a really working Fireball application called FireEdit! For find a dettailed use of this libraries you can see the code, next i put some line of that illustrate the use of CodeEditorControl. Adding an istance of CodeEditorControl to your form is very simple, you need only to add to your toolbox the Fireball.CodeEditor.dll, or you can also istance it manualy with this lines of code. ... using Fireball.Windows.Forms; // Where is located CodeEditorControl class using Fireball.Syntax; // Where is located SyntaxDocument class using Fireball.CodeEditor.SyntaxFiles; // Where is located commons SyntaxFiles public class yourclass : Form { public yourclass() { CodeEditorControl codeEdit = new CodeEditorControl(); this.Controls.Add(codeEdit ); codeEdit.Dock = DockStyle.Fill; codeEdit.Document = CodeEditorSyntaxLoader.SetSyntax(codeEdit, SyntaxLanguage.CSharp); } } You have istanced your own CodeEditor! very simple!! What is SyntaxLanguage? is an enumeration that contains a list of the common languages, see the enum, public enum SyntaxLanguage { Lang6502 = 0, ASP = 1, CPP = 2, Cobol = 3, CSharp = 4, CSS = 5, DataFlex = 6, Delphi = 7, DOSBatch = 8, Fortran90 = 9, FoxPro = 10, Java = 11, JavaScript = 12, JSP = 13, LotusScript = 14, MSIL = 15, MySql_SQL = 16, NPath = 17, Oracle_SQL = 18, Perl = 19, PHP = 20, Povray = 21, Python = 22, Rtf = 23, SmallTalk = 24, SqlServer2K = 25, SqlServer7 = 26, SystemPolicies = 27, Template = 28, Text = 29, TurboPascal = 30, VBNET = 31, VB = 32, VBScript = 33, VRML97 = 34, XML = 35, } The CodeEditorControl give to you a simple way for implementing a little editor and professional editor, on the control you have some nice commands like clipboard function, Cut, Copy and Paste, the control also can split in multiple views, see the class diagram here The control also contains some function for text search and replace. Now you need to see the FireEdit code is more explicative to see code than read an article ;) If you need more help don't esitate to enter my forum at http://www.dotnetfireball.net, and ask your question. if you are interested to contribute to the project with producing path, new functionalities or Documentation please contact me on my forum. ThanksThanks to compona.com for have released SyntaxBox as LGPL, and gived to me the possibility to correct it's bug.History30/04/2006 - Fixed some bugs, released as beta 2 31/03/2006 - Fixed some bugs, thanks to my users for helping me, coming soon a beta 2 19/02/2006 - Updated with the last version of Fireball Source Code, Fixed an issue with IntelliMouse, now the source code of FireEdit is only available at http://www.codeproject.com/useritems/fireedit.asp 14/02/2006 - Fixed an overload error on Fireball.Core GDIBitmap and Fixed a bug TabStrip control. 4/02/2006 - Updated article with zip files and with last version of source code29/01/2006 - Merged some fixes maked by Roger (Compona) that solve an issue with font assignement and added IME Window for international support 15/01/2006 - Added a new method CenterInView on EditViewControl (Thx to Marcel Isler for contribution), and you now get the Active View with the method ActiveViewControl on CodeEditorControl.
|
||||||||||||||||||||||