This commit is contained in:
John Jenko 2011-03-10 13:32:26 +00:00
parent a67f3dc6c7
commit b43ea73257
7 changed files with 775 additions and 645 deletions

View File

@ -175,6 +175,20 @@ namespace VEPROMS.CSLA.Library
if (ROID.StartsWith("FFFF")) return string.Format("Invalid Unit RO '{0}'", ROID); if (ROID.StartsWith("FFFF")) return string.Format("Invalid Unit RO '{0}'", ROID);
return string.Format("Invalid RO '{0}'",ROID); return string.Format("Invalid RO '{0}'",ROID);
} }
public rochild GetRoChild12(string ROID16)
{
string ROID = ROID16.Substring(0, 12);
if (dicRos == null) ParseIntoDictionary(_ROFst != null ? _ROFst.ROLookup : _ROFstInfo.ROLookup);
// Use the ROID to get the value from the dictionary
if (dicRos.ContainsKey(ROID))
{
rochild rochld = (rochild)dicRos[ROID];
return rochld;
}
rochild tmp = new rochild();
tmp.ID = -1;
return tmp;
}
public rochild GetRoChild(string ROID) public rochild GetRoChild(string ROID)
{ {
if (dicRos == null) ParseIntoDictionary(_ROFst != null ? _ROFst.ROLookup : _ROFstInfo.ROLookup); if (dicRos == null) ParseIntoDictionary(_ROFst != null ? _ROFst.ROLookup : _ROFstInfo.ROLookup);

View File

@ -83,6 +83,9 @@ namespace Volian.Controls.Library
CopyStep(); CopyStep();
} }
break; break;
case Keys.Delete:
MyFlexGrid.ClearSelectedCellText();
break;
} }
} }
void SetMenu(string contentMenu) void SetMenu(string contentMenu)
@ -90,7 +93,7 @@ namespace Volian.Controls.Library
if (contentMenu == null) if (contentMenu == null)
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ClearContextMenu(); MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ClearContextMenu();
else if (contentMenu == "OpenContextMenu") else if (contentMenu == "OpenContextMenu")
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetContextMenu(); MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetGridCellContextMenu(); //.SetContextMenu();
else else
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetShortCutContextMenu(contentMenu); MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetShortCutContextMenu(contentMenu);
} }
@ -174,10 +177,15 @@ namespace Volian.Controls.Library
void MyFlexGrid_Click(object sender, EventArgs e) void MyFlexGrid_Click(object sender, EventArgs e)
{ {
MyFlexGrid.Focus(); MyFlexGrid.Focus();
//MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ToggleTableDesignButtons(false);
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetRibbonForGrid();
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetTableButtonsForMergeRangeSelection();
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetGridContextMenu();
} }
void MyStepRTB_EditModeChanged(object sender, EventArgs args) void MyStepRTB_EditModeChanged(object sender, EventArgs args)
{ {
AdjustColorsForEditMode(); AdjustColorsForEditMode();
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetRibbonForGrid();
} }
private void AdjustColorsForEditMode() private void AdjustColorsForEditMode()

View File

