Наследование: ISyntaxModeFileProvider
Пример #1
0
 public TextEditor()
 {
     InitializeComponent();
     Settings.SetupWindowPosition(SavedWindows.Main, this);
     // highlighting
     FileSyntaxModeProvider fsmProvider = new FileSyntaxModeProvider(Settings.ResourcesFolder); // Create new provider with the highlighting directory.
     HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider); // Attach to the text editor.
     // folding timer
     timer = new Timer();
     timer.Interval = 1000;
     timer.Tick += new EventHandler(timer_Tick);
     // Recent files
     UpdateRecentList();
     // Templates
     foreach (string file in Directory.GetFiles(Path.Combine(Settings.ResourcesFolder, "templates"), "*.ssl")) {
         ToolStripMenuItem mi = new ToolStripMenuItem(Path.GetFileNameWithoutExtension(file), null, delegate(object sender, EventArgs e) {
             Open(file, OpenType.File, false, true);
         });
         templatesToolStripMenuItem.DropDownItems.Add(mi);
     }
     parserLabel = new ToolStripLabel("Parser: No file");
     parserLabel.Alignment = ToolStripItemAlignment.Right;
     MainMenu.Items.Add(parserLabel);
     tabControl1.tabsSwapped += delegate(object sender, TabsSwappedEventArgs e) {
         TabInfo tmp = tabs[e.aIndex];
         tabs[e.aIndex] = tabs[e.bIndex];
         tabs[e.aIndex].index = e.aIndex;
         tabs[e.bIndex] = tmp;
         tabs[e.bIndex].index = e.bIndex;
     };
     splitContainer2.Panel2Collapsed = !Settings.enableParser;
     parserLabel.Visible = Settings.enableParser;
     ProgramInfo.LoadOpcodes();
 }
Пример #2
0
 static DocumentTabForm()
 {
     string dir = "./"; // Insert the path to your xshd-files.
     FileSyntaxModeProvider fsmProvider; // Provider
     if (Directory.Exists(dir)) {
         fsmProvider = new FileSyntaxModeProvider(dir); // Create new provider with the highlighting directory.
         HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider); // Attach to the text editor.
     }
 }
        public SourceForm()
        {
            InitializeComponent();

            // Syntax Highlighting
            var fsmProvider = new FileSyntaxModeProvider(Environment.CurrentDirectory);
            HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider);
            textBoxSource.SetHighlighting("QL");

            // Fill demo presets
            _demoPresets.Add("Empty Form", "form formName { }");
            _demoPresets.Add("Questions", "form formName { \r\n\t\"Does it work?\" boolQ1: boolean\r\n\t\"And with two questions?\" boolQ2: boolean\r\n}");
            _demoPresets.Add("Conditional", "form formName {\r\n\t\"Display next question?\" boolQ1: boolean\r\n\tif (boolQ1) {\r\n\t\t\"Did you like it?\" boolQ2: boolean\r\n\t}\r\n}");
            _demoPresets.Add("Assignment", "form formName {\r\n\t\"Income?\" intQ1: integer\r\n\t\"Tax amount\" intTax = intQ1 / 100 * 52\r\n}");
            comboBoxDemos.Items.AddRange(_demoPresets.Keys.ToArray());
        }
Пример #4
0
        private static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var controller = new SingleInstanceController(typeof(MainForm));
            controller.MainFormCreated += delegate
            {
                Container = new UnityContainer().LoadConfiguration("compiler");
                ToolStripManager.Renderer = new Office2007Renderer.Office2007Renderer();
                var dir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); // Insert the path to your xshd-files.
                var fsmProvider = new FileSyntaxModeProvider(dir);
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider); // Attach to the text editor.
            };
            controller.Run(args);
        }
