C2019-047 #337

Merged
jjenko merged 2 commits from C2019-047 into Development 2024-06-14 13:24:52 -04:00
4 changed files with 44 additions and 10 deletions

View File

@ -640,7 +640,7 @@ namespace Volian.Controls.Library
this.btnFSrestore.Location = new System.Drawing.Point(112, 27);
this.btnFSrestore.Margin = new System.Windows.Forms.Padding(2);
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.Text = "Restore";
this.btnFSrestore.UseVisualStyleBackColor = true;

View File

@ -96,6 +96,22 @@ namespace Volian.Controls.Library
get { return Visible; }
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
#region Constructor
public DisplayTags()
@ -396,7 +412,10 @@ namespace Volian.Controls.Library
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);
SetFigure(wd1, wd2);
tbFSWd.Text = wd.ToString();
tbFSHt.Text = ht.ToString();
//trBarFS.Maximum = Math.Max((int)wd2, trBarFS.Maximum);
//if (wd > trBarFS.Maximum) trBarFS.Maximum = wd + 1;
@ -548,8 +567,8 @@ namespace Volian.Controls.Library
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();
//tbFSWd.Text = ii.MyPictureBox.Width.ToString();
//tbFSHt.Text = ii.MyPictureBox.Height.ToString();
}
private int DoListStepTypes(FormatData fmtdata, StepData topType, string curType)
@ -893,7 +912,7 @@ namespace Volian.Controls.Library
}
}
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
// width/height text boxes to slider values.
private void trBarFS_Scroll(object sender, EventArgs e)

View File

@ -1209,7 +1209,7 @@ namespace Volian.Controls.Library
{
EditItem child = null;
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)
child = new RtfRawItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, true, nextEditItem);
else if (MyItemInfo.MyContent.MyGrid != null)
@ -1222,7 +1222,7 @@ namespace Volian.Controls.Library
{
EditItem child = null;
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)
child = new RtfRawItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem);
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 _origCfgWd = 0;
private bool _pastedNew = false; // need this for flagging newly pasted image (may need to clear cfg)
private DisplayTags _displayTags;
#endregion
#region Constructors
public ImageItem()
@ -266,6 +268,7 @@ namespace Volian.Controls.Library
public ImageItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand)
{
InitializeComponent();
MyItemInfo = itemInfo;
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null, false);
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;
_newSizeWd = wd / (MyStepPanel.DPI / 72);
_newSizeHt = ht / (MyStepPanel.DPI / 72);
if (!MyItemInfo.FormatStepData.StepEditData.TypeMenu.MenuItem.ToUpper().Contains("AER")) ItemLocation = TableLocation(MyStepSectionLayoutData, ItemWidth);
_IsDirty = true;
}
@ -330,13 +334,23 @@ namespace Volian.Controls.Library
MyPictureBox.SizeMode = PictureBoxSizeMode.Zoom; // as resize matches width/height.
this.Width = MyPictureBox.Width + ImageMargin;
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
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();
MyItemInfo = itemInfo;
_displayTags = displayTags;
if (MyItemInfo.MyContent.MyImage != null && MyItemInfo.MyContent.MyImage.Data != null) // this is figure/image (not RO)
{
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false);
@ -368,8 +382,8 @@ namespace Volian.Controls.Library
FileName = null;
//InitializeComponent();
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false);
MyPictureBox.Width = 100;
MyPictureBox.Height = 100;
//MyPictureBox.Width = 100;
//MyPictureBox.Height = 100;
this.Width = 100 + ImageMargin;
this.Height = 100;
if (insType == ImageItem.E_ImageSource.File)
@ -546,6 +560,7 @@ namespace Volian.Controls.Library
imageText = val;
}
AddROImageToScreen(W, H, imageText);
}
catch (Exception ex)
{