protected void Initialize()
        {
            Logger.LogInfo("WQE.net", "Launching SQL IDE\n");

            InitializeComponent();

            Logger.LogDebug("WQE.net", 1, "Setup of generated UI done\n");
            outputSelector.SelectedIndex = 0;

            TabText = dbSqlEditorBE.get_title();

            Logger.LogDebug("WQE.net", 2, "Creating Log View\n");
            logView                        = new GridView(dbSqlEditorBE.log());
            logView.AutoScroll             = true;
            logView.RowHeadersVisible      = false;
            logView.Parent                 = actionPanel;
            logView.AllowAutoResizeColumns = false;

            // Some visual setup of the header.
            logView.ColumnHeadersBorderStyle           = DataGridViewHeaderBorderStyle.Single;
            logView.ColumnHeadersDefaultCellStyle.Font = ControlUtilities.GetFont("Segoe UI", 7.5f);
            logView.ColumnHeadersHeightSizeMode        = DataGridViewColumnHeadersHeightSizeMode.AutoSize;

            dbSqlEditorBE.log().refresh_ui_cb(logView.ProcessModelRowsChange);
            logView.ProcessModelChange();
            logView.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            logView.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            logView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            logView.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            logView.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            logView.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            logView.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            logView.SelectionMode           = DataGridViewSelectionMode.FullRowSelect;
            logView.ForeColor = Color.Black;
            logView.CellContextMenuStripNeeded += new DataGridViewCellContextMenuStripNeededEventHandler(logView_CellContextMenuStripNeeded);

            Logger.LogDebug("WQE.net", 1, "Creating History View\n");
            historyEntriesView                   = new GridView(dbSqlEditorBE.history().entries_model());
            historyEntriesView.AutoScroll        = true;
            historyEntriesView.ForeColor         = Color.Black;
            historyEntriesView.MultiSelect       = false;
            historyEntriesView.RowHeadersVisible = false;
            historyEntriesView.Parent            = historySplitContainer.Panel1;
            dbSqlEditorBE.history().entries_model().refresh_ui_cb(ProcessModelHistoryEntryRowsChange);
            historyEntriesView.ProcessModelChange();
            historyEntriesView.AutoSizeColumnsMode         = DataGridViewAutoSizeColumnsMode.Fill;
            historyEntriesView.SelectionMode               = DataGridViewSelectionMode.FullRowSelect;
            historyEntriesView.RowEnter                   += new DataGridViewCellEventHandler(historyEntriesView_RowEnter);
            historyEntriesView.CellContextMenuStripNeeded += historyEntriesView_CellContextMenuStripNeeded;
            historyEntriesView.SetRowSelected(0);
            {
                Logger.LogDebug("WQE.net", 1, "Setting up menu for History View\n");

                // TODO: replace by mforms backed menu. Then remove SqlIdeMenuManager.
                // See if WorkbenchToolbarManager.cs can go entirely when done.
                SqlIdeMenuManager.MenuContext popupMenuContext = new SqlIdeMenuManager.MenuContext();
                popupMenuContext.GetNodesMenuItems  = historyEntriesView.Model.get_popup_items_for_nodes;
                popupMenuContext.GetSelectedNodes   = historyEntriesView.SelectedNodes;
                popupMenuContext.TriggerNodesAction = historyEntriesView.Model.activate_popup_item_for_nodes;
                SqlIdeMenuManager.InitMenu(historyListMenuStrip, popupMenuContext);
            }

            Logger.LogDebug("WQE.net", 1, "Setting up History Details View\n");
            historyDetailsView                             = new GridView(dbSqlEditorBE.history().details_model());
            historyDetailsView.AutoScroll                  = true;
            historyDetailsView.ForeColor                   = Color.Black;
            historyDetailsView.RowHeadersVisible           = false;
            historyDetailsView.Parent                      = historySplitContainer.Panel2;
            historyDetailsView.CellContextMenuStripNeeded += new DataGridViewCellContextMenuStripNeededEventHandler(historyDetailsView_CellContextMenuStripNeeded);
            dbSqlEditorBE.history().details_model().refresh_ui_cb(historyDetailsView.ProcessModelRowsChange);
            historyDetailsView.ProcessModelChange();
            historyDetailsView.AutoSizeColumnsMode     = DataGridViewAutoSizeColumnsMode.Fill;
            historyDetailsView.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            historyDetailsView.SelectionMode           = DataGridViewSelectionMode.FullRowSelect;
            historyDetailsView.CellDoubleClick        += new DataGridViewCellEventHandler(historyDetailsView_CellDoubleClick);

            Logger.LogDebug("WQE.net", 1, "Setting callbacks to backend\n");
            dbSqlEditorBE.set_post_query_cb(AfterExecSql);
            dbSqlEditorBE.exec_sql_task.progress_cb(OnExecSqlProgress);
            dbSqlEditorBE.set_busy_tab_cb(SetBusyTab);

            Logger.LogDebug("WQE.net", 1, "Setting up side bar\n");
            Control sidebar = dbSqlEditorBE.get_sidebar_control();

            sideArea.Controls.Add(sidebar);
            sidebar.Dock = DockStyle.Fill;

            // Help/snippets palette.
            Logger.LogDebug("WQE.net", 1, "Setting up secondary sidebar\n");
            Control palette = dbSqlEditorBE.get_palette_control();

            rightSplitContainer.Panel1.Controls.Add(palette);
            palette.Dock = DockStyle.Fill;
            palette.Show();

            UpdateColors();

            dbSqlEditorBE.set_docking_delegate(new MainPaneDockDelegate(this));

            ManagedNotificationCenter.AddObserver(this, "GNFormTitleDidChange");

            Logger.LogDebug("WQE.net", 1, "Initialization done\n");
        }
