B2024-038: tree view menuing for paste/replace of sections
This commit is contained in:
parent
cf69aa93e6
commit
7cf28366f4
@ -672,8 +672,10 @@ namespace Volian.Controls.Library
|
|||||||
if (_MyDisplayTabItems.ContainsKey(key) && pasteType != ItemInfo.EAddpingPart.Replace) // If procedure page open use it unless replace
|
if (_MyDisplayTabItems.ContainsKey(key) && pasteType != ItemInfo.EAddpingPart.Replace) // If procedure page open use it unless replace
|
||||||
{
|
{
|
||||||
DisplayTabItem pg = _MyDisplayTabItems[key];
|
DisplayTabItem pg = _MyDisplayTabItems[key];
|
||||||
|
// B2024-038: if section, refresh the editor even if the section is not expanded.
|
||||||
|
bool isSec = myItemInfo.IsSection;
|
||||||
if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID) &&
|
if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID) &&
|
||||||
pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID].Expanded)
|
(pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID].Expanded || isSec))
|
||||||
{
|
{
|
||||||
EditItem edtitm = pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID];
|
EditItem edtitm = pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID];
|
||||||
switch (pasteType)
|
switch (pasteType)
|
||||||
@ -710,7 +712,8 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
else if (_MyDisplayTabItems.ContainsKey(key) && pasteType == ItemInfo.EAddpingPart.Replace)
|
else if (_MyDisplayTabItems.ContainsKey(key) && pasteType == ItemInfo.EAddpingPart.Replace)
|
||||||
{
|
{
|
||||||
CloseTabItem(_MyDisplayTabItems["Item - " + myItemInfo.ItemID.ToString()]); //Grab itemID and set to close open tab.
|
// B2024-038: changed tab key to procedure (was item, which caused crash if section)
|
||||||
|
CloseTabItem(_MyDisplayTabItems["Item - " + proc.ItemID.ToString()]); //Grab itemID and set to close open tab.
|
||||||
return false; //B2017-179 PasteReplace will return null if was aborted
|
return false; //B2017-179 PasteReplace will return null if was aborted
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1740,10 +1740,13 @@ namespace Volian.Controls.Library
|
|||||||
// 1) 'to' & 'from' both 'non', i.e. Neither can have enhanced config data (be source or enhanced)
|
// 1) 'to' & 'from' both 'non', i.e. Neither can have enhanced config data (be source or enhanced)
|
||||||
// can do Before/After/Replace
|
// can do Before/After/Replace
|
||||||
// 2) 'to' section is 'source' and 'from' section is 'non' (has no MyEnhancedDocuments)
|
// 2) 'to' section is 'source' and 'from' section is 'non' (has no MyEnhancedDocuments)
|
||||||
// can do Before/After - no links exist in pasted section.
|
// can do Before/After - no links exist in pasted section so cannot do Replace
|
||||||
// cannot do Replace
|
|
||||||
// 3) 'to' section is 'source' and 'from' section is same docversion 'source'
|
// 3) 'to' section is 'source' and 'from' section is same docversion 'source'
|
||||||
// can do Before/After/Replace
|
// can do Before/After (B2024-038 removes replace)
|
||||||
|
// 4) 'to' section is not 'source' and 'from' section is source
|
||||||
|
// can do Before/After but not replace - would have to manage
|
||||||
|
// links for 'from' section (B2024-038 added this case)
|
||||||
|
|
||||||
SectionConfig secToCfg = iiPasteHere.MyConfig as SectionConfig;
|
SectionConfig secToCfg = iiPasteHere.MyConfig as SectionConfig;
|
||||||
SectionConfig secFromCfg = iiClipboard.MyConfig as SectionConfig;
|
SectionConfig secFromCfg = iiClipboard.MyConfig as SectionConfig;
|
||||||
|
|
||||||
@ -1752,13 +1755,22 @@ namespace Volian.Controls.Library
|
|||||||
bool secFromIsEnhanced = iiClipboard.IsEnhancedSection;
|
bool secFromIsEnhanced = iiClipboard.IsEnhancedSection;
|
||||||
bool secFromIsSource = secFromCfg.MyEnhancedDocuments != null && secFromCfg.MyEnhancedDocuments.Count > 0 && secFromCfg.MyEnhancedDocuments[0].Type != 0;
|
bool secFromIsSource = secFromCfg.MyEnhancedDocuments != null && secFromCfg.MyEnhancedDocuments.Count > 0 && secFromCfg.MyEnhancedDocuments[0].Type != 0;
|
||||||
bool secCanPaste = false;
|
bool secCanPaste = false;
|
||||||
if (!secToIsEnhanced && !secToIsSource && !secFromIsEnhanced && !secFromIsSource) secCanPaste = true; // 1)
|
if (!secToIsEnhanced && !secToIsSource && !secFromIsEnhanced && !secFromIsSource) secCanPaste = true; // 1)
|
||||||
else if (secToIsSource && !secFromIsEnhanced && !secFromIsSource) // 2)
|
else if (secToIsSource && !secFromIsEnhanced && !secFromIsSource) // 2)
|
||||||
{
|
{
|
||||||
secCanPaste = true;
|
secCanPaste = true;
|
||||||
okToReplace = false;
|
okToReplace = false;
|
||||||
}
|
}
|
||||||
else if (secToIsSource && iiPasteHere.MyDocVersion.VersionID == iiClipboard.MyDocVersion.VersionID) secCanPaste = true; // 3)
|
else if (secToIsSource && iiPasteHere.MyDocVersion.VersionID == iiClipboard.MyDocVersion.VersionID)
|
||||||
|
{
|
||||||
|
secCanPaste = true; // 3)
|
||||||
|
okToReplace = false;
|
||||||
|
}
|
||||||
|
else if (!secToIsSource && secFromIsSource)
|
||||||
|
{
|
||||||
|
secCanPaste = true; // 4
|
||||||
|
okToReplace = false;
|
||||||
|
}
|
||||||
if (iiClipboard.IsRtfRaw) secCanPaste = okToReplace = false; // never paste an equation.
|
if (iiClipboard.IsRtfRaw) secCanPaste = okToReplace = false; // never paste an equation.
|
||||||
if (secCanPaste) cm.MenuItems.Add("Paste Section Before", new EventHandler(mi_Click));
|
if (secCanPaste) cm.MenuItems.Add("Paste Section Before", new EventHandler(mi_Click));
|
||||||
if (okToReplace && secCanPaste) cm.MenuItems.Add("Replace Existing Section", new EventHandler(mi_Click));
|
if (okToReplace && secCanPaste) cm.MenuItems.Add("Replace Existing Section", new EventHandler(mi_Click));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user