WoWInterface SVN Xcalc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 16 to Rev 15
    Reverse comparison

Rev 16 → Rev 15

trunk/Localization.lua
3,6 → 3,7
BINDING_HEADER_XCALC_AUTOMATIC = "xcalc (automatic)"
BINDING_NAME_XC_NUMLOCK = "Numlock"
BINDING_NAME_XC_CLEAR = "Clear"
BINDING_NAME_XC_CLOSE = "Close"
BINDING_NAME_XC_DIV = "Divide"
BINDING_NAME_XC_MUL = "Multiply"
BINDING_NAME_XC_SUB = "Subtract"
21,30 → 22,8
BINDING_NAME_XC_DEC = "Decimal"
BINDING_NAME_XC_BACKSPACE = "Backspace"
 
XCALC_BINDINGMAP = {
NUMLOCK = "XC_NUMLOCK",
HOME = "XC_CLEAR",
BACKSPACE = "XC_BACKSPACE",
NUMPADDIVIDE = "XC_DIV",
NUMPADMULTIPLY = "XC_MUL",
NUMPADMINUS = "XC_SUB",
NUMPADPLUS = "XC_ADD",
ENTER = "XC_EQ",
NUMPAD0 = "XC_0",
NUMPAD1 = "XC_1",
NUMPAD2 = "XC_2",
NUMPAD3 = "XC_3",
NUMPAD4 = "XC_4",
NUMPAD5 = "XC_5",
NUMPAD6 = "XC_6",
NUMPAD7 = "XC_7",
NUMPAD8 = "XC_8",
NUMPAD9 = "XC_9",
NUMPADDECIMAL = "XC_DEC"
}
 
XCALC_REMAPBINDINGS = { }
 
 
XCALC_NUMBERDISPLAY = "0"
XCALC_RUNNINGTOTAL = ""
XCALC_PREVIOUSKEYTYPE = "none"
trunk/xcalc.lua
1,8 → 1,14
--[[
Xcalc see version in xcalc.toc.
Xcalc see version onload.
author: moird
email: peirthies@gmail.com
 
 
Change ideas:
-Rewrite of the parsing and togsc fromgsc functions
-Possibly adding a scientific option set to enable the calculator
window for more functions that can be achieved already through
the chatline but would give the window a lot better functionality
-Maybe having a history of the last couple of calculations
]]
 
 
31,6 → 37,25
end
end
 
--[[---------------------------------------------------------------------
Proccess for setting the display in the main xcalc calculator window
streamlined the whole process doing it this way so that the function
can be called instead of calling both the variable, setting the new
variable then passing the settext string to change the display.
this also handles the M for memory being displayed on the main window
---------------------------------------------------------------------]]
function xcalc_display(displaynumber, memoryset)
if ( displaynumber == nil or displaynumber == "" ) then
displaynumber = "0"
elseif ( memoryset == "1" ) then
xcalc_memorydisplay:SetText ( XCALC_MEMORYINDICATORON )
elseif ( memoryset == "0" ) then
xcalc_memorydisplay:SetText( XCALC_MEMORYINDICATOR )
end
XCALC_NUMBERDISPLAY = displaynumber
xcalc_numberdisplay:SetText( displaynumber )
end
 
