Exemplo n.º 1
0
        ObjectsTree CreateObjectTree(SplitterPanel panel, string name, string label)
        {
            ObjectsTree result = new ObjectsTree(name == "allObjectsTree");

            result.tree.ContextMenuStrip = this.tableContextMenu;
            if (result.parseTree != null)
            {
                result.parseTree.ContextMenuStrip = this.parseTreeMenu;
            }
            result.Dock     = System.Windows.Forms.DockStyle.Fill;
            result.Location = new System.Drawing.Point(0, 0);
            result.Name     = name;
            result.Size     = new System.Drawing.Size(300, 300);
            return(result);
        }
Exemplo n.º 2
0
        public main()
        {
            Font = SystemFonts.MessageBoxFont;
            InitializeComponent();

            A.Initialize(this);
            ToolButton.toolTip = ToolCheckBox.toolTip = toolTip;
            Wait.form          = this;
            UI.LoadPreferences();
            focusTextbox.BackColor = horzSplitter.Panel1.BackColor = horzSplitter.Panel2.BackColor = vertSplitter.Panel1.BackColor = vertSplitter.Panel2.BackColor = UI.passiveBackColor;

            SuspendLayout();

            goButton = new ToolButton(bigButtonImages, 0, new EventHandler(OnRunClicked), null);
            goButton.SetText("Go");
            horzSplitter.Panel1.Controls.Add(goButton);
            addButton = new ToolButton(bigButtonImages, 7, new EventHandler(OnNewClicked), "New Query");
            horzSplitter.Panel1.Controls.Add(addButton);

            leftTabs                       = new NiceTabControl();
            leftTabs.MinHeight             = 32;
            leftTabs.ContextMenuStrip      = this.tabContextMenu;
            leftTabs.ImageList             = bigButtonImages;
            leftTabs.DropdownImageIndex    = 6;
            leftTabs.OnSelectedTabChanged += new EventHandler(OnLeftTabChanged);
            horzSplitter.Panel1.Controls.Add(leftTabs);

            rightTabs                       = new NiceTabControl();
            rightTabs.ImageList             = bigButtonImages;
            rightTabs.MinHeight             = 32;
            rightTabs.DropdownImageIndex    = 6;
            rightTabs.OnSelectedTabChanged += new EventHandler(OnRightTabChanged);
            rightTabs.AddTab("Structure", objectSplitter);   // , S.Get("showDatabaseObjects", true));
            rightTabs.AddTab("Query History", queryHistory); // , Settings.Get("showQueryHistory", false));
            rightTabs.AddTab("Log", logTextBox);             // , Settings.Get("showLog", false));
            horzSplitter.Panel2.Controls.Add(rightTabs);

            allObjectsTree = CreateObjectTree(objectSplitter.Panel2, "allObjectsTree", "All Objects");
            objectSplitter.Panel2.Controls.Add(allObjectsTree);
            activeObjectsTree = CreateObjectTree(objectSplitter.Panel1, "activeObjectsTree", "Active Objects");
            objectSplitter.Panel1.Controls.Add(activeObjectsTree);

            rowCount.Width  = FormsToolbox.GetTextWidth("00000000000000", Font);
            queryTime.Width = FormsToolbox.GetTextWidth(" 00:00 ", Font);
            rowCount.Text   = queryTime.Text = "";

            autoComplete = new AutoSuggest(this, editor);
            Controls.Add(autoComplete);

            editorHeader = new EditorHeader(this, autoComplete);
            horzSplitter.Panel1.Controls.Add(editorHeader);

            resultsList = new ResultsListView(this);
            resultsList.ContextMenuStrip = resultsMenu;
            vertSplitter.Panel2.Controls.Add(resultsList);
            Query.resultsList = resultsList;
            clipboardHelper   = new ClipboardHelper(editor, logTextBox, resultsList);

            queryHistory = new QueryListView();
            queryHistory.ContextMenuStrip = queryHistoryMenuStrip;
            horzSplitter.Panel2.Controls.Add(queryHistory);
            UpdateUIPreferences(false);

            Parser.onParsed = OnParsed;

            objectSplitter.SplitterWidth = vertSplitter.SplitterWidth = horzSplitter.SplitterWidth = 10;
            ResumeLayout();

            background.DoWork += new System.ComponentModel.DoWorkEventHandler(BackgroundInitialize);
            Background.status  = BackgroundStatus.Loading;
            background.RunWorkerAsync();

            Width  = Math.Max(600, T.Coalesce(S.initSettings.width, 900));
            Height = Math.Max(400, T.Coalesce(S.initSettings.height, 600));

            editor.MouseDown += new MouseEventHandler(OnEditorMouseDown);
            editor.KeyDown   += new KeyEventHandler(OnEditorKeyDown);
            editor.Leave     += new EventHandler(OnEditorLostFocus);
            timer.Tick       += OnIdle;

            loading = new Loading(this);
            StartBackgroundLoading();

            Application.Idle  += OnIdle;
            queryHistory.dirty = true;
        }