public SimpleSyntaxEditor(string text, SyntaxLanguageStyle language)
 {
     ActiproSoftware.SyntaxEditor.SyntaxEditor editor = new ActiproSoftware.SyntaxEditor.SyntaxEditor {
         Dock = DockStyle.Fill
     };
     editor.set_IndicatorMarginVisible(false);
     editor.set_ScrollBarType(0);
     this._editor = editor;
     base.Controls.Add(this._editor);
     try
     {
         this.Font = new Font("Consolas", 10f);
         if (this.Font.Name != "Consolas")
         {
             this.Font = new Font("Courier New", 10f);
         }
     }
     catch
     {
     }
     string name = language.ToString();
     if (name == "VB")
     {
         name = name + "DotNet";
     }
     if (language != SyntaxLanguageStyle.None)
     {
         this._editor.get_Document().set_Language(DocumentManager.GetDynamicLanguage(name, SystemColors.Window.GetBrightness()));
         this._editor.get_Document().get_Outlining().set_Mode(2);
         this._editor.set_BracketHighlightingVisible(true);
     }
     this._editor.get_Document().set_ReadOnly(true);
     VisualStudio2005SyntaxEditorRenderer renderer = new VisualStudio2005SyntaxEditorRenderer();
     SimpleBorder border = new SimpleBorder();
     border.set_Style(0);
     renderer.set_Border(border);
     VisualStudio2005SyntaxEditorRenderer renderer2 = renderer;
     this._editor.set_Renderer(renderer2);
     this.Text = text;
 }
Пример #2
0
 internal void UpdateColors(bool forceChange)
 {
     if (forceChange || !string.IsNullOrEmpty(UserOptions.Instance.EditorBackColor))
     {
         try
         {
             BackgroundFill fill;
             VisualStudio2005SyntaxEditorRenderer renderer = base.get_Renderer();
             renderer.set_SelectionMarginBackgroundFill(fill = new SolidColorBackgroundFill(UserOptions.Instance.ActualEditorBackColor));
             renderer.set_TextAreaBackgroundFill(fill);
         }
         catch
         {
         }
     }
 }
Пример #3
0
        /// <summary>
        /// Constructor</summary>
        public SyntaxEditorControl()
        {
            // Uncomment the next line and use something like
            // CodeEditor to open a document and see these results.
            //PerformAndShowAuditStuff();

            var doc = new Document { LineModificationMarkingEnabled = true };
            doc.Outlining.Mode = OutliningMode.Automatic;

            Location = new Point(0, 0);
            Name = "editor";
            base.AllowDrop = false;
            Document = doc;
            DefaultContextMenuEnabled = true;
            IntelliPrompt.DropShadowEnabled = true;
            IntelliPrompt.SmartTag.ClearOnDocumentModification = true;
            IntelliPrompt.SmartTag.MultipleSmartTagsEnabled = false;
            LineNumberMarginVisible = true;
            IndentType = IndentType.Smart;
            BracketHighlightingVisible = true;
            SplitType = SyntaxEditorSplitType.FourWay;

            DocumentIndicatorRemoved += EditorDocumentIndicatorRemoved;
            SmartIndent += EditorSmartIndent;
            DocumentSyntaxLanguageLoaded += EditorDocumentSyntaxLanguageLoaded;
            DocumentIndicatorAdded += EditorDocumentIndicatorAdded;
            KeyTyping += EditorKeyTyping;
            ViewMouseHover += EditorViewMouseHover;
            DocumentTextChanged += EditorDocumentTextChanged;
            ContextMenuRequested += EditorContextMenuRequested;
            PasteDragDrop += EditorPasteDragDrop;
            TriggerActivated += EditorTriggerActivated;
            ViewMouseDown += EditorViewMouseDown;
            base.SelectionChanged += SyntaxEditorControlSelectionChanged;

            m_findReplaceOptions = new FindReplaceOptions();
            m_findReplaceForm = new FindReplaceForm(this, m_findReplaceOptions);

            if (s_imgList == null)
                s_imgList = ReflectionImageList;

            // Added by PJO
            KeyUp += SyntaxEditorControlKeyUp;
            MouseUp += SyntaxEditorControlMouseUp;

            Renderer = new VisualStudio2005SyntaxEditorRenderer();
        }
Пример #4
0
        public SimpleSyntaxEditor(string text, SyntaxLanguageStyle language)
        {
            ActiproSoftware.SyntaxEditor.SyntaxEditor editor = new ActiproSoftware.SyntaxEditor.SyntaxEditor {
                Dock = DockStyle.Fill
            };
            editor.set_IndicatorMarginVisible(false);
            editor.set_ScrollBarType(0);
            this._editor = editor;
            base.Controls.Add(this._editor);
            try
            {
                this.Font = new Font("Consolas", 10f);
                if (this.Font.Name != "Consolas")
                {
                    this.Font = new Font("Courier New", 10f);
                }
            }
            catch
            {
            }
            string name = language.ToString();

            if (name == "VB")
            {
                name = name + "DotNet";
            }
            if (language != SyntaxLanguageStyle.None)
            {
                this._editor.get_Document().set_Language(DocumentManager.GetDynamicLanguage(name, SystemColors.Window.GetBrightness()));
                this._editor.get_Document().get_Outlining().set_Mode(2);
                this._editor.set_BracketHighlightingVisible(true);
            }
            this._editor.get_Document().set_ReadOnly(true);
            VisualStudio2005SyntaxEditorRenderer renderer = new VisualStudio2005SyntaxEditorRenderer();
            SimpleBorder border = new SimpleBorder();

            border.set_Style(0);
            renderer.set_Border(border);
            VisualStudio2005SyntaxEditorRenderer renderer2 = renderer;

            this._editor.set_Renderer(renderer2);
            this.Text = text;
        }
