Page Num Transition (for grids)

This commit is contained in:
2014-01-22 12:06:56 +00:00
parent cfb0981a22
commit 4e445bbe20
9 changed files with 245 additions and 26 deletions

View File

@@ -30,6 +30,7 @@ namespace Volian.Controls.Library
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DisplayTransition));
this.groupPanelBtns = new DevComponents.DotNetBar.Controls.GroupPanel();
this.cbPageNum = new DevComponents.DotNetBar.Controls.CheckBoxX();
this.btnTranCancel = new DevComponents.DotNetBar.ButtonX();
this.btnTranSave = new DevComponents.DotNetBar.ButtonX();
this.groupPanelTranFmt = new DevComponents.DotNetBar.Controls.GroupPanel();
@@ -61,13 +62,14 @@ namespace Volian.Controls.Library
//
this.groupPanelBtns.CanvasColor = System.Drawing.SystemColors.Control;
this.groupPanelBtns.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanelBtns.Controls.Add(this.cbPageNum);
this.groupPanelBtns.Controls.Add(this.btnTranCancel);
this.groupPanelBtns.Controls.Add(this.btnTranSave);
this.groupPanelBtns.Dock = System.Windows.Forms.DockStyle.Top;
this.groupPanelBtns.Location = new System.Drawing.Point(0, 0);
this.groupPanelBtns.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelBtns.Name = "groupPanelBtns";
this.groupPanelBtns.Size = new System.Drawing.Size(501, 44);
this.groupPanelBtns.Size = new System.Drawing.Size(501, 71);
//
//
//
@@ -98,6 +100,21 @@ namespace Volian.Controls.Library
this.groupPanelBtns.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.groupPanelBtns.TabIndex = 25;
//
// cbPageNum
//
this.cbPageNum.BackColor = System.Drawing.Color.Transparent;
//
//
//
this.cbPageNum.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.cbPageNum.Location = new System.Drawing.Point(0, 43);
this.cbPageNum.Name = "cbPageNum";
this.cbPageNum.Size = new System.Drawing.Size(168, 18);
this.cbPageNum.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.cbPageNum.TabIndex = 26;
this.cbPageNum.Text = "Include Page Number";
this.cbPageNum.CheckedChanged += new System.EventHandler(this.cbPageNum_CheckedChanged);
//
// btnTranCancel
//
this.btnTranCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
@@ -136,10 +153,10 @@ namespace Volian.Controls.Library
this.groupPanelTranFmt.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanelTranFmt.Controls.Add(this.listBoxTranFmt);
this.groupPanelTranFmt.Dock = System.Windows.Forms.DockStyle.Top;
this.groupPanelTranFmt.Location = new System.Drawing.Point(0, 44);
this.groupPanelTranFmt.Location = new System.Drawing.Point(0, 71);
this.groupPanelTranFmt.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelTranFmt.Name = "groupPanelTranFmt";
this.groupPanelTranFmt.Size = new System.Drawing.Size(501, 182);
this.groupPanelTranFmt.Size = new System.Drawing.Size(501, 174);
//
//
//
@@ -192,7 +209,7 @@ namespace Volian.Controls.Library
this.groupPanelTransitionSets.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanelTransitionSets.Controls.Add(this.vlnTreeComboSets);
this.groupPanelTransitionSets.Dock = System.Windows.Forms.DockStyle.Top;
this.groupPanelTransitionSets.Location = new System.Drawing.Point(0, 226);
this.groupPanelTransitionSets.Location = new System.Drawing.Point(0, 245);
this.groupPanelTransitionSets.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelTransitionSets.Name = "groupPanelTransitionSets";
this.groupPanelTransitionSets.Size = new System.Drawing.Size(501, 59);
@@ -245,7 +262,7 @@ namespace Volian.Controls.Library
this.groupPanelTransitionProcs.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanelTransitionProcs.Controls.Add(this.cbTranProcs);
this.groupPanelTransitionProcs.Dock = System.Windows.Forms.DockStyle.Top;
this.groupPanelTransitionProcs.Location = new System.Drawing.Point(0, 285);
this.groupPanelTransitionProcs.Location = new System.Drawing.Point(0, 304);
this.groupPanelTransitionProcs.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelTransitionProcs.Name = "groupPanelTransitionProcs";
this.groupPanelTransitionProcs.Size = new System.Drawing.Size(501, 57);
@@ -298,7 +315,7 @@ namespace Volian.Controls.Library
this.groupPanelTransitionSect.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanelTransitionSect.Controls.Add(this.cbTranSects);
this.groupPanelTransitionSect.Dock = System.Windows.Forms.DockStyle.Top;
this.groupPanelTransitionSect.Location = new System.Drawing.Point(0, 342);
this.groupPanelTransitionSect.Location = new System.Drawing.Point(0, 361);
this.groupPanelTransitionSect.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelTransitionSect.Name = "groupPanelTransitionSect";
this.groupPanelTransitionSect.Size = new System.Drawing.Size(501, 60);
@@ -353,10 +370,10 @@ namespace Volian.Controls.Library
this.groupPanelTranstionSteps.Controls.Add(this.tvTran);
this.groupPanelTranstionSteps.Controls.Add(this.pnlTranStepBtns);
this.groupPanelTranstionSteps.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupPanelTranstionSteps.Location = new System.Drawing.Point(0, 402);
this.groupPanelTranstionSteps.Location = new System.Drawing.Point(0, 421);
this.groupPanelTranstionSteps.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelTranstionSteps.Name = "groupPanelTranstionSteps";
this.groupPanelTranstionSteps.Size = new System.Drawing.Size(501, 430);
this.groupPanelTranstionSteps.Size = new System.Drawing.Size(501, 411);
//
//
//
@@ -395,7 +412,7 @@ namespace Volian.Controls.Library
this.tvTran.Location = new System.Drawing.Point(0, 57);
this.tvTran.Margin = new System.Windows.Forms.Padding(4);
this.tvTran.Name = "tvTran";
this.tvTran.Size = new System.Drawing.Size(495, 350);
this.tvTran.Size = new System.Drawing.Size(495, 331);
this.superToolTipDispTran.SetSuperTooltip(this.tvTran, new DevComponents.DotNetBar.SuperTooltipInfo("", "", resources.GetString("tvTran.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
this.tvTran.TabIndex = 31;
this.tvTran.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvTran_AfterSelect);
@@ -522,5 +539,6 @@ namespace Volian.Controls.Library
private vlnTreeView3 tvTran;
private DevComponents.DotNetBar.SuperTooltip superToolTipDispTran;
private DevComponents.DotNetBar.Controls.CheckBoxX cbIncStepNum;
private DevComponents.DotNetBar.Controls.CheckBoxX cbPageNum;
}
}

