Esempio n. 1
0
 private void CreatePlugInInternal()
 {
     if (this.CreateMainPlugIn != null)
     {
         UITypeEditorEventArgs uITypeEditorEventArgs = new UITypeEditorEventArgs(this);
         this.CreateMainPlugIn(this, uITypeEditorEventArgs);
         this.m_MainPlugIn        = uITypeEditorEventArgs.MainPlugIn;
         this.m_MainPlugInTitle   = uITypeEditorEventArgs.MainPlugInTitle;
         this.m_MainPlugInTabName = uITypeEditorEventArgs.MainPlugInTabName;
     }
     else if (this.m_OriginalInstance is ISupportUITypeEditor)
     {
         this.m_MainPlugInTitle = (this.m_OriginalInstance as ISupportUITypeEditor).GetPlugInTitle() + " Editor";
         string plugInClassName = (this.m_OriginalInstance as ISupportUITypeEditor).GetPlugInClassName();
         this.m_MainPlugIn = (this.CreatePlugInByFullName(plugInClassName) as PlugInStandard);
     }
     if (this.m_OriginalInstance is SubClassBase)
     {
         this.m_MainPlugInTabName = "General";
     }
     else
     {
         this.m_MainPlugInTabName = "Control";
     }
 }
Esempio n. 2
0
        public void UpdateExtents(PlugInStandard plugIn)
        {
            int width  = plugIn.Width + plugIn.MarginLeft + plugIn.MarginRight;
            int height = plugIn.Height + plugIn.MarginTop + plugIn.MarginBottom;

            this.UpdateExtents(width, height);
        }
Esempio n. 3
0
 void IPlugInMaster.ForceApplyButtonEnabled(PlugInStandard value)
 {
     if (this.m_ControlPanel != null)
     {
         this.m_ControlPanel.ApplyButton.Enabled = true;
     }
 }
Esempio n. 4
0
 public override void TransferAmbient()
 {
     Iocomp.Classes.CollectionBase collectionBase  = base.Source as Iocomp.Classes.CollectionBase;
     Iocomp.Classes.CollectionBase collectionBase2 = base.Destination as Iocomp.Classes.CollectionBase;
     collectionBase2.Clear();
     for (int i = 0; i < collectionBase.Count; i++)
     {
         object obj  = ((IList)collectionBase)[i];
         object obj2 = ((ICollectionBase)collectionBase2).CreateInstance(obj.GetType());
         (obj2 as ISubClassBase).ControlBase = (base.Master as IControlBase);
         PlugInStandard classPlugIn = this.GetClassPlugIn(obj);
         classPlugIn.Source      = obj;
         classPlugIn.Destination = obj2;
         classPlugIn.TransferAmbient();
     }
 }
Esempio n. 5
0
        private void SetupRuntime(bool showAbout)
        {
            this.MainForm                 = new Form();
            this.MainForm.Text            = this.MainPlugInTitle;
            this.MainForm.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MainForm.StartPosition   = FormStartPosition.CenterScreen;
            this.MainForm.ShowInTaskbar   = false;
            this.MainForm.MaximizeBox     = false;
            this.MainForm.MinimizeBox     = false;
            this.m_ScaleRatio             = (float)((int)Math.Ceiling((double)this.MainForm.Font.GetHeight()) / this.MainForm.AutoScaleBaseSize.Height);
            this.MainForm.AutoScaleMode   = AutoScaleMode.None;
            TabControl tabControl = new TabControl();

            this.MainForm.Controls.Add(tabControl);
            tabControl.Dock            = DockStyle.Fill;
            this.MainPlugIn.TabName    = this.MainPlugInTabName;
            this.MainPlugIn.TabControl = tabControl;
            TabPage tabPage = new TabPage();

            tabPage.Text = "About";
            tabControl.Controls.Add(tabPage);
            this.m_TabPageBorderSize = 4;
            this.m_TabPageDockMargin = 8;
            this.m_TabHeight         = tabControl.Height - tabControl.DisplayRectangle.Height - 8;
            tabControl.Controls.Remove(tabPage);
            tabPage.Dispose();
            int tabPageBorderSize  = this.TabPageBorderSize;
            int tabPageBorderSize2 = this.TabPageBorderSize;
            int offsetTop          = this.TabHeight + this.TabPageBorderSize;
            int tabPageBorderSize3 = this.TabPageBorderSize;

            this.MainPlugIn.DoTabs(tabControl, true, tabPageBorderSize, tabPageBorderSize2, offsetTop, tabPageBorderSize3, this.m_ScaleRatio, this, this.MainPlugIn.ClassPlugIns);
            if (showAbout)
            {
                this.m_AboutPlugIn         = new AboutPlugIn();
                this.m_AboutPlugIn.TabName = "About";
                this.m_AboutPlugIn.DoTabs(tabControl, true, tabPageBorderSize, tabPageBorderSize2, offsetTop, tabPageBorderSize3, this.m_ScaleRatio, this, this.MainPlugIn.SubPlugIns);
            }
            this.MainPlugIn.OriginalInstance = this.m_OriginalInstance;
            this.MainPlugIn.WorkingInstance  = this.m_OriginalInstance;
            this.MainPlugIn.UploadDisplay();
            this.MainForm.ClientSize = new Size(this.m_MaxWidth, this.m_MaxHeight);
            tabControl.Dock          = DockStyle.None;
            tabControl.Height        = this.m_MaxHeight;
            tabControl.Width         = this.m_MaxWidth;
            this.MainPlugIn.FixupAlign();
        }
