/trunk
## Interface: 20400 |
## Interface: 30000 |
## Title: xcalc |
## Author: Moird |
## Version: 2.06 |
## Version: 2.1.wowi:revision |
## Notes: Basic Calculator |
## eMail: peirthies@gmail.com |
## DefaultState: Enabled |
XCALC_VERSION = "2.06"; |
BINDING_HEADER_XCALC = "xcalc (automatic)"; |
BINDING_HEADER_XCALC = "xcalc (automatic)"; |
BINDING_NAME_XC_NUMLOCK = "Numlock"; |
BINDING_NAME_XC_CLEAR = "Clear"; |
BINDING_NAME_XC_CLOSE = "Close"; |
BINDING_NAME_XC_8 = "Digit 8"; |
BINDING_NAME_XC_9 = "Digit 9"; |
BINDING_NAME_XC_DEC = "Decimal"; |
BINDING_NAME_XC_BACKSPACE = "Backspace"; |
XCALC_REMAPPED = { |
NUMLOCK = ""; |
HOME = ""; |
END = ""; |
NUMPADDIVIDE = ""; |
NUMPADMULTIPLY = ""; |
NUMPADMINUS = ""; |
NUMPADPLUS = ""; |
ENTER = ""; |
NUMPAD0 = ""; |
NUMPAD1 = ""; |
NUMPAD2 = ""; |
NUMPAD3 = ""; |
NUMPAD4 = ""; |
NUMPAD5 = ""; |
NUMPAD6 = ""; |
NUMPAD7 = ""; |
NUMPAD8 = ""; |
NUMPAD9 = ""; |
NUMPADDECIMAL = ""; |
}; |
XCALC_NUMBERDISPLAY = "0"; |
XCALC_RUNNINGTOTAL = ""; |
XCALC_PREVIOUSKEYTYPE = "none"; |
SLASH_XCALC3 = "/="; |
xcalc_optionvariables(); |
xcalc_minimap_init(); |
XCALC_VERSION = GetAddOnMetadata("xcalc", "Version"); |
end |
--Fuction for setting up Saved Variables |
function xcalc_optionvariables() |
if (Xcalc_Settings.Binding == nil) then |
Xcalc_Settings.Binding = 0; |
Xcalc_Settings.Binding = 1; |
end |
if (Xcalc_Settings.Minimapdisplay == nil) then |
Xcalc_Settings.Minimapdisplay = 1; |
--Processes for binding and unbinding numberpad keys to Xcalc |
function xcalc_rebind() |
if (Xcalc_Settings.Binding == 1) then |
for x = 1, GetNumBindings() do |
currBinding = GetBinding(x); |
keyone, keytwo = GetBindingKey(currBinding); |
for key,value in pairs(XCALC_REMAPPED) do |
if (keyone == key or keytwo == key) then |
XCALC_REMAPPED[key] = currBinding; |
end |
end |
end |
--steal numlock away from anything else |
SetBinding("NUMLOCK", "XC_NUMLOCK"); |
SetBinding("HOME", "XC_CLEAR"); |
SetBinding("END", "XC_CLOSE"); |
SetBinding("BACKSPACE", "XC_BACKSPACE"); |
--set numlock on keys |
SetBinding("NUMPADDIVIDE", "XC_DIV"); |
SetBinding("NUMPAD9", "XC_9"); |
SetBinding("NUMPADDECIMAL", "XC_DEC"); |
SaveBindings(2); |
end |
end |
function xcalc_unbind() |
if (Xcalc_Settings.Binding == 1) then |
for key,value in pairs(XCALC_REMAPPED) do |
SetBinding(key, value); |
XCALC_REMAPPED[key] = ""; |
end |
SaveBindings(2); |
LoadBindings(0); |
end |
end |
xcalc Result: (3.5g + 50s) * 2 = 8g |
/calc 4g / 5 |
xcalc Result: 4g / 5 = 80s |
=========================== |
Version History: |
v2.06 (12AUG2008) |
- Updated TOC Version |
- Changed the Keybindings to not initiate the first time, they can be enabled via the options page. |
v2.05 (05DEC2007) |
- Updated TOC Version |
v2.04 (09JAN2007) |
- Updated TOC Version |
v2.03 (02JAN2007) |
- Fixed a bug with a variable |
- Will run a clear When the window is closed |
v2.02 (29DEC2006) |
- Fixed a section with the gold conversion to be 2.0 compatible |
- Minor Bug with Minimap button placement controls if the minimap button wasn't available |
v2.01 (28DEC2006) |
- TOC version change to be 2.0 compatible |
v2.00 (15SEP2006) |
- Complete GUI rewrite (there was a latent problem with the original way it was written) |
- Added Controls to position/hide Minimap Icon |
- Option to turn off Automatic Keybindings |
- Escape Key will close the window |
v1.00 (27AUG2006) |
- Initial Release |
<Binding name="XC_CLOSE" description="Close"> |
xcalc_display(); |
</Binding> |
<Binding name="XC_BACKSPACE" description="Backspace"> |
xcalc_backspace() |
</Binding> |
<Binding name="XC_DIV" description="Divide"> |
xcalc_funckey("/"); |