コード例 #1
0
ファイル: Sequencer.cs プロジェクト: Waik0/FamiStudio
        protected override void OnRenderInitialized(RenderGraphics g)
        {
            theme = RenderTheme.CreateResourcesForGraphics(g);

            bmpTracks[Channel.Square1]  = g.CreateBitmapFromResource("Square");
            bmpTracks[Channel.Square2]  = g.CreateBitmapFromResource("Square");
            bmpTracks[Channel.Triangle] = g.CreateBitmapFromResource("Triangle");
            bmpTracks[Channel.Noise]    = g.CreateBitmapFromResource("Noise");
            bmpTracks[Channel.DPCM]     = g.CreateBitmapFromResource("DPCM");

            bmpGhostNote = g.CreateBitmapFromResource("GhostSmall");

            seekBarBrush                  = g.CreateSolidBrush(ThemeBase.SeekBarColor);
            whiteKeyBrush                 = g.CreateHorizontalGradientBrush(0, trackNameSizeX, ThemeBase.LightGreyFillColor1, ThemeBase.LightGreyFillColor2);
            patternHeaderBrush            = g.CreateVerticalGradientBrush(0, patternHeaderSizeY, ThemeBase.LightGreyFillColor1, ThemeBase.LightGreyFillColor2);
            selectedPatternVisibleBrush   = g.CreateSolidBrush(Color.FromArgb(64, ThemeBase.LightGreyFillColor1));
            selectedPatternInvisibleBrush = g.CreateSolidBrush(Color.FromArgb(32, ThemeBase.LightGreyFillColor1));

            seekGeometry = g.CreateConvexPath(new[]
            {
                new Point(-headerSizeY / 2, 1),
                new Point(0, headerSizeY - 2),
                new Point(headerSizeY / 2, 1)
            });
        }
コード例 #2
0
        protected override void OnRenderInitialized(RenderGraphics g)
        {
            theme = RenderTheme.CreateResourcesForGraphics(g);

            bmpTracks[Channel.Square1]  = g.CreateBitmapFromResource("Square");
            bmpTracks[Channel.Square2]  = g.CreateBitmapFromResource("Square");
            bmpTracks[Channel.Triangle] = g.CreateBitmapFromResource("Triangle");
            bmpTracks[Channel.Noise]    = g.CreateBitmapFromResource("Noise");
            bmpTracks[Channel.DPCM]     = g.CreateBitmapFromResource("DPCM");

            bmpGhostNote = g.CreateBitmapFromResource("GhostSmall");

            playPositionBrush    = g.CreateSolidBrush(Color.FromArgb(192, ThemeBase.LightGreyFillColor1));
            whiteKeyBrush        = g.CreateHorizontalGradientBrush(0, trackNameSizeX, ThemeBase.LightGreyFillColor1, ThemeBase.LightGreyFillColor2);
            patternHeaderBrush   = g.CreateVerticalGradientBrush(0, patternHeaderSizeY, ThemeBase.LightGreyFillColor1, ThemeBase.LightGreyFillColor2);
            selectedPatternBrush = g.CreateSolidBrush(Color.FromArgb(128, ThemeBase.LightGreyFillColor1));
        }
