This commit is contained in:
Kathy Ruffing 2009-11-13 16:13:30 +00:00
parent d4f0563fde
commit 10898f5d90
3 changed files with 56 additions and 3 deletions

View File

@ -140,7 +140,11 @@ namespace Volian.Controls.Library
_MyStepPanel.ItemSelectedChanged += new ItemSelectedChangedEvent(_MyStepPanel_ItemSelectedChanged);
_MyStepPanel.ModeChange += new Volian.Controls.Library.StepPanelModeChangeEvent(_MyStepPanel_ModeChange);
_MyStepPanel.TabDisplay += new Volian.Controls.Library.StepPanelTabDisplayEvent(_MyStepPanel_TabDisplay);
_MyStepPanel.WordSectionClose += new StepPanelWordSectionCloseEvent(_MyStepPanel_WordSectionClose);
_MyStepPanel.WordSectionDeleted += new StepPanelWordSectionDeletedEvent(_MyStepPanel_WordSectionDeleted);
}
#endregion
#region Event Handlers
private bool _ShowingItem = false;
@ -266,6 +270,14 @@ namespace Volian.Controls.Library
{
_MyDisplayTabControl.OnPanelTabDisplay(sender, args);
}
void _MyStepPanel_WordSectionClose(object sender, WordSectionEventArgs args)
{
_MyDisplayTabControl.OnWordSectionClose(sender, args);
}
void _MyStepPanel_WordSectionDeleted(object sender, WordSectionEventArgs args)
{
_MyDisplayTabControl.OnWordSectionDeleted(sender, args);
}
#endregion
}
}

View File

@ -257,6 +257,8 @@ namespace Volian.Controls.Library
btnCMHardSpace.Enabled = btnInsHrdSpc.Enabled = setting;
btnCMSymbol.Enabled = btnSymbols.Enabled = setting;
btnIndent.Enabled = setting;
btnDelelete.Enabled = btnDelStep.Enabled = setting;
btnInsAftH.Enabled = btnInsBefH.Enabled = setting;
}
private void SetButtonAndMenuEnabling()
{
@ -272,6 +274,7 @@ namespace Volian.Controls.Library
else
{
SetButtonMenuEnabledDisabled(true);
if (_MyStepRTB.SelectionFont != null)
{
btnCMBold.Checked = btnBold.Checked = RTBAPI.IsBold(_MyStepRTB);
@ -317,8 +320,8 @@ namespace Volian.Controls.Library
btnInsPgBrk.Enabled = MyItemInfo.IsHigh;
btnEditMode.Checked = btnCMEditMode1.Checked = MyStepItem.MyStepPanel.PanelViewEditMode != E_ViewMode.View;
// if on procedure or section 'change type' & 'insert' buttons should be disabled.
if (MyItemInfo.IsProcedure) btnDelelete.Enabled = btnDelStep.Enabled = false;
if (MyItemInfo.IsProcedure || MyItemInfo.IsSection)
{
btnChgTyp.Enabled = false;
@ -327,6 +330,7 @@ namespace Volian.Controls.Library
// if on a procedure or section title, don't allow for insert of ROs or Transitions:
// disable buttons. Info panels for ROs and Transitions are made invisible in frmVEPROMS.cs
btnInsTrans.Enabled = btnCMTransition.Enabled = btnInsRO.Enabled = btnCMRO.Enabled = false;
btnInsAftH.Enabled = btnInsBefH.Enabled = false;
this.Refresh();
return;
}
@ -345,8 +349,8 @@ namespace Volian.Controls.Library
btnInsFig.Enabled = (actable & E_AccStep.AddingTable) > 0;
btnInsTable.Enabled = (actable & E_AccStep.AddingTable) > 0;
btnInsSubstep.Enabled = (actable & E_AccStep.AddingSub) > 0;
btnInsBefore.Enabled = (actable & E_AccStep.AddingPrev) > 0;
btnInsAfter.Enabled = (actable & E_AccStep.AddingNext) > 0;
btnInsBefore.Enabled = btnInsBefH.Enabled = (actable & E_AccStep.AddingPrev) > 0;
btnInsAfter.Enabled = btnInsAftH.Enabled = (actable & E_AccStep.AddingNext) > 0;
btnInsHLS.SubItems.Clear();
btnInsCaut.SubItems.Clear();
@ -728,6 +732,43 @@ namespace Volian.Controls.Library
MyStepItem.MyStepPanel.OnTabDisplay(sender, args);
}
private void btnDelStep_Click(object sender, EventArgs e)
{
SectionInfo si = MyStepItem.MyItemInfo as SectionInfo;
if (si != null)
{
string msg = si.HasChildren ? "Are you sure you want to delete this section and its steps?" : "Are you sure you want to delete this section?";
DialogResult result = MessageBox.Show(msg, "Verify Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
if (!si.IsStepSection)
{
WordSectionEventArgs args = new WordSectionEventArgs(si);
MyStepItem.MyStepPanel.OnWordSectionClose(sender, args);
}
MyStepItem.RemoveItem();
if (!si.IsStepSection)
{
WordSectionEventArgs args = new WordSectionEventArgs(si);
MyStepItem.MyStepPanel.OnWordSectionDeleted(sender, args);
}
}
return;
}
StepInfo stpi = MyStepItem.MyItemInfo as StepInfo;
if (stpi == null) // not sure that it will every get here!
{
MessageBox.Show("Unknown type, cannot delete!");
return;
}
string msgs = stpi.HasChildren ? "Are you sure you want to delete this step and its substeps?" : "Are you sure you want to delete this step?";
DialogResult results = MessageBox.Show(msgs, "Verify Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (results == DialogResult.Yes)
{
MyStepItem.RemoveItem();
}
}
}
public enum E_FieldToEdit { StepText, Text, Number };