Пример #5
0
        private void QueryControl_Load(object sender, EventArgs e)
        {
            string strPathXSHD =@"..\..\EditorResources";
            FileSyntaxModeProvider provider = new FileSyntaxModeProvider(strPathXSHD);
            HighlightingManager manager = HighlightingManager.Manager;
            manager.AddSyntaxModeFileProvider(provider);
            rtQuery.Document.HighlightingStrategy = manager.FindHighlighter("CESQL");

            rtQuery.Font = new Font("Trebuchet MS", 10, FontStyle.Regular);
            rtQuery.ShowEOLMarkers = false;
            rtQuery.ShowInvalidLines = false;
            rtQuery.ShowSpaces = false;
            rtQuery.ShowTabs = false;
            rtQuery.ShowVRuler = false;
            rtQuery.ShowHRuler = false;
            rtQuery.IsIconBarVisible = false;
            rtQuery.ShowLineNumbers = false;
            rtQuery.AutoScroll = true;

            rtQuery.ActiveTextAreaControl.AllowDrop = true;
        }
Пример #6
0
        /// <summary>
        /// Initialisiert eigene Komponenten
        /// </summary>
        private void InitializeCustomComponent()
        {
            this.menuitemFile = new ToolStripMenuItem();
            this.menuitemFile.Text = "File";
            this.menuitemFile.Click += new System.EventHandler(this.menuitemFile_Click);
            this.menuitemSeparator = new ToolStripSeparator();
            this.menuitemSeparator.Visible = cfgFileManager.CfgFiles.Count > 0;

            //Add Load-MenuItems
            foreach (string path in cfgFileManager.cfgPaths)
            {
                ToolStripMenuItem cfgFileMenuItem = new ToolStripMenuItem();
                cfgFileMenuItem.ToolTipText = path;
                System.Text.RegularExpressions.Regex expr = new System.Text.RegularExpressions.Regex(@"(\\[^\\]+){0,4}$");
                cfgFileMenuItem.Text = "..." + expr.Match(path).ToString();
                cfgFileMenuItem.Tag = path;
                cfgFileMenuItem.Click += new EventHandler(this.cfgFileLoad_Click);
                this.menuitemLoad.DropDownItems.Add(cfgFileMenuItem);
            }
            this.menuitemLoad.DropDownItems.AddRange(
                new System.Windows.Forms.ToolStripItem[] 
                {
                    this.menuitemSeparator,
                    this.menuitemFile
                });

            //TextEditor Anpassungen
            try
            {
                FileSyntaxModeProvider csgoSyntaxProvider = new FileSyntaxModeProvider("highlighting");
                HighlightingManager.Manager.AddSyntaxModeFileProvider(csgoSyntaxProvider);
                textEditor.SetHighlighting("CSGO");
            }
            catch (IOException ioEx)
            { /*TODO*/ }
        }
Пример #7
0
 private void textEditorControl1_Load(object sender, EventArgs e)
 {
     string dirc = Application.StartupPath;
     FileSyntaxModeProvider fsmp;
     if (Directory.Exists(dirc))
     {
         fsmp = new FileSyntaxModeProvider(dirc);
         HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmp);
         textEditorControl1.SetHighlighting("C#");
     }
 }
