C2015-028 Add Editorial Mode to PROMS Step Editor

This commit is contained in:
2025-09-25 08:01:19 -04:00
parent e8b32c4ed3
commit 9130604fa6
10 changed files with 161 additions and 38 deletions

View File

@@ -11,6 +11,7 @@ using DevComponents.DotNetBar;
using JR.Utils.GUI.Forms;
using Volian.Base.Library;
using Microsoft.Win32;
using System.Linq;
namespace Volian.Controls.Library
{
@@ -261,24 +262,45 @@ namespace Volian.Controls.Library
get { return _ChgId; }
set { _ChgId = value; }
}
// C2015-028 Add Editorial Mode to PROMS Step Editor
public bool EditorialChange
{
get
{
if (_ChgId == null) return true;
if (_ChgId == "") return true;
if (_ChgId.ToUpper() == "EC") return true;
return false;
}
}
#endregion
#region Events
/// <summary>
/// This event is raised when a the "Tab" of a DisplayItem is clicked with a mouse.
/// So far this has just been used for demo purposes. It could be used to select a
/// step and it's children for the purpose of copying.
/// </summary>
public event StepPanelEvent ItemClick;
if (_ChgId.ToUpper() == "EC") { return true;}
return IsInEditorialMode;
}
}
// C2015-028 Add Editorial Mode to PROMS Step Editor
// property to hold if button in ribbon is toggled on or off
public bool IsInEditorialMode { get; set; } = false;
// C2015-028 Add Editorial Mode to PROMS Step Editor
// This is used when button in the ribbon is toggled on/off
// It iterates through all previously opened tabs
// and updates the "Editorial Mode" button
// and background color to match those of the current tab
public void SetEdititorialModeForAllTabs(bool mode)
{
foreach (DisplayTabItem tabItem in _MyDisplayTabItems.Values.Where(tabItem => tabItem.MyStepTabPanel != null))
{
tabItem.MyStepTabPanel.MyStepTabRibbon.SetEditorialMode(mode);
}
}
#endregion
#region Events
/// <summary>
/// This event is raised when a the "Tab" of a DisplayItem is clicked with a mouse.
/// So far this has just been used for demo purposes. It could be used to select a
/// step and it's children for the purpose of copying.
/// </summary>
public event StepPanelEvent ItemClick;
/// <summary>
/// Checks to see if the ItemClick event is handled and launches it
/// </summary>

View File

@@ -799,27 +799,41 @@ namespace Volian.Controls.Library
// if the plant has the change id option, the change id was entered when the program started.
// this should be saved for every piece of edited data. Note that the set of config
// item Step_MultipleChangeID has the save built in to it.
if (sc == null) sc = new StepConfig();
if (MyStepRTB.MyItemInfo.IsStep &&
MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds
&& !this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange)
{
//StepConfig sc = MyStepRTB.MyItemInfo.MyConfig as StepConfig;
if (sc == null) sc = new StepConfig();
sc.Step_ChangeID = this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.ChgId;
//if (MyStepRTB.MyItemInfo.MyConfig == null) itm.MyContent.Config = sc.ToString();
}
// C2015-028 Add Editorial Mode to PROMS Step Editor
// if in Editorial Mode, treat it the same as if the ChangeIds are set in the Format file
if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsInEditorialMode && !existingChangeBar)
{
sc.Step_ChangeIDEditorialMode = Volian.Base.Library.VlnSettings.UserID;
}
else
{
sc.Step_ChangeIDEditorialMode = null;
}
// B2020-017: If making an editorial change, clear the Change id. Having the change id on
// was adding/printing a change bar.
// C2015-028 Add Editorial Mode to PROMS Step Editor
// if in Editorial Mode, treat it the same as if the ChangeIds are set in the Format file
if (MyStepRTB.MyItemInfo.IsStep &&
MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds
&& this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange
&& hasChangeBar == false)
(MyStepRTB.MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds
|| MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsInEditorialMode
)
&& MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange
&& !hasChangeBar)
{
if (sc == null) sc = new StepConfig();
sc.Step_ChangeID = null;
}
// B2015-024 Have Spell Checker text changes be an editorial change (not assign a change bar but keep existing change bar)
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.EditData.EditoralSpellCheck)
// C2015-028 Add Editorial Mode to PROMS Step Editor
// if in Editorial Mode, treat it the same as if the Rditorial SprllCheck flag is set in the Format file
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.EditData.EditoralSpellCheck || this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsInEditorialMode)
{
if (StepRTB.DidEditorialSpellCheck)
{

View File

@@ -650,8 +650,13 @@ namespace Volian.Controls.Library
/// </summary>
public Color ActiveColor
{
get { return _ActiveColor; }
set { _ActiveColor = value; }
get {
// C2015-028 Add Editorial Mode to PROMS Step Editor
// if in Editorial Mode, use LightGreen background
_ActiveColor = MyStepTabPanel != null && MyStepTabPanel.MyDisplayTabControl.IsInEditorialMode ? Color.LightGreen : Color.SkyBlue;
return _ActiveColor;
}
set { _ActiveColor = value; }
}
/// <summary>
/// Gets or Sets the Annotation backcolor for StepRTBs in the Panel

View File

@@ -3760,7 +3760,12 @@ namespace Volian.Controls.Library
public bool SpellCheckNext()
{
int nBad = C1SpellChecker2.CheckControl(this, false, MySpellCheckDlg);
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.EditData.EditoralSpellCheck)
// C2015-028 Add Editorial Mode to PROMS Step Editor
// if in Editorial Mode, treat it the same as if the EditorialSpellCheck flag is set in the Format file
bool editorialmode = (this.Parent.Parent.Parent as StepTabPanel).MyDisplayTabControl.IsInEditorialMode;
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.EditData.EditoralSpellCheck || editorialmode)
DidEditorialSpellCheck = MySpellCheckDlg.DidCorrectSpelling; // B2015-024 spell checker in editoral mode
return (nBad >= 0); // nBad = -1 means user pressed Cancel button
}

