示例#1
0
        internal MIDIConverterDialog()
        {
            var openButton = new ThemedButton
            {
                Location = new Point(150, 0),
                Text     = "Open MIDI"
            };

            openButton.Click += OpenMIDI;
            previewButton     = new ThemedButton
            {
                Enabled  = false,
                Location = new Point(150, 50),
                Text     = "Preview Song"
            };
            previewButton.Click += PreviewASM;
            sizeLabel            = new ThemedLabel
            {
                Location = new Point(0, 100),
                Size     = new Size(150, 23)
            };
            offsetValueBox = new ValueTextBox
            {
                Hexadecimal = true,
                Maximum     = ROM.Capacity - 1,
                Value       = SongPlayer.Song.VoiceTable.Offset - ROM.Pak
            };

            Controls.AddRange(new Control[] { openButton, previewButton, sizeLabel, offsetValueBox });
            FormBorderStyle = FormBorderStyle.FixedDialog;
            MaximizeBox     = false;
            Size            = new Size(600, 400);
            Text            = "GBA Music Studio ― MIDI Converter";
        }
示例#2
0
        public AssemblerDialog()
        {
            var openButton = new ThemedButton
            {
                Location = new Point(150, 0),
                Text     = "Apri File"
            };

            openButton.Click += OpenASM;
            previewButton     = new ThemedButton
            {
                Enabled  = false,
                Location = new Point(150, 50),
                Size     = new Size(120, 23),
                Text     = "Anteprima Canzone"
            };
            previewButton.Click += PreviewASM;
            sizeLabel            = new ThemedLabel
            {
                Location = new Point(0, 100),
                Size     = new Size(150, 23)
            };
            offsetValueBox = new ValueTextBox
            {
                Hexadecimal = true,
                Maximum     = ROM.Capacity - 1
            };
            headerLabelTextBox = new ThemedTextBox {
                Location = new Point(0, 50), Size = new Size(150, 22)
            };
            addedDefsGrid = new DataGridView
            {
                ColumnCount = 2,
                Location    = new Point(0, 150),
                MultiSelect = false
            };
            addedDefsGrid.Columns[0].Name = "Definizione";
            addedDefsGrid.Columns[1].Name = "Valore";
            addedDefsGrid.Columns[1].DefaultCellStyle.NullValue = "0";
            addedDefsGrid.Rows.Add(new string[] { "voicegroup000", $"0x{SongPlayer.Instance.Song.VoiceTable.GetOffset() + ROM.Pak:X7}" });
            addedDefsGrid.CellValueChanged += AddedDefsGrid_CellValueChanged;

            Controls.AddRange(new Control[] { openButton, previewButton, sizeLabel, offsetValueBox, headerLabelTextBox, addedDefsGrid });
            FormBorderStyle = FormBorderStyle.FixedDialog;
            MaximizeBox     = false;
            Size            = new Size(600, 400);
            Text            = "GBA Music Studio ― Assembler";
        }
        object entry; // The voice entry being edited

        public VoiceTableEditor()
        {
            int w = (600 / 2) - 12 - 6, h = 400 - 12 - 11;

            // Main VoiceTable view
            voicesListView = new ObjectListView
            {
                FullRowSelect = true,
                HeaderStyle   = ColumnHeaderStyle.Nonclickable,
                HideSelection = false,
                Location      = new Point(12, 12),
                MultiSelect   = false,
                ShowGroups    = false,
                Size          = new Size(w, h)
            };
            voicesListView.FormatRow += FormatRow;
            OLVColumn c1, c2, c3;

            c1 = new OLVColumn("#", "");
            c2 = new OLVColumn("Type", "ToString");
            c3 = new OLVColumn("Offset", "GetOffset")
            {
                AspectToStringFormat = "0x{0:X7}"
            };
            c1.Width     = 45;
            c2.Width     = c3.Width = 108;
            c1.Hideable  = c2.Hideable = c3.Hideable = false;
            c1.TextAlign = c2.TextAlign = c3.TextAlign = HorizontalAlignment.Center;
            voicesListView.AllColumns.AddRange(new OLVColumn[] { c1, c2, c3 });
            voicesListView.RebuildColumns();
            voicesListView.SelectedIndexChanged += MainIndexChanged;

            int h2 = (h / 2) - 5;

            // View of the selected voice's sub-voices
            subVoicesListView = new ObjectListView
            {
                FullRowSelect = true,
                HeaderStyle   = ColumnHeaderStyle.Nonclickable,
                HideSelection = false,
                Location      = new Point(306, 12),
                MultiSelect   = false,
                ShowGroups    = false,
                Size          = new Size(w, h2)
            };
            subVoicesListView.FormatRow += FormatRow;
            c1 = new OLVColumn("#", "");
            c2 = new OLVColumn("Type", "ToString");
            c3 = new OLVColumn("Offset", "GetOffset")
            {
                AspectToStringFormat = "0x{0:X7}"
            };
            c1.Width     = 45;
            c2.Width     = c3.Width = 108;
            c1.Hideable  = c2.Hideable = c3.Hideable = false;
            c1.TextAlign = c2.TextAlign = c3.TextAlign = HorizontalAlignment.Center;
            subVoicesListView.AllColumns.AddRange(new OLVColumn[] { c1, c2, c3 });
            subVoicesListView.RebuildColumns();
            subVoicesListView.SelectedIndexChanged += SubIndexChanged;

            // Panel to edit a voice
            voicePanel = new ThemedPanel {
                Location = new Point(306, 206), Size = new Size(w, h2)
            };

            // Panel controls
            addressLabel = new ThemedLabel {
                Location = new Point(2, 130), Text = "Address:"
            };
            voiceALabel = new ThemedLabel {
                Location = new Point(0 * w / 4 + 2, 160), Text = "A:"
            };
            voiceDLabel = new ThemedLabel {
                Location = new Point(1 * w / 4 + 2, 160), Text = "D:"
            };
            voiceSLabel = new ThemedLabel {
                Location = new Point(2 * w / 4 + 2, 160), Text = "S:"
            };
            voiceRLabel = new ThemedLabel {
                Location = new Point(3 * w / 4 + 2, 160), Text = "R:"
            };
            addressLabel.AutoSize    =
                voiceALabel.AutoSize = voiceDLabel.AutoSize = voiceSLabel.AutoSize = voiceRLabel.AutoSize = true;

            addressValue = new ValueTextBox {
                Location = new Point(w / 5, 127), Size = new Size(78, 24)
            };
            voiceAValue = new ValueTextBox {
                Location = new Point(0 * w / 4 + 20, 157)
            };
            voiceDValue = new ValueTextBox {
                Location = new Point(1 * w / 4 + 20, 157)
            };
            voiceSValue = new ValueTextBox {
                Location = new Point(2 * w / 4 + 20, 157)
            };
            voiceRValue = new ValueTextBox {
                Location = new Point(3 * w / 4 + 20, 157)
            };
            voiceAValue.Size          = voiceDValue.Size = voiceSValue.Size = voiceRValue.Size = new Size(44, 22);
            voiceAValue.ValueChanged += ArgumentChanged; voiceDValue.ValueChanged += ArgumentChanged; voiceSValue.ValueChanged += ArgumentChanged; voiceRValue.ValueChanged += ArgumentChanged;

            voicePanel.Controls.AddRange(new Control[] { addressLabel, addressValue,
                                                         voiceALabel, voiceDLabel, voiceSLabel, voiceRLabel,
                                                         voiceAValue, voiceDValue, voiceSValue, voiceRValue });

            ClientSize = new Size(600, 400);
            Controls.AddRange(new Control[] { voicesListView, subVoicesListView, voicePanel });
            FormBorderStyle = FormBorderStyle.FixedDialog;
            MaximizeBox     = false;

            UpdateTable();
        }