コード例 #1
0
ファイル: ProjectExplorer.cs プロジェクト: VN0/FamiStudio
            public RenderBitmap GetIcon(SubButtonType sub)
            {
                switch (sub)
                {
                case SubButtonType.Add:
                    return(projectExplorer.bmpAdd);

                case SubButtonType.DPCM:
                    return(projectExplorer.bmpDPCM);

                case SubButtonType.DutyCycle:
                    if (instrument.ExpansionType == Project.ExpansionVrc6)
                    {
                        return(projectExplorer.bmpDuty[instrument.DutyCycle]);
                    }
                    else
                    {
                        return(projectExplorer.bmpDuty[instrument.DutyCycle * 2]);
                    }

                case SubButtonType.Arpeggio:
                    return(projectExplorer.bmpArpeggio);

                case SubButtonType.Pitch:
                    return(projectExplorer.bmpPitch);

                case SubButtonType.Volume:
                    return(projectExplorer.bmpVolume);

                case SubButtonType.LoadInstrument:
                    return(projectExplorer.bmpLoadInstrument);
                }

                return(null);
            }
コード例 #2
0
ファイル: ProjectExplorer.cs プロジェクト: Waik0/FamiStudio
        private int GetButtonAtCoord(int x, int y, out SubButtonType sub)
        {
            var buttonIndex = (y + scrollY) / buttonSizeY;

            sub = SubButtonType.Max;

            if (buttonIndex >= 0 && buttonIndex < buttons.Count)
            {
                var subButtons = buttons[buttonIndex].GetSubButtons(out _);
                if (subButtons != null)
                {
                    y -= (buttonIndex * buttonSizeY - scrollY);

                    for (int i = 0; i < subButtons.Length; i++)
                    {
                        int sx = Width - scrollBarSizeX - subButtonSpacingX * (i + 1);
                        int sy = subButtonPosY;
                        int dx = x - sx;
                        int dy = y - sy;

                        if (dx >= 0 && dx < 16 * RenderTheme.MainWindowScaling &&
                            dy >= 0 && dy < 16 * RenderTheme.MainWindowScaling)
                        {
                            sub = subButtons[i];
                            break;
                        }
                    }
                }

                return(buttonIndex);
            }
            else
            {
                return(-1);
            }
        }
コード例 #3
0
        private int GetButtonAtCoord(int x, int y, out SubButtonType sub)
        {
            var buttonIndex = (y + scrollY) / ButtonSizeY;

            sub = SubButtonType.Max;

            if (buttonIndex >= 0 && buttonIndex < buttons.Count)
            {
                var subButtons = buttons[buttonIndex].GetSubButtons(out _);
                if (subButtons != null)
                {
                    y -= (buttonIndex * ButtonSizeY - scrollY);

                    for (int i = 0; i < subButtons.Length; i++)
                    {
                        int sx = Width - ScrollBarSizeX - 20 * (i + 1);
                        int sy = 4;
                        int dx = x - sx;
                        int dy = y - sy;

                        if (dx >= 0 && dx < 16 &&
                            dy >= 0 && dy < 16)
                        {
                            sub = subButtons[i];
                            break;
                        }
                    }
                }

                return(buttonIndex);
            }
            else
            {
                return(-1);
            }
        }