コード例 #3
0
        protected override void OnRenderInitialized(RenderGraphics g)
        {
            theme        = RenderTheme.CreateResourcesForGraphics(g);
            toolbarBrush = g.CreateHorizontalGradientBrush(0, 81, ThemeBase.LightGreyFillColor1, ThemeBase.LightGreyFillColor2);

            bmpLoopNone    = g.CreateBitmapFromResource("LoopNone");
            bmpLoopSong    = g.CreateBitmapFromResource("Loop");
            bmpLoopPattern = g.CreateBitmapFromResource("LoopPattern");
            bmpPlay        = g.CreateBitmapFromResource("Play");
            bmpPause       = g.CreateBitmapFromResource("Pause");

            buttons[ButtonNew] = new Button {
                X = 4, Y = 4, Bmp = g.CreateBitmapFromResource("File"), Click = OnNew
            };
            buttons[ButtonOpen] = new Button {
                X = 44, Y = 4, Bmp = g.CreateBitmapFromResource("Open"), Click = OnOpen
            };
            buttons[ButtonSave] = new Button {
                X = 84, Y = 4, Bmp = g.CreateBitmapFromResource("Save"), Click = OnSave, RightClick = OnSaveAs
            };
            buttons[ButtonExport] = new Button {
                X = 124, Y = 4, Bmp = g.CreateBitmapFromResource("Export"), Click = OnExport
            };
            buttons[ButtonUndo] = new Button {
                X = 164, Y = 4, Bmp = g.CreateBitmapFromResource("Undo"), Click = OnUndo, Enabled = OnUndoEnabled
            };
            buttons[ButtonRedo] = new Button {
                X = 204, Y = 4, Bmp = g.CreateBitmapFromResource("Redo"), Click = OnRedo, Enabled = OnRedoEnabled
            };
            buttons[ButtonConfig] = new Button {
                X = 244, Y = 4, Bmp = g.CreateBitmapFromResource("Config"), Click = OnConfig
            };
            buttons[ButtonPlay] = new Button {
                X = 476, Y = 4, Click = OnPlay, GetBitmap = OnPlayGetBitmap
            };
            buttons[ButtonRewind] = new Button {
                X = 516, Y = 4, Bmp = g.CreateBitmapFromResource("Rewind"), Click = OnRewind
            };
            buttons[ButtonLoop] = new Button {
                X = 556, Y = 4, Click = OnLoop, GetBitmap = OnLoopGetBitmap
            };

            buttons[ButtonNew].ToolTip    = "New Project (Ctrl-N)";
            buttons[ButtonOpen].ToolTip   = "Open Project (Ctrl-O)";
            buttons[ButtonSave].ToolTip   = "Save Project (Ctrl-S) [Right-Click: Save As...]";
            buttons[ButtonExport].ToolTip = "Export to various formats (Ctrl+E)";
            buttons[ButtonUndo].ToolTip   = "Undo (Ctrl+Z)";
            buttons[ButtonRedo].ToolTip   = "Redo (Ctrl+Y)";
            buttons[ButtonConfig].ToolTip = "Edit Application Settings";
            buttons[ButtonPlay].ToolTip   = "Play/Pause (Space) [Ctrl+Space: Play pattern loop, Shift-Space: Play song loop]";
            buttons[ButtonRewind].ToolTip = "Rewind (Home) [Ctrl+Home: Rewind to beginning of current pattern]";
            buttons[ButtonLoop].ToolTip   = "Toggle Loop Mode";

            var scaling = RenderTheme.MainWindowScaling;

            for (int i = 0; i < ButtonCount; i++)
            {
                var btn = buttons[i];
                btn.X    = (int)(btn.X * scaling);
                btn.Y    = (int)(btn.Y * scaling);
                btn.Size = (int)(btn.Size * scaling);
            }

            timecodePosX     = (int)(DefaultTimecodePosX * scaling);
            timecodePosY     = (int)(DefaultTimecodePosY * scaling);
            timecodeSizeX    = (int)(DefaultTimecodeSizeX * scaling);
            timecodeTextPosX = (int)(DefaultTimecodeTextPosX * scaling);
            tooltipPosY      = (int)(DefaultTooltipPosY * scaling);
        }