Esempio n. 6
0
 public override void DoTabs(TabControl tabControl, bool first, int offsetLeft, int offsetRight, int offsetTop, int offsetBottom, float scaleRatio, IPlugInMaster master, PlugInStandardCollection classPlugIns)
 {
     classPlugIns.Add(this);
     base.Master               = master;
     base.TabControl           = tabControl;
     base.TabPage              = new TabPage();
     base.TabPage.Text         = base.TabName;
     base.TabPage.SizeChanged += this.TabPage_SizeChanged;
     base.TabControl.Controls.Add(base.TabPage);
     this.m_Navigator    = new CollectionNavigatorPanel();
     this.Navigator.Dock = DockStyle.Left;
     this.Navigator.SelectedIndexChanged += this.Navigator_SelectedIndexChanged;
     this.Navigator.ItemMoved            += this.Navigator_ItemMoved;
     this.Navigator.ItemAdd    += this.Navigator_ItemAdd;
     this.Navigator.ItemRemove += this.Navigator_ItemRemove;
     this.Navigator.Types       = this.Types;
     this.Navigator.DoLayout();
     base.Master.UpdateExtents(this.Navigator.Width + offsetLeft + offsetRight, this.Navigator.Height + offsetTop + offsetBottom);
     base.TabPage.Controls.Add(this.Navigator);
     this.Navigator.DoLayout();
     base.TabPage.Resize    += this.TabPage_Resize;
     offsetLeft             += base.Master.TabPageBorderSize + this.Navigator.Width;
     offsetRight            += base.Master.TabPageBorderSize;
     offsetTop              += base.Master.TabPageBorderSize + base.Master.TabHeight;
     offsetBottom           += base.Master.TabPageBorderSize;
     this.m_PlugInPool       = this.CreatePlugInPool();
     this.m_ClassTabControls = new TabControl[this.m_PlugInPool.Length];
     for (int i = 0; i < this.m_PlugInPool.Length; i++)
     {
         this.m_ClassTabControls[i]        = new TabControl();
         this.m_ClassTabControls[i].Left   = this.Navigator.Right;
         this.m_ClassTabControls[i].Width  = 700;
         this.m_ClassTabControls[i].Height = 400;
         base.TabPage.Controls.Add(this.m_ClassTabControls[i]);
     }
     for (int j = 0; j < this.m_PlugInPool.Length; j++)
     {
         PlugInStandard plugInStandard = this.m_PlugInPool[j];
         plugInStandard.TabName = "General";
         plugInStandard.DoTabs(this.m_ClassTabControls[j], true, offsetLeft, offsetRight, offsetTop, offsetBottom, scaleRatio, master, plugInStandard.ClassPlugIns);
     }
     for (int k = 0; k < this.m_ClassTabControls.Length; k++)
     {
         this.m_ClassTabControls[k].Visible = false;
     }
 }
