~do-core/do/test-trunk

« back to all changes in this revision

Viewing changes to Do/src/Do.Core/Controller.cs

  • Committer: Chris
  • Date: 2009-07-23 07:17:00 UTC
  • mto: (1280.1.6 kb-service)
  • mto: This revision was merged to the branch mainline in revision 1284.
  • Revision ID: chris@szikszoy.com-20090723071700-f18qot77xjaggo6e
finish work on keybinding service, make libdo return success or failure of binding keys

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
                        Screen.Default.CompositedChanged += OnCompositingChanged;
110
110
                        
111
111
                        // Register Shortcuts
112
 
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (DoKeyEvents.EnterTextMode, Catalog.GetString ("Enter Text Mode"),
113
 
                                "period", OnTextModePressEvent));
114
 
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (DoKeyEvents.Copy, Catalog.GetString ("Copy to Clipboard"),
115
 
                                "<Control>c", OnCopyEvent));
116
 
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (DoKeyEvents.Paste, Catalog.GetString ("Paste Current Text"),
117
 
                                "<Control>v", OnPasteEvent));
118
 
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (DoKeyEvents.PreviousPane, Catalog.GetString ("Previous Pane"),
119
 
                                "ISO_Left_Tab", OnPreviousPanePressEvent));
120
 
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (DoKeyEvents.NextPane, Catalog.GetString ("Next Pane"),
121
 
                                "Tab", OnNextPanePressEvent));
122
 
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (DoKeyEvents.Up, Catalog.GetString ("Previous Item"),
123
 
                                "Up", OnUpKeyPressEvent));
124
 
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (DoKeyEvents.Down, Catalog.GetString ("Next Item"),
125
 
                                "Down", OnDownKeyPressEvent));
126
 
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (DoKeyEvents.First, Catalog.GetString ("First Item"),
127
 
                                "Home", OnHomeKeyPressEvent));
128
 
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (DoKeyEvents.Last, Catalog.GetString ("Last Item"),
129
 
                                "End", OnEndKeyPressEvent));
130
 
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (DoKeyEvents.PageLast, Catalog.GetString ("Previous 5 Results"),
131
 
                                "Page_Up", OnPageUpKeyPressEvent));
132
 
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (DoKeyEvents.PageNext, Catalog.GetString ("Next 5 Results"),
133
 
                                "Page_Down", OnPageDownKeyPressEvent));
134
 
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (DoKeyEvents.Left, Catalog.GetString ("Step Out of Item"),
135
 
                                "Left", OnLeftKeyPressEvent));
136
 
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (DoKeyEvents.Right, Catalog.GetString ("Browse Into Item"),
137
 
                                "Right", OnRightKeyPressEvent));
138
 
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (DoKeyEvents.MultiSelect, Catalog.GetString ("Select Multiple Items"),
139
 
                                "comma", OnSelectionKeyPressEvent));
 
112
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Enter Text Mode"), "period",
 
113
                                OnTextModePressEvent));
 
114
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Copy to Clipboard"), "<Control>c",
 
115
                                OnCopyEvent));
 
116
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Paste Current Text"), "<Control>v",
 
117
                                OnPasteEvent));
 
118
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Previous Pane"), "ISO_Left_Tab",
 
119
                                OnPreviousPanePressEvent));
 
120
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Next Pane"), "Tab",
 
121
                                OnNextPanePressEvent));
 
122
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Previous Item"), "Up",
 
123
                                OnUpKeyPressEvent));
 
124
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Next Item"), "Down",
 
125
                                OnDownKeyPressEvent));
 
126
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("First Item"), "Home",
 
127
                                OnHomeKeyPressEvent));
 
128
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Last Item"), "End",
 
129
                                OnEndKeyPressEvent));
 
130
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Previous 5 Results"), "Page_Up",
 
131
                                OnPageUpKeyPressEvent));
 
132
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Next 5 Results"), "Page_Down",
 
133
                                OnPageDownKeyPressEvent));
 
134
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Step Out of Item"), "Left",
 
135
                                OnLeftKeyPressEvent));
 
136
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Browse Into Item"), "Right",
 
137
                                OnRightKeyPressEvent));
 
138
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Select Multiple Items"), "comma",
 
139
                                OnSelectionKeyPressEvent));
 
140
                        //summon in text mode
 
141
                        Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Summon in Text Mode"), "<Super>period",
 
142
                                delegate { this.Summon (); SearchController.TextMode = true; UpdatePane (CurrentPane); } , true));
140
143
                }
141
144
 
142
145
                void OnSummoned ()
446
449
                        } else if (key == Key.Delete ||
447
450
                                   key == Key.BackSpace) {
448
451
                                OnDeleteKeyPressEvent (evnt);
449
 
                        } else {
 
452
                        } else if (Services.Keybinder.Bindings.ContainsKey (KeyEventToString (evnt))) {
450
453
                                // User set keybindings
451
 
                                Shortcut sc = Do.Keybindings.GetShortcutByKeycode (KeyEventToString (evnt));
452
 
                                if (sc != null) {
453
 
                                        sc.Callback (evnt);
454
 
                                        return;
455
 
                                }
 
454
                                Services.Keybinder.Bindings [KeyEventToString (evnt)].Callback (evnt);
 
455
                        } else {
456
456
                                OnInputKeyPressEvent (evnt);
457
457
                        }
458
458
                }