This commit is contained in:
2009-08-18 14:49:01 +00:00
parent ed89a68e90
commit 9a7a9c3f72
3 changed files with 89 additions and 24 deletions

View File

@@ -52,7 +52,7 @@ namespace Volian.Controls.Library
private VETreeNode _RangeNode2;
// Use _RangeColor to show highlighting for steps selected in range. This is set from
// calling methods from application settings. If not default to aquamarine.
private Color _RangeColor = Color.Aquamarine;
private Color _RangeColor = Color.LightGreen;
public Color RangeColor
{
get { return _RangeColor; }
@@ -92,6 +92,10 @@ namespace Volian.Controls.Library
private ItemInfo _CurrentProcedure; // current procedure used to set all of the controls (may switch between above two)
private int _CurrentProcIndex;
private bool _AlwaysDisableSets; // true if there is only 1 item in tree/combo for sets
private Color _OrigGroupPanelSets;
private Color _OrigGroupPanelProcs;
private Color _OrigGroupPanelSects;
private Color _OrigGroupPanelSteps;
#endregion
#region Constructors
public DisplayTransition()
@@ -111,6 +115,11 @@ namespace Volian.Controls.Library
}
private void InitControls()
{
_OrigGroupPanelSets = groupPanelTransitionSets.Style.BackColor;
_OrigGroupPanelProcs = groupPanelTransitionProcs.Style.BackColor;
_OrigGroupPanelSects = groupPanelTransitionSect.Style.BackColor;
_OrigGroupPanelSteps = groupPanelTranstionSteps.Style.BackColor;
ListBoxTranFmtFillIn();
// if new, use _CurItemFrom to setup the initial selections in the controls,
@@ -193,7 +202,7 @@ namespace Volian.Controls.Library
}
private void tvInitHiliteRange(bool rangeSameLevel, ItemInfo stpitm, ItemInfo rngitm, int uplevel)
{
_RangeNode1 = (VETreeNode) tvTran.SelectedNode;
_RangeNode1 = _CurTrans != null ? (VETreeNode)tvTran.SelectedNode : null;
_RangeNode2 = null;
// get first treenode at this level
VETreeNode tn = (VETreeNode)tvTran.Nodes[0];
@@ -376,17 +385,20 @@ namespace Volian.Controls.Library
for (int i = 0; i < ttl.Count; i++)
listBoxTranFmt.Items.Add(ttl[i].TransFormat.Replace("?.",""));
listBoxTranFmt.SelectedIndex = _TranFmtIndx;
groupPanelTranFmt.Style.BackColor = (_CurTrans == null && _TranFmtIndx==0) ? Color.Yellow : Color.Orange;
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI;
_DoingRange = (etm & E_TransUI.StepLast) == E_TransUI.StepLast;
}
private void tvTranFillIn(ItemInfo startitm)
{
tvTran.Nodes.Clear();
groupPanelTranstionSteps.Style.BackColor = _OrigGroupPanelSteps;
if (startitm == null) return;
// if the transition to point is a section or procedure, just return
if (startitm.MyContent.Type < 20000) return;
groupPanelTranstionSteps.Style.BackColor = Color.Cornsilk;
// For the tree view, use parent, unless already at HLS. If at HLS, use this level.
ItemInfo selitm = startitm;
if (_CurTrans == null)
@@ -447,6 +459,9 @@ namespace Volian.Controls.Library
}
private void SetControlsEnabling()
{
groupPanelTransitionSets.Style.BackColor = _OrigGroupPanelSets;
groupPanelTransitionProcs.Style.BackColor = _OrigGroupPanelProcs;
groupPanelTransitionSect.Style.BackColor = _OrigGroupPanelSects;
// Based on selection & enum representing the transition format, determine the enabling of associated controls
if (_CurItemFrom == null) return;
int indx = listBoxTranFmt.SelectedIndex;
@@ -457,8 +472,13 @@ namespace Volian.Controls.Library
vlnTreeComboSets.Enabled = false;
if ((etm & E_TransUI.ProcMenu) == E_TransUI.ProcMenu)
{
if (!_AlwaysDisableSets)vlnTreeComboSets.Enabled = true;
if (!_AlwaysDisableSets)
{
vlnTreeComboSets.Enabled = true;
groupPanelTransitionSets.Style.BackColor = Color.Cornsilk;
}
cbTranProcs.Enabled = true;
groupPanelTransitionProcs.Style.BackColor = Color.Cornsilk;
}
else
{
@@ -467,12 +487,13 @@ namespace Volian.Controls.Library
}
// Do section combo, in 16-bit system it was types 0, 3, 4, 5
if (cbTranSects.Items.Count>0 &&
if (cbTranSects.Items.Count > 0 &&
(((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault) ||
((etm & E_TransUI.SectMenuAny) == E_TransUI.SectMenuAny) ||
((etm & E_TransUI.SectMenuStep) == E_TransUI.SectMenuStep)))
{
cbTranSects.Enabled = true;
groupPanelTransitionSect.Style.BackColor = Color.Cornsilk;
}
else
cbTranSects.Enabled = false;
@@ -481,7 +502,10 @@ namespace Volian.Controls.Library
// 'cleared/invisble'.
btnTranRangeClear.Visible = _DoingRange;
lblxTranRangeTip.Visible = _DoingRange;
lblxTranRangeTip.BackColor = _RangeColor;
if (_DoingRange)
{
lblxTranRangeTip.BackColor = Color.Yellow;
}
// if any previous nodes selected for range - clear them here
if (!_DoingRange && _RangeNode1 != null) ClearRangeTransition();
// Always allow for step selection if there are items.
@@ -600,7 +624,6 @@ namespace Volian.Controls.Library
{
if (_InitializingTrans) return;
if (listBoxTranFmt.SelectedIndex == _TranFmtIndx) return;
if (_RangeNode1 != null) ClearRangeTransition();
// if this selection needs a step, but not a procedure, use the current procedure & the section list may need to updated
// with step only section. List the step sections of the current procedure.....
@@ -615,6 +638,7 @@ namespace Volian.Controls.Library
if (chldrn != null && chldrn.Count > 0) cbTranSectsFillIn((ItemInfo)chldrn[0], sectstartid);
}
_TranFmtIndx = listBoxTranFmt.SelectedIndex;
groupPanelTranFmt.Style.BackColor = (_CurTrans == null && _TranFmtIndx == 0) ? Color.Yellow : Color.Orange;
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI;
_DoingRange = (etm & E_TransUI.StepLast) == E_TransUI.StepLast;
SetControlsEnabling();
@@ -684,6 +708,7 @@ namespace Volian.Controls.Library
_RangeNode1 = (VETreeNode)tvTran.SelectedNode;
_RangeNode2 = null;
lblxTranRangeTip.Text = "Select Last Step \r\nfor Range";
lblxTranRangeTip.BackColor = Color.LightPink;
}
else
{
@@ -692,6 +717,7 @@ namespace Volian.Controls.Library
tvTran.SelectedNode.BackColor = _RangeColor;
tvTranRangeHilites(true, _RangeNode1, _RangeNode2);
lblxTranRangeTip.Text = "Select First Transition\r\nfor Range";
lblxTranRangeTip.BackColor = Color.Yellow;
}
}
}