Development #338

Merged
djankowski merged 7 commits from Development into master 2024-06-17 08:38:35 -04:00
5 changed files with 108 additions and 25 deletions

View File

@ -56,6 +56,9 @@ namespace Volian.Controls.Library
private ROFSTLookup.rochild selectedChld; private ROFSTLookup.rochild selectedChld;
private DisplayTags displayTags;
#endregion #endregion
#region Properties #region Properties
@ -268,6 +271,10 @@ namespace Volian.Controls.Library
_searchTimer.Stop(); _searchTimer.Stop();
} }
// Initialize the DisplayTags object
displayTags = new DisplayTags();
_progressBar = null; _progressBar = null;
} }
@ -968,6 +975,9 @@ 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."; 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 //TODO: Prompt user to insert a new substep type that handles x/y Plots and place this RO into it
goodToGo = false; goodToGo = false;
} }
break; break;
} }

View File

@ -640,7 +640,7 @@ namespace Volian.Controls.Library
this.btnFSrestore.Location = new System.Drawing.Point(112, 27); this.btnFSrestore.Location = new System.Drawing.Point(112, 27);
this.btnFSrestore.Margin = new System.Windows.Forms.Padding(2); this.btnFSrestore.Margin = new System.Windows.Forms.Padding(2);
this.btnFSrestore.Name = "btnFSrestore"; this.btnFSrestore.Name = "btnFSrestore";
this.btnFSrestore.Size = new System.Drawing.Size(54, 26); this.btnFSrestore.Size = new System.Drawing.Size(54, 20);
this.btnFSrestore.TabIndex = 6; this.btnFSrestore.TabIndex = 6;
this.btnFSrestore.Text = "Restore"; this.btnFSrestore.Text = "Restore";
this.btnFSrestore.UseVisualStyleBackColor = true; this.btnFSrestore.UseVisualStyleBackColor = true;

View File