View File

@@ -120,7 +120,7 @@ namespace Volian.Controls.Library
/// </summary>
private void SetupStepTabRibbon()
{
_MyStepTabRibbon = new StepTabRibbon();
_MyStepTabRibbon = new StepTabRibbon(_MyDisplayTabControl.IsInEditorialMode);
_MyStepTabRibbon.Dock = System.Windows.Forms.DockStyle.Top;
_MyStepTabRibbon.Location = new System.Drawing.Point(0, 0);
_MyStepTabRibbon.Name = "displayTabRibbon1";

View File

@@ -995,7 +995,7 @@ namespace Volian.Controls.Library
// SetButtonAndMenuEnabling(true);
//}
#region Constructor
public StepTabRibbon()
public StepTabRibbon(bool? IsInEditorialMode = false)
{
InitializeComponent();
this.btnInsSupInfo.Tag = string.Format("{0} {1}", (int)E_FromTypes.SupInfos, 1040); // Make type of rno (40) & special case 1000
@@ -1021,8 +1021,16 @@ namespace Volian.Controls.Library
// hide the import from Word file if not running in Debug mode
if (!VlnSettings.DebugMode)
rbnImpWrd.Visible = false;
}
void _RibbonControl_SizeChanged(object sender, EventArgs e)
// C2015-028 Add Editorial Mode to PROMS Step Editor
// default Editorial Mode to what is set in the DisplayTabControl
SetEditorialMode(IsInEditorialMode != null && (bool) IsInEditorialMode);
}
public void SetEditorialMode(bool mode) => btnEditorialMode.Checked = btnCMEditorialMode.Checked = mode;
void _RibbonControl_SizeChanged(object sender, EventArgs e)
{
this.Size = _RibbonControl.Size;
}
@@ -3125,7 +3133,7 @@ namespace Volian.Controls.Library
btnCMRedo.Enabled = btnRedo.Enabled = _MyStepRTB.CanRedo;
btnCMUndo.Enabled = btnUndo.Enabled = _MyStepRTB.CanUndo;
}
private void btnGoTo_Click(object sender, EventArgs e)
private void btnGoTo_Click(object sender, EventArgs e)
{
// if on a transition, go to the selected transition 'to'. If on
// a referenced object, bring up ReferencedObject Editor (for now, just put up a message box.
@@ -3211,7 +3219,29 @@ namespace Volian.Controls.Library
System.Diagnostics.Process.Start(roapp, args);
}
}
private void btnChgTyp_Click(object sender, EventArgs e)
// C2015-028 Add Editorial Mode to PROMS Step Editor
private void btnEditorialMode_Click(object sender, EventArgs e)
{
//toggle button is selected
SetEditorialMode(!btnEditorialMode.Checked);
//set the overall flag in the displaytabcontrol
StepTabPanel tmp = Parent as StepTabPanel;
tmp.MyDisplayTabControl.IsInEditorialMode = btnEditorialMode.Checked;
//refresh the current item so the background color changes (LightGreen=Editorial Mode, SkyBlue=Normal Selected)
if (MyEditItem != null)
{
_MyEditItem.RefreshContent();
Application.DoEvents();
}
//set other preciously opened tabs to match the state of Editorial Mode in the current tab
tmp.MyDisplayTabControl.SetEdititorialModeForAllTabs(btnEditorialMode.Checked);
}
private void btnChgTyp_Click(object sender, EventArgs e)
{
StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("Change Step Type");
MyEditItem.MyStepPanel.OnTabDisplay(sender, args);
@@ -3279,7 +3309,8 @@ namespace Volian.Controls.Library
rtabInsert.Visible = false;
rtabAdmin.Visible = false;
rtabReview.Select();
btnCMEditMode1.Enabled = btnEditMode.Enabled = false; // don't allow reviewer toggle out of view mode
btnCMEditMode1.Enabled = btnEditMode.Enabled = btnCMEditorialMode.Enabled = false; // don't allow reviewer toggle out of view mode
btnCMEditorialMode.Visible = false;
}
}
public void SetupROEditorMode()