annotate CensusButton.lua @ 7:24d1a97dfa1b

Worgen + Goblin Icon; for now DK Icon
author EmFor
date Fri, 10 Dec 2010 16:05:28 +0100
parents 10c85be19b56
children 663f782bd903
rev   line source
EmFor@6 1 --[[
EmFor@6 2 CensusPlus for World of Warcraft(tm).
EmFor@6 3
EmFor@6 4 Copyright 2005 - 2006 Cooper Sellers and WarcraftRealms.com
EmFor@6 5
EmFor@6 6 License:
EmFor@6 7 This program is free software; you can redistribute it and/or
EmFor@6 8 modify it under the terms of the GNU General Public License
EmFor@6 9 as published by the Free Software Foundation; either version 2
EmFor@6 10 of the License, or (at your option) any later version.
EmFor@6 11
EmFor@6 12 This program is distributed in the hope that it will be useful,
EmFor@6 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
EmFor@6 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
EmFor@6 15 GNU General Public License for more details.
EmFor@6 16
EmFor@6 17 You should have received a copy of the GNU General Public License
EmFor@6 18 along with this program(see GLP.txt); if not, write to the Free Software
EmFor@6 19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
EmFor@6 20 ]]
EmFor@0 21
EmFor@0 22
EmFor@0 23 local init = false;
EmFor@0 24
EmFor@0 25 function CensusButton_OnClick()
EmFor@0 26 CensusPlus_Toggle();
EmFor@0 27 end
EmFor@0 28
EmFor@0 29 function CensusButton_Init()
EmFor@0 30 if(CensusPlus_Database["Info"]["CensusButtonShown"] == 1 ) then
EmFor@0 31 CensusButtonFrame:Show();
EmFor@0 32 else
EmFor@0 33 CensusButtonFrame:Hide();
EmFor@0 34 end
EmFor@0 35
EmFor@0 36 init = true;
EmFor@0 37 end
EmFor@0 38
EmFor@0 39 function CensusButton_Toggle()
EmFor@0 40 if(CensusButtonFrame:IsVisible()) then
EmFor@0 41 CensusButtonFrame:Hide();
EmFor@0 42 CensusPlus_Database["Info"]["CensusButtonShown"] = false;
EmFor@0 43 else
EmFor@0 44 CensusButtonFrame:Show();
EmFor@0 45 CensusPlus_Database["Info"]["CensusButtonShown"] = true;
EmFor@0 46 end
EmFor@0 47 end
EmFor@0 48
EmFor@6 49 function CensusButton_UpdatePosition()
EmFor@0 50 CensusButtonFrame:SetPoint(
EmFor@0 51 "TOPLEFT",
EmFor@0 52 "Minimap",
EmFor@0 53 "TOPLEFT",
EmFor@0 54 54 - (78 * cos(CensusPlus_Database["Info"]["CensusButtonPosition"])),
EmFor@0 55 (78 * sin(CensusPlus_Database["Info"]["CensusButtonPosition"])) - 55
EmFor@0 56 );
EmFor@0 57 end
EmFor@0 58
EmFor@0 59 function CensusButton_OnUpdate()
EmFor@0 60 if( init ) then
EmFor@0 61 CensusPlus_OnUpdate();
EmFor@0 62 end
EmFor@0 63 end
EmFor@0 64
EmFor@6 65 function CensusPlusButton_OnClick( arg1 )
EmFor@0 66 if ( arg1 == "LeftButton" ) then
EmFor@0 67 CensusButton_OnClick();
EmFor@0 68 else
EmFor@6 69 ToggleDropDownMenu( 1, nil, CP_ButtonDropDown, "CensusButtonFrame", 20, 20 );
EmFor@0 70 end
EmFor@0 71
EmFor@0 72 end
EmFor@0 73
EmFor@0 74 function CensusPlus_ButtonDropDown_Initialize()
EmFor@0 75
EmFor@0 76 local info;
EmFor@0 77
EmFor@6 78 if (g_IsCensusPlusInProgress == true) then
EmFor@6 79 if( g_CensusPlusManuallyPaused == true ) then
EmFor@0 80 info = {
EmFor@0 81 text = CENSUSPlus_UNPAUSE;
EmFor@0 82 func = CensusPlus_Take_OnClick;
EmFor@0 83 };
EmFor@6 84 else
EmFor@0 85 info = {
EmFor@0 86 text = CENSUSPlus_PAUSE;
EmFor@0 87 func = CensusPlus_Take_OnClick;
EmFor@0 88 };
EmFor@6 89 end
EmFor@6 90 else
EmFor@0 91 info = {
EmFor@0 92 text = CENSUSPlus_TAKE;
EmFor@0 93 func = CensusPlus_Take_OnClick;
EmFor@0 94 };
EmFor@6 95 end
EmFor@0 96 UIDropDownMenu_AddButton(info, 1);
EmFor@0 97
EmFor@0 98 info = {
EmFor@0 99 text = CENSUSPlus_STOP;
EmFor@0 100 func = CensusPlus_StopCensus;
EmFor@0 101 };
EmFor@0 102 UIDropDownMenu_AddButton(info, 1);
EmFor@0 103
EmFor@0 104 info = {
EmFor@0 105 text = CENSUSPlus_CANCEL;
EmFor@6 106 func = CensusPlus_CloseDropDown;
EmFor@0 107 };
EmFor@0 108 UIDropDownMenu_AddButton(info, 1);
EmFor@0 109
EmFor@0 110 end
EmFor@6 111
EmFor@6 112
EmFor@6 113 function CensusPlus_CloseDropDown()
EmFor@6 114 CloseDropDownMenus();
EmFor@6 115 end
EmFor@6 116
EmFor@6 117 function CensusPlus_Button_OnMouseDown( self, arg1 )
EmFor@6 118 if ( ( ( not CensusButtonFrame.isLocked ) or ( CensusButtonFrame.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then
EmFor@6 119 CensusButtonFrame:StartMoving();
EmFor@6 120 CensusButtonFrame.isMoving = true;
EmFor@6 121 end
EmFor@6 122 end
EmFor@6 123
EmFor@6 124 function CensusPlus_Button_OnClick( self, arg1, arg2 )
EmFor@6 125 if( not CensusButtonFrame.isMoving ) then
EmFor@6 126 CensusPlusButton_OnClick(arg1, arg2);
EmFor@6 127 PlaySound("igMainMenuOptionCheckBoxOn");
EmFor@6 128 end
EmFor@0 129 end