コード例 #1
0
        public MainForm()
        {
            InitializeComponent();

            _saveHandler = new SaveHandler();
            _saveHandler.Register(new PTSaveFile());
            _saveHandler.Register(new TQSaveFile());
            _saveHandler.Register(new BMESaveFile());

            _loadHandler = new LoadHandler();
            _loadHandler.Register(new PTOpenFile());
            _loadHandler.Register(new TQOpenFile());

            var editor = m_editorForm.Editor;

            var audioList = this.m_audioList = new AudioListForm();

            audioList.OnPlayPressed       += this.AudioList_onPlayPressed;
            audioList.OnStopPressed       += this.AudioList_onStopPressed;
            audioList.OnInstrumentChanged += this.AudioList_onInstrumentChanged;

            Logs.OnLogWrite += this.Logs_OnWrite;

            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);

            m_notes = new NoteSelectForm(editor.EventsRenderer);

            editor.OnSelectItem += Editor_OnSelectItem;

            m_notes.OnSelectDataEvent += NoteSelect_OnSelectData;

            editor.OnRequestEvent += Editor_OnRequestEvent;

            m_audioList.List.SelectionChanged += AudioList_selectionChanged;

            editor.OnUndoRedo += UndoManager_OnUndoRedo;

            var eventsThemeList = editor.EventsThemeList;
            var currentTheme    = editor.CurrentEventsTheme;

            foreach (var theme in eventsThemeList)
            {
                ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem(theme.GetName());
                ThemeDropDownButton.DropDownItems.Add(toolStripMenuItem);
                if (null != toolStripMenuItem && currentTheme == theme)
                {
                    toolStripMenuItem.Checked = true;
                    ApplyEventsTheme(theme);
                }
            }

            var zonesThemeList   = editor.ZonesThemeList;
            var currentZoneTheme = editor.CurrentZonesTheme;

            foreach (var theme in zonesThemeList)
            {
                ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem(theme.GetName());
                zoneRendererToolStripDropDownButton.DropDownItems.Add(toolStripMenuItem);

                if (currentZoneTheme != theme)
                {
                    continue;
                }

                toolStripMenuItem.Checked = true;
                ApplyZonesTheme(theme);
            }

            var eventDisplayModes = GetAll <EventDisplayMode>();

            var currentEventDisplayMode = editor.EventDisplayMode;

            foreach (var eventDisplayMode in eventDisplayModes)
            {
                var toolStripMenuItem = new ToolStripMenuItem(eventDisplayMode.Value);
                eventDisplayModeToolStripDropDownButton.DropDownItems.Add(toolStripMenuItem);

                if (eventDisplayMode.Key != (int)currentEventDisplayMode)
                {
                    continue;
                }
                toolStripMenuItem.Checked = true;
                eventDisplayModeToolStripDropDownButton.Text = eventDisplayMode.Value;
            }

            AllowDrop = true;
        }