From 526214e0b5b4eb7de8ef8a37c462b033f4796d57 Mon Sep 17 00:00:00 2001 From: Rich Date: Wed, 2 Mar 2016 21:03:08 +0000 Subject: [PATCH] Don't Change Selection if the mouse is down. Don't hide the grid tools for RO Tables Disable individual methods for RO Tables on the Grid Tool Ribbon and Context Menu (Copy, Paste, Insert, Remove) Don;t allow edit mode if IsRoTable. --- PROMS/Volian.Controls.Library/StepRTB.cs | 2 ++ PROMS/Volian.Controls.Library/StepTabRibbon.cs | 17 +++++++++++------ PROMS/Volian.Controls.Library/VlnFlexGrid.cs | 3 ++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index f99973d3..078c7691 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -834,6 +834,7 @@ namespace Volian.Controls.Library OnSetMenu(this, new StepRTBMenuEventArgs(inPsi?"PSI":"OpenContextMenu")); _ContextMenuStripChanged = false; CorrectSelectionAtEndOfLine(); + _MouseDown = true; } void StepRTB_MouseUp(object sender, MouseEventArgs e) { @@ -1512,6 +1513,7 @@ namespace Volian.Controls.Library } private void HandleSelectionChange() { + if (_MouseDown) return; if (_HandlingCtrlA) return; if (!_HandlingCtrlA && this.TextLength == this.SelectionLength && this.SelectedRtf.EndsWith("\\par\r\n}\r\n")) { diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index 367e6261..2fb5d425 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -1292,7 +1292,7 @@ namespace Volian.Controls.Library btnTblDgnAdjustSize.Checked = false; ToggleTableDesignButtons(true); } - rtabTableGridTools.Visible = tmpGridItm != null && !tmpGridItm.MyFlexGrid.IsRoTable; + rtabTableGridTools.Visible = tmpGridItm != null; // 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)) // || ((MyEditItem is GridItem) && !rtabTableGridTools.Visible)) @@ -3030,9 +3030,14 @@ namespace Volian.Controls.Library public void ToggleTableDesignButtons(bool enable) { + bool enableContent = enable; + if (MyFlexGrid != null && MyFlexGrid.IsRoTable) enableContent = false; btnTblDgnAlignText.Enabled = enable; - btnTblDgnCopy.Enabled = enable; - btnTblDgnRemove.Enabled = enable; + btnTblDgnCopy.Enabled = enableContent; + btnTblDgnRemove.Enabled = enableContent; + btnCmGridInsert.Enabled = enableContent; + btnCmGridCopy.Enabled = enableContent; + btnCmGridRemove.Enabled = enableContent; //btnTblDgnGridStyle.Enabled = enable; //rbTblBorder.Enabled = enable; rbnBorderlistBox.Enabled = enable; @@ -3040,11 +3045,11 @@ namespace Volian.Controls.Library btnTblNoBorder.Enabled = enable; btnTblOutline.Enabled = enable; btnTblInside.Enabled = enable; - btnTblDgnInsertColumn.Enabled = enable; - btnTblDgnInsertRow.Enabled = enable; + btnTblDgnInsertColumn.Enabled = enableContent; + btnTblDgnInsertRow.Enabled = enableContent; btnTblDgnMergeCells.Enabled = enable; btnCmGridPaste.Enabled = - btnTblDgnPaste.Enabled = ((VlnFlexGrid.MyCopyInfo.MyCopiedFlexGrid != null) && enable); + btnTblDgnPaste.Enabled = ((VlnFlexGrid.MyCopyInfo.MyCopiedFlexGrid != null) && enableContent); btnTblDgnSplitCells.Enabled = enable; } public void SetRibbonForGridCellIndent() diff --git a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs index f0cd37b6..1a0045d7 100644 --- a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs +++ b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs @@ -2412,7 +2412,8 @@ namespace Volian.Controls.Library private void _StartEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { // start editing the cell with the custom editor - _tableCellEditor.StartEditing(e.Row, e.Col); + if(!IsRoTable ) + _tableCellEditor.StartEditing(e.Row, e.Col); e.Cancel = true; }