Пример #1
0
        private bool ChangeIndex(LogicFolderTreeViewItem swaplftvi, bool isUp)
        {
            if (swaplftvi == null || swaplftvi.Parent == null)
            {
                return(false);
            }
            var index = swaplftvi.Parent.Items.IndexOf(swaplftvi);

            if (isUp)
            {
                if (index > 0)
                {
                    swaplftvi.Parent.Items[index]     = swaplftvi.Parent.Items[index - 1];
                    swaplftvi.Parent.Items[index - 1] = swaplftvi;
                    return(true);
                }
            }
            else
            {
                if (index < swaplftvi.Parent.ItemCount - 1)
                {
                    swaplftvi.Parent.Items[index]     = swaplftvi.Parent.Items[index + 1];
                    swaplftvi.Parent.Items[index + 1] = swaplftvi;
                    return(true);
                }
            }
            return(false);
        }
Пример #2
0
        private void CreateInformation()
        {
            if (siTreeView != null)
            {
                RecursiveDispose(siTreeView.Items);
            }
            if (lfTreeView != null)
            {
                LFRecursiveDispose(lfTreeView.Items);
            }

            int iter = 0;

            siTreeView = new TreeView(new SongInfoTreeViewItem());
            siTreeView.SelectionChanged += treeview_SelectionChanged;
            RecursiveCreate(filter.GetFiltered(SongInformation.Root.Children), ref iter, siTreeView.Root);
            if (siTreeView.ItemCount > 0)
            {
                siTreeView.Select(siTreeView.Items[0]);
            }

            var lfroot = new LogicFolderTreeViewItem
            {
                LogicFolderInfo = LogicFolderInfomation.Root
            };

            lfTreeView = new TreeView(lfroot);
            lfTreeView.SelectionChanged += lfTreeView_SelectionChanged;
            iter = 0;
            LFRecursiveCreate(LogicFolderInfomation.Root.Children, ref iter, lfTreeView.Root);
            if (lfTreeView.ItemCount > 0)
            {
                lfTreeView.Select(lfTreeView.Items[0]);
            }
        }
Пример #3
0
        private void Paste()
        {
            var target = (lfTreeView.SelectedItem ?? lfTreeView.Root) as LogicFolderTreeViewItem;

            if (!target.LogicFolderInfo.IsFolder)
            {
                target = target.Parent as LogicFolderTreeViewItem;
            }
            if (cutOrCopylftvi != null && target != null && !cutOrCopylftvi.LogicFolderInfo.ContainAsChildrenOrSelf(target.LogicFolderInfo))
            {
                if (cut)
                {
                    if (target != cutOrCopylftvi.Parent)
                    {
                        lfTreeView.Select(Copy(cutOrCopylftvi, target));
                        cutOrCopylftvi.Remove();
                        cutOrCopylftvi.LogicFolderInfo.Remove();
                        cutOrCopylftvi = null;
                        target.Expand();
                    }
                }
                else
                {
                    lfTreeView.Select(Copy(cutOrCopylftvi, target));
                    target.Expand();
                }
            }
        }
Пример #4
0
 private void Copy()
 {
     if (lfTreeView.SelectedItem == null)
     {
         return;
     }
     cutOrCopylftvi = lfTreeView.SelectedItem as LogicFolderTreeViewItem;
     cut            = false;
 }
Пример #5
0
 private void ShowTextBox(LogicFolderTreeViewItem lftvi)
 {
     textBox.DrawOnlyFocus = true;
     textBox.DrawMode      = DxTextBox.DrawingMode.DrawAll;
     textBox.Text          = lftvi.TextureString.Text;
     textBox.Position      = new Vector2(lftvi.TextureString.Position.X, lftvi.TextureString.Position.Y);
     textBox.MaxWidth      = textBox.TextBoxWidth = Math.Max(300, (int)lftvi.TextureString.MaxWidth);
     textBox.TextBoxHeight = 14;
     FocusManager.Focus(textBox);
 }
Пример #6
0
        private void ChangeIndex(LogicFolderTreeViewItem swap)
        {
            if (swap == null || swap == lfTreeView.Root)
            {
                return;
            }
            var parent       = swap.Parent as LogicFolderTreeViewItem;
            var currentIndex = parent.Items.IndexOf(swap);

            swap.LogicFolderInfo.ChangeIndex(currentIndex);
            parent.Sort();
            lfTreeView.Select(swap);
        }
Пример #7
0
        private LogicFolderTreeViewItem CreateAndAdd(LogicFolderInfomation child, TreeViewItem parent)
        {
            var tvi = new LogicFolderTreeViewItem
            {
                TextureString = new TextureString(device, child.Name, 14, maxwidth - gapX * child.Depth, PPDColors.White)
                {
                    AllowScroll = false
                },
                LogicFolderInfo = child
            };

            parent.Add(tvi);
            return(tvi);
        }
Пример #8
0
 private void RecursiveCopy(SongInfoTreeViewItem sitvi, LogicFolderTreeViewItem lftvi)
 {
     foreach (SongInfoTreeViewItem childsitvi in sitvi.Items)
     {
         if (!childsitvi.SongInformation.IsPPDSong)
         {
             var folder   = lftvi.LogicFolderInfo.AddFolder(childsitvi.SongInformation.DirectoryName);
             var newlftvi = CreateAndAdd(folder, lftvi);
             RecursiveCopy(childsitvi, newlftvi);
         }
         else
         {
             var newinfo = lftvi.LogicFolderInfo.AddScore(childsitvi.SongInformation);
             CreateAndAdd(newinfo, lftvi);
         }
     }
     lftvi.Sort();
 }
