This commit is contained in:
@@ -14,10 +14,10 @@ namespace Volian.Controls.Library
|
||||
public partial class DisplaySearch : UserControl
|
||||
{
|
||||
#region Properties
|
||||
|
||||
private List<DocVersionInfo> lstCheckedDocVersions = new List<DocVersionInfo>();
|
||||
private List<int> lstCheckedStepTypes = new List<int>();
|
||||
|
||||
private bool _AlwaysDisableSets; // true if there is only 1 item in tree/combo for sets
|
||||
private AnnotationDetails _AnnotationDetails = null;
|
||||
ItemInfo _ItemInfo = null;
|
||||
private DisplayTabControl _TabControl;
|
||||
@@ -26,6 +26,7 @@ namespace Volian.Controls.Library
|
||||
private Color saveXpStepTypeTitleColor;
|
||||
private Color saveGpSrchAnnoTextColor;
|
||||
private Color saveGpSrchTextColor;
|
||||
private Color saveGpFindROsColor;
|
||||
private Color saveGrpPanSearchResults;
|
||||
private ItemInfoList _SearchResults;
|
||||
public ItemInfoList SearchResults
|
||||
@@ -33,7 +34,6 @@ namespace Volian.Controls.Library
|
||||
get { return _SearchResults; }
|
||||
set
|
||||
{
|
||||
|
||||
_SearchResults = value;
|
||||
DisplayResults();
|
||||
}
|
||||
@@ -46,6 +46,13 @@ namespace Volian.Controls.Library
|
||||
// set { tsslStatus.Text = value; Application.DoEvents(); }
|
||||
//}
|
||||
|
||||
private bool _OpenDocFromSearch;
|
||||
|
||||
public bool OpenDocFromSearch
|
||||
{
|
||||
get { return _OpenDocFromSearch; }
|
||||
//set { _OpenDocFromSearch = value; }
|
||||
}
|
||||
public DocVersionInfo Mydocversion
|
||||
{
|
||||
get { return _MyDocVersion; }
|
||||
@@ -68,7 +75,7 @@ namespace Volian.Controls.Library
|
||||
get { return _MyROFSTLookup; }
|
||||
set
|
||||
{
|
||||
if (!Visible) return; // don't reset anything if the form is invisible.
|
||||
//if (!Visible) return; // don't reset anything if the form is invisible.
|
||||
_MyROFSTLookup = value; // define the tree nodes based on this rofst
|
||||
LoadROComboTree();
|
||||
}
|
||||
@@ -100,26 +107,29 @@ namespace Volian.Controls.Library
|
||||
saveXpStepTypeTitleColor = xpStepTypes.TitleStyle.BackColor1.Color;
|
||||
saveGpSrchAnnoTextColor = gpSrchAnnoText.Style.BackColor;
|
||||
saveGpSrchTextColor = gpSrchText.Style.BackColor;
|
||||
saveGpFindROsColor = gpFindROs.Style.BackColor;
|
||||
gpSrchText.Style.BackColor = Color.Yellow;
|
||||
saveGrpPanSearchResults = grpPanSearchResults.Style.BackColor;
|
||||
|
||||
// start out with the procedure and type selection windows colasped
|
||||
xpSetToSearch.Expanded = false;
|
||||
xpStepTypes.Expanded = false;
|
||||
rbtnSrchTxt.Checked = true;
|
||||
gpSrchAnnoText.Enabled = true;
|
||||
cmbResultsStyle.Enabled = false;
|
||||
}
|
||||
|
||||
private void LoadSearchTextListBox()
|
||||
{
|
||||
cbxTextSearchText.Items.Clear();
|
||||
cbxTextSearchAnnotation.Items.Clear();
|
||||
//TODO: load saved search strings from user settings - if we decide to
|
||||
}
|
||||
|
||||
public void advTreeStepTypesFillIn()
|
||||
{
|
||||
DevComponents.AdvTree.Node topnode = new DevComponents.AdvTree.Node();
|
||||
advTreeStepTypes.Nodes.Clear();
|
||||
lstCheckedStepTypes.Clear();
|
||||
topnode.Text = "Types";
|
||||
advTreeStepTypes.Nodes.Add(topnode);
|
||||
|
||||
@@ -175,25 +185,25 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
advTreeStepTypes.Nodes.Sort(); // sort the first level of the tree
|
||||
}
|
||||
buildStepTypePannelTitle();
|
||||
}
|
||||
|
||||
public void advTreeProcSetsFillIn()
|
||||
public void advTreeProcSetsFillIn(bool blSeachTabClicked)
|
||||
{
|
||||
|
||||
DevComponents.AdvTree.Node topnode = null;
|
||||
int cntnd = 0;
|
||||
VETreeNode vtn = VETreeNode.GetFolder(1);
|
||||
FolderInfo fi = vtn.VEObject as FolderInfo;
|
||||
int fiCount = fi.ChildFolderCount;
|
||||
advTreeProcSets.Nodes.Clear();
|
||||
|
||||
lstCheckedDocVersions.Clear();
|
||||
foreach (FolderInfo fic in fi.ChildFolders)
|
||||
{
|
||||
DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node();
|
||||
newnode.Text = fic.ToString();
|
||||
newnode.Tag = fic;
|
||||
|
||||
int tmp;
|
||||
int tmp;
|
||||
if (topnode == null)
|
||||
{
|
||||
newnode.Text = "Available Procedure Sets";
|
||||
@@ -228,14 +238,17 @@ namespace Volian.Controls.Library
|
||||
advTreeProcSets.Nodes.Add(topnode);
|
||||
topnode.Tag = fi;
|
||||
}
|
||||
_AlwaysDisableSets = true;
|
||||
|
||||
advTreeProcSets.BeforeExpand += new DevComponents.AdvTree.AdvTreeNodeCancelEventHandler(advTreeProcSets_BeforeExpand);
|
||||
|
||||
// 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
|
||||
else
|
||||
advTreeProcSets.Nodes[0].SelectedCell = advTreeProcSets.Nodes[0].Cells[0]; // select the first node - fixes cosmetic problem
|
||||
|
||||
if (blSeachTabClicked)
|
||||
cbxTextSearchText.Focus(); // set initial focus to enter search text
|
||||
}
|
||||
|
||||
void advTreeProcSets_BeforeExpand(object sender, DevComponents.AdvTree.AdvTreeNodeCancelEventArgs e)
|
||||
@@ -422,6 +435,28 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
ProgressBar_Clear();
|
||||
}
|
||||
|
||||
private void cmboTreeROs_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (cmboTreeROs.SelectedIndex == -1 || cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rodbi)
|
||||
cbxFndUnLnkROVals.Enabled = false;
|
||||
else if (cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rochild)
|
||||
{
|
||||
ROFSTLookup.rochild ro = (ROFSTLookup.rochild)cmboTreeROs.SelectedNode.Tag;
|
||||
cbxFndUnLnkROVals.Enabled = (ro.children == null);
|
||||
}
|
||||
if (!cbxFndUnLnkROVals.Enabled)
|
||||
cbxFndUnLnkROVals.Checked = false;
|
||||
}
|
||||
|
||||
private void gpFindROs_EnabledChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (gpFindROs.Enabled)
|
||||
gpFindROs.Style.BackColor = Color.Yellow;
|
||||
else
|
||||
gpFindROs.Style.BackColor = saveGpFindROsColor;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Annotation Search
|
||||
@@ -479,9 +514,7 @@ namespace Volian.Controls.Library
|
||||
private void ProgressBar_SetValue(int curval)
|
||||
{
|
||||
if (_ProgressBar != null)
|
||||
{
|
||||
_ProgressBar.Value = curval;
|
||||
}
|
||||
}
|
||||
|
||||
private void ProgressBar_Clear()
|
||||
@@ -536,19 +569,19 @@ namespace Volian.Controls.Library
|
||||
|
||||
}
|
||||
|
||||
public void UpdateAnnotationSearchResults()
|
||||
{
|
||||
//AnnotationTypeInfo ati = cbxAnnoTypes.SelectedValue as AnnotationTypeInfo;
|
||||
//_LoadingList = true;
|
||||
//lbSrchResults.DataSource = ati.AnnotationTypeAnnotations;
|
||||
//lbSrchResults.SelectedIndex = -1;
|
||||
//LastResultsMouseOverIndex = -1;
|
||||
//if (lbSrchResults.Items.Count > 0)
|
||||
// btnPrnSrchRslts.Enabled = true;
|
||||
//else
|
||||
// btnPrnSrchRslts.Enabled = false;
|
||||
//_LoadingList = false;
|
||||
}
|
||||
//public void UpdateAnnotationSearchResults()
|
||||
//{
|
||||
// //AnnotationTypeInfo ati = cbxAnnoTypes.SelectedValue as AnnotationTypeInfo;
|
||||
// //_LoadingList = true;
|
||||
// //lbSrchResults.DataSource = ati.AnnotationTypeAnnotations;
|
||||
// //lbSrchResults.SelectedIndex = -1;
|
||||
// //LastResultsMouseOverIndex = -1;
|
||||
// //if (lbSrchResults.Items.Count > 0)
|
||||
// // btnPrnSrchRslts.Enabled = true;
|
||||
// //else
|
||||
// // btnPrnSrchRslts.Enabled = false;
|
||||
// //_LoadingList = false;
|
||||
//}
|
||||
|
||||
|
||||
private void lbSrchResults_MouseMove(object sender, MouseEventArgs e)
|
||||
@@ -568,7 +601,11 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
_ItemInfo = lbSrchResults.SelectedValue as ItemInfo;
|
||||
if (_ItemInfo != null)
|
||||
{
|
||||
_OpenDocFromSearch = true;
|
||||
_TabControl.OpenItem(_ItemInfo); // open the corresponding procedure text
|
||||
_OpenDocFromSearch = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,6 +637,16 @@ namespace Volian.Controls.Library
|
||||
DisplayResults();
|
||||
}
|
||||
|
||||
private void panSearchButtons_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
DialogResult dr = MessageBox.Show("Michelle,\n\n Do you want to clear this Search List?", "For Michelle...", MessageBoxButtons.YesNo);
|
||||
if (dr == DialogResult.Yes)
|
||||
{
|
||||
lbSrchResults.DataSource = null;
|
||||
_SearchResults = null;
|
||||
DisplayResults();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Search
|
||||
@@ -636,7 +683,7 @@ namespace Volian.Controls.Library
|
||||
|
||||
if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[0])
|
||||
{ // Text Search
|
||||
strRtnStr[2] += string.Format("{0}", cbxTextSearchText.Text); // append text to search
|
||||
strRtnStr[2] += ConvertSpecialChars(cbxTextSearchText.Text);//string.Format("{0}", cbxTextSearchText.Text); // append text to search
|
||||
}
|
||||
else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[1])
|
||||
{ // Annotation Search
|
||||
@@ -645,29 +692,54 @@ namespace Volian.Controls.Library
|
||||
else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[2])
|
||||
{ // RO Search
|
||||
ROFSTLookup.rochild[] chld = null;
|
||||
ROFSTLookup.rochild ch;
|
||||
if (cmboTreeROs.SelectedNode != null)
|
||||
{
|
||||
ROFSTLookup.rochild ch;
|
||||
if (cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rodbi)
|
||||
{
|
||||
ROFSTLookup.rodbi db = (ROFSTLookup.rodbi)cmboTreeROs.SelectedNode.Tag;
|
||||
strRtnStr[2] += _MyRODbID.ToString()+":" + string.Format("{0}", db.dbiID.ToString("D4"));
|
||||
}
|
||||
else if (cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rochild)
|
||||
if (cbxFndUnLnkROVals.Enabled && cbxFndUnLnkROVals.Checked)
|
||||
{
|
||||
ch = (ROFSTLookup.rochild)cmboTreeROs.SelectedNode.Tag;
|
||||
chld = ch.children;
|
||||
// build a list of ROs to search
|
||||
strRtnStr[2] += _MyRODbID.ToString() + ":" + GetROsToSearch(chld);
|
||||
if (strRtnStr[2].EndsWith(","))
|
||||
strRtnStr[2] = strRtnStr[2].Substring(0, strRtnStr[2].Length - 2);
|
||||
strRtnStr[2] += string.Format("{0}", ch.value); // append RO Value text to search
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rodbi)
|
||||
{
|
||||
ROFSTLookup.rodbi db = (ROFSTLookup.rodbi)cmboTreeROs.SelectedNode.Tag;
|
||||
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] += _MyRODbID.ToString() + ":" + GetROsToSearch(chld);
|
||||
if (strRtnStr[2].EndsWith(","))
|
||||
strRtnStr[2] = strRtnStr[2].Substring(0, strRtnStr[2].Length - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return strRtnStr;
|
||||
}
|
||||
|
||||
private string ConvertSpecialChars(string str)
|
||||
{
|
||||
string rtnVal = str;
|
||||
rtnVal = rtnVal.Replace("\u00A0", @"\u160?"); //convert \u00A0 to a hard space (\u00A0 shows as a blank in the search text field)
|
||||
rtnVal = rtnVal.Replace("\n", "");
|
||||
FormatData fmtdata = _MyDocVersion.ActiveFormat.PlantFormat.FormatData;
|
||||
SymbolList sl = fmtdata.SymbolList;
|
||||
if (sl != null)
|
||||
{
|
||||
foreach (Symbol sym in sl)
|
||||
{
|
||||
string rplace = string.Format(sym.Unicode < 256?@"\'{0:X2}" : @"\u{0}", sym.Unicode);
|
||||
rtnVal = rtnVal.Replace(((char)sym.Unicode).ToString(), rplace);
|
||||
}
|
||||
}
|
||||
return rtnVal;
|
||||
}
|
||||
|
||||
private string GetROsToSearch(ROFSTLookup.rochild[] chld)
|
||||
{
|
||||
string rtnstr ="";
|
||||
@@ -701,10 +773,10 @@ namespace Volian.Controls.Library
|
||||
Cursor savcursor = Cursor;
|
||||
Cursor = Cursors.WaitCursor;
|
||||
SearchResults = null;
|
||||
bool includeRTFformat = false;
|
||||
bool includeSpecialChars = true;
|
||||
if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[0]) // Text Search
|
||||
{
|
||||
bool includeRTFformat = false;
|
||||
bool includeSpecialChars = false;
|
||||
if (cbxSrchTypeUsage.Checked) // find just the usage of the selected types
|
||||
{
|
||||
if (lstCheckedStepTypes.Count ==0)
|
||||
@@ -729,21 +801,32 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchResults = ItemInfoList.GetListFromTextSearch(strSearchText[0], strSearchText[1], strSearchText[2], cbxCaseSensitive.Checked, ItemSearchIncludeLinks.Value, includeRTFformat, includeSpecialChars);
|
||||
SearchResults = ItemInfoList.GetListFromTextSearch(strSearchText[0], strSearchText[1], strSearchText[2], cbxCaseSensitive.Checked, cbxIncROTextSrch.Checked ? ItemSearchIncludeLinks.Value : ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars);
|
||||
cmbResultsStyle.SelectedIndex = 3; // display step text in results
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[1]) // Annotation Search
|
||||
{
|
||||
SearchResults = ItemInfoList.GetListFromAnnotationSearch(strSearchText[0], strSearchText[1], strSearchText[2], cbxTextSearchAnnotation.Text, cbxCaseSensitiveAnnoText.Checked);
|
||||
UpdateAnnotationSearchResults();
|
||||
//string srchStr = ConvertSpecialChars(cbxTextSearchAnnotation.Text);//cbxTextSearchAnnotation.Text;
|
||||
|
||||
//SearchResults = ItemInfoList.GetListFromAnnotationSearch(strSearchText[0], strSearchText[1], strSearchText[2], srchStr, 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
|
||||
{
|
||||
SearchResults = ItemInfoList.GetListFromROSearch(strSearchText[0], strSearchText[1], strSearchText[2]);
|
||||
cmbResultsStyle.SelectedIndex = 1; // display procedure number, title, section, step in results
|
||||
if (cbxFndUnLnkROVals.Enabled && cbxFndUnLnkROVals.Checked)
|
||||
{
|
||||
SearchResults = ItemInfoList.GetListFromTextSearch(strSearchText[0], strSearchText[1], strSearchText[2], cbxCaseSensitive.Checked, ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars);
|
||||
cmbResultsStyle.SelectedIndex = 3; // display step text in results
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchResults = ItemInfoList.GetListFromROSearch(strSearchText[0], strSearchText[1], strSearchText[2]);
|
||||
cmbResultsStyle.SelectedIndex = 1; // display procedure number, title, section, step in results
|
||||
}
|
||||
}
|
||||
DisplayResults();
|
||||
Cursor = savcursor;
|
||||
@@ -794,15 +877,6 @@ namespace Volian.Controls.Library
|
||||
gpSrchText.Style.BackColor = saveGpSrchTextColor;
|
||||
}
|
||||
|
||||
private void tabROSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (lstCheckedDocVersions.Count == 0)
|
||||
{
|
||||
xpSetToSearch.Expanded = true;
|
||||
xpSetToSearch.TitleStyle.BackColor1.Color = Color.Crimson;
|
||||
}
|
||||
}
|
||||
|
||||
private void tabStepTypeSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (rbtnSrchTxt.Checked)
|
||||
@@ -828,7 +902,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
n.Style = DevComponents.AdvTree.NodeStyles.Apple;
|
||||
lstCheckedDocVersions.Add((DocVersionInfo) n.Tag);
|
||||
if (Mydocversion == null)
|
||||
if (lstCheckedDocVersions.Count == 1)//Mydocversion == null)
|
||||
{
|
||||
Mydocversion = (DocVersionInfo)n.Tag;
|
||||
advTreeStepTypesFillIn();
|
||||
@@ -838,33 +912,77 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
n.Style = null;
|
||||
lstCheckedDocVersions.Remove((DocVersionInfo)n.Tag);
|
||||
if (lstCheckedDocVersions.Count == 1)
|
||||
{
|
||||
if (Mydocversion != lstCheckedDocVersions[0])
|
||||
{
|
||||
Mydocversion = lstCheckedDocVersions[0];
|
||||
advTreeStepTypesFillIn();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lstCheckedDocVersions.Count == 0)
|
||||
Mydocversion = null;
|
||||
// do this if either none, or more than one procedure set selected
|
||||
advTreeStepTypes.Nodes.Clear();
|
||||
lstCheckedStepTypes.Clear();
|
||||
Node newnode = new DevComponents.AdvTree.Node();
|
||||
newnode.Text = "....select a procedure set for types to appear...";
|
||||
advTreeStepTypes.Nodes.Add(newnode);
|
||||
buildStepTypePannelTitle();
|
||||
}
|
||||
}
|
||||
// Enable the RO combo list only if at least one procedure set node
|
||||
// is selected
|
||||
cmboTreeROs.Enabled = (lstCheckedDocVersions.Count > 0);
|
||||
if (lstCheckedDocVersions.Count > 0)
|
||||
gpFindROs.Enabled = cmboTreeROs.Enabled;
|
||||
|
||||
SetupContextMenu();
|
||||
|
||||
buildSetToSearchPanelTitle();
|
||||
}
|
||||
|
||||
|
||||
private void xpSetToSearch_ExpandedChanged(object sender, ExpandedChangeEventArgs e)
|
||||
{
|
||||
buildSetToSearchPanelTitle();
|
||||
}
|
||||
|
||||
private void buildSetToSearchPanelTitle()
|
||||
{
|
||||
if (lstCheckedDocVersions.Count == 0)
|
||||
{
|
||||
xpSetToSearch.Expanded = true;
|
||||
xpSetToSearch.TitleStyle.BackColor1.Color = Color.Crimson;
|
||||
btnSearch.Enabled = false;
|
||||
//if (xpSetToSearch.Expanded)
|
||||
xpSetToSearch.TitleText = "Select Procedure Sets to Search";
|
||||
//else
|
||||
// xpSetToSearch.TitleText = "Click Here to Select Procedure Sets";
|
||||
|
||||
//xpSetToSearch.TitleStyle.BackColor1.Color = saveXpSetToSearchColor;
|
||||
}
|
||||
else //if (lstCheckedDocVersions.Count > 0)
|
||||
{
|
||||
// display the number of selected procedure sets whether pannel is expanded or not
|
||||
xpSetToSearch.TitleText = string.Format("{0} Procedure Sets Selected", lstCheckedDocVersions.Count);
|
||||
xpSetToSearch.TitleStyle.BackColor1.Color = Color.PapayaWhip;
|
||||
btnSearch.Enabled = true;
|
||||
}
|
||||
else
|
||||
|
||||
}
|
||||
|
||||
private void advTreeProcSets_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e)
|
||||
{
|
||||
DevComponents.AdvTree.Node n = advTreeProcSets.SelectedNode;
|
||||
if (advTreeStepTypes.Nodes.Count == 1 && n.Checked)
|
||||
{
|
||||
xpSetToSearch.TitleText = "Select Procedure Sets to Search";
|
||||
xpSetToSearch.TitleStyle.BackColor1.Color = saveXpSetToSearchColor;
|
||||
Mydocversion = (DocVersionInfo)n.Tag;
|
||||
advTreeStepTypesFillIn();
|
||||
}
|
||||
}
|
||||
|
||||
private void xpSetToSearch_ExpandedChanged(object sender, ExpandedChangeEventArgs e)
|
||||
{
|
||||
if (lstCheckedDocVersions.Count == 0)
|
||||
if (xpSetToSearch.Expanded)
|
||||
xpSetToSearch.TitleText = "Select Procedure Sets to Search";
|
||||
else
|
||||
{
|
||||
xpSetToSearch.TitleText = "Click Here to Select Procedure Sets";
|
||||
xpSetToSearch.TitleStyle.BackColor1.Color = saveXpSetToSearchColor;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region StepTypeSelection
|
||||
@@ -889,21 +1007,19 @@ namespace Volian.Controls.Library
|
||||
else
|
||||
lstCheckedStepTypes.Remove((int)sd.Index);
|
||||
}
|
||||
if (lstCheckedStepTypes.Count > 0)
|
||||
{
|
||||
xpStepTypes.TitleText = string.Format("{0} Step Styles Selected",lstCheckedStepTypes.Count);
|
||||
xpStepTypes.TitleStyle.BackColor1.Color = Color.PapayaWhip;
|
||||
}
|
||||
else
|
||||
{
|
||||
xpStepTypes.TitleText = "Select Types To Search";
|
||||
xpStepTypes.TitleStyle.BackColor1.Color = saveXpStepTypeTitleColor;
|
||||
}
|
||||
buildStepTypePannelTitle();
|
||||
|
||||
}
|
||||
|
||||
private void xpStepTypes_ExpandedChanged(object sender, ExpandedChangeEventArgs e)
|
||||
{
|
||||
buildStepTypePannelTitle();
|
||||
}
|
||||
|
||||
private void buildStepTypePannelTitle()
|
||||
{
|
||||
if (lstCheckedStepTypes.Count == 0)
|
||||
{
|
||||
if (xpStepTypes.Expanded)
|
||||
{
|
||||
xpStepTypes.TitleText = "Select Types To Search";
|
||||
@@ -911,14 +1027,130 @@ namespace Volian.Controls.Library
|
||||
advTreeStepTypes.Nodes[0].SelectedCell = advTreeStepTypes.Nodes[0].Cells[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
xpStepTypes.TitleText = "Click Here To Search By Types";
|
||||
xpStepTypes.TitleStyle.BackColor1.Color = saveXpStepTypeTitleColor;
|
||||
}
|
||||
|
||||
xpStepTypes.TitleStyle.BackColor1.Color = saveXpStepTypeTitleColor;
|
||||
}
|
||||
else //lstCheckedStepTypes.Count > 0
|
||||
{
|
||||
// show how many selected whether pannel is expanded or not
|
||||
xpStepTypes.TitleText = string.Format("{0} Step Styles Selected", lstCheckedStepTypes.Count);
|
||||
xpStepTypes.TitleStyle.BackColor1.Color = Color.PapayaWhip;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ContextMenu
|
||||
|
||||
private void btnSym_Click(object sender, EventArgs e)
|
||||
{
|
||||
DevComponents.DotNetBar.ButtonItem b = (DevComponents.DotNetBar.ButtonItem)sender;
|
||||
if (cbxTextSearchAnnotation.Focused)
|
||||
cbxTextSearchAnnotation.SelectedText = (string)b.Text;
|
||||
else if (cbxTextSearchText.Focused)
|
||||
cbxTextSearchText.SelectedText = (string)b.Text;
|
||||
}
|
||||
|
||||
private void cmFndTxtInsHardSp_Click(object sender, EventArgs e)
|
||||
{
|
||||
// We use \u00A0 to represent a hard space because it show in the search text field as a blank
|
||||
// It will get translated to a real hard space character prior to searching
|
||||
if (cbxTextSearchAnnotation.Focused)
|
||||
cbxTextSearchAnnotation.SelectedText = "\u00A0";
|
||||
else if (cbxTextSearchText.Focused)
|
||||
cbxTextSearchText.SelectedText = "\u00A0";
|
||||
}
|
||||
|
||||
private void SetupContextMenu()
|
||||
{
|
||||
galSymbols.SubItems.Clear();
|
||||
if (_MyDocVersion != null)
|
||||
{
|
||||
FormatData fmtdata = _MyDocVersion.ActiveFormat.PlantFormat.FormatData;
|
||||
SymbolList sl = fmtdata.SymbolList;
|
||||
if (sl == null || sl.Count <= 0)
|
||||
{
|
||||
MessageBox.Show("No symbols are available, check with administrator");
|
||||
return;
|
||||
}
|
||||
foreach (Symbol sym in sl)
|
||||
{
|
||||
DevComponents.DotNetBar.ButtonItem btnCM = new DevComponents.DotNetBar.ButtonItem();
|
||||
btnCM.Text = string.Format("{0}", (char)sym.Unicode);
|
||||
// to name button use unicode rather than desc, desc may have spaces or odd chars
|
||||
btnCM.Name = "btnCM" + sym.Unicode.ToString();
|
||||
btnCM.Tooltip = sym.Desc;
|
||||
btnCM.Tag = string.Format(@"\u{0}", sym.Unicode);
|
||||
btnCM.FontBold = true;
|
||||
btnCM.Click += new System.EventHandler(btnSym_Click);
|
||||
galSymbols.SubItems.Add(btnCM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void cmFndTxtCut_Click(object sender, EventArgs e)
|
||||
{
|
||||
Clipboard.Clear();
|
||||
DataObject myDO = new DataObject(DataFormats.Text, cbxTextSearchAnnotation.Focused? cbxTextSearchAnnotation.SelectedText : cbxTextSearchText.SelectedText);
|
||||
Clipboard.SetDataObject(myDO);
|
||||
// Need to check which combo box activated the context menu so that we know where to take/put selected text
|
||||
if (cbxTextSearchAnnotation.Focused)
|
||||
cbxTextSearchAnnotation.SelectedText = "";
|
||||
else if (cbxTextSearchText.Focused)
|
||||
cbxTextSearchText.SelectedText = "";
|
||||
|
||||
}
|
||||
|
||||
private void cmFndTxtCopy_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Need to check which combo box activated the context menu so that we know where to take/put selected text
|
||||
DataObject myDO = new DataObject(DataFormats.Text, cbxTextSearchAnnotation.Focused? cbxTextSearchAnnotation.SelectedText : cbxTextSearchText.SelectedText);
|
||||
if (cbxTextSearchText.Focused || cbxTextSearchAnnotation.Focused)
|
||||
{
|
||||
Clipboard.Clear();
|
||||
Clipboard.SetDataObject(myDO);
|
||||
}
|
||||
}
|
||||
|
||||
private void cmFndTxtPaste_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Need to check which combo box activated the context menu so that we know where to take/put selected text
|
||||
IDataObject myDO = Clipboard.GetDataObject();
|
||||
if (myDO.GetDataPresent(DataFormats.Rtf))
|
||||
{
|
||||
StepRTB stpRTB = new StepRTB();
|
||||
stpRTB.SelectedRtf = myDO.GetData(DataFormats.Rtf).ToString();
|
||||
if (cbxTextSearchAnnotation.Focused)
|
||||
cbxTextSearchAnnotation.SelectedText = stpRTB.Text;
|
||||
else if (cbxTextSearchText.Focused)
|
||||
cbxTextSearchText.SelectedText = stpRTB.Text;// .SelectedText;//myDO.GetData(DataFormats.Text,true).ToString();
|
||||
}
|
||||
else if (myDO.GetDataPresent(DataFormats.Text))
|
||||
if (cbxTextSearchAnnotation.Focused)
|
||||
cbxTextSearchAnnotation.SelectedText = Clipboard.GetText();
|
||||
else if (cbxTextSearchText.Focused)
|
||||
cbxTextSearchText.SelectedText = Clipboard.GetText();//myDO.GetData(DataFormats.Text).ToString();
|
||||
}
|
||||
|
||||
private void btnCMIFindText_PopupOpen(object sender, PopupOpenEventArgs e)
|
||||
{
|
||||
// the context menu is available with just a mouse hover, even if the combo box does not have focus
|
||||
// ... set the focus to which ever combo box initiated the context menu
|
||||
if (tabAnnotationSearch.IsSelected)
|
||||
{
|
||||
if (!cbxTextSearchAnnotation.Focused)
|
||||
cbxTextSearchAnnotation.Focus();
|
||||
}
|
||||
else if (tabStepTypeSearch.IsSelected)
|
||||
{
|
||||
if (!cbxTextSearchText.Focused)
|
||||
cbxTextSearchText.Focus();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user