Embedded images
This commit is contained in:
@@ -126,7 +126,28 @@ namespace Volian.Controls.Library
|
||||
AddWROContext(btnCMRtfEdit);
|
||||
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfEdit);
|
||||
}
|
||||
|
||||
public void SetContextMenuImage(ImageItem imgItem)
|
||||
{
|
||||
btnCMCut.Enabled = false;
|
||||
btnCMCopy.Enabled = false;
|
||||
btnCMPaste.Enabled = false;
|
||||
btnCMPasteText.Enabled = false;
|
||||
btnCMRO.Enabled = false;
|
||||
bool isInBuff = false;
|
||||
try // image in clipboard - for 'paste'
|
||||
{
|
||||
System.Drawing.Image img = Clipboard.GetImage();
|
||||
isInBuff = img != null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
isInBuff = false;
|
||||
}
|
||||
btnCMPasteImage.Enabled = isInBuff;
|
||||
btnCMEditMode1.Enabled = false; //View mode (irrelevant for images)
|
||||
btnCMGoTo.Enabled = MyItemInfo!=null && MyItemInfo.MyContent != null && MyItemInfo.MyContent.ContentRoUsageCount > 0;
|
||||
_ContextMenuBar.SetContextMenuEx(imgItem, btnCMRtfEdit);
|
||||
}
|
||||
private void AddEnhancedDocumentMenu(DevComponents.DotNetBar.ButtonItem myButtonItem, object sender)
|
||||
{
|
||||
DVEnhancedDocuments dveds = MyItemInfo.MyDocVersion.DocVersionConfig.MyEnhancedDocuments;
|
||||
@@ -626,7 +647,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
SetButtonAndMenuEnabling(true);
|
||||
SetStepButtonAndMenuEnabling(true);
|
||||
|
||||
SetMenuEnablingForFigures();
|
||||
_MyLastFormatID = MyItemInfo.ActiveFormat.FormatID;
|
||||
}
|
||||
}
|
||||
@@ -935,7 +956,7 @@ namespace Volian.Controls.Library
|
||||
if (insdata.Length < 2) return;
|
||||
int fromtype = Convert.ToInt32(insdata[0]);
|
||||
int contenttype = Convert.ToInt32(insdata[1]) + 20000;
|
||||
string tabletype = (insdata.Length == 3)? insdata[2]:null;
|
||||
string tabOrFigType = (insdata.Length == 3)? insdata[2]:null;
|
||||
// if CautionNoteOrder format variable is set then use it to determine the placement of the
|
||||
// Caution, Note, Warning, or Message (calvert format)
|
||||
if (cautNoteOrder != null && (","+cautNoteOrder+",").Contains(","+(contenttype % 10000).ToString() + ",") && (_MyEditItem.MyItemInfo.Cautions != null || _MyEditItem.MyItemInfo.Notes != null))
|
||||
@@ -962,7 +983,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
else if (InsertingTable(contenttype))
|
||||
{
|
||||
if (tabletype.Contains("RO"))
|
||||
if (tabOrFigType.Contains("RO"))
|
||||
{
|
||||
VlnFlexGrid grd = new VlnFlexGrid();
|
||||
grd.Rows.Count = 1;
|
||||
@@ -978,11 +999,30 @@ namespace Volian.Controls.Library
|
||||
if (grd != null) _MyEditItem.AddChild((E_FromType)fromtype, contenttype, grd);
|
||||
}
|
||||
}
|
||||
else if (InsertingFigure(contenttype))
|
||||
{
|
||||
if (tabOrFigType.Contains("RO"))
|
||||
{
|
||||
_MyEditItem.AddChild((E_FromType)fromtype, contenttype, ImageItem.E_ImageSource.RoFigure);
|
||||
StepTabPanel tmp = Parent as StepTabPanel;
|
||||
tmp.MyDisplayTabControl.OnLinkModifyRO(this, new StepPanelLinkEventArgs(null));
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Drawing.Image img = Clipboard.GetImage();
|
||||
if (img == null && tabOrFigType.Contains("CL"))
|
||||
{
|
||||
MessageBox.Show("Clipboard does not contain image data. Cannot create figure.", "Clipboard Error");
|
||||
return;
|
||||
}
|
||||
_MyEditItem.AddChild((E_FromType)fromtype, contenttype, tabOrFigType.Contains("CL")?ImageItem.E_ImageSource.Clipboard:ImageItem.E_ImageSource.File);
|
||||
}
|
||||
if (_MyEditItem.MyItemInfo.IsFigure && tabOrFigType.Contains("RO"))
|
||||
btnInsRO_Click(sender, e);
|
||||
}
|
||||
else
|
||||
{
|
||||
_MyEditItem.AddChild((E_FromType)fromtype, contenttype);
|
||||
if (_MyEditItem.MyItemInfo.IsFigure)
|
||||
btnInsRO_Click(sender, e); // open the step properties RO tab when a figure substep is added
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1061,18 +1101,29 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
return rtnval;
|
||||
}
|
||||
// Figure (embedded images)
|
||||
private bool InsertingFigure(int contenttype)
|
||||
{
|
||||
bool rtnval = false;
|
||||
switch (contenttype)
|
||||
{
|
||||
case 20036: // Centered
|
||||
case 20037: // AER (left)
|
||||
case 20038: // AER (left) without boarder
|
||||
case 20039: // Centered without boarder
|
||||
rtnval = true;
|
||||
break;
|
||||
}
|
||||
return rtnval;
|
||||
}
|
||||
private void btnInsBefore_Click(object sender, EventArgs e)
|
||||
{
|
||||
_MyEditItem.AddSiblingBefore();
|
||||
if (_MyEditItem.MyItemInfo.IsFigure)
|
||||
btnInsRO_Click(sender, e); // open the step properties RO tab when a figure substep is added
|
||||
}
|
||||
|
||||
private void btnInsAfter_Click(object sender, EventArgs e)
|
||||
{
|
||||
_MyEditItem.AddSiblingAfter();
|
||||
if (_MyEditItem.MyItemInfo.IsFigure)
|
||||
btnInsRO_Click(sender, e); // open the step properties RO tab when a figure substep is added
|
||||
}
|
||||
/// <summary>
|
||||
/// Using style for step type, enable/disable formatting buttons
|
||||
@@ -1105,6 +1156,7 @@ namespace Volian.Controls.Library
|
||||
btnCMCopy.Enabled = btnCopy.Enabled = setting;
|
||||
btnPasteAfter.Enabled = btnPasteBefore.Enabled = btnStepPaste.Enabled = btnPasteReplace.Enabled = setting;
|
||||
btnCMGrid.Enabled = setting;
|
||||
btnCMPasteImage.Enabled = setting;
|
||||
}
|
||||
private void SetButtonMenuEnabledDisabledOnStepType(bool setting)
|
||||
{
|
||||
@@ -1128,13 +1180,6 @@ namespace Volian.Controls.Library
|
||||
btnInsNote.Enabled = true;
|
||||
btnInsCaut.Enabled = true;
|
||||
}
|
||||
if (MyItemInfo.IsFigure)
|
||||
{
|
||||
btnInsTrans.Enabled = btnCMTransition.Enabled = false;
|
||||
btnCMSymbol.Enabled = btnSymbols.Enabled = false;
|
||||
btnCMHardSpace.Enabled = btnInsHrdSpc.Enabled = false;
|
||||
btnIndent.Enabled = false;
|
||||
}
|
||||
// if in Calvert Alarms Condition/Response, disable insert of Cautions and Notes
|
||||
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
|
||||
btnInsCaut.Enabled = btnInsNote.Enabled = btnCMInsCaution.Enabled = btnCMInsNote.Enabled = setting && !MyItemInfo.IsInCalvertConditionResponse;
|
||||
@@ -1142,7 +1187,7 @@ namespace Volian.Controls.Library
|
||||
public void SetButtonAndMenuEnabling(bool docontextmenus)
|
||||
{
|
||||
if (_MyStepRTB == null) return;
|
||||
if (_MyStepRTB.FieldToEdit != E_FieldToEdit.StepText)
|
||||
if (_MyStepRTB.FieldToEdit != E_FieldToEdit.StepText && !MyItemInfo.IsFigure) // want menu enabling for figures
|
||||
return; // No need to change menu that does not get used
|
||||
DocVersionInfo dvi = MyEditItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
|
||||
if (dvi == null) return;
|
||||
@@ -1179,6 +1224,7 @@ namespace Volian.Controls.Library
|
||||
btnCMRedo.Enabled = btnRedo.Enabled = _MyStepRTB.CanRedo;
|
||||
|
||||
// for paste, see if there is clipboard data, & if so, of a type we can use.
|
||||
btnCMPasteImage.Enabled = false;
|
||||
try // RHM20150506 Multiline ItemID TextBox
|
||||
{
|
||||
IDataObject iData = Clipboard.GetDataObject();
|
||||
@@ -1216,6 +1262,31 @@ namespace Volian.Controls.Library
|
||||
btnCMEditRO.Enabled = false;
|
||||
}
|
||||
// OLD: SetStepButtonAndMenuEnabling(docontextmenus);
|
||||
SetMenuEnablingForFigures();
|
||||
}
|
||||
|
||||
private void SetMenuEnablingForFigures()
|
||||
{
|
||||
if (MyItemInfo.IsFigure)
|
||||
{
|
||||
btnInsTrans.Enabled = btnCMTransition.Enabled = false;
|
||||
btnInsRO.Enabled = btnCMRO.Enabled = false;
|
||||
btnCMSymbol.Enabled = btnSymbols.Enabled = false;
|
||||
btnCMHardSpace.Enabled = btnInsHrdSpc.Enabled = false;
|
||||
btnIndent.Enabled = false;
|
||||
btnCMBold.Enabled = btnBold.Enabled = false;
|
||||
btnCMItalics.Enabled = btnItalics.Enabled = false;
|
||||
btnCMUnderline.Enabled = btnUnderline.Enabled = false;
|
||||
btnCMSubscript.Enabled = btnSubscript.Enabled = false;
|
||||
btnCMSuperscript.Enabled = btnSuperscript.Enabled = false;
|
||||
btnCMCut.Enabled = btnCut.Enabled = false;
|
||||
btnCMUndo.Enabled = btnUndo.Enabled = false;
|
||||
btnCMRedo.Enabled = btnRedo.Enabled = false;
|
||||
btnChgCase.Enabled = false;
|
||||
btnPaste.Enabled = false;
|
||||
btnCMPaste.Enabled = false;
|
||||
btnCMPasteText.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetButtonEnablingForEnhanced(bool setting)
|
||||
@@ -1510,7 +1581,6 @@ namespace Volian.Controls.Library
|
||||
actable = sd.StepEditData.AcTable;
|
||||
if (actable == null) actable = 0;
|
||||
btnInsHLS.Enabled = MyItemInfo.MyHLS != null;
|
||||
|
||||
btnInsCaut.Enabled = ((actable & E_AccStep.AddingCaution) > 0) && !MyItemInfo.IsEnhancedStep;
|
||||
btnInsNote.Enabled = ((actable & E_AccStep.AddingNote) > 0) && !MyItemInfo.IsEnhancedStep;
|
||||
btnInsRNO.Enabled = (actable & E_AccStep.AddingRNO) > 0;
|
||||
@@ -1663,6 +1733,9 @@ namespace Volian.Controls.Library
|
||||
btn.SubItems.Add(bi);
|
||||
}
|
||||
}
|
||||
//handle various cases for figures:
|
||||
if (btn.Name == "btnInsFig" && docontextmenus) DoFigureMenuing(btn, cmbtn, sdl);
|
||||
|
||||
// if this is a table, then need to add RO/Text table options
|
||||
if (btn.Name == "btnInsTable" && docontextmenus)
|
||||
{
|
||||
@@ -1735,7 +1808,135 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
rbnStepParts.Refresh();
|
||||
}
|
||||
|
||||
// From Figure menuing, need to map those strings to the index in the StepdataList for setting item's content type:
|
||||
//<Step Index="36" Type="Figure" ParentType="Base" />
|
||||
//<Step Index="37" Type="AERFigure" ParentType="Figure" />
|
||||
//<Step Index="38" Type="BorderlessFigure" ParentType="Figure" />
|
||||
//<Step Index="39" Type="BorderlessAERFigure" ParentType="AERFigure" />
|
||||
private int Centered = 36; // will always be top level.
|
||||
private void DoFigureMenuing(ButtonItem btn, ButtonItem cmbtn, List<StepDataRetval> sdl)
|
||||
{
|
||||
// Figure menuing:
|
||||
// Figure (from ribbon)
|
||||
// If in AER Column:
|
||||
// Centered
|
||||
// Left
|
||||
// From both Centered & Left:
|
||||
// With Border
|
||||
// Without Border
|
||||
// From both w/wo Border:
|
||||
// RO Figure
|
||||
// Figure from Clipboard
|
||||
// Figure From File
|
||||
// If in RNO column or single column mode (see comment below for this menu):
|
||||
// With Border
|
||||
// Without Border
|
||||
// From both w/wo Border:
|
||||
// RO Figure
|
||||
// Figure from Clipboard
|
||||
// Figure From File
|
||||
|
||||
// This is done for single column mode, or if in the calvertconditionresponse table (dual column) and in the rno column. Note
|
||||
// the '&&' in if check because when in the calvertconditionresponse table, the section is in 'single column' mode even though
|
||||
// the condition response table is dual column.
|
||||
SectionConfig sc = (SectionConfig)MyItemInfo.ActiveSection.MyConfig;
|
||||
// One Column Mode or Two Column Mode in the RNO Column or Caution or Note
|
||||
if ((sc.Section_ColumnMode == SectionConfig.SectionColumnMode.One && (!MyItemInfo.IsInCalvertConditionResponse || MyItemInfo.IsInRNO))
|
||||
|| (sc.Section_ColumnMode == SectionConfig.SectionColumnMode.Two && MyItemInfo.IsInRNO)
|
||||
|| (MyItemInfo.IsCautionOrNotePart)) // single column step editor
|
||||
{
|
||||
// setup the sub menus for the insert table ribbon button
|
||||
btn.Tag = btn.SubItems[0].Tag;
|
||||
btn.SubItems.Clear();
|
||||
DoFigureW_WOborderSubMenu(btn);
|
||||
// setup the sub menus for the context menu used with the keyborad shortcut <shift><ctrl><T>
|
||||
cmbtn.Tag = cmbtn.SubItems[0].Tag;
|
||||
cmbtn.SubItems.Clear();
|
||||
DoFigureW_WOborderSubMenu(cmbtn);
|
||||
}
|
||||
else
|
||||
{
|
||||
// this is AER column in dual column-need to add 'Centered' & 'Left'
|
||||
char[] sp = { ' ' };
|
||||
btn.Tag = btn.SubItems[0].Tag;
|
||||
btn.SubItems.Clear();
|
||||
string[] insdata = btn.Tag.ToString().Split(sp);
|
||||
int ftype = Convert.ToInt32(insdata[0]);
|
||||
int sdtype = Convert.ToInt32(insdata[1]);
|
||||
DevComponents.DotNetBar.ButtonItem cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + sdtype + "CENT", "Centered");
|
||||
cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways;
|
||||
cmbt.Text = "Centered";
|
||||
cmbt.Tag = string.Format("{0} {1} {2}", ftype, 36, "CENT");
|
||||
cmbt.Click += new System.EventHandler(btnInsStep_Click);
|
||||
btn.SubItems.Add(cmbt);
|
||||
cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + sdtype + "LT", "Left");
|
||||
cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways;
|
||||
cmbt.Text = "Left";
|
||||
cmbt.Tag = string.Format("{0} {1} {2}", ftype, 37, "LT"); // Text table
|
||||
cmbt.Click += new System.EventHandler(btnInsStep_Click);
|
||||
btn.SubItems.Add(cmbt);
|
||||
btn.Tag = null;
|
||||
btn.Click -= new System.EventHandler(btnInsStep_Click);
|
||||
// setup the sub menus for the insert figure ribbon button
|
||||
foreach (DevComponents.DotNetBar.ButtonItem tabbtn in btn.SubItems)
|
||||
DoFigureW_WOborderSubMenu(tabbtn);
|
||||
// setup the sub menus for the context menu used with the keyborad shortcut <shift><ctrl><T>
|
||||
foreach (DevComponents.DotNetBar.ButtonItem cmtabbtn in cmbtn.SubItems)
|
||||
DoFigureW_WOborderSubMenu(cmtabbtn);
|
||||
}
|
||||
}
|
||||
private void DoFigureW_WOborderSubMenu(DevComponents.DotNetBar.ButtonItem tabbtn)
|
||||
{
|
||||
char[] sp = { ' ' };
|
||||
string[] insdata = tabbtn.Tag.ToString().Split(sp);
|
||||
int ftype = Convert.ToInt32(insdata[0]);
|
||||
int sdtype = Convert.ToInt32(insdata[1]);
|
||||
int with = sdtype == Centered ? 36 : 37;
|
||||
DevComponents.DotNetBar.ButtonItem cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + sdtype + "BD", "With Border");
|
||||
cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways;
|
||||
cmbt.Text = "With Border";
|
||||
cmbt.Tag = string.Format("{0} {1} {2}", ftype, sdtype, "BD");
|
||||
cmbt.Click += new System.EventHandler(btnInsStep_Click);
|
||||
tabbtn.SubItems.Add(cmbt);
|
||||
DoFigureFromSubMenu(cmbt);
|
||||
int wo = sdtype == Centered ? 38 : 39;
|
||||
cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + wo + "NB", "Without Border");
|
||||
cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways;
|
||||
cmbt.Text = "Without Border";
|
||||
cmbt.Tag = string.Format("{0} {1} {2}", ftype, wo, "NB");
|
||||
cmbt.Click += new System.EventHandler(btnInsStep_Click);
|
||||
tabbtn.SubItems.Add(cmbt);
|
||||
DoFigureFromSubMenu(cmbt);
|
||||
tabbtn.Tag = null;
|
||||
tabbtn.Click -= new System.EventHandler(btnInsStep_Click);
|
||||
}
|
||||
private void DoFigureFromSubMenu(DevComponents.DotNetBar.ButtonItem tabbtn)
|
||||
{
|
||||
char[] sp = { ' ' };
|
||||
string[] insdata = tabbtn.Tag.ToString().Split(sp);
|
||||
int ftype = Convert.ToInt32(insdata[0]);
|
||||
int sdtype = Convert.ToInt32(insdata[1]);
|
||||
DevComponents.DotNetBar.ButtonItem cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + sdtype + "RO", "RO Figure");
|
||||
cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways;
|
||||
cmbt.Text = "RO Figure";
|
||||
cmbt.Tag = string.Format("{0} {1} {2}", ftype, sdtype, "RO");
|
||||
cmbt.Click += new System.EventHandler(btnInsStep_Click);
|
||||
tabbtn.SubItems.Add(cmbt);
|
||||
cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + sdtype + "CL", "From Clipboard");
|
||||
cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways;
|
||||
cmbt.Text = "From Clipboard";
|
||||
cmbt.Tag = string.Format("{0} {1} {2}", ftype, sdtype, "CL");
|
||||
cmbt.Click += new System.EventHandler(btnInsStep_Click);
|
||||
tabbtn.SubItems.Add(cmbt);
|
||||
cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + sdtype + "FL", "From File");
|
||||
cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways;
|
||||
cmbt.Text = "From File";
|
||||
cmbt.Tag = string.Format("{0} {1} {2}", ftype, sdtype, "FL"); // Text table
|
||||
cmbt.Click += new System.EventHandler(btnInsStep_Click);
|
||||
tabbtn.SubItems.Add(cmbt);
|
||||
tabbtn.Tag = null;
|
||||
tabbtn.Click -= new System.EventHandler(btnInsStep_Click);
|
||||
}
|
||||
private void DoTableSubMenu(DevComponents.DotNetBar.ButtonItem tabbtn)
|
||||
{
|
||||
char[] sp = { ' ' };
|
||||
@@ -2146,12 +2347,18 @@ namespace Volian.Controls.Library
|
||||
myROID = MyFlexGrid.ROID.ToLower();
|
||||
myRODB = RODbInfo.Get(MyFlexGrid.RODbId);
|
||||
}
|
||||
else if (MyItemInfo.IsFigure && MyItemInfo.MyContent.ContentRoUsages != null && MyItemInfo.MyContent.ContentRoUsages.Count > 0)
|
||||
{
|
||||
myROID = MyItemInfo.MyContent.ContentRoUsages[0].ROID;
|
||||
myRODB = MyItemInfo.MyContent.ContentRoUsages[0].MyRODb;
|
||||
}
|
||||
else
|
||||
{
|
||||
LinkText lt = new LinkText(_MyStepRTB.MyLinkText);
|
||||
LinkText lt = new LinkText(_MyStepRTB.MyLinkText);
|
||||
myROID = lt.MyRoUsageInfo.ROID.ToLower();
|
||||
myRODB = lt.MyRoUsageInfo.MyRODb;
|
||||
}
|
||||
if (myROID == null) return;
|
||||
if (myROID.StartsWith("ffff"))
|
||||
{
|
||||
MessageBox.Show("Unit Information RO's cannot be edited", "Unit Information RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
@@ -2262,6 +2469,7 @@ namespace Volian.Controls.Library
|
||||
MyEditItem.ToggleEditView(MyEditItem.MyStepPanel.VwMode);
|
||||
SetButtonAndMenuEnabling(true);
|
||||
SetStepButtonAndMenuEnabling(true);
|
||||
SetMenuEnablingForFigures();
|
||||
MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnModeChange(this, new StepRTBModeChangeEventArgs(MyEditItem.MyStepPanel.VwMode));
|
||||
btnEditMode.Checked = btnCMEditMode1.Checked = MyEditItem.MyStepPanel.VwMode == E_ViewMode.View;
|
||||
MyEditItem.MyStepRTB.SpellCheckContextMenuOn(MyEditItem.MyStepPanel.VwMode != E_ViewMode.View);
|
||||
@@ -3437,7 +3645,10 @@ namespace Volian.Controls.Library
|
||||
_PastePlainTextOvrRide = true;
|
||||
btnPaste_Click(sender, e);
|
||||
}
|
||||
|
||||
private void btnPasteImage_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MyEditItem is ImageItem) (MyEditItem as ImageItem).PasteImage();
|
||||
}
|
||||
private void btnPasteStepText_Click(object sender, EventArgs e)
|
||||
{
|
||||
StartGridEditing(SelectionOption.End);
|
||||
|
Reference in New Issue
Block a user