Пример #9
0
 private LogicFolderTreeViewItem Copy(LogicFolderTreeViewItem src, LogicFolderTreeViewItem dest)
 {
     if (src.LogicFolderInfo.IsFolder)
     {
         var newFolder = dest.LogicFolderInfo.AddFolder(src.LogicFolderInfo.Name);
         var newlftvi  = CreateAndAdd(newFolder, dest);
         dest.Sort();
         foreach (LogicFolderTreeViewItem childlftvi in src.Items)
         {
             Copy(childlftvi, newlftvi);
         }
         return(newlftvi);
     }
     else
     {
         var newScore = dest.LogicFolderInfo.AddScore(SongInformation.FindSongInformationByID(src.LogicFolderInfo.ScoreID), src.LogicFolderInfo.Name);
         var newlftvi = CreateAndAdd(newScore, dest);
         dest.Sort();
         return(newlftvi);
     }
 }
Пример #10
0
        void ScoreManager_Inputed(IFocusable sender, InputEventArgs args)
        {
            if (args.InputInfo.IsPressed(ButtonType.Circle))
            {
                ProcessCircleInput();
            }
            else if (args.InputInfo.IsPressed(ButtonType.Cross))
            {
                FocusManager.RemoveFocus();
                sound.Play(PPDSetting.DefaultSounds[2], -1000);
            }
            else if (args.InputInfo.IsPressed(ButtonType.Triangle))
            {
                if (lfTreeView.SelectedItem == null)
                {
                    foreach (MenuItem menuItem in cm.Menus)
                    {
                        menuItem.Enabled = menuItem.Name == createlinkmenu || menuItem.Name == createfoldermenu || (menuItem.Name == pastemenu && cutOrCopylftvi != null);
                    }
                    cm.Position = new Vector2(500, 200);
                }
                else
                {
                    foreach (MenuItem menuItem in cm.Menus)
                    {
                        if (menuItem.Name == pastemenu && cutOrCopylftvi == null)
                        {
                            menuItem.Enabled = false;
                        }
                        else
                        {
                            menuItem.Enabled = true;
                        }
                    }
                    var lftvi = lfTreeView.SelectedItem as LogicFolderTreeViewItem;
                    var pos   = new Vector2(lftvi.TextureString.Position.X, lftvi.TextureString.Position.Y + lftvi.TextureString.CharacterHeight + 20);
                    if (cm.CheckPositionX(pos) >= 0)
                    {
                        if (cm.CheckPositionY(pos) >= 0)
                        {
                        }
                        else
                        {
                            pos.Y = lftvi.TextureString.Position.Y - cm.Height;
                        }
                    }
                    else
                    {
                        if (cm.CheckPositionY(pos) >= 0)
                        {
                            pos.X = pos.X + cm.CheckPositionX(pos);
                        }
                        else
                        {
                            pos = new Vector2(pos.X + cm.CheckPositionX(pos), lftvi.TextureString.Position.Y - cm.Height);
                        }
                    }
                    cm.Position = pos;
                }
                FocusManager.Focus(cm);
            }
            else if (args.InputInfo.IsPressed(ButtonType.Square))
            {
                swap      = true;
                swaplftvi = lfTreeView.SelectedItem as LogicFolderTreeViewItem;
            }
            else if (args.InputInfo.IsPressed(ButtonType.R))
            {
                focusPanel = FocusPanel.Right;
                sound.Play(PPDSetting.DefaultSounds[3], -1000);
            }
            else if (args.InputInfo.IsPressed(ButtonType.L))
            {
                focusPanel = FocusPanel.Left;
                sound.Play(PPDSetting.DefaultSounds[3], -1000);
            }
            else if (args.InputInfo.IsPressed(ButtonType.Up))
            {
                if (ProcessUpInput())
                {
                    sound.Play(PPDSetting.DefaultSounds[0], -1000);
                }
            }
            else if (args.InputInfo.IsPressed(ButtonType.Down))
            {
                if (ProcessDownInput())
                {
                    sound.Play(PPDSetting.DefaultSounds[0], -1000);
                }
            }
            else if (args.InputInfo.IsPressed(ButtonType.Left))
            {
                bool ok = false;
                for (int i = 0; i < maxHeightNumber / 2; i++)
                {
                    ok |= ProcessUpInput();
                }
                if (ok)
                {
                    sound.Play(PPDSetting.DefaultSounds[0], -1000);
                }
            }
            else if (args.InputInfo.IsPressed(ButtonType.Right))
            {
                bool ok = false;
                for (int i = 0; i < maxHeightNumber / 2; i++)
                {
                    ok |= ProcessDownInput();
                }
                if (ok)
                {
                    sound.Play(PPDSetting.DefaultSounds[0], -1000);
                }
            }

            if (args.InputInfo.IsReleased(ButtonType.Square))
            {
                if (swap)
                {
                    ChangeIndex(swaplftvi);
                    swap      = false;
                    swaplftvi = null;
                }
            }
        }