This commit is contained in:
Kathy Ruffing 2011-02-08 11:31:16 +00:00
parent 9474d194c8
commit 773b2d2380
7 changed files with 3016 additions and 46 deletions

View File

@ -368,7 +368,7 @@ namespace Volian.Controls.Library
if (MyDisplayTabItem.MyItemInfo != null) // lib doc with no associated active procedure defaults to edit
{
StepTabPanel stpanel = _MyDisplayTabControl.GetProcedureTabPanel(MyDisplayTabItem.MyItemInfo);
PanelViewEditMode = (stpanel==null)? E_ViewMode.Edit : stpanel.MyStepPanel.PanelViewEditMode;
PanelViewEditMode = (stpanel == null) ? E_ViewMode.Edit : stpanel.MyStepPanel.VwMode;
}
try
{

View File

@ -0,0 +1,43 @@
namespace Volian.Controls.Library
{
partial class EditItem
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
protected bool _BeingDisposed = false;
public bool BeingDisposed
{
get { return _BeingDisposed; }
set { _BeingDisposed = value; }
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
_BeingDisposed = true;
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@ -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;
}
}

View File

@ -0,0 +1,91 @@
namespace Volian.Controls.Library
{
partial class GridItem
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GridItem));
this.lblTab = new System.Windows.Forms.Label();
this._MyToolTip = new DevComponents.DotNetBar.SuperTooltip();
this._MyFlexGrid = new Volian.Controls.Library.VlnFlexGrid(this.components);
((System.ComponentModel.ISupportInitialize)(this._MyFlexGrid)).BeginInit();
this.SuspendLayout();
//
// lblTab
//
this.lblTab.BackColor = System.Drawing.Color.Transparent;
this.lblTab.Location = new System.Drawing.Point(0, 0);
this.lblTab.Name = "lblTab";
this.lblTab.Size = new System.Drawing.Size(61, 23);
this.lblTab.TabIndex = 3;
this.lblTab.Visible = false;
this.lblTab.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lblTab_MouseDown);
//
// _MyToolTip
//
this._MyToolTip.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F";
//
// _MyFlexGrid
//
this._MyFlexGrid.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Custom;
this._MyFlexGrid.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.Both;
this._MyFlexGrid.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this._MyFlexGrid.ColumnInfo = "3,0,0,0,0,40,Columns:";
this._MyFlexGrid.DrawMode = C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw;
this._MyFlexGrid.FocusRect = C1.Win.C1FlexGrid.FocusRectEnum.Solid;
this._MyFlexGrid.Location = new System.Drawing.Point(5, 5);
this._MyFlexGrid.Name = "_MyFlexGrid";
this._MyFlexGrid.Rows.Count = 4;
this._MyFlexGrid.Rows.DefaultSize = 20;
this._MyFlexGrid.Rows.Fixed = 0;
this._MyFlexGrid.ScrollBars = System.Windows.Forms.ScrollBars.None;
this._MyFlexGrid.Size = new System.Drawing.Size(314, 66);
this._MyFlexGrid.StyleInfo = resources.GetString("_MyFlexGrid.StyleInfo");
this._MyFlexGrid.TabIndex = 4;
//
// GridItem
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this._MyFlexGrid);
this.Controls.Add(this.lblTab);
this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "GridItem";
this.Size = new System.Drawing.Size(320, 72);
((System.ComponentModel.ISupportInitialize)(this._MyFlexGrid)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label lblTab;
private DevComponents.DotNetBar.SuperTooltip _MyToolTip;
private VlnFlexGrid _MyFlexGrid;
}
}

View File

