public WheelMessageFilter(ModelOverviewForm form)
 {
     this.form = form;
 }
Exemple #2
0
        public void RefreshGUI(RefreshType refresh, String str, IntPtr ptr)
        {
            if (IsDisposed || Disposing)
            return;

              SuspendLayout();

              switch (refresh)
              {
            case RefreshType.RefreshCloseDocument:
              {
            ForwardRefreshToAllDocuments(refresh, str, ptr);
            if (workbenchPhysicalOverviewForm != null)
            {
              workbenchPhysicalOverviewForm.ResetDocument(true);
              workbenchPhysicalOverviewForm.Close();
              workbenchPhysicalOverviewForm = null;
            }

            wbContext.flush_idle_tasks();
            wbContext.close_document_finish();

            break;
              }
            case RefreshType.RefreshNewDiagram:
              {
            BaseWindowsCanvasView canvas = BaseWindowsCanvasView.GetFromFixedId(ptr);
            if (canvas != null)
            {
              // Open only diagrams which were open when this model was closed last time.
              ModelDiagramForm modelDiagramForm = canvas.GetOwnerForm() as ModelDiagramForm;
              if (modelDiagramForm != null && !modelDiagramForm.DiagramWrapper.is_closed())
                DockDocument(modelDiagramForm, true, true);
            }
            break;
              }

            case RefreshType.RefreshNewModel: // A new model was loaded or created. Show UI.
              ShowPhysicalOverviewForm(true);

              // Let the backend create what is necessary.
              wbContext.new_model_finish();
              break;

            case RefreshType.RefreshDocument:
            case RefreshType.RefreshCloseEditor:
            case RefreshType.RefreshOverviewNodeInfo:
              ForwardRefreshToAllDocuments(refresh, str, ptr);
              break;

            case RefreshType.RefreshSchemaNoReload:
            case RefreshType.RefreshSelection:
            case RefreshType.RefreshZoom:
              ForwardRefreshToActivDocument(refresh, str, ptr);
              break;

            case RefreshType.RefreshTimer:
              UpdateTimer();
              break;

            case RefreshType.RefreshFinishEdits:
              // Force all ongoing edits to be Commited (like in listview cells)
              try
              {
            Control activeControl = ControlUtilities.GetLeafActiveControl(this);
            if (activeControl != null)
            {
              if (activeControl.Parent is Aga.Controls.Tree.TreeViewAdv)
              {
                ActiveControl = null;
              }
            }
              }
              catch (Exception e)
              {
            Program.HandleException(e);
              }
              break;

            case RefreshType.RefreshOverviewNodeChildren:
              if (workbenchPhysicalOverviewForm != null)
            workbenchPhysicalOverviewForm.RefreshGUI(refresh, str, ptr);
              break;
              }

              ResumeLayout();
        }
Exemple #3
0
        public void ShowPhysicalOverviewForm(bool isNew = false)
        {
            if (workbenchPhysicalOverviewForm == null)
            workbenchPhysicalOverviewForm = new ModelOverviewForm(wbContext, wbContext.get_physical_overview());

              //SuspendLayout();
              //contentTabControl.SuspendLayout();
              DockDocument(workbenchPhysicalOverviewForm, true, true);
              Update();
              if (isNew)
            workbenchPhysicalOverviewForm.RebuildModelContents();
              //contentTabControl.ResumeLayout(true);
              //ResumeLayout();

              workbenchPhysicalOverviewForm.Activate();
        }
Exemple #4
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            // Temporarily remove the focus from what ever control has it currently.
              // This way controls that save content on leave get their chance.
              Focus();

              shuttingDown = true;

              // Query all documents if they can close in advance, so they stay open if one says nay.
              // For historical reasons diagram and model overview pages are on the same tab level
              // (the main one) even though diagrams are subordinated to model tabs. This means we have
              // to do two rounds to ensure diagram tabs are checked before the model tabs are.
              foreach (ITabDocument document in contentTabControl.Documents)
              {
            if (document is ModelDiagramForm)
            {
              e.Cancel = !(document as IWorkbenchDocument).CanCloseDocument();

              // Make the page active that refused to close.
              if (e.Cancel)
              {
            document.Activate();
            break;
              }
            }
              }

              if (!e.Cancel)
              {
            foreach (ITabDocument document in contentTabControl.Documents)
            {
              if (document is ModelDiagramForm)
            continue;

              if (document is IWorkbenchDocument)
            e.Cancel = !(document as IWorkbenchDocument).CanCloseDocument();
              else
            if (document is MySQL.Forms.AppViewDockContent)
            {
              MySQL.Forms.AppViewDockContent content = document as MySQL.Forms.AppViewDockContent;
              e.Cancel = !content.CanCloseDocument();
            }

              if (e.Cancel)
              {
            // Make the page active that refused to close.
            document.Activate();
            break;
              }
            }
              }

              if (!e.Cancel)
            e.Cancel = !wbContext.request_quit();

              if (e.Cancel)
              {
            // Reset termination flag, in case it was set.
            grtManager.resetTermination();
            shuttingDown = false;
            return;
              }

              // Restore previous clipboard chain.
              SaveFormState();

              Hide();

              // Go through each workbench document and close it, now unconditionally.
              contentTabControl.SuspendLayout();
              try
              {
            ITabDocument[] documents = contentTabControl.DocumentsToArray();

            // Close all documents (editors implement the document interface too, so we get them
            // with that loop as well).
            for (int i = documents.Length - 1; i >= 0; i--)
            {
              if (documents[i] is MySQL.Forms.AppViewDockContent)
              {
            MySQL.Forms.AppViewDockContent content = documents[i] as MySQL.Forms.AppViewDockContent;
            content.CloseDocument();
              }
              else
            documents[i].Close();
            }
            workbenchPhysicalOverviewForm = null;
              }
              finally
              {
            contentTabControl.ResumeLayout();
              }

              wbContext.perform_quit();
        }