/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:DiffViewWrapper"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="parent">The parent object.</param> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="currentDraft">The current draft.</param> /// <param name="revisionDraft">The revision draft.</param> /// <param name="currentFootnote">The current footnote.</param> /// <param name="revisionFootnote">The revision footnote.</param> /// <param name="otherControls">A TableLayoutPanel that contains the controls to show /// as labels and buttons above and below the current and revision views.</param> /// ------------------------------------------------------------------------------------ public DiffViewWrapper(string name, Control parent, FdoCache cache, IVwStylesheet styleSheet, DiffViewScrProxy currentDraft, DiffViewScrProxy revisionDraft, DiffViewFootnoteProxy currentFootnote, DiffViewFootnoteProxy revisionFootnote, TableLayoutPanel otherControls) : base(cache, styleSheet, 4, 2) { Dock = DockStyle.Fill; Name = name; Parent = parent; Padding = otherControls.Padding; // Add the labels at the top AddControl(null, kLabelRow, kRevisionColumn, new FixedControlProxy( otherControls.GetControlFromPosition(kRevisionColumn, kLabelRow))); AddControl(null, kLabelRow, kCurrentColumn, new FixedControlProxy( otherControls.GetControlFromPosition(kCurrentColumn, kLabelRow))); // Add the views AddControl(null, kDraftRow, kRevisionColumn, revisionDraft, false, true); AddControl(null, kDraftRow, kCurrentColumn, currentDraft, true, true); AddControl(null, kFootnoteRow, kRevisionColumn, revisionFootnote, false, true); AddControl(null, kFootnoteRow, kCurrentColumn, currentFootnote, false, true); // Add the buttons below the views AddControl(null, kButtonRow, kRevisionColumn, new FixedControlProxy( otherControls.GetControlFromPosition(kRevisionColumn, kButtonRow))); AddControl(null, kButtonRow, kCurrentColumn, new FixedControlProxy( otherControls.GetControlFromPosition(kCurrentColumn, kButtonRow))); // Set properties on the rows // We have to set the desired height first because this resets the visible // state - strange. GetRow(kLabelRow).MinimumHeight = otherControls.GetControlFromPosition(kRevisionColumn, kLabelRow).Height; GetRow(kButtonRow).MinimumHeight = otherControls.GetControlFromPosition(kRevisionColumn, kButtonRow).Height; DataGridViewControlRow row = GetRow(kLabelRow); row.Visible = true; row.Resizable = DataGridViewTriState.False; row.IsAutoFill = false; DataGridViewAdvancedBorderStyle noBorder = new DataGridViewAdvancedBorderStyle(); noBorder.All = DataGridViewAdvancedCellBorderStyle.None; row.AdvancedBorderStyle = noBorder; row = GetRow(kDraftRow); row.Visible = true; row = GetRow(kFootnoteRow); row.FillWeight = 18; // 30% row.Visible = false; row = GetRow(kButtonRow); row.Visible = true; row.Resizable = DataGridViewTriState.False; row.IsAutoFill = false; row.AdvancedBorderStyle = noBorder; // Set properties on the two columns DataGridViewControlColumn column = GetColumn(kRevisionColumn); column.MinimumWidth = 220; column.Visible = true; column.FillWeight = 100; column.Name = "RevisionColumn"; column = GetColumn(kCurrentColumn); column.MinimumWidth = 315; column.Visible = true; column.FillWeight = 100; column.Name = "CurrentColumn"; }
public DiffViewWrapper(string name, Control parent, FdoCache cache, IVwStylesheet styleSheet, DiffViewScrProxy currentDraft, DiffViewScrProxy revisionDraft, DiffViewFootnoteProxy currentFootnote, DiffViewFootnoteProxy revisionFootnote, TableLayoutPanel otherControls) : base(cache, styleSheet, 4, 2) { Dock = DockStyle.Fill; Name = name; Parent = parent; Padding = otherControls.Padding; // Add the labels at the top AddControl(null, kLabelRow, kRevisionColumn, new FixedControlProxy( otherControls.GetControlFromPosition(kRevisionColumn, kLabelRow))); AddControl(null, kLabelRow, kCurrentColumn, new FixedControlProxy( otherControls.GetControlFromPosition(kCurrentColumn, kLabelRow))); // Add the views AddControl(null, kDraftRow, kRevisionColumn, revisionDraft, false, true); AddControl(null, kDraftRow, kCurrentColumn, currentDraft, true, true); AddControl(null, kFootnoteRow, kRevisionColumn, revisionFootnote, false, true); AddControl(null, kFootnoteRow, kCurrentColumn, currentFootnote, false, true); // Add the buttons below the views AddControl(null, kButtonRow, kRevisionColumn, new FixedControlProxy( otherControls.GetControlFromPosition(kRevisionColumn, kButtonRow))); AddControl(null, kButtonRow, kCurrentColumn, new FixedControlProxy( otherControls.GetControlFromPosition(kCurrentColumn, kButtonRow))); // Set properties on the rows // We have to set the desired height first because this resets the visible // state - strange. GetRow(kLabelRow).MinimumHeight = otherControls.GetControlFromPosition(kRevisionColumn, kLabelRow).Height; GetRow(kButtonRow).MinimumHeight = otherControls.GetControlFromPosition(kRevisionColumn, kButtonRow).Height; DataGridViewControlRow row = GetRow(kLabelRow); row.Visible = true; row.Resizable = DataGridViewTriState.False; row.IsAutoFill = false; DataGridViewAdvancedBorderStyle noBorder = new DataGridViewAdvancedBorderStyle(); noBorder.All = DataGridViewAdvancedCellBorderStyle.None; row.AdvancedBorderStyle = noBorder; row = GetRow(kDraftRow); row.Visible = true; row = GetRow(kFootnoteRow); row.FillWeight = 18; // 30% row.Visible = false; row = GetRow(kButtonRow); row.Visible = true; row.Resizable = DataGridViewTriState.False; row.IsAutoFill = false; row.AdvancedBorderStyle = noBorder; // Set properties on the two columns DataGridViewControlColumn column = GetColumn(kRevisionColumn); column.MinimumWidth = 220; column.Visible = true; column.FillWeight = 100; column.Name = "RevisionColumn"; column = GetColumn(kCurrentColumn); column.MinimumWidth = 315; column.Visible = true; column.FillWeight = 100; column.Name = "CurrentColumn"; }
/// ------------------------------------------------------------------------------------ /// <summary> /// When the dialog is created, add the diff views to it. /// </summary> /// ------------------------------------------------------------------------------------ protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); // Make two Diff views, for Current and Revision m_differences.MoveFirst(); // make sure first item is active in list. IScrBook bookRev = m_bookMerger.BookRev; IScrBook bookCurr = m_bookMerger.BookCurr; DiffViewScrProxy currentInfo = new DiffViewScrProxy(this, "Current", bookCurr, false); DiffViewScrProxy revisionInfo = new DiffViewScrProxy(this, "Revision", bookRev, true); DiffViewFootnoteProxy currFnInfo = new DiffViewFootnoteProxy(this, "Current Footnote", bookCurr, false); DiffViewFootnoteProxy revisionFnInfo = new DiffViewFootnoteProxy(this, "Revision Footnote", bookRev, true); // Add ourself to the components to advertise our services components.Add(this); // NOTE: we use a tableLayoutPanel so that we can add all the other controls // like buttons and textboxes in Design mode. The tableLayoutPanel should have // exactly the same number of rows and columns as the real SplitGrid should // have later on (i.e. 4 rows and 2 columns). The DiffViewWrapper then uses // the controls in the first and lost row of the tableLayoutPanel and sticks them // in the SplitGrid. The other two middle rows it fills with the DiffView // and Footnote view. // Make the top draft wrapper to contain the two diff views m_diffViewWrapper = new DiffViewWrapper("Diff View Wrapper", this, m_cache, m_stylesheet, currentInfo, revisionInfo, currFnInfo, revisionFnInfo, tableLayoutPanel); m_diffViewWrapper.Site = Site; Controls.Remove(tableLayoutPanel); Controls.Add(m_diffViewWrapper); Controls.SetChildIndex(m_diffViewWrapper, 0); m_diffViewWrapper.Visible = true; if (!MiscUtils.RunningTests && !DesignMode) { CreateMenuAndToolbars(); m_diffViewWrapper.BringToFront(); } #if __MonoCS__ m_diffViewWrapper.FixupHostedControlVisiblity(); #endif }