Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » General » Downloads
 
Add your own
alternative version

Write Your Customized Editor for Your Own Programming Language

, 13 Jun 2004 CPOL
An article on a customized editor for your own programming language
codemax.zip
CodeMax.pdf
codemaxctl.zip
CodeMaxCtl
App.ico
BIN
Release
Interop.CodeMax.dll
AxInterop.CodeMax.dll
CodeMaxCtl.dll
CMAX20.OCX
CodeMaxCtl.csproj.user
CodeMaxCtl.sln.old
CodeMaxCtl.suo
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace CodeMaxCtl
{
	/// <summary>
	/// Summary description for UserControl1.
	/// </summary>
	public class CodeMaxCtl : System.Windows.Forms.UserControl
	{
		public AxCodeMax.AxCodeMax axCodeMax1;
		
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public CodeMaxCtl()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();
            
			
			CodeMax.Globals Global=new CodeMax.GlobalsClass();
			
			Global.UnregisterAllLanguages();
			
			CodeMax.Language lang=new CodeMax.LanguageClass();
			
			lang.CaseSensitive=false;
			
			lang.Keywords="ABSOLUTE\nADD\nADMINDB\nALL\nAlphanumeric\nALTER\nALTER TABLE\nAnd\nANY\nARE\nAS\nASC\nASSERTION\nAUTHORIZATION\nAUTOINCREMENT\nAvg\nBEGIN\nBetween\nBINARY\nBIT\nBIT_LENGTH\nBOOLEAN\nBOTH\nBY\nBYTE\nCASCADE\nCATALOG\nCHAR\nCHAR_LENGTH\nCHARACTER\nCHARACTER_LENGTH\nCHECK\nCLOSE\nCLUSTERED\nCOALESCE\nCOLLATE\nCOLLATION\nCOLUMN\nCOMMIT\nCOMP\nCOMPRESSION\nCONNECT\nCONNECTION\nCONSTRAINT\nCONSTRAINTS\nCONTAINER\nCONTAINS\nCONVERT\nCount\nCOUNTER\nCREATE\nCURRENCY\nCURRENT_DATE\nCURRENT_TIME\nCURRENT_TIMESTAMP\nCURRENT_USER\nCURSOR\nDATABASE\nDATE\nDATETIME\nDAY\nDEC\nDECIMAL\nDECLARE\nDELETE\nDESC\nDISALLOW\nDISCONNECT\nDISTINCT\nDISTINCTROW\nDOMAIN\nDOUBLE\nDROP\nEqv\nEXCLUSIVECONNECT\nEXEC\nEXECUTE\nEXISTS\nEXTRACT\nFALSE\nFETCH\nFIRST\nFLOAT\nFLOAT4\nFLOAT8\nFOREIGN\nFROM\nFROM Clause\nGENERAL\nGRANT\nGROUP\nGUID\nHAVING\nIDENTITY\nIEEEDOUBLE\nIEEESINGLE\nIGNORE\nIMAGE\nImp\nIn\nIN\nINDEX\nINDEXCREATEDB\nINNER\nINPUT\nINSERT\nINSERT INTO\nINT\nINTEGER\nINTEGER1\nINTEGER2\nINTEGER4\nINTERVAL\nINTO\nIs\nISOLATION\nJOIN\nKEY\nLANGUAGE\nLAST\nLEFT\nLevel\nLike\nLOGICAL\nLOGICAL1\nLONG\nLONGBINARY\nLONGCHAR\nLONGTEXT\nLOWER\nMATCH\nMax\nMEMO\nMin\nMINUTE\nMONEY\nMONTH\nNATIONAL\nNCHAR\nNONCLUSTERED\nNot\nNTEXT\nNULL\nNUMBER\nNUMERIC\nNVARCHAR\nOCTET_LENGTH\nOLEOBJECT\nON\nOPEN\nOPTION\nOr\nORDER\nOuter\nOUTPUT\nOWNERACCESS\nPAD\nPARAMETERS\nPARTIAL\nPASSWORD\nPERCENT\nPIVOT\nPOSITION\nPRECISION\nPREPARE\nPRIMARY\nPRIVILEGES\nPROC\nPROCEDURE\nPUBLIC\nREAL\nREFERENCES\nRESTRICT\nREVOKE\nRIGHT\nROLLBACK\nSCHEMA\nSECOND\nSELECT\nSELECTSCHEMA\nSELECTSECURITY\nSET\nSHORT\nSINGLE\nSIZE\nSMALLDATETIME\nSMALLINT\nSMALLMONEY\nSOME\nSPACE\nSQL\nSQLCODE\nSQLERROR\nSQLSTATE\nStDev\nStDevP\nSTRING\nSUBSTRING\nSum\nSYSNAME\nSYSTEM_USER\nTABLE\nTableID\nTEMPORARY\nTEXT\nTIME\nTIMESTAMP\nTIMEZONE_HOUR\nTIMEZONE_MINUTE\nTINYINT\nTO\nTOP\nTRAILING\nTRANSACTION\nTRANSFORM\nTRANSLATE\nTRANSLATION\nTRIM\nTRUE\nUNION\nUNIQUE\nUNIQUEIDENTIFIER\nUNKNOWN\nUPDATE\nUPDATEIDENTITY\nUPDATEOWNER\nUPDATESECURITY\nUPPER\nUSAGE"
			+"\nUSER\nUSING\nVALUE\nVALUES\nVar\nVARBINARY\nVARCHAR\nVarP\nVARYING\nVIEW\nWHEN\nWHENEVER\nWHERE\nWITH\nWORK\nXor\nYEAR\nYESNO\nZONE";

			lang.TerminatorChar=@";";
			
			lang.Style=CodeMax.cmLangStyle.cmLangStyleProcedural;
			
			Global.RegisterLanguage("TahaSQL",lang);
			
			this.axCodeMax1.Language="TahaSQL";
		    this.axCodeMax1.LineNumbering=true;
			this.axCodeMax1.LineNumberStart=0;
			this.axCodeMax1.ColorSyntax=true;
			this.axCodeMax1.LineNumberStyle=CodeMax.cmLineNumStyle.cmDecimal;
		    

		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if( components != null )
					components.Dispose();
			}
			base.Dispose( disposing );
		}

		#region Component Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify 
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(CodeMaxCtl));
			this.axCodeMax1 = new AxCodeMax.AxCodeMax();
			((System.ComponentModel.ISupportInitialize)(this.axCodeMax1)).BeginInit();
			this.SuspendLayout();
			// 
			// axCodeMax1
			// 
			this.axCodeMax1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.axCodeMax1.Name = "axCodeMax1";
			this.axCodeMax1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axCodeMax1.OcxState")));
			this.axCodeMax1.Size = new System.Drawing.Size(150, 150);
			this.axCodeMax1.TabIndex = 0;
			// 
			// CodeMaxCtl
			// 
			this.AllowDrop = true;
			this.AutoScroll = true;
			this.axCodeMax1.Focus();
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.axCodeMax1});
			this.Name = "CodeMaxCtl";
			((System.ComponentModel.ISupportInitialize)(this.axCodeMax1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion
		
		//return lines Count of CodeMax
		public int GetLinesCount()
		{
			return this.axCodeMax1.LineCount;
		}
		//return lines of CodeMax
		public  string[] GetLines()
		{
			int LineCount=axCodeMax1.LineCount;
			string[] Lines=new string[LineCount];
			for(int i=1;i<LineCount;i++)
					Lines[i]=axCodeMax1.GetLine(i);
			return Lines;
		}

		//return contents of line
		public string GetLine(int line)
		{
			return axCodeMax1.GetLine(line);
   		}
		public void GetAllBookmarks(out System.Array sss)
		{
			this.axCodeMax1.GetAllBookmarks(out sss);
		}
		public int HighlightedLine
		{
			get
			{
				return this.axCodeMax1.HighlightedLine;
			}
			set
			{
				this.axCodeMax1.HighlightedLine=value;
			}
			
		}
		public bool Modified
		{
			get
			{
				return this.axCodeMax1.Modified;
			}
			set
			{
				this.axCodeMax1.Modified=value;
			}
               
		}
		public int TextLength
		{
			get
			{
				return this.axCodeMax1.TextLength;
			}
			
		}
		public string text
		{
			set
			{
				this.axCodeMax1.Text=value;
			}
			get
			{
				return this.axCodeMax1.Text;
			}
		}
		

		}



		
	}


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Taha Amin
Team Leader http://www.linkdev.com/
Egypt Egypt
B/OSS.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141220.1 | Last Updated 14 Jun 2004
Article Copyright 2004 by Taha Amin
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid