Compare commits

...
5 Commits
5 changed files with 219 additions and 161 deletions

No files matched your search

@@ -127,12 +127,13 @@ namespace ROEditor
private string origPrefix;
private string origValue;
private int dbtype;
private bool IsNewGroup = false;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public GroupDefFrm(VlnXmlElement pelem, RODB rodb, string gpname,int idbtype)
public GroupDefFrm(VlnXmlElement pelem, RODB rodb, string gpname,int idbtype, bool newgrp = false)
{
myrodb = rodb;
elem = pelem;
@@ -143,7 +144,8 @@ namespace ROEditor
//
InitializeComponent();
FillInData();
}
IsNewGroup = newgrp;
}
private string CvtUserFldToFld(string fldname)
{
@@ -655,10 +657,11 @@ namespace ROEditor
tmpn.FirstChild.Value = tmpstr2; //tmpn.FirstChild.Value.Replace(CvtUserFldToFld(origGroup), this.tbGroup.Text);
modified=true;
}
if ((elem.HasAttribute("AccPageIDPrefix")&&this.tbPrefix.Text != origPrefix) || this.tbPrefix.Modified==true)
if ((elem.HasAttribute("AccPageIDPrefix")&&(tbPrefix.Text != origPrefix || IsNewGroup)) || tbPrefix.Modified)
{
elem.SetAttribute("AccPageIDPrefix",this.tbPrefix.Text);
modified=true;
IsNewGroup = false;
if (myrodb.IsDuplicateAccPagePrefix(elem, tbPrefix.Text))
{
@@ -666,7 +669,8 @@ namespace ROEditor
elem.SetAttribute("AccPageIDPrefix", origPrefix);
modified = false;
MessageBox.Show($"The Prefix field used for the \"Accessory Pages Access\" values should be unique. The fields used in these values can be found under \"Properties\" of an RO Group. If these are not unique, you may have trouble utilizing these ROs within Word Sections in PROMS. Cannot save.", "Problem saving data");
return;
DialogResult = DialogResult.Cancel;
return;
}
}
bool success=true;
@@ -44,9 +44,7 @@
*********************************************************************************************/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Xml;
using System.Text;
@@ -282,148 +280,176 @@ namespace ROEditor
}
private void btnContinue_Click(object sender, System.EventArgs e)
{
bool success;
if (this.tbGroup.Text == null || this.tbGroup.Text == "")
{
MessageBox.Show("Need to specify group name.");
return;
}
// if this was already saved, i.e. user hit continue button already,
// just return;
if (this.tbGroup.Text == lastSavedGroup)
{
this.Close();
return;
}
lastSavedGroup = this.tbGroup.Text;
int dbtype=-1;
if (this.rbbtnGraphics.Checked == true) dbtype = 1;
else if (this.rbbtnSetpoint.Checked == true) dbtype = 2;
else if (this.rbbtnUserDef.Checked == true) dbtype = 3;
if (dbtype<0)
{
MessageBox.Show("Need to define type of group.");
return;
}
Cursor.Current = Cursors.WaitCursor;
// make a new table with the next table name id
tbname = myrodb.RODB_GetNextGroupTable();
if (tbname == null)
{
Cursor.Current = Cursors.Default;
return;
}
toprecid = myrodb.RODB_AddNewTable(tbname, this.tbGroup.Text);
if (toprecid == null)
{
Cursor.Current = Cursors.Default;
return;
}
// for the given type, copy over the required fields.
success = myrodb.RODB_CopyFieldDefs("ROMaster",tbname,dbtype);
if (success == false)
{
Cursor.Current = Cursors.Default;
return;
}
// create top level group node with input name.
nelem = (VlnXmlElement) elem.OwnerDocument.CreateElement("vlnGroup");
nelem.InnerText = CvtUserFldToFld(this.tbGroup.Text);
nelem.SetAttribute("Table",tbname);
nelem.SetAttribute("ParentID", "00000000");
string nrecid = myrodb.RODB_GetNextRecId(tbname);
nelem.SetAttribute("RecID", nrecid);
elem.AppendChild((XmlNode) nelem);
success = myrodb.RODB_InsertGroup(nelem);
Cursor.Current = Cursors.Default;
if (success == false) return;
nelem.SetAttribute("TreeNotData", "True");
nelem.SetAttribute("MenuTitle", this.tbGroup.Text);
nelem.SetAttribute("MasterRecID",toprecid);
nelem.SetAttribute("HasChild", "False");
// if this is a setpoint db or image db, get fields and find those fields needed
// to define ro & group. This is hardcoded, yuk.
if(dbtype == 1 || dbtype == 2)
{
ArrayList FieldList = myrodb.RODB_GetFields(nelem, (uint) RecordType.Schema);
string[] fldlist=null, grplist=null;
ROField rof;
string curfld;
StringBuilder Inuse = new StringBuilder();
// Get list of inuse fields for the rro.
if (dbtype == 1)
fldlist = new string[] {"Name", "Image ID", "Image"};
else
fldlist = new string[] {"Setpoint ID", "Setpoint Value", "Associated System Component", "Applicability", "Revision", "Short Description",
"Description", "Key Assumptions", "Basis", "References"};
for (int i=0; i< fldlist.Length; i++)
{
curfld = fldlist[i];
for (int j=0; j<FieldList.Count; j++)
{
rof = (ROField) FieldList[j];
if (rof.GetFieldname == curfld)
{
if (i==fldlist.Length-1) // last one don't add ' '
Inuse.Append(rof.GetRecID);
else
Inuse.Append(rof.GetRecID+" ");
break;
}
}
}
nelem.SetAttribute("FieldsInUse", Inuse.ToString());
// Get list of group inuse fields.
Inuse.Remove(0,Inuse.Length);
if (dbtype == 1)
grplist = new string[] {"Group"};
else
grplist = new string[] {"Parameter"};
for (int i=0; i< grplist.Length; i++)
{
curfld = grplist[i];
for (int j=0; j<FieldList.Count; j++)
{
rof = (ROField) FieldList[j];
if (rof.GetFieldname == curfld)
{
if (i == grplist.Length-1) // last, don't add ' '
Inuse.Append(rof.GetRecID);
else
Inuse.Append(rof.GetRecID+" ");
break;
}
}
}
nelem.SetAttribute("GroupFieldsInUse", Inuse.ToString());
if (dbtype == 2) // Setpoint
{
nelem.SetAttribute("RetVal","<Setpoint__Value>");
nelem.SetAttribute("MenuItem","<Setpoint__Value,5,17> <Short__Description>");
nelem.SetAttribute("GroupMenuItem","<Parameter>");
nelem.SetAttribute("AccPageIDPrefix","SP2");
nelem.SetAttribute("AccPageID","<Setpoint__ID>");
}
else if (dbtype == 1) // image
{
nelem.SetAttribute("RetVal","<Image>");
nelem.SetAttribute("MenuItem","<Name>");
nelem.SetAttribute("GroupMenuItem","<Group>");
nelem.SetAttribute("AccPageIDPrefix","IG2");
nelem.SetAttribute("AccPageID","<Image__ID>");
}
success = myrodb.RODB_WriteRO(nelem);
if (success == false) return;
}
{
bool success;
if (this.tbGroup.Text == null || this.tbGroup.Text == "")
{
MessageBox.Show("Need to specify group name.");
return;
}
// if this was already saved, i.e. user hit continue button already,
// just return;
if (this.tbGroup.Text == lastSavedGroup)
{
this.Close();
return;
}
lastSavedGroup = this.tbGroup.Text;
int dbtype = -1;
if (this.rbbtnGraphics.Checked == true) dbtype = 1;
else if (this.rbbtnSetpoint.Checked == true) dbtype = 2;
else if (this.rbbtnUserDef.Checked == true) dbtype = 3;
if (dbtype < 0)
{
MessageBox.Show("Need to define type of group.");
return;
}
Cursor.Current = Cursors.WaitCursor;
// make a new table with the next table name id
tbname = myrodb.RODB_GetNextGroupTable();
if (tbname == null)
{
Cursor.Current = Cursors.Default;
return;
}
toprecid = myrodb.RODB_AddNewTable(tbname, this.tbGroup.Text);
if (toprecid == null)
{
Cursor.Current = Cursors.Default;
return;
}
// for the given type, copy over the required fields.
success = myrodb.RODB_CopyFieldDefs("ROMaster", tbname, dbtype);
if (success == false)
{
Cursor.Current = Cursors.Default;
return;
}
// create top level group node with input name.
nelem = (VlnXmlElement)elem.OwnerDocument.CreateElement("vlnGroup");
nelem.InnerText = CvtUserFldToFld(this.tbGroup.Text);
nelem.SetAttribute("Table", tbname);
nelem.SetAttribute("ParentID", "00000000");
string nrecid = myrodb.RODB_GetNextRecId(tbname);
nelem.SetAttribute("RecID", nrecid);
elem.AppendChild((XmlNode)nelem);
success = myrodb.RODB_InsertGroup(nelem);
Cursor.Current = Cursors.Default;
if (success == false) return;
nelem.SetAttribute("TreeNotData", "True");
nelem.SetAttribute("MenuTitle", this.tbGroup.Text);
nelem.SetAttribute("MasterRecID", toprecid);
nelem.SetAttribute("HasChild", "False");
// if this is a setpoint db or image db, get fields and find those fields needed
// to define ro & group. This is hardcoded, yuk.
if (dbtype == 1 || dbtype == 2)
{
ArrayList FieldList = myrodb.RODB_GetFields(nelem, (uint)RecordType.Schema);
string[] fldlist = null, grplist = null;
ROField rof;
string curfld;
StringBuilder Inuse = new StringBuilder();
// Get list of inuse fields for the rro.
if (dbtype == 1)
fldlist = new string[] { "Name", "Image ID", "Image" };
else
fldlist = new string[] {"Setpoint ID", "Setpoint Value", "Associated System Component", "Applicability", "Revision", "Short Description",
"Description", "Key Assumptions", "Basis", "References"};
for (int i = 0; i < fldlist.Length; i++)
{
curfld = fldlist[i];
for (int j = 0; j < FieldList.Count; j++)
{
rof = (ROField)FieldList[j];
if (rof.GetFieldname == curfld)
{
if (i == fldlist.Length - 1) // last one don't add ' '
Inuse.Append(rof.GetRecID);
else
Inuse.Append(rof.GetRecID + " ");
break;
}
}
}
nelem.SetAttribute("FieldsInUse", Inuse.ToString());
// Get list of group inuse fields.
Inuse.Remove(0, Inuse.Length);
if (dbtype == 1)
grplist = new string[] { "Group" };
else
grplist = new string[] { "Parameter" };
for (int i = 0; i < grplist.Length; i++)
{
curfld = grplist[i];
for (int j = 0; j < FieldList.Count; j++)
{
rof = (ROField)FieldList[j];
if (rof.GetFieldname == curfld)
{
if (i == grplist.Length - 1) // last, don't add ' '
Inuse.Append(rof.GetRecID);
else
Inuse.Append(rof.GetRecID + " ");
break;
}
}
}
nelem.SetAttribute("GroupFieldsInUse", Inuse.ToString());
string defaultPfix = "UD";
if (dbtype == 2) // Setpoint
{
nelem.SetAttribute("RetVal", "<Setpoint__Value>");
nelem.SetAttribute("MenuItem", "<Setpoint__Value,5,17> <Short__Description>");
nelem.SetAttribute("GroupMenuItem", "<Parameter>");
defaultPfix = "SP";
nelem.SetAttribute("AccPageIDPrefix", "SP2");
nelem.SetAttribute("AccPageID", "<Setpoint__ID>");
}
else if (dbtype == 1) // image
{
nelem.SetAttribute("RetVal", "<Image>");
nelem.SetAttribute("MenuItem", "<Name>");
nelem.SetAttribute("GroupMenuItem", "<Group>");
defaultPfix = "IG";
nelem.SetAttribute("AccPageIDPrefix", "IG2");
nelem.SetAttribute("AccPageID", "<Image__ID>");
}
//B2026-091 RO Editor - Change Default Prefix to take existing prefixes into account for Setpoint/Graphics DBs
//if duplicate prefix - then change it so it will be unique
int x = 2;
while (nelem.HasAttribute("AccPageIDPrefix") && myrodb.IsDuplicateAccPagePrefix(nelem, nelem.GetAttribute("AccPageIDPrefix")))
{
nelem.SetAttribute("AccPageIDPrefix", $"{defaultPfix}{x}");
x++;
}
success = myrodb.RODB_WriteRO(nelem);
if (success == false) return;
}
// now let the user specify the group name, etc to define the group.
GroupDefFrm grdef = new GroupDefFrm(nelem,myrodb,nelem.InnerText,dbtype);
grdef.ShowDialog();
}
private void txtBox_KeyDown(object sender, KeyEventArgs e)
DialogResult dlgrslt = DialogResult.OK;
using (GroupDefFrm grdef = new GroupDefFrm(nelem, myrodb, nelem.InnerText, dbtype, true))
{
dlgrslt = grdef.ShowDialog();
}
//If New Group and prefix would not be unique, remove the group
//needed because groups get autoadded with defaults
//before user has a chance to enter things like Acc Page Prefix
if (dlgrslt == DialogResult.Cancel)
{
XmlNode pn = nelem.ParentNode;
XmlNode nd = (XmlNode)nelem;
myrodb.RODB_DeleteGroup(nd, null, null);
pn.RemoveChild(nelem);
DialogResult = DialogResult.Cancel;
Close();
}
}
private void txtBox_KeyDown(object sender, KeyEventArgs e)
{
if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text))
{
@@ -2117,7 +2117,9 @@ namespace RODBInterface
if (retele != null && tbl != ro.GetAttribute("Table") && retele.GetAttribute("AccPageIDPrefix").ToLower() == pfix.ToLower())
{
return true; //another table contains the prefix - return true
DBE.CommandDispose();
DBE.ReaderClose();
return true; //another table contains the prefix - return true
}
}
}
+23 -11
View File
@@ -2426,9 +2426,10 @@ namespace VEPROMS
// when Word procedure tabs are restored.
// C2026-053 leaving this flag in her for now should we decide to trouble-shoot reopening of Word tabs later on.
tc.LoadingSavedProcTabs = true; // we check for this flag in DSOTabPanel.cs when opening Word sections
EditItem LastEditItem = null; //to hold last edit item. Needed in case last tab is a Word Section
foreach (DataRow TabState in DisPlayTabState.Rows)
{
int _ItemID = (int)TabState["ItemID"];
int _ItemID = (int)TabState["ItemID"];
ItemInfo _Procedure = ItemInfo.Get(_ItemID);
// C2026-053 Open procedure tab but only if it's NOT a Word section
// Needed to disable opening saved Word sections - at least for now.
@@ -2439,18 +2440,29 @@ namespace VEPROMS
// SelectedStepTabPanel needs to be set so the print buttons on the ribbon will work.
SelectedStepTabPanel = tc.MyEditItem.MyStepPanel.MyStepTabPanel;
//CSM B2024-090 - if last displaytab item,
//select the steptab panel for it
//and set the EditItem for Find/Replace
//otherwise will cause PROMS to crash if Find clicked before a Tab is given Focus
if ((DisPlayTabState.Rows.IndexOf(TabState) == DisPlayTabState.Rows.Count - 1))
LastEditItem = tc.MyEditItem; //set last tab index
if ((DisPlayTabState.Rows.IndexOf(TabState) == DisPlayTabState.Rows.Count - 1))
{
SelectedStepTabPanel.Select();
dlgFindReplace.MyEditItem = tc.MyEditItem;
SpellChecker.MyEditItem = tc.MyEditItem; //B2025-043 Remember Tabs is not setting the EditItem for the active window causing a PROMS crash when Spell Check
}
}
tc.LoadingSavedProcTabs = false;
}
}
//CSM B2024-090 - if last displaytab item,
//select the steptab panel for it
//and set the EditItem for Find/Replace
//otherwise will cause PROMS to crash if Find clicked before a Tab is given Focus
if (LastEditItem != null)
{
dlgFindReplace.MyEditItem = LastEditItem;
SpellChecker.MyEditItem = LastEditItem; //B2025-043 Remember Tabs is not setting the EditItem for the active window causing a PROMS crash when Spell Check
//B2026-090 Populate Step Properties Panel when PROMS restores saved display tabs
LastEditItem.MyStepPanel.BringToFront();
LastEditItem.MyStepPanel.Select();
Application.DoEvents();
tc_ItemSelectedChanged(this, new ItemSelectedChangedEventArgs(tc.MyEditItem));
}
tc.LoadingSavedProcTabs = false;
}
}
}
+17 -3
View File
@@ -3512,10 +3512,24 @@ namespace Volian.Controls.Library
}
break;
case "InsRNO":
displayMenu = ((actable & E_AccStep.AddingRNO) > 0) && btnCMInsRNO.Enabled;
//B2026-086 Have Shortcut Keys for adding a RNO auto-work instead of having to press a button after shortcut key
displayMenu = false;
LetUserKnowIfTheyCannotAdd(actable, E_AccStep.AddingRNO,"RNO"); // B2018-014 Inform user that they cannot add the specified step type
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsRNO);
break;
if (((actable & E_AccStep.AddingRNO) > 0) && btnCMInsRNO.Enabled)
{
try
{
btnCMInsRNO.SubItems["cmbtnRNOType"].RaiseClick();
}
catch
{
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsRNO);
displayMenu = true;
}
}
break;
case "InsSubStps":
displayMenu = ((actable & E_AccStep.AddingSub) > 0) && btnCMInsSubStps.Enabled;
LetUserKnowIfTheyCannotAdd(actable, E_AccStep.AddingSub,"Sub-step"); // B2018-014 Inform user that they cannot add the specified step type