Esempio n. 7
0
 public override bool GetIsDirty()
 {
     try
     {
         Iocomp.Classes.CollectionBase collectionBase  = base.OriginalInstance as Iocomp.Classes.CollectionBase;
         Iocomp.Classes.CollectionBase collectionBase2 = base.WorkingInstance as Iocomp.Classes.CollectionBase;
         if (collectionBase.Count != collectionBase2.Count)
         {
             return(true);
         }
         int num = 0;
         while (true)
         {
             if (num < collectionBase2.Count)
             {
                 object obj  = ((IList)collectionBase)[num];
                 object obj2 = ((IList)collectionBase2)[num];
                 if (!(obj.GetType() != obj2.GetType()))
                 {
                     PlugInStandard classPlugIn = this.GetClassPlugIn(obj2);
                     classPlugIn.WorkingInstance  = obj2;
                     classPlugIn.OriginalInstance = obj;
                     classPlugIn.UploadDisplay();
                     if (classPlugIn.GetIsDirty())
                     {
                         break;
                     }
                     num++;
                     continue;
                 }
                 return(true);
             }
             return(false);
         }
         return(true);
     }
     finally
     {
         if (this.Navigator.SelectedObject != null)
         {
             PlugInStandard classPlugIn = this.GetClassPlugIn(this.Navigator.SelectedObject);
             classPlugIn.WorkingInstance = this.Navigator.SelectedObject;
             classPlugIn.UploadDisplay();
         }
     }
 }
Esempio n. 8
0
 private void Navigator_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.Navigator.SelectedObject == null)
     {
         TabControl[] classTabControls = this.m_ClassTabControls;
         foreach (TabControl tabControl in classTabControls)
         {
             tabControl.Visible = false;
         }
     }
     else
     {
         for (int j = 0; j < this.m_ClassTabControls.Length; j++)
         {
             this.m_ClassTabControls[j].Visible = (j == this.GetPlugInIndex(this.Navigator.SelectedObject));
         }
         PlugInStandard classPlugIn = this.GetClassPlugIn(this.Navigator.SelectedObject);
         classPlugIn.WorkingInstance = this.Navigator.SelectedObject;
         classPlugIn.UploadDisplay();
     }
 }
Esempio n. 9
0
 void IPlugInMaster.UpdateExtents(PlugInStandard value)
 {
     base.Master.UpdateExtents(value);
 }
Esempio n. 10
0
 void IPlugInMaster.ForceApplyButtonEnabled(PlugInStandard value)
 {
     base.Master.ForceApplyButtonEnabled(this);
 }
Esempio n. 11
0
 void IPlugInMaster.ForceDirtyUpdate(PlugInStandard value)
 {
     base.Master.ForceDirtyUpdate(this);
 }