コード例 #4
0
        protected override void OnRenderInitialized(RenderGraphics g)
        {
            theme = RenderTheme.CreateResourcesForGraphics(g);

            toolbarBrush = g.CreateHorizontalGradientBrush(0, 81, ThemeBase.LightGreyFillColor1, ThemeBase.LightGreyFillColor2);
            warningBrush = g.CreateSolidBrush(ThemeBase.Darken(ThemeBase.CustomColors[0, 0]));

            bmpLoopNone    = g.CreateBitmapFromResource("LoopNone");
            bmpLoopSong    = g.CreateBitmapFromResource("Loop");
            bmpLoopPattern = g.CreateBitmapFromResource("LoopPattern");
            bmpPlay        = g.CreateBitmapFromResource("Play");
            bmpPause       = g.CreateBitmapFromResource("Pause");
            bmpNtsc        = g.CreateBitmapFromResource("NTSC");
            bmpPal         = g.CreateBitmapFromResource("PAL");

            buttons[ButtonNew] = new Button {
                X = 4, Y = 4, Bmp = g.CreateBitmapFromResource("File"), Click = OnNew
            };
            buttons[ButtonOpen] = new Button {
                X = 40, Y = 4, Bmp = g.CreateBitmapFromResource("Open"), Click = OnOpen
            };
            buttons[ButtonSave] = new Button {
                X = 76, Y = 4, Bmp = g.CreateBitmapFromResource("Save"), Click = OnSave, RightClick = OnSaveAs
            };
            buttons[ButtonExport] = new Button {
                X = 112, Y = 4, Bmp = g.CreateBitmapFromResource("Export"), Click = OnExport
            };
            buttons[ButtonCopy] = new Button {
                X = 148, Y = 4, Bmp = g.CreateBitmapFromResource("Copy"), Click = OnCopy, Enabled = OnCopyEnabled
            };
            buttons[ButtonCut] = new Button {
                X = 184, Y = 4, Bmp = g.CreateBitmapFromResource("Cut"), Click = OnCut, Enabled = OnCutEnabled
            };
            buttons[ButtonPaste] = new Button {
                X = 220, Y = 4, Bmp = g.CreateBitmapFromResource("Paste"), Click = OnPaste, RightClick = OnPasteSpecial, Enabled = OnPasteEnabled
            };
            buttons[ButtonUndo] = new Button {
                X = 256, Y = 4, Bmp = g.CreateBitmapFromResource("Undo"), Click = OnUndo, Enabled = OnUndoEnabled
            };
            buttons[ButtonRedo] = new Button {
                X = 292, Y = 4, Bmp = g.CreateBitmapFromResource("Redo"), Click = OnRedo, Enabled = OnRedoEnabled
            };
            buttons[ButtonTransform] = new Button {
                X = 328, Y = 4, Bmp = g.CreateBitmapFromResource("Transform"), Click = OnTransform
            };
            buttons[ButtonConfig] = new Button {
                X = 364, Y = 4, Bmp = g.CreateBitmapFromResource("Config"), Click = OnConfig
            };
            buttons[ButtonPlay] = new Button {
                X = 572, Y = 4, Click = OnPlay, GetBitmap = OnPlayGetBitmap
            };
            buttons[ButtonRewind] = new Button {
                X = 608, Y = 4, Bmp = g.CreateBitmapFromResource("Rewind"), Click = OnRewind
            };
            buttons[ButtonLoop] = new Button {
                X = 644, Y = 4, Click = OnLoop, GetBitmap = OnLoopGetBitmap
            };
            buttons[ButtonMachine] = new Button {
                X = 680, Y = 4, Click = OnMachine, GetBitmap = OnMachineGetBitmap, Enabled = OnMachineEnabled
            };
            buttons[ButtonHelp] = new Button {
                X = 36, Y = 4, Bmp = g.CreateBitmapFromResource("Help"), RightAligned = true, Click = OnHelp
            };

            buttons[ButtonNew].ToolTip       = "{MouseLeft} New Project {Ctrl} {N}";
            buttons[ButtonOpen].ToolTip      = "{MouseLeft} Open Project {Ctrl} {O}";
            buttons[ButtonSave].ToolTip      = "{MouseLeft} Save Project {Ctrl} {S} - {MouseRight} Save As...";
            buttons[ButtonExport].ToolTip    = "{MouseLeft} Export to various formats {Ctrl} {E}";
            buttons[ButtonCopy].ToolTip      = "{MouseLeft} Copy selection {Ctrl} {C}";
            buttons[ButtonCut].ToolTip       = "{MouseLeft} Cut selection {Ctrl} {X}";
            buttons[ButtonPaste].ToolTip     = "{MouseLeft} Paste {Ctrl} {V}\n{MouseRight} Paste Special... {Ctrl} {Shift} {V}";
            buttons[ButtonUndo].ToolTip      = "{MouseLeft} Undo {Ctrl} {Z}";
            buttons[ButtonRedo].ToolTip      = "{MouseLeft} Redo {Ctrl} {Y}";
            buttons[ButtonTransform].ToolTip = "{MouseLeft} Perform cleanup and various operations";
            buttons[ButtonConfig].ToolTip    = "{MouseLeft} Edit Application Settings";
            buttons[ButtonPlay].ToolTip      = "{MouseLeft} Play/Pause {Space} - Play from start of pattern {Ctrl} {Space}";
            buttons[ButtonRewind].ToolTip    = "{MouseLeft} Rewind {Home}\nRewind to beginning of current pattern {Ctrl} {Home}";
            buttons[ButtonLoop].ToolTip      = "{MouseLeft} Toggle Loop Mode";
            buttons[ButtonMachine].ToolTip   = "{MouseLeft} Toggle between NTSC/PAL playback mode";
            buttons[ButtonHelp].ToolTip      = "{MouseLeft} Online documentation";

            var scaling = RenderTheme.MainWindowScaling;

            for (int i = 0; i < ButtonCount; i++)
            {
                var btn = buttons[i];
                btn.X    = (int)(btn.X * scaling);
                btn.Y    = (int)(btn.Y * scaling);
                btn.Size = (int)(btn.Size * scaling);
            }

            timecodePosX            = (int)(DefaultTimecodePosX * scaling);
            timecodePosY            = (int)(DefaultTimecodePosY * scaling);
            timecodeSizeX           = (int)(DefaultTimecodeSizeX * scaling);
            tooltipSingleLinePosY   = (int)(DefaultTooltipSingleLinePosY * scaling);
            tooltipMultiLinePosY    = (int)(DefaultTooltipMultiLinePosY * scaling);
            tooltipLineSizeY        = (int)(DefaultTooltipLineSizeY * scaling);
            tooltipSpecialCharSizeX = (int)(DefaultTooltipSpecialCharSizeX * scaling);
            tooltipSpecialCharSizeY = (int)(DefaultTooltipSpecialCharSizeY * scaling);

            specialCharacters["Shift"] = new TooltipSpecialCharacter {
                Width = (int)(32 * scaling)
            };
            specialCharacters["Space"] = new TooltipSpecialCharacter {
                Width = (int)(38 * scaling)
            };
            specialCharacters["Home"] = new TooltipSpecialCharacter {
                Width = (int)(38 * scaling)
            };
            specialCharacters["Ctrl"] = new TooltipSpecialCharacter {
                Width = (int)(28 * scaling)
            };
            specialCharacters["Alt"] = new TooltipSpecialCharacter {
                Width = (int)(24 * scaling)
            };
            specialCharacters["Drag"] = new TooltipSpecialCharacter {
                Bmp = g.CreateBitmapFromResource("Drag"), OffsetY = 2 * scaling
            };
            specialCharacters["MouseLeft"] = new TooltipSpecialCharacter {
                Bmp = g.CreateBitmapFromResource("MouseLeft"), OffsetY = 2 * scaling
            };
            specialCharacters["MouseRight"] = new TooltipSpecialCharacter {
                Bmp = g.CreateBitmapFromResource("MouseRight"), OffsetY = 2 * scaling
            };
            specialCharacters["MouseWheel"] = new TooltipSpecialCharacter {
                Bmp = g.CreateBitmapFromResource("MouseWheel"), OffsetY = 2 * scaling
            };
            specialCharacters["Warning"] = new TooltipSpecialCharacter {
                Bmp = g.CreateBitmapFromResource("Warning")
            };

            for (char i = 'A'; i <= 'Z'; i++)
            {
                specialCharacters[i.ToString()] = new TooltipSpecialCharacter {
                    Width = tooltipSpecialCharSizeX
                }
            }
            ;
            for (char i = '0'; i <= '9'; i++)
            {
                specialCharacters[i.ToString()] = new TooltipSpecialCharacter {
                    Width = tooltipSpecialCharSizeX
                }
            }
            ;

            specialCharacters["~"] = new TooltipSpecialCharacter {
                Width = tooltipSpecialCharSizeX
            };

            foreach (var specialChar in specialCharacters.Values)
            {
                if (specialChar.Bmp != null)
                {
                    specialChar.Width = (int)g.GetBitmapWidth(specialChar.Bmp);
                }
                specialChar.Height = tooltipSpecialCharSizeY;
            }
        }
