diff --git a/PROMS/VEPROMS User Interface/frmSectionProperties.Designer.cs b/PROMS/VEPROMS User Interface/frmSectionProperties.Designer.cs
index 49d31b57..e181b3ae 100644
--- a/PROMS/VEPROMS User Interface/frmSectionProperties.Designer.cs
+++ b/PROMS/VEPROMS User Interface/frmSectionProperties.Designer.cs
@@ -221,6 +221,7 @@ namespace VEPROMS
// ppBtnDefaultFmt
//
this.ppBtnDefaultFmt.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
+ this.ppBtnDefaultFmt.CallBasePaintBackground = true;
this.ppBtnDefaultFmt.Location = new System.Drawing.Point(587, 22);
this.ppBtnDefaultFmt.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ppBtnDefaultFmt.Name = "ppBtnDefaultFmt";
@@ -358,6 +359,7 @@ namespace VEPROMS
// ppBtnCvrtToLibDoc
//
this.ppBtnCvrtToLibDoc.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
+ this.ppBtnCvrtToLibDoc.CallBasePaintBackground = true;
this.ppBtnCvrtToLibDoc.Location = new System.Drawing.Point(21, 237);
this.ppBtnCvrtToLibDoc.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ppBtnCvrtToLibDoc.Name = "ppBtnCvrtToLibDoc";
@@ -618,6 +620,7 @@ namespace VEPROMS
// ppBtnDefaultPaginationStyle
//
this.ppBtnDefaultPaginationStyle.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
+ this.ppBtnDefaultPaginationStyle.CallBasePaintBackground = true;
this.ppBtnDefaultPaginationStyle.Location = new System.Drawing.Point(281, 166);
this.ppBtnDefaultPaginationStyle.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ppBtnDefaultPaginationStyle.Name = "ppBtnDefaultPaginationStyle";
@@ -633,6 +636,7 @@ namespace VEPROMS
// ppBtnDefaultNumColumns
//
this.ppBtnDefaultNumColumns.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
+ this.ppBtnDefaultNumColumns.CallBasePaintBackground = true;
this.ppBtnDefaultNumColumns.Location = new System.Drawing.Point(230, 227);
this.ppBtnDefaultNumColumns.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ppBtnDefaultNumColumns.Name = "ppBtnDefaultNumColumns";
@@ -689,6 +693,7 @@ namespace VEPROMS
// btnAutomation
//
this.btnAutomation.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
+ this.btnAutomation.CallBasePaintBackground = true;
this.btnAutomation.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnAutomation.Dock = System.Windows.Forms.DockStyle.Top;
this.btnAutomation.Location = new System.Drawing.Point(0, 69);
@@ -702,6 +707,7 @@ namespace VEPROMS
// btnLibDocs
//
this.btnLibDocs.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
+ this.btnLibDocs.CallBasePaintBackground = true;
this.btnLibDocs.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnLibDocs.Dock = System.Windows.Forms.DockStyle.Top;
this.btnLibDocs.Location = new System.Drawing.Point(0, 46);
@@ -715,6 +721,7 @@ namespace VEPROMS
// btnFormat
//
this.btnFormat.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
+ this.btnFormat.CallBasePaintBackground = true;
this.btnFormat.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnFormat.Dock = System.Windows.Forms.DockStyle.Top;
this.btnFormat.Location = new System.Drawing.Point(0, 23);
@@ -728,6 +735,7 @@ namespace VEPROMS
// btnGeneral
//
this.btnGeneral.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
+ this.btnGeneral.CallBasePaintBackground = true;
this.btnGeneral.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnGeneral.Dock = System.Windows.Forms.DockStyle.Top;
this.btnGeneral.Location = new System.Drawing.Point(0, 0);
@@ -744,8 +752,8 @@ namespace VEPROMS
| System.Windows.Forms.AnchorStyles.Right)));
this.tcSectionProp.BackColor = System.Drawing.Color.Transparent;
this.tcSectionProp.CanReorderTabs = true;
- this.tcSectionProp.Controls.Add(this.tcpFormat);
this.tcSectionProp.Controls.Add(this.tcpGeneral);
+ this.tcSectionProp.Controls.Add(this.tcpFormat);
this.tcSectionProp.Controls.Add(this.tcpAutomation);
this.tcSectionProp.Controls.Add(this.tcpLibDoc);
this.tcSectionProp.Controls.Add(this.tabControlPanel4);
@@ -1126,15 +1134,17 @@ namespace VEPROMS
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CaptionFont = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ClientSize = new System.Drawing.Size(873, 391);
+ this.ControlBox = false;
this.Controls.Add(this.tcSectionProp);
this.Controls.Add(this.panSectBtns);
this.Controls.Add(this.ppCbShwDefSettings);
this.Controls.Add(this.ppLblDefSettingsInfo);
this.Controls.Add(this.ppBtnCancel);
this.Controls.Add(this.ppBtnOK);
- this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
this.Name = "frmSectionProperties";
this.ShowIcon = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
diff --git a/PROMS/VEPROMS User Interface/frmSectionProperties.cs b/PROMS/VEPROMS User Interface/frmSectionProperties.cs
index 7886d41d..062520d8 100644
--- a/PROMS/VEPROMS User Interface/frmSectionProperties.cs
+++ b/PROMS/VEPROMS User Interface/frmSectionProperties.cs
@@ -59,25 +59,8 @@ namespace VEPROMS
// if creating a new section, enable the StepSect and WordSect radio buttons
rbStepSect.Enabled = rbWordSect.Enabled = !(ii.HasWordContent || ii.HasStepContent);
- // set up some of the format tab:
- SetupPpCmbxSectionType();
- ShowAvailableOptionsForSectionType();
-
- // check type of section from document styles to determine if the stepsection checkbox should
- // be checked.
- int secindx = (int)sectionConfig.SectionType;
- // find the index for the document style to determine whether this is a step or word section.
- PlantFormat pf = _SectionConfig.MyDefaultFormat.PlantFormat;
- for (int i = 0; i < pf.DocStyles.DocStyleList.Count; i++)
- {
- if (pf.DocStyles.DocStyleList[i].Index == secindx)
- {
- //_isStepSection = pf.DocStyles.DocStyleList[i].IsStepSection;
- //SetupPpCmbxSectionType();
- //ShowAvailableOptionsForSectionType();
- rbStepSect.Checked = pf.DocStyles.DocStyleList[i].IsStepSection;
- }
- }
+ // if this has already been set to be a step section, i.e. HasStepContent, disable the libdoc tab
+ if (ii.HasStepContent) tcpLibDoc.Enabled = false;
}
private void btnSectPropOK_Click(object sender, EventArgs e)
@@ -90,7 +73,10 @@ namespace VEPROMS
Settings.Default.ShowDefaultSectionProp = ppCbShwDefSettings.Checked;
Settings.Default.Save();
DialogResult = DialogResult.OK;
- _SectionConfig.MySection.Save().Dispose();
+ // save the type based on selection.
+ _SectionConfig.MySection.MyContent.Type = ((DocStyle)ppCmbxStyleSectionType.SelectedItem).Index + 10000;
+ Section mySection = _SectionConfig.MySection.Save();
+ FinishSectionSave(mySection);
// if there was a document to delete, do it.
if (_DocumentToDelete != null)
{
@@ -99,8 +85,36 @@ namespace VEPROMS
}
ppSectNumberStpRTB.SaveText();
ppSectTitleStpRTB.SaveText();
+ mySection.Dispose();
this.Close();
}
+ private static void FinishSectionSave(Section section)
+ {
+ ItemInfo sectinfo = ItemInfo.Get(section.ItemID);
+
+ // need to find out if this is a word document type section & if it is, create a new word doc.
+ bool isWordSect = true;
+ int sectype = (int)sectinfo.MyContent.Type - 10000;
+ PlantFormat pf = sectinfo.ActiveFormat.PlantFormat;
+ for (int i = 0; i < pf.DocStyles.DocStyleList.Count; i++)
+ {
+ if (pf.DocStyles.DocStyleList[i].Index == sectype)
+ {
+ isWordSect = !pf.DocStyles.DocStyleList[i].IsStepSection;
+ break;
+ }
+ }
+ if (isWordSect && !sectinfo.HasWordContent)
+ {
+ Content cont = Content.Get(sectinfo.MyContent.ContentID);
+
+ Byte[] tstbyte = System.Text.Encoding.Default.GetBytes("");
+ Document doc = Document.MakeDocument(null, tstbyte, null, null, null); // tstbyte, null, null, null);
+ Entry entry = cont.MyEntry;
+ entry.MyDocument = Document.Get(doc.DocID);
+ cont.Save().Dispose();
+ }
+ }
private void btnSectPropCancel_Click(object sender, EventArgs e)
{
_DocumentToDelete = null;
@@ -159,7 +173,6 @@ namespace VEPROMS
{
_Initializing = true;
sectionConfigBindingSource.DataSource = _SectionConfig;
-
ppCmbxFormat.DataSource = null;
ppCmbxFormat.DisplayMember = "FullName";
@@ -181,7 +194,6 @@ namespace VEPROMS
this.Width -= panSectBtns.Width;
}
-
// Get the default values for the property page information
FindDefaultValues();
@@ -203,8 +215,19 @@ namespace VEPROMS
if (!_isStepSection)
ppCmbxLibDocFill();
+ // check type of section from document styles to determine if the stepsection checkbox should
+ // be checked.
+ int secindx = (int)_SectionConfig.SectionType;
+ // find the index for the document style to determine whether this is a step or word section.
+ PlantFormat pf = _SectionConfig.MyFormat != null ? _SectionConfig.MyFormat.PlantFormat : _SectionConfig.MyDefaultFormat.PlantFormat;
+ for (int i = 0; i < pf.DocStyles.DocStyleList.Count; i++)
+ {
+ if (pf.DocStyles.DocStyleList[i].Index == secindx)
+ rbStepSect.Checked = pf.DocStyles.DocStyleList[i].IsStepSection;
+ }
+ // set up some of the format tab:
+ SetupPpCmbxSectionType();
ShowAvailableOptionsForSectionType();
-
_Initializing = false;
}
@@ -272,50 +295,71 @@ namespace VEPROMS
}
- ///
- /// Selection in Format combo box changed.
- ///
- /// object
- /// EventArgs
- //private void ppCmbxFormat_SelectedValueChanged(object sender, EventArgs e)
- //{
- // if ((ppCmbxFormat.SelectedIndex != -1) && _DefaultFormatName != null && _DefaultFormatName.Equals(ppCmbxFormat.SelectedValue))
- // {
- // ppBtnDefaultFmt.Focus();
- // ppBtnDefaultFmt.PerformClick();
- // }
- // ppBtnDefaultFmt.Visible = (ppCmbxFormat.SelectedValue != null);
- // ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
- // SetupPpCmbxSectionType();
- //}
-
private void SetupPpCmbxSectionType()
{
bool myInit = _Initializing;
- _Initializing = true;
- PlantFormat pf = _SectionConfig.MyDefaultFormat.PlantFormat;
+ // pf will be the current selected format. If changing formats, then this will differ from the previously
+ // selected. If the format is being reset to default, selectedindex=-1. If this is a change, we'll need
+ // to check that there are enough docstyles to map the selected type of section.
+ PlantFormat pf = _SectionConfig.MyFormat != null ? _SectionConfig.MyFormat.PlantFormat : _SectionConfig.MyDefaultFormat.PlantFormat;
if (ppCmbxFormat.SelectedIndex >= 0)
pf = FormatInfoList.SortedFormatInfoList[ppCmbxFormat.SelectedIndex].PlantFormat;
+ else if (!_Initializing) // if the format was changed, it may have been set to default.
+ pf = _SectionConfig.MyDefaultFormat.PlantFormat;
+ _Initializing = true;
ppCmbxStyleSectionType.DisplayMember = "Name";
ppCmbxStyleSectionType.ValueMember = "Index";
// if this has been defined as a step section, only list step section document styles, if
- // a word section, only list word section styles. If neither content types has been defined,
- // list both.
- DocStyleList locDocStyles = new DocStyleList(null);
- //ItemInfo ii = ItemInfo.Get(_SectionConfig.MySection.ItemID);
+ // a word section, only list word section styles.
+ // Also, if changing the format, check to be sure that the section that is selected will map
+ // to something valid in the new format, i.e. a section type of word or step sections exist,
+ // index-wise in the new format.
+ PlantFormat opf = null;
+ int oldSelIndx = -1;
+ if (!myInit)
+ {
+ DocStyleList oldDocStyles = null;
+ opf = _SectionConfig.MyFormat != null ? _SectionConfig.MyFormat.PlantFormat : _SectionConfig.MyDefaultFormat.PlantFormat;
+ if (pf != opf)
+ {
+ oldDocStyles = new DocStyleList(null);
+ for (int i = 0; i < opf.DocStyles.DocStyleList.Count; i++)
+ {
+ if (_isStepSection && opf.DocStyles.DocStyleList[i].IsStepSection)
+ oldDocStyles.Add(opf.DocStyles.DocStyleList[i]); // find only step section types
+ else if (!_isStepSection && !opf.DocStyles.DocStyleList[i].IsStepSection)
+ oldDocStyles.Add(opf.DocStyles.DocStyleList[i]); // find only accessory (MS Word) section types
+ if (_SectionConfig.SectionType == opf.DocStyles.DocStyleList[i].Index) oldSelIndx = oldDocStyles.Count - 1;
+ }
+ }
+ if (oldSelIndx < 0) oldSelIndx = 0;
+ }
+
+ DocStyleList newDocStyles = new DocStyleList(null);
int selindx = -1;
for (int i = 0; i < pf.DocStyles.DocStyleList.Count; i++)
{
if (_isStepSection && pf.DocStyles.DocStyleList[i].IsStepSection)
- locDocStyles.Add(pf.DocStyles.DocStyleList[i]); // add only step section types
+ newDocStyles.Add(pf.DocStyles.DocStyleList[i]); // add only step section types
else if (!_isStepSection && !pf.DocStyles.DocStyleList[i].IsStepSection)
- locDocStyles.Add(pf.DocStyles.DocStyleList[i]); // add only accessory (MS Word) section types
-
- if (_SectionConfig.SectionType == pf.DocStyles.DocStyleList[i].Index) selindx = locDocStyles.Count - 1;
+ newDocStyles.Add(pf.DocStyles.DocStyleList[i]); // add only accessory (MS Word) section types
+ if (_SectionConfig.SectionType == pf.DocStyles.DocStyleList[i].Index) selindx = newDocStyles.Count - 1;
}
- ppCmbxStyleSectionType.DataSource = locDocStyles;
+ if (selindx < 0) selindx = 0;
+ // if changing format, check for valid type (see comment above)
+ if (!myInit && pf != opf)
+ {
+ if (oldSelIndx > newDocStyles.Count)
+ {
+ string msg = string.Format("The section type that is set is not available in the new format, it was reset to {0}. Verify that it is appropriate.", newDocStyles[0].Name);
+ MessageBox.Show(msg, "Non-existent section");
+ selindx = 0;
+ }
+ }
+ ppCmbxStyleSectionType.DataSource = newDocStyles;
ppCmbxStyleSectionType.SelectedIndex = selindx;
+ ppCmbxStyleSectionType.Refresh();
if (!_isStepSection)
ppCmbxLibDocFill();
@@ -329,7 +373,7 @@ namespace VEPROMS
if (!_isStepSection) return; // not needed for accessory pages (word attachments)
bool myInit = _Initializing;
_Initializing = true;
- PlantFormat pf = _SectionConfig.MyDefaultFormat.PlantFormat;
+ PlantFormat pf = _SectionConfig.MyFormat!=null?_SectionConfig.MyFormat.PlantFormat:_SectionConfig.MyDefaultFormat.PlantFormat;
CheckOffList chkoffList = pf.FormatData.ProcData.CheckOffData.CheckOffList;
CheckOffHeaderList chkoffHeaderList = pf.FormatData.ProcData.CheckOffData.CheckOffHeaderList;
if (chkoffList != null && chkoffList.Count > 0)
@@ -365,14 +409,17 @@ namespace VEPROMS
private void ppCmbxFormat_SelectedIndexChanged(object sender, EventArgs e)
{
if (_Initializing) return;
+ bool didDefault = false;
+ Console.WriteLine("CmbxFormat.SelectedIndexChanged - Index = {0}", ppCmbxFormat.SelectedIndex);
if ((ppCmbxFormat.SelectedIndex != -1) && _DefaultFormatName != null && _DefaultFormatName.Equals(ppCmbxFormat.SelectedValue))
{
ppBtnDefaultFmt.Focus();
ppBtnDefaultFmt.PerformClick();
+ didDefault = true;
}
ppBtnDefaultFmt.Visible = (ppCmbxFormat.SelectedValue != null);
ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
- SetupPpCmbxSectionType();
+ if (!didDefault)SetupPpCmbxSectionType();
}
private void ppCmbxStyleSectionType_SelectedValueChanged(object sender, EventArgs e)
@@ -634,8 +681,11 @@ namespace VEPROMS
{
_isStepSection = rbStepSect.Checked;
rbWordSect.Checked = !rbStepSect.Checked;
- SetupPpCmbxSectionType();
- ShowAvailableOptionsForSectionType();
+ if (!_Initializing)
+ {
+ SetupPpCmbxSectionType();
+ ShowAvailableOptionsForSectionType();
+ }
}
private void ppCmbxSectPagination_SelectedValueChanged(object sender, EventArgs e)