예제 #1
0
        public MainForm()
        {
            components = new Container();

            // Main Menu
            openROMToolStripMenuItem = new ToolStripMenuItem {
                Text = "Apri ROM", ShortcutKeys = Keys.Control | Keys.O
            };
            openROMToolStripMenuItem.Click += OpenROM;

            openMIDIToolStripMenuItem = new ToolStripMenuItem {
                Text = "Apri File MIDI", Enabled = false, ShortcutKeys = Keys.Control | Keys.M
            };
            openMIDIToolStripMenuItem.Click += OpenMIDIConverter;

            openASMToolStripMenuItem = new ToolStripMenuItem {
                Text = "Apri File ASM", Enabled = false, ShortcutKeys = Keys.Control | Keys.Shift | Keys.M
            };
            openASMToolStripMenuItem.Click += OpenAssembler;

            configToolStripMenuItem = new ToolStripMenuItem {
                Text = "Ricarica Config", ShortcutKeys = Keys.Control | Keys.R
            };
            configToolStripMenuItem.Click += ReloadConfig;

            fileToolStripMenuItem = new ToolStripMenuItem {
                Text = "File"
            };
            fileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { openROMToolStripMenuItem, openMIDIToolStripMenuItem, openASMToolStripMenuItem, configToolStripMenuItem });


            teToolStripMenuItem = new ToolStripMenuItem {
                Text = "Editor Traccia", Enabled = false, ShortcutKeys = Keys.Control | Keys.T
            };
            teToolStripMenuItem.Click += OpenTrackEditor;

            vteToolStripMenuItem = new ToolStripMenuItem {
                Text = "Editor VoiceTable", Enabled = false, ShortcutKeys = Keys.Control | Keys.V
            };
            vteToolStripMenuItem.Click += OpenVoiceTableEditor;

            eSf2ToolStripMenuItem = new ToolStripMenuItem {
                Text = "Esporta Voicetable In SF2", Enabled = false
            };
            eSf2ToolStripMenuItem.Click += ExportSF2;

            eASMToolStripMenuItem = new ToolStripMenuItem {
                Text = "Esporta Canzone In ASM", Enabled = false
            };
            eASMToolStripMenuItem.Click += ExportASM;

            eMIDIToolStripMenuItem = new ToolStripMenuItem {
                Text = "Esporta Canzone In MIDI", Enabled = false
            };
            eMIDIToolStripMenuItem.Click += ExportMIDI;

            dataToolStripMenuItem = new ToolStripMenuItem {
                Text = "Data"
            };
            dataToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { teToolStripMenuItem, vteToolStripMenuItem, eSf2ToolStripMenuItem, eASMToolStripMenuItem, eMIDIToolStripMenuItem });


            mainMenu = new MenuStrip {
                Size = new Size(iWidth, 24)
            };
            mainMenu.Items.AddRange(new ToolStripItem[] { fileToolStripMenuItem, dataToolStripMenuItem });

            // Buttons
            playButton = new ThemedButton {
                ForeColor = Color.MediumSpringGreen, Location = new Point(5, 3), Text = "Play"
            };
            playButton.Click += Play;
            pauseButton       = new ThemedButton {
                ForeColor = Color.DeepSkyBlue, Location = new Point(85, 3), Text = "Pausa"
            };
            pauseButton.Click += Pause;
            stopButton         = new ThemedButton {
                ForeColor = Color.MediumVioletRed, Location = new Point(166, 3), Text = "Stop"
            };
            stopButton.Click += Stop;

            playButton.Enabled = pauseButton.Enabled = stopButton.Enabled = false;
            playButton.Size    = stopButton.Size = new Size(75, 23);
            pauseButton.Size   = new Size(76, 23);

            // Numericals
            songNumerical = new ThemedNumeric {
                Enabled = false, Location = new Point(246, 4)
            };
            tableNumerical = new ThemedNumeric {
                Location = new Point(246, 35), Maximum = 0, Visible = false
            };

            songNumerical.Size           = tableNumerical.Size = new Size(45, 23);
            songNumerical.ValueChanged  += LoadSong;
            tableNumerical.ValueChanged += TableIndexChanged;

            // Labels
            creatorLabel = new ThemedLabel {
                Location = new Point(3, 43), Size = new Size(72, 13)
            };
            gameLabel = new ThemedLabel {
                Location = new Point(3, 30), Size = new Size(66, 13)
            };
            codeLabel = new ThemedLabel {
                Location = new Point(3, 56), Size = new Size(63, 13)
            };

            creatorLabel.AutoSize  = gameLabel.AutoSize = codeLabel.AutoSize = true;
            creatorLabel.TextAlign = gameLabel.TextAlign = codeLabel.TextAlign = ContentAlignment.MiddleCenter;

            // Timer
            timer       = new Timer(components);
            timer.Tick += UpdateUI;

            // Piano
            piano = new PianoControl {
                Anchor = AnchorStyles.Bottom, Location = new Point(0, 125 - 50 - 1), Size = new Size(iWidth, 50)
            };

            // Volume bar & Position bar
            int sWidth = (int)(iWidth / sfWidth);
            int sX     = iWidth - sWidth - 4;

            positionBar = new ColorSlider()
            {
                Anchor   = AnchorStyles.Top | AnchorStyles.Right,
                Enabled  = false,
                Location = new Point(sX, 45),
                Maximum  = 0,
                Size     = new Size(sWidth, 27)
            };
            positionBar.MouseUp   += SetPosition;
            positionBar.MouseDown += (o, e) => drag = true;
            volumeBar              = new ColorSlider()
            {
                LargeChange = 20,
                Location    = new Point(83, 45),
                Maximum     = 100,
                Size        = new Size(155, 27),
                SmallChange = 5
            };
            volumeBar.ValueChanged += (o, e) => SoundMixer.Instance.MasterVolume = (volumeBar.Value / (float)volumeBar.Maximum);
            volumeBar.Value         = Config.Instance.Volume; // Update MusicPlayer volume

            // Playlist box
            ImageList il = new ImageList(components)
            {
                ColorDepth       = ColorDepth.Depth16Bit,
                ImageSize        = new Size(64, 64),
                TransparentColor = Color.Transparent
            };

            il.Images.AddRange(new Image[] { Resources.PlaylistIcon, Resources.SongIcon });
            songsComboBox = new ImageComboBox.ImageComboBox()
            {
                Anchor    = AnchorStyles.Top | AnchorStyles.Right,
                Enabled   = false,
                ImageList = il,
                Indent    = 15,
                Location  = new Point(sX, 4),
                Size      = new Size(sWidth, 23)
            };
            songsComboBox.SelectedIndexChanged += SongsComboBox_SelectedIndexChanged;

            // Track info
            trackInfo = new TrackInfoControl()
            {
                Dock = DockStyle.Fill,
                Size = new Size(iWidth, 690)
            };

            // Split container
            splitContainer = new SplitContainer()
            {
                BackColor        = Theme.TitleBar,
                Dock             = DockStyle.Fill,
                FixedPanel       = FixedPanel.Panel1,
                IsSplitterFixed  = true,
                Orientation      = Orientation.Horizontal,
                Size             = new Size(iWidth, iHeight),
                SplitterDistance = 125,
                SplitterWidth    = 1
            };
            splitContainer.Panel1.Controls.AddRange(new Control[] { playButton, creatorLabel, gameLabel, codeLabel, pauseButton, stopButton, songNumerical, tableNumerical, songsComboBox, piano, positionBar, volumeBar });
            splitContainer.Panel2.Controls.Add(trackInfo);

            // MainForm
            AutoScaleDimensions = new SizeF(6F, 13F);
            AutoScaleMode       = AutoScaleMode.Font;
            ClientSize          = new Size(iWidth, iHeight);
            Controls.AddRange(new Control[] { splitContainer, mainMenu });
            Icon          = Resources.Icon;
            MainMenuStrip = mainMenu;
            MinimumSize   = new Size(8 + iWidth + 8, 30 + iHeight + 8); // Borders
            SongPlayer.Instance.SongEnded += () => stopUI = true;
            Resize += OnResize;
            Text    = "GBA Music Studio";
        }
예제 #2
0
 public PianoKey(PianoControl piano)
 {
     owner   = piano;
     TabStop = false;
 }