down arrow fix

search tweaks
search tweeks
up arrow fix
This commit is contained in:
2009-02-05 20:51:38 +00:00
parent 20498a2eb5
commit 1503b3f9cc
5 changed files with 173 additions and 103 deletions

View File

@@ -21,7 +21,7 @@ namespace Volian.Controls.Library
private AnnotationDetails _AnnotationDetails = null;
ItemInfo _ItemInfo = null;
private DisplayTabControl _TabControl;
private DocVersionInfo _mydocversion;
private DocVersionInfo _MyDocVersion;
private Color saveXpSetToSearchColor;
private Color saveXpStepTypeTitleColor;
private Color saveGpSrchAnnoTextColor;
@@ -48,8 +48,18 @@ namespace Volian.Controls.Library
public DocVersionInfo Mydocversion
{
get { return _mydocversion; }
set { _mydocversion = value; }
get { return _MyDocVersion; }
set {
_MyDocVersion = value;
if (_MyDocVersion != null)
{
if (_MyDocVersion.DocVersionAssociationCount > 0)
{
MyROFSTLookup = _MyDocVersion.DocVersionAssociations[0].MyROFst.ROFSTLookup;
_MyRODbID = _MyDocVersion.DocVersionAssociations[0].MyROFst.RODbID;
}
}
}
}
private ROFSTLookup _MyROFSTLookup;
@@ -79,7 +89,6 @@ namespace Volian.Controls.Library
get { return _ProgressBar; }
set { _ProgressBar = value; }
}
private ItemInfo _CurrentProcedure;
#endregion
#region setup
@@ -96,13 +105,15 @@ namespace Volian.Controls.Library
// start out with the procedure and type selection windows colasped
xpSetToSearch.Expanded = false;
xpStepTypes.Expanded = false;
rbtnSrchTxt.Checked = true;
gpSrchAnnoText.Enabled = true;
}
private void LoadSearchTextListBox()
{
cbxTextSearchText.Items.Clear();
cbxTextSearchAnnotation.Items.Clear();
//TODO: load saved search strings from user settings
//TODO: load saved search strings from user settings - if we decide to
}
public void advTreeStepTypesFillIn()
@@ -112,7 +123,7 @@ namespace Volian.Controls.Library
topnode.Text = "Types";
advTreeStepTypes.Nodes.Add(topnode);
FormatData fmtdata = _mydocversion.ActiveFormat.PlantFormat.FormatData;
FormatData fmtdata = _MyDocVersion.ActiveFormat.PlantFormat.FormatData;
List<StepDataRetval> lstSrchStpTypes = fmtdata.GetSearchableSteps(); // list of searchable step types
if (lstSrchStpTypes != null && lstSrchStpTypes.Count > 0)
{
@@ -224,6 +235,7 @@ namespace Volian.Controls.Library
// position to the procedure set in the tree if we have a procedure open
if (Mydocversion != null)
advTreeProcSetsPreSelect();
cbxTextSearchText.Focus(); // set initial focus to enter search text
}
void advTreeProcSets_BeforeExpand(object sender, DevComponents.AdvTree.AdvTreeNodeCancelEventArgs e)
@@ -428,10 +440,6 @@ namespace Volian.Controls.Library
_TabControl = tc;
}
private void cbSrchAnnoText_CheckedChanged(object sender, EventArgs e)
{
gpSrchAnnoText.Enabled = cbSrchAnnoText.Checked;
}
private void cbxTextSearchAnnotation_Leave(object sender, EventArgs e)
{
@@ -447,7 +455,10 @@ namespace Volian.Controls.Library
private void gpSrchAnnoText_EnabledChanged(object sender, EventArgs e)
{
if (gpSrchAnnoText.Enabled)
{
gpSrchAnnoText.Style.BackColor = Color.Yellow;
cbxTextSearchAnnotation.Focus();
}
else
gpSrchAnnoText.Style.BackColor = saveGpSrchAnnoTextColor;
}
@@ -602,19 +613,23 @@ namespace Volian.Controls.Library
// get list of doc versions to search
foreach (DocVersionInfo dvi in lstCheckedDocVersions)
{
strRtnStr[0] += string.Format("{0},", dvi.ItemID.ToString());
strRtnStr[0] += string.Format("{0},", dvi.VersionID.ToString());
}
strRtnStr[0] = strRtnStr[0].Remove(strRtnStr[0].LastIndexOf(','), 1);
}
// append list of step types to search
// TODO: need type number to search in attachments (word documents)
if (lstCheckedStepTypes.Count > 0)
{
// get list of selected types
foreach (int typ in lstCheckedStepTypes)
{
strRtnStr[1] += string.Format("{0},", (typ + 20000));
int tmp = typ;
if (tmp == 0)
tmp = 10000; // this is the accessory page type
else
tmp += 20000; // step/substep types
strRtnStr[1] += string.Format("{0},", tmp);
}
strRtnStr[1] = strRtnStr[1].Remove(strRtnStr[1].LastIndexOf(','), 1);
}
@@ -629,8 +644,6 @@ namespace Volian.Controls.Library
}
else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[2])
{ // RO Search
// TODO: the "1:" is hard coded for now. This is the ID to the corresponding
// RO.FST from the Association record
ROFSTLookup.rochild[] chld = null;
if (cmboTreeROs.SelectedNode != null)
{
@@ -638,14 +651,14 @@ namespace Volian.Controls.Library
if (cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rodbi)
{
ROFSTLookup.rodbi db = (ROFSTLookup.rodbi)cmboTreeROs.SelectedNode.Tag;
strRtnStr[2] += "1:" + string.Format("{0}", db.dbiID.ToString("D4"));
strRtnStr[2] += _MyRODbID.ToString()+":" + string.Format("{0}", db.dbiID.ToString("D4"));
}
else if (cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rochild)
{
ch = (ROFSTLookup.rochild)cmboTreeROs.SelectedNode.Tag;
chld = ch.children;
// build a list of ROs to search
strRtnStr[2] += "1:" + GetROsToSearch(chld);
strRtnStr[2] += _MyRODbID.ToString() + ":" + GetROsToSearch(chld);
if (strRtnStr[2].EndsWith(","))
strRtnStr[2] = strRtnStr[2].Substring(0, strRtnStr[2].Length - 2);
}
@@ -694,7 +707,7 @@ namespace Volian.Controls.Library
bool includeSpecialChars = false;
if (cbxSrchTypeUsage.Checked) // find just the usage of the selected types
{
if (lstCheckedStepTypes.Count ==0) //(strSearchText[1].Equals(""))
if (lstCheckedStepTypes.Count ==0)
{
MessageBox.Show("Please select one or more types then press the Search button", "No Types Selected");
xpStepTypes.Expanded = true;
@@ -723,17 +736,9 @@ namespace Volian.Controls.Library
}
else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[1]) // Annotation Search
{
if (cbSrchAnnoText.Checked && cbxTextSearchAnnotation.Text.Equals(string.Empty))
{
MessageBox.Show("Please enter some search text, then click the Search button", "No Search Text");
cbxTextSearchAnnotation.Focus();
}
else
{
SearchResults = ItemInfoList.GetListFromAnnotationSearch(strSearchText[0], strSearchText[1], strSearchText[2], cbSrchAnnoText.Checked ? cbxTextSearchAnnotation.Text : "", cbxCaseSensitiveAnnoText.Checked);
SearchResults = ItemInfoList.GetListFromAnnotationSearch(strSearchText[0], strSearchText[1], strSearchText[2], cbxTextSearchAnnotation.Text, cbxCaseSensitiveAnnoText.Checked);
UpdateAnnotationSearchResults();
cmbResultsStyle.SelectedIndex = 2; // display annotation text in results
}
}
else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[2]) // RO Search
{
@@ -761,16 +766,25 @@ namespace Volian.Controls.Library
private void cbxSrchTypeUsage_CheckedChanged(object sender, EventArgs e)
{
gpSrchText.Enabled = !cbxSrchTypeUsage.Checked;
if (!cbxSrchTypeUsage.Checked && lstCheckedStepTypes.Count == 0)
if (!cbxSrchTypeUsage.Checked)
xpStepTypes.TitleStyle.BackColor1.Color = saveXpStepTypeTitleColor;
else
{
xpStepTypes.Expanded = true;
if (lstCheckedStepTypes.Count == 0)
xpStepTypes.TitleStyle.BackColor1.Color = Color.Crimson;
advTreeStepTypes.Focus();
}
}
private void rbtnSrchTxt_CheckedChanged(object sender, EventArgs e)
{
if (rbtnSrchTxt.Checked)
cbxTextSearchText.Focus();
}
private void gpSrchText_EnabledChanged(object sender, EventArgs e)
{
@@ -788,10 +802,25 @@ namespace Volian.Controls.Library
xpSetToSearch.TitleStyle.BackColor1.Color = Color.Crimson;
}
}
#endregion
private void tabStepTypeSearch_Click(object sender, EventArgs e)
{
if (rbtnSrchTxt.Checked)
cbxTextSearchText.Focus();
}
private void ProcessEnterKey(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r') // enter key pressed
{
e.Handled = true;
btnSearch_Click(sender, e);
}
}
#endregion
#region ProcSetSelection
private int _MyRODbID;
private void advTreeProcSets_AfterCheck(object sender, DevComponents.AdvTree.AdvTreeCellEventArgs e)
{
DevComponents.AdvTree.Node n = advTreeProcSets.SelectedNode;
@@ -804,8 +833,6 @@ namespace Volian.Controls.Library
Mydocversion = (DocVersionInfo)n.Tag;
advTreeStepTypesFillIn();
}
if (MyROFSTLookup == null)
MyROFSTLookup = Mydocversion.DocVersionAssociations[0].MyROFst.ROFSTLookup;
}
else
{
@@ -878,7 +905,11 @@ namespace Volian.Controls.Library
{
if (lstCheckedStepTypes.Count == 0)
if (xpStepTypes.Expanded)
{
xpStepTypes.TitleText = "Select Types To Search";
advTreeStepTypes.Focus();
advTreeStepTypes.Nodes[0].SelectedCell = advTreeStepTypes.Nodes[0].Cells[0];
}
else
{
xpStepTypes.TitleText = "Click Here To Search By Types";
@@ -888,6 +919,9 @@ namespace Volian.Controls.Library
#endregion
}
#region Annoation Search Type Class