--[[--------------------------------------------------------------------
Function for adding Debug messages via xcalc_debug("message") call
Haven't decided on adding a variable to add lots of debugging messages
67,23 → 92,71
--Processes for binding and unbinding numberpad keys to Xcalc
function xcalc_rebind()
if (Xcalc_Settings.Binding == 1) then
for key,value in pairs(XCALC_BINDINGMAP) do
XCALC_REMAPBINDINGS[key] = GetBindingAction(key)
end
for key,value in pairs(XCALC_BINDINGMAP) do
SetBinding(key, value)
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("NUMPADMULTIPLY", "XC_MUL")
SetBinding("NUMPADMINUS", "XC_SUB")
SetBinding("NUMPADPLUS", "XC_ADD")
SetBinding("ENTER", "XC_EQ")
SetBinding("NUMPAD0", "XC_0")
SetBinding("NUMPAD1", "XC_1")
SetBinding("NUMPAD2", "XC_2")
SetBinding("NUMPAD3", "XC_3")
SetBinding("NUMPAD4", "XC_4")
SetBinding("NUMPAD5", "XC_5")
SetBinding("NUMPAD6", "XC_6")
SetBinding("NUMPAD7", "XC_7")
SetBinding("NUMPAD8", "XC_8")
SetBinding("NUMPAD9", "XC_9")
SetBinding("NUMPADDECIMAL", "XC_DEC")
 
end
end
 
function xcalc_unbind()
if (Xcalc_Settings.Binding == 1) then
for key,value in pairs(XCALC_REMAPBINDINGS) do
SetBinding(key, value)
end
LoadBindings(GetCurrentBindingSet())
end
end
 
--Bound Key management
--[[function xcalc_onkeydown()
key = arg1
--message(key)
 
if ( key == "END" ) then
 
elseif ( key == "NUMPAD0" ) then
xcalc_numkey("0")
elseif ( key == "NUMPAD1" ) then
xcalc_numkey("1")
elseif ( key == "NUMPAD2" ) then
xcalc_numkey("2")
elseif ( key == "NUMPAD3" ) then
xcalc_numkey("3")
elseif ( key == "NUMPAD4" ) then
xcalc_numkey("4")
elseif ( key == "NUMPAD5" ) then
xcalc_numkey("5")
elseif ( key == "NUMPAD6" ) then
xcalc_numkey("6")
elseif ( key == "NUMPAD7" ) then
xcalc_numkey("7")
elseif ( key == "NUMPAD8" ) then
xcalc_numkey("8")
elseif ( key == "NUMPAD9" ) then
xcalc_numkey("9")
end
end
]]
 
--Button Clear
function xcalc_clear()
XCALC_RUNNINGTOTAL = ""
trunk/Bindings.xml
9,6 → 9,9
<Binding name="XC_CLEAR" description="Clear">
xcalc_statekey("C");
</Binding>
<Binding name="XC_CLOSE" description="Close">
xcalc_display();
</Binding>
<Binding name="XC_BACKSPACE" description="Backspace">
xcalc_backspace()
</Binding>
trunk/xcalcgui.lua
8,12 → 8,9
 
--Display Main calculator Window
function xcalc_windowdisplay()
if (xcalc_window == nil or xcalc_optionwindow == nil) then
if (xcalc_window == nil) then
xcalc_windowframe()
xcalc_optionframe()
end
 
if (xcalc_window:IsVisible() and xcalc_optionwindow:IsVisible()) then
elseif (xcalc_window:IsVisible() and xcalc_optionwindow:IsVisible()) then
xcalc_optionwindow:Hide()
xcalc_window:Hide()
elseif (xcalc_window:IsVisible()) then
26,32 → 23,15
 
--Display options window
function xcalc_optiondisplay()
if (xcalc_optionwindow:IsVisible()) then
if (xcalc_optionwindow == nil) then
xcalc_optionframe()
elseif (xcalc_optionwindow:IsVisible()) then
xcalc_optionwindow:Hide()
else
xcalc_optionwindow:Show()
end
end
 
--[[---------------------------------------------------------------------
Proccess for setting the display in the main xcalc calculator window
streamlined the whole process doing it this way so that the function
can be called instead of calling both the variable, setting the new
variable then passing the settext string to change the display.
this also handles the M for memory being displayed on the main window
---------------------------------------------------------------------]]
function xcalc_display(displaynumber, memoryset)
if ( displaynumber == nil or displaynumber == "" ) then
displaynumber = "0"
elseif ( memoryset == "1" ) then
xcalc_memorydisplay:SetText ( XCALC_MEMORYINDICATORON )
elseif ( memoryset == "0" ) then
xcalc_memorydisplay:SetText( XCALC_MEMORYINDICATOR )
end
XCALC_NUMBERDISPLAY = displaynumber
xcalc_numberdisplay:SetText( displaynumber )
end
 
function xcalc_windowframe()
--Main Window Frame (container) and title bar
local frame = CreateFrame("Frame","xcalc_window",UIParent)
311,6 → 291,7
optionbutton:SetText("Options")
optionbutton:SetScript("OnClick", function() xcalc_optiondisplay() end)
xcalc_rebind()
frame:Show()
tinsert(UISpecialFrames,"xcalc_window")
end
 
385,6 → 366,7
minimapslider:SetPoint("TOPLEFT",15,-120)
minimapslider:SetValue(Xcalc_Settings.Minimappos)
 
frame:Show()
end
 
function xcalc_minimap_init()