Пример #5
0
 internal QueryControl(RunnableQuery q, SchemaTree schemaTree)
 {
     EventHandler onClick = null;
     EventHandler handler2 = null;
     EventHandler handler3 = null;
     EventHandler handler4 = null;
     SplitterCancelEventHandler handler5 = null;
     this._browserHidden = true;
     Timer timer = new Timer {
         Interval = 0x2710,
         Enabled = true
     };
     this._autoSaveTimer = timer;
     this._executionTrackingTimer = new Timer();
     this._pluginWinButtons = new List<ToolStripButton>();
     this._query = new RunnableQuery();
     this.NextQueryRequest = delegate (object sender, EventArgs e) {
     };
     this.PreviousQueryRequest = delegate (object sender, EventArgs e) {
     };
     this._lambdaData = new MemoryStream();
     this._ilDirty = true;
     this._ilData = new MemoryStream();
     this._queryCount = 0;
     Timer timer2 = new Timer {
         Interval = 200
     };
     this._refreshTimer = timer2;
     Timer timer3 = new Timer {
         Interval = 200
     };
     this._clockTimer = timer3;
     this._firstResultsShow = true;
     this._lastQueryKind = QueryLanguage.SQL;
     this._suppressPullCount = 0;
     this._random = new Random();
     this.components = null;
     this._query = q;
     this._schemaTree = schemaTree;
     try
     {
         this.Font = FontManager.GetDefaultFont();
     }
     catch
     {
     }
     this.InitializeComponent();
     this.CheckIsMyExtensions();
     this._pluginWinManager = new PluginWindowManager(this);
     this._pluginWinButtonMenu = new ContextMenuStrip(this.components);
     if (onClick == null)
     {
         onClick = (sender, e) => this.CloseCurrentVisualizer();
     }
     this._pluginWinButtonMenu.Items.Add("Close visualizer (Shift+F4 or Middle-Click or Ctrl+Click)", Resources.Delete, onClick);
     if (this.btnExecute.Height > 0x20)
     {
         this.btnExecute.Height -= 3;
         this.cboLanguage.Margin = new Padding(this.cboLanguage.Margin.Left, 2, this.cboLanguage.Margin.Right, 4);
         this.cboDb.Margin = new Padding(this.cboDb.Margin.Left, 2, this.cboDb.Margin.Right, 4);
     }
     else if (this.btnExecute.Height > 0x1d)
     {
         this.btnExecute.Height -= 2;
     }
     else if (this.btnExecute.Height > 0x18)
     {
         this.btnExecute.Height--;
     }
     this.btnCancel.Height = this.btnExecute.Height;
     this.btnText.Height = this.btnGrids.Height = this.btnExecute.Height - 1;
     if ((IntPtr.Size == 4) && (this.btnExecute.Height > 0x1b))
     {
         Padding margin = this.cboLanguage.Margin;
         this.cboLanguage.Margin = new Padding(margin.Left, margin.Top, margin.Right, margin.Bottom - 1);
         margin = this.cboDb.Margin;
         this.cboDb.Margin = new Padding(margin.Left, margin.Top, margin.Right, margin.Bottom - 1);
     }
     if (this.btnExecute.Height > 40)
     {
         this.btnExecute.Image = ControlUtil.ResizeImage(this.btnExecute.Image, this.btnExecute.Width, this.btnExecute.Height, true);
         this.btnCancel.Image = ControlUtil.ResizeImage(this.btnCancel.Image, this.btnCancel.Width, this.btnCancel.Height, true);
         this.btnGrids.Image = ControlUtil.ResizeImage(this.btnGrids.Image, (this.btnGrids.Width * 3) / 4, (this.btnGrids.Height * 3) / 4, true);
         this.btnText.Image = ControlUtil.ResizeImage(this.btnText.Image, (this.btnText.Width * 3) / 4, (this.btnText.Height * 3) / 4, true);
     }
     this.UpdateAutocompletionMsg();
     try
     {
         this.txtError.Font = new Font("Verdana", 8.25f);
         this.txtSQL.Font = new Font("Verdana", 9.5f);
         this.btnActivateAutocompletion.Font = new Font("Verdana", 8f, FontStyle.Bold);
         this.lblOptimize.Font = new Font("Verdana", 7f, FontStyle.Bold);
     }
     catch
     {
     }
     this.txtSQL.get_Document().set_Language(DocumentManager.GetDynamicLanguage("SQL", SystemColors.Window.GetBrightness()));
     this.txtSQL.get_Document().get_Outlining().set_Mode(2);
     this.txtSQL.set_BracketHighlightingVisible(true);
     this.txtSQL.get_Document().set_ReadOnly(true);
     VisualStudio2005SyntaxEditorRenderer renderer = new VisualStudio2005SyntaxEditorRenderer();
     SimpleBorder border = new SimpleBorder();
     border.set_Style(0);
     renderer.set_Border(border);
     VisualStudio2005SyntaxEditorRenderer renderer2 = renderer;
     this.txtSQL.set_Renderer(renderer2);
     this._docMan = new DocumentManager(this._query, this);
     this.CreateEditor();
     this.PropagateOptions();
     this.UpdateEditorZoom();
     this.CreateBrowser();
     this._browserHidden = true;
     this.panBottom.BorderStyle = BorderStyle.None;
     this.tsOutput.BackColor = Color.Transparent;
     this.tsOutput.Renderer = new OutputToolsRenderer();
     this.statusStrip.BackColor = Color.Transparent;
     this.statusStrip.Padding = new Padding(this.statusStrip.Padding.Left, this.statusStrip.Padding.Top, this.statusStrip.Padding.Left, this.statusStrip.Padding.Bottom);
     this.PullData(QueryChangedEventArgs.Refresh);
     this.ToggleResultsCollapse();
     this._query.QueryCompiled += new EventHandler<QueryCompilationEventArgs>(this._query_QueryCompiled);
     this._query.PluginsReady += new EventHandler(this._query_PluginsReady);
     this._query.CustomClickCompleted += new EventHandler(this._query_CustomClickCompleted);
     this._query.QueryCompleted += new EventHandler<QueryStatusEventArgs>(this._query_QueryCompleted);
     this._query.QueryChanged += new EventHandler<QueryChangedEventArgs>(this._query_QueryChanged);
     this._query.ReadLineRequested += new EventHandler<ReadLineEventArgs>(this._query_ReadLineRequested);
     this._editor.TextChanged += new EventHandler(this._editor_TextChanged);
     this._editor.add_SelectionChanged(new SelectionEventHandler(this, (IntPtr) this._editor_SelectionChanged));
     this._editor.RepositoryDropped += new EventHandler<QueryEditor.RepositoryEventArgs>(this._editor_RepositoryDropped);
     this._schemaTree.AfterSelect += new TreeViewEventHandler(this._schemaTree_AfterSelect);
     this._docMan.CheckForRepositoryChange();
     this._refreshTimer.Tick += new EventHandler(this.RefreshTimer_Tick);
     this._clockTimer.Tick += new EventHandler(this.ClockTimer_Tick);
     this._autoSaveTimer.Tick += new EventHandler(this.AutoSaveTimer_Tick);
     if (handler2 == null)
     {
         handler2 = (sender, e) => this.ReportMainThreadPosition();
     }
     this._executionTrackingTimer.Tick += handler2;
     if (SystemColors.Window.GetBrightness() < 0.5f)
     {
         this.llDbUseCurrent.ForeColor = SystemColors.HotTrack;
     }
     this.ExtendOutputSplitter();
     if (handler3 == null)
     {
         handler3 = (sender, e) => this.UpdateErrorHeight();
     }
     this.panError.SizeChanged += handler3;
     this.statusStrip.Parent = null;
     base.Controls.Add(this.statusStrip);
     this.statusStrip.SendToBack();
     if (handler4 == null)
     {
         handler4 = (sender, e) => this.RequestWinManagerRelocation();
     }
     EventHandler handler6 = handler4;
     this.panOutput.Resize += handler6;
     for (Control control = this.panOutput; control != null; control = control.Parent)
     {
         control.Move += handler6;
     }
     this._query.PluginWindowManager = this._pluginWinManager;
     this.queryProgressBar.Margin = new Padding(3, 3, 0, 1);
     this.tsOutput.Padding = new Padding(0, 0, 0, 2);
     this.splitContainer.SplitterWidth--;
     if (handler5 == null)
     {
         handler5 = delegate (object sender, SplitterCancelEventArgs e) {
             if (Control.MouseButtons == MouseButtons.Left)
             {
                 MainForm.Instance.IsSplitting = true;
             }
             if ((this.panOutput.BackColor == MainForm.Instance.TransparencyKey) && (this.panOutput.BackColor != Program.LightTransparencyKey))
             {
                 this.panOutput.BackColor = MainForm.Instance.TransparencyKey = Program.LightTransparencyKey;
             }
         };
     }
     this.splitContainer.SplitterMoving += handler5;
     this.panOutput.BorderStyle = BorderStyle.None;
     this.panOutput.BorderColor = Color.FromArgb(160, 160, 160);
     this.lblSyncDb.Cursor = Cursors.Hand;
     this.toolTip.ShowAlways = true;
     this.EnableControls();
     this.panBottom.Layout += new LayoutEventHandler(this.panBottom_Layout);
 }