diff options
author | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
commit | ce28e056c20bf2723f565bbf464b87781ec248a2 (patch) | |
tree | ef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llmoveview.cpp | |
parent | Second Life viewer sources 1.19.1.4b (diff) | |
download | meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2 meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz |
Second Life viewer sources 1.20.2
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llmoveview.cpp | 94 |
1 files changed, 18 insertions, 76 deletions
diff --git a/linden/indra/newview/llmoveview.cpp b/linden/indra/newview/llmoveview.cpp index 5444a6e..0bb0a5e 100644 --- a/linden/indra/newview/llmoveview.cpp +++ b/linden/indra/newview/llmoveview.cpp | |||
@@ -39,12 +39,10 @@ | |||
39 | // Viewer includes | 39 | // Viewer includes |
40 | #include "llagent.h" | 40 | #include "llagent.h" |
41 | #include "llviewercontrol.h" | 41 | #include "llviewercontrol.h" |
42 | #include "llfontgl.h" | ||
43 | #include "llbutton.h" | 42 | #include "llbutton.h" |
44 | #include "llviewerwindow.h" | 43 | #include "llviewerwindow.h" |
45 | #include "lljoystickbutton.h" | 44 | #include "lljoystickbutton.h" |
46 | #include "llresmgr.h" | 45 | #include "lluictrlfactory.h" |
47 | #include "llvieweruictrlfactory.h" | ||
48 | 46 | ||
49 | // | 47 | // |
50 | // Constants | 48 | // Constants |
@@ -54,68 +52,48 @@ const F32 MOVE_BUTTON_DELAY = 0.0f; | |||
54 | const F32 YAW_NUDGE_RATE = 0.05f; // fraction of normal speed | 52 | const F32 YAW_NUDGE_RATE = 0.05f; // fraction of normal speed |
55 | const F32 NUDGE_TIME = 0.25f; // in seconds | 53 | const F32 NUDGE_TIME = 0.25f; // in seconds |
56 | 54 | ||
57 | const char *MOVE_TITLE = ""; | ||
58 | |||
59 | // | ||
60 | // Global statics | ||
61 | // | ||
62 | |||
63 | LLFloaterMove* LLFloaterMove::sInstance = NULL; | ||
64 | |||
65 | |||
66 | // | 55 | // |
67 | // Member functions | 56 | // Member functions |
68 | // | 57 | // |
69 | 58 | ||
70 | // protected | 59 | // protected |
71 | LLFloaterMove::LLFloaterMove() | 60 | LLFloaterMove::LLFloaterMove(const LLSD& key) |
72 | : LLFloater("move floater", "FloaterMoveRect", MOVE_TITLE, FALSE, 100, 100, DRAG_ON_TOP, | 61 | : LLFloater("move floater") |
73 | MINIMIZE_NO) | ||
74 | { | 62 | { |
75 | setIsChrome(TRUE); | 63 | setIsChrome(TRUE); |
76 | gUICtrlFactory->buildFloater(this,"floater_moveview.xml"); | ||
77 | 64 | ||
78 | mForwardButton = LLViewerUICtrlFactory::getJoystickAgentTurnByName(this, "forward btn"); | 65 | const BOOL DONT_OPEN = FALSE; |
66 | LLUICtrlFactory::getInstance()->buildFloater(this,"floater_moveview.xml", NULL, DONT_OPEN); | ||
67 | |||
68 | mForwardButton = getChild<LLJoystickAgentTurn>("forward btn"); | ||
79 | mForwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY); | 69 | mForwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY); |
80 | 70 | ||
81 | mBackwardButton = LLViewerUICtrlFactory::getJoystickAgentTurnByName(this, "backward btn"); | 71 | mBackwardButton = getChild<LLJoystickAgentTurn>("backward btn"); |
82 | mBackwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY); | 72 | mBackwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY); |
83 | 73 | ||
84 | mSlideLeftButton = LLViewerUICtrlFactory::getJoystickAgentSlideByName(this, "slide left btn"); | 74 | mSlideLeftButton = getChild<LLJoystickAgentSlide>("slide left btn"); |
85 | mSlideLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY); | 75 | mSlideLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY); |
86 | 76 | ||
87 | mSlideRightButton = LLViewerUICtrlFactory::getJoystickAgentSlideByName(this, "slide right btn"); | 77 | mSlideRightButton = getChild<LLJoystickAgentSlide>("slide right btn"); |
88 | mSlideRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY); | 78 | mSlideRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY); |
89 | 79 | ||
90 | mTurnLeftButton = LLUICtrlFactory::getButtonByName(this, "turn left btn"); | 80 | mTurnLeftButton = getChild<LLButton>("turn left btn"); |
91 | mTurnLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY); | 81 | mTurnLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY); |
92 | mTurnLeftButton->setHeldDownCallback( turnLeft ); | 82 | mTurnLeftButton->setHeldDownCallback( turnLeft ); |
93 | 83 | ||
94 | mTurnRightButton = LLUICtrlFactory::getButtonByName(this, "turn right btn"); | 84 | mTurnRightButton = getChild<LLButton>("turn right btn"); |
95 | mTurnRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY); | 85 | mTurnRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY); |
96 | mTurnRightButton->setHeldDownCallback( turnRight ); | 86 | mTurnRightButton->setHeldDownCallback( turnRight ); |
97 | 87 | ||
98 | mMoveUpButton = LLUICtrlFactory::getButtonByName(this, "move up btn"); | 88 | mMoveUpButton = getChild<LLButton>("move up btn"); |
99 | childSetAction("move up btn",moveUp,NULL); | 89 | childSetAction("move up btn",moveUp,NULL); |
100 | mMoveUpButton->setHeldDownDelay(MOVE_BUTTON_DELAY); | 90 | mMoveUpButton->setHeldDownDelay(MOVE_BUTTON_DELAY); |
101 | mMoveUpButton->setHeldDownCallback( moveUp ); | 91 | mMoveUpButton->setHeldDownCallback( moveUp ); |
102 | 92 | ||
103 | mMoveDownButton = LLUICtrlFactory::getButtonByName(this, "move down btn"); | 93 | mMoveDownButton = getChild<LLButton>("move down btn"); |
104 | childSetAction("move down btn",moveDown,NULL); | 94 | childSetAction("move down btn",moveDown,NULL); |
105 | mMoveDownButton->setHeldDownDelay(MOVE_BUTTON_DELAY); | 95 | mMoveDownButton->setHeldDownDelay(MOVE_BUTTON_DELAY); |
106 | mMoveDownButton->setHeldDownCallback( moveDown ); | 96 | mMoveDownButton->setHeldDownCallback( moveDown ); |
107 | |||
108 | mFlyButton = LLUICtrlFactory::getButtonByName(this, "fly btn"); | ||
109 | childSetAction("fly btn",onFlyButtonClicked,NULL); | ||
110 | |||
111 | sInstance = this; | ||
112 | } | ||
113 | |||
114 | // protected | ||
115 | LLFloaterMove::~LLFloaterMove() | ||
116 | { | ||
117 | // children all deleted by LLView destructor | ||
118 | sInstance = NULL; | ||
119 | } | 97 | } |
120 | 98 | ||
121 | // virtual | 99 | // virtual |
@@ -133,48 +111,12 @@ void LLFloaterMove::onClose(bool app_quitting) | |||
133 | // Static member functions | 111 | // Static member functions |
134 | // | 112 | // |
135 | 113 | ||
136 | // static | 114 | void LLFloaterMove::onOpen() |
137 | void LLFloaterMove::show(void*) | ||
138 | { | 115 | { |
139 | if (sInstance) | 116 | LLFloater::onOpen(); |
140 | { | ||
141 | sInstance->open(); /*Flawfinder: ignore*/ | ||
142 | } | ||
143 | else | ||
144 | { | ||
145 | LLFloaterMove* f = new LLFloaterMove(); | ||
146 | f->open(); /*Flawfinder: ignore*/ | ||
147 | } | ||
148 | |||
149 | gSavedSettings.setBOOL("ShowMovementControls", TRUE); | 117 | gSavedSettings.setBOOL("ShowMovementControls", TRUE); |
150 | } | 118 | } |
151 | 119 | ||
152 | // static | ||
153 | void LLFloaterMove::toggle(void*) | ||
154 | { | ||
155 | if (sInstance) | ||
156 | { | ||
157 | sInstance->close(); | ||
158 | } | ||
159 | else | ||
160 | { | ||
161 | show(NULL); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | // static | ||
166 | BOOL LLFloaterMove::visible(void*) | ||
167 | { | ||
168 | return (sInstance != NULL); | ||
169 | } | ||
170 | |||
171 | // protected static | ||
172 | void LLFloaterMove::onFlyButtonClicked(void *) | ||
173 | { | ||
174 | gAgent.toggleFlying(); | ||
175 | } | ||
176 | |||
177 | |||
178 | // protected static | 120 | // protected static |
179 | F32 LLFloaterMove::getYawRate( F32 time ) | 121 | F32 LLFloaterMove::getYawRate( F32 time ) |
180 | { | 122 | { |
@@ -192,14 +134,14 @@ F32 LLFloaterMove::getYawRate( F32 time ) | |||
192 | // protected static | 134 | // protected static |
193 | void LLFloaterMove::turnLeft(void *) | 135 | void LLFloaterMove::turnLeft(void *) |
194 | { | 136 | { |
195 | F32 time = sInstance->mTurnLeftButton->getHeldDownTime(); | 137 | F32 time = getInstance()->mTurnLeftButton->getHeldDownTime(); |
196 | gAgent.moveYaw( getYawRate( time ) ); | 138 | gAgent.moveYaw( getYawRate( time ) ); |
197 | } | 139 | } |
198 | 140 | ||
199 | // protected static | 141 | // protected static |
200 | void LLFloaterMove::turnRight(void *) | 142 | void LLFloaterMove::turnRight(void *) |
201 | { | 143 | { |
202 | F32 time = sInstance->mTurnRightButton->getHeldDownTime(); | 144 | F32 time = getInstance()->mTurnRightButton->getHeldDownTime(); |
203 | gAgent.moveYaw( -getYawRate( time ) ); | 145 | gAgent.moveYaw( -getYawRate( time ) ); |
204 | } | 146 | } |
205 | 147 | ||