コード例 #5
0
        protected override void OnRenderInitialized(RenderGraphics g)
        {
            theme        = RenderTheme.CreateResourcesForGraphics(g);
            toolbarBrush = g.CreateHorizontalGradientBrush(0, 81, ThemeBase.LightGreyFillColor1, ThemeBase.LightGreyFillColor2);

            bmpLoopNone    = g.CreateBitmapFromResource("LoopNone");
            bmpLoopSong    = g.CreateBitmapFromResource("Loop");
            bmpLoopPattern = g.CreateBitmapFromResource("LoopPattern");
            bmpPlay        = g.CreateBitmapFromResource("Play");
            bmpPause       = g.CreateBitmapFromResource("Pause");

            buttons[ButtonNew] = new Button {
                X = 4, Y = 4, Bmp = g.CreateBitmapFromResource("File"), Click = OnNew
            };
            buttons[ButtonOpen] = new Button {
                X = 44, Y = 4, Bmp = g.CreateBitmapFromResource("Open"), Click = OnOpen
            };
            buttons[ButtonSave] = new Button {
                X = 84, Y = 4, Bmp = g.CreateBitmapFromResource("Save"), Click = OnSave, RightClick = OnSaveAs
            };
            buttons[ButtonExport] = new Button {
                X = 124, Y = 4, Bmp = g.CreateBitmapFromResource("Export"), Click = OnExport
            };
            buttons[ButtonCopy] = new Button {
                X = 164, Y = 4, Bmp = g.CreateBitmapFromResource("Copy"), Click = OnCopy, Enabled = OnCopyEnabled
            };
            buttons[ButtonCut] = new Button {
                X = 204, Y = 4, Bmp = g.CreateBitmapFromResource("Cut"), Click = OnCut, Enabled = OnCutEnabled
            };
            buttons[ButtonPaste] = new Button {
                X = 244, Y = 4, Bmp = g.CreateBitmapFromResource("Paste"), Click = OnPaste, RightClick = OnPasteSpecial, Enabled = OnPasteEnabled
            };
            buttons[ButtonUndo] = new Button {
                X = 284, Y = 4, Bmp = g.CreateBitmapFromResource("Undo"), Click = OnUndo, Enabled = OnUndoEnabled
            };
            buttons[ButtonRedo] = new Button {
                X = 324, Y = 4, Bmp = g.CreateBitmapFromResource("Redo"), Click = OnRedo, Enabled = OnRedoEnabled
            };
            buttons[ButtonConfig] = new Button {
                X = 364, Y = 4, Bmp = g.CreateBitmapFromResource("Config"), Click = OnConfig
            };
            buttons[ButtonPlay] = new Button {
                X = 594, Y = 4, Click = OnPlay, GetBitmap = OnPlayGetBitmap
            };
            buttons[ButtonRewind] = new Button {
                X = 634, Y = 4, Bmp = g.CreateBitmapFromResource("Rewind"), Click = OnRewind
            };
            buttons[ButtonLoop] = new Button {
                X = 674, Y = 4, Click = OnLoop, GetBitmap = OnLoopGetBitmap
            };

            buttons[ButtonNew].ToolTip    = "{MouseLeft} New Project {Ctrl} {N}";
            buttons[ButtonOpen].ToolTip   = "{MouseLeft} Open Project {Ctrl} {O}";
            buttons[ButtonSave].ToolTip   = "{MouseLeft} Save Project {Ctrl} {S}  - {MouseRight} Save As...";
            buttons[ButtonExport].ToolTip = "{MouseLeft} Export to various formats {Ctrl} {E}";
            buttons[ButtonCopy].ToolTip   = "{MouseLeft} Copy selection {Ctrl} {C}";
            buttons[ButtonCut].ToolTip    = "{MouseLeft} Cut selection {Ctrl} {X}";
            buttons[ButtonPaste].ToolTip  = "{MouseLeft} Paste {Ctrl} {V}\n{MouseRight} Paste Special... {Ctrl} {Shift} {V}";
            buttons[ButtonUndo].ToolTip   = "{MouseLeft} Undo {Ctrl} {Z}";
            buttons[ButtonRedo].ToolTip   = "{MouseLeft} Redo {Ctrl} {Y}";
            buttons[ButtonConfig].ToolTip = "{MouseLeft} Edit Application Settings";
            buttons[ButtonPlay].ToolTip   = "{MouseLeft} Play/Pause {Space}\nPlay pattern loop {Ctrl} {Space}  - Play song loop {Shift} {Space}";
            buttons[ButtonRewind].ToolTip = "{MouseLeft} Rewind {Home}\nRewind to beginning of current pattern {Ctrl} {Home}";
            buttons[ButtonLoop].ToolTip   = "{MouseLeft} Toggle Loop Mode";

            var scaling = RenderTheme.MainWindowScaling;

            for (int i = 0; i < ButtonCount; i++)
            {
                var btn = buttons[i];
                btn.X    = (int)(btn.X * scaling);
                btn.Y    = (int)(btn.Y * scaling);
                btn.Size = (int)(btn.Size * scaling);
            }

            timecodePosX            = (int)(DefaultTimecodePosX * scaling);
            timecodePosY            = (int)(DefaultTimecodePosY * scaling);
            timecodeSizeX           = (int)(DefaultTimecodeSizeX * scaling);
            timecodeTextPosX        = (int)(DefaultTimecodeTextPosX * scaling);
            tooltipSingleLinePosY   = (int)(DefaultTooltipSingleLinePosY * scaling);
            tooltipMultiLinePosY    = (int)(DefaultTooltipMultiLinePosY * scaling);
            tooltipLineSizeY        = (int)(DefaultTooltipLineSizeY * scaling);
            tooltipSpecialCharSizeX = (int)(DefaultTooltipSpecialCharSizeX * scaling);
            tooltipSpecialCharSizeY = (int)(DefaultTooltipSpecialCharSizeY * scaling);

            specialCharacters["Shift"] = new TooltipSpecialCharacter {
                Width = (int)(32 * scaling)
            };
            specialCharacters["Space"] = new TooltipSpecialCharacter {
                Width = (int)(38 * scaling)
            };
            specialCharacters["Home"] = new TooltipSpecialCharacter {
                Width = (int)(38 * scaling)
            };
            specialCharacters["Ctrl"] = new TooltipSpecialCharacter {
                Width = (int)(28 * scaling)
            };
            specialCharacters["Alt"] = new TooltipSpecialCharacter {
                Width = (int)(24 * scaling)
            };
            specialCharacters["Drag"] = new TooltipSpecialCharacter {
                Bmp = g.CreateBitmapFromResource("Drag"), OffsetY = 2 * scaling
            };
            specialCharacters["MouseLeft"] = new TooltipSpecialCharacter {
                Bmp = g.CreateBitmapFromResource("MouseLeft"), OffsetY = 2 * scaling
            };
            specialCharacters["MouseRight"] = new TooltipSpecialCharacter {
                Bmp = g.CreateBitmapFromResource("MouseRight"), OffsetY = 2 * scaling
            };
            specialCharacters["MouseWheel"] = new TooltipSpecialCharacter {
                Bmp = g.CreateBitmapFromResource("MouseWheel"), OffsetY = 2 * scaling
            };

            for (char i = 'A'; i <= 'Z'; i++)
            {
                specialCharacters[i.ToString()] = new TooltipSpecialCharacter {
                    Width = tooltipSpecialCharSizeX
                }
            }
            ;

            foreach (var specialChar in specialCharacters.Values)
            {
                if (specialChar.Bmp != null)
                {
                    specialChar.Width = (int)g.GetBitmapWidth(specialChar.Bmp);
                }
                specialChar.Height = tooltipSpecialCharSizeY;
            }
        }