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

void org::kbinani::cadencii::FormMain::applyShortcut (  ) [inline]

メニューのショートカットキーを、AppManager.EditorConfig.ShorcutKeysの内容に応じて変更します

Definition at line 4025 of file FormMain.cs.

References org::kbinani::cadencii::AppManager::editorConfig, org::kbinani::PortUtil::getComponentName(), org::kbinani::cadencii::AppManager::iconPalette, and org::kbinani::cadencii::AppManager::mMixerWindow.

        {
            mSpecialShortcutHolders.clear();

            TreeMap<String, BKeys[]> dict = AppManager.editorConfig.getShortcutKeysDictionary( this.getDefaultShortcutKeys() );
            #region menuStripMain
            ByRef<Object> parent = new ByRef<Object>( null );
            for ( Iterator<String> itr = dict.keySet().iterator(); itr.hasNext(); ) {
                String key = itr.next();
                if ( str.compare( key, "menuEditCopy" ) || str.compare( key, "menuEditCut" ) || str.compare( key, "menuEditPaste" ) || str.compare( key, "SpecialShortcutGoToFirst" ) ) {
                    continue;
                }
                Object menu = searchMenuItemFromName( key, parent );
                if ( menu != null ) {
                    String menu_name = "";
#if JAVA
                    if( menu instanceof Component ){
                        menu_name = ((Component)menu).getName();
                    }else{
                        continue;
                    }
#else
                    if ( menu is BMenuItem ) {
                        menu_name = ((BMenuItem)menu).Name;
                    } else {
                        continue;
                    }
#endif
                    applyMenuItemShortcut( dict, menu, menu_name );
                }
            }
            if ( dict.containsKey( "menuEditCopy" ) ) {
                applyMenuItemShortcut( dict, menuHiddenCopy, "menuEditCopy" );
            }
            if ( dict.containsKey( "menuEditCut" ) ) {
                applyMenuItemShortcut( dict, menuHiddenCut, "menuEditCut" );
            }
            if ( dict.containsKey( "menuEditCopy" ) ) {
                applyMenuItemShortcut( dict, menuHiddenPaste, "menuEditPaste" );
            }
            #endregion

            Vector<ValuePair<String, BMenuItem[]>> work = new Vector<ValuePair<String, BMenuItem[]>>();
            work.add( new ValuePair<String, BMenuItem[]>( "menuEditUndo", new BMenuItem[] { cMenuPianoUndo, cMenuTrackSelectorUndo } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuEditRedo", new BMenuItem[] { cMenuPianoRedo, cMenuTrackSelectorRedo } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuEditCut", new BMenuItem[] { cMenuPianoCut, cMenuTrackSelectorCut, menuEditCut } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuEditCopy", new BMenuItem[] { cMenuPianoCopy, cMenuTrackSelectorCopy, menuEditCopy } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuEditPaste", new BMenuItem[] { cMenuPianoPaste, cMenuTrackSelectorPaste, menuEditPaste } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuEditSelectAll", new BMenuItem[] { cMenuPianoSelectAll, cMenuTrackSelectorSelectAll } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuEditSelectAllEvents", new BMenuItem[] { cMenuPianoSelectAllEvents } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuEditDelete", new BMenuItem[] { menuEditDelete } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuVisualGridline", new BMenuItem[] { cMenuPianoGrid } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuJobLyric", new BMenuItem[] { cMenuPianoImportLyric } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuLyricExpressionProperty", new BMenuItem[] { cMenuPianoExpressionProperty } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuLyricVibratoProperty", new BMenuItem[] { cMenuPianoVibratoProperty } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuTrackOn", new BMenuItem[] { cMenuTrackTabTrackOn } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuTrackAdd", new BMenuItem[] { cMenuTrackTabAdd } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuTrackCopy", new BMenuItem[] { cMenuTrackTabCopy } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuTrackDelete", new BMenuItem[] { cMenuTrackTabDelete } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuTrackRenderCurrent", new BMenuItem[] { cMenuTrackTabRenderCurrent } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuTrackRenderAll", new BMenuItem[] { cMenuTrackTabRenderAll } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuTrackOverlay", new BMenuItem[] { cMenuTrackTabOverlay } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuTrackRendererVOCALOID1", new BMenuItem[] { cMenuTrackTabRendererVOCALOID1 } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuTrackRendererVOCALOID2", new BMenuItem[] { cMenuTrackTabRendererVOCALOID2 } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuTrackRendererAquesTone", new BMenuItem[] { menuTrackRendererAquesTone } ) );
            work.add( new ValuePair<String, BMenuItem[]>( "menuTrackRendererVCNT", new BMenuItem[] { menuTrackRendererVCNT } ) );
            int c = work.size();
            for ( int j = 0; j < c; j++ ) {
                ValuePair<String, BMenuItem[]> item = work.get( j );
                if ( dict.containsKey( item.getKey() ) ) {
                    BKeys[] k = dict.get( item.getKey() );
                    String s = Utility.getShortcutDisplayString( k );
#if !JAVA
                    if ( s != "" ) {
                        for ( int i = 0; i < item.getValue().Length; i++ ) {
                            item.getValue()[i].ShortcutKeyDisplayString = s;
                        }
                    }
#endif
                }
            }

            // ミキサーウィンドウ
            if ( AppManager.mMixerWindow != null ) {
                if ( dict.containsKey( "menuVisualMixer" ) ) {
                    KeyStroke shortcut = BKeysUtility.getKeyStrokeFromBKeys( dict.get( "menuVisualMixer" ) );
                    AppManager.mMixerWindow.applyShortcut( shortcut );
                }
            }

            // アイコンパレット
            if ( AppManager.iconPalette != null ) {
                if ( dict.containsKey( "menuVisualIconPalette" ) ) {
                    KeyStroke shortcut = BKeysUtility.getKeyStrokeFromBKeys( dict.get( "menuVisualIconPalette" ) );
                    AppManager.iconPalette.applyShortcut( shortcut );
                }
            }

#if ENABLE_PROPERTY
            // プロパティ
            if( AppManager.propertyWindow != null ){
                if( dict.containsKey( menuVisualProperty.getName() ) ){
                    KeyStroke shortcut = BKeysUtility.getKeyStrokeFromBKeys( dict.get( menuVisualProperty.getName() ) );
                    AppManager.propertyWindow.applyShortcut( shortcut );
                }
            }
#endif

            // スクリプトにショートカットを適用
#if JAVA
            MenuElement[] sub_menu_script = menuScript.getSubElements();
            for ( int i = 0; i < sub_menu_script.Length; i++ ) {
                MenuElement tsi = sub_menu_script[i];
                MenuElement[] sub_tsi = tsi.getSubElements();
                if ( sub_tsi.Length == 1 ) {
                    MenuElement dd_run = sub_tsi[0];
#if DEBUG
                    AppManager.debugWriteLine( "    dd_run.name=" + PortUtil.getComponentName( dd_run ) );
#endif
                    if ( dict.containsKey( PortUtil.getComponentName( dd_run ) ) ) {
                        applyMenuItemShortcut( dict, tsi, PortUtil.getComponentName( tsi ) );
                    }
                }
            }
#else
            int count = menuScript.DropDownItems.Count;
            for ( int i = 0; i < count; i++ ) {
                System.Windows.Forms.ToolStripItem tsi = menuScript.DropDownItems[i];
                if ( tsi is System.Windows.Forms.ToolStripMenuItem ) {
                    System.Windows.Forms.ToolStripMenuItem tsmi = (System.Windows.Forms.ToolStripMenuItem)tsi;
                    if ( tsmi.DropDownItems.Count == 1 ) {
                        System.Windows.Forms.ToolStripItem subtsi_tsmi = tsmi.DropDownItems[0];
                        if ( subtsi_tsmi is System.Windows.Forms.ToolStripMenuItem ) {
                            System.Windows.Forms.ToolStripMenuItem dd_run = (System.Windows.Forms.ToolStripMenuItem)subtsi_tsmi;
                            if ( dict.containsKey( PortUtil.getComponentName( dd_run ) ) ) {
                                applyMenuItemShortcut( dict, tsmi, PortUtil.getComponentName( tsi ) );
                            }
                        }
                    }
                }
            }
#endif
        }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index