Пример #8
0
        public CodeEditorPlugin(IHDEHost host, INode node, ISolution solution, ILogger logger)
        {
            FHDEHost   = host;
            FNode      = node;
            FSolution  = solution;
            FLogger    = logger;
            FErrorList = new ViewableCollection <object>();

            if (CompletionIcons.Images.Count == 0)
            {
                var resources = new ComponentResourceManager(typeof(CodeEditorPlugin));
                CompletionIcons.TransparentColor = System.Drawing.Color.Transparent;
                CompletionIcons.Images.Add((System.Drawing.Bitmap)resources.GetObject("Icons.16x16.Class"));
                CompletionIcons.Images.Add((System.Drawing.Bitmap)resources.GetObject("Icons.16x16.Method"));
                CompletionIcons.Images.Add((System.Drawing.Bitmap)resources.GetObject("Icons.16x16.Property"));
                CompletionIcons.Images.Add((System.Drawing.Bitmap)resources.GetObject("Icons.16x16.Field"));
                CompletionIcons.Images.Add((System.Drawing.Bitmap)resources.GetObject("Icons.16x16.Enum"));
                CompletionIcons.Images.Add((System.Drawing.Bitmap)resources.GetObject("Icons.16x16.NameSpace"));
                CompletionIcons.Images.Add((System.Drawing.Bitmap)resources.GetObject("Icons.16x16.Event"));

                var path     = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"..\..\thirdparty"));
                var provider = new SD.FileSyntaxModeProvider(path);
                SD.HighlightingManager.Manager.AddSyntaxModeFileProvider(provider);
            }

            SuspendLayout();

            FCodeEditorForm                     = new Form();
            FCodeEditorForm.Location            = new Point(0, 0);
            FCodeEditorForm.TopLevel            = false;
            FCodeEditorForm.TopMost             = false;
            FCodeEditorForm.Dock                = DockStyle.Fill;
            FCodeEditorForm.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            FCodeEditorForm.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
            FCodeEditorForm.BackColor           = System.Drawing.Color.Silver;
            FCodeEditorForm.ClientSize          = new System.Drawing.Size(881, 476);
            FCodeEditorForm.ControlBox          = false;
            FCodeEditorForm.FormBorderStyle     = System.Windows.Forms.FormBorderStyle.None;
            FCodeEditorForm.MaximizeBox         = false;
            FCodeEditorForm.MinimizeBox         = false;
            FCodeEditorForm.ShowIcon            = false;
            FCodeEditorForm.ShowInTaskbar       = false;
            FCodeEditorForm.SizeGripStyle       = System.Windows.Forms.SizeGripStyle.Hide;
            FCodeEditorForm.TopMost             = true;
            FCodeEditorForm.Show();

            FEditor      = new CodeEditor(FCodeEditorForm, FLogger);
            FEditor.Dock = DockStyle.Fill;
            FCodeEditorForm.Controls.Add(FEditor);

            FErrorTableViewer              = new TableViewer();
            FErrorTableViewer.Dock         = DockStyle.Bottom;
            FErrorTableViewer.TabIndex     = 0;
            FErrorTableViewer.DoubleClick += FErrorTableViewerDoubleClick;
            FErrorTableViewer.AutoSize     = true;
            FErrorTableViewer.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            FErrorTableViewer.MaximumSize  = new Size(0, 100);

            Controls.Add(FCodeEditorForm);
            Controls.Add(FErrorTableViewer);

            ResumeLayout(false);
            PerformLayout();

            var registry = new MappingRegistry();

            registry.RegisterDefaultMapping <IEnumerable <Column>, ErrorCollectionColumnProvider>();
            registry.RegisterMapping <CompilerError, IEnumerable <ICell>, ErrorCellProvider>();
            registry.RegisterMapping <RuntimeError, IEnumerable <ICell>, RuntimeErrorCellProvider>();

            FErrorTableViewer.Registry = registry;
            FErrorTableViewer.Input    = FErrorList;

            FEditor.LinkClicked += FEditor_LinkClicked;
        }
Пример #9
0
        private void InitHighlighting()
        {
            string dir = Path.Combine(Application.StartupPath, @"Highlighting\");
            if (Directory.Exists(dir))
            {
                var fsmProvider = new FileSyntaxModeProvider(dir);
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider);
                textEditorControl1.SetHighlighting("Scrape");
            }

            _executionHighlight = new HighlightColor(Color.Black, Color.Yellow, false, false);
            var highlightingStrategy = textEditorControl1.Document.HighlightingStrategy as DefaultHighlightingStrategy;
            _defaultHighlight = highlightingStrategy.GetColorFor("Selection");
        }
Пример #10
0
        /// <summary>The load highlighting provider.</summary>
        public void LoadHighlightingProvider()
        {
            if (_highlightingProviderLoaded)
            {
                return;
            }

            // see: http://wiki.sharpdevelop.net/Syntax%20highlighting.ashx
            string dir = Path.GetDirectoryName(GetType().Assembly.Location);
            FileSyntaxModeProvider fsmProvider = new FileSyntaxModeProvider(dir);
            HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider); // Attach to the text editor.
            _highlightingProviderLoaded = true;
        }