@ -96,6 +96,22 @@ namespace Volian.Controls.Library
get { return Visible; } get { return Visible; }
set { if (Visible != value) Visible = value; } set { if (Visible != value) Visible = value; }
} }
/// <summary>
/// Expose text properties for height and widht to handle selecting RO Image Types.
/// </summary>
public string TbFSwd
{
get {return tbFSWd.Text;}
set { tbFSWd.Text = value; tbFSWd.Refresh(); trBarFS.Value = Convert.ToInt32(value); }
}
public string TbFSht
{
get { return tbFSHt.Text; }
set { tbFSHt.Text = value; tbFSHt.Refresh(); _origFigureSizeRatio = float.Parse(value) / float.Parse(tbFSWd.Text); }
}
#endregion #endregion
#region Constructor #region Constructor
public DisplayTags() public DisplayTags()
@ -383,6 +399,8 @@ namespace Volian.Controls.Library
cmbCheckoff.Enabled = false; 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) // 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"))) if (MyEditItem.MyItemInfo.IsFigure && (MyEditItem.MyItemInfo.MyContent.MyImage != null || MyEditItem.MyItemInfo.MyContent.Text.ToUpper().Contains("#LINK")))
{ {
@ -393,17 +411,38 @@ namespace Volian.Controls.Library
float wd1 = (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.PageWidth - (float)MyEditItem.MyItemInfo.MyDocStyle.Layout.LeftMargin; 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 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 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; SetFigure(wd1, wd2);
trBarFS.Minimum = Math.Min(wd, 72);
trBarFS.Value = (int)wd; tbFSWd.Text = wd.ToString();
ImageItem ii = MyEditItem as ImageItem; tbFSHt.Text = ht.ToString();
_origFigureSizeWidth = ii.MyPictureBox.Width;
tbFSWd.Text = ii.MyPictureBox.Width.ToString(); //trBarFS.Maximum = Math.Max((int)wd2, trBarFS.Maximum);
tbFSHt.Text = ii.MyPictureBox.Height.ToString(); //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 else
{ {
if (MyEditItem.MyItemInfo.IsFigure)
{
//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; groupPanelFigSize.Visible = false;
} }
@ -516,6 +555,22 @@ namespace Volian.Controls.Library
} }
_Initalizing = false; _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) private int DoListStepTypes(FormatData fmtdata, StepData topType, string curType)
{ {
int cursel=-1; int cursel=-1;
@ -857,7 +912,7 @@ namespace Volian.Controls.Library
} }
} }
private float _origFigureSizeRatio = 0; // keep original ratio & width in case of 'restore' private float _origFigureSizeRatio = 0; // keep original ratio & width in case of 'restore'
private int _origFigureSizeWidth = 0; public int _origFigureSizeWidth = 0;
// support user changing size using slider. This saves change back to ImageItem and sets // support user changing size using slider. This saves change back to ImageItem and sets
// width/height text boxes to slider values. // width/height text boxes to slider values.
private void trBarFS_Scroll(object sender, EventArgs e) private void trBarFS_Scroll(object sender, EventArgs e)
@ -870,6 +925,8 @@ namespace Volian.Controls.Library
} }
// restore the orignal image size // restore the orignal image size
private void btnFSrestore_Click(object sender, EventArgs e) private void btnFSrestore_Click(object sender, EventArgs e)
{
if (_origFigureSizeWidth != 0)
{ {
tbFSWd.Text = _origFigureSizeWidth.ToString(); tbFSWd.Text = _origFigureSizeWidth.ToString();
int ht = (int)(_origFigureSizeRatio * _origFigureSizeWidth); int ht = (int)(_origFigureSizeRatio * _origFigureSizeWidth);
@ -877,6 +934,7 @@ namespace Volian.Controls.Library
(MyEditItem as ImageItem).SizeImage(_origFigureSizeWidth, ht); (MyEditItem as ImageItem).SizeImage(_origFigureSizeWidth, ht);
trBarFS.Value = _origFigureSizeWidth; trBarFS.Value = _origFigureSizeWidth;
} }
}
// user entered width in text box, this event gets called on leave of text box. // user entered width in text box, this event gets called on leave of text box.
private void tbFSWd_Leave(object sender, EventArgs e) private void tbFSWd_Leave(object sender, EventArgs e)
{ {

View File

@ -1209,7 +1209,7 @@ namespace Volian.Controls.Library
{ {
EditItem child = null; EditItem child = null;
if (MyItemInfo.IsFigure) if (MyItemInfo.IsFigure)
child = new ImageItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, true, nextEditItem, FigInsType); child = new ImageItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, true, nextEditItem, FigInsType, _MyStepPropertiesPanel);
else if (MyItemInfo.IsRtfRaw) else if (MyItemInfo.IsRtfRaw)
child = new RtfRawItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, true, nextEditItem); child = new RtfRawItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, true, nextEditItem);
else if (MyItemInfo.MyContent.MyGrid != null) else if (MyItemInfo.MyContent.MyGrid != null)
@ -1222,7 +1222,7 @@ namespace Volian.Controls.Library
{ {
EditItem child = null; EditItem child = null;
if (MyItemInfo.IsFigure) if (MyItemInfo.IsFigure)
child = new ImageItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem, FigInsType); child = new ImageItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem, FigInsType, _MyStepPropertiesPanel);
else if (MyItemInfo.IsRtfRaw) else if (MyItemInfo.IsRtfRaw)
child = new RtfRawItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem); child = new RtfRawItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem);
if (MyItemInfo.MyContent.MyGrid != null) if (MyItemInfo.MyContent.MyGrid != null)

View File