@ -0,0 +1,634 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using VEPROMS.CSLA.Library;
using Volian.Base.Library;
using C1.Win.C1FlexGrid;
namespace Volian.Controls.Library
{
public partial class GridItem : EditItem
{
/*
* TODO: (2/2/11)
* 1) KBR Need to include/handle StepRTB/EditItem Events: Add for grid items, the events that
* are handled by StepRTB/EditItem. Should these be abstract events within EditItem so
* that it 'tells' you which events you need.
* May Need yet:
* OnOpenContextMenu (grid and/or rtb)
* steprtb->OnCopystep ?
* OnCheckClipboard
* 3) KBR FindReplace.cs - had to check for Null rtbItem, so will need
* to support if GridItem. AND frmVEPROMS.cs line 1021, findreplace
* currently are set to need an RTBItem. Will need to be more general.
* 4) KBR ContextMenu for table. May want it to function in a similar way to spellcheck, with
* the contentmenu to support table options and a last item that supports existing
* contextmenu
* 5) RHM Copy step - including modifying SQL code to copy grid/image data.
* 6) RHM Selection is NOT selection, i.e. if merged cells, selection isn't selecting the 'merged'
* i.e. parent cell.
* 7) RHM Selecting a range can end up with uneven rows or uneven columns. We need to handle,
* some possible options are to not allow operations to occur if uneven selections;
* make selection even; etc.
* 8) KBR When data migration of tables, need to include the font if there is a symbol. Move
* AddFontTable from StepRTB.cs to a place accessible, such as volian.base. And then
* in data migration, will need to know if a font is fixed.
* 9) RHM Editting cell with Transition Panel enabled; click on Ro Panel and it is not enabled
*/
#region Fields
public VlnFlexGrid MyFlexGrid
{
get { return _MyFlexGrid; }
set { _MyFlexGrid = value; }
}
private int _GridMargin = 11;
/// <summary>
/// Margin between the EditItem and the VlnFlexGrid. Appears on the Right.
/// Will allow space to draw a Change Bar on the right side of the EditItem.
/// </summary>
public int GridMargin
{
get { return _GridMargin; }
set { _GridMargin = value; }
}
#endregion
#region Event Handlers
/// <summary>
/// Raises an ItemClick event when the user clicks on the Tab
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void lblTab_MouseDown(object sender, MouseEventArgs e)
{
MyStepPanel.OnItemClick(this, new StepPanelEventArgs(this, e));
}
void MyFlexGrid_Resize(object sender, EventArgs e)
{
this.Size = new Size(MyFlexGrid.Width + GridMargin, MyFlexGrid.Height + GridMargin);
AdjustTableWidthAndLocation();
AdjustLocation();
}
void MyFlexGrid_Enter(object sender, EventArgs e)
{
if (MyStepPanel.DisplayItemChanging) return;
MyStepRTB.MyItemInfo = MyItemInfo; // should be in vlnFlexGrid
MyStepPanel.SelectedEditItem = this;
}
void MyFlexGrid_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Left:
if (e.Shift) return;
MyStepRTB.StepRTB_ArrowPressed(e.Control ? E_ArrowKeys.CtrlLeft : E_ArrowKeys.Left);
e.Handled = true;
break;
case Keys.Up:
if (e.Shift) return;
MyStepRTB.StepRTB_ArrowPressed(e.Control ? E_ArrowKeys.CtrlUp : E_ArrowKeys.Up);
e.Handled = true;
break;
case Keys.Right:
if (e.Shift) return;
MyStepRTB.StepRTB_ArrowPressed(e.Control ? E_ArrowKeys.CtrlRight : E_ArrowKeys.Right);
e.Handled = true;
break;
case Keys.Down:
if (e.Shift) return;
MyStepRTB.StepRTB_ArrowPressed(e.Control ? E_ArrowKeys.CtrlDown : E_ArrowKeys.Down);
e.Handled = true;
break;
}
}
void MyFlexGrid_CursorMovement(object sender, VlnFlexGridCursorMovementEventArgs args)
{
MyStepPanel.CursorMovement(this,new Point(0,0), args.Key);
}
void MyStepRTB_LinkModifyTran(object sender, StepPanelLinkEventArgs args)
{
MyStepPanel.OnLinkModifyTran(sender, args);
}
void MyStepRTB_LinkModifyRO(object sender, StepPanelLinkEventArgs args)
{
MyStepPanel.OnLinkModifyRO(sender, args);
}
void MyStepRTB_LinkGoTo(object sender, StepPanelLinkEventArgs args)
{
MyStepPanel.OnLinkClicked(sender, args);
}
void MyStepRTB_CursorKeyPress(object sender, KeyEventArgs args)
{
MyStepPanel.StepCursorKeys(this, args);
}
void MyStepRTB_SetMenu(object sender, StepRTBMenuEventArgs args)
{
if (args.MenuGroup == null)
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ClearContextMenu();
else if (args.MenuGroup == "OpenContextMenu")
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetContextMenu();
else
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetShortCutContextMenu(args.MenuGroup);
}
void MyStepRTB_AdjustTableWidth(object sender, StepRTBTableWidthEventArgs args)
{
//if ((!_MyItemInfo.IsSection && !_MyItemInfo.IsProcedure) && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure))
if (args.EditMode)
{
int colR = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode);
int widS = /* _WidthAdjust + borderWidth + */ MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode);
int wNew = 70 + widS + colR * MyItemInfo.ColumnMode;
if (wNew > ItemWidth)
{
ItemWidth = wNew;
ItemLocation = TableLocation(MyParentEditItem, MyStepSectionLayoutData, wNew);
}
}
else
{
int newwidth = MyFlexGrid.Width;
if (ItemWidth != newwidth)
{
ItemWidth = newwidth;
ItemLocation = TableLocation(MyParentEditItem, MyStepSectionLayoutData, newwidth);
}
}
}
bool MyStepRTB_IsNotCurrentSelection(object sender, EventArgs args)
{
return MyStepPanel.SelectedEditItem != this;
}
void MyStepRTB_OpenAnnotations(object sender, EventArgs args)
{
OpenAnnotations();
}
void MyFlexGrid_OpenAnnotations(object sender, EventArgs args)
{
OpenAnnotations();
}
void MyStepRTB_DoMouseWheel(object sender, MouseEventArgs args)
{
DoMouseWheel(args);
}
void MyStepRTB_DoSaveContents(object sender, EventArgs args)
{
SaveContents();
}
void MyStepRTB_VisibleChanged(object sender, EventArgs e)
{
MyStepRTB.EditMode = MyStepRTB.Visible;
Console.WriteLine("GridItem: EditMode = {0}", MyStepRTB.EditMode);
}
void MyStepRTB_ReturnToEditor(object sender, EventArgs args)
{
MyFlexGrid.Focus();
MyFlexGrid.StartEditing();
}
void MyFlexGrid_Click(object sender, EventArgs e)
{
MyFlexGrid.Focus();
}
void MyStepRTB_EditModeChanged(object sender, EventArgs args)
{
if (MyStepRTB.EditMode)
MyFlexGrid.Styles["Focus"].BackColor = MyFlexGrid.Styles["Highlight"].BackColor = Color.SkyBlue;
else
MyFlexGrid.Styles["Focus"].BackColor = MyFlexGrid.Styles["Highlight"].BackColor = Color.LightCyan;
}
private string _OrigRtf; // used to store original rtf to allow for 'escape' key restore
void MyFlexGrid_SelChange(object sender, EventArgs e)
{
if (MyFlexGrid.Selection.IsSingleCell)
_OrigRtf = MyFlexGrid[MyFlexGrid.Row, MyFlexGrid.Col].ToString();
}
void MyStepRTB_KeyDown(object sender, KeyEventArgs e)
{
if (!e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Escape && MyStepRTB.EditMode)
{
MyStepRTB.Rtf = _OrigRtf;
MyFlexGrid.Select(MyFlexGrid.Selection);
}
}
#endregion // Event Handlers
#region Constructors
public GridItem()
{
InitializeComponent();
}
public GridItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand)
{
InitializeComponent();
SetupEventHandlers();
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null);
//RefreshDisplay(true); //TODO: is the argument true?
}
public GridItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem)
{
InitializeComponent();
SetupEventHandlers();
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem);
//RefreshDisplay(true); //TODO: is the argument true?
}
private void SetupEventHandlers()
{
this.MyFlexGrid.Resize += new EventHandler(MyFlexGrid_Resize);
this.MyFlexGrid.Enter += new EventHandler(MyFlexGrid_Enter);
//this.MyFlexGrid.KeyDown += new KeyEventHandler(MyFlexGrid_KeyDown);
this.MyFlexGrid.CursorMovement += new VlnFlexGridCursorMovementEvent(MyFlexGrid_CursorMovement);
this.MyFlexGrid.OpenAnnotations += new VlnFlexGridEvent(MyFlexGrid_OpenAnnotations);
this.MyStepRTB.LinkGoTo += new StepRTBLinkEvent(MyStepRTB_LinkGoTo);
this.MyStepRTB.LinkModifyRO += new StepRTBLinkEvent(MyStepRTB_LinkModifyRO);
this.MyStepRTB.LinkModifyTran += new StepRTBLinkEvent(MyStepRTB_LinkModifyTran);
this.MyStepRTB.CursorKeyPress += new StepRTBCursorKeysEvent(MyStepRTB_CursorKeyPress);
this.MyStepRTB.SetMenu += new StepRTBMenuEvent(MyStepRTB_SetMenu);
this.MyStepRTB.AdjustTableWidth += new StepRTBTableWidthEvent(MyStepRTB_AdjustTableWidth);
this.MyStepRTB.IsNotCurrentSelection += new StepRTBBooleanEvent(MyStepRTB_IsNotCurrentSelection);
this.MyStepRTB.OpenAnnotations += new StepRTBEvent(MyStepRTB_OpenAnnotations);
this.MyStepRTB.DoMouseWheel += new StepRTBMouseEvent(MyStepRTB_DoMouseWheel);
this.MyStepRTB.DoSaveContents += new StepRTBEvent(MyStepRTB_DoSaveContents);
this.MyStepRTB.VisibleChanged += new EventHandler(MyStepRTB_VisibleChanged);
this.MyStepRTB.ReturnToEditor += new StepRTBEvent(MyStepRTB_ReturnToEditor);
this.MyFlexGrid.Click += new EventHandler(MyFlexGrid_Click);
this.MyStepRTB.EditModeChanged += new StepRTBEvent(MyStepRTB_EditModeChanged);
this.MyStepRTB.KeyDown += new KeyEventHandler(MyStepRTB_KeyDown);
this.MyFlexGrid.SelChange += new EventHandler(MyFlexGrid_SelChange);
}
#endregion
#region Override Method and Properties
public override int BorderWidth { get { return (MyFlexGrid.Width - MyFlexGrid.ClientRectangle.Width); } }
public override Point ContentLocation
{
get { return new Point(Location.X + MyFlexGrid.Left, Location.Y); }
set { Location = new Point(value.X - MyFlexGrid.Left, value.Y); }
}
public override string TabFormat { get { return _TabFormat; } set { _TabFormat = value; } }
public override void AdjustTableWidthAndLocation()
{
//_MyStepRTB.Font = MyStepData.Font.WindowsFont;
//ItemWidth = (int)GetTableWidth(MyStepRTB.Font, MyItemInfo.MyContent.Text, true);
//ItemWidth = MyFlexGrid.Width;
ItemLocation = new Point(50, _MyParentEditItem.Bottom);
ItemLocation = TableLocation(_MyParentEditItem, MyStepSectionLayoutData, ItemWidth);
}
public override void SetToolTip(string tip)
{
DevComponents.DotNetBar.SuperTooltipInfo tpi = new DevComponents.DotNetBar.SuperTooltipInfo("", "", tip, null, null, DevComponents.DotNetBar.eTooltipColor.Lemon);
_MyToolTip.MinimumTooltipSize = new Size(0, 24);
_MyToolTip.TooltipDuration = 3;
_MyToolTip.SetSuperTooltip(MyStepRTB, tpi);
}
public override void RefreshContent()
{
// content, i.e. MyContent, of the grid has changed, refresh the grid
/*
* Need:
* 'RefreshDisplay': Something to display grid
* 'IdentifyMe': Something to highlight appropriately, i.e. copy step OR backgroun color (annotation or not)
* 'SetExpandAndExpander': Handles whether it is visible, i.e. if step is collapsed - this is not visible.
*/
}
public override int TableWidth { get { return 0; } } // DONE
public override int ItemLeft
{
get { return Left + lblTab.Left; }
set { Left = value - lblTab.Left; }
}
public override int ContentLeft { get { return Left + MyFlexGrid.Left; } }
public override int ContentWidth
{
get { return MyFlexGrid.Width; }
set
{
Width = value + lblTab.Left + lblTab.Width;
}
}
public override Point ItemLocation
{
get { return new Point(Location.X + lblTab.Left, Location.Y); }
set { Location = new Point(value.X - lblTab.Left, value.Y); }
}
public override int ItemWidth
{
get { return Width - lblTab.Left; }
set
{
Width = GridMargin + value + lblTab.Left;
}
}
public override void RefreshOrdinal()
{
TabFormat = null; // Reset Tab
}
public override bool Expanded
{
get {return !Colapsing;}
set {;} // Tables are always expanded.
}
public override void RefreshTab() { TabFormat = null;}
public override void SetFocus() { MyFlexGrid.Focus();}
public override void SaveContents()
{
MyFlexGrid[MyFlexGrid.Row, MyFlexGrid.Col] = MyStepRTB.Rtf;
}
public override bool CanExpand { get { return false; } set { ;} }
public override void HandleResize() { ;} // DONE
public override void MatchExpanded() { ;} // DONE
public override void ItemSelect()
{
// Was getting an Error that _MyStepRTB was Disposed RHM 20101217
if (!MyFlexGrid.Disposing)
{
MyFlexGrid.Focus();
MyFlexGrid.Select(0, 0);
}
else
{
_MyLog.WarnFormat("Attempt to give Focus to Disposed Object {0}", MyID);
}
ScrollToCenter();
}
public override void ItemShow()
{
MyFlexGrid.Focus();
ScrollToCenter();
}
public override StepRTB MyStepRTB { get { return MyFlexGrid.TableCellEditor; } }
public override DialogResult ReplaceText(string rpltxt, string fndstr, bool caseSensitive, bool matchWholeWord, bool reverse, bool prompt, IWin32Window fndrpldlg)
{
int r = MyFlexGrid.Row;
int c = MyFlexGrid.Col;
if (!reverse)
{
int w = MyFlexGrid.Cols.Count;
int h = MyFlexGrid.Rows.Count;
while (r < h)
{
CellRange cr = MyFlexGrid.GetMergedRange(r, c);
if (cr.r1 == r && cr.c1 == c)
{
int ss = MyStepRTB.SelectionStart;
int sl = MyStepRTB.SelectionLength;
MyFlexGrid.StartEditing();
MyStepRTB.Select(ss, sl); // need to reset selection because startediting positions to end.
string oldRtf = MyStepRTB.Rtf;
DialogResult dr = MyStepRTB.ReplaceText(rpltxt, fndstr, caseSensitive, matchWholeWord, reverse, prompt, fndrpldlg);
if (oldRtf != MyStepRTB.Rtf) MyFlexGrid[r, c] = MyStepRTB.Rtf;
if (dr == DialogResult.Yes || dr == DialogResult.Cancel) return dr;
}
c = c + 1;
if (c == w)
{
c = 0;
r = r + 1;
}
if (r < h)
{
MyFlexGrid.Select(r, c);
MyStepRTB.Select(0, 0);
}
}
}
else // reverse
{
while (r >= 0)
{
CellRange cr = MyFlexGrid.GetMergedRange(r, c);
if (cr.r1 == r && cr.c1 == c)
{
int ss = MyStepRTB.SelectionStart;
int sl = MyStepRTB.SelectionLength;
MyFlexGrid.StartEditing();
MyStepRTB.Select(ss, sl);
string oldRtf = MyStepRTB.Rtf;
DialogResult dr = MyStepRTB.ReplaceText(rpltxt, fndstr, caseSensitive, matchWholeWord, reverse, prompt, fndrpldlg);
if (oldRtf != MyStepRTB.Rtf) MyFlexGrid[r, c] = MyStepRTB.Rtf;
if (dr == DialogResult.Yes || dr == DialogResult.Cancel) return dr;
}
c = c - 1;
if (c < 0)
{
c = MyFlexGrid.Cols.Count - 1;
r = r - 1;
}
cr = MyFlexGrid.GetMergedRange(r, c);
if (r >= 0 && cr.r1 == r && cr.c1 == c)
{
MyFlexGrid.Select(r, c);
MyFlexGrid.StartEditing();
MyStepRTB.Select(MyStepRTB.Text.Length, 0);
}
}
}
return DialogResult.No;
}
public override bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse)
{
int r = MyFlexGrid.Row;
int c = MyFlexGrid.Col;
if (!reverse)
{
int w = MyFlexGrid.Cols.Count;
int h = MyFlexGrid.Rows.Count;
while (r < h)
{
CellRange cr = MyFlexGrid.GetMergedRange(r, c);
if (cr.r1 == r && cr.c1 == c)
{
int ss = MyStepRTB.SelectionStart + MyStepRTB.SelectionLength;
MyFlexGrid.StartEditing();
MyStepRTB.Select(ss, 0); // need to reset selection because startediting positions to end.
bool scn = MyStepRTB.FindText(str, caseSensitive, matchWholeWord, reverse);
if (scn) return true;
}
c = c + 1;
if (c == w)
{
c = 0;
r = r + 1;
}
if (r < h)
{
MyFlexGrid.Select(r, c);
MyStepRTB.Select(0, 0);
}
}
}
else
{
while (r >= 0)
{
CellRange cr = MyFlexGrid.GetMergedRange(r, c);
if (cr.r1 == r && cr.c1 == c)
{
int ss = MyStepRTB.SelectionStart;
MyFlexGrid.StartEditing();
MyStepRTB.Select(ss, 0);
bool scn = MyStepRTB.FindText(str, caseSensitive, matchWholeWord, reverse);
if (scn) return true;
}
c = c - 1;
if (c < 0)
{
c = MyFlexGrid.Cols.Count - 1;
r = r - 1;
}
cr = MyFlexGrid.GetMergedRange(r, c);
if (r >= 0 && cr.r1 == r && cr.c1 == c)
{
MyFlexGrid.Select(r, c);
MyFlexGrid.StartEditing();
MyStepRTB.Select(MyStepRTB.Text.Length, 0);
}
}
}
return false;
}
public override void PositionToEnd()
{
int r = MyFlexGrid.Rows.Count - 1;
int c = MyFlexGrid.Cols.Count - 1;
MyFlexGrid.Select(r, c);
while (r >= 0)
{
CellRange cr = MyFlexGrid.GetMergedRange(r, c);
if (cr.r1 == r && cr.c1 == c)
{
MyFlexGrid.StartEditing();
return;
}
c = c - 1;
if (c < 0)
{
c = MyFlexGrid.Cols.Count - 1;
r = r - 1;
}
if (r >= 0)
{
MyFlexGrid.Select(r, c);
MyStepRTB.Select(MyStepRTB.Text.Length, 0);
}
}
}
public override string SelectedTextForFind
{
get
{
StepRTB srtb = MyStepRTB;
if (srtb.SelectionLength > 0)
{
if (srtb.IsSelectionLinked(srtb.SelectionStart, srtb.SelectionLength))
return srtb.SelectedText.Substring(0, srtb.SelectedText.IndexOf("#Link"));
else
return srtb.SelectedText;
}
return null;
}
}
public override bool SpellCheckNext()
{
int r = MyFlexGrid.Row;
int c = MyFlexGrid.Col;
int w = MyFlexGrid.Cols.Count;
int h = MyFlexGrid.Rows.Count;
while (r < h)
{
CellRange cr = MyFlexGrid.GetMergedRange(r, c);
if (cr.r1 == r && cr.c1 == c)
{
MyFlexGrid.Select(r, c);
MyFlexGrid.StartEditing();
string oldRtf = MyStepRTB.Rtf;
bool scn = MyStepRTB.SpellCheckNext();
if (oldRtf != MyStepRTB.Rtf) MyFlexGrid[r, c] = MyStepRTB.Rtf;
if (!scn) return false;
}
c = c + 1;
if (c == w)
{
c = 0;
r = r + 1;
}
}
return true;
}
public override void IdentifyMe(bool highlight)
{
if (highlight)
MyFlexGrid.Styles["Alternate"].BackColor = MyFlexGrid.Styles["Normal"].BackColor = Color.Gray;
else
{
if (MyFlexGrid.Focused) // If active Set BackColor to the active color
SetActive();
else // Otherwise Set the BackColor to either the InactiveColor or the AnnotationColor
{
MyFlexGrid.Styles["Alternate"].BackColor = MyFlexGrid.Styles["Normal"].BackColor =
MyItemInfo.ItemAnnotationCount == 0 ? MyStepPanel.InactiveColor : MyStepPanel.AnnotationColor;
// Turn-off Size adjustment
MyFlexGrid.Cols.Fixed = 0;
MyFlexGrid.Rows.Fixed = 0;
}
}
}
public override void SetActive()
{
MyFlexGrid.Styles["Focus"].BackColor = MyFlexGrid.Styles["Highlight"].BackColor = Color.LightCyan;
}
private bool _Empty = false;
public override bool Empty
{
get { return _Empty; }
set { _Empty = value; }
}
public override void RefreshDisplay(bool activeMode)
{
XmlDocument xd = new XmlDocument();
xd.LoadXml(MyItemInfo.MyContent.MyGrid.Data.Replace("Courier New", "Times New Roman"));
//xd.LoadXml(MyItemInfo.MyContent.MyGrid.Data);
MyFlexGrid.Clear();
MyFlexGrid.MergedRanges.Clear();
MyFlexGrid.ReadXml(xd);
MyFlexGrid.AdjustGridControlSize();
// When a grid is read from XML, all of the styles are updated to the values in the XML.
// Thus any specific settings need to be set after the grid is read.
MyFlexGrid.Styles["Highlight"].BackColor = Color.LightCyan;
MyFlexGrid.Styles["Focus"].BackColor = Color.LightCyan;
MyFlexGrid.HighLight = activeMode ? C1.Win.C1FlexGrid.HighLightEnum.Always : C1.Win.C1FlexGrid.HighLightEnum.WithFocus;
MyFlexGrid.VwMode = MyStepPanel.VwMode;
}
public override void ToggleEditView(E_ViewMode vwMode)
{
/*
* TODO:
* 1) SaveContents
*/
RefreshDisplay(false);
MyFlexGrid.VwMode = vwMode;
}
public override int TabLeft { get { return lblTab.Left; } set { lblTab.Left = value; } }
public override Font TabFont { get { return lblTab.Font; } set { lblTab.Font = value; } }
public override string TabText { get { return lblTab.Text; } }
public override Point TabLocation { get { return lblTab.Location; } }
public override Font ContentFont { get { return MyFlexGrid.Font; } set { MyFlexGrid.Font = value; } } // TODO how do we know what font tables are in?
public override float ContentTop { get { return MyFlexGrid.Top; } }
public override void SetupHeader(ItemInfo itemInfo) { ;} // tables do not have headers
public override void ShowExpanded() {;}
public override void SetText()
{
RefreshDisplay(false);
IdentifyMe(false);
}
public override void SetExpandAndExpander(ItemInfo itemInfo) { CanExpand = false; } // can't expand a table
#endregion
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="_MyFlexGrid.StyleInfo" xml:space="preserve">
<value>Normal{Font:Microsoft Sans Serif, 7.8pt;BackColor:255, 255, 255;TextAlign:LeftCenter;Border:Flat,1,Black,Both;} Alternate{BackColor:255, 255, 255;} Fixed{BackColor:Control;ForeColor:ControlText;Border:Flat,1,ControlDark,Both;BackgroundImageLayout:Hide;} Highlight{BackColor:LightCyan;ForeColor:Black;} Focus{BackColor:LightCyan;} Editor{} Search{BackColor:Highlight;ForeColor:HighlightText;} Frozen{BackColor:Beige;} NewRow{ForeColor:GrayText;} EmptyArea{BackColor:Transparent;Border:None,1,Black,Both;} SelectedColumnHeader{} SelectedRowHeader{} GrandTotal{BackColor:Black;ForeColor:White;} Subtotal0{BackColor:ControlDarkDark;ForeColor:White;} Subtotal1{BackColor:ControlDarkDark;ForeColor:White;} Subtotal2{BackColor:ControlDarkDark;ForeColor:White;} Subtotal3{BackColor:ControlDarkDark;ForeColor:White;} Subtotal4{BackColor:ControlDarkDark;ForeColor:White;} Subtotal5{BackColor:ControlDarkDark;ForeColor:White;} </value>
</data>
</root>