@ -57,7 +57,7 @@ namespace Volian.Controls.Library
} }
} }
private ItemInfo MyItemInfo private ItemInfo MyItemInfo
{ get { return _MyStepRTB==null?null:_MyStepRTB.MyItemInfo; } } { get { return _MyStepRTB == null ? null : _MyStepRTB.MyItemInfo; } }
private DevComponents.DotNetBar.ButtonItem _DefaultContextMenu; private DevComponents.DotNetBar.ButtonItem _DefaultContextMenu;
@ -69,6 +69,15 @@ namespace Volian.Controls.Library
{ {
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfEdit); _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfEdit);
} }
public void SetGridCellContextMenu()
{
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfCellEdit);
}
public void SetGridContextMenu()
{
if (rtabTableGridTools.Visible)
_ContextMenuBar.SetContextMenuEx(MyFlexGrid, btnCMGrid);
}
public void OpenContextMenu(Point loc) public void OpenContextMenu(Point loc)
{ {
btnCMRtfEdit.Popup(loc); btnCMRtfEdit.Popup(loc);
@ -87,8 +96,17 @@ namespace Volian.Controls.Library
switch (_MyStepRTB.FieldToEdit) switch (_MyStepRTB.FieldToEdit)
{ {
case E_FieldToEdit.StepText: case E_FieldToEdit.StepText:
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfEdit); if (MyFlexGrid != null)
_DefaultContextMenu = btnCMRtfEdit; {
// This happends when the FlexGrid (table) is slected (not when you edit a table cell)
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfCellEdit);
_DefaultContextMenu = btnCMRtfCellEdit;
}
else
{
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfEdit);
_DefaultContextMenu = btnCMRtfEdit;
}
break; break;
case E_FieldToEdit.Text: case E_FieldToEdit.Text:
case E_FieldToEdit.Number: case E_FieldToEdit.Number:
@ -104,7 +122,8 @@ namespace Volian.Controls.Library
//_MyStepRTB.KeyUp += new KeyEventHandler(_MyStepRTB_KeyUp); //+= new KeyEventHandler(MyStepRTB_SelectionChanged); //_MyStepRTB.KeyUp += new KeyEventHandler(_MyStepRTB_KeyUp); //+= new KeyEventHandler(MyStepRTB_SelectionChanged);
_MyStepRTB.SelectionChanged += new EventHandler(_MyStepRTB_SelectionChanged); _MyStepRTB.SelectionChanged += new EventHandler(_MyStepRTB_SelectionChanged);
//_MyStepRTB.ModeChange += new StepRTBModeChangeEvent(_MyStepRTB_ModeChange); //_MyStepRTB.ModeChange += new StepRTBModeChangeEvent(_MyStepRTB_ModeChange);
_MyStepRTB.Leave += new EventHandler(MyStepRTB_Leave); _MyEditItem.Leave += new EventHandler(_MyEditItem_Leave);
//_MyStepRTB.Leave += new EventHandler(_MyStepRTB_Leave);
_MyStepRTB.LinkChanged += new StepRTBLinkEvent(_MyStepRTB_LinkChanged); _MyStepRTB.LinkChanged += new StepRTBLinkEvent(_MyStepRTB_LinkChanged);
// Add symbols into the tab ribbon based on format selection. For now, only add symbols once // Add symbols into the tab ribbon based on format selection. For now, only add symbols once
// because all symbols are same!!! If we start defining different symbols in different formats // because all symbols are same!!! If we start defining different symbols in different formats
@ -124,6 +143,7 @@ namespace Volian.Controls.Library
} }
BuildSymbolGallery(sl, galleryContainerSymbolsCM); BuildSymbolGallery(sl, galleryContainerSymbolsCM);
BuildSymbolGallery(sl, galleryContainerSymbolsCM3); BuildSymbolGallery(sl, galleryContainerSymbolsCM3);
BuildSymbolGallery(sl, galleryContainerSymbolsGrid);
} }
SetButtonAndMenuEnabling(true); SetButtonAndMenuEnabling(true);
SetStepButtonAndMenuEnabling(true); SetStepButtonAndMenuEnabling(true);
@ -133,6 +153,18 @@ namespace Volian.Controls.Library
} }
} }
void _MyEditItem_Leave(object sender, EventArgs e)
{
// The following two lines were replaced by the third line so that the Ribbon KeyTips will work properly.
// ex. Positon on a substep, press <shift><F6> <N> <S> <S>, to list the substep types
//_MyStepRTB.KeyUp -=new KeyEventHandler(_MyStepRTB_KeyUp);
//_MyStepRTB.MouseUp -= new MouseEventHandler(_MyStepRTB_MouseUp);
_MyStepRTB.SelectionChanged -= new EventHandler(_MyStepRTB_SelectionChanged);
_MyEditItem.Leave += new EventHandler(_MyEditItem_Leave);
//_MyStepRTB.Leave -= new EventHandler(_MyStepRTB_Leave);
_MyStepRTB.LinkChanged -= new StepRTBLinkEvent(_MyStepRTB_LinkChanged);
}
void _MyStepRTB_SelectionChanged(object sender, EventArgs e) void _MyStepRTB_SelectionChanged(object sender, EventArgs e)
{ {
SetButtonAndMenuEnabling(false); SetButtonAndMenuEnabling(false);
@ -197,7 +229,7 @@ namespace Volian.Controls.Library
public bool Expanded public bool Expanded
{ {
get { return _RibbonControl.Expanded; } get { return _RibbonControl.Expanded; }
set{ _RibbonControl.Expanded = value; } set { _RibbonControl.Expanded = value; }
} }
#endregion #endregion
#region Events #region Events
@ -223,21 +255,22 @@ namespace Volian.Controls.Library
btnCMEditRO.Enabled = false; btnCMEditRO.Enabled = false;
} }
} }
void MyStepRTB_Leave(object sender, EventArgs e) void _MyStepRTB_Leave(object sender, EventArgs e)
{ {
// The following two lines were replaced by the third line so that the Ribbon KeyTips will work properly. // The following two lines were replaced by the third line so that the Ribbon KeyTips will work properly.
// ex. Positon on a substep, press <shift><F6> <N> <S> <S>, to list the substep types // ex. Positon on a substep, press <shift><F6> <N> <S> <S>, to list the substep types
//_MyStepRTB.KeyUp -=new KeyEventHandler(_MyStepRTB_KeyUp); //_MyStepRTB.KeyUp -=new KeyEventHandler(_MyStepRTB_KeyUp);
//_MyStepRTB.MouseUp -= new MouseEventHandler(_MyStepRTB_MouseUp); //_MyStepRTB.MouseUp -= new MouseEventHandler(_MyStepRTB_MouseUp);
_MyStepRTB.SelectionChanged -=new EventHandler(_MyStepRTB_SelectionChanged); _MyStepRTB.SelectionChanged -= new EventHandler(_MyStepRTB_SelectionChanged);
_MyStepRTB.Leave -= new EventHandler(MyStepRTB_Leave); _MyStepRTB.Leave -= new EventHandler(_MyStepRTB_Leave);
_MyStepRTB.LinkChanged -= new StepRTBLinkEvent(_MyStepRTB_LinkChanged); _MyStepRTB.LinkChanged -= new StepRTBLinkEvent(_MyStepRTB_LinkChanged);
} }
void btnInsStep_Click(object sender, EventArgs e) void btnInsStep_Click(object sender, EventArgs e)
{ {
DevComponents.DotNetBar.ButtonItem b = (DevComponents.DotNetBar.ButtonItem)sender; DevComponents.DotNetBar.ButtonItem b = (DevComponents.DotNetBar.ButtonItem)sender;
if (b.Tag == null) return; if (b.Tag == null) return;
char [] sep = {' '}; char[] sep = { ' ' };
string[] insdata = b.Tag.ToString().Split(sep); string[] insdata = b.Tag.ToString().Split(sep);
if (insdata.Length != 2) return; if (insdata.Length != 2) return;
int fromtype = Convert.ToInt32(insdata[0]); int fromtype = Convert.ToInt32(insdata[0]);
@ -251,7 +284,7 @@ namespace Volian.Controls.Library
EditItem hlsEditItem = _MyEditItem; EditItem hlsEditItem = _MyEditItem;
while (!hlsEditItem.MyItemInfo.IsHigh) while (!hlsEditItem.MyItemInfo.IsHigh)
hlsEditItem = hlsEditItem.ActiveParent; hlsEditItem = hlsEditItem.ActiveParent;
hlsEditItem.AddSiblingAfter((int ?)contenttype,true); hlsEditItem.AddSiblingAfter((int?)contenttype, true);
} }
else else
{ {
@ -308,6 +341,13 @@ namespace Volian.Controls.Library
btnUnderline.Enabled = btnCMUnderline.Enabled = (!((_MyStepRTB.MyStyleFont.Style & E_Style.Underline) == E_Style.Underline)); btnUnderline.Enabled = btnCMUnderline.Enabled = (!((_MyStepRTB.MyStyleFont.Style & E_Style.Underline) == E_Style.Underline));
btnItalics.Enabled = btnCMItalics.Enabled = (!((_MyStepRTB.MyStyleFont.Style & E_Style.Italics) == E_Style.Italics)); btnItalics.Enabled = btnCMItalics.Enabled = (!((_MyStepRTB.MyStyleFont.Style & E_Style.Italics) == E_Style.Italics));
} }
public void SetTableButtonsForMergeRangeSelection()
{
if (MyFlexGrid != null)
{
btnTblDgnMergeCells.Enabled = btnCmGridMergeCells.Enabled = !MyFlexGrid.IsInMergeRange();
}
}
private void SetButtonMenuEnabledDisabledOnSelection(bool setting) private void SetButtonMenuEnabledDisabledOnSelection(bool setting)
{ {
btnCMBold.Enabled = btnBold.Enabled = setting; btnCMBold.Enabled = btnBold.Enabled = setting;
@ -381,7 +421,7 @@ namespace Volian.Controls.Library
btnCMGoTo.Enabled = btnGoTo.Enabled = _MyStepRTB.IsSelectionLinked(_MyStepRTB.SelectionStart, _MyStepRTB.SelectionLength); //(_MyStepRTB.MyLinkText != null); btnCMGoTo.Enabled = btnGoTo.Enabled = _MyStepRTB.IsSelectionLinked(_MyStepRTB.SelectionStart, _MyStepRTB.SelectionLength); //(_MyStepRTB.MyLinkText != null);
if (btnCMGoTo.Enabled == true && _MyStepRTB.MyLinkText != null) // must have some link test, use it to set edit of transition or ro... if (btnCMGoTo.Enabled == true && _MyStepRTB.MyLinkText != null) // must have some link test, use it to set edit of transition or ro...
{ {
btnCMEditTran.Enabled = _MyStepRTB.MyLinkText.IndexOf("Transition")>-1; // selected link must be a transition btnCMEditTran.Enabled = _MyStepRTB.MyLinkText.IndexOf("Transition") > -1; // selected link must be a transition
btnCMEditRO.Enabled = _MyStepRTB.MyLinkText.IndexOf("ReferencedObject") > -1; // selected link must be ro btnCMEditRO.Enabled = _MyStepRTB.MyLinkText.IndexOf("ReferencedObject") > -1; // selected link must be ro
} }
else else
@ -410,9 +450,9 @@ namespace Volian.Controls.Library
// when doing 'substep' part of paste, need to check if format allows subsection. // when doing 'substep' part of paste, need to check if format allows subsection.
} }
else if (tmp.MyDisplayTabControl.MyCopyStep.IsCautionPart || tmp.MyDisplayTabControl.MyCopyStep.IsNotePart) else if (tmp.MyDisplayTabControl.MyCopyStep.IsCautionPart || tmp.MyDisplayTabControl.MyCopyStep.IsNotePart)
// Part type of copied step must be same as Part type of destination, with exceptions of caution/note and step/rno // Part type of copied step must be same as Part type of destination, with exceptions of caution/note and step/rno
// can be pasted into each other. // can be pasted into each other.
// Part types are procedure - 1, section = 2, step = 6, caution = 3, note = 4, RNO (IsRNO), = 5 table/figure = 7. // Part types are procedure - 1, section = 2, step = 6, caution = 3, note = 4, RNO (IsRNO), = 5 table/figure = 7.
btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnPasteReplace.Enabled = (MyItemInfo.IsCautionPart || MyItemInfo.IsNotePart); btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnPasteReplace.Enabled = (MyItemInfo.IsCautionPart || MyItemInfo.IsNotePart);
else if (tmp.MyDisplayTabControl.MyCopyStep.IsRNOPart || tmp.MyDisplayTabControl.MyCopyStep.IsStepPart) else if (tmp.MyDisplayTabControl.MyCopyStep.IsRNOPart || tmp.MyDisplayTabControl.MyCopyStep.IsStepPart)
btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnPasteReplace.Enabled = (MyItemInfo.IsRNOPart || MyItemInfo.IsStepPart); btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnPasteReplace.Enabled = (MyItemInfo.IsRNOPart || MyItemInfo.IsStepPart);
@ -437,7 +477,7 @@ namespace Volian.Controls.Library
DocVersionInfo dvi = MyEditItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo; DocVersionInfo dvi = MyEditItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
if (dvi == null) return; if (dvi == null) return;
if (dvi.VersionType > 127) if (dvi.VersionType > 127)
btnCMEditMode1.Enabled = btnEditMode.Enabled = false; // in approved btnCMEditMode1.Enabled = btnEditMode.Enabled = false; // in approved
if (dvi.VersionType > 127 || MyEditItem.MyStepPanel.VwMode == E_ViewMode.View) if (dvi.VersionType > 127 || MyEditItem.MyStepPanel.VwMode == E_ViewMode.View)
{ {
SetButtonMenuEnabledDisabledOnStepType(false); SetButtonMenuEnabledDisabledOnStepType(false);
@ -453,15 +493,22 @@ namespace Volian.Controls.Library
btnInsPgBrk.Enabled = MyItemInfo.IsHigh; btnInsPgBrk.Enabled = MyItemInfo.IsHigh;
btnEditMode.Checked = btnCMEditMode1.Checked = MyEditItem.MyStepPanel.VwMode == E_ViewMode.View; btnEditMode.Checked = btnCMEditMode1.Checked = MyEditItem.MyStepPanel.VwMode == E_ViewMode.View;
// if on procedure, 'Delete' buttons should be disabled. // if on procedure, 'Delete' buttons should be disabled.
btnDelelete.Enabled = btnDelStep.Enabled = ! MyItemInfo.IsProcedure; btnDelelete.Enabled = btnDelStep.Enabled = !MyItemInfo.IsProcedure;
btnCpyStp.Enabled = !MyItemInfo.IsProcedure; btnCpyStp.Enabled = !MyItemInfo.IsProcedure;
if (!(MyEditItem is GridItem) && rtabTableGridTools.Checked) // Only display the table edit tools if in a grid (table) and that grid (table) is not an RO Table.
GridItem tmpGridItm = MyEditItem as GridItem;
if (btnTblDgnAdjustSize.Checked)
{
btnTblDgnAdjustSize.Checked = false;
ToggleTableDesignButtons(true);
}
rtabTableGridTools.Visible = tmpGridItm != null && !tmpGridItm.MyFlexGrid.IsRoTable;
// If no longer on a table (grid) or the newly selectd table is an RO table
// then select the Home tab (since the Table tab is not visable)
if ((!(MyEditItem is GridItem) && rtabTableGridTools.Checked) || !rtabTableGridTools.Visible)
{ {
rtabHome.Select(); rtabHome.Select();
} }
// Only display the table edit tools if in a grid (table) and that grid (table) is not an RO Table.
GridItem tmpGridItm = MyEditItem as GridItem;
rtabTableGridTools.Visible = tmpGridItm != null && !tmpGridItm.MyFlexGrid.IsRoTable;
// if on procedure or section, 'change type' & 'insert' buttons should be disabled. // if on procedure or section, 'change type' & 'insert' buttons should be disabled.
if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) if (MyItemInfo.IsProcedure || MyItemInfo.IsSection)
@ -492,7 +539,7 @@ namespace Volian.Controls.Library
actable = sd.StepEditData.AcTable; actable = sd.StepEditData.AcTable;
if (actable == null) actable = 0; if (actable == null) actable = 0;
btnInsHLS.Enabled = true; btnInsHLS.Enabled = true;
btnInsCaut.Enabled = (actable & E_AccStep.AddingCaution)>0; btnInsCaut.Enabled = (actable & E_AccStep.AddingCaution) > 0;
btnInsNote.Enabled = (actable & E_AccStep.AddingNote) > 0; btnInsNote.Enabled = (actable & E_AccStep.AddingNote) > 0;
btnInsRNO.Enabled = (actable & E_AccStep.AddingRNO) > 0; btnInsRNO.Enabled = (actable & E_AccStep.AddingRNO) > 0;
btnInsFig.Enabled = (actable & E_AccStep.AddingTable) > 0; btnInsFig.Enabled = (actable & E_AccStep.AddingTable) > 0;
@ -520,7 +567,7 @@ namespace Volian.Controls.Library
btnCMInsRNO.SubItems.Clear(); btnCMInsRNO.SubItems.Clear();
} }
btnInsRNO.Enabled = btnCMInsRNO.Enabled = btnInsRNO.Enabled && (MyItemInfo.RNOs==null || MyItemInfo.RNOs.Count==0); // don't insert an RNO if has an RNO btnInsRNO.Enabled = btnCMInsRNO.Enabled = btnInsRNO.Enabled && (MyItemInfo.RNOs == null || MyItemInfo.RNOs.Count == 0); // don't insert an RNO if has an RNO
// if (rno is enabled, set the tag: // if (rno is enabled, set the tag:
if (btnInsRNO.Enabled) if (btnInsRNO.Enabled)
@ -588,8 +635,8 @@ namespace Volian.Controls.Library
// if high level step, don't put the rno button on // if high level step, don't put the rno button on
// if caution don't add note button (the StepGetLevelTypes method returns cautions/notes together // if caution don't add note button (the StepGetLevelTypes method returns cautions/notes together
if (btn.Name == "btnInsHLS" && sd.Type == "RNOType") addit = false; if (btn.Name == "btnInsHLS" && sd.Type == "RNOType") addit = false;
if (btn.Name == "btnInsCaut" && sd.Type.Length>=4 && sd.Type.Substring(0, 4) == "Note") addit = false; if (btn.Name == "btnInsCaut" && sd.Type.Length >= 4 && sd.Type.Substring(0, 4) == "Note") addit = false;
if (btn.Name == "btnInsNote" && sd.Type.Length>=7 && sd.Type.Substring(0, 7) == "Caution") addit = false; if (btn.Name == "btnInsNote" && sd.Type.Length >= 7 && sd.Type.Substring(0, 7) == "Caution") addit = false;
if (btn.Name == "btnInsSubstep" && MyItemInfo.Steps != null) addit = false; if (btn.Name == "btnInsSubstep" && MyItemInfo.Steps != null) addit = false;
if (addit) if (addit)
{ {
@ -679,7 +726,7 @@ namespace Volian.Controls.Library
{ {
_MyStepRTB.InsertIndent(MyEditItem.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IndentToken); _MyStepRTB.InsertIndent(MyEditItem.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IndentToken);
} }
#endregion #endregion
#region Home Tab #region Home Tab
private void btnPaste_Click(object sender, EventArgs e) private void btnPaste_Click(object sender, EventArgs e)
{ {
@ -703,7 +750,7 @@ namespace Volian.Controls.Library
myDO.SetText(_MyStepRTB.SelectedText); myDO.SetText(_MyStepRTB.SelectedText);
Clipboard.SetDataObject(myDO); Clipboard.SetDataObject(myDO);
_MyStepRTB.SelectedText = ""; _MyStepRTB.SelectedText = "";
} }
private void btnCopy_Click(object sender, EventArgs e) private void btnCopy_Click(object sender, EventArgs e)
{ {
Clipboard.Clear(); Clipboard.Clear();
@ -824,47 +871,47 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region RHM debug #region RHM debug
//#if DEBUG //#if DEBUG
// // The following code generates an XML output for the selected item for print testing. // // The following code generates an XML output for the selected item for print testing.
// private void btnPageBreak_Click(object sender, EventArgs e) // private void btnPageBreak_Click(object sender, EventArgs e)
// { // {
// // This is here temporarily to get a node and all of it's children for print testing. // // This is here temporarily to get a node and all of it's children for print testing.
// OutputAllChildren(MyRTBItem); // OutputAllChildren(MyRTBItem);
// } // }
// private void OutputAllChildren(RTBItem myRTBItem) // private void OutputAllChildren(RTBItem myRTBItem)
// { // {
// OutputAllChildren(myRTBItem.MyBeforeRTBItems); // OutputAllChildren(myRTBItem.MyBeforeRTBItems);
// OutputStepInfo(myRTBItem); // OutputStepInfo(myRTBItem);
// OutputAllChildren(myRTBItem.MyAfterRTBItems); // OutputAllChildren(myRTBItem.MyAfterRTBItems);
// OutputAllChildren(myRTBItem.MyRNORTBItems); // OutputAllChildren(myRTBItem.MyRNORTBItems);
// } // }
// private void OutputStepInfo(RTBItem myRTBItem) // private void OutputStepInfo(RTBItem myRTBItem)
// { // {
// Label lbl = myRTBItem.MyLabel; // Label lbl = myRTBItem.MyLabel;
// if (lbl.Text.Trim() != "") // if (lbl.Text.Trim() != "")
// Console.WriteLine("<text x='{0}In' y='{1}In' font-family='{2}' font-size='{3}Pt'>{4}</text>", // Console.WriteLine("<text x='{0}In' y='{1}In' font-family='{2}' font-size='{3}Pt'>{4}</text>",
// ToInches(myRTBItem.Left + lbl.Left), ToInches(myRTBItem.Top + lbl.Top), // ToInches(myRTBItem.Left + lbl.Left), ToInches(myRTBItem.Top + lbl.Top),
// lbl.Font.FontFamily.Name,lbl.Font.SizeInPoints,lbl.Text); // lbl.Font.FontFamily.Name,lbl.Font.SizeInPoints,lbl.Text);
// StepRTB rtb = myRTBItem.MyStepRTB; // StepRTB rtb = myRTBItem.MyStepRTB;
// Console.WriteLine("<foreignObject x='{0}In' y='{1}In' width='{2}In' " + // Console.WriteLine("<foreignObject x='{0}In' y='{1}In' width='{2}In' " +
// "requiredExtensions='http://Volian.Com/EmbeddedRTF'>{3}</foreignObject>", // "requiredExtensions='http://Volian.Com/EmbeddedRTF'>{3}</foreignObject>",
// ToInches(myRTBItem.Left + rtb.Left), ToInches(myRTBItem.Top + rtb.Top), ToInches(rtb.Width), myRTBItem.MyItemInfo.MyContent.Text); // ToInches(myRTBItem.Left + rtb.Left), ToInches(myRTBItem.Top + rtb.Top), ToInches(rtb.Width), myRTBItem.MyItemInfo.MyContent.Text);
//// ToInches(myRTBItem.Left + rtb.Left), ToInches(myRTBItem.Top + rtb.Top), ToInches(rtb.Width), rtb.Rtf); //// ToInches(myRTBItem.Left + rtb.Left), ToInches(myRTBItem.Top + rtb.Top), ToInches(rtb.Width), rtb.Rtf);
// } // }
// private float ToInches(int val) // private float ToInches(int val)
// { // {
// return Convert.ToSingle(val)/96F; // return Convert.ToSingle(val)/96F;
// } // }
// private void OutputAllChildren(List<RTBItem> list) // private void OutputAllChildren(List<RTBItem> list)
// { // {
// if(list != null) // if(list != null)
// foreach (RTBItem itm in list) // foreach (RTBItem itm in list)
// OutputAllChildren(itm); // OutputAllChildren(itm);
// } // }
//#endif //#endif
private void btnToggleEditView_Click(object sender, EventArgs e) private void btnToggleEditView_Click(object sender, EventArgs e)
{ {
MyEditItem.MyStepPanel.VwMode = MyEditItem.MyStepPanel.VwMode == E_ViewMode.Edit ? E_ViewMode.View : E_ViewMode.Edit; MyEditItem.MyStepPanel.VwMode = MyEditItem.MyStepPanel.VwMode == E_ViewMode.Edit ? E_ViewMode.View : E_ViewMode.Edit;
@ -884,7 +931,7 @@ namespace Volian.Controls.Library
MessageBox.Show("Could not find path to Ro Editor, check 'roapp' environment variable"); MessageBox.Show("Could not find path to Ro Editor, check 'roapp' environment variable");
return; return;
} }
if (MyDVI==null||MyDVI.DocVersionAssociationCount < 1) if (MyDVI == null || MyDVI.DocVersionAssociationCount < 1)
{ {
MessageBox.Show("Could not find associated path for ro data."); MessageBox.Show("Could not find associated path for ro data.");
return; return;
@ -1067,7 +1114,7 @@ namespace Volian.Controls.Library
if (!si.IsStepSection) if (!si.IsStepSection)
{ {
WordSectionEventArgs args = new WordSectionEventArgs(si); WordSectionEventArgs args = new WordSectionEventArgs(si);
MyEditItem.MyStepPanel.OnWordSectionDeleted(sender, args); MyEditItem.MyStepPanel.OnWordSectionDeleted(sender, args);
} }
} }
return; return;
@ -1227,8 +1274,8 @@ namespace Volian.Controls.Library
if (MyItemInfo.IsHigh) if (MyItemInfo.IsHigh)
{ {
if (MyEditItem != null && MyEditItem.NextDownEditItem != null && MyEditItem.NextDownEditItem.MyItemInfo.MyParent.Equals(MyEditItem.MyItemInfo)) if (MyEditItem != null && MyEditItem.NextDownEditItem != null && MyEditItem.NextDownEditItem.MyItemInfo.MyParent.Equals(MyEditItem.MyItemInfo))
//if (MyRTBItem.NextDownRTBItem.MyItemInfo.MyParent.ItemID == MyRTBItem.MyItemInfo.ItemID) //.Equals(MyRTBItem.MyItemInfo)) //if (MyRTBItem.NextDownRTBItem.MyItemInfo.MyParent.ItemID == MyRTBItem.MyItemInfo.ItemID) //.Equals(MyRTBItem.MyItemInfo))
{ {
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown); MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown);
InsertSiblingBeforeOrAfter("before"); InsertSiblingBeforeOrAfter("before");
} }
@ -1307,7 +1354,7 @@ namespace Volian.Controls.Library
if (nextDownEditItem != null && nextDownEditItem.MyItemInfo.MyParent.ItemID == MyEditItem.MyID) if (nextDownEditItem != null && nextDownEditItem.MyItemInfo.MyParent.ItemID == MyEditItem.MyID)
{ {
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown); MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown);
if(skipTable) MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown); if (skipTable) MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown);
InsertSiblingBeforeOrAfter("before"); InsertSiblingBeforeOrAfter("before");
} }
else else
@ -1369,7 +1416,7 @@ namespace Volian.Controls.Library
private void btnPasteReplace_Click(object sender, EventArgs e) private void btnPasteReplace_Click(object sender, EventArgs e)
{ {
StepTabPanel tmp = Parent as StepTabPanel; StepTabPanel tmp = Parent as StepTabPanel;
if (tmp.MyDisplayTabControl.MyCopyStep==null) return; if (tmp.MyDisplayTabControl.MyCopyStep == null) return;
EditItem oldEditItem = MyEditItem; EditItem oldEditItem = MyEditItem;
MyEditItem = MyEditItem.PasteReplace(tmp.MyDisplayTabControl.MyCopyStep.ItemID); MyEditItem = MyEditItem.PasteReplace(tmp.MyDisplayTabControl.MyCopyStep.ItemID);
if (MyEditItem.MyItemInfo.ItemID != oldEditItem.MyItemInfo.ItemID) oldEditItem.Dispose(); if (MyEditItem.MyItemInfo.ItemID != oldEditItem.MyItemInfo.ItemID) oldEditItem.Dispose();
@ -1447,13 +1494,13 @@ namespace Volian.Controls.Library
MyFlexGrid.ClipBoardCopySelection(); MyFlexGrid.ClipBoardCopySelection();
} }
private void btnTblDgnPasteRowBefore_Click(object sender, EventArgs e) private void btnTblDgnPasteRowAbove_Click(object sender, EventArgs e)
{ {
// create new rows before current position and copy clipboard data // create new rows before current position and copy clipboard data
MyFlexGrid.ClipBoardPasteRows(VlnFlexGrid.enmPastePos.Before); MyFlexGrid.ClipBoardPasteRows(VlnFlexGrid.enmPastePos.Before);
} }
private void btnTblDgnPasteRowAfter_Click(object sender, EventArgs e) private void btnTblDgnPasteRowBelow_Click(object sender, EventArgs e)
{ {
// create new rows after current position and copy clipboard data // create new rows after current position and copy clipboard data
MyFlexGrid.ClipBoardPasteRows(VlnFlexGrid.enmPastePos.After); MyFlexGrid.ClipBoardPasteRows(VlnFlexGrid.enmPastePos.After);
@ -1465,12 +1512,12 @@ namespace Volian.Controls.Library
MyFlexGrid.ClipBoardPasteRows(VlnFlexGrid.enmPastePos.Replace); MyFlexGrid.ClipBoardPasteRows(VlnFlexGrid.enmPastePos.Replace);
} }
private void btnTblDgnPasteColumnBefore_Click(object sender, EventArgs e) private void btnTblDgnPasteColumnLeft_Click(object sender, EventArgs e)
{ {
MyFlexGrid.ClipBoardPasteColumns(VlnFlexGrid.enmPastePos.Before); MyFlexGrid.ClipBoardPasteColumns(VlnFlexGrid.enmPastePos.Before);
} }
private void btnTblDgnPasteColumnAfter_Click(object sender, EventArgs e) private void btnTblDgnPasteColumnRight_Click(object sender, EventArgs e)
{ {
MyFlexGrid.ClipBoardPasteColumns(VlnFlexGrid.enmPastePos.After); MyFlexGrid.ClipBoardPasteColumns(VlnFlexGrid.enmPastePos.After);
} }
@ -1484,50 +1531,96 @@ namespace Volian.Controls.Library
{ {
MyFlexGrid.ClipBoardPasteIntoSelection(); MyFlexGrid.ClipBoardPasteIntoSelection();
} }
private void btnTblDgnClear_Click(object sender, EventArgs e)
{
MyFlexGrid.ClearSelectedCellText();
}
#endregion #endregion
#region Table Grid Delete #region Table Grid Delete
private void btnTblDgnDeleteRow_Click(object sender, EventArgs e) private void btnTblDgnRemoveRow_Click(object sender, EventArgs e)
{ {
MyFlexGrid.RemoveSelectedRow(); MyFlexGrid.RemoveSelectedRow();
} }
private void btnTblDgnDeleteColumn_Click(object sender, EventArgs e) private void btnTblDgnRemoveColumn_Click(object sender, EventArgs e)
{ {
MyFlexGrid.RemoveSelectedColumn(); MyFlexGrid.RemoveSelectedColumn();
} }
private void btnTblDgnDeleteSelected_Click(object sender, EventArgs e)
{
MyFlexGrid.RemoveSelectedCells();
}
#endregion #endregion
#region Table Grid Cell Style #region Table Grid Cell Style
private void cpHighlight_SelectedColorChanged(object sender, EventArgs e) //private void cpHighlight_SelectedColorChanged(object sender, EventArgs e)
{ //{
string strColor = string.Format("{0}, {1}, {2};", cpTblDgnHighlight.SelectedColor.R, cpTblDgnHighlight.SelectedColor.G, cpTblDgnHighlight.SelectedColor.B); // string strColor = string.Format("{0}, {1}, {2};", cpTblDgnHighlight.SelectedColor.R, cpTblDgnHighlight.SelectedColor.G, cpTblDgnHighlight.SelectedColor.B);
MyFlexGrid.ChangeBackgroundColor(strColor); // MyFlexGrid.ChangeBackgroundColor(strColor);
} //}
private void btnTblDgnAlignLeft_Click(object sender, EventArgs e) private void btnTblDgnAlgnTxTopLeft_Click(object sender, EventArgs e)
{ {
MyFlexGrid.VerticalTopText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left); MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left);
} }
private void btnTblDgnAlignCentered_Click(object sender, EventArgs e) private void btnTblDgnAlgnTxTopCenter_Click(object sender, EventArgs e)
{ {
MyFlexGrid.VerticalTopText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center); MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center);
} }
private void btnTblDgnAlignRight_Click(object sender, EventArgs e) private void btnTblDgnAlgnTxTopRight_Click(object sender, EventArgs e)
{ {
MyFlexGrid.VerticalTopText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right); MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right);
} }
private void btnTblDgnAlgnTxCenterLeft_Click(object sender, EventArgs e)
{
MyFlexGrid.VerticalCenterText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left);
}
private void btnTblDgnAlgnTxCenterCenter_Click(object sender, EventArgs e)
{
MyFlexGrid.VerticalCenterText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center);
}
private void btnTblDgnAlgnTxCenterRight_Click(object sender, EventArgs e)
{
MyFlexGrid.VerticalCenterText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right);
}
private void btnTblDgnAlgnTxBottomLeft_Click(object sender, EventArgs e)
{
MyFlexGrid.VerticalBottomText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left);
}
private void btnTblDgnAlgnTxBottomCenter_Click(object sender, EventArgs e)
{
MyFlexGrid.VerticalBottomText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center);
}
private void btnTblDgnAlgnTxBottomRight_Click(object sender, EventArgs e)
{
MyFlexGrid.VerticalBottomText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right);
}
//private void btnTblDgnAlignLeft_Click(object sender, EventArgs e)
//{
// MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left);
//}
//private void btnTblDgnAlignCentered_Click(object sender, EventArgs e)
//{
// MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center);
//}
//private void btnTblDgnAlignRight_Click(object sender, EventArgs e)
//{
// MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right);
//}
#endregion #endregion
#region Table Grid Merge/Split #region Table Grid Merge/Split
private void btnTblDgnSplitCells_ToRows_Click(object sender, EventArgs e) private void btnTblDgnSplitCells_ToRows_Click(object sender, EventArgs e)
@ -1547,41 +1640,56 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region Table Grid Design #region Table Grid Design
private void btnTblDgnInsertRowBefore_Click(object sender, EventArgs e) private void btnTblDgnInsertRowAbove_Click(object sender, EventArgs e)
{ {
MyFlexGrid.InsertRowBefore(); MyFlexGrid.InsertRowBefore();
} }
private void btnTblDgnInsertRowAfter_Click(object sender, EventArgs e) private void btnTblDgnInsertRowBelow_Click(object sender, EventArgs e)
{ {
MyFlexGrid.InsertRowAfter(); MyFlexGrid.InsertRowAfter();
} }
private void btnTblDgnInsertColumnBefore_Click(object sender, EventArgs e) private void btnTblDgnInsertColumnAbove_Click(object sender, EventArgs e)
{ {
MyFlexGrid.InsertColumnBefore(); MyFlexGrid.InsertColumnBefore();
} }
private void btnTblDgnInsertColumnAfter_Click(object sender, EventArgs e) private void btnTblDgnInsertColumnBelow_Click(object sender, EventArgs e)
{ {
MyFlexGrid.InsertColumnAfter(); MyFlexGrid.InsertColumnAfter();
} }
private void ToggleTableDesignButtons(bool enable) public void ToggleTableDesignButtons(bool enable)
{ {
cpTblDgnHighlight.Enabled = enable;
btnTblDgnAlignText.Enabled = enable; btnTblDgnAlignText.Enabled = enable;
btnTblDgnClear.Enabled = enable;
btnTblDgnCopy.Enabled = enable; btnTblDgnCopy.Enabled = enable;
btnTblDgnDelete.Enabled = enable; btnTblDgnRemove.Enabled = enable;
btnTblDgnGridStyle.Enabled = enable; btnTblDgnGridStyle.Enabled = enable;
btnTblDgnInsertColumn.Enabled = enable; btnTblDgnInsertColumn.Enabled = enable;
btnTblDgnInsertRow.Enabled = enable; btnTblDgnInsertRow.Enabled = enable;
btnTblDgnMergeCells.Enabled = enable; btnTblDgnMergeCells.Enabled = enable;
btnTblDgnPaste.Enabled = enable; btnTblDgnPaste.Enabled = enable;
btnTblDgnSplitCells.Enabled = enable; btnTblDgnSplitCells.Enabled = enable;
btnTblDgnTableBorder.Enabled = enable; }
btnTblDgnAdjustSize.Checked = !enable; public void SetRibbonForGrid()
{
// set to true if editing cell, otherwise false for grids
bool enable = (MyFlexGrid.Editor != null);
btnPaste.Enabled = enable;
btnCopy.Enabled = enable;
btnCut.Enabled = enable;
btnBold.Enabled = enable;
btnItalics.Enabled = enable;
btnUnderline.Enabled = enable;
btnSubscript.Enabled = enable;
btnSuperscript.Enabled = enable;
btnChgCase.Enabled = enable;
btnInsHrdSpc.Enabled = enable;
btnSymbols.Enabled = enable;
btnIndent.Enabled = enable;
btnInsTrans.Enabled = enable;
btnInsRO.Enabled = enable;
} }
private void btnTblDgnAdjustSize_Click(object sender, EventArgs e) private void btnTblDgnAdjustSize_Click(object sender, EventArgs e)
{ {
@ -1634,7 +1742,6 @@ namespace Volian.Controls.Library
private void btnTblDgnGridStyleNone_Click(object sender, EventArgs e) private void btnTblDgnGridStyleNone_Click(object sender, EventArgs e)
{ {
MyFlexGrid.ChangeCellBorder(MyFlexGrid.Selection, C1.Win.C1FlexGrid.BorderStyleEnum.None); MyFlexGrid.ChangeCellBorder(MyFlexGrid.Selection, C1.Win.C1FlexGrid.BorderStyleEnum.None);
} }
private void btnTblDgnGridStyleFlat_Click(object sender, EventArgs e) private void btnTblDgnGridStyleFlat_Click(object sender, EventArgs e)
@ -1673,75 +1780,10 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
private void btnTblDgnDeleteRow_Click_1(object sender, EventArgs e)
{
MyFlexGrid.RemoveSelectedRow();
}
private void btnTblDgnDeleteColumn_Click_1(object sender, EventArgs e)
{
MyFlexGrid.RemoveSelectedColumn();
}
private void btnTblDgnDeleteSelected_Click_1(object sender, EventArgs e)
{
MyFlexGrid.RemoveSelectedCells();
}
private void btnTblDgnAlgnTxTopLeft_Click(object sender, EventArgs e)
{
MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.LeftTop);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left);
}
private void btnTblDgnAlgnTxTopCenter_Click(object sender, EventArgs e)
{
MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.CenterTop);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center);
}
private void btnTblDgnAlgnTxTopRight_Click(object sender, EventArgs e)
{
MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.RightTop);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right);
}
private void btnTblDgnAlgnTxCenterLeft_Click(object sender, EventArgs e)
{
MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.LeftCenter);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left);
}
private void btnTblDgnAlgnTxCenterCenter_Click(object sender, EventArgs e)
{
MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.CenterCenter);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center);
}
private void btnTblDgnAlgnTxCenterRight_Click(object sender, EventArgs e)
{
MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.RightCenter);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right);
}
private void btnTblDgnAlgnTxBottomLeft_Click(object sender, EventArgs e)
{
MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.LeftBottom);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left);
}
private void btnTblDgnAlgnTxBottomCenter_Click(object sender, EventArgs e)
{
MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.CenterBottom);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center);
}
private void btnTblDgnAlgnTxBottomRight_Click(object sender, EventArgs e)
{
MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.RightBottom);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right);
}
} }
public enum E_FieldToEdit { StepText, Text, Number }; public enum E_FieldToEdit { StepText, Text, Number };
public class StepTabRibbonEventArgs : EventArgs public class StepTabRibbonEventArgs : EventArgs
{ {
@ -1759,5 +1801,5 @@ namespace Volian.Controls.Library
} }
} }
public delegate void StepTabRibbonEvent(object sender, StepTabRibbonEventArgs args); public delegate void StepTabRibbonEvent(object sender, StepTabRibbonEventArgs args);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -129,6 +129,10 @@ namespace Volian.Controls.Library
{ {
_DPI = value; _DPI = value;
} }
//if (value == 120)
// Console.WriteLine("Test");
// if(!(TableCellEditor is StepRTB))
// Console.WriteLine("{0}",TableCellEditor.GetType().Name);
} }
} }
#region Grid Initialize #region Grid Initialize
@ -1585,8 +1589,8 @@ namespace Volian.Controls.Library
public void ClearSelectedCellText() public void ClearSelectedCellText()
{ {
CellRange cr = this.Selection; CellRange cr = this.Selection;
DialogResult dr = MessageBox.Show("Clear Selected cells?", "Clear", MessageBoxButtons.YesNo); //DialogResult dr = MessageBox.Show("Clear Selected cells?", "Clear", MessageBoxButtons.YesNo);
if (dr == DialogResult.Yes) //if (dr == DialogResult.Yes)
cr.Clear(ClearFlags.Content); cr.Clear(ClearFlags.Content);
} }
public void SetupCellUserData() public void SetupCellUserData()
@ -1616,7 +1620,11 @@ namespace Volian.Controls.Library
this.MergedRanges.Add(this.Selection); this.MergedRanges.Add(this.Selection);
this.Invalidate(); this.Invalidate();
} }
public bool IsInMergeRange()
{
C1.Win.C1FlexGrid.CellRange sel = GetMergedRange(this.Selection.r1, this.Selection.c1);
return MergedRanges.Contains(sel);
}
public void SplitSelection(bool bSplitCols) public void SplitSelection(bool bSplitCols)
{ {
C1.Win.C1FlexGrid.CellRange sel = this.GetMergedRange(this.Selection.r1, this.Selection.c1); C1.Win.C1FlexGrid.CellRange sel = this.GetMergedRange(this.Selection.r1, this.Selection.c1);
@ -1772,7 +1780,10 @@ namespace Volian.Controls.Library
} }
this.MergedRanges.Clear(); this.MergedRanges.Clear();
foreach (CellRange r in crc) foreach (CellRange r in crc)
this.MergedRanges.Add(r); {
if ((r.r1 != r.r2) || (r.c1 != r.c2))
this.MergedRanges.Add(r);
}
} }
private void AdjustMergedColumns(int col, bool left, bool removing) private void AdjustMergedColumns(int col, bool left, bool removing)
@ -1839,7 +1850,10 @@ namespace Volian.Controls.Library
} }
this.MergedRanges.Clear(); this.MergedRanges.Clear();
foreach (CellRange r in crc) foreach (CellRange r in crc)
{
if ((r.r1 != r.r2) || (r.c1 != r.c2))
this.MergedRanges.Add(r); this.MergedRanges.Add(r);
}
} }
private bool RowIsInMergeRange(int row) private bool RowIsInMergeRange(int row)
@ -1866,9 +1880,9 @@ namespace Volian.Controls.Library
if (col >= 0) if (col >= 0)
{ {
CellRange cr = this.Selection; CellRange cr = this.Selection;
rtn = true; //rtn = true;
int r = cr.r1; int r = cr.r1;
while (rtn && (r <= cr.r2)) while (!rtn && (r <= cr.r2))
{ {
int idx = this.MergedRanges.IndexOf(col, r); int idx = this.MergedRanges.IndexOf(col, r);
rtn = (idx > -1); rtn = (idx > -1);
@ -1969,67 +1983,113 @@ namespace Volian.Controls.Library
public void RemoveSelectedColumn() public void RemoveSelectedColumn()
{ {
this.SelectionMode = SelectionModeEnum.Column; string msg = "";
this.Select(this.Selection.r1, this.Selection.c1); string title = "";
DialogResult dr = MessageBox.Show("Remove this column?", "Remove Column", MessageBoxButtons.YesNo); CellRange saveCR = Selection;
if (dr == DialogResult.Yes) this.SelectionMode = SelectionModeEnum.ColumnRange;
RemoveColumns(this.Selection.r1, this.Selection.c1, 1); //this.Select(this.Selection.r1, this.Selection.c1);
this.Select(0,Selection.c1,Rows.Count-1,Selection.c2);
this.SelectionMode = SelectionModeEnum.Default; this.SelectionMode = SelectionModeEnum.Default;
if (Selection.c1 != Selection.c2)
{
msg = "Remove selected columns?";
title = "Delete Columns";
}
else
{
msg = "Remove this column?";
title = "Delete Column";
}
DialogResult dr = MessageBox.Show(msg, title, MessageBoxButtons.YesNo);
if (dr == DialogResult.Yes)
RemoveSelectedCells();//RemoveColumns(this.Selection.r1, this.Selection.c1, 1);
else
Select(saveCR);
} }
public void RemoveSelectedRow() public void RemoveSelectedRow()
{ {
this.SelectionMode = SelectionModeEnum.Row; string msg = "";
this.Select(this.Selection.r1, this.Selection.c1); string title = "";
DialogResult dr = MessageBox.Show("Remove this Row?", "Remove Row", MessageBoxButtons.YesNo); CellRange saveCR = Selection;
if (dr == DialogResult.Yes) this.SelectionMode = SelectionModeEnum.RowRange;
this.RemoveRows(this.Selection.r1, this.Selection.c1, 1); //this.Select(this.Selection.r1, this.Selection.c1,);
this.Select(Selection.r1,0,Selection.r2,Cols.Count-1);
this.SelectionMode = SelectionModeEnum.Default; this.SelectionMode = SelectionModeEnum.Default;
if (Selection.r1 != Selection.r2)
{
msg = "Remove selected rows?";
title = "Delete Rows";
}
else
{
msg = "Remove this row?";
title = "Delete Row";
}
DialogResult dr = MessageBox.Show(msg, title, MessageBoxButtons.YesNo);
if (dr == DialogResult.Yes)
this.RemoveSelectedCells();//this.RemoveRows(this.Selection.r1, this.Selection.c1, 1);
else
Select(saveCR);
} }
private void RemoveRows(int strow, int stcol, int cnt) private void RemoveRows(int strow, int stcol, int cnt)
{ {
bool mergedRow = false;
for (int i = 0; i < cnt; i++) for (int i = 0; i < cnt; i++)
{ {
if (this.RowIsInMergeRange(strow)) //if (this.RowIsInMergeRange(strow))
{ //{
for (int cl = 0; cl < this.Cols.Count; cl++) for (int cl = 0; cl < this.Cols.Count && !mergedRow; cl++)
{ {
int idx = this.MergedRanges.IndexOf(strow, cl); int idx = this.MergedRanges.IndexOf(strow, cl);
if (idx > -1) if (idx > -1)
{ {
CellRange cr = this.MergedRanges[idx]; CellRange cr = this.MergedRanges[idx];
if (cr.r1 < cr.r2) if (cr.r1 < cr.r2)
this[cr.r1 + 1, cr.c1] = this[cr.r1, cr.c1]; mergedRow = true;
//this[cr.r1 + 1, cr.c1] = this[cr.r1, cr.c1];
} }
cl++; cl++;
} }
} //}
this.Rows.Remove(strow); this.Rows.Remove(strow);
this.AdjustMergedRows(strow, false, true); this.AdjustMergedRows(strow, false, true);
if (mergedRow)
{
cnt++;
mergedRow = false;
}
} }
this.AdjustGridControlSize(); this.AdjustGridControlSize();
} }
private void RemoveColumns(int strow, int stcol, int cnt) private void RemoveColumns(int strow, int stcol, int cnt)
{ {
bool mergedCol = false;
for (int i = 0; i < cnt; i++) for (int i = 0; i < cnt; i++)
{ {
if (this.ColIsInMergeRange(stcol)) //if (this.ColIsInMergeRange(stcol))
{ //{
for (int rw = 0; rw < this.Rows.Count; rw++) for (int rw = 0; rw < this.Rows.Count && !mergedCol; rw++)
{ {
int idx = this.MergedRanges.IndexOf(rw, stcol); int idx = this.MergedRanges.IndexOf(rw, stcol);
if (idx > -1) if (idx > -1)
{ {
CellRange cr = this.MergedRanges[idx]; CellRange cr = this.MergedRanges[idx];
if (cr.c1 < cr.c2) if (cr.c1 < cr.c2)
this[cr.r1, cr.c1 + 1] = this[cr.r1, cr.c1]; mergedCol = true;
//this[cr.r1, cr.c1 + 1] = this[cr.r1, cr.c1];
} }
} }
} //}
this.Cols.Remove(stcol); this.Cols.Remove(stcol);
this.AdjustMergedColumns(stcol, false, true); this.AdjustMergedColumns(stcol, false, true);
if (mergedCol)
{
cnt++;
mergedCol = false;
}
} }
this.AdjustGridControlSize(); this.AdjustGridControlSize();
} }

View File

@ -76,10 +76,10 @@ namespace Volian.Print.Library
} }
#endregion #endregion
#region Public Methods #region Public Methods
public void AdjustRowTop(int row, float hNew) public void AdjustRowTop(int row1, int row2, float hNew)
{ {
float hAdjust = hNew - (RowTop[row + 1] - RowTop[row]); float hAdjust = hNew - (RowTop[row2 + 1] - RowTop[row1]);
for (int r = row; r < MyFlexGrid.Rows.Count; r++) for (int r = row2; r < MyFlexGrid.Rows.Count; r++)
RowTop[r + 1] += hAdjust; RowTop[r + 1] += hAdjust;
} }
public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top) public void ToPdf(iTextSharp.text.pdf.ColumnText myColumnText, float left, float top)
@ -147,7 +147,7 @@ namespace Volian.Print.Library
str = myRTB.Rtf; str = myRTB.Rtf;
} }
iTextSharp.text.Paragraph myPara = RtfToParagraph(str); iTextSharp.text.Paragraph myPara = RtfToParagraph(str);
myColumnText1.SetSimpleColumn(0, 0, w - 4, MyContentByte.PdfDocument.PageSize.Top); // Padding = 4 myColumnText1.SetSimpleColumn(0, 0, w - 2, MyContentByte.PdfDocument.PageSize.Top); // Padding = 4
myPara.MultipliedLeading = 1.2F; myPara.MultipliedLeading = 1.2F;
myColumnText1.AddElement(myPara); myColumnText1.AddElement(myPara);
//myColumnText1.Canvas.SetColorFill(iTextSharp.text.BaseColor.RED); //myColumnText1.Canvas.SetColorFill(iTextSharp.text.BaseColor.RED);
@ -156,7 +156,7 @@ namespace Volian.Print.Library
float posAfter = myColumnText1.YLine; float posAfter = myColumnText1.YLine;
float hContent = 4 + posBefore - posAfter; float hContent = 4 + posBefore - posAfter;
if (hContent > h) if (hContent > h)
MyTable.AdjustRowTop(cr.r2, hContent); MyTable.AdjustRowTop(cr.r1, cr.r2, hContent);
Add(new vlnCell(cr.r1, cr.c1, cr.r2, cr.c2, MyTable, myPara, hContent)); Add(new vlnCell(cr.r1, cr.c1, cr.r2, cr.c2, MyTable, myPara, hContent));
} }
} }
@ -290,7 +290,7 @@ namespace Volian.Print.Library
} }
} }
iTextSharp.text.pdf.ColumnText myColumnText1 = new iTextSharp.text.pdf.ColumnText(myColumnText.Canvas); iTextSharp.text.pdf.ColumnText myColumnText1 = new iTextSharp.text.pdf.ColumnText(myColumnText.Canvas);
myColumnText1.SetSimpleColumn(2 + left + x, top - y - h, left + x + w - 2, -1 + top - y - hAdjust); // 2 == Default Padding myColumnText1.SetSimpleColumn(1 + left + x, top - y - h, left + x + w, 1 + top - y - hAdjust); // 2 == Default Padding
myColumnText1.AddElement(MyPara); myColumnText1.AddElement(MyPara);
myColumnText1.Go(); myColumnText1.Go();
myColumnText.Canvas.RestoreState(); myColumnText.Canvas.RestoreState();