View File

@@ -50,7 +50,7 @@ namespace Volian.Controls.Library
// use the following if user selects 'cancel' button
private ItemInfo _SavCurItemFrom;
private int _SavTranFmtIndx;
private bool _ModExistingPageNum = false;
private bool _DoingRange = false; // flags if in 'range' transition mode
private VETreeNode _RangeNode1;
private VETreeNode _RangeNode2;
@@ -580,6 +580,24 @@ namespace Volian.Controls.Library
}
else
cbIncStepNum.Visible = false;
// if this format has the transition flag for UseTransitionModifier, i.e. page numbers included in transition text,
// then make visible the checkbox & set based on data.
// and transition type has to be (tranType==1||tranType==2||tranType==4))
cbPageNum.Visible = _CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier &&
(_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[indx].Type == 1 ||
_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[indx].Type == 2 ||
_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[indx].Type == 4);
if (cbPageNum.Visible)
{
cbPageNum.Checked = false;
if (CurTrans != null)
{
TransitionConfig tc = new TransitionConfig(CurTrans.Config);
cbPageNum.Checked = _ModExistingPageNum = tc != null && tc.Transition_Formatted.ToUpper() == "TRUE";
}
}
}
#endregion
#region Events
@@ -866,7 +884,15 @@ namespace Volian.Controls.Library
btnTranSave.Enabled = allowSave;
if (CurTrans != null)
{
if (CurTrans.ToID == selii.ItemID) btnTranCancel.Enabled = btnTranSave.Enabled = false;
if (CurTrans.ToID == selii.ItemID)
{
// if the checkbox for including a page number (UseTransitionModifier flag is true)
// then need to check if this has been changed, and allow a save/cancel if so.
if (cbPageNum.Visible && _ModExistingPageNum != cbPageNum.Checked)
btnTranCancel.Enabled = btnTranSave.Enabled = true;
else
btnTranCancel.Enabled = btnTranSave.Enabled = false;
}
else
{
btnTranCancel.Enabled = true;
@@ -1010,7 +1036,8 @@ namespace Volian.Controls.Library
MessageBox.Show(sb.ToString());
return;
}
trantxt = TransitionText.GetResolvedText(MyRTB.MyItemInfo, listBoxTranFmt.SelectedIndex,toItem,rangeItem ?? toItem);
bool doTranmod = this.cbPageNum.Checked;
trantxt = TransitionText.GetResolvedText(MyRTB.MyItemInfo, listBoxTranFmt.SelectedIndex, toItem, rangeItem ?? toItem, doTranmod);
int ss = MyRTB.SelectionStart;// Remember where the link is being added
int sl = MyRTB.SelectionLength;
MyRTB.OnReturnToEditor(this, new EventArgs());
@@ -1126,6 +1153,11 @@ namespace Volian.Controls.Library
{
tvTran.Enabled=cbIncStepNum.Checked;
}
private void cbPageNum_CheckedChanged(object sender, EventArgs e)
{
if (_ModExistingPageNum != cbPageNum.Checked)
btnTranCancel.Enabled = btnTranSave.Enabled = true;
}
}
public class TransItem
{

View File

@@ -481,6 +481,7 @@ namespace Volian.Controls.Library
if (!MyFlexGrid.IsDirty && !IsSaving) return;
List<int> RtfRoUsageList = new List<int>();
List<int> RtfTransList = new List<int>();
List<int> RtfTransPageNumList = new List<int>();
int r = 0;
int c = 0;
@@ -524,6 +525,7 @@ namespace Volian.Controls.Library
{
int tid = int.Parse(myMatch.Groups[2].Value);
RtfTransList.Add(tid);
if (m.Groups[3].Value.Contains("(Page ~)")) RtfTransPageNumList.Add(tid);
}
}
}
@@ -567,7 +569,17 @@ namespace Volian.Controls.Library
{
List<int> delTrans = new List<int>();
foreach (TransitionInfo ti in MyItemInfo.MyContent.ContentTransitions)
{
if (!RtfTransList.Contains(ti.TransitionID)) delTrans.Add(ti.TransitionID);
else if (RtfTransPageNumList.Contains(ti.TransitionID))
{
using (Transition t = ti.Get())
{
t.Config = "<Config><Transition Formatted=\"True\" /></Config>";
t.Save();
}
}
}
foreach (int dt in delTrans) Transition.Delete(dt);
}