Embedded images

This commit is contained in:
2016-10-17 14:25:30 +00:00
parent 187dd5be25
commit e689dc2ba0
20 changed files with 2298 additions and 463 deletions

View File

@@ -995,8 +995,9 @@ namespace Volian.Controls.Library
public EditItem AddChildAfter(ItemInfo MyItemInfo, bool expand, bool addFirstChld)
{
EditItem child = null;
//if (MyItemInfo.MyContent.ContentGridCount != 0)
if (MyItemInfo.MyContent.MyGrid != null)
if (MyItemInfo.IsFigure)
child = new ImageItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, expand);
else if (MyItemInfo.MyContent.MyGrid != null)
child = new GridItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, expand);
else
child = new RTBItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, expand, addFirstChld);
@@ -1005,8 +1006,11 @@ namespace Volian.Controls.Library
public EditItem AddChildAfter(ItemInfo MyItemInfo, EditItem nextEditItem)
{
EditItem child = null;
//if (MyItemInfo.MyContent.ContentGridCount != 0)
if (MyItemInfo.MyContent.MyGrid != null)
if (MyItemInfo.IsFigure)
{
child = new ImageItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, true, nextEditItem, FigInsType);
}
else if (MyItemInfo.MyContent.MyGrid != null)
child = new GridItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, true, nextEditItem);
else
child = new RTBItem(MyItemInfo, MyStepPanel, this, ChildRelation.After, true, nextEditItem);
@@ -1015,7 +1019,8 @@ namespace Volian.Controls.Library
public EditItem AddChildBefore(ItemInfo MyItemInfo, EditItem nextEditItem)
{
EditItem child = null;
//if (MyItemInfo.MyContent.ContentGridCount != 0)
if (MyItemInfo.IsFigure)
child = new ImageItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem, FigInsType);
if(MyItemInfo.MyContent.MyGrid != null)
child = new GridItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem);
else
@@ -1045,6 +1050,7 @@ namespace Volian.Controls.Library
SaveContents();
ItemInfo newItemInfo = MyItemInfo.InsertSiblingAfter(text);
AddGridIfNeeded(newItemInfo);
AddImageIfNeeded(newItemInfo);
DoAddSiblingAfter(newItemInfo, updateStatus);
if (MyStepPanel.SelectedEditItem is RTBItem)
{
@@ -1079,11 +1085,21 @@ namespace Volian.Controls.Library
}
}
}
// This logic allows us to do an Insert Before and Insert After while on a Figure
// if allowed by the format. Note that Before/After for figures is only Clipboard (if
// image data exists in clipboard), or file. Doing RO images will be added later if needed -
// this decision was made because of scope.
private void AddImageIfNeeded(ItemInfo newItemInfo)
{
if (this is ImageItem) ImageItem.AddImageIfNeeded(newItemInfo);
}
public void AddSiblingAfter(int? type, bool updateStatus)
{
SaveContents();
ItemInfo newItemInfo = MyItemInfo.InsertSiblingAfter("", "", type);
AddGridIfNeeded(newItemInfo);
AddImageIfNeeded(newItemInfo);
DoAddSiblingAfter(newItemInfo, updateStatus);
if (MyStepPanel.SelectedEditItem is RTBItem)
{
@@ -1129,6 +1145,7 @@ namespace Volian.Controls.Library
SaveContents();
ItemInfo newItemInfo = MyItemInfo.InsertSiblingBefore("", "",type);
AddGridIfNeeded(newItemInfo);
AddImageIfNeeded(newItemInfo);
DoAddSiblingBefore(newItemInfo, updateStatus);
}
public void AddSiblingBefore(string text, bool updateSelection)
@@ -1142,6 +1159,7 @@ namespace Volian.Controls.Library
SaveContents();
ItemInfo newItemInfo = MyItemInfo.InsertSiblingBefore(text);
AddGridIfNeeded(newItemInfo);
AddImageIfNeeded(newItemInfo);
DoAddSiblingBefore(newItemInfo, updateSelection);
if (MyStepPanel.SelectedEditItem is RTBItem)
{
@@ -1207,6 +1225,13 @@ namespace Volian.Controls.Library
MyStepPanel.SelectedEditItem = newEditItem;//Update Screen
specialAdd = false;
}
private ImageItem.E_ImageSource FigInsType = ImageItem.E_ImageSource.None;
public void AddChild(E_FromType fromType, int type, ImageItem.E_ImageSource newSource)
{
FigInsType = newSource;
AddChild("", fromType, type, null);
FigInsType = ImageItem.E_ImageSource.None;
}
public void AddChild(E_FromType fromType, int type)
{
AddChild("", fromType, type, null);
@@ -2511,6 +2536,10 @@ namespace Volian.Controls.Library
{
AdjustTableWidthAndLocation();
}
else if (MyStepData.Type.Contains("Figure"))
{
AdjustTableWidthAndLocation();
}
else
{
if (MyItemInfo.FormatStepData.StepLayoutData.AlignWithParentTab)
@@ -2696,7 +2725,9 @@ namespace Volian.Controls.Library
if (_MyPreviousEditItem != null)
{
_IgnoreResize = true;
if (MyStepData != null && (MyStepData.Type.ToLower().Contains("table") || MyStepData.ParentType.ToLower().Contains("table")))
// the table code goes through the following, rather than 'istablepart'
if (MyStepData != null && ((MyStepData.Type.ToLower().Contains("table") || MyStepData.ParentType.ToLower().Contains("table"))||
(MyStepData.Type.ToLower().Contains("figure") || MyStepData.ParentType.ToLower().Contains("figure"))))
{
ItemWidth = TableWidth;
Location = new Point(_MyPreviousEditItem.Left, FindTop(_MyPreviousEditItem.BottomMostEditItem.Bottom));
@@ -2868,6 +2899,11 @@ namespace Volian.Controls.Library
if (itemInfo.IsStep && itemInfo.FormatStepData.Type == "TitleWithTextBelow" &&
((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd))
ContentWidth = myParentEditItem.ContentWidth;
if (itemInfo.IsStep && itemInfo.MyParent.IsFigure)
{
ContentWidth = myParentEditItem.MyParentEditItem.ContentWidth;
Left = MyParentEditItem.MyParentEditItem.Left + MyParentEditItem.MyParentEditItem.TabLeft;
}
if (myChildRelation == ChildRelation.None)
{
@@ -3013,6 +3049,12 @@ namespace Volian.Controls.Library
X = gi.MyFlexGrid.Right+2;
H = gi.MyFlexGrid.Height;
}
else if (this is ImageItem)
{
ImageItem ii = this as ImageItem;
X = ii.MyPictureBox.Right + 4;
H = ii.MyPictureBox.Height;
}
else
{
RTBItem ri = this as RTBItem;