Thursday, April 19, 2012

Mode-based bindings and temporary bindings

Developers, developers, developers!

I'm thinking about working on an add-on to add emacs-style bindings. You heard right, emacs-style. I know you must all be really excited because we all know emacs is superior to any other editor for *NIX *hides from flame wave*

Anyway. I want to be able to bind certain keys at certain times. So for instance if I press:

C-x C-s (control X followed by control S)

I will get Function1. Let's say, dunno, the social pane. However, suppose I pressed C-s I want it to turn off the sound like it does by default. This is just an example.

I need to know though whether there's a way to bind certain keys temporarily, for instance just in one frame or until I choose to leave the old keybinding mode or something like that.

Of course the other thing I could do is bind both C-x and C-s to Function A and Function B respectively and do this (pseudo code):


Code:
var Was C-x pressed = 0 
Function B does:
if C-x was pressed:
do something
else:
do something else

Function A does:
set was C-x pressed to 1
draw some neat graphics

The problem could be though that I'm not sure whether I can bind actionbar buttons through these functions (those conditions look suspicious and Blizzard doesn't like us doing suspicious things).

Any ideas about how I could get this done?

No comments:

Post a Comment