EmFor@6: --[[ EmFor@6: CensusPlus for World of Warcraft(tm). EmFor@6: EmFor@6: Copyright 2005 - 2006 Cooper Sellers and WarcraftRealms.com EmFor@6: EmFor@6: License: EmFor@6: This program is free software; you can redistribute it and/or EmFor@6: modify it under the terms of the GNU General Public License EmFor@6: as published by the Free Software Foundation; either version 2 EmFor@6: of the License, or (at your option) any later version. EmFor@6: EmFor@6: This program is distributed in the hope that it will be useful, EmFor@6: but WITHOUT ANY WARRANTY; without even the implied warranty of EmFor@6: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the EmFor@6: GNU General Public License for more details. EmFor@6: EmFor@6: You should have received a copy of the GNU General Public License EmFor@6: along with this program(see GLP.txt); if not, write to the Free Software EmFor@6: Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. EmFor@6: ]] EmFor@0: EmFor@0: EmFor@0: local init = false; EmFor@0: EmFor@0: function CensusButton_OnClick() EmFor@0: CensusPlus_Toggle(); EmFor@0: end EmFor@0: EmFor@0: function CensusButton_Init() EmFor@0: if(CensusPlus_Database["Info"]["CensusButtonShown"] == 1 ) then EmFor@0: CensusButtonFrame:Show(); EmFor@0: else EmFor@0: CensusButtonFrame:Hide(); EmFor@0: end EmFor@0: EmFor@0: init = true; EmFor@0: end EmFor@0: EmFor@0: function CensusButton_Toggle() EmFor@0: if(CensusButtonFrame:IsVisible()) then EmFor@0: CensusButtonFrame:Hide(); EmFor@0: CensusPlus_Database["Info"]["CensusButtonShown"] = false; EmFor@0: else EmFor@0: CensusButtonFrame:Show(); EmFor@0: CensusPlus_Database["Info"]["CensusButtonShown"] = true; EmFor@0: end EmFor@0: end EmFor@0: EmFor@6: function CensusButton_UpdatePosition() EmFor@0: CensusButtonFrame:SetPoint( EmFor@0: "TOPLEFT", EmFor@0: "Minimap", EmFor@0: "TOPLEFT", EmFor@0: 54 - (78 * cos(CensusPlus_Database["Info"]["CensusButtonPosition"])), EmFor@0: (78 * sin(CensusPlus_Database["Info"]["CensusButtonPosition"])) - 55 EmFor@0: ); EmFor@0: end EmFor@0: EmFor@0: function CensusButton_OnUpdate() EmFor@0: if( init ) then EmFor@0: CensusPlus_OnUpdate(); EmFor@0: end EmFor@0: end EmFor@0: EmFor@6: function CensusPlusButton_OnClick( arg1 ) EmFor@0: if ( arg1 == "LeftButton" ) then EmFor@0: CensusButton_OnClick(); EmFor@0: else EmFor@6: ToggleDropDownMenu( 1, nil, CP_ButtonDropDown, "CensusButtonFrame", 20, 20 ); EmFor@0: end EmFor@0: EmFor@0: end EmFor@0: EmFor@0: function CensusPlus_ButtonDropDown_Initialize() EmFor@0: EmFor@0: local info; EmFor@0: EmFor@6: if (g_IsCensusPlusInProgress == true) then EmFor@6: if( g_CensusPlusManuallyPaused == true ) then EmFor@0: info = { EmFor@0: text = CENSUSPlus_UNPAUSE; EmFor@0: func = CensusPlus_Take_OnClick; EmFor@0: }; EmFor@6: else EmFor@0: info = { EmFor@0: text = CENSUSPlus_PAUSE; EmFor@0: func = CensusPlus_Take_OnClick; EmFor@0: }; EmFor@6: end EmFor@6: else EmFor@0: info = { EmFor@0: text = CENSUSPlus_TAKE; EmFor@0: func = CensusPlus_Take_OnClick; EmFor@0: }; EmFor@6: end EmFor@0: UIDropDownMenu_AddButton(info, 1); EmFor@0: EmFor@0: info = { EmFor@0: text = CENSUSPlus_STOP; EmFor@0: func = CensusPlus_StopCensus; EmFor@0: }; EmFor@0: UIDropDownMenu_AddButton(info, 1); EmFor@0: EmFor@0: info = { EmFor@0: text = CENSUSPlus_CANCEL; EmFor@6: func = CensusPlus_CloseDropDown; EmFor@0: }; EmFor@0: UIDropDownMenu_AddButton(info, 1); EmFor@0: EmFor@0: end EmFor@6: EmFor@6: EmFor@6: function CensusPlus_CloseDropDown() EmFor@6: CloseDropDownMenus(); EmFor@6: end EmFor@6: function CensusPlus_Button_OnMouseDown( self, arg1 ) EmFor@6: if ( ( ( not CensusButtonFrame.isLocked ) or ( CensusButtonFrame.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then EmFor@6: CensusButtonFrame:StartMoving(); EmFor@6: CensusButtonFrame.isMoving = true; EmFor@6: end EmFor@6: end EmFor@6: function CensusPlus_Button_OnClick( self, arg1, arg2 ) EmFor@6: if( not CensusButtonFrame.isMoving ) then EmFor@6: CensusPlusButton_OnClick(arg1, arg2); EmFor@6: PlaySound("igMainMenuOptionCheckBoxOn"); EmFor@6: end EmFor@0: end