示例#1
0
 private void RunGroupDlg(int numberOfGroups, DisplayGraphsType displayType, GroupGraphsType groupType, GroupGraphsOrder orderGraphs)
 {
     RunDlg <ArrangeGraphsGroupedDlg>(SkylineWindow.ArrangeGraphsGrouped, dlg =>
     {
         dlg.Groups      = numberOfGroups;
         dlg.DisplayType = displayType;
         dlg.GroupType   = groupType;
         dlg.GroupOrder  = orderGraphs;
         dlg.OkDialog();
     });
 }
示例#2
0
 public void ArrangeGraphs(DisplayGraphsType displayGraphsType)
 {
     var listGraphs = GetArrangeableGraphs();
     if (listGraphs.Count < 2)
         return;
     using (new DockPanelLayoutLock(dockPanel, true))
     {
         ArrangeGraphsGrouped(listGraphs, listGraphs.Count, GroupGraphsType.separated, displayGraphsType);
     }
 }
示例#3
0
        private void ArrangeGraphsGrouped(IList<DockableForm> listGraphs, int groups, GroupGraphsType groupType, DisplayGraphsType displayType)
        {
            // First just arrange everything into a single pane
            ArrangeGraphsTabbed(listGraphs);

            // Figure out how to distribute the panes into rows and columns
            var documentPane = FindPane(listGraphs[0]);
            double width = documentPane.Width;
            double height = documentPane.Height;
            int rows;
            if (displayType == DisplayGraphsType.Row)
            {
                rows = 1;
            }
            else if (displayType == DisplayGraphsType.Column)
            {
                rows = groups;
            }
            else
            {
                rows = 1;
                while ((height / rows) / (width / (groups / rows + (groups % rows > 0 ? 1 : 0))) > MAX_TILED_ASPECT_RATIO)
                    rows++;
            }

            int longRows = groups%rows;
            int columnsShort = groups/rows;

            // Distribute the forms into lists representing rows, columns, and groups
            var listTiles = new List<List<List<DockableForm>>>();
            if (groupType == GroupGraphsType.distributed)
            {
                // As if dealing a card deck over the groups
                int iForm = 0;
                int forms = listGraphs.Count;
                while (iForm < listGraphs.Count)
                {
                    for (int iRow = 0; iRow < rows; iRow++)
                    {
                        if (listTiles.Count <= iRow)
                            listTiles.Add(new List<List<DockableForm>>());
                        var rowTiles = listTiles[iRow];
                        int columns = columnsShort + (iRow < longRows ? 1 : 0);
                        for (int iCol = 0; iCol < columns && iForm < forms; iCol++)
                        {
                            if (rowTiles.Count <= iCol)
                                rowTiles.Add(new List<DockableForm>());
                            var tabbedForms = rowTiles[iCol];
                            tabbedForms.Add(listGraphs[iForm++]);
                        }
                    }
                }
            }
            else
            {
                // Filling each group before continuing to the next
                int count = listGraphs.Count;
                int longGroups = count % groups;
                int tabsShort = count / groups;
                for (int iRow = 0, iGroup = 0, iForm = 0; iRow < rows; iRow++)
                {
                    var rowTiles = new List<List<DockableForm>>();
                    listTiles.Add(rowTiles);
                    int columns = columnsShort + (iRow < longRows ? 1 : 0);
                    for (int iCol = 0; iCol < columns; iCol++)
                    {
                        var tabbedForms = new List<DockableForm>();
                        rowTiles.Add(tabbedForms);
                        int tabs = tabsShort + (iGroup++ < longGroups ? 1 : 0);
                        for (int iTab = 0; iTab < tabs; iTab++)
                        {
                            tabbedForms.Add(listGraphs[iForm++]);
                        }
                    }
                }
            }

            // Place the forms in the dock panel
            // Rows first
            for (int i = 1; i < rows; i++)
            {
                PlacePane(i, 0, rows, DockPaneAlignment.Bottom, listTiles);
            }
            // Then columns in the rows
            for (int i = 0; i < rows; i++)
            {
                int columns = listTiles[i].Count;
                for (int j = 1; j < columns; j++)
                {
                    PlacePane(i, j, columns, DockPaneAlignment.Right, listTiles);
                }
            }
        }
示例#4
0
 public static DisplayGraphsType GetEnum(string enumValue, DisplayGraphsType defaultValue)
 {
     return(Helpers.EnumFromLocalizedString(enumValue, LOCALIZED_VALUES, defaultValue));
 }
示例#5
0
 public static string GetLocalizedString(this DisplayGraphsType val)
 {
     return(LOCALIZED_VALUES[(int)val]);
 }
 public static DisplayGraphsType GetEnum(string enumValue, DisplayGraphsType defaultValue)
 {
     return Helpers.EnumFromLocalizedString(enumValue, LOCALIZED_VALUES, defaultValue);
 }
示例#7
0
 public void ArrangeGraphs(DisplayGraphsType displayGraphsType)
 {
     SkylineWindow.ArrangeGraphs(displayGraphsType);
 }
示例#8
0
 private void RunGroupDlg(int numberOfGroups, DisplayGraphsType displayType, GroupGraphsType groupType, GroupGraphsOrder orderGraphs)
 {
     RunDlg<ArrangeGraphsGroupedDlg>(SkylineWindow.ArrangeGraphsGrouped, dlg =>
     {
         dlg.Groups = numberOfGroups;
         dlg.DisplayType = displayType;
         dlg.GroupType = groupType;
         dlg.GroupOrder = orderGraphs;
         dlg.OkDialog();
     });
 }