Пример #11
0
        private void rnkEd_Load(object sender, EventArgs e)
        {
            string dizin = Application.StartupPath;
            FileSyntaxModeProvider renklendirici;
            if (Directory.Exists(dizin))
            {
                renklendirici = new FileSyntaxModeProvider(dizin);
                HighlightingManager.Manager.AddSyntaxModeFileProvider(renklendirici);
                //rnkEd.SetHighlighting();

            }
        }
Пример #12
0
 private void cSSToolStripMenuItem_Click(object sender, EventArgs e)
 {
     textEditorControl1.Text = "";
     string dirc = Application.StartupPath;
     FileSyntaxModeProvider fsmp;
     if (Directory.Exists(dirc))
     {
         fsmp = new FileSyntaxModeProvider(dirc);
         HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmp);
         textEditorControl1.SetHighlighting("CSS");
     }
     TYPE = DocType.CSS;
 }
Пример #13
0
        private void InitializeEditor()
        {
            string path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);

            if (path.ToLower().StartsWith("file:\\"))
            {
                path = path.Substring(6);
            }

            // define a provider that will look in the applications executing directory
            FileSyntaxModeProvider fsmProvider = new FileSyntaxModeProvider(path);

            // add that provider to the highlight manager
            HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider);

            scriptEditor.SuspendLayout();

            // set the highlighting, the name must match what is in the file
            scriptEditor.SetHighlighting("aiscript");
            scriptEditor.ShowEOLMarkers = false;
            scriptEditor.ShowSpaces = false;
            scriptEditor.ShowTabs = false;
            scriptEditor.IndentStyle = IndentStyle.Smart;
            scriptEditor.BracketMatchingStyle = BracketMatchingStyle.Before;
            scriptEditor.Document.FoldingManager.FoldingStrategy = new AIScriptFoldingStrategy();
            scriptEditor.TextEditorProperties.EnableFolding=true;
            scriptEditor.ActiveTextAreaControl.TextArea.KeyDown += new System.Windows.Forms.KeyEventHandler(TextArea_KeyDown);
            scriptEditor.ActiveTextAreaControl.BackColor = scriptEditor.BackColor;
            scriptEditor.ActiveTextAreaControl.TextArea.BackColor = scriptEditor.BackColor;
            scriptEditor.Document.DocumentChanged += new DocumentEventHandler(Document_DocumentChanged);
            scriptEditor.ResumeLayout(false);
        }
Пример #14
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            datosProceso.Ciudades = RepoGeneral.Lista();
            ComboCiudad.ComboBox.DataSource = datosProceso.Ciudades;
            foreach (var fuente in fuentesFactory.Fuentes) {
                listViewFuentes.Items.Add(fuente.Name);
            }
            foreach (var proc in procesosFactory.Procesos) {
                listBoxProcesos.Items.Add(proc.Nombre);
            }

            openFileDialog1.InitialDirectory = config.CarpetaTrabajo;
            FillScripts();

            var fsmProvider = new FileSyntaxModeProvider(Environment.CurrentDirectory); // Create new provider with the highlighting directory.
            HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider); // Attach to the text editor.
            editorScript.SetHighlighting("Boo"); // Activate the highlighting, use the name from the SyntaxDefinition node.
            var font = editorScript.TextEditorProperties.Font;
            editorScript.TextEditorProperties.Font = new Font(font.FontFamily, 8);
            editorScript.ActiveTextAreaControl.TextArea.DoProcessDialogKey += TextArea_DoProcessDialogKey;
            comboFont.Text = "8";

            listViewFichas.SelectedIndexChanged += ListaSelectedIndexChanged;
            listViewCatalogos.SelectedIndexChanged += ListaSelectedIndexChanged;
            listViewMapeos.SelectedIndexChanged += ListaSelectedIndexChanged;
            listViewFuentes.SelectedIndexChanged += ListaSelectedIndexChanged;
        }