Esempio n. 12
0
        private void SetupDesignTime(bool showAbout)
        {
            this.MainForm                            = new Form();
            this.MainForm.Text                       = this.MainPlugInTitle;
            this.MainForm.FormBorderStyle            = FormBorderStyle.FixedDialog;
            this.MainForm.StartPosition              = FormStartPosition.CenterScreen;
            this.MainForm.ShowInTaskbar              = false;
            this.MainForm.MaximizeBox                = false;
            this.MainForm.MinimizeBox                = false;
            this.m_ScaleRatio                        = (float)((int)Math.Ceiling((double)this.MainForm.Font.GetHeight()) / this.MainForm.AutoScaleBaseSize.Height);
            this.MainForm.AutoScaleMode              = AutoScaleMode.None;
            this.m_ControlPanel                      = new PlugInControlPanel();
            this.m_ControlPanel.Dock                 = DockStyle.Bottom;
            this.m_ControlPanel.OKButton.Click      += this.ControlPanel_OkButtonClick;
            this.m_ControlPanel.CancelButton.Click  += this.ControlPanel_CancelButtonClick;
            this.m_ControlPanel.ApplyButton.Click   += this.ControlPanel_ApplyButtonClick;
            this.m_ControlPanel.ResetButton.Click   += this.ResetButton_Click;
            this.m_ControlPanel.RestoreButton.Click += this.RestoreButton_Click;
            this.UpdateExtents(this.m_ControlPanel.RequiredWidthMin, 0);
            this.MainForm.Controls.Add(this.m_ControlPanel);
            this.m_WorkingInstance = GPFunctions.CreateInstance(this.m_OriginalInstance.GetType(), this.m_OriginalInstance.GetType().FullName);
            this.m_RestoreInstance = GPFunctions.CreateInstance(this.m_OriginalInstance.GetType(), this.m_OriginalInstance.GetType().FullName);
            this.m_ResetInstance   = GPFunctions.CreateInstance(this.m_OriginalInstance.GetType(), this.m_OriginalInstance.GetType().FullName);
            if (this.m_OriginalInstance is SubClassBase)
            {
                (this.m_OriginalInstance as ISubClassBase).ResetClone(this.m_ResetInstance as SubClassBase);
            }
            if (this.m_ResetInstance is IComponentBase)
            {
                (this.m_ResetInstance as IComponentBase).SetComponentDefaults();
            }
            if (this.m_ResetInstance is CollectionBase)
            {
                (this.m_ResetInstance as CollectionBase).Reset();
            }
            if (this.m_OriginalInstance is IControlBase)
            {
                this.I_ControlBase     = (this.m_OriginalInstance as IControlBase);
                this.m_SurrogateParent = new Label();
                if (this.I_ControlBase._Parent != null)
                {
                    this.m_SurrogateParent.BackColor = this.I_ControlBase._Parent.BackColor;
                    this.m_SurrogateParent.ForeColor = this.I_ControlBase._Parent.ForeColor;
                    this.m_SurrogateParent.Font      = this.I_ControlBase._Parent.Font;
                }
                (this.m_WorkingInstance as Control).Parent = this.m_SurrogateParent;
                (this.m_ResetInstance as Control).Parent   = this.m_SurrogateParent;
                (this.m_RestoreInstance as Control).Parent = this.m_SurrogateParent;
            }
            else if (this.m_OriginalInstance is ISubClassBase)
            {
                this.I_ControlBase = (this.m_OriginalInstance as ISubClassBase).ControlBase;
                (this.m_WorkingInstance as ISubClassBase).ControlBase  = this;
                (this.m_ResetInstance as ISubClassBase).ControlBase    = this;
                (this.m_RestoreInstance as ISubClassBase).ControlBase  = this;
                (this.m_WorkingInstance as ISubClassBase).AmbientOwner = (this.m_OriginalInstance as ISubClassBase).AmbientOwner;
                (this.m_ResetInstance as ISubClassBase).AmbientOwner   = (this.m_OriginalInstance as ISubClassBase).AmbientOwner;
                (this.m_RestoreInstance as ISubClassBase).AmbientOwner = (this.m_OriginalInstance as ISubClassBase).AmbientOwner;
            }
            else if (this.m_OriginalInstance is ICollectionBase)
            {
                (this.m_WorkingInstance as ICollectionBase).ComponentBase = (this.m_OriginalInstance as ICollectionBase).ComponentBase;
                (this.m_ResetInstance as ICollectionBase).ComponentBase   = (this.m_OriginalInstance as ICollectionBase).ComponentBase;
                (this.m_RestoreInstance as ICollectionBase).ComponentBase = (this.m_OriginalInstance as ICollectionBase).ComponentBase;
            }
            TabControl tabControl = new TabControl();

            this.MainForm.Controls.Add(tabControl);
            tabControl.Dock = DockStyle.Fill;
            if (this.m_OriginalInstance is SubClassBase)
            {
                this.MainPlugIn.TabName = "General";
            }
            else
            {
                this.MainPlugIn.TabName = "Control";
            }
            this.MainPlugIn.TabControl = tabControl;
            TabPage tabPage = new TabPage();

            tabPage.Text = "About";
            tabControl.Controls.Add(tabPage);
            this.m_TabPageBorderSize = 4;
            this.m_TabPageDockMargin = 8;
            this.m_TabHeight         = tabControl.Height - tabControl.DisplayRectangle.Height - 8;
            tabControl.Controls.Remove(tabPage);
            tabPage.Dispose();
            int tabPageBorderSize  = this.TabPageBorderSize;
            int tabPageBorderSize2 = this.TabPageBorderSize;
            int offsetTop          = this.TabHeight + this.TabPageBorderSize;
            int tabPageBorderSize3 = this.TabPageBorderSize;

            this.MainPlugIn.DoTabs(tabControl, true, tabPageBorderSize, tabPageBorderSize2, offsetTop, tabPageBorderSize3, this.m_ScaleRatio, this, this.MainPlugIn.ClassPlugIns);
            if (showAbout)
            {
                this.m_AboutPlugIn         = new AboutPlugIn();
                this.m_AboutPlugIn.TabName = "About";
                this.m_AboutPlugIn.DoTabs(tabControl, true, tabPageBorderSize, tabPageBorderSize2, offsetTop, tabPageBorderSize3, this.m_ScaleRatio, this, this.MainPlugIn.SubPlugIns);
            }
            this.MainPlugIn.WorkingInstance  = this.m_WorkingInstance;
            this.MainPlugIn.OriginalInstance = this.m_OriginalInstance;
            this.TransferAmbient(this.m_OriginalInstance, this.m_WorkingInstance);
            this.TransferAmbient(this.m_OriginalInstance, this.m_RestoreInstance);
            this.MainPlugIn.UploadDisplay();
            this.MainForm.ClientSize = new Size(this.m_MaxWidth, this.m_MaxHeight + this.m_ControlPanel.Height);
            tabControl.Dock          = DockStyle.None;
            tabControl.Height        = this.m_MaxHeight;
            tabControl.Width         = this.m_MaxWidth;
            this.MainPlugIn.FixupAlign();
            this.m_ControlPanel.Dock  = DockStyle.None;
            this.m_ControlPanel.Width = this.MainForm.ClientSize.Width;
            this.m_ControlPanel.Top   = this.MainForm.ClientSize.Height - this.m_ControlPanel.Height;
            this.m_ControlPanel.DoLayout();
            this.UpdateControlPanel();
        }