Example #2
0
        protected void Initialize()
        {
            Logger.LogInfo("WQE.net", "Launching SQL IDE\n");

              InitializeComponent();

              Logger.LogDebug("WQE.net", 1, "Setup of generated UI done\n");
              outputSelector.SelectedIndex = 0;

              TabText = dbSqlEditorBE.get_title();

              Logger.LogDebug("WQE.net", 2, "Creating Log View\n");
              logView = new GridView(dbSqlEditorBE.log());
              logView.AutoScroll = true;
              logView.RowHeadersVisible = false;
              logView.Parent = actionPanel;
              logView.AllowAutoResizeColumns = false;

              // Some visual setup of the header.
              logView.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
              logView.ColumnHeadersDefaultCellStyle.Font = ControlUtilities.GetFont("Segoe UI", 7.5f);
              logView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;

              dbSqlEditorBE.log().refresh_ui_cb(logView.ProcessModelRowsChange);
              logView.ProcessModelChange();
              logView.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
              logView.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
              logView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
              logView.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
              logView.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
              logView.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
              logView.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
              logView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
              logView.ForeColor = Color.Black;
              logView.CellContextMenuStripNeeded += new DataGridViewCellContextMenuStripNeededEventHandler(logView_CellContextMenuStripNeeded);

              Logger.LogDebug("WQE.net", 1, "Creating History View\n");
              historyEntriesView = new GridView(dbSqlEditorBE.history().entries_model());
              historyEntriesView.AutoScroll = true;
              historyEntriesView.ForeColor = Color.Black;
              historyEntriesView.MultiSelect = false;
              historyEntriesView.RowHeadersVisible = false;
              historyEntriesView.Parent = historySplitContainer.Panel1;
              dbSqlEditorBE.history().entries_model().refresh_ui_cb(ProcessModelHistoryEntryRowsChange);
              historyEntriesView.ProcessModelChange();
              historyEntriesView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
              historyEntriesView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
              historyEntriesView.RowEnter += new DataGridViewCellEventHandler(historyEntriesView_RowEnter);
              historyEntriesView.CellContextMenuStripNeeded += historyEntriesView_CellContextMenuStripNeeded;
              historyEntriesView.SetRowSelected(0);
              {
            Logger.LogDebug("WQE.net", 1, "Setting up menu for History View\n");

            // TODO: replace by mforms backed menu. Then remove SqlIdeMenuManager.
            // See if WorkbenchToolbarManager.cs can go entirely when done.
            SqlIdeMenuManager.MenuContext popupMenuContext = new SqlIdeMenuManager.MenuContext();
            popupMenuContext.GetNodesMenuItems = historyEntriesView.Model.get_popup_items_for_nodes;
            popupMenuContext.GetSelectedNodes = historyEntriesView.SelectedNodes;
            popupMenuContext.TriggerNodesAction = historyEntriesView.Model.activate_popup_item_for_nodes;
            SqlIdeMenuManager.InitMenu(historyListMenuStrip, popupMenuContext);
              }

              Logger.LogDebug("WQE.net", 1, "Setting up History Details View\n");
              historyDetailsView = new GridView(dbSqlEditorBE.history().details_model());
              historyDetailsView.AutoScroll = true;
              historyDetailsView.ForeColor = Color.Black;
              historyDetailsView.RowHeadersVisible = false;
              historyDetailsView.Parent = historySplitContainer.Panel2;
              historyDetailsView.CellContextMenuStripNeeded += new DataGridViewCellContextMenuStripNeededEventHandler(historyDetailsView_CellContextMenuStripNeeded);
              dbSqlEditorBE.history().details_model().refresh_ui_cb(historyDetailsView.ProcessModelRowsChange);
              historyDetailsView.ProcessModelChange();
              historyDetailsView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
              historyDetailsView.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
              historyDetailsView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
              historyDetailsView.CellDoubleClick += new DataGridViewCellEventHandler(historyDetailsView_CellDoubleClick);

              Logger.LogDebug("WQE.net", 1, "Setting callbacks to backend\n");
              dbSqlEditorBE.set_post_query_cb(AfterExecSql);
              dbSqlEditorBE.exec_sql_task.progress_cb(OnExecSqlProgress);
              dbSqlEditorBE.set_busy_tab_cb(SetBusyTab);

              Logger.LogDebug("WQE.net", 1, "Setting up side bar\n");
              Control sidebar = dbSqlEditorBE.get_sidebar_control();
              sideArea.Controls.Add(sidebar);
              sidebar.Dock = DockStyle.Fill;

              // Help/snippets palette.
              Logger.LogDebug("WQE.net", 1, "Setting up secondary sidebar\n");
              Control palette = dbSqlEditorBE.get_palette_control();
              rightSplitContainer.Panel1.Controls.Add(palette);
              palette.Dock = DockStyle.Fill;
              palette.Show();

              UpdateColors();

              dbSqlEditorBE.set_docking_delegate(new MainPaneDockDelegate(this));

              ManagedNotificationCenter.AddObserver(this, "GNFormTitleDidChange");

              Logger.LogDebug("WQE.net", 1, "Initialization done\n");
        }