상속: NodeXLApplicationSettingsBase
    //*************************************************************************
    //  Constructor: LayoutUserSettingsDialog()
    //
    /// <overloads>
    /// Initializes a new instance of the <see
    /// cref="LayoutUserSettingsDialog" /> class.
    /// </overloads>
    ///
    /// <summary>
    /// Initializes a new instance of the <see
    /// cref="LayoutUserSettingsDialog" /> class with a LayoutUserSettings
    /// object.
    /// </summary>
    ///
    /// <param name="layoutUserSettings">
    /// The object being edited.
    /// </param>
    //*************************************************************************

    public LayoutUserSettingsDialog
    (
        LayoutUserSettings layoutUserSettings
    )
    : this()
    {
        Debug.Assert(layoutUserSettings != null);
        layoutUserSettings.AssertValid();

        m_oLayoutUserSettings = layoutUserSettings;

        // Instantiate an object that saves and retrieves the user settings for
        // this dialog.  Note that the object automatically saves the settings
        // when the form closes.

        m_oLayoutUserSettingsDialogUserSettings =
            new LayoutUserSettingsDialogUserSettings(this);

        cbxBoxLayoutAlgorithm.PopulateWithEnumValues(
            typeof(BoxLayoutAlgorithm), true);

        cbxIntergroupEdgeStyle.PopulateWithEnumValues(
            typeof(IntergroupEdgeStyle), true);

        DoDataExchange(false);

        AssertValid();
    }
예제 #2
0
        public LayoutControl()
        {
            InitializeComponent();

            GeneralUserSettings oGeneralUserSettings = new GeneralUserSettings();
            oGeneralUserSettings.NotUseWorkbookSettings();
            LayoutUserSettings oLayoutUserSettings = new LayoutUserSettings();
            oLayoutUserSettings.NotUseWorkbookSettings();

            LayoutType eInitialLayout = oLayoutUserSettings.Layout;
//            LayoutType eInitialLayout = LayoutType.FruchtermanReingold;

            // Instantiate an object that populates the tssbLayout
            // ToolStripSplitButton and handles its LayoutChanged event.

            m_oLayoutManagerForToolStripSplitButton =
                new LayoutManagerForToolStripSplitButton();

            m_oLayoutManagerForToolStripSplitButton.AddItems(this.tssbLayout);
            m_oLayoutManagerForToolStripSplitButton.Layout = eInitialLayout;
            m_oLayoutManagerForToolStripSplitButton.LayoutChanged +=
                new EventHandler(
                    this.LayoutManagerForToolStripSplitButton_LayoutChanged);

            CreateNodeXLControl();
            CreateGraphZoomAndScaleControl();

            ApplyGeneralUserSettings(oGeneralUserSettings);
            ApplyLayoutUserSettings(oLayoutUserSettings);

            AssertValid();
        }
예제 #3
0
        OnLayoutChanged
        (
            LayoutType eLayout
        )
        {
            AssertValid();

            if (m_bHandlingLayoutChanged)
            {
                // Prevent an endless loop when the layout managers are
                // synchronized.

                return;
            }

            m_bHandlingLayoutChanged = true;


            // Save and apply the new layout.

            LayoutUserSettings oLayoutUserSettings = new LayoutUserSettings();
            oLayoutUserSettings.NotUseWorkbookSettings();
            oLayoutUserSettings.Layout = eLayout;
            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.

            m_bHandlingLayoutChanged = false;
        }
예제 #4
0
        protected void ShowGraph(Boolean bLayOutGraph)
//        public void ShowGraph(Boolean bLayOutGraph)
        {
            AssertValid();

            if (m_oNodeXLControl.IsLayingOutGraph)
            {
                return;
            }
            GeneralUserSettings oGeneralUserSettings = new GeneralUserSettings();
            oGeneralUserSettings.NotUseWorkbookSettings();
            LayoutUserSettings oLayoutUserSettings = new LayoutUserSettings();
            oLayoutUserSettings.NotUseWorkbookSettings();

            ApplyGeneralUserSettings(oGeneralUserSettings);
            ApplyLayoutUserSettings(oLayoutUserSettings);
            EnableGraphControls(false);

            try
            {
//                IGraphAdapter oGraphAdapter = new SimpleGraphAdapter();
//                m_oNodeXLControl.Graph = oGraphAdapter.LoadGraphFromFile(
//                    "..\\..\\SampleGraph.txt");

                //IGraph oGraph = oWorkbookReader.ReadWorkbook(
                //    m_oWorkbook, oReadWorkbookContext);

                // Load the NodeXLControl with the resulting graph.

                //m_oNodeXLControl.Graph = oGraph;

                // Collapse any groups that are supposed to be collapsed.

                //CollapseOrExpandGroups(GetGroupNamesToCollapse(oGraph), true,
                //    false);

                // Enable tooltips in case tooltips were specified in the workbook.

                m_oNodeXLControl.ShowVertexToolTips = true;

                // If the dynamic filter dialog is open, read the dynamic filter
                // columns it filled in.

                m_oNodeXLControl.DrawGraph(bLayOutGraph);

            }
            catch (Exception oException)
            {
                // If exceptions aren't caught here, Excel consumes them without
                // indicating that anything is wrong.  This can result in the graph
                // controls remaining disabled, among other problems.

                //ErrorUtil.OnException(oException);
            }
            finally
            {
                EnableGraphControls(true);
            }

            // Change the button text to indicate that if any of the buttons is
            // clicked again, the graph will be read again.

            tsbShowGraph.Text = "Refresh Graph";

        }
예제 #5
0
        EditLayoutUserSettings()
        {
            AssertValid();

            if (m_oNodeXLControl.IsLayingOutGraph)
            {
                return;
            }

            LayoutUserSettings oLayoutUserSettings = new LayoutUserSettings();
            oLayoutUserSettings.NotUseWorkbookSettings();

            LayoutUserSettingsDialog oLayoutUserSettingsDialog =
                new LayoutUserSettingsDialog(oLayoutUserSettings);

            if (oLayoutUserSettingsDialog.ShowDialog() == DialogResult.OK)
            {
                oLayoutUserSettings.Save();
                ApplyLayoutUserSettings(oLayoutUserSettings);
                m_oNodeXLControl.DrawGraph();
            }
        }
예제 #6
0
        ApplyLayoutUserSettings
        (
            LayoutUserSettings oLayoutUserSettings
        )
        {
//            Debug.Assert(oLayoutUserSettings != null);
//            AssertValid();

            // Either layout manager will work; arbitrarily use one of them to
            // create a layout.

            ILayout oLayout =
                m_oLayoutManagerForToolStripSplitButton.CreateLayout();

            oLayoutUserSettings.TransferToLayout(oLayout);
            m_oNodeXLControl.Layout = oLayout;
        }