//************************************************************************* // Method: LayoutManager_LayoutChanged() // /// <summary> /// Handles all LayoutChanged events. /// </summary> /// /// <param name="sender"> /// Standard event argument. /// </param> /// /// <param name="e"> /// Standard event argument. /// </param> //************************************************************************* protected void LayoutManager_LayoutChanged( object sender, EventArgs e ) { AssertValid(); if (m_bHandlingLayoutChanged) { // Prevent an endless loop when the other layout manager's Layout // property is set below. return; } m_bHandlingLayoutChanged = true; // The user just selected a layout via one of the Layout menus. // Synchronize the layout managers that manage those menus. if (sender == m_oLayoutManagerForToolStripSplitButton) { m_oRibbon.Layout = m_oLayoutManagerForContextMenu.Layout = m_oLayoutManagerForToolStripSplitButton.Layout; } else if (sender == m_oLayoutManagerForContextMenu) { m_oRibbon.Layout = m_oLayoutManagerForToolStripSplitButton.Layout = m_oLayoutManagerForContextMenu.Layout; } else if (sender == m_oRibbon) { m_oLayoutManagerForContextMenu.Layout = m_oLayoutManagerForToolStripSplitButton.Layout = m_oRibbon.Layout; } else { Debug.Assert(false); } // Save the new layout. LayoutUserSettings oLayoutUserSettings = new LayoutUserSettings(); oLayoutUserSettings.Layout = m_oLayoutManagerForToolStripSplitButton.Layout; oLayoutUserSettings.Save(); ApplyLayoutUserSettings(oLayoutUserSettings); // If the layout was just changed from Null to something else and the // X and Y columns were autofilled, the X and Y autofill results need // to be cleared. if (!this.LayoutIsNull) { PerWorkbookSettings oPerWorkbookSettings = this.PerWorkbookSettings; AutoFillWorkbookResults oAutoFillWorkbookResults = oPerWorkbookSettings.AutoFillWorkbookResults; if (oAutoFillWorkbookResults.VertexXResults.ColumnAutoFilled) { oAutoFillWorkbookResults.VertexXResults = new AutoFillNumericRangeColumnResults(); oAutoFillWorkbookResults.VertexYResults = new AutoFillNumericRangeColumnResults(); // The PerWorkbookSettings object doesn't persist its settings // to the workbook unless one of its own properties is set. oPerWorkbookSettings.AutoFillWorkbookResults = oAutoFillWorkbookResults; UpdateAxes(oPerWorkbookSettings); } } m_bHandlingLayoutChanged = false; }
//************************************************************************* // Method: EditLayoutUserSettings() // /// <summary> /// Shows the dialog that lets the user edit his layout settings. /// </summary> //************************************************************************* protected void EditLayoutUserSettings() { AssertValid(); if (oNodeXLControl.IsLayingOutGraph) { return; } LayoutUserSettings oLayoutUserSettings = new LayoutUserSettings(); LayoutUserSettingsDialog oLayoutUserSettingsDialog = new LayoutUserSettingsDialog(oLayoutUserSettings); if (oLayoutUserSettingsDialog.ShowDialog() == DialogResult.OK) { oLayoutUserSettings.Save(); ApplyLayoutUserSettings(oLayoutUserSettings); oNodeXLControl.DrawGraph(); } }