Getting everthing functional
This commit is contained in:
parent
ad901cb553
commit
07d2367ea3
136
PROMS/Volian.Controls.Library/FindReplace.Designer.cs
generated
136
PROMS/Volian.Controls.Library/FindReplace.Designer.cs
generated
@ -13,6 +13,25 @@ namespace Volian.Controls.Library
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (cmboFindText.Items.Count == 0)
|
||||
Properties.Settings.Default["FindTextList"] = null;
|
||||
else
|
||||
{
|
||||
System.Collections.Specialized.StringCollection lstfnd = new System.Collections.Specialized.StringCollection();
|
||||
foreach (string str in cmboFindText.Items)
|
||||
lstfnd.Add(str);
|
||||
Properties.Settings.Default.FindTextList = lstfnd;
|
||||
}
|
||||
if (cmboReplaceText.Items.Count == 0)
|
||||
Properties.Settings.Default["ReplaceTextList"] = null;
|
||||
else
|
||||
{
|
||||
System.Collections.Specialized.StringCollection lstrpl = new System.Collections.Specialized.StringCollection();
|
||||
foreach (string str in cmboReplaceText.Items)
|
||||
lstrpl.Add(str);
|
||||
Properties.Settings.Default.ReplaceTextList = lstrpl;
|
||||
}
|
||||
Properties.Settings.Default.Save();
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
@ -39,6 +58,16 @@ namespace Volian.Controls.Library
|
||||
this.labelX3 = new DevComponents.DotNetBar.LabelX();
|
||||
this.btnRplAll = new DevComponents.DotNetBar.ButtonX();
|
||||
this.panelEx1 = new DevComponents.DotNetBar.PanelEx();
|
||||
this.contextMenuBar1 = new DevComponents.DotNetBar.ContextMenuBar();
|
||||
this.btnCmFndRpl = new DevComponents.DotNetBar.ButtonItem();
|
||||
this.btnCmEdit = new DevComponents.DotNetBar.ButtonItem();
|
||||
this.btnCmCut = new DevComponents.DotNetBar.ButtonItem();
|
||||
this.btnCmCopy = new DevComponents.DotNetBar.ButtonItem();
|
||||
this.btnCmPaste = new DevComponents.DotNetBar.ButtonItem();
|
||||
this.btnCmInsert = new DevComponents.DotNetBar.ButtonItem();
|
||||
this.btnCmHardSp = new DevComponents.DotNetBar.ButtonItem();
|
||||
this.btnCmSymbol = new DevComponents.DotNetBar.ButtonItem();
|
||||
this.galSymbols = new DevComponents.DotNetBar.GalleryContainer();
|
||||
this.cbxReverse = new DevComponents.DotNetBar.Controls.CheckBoxX();
|
||||
this.cbxWholeWord = new DevComponents.DotNetBar.Controls.CheckBoxX();
|
||||
this.cbxCaseSensitive = new DevComponents.DotNetBar.Controls.CheckBoxX();
|
||||
@ -55,6 +84,7 @@ namespace Volian.Controls.Library
|
||||
this.tabControlPanel2 = new DevComponents.DotNetBar.TabControlPanel();
|
||||
this.tabReplace = new DevComponents.DotNetBar.TabItem(this.components);
|
||||
this.panelEx1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.contextMenuBar1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tabControl1)).BeginInit();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@ -98,10 +128,12 @@ namespace Volian.Controls.Library
|
||||
//
|
||||
this.cmboReplaceText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.contextMenuBar1.SetContextMenuEx(this.cmboReplaceText, this.btnCmFndRpl);
|
||||
this.cmboReplaceText.DisplayMember = "Text";
|
||||
this.cmboReplaceText.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
|
||||
this.cmboReplaceText.FormattingEnabled = true;
|
||||
this.cmboReplaceText.Location = new System.Drawing.Point(108, 50);
|
||||
this.cmboReplaceText.MaxDropDownItems = 10;
|
||||
this.cmboReplaceText.Name = "cmboReplaceText";
|
||||
this.cmboReplaceText.Size = new System.Drawing.Size(463, 23);
|
||||
this.cmboReplaceText.TabIndex = 2;
|
||||
@ -128,15 +160,18 @@ namespace Volian.Controls.Library
|
||||
//
|
||||
this.cmboFindText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.contextMenuBar1.SetContextMenuEx(this.cmboFindText, this.btnCmFndRpl);
|
||||
this.cmboFindText.DisplayMember = "Text";
|
||||
this.cmboFindText.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
|
||||
this.cmboFindText.FormattingEnabled = true;
|
||||
this.cmboFindText.Location = new System.Drawing.Point(108, 10);
|
||||
this.cmboFindText.MaxDropDownItems = 10;
|
||||
this.cmboFindText.Name = "cmboFindText";
|
||||
this.cmboFindText.Size = new System.Drawing.Size(463, 23);
|
||||
this.cmboFindText.TabIndex = 1;
|
||||
this.cmboFindText.WatermarkFont = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.cmboFindText.WatermarkText = "Enter text to find";
|
||||
this.cmboFindText.Leave += new System.EventHandler(this.cmboFindText_Leave);
|
||||
this.cmboFindText.TextChanged += new System.EventHandler(this.cmboFindText_TextChanged);
|
||||
//
|
||||
// labelX3
|
||||
@ -162,6 +197,7 @@ namespace Volian.Controls.Library
|
||||
this.btnRplAll.TabIndex = 10;
|
||||
this.btnRplAll.Text = "Replace All";
|
||||
this.btnRplAll.Visible = false;
|
||||
this.btnRplAll.Click += new System.EventHandler(this.btnRplAll_Click);
|
||||
//
|
||||
// panelEx1
|
||||
//
|
||||
@ -170,6 +206,7 @@ namespace Volian.Controls.Library
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panelEx1.CanvasColor = System.Drawing.Color.Transparent;
|
||||
this.panelEx1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
|
||||
this.panelEx1.Controls.Add(this.contextMenuBar1);
|
||||
this.panelEx1.Controls.Add(this.cbxReverse);
|
||||
this.panelEx1.Controls.Add(this.cbxWholeWord);
|
||||
this.panelEx1.Controls.Add(this.cbxCaseSensitive);
|
||||
@ -191,6 +228,88 @@ namespace Volian.Controls.Library
|
||||
this.panelEx1.Style.GradientAngle = 90;
|
||||
this.panelEx1.TabIndex = 15;
|
||||
//
|
||||
// contextMenuBar1
|
||||
//
|
||||
this.contextMenuBar1.AntiAlias = true;
|
||||
this.contextMenuBar1.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
|
||||
this.btnCmFndRpl});
|
||||
this.contextMenuBar1.Location = new System.Drawing.Point(153, 84);
|
||||
this.contextMenuBar1.Name = "contextMenuBar1";
|
||||
this.contextMenuBar1.Size = new System.Drawing.Size(75, 29);
|
||||
this.contextMenuBar1.Stretch = true;
|
||||
this.contextMenuBar1.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.contextMenuBar1.TabIndex = 13;
|
||||
this.contextMenuBar1.TabStop = false;
|
||||
this.contextMenuBar1.Text = "contextMenuBar1";
|
||||
//
|
||||
// btnCmFndRpl
|
||||
//
|
||||
this.btnCmFndRpl.AutoExpandOnClick = true;
|
||||
this.btnCmFndRpl.Name = "btnCmFndRpl";
|
||||
this.btnCmFndRpl.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
|
||||
this.btnCmEdit,
|
||||
this.btnCmInsert});
|
||||
this.btnCmFndRpl.Text = "cmFndRpl";
|
||||
//
|
||||
// btnCmEdit
|
||||
//
|
||||
this.btnCmEdit.Name = "btnCmEdit";
|
||||
this.btnCmEdit.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
|
||||
this.btnCmCut,
|
||||
this.btnCmCopy,
|
||||
this.btnCmPaste});
|
||||
this.btnCmEdit.Text = "Edit";
|
||||
//
|
||||
// btnCmCut
|
||||
//
|
||||
this.btnCmCut.Name = "btnCmCut";
|
||||
this.btnCmCut.Text = "Cut";
|
||||
this.btnCmCut.Click += new System.EventHandler(this.btnCmCut_Click);
|
||||
//
|
||||
// btnCmCopy
|
||||
//
|
||||
this.btnCmCopy.Name = "btnCmCopy";
|
||||
this.btnCmCopy.Text = "Copy";
|
||||
this.btnCmCopy.Click += new System.EventHandler(this.btnCmCopy_Click);
|
||||
//
|
||||
// btnCmPaste
|
||||
//
|
||||
this.btnCmPaste.Name = "btnCmPaste";
|
||||
this.btnCmPaste.Text = "Paste";
|
||||
this.btnCmPaste.Click += new System.EventHandler(this.btnCmPaste_Click);
|
||||
//
|
||||
// btnCmInsert
|
||||
//
|
||||
this.btnCmInsert.Name = "btnCmInsert";
|
||||
this.btnCmInsert.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
|
||||
this.btnCmHardSp,
|
||||
this.btnCmSymbol});
|
||||
this.btnCmInsert.Text = "Insert";
|
||||
//
|
||||
// btnCmHardSp
|
||||
//
|
||||
this.btnCmHardSp.Name = "btnCmHardSp";
|
||||
this.btnCmHardSp.Text = "Hard Space";
|
||||
this.btnCmHardSp.Click += new System.EventHandler(this.btnCmHardSp_Click);
|
||||
//
|
||||
// btnCmSymbol
|
||||
//
|
||||
this.btnCmSymbol.Name = "btnCmSymbol";
|
||||
this.btnCmSymbol.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
|
||||
this.galSymbols});
|
||||
this.btnCmSymbol.Text = "Symbol";
|
||||
//
|
||||
// galSymbols
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
this.galSymbols.BackgroundStyle.Class = "";
|
||||
this.galSymbols.EnableGalleryPopup = false;
|
||||
this.galSymbols.MinimumSize = new System.Drawing.Size(150, 200);
|
||||
this.galSymbols.Name = "galSymbols";
|
||||
this.galSymbols.Text = "galleryContainer1";
|
||||
//
|
||||
// cbxReverse
|
||||
//
|
||||
//
|
||||
@ -246,6 +365,7 @@ namespace Volian.Controls.Library
|
||||
this.cmbScope.Size = new System.Drawing.Size(248, 22);
|
||||
this.cmbScope.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.cmbScope.TabIndex = 6;
|
||||
this.cmbScope.Visible = false;
|
||||
//
|
||||
// comboItem1
|
||||
//
|
||||
@ -270,11 +390,12 @@ namespace Volian.Controls.Library
|
||||
//
|
||||
this.labelX1.BackgroundStyle.Class = "";
|
||||
this.labelX1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelX1.Location = new System.Drawing.Point(263, 103);
|
||||
this.labelX1.Location = new System.Drawing.Point(253, 104);
|
||||
this.labelX1.Name = "labelX1";
|
||||
this.labelX1.Size = new System.Drawing.Size(56, 23);
|
||||
this.labelX1.TabIndex = 12;
|
||||
this.labelX1.Text = "Scope:";
|
||||
this.labelX1.Visible = false;
|
||||
//
|
||||
// btnBookMrkAll
|
||||
//
|
||||
@ -287,6 +408,7 @@ namespace Volian.Controls.Library
|
||||
this.btnBookMrkAll.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnBookMrkAll.TabIndex = 8;
|
||||
this.btnBookMrkAll.Text = "Bookmark All";
|
||||
this.btnBookMrkAll.Click += new System.EventHandler(this.btnBookMrkAll_Click);
|
||||
//
|
||||
// tabControl1
|
||||
//
|
||||
@ -376,8 +498,10 @@ namespace Volian.Controls.Library
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Find and Replace";
|
||||
this.TopMost = true;
|
||||
this.Activated += new System.EventHandler(this.FindReplace_Activated);
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FindReplace_FormClosing);
|
||||
this.panelEx1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.contextMenuBar1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tabControl1)).EndInit();
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
@ -410,5 +534,15 @@ namespace Volian.Controls.Library
|
||||
private DevComponents.DotNetBar.TabItem tabFind;
|
||||
private DevComponents.DotNetBar.TabControlPanel tabControlPanel2;
|
||||
private DevComponents.DotNetBar.TabItem tabReplace;
|
||||
private DevComponents.DotNetBar.ContextMenuBar contextMenuBar1;
|
||||
private DevComponents.DotNetBar.ButtonItem btnCmFndRpl;
|
||||
private DevComponents.DotNetBar.ButtonItem btnCmEdit;
|
||||
private DevComponents.DotNetBar.ButtonItem btnCmInsert;
|
||||
private DevComponents.DotNetBar.ButtonItem btnCmCut;
|
||||
private DevComponents.DotNetBar.ButtonItem btnCmCopy;
|
||||
private DevComponents.DotNetBar.ButtonItem btnCmPaste;
|
||||
private DevComponents.DotNetBar.ButtonItem btnCmHardSp;
|
||||
private DevComponents.DotNetBar.ButtonItem btnCmSymbol;
|
||||
private DevComponents.DotNetBar.GalleryContainer galSymbols;
|
||||
}
|
||||
}
|
@ -11,6 +11,10 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
public partial class FindReplace : DevComponents.DotNetBar.Office2007Form
|
||||
{
|
||||
private bool doingfind = false;
|
||||
private bool found = false;
|
||||
private bool findingbookmarks = false;
|
||||
|
||||
//private bool _offsetStartPos = false;
|
||||
private StepItem _MyStepItem;
|
||||
public StepItem MyStepItem
|
||||
@ -19,6 +23,9 @@ namespace Volian.Controls.Library
|
||||
set
|
||||
{
|
||||
_MyStepItem = value;
|
||||
//DocVersionInfo dvi = _MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo; //MyStepItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
|
||||
_MyDocVersion = _MyStepItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
|
||||
SetupContextMenu();
|
||||
//_offsetStartPos = false; // in a different rtf box, don't offset find position first time around
|
||||
}
|
||||
}
|
||||
@ -39,6 +46,31 @@ namespace Volian.Controls.Library
|
||||
// }
|
||||
//}
|
||||
|
||||
private DocVersionInfo _MyDocVersion;
|
||||
public DocVersionInfo Mydocversion
|
||||
{
|
||||
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 DisplayBookMarks _myDisplayBookMarks;
|
||||
|
||||
public DisplayBookMarks MyDisplayBookMarks
|
||||
{
|
||||
get { return _myDisplayBookMarks; }
|
||||
set { _myDisplayBookMarks = value; }
|
||||
}
|
||||
|
||||
private bool _InApproved;
|
||||
|
||||
public bool InApproved
|
||||
@ -51,6 +83,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
//DocVersionInfo dvi = MyStepItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
|
||||
InitializeComponent();
|
||||
LoadFindReplaceTextListBox();
|
||||
//if (dvi != null && dvi.VersionType > 127)
|
||||
// InApproved = false; // in approved
|
||||
cmbScope.SelectedIndex = 0;
|
||||
@ -61,6 +94,24 @@ namespace Volian.Controls.Library
|
||||
//if (MyStepItem.MyStepRTB.SelectionLength > 0)
|
||||
// cmboFindText.Text = MyStepItem.MyStepRTB.SelectedText;
|
||||
cmboFindText.Focus();
|
||||
//SetupContextMenu();
|
||||
}
|
||||
private void LoadFindReplaceTextListBox()
|
||||
{
|
||||
// Setup cmboFindText Combo box
|
||||
cmboFindText.Items.Clear();
|
||||
if (Properties.Settings.Default["FindTextList"] != null && Properties.Settings.Default.FindTextList.Count > 0)
|
||||
{
|
||||
foreach (string str in Properties.Settings.Default.FindTextList)
|
||||
cmboFindText.Items.Add(str);
|
||||
}
|
||||
// Setup cmboReplaceText Combo box
|
||||
cmboReplaceText.Items.Clear();
|
||||
if (Properties.Settings.Default["ReplaceTextList"] != null && Properties.Settings.Default.ReplaceTextList.Count > 0)
|
||||
{
|
||||
foreach (string str in Properties.Settings.Default.ReplaceTextList)
|
||||
cmboReplaceText.Items.Add(str);
|
||||
}
|
||||
}
|
||||
|
||||
//public FindReplace(StepItem stpitm)
|
||||
@ -83,24 +134,90 @@ namespace Volian.Controls.Library
|
||||
|
||||
private void btnReplace_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!cmboReplaceText.Items.Contains(cmboReplaceText.Text))
|
||||
cmboReplaceText.Items.Add(cmboReplaceText.Text);
|
||||
btnFindNext_Click(sender, e);
|
||||
if (found) // found is set in btnFindNext_Click()
|
||||
MyStepItem.MyStepRTB.ReplaceText(cmboReplaceText.Text, cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked, false, null);
|
||||
}
|
||||
|
||||
private void btnRplAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnFindNext_Click(sender, e);
|
||||
while (found) // found is set in btnFindNext_Click()
|
||||
{
|
||||
if (MyStepItem.MyStepRTB.ReplaceText(cmboReplaceText.Text, cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked, true, this) == DialogResult.Cancel)
|
||||
found = false;
|
||||
else
|
||||
btnFindNext_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnBookMrkAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
findingbookmarks = true;
|
||||
btnFindNext_Click(sender, e);
|
||||
while (found) // found is set in btnFindNext_Click()
|
||||
{
|
||||
MyDisplayBookMarks.AddBookMark(MyStepItem.MyItemInfo);
|
||||
btnFindNext_Click(sender, e);
|
||||
}
|
||||
StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("Bookmarks");
|
||||
MyStepItem.MyStepPanel.OnTabDisplay(sender, args);
|
||||
findingbookmarks = false;
|
||||
}
|
||||
|
||||
private void btnFndRplDone_Click(object sender, EventArgs e)
|
||||
{
|
||||
//this.Close();
|
||||
this.Visible = false;
|
||||
doingfind = false;
|
||||
this.Visible = false;
|
||||
}
|
||||
|
||||
private void btnFindNext_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!cmboFindText.Items.Contains(cmboFindText.Text))
|
||||
cmboFindText.Items.Add(cmboFindText.Text);
|
||||
MyStepItem.MyStepRTB.FindText(cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked);
|
||||
found = false;
|
||||
AddToComboLists();
|
||||
doingfind = true;
|
||||
while (!MyStepItem.MyStepRTB.FindText(cmboFindText.Text, cbxCaseSensitive.Checked, cbxWholeWord.Checked, cbxReverse.Checked))
|
||||
{
|
||||
ItemInfo next = (cbxReverse.Checked) ? MyStepItem.MyItemInfo.SearchPrev : MyStepItem.MyItemInfo.SearchNext;
|
||||
while (!next.IsSection && !next.MyContent.Text.ToUpper().Contains(cmboFindText.Text.ToUpper()))
|
||||
next = (cbxReverse.Checked) ? next.SearchPrev : next.SearchNext;
|
||||
if (next.IsSection)
|
||||
{
|
||||
if (!findingbookmarks)
|
||||
{
|
||||
if (cbxReverse.Checked)
|
||||
MessageBox.Show(this, "Not Found - From Here to Beginning of Section", "Find/Replace");
|
||||
else
|
||||
MessageBox.Show(this, "Not Found - From Here to End of Section", "Find/Replace");
|
||||
}
|
||||
return;
|
||||
}
|
||||
MyStepItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(next);
|
||||
if (cbxReverse.Checked)
|
||||
MyStepItem.MyStepRTB.SelectionStart = MyStepItem.MyStepRTB.Text.Length;
|
||||
}
|
||||
MyStepItem.MyStepRTB.Focus();
|
||||
found = true;
|
||||
}
|
||||
|
||||
private void AddToComboLists()
|
||||
{
|
||||
bool hastext = this.cmboFindText.Text.Length > 0;
|
||||
if (hastext && !cmboFindText.Items.Contains(cmboFindText.Text))
|
||||
{
|
||||
if (cmboFindText.Items.Count >= 10)
|
||||
cmboFindText.Items.RemoveAt(9);
|
||||
cmboFindText.Items.Insert(0, cmboFindText.Text);//.Add(cmboFindText.Text);
|
||||
}
|
||||
hastext = this.cmboReplaceText.Text.Length > 0;
|
||||
if (hastext && btnReplace.Enabled && !cmboReplaceText.Items.Contains(cmboReplaceText.Text))
|
||||
{
|
||||
if (cmboReplaceText.Items.Count >= 10)
|
||||
cmboReplaceText.Items.RemoveAt(9);
|
||||
cmboReplaceText.Items.Insert(0, cmboReplaceText.Text);
|
||||
}
|
||||
}
|
||||
private void cmboFindText_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
bool hastext = this.cmboFindText.Text.Length > 0;
|
||||
@ -140,5 +257,116 @@ namespace Volian.Controls.Library
|
||||
btnFndRplDone_Click(sender, e);
|
||||
e.Cancel = true; // cancel the form close event - the Done_Click() will hide it instead
|
||||
}
|
||||
|
||||
private void cmboFindText_Leave(object sender, EventArgs e)
|
||||
{
|
||||
//bool hastext = this.cmboFindText.Text.Length > 0;
|
||||
//if (hastext && !cmboFindText.Items.Contains(cmboFindText.Text))
|
||||
//{
|
||||
// if (cmboFindText.Items.Count >= 10)
|
||||
// cmboFindText.Items.RemoveAt(9);
|
||||
// cmboFindText.Items.Insert(0, cmboFindText.Text);//.Add(cmboFindText.Text);
|
||||
//}
|
||||
}
|
||||
|
||||
private void btnCmCut_Click(object sender, EventArgs e)
|
||||
{
|
||||
Clipboard.Clear();
|
||||
DataObject myDO = new DataObject(DataFormats.Text, cmboReplaceText.Focused ? cmboReplaceText.SelectedText : cmboFindText.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 (cmboFindText.Focused)
|
||||
cmboFindText.SelectedText = "";
|
||||
else if (cmboReplaceText.Focused)
|
||||
cmboReplaceText.SelectedText = "";
|
||||
}
|
||||
|
||||
private void btnCmCopy_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, cmboReplaceText.Focused ? cmboReplaceText.SelectedText : cmboFindText.SelectedText);
|
||||
if (cmboFindText.Focused || cmboReplaceText.Focused)
|
||||
{
|
||||
Clipboard.Clear();
|
||||
Clipboard.SetDataObject(myDO);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCmPaste_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 (cmboReplaceText.Focused)
|
||||
cmboReplaceText.SelectedText = stpRTB.Text;
|
||||
else if (cmboFindText.Focused)
|
||||
cmboFindText.SelectedText = stpRTB.Text;
|
||||
}
|
||||
else if (myDO.GetDataPresent(DataFormats.Text))
|
||||
if (cmboReplaceText.Focused)
|
||||
cmboReplaceText.SelectedText = Clipboard.GetText();
|
||||
else if (cmboFindText.Focused)
|
||||
cmboFindText.SelectedText = Clipboard.GetText();
|
||||
}
|
||||
|
||||
private void btnCmHardSp_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 (cmboReplaceText.Focused)
|
||||
cmboReplaceText.SelectedText = "\u00A0";
|
||||
else if (cmboFindText.Focused)
|
||||
cmboFindText.SelectedText = "\u00A0";
|
||||
}
|
||||
private void btnSym_Click(object sender, EventArgs e)
|
||||
{
|
||||
DevComponents.DotNetBar.ButtonItem b = (DevComponents.DotNetBar.ButtonItem)sender;
|
||||
if (cmboReplaceText.Focused)
|
||||
cmboReplaceText.SelectedText = (string)b.Text;
|
||||
else if (cmboFindText.Focused)
|
||||
cmboFindText.SelectedText = (string)b.Text;
|
||||
}
|
||||
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(this, "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(@"{0}", sym.Unicode);
|
||||
btnCM.FontBold = true;
|
||||
btnCM.Click += new System.EventHandler(btnSym_Click);
|
||||
galSymbols.SubItems.Add(btnCM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FindReplace_Activated(object sender, EventArgs e)
|
||||
{
|
||||
StepRTB srtb = MyStepItem.MyStepRTB;
|
||||
if (srtb.SelectionLength > 0 && !doingfind)
|
||||
{
|
||||
if (srtb.IsSelectionLinked(srtb.SelectionStart, srtb.SelectionLength))
|
||||
cmboFindText.Text = srtb.SelectedText.Substring(0, srtb.SelectedText.IndexOf("#Link"));
|
||||
else
|
||||
cmboFindText.Text = srtb.SelectedText;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user