From 0d6fd6950c1726fd649f70fde06d912295d333bc Mon Sep 17 00:00:00 2001 From: Kevin Laskey Date: Tue, 4 Jun 2024 09:18:58 -0400 Subject: [PATCH 1/3] C2019-047 - Show the figure size adjustment panel before a figure is selected or inserted, so that they dont have to open/close the area to see it. --- PROMS/Volian.Controls.Library/DisplayTags.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PROMS/Volian.Controls.Library/DisplayTags.cs b/PROMS/Volian.Controls.Library/DisplayTags.cs index fbfa10d2..154972ce 100644 --- a/PROMS/Volian.Controls.Library/DisplayTags.cs +++ b/PROMS/Volian.Controls.Library/DisplayTags.cs @@ -404,7 +404,8 @@ namespace Volian.Controls.Library } else { - groupPanelFigSize.Visible = false; + //No Current image, but still show groupPanelFigSize, will adjust when file is selected. + groupPanelFigSize.Visible = true; } // change bar setting depends on whether step has changed (dts) as compared to date/time off the From 241785846e02b8cdf1497e9aed1501cb1228f4bb Mon Sep 17 00:00:00 2001 From: Kevin Laskey Date: Tue, 4 Jun 2024 11:55:17 -0400 Subject: [PATCH 2/3] Update for displaying when a figure is selected or added (as opposed to a step or some other type of option) --- PROMS/Volian.Controls.Library/DisplayTags.cs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DisplayTags.cs b/PROMS/Volian.Controls.Library/DisplayTags.cs index 154972ce..873fe01a 100644 --- a/PROMS/Volian.Controls.Library/DisplayTags.cs +++ b/PROMS/Volian.Controls.Library/DisplayTags.cs @@ -404,8 +404,11 @@ namespace Volian.Controls.Library } else { - //No Current image, but still show groupPanelFigSize, will adjust when file is selected. - groupPanelFigSize.Visible = true; + if (MyEditItem.MyItemInfo.IsFigure) + //No Current image, but still show groupPanelFigSize, will adjust when file is selected. + groupPanelFigSize.Visible = true; + else + groupPanelFigSize.Visible = false; } // change bar setting depends on whether step has changed (dts) as compared to date/time off the @@ -872,11 +875,14 @@ namespace Volian.Controls.Library // restore the orignal image size private void btnFSrestore_Click(object sender, EventArgs e) { - tbFSWd.Text = _origFigureSizeWidth.ToString(); - int ht = (int)(_origFigureSizeRatio * _origFigureSizeWidth); - tbFSHt.Text = ht.ToString(); - (MyEditItem as ImageItem).SizeImage(_origFigureSizeWidth, ht); - trBarFS.Value = _origFigureSizeWidth; + if (_origFigureSizeWidth != 0) + { + tbFSWd.Text = _origFigureSizeWidth.ToString(); + int ht = (int)(_origFigureSizeRatio * _origFigureSizeWidth); + tbFSHt.Text = ht.ToString(); + (MyEditItem as ImageItem).SizeImage(_origFigureSizeWidth, ht); + trBarFS.Value = _origFigureSizeWidth; + } } // user entered width in text box, this event gets called on leave of text box. private void tbFSWd_Leave(object sender, EventArgs e) From 2ae0d0d4548c6159ba4a43a22aa04053be315383 Mon Sep 17 00:00:00 2001 From: Kevin Laskey Date: Wed, 5 Jun 2024 10:48:51 -0400 Subject: [PATCH 3/3] Update to ensure some size is presetned for the figure when adding a new. --- PROMS/Volian.Controls.Library/DisplayRO.cs | 14 ++++- PROMS/Volian.Controls.Library/DisplayTags.cs | 54 ++++++++++++++++---- 2 files changed, 55 insertions(+), 13 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs index 9378fd7a..6c44d3b3 100644 --- a/PROMS/Volian.Controls.Library/DisplayRO.cs +++ b/PROMS/Volian.Controls.Library/DisplayRO.cs @@ -56,6 +56,9 @@ namespace Volian.Controls.Library private ROFSTLookup.rochild selectedChld; + private DisplayTags displayTags; + + #endregion #region Properties @@ -268,6 +271,10 @@ namespace Volian.Controls.Library _searchTimer.Stop(); } + + // Initialize the DisplayTags object + displayTags = new DisplayTags(); + _progressBar = null; } @@ -927,7 +934,7 @@ namespace Volian.Controls.Library bool replacingRO = (_savCurROLink != null); string insrpl = (replacingRO) ? "Cannot Replace" : "Cannot Insert"; - string errormsg = string.Empty; + string errormsg = string.Empty; switch (selectedRO.type) { @@ -968,7 +975,10 @@ namespace Volian.Controls.Library errormsg = (replacingRO) ? "a graphics RO with a non-graphcis RO." : "a Graphics RO in an non-Figure or a non-Accessory Page type."; //TODO: Prompt user to insert a new substep type that handles x/y Plots and place this RO into it goodToGo = false; - } + + + + } break; } diff --git a/PROMS/Volian.Controls.Library/DisplayTags.cs b/PROMS/Volian.Controls.Library/DisplayTags.cs index 873fe01a..a76f2cb4 100644 --- a/PROMS/Volian.Controls.Library/DisplayTags.cs +++ b/PROMS/Volian.Controls.Library/DisplayTags.cs @@ -383,6 +383,8 @@ namespace Volian.Controls.Library cmbCheckoff.Enabled = false; } + + // show the part of panel for resizing a figure (if figure already exists: MyImage is set for non-RO existing images & content.text has a link in it) if (MyEditItem.MyItemInfo.IsFigure && (MyEditItem.MyItemInfo.MyContent.MyImage != null || MyEditItem.MyItemInfo.MyContent.Text.ToUpper().Contains("#LINK"))) { @@ -391,22 +393,36 @@ namespace Volian.Controls.Library int wd = (MyEditItem as ImageItem).MyPictureBox.Width; _origFigureSizeRatio = (float)ht / (float)wd; // use this to keep width/height ratio while changing size. float wd1 = (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.PageWidth - (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.LeftMargin; - float ht1 = (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.PageLength - (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.TopMargin - 36; // 36 is to allow for end message - float wd2 = Math.Min(wd1, ht1 / _origFigureSizeRatio); // keep original ratio - trBarFS.Maximum = Math.Max((int)wd2, trBarFS.Maximum); - if (wd > trBarFS.Maximum) trBarFS.Maximum = wd + 1; - trBarFS.Minimum = Math.Min(wd, 72); - trBarFS.Value = (int)wd; - ImageItem ii = MyEditItem as ImageItem; - _origFigureSizeWidth = ii.MyPictureBox.Width; - tbFSWd.Text = ii.MyPictureBox.Width.ToString(); - tbFSHt.Text = ii.MyPictureBox.Height.ToString(); + float ht1 = (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.PageLength - (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.TopMargin - 36; // 36 is to allow for end message + float wd2 = Math.Min(wd1, ht1 / _origFigureSizeRatio); // keep original ratio + + SetFigure(wd1, wd2); + + //trBarFS.Maximum = Math.Max((int)wd2, trBarFS.Maximum); + //if (wd > trBarFS.Maximum) trBarFS.Maximum = wd + 1; + //trBarFS.Minimum = Math.Min(wd, 72); + //trBarFS.Value = (int)wd; + //ImageItem ii = MyEditItem as ImageItem; + //_origFigureSizeWidth = ii.MyPictureBox.Width; + //tbFSWd.Text = ii.MyPictureBox.Width.ToString(); + //tbFSHt.Text = ii.MyPictureBox.Height.ToString(); } else { if (MyEditItem.MyItemInfo.IsFigure) - //No Current image, but still show groupPanelFigSize, will adjust when file is selected. + { + //No Current image, but still show groupPanelFigSize, will adjust when file is selected, but let's give it a default + //size on using the picturebox. groupPanelFigSize.Visible = true; + int ht = (MyEditItem as ImageItem).MyPictureBox.Height; + int wd = (MyEditItem as ImageItem).MyPictureBox.Width; + _origFigureSizeRatio = (float)ht / (float)wd; // use this to keep width/height ratio while changing size. + float wd1 = (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.PageWidth - (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.LeftMargin; + float ht1 = (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.PageLength - (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.TopMargin - 36; // 36 is to allow for end message + float wd2 = Math.Min(wd1, ht1 / _origFigureSizeRatio); // keep original ratio + + SetFigure(wd1, wd2); + } else groupPanelFigSize.Visible = false; } @@ -520,6 +536,22 @@ namespace Volian.Controls.Library } _Initalizing = false; } + public void SetFigure(double wd, double wd2) + { + // Check MyEditItem type and cast if needed + ImageItem ii = MyEditItem as ImageItem; + if (ii == null) return; + + // Set the values as needed + trBarFS.Maximum = Math.Max((int)wd2, trBarFS.Maximum); + if (wd > trBarFS.Maximum) trBarFS.Maximum = (int)wd + 1; + trBarFS.Minimum = Math.Min((int)wd, 72); + trBarFS.Value = (int)wd; + _origFigureSizeWidth = ii.MyPictureBox.Width; + tbFSWd.Text = ii.MyPictureBox.Width.ToString(); + tbFSHt.Text = ii.MyPictureBox.Height.ToString(); + } + private int DoListStepTypes(FormatData fmtdata, StepData topType, string curType) { int cursel=-1;