Logo Search packages:      
Sourcecode: cadencii version File versions  Download package

org::kbinani::cadencii::FormMain::FormMain ( FormMainController  controller,
String  file 
) [inline]

コンストラクタ

Parameters:
file最初に開くxvsq,vsqファイルのパス

Definition at line 566 of file FormMain.cs.

References org::kbinani::cadencii::AppManager::baseFont10, org::kbinani::cadencii::AppManager::baseFont10Bold, org::kbinani::cadencii::AppManager::baseFont50Bold, org::kbinani::cadencii::AppManager::baseFont8, org::kbinani::cadencii::AppManager::baseFont9, org::kbinani::cadencii::PropertyPanelState::Bounds, org::kbinani::cadencii::EditorConfig::DefaultSingerName, org::kbinani::cadencii::EditorConfig::DefaultSynthesizer, org::kbinani::cadencii::EditorConfig::DefaultXScale, org::kbinani::cadencii::AppManager::EditedStateChanged, org::kbinani::cadencii::AppManager::editorConfig, org::kbinani::cadencii::EditorConfig::FormIconPaletteLocation, org::kbinani::vsq::VsqFile::getPreMeasureClocks(), org::kbinani::cadencii::FormMainController::getScaleXInv(), org::kbinani::cadencii::FormMainController::getScaleY(), org::kbinani::cadencii::AppManager::getSingerListFromRendererKind(), org::kbinani::cadencii::AppManager::getVersionStringFromRendererKind(), org::kbinani::cadencii::AppManager::getVsqFile(), org::kbinani::cadencii::AppManager::GridVisibleChanged, org::kbinani::cadencii::AppManager::iconPalette, org::kbinani::cadencii::EditorConfig::IconPaletteVisible, org::kbinani::PortUtil::isPointInScreens(), org::kbinani::cadencii::AppManager::itemSelection, org::kbinani::cadencii::EditorConfig::Language, org::kbinani::cadencii::AppManager::MainWindowFocusRequired, org::kbinani::cadencii::AppManager::mAutoScroll, org::kbinani::cadencii::EditorConfig::MaximumFrameRate, org::kbinani::cadencii::AppManager::mInputTextBox, org::kbinani::cadencii::EditorConfig::MixerVisible, org::kbinani::cadencii::AppManager::mMixerWindow, org::kbinani::cadencii::EditorConfig::OverviewEnabled, org::kbinani::cadencii::AppManager::PreviewAborted, org::kbinani::cadencii::AppManager::PreviewStarted, org::kbinani::cadencii::EditorConfig::QuantizeModeChanged, org::kbinani::cadencii::ItemSelectionModel::SelectedEventChanged, org::kbinani::cadencii::AppManager::SelectedToolChanged, org::kbinani::cadencii::AppManager::setCurrentClock(), org::kbinani::cadencii::EditorConfig::ShowExpLine, org::kbinani::cadencii::EditorConfig::ShowLyric, org::kbinani::cadencii::PropertyPanelState::State, org::kbinani::vsq::VsqFile::TotalClocks, org::kbinani::vsq::VsqFile::Track, org::kbinani::cadencii::AppManager::UpdateBgmStatusRequired, org::kbinani::cadencii::FormMixer::updateStatus(), org::kbinani::cadencii::CurveType::VEL, org::kbinani::cadencii::EditorConfig::ViewWaveform, org::kbinani::cadencii::AppManager::WaveViewReloadRequired, org::kbinani::cadencii::EditorConfig::WindowMaximized, and org::kbinani::cadencii::EditorConfig::WindowRect.

        {
#if JAVA
                super();
#endif
            this.controller = controller;
            this.controller.setupUi( this );

            // 言語設定を反映させる
            Messaging.setLanguage( AppManager.editorConfig.Language );

#if ENABLE_PROPERTY
            AppManager.propertyPanel = new PropertyPanel();
            AppManager.propertyWindow = new FormNoteProperty();
            AppManager.propertyWindow.addComponent( AppManager.propertyPanel );
#endif

#if DEBUG
            AppManager.debugWriteLine( "FormMain..ctor()" );
#endif
            AppManager.baseFont10Bold = new Font( AppManager.editorConfig.BaseFontName, java.awt.Font.BOLD, AppManager.FONT_SIZE10 );
            AppManager.baseFont8 = new Font( AppManager.editorConfig.BaseFontName, java.awt.Font.PLAIN, AppManager.FONT_SIZE8 );
            AppManager.baseFont10 = new Font( AppManager.editorConfig.BaseFontName, java.awt.Font.PLAIN, AppManager.FONT_SIZE10 );
            AppManager.baseFont9 = new Font( AppManager.editorConfig.BaseFontName, java.awt.Font.PLAIN, AppManager.FONT_SIZE9 );
            AppManager.baseFont50Bold = new Font( AppManager.editorConfig.BaseFontName, java.awt.Font.BOLD, AppManager.FONT_SIZE50 );

            s_modifier_key = 
#if JAVA_MAC
                InputEvent.META_MASK;
#else
                InputEvent.CTRL_MASK;
#endif
            VsqFileEx tvsq = 
                new VsqFileEx( 
                    AppManager.editorConfig.DefaultSingerName,
                    1,
                    4,
                    4,
                    500000 );
            RendererKind kind = AppManager.editorConfig.DefaultSynthesizer;
            String renderer = AppManager.getVersionStringFromRendererKind( kind );
            Vector<VsqID> singers = AppManager.getSingerListFromRendererKind( kind );
            tvsq.Track.get( 1 ).changeRenderer( renderer, singers );
            AppManager.setVsqFile( tvsq );

            trackSelector = new TrackSelector( this ); // initializeで引数なしのコンストラクタが呼ばれるのを予防
#if !JAVA
            //TODO: javaのwaveViewはどこで作られるんだっけ?
            waveView = new WaveView();
#endif
            //TODO: これはひどい
            panelWaveformZoom = (WaveformZoomUiImpl)(new WaveformZoomController( this, waveView )).getUi();

#if JAVA
            initialize();
            timer = new BTimer();
            getCMenuPiano();
            getCMenuTrackTab();
            getCMenuTrackSelector();
// MIDIステップ入力は使えないことにする
//            toolStripTool.remove( getStripBtnStepSequencer() );
#else
            InitializeComponent();
            timer = new BTimer( this.components );
#endif

            panelOverview.setMainForm( this );
            pictPianoRoll.setMainForm( this );
            bgWorkScreen = new BBackgroundWorker();

#if JAVA
#else
            this.panelWaveformZoom.Controls.Add( this.waveView );
            this.waveView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.waveView.BackColor = System.Drawing.Color.FromArgb( ((int)(((byte)(212)))), ((int)(((byte)(212)))), ((int)(((byte)(212)))) );
            this.waveView.Location = new System.Drawing.Point( 66, 0 );
            this.waveView.Margin = new System.Windows.Forms.Padding( 0 );
            this.waveView.Name = "waveView";
            this.waveView.Size = new System.Drawing.Size( 355, 59 );
            this.waveView.TabIndex = 17;
#endif
            openXmlVsqDialog = new BFileChooser();
            openXmlVsqDialog.addFileFilter( "VSQ Format(*.vsq)|*.vsq" );
            openXmlVsqDialog.addFileFilter( "XML-VSQ Format(*.xvsq)|*.xvsq" );

            saveXmlVsqDialog = new BFileChooser();
            saveXmlVsqDialog.addFileFilter( "VSQ Format(*.vsq)|*.vsq" );
            saveXmlVsqDialog.addFileFilter( "XML-VSQ Format(*.xvsq)|*.xvsq" );
            saveXmlVsqDialog.addFileFilter( "All files(*.*)|*.*" );

            openUstDialog = new BFileChooser();
            openUstDialog.addFileFilter( "UTAU Project File(*.ust)|*.ust" );
            openUstDialog.addFileFilter( "All Files(*.*)|*.*" );

            openMidiDialog = new BFileChooser();
            saveMidiDialog = new BFileChooser();
            openWaveDialog = new BFileChooser();

            /*mOverviewScaleCount = AppManager.editorConfig.OverviewScaleCount;
            mOverviewPixelPerClock = getOverviewScaleX( mOverviewScaleCount );*/

            menuVisualOverview.setSelected( AppManager.editorConfig.OverviewEnabled );
#if ENABLE_PROPERTY
            mPropertyPanelContainer = new PropertyPanelContainer();
#endif

            registerEventHandlers();
            setResources();

#if !ENABLE_SCRIPT
            menuSettingPaletteTool.setVisible( false );
            menuScript.setVisible( false );
#endif
            trackSelector.updateVisibleCurves();
            trackSelector.setBackground( new Color( 108, 108, 108 ) );
            trackSelector.setCurveVisible( true );
            trackSelector.setSelectedCurve( CurveType.VEL );
#if !JAVA
            trackSelector.setLocation( new Point( 0, 242 ) );
            trackSelector.Margin = new System.Windows.Forms.Padding( 0 );
            trackSelector.Name = "trackSelector";
            trackSelector.setSize( 446, 250 );
            trackSelector.TabIndex = 0;
#endif
            trackSelector.MouseClick += new BMouseEventHandler( trackSelector_MouseClick );
            trackSelector.MouseUp += new BMouseEventHandler( trackSelector_MouseUp );
            trackSelector.MouseDown += new BMouseEventHandler( trackSelector_MouseDown );
            trackSelector.MouseMove += new BMouseEventHandler( trackSelector_MouseMove );
            trackSelector.KeyDown += new BKeyEventHandler( handleSpaceKeyDown );
            trackSelector.KeyUp += new BKeyEventHandler( handleSpaceKeyUp );
            trackSelector.PreviewKeyDown += new BPreviewKeyDownEventHandler( trackSelector_PreviewKeyDown );
            trackSelector.SelectedTrackChanged += new SelectedTrackChangedEventHandler( trackSelector_SelectedTrackChanged );
            trackSelector.SelectedCurveChanged += new SelectedCurveChangedEventHandler( trackSelector_SelectedCurveChanged );
            trackSelector.RenderRequired += new RenderRequiredEventHandler( trackSelector_RenderRequired );
            trackSelector.PreferredMinHeightChanged += new BEventHandler( trackSelector_PreferredMinHeightChanged );
            trackSelector.MouseDoubleClick += new BMouseEventHandler( trackSelector_MouseDoubleClick );

#if !JAVA
            splitContainer1.Panel2MinSize = trackSelector.getPreferredMinSize();
            this.setMinimumSize( getWindowMinimumSize() );
#endif
#if JAVA
            stripBtnScroll.setSelected( AppManager.mAutoScroll );
#else
            stripBtnScroll.Pushed = AppManager.mAutoScroll;
#endif

            applySelectedTool();
            applyQuantizeMode();

            // Palette Toolの読み込み
#if ENABLE_SCRIPT
            updatePaletteTool();
#endif

#if !JAVA
            splitContainer1.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.None;
            splitContainer1.Panel2.BorderStyle = System.Windows.Forms.BorderStyle.None;
            splitContainer1.BackColor = System.Drawing.Color.FromArgb( 212, 212, 212 );
            splitContainer2.Panel1.Controls.Add( panel1 );
            panel1.Dock = System.Windows.Forms.DockStyle.Fill;
            splitContainer2.Panel2.Controls.Add( panelWaveformZoom );
            //splitContainer2.Panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            splitContainer2.Panel2.BorderColor = System.Drawing.Color.FromArgb( 112, 112, 112 );
            splitContainer1.Panel1.Controls.Add( splitContainer2 );
            panelWaveformZoom.Dock = System.Windows.Forms.DockStyle.Fill;
            splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
            splitContainer1.Panel2.Controls.Add( trackSelector );
            trackSelector.Dock = System.Windows.Forms.DockStyle.Fill;
            splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
            splitContainer1.Panel2MinSize = trackSelector.getPreferredMinSize();
            splitContainerProperty.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
#endif

#if ENABLE_PROPERTY
#if JAVA
            splitContainerProperty.setLeftComponent( mPropertyPanelContainer );
            mPropertyPanelContainer.setMinimumSize( new Dimension( 0, 0 ) );
#else
            splitContainerProperty.Panel1.Controls.Add( mPropertyPanelContainer );
            mPropertyPanelContainer.Dock = System.Windows.Forms.DockStyle.Fill;
#endif
#else
            splitContainerProperty.setDividerLocation( 0 );
            splitContainerProperty.setEnabled( false );
            menuVisualProperty.setVisible( false );
#endif

#if !JAVA
            splitContainerProperty.Panel2.Controls.Add( splitContainer1 );
            splitContainerProperty.Dock = System.Windows.Forms.DockStyle.Fill;

            // コントロールの位置・サイズを調節
            splitContainer2.Panel1.SuspendLayout();
            panel1.SuspendLayout();
            pictPianoRoll.SuspendLayout();
            vScroll.SuspendLayout();
            // panel1の中身は
            // picturePositionIndicator
            picturePositionIndicator.Left = 0;
            picturePositionIndicator.Top = 0;
            picturePositionIndicator.Width = panel1.Width;
            // pictPianoRoll
            pictPianoRoll.setBounds( 0, picturePositionIndicator.Height, panel1.Width - vScroll.Width, panel1.Height - picturePositionIndicator.Height - hScroll.Height );
            // vScroll
            vScroll.Left = pictPianoRoll.getWidth();
            vScroll.Top = picturePositionIndicator.Height;
            vScroll.Height = pictPianoRoll.getHeight();
            // pictureBox3
            pictureBox3.Left = 0;
            pictureBox3.Top = panel1.Height - hScroll.getHeight();
            pictureBox3.Height = hScroll.Height;
            // hScroll
            hScroll.Left = pictureBox3.Width;
            hScroll.Top = panel1.Height - hScroll.Height;
            hScroll.Width = panel1.Width - pictureBox3.Width - trackBar.getWidth() - pictureBox2.Width;
            // trackBar
            trackBar.Left = pictureBox3.Width + hScroll.Width;
            trackBar.Top = panel1.Height - hScroll.Height;
            // pictureBox2
            pictureBox2.Left = panel1.Width - vScroll.Width;
            pictureBox2.Top = panel1.Height - hScroll.Height;

            vScroll.ResumeLayout();
            pictPianoRoll.ResumeLayout();
            panel1.ResumeLayout();
            splitContainer2.Panel1.ResumeLayout();
#endif

            updatePropertyPanelState( AppManager.editorConfig.PropertyWindowStatus.State );

            pictPianoRoll.MouseWheel += new BMouseEventHandler( pictPianoRoll_MouseWheel );
            trackSelector.MouseWheel += new BMouseEventHandler( trackSelector_MouseWheel );
            picturePositionIndicator.MouseWheel += new BMouseEventHandler( picturePositionIndicator_MouseWheel );

            menuVisualOverview.CheckedChanged += new BEventHandler( menuVisualOverview_CheckedChanged );

            hScroll.setMaximum( AppManager.getVsqFile().TotalClocks + 240 );
            hScroll.setVisibleAmount( 240 * 4 );

            vScroll.setMaximum( (int)(controller.getScaleY() * 100 * 128) );
            vScroll.setVisibleAmount( 24 * 4 );
#if !JAVA
            hScroll.SmallChange = 240;
            vScroll.SmallChange = 24;
#endif

            trackSelector.setCurveVisible( true );

            // inputTextBoxの初期化
#if JAVA
            AppManager.mInputTextBox = new LyricTextBox( this );
            AppManager.mInputTextBox.setVisible( false );
            AppManager.mInputTextBox.setSize( 80, 22 );
            AppManager.mInputTextBox.setBackground( Color.white );
            AppManager.mInputTextBox.setFont( new Font( AppManager.editorConfig.BaseFontName, java.awt.Font.PLAIN, 9 ) );
            AppManager.mInputTextBox.setEnabled( false );
            AppManager.mInputTextBox.keyPressEvent.add( new BKeyPressEventHandler( this, "mInputTextBox_KeyPress" ) );
#else
            AppManager.mInputTextBox = new LyricTextBox();
            AppManager.mInputTextBox.setVisible( false );
            AppManager.mInputTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
            AppManager.mInputTextBox.Width = 80;
            AppManager.mInputTextBox.AcceptsReturn = true;
            AppManager.mInputTextBox.setBackground( Color.white );
            AppManager.mInputTextBox.setFont( new Font( AppManager.editorConfig.BaseFontName, java.awt.Font.PLAIN, AppManager.FONT_SIZE9 ) );
            AppManager.mInputTextBox.setEnabled( false );
            AppManager.mInputTextBox.KeyPress += mInputTextBox_KeyPress;
            AppManager.mInputTextBox.Parent = pictPianoRoll;
            panel1.Controls.Add( AppManager.mInputTextBox );
#endif

            int fps = 1000 / AppManager.editorConfig.MaximumFrameRate;
            timer.setDelay( (fps <= 0) ? 1 : fps );

#if JAVA
#if !DEBUG
            menuHelp.remove( menuHelpDebug );
#endif // !DEBUG
#else // JAVA
#if DEBUG
            menuHelpDebug.setVisible( true );
#endif // DEBUG
#endif // else JAVA

#if !JAVA
            String _HAND = "AAACAAEAICAAABAAEADoAgAAFgAAACgAAAAgAAAAQAAAAAEABAAAAAAAgAIAAAAAAAAAAAAAAAAAAAAAAAAAA" +
                "AAAgAAAAACAAACAgAAAAACAAIAAgAAAgIAAwMDAAICAgAD/AAAAAP8AAP//AAAAAP8A/wD/AAD//wD///8AAAAAAAAAAAAAAAAAAAA" +
                "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +
                "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAAAAAAAAAAAAAAAAD" +
                "//wAAAAAAAAAAAAAAAAAA//8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8AAAAA/wAAAAAAAAAAA" +
                "A//AAAAAP/wAAAAAAAAAAAP/wAAAAD/8AAAAAAAAAAAAP8AAAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +
                "AAAAAAAAA//8AAAAAAAAAAAAAAAAAAP//AAAAAAAAAAAAAAAAAAAP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +
                "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +
                "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD////////////////////////////////////////////+f////" +
                "D////gf///4H////D///8/z//+H4f//B+D//wfg//+H4f//z/P///w////4H///+B////w////+f//////////////////////////" +
                "//////////////////w==";
            System.IO.MemoryStream ms = null;
            try {
                ms = new System.IO.MemoryStream( Base64.decode( _HAND ) );
                HAND = new System.Windows.Forms.Cursor( ms );
            } catch ( Exception ex ) {
                Logger.write( typeof( FormMain ) + ".ctor; ex=" + ex + "\n" );
            } finally {
                if ( ms != null ) {
                    try {
                        ms.Close();
                    } catch ( Exception ex2 ) {
                        Logger.write( typeof( FormMain ) + ".ctor; ex=" + ex2 + "\n" );
                    }
                }
            }
#endif

            menuHelpLogSwitch.setSelected( Logger.isEnabled() );
            applyShortcut();

            AppManager.mMixerWindow = new FormMixer( this );
            AppManager.iconPalette = new FormIconPalette( this );

            // ファイルを開く
            if ( !str.compare( file, "" ) ) {
                if ( fsys.isFileExists( file ) ) {
                    String low_file = file.ToLower();
                    if ( low_file.EndsWith( ".xvsq" ) ) {
                        openVsqCor( low_file );
                        //AppManager.readVsq( file );
                    } else if ( low_file.EndsWith( ".vsq" ) ) {
                        VsqFileEx vsq = null;
                        try {
                            vsq = new VsqFileEx( file, "Shift_JIS" );
                            AppManager.setVsqFile( vsq );
                            updateBgmMenuState();
                        } catch ( Exception ex ) {
                            Logger.write( typeof( FormMain ) + ".ctor; ex=" + ex + "\n" );
                            serr.println( "FormMain#.ctor; ex=" + ex );
                        }
                    }
                }
            }

            trackBar.setValue( AppManager.editorConfig.DefaultXScale );
            AppManager.setCurrentClock( 0 );
            setEdited( false );

            AppManager.PreviewStarted += new BEventHandler( AppManager_PreviewStarted );
            AppManager.PreviewAborted += new BEventHandler( AppManager_PreviewAborted );
            AppManager.GridVisibleChanged += new BEventHandler( AppManager_GridVisibleChanged );
            AppManager.itemSelection.SelectedEventChanged += new SelectedEventChangedEventHandler( ItemSelectionModel_SelectedEventChanged );
            AppManager.SelectedToolChanged += new BEventHandler( AppManager_SelectedToolChanged );
            AppManager.UpdateBgmStatusRequired += new BEventHandler( AppManager_UpdateBgmStatusRequired );
            AppManager.MainWindowFocusRequired += new BEventHandler( AppManager_MainWindowFocusRequired );
            AppManager.EditedStateChanged += new EditedStateChangedEventHandler( AppManager_EditedStateChanged );
            AppManager.WaveViewReloadRequired += new WaveViewRealoadRequiredEventHandler( AppManager_WaveViewRealoadRequired );
            EditorConfig.QuantizeModeChanged += new BEventHandler( handleEditorConfig_QuantizeModeChanged );

#if ENABLE_PROPERTY
            mPropertyPanelContainer.StateChangeRequired += new StateChangeRequiredEventHandler( mPropertyPanelContainer_StateChangeRequired );
#endif

            updateRecentFileMenu();

            // C3が画面中央に来るように調整
            int draft_start_to_draw_y = 68 * (int)(100 * controller.getScaleY()) - pictPianoRoll.getHeight() / 2;
            int draft_vscroll_value = (int)((draft_start_to_draw_y * (double)vScroll.getMaximum()) / (128 * (int)(100 * controller.getScaleY()) - vScroll.getHeight()));
            try {
                vScroll.setValue( draft_vscroll_value );
            } catch ( Exception ex ) {
                Logger.write( typeof( FormMain ) + ".FormMain_Load; ex=" + ex + "\n" );
            }

            // x=97がプリメジャークロックになるように調整
            int cp = AppManager.getVsqFile().getPreMeasureClocks();
            int draft_hscroll_value = (int)(cp - 24.0 * controller.getScaleXInv());
            try {
                hScroll.setValue( draft_hscroll_value );
            } catch ( Exception ex ) {
                Logger.write( typeof( FormMain ) + ".FormMain_Load; ex=" + ex + "\n" );
            }

            //s_pen_dashed_171_171_171.DashPattern = new float[] { 3, 3 };
            //s_pen_dashed_209_204_172.DashPattern = new float[] { 3, 3 };

            menuVisualNoteProperty.setSelected( AppManager.editorConfig.ShowExpLine );
            menuVisualLyrics.setSelected( AppManager.editorConfig.ShowLyric );
            menuVisualMixer.setSelected( AppManager.editorConfig.MixerVisible );
            menuVisualPitchLine.setSelected( AppManager.editorConfig.ViewAtcualPitch );

            updateMenuFonts();

            AppManager.mMixerWindow.FederChanged += new FederChangedEventHandler( mixerWindow_FederChanged );
            AppManager.mMixerWindow.PanpotChanged += new PanpotChangedEventHandler( mixerWindow_PanpotChanged );
            AppManager.mMixerWindow.MuteChanged += new MuteChangedEventHandler( mixerWindow_MuteChanged );
            AppManager.mMixerWindow.SoloChanged += new SoloChangedEventHandler( mixerWindow_SoloChanged );
            AppManager.mMixerWindow.updateStatus();
            if ( AppManager.editorConfig.MixerVisible ) {
                AppManager.mMixerWindow.setVisible( true );
            }
            AppManager.mMixerWindow.FormClosing += new BFormClosingEventHandler( mixerWindow_FormClosing );

            Point p1 = AppManager.editorConfig.FormIconPaletteLocation.toPoint();
            if ( !PortUtil.isPointInScreens( p1 ) ) {
                Rectangle workingArea = PortUtil.getWorkingArea( this );
                p1 = new Point( workingArea.x, workingArea.y );
            }
            AppManager.iconPalette.setLocation( p1 );
            if ( AppManager.editorConfig.IconPaletteVisible ) {
                AppManager.iconPalette.setVisible( true );
            }
            AppManager.iconPalette.FormClosing += new BFormClosingEventHandler( iconPalette_FormClosing );
            AppManager.iconPalette.LocationChanged += new BEventHandler( iconPalette_LocationChanged );

            trackSelector.CommandExecuted += new BEventHandler( trackSelector_CommandExecuted );

#if ENABLE_SCRIPT
            updateScriptShortcut();
            // RunOnceという名前のスクリプトがあれば,そいつを実行
            for ( Iterator<String> itr = ScriptServer.getScriptIdIterator(); itr.hasNext(); ) {
                String id = itr.next();
                if ( str.compare( PortUtil.getFileNameWithoutExtension( id ).ToLower(), "runonce" ) ) {
                    ScriptServer.invokeScript( id, AppManager.getVsqFile() );
                    break;
                }
            }
#endif

            clearTempWave();
            updateVibratoPresetMenu();
            mPencilMode.setMode( PencilModeEnum.Off );
            updateCMenuPianoFixed();
            loadGameControler();
#if ENABLE_MIDI
            reloadMidiIn();
#endif
            menuVisualWaveform.setSelected( AppManager.editorConfig.ViewWaveform );

            updateRendererMenu();

            // ウィンドウの位置・サイズを再現
            if ( AppManager.editorConfig.WindowMaximized ) {
                setExtendedState( BForm.MAXIMIZED_BOTH );
            } else {
                setExtendedState( BForm.NORMAL );
            }
            Rectangle bounds = AppManager.editorConfig.WindowRect;
            this.setBounds( bounds );
            // ウィンドウ位置・サイズの設定値が、使えるディスプレイのどれにも被っていない場合
            Rectangle rc2 = PortUtil.getScreenBounds( this );
            if ( bounds.x < rc2.x ||
                 rc2.x + rc2.width < bounds.x + bounds.width ||
                 bounds.y < rc2.y ||
                 rc2.y + rc2.height < bounds.y + bounds.height ) {
                bounds.x = rc2.x;
                bounds.y = rc2.y;
                this.setBounds( bounds );
                AppManager.editorConfig.WindowRect = bounds;
            }
            this.WindowStateChanged += new BEventHandler( FormMain_WindowStateChanged );
            this.LocationChanged += new BEventHandler( FormMain_LocationChanged );

            updateScrollRangeHorizontal();
            updateScrollRangeVertical();

            // プロパティウィンドウの位置を復元
            Rectangle rc1 = PortUtil.getScreenBounds( this );
            Rectangle rcScreen = new Rectangle( rc1.x, rc1.y, rc1.width, rc1.height );
            Point p = this.getLocation();
            XmlRectangle xr = AppManager.editorConfig.PropertyWindowStatus.Bounds;
            Point p0 = new Point( xr.x, xr.y );
            Point a = new Point( p.x + p0.x, p.y + p0.y );
            Rectangle rc = new Rectangle( a.x,
                                          a.y,
                                          AppManager.editorConfig.PropertyWindowStatus.Bounds.getWidth(),
                                          AppManager.editorConfig.PropertyWindowStatus.Bounds.getHeight() );

            if ( a.y > rcScreen.y + rcScreen.height ) {
                a = new Point( a.x, rcScreen.y + rcScreen.height - rc.height );
            }
            if ( a.y < rcScreen.y ) {
                a = new Point( a.x, rcScreen.y );
            }
            if ( a.x > rcScreen.x + rcScreen.width ) {
                a = new Point( rcScreen.x + rcScreen.width - rc.width, a.y );
            }
            if ( a.x < rcScreen.x ) {
                a = new Point( rcScreen.x, a.y );
            }
#if DEBUG
            AppManager.debugWriteLine( "FormMain_Load; a=" + a );
#endif

#if ENABLE_PROPERTY
            AppManager.propertyWindow.setBounds( a.x, a.y, rc.width, rc.height );
            AppManager.propertyWindow.WindowStateChanged += new BEventHandler( propertyWindow_WindowStateChanged );
            AppManager.propertyWindow.LocationChanged += new BEventHandler( propertyWindow_LocationOrSizeChanged );
            AppManager.propertyWindow.SizeChanged += new BEventHandler( propertyWindow_LocationOrSizeChanged );
            AppManager.propertyWindow.FormClosing += new BFormClosingEventHandler( propertyWindow_FormClosing );
            AppManager.propertyPanel.CommandExecuteRequired += new CommandExecuteRequiredEventHandler( propertyPanel_CommandExecuteRequired );
#endif
            updateBgmMenuState();
            AppManager.mLastTrackSelectorHeight = trackSelector.getPreferredMinSize();
            flipControlCurveVisible( true );

            repaint();
            updateLayout();
#if DEBUG
            menuHidden.setVisible( true );
#else
            menuHidden.setVisible( false );
#endif

#if !ENABLE_VOCALOID
            menuTrackRenderer.remove( menuTrackRendererVOCALOID2 );
            menuTrackRenderer.remove( menuTrackRendererVOCALOID1 );
            cMenuTrackTabRenderer.remove( cMenuTrackTabRendererVOCALOID2 );
            cMenuTrackTabRenderer.remove( cMenuTrackTabRendererVOCALOID1 );
#endif

#if !ENABLE_AQUESTONE
            menuTrackRenderer.remove( menuTrackRendererAquesTone );
            cMenuTrackTabRenderer.remove( cMenuTrackTabRendererAquesTone );
#endif

#if JAVA
            menuVisual.remove( menuVisualPluginUi );
            menuSetting.remove( menuSettingGameControler );
#endif

#if JAVA_MAC
            // Macの一般的なメニュー編成にあわせる
            com.apple.eawt.Application app = com.apple.eawt.Application.getApplication();
#if JAVA_1_5
            // 「Cadenciiについて」
            app.setAboutHandler( new com.apple.eawt.AboutHandler(){
                public void handleAbout( com.apple.eawt.AppEvent.AboutEvent arg0 ) {
                    menuHelpAbout_Click( null, null );
                }
            } );

            // 「Cadenciiを終了」
            app.setQuitHandler( new com.apple.eawt.QuitHandler(){
                public void handleQuitRequestWith( com.apple.eawt.AppEvent.QuitEvent arg0, com.apple.eawt.QuitResponse arg1 ) {
                    if( handleFormClosing() ){
                        arg1.cancelQuit();
                    }else{
                        dispose();
                    }
                }
            } );

            // 「環境設定」
            app.setPreferencesHandler( new com.apple.eawt.PreferencesHandler(){
                public void handlePreferences( com.apple.eawt.AppEvent.PreferencesEvent arg0 ){
                    menuSettingPreference_Click( null, null );
                }
            });
#else // JAVA_1_5
              app.setEnabledPreferencesMenu( true );
              app.setEnabledAboutMenu( true );
              app.addApplicationListener( new com.apple.eawt.ApplicationListener(){
                        public void handleAbout(ApplicationEvent arg0) {
                      arg0.setHandled( true );
                      menuHelpAbout_Click( null, null );
                        }
      
                        public void handleOpenApplication(ApplicationEvent arg0) {
                        }
      
                        public void handleOpenFile(ApplicationEvent arg0) {
                        }
      
                        public void handlePreferences(ApplicationEvent arg0) {
                              menuSettingPreference_Click( null, null );
                        }
      
                        public void handlePrintFile(ApplicationEvent arg0) {
                        }
      
                        public void handleQuit(ApplicationEvent arg0) {
                              arg0.setHandled( !handleFormClosing() );
                        }
      
                        public void handleReOpenApplication(ApplicationEvent arg0) {
                        }
              });
#endif
              menuHelp.remove( menuHelpAbout );
              menuFile.remove( menuFileSeparator3 );
              menuFile.remove( menuFileQuit );
              menuSetting.remove( menuSettingPreference );
#endif // JAVA_MAC

#if !JAVA
#if DEBUG
            System.Collections.Generic.List<ValuePair<String, String>> list = new System.Collections.Generic.List<ValuePair<String, String>>();
            foreach ( System.Reflection.FieldInfo fi in typeof( EditorConfig ).GetFields() ) {
                if ( fi.IsPublic && !fi.IsStatic ) {
                    list.Add( new ValuePair<String, String>( fi.Name, fi.FieldType.ToString() ) );
                }
            }

            foreach ( System.Reflection.PropertyInfo pi in typeof( EditorConfig ).GetProperties() ) {
                if ( !pi.CanRead || !pi.CanWrite ) {
                    continue;
                }
                System.Reflection.MethodInfo getmethod = pi.GetGetMethod();
                System.Reflection.MethodInfo setmethod = pi.GetSetMethod();
                if ( !setmethod.IsPublic || setmethod.IsStatic ) {
                    continue;
                }
                if ( !getmethod.IsPublic || getmethod.IsStatic ) {
                    continue;
                }
                list.Add( new ValuePair<String, String>( pi.Name, pi.PropertyType.ToString() ) );
            }

            list.Sort();

            System.IO.StreamWriter sw = null;
            try {
                sw = new System.IO.StreamWriter( "EditorConfig.txt" );
                foreach ( ValuePair<String, String> s in list ) {
                    sw.WriteLine( s.Key );
                }
                sw.WriteLine( "--------------------------------------------" );
                foreach ( ValuePair<String, String> s in list ) {
                    sw.WriteLine( s.Value + "\t" + s.Key + ";" );
                }
            } catch ( Exception ex ) {
                Logger.write( typeof( FormMain ) + ".ctor; ex=" + ex + "\n" );
            } finally {
                if ( sw != null ) {
                    try {
                        sw.Close();
                    } catch ( Exception ex2 ) {
                        Logger.write( typeof( FormMain ) + ".ctor; ex=" + ex2 + "\n" );
                    }
                }
            }
#endif
#endif
        }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index