This commit is contained in:
@@ -16,36 +16,19 @@ namespace Volian.Controls.Library
|
||||
private bool findingbookmarks = false;
|
||||
|
||||
//private bool _offsetStartPos = false;
|
||||
private RTBItem _MyRTBItem;
|
||||
public RTBItem MyRTBItem
|
||||
private EditItem _MyEditItem;
|
||||
public EditItem MyEditItem
|
||||
{
|
||||
get { return _MyRTBItem; }
|
||||
get { return _MyEditItem; }
|
||||
set
|
||||
{
|
||||
_MyRTBItem = value;
|
||||
//DocVersionInfo dvi = _MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo; //MyRTBItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
|
||||
_MyDocVersion = _MyRTBItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
|
||||
_MyEditItem = value;
|
||||
if (_MyEditItem == null) return;
|
||||
_MyDocVersion = _MyEditItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
|
||||
SetupContextMenu();
|
||||
//_offsetStartPos = false; // in a different rtf box, don't offset find position first time around
|
||||
}
|
||||
}
|
||||
//private DocVersionInfo _MyDVI;
|
||||
//public DocVersionInfo MyDVI
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// if (_MyDVI != null) return _MyDVI;
|
||||
// if (_MyRTBItem != null)
|
||||
// {
|
||||
// ItemInfo procInfo = _MyRTBItem.MyItemInfo.MyProcedure as ItemInfo;
|
||||
// if (procInfo == null) return null;
|
||||
// _MyDVI = procInfo.ActiveParent as DocVersionInfo;
|
||||
// return _MyDVI;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//}
|
||||
|
||||
private DocVersionInfo _MyDocVersion;
|
||||
public DocVersionInfo Mydocversion
|
||||
{
|
||||
@@ -81,7 +64,6 @@ namespace Volian.Controls.Library
|
||||
|
||||
public FindReplace()
|
||||
{
|
||||
//DocVersionInfo dvi = MyRTBItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
|
||||
InitializeComponent();
|
||||
LoadFindReplaceTextListBox();
|
||||
//if (dvi != null && dvi.VersionType > 127)
|
||||
@@ -136,7 +118,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
btnFindNext_Click(sender, e);
|
||||
if (found) // found is set in btnFindNext_Click()
|
||||
MyRTBItem.MyStepRTB.ReplaceText(cmboReplaceText.Text, cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked, false, null);
|
||||
MyEditItem.ReplaceText(cmboReplaceText.Text, cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked, false, null);
|
||||
}
|
||||
|
||||
private void btnRplAll_Click(object sender, EventArgs e)
|
||||
@@ -144,7 +126,7 @@ namespace Volian.Controls.Library
|
||||
btnFindNext_Click(sender, e);
|
||||
while (found) // found is set in btnFindNext_Click()
|
||||
{
|
||||
if (MyRTBItem.MyStepRTB.ReplaceText(cmboReplaceText.Text, cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked, true, this) == DialogResult.Cancel)
|
||||
if (MyEditItem.ReplaceText(cmboReplaceText.Text, cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked, true, this) == DialogResult.Cancel)
|
||||
found = false;
|
||||
else
|
||||
btnFindNext_Click(sender, e);
|
||||
@@ -157,11 +139,11 @@ namespace Volian.Controls.Library
|
||||
btnFindNext_Click(sender, e);
|
||||
while (found) // found is set in btnFindNext_Click()
|
||||
{
|
||||
MyDisplayBookMarks.AddBookMark(MyRTBItem.MyItemInfo);
|
||||
MyDisplayBookMarks.AddBookMark(MyEditItem.MyItemInfo);
|
||||
btnFindNext_Click(sender, e);
|
||||
}
|
||||
StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("Bookmarks");
|
||||
MyRTBItem.MyStepPanel.OnTabDisplay(sender, args);
|
||||
MyEditItem.MyStepPanel.OnTabDisplay(sender, args);
|
||||
findingbookmarks = false;
|
||||
}
|
||||
|
||||
@@ -177,10 +159,14 @@ namespace Volian.Controls.Library
|
||||
found = false;
|
||||
AddToComboLists();
|
||||
doingfind = true;
|
||||
while (!MyRTBItem.MyStepRTB.FindText(cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked))
|
||||
while (!MyEditItem.FindText(cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked))
|
||||
{
|
||||
ItemInfo next = (cbxReverse.Checked) ? MyRTBItem.MyItemInfo.SearchPrev : MyRTBItem.MyItemInfo.SearchNext;
|
||||
while (!next.IsSection && !next.MyContent.Text.ToUpper().Contains(cmboFindText.Text.ToUpper()))
|
||||
ItemInfo next = (cbxReverse.Checked) ? MyEditItem.MyItemInfo.SearchPrev : MyEditItem.MyItemInfo.SearchNext;
|
||||
|
||||
// TODO: Searchable text for grids/tables will be in MyContent.Text - but is not there now.
|
||||
// uncomment next line and remove following line (and it's associated method code) when it is available.
|
||||
//while (!next.IsSection && !next.MyContent.Text.ToUpper().Contains(cmboFindText.Text.ToUpper()))
|
||||
while (!next.IsSection && !FindNextText(next))
|
||||
next = (cbxReverse.Checked) ? next.SearchPrev : next.SearchNext;
|
||||
if (next.IsSection)
|
||||
{
|
||||
@@ -193,14 +179,22 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
return;
|
||||
}
|
||||
MyRTBItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(next);
|
||||
MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(next);
|
||||
if (cbxReverse.Checked)
|
||||
MyRTBItem.MyStepRTB.SelectionStart = MyRTBItem.MyStepRTB.Text.Length;
|
||||
MyEditItem.PositionToEnd();
|
||||
}
|
||||
if (MyEditItem.MyStepRTB != null && !MyEditItem.MyStepRTB.Visible)
|
||||
{
|
||||
MyEditItem.MyStepRTB.Visible = true;
|
||||
MyEditItem.MyStepRTB.Focus();
|
||||
}
|
||||
MyRTBItem.MyStepRTB.Focus();
|
||||
found = true;
|
||||
}
|
||||
|
||||
private bool FindNextText(ItemInfo next)
|
||||
{
|
||||
if (next.MyContent.MyGrid!=null) return true;
|
||||
return next.MyContent.Text.ToUpper().Contains(cmboFindText.Text.ToUpper());
|
||||
}
|
||||
private void AddToComboLists()
|
||||
{
|
||||
bool hastext = this.cmboFindText.Text.Length > 0;
|
||||
@@ -298,12 +292,12 @@ namespace Volian.Controls.Library
|
||||
IDataObject myDO = Clipboard.GetDataObject();
|
||||
if (myDO.GetDataPresent(DataFormats.Rtf))
|
||||
{
|
||||
StepRTB stpRTB = new StepRTB();
|
||||
stpRTB.SelectedRtf = myDO.GetData(DataFormats.Rtf).ToString();
|
||||
RichTextBox rtb = new RichTextBox();
|
||||
rtb.SelectedRtf = ItemInfo.StripLinks(myDO.GetData(DataFormats.Rtf).ToString());
|
||||
if (cmboReplaceText.Focused)
|
||||
cmboReplaceText.SelectedText = stpRTB.Text;
|
||||
cmboReplaceText.SelectedText = rtb.Text;
|
||||
else if (cmboFindText.Focused)
|
||||
cmboFindText.SelectedText = stpRTB.Text;
|
||||
cmboFindText.SelectedText = rtb.Text;
|
||||
}
|
||||
else if (myDO.GetDataPresent(DataFormats.Text))
|
||||
if (cmboReplaceText.Focused)
|
||||
@@ -358,13 +352,10 @@ namespace Volian.Controls.Library
|
||||
|
||||
private void FindReplace_Activated(object sender, EventArgs e)
|
||||
{
|
||||
StepRTB srtb = MyRTBItem.MyStepRTB;
|
||||
if (srtb.SelectionLength > 0 && !doingfind)
|
||||
if (!doingfind)
|
||||
{
|
||||
if (srtb.IsSelectionLinked(srtb.SelectionStart, srtb.SelectionLength))
|
||||
cmboFindText.Text = srtb.SelectedText.Substring(0, srtb.SelectedText.IndexOf("#Link"));
|
||||
else
|
||||
cmboFindText.Text = srtb.SelectedText;
|
||||
string find = MyEditItem.SelectedTextForFind;
|
||||
if (find != null) cmboFindText.Text = find;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user