From aa447a2dd1c3e4b31b03078f4aa4b42d5d6da7e5 Mon Sep 17 00:00:00 2001 From: Michael Sevestre Date: Fri, 29 Jul 2022 18:56:37 -0400 Subject: [PATCH] Fixes #2249 scale button (#2269) * Fixes #2249 scale button * Fixes #2249 scale button --- .../Parameters/MultiParameterEditPresenter.cs | 2 +- .../Parameters/ScaleParametersPresenter.cs | 4 +- .../MultiParameterEditView.Designer.cs | 42 ++--- .../ScaleParametersView.Designer.cs | 161 +++++------------- .../Views/Parameters/ScaleParametersView.cs | 15 +- .../Views/Parameters/ScaleParametersView.resx | 6 +- 6 files changed, 81 insertions(+), 149 deletions(-) diff --git a/src/PKSim.Presentation/Presenters/Parameters/MultiParameterEditPresenter.cs b/src/PKSim.Presentation/Presenters/Parameters/MultiParameterEditPresenter.cs index d813831c3..e3a06c07e 100644 --- a/src/PKSim.Presentation/Presenters/Parameters/MultiParameterEditPresenter.cs +++ b/src/PKSim.Presentation/Presenters/Parameters/MultiParameterEditPresenter.cs @@ -131,7 +131,7 @@ public interface IMultiParameterEditPresenter : void SelectedParametersChanged(); /// - /// if set to true, parameter will be compared for sort only if sharing the same hiearchy of visible groups + /// if set to true, parameter will be compared for sort only if sharing the same hierarchy of visible groups /// It is useful for events, default is false /// bool UseAdvancedSortingMode { set; } diff --git a/src/PKSim.Presentation/Presenters/Parameters/ScaleParametersPresenter.cs b/src/PKSim.Presentation/Presenters/Parameters/ScaleParametersPresenter.cs index 3c085f0bc..9c1576b92 100644 --- a/src/PKSim.Presentation/Presenters/Parameters/ScaleParametersPresenter.cs +++ b/src/PKSim.Presentation/Presenters/Parameters/ScaleParametersPresenter.cs @@ -23,7 +23,7 @@ public interface IScaleParametersPresenter : IPresenter void Reset(); /// - /// set wether the scale and reset functions are enabled or not + /// set whether the scale and reset functions are enabled or not /// bool Enabled { set; } } @@ -56,7 +56,7 @@ public void Reset() public bool Enabled { - set { _view.ReadOnly = !value; } + set => _view.ReadOnly = !value; } } } \ No newline at end of file diff --git a/src/PKSim.UI/Views/Parameters/MultiParameterEditView.Designer.cs b/src/PKSim.UI/Views/Parameters/MultiParameterEditView.Designer.cs index 7778b3186..8884d44a1 100644 --- a/src/PKSim.UI/Views/Parameters/MultiParameterEditView.Designer.cs +++ b/src/PKSim.UI/Views/Parameters/MultiParameterEditView.Designer.cs @@ -55,12 +55,12 @@ private void InitializeComponent() this.gridParameters.Location = new System.Drawing.Point(0, 27); this.gridParameters.MainView = this.gridView; this.gridParameters.Name = "gridParameters"; - this.gridParameters.Size = new System.Drawing.Size(526, 347); + this.gridParameters.Size = new System.Drawing.Size(766, 482); this.gridParameters.TabIndex = 4; this.gridParameters.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.gridView}); // - // gridViewParameters + // gridView // this.gridView.AllowsFiltering = true; this.gridView.EnableColumnContextMenu = true; @@ -70,6 +70,7 @@ private void InitializeComponent() this.gridView.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDown; this.gridView.OptionsSelection.EnableAppearanceFocusedCell = false; this.gridView.OptionsSelection.EnableAppearanceFocusedRow = false; + this.gridView.OptionsSelection.MultiSelect = true; // // layoutControlParameters // @@ -79,17 +80,17 @@ private void InitializeComponent() this.layoutControlParameters.Dock = System.Windows.Forms.DockStyle.Fill; this.layoutControlParameters.Location = new System.Drawing.Point(0, 0); this.layoutControlParameters.Name = "layoutControlParameters"; - this.layoutControlParameters.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(607, 202, 250, 350); + this.layoutControlParameters.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(607, 202, 525, 479); this.layoutControlParameters.Root = this.layoutControlGroup1; - this.layoutControlParameters.Size = new System.Drawing.Size(526, 374); + this.layoutControlParameters.Size = new System.Drawing.Size(766, 509); this.layoutControlParameters.TabIndex = 5; this.layoutControlParameters.Text = "layoutControl1"; // // panelScaling // - this.panelScaling.Location = new System.Drawing.Point(275, 2); + this.panelScaling.Location = new System.Drawing.Point(474, 2); this.panelScaling.Name = "panelScaling"; - this.panelScaling.Size = new System.Drawing.Size(249, 23); + this.panelScaling.Size = new System.Drawing.Size(290, 23); this.panelScaling.TabIndex = 5; // // layoutControlGroup1 @@ -101,11 +102,9 @@ private void InitializeComponent() this.layoutItemParameters, this.layoutItemScaling, this.emptySpaceItemForScaling}); - this.layoutControlGroup1.Location = new System.Drawing.Point(0, 0); - this.layoutControlGroup1.Name = "layoutControlGroup1"; + this.layoutControlGroup1.Name = "Root"; this.layoutControlGroup1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); - this.layoutControlGroup1.Size = new System.Drawing.Size(526, 374); - this.layoutControlGroup1.Text = "layoutControlGroup1"; + this.layoutControlGroup1.Size = new System.Drawing.Size(766, 509); this.layoutControlGroup1.TextVisible = false; // // layoutItemParameters @@ -113,27 +112,25 @@ private void InitializeComponent() this.layoutItemParameters.Control = this.gridParameters; this.layoutItemParameters.CustomizationFormText = "layoutItemParameters"; this.layoutItemParameters.Location = new System.Drawing.Point(0, 27); + this.layoutItemParameters.MinSize = new System.Drawing.Size(100, 20); this.layoutItemParameters.Name = "layoutItemParameters"; this.layoutItemParameters.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); - this.layoutItemParameters.Size = new System.Drawing.Size(526, 347); - this.layoutItemParameters.Text = "layoutItemParameters"; + this.layoutItemParameters.Size = new System.Drawing.Size(766, 482); + this.layoutItemParameters.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.layoutItemParameters.TextSize = new System.Drawing.Size(0, 0); - this.layoutItemParameters.TextToControlDistance = 0; this.layoutItemParameters.TextVisible = false; // // layoutItemScaling // this.layoutItemScaling.Control = this.panelScaling; this.layoutItemScaling.CustomizationFormText = "layoutItemScaling"; - this.layoutItemScaling.Location = new System.Drawing.Point(273, 0); - this.layoutItemScaling.MaxSize = new System.Drawing.Size(253, 27); - this.layoutItemScaling.MinSize = new System.Drawing.Size(253, 27); + this.layoutItemScaling.Location = new System.Drawing.Point(472, 0); + this.layoutItemScaling.MaxSize = new System.Drawing.Size(294, 27); + this.layoutItemScaling.MinSize = new System.Drawing.Size(294, 27); this.layoutItemScaling.Name = "layoutItemScaling"; - this.layoutItemScaling.Size = new System.Drawing.Size(253, 27); + this.layoutItemScaling.Size = new System.Drawing.Size(294, 27); this.layoutItemScaling.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; - this.layoutItemScaling.Text = "layoutItemScaling"; this.layoutItemScaling.TextSize = new System.Drawing.Size(0, 0); - this.layoutItemScaling.TextToControlDistance = 0; this.layoutItemScaling.TextVisible = false; // // emptySpaceItemForScaling @@ -141,8 +138,11 @@ private void InitializeComponent() this.emptySpaceItemForScaling.AllowHotTrack = false; this.emptySpaceItemForScaling.CustomizationFormText = "emptySpaceItemForScaling"; this.emptySpaceItemForScaling.Location = new System.Drawing.Point(0, 0); + this.emptySpaceItemForScaling.MaxSize = new System.Drawing.Size(0, 27); + this.emptySpaceItemForScaling.MinSize = new System.Drawing.Size(10, 27); this.emptySpaceItemForScaling.Name = "emptySpaceItem1"; - this.emptySpaceItemForScaling.Size = new System.Drawing.Size(273, 27); + this.emptySpaceItemForScaling.Size = new System.Drawing.Size(472, 27); + this.emptySpaceItemForScaling.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.emptySpaceItemForScaling.Text = "emptySpaceItemForScaling"; this.emptySpaceItemForScaling.TextSize = new System.Drawing.Size(0, 0); // @@ -153,7 +153,7 @@ private void InitializeComponent() this.Controls.Add(this.layoutControlParameters); this.Margin = new System.Windows.Forms.Padding(0); this.Name = "MultiParameterEditView"; - this.Size = new System.Drawing.Size(526, 374); + this.Size = new System.Drawing.Size(766, 509); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gridParameters)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gridView)).EndInit(); diff --git a/src/PKSim.UI/Views/Parameters/ScaleParametersView.Designer.cs b/src/PKSim.UI/Views/Parameters/ScaleParametersView.Designer.cs index 1846bbd4b..c6d2b726a 100644 --- a/src/PKSim.UI/Views/Parameters/ScaleParametersView.Designer.cs +++ b/src/PKSim.UI/Views/Parameters/ScaleParametersView.Designer.cs @@ -29,150 +29,83 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.layoutControl = new OSPSuite.UI.Controls.UxLayoutControl(); - this.layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup(); - this.btnScale = new DevExpress.XtraEditors.SimpleButton(); - this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); - this.tbValue = new DevExpress.XtraEditors.TextEdit(); - this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem(); this.btnReset = new DevExpress.XtraEditors.SimpleButton(); - this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem(); + this.tbValue = new DevExpress.XtraEditors.TextEdit(); + this.btnScale = new DevExpress.XtraEditors.SimpleButton(); + this.tablePanel = new DevExpress.Utils.Layout.TablePanel(); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).BeginInit(); - this.layoutControl.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tbValue.Properties)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.tablePanel)).BeginInit(); + this.tablePanel.SuspendLayout(); this.SuspendLayout(); // - // layoutControl1 - // - this.layoutControl.AutoScroll = false; - this.layoutControl.Controls.Add(this.btnReset); - this.layoutControl.Controls.Add(this.tbValue); - this.layoutControl.Controls.Add(this.btnScale); - this.layoutControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.layoutControl.Location = new System.Drawing.Point(0, 0); - this.layoutControl.Name = "layoutControl"; - this.layoutControl.Root = this.layoutControlGroup1; - this.layoutControl.Size = new System.Drawing.Size(412, 22); - this.layoutControl.TabIndex = 5; - this.layoutControl.Text = "layoutControl1"; - // - // layoutControlGroup1 - // - this.layoutControlGroup1.CustomizationFormText = "layoutControlGroup1"; - this.layoutControlGroup1.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; - this.layoutControlGroup1.GroupBordersVisible = false; - this.layoutControlGroup1.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { - this.layoutControlItem1, - this.layoutControlItem2, - this.layoutControlItem3}); - this.layoutControlGroup1.Location = new System.Drawing.Point(0, 0); - this.layoutControlGroup1.Name = "layoutControlGroup1"; - this.layoutControlGroup1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); - this.layoutControlGroup1.Size = new System.Drawing.Size(412, 22); - this.layoutControlGroup1.Spacing = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); - this.layoutControlGroup1.Text = "layoutControlGroup1"; - this.layoutControlGroup1.TextVisible = false; - // - // btnScale - // - this.btnScale.Location = new System.Drawing.Point(0, 0); - this.btnScale.Name = "btnScale"; - this.btnScale.Size = new System.Drawing.Size(88, 22); - this.btnScale.StyleController = this.layoutControl; - this.btnScale.TabIndex = 4; - this.btnScale.Text = "btnScale"; - // - // layoutControlItem1 + // btnReset // - this.layoutControlItem1.Control = this.btnScale; - this.layoutControlItem1.CustomizationFormText = "layoutControlItem1"; - this.layoutControlItem1.Location = new System.Drawing.Point(0, 0); - this.layoutControlItem1.Name = "layoutControlItem1"; - this.layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); - this.layoutControlItem1.Size = new System.Drawing.Size(88, 22); - this.layoutControlItem1.Text = "layoutControlItem1"; - this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0); - this.layoutControlItem1.TextToControlDistance = 0; - this.layoutControlItem1.TextVisible = false; + this.tablePanel.SetColumn(this.btnReset, 2); + this.btnReset.Location = new System.Drawing.Point(334, 3); + this.btnReset.Name = "btnReset"; + this.tablePanel.SetRow(this.btnReset, 0); + this.btnReset.Size = new System.Drawing.Size(120, 20); + this.btnReset.TabIndex = 6; + this.btnReset.Text = "btnReset"; // // tbValue // - this.tbValue.Location = new System.Drawing.Point(88, 0); + this.tablePanel.SetColumn(this.tbValue, 1); + this.tbValue.Location = new System.Drawing.Point(107, 3); this.tbValue.Name = "tbValue"; this.tbValue.Properties.AutoHeight = false; - this.tbValue.Size = new System.Drawing.Size(232, 22); - this.tbValue.StyleController = this.layoutControl; + this.tablePanel.SetRow(this.tbValue, 0); + this.tbValue.Size = new System.Drawing.Size(221, 20); this.tbValue.TabIndex = 5; // - // layoutControlItem2 - // - this.layoutControlItem2.Control = this.tbValue; - this.layoutControlItem2.CustomizationFormText = "layoutControlItem2"; - this.layoutControlItem2.Location = new System.Drawing.Point(88, 0); - this.layoutControlItem2.Name = "layoutControlItem2"; - this.layoutControlItem2.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); - this.layoutControlItem2.Size = new System.Drawing.Size(232, 22); - this.layoutControlItem2.Text = "layoutControlItem2"; - this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0); - this.layoutControlItem2.TextToControlDistance = 0; - this.layoutControlItem2.TextVisible = false; - // - // btnReset - // - this.btnReset.Location = new System.Drawing.Point(320, 0); - this.btnReset.Name = "btnReset"; - this.btnReset.Size = new System.Drawing.Size(92, 22); - this.btnReset.StyleController = this.layoutControl; - this.btnReset.TabIndex = 6; - this.btnReset.Text = "btnReset"; + // btnScale // - // layoutControlItem3 + this.tablePanel.SetColumn(this.btnScale, 0); + this.btnScale.Location = new System.Drawing.Point(3, 3); + this.btnScale.Name = "btnScale"; + this.tablePanel.SetRow(this.btnScale, 0); + this.btnScale.Size = new System.Drawing.Size(98, 20); + this.btnScale.TabIndex = 4; + this.btnScale.Text = "btnScale"; // - this.layoutControlItem3.Control = this.btnReset; - this.layoutControlItem3.CustomizationFormText = "layoutControlItem3"; - this.layoutControlItem3.Location = new System.Drawing.Point(320, 0); - this.layoutControlItem3.Name = "layoutControlItem3"; - this.layoutControlItem3.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); - this.layoutControlItem3.Size = new System.Drawing.Size(92, 22); - this.layoutControlItem3.Text = "layoutControlItem3"; - this.layoutControlItem3.TextSize = new System.Drawing.Size(0, 0); - this.layoutControlItem3.TextToControlDistance = 0; - this.layoutControlItem3.TextVisible = false; + // tablePanel + // + this.tablePanel.Columns.AddRange(new DevExpress.Utils.Layout.TablePanelColumn[] { + new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 24.95F), + new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 54.62F), + new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 30.43F)}); + this.tablePanel.Controls.Add(this.btnScale); + this.tablePanel.Controls.Add(this.tbValue); + this.tablePanel.Controls.Add(this.btnReset); + this.tablePanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.tablePanel.Location = new System.Drawing.Point(0, 0); + this.tablePanel.Name = "tablePanel"; + this.tablePanel.Rows.AddRange(new DevExpress.Utils.Layout.TablePanelRow[] { + new DevExpress.Utils.Layout.TablePanelRow(DevExpress.Utils.Layout.TablePanelEntityStyle.Absolute, 26F), + new DevExpress.Utils.Layout.TablePanelRow(DevExpress.Utils.Layout.TablePanelEntityStyle.Absolute, 26F)}); + this.tablePanel.Size = new System.Drawing.Size(457, 28); + this.tablePanel.TabIndex = 6; // // ScaleParametersView // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.layoutControl); + this.Controls.Add(this.tablePanel); this.Name = "ScaleParametersView"; - this.Size = new System.Drawing.Size(412, 22); + this.Size = new System.Drawing.Size(457, 28); ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControl)).EndInit(); - this.layoutControl.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.tbValue.Properties)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.tablePanel)).EndInit(); + this.tablePanel.ResumeLayout(false); this.ResumeLayout(false); } #endregion - - private OSPSuite.UI.Controls.UxLayoutControl layoutControl; private DevExpress.XtraEditors.SimpleButton btnReset; private DevExpress.XtraEditors.TextEdit tbValue; private DevExpress.XtraEditors.SimpleButton btnScale; - private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup1; - private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1; - private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2; - private DevExpress.XtraLayout.LayoutControlItem layoutControlItem3; - + private DevExpress.Utils.Layout.TablePanel tablePanel; } } diff --git a/src/PKSim.UI/Views/Parameters/ScaleParametersView.cs b/src/PKSim.UI/Views/Parameters/ScaleParametersView.cs index d2782cee6..22a913f79 100644 --- a/src/PKSim.UI/Views/Parameters/ScaleParametersView.cs +++ b/src/PKSim.UI/Views/Parameters/ScaleParametersView.cs @@ -1,14 +1,12 @@ -using OSPSuite.DataBinding; +using OSPSuite.Assets; +using OSPSuite.DataBinding; using OSPSuite.DataBinding.DevExpress; -using OSPSuite.Assets; -using DevExpress.XtraEditors; +using OSPSuite.UI.Controls; +using OSPSuite.UI.Extensions; using PKSim.Assets; using PKSim.Presentation.DTO.Parameters; using PKSim.Presentation.Presenters.Parameters; using PKSim.Presentation.Views.Parameters; -using PKSim.UI.Extensions; -using OSPSuite.UI.Controls; -using OSPSuite.UI.Extensions; namespace PKSim.UI.Views.Parameters { @@ -52,7 +50,7 @@ public void BindTo(ParameterScaleWithFactorDTO parameterScaleWithFactorDTO) public bool ReadOnly { - set => layoutControl.Enabled = !value; + set => tablePanel.Enabled = !value; } public override void InitializeResources() @@ -61,7 +59,8 @@ public override void InitializeResources() btnReset.SuperTip = _toolTipCreator.CreateToolTip(PKSimConstants.UI.ResetAllVisibleButtonToolTip, PKSimConstants.UI.ResetAll, ApplicationIcons.Reset); btnScale.Text = PKSimConstants.UI.ScaleButton; btnScale.SuperTip = _toolTipCreator.CreateToolTip(PKSimConstants.UI.ScaleButtonToolTip, PKSimConstants.UI.ScaleButton); - layoutControl.InitializeDisabledColors(); + tablePanel.AdjustControlSize(btnScale, height:tbValue.Height); + tablePanel.AdjustControlSize(btnReset, height:tbValue.Height); } } } \ No newline at end of file diff --git a/src/PKSim.UI/Views/Parameters/ScaleParametersView.resx b/src/PKSim.UI/Views/Parameters/ScaleParametersView.resx index 38d368e69..29a1e5cd6 100644 --- a/src/PKSim.UI/Views/Parameters/ScaleParametersView.resx +++ b/src/PKSim.UI/Views/Parameters/ScaleParametersView.resx @@ -112,12 +112,12 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 17 \ No newline at end of file