Esempio n. 13
0
        private object Edit(object value, bool designTimeStyle, bool modal, bool showAbout)
        {
            this.m_OriginalInstance = value;
            if (!modal && !designTimeStyle && this.MainPlugIn != null && this.MainForm != null)
            {
                this.MainForm.Show();
                this.MainForm.BringToFront();
                return(value);
            }
            if (this.MainPlugIn != null)
            {
                this.MainPlugIn.Dispose();
                this.m_MainPlugIn = null;
            }
            if (this.MainForm != null)
            {
                this.MainForm.Dispose();
                this.m_MainForm = null;
            }
            this.CreatePlugInInternal();
            if (this.m_MainPlugIn == null)
            {
                return(value);
            }
            if (designTimeStyle)
            {
                this.SetupDesignTime(showAbout);
            }
            else
            {
                this.SetupRuntime(showAbout);
            }
            if (this.m_Provider != null && this.m_Context != null)
            {
                IWindowsFormsEditorService windowsFormsEditorService = (IWindowsFormsEditorService)this.m_Provider.GetService(typeof(IWindowsFormsEditorService));
                if (windowsFormsEditorService != null)
                {
                    windowsFormsEditorService.ShowDialog(this.MainForm);
                    this.m_Context.OnComponentChanged();
                    this.MainPlugIn.Dispose();
                    this.m_MainPlugIn = null;
                    goto IL_015b;
                }
                return(base.EditValue(this.m_Context, this.m_Provider, this.m_OriginalInstance));
            }
            if (!modal && !designTimeStyle)
            {
                this.MainForm.TopMost = true;
                this.MainForm.Show();
                this.MainForm.BringToFront();
            }
            else
            {
                this.MainForm.ShowDialog();
                this.MainPlugIn.Dispose();
                this.MainForm.Dispose();
                this.m_MainPlugIn = null;
                this.m_MainForm   = null;
            }
            goto IL_015b;
IL_015b:
            return(value);
        }
Esempio n. 14
0
 void IPlugInMaster.ForceDirtyUpdate(PlugInStandard value)
 {
     this.MainPlugIn.UploadDisplay();
     this.UpdateControlPanel();
 }
Esempio n. 15
0
 public void AddSubPlugIn(PlugInStandard plugIn, string tabName, bool sameLevel)
 {
     this.SubPlugIns.Add(plugIn);
     plugIn.TabName   = tabName;
     plugIn.SameLevel = sameLevel;
 }