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

void org::kbinani::cadencii::FormMain::processSpecialShortcutKey ( BKeyEventArgs  e,
boolean  onPreviewKeyDown 
) [inline]

特殊なショートカットキーを処理します。

Parameters:
e
onPreviewKeyDownPreviewKeyDownイベントから送信されてきた場合、true(送る側が設定する)

Definition at line 3693 of file FormMain.cs.

References org::kbinani::cadencii::VsqFileEx::config, org::kbinani::cadencii::AppManager::editorConfig, org::kbinani::cadencii::AppManager::getCurrentClock(), org::kbinani::cadencii::AppManager::getEditMode(), org::kbinani::cadencii::AppManager::getVsqFile(), org::kbinani::cadencii::AppManager::isPlaying(), org::kbinani::cadencii::AppManager::keyWidth, org::kbinani::cadencii::AppManager::mAddingEvent, org::kbinani::cadencii::FormMain::SpecialShortcutHolder::menu, org::kbinani::cadencii::AppManager::mForbidFlipPlayingThresholdSeconds, org::kbinani::cadencii::EditorConfig::MinimumScrollHandleWidth, org::kbinani::cadencii::AppManager::mInputTextBox, org::kbinani::cadencii::AppManager::setCurrentClock(), org::kbinani::cadencii::AppManager::setPlaying(), org::kbinani::cadencii::FormMain::SpecialShortcutHolder::shortcut, org::kbinani::cadencii::EditorConfig::SpecialShortcutGoToFirst, org::kbinani::cadencii::SequenceConfig::StartMarker, org::kbinani::cadencii::SequenceConfig::StartMarkerEnabled, org::kbinani::vsq::VsqFile::TotalClocks, and org::kbinani::cadencii::EditorConfig::UseSpaceKeyAsMiddleButtonModifier.

        {
#if DEBUG
            sout.println( "FormMain#processSpecialShortcutKey" );
#endif
            // 歌詞入力用のテキストボックスが表示されていたら,何もしない
#if JAVA
            if ( AppManager.mInputTextBox.isVisible() ) {
#else
            if ( AppManager.mInputTextBox.Enabled ) {
#endif
                AppManager.mInputTextBox.requestFocus();
                return;
            }

            boolean flipPlaying = false; // 再生/停止状態の切り替えが要求されたらtrue

            // 最初に、特殊な取り扱いが必要なショートカット、について、
            // 該当するショートカットがあればそいつらを発動する。
            int modifier = PortUtil.getCurrentModifierKey();
            KeyStroke stroke = KeyStroke.getKeyStroke( e.KeyValue, modifier );
            int keycode = e.KeyValue;
#if DEBUG
            sout.println( "FormMain#processSpecialShortcutKey; stroke=" + stroke );
#endif

            if ( onPreviewKeyDown && keycode != 0 ) {
                foreach ( SpecialShortcutHolder holder in mSpecialShortcutHolders ) {
                    if ( stroke.Equals( holder.shortcut ) ) {
                        try {
#if DEBUG
                            sout.println( "FormMain#processSpecialShortcutKey; perform click: name=" + holder.menu.getName() );
#endif
#if JAVA
                            holder.menu.clickEvent.raise( holder.menu, new BEventArgs() );
#else
                            holder.menu.PerformClick();
#endif
                        } catch ( Exception ex ) {
                            Logger.write( typeof( FormMain ) + ".processSpecialShortcutKey; ex=" + ex + "\n" );
                            serr.println( "FormMain#processSpecialShortcutKey; ex=" + ex );
                        }
#if JAVA
                        if ( e.KeyValue == KeyEvent.VK_TAB ) {
#else
                        if ( e.KeyCode == System.Windows.Forms.Keys.Tab ) {
#endif
                            focusPianoRoll();
                        }
                        return;
                    }
                }
            }

            if ( modifier != KeyEvent.VK_UNDEFINED ) {
#if DEBUG
                sout.println( "FormMain#processSpecialShortcutKey; bailout with (modifier != VK_UNDEFINED)" );
#endif
                return;
            }

            EditMode edit_mode = AppManager.getEditMode();

#if JAVA
            if ( e.KeyValue == KeyEvent.VK_ENTER ) {
#else
            if ( e.KeyCode == System.Windows.Forms.Keys.Return ) {
#endif
                // MIDIステップ入力のときの処理
                if ( controller.isStepSequencerEnabled() ) {
                    if ( AppManager.mAddingEvent != null ) {
                        fixAddingEvent();
                        AppManager.mAddingEvent = null;
                        refreshScreen( true );
                    }
                }
#if JAVA
            } else if ( e.KeyValue == KeyEvent.VK_SPACE ) {
#else
            } else if ( e.KeyCode == System.Windows.Forms.Keys.Space ) {
#endif
                if ( !AppManager.editorConfig.UseSpaceKeyAsMiddleButtonModifier ) {
                    flipPlaying = true;
                }
#if JAVA
            } else if ( e.KeyValue == KeyEvent.VK_PERIOD ) {
#else
            } else if ( e.KeyCode == System.Windows.Forms.Keys.OemPeriod ) {
#endif
                if ( !onPreviewKeyDown ) {

                    if ( AppManager.isPlaying() ) {
                        AppManager.setPlaying( false, this );
                    } else {
                        VsqFileEx vsq = AppManager.getVsqFile();
                        if ( !vsq.config.StartMarkerEnabled ) {
                            AppManager.setCurrentClock( 0 );
                        } else {
                            AppManager.setCurrentClock( vsq.config.StartMarker );
                        }
                        refreshScreen();
                    }
                }
#if JAVA
            } else if( e.KeyValue == KeyEvent.VK_ADD || e.KeyValue == KeyEvent.VK_PLUS || e.KeyValue == KeyEvent.VK_RIGHT ) {
#else
            } else if ( e.KeyCode == System.Windows.Forms.Keys.Add || e.KeyCode == System.Windows.Forms.Keys.Oemplus || e.KeyCode == System.Windows.Forms.Keys.Right ) {
#endif
                if ( onPreviewKeyDown ) {
                    forward();
                }
#if JAVA
            } else if ( e.KeyValue == KeyEvent.VK_MINUS || e.KeyValue == KeyEvent.VK_LEFT ) {
#else
            } else if ( e.KeyCode == System.Windows.Forms.Keys.Subtract || e.KeyCode == System.Windows.Forms.Keys.OemMinus || e.KeyCode == System.Windows.Forms.Keys.Left ) {
#endif
                if ( onPreviewKeyDown ) {
                    rewind();
                }
#if JAVA
            } else if ( e.KeyValue == KeyEvent.VK_ESCAPE ) {
#else
            } else if ( e.KeyCode == System.Windows.Forms.Keys.Escape ) {
#endif
                // ステップ入力中の場合,入力中の音符をクリアする
                VsqEvent item = AppManager.mAddingEvent;
                if ( controller.isStepSequencerEnabled() && item != null ) {
                    // 入力中だった音符の長さを取得し,
                    int length = item.ID.getLength();
                    AppManager.mAddingEvent = null;
                    int clock = AppManager.getCurrentClock();
                    int clock_draft = clock - length;
                    if ( clock_draft < 0 ) {
                        clock_draft = 0;
                    }
                    // その分だけソングポジションを戻す.
                    AppManager.setCurrentClock( clock_draft );
                    refreshScreen( true );
                }
            } else {
                if ( !AppManager.isPlaying() ) {
                    // 最初に戻る、の機能を発動
                    BKeys[] specialGoToFirst = AppManager.editorConfig.SpecialShortcutGoToFirst;
                    if ( specialGoToFirst != null && specialGoToFirst.Length > 0 ) {
                        KeyStroke ks = BKeysUtility.getKeyStrokeFromBKeys( specialGoToFirst );
#if JAVA
                        if( e.KeyCode == ks.getKeyCode() )
#else
                        if ( e.KeyCode == ks.keys )
#endif
                        {
                            AppManager.setCurrentClock( 0 );
                            ensureCursorVisible();
                            refreshScreen();
                        }
                    }
                }
            }
            if ( !onPreviewKeyDown && flipPlaying ) {
                if ( AppManager.isPlaying() ) {
                    double elapsed = PlaySound.getPosition();
                    double threshold = AppManager.mForbidFlipPlayingThresholdSeconds;
                    if ( threshold < 0 ) {
                        threshold = 0.0;
                    }
                    if ( elapsed > threshold ) {
                        timer.stop();
                        AppManager.setPlaying( false, this );
                    }
                } else {
                    AppManager.setPlaying( true, this );
                }
            }
#if JAVA
            if ( e.KeyValue == KeyEvent.VK_TAB ) {
#else
            if ( e.KeyCode == System.Windows.Forms.Keys.Tab ) {
#endif
                focusPianoRoll();
            }
        }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index