@ -256,6 +256,8 @@ namespace Volian.Controls.Library
private int _origCfgHt = 0; // keep track if original size was stored in cfg private int _origCfgHt = 0; // keep track if original size was stored in cfg
private int _origCfgWd = 0; private int _origCfgWd = 0;
private bool _pastedNew = false; // need this for flagging newly pasted image (may need to clear cfg) private bool _pastedNew = false; // need this for flagging newly pasted image (may need to clear cfg)
private DisplayTags _displayTags;
#endregion #endregion
#region Constructors #region Constructors
public ImageItem() public ImageItem()
@ -266,6 +268,7 @@ namespace Volian.Controls.Library
public ImageItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand) public ImageItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand)
{ {
InitializeComponent(); InitializeComponent();
MyItemInfo = itemInfo; MyItemInfo = itemInfo;
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null, false); SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null, false);
if (MyItemInfo.MyContent.MyImage != null && MyItemInfo.MyContent.MyImage.Data != null) // this is figure/image (not RO) if (MyItemInfo.MyContent.MyImage != null && MyItemInfo.MyContent.MyImage.Data != null) // this is figure/image (not RO)
@ -307,6 +310,7 @@ namespace Volian.Controls.Library
this.Height = MyPictureBox.Height + 10; this.Height = MyPictureBox.Height + 10;
_newSizeWd = wd / (MyStepPanel.DPI / 72); _newSizeWd = wd / (MyStepPanel.DPI / 72);
_newSizeHt = ht / (MyStepPanel.DPI / 72); _newSizeHt = ht / (MyStepPanel.DPI / 72);
if (!MyItemInfo.FormatStepData.StepEditData.TypeMenu.MenuItem.ToUpper().Contains("AER")) ItemLocation = TableLocation(MyStepSectionLayoutData, ItemWidth); if (!MyItemInfo.FormatStepData.StepEditData.TypeMenu.MenuItem.ToUpper().Contains("AER")) ItemLocation = TableLocation(MyStepSectionLayoutData, ItemWidth);
_IsDirty = true; _IsDirty = true;
} }
@ -330,13 +334,23 @@ namespace Volian.Controls.Library
MyPictureBox.SizeMode = PictureBoxSizeMode.Zoom; // as resize matches width/height. MyPictureBox.SizeMode = PictureBoxSizeMode.Zoom; // as resize matches width/height.
this.Width = MyPictureBox.Width + ImageMargin; this.Width = MyPictureBox.Width + ImageMargin;
this.Height = MyPictureBox.Height + 10; this.Height = MyPictureBox.Height + 10;
if (_displayTags != null)
{
_displayTags._origFigureSizeWidth = wd;
_displayTags.TbFSwd = wd.ToString();
_displayTags.TbFSht = ht.ToString();
}
} }
// the following gets called for 'NEW' images // the following gets called for 'NEW' images
private E_ImageSource InsType = E_ImageSource.None; private E_ImageSource InsType = E_ImageSource.None;
public ImageItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem, ImageItem.E_ImageSource insType) public ImageItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem, ImageItem.E_ImageSource insType, DisplayTags displayTags)
{ {
InitializeComponent(); InitializeComponent();
MyItemInfo = itemInfo; MyItemInfo = itemInfo;
_displayTags = displayTags;
if (MyItemInfo.MyContent.MyImage != null && MyItemInfo.MyContent.MyImage.Data != null) // this is figure/image (not RO) if (MyItemInfo.MyContent.MyImage != null && MyItemInfo.MyContent.MyImage.Data != null) // this is figure/image (not RO)
{ {
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false); SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false);
@ -368,8 +382,8 @@ namespace Volian.Controls.Library
FileName = null; FileName = null;
//InitializeComponent(); //InitializeComponent();
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false); SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false);
MyPictureBox.Width = 100; //MyPictureBox.Width = 100;
MyPictureBox.Height = 100; //MyPictureBox.Height = 100;
this.Width = 100 + ImageMargin; this.Width = 100 + ImageMargin;
this.Height = 100; this.Height = 100;
if (insType == ImageItem.E_ImageSource.File) if (insType == ImageItem.E_ImageSource.File)
@ -546,6 +560,7 @@ namespace Volian.Controls.Library
imageText = val; imageText = val;
} }
AddROImageToScreen(W, H, imageText); AddROImageToScreen(W, H, imageText);
} }
catch (Exception ex) catch (Exception ex)
{ {