aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llui')
-rw-r--r--linden/indra/llui/files.lst4
-rw-r--r--linden/indra/llui/llalertdialog.cpp16
-rw-r--r--linden/indra/llui/llalertdialog.h59
-rw-r--r--linden/indra/llui/llbutton.cpp65
-rw-r--r--linden/indra/llui/llbutton.h39
-rw-r--r--linden/indra/llui/llcheckboxctrl.cpp13
-rw-r--r--linden/indra/llui/llclipboard.cpp4
-rw-r--r--linden/indra/llui/llclipboard.h18
-rw-r--r--linden/indra/llui/llcombobox.cpp71
-rw-r--r--linden/indra/llui/llcombobox.h16
-rw-r--r--linden/indra/llui/llctrlselectioninterface.h12
-rw-r--r--linden/indra/llui/lldraghandle.cpp91
-rw-r--r--linden/indra/llui/lldraghandle.h7
-rw-r--r--linden/indra/llui/lleditmenuhandler.cpp96
-rw-r--r--linden/indra/llui/lleditmenuhandler.h46
-rw-r--r--linden/indra/llui/llfloater.cpp488
-rw-r--r--linden/indra/llui/llfloater.h172
-rw-r--r--linden/indra/llui/llfocusmgr.cpp34
-rw-r--r--linden/indra/llui/llfocusmgr.h33
-rw-r--r--linden/indra/llui/lliconctrl.cpp4
-rw-r--r--linden/indra/llui/lliconctrl.h2
-rw-r--r--linden/indra/llui/llkeywords.cpp2
-rw-r--r--linden/indra/llui/llkeywords.h34
-rw-r--r--linden/indra/llui/lllineeditor.cpp214
-rw-r--r--linden/indra/llui/lllineeditor.h143
-rw-r--r--linden/indra/llui/llmemberlistener.h53
-rw-r--r--linden/indra/llui/llmenugl.cpp566
-rw-r--r--linden/indra/llui/llmenugl.h268
-rw-r--r--linden/indra/llui/llmodaldialog.cpp23
-rw-r--r--linden/indra/llui/llmodaldialog.h8
-rw-r--r--linden/indra/llui/llmultislider.cpp677
-rw-r--r--linden/indra/llui/llmultislider.h129
-rw-r--r--linden/indra/llui/llmultisliderctrl.cpp634
-rw-r--r--linden/indra/llui/llmultisliderctrl.h160
-rw-r--r--linden/indra/llui/llpanel.cpp231
-rw-r--r--linden/indra/llui/llpanel.h176
-rw-r--r--linden/indra/llui/llradiogroup.cpp28
-rw-r--r--linden/indra/llui/llradiogroup.h41
-rw-r--r--linden/indra/llui/llresizebar.cpp42
-rw-r--r--linden/indra/llui/llresizebar.h11
-rw-r--r--linden/indra/llui/llresizehandle.cpp27
-rw-r--r--linden/indra/llui/llresizehandle.h9
-rw-r--r--linden/indra/llui/llresmgr.h5
-rw-r--r--linden/indra/llui/llrootview.cpp12
-rw-r--r--linden/indra/llui/llrootview.h4
-rw-r--r--linden/indra/llui/llscrollbar.cpp48
-rw-r--r--linden/indra/llui/llscrollbar.h26
-rw-r--r--linden/indra/llui/llscrollcontainer.cpp68
-rw-r--r--linden/indra/llui/llscrollcontainer.h39
-rw-r--r--linden/indra/llui/llscrollingpanellist.cpp20
-rw-r--r--linden/indra/llui/llscrollingpanellist.h28
-rw-r--r--linden/indra/llui/llscrolllistctrl.cpp123
-rw-r--r--linden/indra/llui/llscrolllistctrl.h127
-rw-r--r--linden/indra/llui/llslider.cpp30
-rw-r--r--linden/indra/llui/llslider.h19
-rw-r--r--linden/indra/llui/llsliderctrl.cpp31
-rw-r--r--linden/indra/llui/llsliderctrl.h43
-rw-r--r--linden/indra/llui/llspinctrl.cpp25
-rw-r--r--linden/indra/llui/llspinctrl.h37
-rw-r--r--linden/indra/llui/llstyle.cpp94
-rw-r--r--linden/indra/llui/llstyle.h51
-rw-r--r--linden/indra/llui/lltabcontainer.cpp2397
-rw-r--r--linden/indra/llui/lltabcontainer.h263
-rw-r--r--linden/indra/llui/lltabcontainervertical.cpp582
-rw-r--r--linden/indra/llui/lltabcontainervertical.h67
-rw-r--r--linden/indra/llui/lltextbox.cpp124
-rw-r--r--linden/indra/llui/lltextbox.h30
-rw-r--r--linden/indra/llui/lltexteditor.cpp828
-rw-r--r--linden/indra/llui/lltexteditor.h314
-rw-r--r--linden/indra/llui/llui.cpp1048
-rw-r--r--linden/indra/llui/llui.h330
-rw-r--r--linden/indra/llui/llui.vcproj18
-rw-r--r--linden/indra/llui/llui_vc8.vcproj1206
-rw-r--r--linden/indra/llui/llui_vc9.vcproj1208
-rw-r--r--linden/indra/llui/lluictrl.cpp203
-rw-r--r--linden/indra/llui/lluictrl.h132
-rw-r--r--linden/indra/llui/lluictrlfactory.cpp224
-rw-r--r--linden/indra/llui/lluictrlfactory.h127
-rw-r--r--linden/indra/llui/lluifwd.h63
-rw-r--r--linden/indra/llui/lluistring.cpp12
-rw-r--r--linden/indra/llui/lluistring.h10
-rw-r--r--linden/indra/llui/lluixmltags.h179
-rw-r--r--linden/indra/llui/llundo.cpp7
-rw-r--r--linden/indra/llui/llundo.h48
-rw-r--r--linden/indra/llui/llview.cpp1042
-rw-r--r--linden/indra/llui/llview.h486
-rw-r--r--linden/indra/llui/llviewborder.cpp96
-rw-r--r--linden/indra/llui/llviewborder.h38
-rw-r--r--linden/indra/llui/llviewquery.cpp17
-rw-r--r--linden/indra/llui/llviewquery.h27
90 files changed, 8564 insertions, 8158 deletions
diff --git a/linden/indra/llui/files.lst b/linden/indra/llui/files.lst
index 96bb170..56bc2c3 100644
--- a/linden/indra/llui/files.lst
+++ b/linden/indra/llui/files.lst
@@ -13,6 +13,8 @@ llui/llkeywords.cpp
13llui/lllineeditor.cpp 13llui/lllineeditor.cpp
14llui/llmenugl.cpp 14llui/llmenugl.cpp
15llui/llmodaldialog.cpp 15llui/llmodaldialog.cpp
16llui/llmultislider.cpp
17llui/llmultisliderctrl.cpp
16llui/llpanel.cpp 18llui/llpanel.cpp
17llui/llradiogroup.cpp 19llui/llradiogroup.cpp
18llui/llresizebar.cpp 20llui/llresizebar.cpp
@@ -39,4 +41,6 @@ llui/llundo.cpp
39llui/llview.cpp 41llui/llview.cpp
40llui/llviewborder.cpp 42llui/llviewborder.cpp
41llui/llviewquery.cpp 43llui/llviewquery.cpp
44llui/llmultislider.cpp
45llui/llmultisliderctrl.cpp
42 46
diff --git a/linden/indra/llui/llalertdialog.cpp b/linden/indra/llui/llalertdialog.cpp
index 204fb10..e60ef42 100644
--- a/linden/indra/llui/llalertdialog.cpp
+++ b/linden/indra/llui/llalertdialog.cpp
@@ -177,11 +177,11 @@ LLAlertDialog::LLAlertDialog( const LLAlertDialogTemplate* xml_template,
177// so that the alert is valid until show() is called. 177// so that the alert is valid until show() is called.
178bool LLAlertDialog::show() 178bool LLAlertDialog::show()
179{ 179{
180 // If mModal, check to see if we are not displaying alerts, 180 // If modal, check to see if we are not displaying alerts,
181 // and do any application logic before showing modal alerts 181 // and do any application logic before showing modal alerts
182 if (sDisplayCallback) 182 if (sDisplayCallback)
183 { 183 {
184 bool show = sDisplayCallback(mModal); 184 bool show = sDisplayCallback(isModal());
185 if (show == false) 185 if (show == false)
186 { 186 {
187 mOptionChosen = mDefaultOption; 187 mOptionChosen = mDefaultOption;
@@ -330,7 +330,7 @@ void LLAlertDialog::createDialog(const std::vector<LLString>* optionsp, S32 defa
330 } 330 }
331 reshape( dialog_width, dialog_height, FALSE ); 331 reshape( dialog_width, dialog_height, FALSE );
332 332
333 S32 msg_y = mRect.getHeight() - VPAD; 333 S32 msg_y = getRect().getHeight() - VPAD;
334 S32 msg_x = HPAD; 334 S32 msg_x = HPAD;
335 if (hasTitleBar()) 335 if (hasTitleBar())
336 { 336 {
@@ -355,7 +355,7 @@ void LLAlertDialog::createDialog(const std::vector<LLString>* optionsp, S32 defa
355 addChild(msg_box); 355 addChild(msg_box);
356 356
357 // Buttons 357 // Buttons
358 S32 button_left = (mRect.getWidth() - btn_total_width) / 2; 358 S32 button_left = (getRect().getWidth() - btn_total_width) / 2;
359 359
360 for( S32 i = 0; i < mNumOptions; i++ ) 360 for( S32 i = 0; i < mNumOptions; i++ )
361 { 361 {
@@ -403,18 +403,18 @@ bool LLAlertDialog::setCheckBox( const LLString& check_title, const LLString& ch
403 const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f); 403 const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f);
404 404
405 // Extend dialog for "check next time" 405 // Extend dialog for "check next time"
406 S32 max_msg_width = mRect.getWidth() - 2 * HPAD; 406 S32 max_msg_width = getRect().getWidth() - 2 * HPAD;
407 S32 check_width = S32(font->getWidth(check_title) + 0.99f) + 16; 407 S32 check_width = S32(font->getWidth(check_title) + 0.99f) + 16;
408 max_msg_width = llmax(max_msg_width, check_width); 408 max_msg_width = llmax(max_msg_width, check_width);
409 S32 dialog_width = max_msg_width + 2 * HPAD; 409 S32 dialog_width = max_msg_width + 2 * HPAD;
410 410
411 S32 dialog_height = mRect.getHeight(); 411 S32 dialog_height = getRect().getHeight();
412 dialog_height += LINE_HEIGHT; 412 dialog_height += LINE_HEIGHT;
413 dialog_height += LINE_HEIGHT / 2; 413 dialog_height += LINE_HEIGHT / 2;
414 414
415 reshape( dialog_width, dialog_height, FALSE ); 415 reshape( dialog_width, dialog_height, FALSE );
416 416
417 S32 msg_x = (mRect.getWidth() - max_msg_width) / 2; 417 S32 msg_x = (getRect().getWidth() - max_msg_width) / 2;
418 418
419 LLRect check_rect; 419 LLRect check_rect;
420 check_rect.setOriginAndSize(msg_x, VPAD+BTN_HEIGHT+LINE_HEIGHT/2, 420 check_rect.setOriginAndSize(msg_x, VPAD+BTN_HEIGHT+LINE_HEIGHT/2,
@@ -556,7 +556,7 @@ void LLAlertDialog::draw()
556 LLColor4 shadow_color = LLUI::sColorsGroup->getColor("ColorDropShadow"); 556 LLColor4 shadow_color = LLUI::sColorsGroup->getColor("ColorDropShadow");
557 S32 shadow_lines = LLUI::sConfigGroup->getS32("DropShadowFloater"); 557 S32 shadow_lines = LLUI::sConfigGroup->getS32("DropShadowFloater");
558 558
559 gl_drop_shadow( 0, mRect.getHeight(), mRect.getWidth(), 0, 559 gl_drop_shadow( 0, getRect().getHeight(), getRect().getWidth(), 0,
560 shadow_color, shadow_lines); 560 shadow_color, shadow_lines);
561 561
562 LLModalDialog::draw(); 562 LLModalDialog::draw();
diff --git a/linden/indra/llui/llalertdialog.h b/linden/indra/llui/llalertdialog.h
index 31f4769..4978d71 100644
--- a/linden/indra/llui/llalertdialog.h
+++ b/linden/indra/llui/llalertdialog.h
@@ -42,6 +42,7 @@ class LLCheckBoxCtrl;
42class LLAlertDialogTemplate; 42class LLAlertDialogTemplate;
43class LLLineEditor; 43class LLLineEditor;
44 44
45// https://wiki.lindenlab.com/mediawiki/index.php?title=LLAlertDialog&oldid=81388
45class LLAlertDialog : public LLModalDialog 46class LLAlertDialog : public LLModalDialog
46{ 47{
47public: 48public:
@@ -60,17 +61,13 @@ public:
60 static void setURLLoader(URLLoader* loader) 61 static void setURLLoader(URLLoader* loader)
61 { 62 {
62 sURLLoader = loader; 63 sURLLoader = loader;
63 }; 64 }
64
65protected:
66 struct ButtonData
67 {
68 LLAlertDialog* mSelf;
69 LLButton* mButton;
70 S32 mOption;
71 };
72 65
73public: 66public:
67 // User's responsibility to call show() after creating these.
68 LLAlertDialog( const LLAlertDialogTemplate* xml_template, const LLString::format_map_t& args,
69 alert_callback_t callback = NULL, void *user_data = NULL);
70
74 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent ); 71 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent );
75 72
76 virtual void draw(); 73 virtual void draw();
@@ -106,14 +103,25 @@ public:
106 static const LLString& getTemplateMessage(const LLString& xml_desc); 103 static const LLString& getTemplateMessage(const LLString& xml_desc);
107 104
108 static void setDisplayCallback(display_callback_t callback) { sDisplayCallback = callback; } 105 static void setDisplayCallback(display_callback_t callback) { sDisplayCallback = callback; }
109
110 // Must call show() after creating these
111 LLAlertDialog( const LLAlertDialogTemplate* xml_template, const LLString::format_map_t& args,
112 alert_callback_t callback = NULL, void *user_data = NULL);
113 106
114 void format(LLString& msg, const LLString::format_map_t& args); 107 void format(LLString& msg, const LLString::format_map_t& args);
115 108
116protected: 109 static LLControlGroup* sSettings;
110
111 // use LLPointer so they delete themselves when sTemplates is destroyed
112 typedef std::map<LLString, LLPointer<LLAlertDialogTemplate> > template_map_t;
113 static template_map_t sAlertTemplates; // by mLabel
114 static template_map_t sIgnorableTemplates; // by mIgnoreLabel
115
116
117private:
118
119 static std::map<LLString, LLAlertDialog*> sUniqueActiveMap;
120 static display_callback_t sDisplayCallback;
121
122 static LLString sStringSkipNextTime;
123 static LLString sStringAlwaysChoose;
124
117 void createDialog(const std::vector<LLString>* options, S32 default_option, 125 void createDialog(const std::vector<LLString>* options, S32 default_option,
118 const LLString& msg, const LLString::format_map_t& args, 126 const LLString& msg, const LLString::format_map_t& args,
119 const LLString& edit_text); 127 const LLString& edit_text);
@@ -123,7 +131,13 @@ protected:
123 // Does it have a readable title label, or minimize or close buttons? 131 // Does it have a readable title label, or minimize or close buttons?
124 BOOL hasTitleBar() const; 132 BOOL hasTitleBar() const;
125 133
126protected: 134 struct ButtonData
135 {
136 LLAlertDialog* mSelf;
137 LLButton* mButton;
138 S32 mOption;
139 } * mButtonData;
140
127 alert_callback_t mCallback; 141 alert_callback_t mCallback;
128 void* mUserData; 142 void* mUserData;
129 S32 mNumOptions; 143 S32 mNumOptions;
@@ -135,7 +149,6 @@ protected:
135 S32 mIgnorable; 149 S32 mIgnorable;
136 LLString mLabel; 150 LLString mLabel;
137 LLString mIgnoreLabel; 151 LLString mIgnoreLabel;
138 ButtonData* mButtonData;
139 LLFrameTimer mDefaultBtnTimer; 152 LLFrameTimer mDefaultBtnTimer;
140 // For Dialogs that take a line as text as input: 153 // For Dialogs that take a line as text as input:
141 LLLineEditor* mLineEditor; 154 LLLineEditor* mLineEditor;
@@ -143,18 +156,6 @@ protected:
143 // For Dialogs linked to a URL 156 // For Dialogs linked to a URL
144 LLString mURL; // Some alerts will direct the resident to a URL 157 LLString mURL; // Some alerts will direct the resident to a URL
145 S32 mURLOption; 158 S32 mURLOption;
146
147public:
148 // use LLPointer so they delete themselves when sTemplates is destroyed
149 typedef std::map<LLString, LLPointer<LLAlertDialogTemplate> > template_map_t;
150 static template_map_t sAlertTemplates; // by mLabel
151 static template_map_t sIgnorableTemplates; // by mIgnoreLabel
152 static LLControlGroup* sSettings;
153 static std::map<LLString, LLAlertDialog*> sUniqueActiveMap;
154 static display_callback_t sDisplayCallback;
155
156 static LLString sStringSkipNextTime;
157 static LLString sStringAlwaysChoose;
158 159
159private: 160private:
160 static URLLoader* sURLLoader; 161 static URLLoader* sURLLoader;
diff --git a/linden/indra/llui/llbutton.cpp b/linden/indra/llui/llbutton.cpp
index 7513fc2..4af40ff 100644
--- a/linden/indra/llui/llbutton.cpp
+++ b/linden/indra/llui/llbutton.cpp
@@ -48,6 +48,7 @@
48#include "llglheaders.h" 48#include "llglheaders.h"
49#include "llfocusmgr.h" 49#include "llfocusmgr.h"
50#include "llwindow.h" 50#include "llwindow.h"
51#include "llglimmediate.h"
51 52
52// globals loaded from settings.xml 53// globals loaded from settings.xml
53S32 LLBUTTON_ORIG_H_PAD = 6; // Pre-zoomable UI 54S32 LLBUTTON_ORIG_H_PAD = 6; // Pre-zoomable UI
@@ -189,7 +190,7 @@ void LLButton::init(void (*click_callback)(void*), void *callback_data, const LL
189 mGLFont = ( font ? font : LLFontGL::sSansSerif); 190 mGLFont = ( font ? font : LLFontGL::sSansSerif);
190 191
191 // Hack to make sure there is space for at least one character 192 // Hack to make sure there is space for at least one character
192 if (mRect.getWidth() - (mRightHPad + mLeftHPad) < mGLFont->getWidth(" ")) 193 if (getRect().getWidth() - (mRightHPad + mLeftHPad) < mGLFont->getWidth(" "))
193 { 194 {
194 // Use old defaults 195 // Use old defaults
195 mLeftHPad = LLBUTTON_ORIG_H_PAD; 196 mLeftHPad = LLBUTTON_ORIG_H_PAD;
@@ -252,12 +253,12 @@ void LLButton::onCommit()
252 (*mMouseUpCallback)(mCallbackUserData); 253 (*mMouseUpCallback)(mCallbackUserData);
253 } 254 }
254 255
255 if (mSoundFlags & MOUSE_DOWN) 256 if (getSoundFlags() & MOUSE_DOWN)
256 { 257 {
257 make_ui_sound("UISndClick"); 258 make_ui_sound("UISndClick");
258 } 259 }
259 260
260 if (mSoundFlags & MOUSE_UP) 261 if (getSoundFlags() & MOUSE_UP)
261 { 262 {
262 make_ui_sound("UISndClickRelease"); 263 make_ui_sound("UISndClickRelease");
263 } 264 }
@@ -279,7 +280,7 @@ void LLButton::onCommit()
279BOOL LLButton::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) 280BOOL LLButton::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent)
280{ 281{
281 BOOL handled = FALSE; 282 BOOL handled = FALSE;
282 if( getVisible() && mEnabled && !called_from_parent && ' ' == uni_char && !gKeyboard->getKeyRepeated(' ')) 283 if( getVisible() && getEnabled() && !called_from_parent && ' ' == uni_char && !gKeyboard->getKeyRepeated(' '))
283 { 284 {
284 if (mIsToggle) 285 if (mIsToggle)
285 { 286 {
@@ -298,7 +299,7 @@ BOOL LLButton::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent)
298BOOL LLButton::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent ) 299BOOL LLButton::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent )
299{ 300{
300 BOOL handled = FALSE; 301 BOOL handled = FALSE;
301 if( getVisible() && mEnabled && !called_from_parent ) 302 if( getVisible() && getEnabled() && !called_from_parent )
302 { 303 {
303 if( mCommitOnReturn && KEY_RETURN == key && mask == MASK_NONE && !gKeyboard->getKeyRepeated(key)) 304 if( mCommitOnReturn && KEY_RETURN == key && mask == MASK_NONE && !gKeyboard->getKeyRepeated(key))
304 { 305 {
@@ -337,7 +338,7 @@ BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask)
337 mMouseDownTimer.start(); 338 mMouseDownTimer.start();
338 mMouseDownFrame = LLFrameTimer::getFrameCount(); 339 mMouseDownFrame = LLFrameTimer::getFrameCount();
339 340
340 if (mSoundFlags & MOUSE_DOWN) 341 if (getSoundFlags() & MOUSE_DOWN)
341 { 342 {
342 make_ui_sound("UISndClick"); 343 make_ui_sound("UISndClick");
343 } 344 }
@@ -367,7 +368,7 @@ BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask)
367 // If mouseup in the widget, it's been clicked 368 // If mouseup in the widget, it's been clicked
368 if (pointInView(x, y)) 369 if (pointInView(x, y))
369 { 370 {
370 if (mSoundFlags & MOUSE_UP) 371 if (getSoundFlags() & MOUSE_UP)
371 { 372 {
372 make_ui_sound("UISndClickRelease"); 373 make_ui_sound("UISndClickRelease");
373 } 374 }
@@ -400,7 +401,7 @@ BOOL LLButton::handleHover(S32 x, S32 y, MASK mask)
400 401
401 if (mMouseDownTimer.getStarted() && NULL != mHeldDownCallback) 402 if (mMouseDownTimer.getStarted() && NULL != mHeldDownCallback)
402 { 403 {
403 F32 elapsed = mMouseDownTimer.getElapsedTimeF32(); 404 F32 elapsed = getHeldDownTime();
404 if( mHeldDownDelay <= elapsed && mHeldDownFrameDelay <= LLFrameTimer::getFrameCount() - mMouseDownFrame) 405 if( mHeldDownDelay <= elapsed && mHeldDownFrameDelay <= LLFrameTimer::getFrameCount() - mMouseDownFrame)
405 { 406 {
406 mHeldDownCallback( mCallbackUserData ); 407 mHeldDownCallback( mCallbackUserData );
@@ -505,11 +506,11 @@ void LLButton::draw()
505 // enabled and tentative 506 // enabled and tentative
506 // or 507 // or
507 // disabled but checked 508 // disabled but checked
508 if (!mImageDisabledSelected.isNull() && ( (mEnabled && mTentative) || (!mEnabled && pressed ) ) ) 509 if (!mImageDisabledSelected.isNull() && ( (getEnabled() && getTentative()) || (!getEnabled() && pressed ) ) )
509 { 510 {
510 mImagep = mImageDisabledSelected; 511 mImagep = mImageDisabledSelected;
511 } 512 }
512 else if (!mImageDisabled.isNull() && !mEnabled && !pressed) 513 else if (!mImageDisabled.isNull() && !getEnabled() && !pressed)
513 { 514 {
514 mImagep = mImageDisabled; 515 mImagep = mImageDisabled;
515 } 516 }
@@ -523,7 +524,7 @@ void LLButton::draw()
523 LLColor4 label_color; 524 LLColor4 label_color;
524 525
525 // label changes when button state changes, not when pressed 526 // label changes when button state changes, not when pressed
526 if ( mEnabled ) 527 if ( getEnabled() )
527 { 528 {
528 if ( mToggleState ) 529 if ( mToggleState )
529 { 530 {
@@ -551,7 +552,7 @@ void LLButton::draw()
551 552
552 if( mToggleState ) 553 if( mToggleState )
553 { 554 {
554 if( mEnabled || mDisabledSelectedLabel.empty() ) 555 if( getEnabled() || mDisabledSelectedLabel.empty() )
555 { 556 {
556 label = mSelectedLabel; 557 label = mSelectedLabel;
557 } 558 }
@@ -562,7 +563,7 @@ void LLButton::draw()
562 } 563 }
563 else 564 else
564 { 565 {
565 if( mEnabled || mDisabledLabel.empty() ) 566 if( getEnabled() || mDisabledLabel.empty() )
566 { 567 {
567 label = mUnselectedLabel; 568 label = mUnselectedLabel;
568 } 569 }
@@ -573,7 +574,7 @@ void LLButton::draw()
573 } 574 }
574 575
575 // draw default button border 576 // draw default button border
576 if (mEnabled && mBorderEnabled && gFocusMgr.getAppHasFocus()) // because we're the default button in a panel 577 if (getEnabled() && mBorderEnabled && gFocusMgr.getAppHasFocus()) // because we're the default button in a panel
577 { 578 {
578 drawBorder(LLUI::sColorsGroup->getColor( "ButtonBorderColor" ), BORDER_SIZE); 579 drawBorder(LLUI::sColorsGroup->getColor( "ButtonBorderColor" ), BORDER_SIZE);
579 } 580 }
@@ -598,37 +599,37 @@ void LLButton::draw()
598 // Otherwise draw basic rectangular button. 599 // Otherwise draw basic rectangular button.
599 if( mImagep.notNull() && !mScaleImage) 600 if( mImagep.notNull() && !mScaleImage)
600 { 601 {
601 mImagep->draw(0, 0, mEnabled ? mImageColor : mDisabledImageColor ); 602 mImagep->draw(0, 0, getEnabled() ? mImageColor : mDisabledImageColor );
602 if (mCurGlowStrength > 0.01f) 603 if (mCurGlowStrength > 0.01f)
603 { 604 {
604 glBlendFunc(GL_SRC_ALPHA, GL_ONE); 605 gGL.blendFunc(GL_SRC_ALPHA, GL_ONE);
605 mImagep->drawSolid(0, 0, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength)); 606 mImagep->drawSolid(0, 0, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength));
606 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 607 gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
607 } 608 }
608 } 609 }
609 else 610 else
610 if ( mImagep.notNull() && mScaleImage) 611 if ( mImagep.notNull() && mScaleImage)
611 { 612 {
612 mImagep->draw(0, 0, mRect.getWidth(), mRect.getHeight(), mEnabled ? mImageColor : mDisabledImageColor ); 613 mImagep->draw(0, 0, getRect().getWidth(), getRect().getHeight(), getEnabled() ? mImageColor : mDisabledImageColor );
613 if (mCurGlowStrength > 0.01f) 614 if (mCurGlowStrength > 0.01f)
614 { 615 {
615 glBlendFunc(GL_SRC_ALPHA, GL_ONE); 616 gGL.blendFunc(GL_SRC_ALPHA, GL_ONE);
616 mImagep->drawSolid(0, 0, mRect.getWidth(), mRect.getHeight(), LLColor4(1.f, 1.f, 1.f, mCurGlowStrength)); 617 mImagep->drawSolid(0, 0, getRect().getWidth(), getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, mCurGlowStrength));
617 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 618 gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
618 } 619 }
619 } 620 }
620 else 621 else
621 { 622 {
622 // no image 623 // no image
623 llwarns << "No image for button " << mName << llendl; 624 llwarns << "No image for button " << getName() << llendl;
624 // draw it in pink so we can find it 625 // draw it in pink so we can find it
625 gl_rect_2d(0, mRect.getHeight(), mRect.getWidth(), 0, LLColor4::pink1, FALSE); 626 gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4::pink1, FALSE);
626 } 627 }
627 628
628 // let overlay image and text play well together 629 // let overlay image and text play well together
629 S32 text_left = mLeftHPad; 630 S32 text_left = mLeftHPad;
630 S32 text_right = mRect.getWidth() - mRightHPad; 631 S32 text_right = getRect().getWidth() - mRightHPad;
631 S32 text_width = mRect.getWidth() - mLeftHPad - mRightHPad; 632 S32 text_width = getRect().getWidth() - mLeftHPad - mRightHPad;
632 633
633 // draw overlay image 634 // draw overlay image
634 if (mImageOverlay.notNull()) 635 if (mImageOverlay.notNull())
@@ -637,7 +638,7 @@ void LLButton::draw()
637 S32 overlay_width = mImageOverlay->getWidth(); 638 S32 overlay_width = mImageOverlay->getWidth();
638 S32 overlay_height = mImageOverlay->getHeight(); 639 S32 overlay_height = mImageOverlay->getHeight();
639 640
640 F32 scale_factor = llmin((F32)mRect.getWidth() / (F32)overlay_width, (F32)mRect.getHeight() / (F32)overlay_height, 1.f); 641 F32 scale_factor = llmin((F32)getRect().getWidth() / (F32)overlay_width, (F32)getRect().getHeight() / (F32)overlay_height, 1.f);
641 overlay_width = llround((F32)overlay_width * scale_factor); 642 overlay_width = llround((F32)overlay_width * scale_factor);
642 overlay_height = llround((F32)overlay_height * scale_factor); 643 overlay_height = llround((F32)overlay_height * scale_factor);
643 644
@@ -682,7 +683,7 @@ void LLButton::draw()
682 text_right -= overlay_width + 1; 683 text_right -= overlay_width + 1;
683 text_width -= overlay_width + 1; 684 text_width -= overlay_width + 1;
684 mImageOverlay->draw( 685 mImageOverlay->draw(
685 mRect.getWidth() - mRightHPad - overlay_width, 686 getRect().getWidth() - mRightHPad - overlay_width,
686 center_y - (overlay_height / 2), 687 center_y - (overlay_height / 2),
687 overlay_width, 688 overlay_width,
688 overlay_height, 689 overlay_height,
@@ -706,7 +707,7 @@ void LLButton::draw()
706 x = text_right; 707 x = text_right;
707 break; 708 break;
708 case LLFontGL::HCENTER: 709 case LLFontGL::HCENTER:
709 x = mRect.getWidth() / 2; 710 x = getRect().getWidth() / 2;
710 break; 711 break;
711 case LLFontGL::LEFT: 712 case LLFontGL::LEFT:
712 default: 713 default:
@@ -714,7 +715,7 @@ void LLButton::draw()
714 break; 715 break;
715 } 716 }
716 717
717 S32 y_offset = 2 + (mRect.getHeight() - 20)/2; 718 S32 y_offset = 2 + (getRect().getHeight() - 20)/2;
718 719
719 if (pressed) 720 if (pressed)
720 { 721 {
@@ -743,8 +744,8 @@ void LLButton::draw()
743void LLButton::drawBorder(const LLColor4& color, S32 size) 744void LLButton::drawBorder(const LLColor4& color, S32 size)
744{ 745{
745 S32 left = -size; 746 S32 left = -size;
746 S32 top = mRect.getHeight() + size; 747 S32 top = getRect().getHeight() + size;
747 S32 right = mRect.getWidth() + size; 748 S32 right = getRect().getWidth() + size;
748 S32 bottom = -size; 749 S32 bottom = -size;
749 750
750 if (mImagep.isNull()) 751 if (mImagep.isNull())
@@ -1146,7 +1147,7 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa
1146 return button; 1147 return button;
1147} 1148}
1148 1149
1149void LLButton::setHelpURLCallback(std::string help_url) 1150void LLButton::setHelpURLCallback(const LLString &help_url)
1150{ 1151{
1151 mHelpURL = help_url; 1152 mHelpURL = help_url;
1152 setClickedCallback(clicked_help,this); 1153 setClickedCallback(clicked_help,this);
diff --git a/linden/indra/llui/llbutton.h b/linden/indra/llui/llbutton.h
index 7d50f40..18f4e07 100644
--- a/linden/indra/llui/llbutton.h
+++ b/linden/indra/llui/llbutton.h
@@ -52,10 +52,14 @@ extern S32 LLBUTTON_V_PAD;
52extern S32 BTN_HEIGHT_SMALL; 52extern S32 BTN_HEIGHT_SMALL;
53extern S32 BTN_HEIGHT; 53extern S32 BTN_HEIGHT;
54 54
55
56// All button widths should be rounded up to this size 55// All button widths should be rounded up to this size
57extern S32 BTN_GRID; 56extern S32 BTN_GRID;
58 57
58//
59// Helpful functions
60//
61S32 round_up(S32 grid, S32 value);
62
59 63
60class LLUICtrlFactory; 64class LLUICtrlFactory;
61 65
@@ -124,6 +128,7 @@ public:
124 BOOL getFlashing() const { return mFlashing; } 128 BOOL getFlashing() const { return mFlashing; }
125 129
126 void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; } 130 void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; }
131 LLFontGL::HAlign getHAlign() const { return mHAlign; }
127 void setLeftHPad( S32 pad ) { mLeftHPad = pad; } 132 void setLeftHPad( S32 pad ) { mLeftHPad = pad; }
128 void setRightHPad( S32 pad ) { mRightHPad = pad; } 133 void setRightHPad( S32 pad ) { mRightHPad = pad; }
129 134
@@ -162,6 +167,7 @@ public:
162 void setFont(const LLFontGL *font) 167 void setFont(const LLFontGL *font)
163 { mGLFont = ( font ? font : LLFontGL::sSansSerif); } 168 { mGLFont = ( font ? font : LLFontGL::sSansSerif); }
164 void setScaleImage(BOOL scale) { mScaleImage = scale; } 169 void setScaleImage(BOOL scale) { mScaleImage = scale; }
170 BOOL getScaleImage() const { return mScaleImage; }
165 171
166 void setDropShadowedText(BOOL b) { mDropShadowedText = b; } 172 void setDropShadowedText(BOOL b) { mDropShadowedText = b; }
167 173
@@ -171,9 +177,10 @@ public:
171 177
172 void setHoverGlowStrength(F32 strength) { mHoverGlowStrength = strength; } 178 void setHoverGlowStrength(F32 strength) { mHoverGlowStrength = strength; }
173 179
174public:
175 void setImageUnselected(const LLString &image_name); 180 void setImageUnselected(const LLString &image_name);
181 const LLString& getImageUnselectedName() const { return mImageUnselectedName; }
176 void setImageSelected(const LLString &image_name); 182 void setImageSelected(const LLString &image_name);
183 const LLString& getImageSelectedName() const { return mImageSelectedName; }
177 void setImageHoverSelected(const LLString &image_name); 184 void setImageHoverSelected(const LLString &image_name);
178 void setImageHoverUnselected(const LLString &image_name); 185 void setImageHoverUnselected(const LLString &image_name);
179 void setImageDisabled(const LLString &image_name); 186 void setImageDisabled(const LLString &image_name);
@@ -187,14 +194,29 @@ public:
187 void setImageDisabledSelected(LLPointer<LLUIImage> image); 194 void setImageDisabledSelected(LLPointer<LLUIImage> image);
188 195
189 void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; } 196 void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; }
190 BOOL getCommitOnReturn() { return mCommitOnReturn; } 197 BOOL getCommitOnReturn() const { return mCommitOnReturn; }
198
199 void setHelpURLCallback(const LLString &help_url);
200 const LLString& getHelpURL() const { return mHelpURL; }
191 201
192 void setHelpURLCallback(std::string help_url);
193 LLString getHelpURL() { return mHelpURL; }
194protected: 202protected:
203
195 virtual void drawBorder(const LLColor4& color, S32 size); 204 virtual void drawBorder(const LLColor4& color, S32 size);
196 205
197protected: 206 void setImageUnselectedID(const LLUUID &image_id);
207 const LLUUID& getImageUnselectedID() const { return mImageUnselectedID; }
208 void setImageSelectedID(const LLUUID &image_id);
209 const LLUUID& getImageSelectedID() const { return mImageSelectedID; }
210 void setImageHoverSelectedID(const LLUUID &image_id);
211 void setImageHoverUnselectedID(const LLUUID &image_id);
212 void setImageDisabledID(const LLUUID &image_id);
213 void setImageDisabledSelectedID(const LLUUID &image_id);
214 const LLPointer<LLUIImage>& getImageUnselected() const { return mImageUnselected; }
215 const LLPointer<LLUIImage>& getImageSelected() const { return mImageSelected; }
216
217 LLFrameTimer mMouseDownTimer;
218
219private:
198 220
199 void (*mClickedCallback)(void* data ); 221 void (*mClickedCallback)(void* data );
200 void (*mMouseDownCallback)(void *data); 222 void (*mMouseDownCallback)(void *data);
@@ -203,7 +225,6 @@ protected:
203 225
204 const LLFontGL *mGLFont; 226 const LLFontGL *mGLFont;
205 227
206 LLFrameTimer mMouseDownTimer;
207 S32 mMouseDownFrame; 228 S32 mMouseDownFrame;
208 F32 mHeldDownDelay; // seconds, after which held-down callbacks get called 229 F32 mHeldDownDelay; // seconds, after which held-down callbacks get called
209 S32 mHeldDownFrameDelay; // frames, after which held-down callbacks get called 230 S32 mHeldDownFrameDelay; // frames, after which held-down callbacks get called
@@ -232,7 +253,6 @@ protected:
232 LLUIString mDisabledSelectedLabel; 253 LLUIString mDisabledSelectedLabel;
233 LLColor4 mDisabledSelectedLabelColor; 254 LLColor4 mDisabledSelectedLabelColor;
234 255
235
236 LLUUID mImageUnselectedID; 256 LLUUID mImageUnselectedID;
237 LLUUID mImageSelectedID; 257 LLUUID mImageSelectedID;
238 LLUUID mImageHoverSelectedID; 258 LLUUID mImageHoverSelectedID;
@@ -280,7 +300,4 @@ protected:
280 LLFrameTimer mFlashingTimer; 300 LLFrameTimer mFlashingTimer;
281}; 301};
282 302
283// Helpful functions
284S32 round_up(S32 grid, S32 value);
285
286#endif // LL_LLBUTTON_H 303#endif // LL_LLBUTTON_H
diff --git a/linden/indra/llui/llcheckboxctrl.cpp b/linden/indra/llui/llcheckboxctrl.cpp
index ff46a80..ecb6342 100644
--- a/linden/indra/llui/llcheckboxctrl.cpp
+++ b/linden/indra/llui/llcheckboxctrl.cpp
@@ -89,7 +89,16 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLString& name, const LLRect& rect,
89 LLCHECKBOXCTRL_VPAD + 1, // padding to get better alignment 89 LLCHECKBOXCTRL_VPAD + 1, // padding to get better alignment
90 text_width + LLCHECKBOXCTRL_HPAD, 90 text_width + LLCHECKBOXCTRL_HPAD,
91 text_height ); 91 text_height );
92 mLabel = new LLTextBox( "CheckboxCtrl Label", label_rect, label.c_str(), mFont ); 92
93 // *HACK Get rid of this with SL-55508...
94 // this allows blank check boxes and radio boxes for now
95 LLString local_label = label;
96 if(local_label.empty())
97 {
98 local_label = " ";
99 }
100
101 mLabel = new LLTextBox( "CheckboxCtrl Label", label_rect, local_label.c_str(), mFont );
93 mLabel->setFollowsLeft(); 102 mLabel->setFollowsLeft();
94 mLabel->setFollowsBottom(); 103 mLabel->setFollowsBottom();
95 addChild(mLabel); 104 addChild(mLabel);
@@ -212,7 +221,7 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)
212 221
213void LLCheckBoxCtrl::draw() 222void LLCheckBoxCtrl::draw()
214{ 223{
215 if (mEnabled) 224 if (getEnabled())
216 { 225 {
217 mLabel->setColor( mTextEnabledColor ); 226 mLabel->setColor( mTextEnabledColor );
218 } 227 }
diff --git a/linden/indra/llui/llclipboard.cpp b/linden/indra/llui/llclipboard.cpp
index eaf7798..31d02a4 100644
--- a/linden/indra/llui/llclipboard.cpp
+++ b/linden/indra/llui/llclipboard.cpp
@@ -61,7 +61,7 @@ void LLClipboard::copyFromSubstring(const LLWString &src, S32 pos, S32 len, cons
61} 61}
62 62
63 63
64LLWString LLClipboard::getPasteWString( LLUUID* source_id ) 64const LLWString& LLClipboard::getPasteWString( LLUUID* source_id )
65{ 65{
66 if( mSourceID.notNull() ) 66 if( mSourceID.notNull() )
67 { 67 {
@@ -88,7 +88,7 @@ LLWString LLClipboard::getPasteWString( LLUUID* source_id )
88} 88}
89 89
90 90
91BOOL LLClipboard::canPasteString() 91BOOL LLClipboard::canPasteString() const
92{ 92{
93 return LLView::getWindow()->isClipboardTextAvailable(); 93 return LLView::getWindow()->isClipboardTextAvailable();
94} 94}
diff --git a/linden/indra/llui/llclipboard.h b/linden/indra/llui/llclipboard.h
index 82ea334..2ebc2de 100644
--- a/linden/indra/llui/llclipboard.h
+++ b/linden/indra/llui/llclipboard.h
@@ -36,24 +36,20 @@
36#include "llstring.h" 36#include "llstring.h"
37#include "lluuid.h" 37#include "lluuid.h"
38 38
39// 39
40// Classes
41//
42class LLClipboard 40class LLClipboard
43{ 41{
44protected:
45 LLUUID mSourceID;
46 LLWString mString;
47
48public: 42public:
49 LLClipboard(); 43 LLClipboard();
50 ~LLClipboard(); 44 ~LLClipboard();
51 45
52 void copyFromSubstring(const LLWString &copy_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null ); 46 void copyFromSubstring(const LLWString &copy_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null );
53 47 BOOL canPasteString() const;
54 48 const LLWString& getPasteWString(LLUUID* source_id = NULL);
55 BOOL canPasteString(); 49
56 LLWString getPasteWString(LLUUID* source_id = NULL); 50private:
51 LLUUID mSourceID;
52 LLWString mString;
57}; 53};
58 54
59 55
diff --git a/linden/indra/llui/llcombobox.cpp b/linden/indra/llui/llcombobox.cpp
index 0e0f5f2..c486042 100644
--- a/linden/indra/llui/llcombobox.cpp
+++ b/linden/indra/llui/llcombobox.cpp
@@ -99,7 +99,7 @@ LLComboBox::LLComboBox( const LLString& name, const LLRect &rect, const LLString
99 mList->setCommitOnKeyboardMovement(FALSE); 99 mList->setCommitOnKeyboardMovement(FALSE);
100 addChild(mList); 100 addChild(mList);
101 101
102 LLRect border_rect(0, mRect.getHeight(), mRect.getWidth(), 0); 102 LLRect border_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
103 mBorder = new LLViewBorder( "combo border", border_rect ); 103 mBorder = new LLViewBorder( "combo border", border_rect );
104 addChild( mBorder ); 104 addChild( mBorder );
105 mBorder->setFollowsAll(); 105 mBorder->setFollowsAll();
@@ -444,7 +444,7 @@ void LLComboBox::setButtonVisible(BOOL visible)
444 mButton->setVisible(visible); 444 mButton->setVisible(visible);
445 if (mTextEntry) 445 if (mTextEntry)
446 { 446 {
447 LLRect text_entry_rect(0, mRect.getHeight(), mRect.getWidth(), 0); 447 LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
448 if (visible) 448 if (visible)
449 { 449 {
450 text_entry_rect.mRight -= llmax(8,mArrowImage->getWidth(0)) + 2 * LLUI::sConfigGroup->getS32("DropShadowButton"); 450 text_entry_rect.mRight -= llmax(8,mArrowImage->getWidth(0)) + 2 * LLUI::sConfigGroup->getS32("DropShadowButton");
@@ -460,7 +460,7 @@ void LLComboBox::draw()
460 { 460 {
461 mBorder->setKeyboardFocusHighlight(hasFocus()); 461 mBorder->setKeyboardFocusHighlight(hasFocus());
462 462
463 mButton->setEnabled(mEnabled /*&& !mList->isEmpty()*/); 463 mButton->setEnabled(getEnabled() /*&& !mList->isEmpty()*/);
464 464
465 // Draw children normally 465 // Draw children normally
466 LLUICtrl::draw(); 466 LLUICtrl::draw();
@@ -494,13 +494,13 @@ void LLComboBox::updateLayout()
494 if (mAllowTextEntry) 494 if (mAllowTextEntry)
495 { 495 {
496 S32 shadow_size = LLUI::sConfigGroup->getS32("DropShadowButton"); 496 S32 shadow_size = LLUI::sConfigGroup->getS32("DropShadowButton");
497 mButton->setRect(LLRect( mRect.getWidth() - llmax(8,mArrowImage->getWidth(0)) - 2 * shadow_size, 497 mButton->setRect(LLRect( getRect().getWidth() - llmax(8,mArrowImage->getWidth(0)) - 2 * shadow_size,
498 rect.mTop, rect.mRight, rect.mBottom)); 498 rect.mTop, rect.mRight, rect.mBottom));
499 mButton->setTabStop(FALSE); 499 mButton->setTabStop(FALSE);
500 500
501 if (!mTextEntry) 501 if (!mTextEntry)
502 { 502 {
503 LLRect text_entry_rect(0, mRect.getHeight(), mRect.getWidth(), 0); 503 LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
504 text_entry_rect.mRight -= llmax(8,mArrowImage->getWidth(0)) + 2 * LLUI::sConfigGroup->getS32("DropShadowButton"); 504 text_entry_rect.mRight -= llmax(8,mArrowImage->getWidth(0)) + 2 * LLUI::sConfigGroup->getS32("DropShadowButton");
505 // clear label on button 505 // clear label on button
506 LLString cur_label = mButton->getLabelSelected(); 506 LLString cur_label = mButton->getLabelSelected();
@@ -575,7 +575,7 @@ void LLComboBox::showList()
575 575
576 LLRect rect = mList->getRect(); 576 LLRect rect = mList->getRect();
577 577
578 S32 min_width = mRect.getWidth(); 578 S32 min_width = getRect().getWidth();
579 S32 max_width = llmax(min_width, MAX_COMBO_WIDTH); 579 S32 max_width = llmax(min_width, MAX_COMBO_WIDTH);
580 S32 list_width = llclamp(mList->getMaxContentWidth(), min_width, max_width); 580 S32 list_width = llclamp(mList->getMaxContentWidth(), min_width, max_width);
581 581
@@ -589,7 +589,7 @@ void LLComboBox::showList()
589 else 589 else
590 { 590 {
591 // stack on top or bottom, depending on which has more room 591 // stack on top or bottom, depending on which has more room
592 if (-root_view_local.mBottom > root_view_local.mTop - mRect.getHeight()) 592 if (-root_view_local.mBottom > root_view_local.mTop - getRect().getHeight())
593 { 593 {
594 // Move rect so it hangs off the bottom of this view 594 // Move rect so it hangs off the bottom of this view
595 rect.setLeftTopAndSize(0, 0, list_width, llmin(-root_view_local.mBottom, rect.getHeight())); 595 rect.setLeftTopAndSize(0, 0, list_width, llmin(-root_view_local.mBottom, rect.getHeight()));
@@ -597,21 +597,21 @@ void LLComboBox::showList()
597 else 597 else
598 { 598 {
599 // move rect so it stacks on top of this view (clipped to size of screen) 599 // move rect so it stacks on top of this view (clipped to size of screen)
600 rect.setOriginAndSize(0, mRect.getHeight(), list_width, llmin(root_view_local.mTop - mRect.getHeight(), rect.getHeight())); 600 rect.setOriginAndSize(0, getRect().getHeight(), list_width, llmin(root_view_local.mTop - getRect().getHeight(), rect.getHeight()));
601 } 601 }
602 } 602 }
603 } 603 }
604 else // ABOVE 604 else // ABOVE
605 { 605 {
606 if (rect.getHeight() <= root_view_local.mTop - mRect.getHeight()) 606 if (rect.getHeight() <= root_view_local.mTop - getRect().getHeight())
607 { 607 {
608 // move rect so it stacks on top of this view (clipped to size of screen) 608 // move rect so it stacks on top of this view (clipped to size of screen)
609 rect.setOriginAndSize(0, mRect.getHeight(), list_width, llmin(root_view_local.mTop - mRect.getHeight(), rect.getHeight())); 609 rect.setOriginAndSize(0, getRect().getHeight(), list_width, llmin(root_view_local.mTop - getRect().getHeight(), rect.getHeight()));
610 } 610 }
611 else 611 else
612 { 612 {
613 // stack on top or bottom, depending on which has more room 613 // stack on top or bottom, depending on which has more room
614 if (-root_view_local.mBottom > root_view_local.mTop - mRect.getHeight()) 614 if (-root_view_local.mBottom > root_view_local.mTop - getRect().getHeight())
615 { 615 {
616 // Move rect so it hangs off the bottom of this view 616 // Move rect so it hangs off the bottom of this view
617 rect.setLeftTopAndSize(0, 0, list_width, llmin(-root_view_local.mBottom, rect.getHeight())); 617 rect.setLeftTopAndSize(0, 0, list_width, llmin(-root_view_local.mBottom, rect.getHeight()));
@@ -619,7 +619,7 @@ void LLComboBox::showList()
619 else 619 else
620 { 620 {
621 // move rect so it stacks on top of this view (clipped to size of screen) 621 // move rect so it stacks on top of this view (clipped to size of screen)
622 rect.setOriginAndSize(0, mRect.getHeight(), list_width, llmin(root_view_local.mTop - mRect.getHeight(), rect.getHeight())); 622 rect.setOriginAndSize(0, getRect().getHeight(), list_width, llmin(root_view_local.mTop - getRect().getHeight(), rect.getHeight()));
623 } 623 }
624 } 624 }
625 625
@@ -640,12 +640,6 @@ void LLComboBox::showList()
640 // NB: this call will trigger the focuslost callback which will hide the list, so do it first 640 // NB: this call will trigger the focuslost callback which will hide the list, so do it first
641 // before finally showing the list 641 // before finally showing the list
642 642
643 if (!mList->getFirstSelected())
644 {
645 // if nothing is selected, select the first item
646 // so that the callback is not immediately triggered on setFocus()
647 mList->selectFirstItem();
648 }
649 mList->setFocus(TRUE); 643 mList->setFocus(TRUE);
650 644
651 // register ourselves as a "top" control 645 // register ourselves as a "top" control
@@ -718,7 +712,7 @@ void LLComboBox::onButtonDown(void *userdata)
718 else 712 else
719 { 713 {
720 self->hideList(); 714 self->hideList();
721 } 715 }
722 716
723} 717}
724 718
@@ -741,31 +735,36 @@ void LLComboBox::onItemSelected(LLUICtrl* item, void *userdata)
741 self->mTextEntry->selectAll(); 735 self->mTextEntry->selectAll();
742 } 736 }
743 } 737 }
744 else
745 {
746 // invalid selection, just restore existing value
747 LLString orig_selection = self->mAllowTextEntry ? self->mTextEntry->getText() : self->mButton->getLabelSelected();
748
749 self->mList->selectItemByLabel(orig_selection);
750 }
751 self->onCommit();
752 738
739 // hiding the list reasserts the old value stored in the text editor/dropdown button
753 self->hideList(); 740 self->hideList();
741
742 // commit does the reverse, asserting the value in the list
743 self->onCommit();
754} 744}
755 745
756BOOL LLComboBox::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) 746BOOL LLComboBox::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen)
757{ 747{
758 LLString tool_tip; 748 LLString tool_tip;
759 749
750 if(LLUICtrl::handleToolTip(x, y, msg, sticky_rect_screen))
751 {
752 return TRUE;
753 }
754
760 if (LLUI::sShowXUINames) 755 if (LLUI::sShowXUINames)
761 { 756 {
762 tool_tip = getShowNamesToolTip(); 757 tool_tip = getShowNamesToolTip();
763 } 758 }
764 else 759 else
765 { 760 {
766 tool_tip = mToolTipMsg; 761 tool_tip = getToolTip();
762 if (tool_tip.empty())
763 {
764 tool_tip = getValue().asString();
765 }
767 } 766 }
768 767
769 if( !tool_tip.empty() ) 768 if( !tool_tip.empty() )
770 { 769 {
771 msg = tool_tip; 770 msg = tool_tip;
@@ -775,7 +774,7 @@ BOOL LLComboBox::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_
775 0, 0, 774 0, 0,
776 &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); 775 &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );
777 localPointToScreen( 776 localPointToScreen(
778 mRect.getWidth(), mRect.getHeight(), 777 getRect().getWidth(), getRect().getHeight(),
779 &(sticky_rect_screen->mRight), &(sticky_rect_screen->mTop) ); 778 &(sticky_rect_screen->mRight), &(sticky_rect_screen->mTop) );
780 } 779 }
781 return TRUE; 780 return TRUE;
@@ -1042,11 +1041,11 @@ BOOL LLComboBox::setCurrentByID(const LLUUID& id)
1042 return found; 1041 return found;
1043} 1042}
1044 1043
1045LLUUID LLComboBox::getCurrentID() 1044LLUUID LLComboBox::getCurrentID() const
1046{ 1045{
1047 return mList->getStringUUIDSelectedItem(); 1046 return mList->getStringUUIDSelectedItem();
1048} 1047}
1049BOOL LLComboBox::setSelectedByValue(LLSD value, BOOL selected) 1048BOOL LLComboBox::setSelectedByValue(const LLSD& value, BOOL selected)
1050{ 1049{
1051 BOOL found = mList->setSelectedByValue(value, selected); 1050 BOOL found = mList->setSelectedByValue(value, selected);
1052 if (found) 1051 if (found)
@@ -1061,7 +1060,7 @@ LLSD LLComboBox::getSelectedValue()
1061 return mList->getSelectedValue(); 1060 return mList->getSelectedValue();
1062} 1061}
1063 1062
1064BOOL LLComboBox::isSelected(LLSD value) 1063BOOL LLComboBox::isSelected(const LLSD& value) const
1065{ 1064{
1066 return mList->isSelected(value); 1065 return mList->isSelected(value);
1067} 1066}
@@ -1199,14 +1198,14 @@ void LLFlyoutButton::updateLayout()
1199{ 1198{
1200 LLComboBox::updateLayout(); 1199 LLComboBox::updateLayout();
1201 1200
1202 mButton->setOrigin(mRect.getWidth() - FLYOUT_BUTTON_ARROW_WIDTH, 0); 1201 mButton->setOrigin(getRect().getWidth() - FLYOUT_BUTTON_ARROW_WIDTH, 0);
1203 mButton->reshape(FLYOUT_BUTTON_ARROW_WIDTH, mRect.getHeight()); 1202 mButton->reshape(FLYOUT_BUTTON_ARROW_WIDTH, getRect().getHeight());
1204 mButton->setFollows(FOLLOWS_RIGHT | FOLLOWS_TOP | FOLLOWS_BOTTOM); 1203 mButton->setFollows(FOLLOWS_RIGHT | FOLLOWS_TOP | FOLLOWS_BOTTOM);
1205 mButton->setTabStop(FALSE); 1204 mButton->setTabStop(FALSE);
1206 mButton->setImageOverlay(mListPosition == BELOW ? "down_arrow.tga" : "up_arrow.tga", LLFontGL::RIGHT); 1205 mButton->setImageOverlay(mListPosition == BELOW ? "down_arrow.tga" : "up_arrow.tga", LLFontGL::RIGHT);
1207 1206
1208 mActionButton->setOrigin(0, 0); 1207 mActionButton->setOrigin(0, 0);
1209 mActionButton->reshape(mRect.getWidth() - FLYOUT_BUTTON_ARROW_WIDTH, mRect.getHeight()); 1208 mActionButton->reshape(getRect().getWidth() - FLYOUT_BUTTON_ARROW_WIDTH, getRect().getHeight());
1210} 1209}
1211 1210
1212//static 1211//static
diff --git a/linden/indra/llui/llcombobox.h b/linden/indra/llui/llcombobox.h
index db1c251..f9ca4d2 100644
--- a/linden/indra/llui/llcombobox.h
+++ b/linden/indra/llui/llcombobox.h
@@ -159,10 +159,10 @@ public:
159 virtual BOOL selectItemRange( S32 first, S32 last ); 159 virtual BOOL selectItemRange( S32 first, S32 last );
160 virtual S32 getFirstSelectedIndex() const { return getCurrentIndex(); } 160 virtual S32 getFirstSelectedIndex() const { return getCurrentIndex(); }
161 virtual BOOL setCurrentByID( const LLUUID& id ); 161 virtual BOOL setCurrentByID( const LLUUID& id );
162 virtual LLUUID getCurrentID(); // LLUUID::null if no items in menu 162 virtual LLUUID getCurrentID() const; // LLUUID::null if no items in menu
163 virtual BOOL setSelectedByValue(LLSD value, BOOL selected); 163 virtual BOOL setSelectedByValue(const LLSD& value, BOOL selected);
164 virtual LLSD getSelectedValue(); 164 virtual LLSD getSelectedValue();
165 virtual BOOL isSelected(LLSD value); 165 virtual BOOL isSelected(const LLSD& value) const;
166 virtual BOOL operateOnSelection(EOperation op); 166 virtual BOOL operateOnSelection(EOperation op);
167 virtual BOOL operateOnAll(EOperation op); 167 virtual BOOL operateOnAll(EOperation op);
168 168
@@ -183,18 +183,20 @@ public:
183 void updateSelection(); 183 void updateSelection();
184 virtual void showList(); 184 virtual void showList();
185 virtual void hideList(); 185 virtual void hideList();
186 186
187protected: 187protected:
188 LLButton* mButton; 188 LLButton* mButton;
189 LLScrollListCtrl* mList; 189 LLScrollListCtrl* mList;
190 S32 mButtonPadding;
191 LLViewBorder* mBorder; 190 LLViewBorder* mBorder;
191 EPreferredPosition mListPosition;
192 LLPointer<LLImageGL> mArrowImage;
193
194private:
195 S32 mButtonPadding;
192 LLLineEditor* mTextEntry; 196 LLLineEditor* mTextEntry;
193 LLPointer<LLImageGL> mArrowImage;
194 BOOL mAllowTextEntry; 197 BOOL mAllowTextEntry;
195 S32 mMaxChars; 198 S32 mMaxChars;
196 BOOL mTextEntryTentative; 199 BOOL mTextEntryTentative;
197 EPreferredPosition mListPosition;
198 void (*mPrearrangeCallback)(LLUICtrl*,void*); 200 void (*mPrearrangeCallback)(LLUICtrl*,void*);
199 void (*mTextEntryCallback)(LLLineEditor*, void*); 201 void (*mTextEntryCallback)(LLLineEditor*, void*);
200}; 202};
diff --git a/linden/indra/llui/llctrlselectioninterface.h b/linden/indra/llui/llctrlselectioninterface.h
index b4d3fc0..f303861 100644
--- a/linden/indra/llui/llctrlselectioninterface.h
+++ b/linden/indra/llui/llctrlselectioninterface.h
@@ -64,14 +64,14 @@ public:
64 64
65 // TomY TODO: Simply cast the UUIDs to LLSDs, using the selectByValue function 65 // TomY TODO: Simply cast the UUIDs to LLSDs, using the selectByValue function
66 virtual BOOL setCurrentByID( const LLUUID& id ) = 0; 66 virtual BOOL setCurrentByID( const LLUUID& id ) = 0;
67 virtual LLUUID getCurrentID() = 0; 67 virtual LLUUID getCurrentID() const = 0;
68 68
69 BOOL selectByValue(LLSD value); 69 BOOL selectByValue(const LLSD value);
70 BOOL deselectByValue(LLSD value); 70 BOOL deselectByValue(const LLSD value);
71 virtual BOOL setSelectedByValue(LLSD value, BOOL selected) = 0; 71 virtual BOOL setSelectedByValue(const LLSD& value, BOOL selected) = 0;
72 virtual LLSD getSelectedValue() = 0; 72 virtual LLSD getSelectedValue() = 0;
73 73
74 virtual BOOL isSelected(LLSD value) = 0; 74 virtual BOOL isSelected(const LLSD& value) const = 0;
75 75
76 virtual BOOL operateOnSelection(EOperation op) = 0; 76 virtual BOOL operateOnSelection(EOperation op) = 0;
77 virtual BOOL operateOnAll(EOperation op) = 0; 77 virtual BOOL operateOnAll(EOperation op) = 0;
@@ -101,7 +101,7 @@ class LLCtrlScrollInterface
101public: 101public:
102 virtual ~LLCtrlScrollInterface(); 102 virtual ~LLCtrlScrollInterface();
103 103
104 virtual S32 getScrollPos() = 0; 104 virtual S32 getScrollPos() const = 0;
105 virtual void setScrollPos( S32 pos ) = 0; 105 virtual void setScrollPos( S32 pos ) = 0;
106 virtual void scrollToShowSelected() = 0; 106 virtual void scrollToShowSelected() = 0;
107}; 107};
diff --git a/linden/indra/llui/lldraghandle.cpp b/linden/indra/llui/lldraghandle.cpp
index 032cb91..516afc6 100644
--- a/linden/indra/llui/lldraghandle.cpp
+++ b/linden/indra/llui/lldraghandle.cpp
@@ -74,7 +74,24 @@ LLDragHandle::LLDragHandle( const LLString& name, const LLRect& rect, const LLSt
74 74
75void LLDragHandle::setTitleVisible(BOOL visible) 75void LLDragHandle::setTitleVisible(BOOL visible)
76{ 76{
77 mTitleBox->setVisible(visible); 77 if(mTitleBox)
78 {
79 mTitleBox->setVisible(visible);
80 }
81}
82
83void LLDragHandle::setTitleBox(LLTextBox* titlebox)
84{
85 if( mTitleBox )
86 {
87 removeChild(mTitleBox);
88 delete mTitleBox;
89 }
90 mTitleBox = titlebox;
91 if(mTitleBox)
92 {
93 addChild( mTitleBox );
94 }
78} 95}
79 96
80LLDragHandleTop::LLDragHandleTop(const LLString& name, const LLRect &rect, const LLString& title) 97LLDragHandleTop::LLDragHandleTop(const LLString& name, const LLRect &rect, const LLString& title)
@@ -113,46 +130,28 @@ LLString LLDragHandleLeft::getWidgetTag() const
113 130
114void LLDragHandleTop::setTitle(const LLString& title) 131void LLDragHandleTop::setTitle(const LLString& title)
115{ 132{
116 if( mTitleBox )
117 {
118 removeChild(mTitleBox);
119 delete mTitleBox;
120 }
121
122 LLString trimmed_title = title; 133 LLString trimmed_title = title;
123 LLString::trim(trimmed_title); 134 LLString::trim(trimmed_title);
124 135
125 const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF ); 136 const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF );
126 mTitleBox = new LLTextBox( "Drag Handle Title", mRect, trimmed_title, font ); 137 LLTextBox* titlebox = new LLTextBox( "Drag Handle Title", getRect(), trimmed_title, font );
127 mTitleBox->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT | FOLLOWS_RIGHT); 138 titlebox->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT | FOLLOWS_RIGHT);
128 mTitleBox->setFontStyle(LLFontGL::DROP_SHADOW_SOFT); 139 titlebox->setFontStyle(LLFontGL::DROP_SHADOW_SOFT);
129 reshapeTitleBox();
130 140
131 // allow empty titles, as default behavior replaces them with title box name 141 setTitleBox(titlebox);
132 if (trimmed_title.empty()) 142 reshapeTitleBox();
133 {
134 mTitleBox->setText(LLString::null);
135 }
136 addChild( mTitleBox );
137} 143}
138 144
139 145
140const LLString& LLDragHandleTop::getTitle() const 146const LLString& LLDragHandleTop::getTitle() const
141{ 147{
142 return mTitleBox->getText(); 148 return getTitleBox() == NULL ? LLString::null : getTitleBox()->getText();
143} 149}
144 150
145 151
146void LLDragHandleLeft::setTitle(const LLString& ) 152void LLDragHandleLeft::setTitle(const LLString& )
147{ 153{
148 if( mTitleBox ) 154 setTitleBox(NULL);
149 {
150 removeChild(mTitleBox);
151 delete mTitleBox;
152 }
153
154 mTitleBox = NULL;
155
156 /* no title on left edge */ 155 /* no title on left edge */
157} 156}
158 157
@@ -166,14 +165,14 @@ const LLString& LLDragHandleLeft::getTitle() const
166void LLDragHandleTop::draw() 165void LLDragHandleTop::draw()
167{ 166{
168 /* Disable lines. Can drag anywhere in most windows. JC 167 /* Disable lines. Can drag anywhere in most windows. JC
169 if( getVisible() && mEnabled && mForeground) 168 if( getVisible() && getEnabled() && mForeground)
170 { 169 {
171 const S32 BORDER_PAD = 2; 170 const S32 BORDER_PAD = 2;
172 const S32 HPAD = 2; 171 const S32 HPAD = 2;
173 const S32 VPAD = 2; 172 const S32 VPAD = 2;
174 S32 left = BORDER_PAD + HPAD; 173 S32 left = BORDER_PAD + HPAD;
175 S32 top = mRect.getHeight() - 2 * VPAD; 174 S32 top = getRect().getHeight() - 2 * VPAD;
176 S32 right = mRect.getWidth() - HPAD; 175 S32 right = getRect().getWidth() - HPAD;
177// S32 bottom = VPAD; 176// S32 bottom = VPAD;
178 177
179 // draw lines for drag areas 178 // draw lines for drag areas
@@ -183,7 +182,7 @@ void LLDragHandleTop::draw()
183 182
184 LLRect title_rect = mTitleBox->getRect(); 183 LLRect title_rect = mTitleBox->getRect();
185 S32 title_right = title_rect.mLeft + mTitleWidth; 184 S32 title_right = title_rect.mLeft + mTitleWidth;
186 BOOL show_right_side = title_right < mRect.getWidth(); 185 BOOL show_right_side = title_right < getRect().getWidth();
187 186
188 for( S32 i=0; i<4; i++ ) 187 for( S32 i=0; i<4; i++ )
189 { 188 {
@@ -204,9 +203,9 @@ void LLDragHandleTop::draw()
204 */ 203 */
205 204
206 // Colorize the text to match the frontmost state 205 // Colorize the text to match the frontmost state
207 if (mTitleBox) 206 if (getTitleBox())
208 { 207 {
209 mTitleBox->setEnabled(mForeground); 208 getTitleBox()->setEnabled(getForeground());
210 } 209 }
211 210
212 LLView::draw(); 211 LLView::draw();
@@ -217,7 +216,7 @@ void LLDragHandleTop::draw()
217void LLDragHandleLeft::draw() 216void LLDragHandleLeft::draw()
218{ 217{
219 /* Disable lines. Can drag anywhere in most windows. JC 218 /* Disable lines. Can drag anywhere in most windows. JC
220 if( getVisible() && mEnabled && mForeground ) 219 if( getVisible() && getEnabled() && mForeground )
221 { 220 {
222 const S32 BORDER_PAD = 2; 221 const S32 BORDER_PAD = 2;
223// const S32 HPAD = 2; 222// const S32 HPAD = 2;
@@ -225,8 +224,8 @@ void LLDragHandleLeft::draw()
225 const S32 LINE_SPACING = 3; 224 const S32 LINE_SPACING = 3;
226 225
227 S32 left = BORDER_PAD + LINE_SPACING; 226 S32 left = BORDER_PAD + LINE_SPACING;
228 S32 top = mRect.getHeight() - 2 * VPAD; 227 S32 top = getRect().getHeight() - 2 * VPAD;
229// S32 right = mRect.getWidth() - HPAD; 228// S32 right = getRect().getWidth() - HPAD;
230 S32 bottom = VPAD; 229 S32 bottom = VPAD;
231 230
232 // draw lines for drag areas 231 // draw lines for drag areas
@@ -234,7 +233,7 @@ void LLDragHandleLeft::draw()
234 // no titles yet 233 // no titles yet
235 //LLRect title_rect = mTitleBox->getRect(); 234 //LLRect title_rect = mTitleBox->getRect();
236 //S32 title_right = title_rect.mLeft + mTitleWidth; 235 //S32 title_right = title_rect.mLeft + mTitleWidth;
237 //BOOL show_right_side = title_right < mRect.getWidth(); 236 //BOOL show_right_side = title_right < getRect().getWidth();
238 237
239 S32 line = left; 238 S32 line = left;
240 for( S32 i=0; i<4; i++ ) 239 for( S32 i=0; i<4; i++ )
@@ -249,9 +248,9 @@ void LLDragHandleLeft::draw()
249 */ 248 */
250 249
251 // Colorize the text to match the frontmost state 250 // Colorize the text to match the frontmost state
252 if (mTitleBox) 251 if (getTitleBox())
253 { 252 {
254 mTitleBox->setEnabled(mForeground); 253 getTitleBox()->setEnabled(getForeground());
255 } 254 }
256 255
257 LLView::draw(); 256 LLView::draw();
@@ -259,19 +258,23 @@ void LLDragHandleLeft::draw()
259 258
260void LLDragHandleTop::reshapeTitleBox() 259void LLDragHandleTop::reshapeTitleBox()
261{ 260{
261 if( ! getTitleBox())
262 {
263 return;
264 }
262 const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF ); 265 const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF );
263 S32 title_width = font->getWidth( mTitleBox->getText() ) + TITLE_PAD; 266 S32 title_width = font->getWidth( getTitleBox()->getText() ) + TITLE_PAD;
264 if (mMaxTitleWidth > 0) 267 if (getMaxTitleWidth() > 0)
265 title_width = llmin(title_width, mMaxTitleWidth); 268 title_width = llmin(title_width, getMaxTitleWidth());
266 S32 title_height = llround(font->getLineHeight()); 269 S32 title_height = llround(font->getLineHeight());
267 LLRect title_rect; 270 LLRect title_rect;
268 title_rect.setLeftTopAndSize( 271 title_rect.setLeftTopAndSize(
269 LEFT_PAD, 272 LEFT_PAD,
270 mRect.getHeight() - BORDER_PAD, 273 getRect().getHeight() - BORDER_PAD,
271 mRect.getWidth() - LEFT_PAD - RIGHT_PAD, 274 getRect().getWidth() - LEFT_PAD - RIGHT_PAD,
272 title_height); 275 title_height);
273 276
274 mTitleBox->setRect( title_rect ); 277 getTitleBox()->setRect( title_rect );
275} 278}
276 279
277void LLDragHandleTop::reshape(S32 width, S32 height, BOOL called_from_parent) 280void LLDragHandleTop::reshape(S32 width, S32 height, BOOL called_from_parent)
diff --git a/linden/indra/llui/lldraghandle.h b/linden/indra/llui/lldraghandle.h
index a48c0f7..cb9924d 100644
--- a/linden/indra/llui/lldraghandle.h
+++ b/linden/indra/llui/lldraghandle.h
@@ -45,11 +45,14 @@ class LLDragHandle : public LLView
45{ 45{
46public: 46public:
47 LLDragHandle(const LLString& name, const LLRect& rect, const LLString& title ); 47 LLDragHandle(const LLString& name, const LLRect& rect, const LLString& title );
48 virtual ~LLDragHandle() { setTitleBox(NULL); }
48 49
49 virtual void setValue(const LLSD& value); 50 virtual void setValue(const LLSD& value);
50 51
51 void setForeground(BOOL b) { mForeground = b; } 52 void setForeground(BOOL b) { mForeground = b; }
53 BOOL getForeground() const { return mForeground; }
52 void setMaxTitleWidth(S32 max_width) {mMaxTitleWidth = llmin(max_width, mMaxTitleWidth); } 54 void setMaxTitleWidth(S32 max_width) {mMaxTitleWidth = llmin(max_width, mMaxTitleWidth); }
55 S32 getMaxTitleWidth() const { return mMaxTitleWidth; }
53 void setTitleVisible(BOOL visible); 56 void setTitleVisible(BOOL visible);
54 57
55 virtual void setTitle( const LLString& title ) = 0; 58 virtual void setTitle( const LLString& title ) = 0;
@@ -61,6 +64,10 @@ public:
61 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); 64 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
62 65
63protected: 66protected:
67 LLTextBox* getTitleBox() const { return mTitleBox; }
68 void setTitleBox(LLTextBox*);
69
70private:
64 S32 mDragLastScreenX; 71 S32 mDragLastScreenX;
65 S32 mDragLastScreenY; 72 S32 mDragLastScreenY;
66 S32 mLastMouseScreenX; 73 S32 mLastMouseScreenX;
diff --git a/linden/indra/llui/lleditmenuhandler.cpp b/linden/indra/llui/lleditmenuhandler.cpp
index 6291088..2f29f71 100644
--- a/linden/indra/llui/lleditmenuhandler.cpp
+++ b/linden/indra/llui/lleditmenuhandler.cpp
@@ -33,98 +33,6 @@
33 33
34#include "lleditmenuhandler.h" 34#include "lleditmenuhandler.h"
35 35
36LLEditMenuHandler* gEditMenuHandler = NULL; 36/* static */
37LLEditMenuHandler* LLEditMenuHandler::gEditMenuHandler = NULL;
37 38
38// virtual
39LLEditMenuHandler::~LLEditMenuHandler()
40{ }
41
42// virtual
43void LLEditMenuHandler::undo()
44{ }
45
46// virtual
47BOOL LLEditMenuHandler::canUndo()
48{
49 return FALSE;
50}
51
52// virtual
53void LLEditMenuHandler::redo()
54{ }
55
56// virtual
57BOOL LLEditMenuHandler::canRedo()
58{
59 return FALSE;
60}
61
62// virtual
63void LLEditMenuHandler::cut()
64{ }
65
66// virtual
67BOOL LLEditMenuHandler::canCut()
68{
69 return FALSE;
70}
71
72// virtual
73void LLEditMenuHandler::copy()
74{ }
75
76// virtual
77BOOL LLEditMenuHandler::canCopy()
78{
79 return FALSE;
80}
81
82// virtual
83void LLEditMenuHandler::paste()
84{ }
85
86// virtual
87BOOL LLEditMenuHandler::canPaste()
88{
89 return FALSE;
90}
91
92// virtual
93void LLEditMenuHandler::doDelete()
94{ }
95
96// virtual
97BOOL LLEditMenuHandler::canDoDelete()
98{
99 return FALSE;
100}
101
102// virtual
103void LLEditMenuHandler::selectAll()
104{ }
105
106// virtual
107BOOL LLEditMenuHandler::canSelectAll()
108{
109 return FALSE;
110}
111
112// virtual
113void LLEditMenuHandler::deselect()
114{ }
115
116// virtual
117BOOL LLEditMenuHandler::canDeselect()
118{
119 return FALSE;
120}
121
122// virtual
123void LLEditMenuHandler::duplicate()
124{ }
125
126// virtual
127BOOL LLEditMenuHandler::canDuplicate()
128{
129 return FALSE;
130}
diff --git a/linden/indra/llui/lleditmenuhandler.h b/linden/indra/llui/lleditmenuhandler.h
index ef9b1dd..82bb058 100644
--- a/linden/indra/llui/lleditmenuhandler.h
+++ b/linden/indra/llui/lleditmenuhandler.h
@@ -37,37 +37,43 @@ class LLEditMenuHandler
37{ 37{
38public: 38public:
39 // this is needed even though this is just an interface class. 39 // this is needed even though this is just an interface class.
40 virtual ~LLEditMenuHandler(); 40 virtual ~LLEditMenuHandler() {};
41 41
42 virtual void undo(); 42 virtual void undo() {};
43 virtual BOOL canUndo(); 43 virtual BOOL canUndo() const { return FALSE; }
44 44
45 virtual void redo(); 45 virtual void redo() {};
46 virtual BOOL canRedo(); 46 virtual BOOL canRedo() const { return FALSE; }
47 47
48 virtual void cut(); 48 virtual void cut() {};
49 virtual BOOL canCut(); 49 virtual BOOL canCut() const { return FALSE; }
50 50
51 virtual void copy(); 51 virtual void copy() {};
52 virtual BOOL canCopy(); 52 virtual BOOL canCopy() const { return FALSE; }
53 53
54 virtual void paste(); 54 virtual void paste() {};
55 virtual BOOL canPaste(); 55 virtual BOOL canPaste() const { return FALSE; }
56 56
57 // "delete" is a keyword 57 // "delete" is a keyword
58 virtual void doDelete(); 58 virtual void doDelete() {};
59 virtual BOOL canDoDelete(); 59 virtual BOOL canDoDelete() const { return FALSE; }
60 60
61 virtual void selectAll(); 61 virtual void selectAll() {};
62 virtual BOOL canSelectAll(); 62 virtual BOOL canSelectAll() const { return FALSE; }
63 63
64 virtual void deselect(); 64 virtual void deselect() {};
65 virtual BOOL canDeselect(); 65 virtual BOOL canDeselect() const { return FALSE; }
66 66
67 virtual void duplicate(); 67 virtual void duplicate() {};
68 virtual BOOL canDuplicate(); 68 virtual BOOL canDuplicate() const { return FALSE; }
69
70 // TODO: Instead of being a public data member, it would be better to hide it altogether
71 // and have a "set" method and then a bunch of static versions of the cut, copy, paste
72 // methods, etc that operate on the current global instance. That would drastically
73 // simplify the existing code that accesses this global variable by putting all the
74 // null checks in the one implementation of those static methods. -MG
75 static LLEditMenuHandler* gEditMenuHandler;
69}; 76};
70 77
71extern LLEditMenuHandler* gEditMenuHandler;
72 78
73#endif 79#endif
diff --git a/linden/indra/llui/llfloater.cpp b/linden/indra/llui/llfloater.cpp
index 6d86652..493e68f 100644
--- a/linden/indra/llui/llfloater.cpp
+++ b/linden/indra/llui/llfloater.cpp
@@ -142,20 +142,18 @@ LLFloater::LLFloater() :
142 mButtons[i] = NULL; 142 mButtons[i] = NULL;
143 } 143 }
144 mDragHandle = NULL; 144 mDragHandle = NULL;
145 mHandle.bind(this);
145} 146}
146 147
147LLFloater::LLFloater(const LLString& name) 148LLFloater::LLFloater(const LLString& name)
148: LLPanel(name) 149: LLPanel(name), mAutoFocus(TRUE) // automatically take focus when opened
149{ 150{
150 for (S32 i = 0; i < BUTTON_COUNT; i++) 151 for (S32 i = 0; i < BUTTON_COUNT; i++)
151 { 152 {
152 mButtonsEnabled[i] = FALSE; 153 mButtonsEnabled[i] = FALSE;
153 mButtons[i] = NULL; 154 mButtons[i] = NULL;
154 } 155 }
155
156 LLString title; // null string 156 LLString title; // null string
157 // automatically take focus when opened
158 mAutoFocus = TRUE;
159 init(title, FALSE, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, TRUE, TRUE); // defaults 157 init(title, FALSE, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, TRUE, TRUE); // defaults
160} 158}
161 159
@@ -168,15 +166,13 @@ LLFloater::LLFloater(const LLString& name, const LLRect& rect, const LLString& t
168 BOOL minimizable, 166 BOOL minimizable,
169 BOOL close_btn, 167 BOOL close_btn,
170 BOOL bordered) 168 BOOL bordered)
171: LLPanel(name, rect, bordered) 169: LLPanel(name, rect, bordered), mAutoFocus(TRUE) // automatically take focus when opened
172{ 170{
173 for (S32 i = 0; i < BUTTON_COUNT; i++) 171 for (S32 i = 0; i < BUTTON_COUNT; i++)
174 { 172 {
175 mButtonsEnabled[i] = FALSE; 173 mButtonsEnabled[i] = FALSE;
176 mButtons[i] = NULL; 174 mButtons[i] = NULL;
177 } 175 }
178 // automatically take focus when opened
179 mAutoFocus = TRUE;
180 init( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn); 176 init( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn);
181} 177}
182 178
@@ -188,15 +184,13 @@ LLFloater::LLFloater(const LLString& name, const LLString& rect_control, const L
188 BOOL minimizable, 184 BOOL minimizable,
189 BOOL close_btn, 185 BOOL close_btn,
190 BOOL bordered) 186 BOOL bordered)
191: LLPanel(name, rect_control, bordered) 187: LLPanel(name, rect_control, bordered), mAutoFocus(TRUE) // automatically take focus when opened
192{ 188{
193 for (S32 i = 0; i < BUTTON_COUNT; i++) 189 for (S32 i = 0; i < BUTTON_COUNT; i++)
194 { 190 {
195 mButtonsEnabled[i] = FALSE; 191 mButtonsEnabled[i] = FALSE;
196 mButtons[i] = NULL; 192 mButtons[i] = NULL;
197 } 193 }
198 // automatically take focus when opened
199 mAutoFocus = TRUE;
200 init( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn); 194 init( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn);
201} 195}
202 196
@@ -206,6 +200,8 @@ void LLFloater::init(const LLString& title,
206 BOOL resizable, S32 min_width, S32 min_height, 200 BOOL resizable, S32 min_width, S32 min_height,
207 BOOL drag_on_left, BOOL minimizable, BOOL close_btn) 201 BOOL drag_on_left, BOOL minimizable, BOOL close_btn)
208{ 202{
203 mHandle.bind(this);
204
209 // Init function can be called more than once, so clear out old data. 205 // Init function can be called more than once, so clear out old data.
210 for (S32 i = 0; i < BUTTON_COUNT; i++) 206 for (S32 i = 0; i < BUTTON_COUNT; i++)
211 { 207 {
@@ -219,20 +215,20 @@ void LLFloater::init(const LLString& title,
219 } 215 }
220 mButtonScale = 1.f; 216 mButtonScale = 1.f;
221 217
222 BOOL need_border = mBorder != NULL; 218 //sjb: Thia is a bit of a hack:
223 219 BOOL need_border = hasBorder();
220 // remove the border since deleteAllChildren() will also delete the border (but not clear mBorder)
221 removeBorder();
224 // this will delete mBorder too 222 // this will delete mBorder too
225 deleteAllChildren(); 223 deleteAllChildren();
226 // make sure we don't have a pointer to an old, deleted border 224 // add the border back if we want it
227 mBorder = NULL;
228 //sjb: HACK! we had a border which was just deleted, so re-create it
229 if (need_border) 225 if (need_border)
230 { 226 {
231 addBorder(); 227 addBorder();
232 } 228 }
233 229
234 // chrome floaters don't take focus at all 230 // chrome floaters don't take focus at all
235 mIsFocusRoot = !getIsChrome(); 231 setFocusRoot(!getIsChrome());
236 232
237 // Reset cached pointers 233 // Reset cached pointers
238 mDragHandle = NULL; 234 mDragHandle = NULL;
@@ -257,7 +253,7 @@ void LLFloater::init(const LLString& title,
257 // Floaters start not minimized. When minimized, they save their 253 // Floaters start not minimized. When minimized, they save their
258 // prior rectangle to be used on restore. 254 // prior rectangle to be used on restore.
259 mMinimized = FALSE; 255 mMinimized = FALSE;
260 mPreviousRect.set(0,0,0,0); 256 mExpandedRect.set(0,0,0,0);
261 257
262 S32 close_pad; // space to the right of close box 258 S32 close_pad; // space to the right of close box
263 S32 close_box_size; // For layout purposes, how big is the close box? 259 S32 close_box_size; // For layout purposes, how big is the close box?
@@ -288,31 +284,20 @@ void LLFloater::init(const LLString& title,
288 // Drag Handle 284 // Drag Handle
289 // Add first so it's in the background. 285 // Add first so it's in the background.
290// const S32 drag_pad = 2; 286// const S32 drag_pad = 2;
291 LLRect drag_handle_rect; 287 if (drag_on_left)
292 if (!drag_on_left)
293 {
294 drag_handle_rect.set( 0, mRect.getHeight(), mRect.getWidth(), 0 );
295
296 /*
297 drag_handle_rect.setLeftTopAndSize(
298 0, mRect.getHeight(),
299 mRect.getWidth()
300 - LLPANEL_BORDER_WIDTH
301 - drag_pad
302 - minimize_box_size - minimize_pad
303 - close_box_size - close_pad,
304 DRAG_HANDLE_HEIGHT);
305 */
306 mDragHandle = new LLDragHandleTop( "Drag Handle", drag_handle_rect, title );
307 }
308 else
309 { 288 {
289 LLRect drag_handle_rect;
310 drag_handle_rect.setOriginAndSize( 290 drag_handle_rect.setOriginAndSize(
311 0, 0, 291 0, 0,
312 DRAG_HANDLE_WIDTH, 292 DRAG_HANDLE_WIDTH,
313 mRect.getHeight() - LLPANEL_BORDER_WIDTH - close_box_size); 293 getRect().getHeight() - LLPANEL_BORDER_WIDTH - close_box_size);
314 mDragHandle = new LLDragHandleLeft("drag", drag_handle_rect, title ); 294 mDragHandle = new LLDragHandleLeft("drag", drag_handle_rect, title );
315 } 295 }
296 else // drag on top
297 {
298 LLRect drag_handle_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 );
299 mDragHandle = new LLDragHandleTop( "Drag Handle", drag_handle_rect, title );
300 }
316 addChild(mDragHandle); 301 addChild(mDragHandle);
317 302
318 // Resize Handle 303 // Resize Handle
@@ -327,28 +312,28 @@ void LLFloater::init(const LLString& title,
327 mResizeBar[LLResizeBar::LEFT] = new LLResizeBar( 312 mResizeBar[LLResizeBar::LEFT] = new LLResizeBar(
328 "resizebar_left", 313 "resizebar_left",
329 this, 314 this,
330 LLRect( 0, mRect.getHeight(), RESIZE_BAR_THICKNESS, 0), 315 LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0),
331 min_width, S32_MAX, LLResizeBar::LEFT ); 316 min_width, S32_MAX, LLResizeBar::LEFT );
332 addChild( mResizeBar[0] ); 317 addChild( mResizeBar[0] );
333 318
334 mResizeBar[LLResizeBar::TOP] = new LLResizeBar( 319 mResizeBar[LLResizeBar::TOP] = new LLResizeBar(
335 "resizebar_top", 320 "resizebar_top",
336 this, 321 this,
337 LLRect( 0, mRect.getHeight(), mRect.getWidth(), mRect.getHeight() - RESIZE_BAR_THICKNESS), 322 LLRect( 0, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_BAR_THICKNESS),
338 min_height, S32_MAX, LLResizeBar::TOP ); 323 min_height, S32_MAX, LLResizeBar::TOP );
339 addChild( mResizeBar[1] ); 324 addChild( mResizeBar[1] );
340 325
341 mResizeBar[LLResizeBar::RIGHT] = new LLResizeBar( 326 mResizeBar[LLResizeBar::RIGHT] = new LLResizeBar(
342 "resizebar_right", 327 "resizebar_right",
343 this, 328 this,
344 LLRect( mRect.getWidth() - RESIZE_BAR_THICKNESS, mRect.getHeight(), mRect.getWidth(), 0), 329 LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0),
345 min_width, S32_MAX, LLResizeBar::RIGHT ); 330 min_width, S32_MAX, LLResizeBar::RIGHT );
346 addChild( mResizeBar[2] ); 331 addChild( mResizeBar[2] );
347 332
348 mResizeBar[LLResizeBar::BOTTOM] = new LLResizeBar( 333 mResizeBar[LLResizeBar::BOTTOM] = new LLResizeBar(
349 "resizebar_bottom", 334 "resizebar_bottom",
350 this, 335 this,
351 LLRect( 0, RESIZE_BAR_THICKNESS, mRect.getWidth(), 0), 336 LLRect( 0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0),
352 min_height, S32_MAX, LLResizeBar::BOTTOM ); 337 min_height, S32_MAX, LLResizeBar::BOTTOM );
353 addChild( mResizeBar[3] ); 338 addChild( mResizeBar[3] );
354 339
@@ -356,14 +341,14 @@ void LLFloater::init(const LLString& title,
356 // Resize handles (corners) 341 // Resize handles (corners)
357 mResizeHandle[0] = new LLResizeHandle( 342 mResizeHandle[0] = new LLResizeHandle(
358 "Resize Handle", 343 "Resize Handle",
359 LLRect( mRect.getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, mRect.getWidth(), 0), 344 LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0),
360 min_width, 345 min_width,
361 min_height, 346 min_height,
362 LLResizeHandle::RIGHT_BOTTOM); 347 LLResizeHandle::RIGHT_BOTTOM);
363 addChild(mResizeHandle[0]); 348 addChild(mResizeHandle[0]);
364 349
365 mResizeHandle[1] = new LLResizeHandle( "resize", 350 mResizeHandle[1] = new LLResizeHandle( "resize",
366 LLRect( mRect.getWidth() - RESIZE_HANDLE_WIDTH, mRect.getHeight(), mRect.getWidth(), mRect.getHeight() - RESIZE_HANDLE_HEIGHT), 351 LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_HANDLE_HEIGHT),
367 min_width, 352 min_width,
368 min_height, 353 min_height,
369 LLResizeHandle::RIGHT_TOP ); 354 LLResizeHandle::RIGHT_TOP );
@@ -377,7 +362,7 @@ void LLFloater::init(const LLString& title,
377 addChild(mResizeHandle[2]); 362 addChild(mResizeHandle[2]);
378 363
379 mResizeHandle[3] = new LLResizeHandle( "resize", 364 mResizeHandle[3] = new LLResizeHandle( "resize",
380 LLRect( 0, mRect.getHeight(), RESIZE_HANDLE_WIDTH, mRect.getHeight() - RESIZE_HANDLE_HEIGHT ), 365 LLRect( 0, getRect().getHeight(), RESIZE_HANDLE_WIDTH, getRect().getHeight() - RESIZE_HANDLE_HEIGHT ),
381 min_width, 366 min_width,
382 min_height, 367 min_height,
383 LLResizeHandle::LEFT_TOP ); 368 LLResizeHandle::LEFT_TOP );
@@ -413,7 +398,7 @@ void LLFloater::init(const LLString& title,
413 setVisible(FALSE); 398 setVisible(FALSE);
414 399
415 // add self to handle->floater map 400 // add self to handle->floater map
416 sFloaterMap[mViewHandle] = this; 401 sFloaterMap[mHandle] = this;
417 402
418 if (!getParent()) 403 if (!getParent())
419 { 404 {
@@ -450,7 +435,7 @@ LLFloater::~LLFloater()
450 // correct, non-minimized positions. 435 // correct, non-minimized positions.
451 setMinimized( FALSE ); 436 setMinimized( FALSE );
452 437
453 sFloaterMap.erase(mViewHandle); 438 sFloaterMap.erase(mHandle);
454 439
455 delete mDragHandle; 440 delete mDragHandle;
456 for (S32 i = 0; i < 4; i++) 441 for (S32 i = 0; i < 4; i++)
@@ -460,22 +445,6 @@ LLFloater::~LLFloater()
460 } 445 }
461} 446}
462 447
463// virtual
464EWidgetType LLFloater::getWidgetType() const
465{
466 return WIDGET_TYPE_FLOATER;
467}
468
469// virtual
470LLString LLFloater::getWidgetTag() const
471{
472 return LL_FLOATER_TAG;
473}
474
475void LLFloater::destroy()
476{
477 die();
478}
479 448
480void LLFloater::setVisible( BOOL visible ) 449void LLFloater::setVisible( BOOL visible )
481{ 450{
@@ -501,7 +470,7 @@ void LLFloater::setVisible( BOOL visible )
501 for(handle_set_iter_t dependent_it = mDependents.begin(); 470 for(handle_set_iter_t dependent_it = mDependents.begin();
502 dependent_it != mDependents.end(); ) 471 dependent_it != mDependents.end(); )
503 { 472 {
504 LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it); 473 LLFloater* floaterp = dependent_it->get();
505 474
506 if (floaterp) 475 if (floaterp)
507 { 476 {
@@ -513,10 +482,10 @@ void LLFloater::setVisible( BOOL visible )
513 482
514void LLFloater::open() /* Flawfinder: ignore */ 483void LLFloater::open() /* Flawfinder: ignore */
515{ 484{
516 if (mSoundFlags != SILENT 485 if (getSoundFlags() != SILENT
517 // don't play open sound for hosted (tabbed) windows 486 // don't play open sound for hosted (tabbed) windows
518 && !getHost() 487 && !getHost()
519 && !sHostp 488 && !getFloaterHost()
520 && (!getVisible() || isMinimized())) 489 && (!getVisible() || isMinimized()))
521 { 490 {
522 make_ui_sound("UISndWindowOpen"); 491 make_ui_sound("UISndWindowOpen");
@@ -524,17 +493,16 @@ void LLFloater::open() /* Flawfinder: ignore */
524 493
525 //RN: for now, we don't allow rehosting from one multifloater to another 494 //RN: for now, we don't allow rehosting from one multifloater to another
526 // just need to fix the bugs 495 // just need to fix the bugs
527 LLMultiFloater* hostp = getHost(); 496 if (getFloaterHost() != NULL && getHost() == NULL)
528 if (sHostp != NULL && hostp == NULL)
529 { 497 {
530 // needs a host 498 // needs a host
531 // only select tabs if window they are hosted in is visible 499 // only select tabs if window they are hosted in is visible
532 sHostp->addFloater(this, sHostp->getVisible()); 500 getFloaterHost()->addFloater(this, getFloaterHost()->getVisible());
533 } 501 }
534 else if (hostp != NULL) 502 else if (getHost() != NULL)
535 { 503 {
536 // already hosted 504 // already hosted
537 hostp->showFloater(this); 505 getHost()->showFloater(this);
538 } 506 }
539 else 507 else
540 { 508 {
@@ -558,7 +526,7 @@ void LLFloater::close(bool app_quitting)
558 ((LLMultiFloater*)getHost())->removeFloater(this); 526 ((LLMultiFloater*)getHost())->removeFloater(this);
559 } 527 }
560 528
561 if (mSoundFlags != SILENT 529 if (getSoundFlags() != SILENT
562 && getVisible() 530 && getVisible()
563 && !getHost() 531 && !getHost()
564 && !app_quitting) 532 && !app_quitting)
@@ -571,7 +539,7 @@ void LLFloater::close(bool app_quitting)
571 dependent_it != mDependents.end(); ) 539 dependent_it != mDependents.end(); )
572 { 540 {
573 541
574 LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it); 542 LLFloater* floaterp = dependent_it->get();
575 if (floaterp) 543 if (floaterp)
576 { 544 {
577 ++dependent_it; 545 ++dependent_it;
@@ -595,7 +563,7 @@ void LLFloater::close(bool app_quitting)
595 // give focus to dependee floater if it exists, and we had focus first 563 // give focus to dependee floater if it exists, and we had focus first
596 if (isDependent()) 564 if (isDependent())
597 { 565 {
598 LLFloater* dependee = LLFloater::getFloaterByHandle(mDependeeHandle); 566 LLFloater* dependee = mDependeeHandle.get();
599 if (dependee && !dependee->isDead()) 567 if (dependee && !dependee->isDead())
600 { 568 {
601 dependee->setFocus(TRUE); 569 dependee->setFocus(TRUE);
@@ -661,20 +629,15 @@ void LLFloater::center()
661 // hosted floaters can't move 629 // hosted floaters can't move
662 return; 630 return;
663 } 631 }
664 const LLRect &window = gFloaterView->getRect(); 632 centerWithin(gFloaterView->getRect());
665
666 S32 left = window.mLeft + (window.getWidth() - mRect.getWidth()) / 2;
667 S32 bottom = window.mBottom + (window.getHeight() - mRect.getHeight()) / 2;
668
669 translate( left - mRect.mLeft, bottom - mRect.mBottom );
670} 633}
671 634
672void LLFloater::applyRectControl() 635void LLFloater::applyRectControl()
673{ 636{
674 if (!mRectControl.empty()) 637 if (!getRectControl().empty())
675 { 638 {
676 const LLRect& rect = LLUI::sConfigGroup->getRect(mRectControl); 639 const LLRect& rect = LLUI::sConfigGroup->getRect(getRectControl());
677 translate( rect.mLeft - mRect.mLeft, rect.mBottom - mRect.mBottom); 640 translate( rect.mLeft - getRect().mLeft, rect.mBottom - getRect().mBottom);
678 if (mResizable) 641 if (mResizable)
679 { 642 {
680 reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight())); 643 reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight()));
@@ -715,7 +678,7 @@ LLString LLFloater::getShortTitle()
715 678
716 679
717 680
718BOOL LLFloater::canSnapTo(LLView* other_view) 681BOOL LLFloater::canSnapTo(const LLView* other_view)
719{ 682{
720 if (NULL == other_view) 683 if (NULL == other_view)
721 { 684 {
@@ -727,7 +690,7 @@ BOOL LLFloater::canSnapTo(LLView* other_view)
727 { 690 {
728 LLFloater* other_floaterp = (LLFloater*)other_view; 691 LLFloater* other_floaterp = (LLFloater*)other_view;
729 692
730 if (other_floaterp->getSnapTarget() == mViewHandle && mDependents.find(other_floaterp->getHandle()) != mDependents.end()) 693 if (other_floaterp->getSnapTarget() == getHandle() && mDependents.find(other_floaterp->getHandle()) != mDependents.end())
731 { 694 {
732 // this is a dependent that is already snapped to us, so don't snap back to it 695 // this is a dependent that is already snapped to us, so don't snap back to it
733 return FALSE; 696 return FALSE;
@@ -737,7 +700,7 @@ BOOL LLFloater::canSnapTo(LLView* other_view)
737 return LLPanel::canSnapTo(other_view); 700 return LLPanel::canSnapTo(other_view);
738} 701}
739 702
740void LLFloater::snappedTo(LLView* snap_view) 703void LLFloater::snappedTo(const LLView* snap_view)
741{ 704{
742 if (!snap_view || snap_view == getParent()) 705 if (!snap_view || snap_view == getParent())
743 { 706 {
@@ -754,7 +717,7 @@ void LLFloater::snappedTo(LLView* snap_view)
754 717
755void LLFloater::userSetShape(const LLRect& new_rect) 718void LLFloater::userSetShape(const LLRect& new_rect)
756{ 719{
757 LLRect old_rect = mRect; 720 const LLRect& old_rect = getRect();
758 LLView::userSetShape(new_rect); 721 LLView::userSetShape(new_rect);
759 722
760 // if not minimized, adjust all snapped dependents to new shape 723 // if not minimized, adjust all snapped dependents to new shape
@@ -764,22 +727,22 @@ void LLFloater::userSetShape(const LLRect& new_rect)
764 for(handle_set_iter_t dependent_it = mDependents.begin(); 727 for(handle_set_iter_t dependent_it = mDependents.begin();
765 dependent_it != mDependents.end(); ++dependent_it) 728 dependent_it != mDependents.end(); ++dependent_it)
766 { 729 {
767 LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it); 730 LLFloater* floaterp = dependent_it->get();
768 // is a dependent snapped to us? 731 // is a dependent snapped to us?
769 if (floaterp && floaterp->getSnapTarget() == mViewHandle) 732 if (floaterp && floaterp->getSnapTarget() == getHandle())
770 { 733 {
771 S32 delta_x = 0; 734 S32 delta_x = 0;
772 S32 delta_y = 0; 735 S32 delta_y = 0;
773 // check to see if it snapped to right or top, and move if dependee floater is resizing 736 // check to see if it snapped to right or top, and move if dependee floater is resizing
774 LLRect dependent_rect = floaterp->getRect(); 737 LLRect dependent_rect = floaterp->getRect();
775 if (dependent_rect.mLeft - mRect.mLeft >= old_rect.getWidth() || // dependent on my right? 738 if (dependent_rect.mLeft - getRect().mLeft >= old_rect.getWidth() || // dependent on my right?
776 dependent_rect.mRight == mRect.mLeft + old_rect.getWidth()) // dependent aligned with my right 739 dependent_rect.mRight == getRect().mLeft + old_rect.getWidth()) // dependent aligned with my right
777 { 740 {
778 // was snapped directly onto right side or aligned with it 741 // was snapped directly onto right side or aligned with it
779 delta_x += new_rect.getWidth() - old_rect.getWidth(); 742 delta_x += new_rect.getWidth() - old_rect.getWidth();
780 } 743 }
781 if (dependent_rect.mBottom - mRect.mBottom >= old_rect.getHeight() || 744 if (dependent_rect.mBottom - getRect().mBottom >= old_rect.getHeight() ||
782 dependent_rect.mTop == mRect.mBottom + old_rect.getHeight()) 745 dependent_rect.mTop == getRect().mBottom + old_rect.getHeight())
783 { 746 {
784 // was snapped directly onto top side or aligned with it 747 // was snapped directly onto top side or aligned with it
785 delta_y += new_rect.getHeight() - old_rect.getHeight(); 748 delta_y += new_rect.getHeight() - old_rect.getHeight();
@@ -812,7 +775,7 @@ void LLFloater::setMinimized(BOOL minimize)
812 775
813 if (minimize) 776 if (minimize)
814 { 777 {
815 mPreviousRect = mRect; 778 mExpandedRect = getRect();
816 779
817 reshape( MINIMIZED_WIDTH, LLFLOATER_HEADER_SIZE, TRUE); 780 reshape( MINIMIZED_WIDTH, LLFLOATER_HEADER_SIZE, TRUE);
818 781
@@ -843,7 +806,7 @@ void LLFloater::setMinimized(BOOL minimize)
843 LLView* viewp = *child_it; 806 LLView* viewp = *child_it;
844 if (!viewp->getVisible()) 807 if (!viewp->getVisible())
845 { 808 {
846 mMinimizedHiddenChildren.push_back(viewp->mViewHandle); 809 mMinimizedHiddenChildren.push_back(viewp->getHandle());
847 } 810 }
848 viewp->setVisible(FALSE); 811 viewp->setVisible(FALSE);
849 } 812 }
@@ -860,7 +823,7 @@ void LLFloater::setMinimized(BOOL minimize)
860 dependent_it != mDependents.end(); 823 dependent_it != mDependents.end();
861 ++dependent_it) 824 ++dependent_it)
862 { 825 {
863 LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it); 826 LLFloater* floaterp = dependent_it->get();
864 if (floaterp) 827 if (floaterp)
865 { 828 {
866 if (floaterp->isMinimizeable()) 829 if (floaterp->isMinimizeable())
@@ -890,8 +853,8 @@ void LLFloater::setMinimized(BOOL minimize)
890 mPreviousMinimizedBottom = currentRect.mBottom; 853 mPreviousMinimizedBottom = currentRect.mBottom;
891 } 854 }
892 855
893 reshape( mPreviousRect.getWidth(), mPreviousRect.getHeight(), TRUE ); 856 reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE );
894 setOrigin( mPreviousRect.mLeft, mPreviousRect.mBottom ); 857 setOrigin( mExpandedRect.mLeft, mExpandedRect.mBottom );
895 858
896 if (mButtonsEnabled[BUTTON_RESTORE]) 859 if (mButtonsEnabled[BUTTON_RESTORE])
897 { 860 {
@@ -906,10 +869,10 @@ void LLFloater::setMinimized(BOOL minimize)
906 viewp->setVisible(TRUE); 869 viewp->setVisible(TRUE);
907 } 870 }
908 871
909 std::vector<LLViewHandle>::iterator itor = mMinimizedHiddenChildren.begin(); 872 std::vector<LLHandle<LLView> >::iterator itor = mMinimizedHiddenChildren.begin();
910 for ( ; itor != mMinimizedHiddenChildren.end(); ++itor) 873 for ( ; itor != mMinimizedHiddenChildren.end(); ++itor)
911 { 874 {
912 LLView* viewp = LLView::getViewByHandle(*itor); 875 LLView* viewp = itor->get();
913 if(viewp) 876 if(viewp)
914 { 877 {
915 viewp->setVisible(FALSE); 878 viewp->setVisible(FALSE);
@@ -922,7 +885,7 @@ void LLFloater::setMinimized(BOOL minimize)
922 dependent_it != mDependents.end(); 885 dependent_it != mDependents.end();
923 ++dependent_it) 886 ++dependent_it)
924 { 887 {
925 LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it); 888 LLFloater* floaterp = dependent_it->get();
926 if (floaterp) 889 if (floaterp)
927 { 890 {
928 floaterp->setMinimized(FALSE); 891 floaterp->setMinimized(FALSE);
@@ -979,7 +942,7 @@ void LLFloater::setIsChrome(BOOL is_chrome)
979 // remove focus if we're changing to chrome 942 // remove focus if we're changing to chrome
980 setFocus(FALSE); 943 setFocus(FALSE);
981 // can't Ctrl-Tab to "chrome" floaters 944 // can't Ctrl-Tab to "chrome" floaters
982 mIsFocusRoot = FALSE; 945 setFocusRoot(FALSE);
983 } 946 }
984 947
985 // no titles displayed on "chrome" floaters 948 // no titles displayed on "chrome" floaters
@@ -1011,7 +974,7 @@ void LLFloater::cleanupHandles()
1011 for(handle_set_iter_t dependent_it = mDependents.begin(); 974 for(handle_set_iter_t dependent_it = mDependents.begin();
1012 dependent_it != mDependents.end(); ) 975 dependent_it != mDependents.end(); )
1013 { 976 {
1014 LLFloater* floaterp = LLFloater::getFloaterByHandle(*dependent_it); 977 LLFloater* floaterp = dependent_it->get();
1015 if (!floaterp) 978 if (!floaterp)
1016 { 979 {
1017 mDependents.erase(dependent_it++); 980 mDependents.erase(dependent_it++);
@@ -1085,7 +1048,7 @@ void LLFloater::addDependentFloater(LLFloater* floaterp, BOOL reposition)
1085 if (reposition) 1048 if (reposition)
1086 { 1049 {
1087 floaterp->setRect(gFloaterView->findNeighboringPosition(this, floaterp)); 1050 floaterp->setRect(gFloaterView->findNeighboringPosition(this, floaterp));
1088 floaterp->setSnapTarget(mViewHandle); 1051 floaterp->setSnapTarget(getHandle());
1089 } 1052 }
1090 gFloaterView->adjustToFitScreen(floaterp, FALSE); 1053 gFloaterView->adjustToFitScreen(floaterp, FALSE);
1091 if (floaterp->isFrontmost()) 1054 if (floaterp->isFrontmost())
@@ -1095,9 +1058,9 @@ void LLFloater::addDependentFloater(LLFloater* floaterp, BOOL reposition)
1095 } 1058 }
1096} 1059}
1097 1060
1098void LLFloater::addDependentFloater(LLViewHandle dependent, BOOL reposition) 1061void LLFloater::addDependentFloater(LLHandle<LLFloater> dependent, BOOL reposition)
1099{ 1062{
1100 LLFloater* dependent_floaterp = LLFloater::getFloaterByHandle(dependent); 1063 LLFloater* dependent_floaterp = dependent.get();
1101 if(dependent_floaterp) 1064 if(dependent_floaterp)
1102 { 1065 {
1103 addDependentFloater(dependent_floaterp, reposition); 1066 addDependentFloater(dependent_floaterp, reposition);
@@ -1107,7 +1070,7 @@ void LLFloater::addDependentFloater(LLViewHandle dependent, BOOL reposition)
1107void LLFloater::removeDependentFloater(LLFloater* floaterp) 1070void LLFloater::removeDependentFloater(LLFloater* floaterp)
1108{ 1071{
1109 mDependents.erase(floaterp->getHandle()); 1072 mDependents.erase(floaterp->getHandle());
1110 floaterp->mDependeeHandle = LLViewHandle::sDeadHandle; 1073 floaterp->mDependeeHandle = LLHandle<LLFloater>();
1111} 1074}
1112 1075
1113// virtual 1076// virtual
@@ -1215,32 +1178,13 @@ void LLFloater::setFrontmost(BOOL take_focus)
1215 } 1178 }
1216} 1179}
1217 1180
1218// static
1219LLFloater* LLFloater::getFloaterByHandle(LLViewHandle handle)
1220{
1221 LLFloater* floater = NULL;
1222 if (sFloaterMap.count(handle))
1223 {
1224 floater = sFloaterMap[handle];
1225 }
1226 if (floater && !floater->isDead())
1227 {
1228 return floater;
1229 }
1230 else
1231 {
1232 return NULL;
1233 }
1234}
1235
1236//static 1181//static
1237void LLFloater::setEditModeEnabled(BOOL enable) 1182void LLFloater::setEditModeEnabled(BOOL enable)
1238{ 1183{
1239 if (enable != sEditModeEnabled) 1184 if (enable != sEditModeEnabled)
1240 { 1185 {
1241 S32 count = 0; 1186 S32 count = 0;
1242 std::map<LLViewHandle, LLFloater*>::iterator iter; 1187 for(handle_map_iter_t iter = sFloaterMap.begin(); iter != sFloaterMap.end(); ++iter)
1243 for(iter = sFloaterMap.begin(); iter != sFloaterMap.end(); ++iter)
1244 { 1188 {
1245 LLFloater* floater = iter->second; 1189 LLFloater* floater = iter->second;
1246 if (!floater->isDead()) 1190 if (!floater->isDead())
@@ -1255,41 +1199,6 @@ void LLFloater::setEditModeEnabled(BOOL enable)
1255 sEditModeEnabled = enable; 1199 sEditModeEnabled = enable;
1256} 1200}
1257 1201
1258//static
1259BOOL LLFloater::getEditModeEnabled()
1260{
1261 return sEditModeEnabled;
1262}
1263
1264//static
1265void LLFloater::show(LLFloater* floaterp)
1266{
1267 if (floaterp)
1268 {
1269 gFocusMgr.triggerFocusFlash();
1270 floaterp->open();
1271 if (floaterp->getHost())
1272 {
1273 floaterp->getHost()->open();
1274 }
1275 }
1276}
1277
1278//static
1279void LLFloater::hide(LLFloater* floaterp)
1280{
1281 if (floaterp) floaterp->close();
1282}
1283
1284//static
1285BOOL LLFloater::visible(LLFloater* floaterp)
1286{
1287 if (floaterp)
1288 {
1289 return !floaterp->isMinimized() && floaterp->isInVisibleChain();
1290 }
1291 return FALSE;
1292}
1293 1202
1294// static 1203// static
1295void LLFloater::onClickMinimize(void *userdata) 1204void LLFloater::onClickMinimize(void *userdata)
@@ -1316,9 +1225,9 @@ void LLFloater::onClickTearOff(void *userdata)
1316 self->open(); /* Flawfinder: ignore */ 1225 self->open(); /* Flawfinder: ignore */
1317 1226
1318 // only force position for floaters that don't have that data saved 1227 // only force position for floaters that don't have that data saved
1319 if (self->mRectControl.empty()) 1228 if (self->getRectControl().empty())
1320 { 1229 {
1321 new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - LLFLOATER_HEADER_SIZE - 5, self->mRect.getWidth(), self->mRect.getHeight()); 1230 new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - LLFLOATER_HEADER_SIZE - 5, self->getRect().getWidth(), self->getRect().getHeight());
1322 self->setRect(new_rect); 1231 self->setRect(new_rect);
1323 } 1232 }
1324 gFloaterView->adjustToFitScreen(self, FALSE); 1233 gFloaterView->adjustToFitScreen(self, FALSE);
@@ -1327,7 +1236,7 @@ void LLFloater::onClickTearOff(void *userdata)
1327 } 1236 }
1328 else //Attach to parent. 1237 else //Attach to parent.
1329 { 1238 {
1330 LLMultiFloater* new_host = (LLMultiFloater*)LLFloater::getFloaterByHandle(self->mLastHostHandle); 1239 LLMultiFloater* new_host = (LLMultiFloater*)self->mLastHostHandle.get();
1331 if (new_host) 1240 if (new_host)
1332 { 1241 {
1333 new_host->showFloater(self); 1242 new_host->showFloater(self);
@@ -1351,7 +1260,7 @@ void LLFloater::closeFocusedFloater()
1351{ 1260{
1352 LLFloater* focused_floater = NULL; 1261 LLFloater* focused_floater = NULL;
1353 1262
1354 std::map<LLViewHandle, LLFloater*>::iterator iter; 1263 handle_map_iter_t iter;
1355 for(iter = sFloaterMap.begin(); iter != sFloaterMap.end(); ++iter) 1264 for(iter = sFloaterMap.begin(); iter != sFloaterMap.end(); ++iter)
1356 { 1265 {
1357 focused_floater = iter->second; 1266 focused_floater = iter->second;
@@ -1396,16 +1305,16 @@ void LLFloater::draw()
1396 if( getVisible() ) 1305 if( getVisible() )
1397 { 1306 {
1398 // draw background 1307 // draw background
1399 if( mBgVisible ) 1308 if( isBackgroundVisible() )
1400 { 1309 {
1401 S32 left = LLPANEL_BORDER_WIDTH; 1310 S32 left = LLPANEL_BORDER_WIDTH;
1402 S32 top = mRect.getHeight() - LLPANEL_BORDER_WIDTH; 1311 S32 top = getRect().getHeight() - LLPANEL_BORDER_WIDTH;
1403 S32 right = mRect.getWidth() - LLPANEL_BORDER_WIDTH; 1312 S32 right = getRect().getWidth() - LLPANEL_BORDER_WIDTH;
1404 S32 bottom = LLPANEL_BORDER_WIDTH; 1313 S32 bottom = LLPANEL_BORDER_WIDTH;
1405 1314
1406 LLColor4 shadow_color = LLUI::sColorsGroup->getColor("ColorDropShadow"); 1315 LLColor4 shadow_color = LLUI::sColorsGroup->getColor("ColorDropShadow");
1407 F32 shadow_offset = (F32)LLUI::sConfigGroup->getS32("DropShadowFloater"); 1316 F32 shadow_offset = (F32)LLUI::sConfigGroup->getS32("DropShadowFloater");
1408 if (!mBgOpaque) 1317 if (!isBackgroundOpaque())
1409 { 1318 {
1410 shadow_offset *= 0.2f; 1319 shadow_offset *= 0.2f;
1411 shadow_color.mV[VALPHA] *= 0.5f; 1320 shadow_color.mV[VALPHA] *= 0.5f;
@@ -1415,13 +1324,13 @@ void LLFloater::draw()
1415 llround(shadow_offset)); 1324 llround(shadow_offset));
1416 1325
1417 // No transparent windows in simple UI 1326 // No transparent windows in simple UI
1418 if (mBgOpaque) 1327 if (isBackgroundOpaque())
1419 { 1328 {
1420 gl_rect_2d( left, top, right, bottom, mBgColorOpaque ); 1329 gl_rect_2d( left, top, right, bottom, getBackgroundColor() );
1421 } 1330 }
1422 else 1331 else
1423 { 1332 {
1424 gl_rect_2d( left, top, right, bottom, mBgColorAlpha ); 1333 gl_rect_2d( left, top, right, bottom, getTransparentColor() );
1425 } 1334 }
1426 1335
1427 if(gFocusMgr.childHasKeyboardFocus(this) && !getIsChrome() && !getTitle().empty()) 1336 if(gFocusMgr.childHasKeyboardFocus(this) && !getIsChrome() && !getTitle().empty())
@@ -1448,13 +1357,13 @@ void LLFloater::draw()
1448 // don't call LLPanel::draw() since we've implemented custom background rendering 1357 // don't call LLPanel::draw() since we've implemented custom background rendering
1449 LLView::draw(); 1358 LLView::draw();
1450 1359
1451 if( mBgVisible ) 1360 if( isBackgroundVisible() )
1452 { 1361 {
1453 // add in a border to improve spacialized visual aclarity ;) 1362 // add in a border to improve spacialized visual aclarity ;)
1454 // use lines instead of gl_rect_2d so we can round the edges as per james' recommendation 1363 // use lines instead of gl_rect_2d so we can round the edges as per james' recommendation
1455 LLUI::setLineWidth(1.5f); 1364 LLUI::setLineWidth(1.5f);
1456 LLColor4 outlineColor = gFocusMgr.childHasKeyboardFocus(this) ? LLUI::sColorsGroup->getColor("FloaterFocusBorderColor") : LLUI::sColorsGroup->getColor("FloaterUnfocusBorderColor"); 1365 LLColor4 outlineColor = gFocusMgr.childHasKeyboardFocus(this) ? LLUI::sColorsGroup->getColor("FloaterFocusBorderColor") : LLUI::sColorsGroup->getColor("FloaterUnfocusBorderColor");
1457 gl_rect_2d_offset_local(0, mRect.getHeight() + 1, mRect.getWidth() + 1, 0, outlineColor, -LLPANEL_BORDER_WIDTH, FALSE); 1366 gl_rect_2d_offset_local(0, getRect().getHeight() + 1, getRect().getWidth() + 1, 0, outlineColor, -LLPANEL_BORDER_WIDTH, FALSE);
1458 LLUI::setLineWidth(1.f); 1367 LLUI::setLineWidth(1.f);
1459 } 1368 }
1460 1369
@@ -1468,7 +1377,7 @@ void LLFloater::draw()
1468 // when last host goes away 1377 // when last host goes away
1469 if (mCanTearOff && !getHost()) 1378 if (mCanTearOff && !getHost())
1470 { 1379 {
1471 LLFloater* old_host = gFloaterView->getFloaterByHandle(mLastHostHandle); 1380 LLFloater* old_host = mLastHostHandle.get();
1472 if (!old_host) 1381 if (!old_host)
1473 { 1382 {
1474 setCanTearOff(FALSE); 1383 setCanTearOff(FALSE);
@@ -1477,33 +1386,6 @@ void LLFloater::draw()
1477 } 1386 }
1478} 1387}
1479 1388
1480// virtual
1481void LLFloater::onOpen()
1482{
1483}
1484
1485// virtual
1486void LLFloater::onClose(bool app_quitting)
1487{
1488 destroy();
1489}
1490
1491// virtual
1492BOOL LLFloater::canClose()
1493{
1494 return TRUE;
1495}
1496
1497// virtual
1498BOOL LLFloater::canSaveAs()
1499{
1500 return FALSE;
1501}
1502
1503// virtual
1504void LLFloater::saveAs()
1505{
1506}
1507 1389
1508void LLFloater::setCanMinimize(BOOL can_minimize) 1390void LLFloater::setCanMinimize(BOOL can_minimize)
1509{ 1391{
@@ -1572,28 +1454,28 @@ void LLFloater::setCanResize(BOOL can_resize)
1572 mResizeBar[0] = new LLResizeBar( 1454 mResizeBar[0] = new LLResizeBar(
1573 "resizebar_left", 1455 "resizebar_left",
1574 this, 1456 this,
1575 LLRect( 0, mRect.getHeight(), RESIZE_BAR_THICKNESS, 0), 1457 LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0),
1576 mMinWidth, S32_MAX, LLResizeBar::LEFT ); 1458 mMinWidth, S32_MAX, LLResizeBar::LEFT );
1577 addChild( mResizeBar[0] ); 1459 addChild( mResizeBar[0] );
1578 1460
1579 mResizeBar[1] = new LLResizeBar( 1461 mResizeBar[1] = new LLResizeBar(
1580 "resizebar_top", 1462 "resizebar_top",
1581 this, 1463 this,
1582 LLRect( 0, mRect.getHeight(), mRect.getWidth(), mRect.getHeight() - RESIZE_BAR_THICKNESS), 1464 LLRect( 0, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_BAR_THICKNESS),
1583 mMinHeight, S32_MAX, LLResizeBar::TOP ); 1465 mMinHeight, S32_MAX, LLResizeBar::TOP );
1584 addChild( mResizeBar[1] ); 1466 addChild( mResizeBar[1] );
1585 1467
1586 mResizeBar[2] = new LLResizeBar( 1468 mResizeBar[2] = new LLResizeBar(
1587 "resizebar_right", 1469 "resizebar_right",
1588 this, 1470 this,
1589 LLRect( mRect.getWidth() - RESIZE_BAR_THICKNESS, mRect.getHeight(), mRect.getWidth(), 0), 1471 LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0),
1590 mMinWidth, S32_MAX, LLResizeBar::RIGHT ); 1472 mMinWidth, S32_MAX, LLResizeBar::RIGHT );
1591 addChild( mResizeBar[2] ); 1473 addChild( mResizeBar[2] );
1592 1474
1593 mResizeBar[3] = new LLResizeBar( 1475 mResizeBar[3] = new LLResizeBar(
1594 "resizebar_bottom", 1476 "resizebar_bottom",
1595 this, 1477 this,
1596 LLRect( 0, RESIZE_BAR_THICKNESS, mRect.getWidth(), 0), 1478 LLRect( 0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0),
1597 mMinHeight, S32_MAX, LLResizeBar::BOTTOM ); 1479 mMinHeight, S32_MAX, LLResizeBar::BOTTOM );
1598 addChild( mResizeBar[3] ); 1480 addChild( mResizeBar[3] );
1599 1481
@@ -1601,14 +1483,14 @@ void LLFloater::setCanResize(BOOL can_resize)
1601 // Resize handles (corners) 1483 // Resize handles (corners)
1602 mResizeHandle[0] = new LLResizeHandle( 1484 mResizeHandle[0] = new LLResizeHandle(
1603 "Resize Handle", 1485 "Resize Handle",
1604 LLRect( mRect.getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, mRect.getWidth(), 0), 1486 LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0),
1605 mMinWidth, 1487 mMinWidth,
1606 mMinHeight, 1488 mMinHeight,
1607 LLResizeHandle::RIGHT_BOTTOM); 1489 LLResizeHandle::RIGHT_BOTTOM);
1608 addChild(mResizeHandle[0]); 1490 addChild(mResizeHandle[0]);
1609 1491
1610 mResizeHandle[1] = new LLResizeHandle( "resize", 1492 mResizeHandle[1] = new LLResizeHandle( "resize",
1611 LLRect( mRect.getWidth() - RESIZE_HANDLE_WIDTH, mRect.getHeight(), mRect.getWidth(), mRect.getHeight() - RESIZE_HANDLE_HEIGHT), 1493 LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_HANDLE_HEIGHT),
1612 mMinWidth, 1494 mMinWidth,
1613 mMinHeight, 1495 mMinHeight,
1614 LLResizeHandle::RIGHT_TOP ); 1496 LLResizeHandle::RIGHT_TOP );
@@ -1622,7 +1504,7 @@ void LLFloater::setCanResize(BOOL can_resize)
1622 addChild(mResizeHandle[2]); 1504 addChild(mResizeHandle[2]);
1623 1505
1624 mResizeHandle[3] = new LLResizeHandle( "resize", 1506 mResizeHandle[3] = new LLResizeHandle( "resize",
1625 LLRect( 0, mRect.getHeight(), RESIZE_HANDLE_WIDTH, mRect.getHeight() - RESIZE_HANDLE_HEIGHT ), 1507 LLRect( 0, getRect().getHeight(), RESIZE_HANDLE_WIDTH, getRect().getHeight() - RESIZE_HANDLE_HEIGHT ),
1626 mMinWidth, 1508 mMinWidth,
1627 mMinHeight, 1509 mMinHeight,
1628 LLResizeHandle::LEFT_TOP ); 1510 LLResizeHandle::LEFT_TOP );
@@ -1659,15 +1541,15 @@ void LLFloater::updateButtons()
1659 { 1541 {
1660 btn_rect.setLeftTopAndSize( 1542 btn_rect.setLeftTopAndSize(
1661 LLPANEL_BORDER_WIDTH, 1543 LLPANEL_BORDER_WIDTH,
1662 mRect.getHeight() - CLOSE_BOX_FROM_TOP - (LLFLOATER_CLOSE_BOX_SIZE + 1) * button_count, 1544 getRect().getHeight() - CLOSE_BOX_FROM_TOP - (LLFLOATER_CLOSE_BOX_SIZE + 1) * button_count,
1663 llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale), 1545 llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
1664 llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale)); 1546 llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
1665 } 1547 }
1666 else 1548 else
1667 { 1549 {
1668 btn_rect.setLeftTopAndSize( 1550 btn_rect.setLeftTopAndSize(
1669 mRect.getWidth() - LLPANEL_BORDER_WIDTH - (LLFLOATER_CLOSE_BOX_SIZE + 1) * button_count, 1551 getRect().getWidth() - LLPANEL_BORDER_WIDTH - (LLFLOATER_CLOSE_BOX_SIZE + 1) * button_count,
1670 mRect.getHeight() - CLOSE_BOX_FROM_TOP, 1552 getRect().getHeight() - CLOSE_BOX_FROM_TOP,
1671 llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale), 1553 llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
1672 llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale)); 1554 llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
1673 } 1555 }
@@ -1685,7 +1567,7 @@ void LLFloater::updateButtons()
1685 } 1567 }
1686 } 1568 }
1687 1569
1688 mDragHandle->setMaxTitleWidth(mRect.getWidth() - (button_count * (LLFLOATER_CLOSE_BOX_SIZE + 1))); 1570 mDragHandle->setMaxTitleWidth(getRect().getWidth() - (button_count * (LLFLOATER_CLOSE_BOX_SIZE + 1)));
1689} 1571}
1690 1572
1691void LLFloater::buildButtons() 1573void LLFloater::buildButtons()
@@ -1697,15 +1579,15 @@ void LLFloater::buildButtons()
1697 { 1579 {
1698 btn_rect.setLeftTopAndSize( 1580 btn_rect.setLeftTopAndSize(
1699 LLPANEL_BORDER_WIDTH, 1581 LLPANEL_BORDER_WIDTH,
1700 mRect.getHeight() - CLOSE_BOX_FROM_TOP - (LLFLOATER_CLOSE_BOX_SIZE + 1) * (i + 1), 1582 getRect().getHeight() - CLOSE_BOX_FROM_TOP - (LLFLOATER_CLOSE_BOX_SIZE + 1) * (i + 1),
1701 llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale), 1583 llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
1702 llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale)); 1584 llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
1703 } 1585 }
1704 else 1586 else
1705 { 1587 {
1706 btn_rect.setLeftTopAndSize( 1588 btn_rect.setLeftTopAndSize(
1707 mRect.getWidth() - LLPANEL_BORDER_WIDTH - (LLFLOATER_CLOSE_BOX_SIZE + 1) * (i + 1), 1589 getRect().getWidth() - LLPANEL_BORDER_WIDTH - (LLFLOATER_CLOSE_BOX_SIZE + 1) * (i + 1),
1708 mRect.getHeight() - CLOSE_BOX_FROM_TOP, 1590 getRect().getHeight() - CLOSE_BOX_FROM_TOP,
1709 llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale), 1591 llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale),
1710 llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale)); 1592 llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale));
1711 } 1593 }
@@ -1748,16 +1630,6 @@ LLFloaterView::LLFloaterView( const LLString& name, const LLRect& rect )
1748 resetStartingFloaterPosition(); 1630 resetStartingFloaterPosition();
1749} 1631}
1750 1632
1751EWidgetType LLFloaterView::getWidgetType() const
1752{
1753 return WIDGET_TYPE_FLOATER_VIEW;
1754}
1755
1756LLString LLFloaterView::getWidgetTag() const
1757{
1758 return LL_FLOATER_VIEW_TAG;
1759}
1760
1761// By default, adjust vertical. 1633// By default, adjust vertical.
1762void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) 1634void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent)
1763{ 1635{
@@ -1767,8 +1639,8 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent)
1767// When reshaping this view, make the floaters follow their closest edge. 1639// When reshaping this view, make the floaters follow their closest edge.
1768void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent, BOOL adjust_vertical) 1640void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent, BOOL adjust_vertical)
1769{ 1641{
1770 S32 old_width = mRect.getWidth(); 1642 S32 old_width = getRect().getWidth();
1771 S32 old_height = mRect.getHeight(); 1643 S32 old_height = getRect().getHeight();
1772 1644
1773 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) 1645 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
1774 { 1646 {
@@ -1822,7 +1694,7 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent, BOOL
1822 for(LLFloater::handle_set_iter_t dependent_it = floaterp->mDependents.begin(); 1694 for(LLFloater::handle_set_iter_t dependent_it = floaterp->mDependents.begin();
1823 dependent_it != floaterp->mDependents.end(); ++dependent_it) 1695 dependent_it != floaterp->mDependents.end(); ++dependent_it)
1824 { 1696 {
1825 LLFloater* dependent_floaterp = getFloaterByHandle(*dependent_it); 1697 LLFloater* dependent_floaterp = dependent_it->get();
1826 if (dependent_floaterp) 1698 if (dependent_floaterp)
1827 { 1699 {
1828 dependent_floaterp->setFollows(follow_flags); 1700 dependent_floaterp->setFollows(follow_flags);
@@ -1924,7 +1796,7 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF
1924 for(LLFloater::handle_set_iter_t dependent_it = reference_floater->mDependents.begin(); 1796 for(LLFloater::handle_set_iter_t dependent_it = reference_floater->mDependents.begin();
1925 dependent_it != reference_floater->mDependents.end(); ++dependent_it) 1797 dependent_it != reference_floater->mDependents.end(); ++dependent_it)
1926 { 1798 {
1927 LLFloater* sibling = LLFloater::getFloaterByHandle(*dependent_it); 1799 LLFloater* sibling = dependent_it->get();
1928 // check for dependents within 10 pixels of base floater 1800 // check for dependents within 10 pixels of base floater
1929 if (sibling && 1801 if (sibling &&
1930 sibling != neighbor && 1802 sibling != neighbor &&
@@ -1936,8 +1808,8 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF
1936 } 1808 }
1937 1809
1938 S32 left_margin = llmax(0, base_rect.mLeft); 1810 S32 left_margin = llmax(0, base_rect.mLeft);
1939 S32 right_margin = llmax(0, mRect.getWidth() - base_rect.mRight); 1811 S32 right_margin = llmax(0, getRect().getWidth() - base_rect.mRight);
1940 S32 top_margin = llmax(0, mRect.getHeight() - base_rect.mTop); 1812 S32 top_margin = llmax(0, getRect().getHeight() - base_rect.mTop);
1941 S32 bottom_margin = llmax(0, base_rect.mBottom); 1813 S32 bottom_margin = llmax(0, base_rect.mBottom);
1942 1814
1943 // find position for floater in following order 1815 // find position for floater in following order
@@ -1946,22 +1818,22 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF
1946 { 1818 {
1947 if (right_margin > width) 1819 if (right_margin > width)
1948 { 1820 {
1949 new_rect.translate(base_rect.mRight - neighbor->mRect.mLeft, base_rect.mTop - neighbor->mRect.mTop); 1821 new_rect.translate(base_rect.mRight - neighbor->getRect().mLeft, base_rect.mTop - neighbor->getRect().mTop);
1950 return new_rect; 1822 return new_rect;
1951 } 1823 }
1952 else if (left_margin > width) 1824 else if (left_margin > width)
1953 { 1825 {
1954 new_rect.translate(base_rect.mLeft - neighbor->mRect.mRight, base_rect.mTop - neighbor->mRect.mTop); 1826 new_rect.translate(base_rect.mLeft - neighbor->getRect().mRight, base_rect.mTop - neighbor->getRect().mTop);
1955 return new_rect; 1827 return new_rect;
1956 } 1828 }
1957 else if (bottom_margin > height) 1829 else if (bottom_margin > height)
1958 { 1830 {
1959 new_rect.translate(base_rect.mLeft - neighbor->mRect.mLeft, base_rect.mBottom - neighbor->mRect.mTop); 1831 new_rect.translate(base_rect.mLeft - neighbor->getRect().mLeft, base_rect.mBottom - neighbor->getRect().mTop);
1960 return new_rect; 1832 return new_rect;
1961 } 1833 }
1962 else if (top_margin > height) 1834 else if (top_margin > height)
1963 { 1835 {
1964 new_rect.translate(base_rect.mLeft - neighbor->mRect.mLeft, base_rect.mTop - neighbor->mRect.mBottom); 1836 new_rect.translate(base_rect.mLeft - neighbor->getRect().mLeft, base_rect.mTop - neighbor->getRect().mBottom);
1965 return new_rect; 1837 return new_rect;
1966 } 1838 }
1967 1839
@@ -1976,15 +1848,6 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF
1976 return new_rect; 1848 return new_rect;
1977} 1849}
1978 1850
1979void LLFloaterView::setCycleMode(BOOL mode)
1980{
1981 mFocusCycleMode = mode;
1982}
1983
1984BOOL LLFloaterView::getCycleMode()
1985{
1986 return mFocusCycleMode;
1987}
1988 1851
1989void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus) 1852void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus)
1990{ 1853{
@@ -2014,7 +1877,7 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus)
2014 for(LLFloater::handle_set_iter_t dependent_it = floater->mDependents.begin(); 1877 for(LLFloater::handle_set_iter_t dependent_it = floater->mDependents.begin();
2015 dependent_it != floater->mDependents.end(); ) 1878 dependent_it != floater->mDependents.end(); )
2016 { 1879 {
2017 LLFloater* sibling = LLFloater::getFloaterByHandle(*dependent_it); 1880 LLFloater* sibling = dependent_it->get();
2018 if (sibling) 1881 if (sibling)
2019 { 1882 {
2020 floaters_to_move.push_back(sibling); 1883 floaters_to_move.push_back(sibling);
@@ -2045,7 +1908,7 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus)
2045 for(LLFloater::handle_set_iter_t dependent_it = child->mDependents.begin(); 1908 for(LLFloater::handle_set_iter_t dependent_it = child->mDependents.begin();
2046 dependent_it != child->mDependents.end(); ) 1909 dependent_it != child->mDependents.end(); )
2047 { 1910 {
2048 LLFloater* dependent = getFloaterByHandle(*dependent_it); 1911 LLFloater* dependent = dependent_it->get();
2049 if (dependent) 1912 if (dependent)
2050 { 1913 {
2051 sendChildToFront(dependent); 1914 sendChildToFront(dependent);
@@ -2086,7 +1949,7 @@ void LLFloaterView::highlightFocusedFloater()
2086 dependent_it != floater->mDependents.end(); 1949 dependent_it != floater->mDependents.end();
2087 ++dependent_it) 1950 ++dependent_it)
2088 { 1951 {
2089 LLFloater* dependent_floaterp = getFloaterByHandle(*dependent_it); 1952 LLFloater* dependent_floaterp = dependent_it->get();
2090 if (dependent_floaterp && gFocusMgr.childHasKeyboardFocus(dependent_floaterp)) 1953 if (dependent_floaterp && gFocusMgr.childHasKeyboardFocus(dependent_floaterp))
2091 { 1954 {
2092 floater_or_dependent_has_focus = TRUE; 1955 floater_or_dependent_has_focus = TRUE;
@@ -2099,7 +1962,7 @@ void LLFloaterView::highlightFocusedFloater()
2099 for(LLFloater::handle_set_iter_t dependent_it = floater->mDependents.begin(); 1962 for(LLFloater::handle_set_iter_t dependent_it = floater->mDependents.begin();
2100 dependent_it != floater->mDependents.end(); ) 1963 dependent_it != floater->mDependents.end(); )
2101 { 1964 {
2102 LLFloater* dependent_floaterp = getFloaterByHandle(*dependent_it); 1965 LLFloater* dependent_floaterp = dependent_it->get();
2103 if (dependent_floaterp) 1966 if (dependent_floaterp)
2104 { 1967 {
2105 dependent_floaterp->setForeground(floater_or_dependent_has_focus); 1968 dependent_floaterp->setForeground(floater_or_dependent_has_focus);
@@ -2260,42 +2123,40 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
2260 if( floater->isResizable() ) 2123 if( floater->isResizable() )
2261 { 2124 {
2262 LLRect view_rect = floater->getRect(); 2125 LLRect view_rect = floater->getRect();
2263 S32 view_width = view_rect.getWidth(); 2126 S32 old_width = view_rect.getWidth();
2264 S32 view_height = view_rect.getHeight(); 2127 S32 old_height = view_rect.getHeight();
2265 S32 min_width; 2128 S32 min_width;
2266 S32 min_height; 2129 S32 min_height;
2267 floater->getResizeLimits( &min_width, &min_height ); 2130 floater->getResizeLimits( &min_width, &min_height );
2268 2131
2269 // Make sure floater isn't already smaller than its min height/width? 2132 // Make sure floater isn't already smaller than its min height/width?
2270 S32 new_width = llmax( min_width, view_width ); 2133 S32 new_width = llmax( min_width, old_width );
2271 S32 new_height = llmax( min_height, view_height ); 2134 S32 new_height = llmax( min_height, old_height);
2272 2135
2273 if( !allow_partial_outside 2136 if((new_width > screen_width) || (new_height > screen_height))
2274 && ( (new_width > screen_width)
2275 || (new_height > screen_height) ) )
2276 { 2137 {
2277 // We have to force this window to be inside the screen. 2138 // We have to make this window able to fit on screen
2278 new_width = llmin(new_width, screen_width); 2139 new_width = llmin(new_width, screen_width);
2279 new_height = llmin(new_height, screen_height); 2140 new_height = llmin(new_height, screen_height);
2280 2141
2281 // Still respect minimum width/height 2142 // ...while respecting minimum width/height
2282 new_width = llmax(new_width, min_width); 2143 new_width = llmax(new_width, min_width);
2283 new_height = llmax(new_height, min_height); 2144 new_height = llmax(new_height, min_height);
2284 2145
2285 floater->reshape( new_width, new_height, TRUE ); 2146 floater->reshape( new_width, new_height, TRUE );
2147 if (floater->followsRight())
2148 {
2149 floater->translate(old_width - new_width, 0);
2150 }
2286 2151
2287 // Make sure the damn thing is actually onscreen. 2152 if (floater->followsTop())
2288 if (floater->translateIntoRect(snap_rect_local, FALSE))
2289 { 2153 {
2290 floater->clearSnapTarget(); 2154 floater->translate(0, old_height - new_height);
2291 } 2155 }
2292 } 2156 }
2293 else if (!floater->isMinimized())
2294 {
2295 floater->reshape(new_width, new_height, TRUE);
2296 }
2297 } 2157 }
2298 2158
2159 // move window fully onscreen
2299 if (floater->translateIntoRect( snap_rect_local, allow_partial_outside )) 2160 if (floater->translateIntoRect( snap_rect_local, allow_partial_outside ))
2300 { 2161 {
2301 floater->clearSnapTarget(); 2162 floater->clearSnapTarget();
@@ -2328,9 +2189,9 @@ void LLFloaterView::draw()
2328 } 2189 }
2329} 2190}
2330 2191
2331const LLRect LLFloaterView::getSnapRect() const 2192LLRect LLFloaterView::getSnapRect() const
2332{ 2193{
2333 LLRect snap_rect = mRect; 2194 LLRect snap_rect = getRect();
2334 snap_rect.mBottom += mSnapOffsetBottom; 2195 snap_rect.mBottom += mSnapOffsetBottom;
2335 2196
2336 return snap_rect; 2197 return snap_rect;
@@ -2397,23 +2258,6 @@ void LLFloaterView::syncFloaterTabOrder()
2397 } 2258 }
2398} 2259}
2399 2260
2400LLFloater* LLFloaterView::getFloaterByHandle(LLViewHandle handle)
2401{
2402 if (handle == LLViewHandle::sDeadHandle)
2403 {
2404 return NULL;
2405 }
2406 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
2407 {
2408 LLView* viewp = *child_it;
2409 if (((LLFloater*)viewp)->getHandle() == handle)
2410 {
2411 return (LLFloater*)viewp;
2412 }
2413 }
2414 return NULL;
2415}
2416
2417LLFloater* LLFloaterView::getParentFloater(LLView* viewp) 2261LLFloater* LLFloaterView::getParentFloater(LLView* viewp)
2418{ 2262{
2419 LLView* parentp = viewp->getParent(); 2263 LLView* parentp = viewp->getParent();
@@ -2479,13 +2323,13 @@ void LLFloaterView::popVisibleAll(const skip_list_t& skip_list)
2479 2323
2480LLMultiFloater::LLMultiFloater() : 2324LLMultiFloater::LLMultiFloater() :
2481 mTabContainer(NULL), 2325 mTabContainer(NULL),
2482 mTabPos(LLTabContainerCommon::TOP), 2326 mTabPos(LLTabContainer::TOP),
2483 mAutoResize(TRUE) 2327 mAutoResize(TRUE)
2484{ 2328{
2485 2329
2486} 2330}
2487 2331
2488LLMultiFloater::LLMultiFloater(LLTabContainerCommon::TabPosition tab_pos) : 2332LLMultiFloater::LLMultiFloater(LLTabContainer::TabPosition tab_pos) :
2489 mTabContainer(NULL), 2333 mTabContainer(NULL),
2490 mTabPos(tab_pos), 2334 mTabPos(tab_pos),
2491 mAutoResize(TRUE) 2335 mAutoResize(TRUE)
@@ -2496,7 +2340,7 @@ LLMultiFloater::LLMultiFloater(LLTabContainerCommon::TabPosition tab_pos) :
2496LLMultiFloater::LLMultiFloater(const LLString &name) : 2340LLMultiFloater::LLMultiFloater(const LLString &name) :
2497 LLFloater(name), 2341 LLFloater(name),
2498 mTabContainer(NULL), 2342 mTabContainer(NULL),
2499 mTabPos(LLTabContainerCommon::TOP), 2343 mTabPos(LLTabContainer::TOP),
2500 mAutoResize(FALSE) 2344 mAutoResize(FALSE)
2501{ 2345{
2502} 2346}
@@ -2508,16 +2352,16 @@ LLMultiFloater::LLMultiFloater(
2508 BOOL auto_resize) : 2352 BOOL auto_resize) :
2509 LLFloater(name, rect, name), 2353 LLFloater(name, rect, name),
2510 mTabContainer(NULL), 2354 mTabContainer(NULL),
2511 mTabPos(LLTabContainerCommon::TOP), 2355 mTabPos(LLTabContainer::TOP),
2512 mAutoResize(auto_resize) 2356 mAutoResize(auto_resize)
2513{ 2357{
2514 mTabContainer = new LLTabContainer("Preview Tabs", 2358 mTabContainer = new LLTabContainer("Preview Tabs",
2515 LLRect(LLPANEL_BORDER_WIDTH, mRect.getHeight() - LLFLOATER_HEADER_SIZE, mRect.getWidth() - LLPANEL_BORDER_WIDTH, 0), 2359 LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0),
2516 mTabPos, 2360 mTabPos,
2517 NULL, 2361 FALSE,
2518 NULL); 2362 FALSE);
2519 mTabContainer->setFollowsAll(); 2363 mTabContainer->setFollowsAll();
2520 if (mResizable) 2364 if (isResizable())
2521 { 2365 {
2522 mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH); 2366 mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH);
2523 } 2367 }
@@ -2536,12 +2380,12 @@ LLMultiFloater::LLMultiFloater(
2536 mAutoResize(auto_resize) 2380 mAutoResize(auto_resize)
2537{ 2381{
2538 mTabContainer = new LLTabContainer("Preview Tabs", 2382 mTabContainer = new LLTabContainer("Preview Tabs",
2539 LLRect(LLPANEL_BORDER_WIDTH, mRect.getHeight() - LLFLOATER_HEADER_SIZE, mRect.getWidth() - LLPANEL_BORDER_WIDTH, 0), 2383 LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0),
2540 mTabPos, 2384 mTabPos,
2541 NULL, 2385 FALSE,
2542 NULL); 2386 FALSE);
2543 mTabContainer->setFollowsAll(); 2387 mTabContainer->setFollowsAll();
2544 if (mResizable && mTabPos == LLTabContainerCommon::BOTTOM) 2388 if (isResizable() && mTabPos == LLTabContainer::BOTTOM)
2545 { 2389 {
2546 mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH); 2390 mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH);
2547 } 2391 }
@@ -2550,21 +2394,6 @@ LLMultiFloater::LLMultiFloater(
2550 2394
2551} 2395}
2552 2396
2553LLMultiFloater::~LLMultiFloater()
2554{
2555}
2556
2557// virtual
2558EWidgetType LLMultiFloater::getWidgetType() const
2559{
2560 return WIDGET_TYPE_MULTI_FLOATER;
2561}
2562
2563// virtual
2564LLString LLMultiFloater::getWidgetTag() const
2565{
2566 return LL_MULTI_FLOATER_TAG;
2567}
2568 2397
2569void LLMultiFloater::open() /* Flawfinder: ignore */ 2398void LLMultiFloater::open() /* Flawfinder: ignore */
2570{ 2399{
@@ -2584,7 +2413,7 @@ void LLMultiFloater::onClose(bool app_quitting)
2584{ 2413{
2585 if(closeAllFloaters() == TRUE) 2414 if(closeAllFloaters() == TRUE)
2586 { 2415 {
2587 LLFloater::onClose(app_quitting ? true : false); 2416 LLFloater::onClose(app_quitting);
2588 }//else not all tabs could be closed... 2417 }//else not all tabs could be closed...
2589} 2418}
2590 2419
@@ -2635,16 +2464,18 @@ BOOL LLMultiFloater::closeAllFloaters()
2635 2464
2636void LLMultiFloater::growToFit(S32 content_width, S32 content_height) 2465void LLMultiFloater::growToFit(S32 content_width, S32 content_height)
2637{ 2466{
2638 S32 new_width = llmax(mRect.getWidth(), content_width + LLPANEL_BORDER_WIDTH * 2); 2467 S32 new_width = llmax(getRect().getWidth(), content_width + LLPANEL_BORDER_WIDTH * 2);
2639 S32 new_height = llmax(mRect.getHeight(), content_height + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT); 2468 S32 new_height = llmax(getRect().getHeight(), content_height + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT);
2640 2469
2641 if (isMinimized()) 2470 if (isMinimized())
2642 { 2471 {
2643 mPreviousRect.setLeftTopAndSize(mPreviousRect.mLeft, mPreviousRect.mTop, new_width, new_height); 2472 LLRect newrect;
2644 } 2473 newrect.setLeftTopAndSize(getExpandedRect().mLeft, getExpandedRect().mTop, new_width, new_height);
2474 setExpandedRect(newrect);
2475 }
2645 else 2476 else
2646 { 2477 {
2647 S32 old_height = mRect.getHeight(); 2478 S32 old_height = getRect().getHeight();
2648 reshape(new_width, new_height); 2479 reshape(new_width, new_height);
2649 // keep top left corner in same position 2480 // keep top left corner in same position
2650 translate(0, old_height - new_height); 2481 translate(0, old_height - new_height);
@@ -2729,7 +2560,7 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater,
2729 } 2560 }
2730 2561
2731 floaterp->setHost(this); 2562 floaterp->setHost(this);
2732 if (mMinimized) 2563 if (isMinimized())
2733 { 2564 {
2734 floaterp->setVisible(FALSE); 2565 floaterp->setVisible(FALSE);
2735 } 2566 }
@@ -2912,7 +2743,7 @@ void LLMultiFloater::onTabSelected(void* userdata, bool from_click)
2912void LLMultiFloater::setCanResize(BOOL can_resize) 2743void LLMultiFloater::setCanResize(BOOL can_resize)
2913{ 2744{
2914 LLFloater::setCanResize(can_resize); 2745 LLFloater::setCanResize(can_resize);
2915 if (mResizable && mTabContainer->getTabPosition() == LLTabContainer::BOTTOM) 2746 if (isResizable() && mTabContainer->getTabPosition() == LLTabContainer::BOTTOM)
2916 { 2747 {
2917 mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH); 2748 mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH);
2918 } 2749 }
@@ -2955,20 +2786,23 @@ void LLMultiFloater::updateResizeLimits()
2955 } 2786 }
2956 setResizeLimits(new_min_width, new_min_height); 2787 setResizeLimits(new_min_width, new_min_height);
2957 2788
2958 S32 cur_height = mRect.getHeight(); 2789 S32 cur_height = getRect().getHeight();
2959 S32 new_width = llmax(mRect.getWidth(), new_min_width); 2790 S32 new_width = llmax(getRect().getWidth(), new_min_width);
2960 S32 new_height = llmax(mRect.getHeight(), new_min_height); 2791 S32 new_height = llmax(getRect().getHeight(), new_min_height);
2961 2792
2962 if (isMinimized()) 2793 if (isMinimized())
2963 { 2794 {
2964 mPreviousRect.setLeftTopAndSize(mPreviousRect.mLeft, mPreviousRect.mTop, llmax(mPreviousRect.getWidth(), new_width), llmax(mPreviousRect.getHeight(), new_height)); 2795 const LLRect& expanded = getExpandedRect();
2796 LLRect newrect;
2797 newrect.setLeftTopAndSize(expanded.mLeft, expanded.mTop, llmax(expanded.getWidth(), new_width), llmax(expanded.getHeight(), new_height));
2798 setExpandedRect(newrect);
2965 } 2799 }
2966 else 2800 else
2967 { 2801 {
2968 reshape(new_width, new_height); 2802 reshape(new_width, new_height);
2969 2803
2970 // make sure upper left corner doesn't move 2804 // make sure upper left corner doesn't move
2971 translate(0, cur_height - mRect.getHeight()); 2805 translate(0, cur_height - getRect().getHeight());
2972 2806
2973 // make sure this window is visible on screen when it has been modified 2807 // make sure this window is visible on screen when it has been modified
2974 // (tab added, etc) 2808 // (tab added, etc)
diff --git a/linden/indra/llui/llfloater.h b/linden/indra/llui/llfloater.h
index 56b0e6e..534af16 100644
--- a/linden/indra/llui/llfloater.h
+++ b/linden/indra/llui/llfloater.h
@@ -112,8 +112,8 @@ public:
112 void initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory, BOOL open = TRUE); 112 void initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory, BOOL open = TRUE);
113 113
114 /*virtual*/ void userSetShape(const LLRect& new_rect); 114 /*virtual*/ void userSetShape(const LLRect& new_rect);
115 /*virtual*/ BOOL canSnapTo(LLView* other_view); 115 /*virtual*/ BOOL canSnapTo(const LLView* other_view);
116 /*virtual*/ void snappedTo(LLView* snap_view); 116 /*virtual*/ void snappedTo(const LLView* snap_view);
117 /*virtual*/ void setFocus( BOOL b ); 117 /*virtual*/ void setFocus( BOOL b );
118 /*virtual*/ void setIsChrome(BOOL is_chrome); 118 /*virtual*/ void setIsChrome(BOOL is_chrome);
119 119
@@ -122,16 +122,14 @@ public:
122 virtual void init(const LLString& title, BOOL resizable, 122 virtual void init(const LLString& title, BOOL resizable,
123 S32 min_width, S32 min_height, BOOL drag_on_left, 123 S32 min_width, S32 min_height, BOOL drag_on_left,
124 BOOL minimizable, BOOL close_btn); 124 BOOL minimizable, BOOL close_btn);
125 virtual EWidgetType getWidgetType() const; 125 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_FLOATER; }
126 virtual LLString getWidgetTag() const; 126 virtual LLString getWidgetTag() const { return LL_FLOATER_TAG; };
127 127
128 virtual void open(); /* Flawfinder: ignore */ 128 virtual void open(); /* Flawfinder: ignore */
129 129
130 // If allowed, close the floater cleanly, releasing focus. 130 // If allowed, close the floater cleanly, releasing focus.
131 // app_quitting is passed to onClose() below. 131 // app_quitting is passed to onClose() below.
132 virtual void close(bool app_quitting = false); 132 virtual void close(bool app_quitting = false);
133
134 void setAutoFocus(BOOL focus) { mAutoFocus = focus; setFocus(focus); }
135 133
136 // Release keyboard and mouse focus 134 // Release keyboard and mouse focus
137 void releaseFocus(); 135 void releaseFocus();
@@ -142,18 +140,18 @@ public:
142 void applyRectControl(); 140 void applyRectControl();
143 141
144 142
145 LLMultiFloater* getHost() { return (LLMultiFloater*)LLFloater::getFloaterByHandle(mHostHandle); } 143 LLMultiFloater* getHost() { return (LLMultiFloater*)mHostHandle.get(); }
146 144
147 void setTitle( const LLString& title ); 145 void setTitle( const LLString& title );
148 const LLString& getTitle() const; 146 const LLString& getTitle() const;
149 void setShortTitle( const LLString& short_title ); 147 void setShortTitle( const LLString& short_title );
150 LLString getShortTitle(); 148 LLString getShortTitle();
151 virtual void setMinimized(BOOL b); 149 virtual void setMinimized(BOOL b);
152 void moveResizeHandlesToFront(); 150 void moveResizeHandlesToFront();
153 void addDependentFloater(LLFloater* dependent, BOOL reposition = TRUE); 151 void addDependentFloater(LLFloater* dependent, BOOL reposition = TRUE);
154 void addDependentFloater(LLViewHandle dependent_handle, BOOL reposition = TRUE); 152 void addDependentFloater(LLHandle<LLFloater> dependent_handle, BOOL reposition = TRUE);
155 LLFloater* getDependee() { return (LLFloater*)LLFloater::getFloaterByHandle(mDependeeHandle); } 153 LLFloater* getDependee() { return (LLFloater*)mDependeeHandle.get(); }
156 void removeDependentFloater(LLFloater* dependent); 154 void removeDependentFloater(LLFloater* dependent);
157 BOOL isMinimized() { return mMinimized; } 155 BOOL isMinimized() { return mMinimized; }
158 BOOL isFrontmost(); 156 BOOL isFrontmost();
159 BOOL isDependent() { return !mDependeeHandle.isDead(); } 157 BOOL isDependent() { return !mDependeeHandle.isDead(); }
@@ -167,10 +165,9 @@ public:
167 void setResizeLimits( S32 min_width, S32 min_height ); 165 void setResizeLimits( S32 min_width, S32 min_height );
168 void getResizeLimits( S32* min_width, S32* min_height ) { *min_width = mMinWidth; *min_height = mMinHeight; } 166 void getResizeLimits( S32* min_width, S32* min_height ) { *min_width = mMinWidth; *min_height = mMinHeight; }
169 167
170
171 bool isMinimizeable() const{ return mButtonsEnabled[BUTTON_MINIMIZE]; } 168 bool isMinimizeable() const{ return mButtonsEnabled[BUTTON_MINIMIZE]; }
172 // Does this window have a close button, NOT can we close it right now. 169 // Does this window have a close button, NOT can we close it right now.
173 bool isCloseable() const{ return (mButtonsEnabled[BUTTON_CLOSE] ? true : false); } 170 bool isCloseable() const{ return (mButtonsEnabled[BUTTON_CLOSE]); }
174 bool isDragOnLeft() const{ return mDragOnLeft; } 171 bool isDragOnLeft() const{ return mDragOnLeft; }
175 S32 getMinWidth() const{ return mMinWidth; } 172 S32 getMinWidth() const{ return mMinWidth; }
176 S32 getMinHeight() const{ return mMinHeight; } 173 S32 getMinHeight() const{ return mMinHeight; }
@@ -181,29 +178,28 @@ public:
181 178
182 virtual void draw(); 179 virtual void draw();
183 180
184 // does nothing by default 181 virtual void onOpen() {}
185 virtual void onOpen();
186 182
187 // Call destroy() to free memory, or setVisible(FALSE) to keep it 183 // Call destroy() to free memory, or setVisible(FALSE) to keep it
188 // If app_quitting, you might not want to save your visibility. 184 // If app_quitting, you might not want to save your visibility.
189 // Defaults to destroy(). 185 // Defaults to destroy().
190 virtual void onClose(bool app_quitting); 186 virtual void onClose(bool app_quitting) { destroy(); }
191 187
192 // Defaults to true. 188 virtual BOOL canClose() { return TRUE; }
193 virtual BOOL canClose();
194 189
195 virtual void setVisible(BOOL visible); 190 virtual void setVisible(BOOL visible);
196 void setFrontmost(BOOL take_focus = TRUE); 191 void setFrontmost(BOOL take_focus = TRUE);
197 192
198 // Defaults to false. 193 // Defaults to false.
199 virtual BOOL canSaveAs(); 194 virtual BOOL canSaveAs() const { return FALSE; }
200 195
201 // Defaults to no-op. 196 virtual void saveAs() {}
202 virtual void saveAs();
203 197
204 void setSnapTarget(LLViewHandle handle) { mSnappedTo = handle; } 198 void setSnapTarget(LLHandle<LLFloater> handle) { mSnappedTo = handle; }
205 void clearSnapTarget() { mSnappedTo.markDead(); } 199 void clearSnapTarget() { mSnappedTo.markDead(); }
206 LLViewHandle getSnapTarget() { return mSnappedTo; } 200 LLHandle<LLFloater> getSnapTarget() { return mSnappedTo; }
201
202 LLHandle<LLFloater> getHandle() { return mHandle; }
207 203
208 static void closeFocusedFloater(); 204 static void closeFocusedFloater();
209 205
@@ -214,39 +210,39 @@ public:
214 210
215 static void setFloaterHost(LLMultiFloater* hostp) {sHostp = hostp; } 211 static void setFloaterHost(LLMultiFloater* hostp) {sHostp = hostp; }
216 static void setEditModeEnabled(BOOL enable); 212 static void setEditModeEnabled(BOOL enable);
217 static BOOL getEditModeEnabled(); 213 static BOOL getEditModeEnabled() { return sEditModeEnabled; }
218 static LLMultiFloater* getFloaterHost() {return sHostp; } 214 static LLMultiFloater* getFloaterHost() {return sHostp; }
219 215
220 static void show(LLFloater* floaterp);
221 static void hide(LLFloater* floaterp);
222 static BOOL visible(LLFloater* floaterp);
223
224 static LLFloater* getFloaterByHandle(LLViewHandle handle);
225
226protected: 216protected:
227 // Don't call this directly. You probably want to call close(). JC 217
228 void destroy();
229 virtual void bringToFront(S32 x, S32 y); 218 virtual void bringToFront(S32 x, S32 y);
230 virtual void setVisibleAndFrontmost(BOOL take_focus=TRUE); 219 virtual void setVisibleAndFrontmost(BOOL take_focus=TRUE);
220
221 void setExpandedRect(const LLRect& rect) { mExpandedRect = rect; } // size when not minimized
222 const LLRect& getExpandedRect() const { return mExpandedRect; }
223
224 void setAutoFocus(BOOL focus) { mAutoFocus = focus; } // whether to automatically take focus when opened
225 LLDragHandle* getDragHandle() const { return mDragHandle; }
226
227 void destroy() { die(); } // Don't call this directly. You probably want to call close(). JC
228
229private:
230
231 void setForeground(BOOL b); // called only by floaterview 231 void setForeground(BOOL b); // called only by floaterview
232 void cleanupHandles(); // remove handles to dead floaters 232 void cleanupHandles(); // remove handles to dead floaters
233 void createMinimizeButton(); 233 void createMinimizeButton();
234 void updateButtons(); 234 void updateButtons();
235 void buildButtons(); 235 void buildButtons();
236 236
237protected: 237 LLRect mExpandedRect;
238// static LLViewerImage* sBackgroundImage;
239// static LLViewerImage* sShadowImage;
240
241 LLDragHandle* mDragHandle; 238 LLDragHandle* mDragHandle;
242 LLResizeBar* mResizeBar[4]; 239 LLResizeBar* mResizeBar[4];
243 LLResizeHandle* mResizeHandle[4]; 240 LLResizeHandle* mResizeHandle[4];
244 LLButton *mMinimizeButton; 241 LLButton *mMinimizeButton;
245 BOOL mCanTearOff; 242 BOOL mCanTearOff;
246 BOOL mMinimized; 243 BOOL mMinimized;
247 LLRect mPreviousRect;
248 BOOL mForeground; 244 BOOL mForeground;
249 LLViewHandle mDependeeHandle; 245 LLHandle<LLFloater> mDependeeHandle;
250 LLString mShortTitle; 246 LLString mShortTitle;
251 247
252 BOOL mFirstLook; // TRUE if the _next_ time this floater is visible will be the first time in the session that it is visible. 248 BOOL mFirstLook; // TRUE if the _next_ time this floater is visible will be the first time in the session that it is visible.
@@ -255,25 +251,24 @@ protected:
255 S32 mMinWidth; 251 S32 mMinWidth;
256 S32 mMinHeight; 252 S32 mMinHeight;
257 253
258 BOOL mAutoFocus;
259 BOOL mEditing; 254 BOOL mEditing;
260 255
261 typedef std::set<LLViewHandle> handle_set_t; 256 typedef std::set<LLHandle<LLFloater> > handle_set_t;
262 typedef std::set<LLViewHandle>::iterator handle_set_iter_t; 257 typedef std::set<LLHandle<LLFloater> >::iterator handle_set_iter_t;
263 handle_set_t mDependents; 258 handle_set_t mDependents;
264 bool mDragOnLeft; 259 bool mDragOnLeft;
265 260
266 BOOL mButtonsEnabled[BUTTON_COUNT]; 261 BOOL mButtonsEnabled[BUTTON_COUNT];
267 LLButton* mButtons[BUTTON_COUNT]; 262 LLButton* mButtons[BUTTON_COUNT];
268 F32 mButtonScale; 263 F32 mButtonScale;
269 264 BOOL mAutoFocus;
270 LLViewHandle mSnappedTo; 265 LLHandle<LLFloater> mSnappedTo;
271 266
272 LLViewHandle mHostHandle; 267 LLHandle<LLFloater> mHostHandle;
273 LLViewHandle mLastHostHandle; 268 LLHandle<LLFloater> mLastHostHandle;
274 269
275 static BOOL sEditModeEnabled;
276 static LLMultiFloater* sHostp; 270 static LLMultiFloater* sHostp;
271 static BOOL sEditModeEnabled;
277 static LLString sButtonActiveImageNames[BUTTON_COUNT]; 272 static LLString sButtonActiveImageNames[BUTTON_COUNT];
278 static LLString sButtonInactiveImageNames[BUTTON_COUNT]; 273 static LLString sButtonInactiveImageNames[BUTTON_COUNT];
279 static LLString sButtonPressedImageNames[BUTTON_COUNT]; 274 static LLString sButtonPressedImageNames[BUTTON_COUNT];
@@ -282,15 +277,18 @@ protected:
282 typedef void (*click_callback)(void *); 277 typedef void (*click_callback)(void *);
283 static click_callback sButtonCallbacks[BUTTON_COUNT]; 278 static click_callback sButtonCallbacks[BUTTON_COUNT];
284 279
285 typedef std::map<LLViewHandle, LLFloater*> handle_map_t; 280 typedef std::map<LLHandle<LLFloater>, LLFloater*> handle_map_t;
286 typedef std::map<LLViewHandle, LLFloater*>::iterator handle_map_iter_t; 281 typedef std::map<LLHandle<LLFloater>, LLFloater*>::iterator handle_map_iter_t;
287 static handle_map_t sFloaterMap; 282 static handle_map_t sFloaterMap;
288 283
289 std::vector<LLViewHandle> mMinimizedHiddenChildren; 284 std::vector<LLHandle<LLView> > mMinimizedHiddenChildren;
290 285
291 BOOL mHasBeenDraggedWhileMinimized; 286 BOOL mHasBeenDraggedWhileMinimized;
292 S32 mPreviousMinimizedBottom; 287 S32 mPreviousMinimizedBottom;
293 S32 mPreviousMinimizedLeft; 288 S32 mPreviousMinimizedLeft;
289
290private:
291 LLRootHandle<LLFloater> mHandle;
294}; 292};
295 293
296///////////////////////////////////////////////////////////// 294/////////////////////////////////////////////////////////////
@@ -302,14 +300,14 @@ class LLFloaterView : public LLUICtrl
302public: 300public:
303 LLFloaterView( const LLString& name, const LLRect& rect ); 301 LLFloaterView( const LLString& name, const LLRect& rect );
304 302
305 virtual EWidgetType getWidgetType() const; 303 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_FLOATER_VIEW; }
306 virtual LLString getWidgetTag() const; 304 virtual LLString getWidgetTag() const { return LL_FLOATER_VIEW_TAG; }
307 305
308 /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent); 306 /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent);
309 void reshape(S32 width, S32 height, BOOL called_from_parent, BOOL adjust_vertical); 307 void reshape(S32 width, S32 height, BOOL called_from_parent, BOOL adjust_vertical);
310 308
311 /*virtual*/ void draw(); 309 /*virtual*/ void draw();
312 /*virtual*/ const LLRect getSnapRect() const; 310 /*virtual*/ LLRect getSnapRect() const;
313 void refresh(); 311 void refresh();
314 312
315 void getNewFloaterPosition( S32* left, S32* top ); 313 void getNewFloaterPosition( S32* left, S32* top );
@@ -325,8 +323,8 @@ public:
325 void pushVisibleAll(BOOL visible, const skip_list_t& skip_list = skip_list_t()); 323 void pushVisibleAll(BOOL visible, const skip_list_t& skip_list = skip_list_t());
326 void popVisibleAll(const skip_list_t& skip_list = skip_list_t()); 324 void popVisibleAll(const skip_list_t& skip_list = skip_list_t());
327 325
328 void setCycleMode(BOOL mode); 326 void setCycleMode(BOOL mode) { mFocusCycleMode = mode; }
329 BOOL getCycleMode(); 327 BOOL getCycleMode() const { return mFocusCycleMode; }
330 void bringToFront( LLFloater* child, BOOL give_focus = TRUE ); 328 void bringToFront( LLFloater* child, BOOL give_focus = TRUE );
331 void highlightFocusedFloater(); 329 void highlightFocusedFloater();
332 void unhighlightFocusedFloater(); 330 void unhighlightFocusedFloater();
@@ -342,10 +340,6 @@ public:
342 LLFloater* getFocusedFloater(); 340 LLFloater* getFocusedFloater();
343 void syncFloaterTabOrder(); 341 void syncFloaterTabOrder();
344 342
345 // Get a floater based the handle. If this returns NULL, it is up
346 // to the caller to discard the handle.
347 LLFloater* getFloaterByHandle(LLViewHandle handle);
348
349 // Returns z order of child provided. 0 is closest, larger numbers 343 // Returns z order of child provided. 0 is closest, larger numbers
350 // are deeper in the screen. If there is no such child, the return 344 // are deeper in the screen. If there is no such child, the return
351 // value is not defined. 345 // value is not defined.
@@ -361,15 +355,16 @@ private:
361 S32 mSnapOffsetBottom; 355 S32 mSnapOffsetBottom;
362}; 356};
363 357
358// https://wiki.lindenlab.com/mediawiki/index.php?title=LLMultiFloater&oldid=81376
364class LLMultiFloater : public LLFloater 359class LLMultiFloater : public LLFloater
365{ 360{
366public: 361public:
367 LLMultiFloater(); 362 LLMultiFloater();
368 LLMultiFloater(LLTabContainerCommon::TabPosition tab_pos); 363 LLMultiFloater(LLTabContainer::TabPosition tab_pos);
369 LLMultiFloater(const LLString& name); 364 LLMultiFloater(const LLString& name);
370 LLMultiFloater(const LLString& name, const LLRect& rect, LLTabContainer::TabPosition tab_pos = LLTabContainer::TOP, BOOL auto_resize = TRUE); 365 LLMultiFloater(const LLString& name, const LLRect& rect, LLTabContainer::TabPosition tab_pos = LLTabContainer::TOP, BOOL auto_resize = TRUE);
371 LLMultiFloater(const LLString& name, const LLString& rect_control, LLTabContainer::TabPosition tab_pos = LLTabContainer::TOP, BOOL auto_resize = TRUE); 366 LLMultiFloater(const LLString& name, const LLString& rect_control, LLTabContainer::TabPosition tab_pos = LLTabContainer::TOP, BOOL auto_resize = TRUE);
372 virtual ~LLMultiFloater(); 367 virtual ~LLMultiFloater() {};
373 368
374 virtual BOOL postBuild(); 369 virtual BOOL postBuild();
375 /*virtual*/ void open(); /* Flawfinder: ignore */ 370 /*virtual*/ void open(); /* Flawfinder: ignore */
@@ -377,12 +372,12 @@ public:
377 /*virtual*/ void draw(); 372 /*virtual*/ void draw();
378 /*virtual*/ void setVisible(BOOL visible); 373 /*virtual*/ void setVisible(BOOL visible);
379 /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); 374 /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
380 /*virtual*/ EWidgetType getWidgetType() const; 375 /*virtual*/ EWidgetType getWidgetType() const { return WIDGET_TYPE_MULTI_FLOATER; }
381 /*virtual*/ LLString getWidgetTag() const; 376 /*virtual*/ LLString getWidgetTag() const { return LL_MULTI_FLOATER_TAG; };
382 377
383 virtual void setCanResize(BOOL can_resize); 378 virtual void setCanResize(BOOL can_resize);
384 virtual void growToFit(S32 content_width, S32 content_height); 379 virtual void growToFit(S32 content_width, S32 content_height);
385 virtual void addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainerCommon::eInsertionPoint insertion_point = LLTabContainerCommon::END); 380 virtual void addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END);
386 381
387 virtual void showFloater(LLFloater* floaterp); 382 virtual void showFloater(LLFloater* floaterp);
388 virtual void removeFloater(LLFloater* floaterp); 383 virtual void removeFloater(LLFloater* floaterp);
@@ -400,7 +395,7 @@ public:
400 395
401 virtual void setFloaterFlashing(LLFloater* floaterp, BOOL flashing); 396 virtual void setFloaterFlashing(LLFloater* floaterp, BOOL flashing);
402 virtual BOOL closeAllFloaters(); //Returns FALSE if the floater could not be closed due to pending confirmation dialogs 397 virtual BOOL closeAllFloaters(); //Returns FALSE if the floater could not be closed due to pending confirmation dialogs
403 void setTabContainer(LLTabContainerCommon* tab_container) { if (!mTabContainer) mTabContainer = tab_container; } 398 void setTabContainer(LLTabContainer* tab_container) { if (!mTabContainer) mTabContainer = tab_container; }
404 static void onTabSelected(void* userdata, bool); 399 static void onTabSelected(void* userdata, bool);
405 400
406 virtual void updateResizeLimits(); 401 virtual void updateResizeLimits();
@@ -414,15 +409,56 @@ protected:
414 BOOL mCanResize; 409 BOOL mCanResize;
415 }; 410 };
416 411
417 LLTabContainerCommon* mTabContainer; 412 LLTabContainer* mTabContainer;
418 413
419 typedef std::map<LLViewHandle, LLFloaterData> floater_data_map_t; 414 typedef std::map<LLHandle<LLFloater>, LLFloaterData> floater_data_map_t;
420 floater_data_map_t mFloaterDataMap; 415 floater_data_map_t mFloaterDataMap;
421 416
422 LLTabContainerCommon::TabPosition mTabPos; 417 LLTabContainer::TabPosition mTabPos;
423 BOOL mAutoResize; 418 BOOL mAutoResize;
424}; 419};
425 420
421// visibility policy specialized for floaters
422template<>
423class VisibilityPolicy<LLFloater>
424{
425public:
426 // visibility methods
427 static bool visible(LLFloater* instance, const LLSD& key)
428 {
429 if (instance)
430 {
431 return !instance->isMinimized() && instance->isInVisibleChain();
432 }
433 return FALSE;
434 }
435
436 static void show(LLFloater* instance, const LLSD& key)
437 {
438 if (instance)
439 {
440 instance->open();
441 if (instance->getHost())
442 {
443 instance->getHost()->open();
444 }
445 }
446 }
447
448 static void hide(LLFloater* instance, const LLSD& key)
449 {
450 if (instance) instance->close();
451 }
452};
453
454
455// singleton implementation for floaters (provides visibility policy)
456// https://wiki.lindenlab.com/mediawiki/index.php?title=LLFloaterSingleton&oldid=79410
457
458template <class T> class LLFloaterSingleton : public LLUISingleton<T, VisibilityPolicy<LLFloater> >
459{
460};
461
426 462
427extern LLFloaterView* gFloaterView; 463extern LLFloaterView* gFloaterView;
428 464
diff --git a/linden/indra/llui/llfocusmgr.cpp b/linden/indra/llui/llfocusmgr.cpp
index efca3d8..0634513 100644
--- a/linden/indra/llui/llfocusmgr.cpp
+++ b/linden/indra/llui/llfocusmgr.cpp
@@ -57,12 +57,8 @@ LLFocusMgr::LLFocusMgr()
57{ 57{
58} 58}
59 59
60LLFocusMgr::~LLFocusMgr()
61{
62 mFocusHistory.clear();
63}
64 60
65void LLFocusMgr::releaseFocusIfNeeded( LLView* view ) 61void LLFocusMgr::releaseFocusIfNeeded( const LLView* view )
66{ 62{
67 if( childHasMouseCapture( view ) ) 63 if( childHasMouseCapture( view ) )
68 { 64 {
@@ -146,7 +142,7 @@ void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock)
146 142
147 if (focus_subtree) 143 if (focus_subtree)
148 { 144 {
149 mFocusHistory[focus_subtree->mViewHandle] = mKeyboardFocus ? mKeyboardFocus->mViewHandle : LLViewHandle::sDeadHandle; 145 mFocusHistory[focus_subtree->getHandle()] = mKeyboardFocus ? mKeyboardFocus->getHandle() : LLHandle<LLView>();
150 } 146 }
151 } 147 }
152 148
@@ -156,10 +152,6 @@ void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock)
156 } 152 }
157} 153}
158 154
159void LLFocusMgr::setDefaultKeyboardFocus(LLUICtrl* default_focus)
160{
161 mDefaultKeyboardFocus = default_focus;
162}
163 155
164// Returns TRUE is parent or any descedent of parent has keyboard focus. 156// Returns TRUE is parent or any descedent of parent has keyboard focus.
165BOOL LLFocusMgr::childHasKeyboardFocus(const LLView* parent ) const 157BOOL LLFocusMgr::childHasKeyboardFocus(const LLView* parent ) const
@@ -177,7 +169,7 @@ BOOL LLFocusMgr::childHasKeyboardFocus(const LLView* parent ) const
177} 169}
178 170
179// Returns TRUE is parent or any descedent of parent is the mouse captor. 171// Returns TRUE is parent or any descedent of parent is the mouse captor.
180BOOL LLFocusMgr::childHasMouseCapture( LLView* parent ) 172BOOL LLFocusMgr::childHasMouseCapture( const LLView* parent ) const
181{ 173{
182 if( mMouseCaptor && mMouseCaptor->isView() ) 174 if( mMouseCaptor && mMouseCaptor->isView() )
183 { 175 {
@@ -194,7 +186,7 @@ BOOL LLFocusMgr::childHasMouseCapture( LLView* parent )
194 return FALSE; 186 return FALSE;
195} 187}
196 188
197void LLFocusMgr::removeKeyboardFocusWithoutCallback( LLView* focus ) 189void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLView* focus )
198{ 190{
199 // should be ok to unlock here, as you have to know the locked view 191 // should be ok to unlock here, as you have to know the locked view
200 // in order to unlock it 192 // in order to unlock it
@@ -253,7 +245,7 @@ void LLFocusMgr::setMouseCapture( LLMouseHandler* new_captor )
253 } 245 }
254} 246}
255 247
256void LLFocusMgr::removeMouseCaptureWithoutCallback( LLMouseHandler* captor ) 248void LLFocusMgr::removeMouseCaptureWithoutCallback( const LLMouseHandler* captor )
257{ 249{
258 //if (mFocusLocked) 250 //if (mFocusLocked)
259 //{ 251 //{
@@ -269,7 +261,7 @@ void LLFocusMgr::removeMouseCaptureWithoutCallback( LLMouseHandler* captor )
269} 261}
270 262
271 263
272BOOL LLFocusMgr::childIsTopCtrl( LLView* parent ) 264BOOL LLFocusMgr::childIsTopCtrl( const LLView* parent ) const
273{ 265{
274 LLView* top_view = (LLView*)mTopCtrl; 266 LLView* top_view = (LLView*)mTopCtrl;
275 while( top_view ) 267 while( top_view )
@@ -304,7 +296,7 @@ void LLFocusMgr::setTopCtrl( LLUICtrl* new_top )
304 } 296 }
305} 297}
306 298
307void LLFocusMgr::removeTopCtrlWithoutCallback( LLUICtrl* top_view ) 299void LLFocusMgr::removeTopCtrlWithoutCallback( const LLUICtrl* top_view )
308{ 300{
309 if( mTopCtrl == top_view ) 301 if( mTopCtrl == top_view )
310 { 302 {
@@ -325,12 +317,12 @@ void LLFocusMgr::unlockFocus()
325 mLockedView = NULL; 317 mLockedView = NULL;
326} 318}
327 319
328F32 LLFocusMgr::getFocusFlashAmt() 320F32 LLFocusMgr::getFocusFlashAmt() const
329{ 321{
330 return clamp_rescale(getFocusTime(), 0.f, FOCUS_FADE_TIME, mFocusWeight, 0.f); 322 return clamp_rescale(getFocusTime(), 0.f, FOCUS_FADE_TIME, mFocusWeight, 0.f);
331} 323}
332 324
333LLColor4 LLFocusMgr::getFocusColor() 325LLColor4 LLFocusMgr::getFocusColor() const
334{ 326{
335 LLColor4 focus_color = lerp(LLUI::sColorsGroup->getColor( "FocusColor" ), LLColor4::white, getFocusFlashAmt()); 327 LLColor4 focus_color = lerp(LLUI::sColorsGroup->getColor( "FocusColor" ), LLColor4::white, getFocusFlashAmt());
336 // de-emphasize keyboard focus when app has lost focus (to avoid typing into wrong window problem) 328 // de-emphasize keyboard focus when app has lost focus (to avoid typing into wrong window problem)
@@ -362,15 +354,15 @@ void LLFocusMgr::setAppHasFocus(BOOL focus)
362 mAppHasFocus = focus; 354 mAppHasFocus = focus;
363} 355}
364 356
365LLUICtrl* LLFocusMgr::getLastFocusForGroup(LLView* subtree_root) 357LLUICtrl* LLFocusMgr::getLastFocusForGroup(LLView* subtree_root) const
366{ 358{
367 if (subtree_root) 359 if (subtree_root)
368 { 360 {
369 focus_history_map_t::iterator found_it = mFocusHistory.find(subtree_root->mViewHandle); 361 focus_history_map_t::const_iterator found_it = mFocusHistory.find(subtree_root->getHandle());
370 if (found_it != mFocusHistory.end()) 362 if (found_it != mFocusHistory.end())
371 { 363 {
372 // found last focus for this subtree 364 // found last focus for this subtree
373 return static_cast<LLUICtrl*>(LLView::getViewByHandle(found_it->second)); 365 return static_cast<LLUICtrl*>(found_it->second.get());
374 } 366 }
375 } 367 }
376 return NULL; 368 return NULL;
@@ -380,6 +372,6 @@ void LLFocusMgr::clearLastFocusForGroup(LLView* subtree_root)
380{ 372{
381 if (subtree_root) 373 if (subtree_root)
382 { 374 {
383 mFocusHistory.erase(subtree_root->mViewHandle); 375 mFocusHistory.erase(subtree_root->getHandle());
384 } 376 }
385} 377}
diff --git a/linden/indra/llui/llfocusmgr.h b/linden/indra/llui/llfocusmgr.h
index 3bd5b35..842c874 100644
--- a/linden/indra/llui/llfocusmgr.h
+++ b/linden/indra/llui/llfocusmgr.h
@@ -45,48 +45,48 @@ class LLFocusMgr
45{ 45{
46public: 46public:
47 LLFocusMgr(); 47 LLFocusMgr();
48 ~LLFocusMgr(); 48 ~LLFocusMgr() { mFocusHistory.clear(); }
49 49
50 // Mouse Captor 50 // Mouse Captor
51 void setMouseCapture(LLMouseHandler* new_captor); // new_captor = NULL to release the mouse. 51 void setMouseCapture(LLMouseHandler* new_captor); // new_captor = NULL to release the mouse.
52 LLMouseHandler* getMouseCapture() { return mMouseCaptor; } 52 LLMouseHandler* getMouseCapture() const { return mMouseCaptor; }
53 void removeMouseCaptureWithoutCallback( LLMouseHandler* captor ); 53 void removeMouseCaptureWithoutCallback( const LLMouseHandler* captor );
54 BOOL childHasMouseCapture( LLView* parent ); 54 BOOL childHasMouseCapture( const LLView* parent ) const;
55 55
56 // Keyboard Focus 56 // Keyboard Focus
57 void setKeyboardFocus(LLUICtrl* new_focus, BOOL lock = FALSE); // new_focus = NULL to release the focus. 57 void setKeyboardFocus(LLUICtrl* new_focus, BOOL lock = FALSE); // new_focus = NULL to release the focus.
58 LLUICtrl* getKeyboardFocus() const { return mKeyboardFocus; } 58 LLUICtrl* getKeyboardFocus() const { return mKeyboardFocus; }
59 LLUICtrl* getLastKeyboardFocus() const { return mLastKeyboardFocus; } 59 LLUICtrl* getLastKeyboardFocus() const { return mLastKeyboardFocus; }
60 BOOL childHasKeyboardFocus( const LLView* parent ) const; 60 BOOL childHasKeyboardFocus( const LLView* parent ) const;
61 void removeKeyboardFocusWithoutCallback( LLView* focus ); 61 void removeKeyboardFocusWithoutCallback( const LLView* focus );
62 F32 getFocusTime() const { return mFocusTimer.getElapsedTimeF32(); } 62 F32 getFocusTime() const { return mFocusTimer.getElapsedTimeF32(); }
63 F32 getFocusFlashAmt(); 63 F32 getFocusFlashAmt() const;
64 LLColor4 getFocusColor(); 64 LLColor4 getFocusColor() const;
65 void triggerFocusFlash(); 65 void triggerFocusFlash();
66 BOOL getAppHasFocus() { return mAppHasFocus; } 66 BOOL getAppHasFocus() const { return mAppHasFocus; }
67 void setAppHasFocus(BOOL focus); 67 void setAppHasFocus(BOOL focus);
68 LLUICtrl* getLastFocusForGroup(LLView* subtree_root); 68 LLUICtrl* getLastFocusForGroup(LLView* subtree_root) const;
69 void clearLastFocusForGroup(LLView* subtree_root); 69 void clearLastFocusForGroup(LLView* subtree_root);
70 70
71 // If setKeyboardFocus(NULL) is called, and there is a non-NULL default 71 // If setKeyboardFocus(NULL) is called, and there is a non-NULL default
72 // keyboard focus view, focus goes there. JC 72 // keyboard focus view, focus goes there. JC
73 void setDefaultKeyboardFocus(LLUICtrl* default_focus); 73 void setDefaultKeyboardFocus(LLUICtrl* default_focus) { mDefaultKeyboardFocus = default_focus; }
74 LLUICtrl* getDefaultKeyboardFocus() const { return mDefaultKeyboardFocus; } 74 LLUICtrl* getDefaultKeyboardFocus() const { return mDefaultKeyboardFocus; }
75 75
76 76
77 // Top View 77 // Top View
78 void setTopCtrl(LLUICtrl* new_top); 78 void setTopCtrl(LLUICtrl* new_top);
79 LLUICtrl* getTopCtrl() const { return mTopCtrl; } 79 LLUICtrl* getTopCtrl() const { return mTopCtrl; }
80 void removeTopCtrlWithoutCallback( LLUICtrl* top_view ); 80 void removeTopCtrlWithoutCallback( const LLUICtrl* top_view );
81 BOOL childIsTopCtrl( LLView* parent ); 81 BOOL childIsTopCtrl( const LLView* parent ) const;
82 82
83 // All Three 83 // All Three
84 void releaseFocusIfNeeded( LLView* top_view ); 84 void releaseFocusIfNeeded( const LLView* top_view );
85 void lockFocus(); 85 void lockFocus();
86 void unlockFocus(); 86 void unlockFocus();
87 BOOL focusLocked() { return mLockedView != NULL; } 87 BOOL focusLocked() const { return mLockedView != NULL; }
88 88
89protected: 89private:
90 LLUICtrl* mLockedView; 90 LLUICtrl* mLockedView;
91 91
92 // Mouse Captor 92 // Mouse Captor
@@ -105,7 +105,7 @@ protected:
105 105
106 BOOL mAppHasFocus; 106 BOOL mAppHasFocus;
107 107
108 typedef std::map<LLViewHandle, LLViewHandle> focus_history_map_t; 108 typedef std::map<LLHandle<LLView>, LLHandle<LLView> > focus_history_map_t;
109 focus_history_map_t mFocusHistory; 109 focus_history_map_t mFocusHistory;
110 110
111 #ifdef _DEBUG 111 #ifdef _DEBUG
@@ -119,3 +119,4 @@ extern LLFocusMgr gFocusMgr;
119 119
120#endif // LL_LLFOCUSMGR_H 120#endif // LL_LLFOCUSMGR_H
121 121
122
diff --git a/linden/indra/llui/lliconctrl.cpp b/linden/indra/llui/lliconctrl.cpp
index 79982c6..6a1d77c 100644
--- a/linden/indra/llui/lliconctrl.cpp
+++ b/linden/indra/llui/lliconctrl.cpp
@@ -91,8 +91,8 @@ void LLIconCtrl::draw()
91 if( mImagep.notNull() ) 91 if( mImagep.notNull() )
92 { 92 {
93 mImagep->draw(0, 0, 93 mImagep->draw(0, 0,
94 mRect.getWidth(), mRect.getHeight(), 94 getRect().getWidth(), getRect().getHeight(),
95 mColor ); 95 mColor );
96 } 96 }
97 97
98 LLUICtrl::draw(); 98 LLUICtrl::draw();
diff --git a/linden/indra/llui/lliconctrl.h b/linden/indra/llui/lliconctrl.h
index f767b3c..b0c191f 100644
--- a/linden/indra/llui/lliconctrl.h
+++ b/linden/indra/llui/lliconctrl.h
@@ -69,7 +69,7 @@ public:
69 virtual LLXMLNodePtr getXML(bool save_children = true) const; 69 virtual LLXMLNodePtr getXML(bool save_children = true) const;
70 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 70 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
71 71
72protected: 72private:
73 LLColor4 mColor; 73 LLColor4 mColor;
74 LLString mImageName; 74 LLString mImageName;
75 LLUUID mImageID; 75 LLUUID mImageID;
diff --git a/linden/indra/llui/llkeywords.cpp b/linden/indra/llui/llkeywords.cpp
index 1d157d2..d5d0d23 100644
--- a/linden/indra/llui/llkeywords.cpp
+++ b/linden/indra/llui/llkeywords.cpp
@@ -41,7 +41,7 @@
41 41
42const U32 KEYWORD_FILE_CURRENT_VERSION = 2; 42const U32 KEYWORD_FILE_CURRENT_VERSION = 2;
43 43
44inline BOOL LLKeywordToken::isHead(const llwchar* s) 44inline BOOL LLKeywordToken::isHead(const llwchar* s) const
45{ 45{
46 // strncmp is much faster than string compare 46 // strncmp is much faster than string compare
47 BOOL res = TRUE; 47 BOOL res = TRUE;
diff --git a/linden/indra/llui/llkeywords.h b/linden/indra/llui/llkeywords.h
index d5d7302..61c3c57 100644
--- a/linden/indra/llui/llkeywords.h
+++ b/linden/indra/llui/llkeywords.h
@@ -56,11 +56,12 @@ public:
56 { 56 {
57 } 57 }
58 58
59 S32 getLength() { return mToken.size(); } 59 S32 getLength() const { return mToken.size(); }
60 BOOL isHead(const llwchar* s); 60 BOOL isHead(const llwchar* s) const;
61 const LLColor3& getColor() { return mColor; } 61 const LLWString& getToken() const { return mToken; }
62 TOKEN_TYPE getType() { return mType; } 62 const LLColor3& getColor() const { return mColor; }
63 const LLWString& getToolTip() { return mToolTip; } 63 TOKEN_TYPE getType() const { return mType; }
64 const LLWString& getToolTip() const { return mToolTip; }
64 65
65#ifdef _DEBUG 66#ifdef _DEBUG
66 void dump(); 67 void dump();
@@ -68,10 +69,8 @@ public:
68 69
69private: 70private:
70 TOKEN_TYPE mType; 71 TOKEN_TYPE mType;
71public:
72 LLWString mToken; 72 LLWString mToken;
73 LLColor3 mColor; 73 LLColor3 mColor;
74private:
75 LLWString mToolTip; 74 LLWString mToolTip;
76}; 75};
77 76
@@ -82,30 +81,31 @@ public:
82 ~LLKeywords(); 81 ~LLKeywords();
83 82
84 BOOL loadFromFile(const LLString& filename); 83 BOOL loadFromFile(const LLString& filename);
85 BOOL isLoaded() { return mLoaded; } 84 BOOL isLoaded() const { return mLoaded; }
86 85
87 void findSegments(std::vector<LLTextSegment *> *seg_list, const LLWString& text, const LLColor4 &defaultColor ); 86 void findSegments(std::vector<LLTextSegment *> *seg_list, const LLWString& text, const LLColor4 &defaultColor );
88 87
89#ifdef _DEBUG
90 void dump();
91#endif
92
93 // Add the token as described 88 // Add the token as described
94 void addToken(LLKeywordToken::TOKEN_TYPE type, 89 void addToken(LLKeywordToken::TOKEN_TYPE type,
95 const LLString& key, 90 const LLString& key,
96 const LLColor3& color, 91 const LLColor3& color,
97 const LLString& tool_tip = LLString::null); 92 const LLString& tool_tip = LLString::null);
98 93
94 typedef std::map<LLWString, LLKeywordToken*> word_token_map_t;
95 typedef word_token_map_t::const_iterator keyword_iterator_t;
96 keyword_iterator_t begin() const { return mWordTokenMap.begin(); }
97 keyword_iterator_t end() const { return mWordTokenMap.end(); }
98
99#ifdef _DEBUG
100 void dump();
101#endif
102
99private: 103private:
100 LLColor3 readColor(const LLString& s); 104 LLColor3 readColor(const LLString& s);
101 void insertSegment(std::vector<LLTextSegment *> *seg_list, LLTextSegment* new_segment, S32 text_len, const LLColor4 &defaultColor); 105 void insertSegment(std::vector<LLTextSegment *> *seg_list, LLTextSegment* new_segment, S32 text_len, const LLColor4 &defaultColor);
102 106
103private: 107 BOOL mLoaded;
104 BOOL mLoaded;
105public:
106 typedef std::map<LLWString, LLKeywordToken*> word_token_map_t;
107 word_token_map_t mWordTokenMap; 108 word_token_map_t mWordTokenMap;
108private:
109 typedef std::deque<LLKeywordToken*> token_list_t; 109 typedef std::deque<LLKeywordToken*> token_list_t;
110 token_list_t mLineTokenList; 110 token_list_t mLineTokenList;
111 token_list_t mDelimiterTokenList; 111 token_list_t mDelimiterTokenList;
diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp
index b091bb7..1c96bc4 100644
--- a/linden/indra/llui/lllineeditor.cpp
+++ b/linden/indra/llui/lllineeditor.cpp
@@ -81,44 +81,6 @@ const S32 PREEDIT_STANDOUT_GAP = 1;
81const S32 PREEDIT_STANDOUT_POSITION = 2; 81const S32 PREEDIT_STANDOUT_POSITION = 2;
82const S32 PREEDIT_STANDOUT_THICKNESS = 2; 82const S32 PREEDIT_STANDOUT_THICKNESS = 2;
83 83
84// This is a friend class of and is only used by LLLineEditor
85class LLLineEditorRollback
86{
87public:
88 LLLineEditorRollback( LLLineEditor* ed )
89 :
90 mCursorPos( ed->mCursorPos ),
91 mScrollHPos( ed->mScrollHPos ),
92 mIsSelecting( ed->mIsSelecting ),
93 mSelectionStart( ed->mSelectionStart ),
94 mSelectionEnd( ed->mSelectionEnd )
95 {
96 mText = ed->getText();
97 }
98
99 void doRollback( LLLineEditor* ed )
100 {
101 ed->mCursorPos = mCursorPos;
102 ed->mScrollHPos = mScrollHPos;
103 ed->mIsSelecting = mIsSelecting;
104 ed->mSelectionStart = mSelectionStart;
105 ed->mSelectionEnd = mSelectionEnd;
106 ed->mText = mText;
107 ed->mPrevText = mText;
108 }
109
110 LLString getText() { return mText; }
111
112private:
113 LLString mText;
114 S32 mCursorPos;
115 S32 mScrollHPos;
116 BOOL mIsSelecting;
117 S32 mSelectionStart;
118 S32 mSelectionEnd;
119};
120
121
122// 84//
123// Member functions 85// Member functions
124// 86//
@@ -190,7 +152,7 @@ LLLineEditor::LLLineEditor(const LLString& name, const LLRect& rect,
190 setFocusLostCallback(focus_lost_callback); 152 setFocusLostCallback(focus_lost_callback);
191 153
192 mMinHPixels = mBorderThickness + UI_LINEEDITOR_H_PAD + mBorderLeft; 154 mMinHPixels = mBorderThickness + UI_LINEEDITOR_H_PAD + mBorderLeft;
193 mMaxHPixels = mRect.getWidth() - mMinHPixels - mBorderThickness - mBorderRight; 155 mMaxHPixels = getRect().getWidth() - mMinHPixels - mBorderThickness - mBorderRight;
194 156
195 mScrollTimer.reset(); 157 mScrollTimer.reset();
196 158
@@ -200,7 +162,7 @@ LLLineEditor::LLLineEditor(const LLString& name, const LLRect& rect,
200 162
201 // Scalable UI somehow made these rectangles off-by-one. 163 // Scalable UI somehow made these rectangles off-by-one.
202 // I don't know why. JC 164 // I don't know why. JC
203 LLRect border_rect(0, mRect.getHeight()-1, mRect.getWidth()-1, 0); 165 LLRect border_rect(0, getRect().getHeight()-1, getRect().getWidth()-1, 0);
204 mBorder = new LLViewBorder( "line ed border", border_rect, border_bevel, border_style, mBorderThickness ); 166 mBorder = new LLViewBorder( "line ed border", border_rect, border_bevel, border_style, mBorderThickness );
205 addChild( mBorder ); 167 addChild( mBorder );
206 mBorder->setFollows(FOLLOWS_LEFT|FOLLOWS_RIGHT|FOLLOWS_TOP|FOLLOWS_BOTTOM); 168 mBorder->setFollows(FOLLOWS_LEFT|FOLLOWS_RIGHT|FOLLOWS_TOP|FOLLOWS_BOTTOM);
@@ -219,17 +181,6 @@ LLLineEditor::~LLLineEditor()
219 } 181 }
220} 182}
221 183
222//virtual
223EWidgetType LLLineEditor::getWidgetType() const
224{
225 return WIDGET_TYPE_LINE_EDITOR;
226}
227
228//virtual
229LLString LLLineEditor::getWidgetTag() const
230{
231 return LL_LINE_EDITOR_TAG;
232}
233 184
234void LLLineEditor::onFocusReceived() 185void LLLineEditor::onFocusReceived()
235{ 186{
@@ -269,18 +220,6 @@ void LLLineEditor::onCommit()
269 selectAll(); 220 selectAll();
270} 221}
271 222
272// virtual
273BOOL LLLineEditor::isDirty() const
274{
275 return ( mText.getString() != mPrevText );
276}
277
278// virtual
279void LLLineEditor::resetDirty()
280{
281 mPrevText = mText.getString();
282}
283
284 223
285// line history support 224// line history support
286void LLLineEditor::updateHistory() 225void LLLineEditor::updateHistory()
@@ -306,12 +245,7 @@ void LLLineEditor::reshape(S32 width, S32 height, BOOL called_from_parent)
306{ 245{
307 LLUICtrl::reshape(width, height, called_from_parent ); 246 LLUICtrl::reshape(width, height, called_from_parent );
308 247
309 mMaxHPixels = mRect.getWidth() - 2 * (mBorderThickness + UI_LINEEDITOR_H_PAD) + 1 - mBorderRight; 248 mMaxHPixels = getRect().getWidth() - 2 * (mBorderThickness + UI_LINEEDITOR_H_PAD) + 1 - mBorderRight;
310}
311
312void LLLineEditor::setEnableLineHistory( BOOL enabled )
313{
314 mHaveHistory = enabled;
315} 249}
316 250
317void LLLineEditor::setEnabled(BOOL enabled) 251void LLLineEditor::setEnabled(BOOL enabled)
@@ -330,16 +264,12 @@ void LLLineEditor::setMaxTextLength(S32 max_text_length)
330 264
331void LLLineEditor::setBorderWidth(S32 left, S32 right) 265void LLLineEditor::setBorderWidth(S32 left, S32 right)
332{ 266{
333 mBorderLeft = llclamp(left, 0, mRect.getWidth()); 267 mBorderLeft = llclamp(left, 0, getRect().getWidth());
334 mBorderRight = llclamp(right, 0, mRect.getWidth()); 268 mBorderRight = llclamp(right, 0, getRect().getWidth());
335 mMinHPixels = mBorderThickness + UI_LINEEDITOR_H_PAD + mBorderLeft; 269 mMinHPixels = mBorderThickness + UI_LINEEDITOR_H_PAD + mBorderLeft;
336 mMaxHPixels = mRect.getWidth() - mMinHPixels - mBorderThickness - mBorderRight; 270 mMaxHPixels = getRect().getWidth() - mMinHPixels - mBorderThickness - mBorderRight;
337} 271}
338 272
339void LLLineEditor::setLabel(const LLStringExplicit &new_label)
340{
341 mLabel = new_label;
342}
343 273
344void LLLineEditor::setText(const LLStringExplicit &new_text) 274void LLLineEditor::setText(const LLStringExplicit &new_text)
345{ 275{
@@ -451,12 +381,11 @@ void LLLineEditor::setCursorToEnd()
451 deselect(); 381 deselect();
452} 382}
453 383
454BOOL LLLineEditor::canDeselect() 384BOOL LLLineEditor::canDeselect() const
455{ 385{
456 return hasSelection(); 386 return hasSelection();
457} 387}
458 388
459
460void LLLineEditor::deselect() 389void LLLineEditor::deselect()
461{ 390{
462 mSelectionStart = 0; 391 mSelectionStart = 0;
@@ -481,7 +410,7 @@ void LLLineEditor::endSelection()
481 } 410 }
482} 411}
483 412
484BOOL LLLineEditor::canSelectAll() 413BOOL LLLineEditor::canSelectAll() const
485{ 414{
486 return TRUE; 415 return TRUE;
487} 416}
@@ -554,7 +483,7 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
554 483
555BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) 484BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask)
556{ 485{
557 if (x < mBorderLeft || x > (mRect.getWidth() - mBorderRight)) 486 if (x < mBorderLeft || x > (getRect().getWidth() - mBorderRight))
558 { 487 {
559 return LLUICtrl::handleMouseDown(x, y, mask); 488 return LLUICtrl::handleMouseDown(x, y, mask);
560 } 489 }
@@ -634,7 +563,7 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask)
634BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) 563BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask)
635{ 564{
636 BOOL handled = FALSE; 565 BOOL handled = FALSE;
637 if (!hasMouseCapture() && (x < mBorderLeft || x > (mRect.getWidth() - mBorderRight))) 566 if (!hasMouseCapture() && (x < mBorderLeft || x > (getRect().getWidth() - mBorderRight)))
638 { 567 {
639 return LLUICtrl::handleHover(x, y, mask); 568 return LLUICtrl::handleHover(x, y, mask);
640 } 569 }
@@ -705,7 +634,7 @@ BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask)
705 handled = TRUE; 634 handled = TRUE;
706 } 635 }
707 636
708 if (!handled && (x < mBorderLeft || x > (mRect.getWidth() - mBorderRight))) 637 if (!handled && (x < mBorderLeft || x > (getRect().getWidth() - mBorderRight)))
709 { 638 {
710 return LLUICtrl::handleMouseUp(x, y, mask); 639 return LLUICtrl::handleMouseUp(x, y, mask);
711 } 640 }
@@ -856,11 +785,6 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
856 switch( key ) 785 switch( key )
857 { 786 {
858 case KEY_LEFT: 787 case KEY_LEFT:
859 if (mIgnoreArrowKeys)
860 {
861 handled = FALSE;
862 break;
863 }
864 if( 0 < getCursor() ) 788 if( 0 < getCursor() )
865 { 789 {
866 S32 cursorPos = getCursor() - 1; 790 S32 cursorPos = getCursor() - 1;
@@ -877,11 +801,6 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
877 break; 801 break;
878 802
879 case KEY_RIGHT: 803 case KEY_RIGHT:
880 if (mIgnoreArrowKeys)
881 {
882 handled = FALSE;
883 break;
884 }
885 if( getCursor() < mText.length()) 804 if( getCursor() < mText.length())
886 { 805 {
887 S32 cursorPos = getCursor() + 1; 806 S32 cursorPos = getCursor() + 1;
@@ -899,22 +818,12 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
899 818
900 case KEY_PAGE_UP: 819 case KEY_PAGE_UP:
901 case KEY_HOME: 820 case KEY_HOME:
902 if (mIgnoreArrowKeys)
903 {
904 handled = FALSE;
905 break;
906 }
907 extendSelection( 0 ); 821 extendSelection( 0 );
908 break; 822 break;
909 823
910 case KEY_PAGE_DOWN: 824 case KEY_PAGE_DOWN:
911 case KEY_END: 825 case KEY_END:
912 { 826 {
913 if (mIgnoreArrowKeys)
914 {
915 handled = FALSE;
916 break;
917 }
918 S32 len = mText.length(); 827 S32 len = mText.length();
919 if( len ) 828 if( len )
920 { 829 {
@@ -962,7 +871,7 @@ void LLLineEditor::deleteSelection()
962 } 871 }
963} 872}
964 873
965BOOL LLLineEditor::canCut() 874BOOL LLLineEditor::canCut() const
966{ 875{
967 return !mReadOnly && !mDrawAsterixes && hasSelection(); 876 return !mReadOnly && !mDrawAsterixes && hasSelection();
968} 877}
@@ -996,7 +905,7 @@ void LLLineEditor::cut()
996 } 905 }
997} 906}
998 907
999BOOL LLLineEditor::canCopy() 908BOOL LLLineEditor::canCopy() const
1000{ 909{
1001 return !mDrawAsterixes && hasSelection(); 910 return !mDrawAsterixes && hasSelection();
1002} 911}
@@ -1013,7 +922,7 @@ void LLLineEditor::copy()
1013 } 922 }
1014} 923}
1015 924
1016BOOL LLLineEditor::canPaste() 925BOOL LLLineEditor::canPaste() const
1017{ 926{
1018 return !mReadOnly && gClipboard.canPasteString(); 927 return !mReadOnly && gClipboard.canPasteString();
1019} 928}
@@ -1148,8 +1057,9 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
1148 break; 1057 break;
1149 1058
1150 case KEY_LEFT: 1059 case KEY_LEFT:
1151 if (!mIgnoreArrowKeys 1060 if (mIgnoreArrowKeys && mask == MASK_NONE)
1152 && mask != MASK_ALT) 1061 break;
1062 if ((mask & MASK_ALT) == 0)
1153 { 1063 {
1154 if( hasSelection() ) 1064 if( hasSelection() )
1155 { 1065 {
@@ -1174,8 +1084,9 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
1174 break; 1084 break;
1175 1085
1176 case KEY_RIGHT: 1086 case KEY_RIGHT:
1177 if (!mIgnoreArrowKeys 1087 if (mIgnoreArrowKeys && mask == MASK_NONE)
1178 && mask != MASK_ALT) 1088 break;
1089 if ((mask & MASK_ALT) == 0)
1179 { 1090 {
1180 if (hasSelection()) 1091 if (hasSelection())
1181 { 1092 {
@@ -1428,7 +1339,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_pare
1428} 1339}
1429 1340
1430 1341
1431BOOL LLLineEditor::canDoDelete() 1342BOOL LLLineEditor::canDoDelete() const
1432{ 1343{
1433 return ( !mReadOnly && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) ); 1344 return ( !mReadOnly && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) );
1434} 1345}
@@ -1490,7 +1401,7 @@ void LLLineEditor::draw()
1490 } 1401 }
1491 1402
1492 // draw rectangle for the background 1403 // draw rectangle for the background
1493 LLRect background( 0, mRect.getHeight(), mRect.getWidth(), 0 ); 1404 LLRect background( 0, getRect().getHeight(), getRect().getWidth(), 0 );
1494 background.stretch( -mBorderThickness ); 1405 background.stretch( -mBorderThickness );
1495 1406
1496 LLColor4 bg_color = mReadOnlyBgColor; 1407 LLColor4 bg_color = mReadOnlyBgColor;
@@ -1521,7 +1432,7 @@ void LLLineEditor::draw()
1521 LLColor4 text_color; 1432 LLColor4 text_color;
1522 if (!mReadOnly) 1433 if (!mReadOnly)
1523 { 1434 {
1524 if (!mTentative) 1435 if (!getTentative())
1525 { 1436 {
1526 text_color = mFgColor; 1437 text_color = mFgColor;
1527 } 1438 }
@@ -1846,7 +1757,7 @@ BOOL LLLineEditor::prevalidateFloat(const LLWString &str)
1846 if( 0 < len ) 1757 if( 0 < len )
1847 { 1758 {
1848 // May be a comma or period, depending on the locale 1759 // May be a comma or period, depending on the locale
1849 char decimal_point = gResMgr->getDecimalPoint(); 1760 llwchar decimal_point = (llwchar)gResMgr->getDecimalPoint();
1850 1761
1851 S32 i = 0; 1762 S32 i = 0;
1852 1763
@@ -1895,7 +1806,7 @@ BOOL LLLineEditor::postvalidateFloat(const LLString &str)
1895 } 1806 }
1896 1807
1897 // May be a comma or period, depending on the locale 1808 // May be a comma or period, depending on the locale
1898 char decimal_point = gResMgr->getDecimalPoint(); 1809 llwchar decimal_point = (llwchar)gResMgr->getDecimalPoint();
1899 1810
1900 for( ; i < len; i++ ) 1811 for( ; i < len; i++ )
1901 { 1812 {
@@ -2366,18 +2277,6 @@ void LLLineEditor::setColorParameters(LLXMLNodePtr node)
2366 } 2277 }
2367} 2278}
2368 2279
2369void LLLineEditor::setValue(const LLSD& value )
2370{
2371 setText(value.asString());
2372}
2373
2374LLSD LLLineEditor::getValue() const
2375{
2376 LLString str = getText();
2377 LLSD ret(str);
2378 return ret;
2379}
2380
2381BOOL LLLineEditor::setTextArg( const LLString& key, const LLStringExplicit& text ) 2280BOOL LLLineEditor::setTextArg( const LLString& key, const LLStringExplicit& text )
2382{ 2281{
2383 mText.setArg(key, text); 2282 mText.setArg(key, text);
@@ -2492,7 +2391,7 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
2492 if (control) 2391 if (control)
2493 { 2392 {
2494 LLRect control_rect_screen; 2393 LLRect control_rect_screen;
2495 localRectToScreen(mRect, &control_rect_screen); 2394 localRectToScreen(getRect(), &control_rect_screen);
2496 LLUI::screenRectToGL(control_rect_screen, control); 2395 LLUI::screenRectToGL(control_rect_screen, control);
2497 } 2396 }
2498 2397
@@ -2522,21 +2421,21 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
2522 { 2421 {
2523 S32 query_local = findPixelNearestPos(query - getCursor()); 2422 S32 query_local = findPixelNearestPos(query - getCursor());
2524 S32 query_screen_x, query_screen_y; 2423 S32 query_screen_x, query_screen_y;
2525 localPointToScreen(query_local, mRect.getHeight() / 2, &query_screen_x, &query_screen_y); 2424 localPointToScreen(query_local, getRect().getHeight() / 2, &query_screen_x, &query_screen_y);
2526 LLUI::screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY); 2425 LLUI::screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY);
2527 } 2426 }
2528 2427
2529 if (bounds) 2428 if (bounds)
2530 { 2429 {
2531 S32 preedit_left_local = findPixelNearestPos(llmax(preedit_left_column, mScrollHPos) - getCursor()); 2430 S32 preedit_left_local = findPixelNearestPos(llmax(preedit_left_column, mScrollHPos) - getCursor());
2532 S32 preedit_right_local = llmin(findPixelNearestPos(preedit_right_column - getCursor()), mRect.getWidth() - mBorderThickness); 2431 S32 preedit_right_local = llmin(findPixelNearestPos(preedit_right_column - getCursor()), getRect().getWidth() - mBorderThickness);
2533 if (preedit_left_local > preedit_right_local) 2432 if (preedit_left_local > preedit_right_local)
2534 { 2433 {
2535 // Is this condition possible? 2434 // Is this condition possible?
2536 preedit_right_local = preedit_left_local; 2435 preedit_right_local = preedit_left_local;
2537 } 2436 }
2538 2437
2539 LLRect preedit_rect_local(preedit_left_local, mRect.getHeight(), preedit_right_local, 0); 2438 LLRect preedit_rect_local(preedit_left_local, getRect().getHeight(), preedit_right_local, 0);
2540 LLRect preedit_rect_screen; 2439 LLRect preedit_rect_screen;
2541 localRectToScreen(preedit_rect_local, &preedit_rect_screen); 2440 localRectToScreen(preedit_rect_local, &preedit_rect_screen);
2542 LLUI::screenRectToGL(preedit_rect_screen, bounds); 2441 LLUI::screenRectToGL(preedit_rect_screen, bounds);
@@ -2620,7 +2519,7 @@ LLSearchEditor::LLSearchEditor(const LLString& name,
2620 LLUICtrl(name, rect, TRUE, NULL, userdata), 2519 LLUICtrl(name, rect, TRUE, NULL, userdata),
2621 mSearchCallback(search_callback) 2520 mSearchCallback(search_callback)
2622{ 2521{
2623 LLRect search_edit_rect(0, mRect.getHeight(), mRect.getWidth(), 0); 2522 LLRect search_edit_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
2624 mSearchEdit = new LLLineEditor("search edit", 2523 mSearchEdit = new LLLineEditor("search edit",
2625 search_edit_rect, 2524 search_edit_rect,
2626 LLString::null, 2525 LLString::null,
@@ -2656,55 +2555,6 @@ LLSearchEditor::LLSearchEditor(const LLString& name,
2656 mSearchEdit->setBorderWidth(0, btn_width); 2555 mSearchEdit->setBorderWidth(0, btn_width);
2657} 2556}
2658 2557
2659LLSearchEditor::~LLSearchEditor()
2660{
2661}
2662
2663//virtual
2664EWidgetType LLSearchEditor::getWidgetType() const
2665{
2666 return WIDGET_TYPE_SEARCH_EDITOR;
2667}
2668
2669//virtual
2670LLString LLSearchEditor::getWidgetTag() const
2671{
2672 return LL_SEARCH_EDITOR_TAG;
2673}
2674
2675//virtual
2676void LLSearchEditor::setValue(const LLSD& value )
2677{
2678 mSearchEdit->setValue(value);
2679}
2680
2681//virtual
2682LLSD LLSearchEditor::getValue() const
2683{
2684 return mSearchEdit->getValue();
2685}
2686
2687//virtual
2688BOOL LLSearchEditor::setTextArg( const LLString& key, const LLStringExplicit& text )
2689{
2690 return mSearchEdit->setTextArg(key, text);
2691}
2692
2693//virtual
2694BOOL LLSearchEditor::setLabelArg( const LLString& key, const LLStringExplicit& text )
2695{
2696 return mSearchEdit->setLabelArg(key, text);
2697}
2698
2699//virtual
2700void LLSearchEditor::clear()
2701{
2702 if (mSearchEdit)
2703 {
2704 mSearchEdit->clear();
2705 }
2706}
2707
2708 2558
2709void LLSearchEditor::draw() 2559void LLSearchEditor::draw()
2710{ 2560{
@@ -2713,10 +2563,6 @@ void LLSearchEditor::draw()
2713 LLUICtrl::draw(); 2563 LLUICtrl::draw();
2714} 2564}
2715 2565
2716void LLSearchEditor::setText(const LLStringExplicit &new_text)
2717{
2718 mSearchEdit->setText(new_text);
2719}
2720 2566
2721//static 2567//static
2722void LLSearchEditor::onSearchEdit(LLLineEditor* caller, void* user_data ) 2568void LLSearchEditor::onSearchEdit(LLLineEditor* caller, void* user_data )
diff --git a/linden/indra/llui/lllineeditor.h b/linden/indra/llui/lllineeditor.h
index 6d328e5..ba3c697 100644
--- a/linden/indra/llui/lllineeditor.h
+++ b/linden/indra/llui/lllineeditor.h
@@ -1,6 +1,15 @@
1/** 1/**
2 * @file lllineeditor.h 2 * @file lllineeditor.h
3 * @brief LLLineEditor base class 3 * @brief Text editor widget to let users enter/edit a single line.
4 *
5 * Features:
6 * Text entry of a single line (text, delete, left and right arrow, insert, return).
7 * Callbacks either on every keystroke or just on the return key.
8 * Focus (allow multiple text entry widgets)
9 * Clipboard (cut, copy, and paste)
10 * Horizontal scrolling to allow strings longer than widget size allows
11 * Pre-validation (limit which keys can be used)
12 * Optional line history so previous entries can be recalled by CTRL UP/DOWN
4 * 13 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$ 14 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 * 15 *
@@ -29,19 +38,6 @@
29 * $/LicenseInfo$ 38 * $/LicenseInfo$
30 */ 39 */
31 40
32// Text editor widget to let users enter/edit a single line.
33//
34//
35// Features:
36// Text entry of a single line (text, delete, left and right arrow, insert, return).
37// Callbacks either on every keystroke or just on the return key.
38// Focus (allow multiple text entry widgets)
39// Clipboard (cut, copy, and paste)
40// Horizontal scrolling to allow strings longer than widget size allows
41// Pre-validation (limit which keys can be used)
42// Optional line history so previous entries can be recalled by CTRL UP/DOWN
43
44
45#ifndef LL_LLLINEEDITOR_H 41#ifndef LL_LLLINEEDITOR_H
46#define LL_LLLINEEDITOR_H 42#define LL_LLLINEEDITOR_H
47 43
@@ -61,13 +57,10 @@ class LLButton;
61 57
62typedef BOOL (*LLLinePrevalidateFunc)(const LLWString &wstr); 58typedef BOOL (*LLLinePrevalidateFunc)(const LLWString &wstr);
63 59
64// 60
65// Classes
66//
67class LLLineEditor 61class LLLineEditor
68: public LLUICtrl, public LLEditMenuHandler, protected LLPreeditor 62: public LLUICtrl, public LLEditMenuHandler, protected LLPreeditor
69{ 63{
70 friend class LLLineEditorRollback;
71 64
72public: 65public:
73 LLLineEditor(const LLString& name, 66 LLLineEditor(const LLString& name,
@@ -85,8 +78,8 @@ public:
85 S32 border_thickness = 1); 78 S32 border_thickness = 1);
86 79
87 virtual ~LLLineEditor(); 80 virtual ~LLLineEditor();
88 virtual EWidgetType getWidgetType() const; 81 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_LINE_EDITOR; }
89 virtual LLString getWidgetTag() const; 82 virtual LLString getWidgetTag() const { return LL_LINE_EDITOR_TAG; };
90 virtual LLXMLNodePtr getXML(bool save_children = true) const; 83 virtual LLXMLNodePtr getXML(bool save_children = true) const;
91 void setColorParameters(LLXMLNodePtr node); 84 void setColorParameters(LLXMLNodePtr node);
92 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 85 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
@@ -102,22 +95,22 @@ public:
102 95
103 // LLEditMenuHandler overrides 96 // LLEditMenuHandler overrides
104 virtual void cut(); 97 virtual void cut();
105 virtual BOOL canCut(); 98 virtual BOOL canCut() const;
106 99
107 virtual void copy(); 100 virtual void copy();
108 virtual BOOL canCopy(); 101 virtual BOOL canCopy() const;
109 102
110 virtual void paste(); 103 virtual void paste();
111 virtual BOOL canPaste(); 104 virtual BOOL canPaste() const;
112 105
113 virtual void doDelete(); 106 virtual void doDelete();
114 virtual BOOL canDoDelete(); 107 virtual BOOL canDoDelete() const;
115 108
116 virtual void selectAll(); 109 virtual void selectAll();
117 virtual BOOL canSelectAll(); 110 virtual BOOL canSelectAll() const;
118 111
119 virtual void deselect(); 112 virtual void deselect();
120 virtual BOOL canDeselect(); 113 virtual BOOL canDeselect() const;
121 114
122 // view overrides 115 // view overrides
123 virtual void draw(); 116 virtual void draw();
@@ -133,16 +126,16 @@ public:
133 virtual void setRect(const LLRect& rect); 126 virtual void setRect(const LLRect& rect);
134 virtual BOOL acceptsTextInput() const; 127 virtual BOOL acceptsTextInput() const;
135 virtual void onCommit(); 128 virtual void onCommit();
136 virtual BOOL isDirty() const; // Returns TRUE if the user has changed value at all 129 virtual BOOL isDirty() const { return mText.getString() != mPrevText; } // Returns TRUE if user changed value at all
137 virtual void resetDirty(); // Clear dirty state 130 virtual void resetDirty() { mPrevText = mText.getString(); } // Clear dirty state
138 131
139 // assumes UTF8 text 132 // assumes UTF8 text
140 virtual void setValue(const LLSD& value ); 133 virtual void setValue(const LLSD& value ) { setText(value.asString()); }
141 virtual LLSD getValue() const; 134 virtual LLSD getValue() const { return LLSD(getText()); }
142 virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text ); 135 virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text );
143 virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); 136 virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
144 137
145 void setLabel(const LLStringExplicit &new_label); 138 void setLabel(const LLStringExplicit &new_label) { mLabel = new_label; }
146 void setText(const LLStringExplicit &new_text); 139 void setText(const LLStringExplicit &new_text);
147 140
148 const LLString& getText() const { return mText.getString(); } 141 const LLString& getText() const { return mText.getString(); }
@@ -179,7 +172,6 @@ public:
179 void setIgnoreArrowKeys(BOOL b) { mIgnoreArrowKeys = b; } 172 void setIgnoreArrowKeys(BOOL b) { mIgnoreArrowKeys = b; }
180 void setIgnoreTab(BOOL b) { mIgnoreTab = b; } 173 void setIgnoreTab(BOOL b) { mIgnoreTab = b; }
181 void setPassDelete(BOOL b) { mPassDelete = b; } 174 void setPassDelete(BOOL b) { mPassDelete = b; }
182
183 void setDrawAsterixes(BOOL b); 175 void setDrawAsterixes(BOOL b);
184 176
185 // get the cursor position of the beginning/end of the prev/next word in the text 177 // get the cursor position of the beginning/end of the prev/next word in the text
@@ -216,23 +208,24 @@ public:
216 static BOOL postvalidateFloat(const LLString &str); 208 static BOOL postvalidateFloat(const LLString &str);
217 209
218 // line history support: 210 // line history support:
219 void setEnableLineHistory( BOOL enabled ); // switches line history on or off 211 void setEnableLineHistory( BOOL enabled ) { mHaveHistory = enabled; } // switches line history on or off
220 void updateHistory(); // stores current line in history 212 void updateHistory(); // stores current line in history
221 213
222protected: 214private:
215 // private helper classes
223 void removeChar(); 216 void removeChar();
224 void addChar(const llwchar c); 217 void addChar(const llwchar c);
225 void setCursorAtLocalPos(S32 local_mouse_x); 218 void setCursorAtLocalPos(S32 local_mouse_x);
226
227 S32 findPixelNearestPos(S32 cursor_offset = 0) const; 219 S32 findPixelNearestPos(S32 cursor_offset = 0) const;
228 void reportBadKeystroke(); 220 void reportBadKeystroke();
229
230 BOOL handleSpecialKey(KEY key, MASK mask); 221 BOOL handleSpecialKey(KEY key, MASK mask);
231 BOOL handleSelectionKey(KEY key, MASK mask); 222 BOOL handleSelectionKey(KEY key, MASK mask);
232 BOOL handleControlKey(KEY key, MASK mask); 223 BOOL handleControlKey(KEY key, MASK mask);
233 S32 handleCommitKey(KEY key, MASK mask); 224 S32 handleCommitKey(KEY key, MASK mask);
234 225
235protected: 226 //
227 // private data members
228 //
236 void updateAllowingLanguageInput(); 229 void updateAllowingLanguageInput();
237 BOOL hasPreeditString() const; 230 BOOL hasPreeditString() const;
238 // Implementation (overrides) of LLPreeditor 231 // Implementation (overrides) of LLPreeditor
@@ -308,13 +301,53 @@ protected:
308 LLWString mPreeditOverwrittenWString; 301 LLWString mPreeditOverwrittenWString;
309 std::vector<S32> mPreeditPositions; 302 std::vector<S32> mPreeditPositions;
310 LLPreeditor::standouts_t mPreeditStandouts; 303 LLPreeditor::standouts_t mPreeditStandouts;
311};
312
313 304
305 // private helper class
306 class LLLineEditorRollback
307 {
308 public:
309 LLLineEditorRollback( LLLineEditor* ed )
310 :
311 mCursorPos( ed->mCursorPos ),
312 mScrollHPos( ed->mScrollHPos ),
313 mIsSelecting( ed->mIsSelecting ),
314 mSelectionStart( ed->mSelectionStart ),
315 mSelectionEnd( ed->mSelectionEnd )
316 {
317 mText = ed->getText();
318 }
319
320 void doRollback( LLLineEditor* ed )
321 {
322 ed->mCursorPos = mCursorPos;
323 ed->mScrollHPos = mScrollHPos;
324 ed->mIsSelecting = mIsSelecting;
325 ed->mSelectionStart = mSelectionStart;
326 ed->mSelectionEnd = mSelectionEnd;
327 ed->mText = mText;
328 ed->mPrevText = mText;
329 }
330
331 LLString getText() { return mText; }
332
333 private:
334 LLString mText;
335 S32 mCursorPos;
336 S32 mScrollHPos;
337 BOOL mIsSelecting;
338 S32 mSelectionStart;
339 S32 mSelectionEnd;
340 }; // end class LLLineEditorRollback
341
342}; // end class LLLineEditor
343
344
345
346/*
347 * @brief A line editor with a button to clear it and a callback to call on every edit event.
348 */
314class LLSearchEditor : public LLUICtrl 349class LLSearchEditor : public LLUICtrl
315{ 350{
316friend class LLLineEditorRollback;
317
318public: 351public:
319 LLSearchEditor(const LLString& name, 352 LLSearchEditor(const LLString& name,
320 const LLRect& rect, 353 const LLRect& rect,
@@ -322,34 +355,34 @@ public:
322 void (*search_callback)(const LLString& search_string, void* user_data), 355 void (*search_callback)(const LLString& search_string, void* user_data),
323 void* userdata); 356 void* userdata);
324 357
325 virtual ~LLSearchEditor(); 358 virtual ~LLSearchEditor() {}
326 359
327 /*virtual*/ void draw(); 360 /*virtual*/ void draw();
328 361
329 virtual EWidgetType getWidgetType() const; 362 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SEARCH_EDITOR; }
330 virtual LLString getWidgetTag() const; 363 virtual LLString getWidgetTag() const { return LL_SEARCH_EDITOR_TAG; }
331 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 364 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
332 365
333 void setText(const LLStringExplicit &new_text); 366 void setText(const LLStringExplicit &new_text) { mSearchEdit->setText(new_text); }
334 367
335 void setSearchCallback(void (*search_callback)(const LLString& search_string, void* user_data), void* data) { mSearchCallback = search_callback; mCallbackUserData = data; } 368 void setSearchCallback(void (*search_callback)(const LLString& search_string, void* user_data), void* data) { mSearchCallback = search_callback; mCallbackUserData = data; }
336 369
337 // LLUICtrl interface 370 // LLUICtrl interface
338 virtual void setValue(const LLSD& value ); 371 virtual void setValue(const LLSD& value ) { mSearchEdit->setValue(value); }
339 virtual LLSD getValue() const; 372 virtual LLSD getValue() const { return mSearchEdit->getValue(); }
340 virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text ); 373 virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text ) { return mSearchEdit->setTextArg( key, text); }
341 virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); 374 virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ) { return mSearchEdit->setLabelArg(key, text); }
342 virtual void clear(); 375 virtual void clear() { if (mSearchEdit) mSearchEdit->clear(); }
343 376
344 377
345protected: 378private:
346 LLLineEditor* mSearchEdit; 379 static void onSearchEdit(LLLineEditor* caller, void* user_data );
347 LLButton* mClearSearchButton; 380 static void onClearSearch(void* user_data);
348 381
382 LLLineEditor* mSearchEdit;
383 class LLButton* mClearSearchButton;
349 void (*mSearchCallback)(const LLString& search_string, void* user_data); 384 void (*mSearchCallback)(const LLString& search_string, void* user_data);
350 385
351 static void onSearchEdit(LLLineEditor* caller, void* user_data );
352 static void onClearSearch(void* user_data);
353}; 386};
354 387
355#endif // LL_LINEEDITOR_ 388#endif // LL_LINEEDITOR_
diff --git a/linden/indra/llui/llmemberlistener.h b/linden/indra/llui/llmemberlistener.h
index 02aff17..6f4ba8b 100644
--- a/linden/indra/llui/llmemberlistener.h
+++ b/linden/indra/llui/llmemberlistener.h
@@ -2,6 +2,32 @@
2 * @file llmemberlistener.h 2 * @file llmemberlistener.h
3 * @brief Listener class which registers itself with its parent view 3 * @brief Listener class which registers itself with its parent view
4 * 4 *
5 * <code>
6 * Example usage:
7 *
8 * (in header)
9 *
10 * class T {
11 * class LLDoTest : public LLMemberListener<LLInventoryView>
12 * {
13 * bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
14 * };
15 * LLDoTest mDoTest;
16 * }
17 *
18 * (in cpp)
19 *
20 * T::T() {
21 * mDoTest.registerListener(this, "T.Test");
22 * }
23 *
24 * T::LLDoTest::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
25 * {
26 * T *self = mPtr;
27 * ...
28 * }
29 * </code>
30 *
5 * $LicenseInfo:firstyear=2006&license=viewergpl$ 31 * $LicenseInfo:firstyear=2006&license=viewergpl$
6 * 32 *
7 * Copyright (c) 2006-2008, Linden Research, Inc. 33 * Copyright (c) 2006-2008, Linden Research, Inc.
@@ -34,7 +60,6 @@
34 60
35#include "llevent.h" 61#include "llevent.h"
36 62
37// T *mPtr is the object that this listener manipulates
38template <class T> 63template <class T>
39class LLMemberListener : public LLSimpleListener 64class LLMemberListener : public LLSimpleListener
40{ 65{
@@ -51,32 +76,10 @@ public:
51 // This is what you have to override to handle this event 76 // This is what you have to override to handle this event
52 virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) = 0; 77 virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) = 0;
53 78
54 T *mPtr; 79protected:
80 T *mPtr; // The object that this listener manipulates
55 LLString mRegisteredName; 81 LLString mRegisteredName;
56}; 82};
57 83
58// Example usage:
59
60// (in header)
61
62// class T {
63// class LLDoTest : public LLMemberListener<LLInventoryView>
64// {
65// bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
66// };
67// LLDoTest mDoTest;
68// }
69
70// (in cpp)
71
72// T::T() {
73// mDoTest.registerListener(this, "T.Test");
74// }
75//
76// T::LLDoTest::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
77// {
78// T *self = mPtr;
79// ...
80// }
81 84
82#endif // LL_LLMEMBERLISTENER_H 85#endif // LL_LLMEMBERLISTENER_H
diff --git a/linden/indra/llui/llmenugl.cpp b/linden/indra/llui/llmenugl.cpp
index a56b090..4a12870 100644
--- a/linden/indra/llui/llmenugl.cpp
+++ b/linden/indra/llui/llmenugl.cpp
@@ -47,6 +47,7 @@
47 47
48#include "llmath.h" 48#include "llmath.h"
49#include "llgl.h" 49#include "llgl.h"
50#include "llglimmediate.h"
50#include "llfocusmgr.h" 51#include "llfocusmgr.h"
51#include "llfont.h" 52#include "llfont.h"
52#include "llcoord.h" 53#include "llcoord.h"
@@ -112,12 +113,11 @@ LLColor4 LLMenuItemGL::sEnabledColor( 0.0f, 0.0f, 0.0f, 1.0f );
112LLColor4 LLMenuItemGL::sDisabledColor( 0.5f, 0.5f, 0.5f, 1.0f ); 113LLColor4 LLMenuItemGL::sDisabledColor( 0.5f, 0.5f, 0.5f, 1.0f );
113LLColor4 LLMenuItemGL::sHighlightBackground( 0.0f, 0.0f, 0.7f, 1.0f ); 114LLColor4 LLMenuItemGL::sHighlightBackground( 0.0f, 0.0f, 0.7f, 1.0f );
114LLColor4 LLMenuItemGL::sHighlightForeground( 1.0f, 1.0f, 1.0f, 1.0f ); 115LLColor4 LLMenuItemGL::sHighlightForeground( 1.0f, 1.0f, 1.0f, 1.0f );
115BOOL LLMenuItemGL::sDropShadowText = TRUE;
116 116
117LLColor4 LLMenuGL::sDefaultBackgroundColor( 0.25f, 0.25f, 0.25f, 0.75f ); 117LLColor4 LLMenuGL::sDefaultBackgroundColor( 0.25f, 0.25f, 0.25f, 0.75f );
118BOOL LLMenuGL::sKeyboardMode = FALSE; 118BOOL LLMenuGL::sKeyboardMode = FALSE;
119 119
120LLViewHandle LLMenuHolderGL::sItemLastSelectedHandle; 120LLHandle<LLView> LLMenuHolderGL::sItemLastSelectedHandle;
121LLFrameTimer LLMenuHolderGL::sItemActivationTimer; 121LLFrameTimer LLMenuHolderGL::sItemActivationTimer;
122//LLColor4 LLMenuGL::sBackgroundColor( 0.8f, 0.8f, 0.0f, 1.0f ); 122//LLColor4 LLMenuGL::sBackgroundColor( 0.8f, 0.8f, 0.0f, 1.0f );
123 123
@@ -199,7 +199,7 @@ BOOL LLMenuItemGL::handleKey(KEY key, MASK mask, BOOL called_from_parent)
199 if( called_from_parent ) 199 if( called_from_parent )
200 { 200 {
201 // Downward traversal 201 // Downward traversal
202 if (mEnabled) 202 if (getEnabled())
203 { 203 {
204 handled = childrenHandleKey( key, mask ) != NULL; 204 handled = childrenHandleKey( key, mask ) != NULL;
205 } 205 }
@@ -215,7 +215,7 @@ BOOL LLMenuItemGL::handleKey(KEY key, MASK mask, BOOL called_from_parent)
215 215
216BOOL LLMenuItemGL::handleAcceleratorKey(KEY key, MASK mask) 216BOOL LLMenuItemGL::handleAcceleratorKey(KEY key, MASK mask)
217{ 217{
218 if( mEnabled && (!gKeyboard->getKeyRepeated(key) || mAllowKeyRepeat) && (key == mAcceleratorKey) && (mask == (mAcceleratorMask & MASK_NORMALKEYS)) ) 218 if( getEnabled() && (!gKeyboard->getKeyRepeated(key) || mAllowKeyRepeat) && (key == mAcceleratorKey) && (mask == (mAcceleratorMask & MASK_NORMALKEYS)) )
219 { 219 {
220 doIt(); 220 doIt();
221 return TRUE; 221 return TRUE;
@@ -225,15 +225,10 @@ BOOL LLMenuItemGL::handleAcceleratorKey(KEY key, MASK mask)
225 225
226BOOL LLMenuItemGL::handleHover(S32 x, S32 y, MASK mask) 226BOOL LLMenuItemGL::handleHover(S32 x, S32 y, MASK mask)
227{ 227{
228 mGotHover = TRUE; 228 setHover(TRUE);
229 getWindow()->setCursor(UI_CURSOR_ARROW); 229 getWindow()->setCursor(UI_CURSOR_ARROW);
230 return TRUE; 230 return TRUE;
231} 231}
232
233void LLMenuItemGL::setBriefItem(BOOL b)
234{
235 mBriefItem = b;
236}
237 232
238// This function checks to see if the accelerator key is already in use; 233// This function checks to see if the accelerator key is already in use;
239// if not, it will be added to the list 234// if not, it will be added to the list
@@ -282,7 +277,7 @@ BOOL LLMenuItemGL::addToAcceleratorList(std::list <LLKeyBinding*> *listp)
282 277
283// This function appends the character string representation of 278// This function appends the character string representation of
284// the current accelerator key and mask to the provided string. 279// the current accelerator key and mask to the provided string.
285void LLMenuItemGL::appendAcceleratorString( LLString& st ) 280void LLMenuItemGL::appendAcceleratorString( LLString& st ) const
286{ 281{
287 // break early if this is a silly thing to do. 282 // break early if this is a silly thing to do.
288 if( KEY_NONE == mAcceleratorKey ) 283 if( KEY_NONE == mAcceleratorKey )
@@ -332,52 +327,14 @@ void LLMenuItemGL::setJumpKey(KEY key)
332 mJumpKey = LLStringOps::toUpper((char)key); 327 mJumpKey = LLStringOps::toUpper((char)key);
333} 328}
334 329
335KEY LLMenuItemGL::getJumpKey()
336{
337 return mJumpKey;
338}
339
340
341// set the font used by all of the menu objects
342void LLMenuItemGL::setFont(LLFontGL* font)
343{
344 mFont = font;
345}
346
347// returns the height in pixels for the current font.
348U32 LLMenuItemGL::getNominalHeight( void )
349{
350 return llround(mFont->getLineHeight()) + MENU_ITEM_PADDING;
351}
352
353// functions to control the color scheme
354void LLMenuItemGL::setEnabledColor( const LLColor4& color )
355{
356 sEnabledColor = color;
357}
358
359void LLMenuItemGL::setDisabledColor( const LLColor4& color )
360{
361 sDisabledColor = color;
362}
363
364void LLMenuItemGL::setHighlightBGColor( const LLColor4& color )
365{
366 sHighlightBackground = color;
367}
368 330
369void LLMenuItemGL::setHighlightFGColor( const LLColor4& color ) 331// virtual
370{ 332U32 LLMenuItemGL::getNominalHeight( void ) const
371 sHighlightForeground = color; 333{
334 return llround(mFont->getLineHeight()) + MENU_ITEM_PADDING;
372} 335}
373 336
374 337
375// change the label
376void LLMenuItemGL::setLabel( const LLStringExplicit& label )
377{
378 mLabel = label;
379}
380
381// Get the parent menu for this item 338// Get the parent menu for this item
382LLMenuGL* LLMenuItemGL::getMenu() 339LLMenuGL* LLMenuItemGL::getMenu()
383{ 340{
@@ -388,7 +345,7 @@ LLMenuGL* LLMenuItemGL::getMenu()
388// getNominalWidth() - returns the normal width of this control in 345// getNominalWidth() - returns the normal width of this control in
389// pixels - this is used for calculating the widest item, as well as 346// pixels - this is used for calculating the widest item, as well as
390// for horizontal arrangement. 347// for horizontal arrangement.
391U32 LLMenuItemGL::getNominalWidth( void ) 348U32 LLMenuItemGL::getNominalWidth( void ) const
392{ 349{
393 U32 width; 350 U32 width;
394 351
@@ -442,17 +399,6 @@ void LLMenuItemGL::doIt( void )
442 mHighlight = highlight; 399 mHighlight = highlight;
443} 400}
444 401
445// determine if this object represents an active sub-menu
446BOOL LLMenuItemGL::isActive( void ) const
447{
448 return FALSE;
449}
450
451// determine if this object represents an open sub-menu
452BOOL LLMenuItemGL::isOpen( void ) const
453{
454 return FALSE;
455}
456 402
457BOOL LLMenuItemGL::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent ) 403BOOL LLMenuItemGL::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent )
458{ 404{
@@ -490,7 +436,7 @@ BOOL LLMenuItemGL::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent )
490 436
491BOOL LLMenuItemGL::handleMouseUp( S32 x, S32 y, MASK ) 437BOOL LLMenuItemGL::handleMouseUp( S32 x, S32 y, MASK )
492{ 438{
493 if (mEnabled) 439 if (getEnabled())
494 { 440 {
495 // switch to mouse navigation mode 441 // switch to mouse navigation mode
496 LLMenuGL::setKeyboardMode(FALSE); 442 LLMenuGL::setKeyboardMode(FALSE);
@@ -504,7 +450,7 @@ BOOL LLMenuItemGL::handleMouseUp( S32 x, S32 y, MASK )
504 450
505BOOL LLMenuItemGL::handleMouseDown( S32 x, S32 y, MASK ) 451BOOL LLMenuItemGL::handleMouseDown( S32 x, S32 y, MASK )
506{ 452{
507 if (mEnabled) 453 if (getEnabled())
508 { 454 {
509 // switch to mouse navigation mode 455 // switch to mouse navigation mode
510 LLMenuGL::setKeyboardMode(FALSE); 456 LLMenuGL::setKeyboardMode(FALSE);
@@ -512,10 +458,7 @@ BOOL LLMenuItemGL::handleMouseDown( S32 x, S32 y, MASK )
512 setHighlight(TRUE); 458 setHighlight(TRUE);
513 return TRUE; 459 return TRUE;
514 } 460 }
515 else 461 return FALSE;
516 {
517 return FALSE;
518 }
519} 462}
520 463
521 464
@@ -528,14 +471,14 @@ void LLMenuItemGL::draw( void )
528 // let disabled items be highlighted, just don't draw them as such 471 // let disabled items be highlighted, just don't draw them as such
529 if( getEnabled() && getHighlight() && !mBriefItem) 472 if( getEnabled() && getHighlight() && !mBriefItem)
530 { 473 {
531 glColor4fv( sHighlightBackground.mV ); 474 gGL.color4fv( sHighlightBackground.mV );
532 gl_rect_2d( 0, mRect.getHeight(), mRect.getWidth(), 0 ); 475 gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0 );
533 } 476 }
534 477
535 LLColor4 color; 478 LLColor4 color;
536 479
537 U8 font_style = mStyle; 480 U8 font_style = mStyle;
538 if (LLMenuItemGL::sDropShadowText && getEnabled() && !mDrawTextDisabled ) 481 if (getEnabled() && !mDrawTextDisabled )
539 { 482 {
540 font_style |= LLFontGL::DROP_SHADOW_SOFT; 483 font_style |= LLFontGL::DROP_SHADOW_SOFT;
541 } 484 }
@@ -570,12 +513,12 @@ void LLMenuItemGL::draw( void )
570 LLFontGL::LEFT, LLFontGL::BOTTOM, font_style, S32_MAX, S32_MAX, NULL, FALSE ); 513 LLFontGL::LEFT, LLFontGL::BOTTOM, font_style, S32_MAX, S32_MAX, NULL, FALSE );
571 if( !mDrawAccelLabel.empty() ) 514 if( !mDrawAccelLabel.empty() )
572 { 515 {
573 mFont->render( mDrawAccelLabel.getWString(), 0, (F32)mRect.mRight - (F32)RIGHT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color, 516 mFont->render( mDrawAccelLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
574 LLFontGL::RIGHT, LLFontGL::BOTTOM, font_style, S32_MAX, S32_MAX, NULL, FALSE ); 517 LLFontGL::RIGHT, LLFontGL::BOTTOM, font_style, S32_MAX, S32_MAX, NULL, FALSE );
575 } 518 }
576 if( !mDrawBranchLabel.empty() ) 519 if( !mDrawBranchLabel.empty() )
577 { 520 {
578 mFont->render( mDrawBranchLabel.getWString(), 0, (F32)mRect.mRight - (F32)RIGHT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color, 521 mFont->render( mDrawBranchLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
579 LLFontGL::RIGHT, LLFontGL::BOTTOM, font_style, S32_MAX, S32_MAX, NULL, FALSE ); 522 LLFontGL::RIGHT, LLFontGL::BOTTOM, font_style, S32_MAX, S32_MAX, NULL, FALSE );
580 } 523 }
581 } 524 }
@@ -595,7 +538,7 @@ void LLMenuItemGL::draw( void )
595 } 538 }
596 539
597 // clear got hover every frame 540 // clear got hover every frame
598 mGotHover = FALSE; 541 setHover(FALSE);
599} 542}
600 543
601BOOL LLMenuItemGL::setLabelArg( const LLString& key, const LLStringExplicit& text ) 544BOOL LLMenuItemGL::setLabelArg( const LLString& key, const LLStringExplicit& text )
@@ -628,7 +571,7 @@ public:
628 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); 571 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
629 virtual BOOL handleHover(S32 x, S32 y, MASK mask); 572 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
630 573
631 virtual U32 getNominalHeight( void ) { return SEPARATOR_HEIGHT_PIXELS; } 574 virtual U32 getNominalHeight( void ) const { return SEPARATOR_HEIGHT_PIXELS; }
632}; 575};
633 576
634LLMenuItemSeparatorGL::LLMenuItemSeparatorGL( const LLString &name ) : 577LLMenuItemSeparatorGL::LLMenuItemSeparatorGL( const LLString &name ) :
@@ -638,42 +581,42 @@ LLMenuItemSeparatorGL::LLMenuItemSeparatorGL( const LLString &name ) :
638 581
639void LLMenuItemSeparatorGL::draw( void ) 582void LLMenuItemSeparatorGL::draw( void )
640{ 583{
641 glColor4fv( sDisabledColor.mV ); 584 gGL.color4fv( getDisabledColor().mV );
642 const S32 y = mRect.getHeight() / 2; 585 const S32 y = getRect().getHeight() / 2;
643 const S32 PAD = 6; 586 const S32 PAD = 6;
644 gl_line_2d( PAD, y, mRect.getWidth() - PAD, y ); 587 gl_line_2d( PAD, y, getRect().getWidth() - PAD, y );
645} 588}
646 589
647BOOL LLMenuItemSeparatorGL::handleMouseDown(S32 x, S32 y, MASK mask) 590BOOL LLMenuItemSeparatorGL::handleMouseDown(S32 x, S32 y, MASK mask)
648{ 591{
649 LLMenuGL* parent_menu = getMenu(); 592 LLMenuGL* parent_menu = getMenu();
650 if (y > mRect.getHeight() / 2) 593 if (y > getRect().getHeight() / 2)
651 { 594 {
652 return parent_menu->handleMouseDown(x + mRect.mLeft, mRect.mTop + 1, mask); 595 return parent_menu->handleMouseDown(x + getRect().mLeft, getRect().mTop + 1, mask);
653 } 596 }
654 else 597 else
655 { 598 {
656 return parent_menu->handleMouseDown(x + mRect.mLeft, mRect.mBottom - 1, mask); 599 return parent_menu->handleMouseDown(x + getRect().mLeft, getRect().mBottom - 1, mask);
657 } 600 }
658} 601}
659 602
660BOOL LLMenuItemSeparatorGL::handleMouseUp(S32 x, S32 y, MASK mask) 603BOOL LLMenuItemSeparatorGL::handleMouseUp(S32 x, S32 y, MASK mask)
661{ 604{
662 LLMenuGL* parent_menu = getMenu(); 605 LLMenuGL* parent_menu = getMenu();
663 if (y > mRect.getHeight() / 2) 606 if (y > getRect().getHeight() / 2)
664 { 607 {
665 return parent_menu->handleMouseUp(x + mRect.mLeft, mRect.mTop + 1, mask); 608 return parent_menu->handleMouseUp(x + getRect().mLeft, getRect().mTop + 1, mask);
666 } 609 }
667 else 610 else
668 { 611 {
669 return parent_menu->handleMouseUp(x + mRect.mLeft, mRect.mBottom - 1, mask); 612 return parent_menu->handleMouseUp(x + getRect().mLeft, getRect().mBottom - 1, mask);
670 } 613 }
671} 614}
672 615
673BOOL LLMenuItemSeparatorGL::handleHover(S32 x, S32 y, MASK mask) 616BOOL LLMenuItemSeparatorGL::handleHover(S32 x, S32 y, MASK mask)
674{ 617{
675 LLMenuGL* parent_menu = getMenu(); 618 LLMenuGL* parent_menu = getMenu();
676 if (y > mRect.getHeight() / 2) 619 if (y > getRect().getHeight() / 2)
677 { 620 {
678 parent_menu->highlightPrevItem(this, FALSE); 621 parent_menu->highlightPrevItem(this, FALSE);
679 return FALSE; 622 return FALSE;
@@ -711,24 +654,13 @@ LLMenuItemVerticalSeparatorGL::LLMenuItemVerticalSeparatorGL( void )
711 654
712//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
713// Class LLMenuItemTearOffGL 656// Class LLMenuItemTearOffGL
714//
715// This class represents a separator.
716//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
717LLMenuItemTearOffGL::LLMenuItemTearOffGL(LLViewHandle parent_floater_handle) : 658LLMenuItemTearOffGL::LLMenuItemTearOffGL(LLHandle<LLFloater> parent_floater_handle) :
718 LLMenuItemGL("tear off", TEAROFF_SEPARATOR_LABEL), 659 LLMenuItemGL("tear off", TEAROFF_SEPARATOR_LABEL),
719 mParentHandle(parent_floater_handle) 660 mParentHandle(parent_floater_handle)
720{ 661{
721} 662}
722 663
723EWidgetType LLMenuItemTearOffGL::getWidgetType() const
724{
725 return WIDGET_TYPE_TEAROFF_MENU;
726}
727
728LLString LLMenuItemTearOffGL::getWidgetTag() const
729{
730 return LL_MENU_ITEM_TEAR_OFF_GL_TAG;
731}
732 664
733void LLMenuItemTearOffGL::doIt() 665void LLMenuItemTearOffGL::doIt()
734{ 666{
@@ -747,7 +679,7 @@ void LLMenuItemTearOffGL::doIt()
747 679
748 getMenu()->arrange(); 680 getMenu()->arrange();
749 681
750 LLFloater* parent_floater = LLFloater::getFloaterByHandle(mParentHandle); 682 LLFloater* parent_floater = mParentHandle.get();
751 LLFloater* tear_off_menu = LLTearOffMenu::create(getMenu()); 683 LLFloater* tear_off_menu = LLTearOffMenu::create(getMenu());
752 684
753 if (tear_off_menu) 685 if (tear_off_menu)
@@ -768,27 +700,31 @@ void LLMenuItemTearOffGL::doIt()
768void LLMenuItemTearOffGL::draw() 700void LLMenuItemTearOffGL::draw()
769{ 701{
770 // disabled items can be highlighted, but shouldn't render as such 702 // disabled items can be highlighted, but shouldn't render as such
771 if( getEnabled() && getHighlight() && !mBriefItem) 703 if( getEnabled() && getHighlight() && !isBriefItem())
772 { 704 {
773 glColor4fv( sHighlightBackground.mV ); 705 gGL.color4fv( getHighlightBGColor().mV );
774 gl_rect_2d( 0, mRect.getHeight(), mRect.getWidth(), 0 ); 706 gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0 );
775 } 707 }
776 708
777 if (mEnabled) 709 if (getEnabled())
778 { 710 {
779 glColor4fv( sEnabledColor.mV ); 711 gGL.color4fv( getEnabledColor().mV );
780 } 712 }
781 else 713 else
782 { 714 {
783 glColor4fv( sDisabledColor.mV ); 715 gGL.color4fv( getDisabledColor().mV );
784 } 716 }
785 const S32 y = mRect.getHeight() / 3; 717 const S32 y = getRect().getHeight() / 3;
786 const S32 PAD = 6; 718 const S32 PAD = 6;
787 gl_line_2d( PAD, y, mRect.getWidth() - PAD, y ); 719 gl_line_2d( PAD, y, getRect().getWidth() - PAD, y );
788 gl_line_2d( PAD, y * 2, mRect.getWidth() - PAD, y * 2 ); 720 gl_line_2d( PAD, y * 2, getRect().getWidth() - PAD, y * 2 );
721}
722
723U32 LLMenuItemTearOffGL::getNominalHeight( void ) const
724{
725 return TEAROFF_SEPARATOR_HEIGHT_PIXELS;
789} 726}
790 727
791U32 LLMenuItemTearOffGL::getNominalHeight( void ) { return TEAROFF_SEPARATOR_HEIGHT_PIXELS; }
792 728
793//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 729//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
794// Class LLMenuItemBlankGL 730// Class LLMenuItemBlankGL
@@ -799,22 +735,16 @@ U32 LLMenuItemTearOffGL::getNominalHeight( void ) { return TEAROFF_SEPARATOR_HEI
799class LLMenuItemBlankGL : public LLMenuItemGL 735class LLMenuItemBlankGL : public LLMenuItemGL
800{ 736{
801public: 737public:
802 LLMenuItemBlankGL( void ); 738 LLMenuItemBlankGL( void ) : LLMenuItemGL( "", "" )
803 739 {
740 setEnabled(FALSE);
741 }
804 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM_BLANK; } 742 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM_BLANK; }
805 virtual LLString getWidgetTag() const { return LL_MENU_ITEM_BLANK_GL_TAG; } 743 virtual LLString getWidgetTag() const { return LL_MENU_ITEM_BLANK_GL_TAG; }
806
807 // doIt() - do the primary funcationality of the menu item.
808 virtual void doIt( void ) {} 744 virtual void doIt( void ) {}
809
810 virtual void draw( void ) {} 745 virtual void draw( void ) {}
811}; 746};
812 747
813LLMenuItemBlankGL::LLMenuItemBlankGL( void )
814: LLMenuItemGL( "", "" )
815{
816 mEnabled = FALSE;
817}
818 748
819///============================================================================ 749///============================================================================
820/// Class LLMenuItemCallGL 750/// Class LLMenuItemCallGL
@@ -905,7 +835,7 @@ void LLMenuItemCallGL::setEnabledControl(LLString enabled_control, LLView *conte
905 } 835 }
906 else 836 else
907 { 837 {
908 context->addBoolControl(enabled_control, mEnabled); 838 context->addBoolControl(enabled_control, getEnabled());
909 control = context->findControl(enabled_control); 839 control = context->findControl(enabled_control);
910 control->registerListener(this, "ENABLED"); 840 control->registerListener(this, "ENABLED");
911 } 841 }
@@ -925,7 +855,7 @@ void LLMenuItemCallGL::setVisibleControl(LLString enabled_control, LLView *conte
925 } 855 }
926 else 856 else
927 { 857 {
928 context->addBoolControl(enabled_control, mEnabled); 858 context->addBoolControl(enabled_control, getEnabled());
929 control = context->findControl(enabled_control); 859 control = context->findControl(enabled_control);
930 control->registerListener(this, "VISIBLE"); 860 control->registerListener(this, "VISIBLE");
931 } 861 }
@@ -989,16 +919,6 @@ void LLMenuItemCallGL::doIt( void )
989 LLMenuItemGL::doIt(); 919 LLMenuItemGL::doIt();
990} 920}
991 921
992EWidgetType LLMenuItemCallGL::getWidgetType() const
993{
994 return WIDGET_TYPE_MENU_ITEM_CALL;
995}
996
997LLString LLMenuItemCallGL::getWidgetTag() const
998{
999 return LL_MENU_ITEM_CALL_GL_TAG;
1000}
1001
1002void LLMenuItemCallGL::buildDrawLabel( void ) 922void LLMenuItemCallGL::buildDrawLabel( void )
1003{ 923{
1004 LLPointer<LLEvent> fired_event = new LLEvent(this); 924 LLPointer<LLEvent> fired_event = new LLEvent(this);
@@ -1018,7 +938,7 @@ void LLMenuItemCallGL::buildDrawLabel( void )
1018 938
1019BOOL LLMenuItemCallGL::handleAcceleratorKey( KEY key, MASK mask ) 939BOOL LLMenuItemCallGL::handleAcceleratorKey( KEY key, MASK mask )
1020{ 940{
1021 if( (!gKeyboard->getKeyRepeated(key) || mAllowKeyRepeat) && (key == mAcceleratorKey) && (mask == (mAcceleratorMask & MASK_NORMALKEYS)) ) 941 if( (!gKeyboard->getKeyRepeated(key) || getAllowKeyRepeat()) && (key == mAcceleratorKey) && (mask == (mAcceleratorMask & MASK_NORMALKEYS)) )
1022 { 942 {
1023 LLPointer<LLEvent> fired_event = new LLEvent(this); 943 LLPointer<LLEvent> fired_event = new LLEvent(this);
1024 fireEvent(fired_event, "on_build"); 944 fireEvent(fired_event, "on_build");
@@ -1026,7 +946,7 @@ BOOL LLMenuItemCallGL::handleAcceleratorKey( KEY key, MASK mask )
1026 { 946 {
1027 setEnabled( mEnabledCallback( mUserData ) ); 947 setEnabled( mEnabledCallback( mUserData ) );
1028 } 948 }
1029 if( !mEnabled ) 949 if( !getEnabled() )
1030 { 950 {
1031 if( mOnDisabledCallback ) 951 if( mOnDisabledCallback )
1032 { 952 {
@@ -1127,20 +1047,10 @@ LLXMLNodePtr LLMenuItemCheckGL::getXML(bool save_children) const
1127 return node; 1047 return node;
1128} 1048}
1129 1049
1130EWidgetType LLMenuItemCheckGL::getWidgetType() const
1131{
1132 return WIDGET_TYPE_MENU_ITEM_CHECK;
1133}
1134
1135LLString LLMenuItemCheckGL::getWidgetTag() const
1136{
1137 return LL_MENU_ITEM_CHECK_GL_TAG;
1138}
1139
1140// called to rebuild the draw label 1050// called to rebuild the draw label
1141void LLMenuItemCheckGL::buildDrawLabel( void ) 1051void LLMenuItemCheckGL::buildDrawLabel( void )
1142{ 1052{
1143 if(mChecked || (mCheckCallback && mCheckCallback( mUserData ) ) ) 1053 if(mChecked || (mCheckCallback && mCheckCallback( getUserData() ) ) )
1144 { 1054 {
1145 mDrawBoolLabel = BOOLEAN_TRUE_PREFIX; 1055 mDrawBoolLabel = BOOLEAN_TRUE_PREFIX;
1146 } 1056 }
@@ -1216,23 +1126,13 @@ LLView* LLMenuItemBranchGL::getChildByName(const LLString& name, BOOL recurse) c
1216 return mBranch; 1126 return mBranch;
1217 } 1127 }
1218 // Always recurse on branches 1128 // Always recurse on branches
1219 return mBranch->getChildByName(name, recurse); 1129 return mBranch->getChild<LLView>(name, recurse);
1220}
1221
1222EWidgetType LLMenuItemBranchGL::getWidgetType() const
1223{
1224 return WIDGET_TYPE_MENU_ITEM_BRANCH;
1225}
1226
1227LLString LLMenuItemBranchGL::getWidgetTag() const
1228{
1229 return LL_MENU_ITEM_BRANCH_GL_TAG;
1230} 1130}
1231 1131
1232// virtual 1132// virtual
1233BOOL LLMenuItemBranchGL::handleMouseUp(S32 x, S32 y, MASK mask) 1133BOOL LLMenuItemBranchGL::handleMouseUp(S32 x, S32 y, MASK mask)
1234{ 1134{
1235 if (mEnabled) 1135 if (getEnabled())
1236 { 1136 {
1237 // switch to mouse navigation mode 1137 // switch to mouse navigation mode
1238 LLMenuGL::setKeyboardMode(FALSE); 1138 LLMenuGL::setKeyboardMode(FALSE);
@@ -1335,18 +1235,11 @@ BOOL LLMenuItemBranchGL::handleUnicodeChar(llwchar uni_char, BOOL called_from_pa
1335} 1235}
1336 1236
1337 1237
1338// set the hover status (called by it's menu)
1339void LLMenuItemBranchGL::setHighlight( BOOL highlight ) 1238void LLMenuItemBranchGL::setHighlight( BOOL highlight )
1340{ 1239{
1341 if (highlight == getHighlight()) return; 1240 if (highlight == getHighlight()) return;
1342 1241
1343 // make sure only yourself is highlighted 1242 BOOL auto_open = getEnabled() && (!mBranch->getVisible() || mBranch->getTornOff());
1344 if (highlight)
1345 {
1346 getMenu()->clearHoverItem();
1347 }
1348
1349 BOOL auto_open = mEnabled && (!mBranch->getVisible() || mBranch->getTornOff());
1350 // torn off menus don't open sub menus on hover unless they have focus 1243 // torn off menus don't open sub menus on hover unless they have focus
1351 if (getMenu()->getTornOff() && !((LLFloater*)getMenu()->getParent())->hasFocus()) 1244 if (getMenu()->getTornOff() && !((LLFloater*)getMenu()->getParent())->hasFocus())
1352 { 1245 {
@@ -1357,8 +1250,7 @@ void LLMenuItemBranchGL::setHighlight( BOOL highlight )
1357 { 1250 {
1358 auto_open = FALSE; 1251 auto_open = FALSE;
1359 } 1252 }
1360 1253 LLMenuItemGL::setHighlight(highlight);
1361 mHighlight = highlight;
1362 if( highlight ) 1254 if( highlight )
1363 { 1255 {
1364 if(auto_open) 1256 if(auto_open)
@@ -1380,11 +1272,6 @@ void LLMenuItemBranchGL::setHighlight( BOOL highlight )
1380 } 1272 }
1381} 1273}
1382 1274
1383void LLMenuItemBranchGL::setEnabledSubMenus(BOOL enabled)
1384{
1385 mBranch->setEnabledSubMenus(enabled);
1386}
1387
1388void LLMenuItemBranchGL::draw() 1275void LLMenuItemBranchGL::draw()
1389{ 1276{
1390 LLMenuItemGL::draw(); 1277 LLMenuItemGL::draw();
@@ -1394,18 +1281,6 @@ void LLMenuItemBranchGL::draw()
1394 } 1281 }
1395} 1282}
1396 1283
1397// determine if this object is active
1398// which, for branching menus, means the branch is open and has "focus"
1399BOOL LLMenuItemBranchGL::isActive( void ) const
1400{
1401 return isOpen() && mBranch->getHighlightedItem();
1402}
1403
1404BOOL LLMenuItemBranchGL::isOpen( void ) const
1405{
1406 return mBranch->isOpen();
1407}
1408
1409void LLMenuItemBranchGL::updateBranchParent(LLView* parentp) 1284void LLMenuItemBranchGL::updateBranchParent(LLView* parentp)
1410{ 1285{
1411 if (mBranch->getParent() == NULL) 1286 if (mBranch->getParent() == NULL)
@@ -1478,8 +1353,8 @@ void LLMenuItemBranchGL::openMenu()
1478 1353
1479 LLRect rect = mBranch->getRect(); 1354 LLRect rect = mBranch->getRect();
1480 // calculate root-view relative position for branch menu 1355 // calculate root-view relative position for branch menu
1481 S32 left = mRect.mRight; 1356 S32 left = getRect().mRight;
1482 S32 top = mRect.mTop - mRect.mBottom; 1357 S32 top = getRect().mTop - getRect().mBottom;
1483 1358
1484 localPointToOtherView(left, top, &left, &top, mBranch->getParent()); 1359 localPointToOtherView(left, top, &left, &top, mBranch->getParent());
1485 1360
@@ -1505,7 +1380,7 @@ void LLMenuItemBranchGL::openMenu()
1505 if( x - menu_region_rect.mLeft > menu_region_width - rect.getWidth() ) 1380 if( x - menu_region_rect.mLeft > menu_region_width - rect.getWidth() )
1506 { 1381 {
1507 // move sub-menu over to left side 1382 // move sub-menu over to left side
1508 delta_x = llmax(-x, (-1 * (rect.getWidth() + mRect.getWidth()))); 1383 delta_x = llmax(-x, (-1 * (rect.getWidth() + getRect().getWidth())));
1509 } 1384 }
1510 mBranch->translate( delta_x, delta_y ); 1385 mBranch->translate( delta_x, delta_y );
1511 mBranch->setVisible( TRUE ); 1386 mBranch->setVisible( TRUE );
@@ -1536,7 +1411,7 @@ public:
1536 // returns the normal width of this control in pixels - this is 1411 // returns the normal width of this control in pixels - this is
1537 // used for calculating the widest item, as well as for horizontal 1412 // used for calculating the widest item, as well as for horizontal
1538 // arrangement. 1413 // arrangement.
1539 virtual U32 getNominalWidth( void ); 1414 virtual U32 getNominalWidth( void ) const;
1540 1415
1541 // called to rebuild the draw label 1416 // called to rebuild the draw label
1542 virtual void buildDrawLabel( void ); 1417 virtual void buildDrawLabel( void );
@@ -1570,10 +1445,10 @@ LLMenuItemBranchDownGL::LLMenuItemBranchDownGL( const LLString& name,
1570// returns the normal width of this control in pixels - this is used 1445// returns the normal width of this control in pixels - this is used
1571// for calculating the widest item, as well as for horizontal 1446// for calculating the widest item, as well as for horizontal
1572// arrangement. 1447// arrangement.
1573U32 LLMenuItemBranchDownGL::getNominalWidth( void ) 1448U32 LLMenuItemBranchDownGL::getNominalWidth( void ) const
1574{ 1449{
1575 U32 width = LEFT_PAD_PIXELS + LEFT_WIDTH_PIXELS + RIGHT_PAD_PIXELS; 1450 U32 width = LEFT_PAD_PIXELS + LEFT_WIDTH_PIXELS + RIGHT_PAD_PIXELS;
1576 width += mFont->getWidth( mLabel.getWString().c_str() ); 1451 width += getFont()->getWidth( mLabel.getWString().c_str() );
1577 return width; 1452 return width;
1578} 1453}
1579 1454
@@ -1588,32 +1463,33 @@ void LLMenuItemBranchDownGL::buildDrawLabel( void )
1588 1463
1589void LLMenuItemBranchDownGL::openMenu( void ) 1464void LLMenuItemBranchDownGL::openMenu( void )
1590{ 1465{
1591 if( mBranch->getVisible() && !mBranch->getTornOff() ) 1466 LLMenuGL* branch = getBranch();
1467 if( branch->getVisible() && !branch->getTornOff() )
1592 { 1468 {
1593 mBranch->setVisible( FALSE ); 1469 branch->setVisible( FALSE );
1594 } 1470 }
1595 else 1471 else
1596 { 1472 {
1597 if (mBranch->getTornOff()) 1473 if (branch->getTornOff())
1598 { 1474 {
1599 gFloaterView->bringToFront((LLFloater*)mBranch->getParent()); 1475 gFloaterView->bringToFront((LLFloater*)branch->getParent());
1600 } 1476 }
1601 else 1477 else
1602 { 1478 {
1603 // We're showing the drop-down menu, so patch up its labels/rects 1479 // We're showing the drop-down menu, so patch up its labels/rects
1604 mBranch->arrange(); 1480 branch->arrange();
1605 1481
1606 LLRect rect = mBranch->getRect(); 1482 LLRect rect = branch->getRect();
1607 S32 left = 0; 1483 S32 left = 0;
1608 S32 top = mRect.mBottom; 1484 S32 top = getRect().mBottom;
1609 localPointToOtherView(left, top, &left, &top, mBranch->getParent()); 1485 localPointToOtherView(left, top, &left, &top, branch->getParent());
1610 1486
1611 rect.setLeftTopAndSize( left, top, 1487 rect.setLeftTopAndSize( left, top,
1612 rect.getWidth(), rect.getHeight() ); 1488 rect.getWidth(), rect.getHeight() );
1613 mBranch->setRect( rect ); 1489 branch->setRect( rect );
1614 S32 x = 0; 1490 S32 x = 0;
1615 S32 y = 0; 1491 S32 y = 0;
1616 mBranch->localPointToScreen( 0, 0, &x, &y ); 1492 branch->localPointToScreen( 0, 0, &x, &y );
1617 S32 delta_x = 0; 1493 S32 delta_x = 0;
1618 1494
1619 LLCoordScreen window_size; 1495 LLCoordScreen window_size;
@@ -1625,13 +1501,11 @@ void LLMenuItemBranchDownGL::openMenu( void )
1625 { 1501 {
1626 delta_x = (window_width - rect.getWidth()) - x; 1502 delta_x = (window_width - rect.getWidth()) - x;
1627 } 1503 }
1628 mBranch->translate( delta_x, 0 ); 1504 branch->translate( delta_x, 0 );
1629 1505
1630 setHighlight(TRUE); 1506 setHighlight(TRUE);
1631 mBranch->setVisible( TRUE ); 1507 branch->setVisible( TRUE );
1632 } 1508 }
1633
1634
1635 } 1509 }
1636} 1510}
1637 1511
@@ -1640,21 +1514,18 @@ void LLMenuItemBranchDownGL::setHighlight( BOOL highlight )
1640{ 1514{
1641 if (highlight == getHighlight()) return; 1515 if (highlight == getHighlight()) return;
1642 1516
1643 if (highlight) 1517 //NOTE: Purposely calling all the way to the base to bypass auto-open.
1644 { 1518 LLMenuItemGL::setHighlight(highlight);
1645 getMenu()->clearHoverItem();
1646 }
1647 mHighlight = highlight;
1648 if( !highlight) 1519 if( !highlight)
1649 { 1520 {
1650 if (mBranch->getTornOff()) 1521 if (getBranch()->getTornOff())
1651 { 1522 {
1652 ((LLFloater*)mBranch->getParent())->setFocus(FALSE); 1523 ((LLFloater*)getBranch()->getParent())->setFocus(FALSE);
1653 mBranch->clearHoverItem(); 1524 getBranch()->clearHoverItem();
1654 } 1525 }
1655 else 1526 else
1656 { 1527 {
1657 mBranch->setVisible( FALSE ); 1528 getBranch()->setVisible( FALSE );
1658 } 1529 }
1659 } 1530 }
1660} 1531}
@@ -1684,8 +1555,8 @@ BOOL LLMenuItemBranchDownGL::handleMouseUp( S32 x, S32 y, MASK mask )
1684 1555
1685BOOL LLMenuItemBranchDownGL::handleAcceleratorKey(KEY key, MASK mask) 1556BOOL LLMenuItemBranchDownGL::handleAcceleratorKey(KEY key, MASK mask)
1686{ 1557{
1687 BOOL branch_visible = mBranch->getVisible(); 1558 BOOL branch_visible = getBranch()->getVisible();
1688 BOOL handled = mBranch->handleAcceleratorKey(key, mask); 1559 BOOL handled = getBranch()->handleAcceleratorKey(key, mask);
1689 if (handled && !branch_visible && getVisible()) 1560 if (handled && !branch_visible && getVisible())
1690 { 1561 {
1691 // flash this menu entry because we triggered an invisible menu item 1562 // flash this menu entry because we triggered an invisible menu item
@@ -1697,7 +1568,7 @@ BOOL LLMenuItemBranchDownGL::handleAcceleratorKey(KEY key, MASK mask)
1697 1568
1698BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) 1569BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
1699{ 1570{
1700 BOOL menu_open = mBranch->getVisible(); 1571 BOOL menu_open = getBranch()->getVisible();
1701 // don't do keyboard navigation of top-level menus unless in keyboard mode, or menu expanded 1572 // don't do keyboard navigation of top-level menus unless in keyboard mode, or menu expanded
1702 if (getHighlight() && getMenu()->getVisible() && (isActive() || LLMenuGL::getKeyboardMode())) 1573 if (getHighlight() && getMenu()->getVisible() && (isActive() || LLMenuGL::getKeyboardMode()))
1703 { 1574 {
@@ -1738,7 +1609,7 @@ BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask, BOOL called_from_
1738 { 1609 {
1739 doIt(); 1610 doIt();
1740 } 1611 }
1741 mBranch->highlightNextItem(NULL); 1612 getBranch()->highlightNextItem(NULL);
1742 return TRUE; 1613 return TRUE;
1743 } 1614 }
1744 else if (key == KEY_UP) 1615 else if (key == KEY_UP)
@@ -1750,7 +1621,7 @@ BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask, BOOL called_from_
1750 { 1621 {
1751 doIt(); 1622 doIt();
1752 } 1623 }
1753 mBranch->highlightPrevItem(NULL); 1624 getBranch()->highlightPrevItem(NULL);
1754 return TRUE; 1625 return TRUE;
1755 } 1626 }
1756 } 1627 }
@@ -1761,19 +1632,19 @@ BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask, BOOL called_from_
1761void LLMenuItemBranchDownGL::draw( void ) 1632void LLMenuItemBranchDownGL::draw( void )
1762{ 1633{
1763 //FIXME: try removing this 1634 //FIXME: try removing this
1764 if (mBranch->getVisible() && !mBranch->getTornOff()) 1635 if (getBranch()->getVisible() && !getBranch()->getTornOff())
1765 { 1636 {
1766 setHighlight(TRUE); 1637 setHighlight(TRUE);
1767 } 1638 }
1768 1639
1769 if( getHighlight() ) 1640 if( getHighlight() )
1770 { 1641 {
1771 glColor4fv( sHighlightBackground.mV ); 1642 gGL.color4fv( getHighlightBGColor().mV );
1772 gl_rect_2d( 0, mRect.getHeight(), mRect.getWidth(), 0 ); 1643 gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0 );
1773 } 1644 }
1774 1645
1775 U8 font_style = mStyle; 1646 U8 font_style = getFontStyle();
1776 if (LLMenuItemGL::sDropShadowText && getEnabled() && !mDrawTextDisabled ) 1647 if (getEnabled() && !getDrawTextDisabled() )
1777 { 1648 {
1778 font_style |= LLFontGL::DROP_SHADOW_SOFT; 1649 font_style |= LLFontGL::DROP_SHADOW_SOFT;
1779 } 1650 }
@@ -1781,17 +1652,17 @@ void LLMenuItemBranchDownGL::draw( void )
1781 LLColor4 color; 1652 LLColor4 color;
1782 if (getHighlight()) 1653 if (getHighlight())
1783 { 1654 {
1784 color = sHighlightForeground; 1655 color = getHighlightFGColor();
1785 } 1656 }
1786 else if( mEnabled ) 1657 else if( getEnabled() )
1787 { 1658 {
1788 color = sEnabledColor; 1659 color = getEnabledColor();
1789 } 1660 }
1790 else 1661 else
1791 { 1662 {
1792 color = sDisabledColor; 1663 color = getDisabledColor();
1793 } 1664 }
1794 mFont->render( mLabel.getWString(), 0, (F32)mRect.getWidth() / 2.f, (F32)LABEL_BOTTOM_PAD_PIXELS, color, 1665 getFont()->render( mLabel.getWString(), 0, (F32)getRect().getWidth() / 2.f, (F32)LABEL_BOTTOM_PAD_PIXELS, color,
1795 LLFontGL::HCENTER, LLFontGL::BOTTOM, font_style ); 1666 LLFontGL::HCENTER, LLFontGL::BOTTOM, font_style );
1796 1667
1797 1668
@@ -1800,19 +1671,19 @@ void LLMenuItemBranchDownGL::draw( void )
1800 { 1671 {
1801 LLString upper_case_label = mLabel.getString(); 1672 LLString upper_case_label = mLabel.getString();
1802 LLString::toUpper(upper_case_label); 1673 LLString::toUpper(upper_case_label);
1803 std::string::size_type offset = upper_case_label.find(mJumpKey); 1674 std::string::size_type offset = upper_case_label.find(getJumpKey());
1804 if (offset != std::string::npos) 1675 if (offset != std::string::npos)
1805 { 1676 {
1806 S32 x_offset = llround((F32)mRect.getWidth() / 2.f - mFont->getWidthF32(mLabel.getString(), 0, S32_MAX) / 2.f); 1677 S32 x_offset = llround((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(mLabel.getString(), 0, S32_MAX) / 2.f);
1807 S32 x_begin = x_offset + mFont->getWidth(mLabel, 0, offset); 1678 S32 x_begin = x_offset + getFont()->getWidth(mLabel, 0, offset);
1808 S32 x_end = x_offset + mFont->getWidth(mLabel, 0, offset + 1); 1679 S32 x_end = x_offset + getFont()->getWidth(mLabel, 0, offset + 1);
1809 gl_line_2d(x_begin, LABEL_BOTTOM_PAD_PIXELS, x_end, LABEL_BOTTOM_PAD_PIXELS); 1680 gl_line_2d(x_begin, LABEL_BOTTOM_PAD_PIXELS, x_end, LABEL_BOTTOM_PAD_PIXELS);
1810 } 1681 }
1811 } 1682 }
1812 1683
1813 // reset every frame so that we only show highlight 1684 // reset every frame so that we only show highlight
1814 // when we get hover events on that frame 1685 // when we get hover events on that frame
1815 mGotHover = FALSE; 1686 setHover(FALSE);
1816} 1687}
1817 1688
1818///============================================================================ 1689///============================================================================
@@ -1820,7 +1691,7 @@ void LLMenuItemBranchDownGL::draw( void )
1820///============================================================================ 1691///============================================================================
1821 1692
1822// Default constructor 1693// Default constructor
1823LLMenuGL::LLMenuGL( const LLString& name, const LLString& label, LLViewHandle parent_floater_handle ) 1694LLMenuGL::LLMenuGL( const LLString& name, const LLString& label, LLHandle<LLFloater> parent_floater_handle )
1824: LLUICtrl( name, LLRect(), FALSE, NULL, NULL ), 1695: LLUICtrl( name, LLRect(), FALSE, NULL, NULL ),
1825 mBackgroundColor( sDefaultBackgroundColor ), 1696 mBackgroundColor( sDefaultBackgroundColor ),
1826 mBgVisible( TRUE ), 1697 mBgVisible( TRUE ),
@@ -1845,7 +1716,7 @@ LLMenuGL::LLMenuGL( const LLString& name, const LLString& label, LLViewHandle pa
1845 setTabStop(FALSE); 1716 setTabStop(FALSE);
1846} 1717}
1847 1718
1848LLMenuGL::LLMenuGL( const LLString& label, LLViewHandle parent_floater_handle ) 1719LLMenuGL::LLMenuGL( const LLString& label, LLHandle<LLFloater> parent_floater_handle )
1849: LLUICtrl( label, LLRect(), FALSE, NULL, NULL ), 1720: LLUICtrl( label, LLRect(), FALSE, NULL, NULL ),
1850 mBackgroundColor( sDefaultBackgroundColor ), 1721 mBackgroundColor( sDefaultBackgroundColor ),
1851 mBgVisible( TRUE ), 1722 mBgVisible( TRUE ),
@@ -1879,7 +1750,7 @@ LLMenuGL::~LLMenuGL( void )
1879 mJumpKeys.clear(); 1750 mJumpKeys.clear();
1880} 1751}
1881 1752
1882void LLMenuGL::setCanTearOff(BOOL tear_off, LLViewHandle parent_floater_handle ) 1753void LLMenuGL::setCanTearOff(BOOL tear_off, LLHandle<LLFloater> parent_floater_handle )
1883{ 1754{
1884 if (tear_off && mTearOffItem == NULL) 1755 if (tear_off && mTearOffItem == NULL)
1885 { 1756 {
@@ -2317,29 +2188,13 @@ LLView* LLMenuGL::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa
2317 return menu; 2188 return menu;
2318} 2189}
2319 2190
2320// control the color scheme
2321void LLMenuGL::setDefaultBackgroundColor( const LLColor4& color )
2322{
2323 sDefaultBackgroundColor = color;
2324}
2325
2326void LLMenuGL::setBackgroundColor( const LLColor4& color )
2327{
2328 mBackgroundColor = color;
2329}
2330
2331LLColor4 LLMenuGL::getBackgroundColor()
2332{
2333 return mBackgroundColor;
2334}
2335
2336 2191
2337// rearrange the child rects so they fit the shape of the menu. 2192// rearrange the child rects so they fit the shape of the menu.
2338void LLMenuGL::arrange( void ) 2193void LLMenuGL::arrange( void )
2339{ 2194{
2340 // calculate the height & width, and set our rect based on that 2195 // calculate the height & width, and set our rect based on that
2341 // information. 2196 // information.
2342 LLRect initial_rect = mRect; 2197 const LLRect& initial_rect = getRect();
2343 2198
2344 U32 width = 0, height = MENU_ITEM_PADDING; 2199 U32 width = 0, height = MENU_ITEM_PADDING;
2345 2200
@@ -2349,8 +2204,9 @@ void LLMenuGL::arrange( void )
2349 { 2204 {
2350 const LLRect menu_region_rect = LLMenuGL::sMenuContainer ? LLMenuGL::sMenuContainer->getMenuRect() : LLRect(0, S32_MAX, S32_MAX, 0); 2205 const LLRect menu_region_rect = LLMenuGL::sMenuContainer ? LLMenuGL::sMenuContainer->getMenuRect() : LLRect(0, S32_MAX, S32_MAX, 0);
2351 2206
2352 U32 max_width = menu_region_rect.getWidth(); 2207 // torn off menus are not constrained to the size of the screen
2353 U32 max_height = menu_region_rect.getHeight(); 2208 U32 max_width = getTornOff() ? U32_MAX : menu_region_rect.getWidth();
2209 U32 max_height = getTornOff() ? U32_MAX : menu_region_rect.getHeight();
2354 // *FIX: create the item first and then ask for its dimensions? 2210 // *FIX: create the item first and then ask for its dimensions?
2355 S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::sSansSerif->getWidth( "More" ); 2211 S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::sSansSerif->getWidth( "More" );
2356 S32 spillover_item_height = llround(LLFontGL::sSansSerif->getLineHeight()) + MENU_ITEM_PADDING; 2212 S32 spillover_item_height = llround(LLFontGL::sSansSerif->getLineHeight()) + MENU_ITEM_PADDING;
@@ -2429,8 +2285,7 @@ void LLMenuGL::arrange( void )
2429 } 2285 }
2430 } 2286 }
2431 2287
2432 mRect.mRight = mRect.mLeft + width; 2288 setRect(LLRect(getRect().mLeft, getRect().mBottom + height, getRect().mLeft + width, getRect().mBottom));
2433 mRect.mTop = mRect.mBottom + height;
2434 2289
2435 S32 cur_height = (S32)llmin(max_height, height); 2290 S32 cur_height = (S32)llmin(max_height, height);
2436 S32 cur_width = 0; 2291 S32 cur_width = 0;
@@ -2622,8 +2477,7 @@ void LLMenuGL::empty( void )
2622// Adjust rectangle of the menu 2477// Adjust rectangle of the menu
2623void LLMenuGL::setLeftAndBottom(S32 left, S32 bottom) 2478void LLMenuGL::setLeftAndBottom(S32 left, S32 bottom)
2624{ 2479{
2625 mRect.mLeft = left; 2480 setRect(LLRect(left, getRect().mTop, getRect().mRight, bottom));
2626 mRect.mBottom = bottom;
2627 arrange(); 2481 arrange();
2628} 2482}
2629 2483
@@ -2953,7 +2807,7 @@ BOOL LLMenuGL::handleKey( KEY key, MASK mask, BOOL called_from_parent )
2953 BOOL handled = FALSE; 2807 BOOL handled = FALSE;
2954 2808
2955 // Pass down even if not visible 2809 // Pass down even if not visible
2956 if( mEnabled && called_from_parent ) 2810 if( getEnabled() && called_from_parent )
2957 { 2811 {
2958 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) 2812 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
2959 { 2813 {
@@ -2981,7 +2835,7 @@ BOOL LLMenuGL::handleKey( KEY key, MASK mask, BOOL called_from_parent )
2981BOOL LLMenuGL::handleAcceleratorKey(KEY key, MASK mask) 2835BOOL LLMenuGL::handleAcceleratorKey(KEY key, MASK mask)
2982{ 2836{
2983 // don't handle if not enabled 2837 // don't handle if not enabled
2984 if(!mEnabled) 2838 if(!getEnabled())
2985 { 2839 {
2986 return FALSE; 2840 return FALSE;
2987 } 2841 }
@@ -3080,7 +2934,7 @@ void LLMenuGL::draw( void )
3080{ 2934{
3081 if (mDropShadowed && !mTornOff) 2935 if (mDropShadowed && !mTornOff)
3082 { 2936 {
3083 gl_drop_shadow(0, mRect.getHeight(), mRect.getWidth(), 0, 2937 gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0,
3084 LLUI::sColorsGroup->getColor("ColorDropShadow"), 2938 LLUI::sColorsGroup->getColor("ColorDropShadow"),
3085 LLUI::sConfigGroup->getS32("DropShadowFloater") ); 2939 LLUI::sConfigGroup->getS32("DropShadowFloater") );
3086 } 2940 }
@@ -3089,14 +2943,14 @@ void LLMenuGL::draw( void )
3089 2943
3090 if( mBgVisible ) 2944 if( mBgVisible )
3091 { 2945 {
3092 gl_rect_2d( 0, mRect.getHeight(), mRect.getWidth(), 0, mBackgroundColor ); 2946 gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0, mBackgroundColor );
3093 } 2947 }
3094 LLView::draw(); 2948 LLView::draw();
3095} 2949}
3096 2950
3097void LLMenuGL::drawBackground(LLMenuItemGL* itemp, LLColor4& color) 2951void LLMenuGL::drawBackground(LLMenuItemGL* itemp, LLColor4& color)
3098{ 2952{
3099 glColor4fv( color.mV ); 2953 gGL.color4fv( color.mV );
3100 LLRect item_rect = itemp->getRect(); 2954 LLRect item_rect = itemp->getRect();
3101 gl_rect_2d( 0, item_rect.getHeight(), item_rect.getWidth(), 0); 2955 gl_rect_2d( 0, item_rect.getHeight(), item_rect.getWidth(), 0);
3102} 2956}
@@ -3139,7 +2993,7 @@ LLMenuGL* LLMenuGL::getChildMenuByName(const LLString& name, BOOL recurse) const
3139 return (LLMenuGL*)view; 2993 return (LLMenuGL*)view;
3140 } 2994 }
3141 } 2995 }
3142 llwarns << "Child Menu " << name << " not found in menu " << mName << llendl; 2996 llwarns << "Child Menu " << name << " not found in menu " << getName() << llendl;
3143 return NULL; 2997 return NULL;
3144} 2998}
3145 2999
@@ -3254,7 +3108,7 @@ void LLPieMenuBranch::buildDrawLabel( void )
3254 if(mEnabledCallback) 3108 if(mEnabledCallback)
3255 { 3109 {
3256 setEnabled(mEnabledCallback(mUserData)); 3110 setEnabled(mEnabledCallback(mUserData));
3257 mDrawTextDisabled = FALSE; 3111 setDrawTextDisabled(FALSE);
3258 } 3112 }
3259 else 3113 else
3260 { 3114 {
@@ -3273,7 +3127,7 @@ void LLPieMenuBranch::buildDrawLabel( void )
3273 break; 3127 break;
3274 } 3128 }
3275 } 3129 }
3276 mDrawTextDisabled = !any_enabled; 3130 setDrawTextDisabled(!any_enabled);
3277 setEnabled(TRUE); 3131 setEnabled(TRUE);
3278 } 3132 }
3279 3133
@@ -3334,20 +3188,6 @@ LLPieMenu::LLPieMenu(const LLString& name)
3334 setCanTearOff(FALSE); 3188 setCanTearOff(FALSE);
3335} 3189}
3336 3190
3337// virtual
3338LLPieMenu::~LLPieMenu()
3339{ }
3340
3341
3342EWidgetType LLPieMenu::getWidgetType() const
3343{
3344 return WIDGET_TYPE_PIE_MENU;
3345}
3346
3347LLString LLPieMenu::getWidgetTag() const
3348{
3349 return LL_PIE_MENU_TAG;
3350}
3351 3191
3352void LLPieMenu::initXML(LLXMLNodePtr node, LLView *context, LLUICtrlFactory *factory) 3192void LLPieMenu::initXML(LLXMLNodePtr node, LLView *context, LLUICtrlFactory *factory)
3353{ 3193{
@@ -3621,8 +3461,8 @@ void LLPieMenu::draw()
3621 mHoverItem = NULL; 3461 mHoverItem = NULL;
3622 } 3462 }
3623 3463
3624 F32 width = (F32) mRect.getWidth(); 3464 F32 width = (F32) getRect().getWidth();
3625 F32 height = (F32) mRect.getHeight(); 3465 F32 height = (F32) getRect().getHeight();
3626 mCurRadius = PIE_SCALE_FACTOR * llmax( width/2, height/2 ); 3466 mCurRadius = PIE_SCALE_FACTOR * llmax( width/2, height/2 );
3627 3467
3628 mOuterRingAlpha = mUseInfiniteRadius ? 0.f : 1.f; 3468 mOuterRingAlpha = mUseInfiniteRadius ? 0.f : 1.f;
@@ -3637,9 +3477,9 @@ void LLPieMenu::draw()
3637 F32 center_y = height/2; 3477 F32 center_y = height/2;
3638 S32 steps = 100; 3478 S32 steps = 100;
3639 3479
3640 glPushMatrix(); 3480 gGL.pushMatrix();
3641 { 3481 {
3642 glTranslatef(center_x, center_y, 0.f); 3482 gGL.translatef(center_x, center_y, 0.f);
3643 3483
3644 F32 line_width = LLUI::sConfigGroup->getF32("PieMenuLineWidth"); 3484 F32 line_width = LLUI::sConfigGroup->getF32("PieMenuLineWidth");
3645 LLColor4 line_color = LLUI::sColorsGroup->getColor("PieMenuLineColor"); 3485 LLColor4 line_color = LLUI::sColorsGroup->getColor("PieMenuLineColor");
@@ -3678,16 +3518,16 @@ void LLPieMenu::draw()
3678 gl_washer_spokes_2d( mCurRadius, (F32)PIE_CENTER_SIZE, 8, line_color, outer_color ); 3518 gl_washer_spokes_2d( mCurRadius, (F32)PIE_CENTER_SIZE, 8, line_color, outer_color );
3679 3519
3680 // inner circle 3520 // inner circle
3681 glColor4fv( line_color.mV ); 3521 gGL.color4fv( line_color.mV );
3682 gl_circle_2d( 0, 0, (F32)PIE_CENTER_SIZE, steps, FALSE ); 3522 gl_circle_2d( 0, 0, (F32)PIE_CENTER_SIZE, steps, FALSE );
3683 3523
3684 // outer circle 3524 // outer circle
3685 glColor4fv( outer_color.mV ); 3525 gGL.color4fv( outer_color.mV );
3686 gl_circle_2d( 0, 0, mCurRadius, steps, FALSE ); 3526 gl_circle_2d( 0, 0, mCurRadius, steps, FALSE );
3687 3527
3688 LLUI::setLineWidth(1.0f); 3528 LLUI::setLineWidth(1.0f);
3689 } 3529 }
3690 glPopMatrix(); 3530 gGL.popMatrix();
3691 3531
3692 mHoverThisFrame = FALSE; 3532 mHoverThisFrame = FALSE;
3693 3533
@@ -3696,16 +3536,16 @@ void LLPieMenu::draw()
3696 3536
3697void LLPieMenu::drawBackground(LLMenuItemGL* itemp, LLColor4& color) 3537void LLPieMenu::drawBackground(LLMenuItemGL* itemp, LLColor4& color)
3698{ 3538{
3699 F32 width = (F32) mRect.getWidth(); 3539 F32 width = (F32) getRect().getWidth();
3700 F32 height = (F32) mRect.getHeight(); 3540 F32 height = (F32) getRect().getHeight();
3701 F32 center_x = width/2; 3541 F32 center_x = width/2;
3702 F32 center_y = height/2; 3542 F32 center_y = height/2;
3703 S32 steps = 100; 3543 S32 steps = 100;
3704 3544
3705 glColor4fv( color.mV ); 3545 gGL.color4fv( color.mV );
3706 glPushMatrix(); 3546 gGL.pushMatrix();
3707 { 3547 {
3708 glTranslatef(center_x - itemp->getRect().mLeft, center_y - itemp->getRect().mBottom, 0.f); 3548 gGL.translatef(center_x - itemp->getRect().mLeft, center_y - itemp->getRect().mBottom, 0.f);
3709 3549
3710 item_list_t::iterator item_iter; 3550 item_list_t::iterator item_iter;
3711 S32 i = 0; 3551 S32 i = 0;
@@ -3725,7 +3565,7 @@ void LLPieMenu::drawBackground(LLMenuItemGL* itemp, LLColor4& color)
3725 i++; 3565 i++;
3726 } 3566 }
3727 } 3567 }
3728 glPopMatrix(); 3568 gGL.popMatrix();
3729} 3569}
3730 3570
3731// virtual 3571// virtual
@@ -3790,7 +3630,8 @@ void LLPieMenu::arrange()
3790 3630
3791 // TODO: Compute actual bounding rect for menu 3631 // TODO: Compute actual bounding rect for menu
3792 3632
3793 mRect.setOriginAndSize(mRect.mLeft, mRect.mBottom, rect_width, rect_height ); 3633 // HACK: casting away const. Should use setRect or some helper function instead.
3634 const_cast<LLRect&>(getRect()).setOriginAndSize(getRect().mLeft, getRect().mBottom, rect_width, rect_height );
3794 3635
3795 // place items around a circle, with item 0 at positive X, 3636 // place items around a circle, with item 0 at positive X,
3796 // rotating counter-clockwise 3637 // rotating counter-clockwise
@@ -3827,8 +3668,8 @@ LLMenuItemGL *LLPieMenu::pieItemFromXY(S32 x, S32 y)
3827 3668
3828 // An arc of the pie menu is 45 degrees 3669 // An arc of the pie menu is 45 degrees
3829 const F32 ARC_DEG = 45.f; 3670 const F32 ARC_DEG = 45.f;
3830 S32 delta_x = x - mRect.getWidth() / 2; 3671 S32 delta_x = x - getRect().getWidth() / 2;
3831 S32 delta_y = y - mRect.getHeight() / 2; 3672 S32 delta_y = y - getRect().getHeight() / 2;
3832 3673
3833 // circle safe zone in the center 3674 // circle safe zone in the center
3834 S32 dist_squared = delta_x*delta_x + delta_y*delta_y; 3675 S32 dist_squared = delta_x*delta_x + delta_y*delta_y;
@@ -3838,7 +3679,7 @@ LLMenuItemGL *LLPieMenu::pieItemFromXY(S32 x, S32 y)
3838 } 3679 }
3839 3680
3840 // infinite radius is only used with right clicks 3681 // infinite radius is only used with right clicks
3841 S32 radius = llmax( mRect.getWidth()/2, mRect.getHeight()/2 ); 3682 S32 radius = llmax( getRect().getWidth()/2, getRect().getHeight()/2 );
3842 if (!(mUseInfiniteRadius && mRightMouseDown) && dist_squared > radius * radius) 3683 if (!(mUseInfiniteRadius && mRightMouseDown) && dist_squared > radius * radius)
3843 { 3684 {
3844 return NULL; 3685 return NULL;
@@ -3876,8 +3717,8 @@ S32 LLPieMenu::pieItemIndexFromXY(S32 x, S32 y)
3876 // An arc of the pie menu is 45 degrees 3717 // An arc of the pie menu is 45 degrees
3877 const F32 ARC_DEG = 45.f; 3718 const F32 ARC_DEG = 45.f;
3878 // correct for non-square pixels 3719 // correct for non-square pixels
3879 S32 delta_x = x - mRect.getWidth() / 2; 3720 S32 delta_x = x - getRect().getWidth() / 2;
3880 S32 delta_y = y - mRect.getHeight() / 2; 3721 S32 delta_y = y - getRect().getHeight() / 2;
3881 3722
3882 // circle safe zone in the center 3723 // circle safe zone in the center
3883 if (delta_x*delta_x + delta_y*delta_y < PIE_CENTER_SIZE*PIE_CENTER_SIZE) 3724 if (delta_x*delta_x + delta_y*delta_y < PIE_CENTER_SIZE*PIE_CENTER_SIZE)
@@ -3900,8 +3741,8 @@ S32 LLPieMenu::pieItemIndexFromXY(S32 x, S32 y)
3900 3741
3901void LLPieMenu::show(S32 x, S32 y, BOOL mouse_down) 3742void LLPieMenu::show(S32 x, S32 y, BOOL mouse_down)
3902{ 3743{
3903 S32 width = mRect.getWidth(); 3744 S32 width = getRect().getWidth();
3904 S32 height = mRect.getHeight(); 3745 S32 height = getRect().getHeight();
3905 3746
3906 const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getMenuRect(); 3747 const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getMenuRect();
3907 3748
@@ -3911,40 +3752,45 @@ void LLPieMenu::show(S32 x, S32 y, BOOL mouse_down)
3911 S32 local_x, local_y; 3752 S32 local_x, local_y;
3912 parent_view->screenPointToLocal(x, y, &local_x, &local_y); 3753 parent_view->screenPointToLocal(x, y, &local_x, &local_y);
3913 3754
3914 mRect.setCenterAndSize(local_x, local_y, width, height); 3755 // HACK: casting away const. Should use setRect or some helper function instead.
3756 const_cast<LLRect&>(getRect()).setCenterAndSize(local_x, local_y, width, height);
3915 arrange(); 3757 arrange();
3916 3758
3917 // Adjust the pie rectangle to keep it on screen 3759 // Adjust the pie rectangle to keep it on screen
3918 if (mRect.mLeft < menu_region_rect.mLeft) 3760 if (getRect().mLeft < menu_region_rect.mLeft)
3919 { 3761 {
3920 //mShiftHoriz = menu_region_rect.mLeft - mRect.mLeft; 3762 //mShiftHoriz = menu_region_rect.mLeft - getRect().mLeft;
3921 //mRect.translate( mShiftHoriz, 0 ); 3763 //getRect().translate( mShiftHoriz, 0 );
3922 mRect.translate( menu_region_rect.mLeft - mRect.mLeft, 0 ); 3764 // HACK: casting away const. Should use setRect or some helper function instead.
3765 const_cast<LLRect&>(getRect()).translate( menu_region_rect.mLeft - getRect().mLeft, 0 );
3923 moved = TRUE; 3766 moved = TRUE;
3924 } 3767 }
3925 3768
3926 if (mRect.mRight > menu_region_rect.mRight) 3769 if (getRect().mRight > menu_region_rect.mRight)
3927 { 3770 {
3928 //mShiftHoriz = menu_region_rect.mRight - mRect.mRight; 3771 //mShiftHoriz = menu_region_rect.mRight - getRect().mRight;
3929 //mRect.translate( mShiftHoriz, 0); 3772 //getRect().translate( mShiftHoriz, 0);
3930 mRect.translate( menu_region_rect.mRight - mRect.mRight, 0 ); 3773 // HACK: casting away const. Should use setRect or some helper function instead.
3774 const_cast<LLRect&>(getRect()).translate( menu_region_rect.mRight - getRect().mRight, 0 );
3931 moved = TRUE; 3775 moved = TRUE;
3932 } 3776 }
3933 3777
3934 if (mRect.mBottom < menu_region_rect.mBottom) 3778 if (getRect().mBottom < menu_region_rect.mBottom)
3935 { 3779 {
3936 //mShiftVert = menu_region_rect.mBottom - mRect.mBottom; 3780 //mShiftVert = menu_region_rect.mBottom - getRect().mBottom;
3937 //mRect.translate( 0, mShiftVert ); 3781 //getRect().translate( 0, mShiftVert );
3938 mRect.translate( 0, menu_region_rect.mBottom - mRect.mBottom ); 3782 // HACK: casting away const. Should use setRect or some helper function instead.
3783 const_cast<LLRect&>(getRect()).translate( 0, menu_region_rect.mBottom - getRect().mBottom );
3939 moved = TRUE; 3784 moved = TRUE;
3940 } 3785 }
3941 3786
3942 3787
3943 if (mRect.mTop > menu_region_rect.mTop) 3788 if (getRect().mTop > menu_region_rect.mTop)
3944 { 3789 {
3945 //mShiftVert = menu_region_rect.mTop - mRect.mTop; 3790 //mShiftVert = menu_region_rect.mTop - getRect().mTop;
3946 //mRect.translate( 0, mShiftVert ); 3791 //getRect().translate( 0, mShiftVert );
3947 mRect.translate( 0, menu_region_rect.mTop - mRect.mTop ); 3792 // HACK: casting away const. Should use setRect or some helper function instead.
3793 const_cast<LLRect&>(getRect()).translate( 0, menu_region_rect.mTop - getRect().mTop );
3948 moved = TRUE; 3794 moved = TRUE;
3949 } 3795 }
3950 3796
@@ -3953,8 +3799,8 @@ void LLPieMenu::show(S32 x, S32 y, BOOL mouse_down)
3953 if (moved) 3799 if (moved)
3954 { 3800 {
3955 LLCoordGL center; 3801 LLCoordGL center;
3956 center.mX = (mRect.mLeft + mRect.mRight) / 2; 3802 center.mX = (getRect().mLeft + getRect().mRight) / 2;
3957 center.mY = (mRect.mTop + mRect.mBottom) / 2; 3803 center.mY = (getRect().mTop + getRect().mBottom) / 2;
3958 3804
3959 LLUI::setCursorPositionLocal(getParent(), center.mX, center.mY); 3805 LLUI::setCursorPositionLocal(getParent(), center.mX, center.mY);
3960 } 3806 }
@@ -4066,7 +3912,7 @@ LLView* LLMenuBarGL::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
4066 3912
4067 LLMenuBarGL *menubar = new LLMenuBarGL(name); 3913 LLMenuBarGL *menubar = new LLMenuBarGL(name);
4068 3914
4069 LLViewHandle parent_handle = LLViewHandle::sDeadHandle; 3915 LLHandle<LLFloater> parent_handle;
4070 if (parent->getWidgetType() == WIDGET_TYPE_FLOATER) 3916 if (parent->getWidgetType() == WIDGET_TYPE_FLOATER)
4071 { 3917 {
4072 parent_handle = ((LLFloater*)parent)->getHandle(); 3918 parent_handle = ((LLFloater*)parent)->getHandle();
@@ -4246,7 +4092,7 @@ BOOL LLMenuBarGL::jumpKeysActive()
4246void LLMenuBarGL::arrange( void ) 4092void LLMenuBarGL::arrange( void )
4247{ 4093{
4248 U32 pos = 0; 4094 U32 pos = 0;
4249 LLRect rect( 0, mRect.getHeight(), 0, 0 ); 4095 LLRect rect( 0, getRect().getHeight(), 0, 0 );
4250 item_list_t::const_iterator item_iter; 4096 item_list_t::const_iterator item_iter;
4251 for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter) 4097 for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter)
4252 { 4098 {
@@ -4398,25 +4244,12 @@ LLMenuHolderGL::LLMenuHolderGL(const LLString& name, const LLRect& rect, BOOL mo
4398 mCanHide = TRUE; 4244 mCanHide = TRUE;
4399} 4245}
4400 4246
4401LLMenuHolderGL::~LLMenuHolderGL()
4402{
4403}
4404
4405EWidgetType LLMenuHolderGL::getWidgetType() const
4406{
4407 return WIDGET_TYPE_MENU_HOLDER;
4408}
4409
4410LLString LLMenuHolderGL::getWidgetTag() const
4411{
4412 return LL_MENU_HOLDER_GL_TAG;
4413}
4414 4247
4415void LLMenuHolderGL::draw() 4248void LLMenuHolderGL::draw()
4416{ 4249{
4417 LLView::draw(); 4250 LLView::draw();
4418 // now draw last selected item as overlay 4251 // now draw last selected item as overlay
4419 LLMenuItemGL* selecteditem = (LLMenuItemGL*)LLView::getViewByHandle(sItemLastSelectedHandle); 4252 LLMenuItemGL* selecteditem = (LLMenuItemGL*)sItemLastSelectedHandle.get();
4420 if (selecteditem && sItemActivationTimer.getStarted() && sItemActivationTimer.getElapsedTimeF32() < ACTIVATE_HIGHLIGHT_TIME) 4253 if (selecteditem && sItemActivationTimer.getStarted() && sItemActivationTimer.getElapsedTimeF32() < ACTIVATE_HIGHLIGHT_TIME)
4421 { 4254 {
4422 // make sure toggle items, for example, show the proper state when fading out 4255 // make sure toggle items, for example, show the proper state when fading out
@@ -4426,10 +4259,10 @@ void LLMenuHolderGL::draw()
4426 selecteditem->localRectToOtherView(selecteditem->getLocalRect(), &item_rect, this); 4259 selecteditem->localRectToOtherView(selecteditem->getLocalRect(), &item_rect, this);
4427 4260
4428 F32 interpolant = sItemActivationTimer.getElapsedTimeF32() / ACTIVATE_HIGHLIGHT_TIME; 4261 F32 interpolant = sItemActivationTimer.getElapsedTimeF32() / ACTIVATE_HIGHLIGHT_TIME;
4429 F32 alpha = lerp(LLMenuItemGL::sHighlightBackground.mV[VALPHA], 0.f, interpolant); 4262 F32 alpha = lerp(LLMenuItemGL::getHighlightBGColor().mV[VALPHA], 0.f, interpolant);
4430 LLColor4 bg_color(LLMenuItemGL::sHighlightBackground.mV[VRED], 4263 LLColor4 bg_color(LLMenuItemGL::getHighlightBGColor().mV[VRED],
4431 LLMenuItemGL::sHighlightBackground.mV[VGREEN], 4264 LLMenuItemGL::getHighlightBGColor().mV[VGREEN],
4432 LLMenuItemGL::sHighlightBackground.mV[VBLUE], 4265 LLMenuItemGL::getHighlightBGColor().mV[VBLUE],
4433 alpha); 4266 alpha);
4434 4267
4435 LLUI::pushMatrix(); 4268 LLUI::pushMatrix();
@@ -4466,7 +4299,7 @@ BOOL LLMenuHolderGL::handleRightMouseDown( S32 x, S32 y, MASK mask )
4466 4299
4467void LLMenuHolderGL::reshape(S32 width, S32 height, BOOL called_from_parent) 4300void LLMenuHolderGL::reshape(S32 width, S32 height, BOOL called_from_parent)
4468{ 4301{
4469 if (width != mRect.getWidth() || height != mRect.getHeight()) 4302 if (width != getRect().getWidth() || height != getRect().getHeight())
4470 { 4303 {
4471 hideMenus(); 4304 hideMenus();
4472 } 4305 }
@@ -4486,10 +4319,6 @@ BOOL LLMenuHolderGL::hasVisibleMenu() const
4486 return FALSE; 4319 return FALSE;
4487} 4320}
4488 4321
4489const LLRect LLMenuHolderGL::getMenuRect() const
4490{
4491 return getLocalRect();
4492}
4493 4322
4494BOOL LLMenuHolderGL::hideMenus() 4323BOOL LLMenuHolderGL::hideMenus()
4495{ 4324{
@@ -4522,7 +4351,7 @@ BOOL LLMenuHolderGL::hideMenus()
4522 4351
4523void LLMenuHolderGL::setActivatedItem(LLMenuItemGL* item) 4352void LLMenuHolderGL::setActivatedItem(LLMenuItemGL* item)
4524{ 4353{
4525 sItemLastSelectedHandle = item->mViewHandle; 4354 sItemLastSelectedHandle = item->getHandle();
4526 sItemActivationTimer.start(); 4355 sItemActivationTimer.start();
4527} 4356}
4528 4357
@@ -4532,20 +4361,24 @@ void LLMenuHolderGL::setActivatedItem(LLMenuItemGL* item)
4532LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) : 4361LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) :
4533 LLFloater(menup->getName(), LLRect(0, 100, 100, 0), menup->getLabel(), FALSE, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, FALSE) 4362 LLFloater(menup->getName(), LLRect(0, 100, 100, 0), menup->getLabel(), FALSE, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, FALSE)
4534{ 4363{
4364 // flag menu as being torn off
4365 menup->setTornOff(TRUE);
4366 // update menu layout as torn off menu (no spillover menus)
4367 menup->arrange();
4368
4535 LLRect rect; 4369 LLRect rect;
4536 menup->localRectToOtherView(LLRect(-1, menup->getRect().getHeight(), menup->getRect().getWidth() + 3, 0), &rect, gFloaterView); 4370 menup->localRectToOtherView(LLRect(-1, menup->getRect().getHeight(), menup->getRect().getWidth() + 3, 0), &rect, gFloaterView);
4371 // make sure this floater is big enough for menu
4537 mTargetHeight = (F32)(rect.getHeight() + LLFLOATER_HEADER_SIZE + 5); 4372 mTargetHeight = (F32)(rect.getHeight() + LLFLOATER_HEADER_SIZE + 5);
4538 reshape(rect.getWidth(), rect.getHeight()); 4373 reshape(rect.getWidth(), rect.getHeight());
4539 setRect(rect); 4374 setRect(rect);
4540 mOldParent = menup->getParent();
4541 mOldParent->removeChild(menup);
4542 4375
4376 // attach menu to floater
4543 menup->setFollowsAll(); 4377 menup->setFollowsAll();
4378 mOldParent = menup->getParent();
4544 addChild(menup); 4379 addChild(menup);
4545 menup->setVisible(TRUE); 4380 menup->setVisible(TRUE);
4546 menup->translate(-menup->getRect().mLeft + 1, -menup->getRect().mBottom + 1); 4381 menup->translate(-menup->getRect().mLeft + 1, -menup->getRect().mBottom + 1);
4547
4548 menup->setTornOff(TRUE);
4549 menup->setDropShadowed(FALSE); 4382 menup->setDropShadowed(FALSE);
4550 4383
4551 mMenu = menup; 4384 mMenu = menup;
@@ -4554,19 +4387,16 @@ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) :
4554 mMenu->highlightNextItem(NULL); 4387 mMenu->highlightNextItem(NULL);
4555} 4388}
4556 4389
4557LLTearOffMenu::~LLTearOffMenu()
4558{
4559}
4560 4390
4561void LLTearOffMenu::draw() 4391void LLTearOffMenu::draw()
4562{ 4392{
4563 mMenu->setBackgroundVisible(mBgOpaque); 4393 mMenu->setBackgroundVisible(isBackgroundOpaque());
4564 mMenu->arrange(); 4394 mMenu->arrange();
4565 4395
4566 if (mRect.getHeight() != mTargetHeight) 4396 if (getRect().getHeight() != mTargetHeight)
4567 { 4397 {
4568 // animate towards target height 4398 // animate towards target height
4569 reshape(mRect.getWidth(), llceil(lerp((F32)mRect.getHeight(), mTargetHeight, LLCriticalDamp::getInterpolant(0.05f)))); 4399 reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLCriticalDamp::getInterpolant(0.05f))));
4570 } 4400 }
4571 else 4401 else
4572 { 4402 {
@@ -4667,23 +4497,3 @@ void LLTearOffMenu::onClose(bool app_quitting)
4667 destroy(); 4497 destroy();
4668} 4498}
4669 4499
4670///============================================================================
4671/// Class LLEditMenuHandlerMgr
4672///============================================================================
4673LLEditMenuHandlerMgr& LLEditMenuHandlerMgr::getInstance()
4674{
4675 static LLEditMenuHandlerMgr instance;
4676 return instance;
4677}
4678
4679LLEditMenuHandlerMgr::LLEditMenuHandlerMgr()
4680{
4681}
4682
4683LLEditMenuHandlerMgr::~LLEditMenuHandlerMgr()
4684{
4685}
4686
4687///============================================================================
4688/// Local function definitions
4689///============================================================================
diff --git a/linden/indra/llui/llmenugl.h b/linden/indra/llui/llmenugl.h
index 9274101..4e5ac69 100644
--- a/linden/indra/llui/llmenugl.h
+++ b/linden/indra/llui/llmenugl.h
@@ -44,8 +44,6 @@
44#include "lluistring.h" 44#include "lluistring.h"
45#include "llview.h" 45#include "llview.h"
46 46
47class LLMenuItemGL;
48class LLMenuHolderGL;
49 47
50extern S32 MENU_BAR_HEIGHT; 48extern S32 MENU_BAR_HEIGHT;
51extern S32 MENU_BAR_WIDTH; 49extern S32 MENU_BAR_WIDTH;
@@ -77,13 +75,19 @@ typedef void (*label_callback)(LLString&,void*);
77// The LLMenuItemGL represents a single menu item in a menu. 75// The LLMenuItemGL represents a single menu item in a menu.
78//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 76//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
79 77
80class LLFontGL;
81class LLMenuGL;
82
83
84class LLMenuItemGL : public LLView 78class LLMenuItemGL : public LLView
85{ 79{
86public: 80public:
81 // static functions to control the global color scheme.
82 static void setEnabledColor( const LLColor4& color ) { sEnabledColor = color; }
83 static const LLColor4& getEnabledColor() { return sEnabledColor; }
84 static void setDisabledColor( const LLColor4& color ) { sDisabledColor = color; }
85 static const LLColor4& getDisabledColor() { return sDisabledColor; }
86 static void setHighlightBGColor( const LLColor4& color ) { sHighlightBackground = color; }
87 static const LLColor4& getHighlightBGColor() { return sHighlightBackground; }
88 static void setHighlightFGColor( const LLColor4& color ) { sHighlightForeground = color; }
89 static const LLColor4& getHighlightFGColor() { return sHighlightForeground; }
90
87 LLMenuItemGL( const LLString& name, const LLString& label, KEY key = KEY_NONE, MASK = MASK_NONE ); 91 LLMenuItemGL( const LLString& name, const LLString& label, KEY key = KEY_NONE, MASK = MASK_NONE );
88 92
89 virtual void setValue(const LLSD& value) { setLabel(value.asString()); } 93 virtual void setValue(const LLSD& value) { setLabel(value.asString()); }
@@ -99,44 +103,38 @@ public:
99 103
100 virtual BOOL handleAcceleratorKey(KEY key, MASK mask); 104 virtual BOOL handleAcceleratorKey(KEY key, MASK mask);
101 105
102 BOOL getHighlight() const { return mHighlight; }
103
104 void setJumpKey(KEY key); 106 void setJumpKey(KEY key);
105 KEY getJumpKey(); 107 KEY getJumpKey() const { return mJumpKey; }
106 108
107 // set the font used by this item. 109 // set the font used by this item.
108 void setFont(LLFontGL* font); 110 void setFont(const LLFontGL* font) { mFont = font; }
111 const LLFontGL* getFont() const { return mFont; }
109 void setFontStyle(U8 style) { mStyle = style; } 112 void setFontStyle(U8 style) { mStyle = style; }
113 U8 getFontStyle() const { return mStyle; }
110 114
111 // returns the height in pixels for the current font. 115 // returns the height in pixels for the current font.
112 virtual U32 getNominalHeight( void ); 116 virtual U32 getNominalHeight( void ) const;
113
114 // functions to control the color scheme
115 static void setEnabledColor( const LLColor4& color );
116 static void setDisabledColor( const LLColor4& color );
117 static void setHighlightBGColor( const LLColor4& color );
118 static void setHighlightFGColor( const LLColor4& color );
119 117
120 // Marks item as not needing space for check marks or accelerator keys 118 // Marks item as not needing space for check marks or accelerator keys
121 virtual void setBriefItem(BOOL brief); 119 virtual void setBriefItem(BOOL brief) { mBriefItem = brief; }
120 virtual BOOL isBriefItem() const { return mBriefItem; }
122 121
123 virtual BOOL addToAcceleratorList(std::list<LLKeyBinding*> *listp); 122 virtual BOOL addToAcceleratorList(std::list<LLKeyBinding*> *listp);
124 void setAllowKeyRepeat(BOOL allow) { mAllowKeyRepeat = allow; } 123 void setAllowKeyRepeat(BOOL allow) { mAllowKeyRepeat = allow; }
125 124 BOOL getAllowKeyRepeat() const { return mAllowKeyRepeat; }
126 // return the name label
127 LLString getLabel( void ) const { return mLabel.getString(); }
128 125
129 // change the label 126 // change the label
130 void setLabel( const LLStringExplicit& label ); 127 void setLabel( const LLStringExplicit& label ) { mLabel = label; }
128 LLString getLabel( void ) const { return mLabel.getString(); }
131 virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); 129 virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
132 130
133 // Get the parent menu for this item 131 // Get the parent menu for this item
134 virtual LLMenuGL* getMenu(); 132 virtual class LLMenuGL* getMenu();
135 133
136 // returns the normal width of this control in pixels - this is 134 // returns the normal width of this control in pixels - this is
137 // used for calculating the widest item, as well as for horizontal 135 // used for calculating the widest item, as well as for horizontal
138 // arrangement. 136 // arrangement.
139 virtual U32 getNominalWidth( void ); 137 virtual U32 getNominalWidth( void ) const;
140 138
141 // buildDrawLabel() - constructs the string used during the draw() 139 // buildDrawLabel() - constructs the string used during the draw()
142 // function. This reduces the overall string manipulation, but can 140 // function. This reduces the overall string manipulation, but can
@@ -155,14 +153,14 @@ public:
155 // doIt() - do the primary funcationality of the menu item. 153 // doIt() - do the primary funcationality of the menu item.
156 virtual void doIt( void ); 154 virtual void doIt( void );
157 155
158 // set the hover status (called by it's menu)
159 virtual void setHighlight( BOOL highlight ); 156 virtual void setHighlight( BOOL highlight );
157 virtual BOOL getHighlight() const { return mHighlight; }
160 158
161 // determine if this represents an active sub-menu 159 // determine if this represents an active sub-menu
162 virtual BOOL isActive( void ) const; 160 virtual BOOL isActive( void ) const { return FALSE; }
163 161
164 // determine if this represents an open sub-menu 162 // determine if this represents an open sub-menu
165 virtual BOOL isOpen( void ) const; 163 virtual BOOL isOpen( void ) const { return FALSE; }
166 164
167 virtual void setEnabledSubMenus(BOOL enable){}; 165 virtual void setEnabledSubMenus(BOOL enable){};
168 166
@@ -172,24 +170,20 @@ public:
172 virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); 170 virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
173 virtual void draw( void ); 171 virtual void draw( void );
174 172
175 BOOL getHover() { return mGotHover; } 173 BOOL getHover() const { return mGotHover; }
176 174
175 void setDrawTextDisabled(BOOL disabled) { mDrawTextDisabled = disabled; }
177 BOOL getDrawTextDisabled() const { return mDrawTextDisabled; } 176 BOOL getDrawTextDisabled() const { return mDrawTextDisabled; }
178 177
179protected: 178protected:
179 void setHover(BOOL hover) { mGotHover = hover; }
180
180 // This function appends the character string representation of 181 // This function appends the character string representation of
181 // the current accelerator key and mask to the provided string. 182 // the current accelerator key and mask to the provided string.
182 void appendAcceleratorString( LLString& st ); 183 void appendAcceleratorString( LLString& st ) const;
183
184public:
185 static LLColor4 sEnabledColor;
186 static LLColor4 sDisabledColor;
187 static LLColor4 sHighlightBackground;
188 static LLColor4 sHighlightForeground;
189
190protected:
191 static BOOL sDropShadowText;
192 184
185 KEY mAcceleratorKey;
186 MASK mAcceleratorMask;
193 // mLabel contains the actual label specified by the user. 187 // mLabel contains the actual label specified by the user.
194 LLUIString mLabel; 188 LLUIString mLabel;
195 189
@@ -200,12 +194,15 @@ protected:
200 LLUIString mDrawAccelLabel; 194 LLUIString mDrawAccelLabel;
201 LLUIString mDrawBranchLabel; 195 LLUIString mDrawBranchLabel;
202 196
197 BOOL mHighlight;
198private:
199 static LLColor4 sEnabledColor;
200 static LLColor4 sDisabledColor;
201 static LLColor4 sHighlightBackground;
202 static LLColor4 sHighlightForeground;
203
203 // Keyboard and mouse variables 204 // Keyboard and mouse variables
204 KEY mJumpKey;
205 KEY mAcceleratorKey;
206 MASK mAcceleratorMask;
207 BOOL mAllowKeyRepeat; 205 BOOL mAllowKeyRepeat;
208 BOOL mHighlight;
209 BOOL mGotHover; 206 BOOL mGotHover;
210 207
211 // If true, suppress normal space for check marks on the left and accelerator 208 // If true, suppress normal space for check marks on the left and accelerator
@@ -213,10 +210,11 @@ protected:
213 BOOL mBriefItem; 210 BOOL mBriefItem;
214 211
215 // Font for this item 212 // Font for this item
216 LLFontGL* mFont; 213 const LLFontGL* mFont;
217
218 U8 mStyle; 214 U8 mStyle;
219 BOOL mDrawTextDisabled; 215 BOOL mDrawTextDisabled;
216
217 KEY mJumpKey;
220}; 218};
221 219
222 220
@@ -229,14 +227,6 @@ protected:
229 227
230class LLMenuItemCallGL : public LLMenuItemGL 228class LLMenuItemCallGL : public LLMenuItemGL
231{ 229{
232protected:
233 menu_callback mCallback;
234 // mEnabledCallback should return TRUE if the item should be enabled
235 enabled_callback mEnabledCallback;
236 label_callback mLabelCallback;
237 void* mUserData;
238 on_disabled_callback mOnDisabledCallback;
239
240public: 230public:
241 // normal constructor 231 // normal constructor
242 LLMenuItemCallGL( const LLString& name, 232 LLMenuItemCallGL( const LLString& name,
@@ -277,8 +267,8 @@ public:
277 267
278 virtual LLString getType() const { return "call"; } 268 virtual LLString getType() const { return "call"; }
279 269
280 virtual EWidgetType getWidgetType() const; 270 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM_CALL; }
281 virtual LLString getWidgetTag() const; 271 virtual LLString getWidgetTag() const { return LL_MENU_ITEM_CALL_GL_TAG; }
282 272
283 void setEnabledControl(LLString enabled_control, LLView *context); 273 void setEnabledControl(LLString enabled_control, LLView *context);
284 void setVisibleControl(LLString enabled_control, LLView *context); 274 void setVisibleControl(LLString enabled_control, LLView *context);
@@ -302,6 +292,14 @@ public:
302 //virtual void draw(); 292 //virtual void draw();
303 293
304 virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata); 294 virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
295
296private:
297 menu_callback mCallback;
298 // mEnabledCallback should return TRUE if the item should be enabled
299 enabled_callback mEnabledCallback;
300 label_callback mLabelCallback;
301 void* mUserData;
302 on_disabled_callback mOnDisabledCallback;
305}; 303};
306 304
307//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 305//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -310,17 +308,13 @@ public:
310// The LLMenuItemCheckGL is an extension of the LLMenuItemCallGL 308// The LLMenuItemCheckGL is an extension of the LLMenuItemCallGL
311// class, by allowing another method to be specified which determines 309// class, by allowing another method to be specified which determines
312// if the menu item should consider itself checked as true or not. Be 310// if the menu item should consider itself checked as true or not. Be
313// careful that the check callback provided - it needs to be VERY 311// careful that the provided callback is fast - it needs to be VERY
314// FUCKING EFFICIENT, because it may need to be checked a lot. 312// FUCKING EFFICIENT, because it may need to be checked a lot.
315//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 313//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
316 314
317class LLMenuItemCheckGL 315class LLMenuItemCheckGL
318: public LLMenuItemCallGL 316: public LLMenuItemCallGL
319{ 317{
320protected:
321 check_callback mCheckCallback;
322 BOOL mChecked;
323
324public: 318public:
325 LLMenuItemCheckGL( const LLString& name, 319 LLMenuItemCheckGL( const LLString& name,
326 const LLString& label, 320 const LLString& label,
@@ -348,8 +342,8 @@ public:
348 void setCheckedControl(LLString checked_control, LLView *context); 342 void setCheckedControl(LLString checked_control, LLView *context);
349 343
350 virtual void setValue(const LLSD& value) { mChecked = value.asBoolean(); } 344 virtual void setValue(const LLSD& value) { mChecked = value.asBoolean(); }
351 virtual EWidgetType getWidgetType() const; 345 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM_CHECK; }
352 virtual LLString getWidgetTag() const; 346 virtual LLString getWidgetTag() const { return LL_MENU_ITEM_CHECK_GL_TAG; }
353 347
354 virtual LLString getType() const { return "check"; } 348 virtual LLString getType() const { return "check"; }
355 349
@@ -358,8 +352,9 @@ public:
358 352
359 virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata); 353 virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
360 354
361 // LLView Functionality 355private:
362 //virtual void draw( void ); 356 check_callback mCheckCallback;
357 BOOL mChecked;
363}; 358};
364 359
365 360
@@ -372,9 +367,6 @@ public:
372 367
373class LLMenuItemToggleGL : public LLMenuItemGL 368class LLMenuItemToggleGL : public LLMenuItemGL
374{ 369{
375protected:
376 BOOL* mToggle;
377
378public: 370public:
379 LLMenuItemToggleGL( const LLString& name, const LLString& label, 371 LLMenuItemToggleGL( const LLString& name, const LLString& label,
380 BOOL* toggle, 372 BOOL* toggle,
@@ -394,6 +386,9 @@ public:
394 386
395 // LLView Functionality 387 // LLView Functionality
396 //virtual void draw( void ); 388 //virtual void draw( void );
389
390private:
391 BOOL* mToggle;
397}; 392};
398 393
399 394
@@ -408,16 +403,14 @@ public:
408// it in the appendMenu() method. 403// it in the appendMenu() method.
409//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 404//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
410 405
411class LLMenuArrowGL;
412class LLMenuItemBranchGL;
413class LLMenuItemTearOffGL;
414
415class LLMenuGL 406class LLMenuGL
416: public LLUICtrl 407: public LLUICtrl
408// TODO: The menu and menu item classes share a great deal of functionality and perhaps should be united.
409// I think it may make the most sense to make LLMenuGL be a subclass of LLMenuItemGL. -MG
417{ 410{
418public: 411public:
419 LLMenuGL( const LLString& name, const LLString& label, LLViewHandle parent_floater = LLViewHandle::sDeadHandle ); 412 LLMenuGL( const LLString& name, const LLString& label, LLHandle<LLFloater> parent_floater = LLHandle<LLFloater>());
420 LLMenuGL( const LLString& label, LLViewHandle parent_floater = LLViewHandle::sDeadHandle ); 413 LLMenuGL( const LLString& label, LLHandle<LLFloater> parent_floater = LLHandle<LLFloater>() );
421 virtual ~LLMenuGL( void ); 414 virtual ~LLMenuGL( void );
422 virtual LLXMLNodePtr getXML(bool save_children = true) const; 415 virtual LLXMLNodePtr getXML(bool save_children = true) const;
423 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 416 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
@@ -446,11 +439,12 @@ public:
446 const LLString& getLabel( void ) const { return mLabel.getString(); } 439 const LLString& getLabel( void ) const { return mLabel.getString(); }
447 void setLabel(const LLStringExplicit& label) { mLabel = label; } 440 void setLabel(const LLStringExplicit& label) { mLabel = label; }
448 441
449 static void setDefaultBackgroundColor( const LLColor4& color ); 442 // background colors
450 void setBackgroundColor( const LLColor4& color ); 443 static void setDefaultBackgroundColor( const LLColor4& color ) { sDefaultBackgroundColor = color; }
451 LLColor4 getBackgroundColor(); 444 void setBackgroundColor( const LLColor4& color ) { mBackgroundColor = color; }
445 const LLColor4& getBackgroundColor() const { return mBackgroundColor; }
452 void setBackgroundVisible( BOOL b ) { mBgVisible = b; } 446 void setBackgroundVisible( BOOL b ) { mBgVisible = b; }
453 void setCanTearOff(BOOL tear_off, LLViewHandle parent_floater_handle = LLViewHandle::sDeadHandle); 447 void setCanTearOff(BOOL tear_off, LLHandle<LLFloater> parent_floater_handle = LLHandle<LLFloater>());
454 448
455 // Add the menu item to this menu. 449 // Add the menu item to this menu.
456 virtual BOOL append( LLMenuItemGL* item ); 450 virtual BOOL append( LLMenuItemGL* item );
@@ -524,7 +518,7 @@ public:
524 518
525 BOOL getCanTearOff() { return mTearOffItem != NULL; } 519 BOOL getCanTearOff() { return mTearOffItem != NULL; }
526 520
527 KEY getJumpKey() { return mJumpKey; } 521 KEY getJumpKey() const { return mJumpKey; }
528 void setJumpKey(KEY key) { mJumpKey = key; } 522 void setJumpKey(KEY key) { mJumpKey = key; }
529 523
530 static void setKeyboardMode(BOOL mode) { sKeyboardMode = mode; } 524 static void setKeyboardMode(BOOL mode) { sKeyboardMode = mode; }
@@ -532,40 +526,42 @@ public:
532 526
533 static void onFocusLost(LLView* old_focus); 527 static void onFocusLost(LLView* old_focus);
534 528
535 static LLMenuHolderGL* sMenuContainer; 529 static class LLMenuHolderGL* sMenuContainer;
536 530
537protected: 531protected:
538 void createSpilloverBranch(); 532 void createSpilloverBranch();
539 void cleanupSpilloverBranch(); 533 void cleanupSpilloverBranch();
540 534
541protected: 535 // TODO: create accessor methods for these?
536 typedef std::list< LLMenuItemGL* > item_list_t;
537 item_list_t mItems;
538 typedef std::map<KEY, LLMenuItemGL*> navigation_key_map_t;
539 navigation_key_map_t mJumpKeys;
540 S32 mLastMouseX;
541 S32 mLastMouseY;
542 S32 mMouseVelX;
543 S32 mMouseVelY;
544 BOOL mHorizontalLayout;
545 BOOL mKeepFixedSize;
546
547private:
542 static LLColor4 sDefaultBackgroundColor; 548 static LLColor4 sDefaultBackgroundColor;
543 static BOOL sKeyboardMode; 549 static BOOL sKeyboardMode;
544 550
545 LLColor4 mBackgroundColor; 551 LLColor4 mBackgroundColor;
546 BOOL mBgVisible; 552 BOOL mBgVisible;
547 typedef std::list< LLMenuItemGL* > item_list_t;
548 item_list_t mItems;
549 typedef std::map<KEY, LLMenuItemGL*> navigation_key_map_t;
550 navigation_key_map_t mJumpKeys;
551 LLMenuItemGL* mParentMenuItem; 553 LLMenuItemGL* mParentMenuItem;
552 LLUIString mLabel; 554 LLUIString mLabel;
553 BOOL mDropShadowed; // Whether to drop shadow 555 BOOL mDropShadowed; // Whether to drop shadow
554 BOOL mHorizontalLayout;
555 BOOL mKeepFixedSize;
556 BOOL mHasSelection; 556 BOOL mHasSelection;
557 LLFrameTimer mFadeTimer; 557 LLFrameTimer mFadeTimer;
558 S32 mLastMouseX;
559 S32 mLastMouseY;
560 S32 mMouseVelX;
561 S32 mMouseVelY;
562 BOOL mTornOff; 558 BOOL mTornOff;
563 LLMenuItemTearOffGL* mTearOffItem; 559 class LLMenuItemTearOffGL* mTearOffItem;
564 LLMenuItemBranchGL* mSpilloverBranch; 560 class LLMenuItemBranchGL* mSpilloverBranch;
565 LLMenuGL* mSpilloverMenu; 561 LLMenuGL* mSpilloverMenu;
566 LLViewHandle mParentFloaterHandle; 562 LLHandle<LLFloater> mParentFloaterHandle;
567 KEY mJumpKey; 563 KEY mJumpKey;
568}; 564}; // end class LLMenuGL
569 565
570 566
571 567
@@ -578,20 +574,15 @@ protected:
578 574
579class LLMenuItemBranchGL : public LLMenuItemGL 575class LLMenuItemBranchGL : public LLMenuItemGL
580{ 576{
581protected:
582 LLMenuGL* mBranch;
583
584public: 577public:
585 LLMenuItemBranchGL( const LLString& name, const LLString& label, LLMenuGL* branch, 578 LLMenuItemBranchGL( const LLString& name, const LLString& label, LLMenuGL* branch,
586 KEY key = KEY_NONE, MASK mask = MASK_NONE ); 579 KEY key = KEY_NONE, MASK mask = MASK_NONE );
587 virtual LLXMLNodePtr getXML(bool save_children = true) const; 580 virtual LLXMLNodePtr getXML(bool save_children = true) const;
588 581
589 virtual LLView* getChildByName(const LLString& name, BOOL recurse) const; 582 virtual LLString getType() const { return "menu"; }
590
591 virtual LLString getType() const { return "menu"; }
592 583
593 virtual EWidgetType getWidgetType() const; 584 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM_BRANCH; }
594 virtual LLString getWidgetTag() const; 585 virtual LLString getWidgetTag() const { return LL_MENU_ITEM_BRANCH_GL_TAG; }
595 586
596 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); 587 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
597 588
@@ -615,9 +606,9 @@ public:
615 606
616 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); 607 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
617 608
618 virtual BOOL isActive() const; 609 virtual BOOL isActive() const { return isOpen() && mBranch->getHighlightedItem(); }
619 610
620 virtual BOOL isOpen() const; 611 virtual BOOL isOpen() const { return mBranch->isOpen(); }
621 612
622 LLMenuGL *getBranch() const { return mBranch; } 613 LLMenuGL *getBranch() const { return mBranch; }
623 614
@@ -628,11 +619,16 @@ public:
628 619
629 virtual void draw(); 620 virtual void draw();
630 621
631 virtual void setEnabledSubMenus(BOOL enabled); 622 virtual void setEnabledSubMenus(BOOL enabled) { mBranch->setEnabledSubMenus(enabled); }
632 623
633 virtual void openMenu(); 624 virtual void openMenu();
634};
635 625
626protected:
627 virtual LLView* getChildByName(const LLString& name, BOOL recurse) const;
628
629private:
630 LLMenuGL* mBranch;
631}; // end class LLMenuItemBranchGL
636 632
637 633
638 634
@@ -647,10 +643,10 @@ class LLPieMenu
647public: 643public:
648 LLPieMenu(const LLString& name, const LLString& label); 644 LLPieMenu(const LLString& name, const LLString& label);
649 LLPieMenu(const LLString& name); 645 LLPieMenu(const LLString& name);
650 virtual ~LLPieMenu(); 646 virtual ~LLPieMenu() {}
651 647
652 virtual EWidgetType getWidgetType() const; 648 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_PIE_MENU; }
653 virtual LLString getWidgetTag() const; 649 virtual LLString getWidgetTag() const { return LL_PIE_MENU_TAG; }
654 650
655 void initXML(LLXMLNodePtr node, LLView *context, LLUICtrlFactory *factory); 651 void initXML(LLXMLNodePtr node, LLView *context, LLUICtrlFactory *factory);
656 652
@@ -682,11 +678,10 @@ public:
682 void show(S32 x, S32 y, BOOL mouse_down); 678 void show(S32 x, S32 y, BOOL mouse_down);
683 void hide(BOOL item_selected); 679 void hide(BOOL item_selected);
684 680
685protected: 681private:
686 LLMenuItemGL *pieItemFromXY(S32 x, S32 y); 682 LLMenuItemGL *pieItemFromXY(S32 x, S32 y);
687 S32 pieItemIndexFromXY(S32 x, S32 y); 683 S32 pieItemIndexFromXY(S32 x, S32 y);
688 684
689private:
690 // These cause menu items to be spuriously selected by right-clicks 685 // These cause menu items to be spuriously selected by right-clicks
691 // near the window edge at low frame rates. I don't think they are 686 // near the window edge at low frame rates. I don't think they are
692 // needed unless you shift the menu position in the draw() function. JC 687 // needed unless you shift the menu position in the draw() function. JC
@@ -703,6 +698,7 @@ private:
703 BOOL mRightMouseDown; 698 BOOL mRightMouseDown;
704}; 699};
705 700
701
706//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
707// Class LLMenuBarGL 703// Class LLMenuBarGL
708// 704//
@@ -711,10 +707,6 @@ private:
711 707
712class LLMenuBarGL : public LLMenuGL 708class LLMenuBarGL : public LLMenuGL
713{ 709{
714protected:
715 std::list <LLKeyBinding*> mAccelerators;
716 BOOL mAltKeyTrigger;
717
718public: 710public:
719 LLMenuBarGL( const LLString& name ); 711 LLMenuBarGL( const LLString& name );
720 virtual ~LLMenuBarGL(); 712 virtual ~LLMenuBarGL();
@@ -748,9 +740,11 @@ public:
748 740
749 void resetMenuTrigger() { mAltKeyTrigger = FALSE; } 741 void resetMenuTrigger() { mAltKeyTrigger = FALSE; }
750 742
751protected: 743private:
752 void checkMenuTrigger(); 744 void checkMenuTrigger();
753 745
746 std::list <LLKeyBinding*> mAccelerators;
747 BOOL mAltKeyTrigger;
754}; 748};
755 749
756//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 750//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -763,10 +757,10 @@ class LLMenuHolderGL : public LLPanel
763public: 757public:
764 LLMenuHolderGL(); 758 LLMenuHolderGL();
765 LLMenuHolderGL(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows = FOLLOWS_NONE); 759 LLMenuHolderGL(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows = FOLLOWS_NONE);
766 virtual ~LLMenuHolderGL(); 760 virtual ~LLMenuHolderGL() {}
767 761
768 virtual EWidgetType getWidgetType() const; 762 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_HOLDER; }
769 virtual LLString getWidgetTag() const; 763 virtual LLString getWidgetTag() const { return LL_MENU_HOLDER_GL_TAG; }
770 764
771 virtual BOOL hideMenus(); 765 virtual BOOL hideMenus();
772 void reshape(S32 width, S32 height, BOOL called_from_parent); 766 void reshape(S32 width, S32 height, BOOL called_from_parent);
@@ -777,13 +771,13 @@ public:
777 virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); 771 virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
778 virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); 772 virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
779 773
780 virtual const LLRect getMenuRect() const; 774 virtual const LLRect getMenuRect() const { return getLocalRect(); }
781 virtual BOOL hasVisibleMenu() const; 775 virtual BOOL hasVisibleMenu() const;
782 776
783 static void setActivatedItem(LLMenuItemGL* item); 777 static void setActivatedItem(LLMenuItemGL* item);
784 778
785protected: 779private:
786 static LLViewHandle sItemLastSelectedHandle; 780 static LLHandle<LLView> sItemLastSelectedHandle;
787 static LLFrameTimer sItemActivationTimer; 781 static LLFrameTimer sItemActivationTimer;
788 782
789 BOOL mCanHide; 783 BOOL mCanHide;
@@ -793,12 +787,13 @@ protected:
793// Class LLTearOffMenu 787// Class LLTearOffMenu
794// 788//
795// Floater that hosts a menu 789// Floater that hosts a menu
790// https://wiki.lindenlab.com/mediawiki/index.php?title=LLTearOffMenu&oldid=81344
796//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 791//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
797class LLTearOffMenu : public LLFloater 792class LLTearOffMenu : public LLFloater
798{ 793{
799public: 794public:
800 static LLTearOffMenu* create(LLMenuGL* menup); 795 static LLTearOffMenu* create(LLMenuGL* menup);
801 virtual ~LLTearOffMenu(); 796 virtual ~LLTearOffMenu() {}
802 virtual void onClose(bool app_quitting); 797 virtual void onClose(bool app_quitting);
803 virtual void draw(void); 798 virtual void draw(void);
804 virtual void onFocusReceived(); 799 virtual void onFocusReceived();
@@ -807,10 +802,9 @@ public:
807 virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); 802 virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
808 virtual void translate(S32 x, S32 y); 803 virtual void translate(S32 x, S32 y);
809 804
810protected: 805private:
811 LLTearOffMenu(LLMenuGL* menup); 806 LLTearOffMenu(LLMenuGL* menup);
812 807
813protected:
814 LLView* mOldParent; 808 LLView* mOldParent;
815 LLMenuGL* mMenu; 809 LLMenuGL* mMenu;
816 F32 mTargetHeight; 810 F32 mTargetHeight;
@@ -825,19 +819,19 @@ protected:
825class LLMenuItemTearOffGL : public LLMenuItemGL 819class LLMenuItemTearOffGL : public LLMenuItemGL
826{ 820{
827public: 821public:
828 LLMenuItemTearOffGL( LLViewHandle parent_floater_handle = (LLViewHandle)LLViewHandle::sDeadHandle ); 822 LLMenuItemTearOffGL( LLHandle<LLFloater> parent_floater_handle = LLHandle<LLFloater>());
829 823
830 virtual EWidgetType getWidgetType() const; 824 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_TEAROFF_MENU; }
831 virtual LLString getWidgetTag() const; 825 virtual LLString getWidgetTag() const { return LL_MENU_ITEM_TEAR_OFF_GL_TAG; }
832 826
833 virtual LLString getType() const { return "tearoff_menu"; } 827 virtual LLString getType() const { return "tearoff_menu"; }
834 828
835 virtual void doIt(void); 829 virtual void doIt(void);
836 virtual void draw(void); 830 virtual void draw(void);
837 virtual U32 getNominalHeight(); 831 virtual U32 getNominalHeight() const;
838 832
839protected: 833private:
840 LLViewHandle mParentHandle; 834 LLHandle<LLFloater> mParentHandle;
841}; 835};
842 836
843 837
@@ -845,11 +839,13 @@ protected:
845class LLEditMenuHandlerMgr 839class LLEditMenuHandlerMgr
846{ 840{
847public: 841public:
848 LLEditMenuHandlerMgr& getInstance(); 842 LLEditMenuHandlerMgr& getInstance() {
849 virtual ~LLEditMenuHandlerMgr(); 843 static LLEditMenuHandlerMgr instance;
850protected: 844 return instance;
851 LLEditMenuHandlerMgr(); 845 }
852 846 virtual ~LLEditMenuHandlerMgr() {}
847private:
848 LLEditMenuHandlerMgr() {};
853}; 849};
854 850
855#endif // LL_LLMENUGL_H 851#endif // LL_LLMENUGL_H
diff --git a/linden/indra/llui/llmodaldialog.cpp b/linden/indra/llui/llmodaldialog.cpp
index ff4858f..392c122 100644
--- a/linden/indra/llui/llmodaldialog.cpp
+++ b/linden/indra/llui/llmodaldialog.cpp
@@ -74,10 +74,10 @@ LLModalDialog::~LLModalDialog()
74void LLModalDialog::open() /* Flawfinder: ignore */ 74void LLModalDialog::open() /* Flawfinder: ignore */
75{ 75{
76 // SJB: Hack! Make sure we don't ever host a modal dialog 76 // SJB: Hack! Make sure we don't ever host a modal dialog
77 LLMultiFloater* thost = LLFloater::sHostp; 77 LLMultiFloater* thost = LLFloater::getFloaterHost();
78 LLFloater::sHostp = NULL; 78 LLFloater::setFloaterHost(NULL);
79 LLFloater::open(); 79 LLFloater::open();
80 LLFloater::sHostp = thost; 80 LLFloater::setFloaterHost(thost);
81} 81}
82 82
83void LLModalDialog::reshape(S32 width, S32 height, BOOL called_from_parent) 83void LLModalDialog::reshape(S32 width, S32 height, BOOL called_from_parent)
@@ -157,14 +157,18 @@ void LLModalDialog::setVisible( BOOL visible )
157 157
158BOOL LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask) 158BOOL LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask)
159{ 159{
160 if (!LLFloater::handleMouseDown(x, y, mask)) 160 if (mModal)
161 { 161 {
162 if (mModal) 162 if (!LLFloater::handleMouseDown(x, y, mask))
163 { 163 {
164 // Click was outside the panel 164 // Click was outside the panel
165 make_ui_sound("UISndInvalidOp"); 165 make_ui_sound("UISndInvalidOp");
166 } 166 }
167 } 167 }
168 else
169 {
170 LLFloater::handleMouseDown(x, y, mask);
171 }
168 return TRUE; 172 return TRUE;
169} 173}
170 174
@@ -247,7 +251,7 @@ void LLModalDialog::draw()
247 LLColor4 shadow_color = LLUI::sColorsGroup->getColor("ColorDropShadow"); 251 LLColor4 shadow_color = LLUI::sColorsGroup->getColor("ColorDropShadow");
248 S32 shadow_lines = LLUI::sConfigGroup->getS32("DropShadowFloater"); 252 S32 shadow_lines = LLUI::sConfigGroup->getS32("DropShadowFloater");
249 253
250 gl_drop_shadow( 0, mRect.getHeight(), mRect.getWidth(), 0, 254 gl_drop_shadow( 0, getRect().getHeight(), getRect().getWidth(), 0,
251 shadow_color, shadow_lines); 255 shadow_color, shadow_lines);
252 256
253 LLFloater::draw(); 257 LLFloater::draw();
@@ -276,11 +280,7 @@ void LLModalDialog::draw()
276void LLModalDialog::centerOnScreen() 280void LLModalDialog::centerOnScreen()
277{ 281{
278 LLVector2 window_size = LLUI::getWindowSize(); 282 LLVector2 window_size = LLUI::getWindowSize();
279 283 centerWithin(LLRect(0, 0, llround(window_size.mV[VX]), llround(window_size.mV[VY])));
280 S32 dialog_left = (llround(window_size.mV[VX]) - mRect.getWidth()) / 2;
281 S32 dialog_bottom = (llround(window_size.mV[VY]) - mRect.getHeight()) / 2;
282
283 translate( dialog_left - mRect.mLeft, dialog_bottom - mRect.mBottom );
284} 284}
285 285
286 286
@@ -319,3 +319,4 @@ void LLModalDialog::onAppFocusGained()
319} 319}
320 320
321 321
322
diff --git a/linden/indra/llui/llmodaldialog.h b/linden/indra/llui/llmodaldialog.h
index 342a0f6..dd82b25 100644
--- a/linden/indra/llui/llmodaldialog.h
+++ b/linden/indra/llui/llmodaldialog.h
@@ -40,7 +40,7 @@ class LLModalDialog;
40// By default, a ModalDialog is modal, i.e. no other window can have focus 40// By default, a ModalDialog is modal, i.e. no other window can have focus
41// However, for the sake of code reuse and simplicity, if mModal == false, 41// However, for the sake of code reuse and simplicity, if mModal == false,
42// the dialog behaves like a normal floater 42// the dialog behaves like a normal floater
43 43// https://wiki.lindenlab.com/mediawiki/index.php?title=LLModalDialog&oldid=81385
44class LLModalDialog : public LLFloater 44class LLModalDialog : public LLFloater
45{ 45{
46public: 46public:
@@ -67,6 +67,8 @@ public:
67 /*virtual*/ void setVisible(BOOL visible); 67 /*virtual*/ void setVisible(BOOL visible);
68 /*virtual*/ void draw(); 68 /*virtual*/ void draw();
69 69
70 BOOL isModal() const { return mModal; }
71
70 static void onAppFocusLost(); 72 static void onAppFocusLost();
71 static void onAppFocusGained(); 73 static void onAppFocusGained();
72 74
@@ -75,9 +77,9 @@ public:
75protected: 77protected:
76 void centerOnScreen(); 78 void centerOnScreen();
77 79
78protected: 80private:
79 LLFrameTimer mVisibleTime; 81 LLFrameTimer mVisibleTime;
80 BOOL mModal; // do not change this after creation! 82 const BOOL mModal;
81 83
82 static std::list<LLModalDialog*> sModalStack; // Top of stack is currently being displayed 84 static std::list<LLModalDialog*> sModalStack; // Top of stack is currently being displayed
83}; 85};
diff --git a/linden/indra/llui/llmultislider.cpp b/linden/indra/llui/llmultislider.cpp
new file mode 100644
index 0000000..d0c9002
--- /dev/null
+++ b/linden/indra/llui/llmultislider.cpp
@@ -0,0 +1,677 @@
1/**
2 * @file llmultisldr.cpp
3 * @brief LLMultiSlider base class
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2008, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
30 */
31
32#include "linden_common.h"
33
34#include "llmultislider.h"
35#include "llui.h"
36
37#include "llgl.h"
38#include "llwindow.h"
39#include "llfocusmgr.h"
40#include "llkeyboard.h" // for the MASK constants
41#include "llcontrol.h"
42#include "llimagegl.h"
43
44#include <sstream>
45
46const S32 MULTI_THUMB_WIDTH = 8;
47const S32 MULTI_TRACK_HEIGHT = 6;
48const F32 FLOAT_THRESHOLD = 0.00001f;
49const S32 EXTRA_TRIANGLE_WIDTH = 2;
50const S32 EXTRA_TRIANGLE_HEIGHT = -2;
51
52S32 LLMultiSlider::mNameCounter = 0;
53
54LLMultiSlider::LLMultiSlider(
55 const LLString& name,
56 const LLRect& rect,
57 void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata),
58 void* callback_userdata,
59 F32 initial_value,
60 F32 min_value,
61 F32 max_value,
62 F32 increment,
63 S32 max_sliders,
64 BOOL allow_overlap,
65 BOOL draw_track,
66 BOOL use_triangle,
67 const LLString& control_name)
68 :
69 LLUICtrl( name, rect, TRUE, on_commit_callback, callback_userdata,
70 FOLLOWS_LEFT | FOLLOWS_TOP),
71
72 mInitialValue( initial_value ),
73 mMinValue( min_value ),
74 mMaxValue( max_value ),
75 mIncrement( increment ),
76 mMaxNumSliders(max_sliders),
77 mAllowOverlap(allow_overlap),
78 mDrawTrack(draw_track),
79 mUseTriangle(use_triangle),
80 mMouseOffset( 0 ),
81 mDragStartThumbRect( 0, getRect().getHeight(), MULTI_THUMB_WIDTH, 0 ),
82 mTrackColor( LLUI::sColorsGroup->getColor( "MultiSliderTrackColor" ) ),
83 mThumbOutlineColor( LLUI::sColorsGroup->getColor( "MultiSliderThumbOutlineColor" ) ),
84 mThumbCenterColor( LLUI::sColorsGroup->getColor( "MultiSliderThumbCenterColor" ) ),
85 mThumbCenterSelectedColor( LLUI::sColorsGroup->getColor( "MultiSliderThumbCenterSelectedColor" ) ),
86 mDisabledThumbColor(LLUI::sColorsGroup->getColor( "MultiSliderDisabledThumbColor" ) ),
87 mTriangleColor(LLUI::sColorsGroup->getColor( "MultiSliderTriangleColor" ) ),
88 mMouseDownCallback( NULL ),
89 mMouseUpCallback( NULL )
90{
91 mValue.emptyMap();
92 mCurSlider = LLString::null;
93
94 // properly handle setting the starting thumb rect
95 // do it this way to handle both the operating-on-settings
96 // and standalone ways of using this
97 setControlName(control_name, NULL);
98 setValue(getValue());
99}
100
101EWidgetType LLMultiSlider::getWidgetType() const
102{
103 return WIDGET_TYPE_MULTI_SLIDER_BAR;
104}
105
106LLString LLMultiSlider::getWidgetTag() const
107{
108 return LL_MULTI_SLIDER_TAG;
109}
110
111void LLMultiSlider::setSliderValue(const LLString& name, F32 value, BOOL from_event)
112{
113 // exit if not there
114 if(!mValue.has(name)) {
115 return;
116 }
117
118 value = llclamp( value, mMinValue, mMaxValue );
119
120 // Round to nearest increment (bias towards rounding down)
121 value -= mMinValue;
122 value += mIncrement/2.0001f;
123 value -= fmod(value, mIncrement);
124 F32 newValue = mMinValue + value;
125
126 // now, make sure no overlap
127 // if we want that
128 if(!mAllowOverlap) {
129 bool hit = false;
130
131 // look at the current spot
132 // and see if anything is there
133 LLSD::map_iterator mIt = mValue.beginMap();
134 for(;mIt != mValue.endMap(); mIt++) {
135
136 F32 testVal = (F32)mIt->second.asReal() - newValue;
137 if(testVal > -FLOAT_THRESHOLD && testVal < FLOAT_THRESHOLD &&
138 mIt->first != name) {
139 hit = true;
140 break;
141 }
142 }
143
144 // if none found, stop
145 if(hit) {
146 return;
147 }
148 }
149
150
151 // now set it in the map
152 mValue[name] = newValue;
153
154 // set the control if it's the current slider and not from an event
155 if (!from_event && name == mCurSlider)
156 {
157 setControlValue(mValue);
158 }
159
160 F32 t = (newValue - mMinValue) / (mMaxValue - mMinValue);
161
162 S32 left_edge = MULTI_THUMB_WIDTH/2;
163 S32 right_edge = getRect().getWidth() - (MULTI_THUMB_WIDTH/2);
164
165 S32 x = left_edge + S32( t * (right_edge - left_edge) );
166 mThumbRects[name].mLeft = x - (MULTI_THUMB_WIDTH/2);
167 mThumbRects[name].mRight = x + (MULTI_THUMB_WIDTH/2);
168}
169
170void LLMultiSlider::setValue(const LLSD& value)
171{
172 // only do if it's a map
173 if(value.isMap()) {
174
175 // add each value... the first in the map becomes the current
176 LLSD::map_const_iterator mIt = value.beginMap();
177 mCurSlider = mIt->first;
178
179 for(; mIt != value.endMap(); mIt++) {
180 setSliderValue(mIt->first, (F32)mIt->second.asReal(), TRUE);
181 }
182 }
183}
184
185F32 LLMultiSlider::getSliderValue(const LLString& name) const
186{
187 return (F32)mValue[name].asReal();
188}
189
190void LLMultiSlider::setCurSlider(const LLString& name)
191{
192 if(mValue.has(name)) {
193 mCurSlider = name;
194 }
195}
196
197const LLString& LLMultiSlider::addSlider()
198{
199 return addSlider(mInitialValue);
200}
201
202const LLString& LLMultiSlider::addSlider(F32 val)
203{
204 std::stringstream newName;
205 F32 initVal = val;
206
207 if(mValue.size() >= mMaxNumSliders) {
208 return LLString::null;
209 }
210
211 // create a new name
212 newName << "sldr" << mNameCounter;
213 mNameCounter++;
214
215 bool foundOne = findUnusedValue(initVal);
216 if(!foundOne) {
217 return LLString::null;
218 }
219
220 // add a new thumb rect
221 mThumbRects[newName.str()] = LLRect( 0, getRect().getHeight(), MULTI_THUMB_WIDTH, 0 );
222
223 // add the value and set the current slider to this one
224 mValue.insert(newName.str(), initVal);
225 mCurSlider = newName.str();
226
227 // move the slider
228 setSliderValue(mCurSlider, initVal, TRUE);
229
230 return mCurSlider;
231}
232
233bool LLMultiSlider::findUnusedValue(F32& initVal)
234{
235 bool firstTry = true;
236
237 // find the first open slot starting with
238 // the initial value
239 while(true) {
240
241 bool hit = false;
242
243 // look at the current spot
244 // and see if anything is there
245 LLSD::map_iterator mIt = mValue.beginMap();
246 for(;mIt != mValue.endMap(); mIt++) {
247
248 F32 testVal = (F32)mIt->second.asReal() - initVal;
249 if(testVal > -FLOAT_THRESHOLD && testVal < FLOAT_THRESHOLD) {
250 hit = true;
251 break;
252 }
253 }
254
255 // if we found one
256 if(!hit) {
257 break;
258 }
259
260 // increment and wrap if need be
261 initVal += mIncrement;
262 if(initVal > mMaxValue) {
263 initVal = mMinValue;
264 }
265
266 // stop if it's filled
267 if(initVal == mInitialValue && !firstTry) {
268 llwarns << "Whoa! Too many multi slider elements to add one to" << llendl;
269 return false;
270 }
271
272 firstTry = false;
273 continue;
274 }
275
276 return true;
277}
278
279
280void LLMultiSlider::deleteSlider(const LLString& name)
281{
282 // can't delete last slider
283 if(mValue.size() <= 0) {
284 return;
285 }
286
287 // get rid of value from mValue and its thumb rect
288 mValue.erase(name);
289 mThumbRects.erase(name);
290
291 // set to the last created
292 if(mValue.size() > 0) {
293 std::map<LLString, LLRect>::iterator mIt = mThumbRects.end();
294 mIt--;
295 mCurSlider = mIt->first;
296 }
297}
298
299void LLMultiSlider::clear()
300{
301 while(mThumbRects.size() > 0) {
302 deleteCurSlider();
303 }
304
305 LLUICtrl::clear();
306}
307
308BOOL LLMultiSlider::handleHover(S32 x, S32 y, MASK mask)
309{
310 if( gFocusMgr.getMouseCapture() == this )
311 {
312 S32 left_edge = MULTI_THUMB_WIDTH/2;
313 S32 right_edge = getRect().getWidth() - (MULTI_THUMB_WIDTH/2);
314
315 x += mMouseOffset;
316 x = llclamp( x, left_edge, right_edge );
317
318 F32 t = F32(x - left_edge) / (right_edge - left_edge);
319 setCurSliderValue(t * (mMaxValue - mMinValue) + mMinValue );
320 onCommit();
321
322 getWindow()->setCursor(UI_CURSOR_ARROW);
323 lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl;
324 }
325 else
326 {
327 getWindow()->setCursor(UI_CURSOR_ARROW);
328 lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl;
329 }
330 return TRUE;
331}
332
333BOOL LLMultiSlider::handleMouseUp(S32 x, S32 y, MASK mask)
334{
335 BOOL handled = FALSE;
336
337 if( gFocusMgr.getMouseCapture() == this )
338 {
339 gFocusMgr.setMouseCapture( NULL );
340
341 if( mMouseUpCallback )
342 {
343 mMouseUpCallback( this, mCallbackUserData );
344 }
345 handled = TRUE;
346 make_ui_sound("UISndClickRelease");
347 }
348 else
349 {
350 handled = TRUE;
351 }
352
353 return handled;
354}
355
356BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask)
357{
358 // only do sticky-focus on non-chrome widgets
359 if (!getIsChrome())
360 {
361 setFocus(TRUE);
362 }
363 if( mMouseDownCallback )
364 {
365 mMouseDownCallback( this, mCallbackUserData );
366 }
367
368 if (MASK_CONTROL & mask) // if CTRL is modifying
369 {
370 setCurSliderValue(mInitialValue);
371 onCommit();
372 }
373 else
374 {
375 // scroll through thumbs to see if we have a new one selected and select that one
376 std::map<LLString, LLRect>::iterator mIt = mThumbRects.begin();
377 for(; mIt != mThumbRects.end(); mIt++) {
378
379 // check if inside. If so, set current slider and continue
380 if(mIt->second.pointInRect(x,y)) {
381 mCurSlider = mIt->first;
382 break;
383 }
384 }
385
386 // Find the offset of the actual mouse location from the center of the thumb.
387 if (mThumbRects[mCurSlider].pointInRect(x,y))
388 {
389 mMouseOffset = (mThumbRects[mCurSlider].mLeft + MULTI_THUMB_WIDTH/2) - x;
390 }
391 else
392 {
393 mMouseOffset = 0;
394 }
395
396 // Start dragging the thumb
397 // No handler needed for focus lost since this class has no state that depends on it.
398 gFocusMgr.setMouseCapture( this );
399 mDragStartThumbRect = mThumbRects[mCurSlider];
400 }
401 make_ui_sound("UISndClick");
402
403 return TRUE;
404}
405
406BOOL LLMultiSlider::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
407{
408 BOOL handled = FALSE;
409 if( getVisible() && getEnabled() && !called_from_parent )
410 {
411 switch(key)
412 {
413 case KEY_UP:
414 case KEY_DOWN:
415 // eat up and down keys to be consistent
416 handled = TRUE;
417 break;
418 case KEY_LEFT:
419 setCurSliderValue(getCurSliderValue() - getIncrement());
420 onCommit();
421 handled = TRUE;
422 break;
423 case KEY_RIGHT:
424 setCurSliderValue(getCurSliderValue() + getIncrement());
425 onCommit();
426 handled = TRUE;
427 break;
428 default:
429 break;
430 }
431 }
432 return handled;
433}
434
435void LLMultiSlider::draw()
436{
437 LLColor4 curThumbColor;
438
439 std::map<LLString, LLRect>::iterator mIt;
440 std::map<LLString, LLRect>::iterator curSldrIt;
441 if( getVisible() )
442 {
443 // Draw background and thumb.
444
445 // drawing solids requires texturing be disabled
446 LLGLSNoTexture no_texture;
447
448 LLRect rect(mDragStartThumbRect);
449
450 F32 opacity = getEnabled() ? 1.f : 0.3f;
451
452 // Track
453 LLUUID thumb_image_id;
454 thumb_image_id.set(LLUI::sAssetsGroup->getString("rounded_square.tga"));
455 LLPointer<LLImageGL> thumb_imagep(LLUI::sImageProvider->getUIImageByID(thumb_image_id)->getImage());
456
457 S32 height_offset = (getRect().getHeight() - MULTI_TRACK_HEIGHT) / 2;
458 LLRect track_rect(0, getRect().getHeight() - height_offset, getRect().getWidth(), height_offset );
459
460
461 if(mDrawTrack)
462 {
463 track_rect.stretch(-1);
464 gl_draw_scaled_image_with_border(track_rect.mLeft, track_rect.mBottom, 16, 16, track_rect.getWidth(), track_rect.getHeight(),
465 thumb_imagep, mTrackColor % opacity);
466 }
467
468 // if we're supposed to use a drawn triangle
469 // simple gl call for the triangle
470 if(mUseTriangle) {
471
472 for(mIt = mThumbRects.begin(); mIt != mThumbRects.end(); mIt++) {
473
474 gl_triangle_2d(
475 mIt->second.mLeft - EXTRA_TRIANGLE_WIDTH,
476 mIt->second.mTop + EXTRA_TRIANGLE_HEIGHT,
477 mIt->second.mRight + EXTRA_TRIANGLE_WIDTH,
478 mIt->second.mTop + EXTRA_TRIANGLE_HEIGHT,
479 mIt->second.mLeft + mIt->second.getWidth() / 2,
480 mIt->second.mBottom - EXTRA_TRIANGLE_HEIGHT,
481 mTriangleColor, TRUE);
482 }
483 }
484 else if (!thumb_imagep)
485 {
486 // draw all the thumbs
487 curSldrIt = mThumbRects.end();
488 for(mIt = mThumbRects.begin(); mIt != mThumbRects.end(); mIt++) {
489
490 // choose the color
491 curThumbColor = mThumbCenterColor;
492 if(mIt->first == mCurSlider) {
493
494 curSldrIt = mIt;
495 continue;
496 //curThumbColor = mThumbCenterSelectedColor;
497 }
498
499 // the draw command
500 gl_rect_2d(mIt->second, curThumbColor, TRUE);
501 }
502
503 // now draw the current slider
504 if(curSldrIt != mThumbRects.end()) {
505 gl_rect_2d(curSldrIt->second, mThumbCenterSelectedColor, TRUE);
506 }
507
508 // and draw the drag start
509 if (gFocusMgr.getMouseCapture() == this)
510 {
511 gl_rect_2d(mDragStartThumbRect, mThumbCenterColor % opacity, FALSE);
512 }
513 }
514 else if( gFocusMgr.getMouseCapture() == this )
515 {
516 // draw drag start
517 gl_draw_scaled_image_with_border(mDragStartThumbRect.mLeft,
518 mDragStartThumbRect.mBottom, 16, 16,
519 mDragStartThumbRect.getWidth(),
520 mDragStartThumbRect.getHeight(),
521 thumb_imagep, mThumbCenterColor % 0.3f, TRUE);
522
523 // draw the highlight
524 if (hasFocus())
525 {
526 F32 lerp_amt = gFocusMgr.getFocusFlashAmt();
527 LLRect highlight_rect = mThumbRects[mCurSlider];
528 highlight_rect.stretch(llround(lerp(1.f, 3.f, lerp_amt)));
529 gl_draw_scaled_image_with_border(highlight_rect.mLeft,
530 highlight_rect.mBottom, 16, 16, highlight_rect.getWidth(),
531 highlight_rect.getHeight(),
532 thumb_imagep, gFocusMgr.getFocusColor());
533 }
534
535 // draw the thumbs
536 curSldrIt = mThumbRects.end();
537 for(mIt = mThumbRects.begin(); mIt != mThumbRects.end(); mIt++) {
538
539 // choose the color
540 curThumbColor = mThumbCenterColor;
541 if(mIt->first == mCurSlider) {
542 // don't draw now, draw last
543 curSldrIt = mIt;
544 continue;
545 }
546
547 // the draw command
548 gl_draw_scaled_image_with_border(
549 mIt->second.mLeft,
550 mIt->second.mBottom, 16, 16,
551 mIt->second.getWidth(),
552 mIt->second.getHeight(), thumb_imagep,
553 curThumbColor, TRUE);
554 }
555
556 // draw cur slider last
557 if(curSldrIt != mThumbRects.end()) {
558 gl_draw_scaled_image_with_border(
559 curSldrIt->second.mLeft,
560 curSldrIt->second.mBottom, 16, 16,
561 curSldrIt->second.getWidth(),
562 curSldrIt->second.getHeight(), thumb_imagep,
563 mThumbCenterSelectedColor, TRUE);
564 }
565
566 }
567 else
568 {
569 // draw highlight
570 if (hasFocus())
571 {
572 F32 lerp_amt = gFocusMgr.getFocusFlashAmt();
573 LLRect highlight_rect = mThumbRects[mCurSlider];
574 highlight_rect.stretch(llround(lerp(1.f, 3.f, lerp_amt)));
575 gl_draw_scaled_image_with_border(highlight_rect.mLeft, highlight_rect.mBottom, 16, 16, highlight_rect.getWidth(), highlight_rect.getHeight(),
576 thumb_imagep, gFocusMgr.getFocusColor());
577 }
578
579 // draw thumbs
580 curSldrIt = mThumbRects.end();
581 for(mIt = mThumbRects.begin(); mIt != mThumbRects.end(); mIt++) {
582
583 // choose the color
584 curThumbColor = mThumbCenterColor;
585 if(mIt->first == mCurSlider) {
586 curSldrIt = mIt;
587 continue;
588 //curThumbColor = mThumbCenterSelectedColor;
589 }
590
591 // the draw command
592 gl_draw_scaled_image_with_border(
593 mIt->second.mLeft,
594 mIt->second.mBottom, 16, 16,
595 mIt->second.getWidth(),
596 mIt->second.getHeight(), thumb_imagep,
597 curThumbColor % opacity, TRUE);
598 }
599
600 if(curSldrIt != mThumbRects.end()) {
601 gl_draw_scaled_image_with_border(
602 curSldrIt->second.mLeft,
603 curSldrIt->second.mBottom, 16, 16,
604 curSldrIt->second.getWidth(),
605 curSldrIt->second.getHeight(), thumb_imagep,
606 mThumbCenterSelectedColor % opacity, TRUE);
607 }
608 }
609
610 LLUICtrl::draw();
611 }
612}
613
614// virtual
615LLXMLNodePtr LLMultiSlider::getXML(bool save_children) const
616{
617 LLXMLNodePtr node = LLUICtrl::getXML();
618
619 node->createChild("initial_val", TRUE)->setFloatValue(getInitialValue());
620 node->createChild("min_val", TRUE)->setFloatValue(getMinValue());
621 node->createChild("max_val", TRUE)->setFloatValue(getMaxValue());
622 node->createChild("increment", TRUE)->setFloatValue(getIncrement());
623
624 return node;
625}
626
627
628//static
629LLView* LLMultiSlider::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
630{
631 LLString name("multi_slider_bar");
632 node->getAttributeString("name", name);
633
634 LLRect rect;
635 createRect(node, rect, parent, LLRect());
636
637 F32 initial_value = 0.f;
638 node->getAttributeF32("initial_val", initial_value);
639
640 F32 min_value = 0.f;
641 node->getAttributeF32("min_val", min_value);
642
643 F32 max_value = 1.f;
644 node->getAttributeF32("max_val", max_value);
645
646 F32 increment = 0.1f;
647 node->getAttributeF32("increment", increment);
648
649 S32 max_sliders = 1;
650 node->getAttributeS32("max_sliders", max_sliders);
651
652 BOOL allow_overlap = FALSE;
653 node->getAttributeBOOL("allow_overlap", allow_overlap);
654
655 BOOL draw_track = TRUE;
656 node->getAttributeBOOL("draw_track", draw_track);
657
658 BOOL use_triangle = FALSE;
659 node->getAttributeBOOL("use_triangle", use_triangle);
660
661 LLMultiSlider* multiSlider = new LLMultiSlider(name,
662 rect,
663 NULL,
664 NULL,
665 initial_value,
666 min_value,
667 max_value,
668 increment,
669 max_sliders,
670 allow_overlap,
671 draw_track,
672 use_triangle);
673
674 multiSlider->initFromXML(node, parent);
675
676 return multiSlider;
677}
diff --git a/linden/indra/llui/llmultislider.h b/linden/indra/llui/llmultislider.h
new file mode 100644
index 0000000..7cd5061
--- /dev/null
+++ b/linden/indra/llui/llmultislider.h
@@ -0,0 +1,129 @@
1/**
2 * @file llmultislider.h
3 * @brief A simple multislider
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2008, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
30 */
31
32#ifndef LL_MULTI_SLIDER_H
33#define LL_MULTI_SLIDER_H
34
35#include "lluictrl.h"
36#include "v4color.h"
37
38class LLUICtrlFactory;
39
40class LLMultiSlider : public LLUICtrl
41{
42public:
43 LLMultiSlider(
44 const LLString& name,
45 const LLRect& rect,
46 void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata),
47 void* callback_userdata,
48 F32 initial_value,
49 F32 min_value,
50 F32 max_value,
51 F32 increment,
52 S32 max_sliders,
53 BOOL allow_overlap,
54 BOOL draw_track,
55 BOOL use_triangle,
56 const LLString& control_name = LLString::null );
57
58 virtual EWidgetType getWidgetType() const;
59 virtual LLString getWidgetTag() const;
60 virtual LLXMLNodePtr getXML(bool save_children = true) const;
61 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
62
63 void setSliderValue(const LLString& name, F32 value, BOOL from_event = FALSE);
64 F32 getSliderValue(const LLString& name) const;
65
66 const LLString& getCurSlider() const { return mCurSlider; }
67 F32 getCurSliderValue() const { return getSliderValue(mCurSlider); }
68 void setCurSlider(const LLString& name);
69 void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mCurSlider, val, from_event); }
70
71 virtual void setValue(const LLSD& value);
72 virtual LLSD getValue() const { return mValue; }
73
74 virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); }
75 virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); }
76
77 F32 getInitialValue() const { return mInitialValue; }
78 F32 getMinValue() const { return mMinValue; }
79 F32 getMaxValue() const { return mMaxValue; }
80 F32 getIncrement() const { return mIncrement; }
81 void setMinValue(F32 min_value) { mMinValue = min_value; }
82 void setMaxValue(F32 max_value) { mMaxValue = max_value; }
83 void setIncrement(F32 increment) { mIncrement = increment; }
84 void setMouseDownCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseDownCallback = cb; }
85 void setMouseUpCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseUpCallback = cb; }
86
87 bool findUnusedValue(F32& initVal);
88 const LLString& addSlider();
89 const LLString& addSlider(F32 val);
90 void deleteSlider(const LLString& name);
91 void deleteCurSlider() { deleteSlider(mCurSlider); }
92 void clear();
93
94 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
95 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
96 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
97 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
98 virtual void draw();
99
100protected:
101 LLSD mValue;
102 F32 mInitialValue;
103 F32 mMinValue;
104 F32 mMaxValue;
105 F32 mIncrement;
106 LLString mCurSlider;
107 static S32 mNameCounter;
108
109 S32 mMaxNumSliders;
110 BOOL mAllowOverlap;
111 BOOL mDrawTrack;
112 BOOL mUseTriangle; /// hacked in toggle to use a triangle
113
114 S32 mMouseOffset;
115 LLRect mDragStartThumbRect;
116
117 std::map<LLString, LLRect> mThumbRects;
118 LLColor4 mTrackColor;
119 LLColor4 mThumbOutlineColor;
120 LLColor4 mThumbCenterColor;
121 LLColor4 mThumbCenterSelectedColor;
122 LLColor4 mDisabledThumbColor;
123 LLColor4 mTriangleColor;
124
125 void (*mMouseDownCallback)(LLUICtrl* ctrl, void* userdata);
126 void (*mMouseUpCallback)(LLUICtrl* ctrl, void* userdata);
127};
128
129#endif // LL_LLSLIDER_H
diff --git a/linden/indra/llui/llmultisliderctrl.cpp b/linden/indra/llui/llmultisliderctrl.cpp
new file mode 100644
index 0000000..0d23dd7
--- /dev/null
+++ b/linden/indra/llui/llmultisliderctrl.cpp
@@ -0,0 +1,634 @@
1/**
2 * @file llmultisliderctrl.cpp
3 * @brief LLMultiSliderCtrl base class
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2008, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
30 */
31
32#include "linden_common.h"
33
34#include "llmultisliderctrl.h"
35
36#include "audioengine.h"
37#include "sound_ids.h"
38
39#include "llmath.h"
40#include "llfontgl.h"
41#include "llgl.h"
42#include "llkeyboard.h"
43#include "lllineeditor.h"
44#include "llmultislider.h"
45#include "llstring.h"
46#include "lltextbox.h"
47#include "llui.h"
48#include "lluiconstants.h"
49#include "llcontrol.h"
50#include "llfocusmgr.h"
51#include "llresmgr.h"
52
53const U32 MAX_STRING_LENGTH = 10;
54
55
56LLMultiSliderCtrl::LLMultiSliderCtrl(const LLString& name, const LLRect& rect,
57 const LLString& label,
58 const LLFontGL* font,
59 S32 label_width,
60 S32 text_left,
61 BOOL show_text,
62 BOOL can_edit_text,
63 void (*commit_callback)(LLUICtrl*, void*),
64 void* callback_user_data,
65 F32 initial_value, F32 min_value, F32 max_value, F32 increment,
66 S32 max_sliders, BOOL allow_overlap,
67 BOOL draw_track,
68 BOOL use_triangle,
69 const LLString& control_which)
70 : LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data ),
71 mFont(font),
72 mShowText( show_text ),
73 mCanEditText( can_edit_text ),
74 mPrecision( 3 ),
75 mLabelBox( NULL ),
76 mLabelWidth( label_width ),
77
78 mEditor( NULL ),
79 mTextBox( NULL ),
80 mTextEnabledColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ),
81 mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ),
82 mSliderMouseUpCallback( NULL ),
83 mSliderMouseDownCallback( NULL )
84{
85 S32 top = getRect().getHeight();
86 S32 bottom = 0;
87 S32 left = 0;
88
89 // Label
90 if( !label.empty() )
91 {
92 if (label_width == 0)
93 {
94 label_width = font->getWidth(label);
95 }
96 LLRect label_rect( left, top, label_width, bottom );
97 mLabelBox = new LLTextBox( "MultiSliderCtrl Label", label_rect, label.c_str(), font );
98 addChild(mLabelBox);
99 }
100
101 S32 slider_right = getRect().getWidth();
102 if( show_text )
103 {
104 slider_right = text_left - MULTI_SLIDERCTRL_SPACING;
105 }
106
107 S32 slider_left = label_width ? label_width + MULTI_SLIDERCTRL_SPACING : 0;
108 LLRect slider_rect( slider_left, top, slider_right, bottom );
109 mMultiSlider = new LLMultiSlider(
110 "multi_slider",
111 slider_rect,
112 LLMultiSliderCtrl::onSliderCommit, this,
113 initial_value, min_value, max_value, increment,
114 max_sliders, allow_overlap, draw_track,
115 use_triangle,
116 control_which );
117 addChild( mMultiSlider );
118 mCurValue = mMultiSlider->getCurSliderValue();
119
120 if( show_text )
121 {
122 LLRect text_rect( text_left, top, getRect().getWidth(), bottom );
123 if( can_edit_text )
124 {
125 mEditor = new LLLineEditor( "MultiSliderCtrl Editor", text_rect,
126 "", font,
127 MAX_STRING_LENGTH,
128 &LLMultiSliderCtrl::onEditorCommit, NULL, NULL, this,
129 &LLLineEditor::prevalidateFloat );
130 mEditor->setFollowsLeft();
131 mEditor->setFollowsBottom();
132 mEditor->setFocusReceivedCallback( &LLMultiSliderCtrl::onEditorGainFocus );
133 mEditor->setIgnoreTab(TRUE);
134 // don't do this, as selecting the entire text is single clicking in some cases
135 // and double clicking in others
136 //mEditor->setSelectAllonFocusReceived(TRUE);
137 addChild(mEditor);
138 }
139 else
140 {
141 mTextBox = new LLTextBox( "MultiSliderCtrl Text", text_rect, "", font);
142 mTextBox->setFollowsLeft();
143 mTextBox->setFollowsBottom();
144 addChild(mTextBox);
145 }
146 }
147
148 updateText();
149}
150
151LLMultiSliderCtrl::~LLMultiSliderCtrl()
152{
153 // Children all cleaned up by default view destructor.
154}
155
156// static
157void LLMultiSliderCtrl::onEditorGainFocus( LLFocusableElement* caller, void *userdata )
158{
159 LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
160 llassert( caller == self->mEditor );
161
162 self->onFocusReceived();
163}
164
165
166void LLMultiSliderCtrl::setValue(const LLSD& value)
167{
168 mMultiSlider->setValue(value);
169 mCurValue = mMultiSlider->getCurSliderValue();
170 updateText();
171}
172
173void LLMultiSliderCtrl::setSliderValue(const LLString& name, F32 v, BOOL from_event)
174{
175 mMultiSlider->setSliderValue(name, v, from_event );
176 mCurValue = mMultiSlider->getCurSliderValue();
177 updateText();
178}
179
180void LLMultiSliderCtrl::setCurSlider(const LLString& name)
181{
182 mMultiSlider->setCurSlider(name);
183 mCurValue = mMultiSlider->getCurSliderValue();
184}
185
186BOOL LLMultiSliderCtrl::setLabelArg( const LLString& key, const LLString& text )
187{
188 BOOL res = FALSE;
189 if (mLabelBox)
190 {
191 res = mLabelBox->setTextArg(key, text);
192 if (res && mLabelWidth == 0)
193 {
194 S32 label_width = mFont->getWidth(mLabelBox->getText());
195 LLRect rect = mLabelBox->getRect();
196 S32 prev_right = rect.mRight;
197 rect.mRight = rect.mLeft + label_width;
198 mLabelBox->setRect(rect);
199
200 S32 delta = rect.mRight - prev_right;
201 rect = mMultiSlider->getRect();
202 S32 left = rect.mLeft + delta;
203 left = llclamp(left, 0, rect.mRight-MULTI_SLIDERCTRL_SPACING);
204 rect.mLeft = left;
205 mMultiSlider->setRect(rect);
206 }
207 }
208 return res;
209}
210
211const LLString& LLMultiSliderCtrl::addSlider()
212{
213 const LLString& name = mMultiSlider->addSlider();
214
215 // if it returns null, pass it on
216 if(name == LLString::null) {
217 return LLString::null;
218 }
219
220 // otherwise, update stuff
221 mCurValue = mMultiSlider->getCurSliderValue();
222 updateText();
223 return name;
224}
225
226const LLString& LLMultiSliderCtrl::addSlider(F32 val)
227{
228 const LLString& name = mMultiSlider->addSlider(val);
229
230 // if it returns null, pass it on
231 if(name == LLString::null) {
232 return LLString::null;
233 }
234
235 // otherwise, update stuff
236 mCurValue = mMultiSlider->getCurSliderValue();
237 updateText();
238 return name;
239}
240
241void LLMultiSliderCtrl::deleteSlider(const LLString& name)
242{
243 mMultiSlider->deleteSlider(name);
244 mCurValue = mMultiSlider->getCurSliderValue();
245 updateText();
246}
247
248
249void LLMultiSliderCtrl::clear()
250{
251 setCurSliderValue(0.0f);
252 if( mEditor )
253 {
254 mEditor->setText(LLString(""));
255 }
256 if( mTextBox )
257 {
258 mTextBox->setText(LLString(""));
259 }
260
261 // get rid of sliders
262 mMultiSlider->clear();
263
264}
265
266BOOL LLMultiSliderCtrl::isMouseHeldDown()
267{
268 return gFocusMgr.getMouseCapture() == mMultiSlider;
269}
270
271void LLMultiSliderCtrl::updateText()
272{
273 if( mEditor || mTextBox )
274 {
275 LLLocale locale(LLLocale::USER_LOCALE);
276
277 // Don't display very small negative values as -0.000
278 F32 displayed_value = (F32)(floor(getCurSliderValue() * pow(10.0, (F64)mPrecision) + 0.5) / pow(10.0, (F64)mPrecision));
279
280 LLString format = llformat("%%.%df", mPrecision);
281 LLString text = llformat(format.c_str(), displayed_value);
282 if( mEditor )
283 {
284 mEditor->setText( text );
285 }
286 else
287 {
288 mTextBox->setText( text );
289 }
290 }
291}
292
293// static
294void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* caller, void *userdata )
295{
296 LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
297 llassert( caller == self->mEditor );
298
299 BOOL success = FALSE;
300 F32 val = self->mCurValue;
301 F32 saved_val = self->mCurValue;
302
303 LLString text = self->mEditor->getText();
304 if( LLLineEditor::postvalidateFloat( text ) )
305 {
306 LLLocale locale(LLLocale::USER_LOCALE);
307 val = (F32) atof( text.c_str() );
308 if( self->mMultiSlider->getMinValue() <= val && val <= self->mMultiSlider->getMaxValue() )
309 {
310 if( self->mValidateCallback )
311 {
312 self->setCurSliderValue( val ); // set the value temporarily so that the callback can retrieve it.
313 if( self->mValidateCallback( self, self->mCallbackUserData ) )
314 {
315 success = TRUE;
316 }
317 }
318 else
319 {
320 self->setCurSliderValue( val );
321 success = TRUE;
322 }
323 }
324 }
325
326 if( success )
327 {
328 self->onCommit();
329 }
330 else
331 {
332 if( self->getCurSliderValue() != saved_val )
333 {
334 self->setCurSliderValue( saved_val );
335 }
336 self->reportInvalidData();
337 }
338 self->updateText();
339}
340
341// static
342void LLMultiSliderCtrl::onSliderCommit( LLUICtrl* caller, void *userdata )
343{
344 LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
345 //llassert( caller == self->mSlider );
346
347 BOOL success = FALSE;
348 F32 saved_val = self->mCurValue;
349 F32 new_val = self->mMultiSlider->getCurSliderValue();
350
351 if( self->mValidateCallback )
352 {
353 self->mCurValue = new_val; // set the value temporarily so that the callback can retrieve it.
354 if( self->mValidateCallback( self, self->mCallbackUserData ) )
355 {
356 success = TRUE;
357 }
358 }
359 else
360 {
361 self->mCurValue = new_val;
362 success = TRUE;
363 }
364
365 if( success )
366 {
367 self->onCommit();
368 }
369 else
370 {
371 if( self->mCurValue != saved_val )
372 {
373 self->setCurSliderValue( saved_val );
374 }
375 self->reportInvalidData();
376 }
377 self->updateText();
378}
379
380void LLMultiSliderCtrl::setEnabled(BOOL b)
381{
382 LLUICtrl::setEnabled( b );
383
384 if( mLabelBox )
385 {
386 mLabelBox->setColor( b ? mTextEnabledColor : mTextDisabledColor );
387 }
388
389 mMultiSlider->setEnabled( b );
390
391 if( mEditor )
392 {
393 mEditor->setEnabled( b );
394 }
395
396 if( mTextBox )
397 {
398 mTextBox->setColor( b ? mTextEnabledColor : mTextDisabledColor );
399 }
400}
401
402
403void LLMultiSliderCtrl::setTentative(BOOL b)
404{
405 if( mEditor )
406 {
407 mEditor->setTentative(b);
408 }
409 LLUICtrl::setTentative(b);
410}
411
412
413void LLMultiSliderCtrl::onCommit()
414{
415 setTentative(FALSE);
416
417 if( mEditor )
418 {
419 mEditor->setTentative(FALSE);
420 }
421
422 LLUICtrl::onCommit();
423}
424
425
426void LLMultiSliderCtrl::setPrecision(S32 precision)
427{
428 if (precision < 0 || precision > 10)
429 {
430 llerrs << "LLMultiSliderCtrl::setPrecision - precision out of range" << llendl;
431 return;
432 }
433
434 mPrecision = precision;
435 updateText();
436}
437
438void LLMultiSliderCtrl::setSliderMouseDownCallback( void (*slider_mousedown_callback)(LLUICtrl* caller, void* userdata) )
439{
440 mSliderMouseDownCallback = slider_mousedown_callback;
441 mMultiSlider->setMouseDownCallback( LLMultiSliderCtrl::onSliderMouseDown );
442}
443
444// static
445void LLMultiSliderCtrl::onSliderMouseDown(LLUICtrl* caller, void* userdata)
446{
447 LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
448 if( self->mSliderMouseDownCallback )
449 {
450 self->mSliderMouseDownCallback( self, self->mCallbackUserData );
451 }
452}
453
454
455void LLMultiSliderCtrl::setSliderMouseUpCallback( void (*slider_mouseup_callback)(LLUICtrl* caller, void* userdata) )
456{
457 mSliderMouseUpCallback = slider_mouseup_callback;
458 mMultiSlider->setMouseUpCallback( LLMultiSliderCtrl::onSliderMouseUp );
459}
460
461// static
462void LLMultiSliderCtrl::onSliderMouseUp(LLUICtrl* caller, void* userdata)
463{
464 LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
465 if( self->mSliderMouseUpCallback )
466 {
467 self->mSliderMouseUpCallback( self, self->mCallbackUserData );
468 }
469}
470
471void LLMultiSliderCtrl::onTabInto()
472{
473 if( mEditor )
474 {
475 mEditor->onTabInto();
476 }
477}
478
479void LLMultiSliderCtrl::reportInvalidData()
480{
481 make_ui_sound("UISndBadKeystroke");
482}
483
484//virtual
485LLString LLMultiSliderCtrl::getControlName() const
486{
487 return mMultiSlider->getControlName();
488}
489
490// virtual
491void LLMultiSliderCtrl::setControlName(const LLString& control_name, LLView* context)
492{
493 mMultiSlider->setControlName(control_name, context);
494}
495
496// virtual
497LLXMLNodePtr LLMultiSliderCtrl::getXML(bool save_children) const
498{
499 LLXMLNodePtr node = LLUICtrl::getXML();
500
501 node->createChild("show_text", TRUE)->setBoolValue(mShowText);
502
503 node->createChild("can_edit_text", TRUE)->setBoolValue(mCanEditText);
504
505 node->createChild("decimal_digits", TRUE)->setIntValue(mPrecision);
506
507 if (mLabelBox)
508 {
509 node->createChild("label", TRUE)->setStringValue(mLabelBox->getText());
510 }
511
512 // TomY TODO: Do we really want to export the transient state of the slider?
513 node->createChild("value", TRUE)->setFloatValue(mCurValue);
514
515 if (mMultiSlider)
516 {
517 node->createChild("initial_val", TRUE)->setFloatValue(mMultiSlider->getInitialValue());
518 node->createChild("min_val", TRUE)->setFloatValue(mMultiSlider->getMinValue());
519 node->createChild("max_val", TRUE)->setFloatValue(mMultiSlider->getMaxValue());
520 node->createChild("increment", TRUE)->setFloatValue(mMultiSlider->getIncrement());
521 }
522 addColorXML(node, mTextEnabledColor, "text_enabled_color", "LabelTextColor");
523 addColorXML(node, mTextDisabledColor, "text_disabled_color", "LabelDisabledColor");
524
525 return node;
526}
527
528LLView* LLMultiSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
529{
530 LLString name("multi_slider");
531 node->getAttributeString("name", name);
532
533 LLString label;
534 node->getAttributeString("label", label);
535
536 LLRect rect;
537 createRect(node, rect, parent, LLRect());
538
539 LLFontGL* font = LLView::selectFont(node);
540
541 // HACK: Font might not be specified.
542 if (!font)
543 {
544 font = LLFontGL::sSansSerifSmall;
545 }
546
547 S32 label_width = 0;
548 node->getAttributeS32("label_width", label_width);
549
550 BOOL show_text = TRUE;
551 node->getAttributeBOOL("show_text", show_text);
552
553 BOOL can_edit_text = FALSE;
554 node->getAttributeBOOL("can_edit_text", can_edit_text);
555
556 BOOL allow_overlap = FALSE;
557 node->getAttributeBOOL("allow_overlap", allow_overlap);
558
559 BOOL draw_track = TRUE;
560 node->getAttributeBOOL("draw_track", draw_track);
561
562 BOOL use_triangle = FALSE;
563 node->getAttributeBOOL("use_triangle", use_triangle);
564
565 F32 initial_value = 0.f;
566 node->getAttributeF32("initial_val", initial_value);
567
568 F32 min_value = 0.f;
569 node->getAttributeF32("min_val", min_value);
570
571 F32 max_value = 1.f;
572 node->getAttributeF32("max_val", max_value);
573
574 F32 increment = 0.1f;
575 node->getAttributeF32("increment", increment);
576
577 U32 precision = 3;
578 node->getAttributeU32("decimal_digits", precision);
579
580 S32 max_sliders = 1;
581 node->getAttributeS32("max_sliders", max_sliders);
582
583
584 S32 text_left = 0;
585 if (show_text)
586 {
587 // calculate the size of the text box (log max_value is number of digits - 1 so plus 1)
588 if ( max_value )
589 text_left = font->getWidth("0") * ( static_cast < S32 > ( log10 ( max_value ) ) + precision + 1 );
590
591 if ( increment < 1.0f )
592 text_left += font->getWidth("."); // (mostly) take account of decimal point in value
593
594 if ( min_value < 0.0f || max_value < 0.0f )
595 text_left += font->getWidth("-"); // (mostly) take account of minus sign
596
597 // padding to make things look nicer
598 text_left += 8;
599 }
600
601 LLUICtrlCallback callback = NULL;
602
603 if (label.empty())
604 {
605 label.assign(node->getTextContents());
606 }
607
608 LLMultiSliderCtrl* slider = new LLMultiSliderCtrl(name,
609 rect,
610 label,
611 font,
612 label_width,
613 rect.getWidth() - text_left,
614 show_text,
615 can_edit_text,
616 callback,
617 NULL,
618 initial_value,
619 min_value,
620 max_value,
621 increment,
622 max_sliders,
623 allow_overlap,
624 draw_track,
625 use_triangle);
626
627 slider->setPrecision(precision);
628
629 slider->initFromXML(node, parent);
630
631 slider->updateText();
632
633 return slider;
634}
diff --git a/linden/indra/llui/llmultisliderctrl.h b/linden/indra/llui/llmultisliderctrl.h
new file mode 100644
index 0000000..90f43df
--- /dev/null
+++ b/linden/indra/llui/llmultisliderctrl.h
@@ -0,0 +1,160 @@
1/**
2 * @file llmultisliderctrl.h
3 * @brief LLMultiSliderCtrl base class
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2008, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
30 */
31
32#ifndef LL_MULTI_SLIDERCTRL_H
33#define LL_MULTI_SLIDERCTRL_H
34
35#include "lluictrl.h"
36#include "v4color.h"
37#include "llmultislider.h"
38#include "lltextbox.h"
39#include "llrect.h"
40
41//
42// Constants
43//
44const S32 MULTI_SLIDERCTRL_SPACING = 4; // space between label, slider, and text
45const S32 MULTI_SLIDERCTRL_HEIGHT = 16;
46
47//
48// Classes
49//
50class LLFontGL;
51class LLLineEditor;
52class LLSlider;
53
54
55class LLMultiSliderCtrl : public LLUICtrl
56{
57public:
58 LLMultiSliderCtrl(const LLString& name,
59 const LLRect& rect,
60 const LLString& label,
61 const LLFontGL* font,
62 S32 slider_left,
63 S32 text_left,
64 BOOL show_text,
65 BOOL can_edit_text,
66 void (*commit_callback)(LLUICtrl*, void*),
67 void* callback_userdata,
68 F32 initial_value, F32 min_value, F32 max_value, F32 increment,
69 S32 max_sliders, BOOL allow_overlap, BOOL draw_track,
70 BOOL use_triangle,
71 const LLString& control_which = LLString::null );
72
73 virtual ~LLMultiSliderCtrl();
74 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MULTI_SLIDER; }
75 virtual LLString getWidgetTag() const { return LL_MULTI_SLIDER_CTRL_TAG; }
76 virtual LLXMLNodePtr getXML(bool save_children = true) const;
77 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
78
79 F32 getSliderValue(const LLString& name) const;
80 void setSliderValue(const LLString& name, F32 v, BOOL from_event = FALSE);
81
82 virtual void setValue(const LLSD& value );
83 virtual LLSD getValue() const { return mMultiSlider->getValue(); }
84 virtual BOOL setLabelArg( const LLString& key, const LLString& text );
85
86 const LLString& getCurSlider() const { return mMultiSlider->getCurSlider(); }
87 F32 getCurSliderValue() const { return mCurValue; }
88 void setCurSlider(const LLString& name);
89 void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mMultiSlider->getCurSlider(), val, from_event); }
90
91 virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); }
92 virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); }
93
94 BOOL isMouseHeldDown();
95
96 virtual void setEnabled( BOOL b );
97 virtual void clear();
98 virtual void setPrecision(S32 precision);
99 void setMinValue(F32 min_value) {mMultiSlider->setMinValue(min_value);}
100 void setMaxValue(F32 max_value) {mMultiSlider->setMaxValue(max_value);}
101 void setIncrement(F32 increment) {mMultiSlider->setIncrement(increment);}
102
103 /// for adding and deleting sliders
104 const LLString& addSlider();
105 const LLString& addSlider(F32 val);
106 void deleteSlider(const LLString& name);
107 void deleteCurSlider() { deleteSlider(mMultiSlider->getCurSlider()); }
108
109 F32 getMinValue() { return mMultiSlider->getMinValue(); }
110 F32 getMaxValue() { return mMultiSlider->getMaxValue(); }
111
112 void setLabel(const LLString& label) { if (mLabelBox) mLabelBox->setText(label); }
113 void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; }
114 void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; }
115
116 void setSliderMouseDownCallback( void (*slider_mousedown_callback)(LLUICtrl* caller, void* userdata) );
117 void setSliderMouseUpCallback( void (*slider_mouseup_callback)(LLUICtrl* caller, void* userdata) );
118
119 virtual void onTabInto();
120
121 virtual void setTentative(BOOL b); // marks value as tentative
122 virtual void onCommit(); // mark not tentative, then commit
123
124 virtual void setControlName(const LLString& control_name, LLView* context);
125 virtual LLString getControlName() const;
126
127 static void onSliderCommit(LLUICtrl* caller, void* userdata);
128 static void onSliderMouseDown(LLUICtrl* caller,void* userdata);
129 static void onSliderMouseUp(LLUICtrl* caller,void* userdata);
130
131 static void onEditorCommit(LLUICtrl* caller, void* userdata);
132 static void onEditorGainFocus(LLFocusableElement* caller, void *userdata);
133 static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata);
134
135private:
136 void updateText();
137 void reportInvalidData();
138
139private:
140 const LLFontGL* mFont;
141 BOOL mShowText;
142 BOOL mCanEditText;
143
144 S32 mPrecision;
145 LLTextBox* mLabelBox;
146 S32 mLabelWidth;
147
148 F32 mCurValue;
149 LLMultiSlider* mMultiSlider;
150 LLLineEditor* mEditor;
151 LLTextBox* mTextBox;
152
153 LLColor4 mTextEnabledColor;
154 LLColor4 mTextDisabledColor;
155
156 void (*mSliderMouseUpCallback)( LLUICtrl* ctrl, void* userdata );
157 void (*mSliderMouseDownCallback)( LLUICtrl* ctrl, void* userdata );
158};
159
160#endif // LL_MULTI_SLIDERCTRL_H
diff --git a/linden/indra/llui/llpanel.cpp b/linden/indra/llui/llpanel.cpp
index b72e104..9a3f1a2 100644
--- a/linden/indra/llui/llpanel.cpp
+++ b/linden/indra/llui/llpanel.cpp
@@ -60,10 +60,10 @@
60#include "llresizebar.h" 60#include "llresizebar.h"
61#include "llcriticaldamp.h" 61#include "llcriticaldamp.h"
62 62
63LLPanel::panel_map_t LLPanel::sPanelMap;
64LLPanel::alert_queue_t LLPanel::sAlertQueue; 63LLPanel::alert_queue_t LLPanel::sAlertQueue;
65 64
66const S32 RESIZE_BAR_OVERLAP = 1; 65const S32 RESIZE_BAR_OVERLAP = 1;
66const S32 RESIZE_BAR_HEIGHT = 3;
67 67
68void LLPanel::init() 68void LLPanel::init()
69{ 69{
@@ -78,8 +78,7 @@ void LLPanel::init()
78 setIsChrome(FALSE); //is this a decorator to a live window or a form? 78 setIsChrome(FALSE); //is this a decorator to a live window or a form?
79 mLastTabGroup = 0; 79 mLastTabGroup = 0;
80 80
81 // add self to handle->panel map 81 mPanelHandle.bind(this);
82 sPanelMap[mViewHandle] = this;
83 setTabStop(FALSE); 82 setTabStop(FALSE);
84} 83}
85 84
@@ -121,31 +120,11 @@ LLPanel::LLPanel(const LLString& name, const LLString& rect_control, BOOL border
121 } 120 }
122} 121}
123 122
124void LLPanel::addBorder(LLViewBorder::EBevel border_bevel,
125 LLViewBorder::EStyle border_style, S32 border_thickness)
126{
127 removeBorder();
128 mBorder = new LLViewBorder( "panel border",
129 LLRect(0, mRect.getHeight(), mRect.getWidth(), 0),
130 border_bevel, border_style, border_thickness );
131 mBorder->setSaveToXML(false);
132 addChild( mBorder );
133}
134
135void LLPanel::removeBorder()
136{
137 delete mBorder;
138 mBorder = NULL;
139}
140
141
142LLPanel::~LLPanel() 123LLPanel::~LLPanel()
143{ 124{
144 storeRectControl(); 125 storeRectControl();
145 sPanelMap.erase(mViewHandle);
146} 126}
147 127
148
149// virtual 128// virtual
150EWidgetType LLPanel::getWidgetType() const 129EWidgetType LLPanel::getWidgetType() const
151{ 130{
@@ -159,7 +138,7 @@ LLString LLPanel::getWidgetTag() const
159} 138}
160 139
161// virtual 140// virtual
162BOOL LLPanel::isPanel() 141BOOL LLPanel::isPanel() const
163{ 142{
164 return TRUE; 143 return TRUE;
165} 144}
@@ -170,6 +149,24 @@ BOOL LLPanel::postBuild()
170 return TRUE; 149 return TRUE;
171} 150}
172 151
152void LLPanel::addBorder(LLViewBorder::EBevel border_bevel,
153 LLViewBorder::EStyle border_style, S32 border_thickness)
154{
155 removeBorder();
156 mBorder = new LLViewBorder( "panel border",
157 LLRect(0, getRect().getHeight(), getRect().getWidth(), 0),
158 border_bevel, border_style, border_thickness );
159 mBorder->setSaveToXML(false);
160 addChild( mBorder );
161}
162
163void LLPanel::removeBorder()
164{
165 delete mBorder;
166 mBorder = NULL;
167}
168
169
173// virtual 170// virtual
174void LLPanel::clearCtrls() 171void LLPanel::clearCtrls()
175{ 172{
@@ -200,8 +197,8 @@ void LLPanel::draw()
200 { 197 {
201 //RN: I don't see the point of this 198 //RN: I don't see the point of this
202 S32 left = 0;//LLPANEL_BORDER_WIDTH; 199 S32 left = 0;//LLPANEL_BORDER_WIDTH;
203 S32 top = mRect.getHeight();// - LLPANEL_BORDER_WIDTH; 200 S32 top = getRect().getHeight();// - LLPANEL_BORDER_WIDTH;
204 S32 right = mRect.getWidth();// - LLPANEL_BORDER_WIDTH; 201 S32 right = getRect().getWidth();// - LLPANEL_BORDER_WIDTH;
205 S32 bottom = 0;//LLPANEL_BORDER_WIDTH; 202 S32 bottom = 0;//LLPANEL_BORDER_WIDTH;
206 203
207 if (mBgOpaque ) 204 if (mBgOpaque )
@@ -281,13 +278,13 @@ BOOL LLPanel::handleKey(KEY key, MASK mask, BOOL called_from_parent)
281 if( (mask == MASK_SHIFT) && (KEY_TAB == key)) 278 if( (mask == MASK_SHIFT) && (KEY_TAB == key))
282 { 279 {
283 //SHIFT-TAB 280 //SHIFT-TAB
284 LLView* cur_focus = gFocusMgr.getKeyboardFocus(); 281 LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus();
285 if (cur_focus && gFocusMgr.childHasKeyboardFocus(this)) 282 if (cur_focus && gFocusMgr.childHasKeyboardFocus(this))
286 { 283 {
287 LLView* focus_root = cur_focus; 284 LLUICtrl* focus_root = cur_focus;
288 while(cur_focus->getParent()) 285 while(cur_focus->getParentUICtrl())
289 { 286 {
290 cur_focus = cur_focus->getParent(); 287 cur_focus = cur_focus->getParentUICtrl();
291 if (cur_focus->isFocusRoot()) 288 if (cur_focus->isFocusRoot())
292 { 289 {
293 // this is the root-most focus root found so far 290 // this is the root-most focus root found so far
@@ -296,7 +293,7 @@ BOOL LLPanel::handleKey(KEY key, MASK mask, BOOL called_from_parent)
296 } 293 }
297 handled = focus_root->focusPrevItem(FALSE); 294 handled = focus_root->focusPrevItem(FALSE);
298 } 295 }
299 else if (!cur_focus && mIsFocusRoot) 296 else if (!cur_focus && isFocusRoot())
300 { 297 {
301 handled = focusLastItem(); 298 handled = focusLastItem();
302 if (!handled) 299 if (!handled)
@@ -310,13 +307,13 @@ BOOL LLPanel::handleKey(KEY key, MASK mask, BOOL called_from_parent)
310 if( (mask == MASK_NONE ) && (KEY_TAB == key)) 307 if( (mask == MASK_NONE ) && (KEY_TAB == key))
311 { 308 {
312 //TAB 309 //TAB
313 LLView* cur_focus = gFocusMgr.getKeyboardFocus(); 310 LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus();
314 if (cur_focus && gFocusMgr.childHasKeyboardFocus(this)) 311 if (cur_focus && gFocusMgr.childHasKeyboardFocus(this))
315 { 312 {
316 LLView* focus_root = cur_focus; 313 LLUICtrl* focus_root = cur_focus;
317 while(cur_focus->getParent()) 314 while(cur_focus->getParentUICtrl())
318 { 315 {
319 cur_focus = cur_focus->getParent(); 316 cur_focus = cur_focus->getParentUICtrl();
320 if (cur_focus->isFocusRoot()) 317 if (cur_focus->isFocusRoot())
321 { 318 {
322 focus_root = cur_focus; 319 focus_root = cur_focus;
@@ -324,7 +321,7 @@ BOOL LLPanel::handleKey(KEY key, MASK mask, BOOL called_from_parent)
324 } 321 }
325 handled = focus_root->focusNextItem(FALSE); 322 handled = focus_root->focusNextItem(FALSE);
326 } 323 }
327 else if (!cur_focus && mIsFocusRoot) 324 else if (!cur_focus && isFocusRoot())
328 { 325 {
329 handled = focusFirstItem(); 326 handled = focusFirstItem();
330 if (!handled) 327 if (!handled)
@@ -408,12 +405,12 @@ void LLPanel::requires(LLString name, EWidgetType type)
408 mRequirements[name] = type; 405 mRequirements[name] = type;
409} 406}
410 407
411BOOL LLPanel::checkRequirements() 408BOOL LLPanel::checkRequirements() const
412{ 409{
413 BOOL retval = TRUE; 410 BOOL retval = TRUE;
414 LLString message; 411 LLString message;
415 412
416 for (requirements_map_t::iterator i = mRequirements.begin(); i != mRequirements.end(); ++i) 413 for (requirements_map_t::const_iterator i = mRequirements.begin(); i != mRequirements.end(); ++i)
417 { 414 {
418 if (!this->getCtrlByNameAndType(i->first, i->second)) 415 if (!this->getCtrlByNameAndType(i->first, i->second))
419 { 416 {
@@ -489,21 +486,6 @@ void LLPanel::setFocus(BOOL b)
489 } 486 }
490} 487}
491 488
492void LLPanel::setBackgroundColor(const LLColor4& color)
493{
494 mBgColorOpaque = color;
495}
496
497LLColor4 LLPanel::getBackgroundColor()
498{
499 return mBgColorOpaque;
500}
501
502void LLPanel::setTransparentColor(const LLColor4& color)
503{
504 mBgColorAlpha = color;
505}
506
507void LLPanel::setBorderVisible(BOOL b) 489void LLPanel::setBorderVisible(BOOL b)
508{ 490{
509 if (mBorder) 491 if (mBorder)
@@ -512,18 +494,18 @@ void LLPanel::setBorderVisible(BOOL b)
512 } 494 }
513} 495}
514 496
515LLView* LLPanel::getCtrlByNameAndType(const LLString& name, EWidgetType type) 497LLUICtrl* LLPanel::getCtrlByNameAndType(const LLString& name, EWidgetType type) const
516{ 498{
517 LLView* view = getChildByName(name, TRUE); 499 LLView* view = getChildByName(name, TRUE);
518 if (view) 500 if (view && view->isCtrl())
519 { 501 {
520 if (type == WIDGET_TYPE_DONTCARE || view->getWidgetType() == type) 502 if (type == WIDGET_TYPE_DONTCARE || view->getWidgetType() == type)
521 { 503 {
522 return view; 504 return (LLUICtrl*)view;
523 } 505 }
524 else 506 else
525 { 507 {
526 llwarns << "Widget " << name << " has improper type in panel " << mName << "\n" 508 llwarns << "Widget " << name << " has improper type in panel " << getName() << "\n"
527 << "Is: \t\t" << view->getWidgetType() << "\n" 509 << "Is: \t\t" << view->getWidgetType() << "\n"
528 << "Should be: \t" << type 510 << "Should be: \t" << type
529 << llendl; 511 << llendl;
@@ -536,17 +518,6 @@ LLView* LLPanel::getCtrlByNameAndType(const LLString& name, EWidgetType type)
536 return NULL; 518 return NULL;
537} 519}
538 520
539// static
540LLPanel* LLPanel::getPanelByHandle(LLViewHandle handle)
541{
542 if (!sPanelMap.count(handle))
543 {
544 return NULL;
545 }
546
547 return sPanelMap[handle];
548}
549
550// virtual 521// virtual
551LLXMLNodePtr LLPanel::getXML(bool save_children) const 522LLXMLNodePtr LLPanel::getXML(bool save_children) const
552{ 523{
@@ -734,7 +705,7 @@ void LLPanel::setPanelParameters(LLXMLNodePtr node, LLView* parent)
734 setLabel(label); 705 setLabel(label);
735} 706}
736 707
737LLString LLPanel::getFormattedUIString(const LLString& name, const LLString::format_map_t& args) const 708LLString LLPanel::getString(const LLString& name, const LLString::format_map_t& args) const
738{ 709{
739 ui_string_map_t::const_iterator found_it = mUIStrings.find(name); 710 ui_string_map_t::const_iterator found_it = mUIStrings.find(name);
740 if (found_it != mUIStrings.end()) 711 if (found_it != mUIStrings.end())
@@ -744,6 +715,7 @@ LLString LLPanel::getFormattedUIString(const LLString& name, const LLString::for
744 formatted_string.setArgList(args); 715 formatted_string.setArgList(args);
745 return formatted_string.getString(); 716 return formatted_string.getString();
746 } 717 }
718 llerrs << "Failed to find string " << name << " in panel " << getName() << llendl;
747 return LLString::null; 719 return LLString::null;
748} 720}
749 721
@@ -754,13 +726,14 @@ LLUIString LLPanel::getUIString(const LLString& name) const
754 { 726 {
755 return found_it->second; 727 return found_it->second;
756 } 728 }
729 llerrs << "Failed to find string " << name << " in panel " << getName() << llendl;
757 return LLUIString(LLString::null); 730 return LLUIString(LLString::null);
758} 731}
759 732
760 733
761void LLPanel::childSetVisible(const LLString& id, bool visible) 734void LLPanel::childSetVisible(const LLString& id, bool visible)
762{ 735{
763 LLView* child = getChildByName(id, true); 736 LLView* child = getChild<LLView>(id);
764 if (child) 737 if (child)
765 { 738 {
766 child->setVisible(visible); 739 child->setVisible(visible);
@@ -769,7 +742,7 @@ void LLPanel::childSetVisible(const LLString& id, bool visible)
769 742
770bool LLPanel::childIsVisible(const LLString& id) const 743bool LLPanel::childIsVisible(const LLString& id) const
771{ 744{
772 LLView* child = getChildByName(id, true); 745 LLView* child = getChild<LLView>(id);
773 if (child) 746 if (child)
774 { 747 {
775 return (bool)child->getVisible(); 748 return (bool)child->getVisible();
@@ -779,7 +752,7 @@ bool LLPanel::childIsVisible(const LLString& id) const
779 752
780void LLPanel::childSetEnabled(const LLString& id, bool enabled) 753void LLPanel::childSetEnabled(const LLString& id, bool enabled)
781{ 754{
782 LLView* child = getChildByName(id, true); 755 LLView* child = getChild<LLView>(id);
783 if (child) 756 if (child)
784 { 757 {
785 child->setEnabled(enabled); 758 child->setEnabled(enabled);
@@ -788,7 +761,7 @@ void LLPanel::childSetEnabled(const LLString& id, bool enabled)
788 761
789void LLPanel::childSetTentative(const LLString& id, bool tentative) 762void LLPanel::childSetTentative(const LLString& id, bool tentative)
790{ 763{
791 LLView* child = getChildByName(id, true); 764 LLView* child = getChild<LLView>(id);
792 if (child) 765 if (child)
793 { 766 {
794 child->setTentative(tentative); 767 child->setTentative(tentative);
@@ -797,7 +770,7 @@ void LLPanel::childSetTentative(const LLString& id, bool tentative)
797 770
798bool LLPanel::childIsEnabled(const LLString& id) const 771bool LLPanel::childIsEnabled(const LLString& id) const
799{ 772{
800 LLView* child = getChildByName(id, true); 773 LLView* child = getChild<LLView>(id);
801 if (child) 774 if (child)
802 { 775 {
803 return (bool)child->getEnabled(); 776 return (bool)child->getEnabled();
@@ -808,7 +781,7 @@ bool LLPanel::childIsEnabled(const LLString& id) const
808 781
809void LLPanel::childSetToolTip(const LLString& id, const LLString& msg) 782void LLPanel::childSetToolTip(const LLString& id, const LLString& msg)
810{ 783{
811 LLView* child = getChildByName(id, true); 784 LLView* child = getChild<LLView>(id);
812 if (child) 785 if (child)
813 { 786 {
814 child->setToolTip(msg); 787 child->setToolTip(msg);
@@ -817,7 +790,7 @@ void LLPanel::childSetToolTip(const LLString& id, const LLString& msg)
817 790
818void LLPanel::childSetRect(const LLString& id, const LLRect& rect) 791void LLPanel::childSetRect(const LLString& id, const LLRect& rect)
819{ 792{
820 LLView* child = getChildByName(id, true); 793 LLView* child = getChild<LLView>(id);
821 if (child) 794 if (child)
822 { 795 {
823 child->setRect(rect); 796 child->setRect(rect);
@@ -826,7 +799,7 @@ void LLPanel::childSetRect(const LLString& id, const LLRect& rect)
826 799
827bool LLPanel::childGetRect(const LLString& id, LLRect& rect) const 800bool LLPanel::childGetRect(const LLString& id, LLRect& rect) const
828{ 801{
829 LLView* child = getChildByName(id, true); 802 LLView* child = getChild<LLView>(id);
830 if (child) 803 if (child)
831 { 804 {
832 rect = child->getRect(); 805 rect = child->getRect();
@@ -837,7 +810,7 @@ bool LLPanel::childGetRect(const LLString& id, LLRect& rect) const
837 810
838void LLPanel::childSetFocus(const LLString& id, BOOL focus) 811void LLPanel::childSetFocus(const LLString& id, BOOL focus)
839{ 812{
840 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 813 LLUICtrl* child = getChild<LLUICtrl>(id, true);
841 if (child) 814 if (child)
842 { 815 {
843 child->setFocus(focus); 816 child->setFocus(focus);
@@ -846,7 +819,7 @@ void LLPanel::childSetFocus(const LLString& id, BOOL focus)
846 819
847BOOL LLPanel::childHasFocus(const LLString& id) 820BOOL LLPanel::childHasFocus(const LLString& id)
848{ 821{
849 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 822 LLUICtrl* child = getChild<LLUICtrl>(id, true);
850 if (child) 823 if (child)
851 { 824 {
852 return child->hasFocus(); 825 return child->hasFocus();
@@ -861,7 +834,7 @@ BOOL LLPanel::childHasFocus(const LLString& id)
861 834
862void LLPanel::childSetFocusChangedCallback(const LLString& id, void (*cb)(LLFocusableElement*, void*), void* user_data) 835void LLPanel::childSetFocusChangedCallback(const LLString& id, void (*cb)(LLFocusableElement*, void*), void* user_data)
863{ 836{
864 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 837 LLUICtrl* child = getChild<LLUICtrl>(id, true);
865 if (child) 838 if (child)
866 { 839 {
867 child->setFocusChangedCallback(cb, user_data); 840 child->setFocusChangedCallback(cb, user_data);
@@ -870,7 +843,7 @@ void LLPanel::childSetFocusChangedCallback(const LLString& id, void (*cb)(LLFocu
870 843
871void LLPanel::childSetCommitCallback(const LLString& id, void (*cb)(LLUICtrl*, void*), void *userdata ) 844void LLPanel::childSetCommitCallback(const LLString& id, void (*cb)(LLUICtrl*, void*), void *userdata )
872{ 845{
873 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 846 LLUICtrl* child = getChild<LLUICtrl>(id, true);
874 if (child) 847 if (child)
875 { 848 {
876 child->setCommitCallback(cb); 849 child->setCommitCallback(cb);
@@ -880,7 +853,7 @@ void LLPanel::childSetCommitCallback(const LLString& id, void (*cb)(LLUICtrl*, v
880 853
881void LLPanel::childSetDoubleClickCallback(const LLString& id, void (*cb)(void*), void *userdata ) 854void LLPanel::childSetDoubleClickCallback(const LLString& id, void (*cb)(void*), void *userdata )
882{ 855{
883 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 856 LLUICtrl* child = getChild<LLUICtrl>(id, true);
884 if (child) 857 if (child)
885 { 858 {
886 child->setDoubleClickCallback(cb); 859 child->setDoubleClickCallback(cb);
@@ -893,7 +866,7 @@ void LLPanel::childSetDoubleClickCallback(const LLString& id, void (*cb)(void*),
893 866
894void LLPanel::childSetValidate(const LLString& id, BOOL (*cb)(LLUICtrl*, void*)) 867void LLPanel::childSetValidate(const LLString& id, BOOL (*cb)(LLUICtrl*, void*))
895{ 868{
896 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 869 LLUICtrl* child = getChild<LLUICtrl>(id, true);
897 if (child) 870 if (child)
898 { 871 {
899 child->setValidateBeforeCommit(cb); 872 child->setValidateBeforeCommit(cb);
@@ -902,7 +875,7 @@ void LLPanel::childSetValidate(const LLString& id, BOOL (*cb)(LLUICtrl*, void*))
902 875
903void LLPanel::childSetUserData(const LLString& id, void* userdata) 876void LLPanel::childSetUserData(const LLString& id, void* userdata)
904{ 877{
905 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 878 LLUICtrl* child = getChild<LLUICtrl>(id, true);
906 if (child) 879 if (child)
907 { 880 {
908 child->setCallbackUserData(userdata); 881 child->setCallbackUserData(userdata);
@@ -911,16 +884,16 @@ void LLPanel::childSetUserData(const LLString& id, void* userdata)
911 884
912void LLPanel::childSetColor(const LLString& id, const LLColor4& color) 885void LLPanel::childSetColor(const LLString& id, const LLColor4& color)
913{ 886{
914 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 887 LLUICtrl* child = getChild<LLUICtrl>(id, true);
915 if (child) 888 if (child)
916 { 889 {
917 child->setColor(color); 890 child->setColor(color);
918 } 891 }
919} 892}
920 893
921LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const LLString& id) 894LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const LLString& id) const
922{ 895{
923 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 896 LLUICtrl* child = getChild<LLUICtrl>(id, true);
924 if (child) 897 if (child)
925 { 898 {
926 return child->getSelectionInterface(); 899 return child->getSelectionInterface();
@@ -928,9 +901,9 @@ LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const LLString& id
928 return NULL; 901 return NULL;
929} 902}
930 903
931LLCtrlListInterface* LLPanel::childGetListInterface(const LLString& id) 904LLCtrlListInterface* LLPanel::childGetListInterface(const LLString& id) const
932{ 905{
933 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 906 LLUICtrl* child = getChild<LLUICtrl>(id, true);
934 if (child) 907 if (child)
935 { 908 {
936 return child->getListInterface(); 909 return child->getListInterface();
@@ -938,9 +911,9 @@ LLCtrlListInterface* LLPanel::childGetListInterface(const LLString& id)
938 return NULL; 911 return NULL;
939} 912}
940 913
941LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const LLString& id) 914LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const LLString& id) const
942{ 915{
943 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 916 LLUICtrl* child = getChild<LLUICtrl>(id, true);
944 if (child) 917 if (child)
945 { 918 {
946 return child->getScrollInterface(); 919 return child->getScrollInterface();
@@ -950,7 +923,7 @@ LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const LLString& id)
950 923
951void LLPanel::childSetValue(const LLString& id, LLSD value) 924void LLPanel::childSetValue(const LLString& id, LLSD value)
952{ 925{
953 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 926 LLView* child = getChild<LLView>(id, true);
954 if (child) 927 if (child)
955 { 928 {
956 child->setValue(value); 929 child->setValue(value);
@@ -959,7 +932,7 @@ void LLPanel::childSetValue(const LLString& id, LLSD value)
959 932
960LLSD LLPanel::childGetValue(const LLString& id) const 933LLSD LLPanel::childGetValue(const LLString& id) const
961{ 934{
962 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 935 LLView* child = getChild<LLView>(id, true);
963 if (child) 936 if (child)
964 { 937 {
965 return child->getValue(); 938 return child->getValue();
@@ -970,7 +943,7 @@ LLSD LLPanel::childGetValue(const LLString& id) const
970 943
971BOOL LLPanel::childSetTextArg(const LLString& id, const LLString& key, const LLStringExplicit& text) 944BOOL LLPanel::childSetTextArg(const LLString& id, const LLString& key, const LLStringExplicit& text)
972{ 945{
973 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 946 LLUICtrl* child = getChild<LLUICtrl>(id, true);
974 if (child) 947 if (child)
975 { 948 {
976 return child->setTextArg(key, text); 949 return child->setTextArg(key, text);
@@ -980,7 +953,7 @@ BOOL LLPanel::childSetTextArg(const LLString& id, const LLString& key, const LLS
980 953
981BOOL LLPanel::childSetLabelArg(const LLString& id, const LLString& key, const LLStringExplicit& text) 954BOOL LLPanel::childSetLabelArg(const LLString& id, const LLString& key, const LLStringExplicit& text)
982{ 955{
983 LLView* child = getChildByName(id, true); 956 LLView* child = getChild<LLView>(id);
984 if (child) 957 if (child)
985 { 958 {
986 return child->setLabelArg(key, text); 959 return child->setLabelArg(key, text);
@@ -1000,7 +973,7 @@ BOOL LLPanel::childSetToolTipArg(const LLString& id, const LLString& key, const
1000 973
1001void LLPanel::childSetMinValue(const LLString& id, LLSD min_value) 974void LLPanel::childSetMinValue(const LLString& id, LLSD min_value)
1002{ 975{
1003 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 976 LLUICtrl* child = getChild<LLUICtrl>(id, true);
1004 if (child) 977 if (child)
1005 { 978 {
1006 child->setMinValue(min_value); 979 child->setMinValue(min_value);
@@ -1009,7 +982,7 @@ void LLPanel::childSetMinValue(const LLString& id, LLSD min_value)
1009 982
1010void LLPanel::childSetMaxValue(const LLString& id, LLSD max_value) 983void LLPanel::childSetMaxValue(const LLString& id, LLSD max_value)
1011{ 984{
1012 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 985 LLUICtrl* child = getChild<LLUICtrl>(id, true);
1013 if (child) 986 if (child)
1014 { 987 {
1015 child->setMaxValue(max_value); 988 child->setMaxValue(max_value);
@@ -1018,16 +991,16 @@ void LLPanel::childSetMaxValue(const LLString& id, LLSD max_value)
1018 991
1019void LLPanel::childShowTab(const LLString& id, const LLString& tabname, bool visible) 992void LLPanel::childShowTab(const LLString& id, const LLString& tabname, bool visible)
1020{ 993{
1021 LLTabContainerCommon* child = LLUICtrlFactory::getTabContainerByName(this, id); 994 LLTabContainer* child = LLUICtrlFactory::getTabContainerByName(this, id);
1022 if (child) 995 if (child)
1023 { 996 {
1024 child->selectTabByName(tabname); 997 child->selectTabByName(tabname);
1025 } 998 }
1026} 999}
1027 1000
1028LLPanel *LLPanel::childGetVisibleTab(const LLString& id) 1001LLPanel *LLPanel::childGetVisibleTab(const LLString& id) const
1029{ 1002{
1030 LLTabContainerCommon* child = LLUICtrlFactory::getTabContainerByName(this, id); 1003 LLTabContainer* child = LLUICtrlFactory::getTabContainerByName(this, id);
1031 if (child) 1004 if (child)
1032 { 1005 {
1033 return child->getCurrentPanel(); 1006 return child->getCurrentPanel();
@@ -1037,7 +1010,7 @@ LLPanel *LLPanel::childGetVisibleTab(const LLString& id)
1037 1010
1038void LLPanel::childSetTabChangeCallback(const LLString& id, const LLString& tabname, void (*on_tab_clicked)(void*, bool), void *userdata) 1011void LLPanel::childSetTabChangeCallback(const LLString& id, const LLString& tabname, void (*on_tab_clicked)(void*, bool), void *userdata)
1039{ 1012{
1040 LLTabContainerCommon* child = LLUICtrlFactory::getTabContainerByName(this, id); 1013 LLTabContainer* child = LLUICtrlFactory::getTabContainerByName(this, id);
1041 if (child) 1014 if (child)
1042 { 1015 {
1043 LLPanel *panel = child->getPanelByName(tabname); 1016 LLPanel *panel = child->getPanelByName(tabname);
@@ -1049,11 +1022,6 @@ void LLPanel::childSetTabChangeCallback(const LLString& id, const LLString& tabn
1049 } 1022 }
1050} 1023}
1051 1024
1052void LLPanel::childSetText(const LLString& id, const LLStringExplicit& text)
1053{
1054 childSetValue(id, LLSD(text));
1055}
1056
1057void LLPanel::childSetKeystrokeCallback(const LLString& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data) 1025void LLPanel::childSetKeystrokeCallback(const LLString& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data)
1058{ 1026{
1059 LLLineEditor* child = LLUICtrlFactory::getLineEditorByName(this, id); 1027 LLLineEditor* child = LLUICtrlFactory::getLineEditorByName(this, id);
@@ -1076,11 +1044,6 @@ void LLPanel::childSetPrevalidate(const LLString& id, BOOL (*func)(const LLWStri
1076 } 1044 }
1077} 1045}
1078 1046
1079LLString LLPanel::childGetText(const LLString& id)
1080{
1081 return childGetValue(id).asString();
1082}
1083
1084void LLPanel::childSetWrappedText(const LLString& id, const LLString& text, bool visible) 1047void LLPanel::childSetWrappedText(const LLString& id, const LLString& text, bool visible)
1085{ 1048{
1086 LLTextBox* child = (LLTextBox*)getCtrlByNameAndType(id, WIDGET_TYPE_TEXT_BOX); 1049 LLTextBox* child = (LLTextBox*)getCtrlByNameAndType(id, WIDGET_TYPE_TEXT_BOX);
@@ -1111,7 +1074,7 @@ void LLPanel::childSetActionTextbox(const LLString& id, void(*function)(void*))
1111 1074
1112void LLPanel::childSetControlName(const LLString& id, const LLString& control_name) 1075void LLPanel::childSetControlName(const LLString& id, const LLString& control_name)
1113{ 1076{
1114 LLView* view = getChildByName(id, TRUE); 1077 LLView* view = getChild<LLView>(id);
1115 if (view) 1078 if (view)
1116 { 1079 {
1117 view->setControlName(control_name, NULL); 1080 view->setControlName(control_name, NULL);
@@ -1161,7 +1124,7 @@ void LLPanel::storeRectControl()
1161{ 1124{
1162 if( !mRectControl.empty() ) 1125 if( !mRectControl.empty() )
1163 { 1126 {
1164 LLUI::sConfigGroup->setRect( mRectControl, mRect ); 1127 LLUI::sConfigGroup->setRect( mRectControl, getRect() );
1165 } 1128 }
1166} 1129}
1167 1130
@@ -1231,6 +1194,19 @@ LLLayoutStack::~LLLayoutStack()
1231 std::for_each(mPanels.begin(), mPanels.end(), DeletePointer()); 1194 std::for_each(mPanels.begin(), mPanels.end(), DeletePointer());
1232} 1195}
1233 1196
1197// virtual
1198EWidgetType LLLayoutStack::getWidgetType() const
1199{
1200 return WIDGET_TYPE_LAYOUT_STACK;
1201}
1202
1203// virtual
1204LLString LLLayoutStack::getWidgetTag() const
1205{
1206 return LL_LAYOUT_STACK_TAG;
1207}
1208
1209
1234void LLLayoutStack::draw() 1210void LLLayoutStack::draw()
1235{ 1211{
1236 updateLayout(); 1212 updateLayout();
@@ -1343,23 +1319,13 @@ LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor
1343 return layout_stackp; 1319 return layout_stackp;
1344} 1320}
1345 1321
1346S32 LLLayoutStack::getMinWidth()
1347{
1348 return mMinWidth;
1349}
1350
1351S32 LLLayoutStack::getMinHeight()
1352{
1353 return mMinHeight;
1354}
1355
1356S32 LLLayoutStack::getDefaultHeight(S32 cur_height) 1322S32 LLLayoutStack::getDefaultHeight(S32 cur_height)
1357{ 1323{
1358 // if we are spanning our children (crude upward propagation of size) 1324 // if we are spanning our children (crude upward propagation of size)
1359 // then don't enforce our size on our children 1325 // then don't enforce our size on our children
1360 if (mOrientation == HORIZONTAL) 1326 if (mOrientation == HORIZONTAL)
1361 { 1327 {
1362 cur_height = llmax(mMinHeight, mRect.getHeight()); 1328 cur_height = llmax(mMinHeight, getRect().getHeight());
1363 } 1329 }
1364 1330
1365 return cur_height; 1331 return cur_height;
@@ -1371,7 +1337,7 @@ S32 LLLayoutStack::getDefaultWidth(S32 cur_width)
1371 // then don't enforce our size on our children 1337 // then don't enforce our size on our children
1372 if (mOrientation == VERTICAL) 1338 if (mOrientation == VERTICAL)
1373 { 1339 {
1374 cur_width = llmax(mMinWidth, mRect.getWidth()); 1340 cur_width = llmax(mMinWidth, getRect().getWidth());
1375 } 1341 }
1376 1342
1377 return cur_width; 1343 return cur_width;
@@ -1497,15 +1463,15 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
1497 S32 pixels_to_distribute; 1463 S32 pixels_to_distribute;
1498 if (mOrientation == HORIZONTAL) 1464 if (mOrientation == HORIZONTAL)
1499 { 1465 {
1500 pixels_to_distribute = mRect.getWidth() - total_width; 1466 pixels_to_distribute = getRect().getWidth() - total_width;
1501 } 1467 }
1502 else //VERTICAL 1468 else //VERTICAL
1503 { 1469 {
1504 pixels_to_distribute = mRect.getHeight() - total_height; 1470 pixels_to_distribute = getRect().getHeight() - total_height;
1505 } 1471 }
1506 1472
1507 S32 cur_x = 0; 1473 S32 cur_x = 0;
1508 S32 cur_y = mRect.getHeight(); 1474 S32 cur_y = getRect().getHeight();
1509 1475
1510 for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) 1476 for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
1511 { 1477 {
@@ -1643,18 +1609,19 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
1643 if (force_resize == FALSE 1609 if (force_resize == FALSE
1644 // layout did not complete by reaching target position 1610 // layout did not complete by reaching target position
1645 && ((mOrientation == VERTICAL && cur_y != -mPanelSpacing) 1611 && ((mOrientation == VERTICAL && cur_y != -mPanelSpacing)
1646 || (mOrientation == HORIZONTAL && cur_x != mRect.getWidth() + mPanelSpacing))) 1612 || (mOrientation == HORIZONTAL && cur_x != getRect().getWidth() + mPanelSpacing)))
1647 { 1613 {
1648 // do another layout pass with all stacked elements contributing 1614 // do another layout pass with all stacked elements contributing
1649 // even those that don't usually resize 1615 // even those that don't usually resize
1650 llassert_always(force_resize == FALSE); 1616 llassert_always(force_resize == FALSE);
1651 updateLayout(TRUE); 1617 updateLayout(TRUE);
1652 } 1618 }
1653} 1619} // end LLLayoutStack::updateLayout
1654 1620
1655LLLayoutStack::LLEmbeddedPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) 1621
1622LLLayoutStack::LLEmbeddedPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const
1656{ 1623{
1657 e_panel_list_t::iterator panel_it; 1624 e_panel_list_t::const_iterator panel_it;
1658 for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) 1625 for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
1659 { 1626 {
1660 if ((*panel_it)->mPanel == panelp) 1627 if ((*panel_it)->mPanel == panelp)
diff --git a/linden/indra/llui/llpanel.h b/linden/indra/llui/llpanel.h
index aeba6d9..e0f48ca 100644
--- a/linden/indra/llui/llpanel.h
+++ b/linden/indra/llui/llpanel.h
@@ -33,10 +33,11 @@
33#ifndef LL_LLPANEL_H 33#ifndef LL_LLPANEL_H
34#define LL_LLPANEL_H 34#define LL_LLPANEL_H
35 35
36// Opaque view with a background and a border. Can contain LLUICtrls.
37 36
38#include "llcallbackmap.h" 37#include "llcallbackmap.h"
39#include "lluictrl.h" 38#include "lluictrl.h"
39#include "llbutton.h"
40#include "lllineeditor.h"
40#include "llviewborder.h" 41#include "llviewborder.h"
41#include "lluistring.h" 42#include "lluistring.h"
42#include "v4color.h" 43#include "v4color.h"
@@ -47,39 +48,26 @@ const S32 LLPANEL_BORDER_WIDTH = 1;
47const BOOL BORDER_YES = TRUE; 48const BOOL BORDER_YES = TRUE;
48const BOOL BORDER_NO = FALSE; 49const BOOL BORDER_NO = FALSE;
49 50
50class LLViewerImage; 51
51class LLUUID; 52struct LLAlertInfo
52class LLCheckBoxCtrl;
53class LLComboBox;
54class LLIconCtrl;
55class LLLineEditor;
56class LLRadioGroup;
57class LLScrollListCtrl;
58class LLSliderCtrl;
59class LLSpinCtrl;
60class LLTextBox;
61class LLTextEditor;
62
63class LLAlertInfo
64{ 53{
65public:
66 LLString mLabel; 54 LLString mLabel;
67 LLString::format_map_t mArgs; 55 LLString::format_map_t mArgs;
68 56
69 LLAlertInfo(LLString label, LLString::format_map_t args) 57 LLAlertInfo(LLString label, LLString::format_map_t args) : mLabel(label), mArgs(args) { }
70 : mLabel(label), mArgs(args) { } 58 LLAlertInfo(){}
71
72 LLAlertInfo() { }
73}; 59};
74 60
75class LLPanel : public LLUICtrl 61
62/*
63 * General purpose concrete view base class.
64 * Transparent or opaque,
65 * With or without border,
66 * Can contain LLUICtrls.
67 */
68class LLPanel : public LLUICtrl
76{ 69{
77public: 70public:
78 virtual EWidgetType getWidgetType() const;
79 virtual LLString getWidgetTag() const;
80
81 // defaults to TRUE
82 virtual BOOL isPanel();
83 71
84 // minimal constructor for data-driven initialization 72 // minimal constructor for data-driven initialization
85 LLPanel(); 73 LLPanel();
@@ -89,34 +77,46 @@ public:
89 LLPanel(const LLString& name, const LLRect& rect, BOOL bordered = TRUE); 77 LLPanel(const LLString& name, const LLRect& rect, BOOL bordered = TRUE);
90 78
91 // Position and size are saved to rect_control 79 // Position and size are saved to rect_control
92 LLPanel(const LLString& name, const LLString& rect_control, BOOL bordered = TRUE); 80 LLPanel(const LLString& name, const LLString& rect_control, BOOL bordered = TRUE);
81
82 /*virtual*/ ~LLPanel();
83
84 // LLView interface
85 /*virtual*/ EWidgetType getWidgetType() const;
86 /*virtual*/ LLString getWidgetTag() const;
87 /*virtual*/ BOOL isPanel() const;
88 /*virtual*/ void draw();
89 /*virtual*/ BOOL handleKey( KEY key, MASK mask, BOOL called_from_parent );
90 /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask, BOOL called_from_parent );
91 /*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
93 92
93 // From LLFocusableElement
94 /*virtual*/ void setFocus( BOOL b );
95
96 // New virtuals
97 virtual void refresh(); // called in setFocus()
98 virtual BOOL postBuild();
99 virtual void clearCtrls(); // overridden in LLPanelObject and LLPanelVolume
100
101 // Border controls
94 void addBorder( LLViewBorder::EBevel border_bevel = LLViewBorder::BEVEL_OUT, 102 void addBorder( LLViewBorder::EBevel border_bevel = LLViewBorder::BEVEL_OUT,
95 LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE, 103 LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE,
96 S32 border_thickness = LLPANEL_BORDER_WIDTH ); 104 S32 border_thickness = LLPANEL_BORDER_WIDTH );
97 105 void removeBorder();
98 void removeBorder(); 106 BOOL hasBorder() const { return mBorder != NULL; }
99 107 void setBorderVisible( BOOL b );
100 virtual ~LLPanel();
101 virtual void draw();
102 virtual void refresh(); // called in setFocus()
103 virtual void setFocus( BOOL b );
104 void setFocusRoot(BOOL b) { mIsFocusRoot = b; }
105 virtual BOOL handleKeyHere( KEY key, MASK mask, BOOL called_from_parent );
106 virtual BOOL handleKey( KEY key, MASK mask, BOOL called_from_parent );
107 virtual BOOL postBuild();
108 108
109 void requires(LLString name, EWidgetType type = WIDGET_TYPE_DONTCARE); 109 void requires(LLString name, EWidgetType type = WIDGET_TYPE_DONTCARE);
110 BOOL checkRequirements(); 110 BOOL checkRequirements() const;
111
112 static void alertXml(LLString label, LLString::format_map_t args = LLString::format_map_t());
113 static BOOL nextAlert(LLAlertInfo &alert);
114 111
115 void setBackgroundColor( const LLColor4& color ); 112 void setBackgroundColor( const LLColor4& color ) { mBgColorOpaque = color; }
116 LLColor4 getBackgroundColor(); 113 const LLColor4& getBackgroundColor() const { return mBgColorOpaque; }
117 void setTransparentColor(const LLColor4& color); 114 void setTransparentColor(const LLColor4& color) { mBgColorAlpha = color; }
115 const LLColor4& getTransparentColor() const { return mBgColorAlpha; }
118 void setBackgroundVisible( BOOL b ) { mBgVisible = b; } 116 void setBackgroundVisible( BOOL b ) { mBgVisible = b; }
117 BOOL isBackgroundVisible() const { return mBgVisible; }
119 void setBackgroundOpaque(BOOL b) { mBgOpaque = b; } 118 void setBackgroundOpaque(BOOL b) { mBgOpaque = b; }
119 BOOL isBackgroundOpaque() const { return mBgOpaque; }
120 void setDefaultBtn(LLButton* btn = NULL); 120 void setDefaultBtn(LLButton* btn = NULL);
121 void setDefaultBtn(const LLString& id); 121 void setDefaultBtn(const LLString& id);
122 void updateDefaultBtn(); 122 void updateDefaultBtn();
@@ -124,37 +124,28 @@ public:
124 LLString getLabel() const { return mLabel; } 124 LLString getLabel() const { return mLabel; }
125 125
126 void setRectControl(const LLString& rect_control) { mRectControl.assign(rect_control); } 126 void setRectControl(const LLString& rect_control) { mRectControl.assign(rect_control); }
127 const LLString& getRectControl() const { return mRectControl; }
127 void storeRectControl(); 128 void storeRectControl();
128
129 void setBorderVisible( BOOL b );
130 129
131 void setCtrlsEnabled(BOOL b); 130 void setCtrlsEnabled(BOOL b);
132 virtual void clearCtrls();
133
134 LLViewHandle getHandle() { return mViewHandle; }
135 131
136 S32 getLastTabGroup() { return mLastTabGroup; } 132 LLHandle<LLPanel> getHandle() const { return mPanelHandle; }
137 133
138 LLView* getCtrlByNameAndType(const LLString& name, EWidgetType type); 134 S32 getLastTabGroup() const { return mLastTabGroup; }
139 135
140 static LLPanel* getPanelByHandle(LLViewHandle handle); 136 LLUICtrl* getCtrlByNameAndType(const LLString& name, EWidgetType type) const;
141 137
142 virtual const LLCallbackMap::map_t& getFactoryMap() const { return mFactoryMap; } 138 const LLCallbackMap::map_t& getFactoryMap() const { return mFactoryMap; }
143 139
144 virtual LLXMLNodePtr getXML(bool save_children = true) const;
145 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
146 BOOL initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 140 BOOL initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
147 void initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory); 141 void initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory);
148 void setPanelParameters(LLXMLNodePtr node, LLView *parentp); 142 void setPanelParameters(LLXMLNodePtr node, LLView *parentp);
149 143
150 LLString getFormattedUIString(const LLString& name, const LLString::format_map_t& args = LLUIString::sNullArgs) const; 144 LLString getString(const LLString& name, const LLString::format_map_t& args = LLUIString::sNullArgs) const;
151 LLUIString getUIString(const LLString& name) const; 145 LLUIString getUIString(const LLString& name) const;
152 146
153 // ** Wrappers for setting child properties by name ** -TomY 147 // ** Wrappers for setting child properties by name ** -TomY
154 148
155 // Override to set not found list
156 virtual LLView* getChildByName(const LLString& name, BOOL recurse = FALSE) const;
157
158 // LLView 149 // LLView
159 void childSetVisible(const LLString& name, bool visible); 150 void childSetVisible(const LLString& name, bool visible);
160 void childShow(const LLString& name) { childSetVisible(name, true); } 151 void childShow(const LLString& name) { childSetVisible(name, true); }
@@ -183,9 +174,9 @@ public:
183 174
184 void childSetColor(const LLString& id, const LLColor4& color); 175 void childSetColor(const LLString& id, const LLColor4& color);
185 176
186 LLCtrlSelectionInterface* childGetSelectionInterface(const LLString& id); 177 LLCtrlSelectionInterface* childGetSelectionInterface(const LLString& id) const;
187 LLCtrlListInterface* childGetListInterface(const LLString& id); 178 LLCtrlListInterface* childGetListInterface(const LLString& id) const;
188 LLCtrlScrollInterface* childGetScrollInterface(const LLString& id); 179 LLCtrlScrollInterface* childGetScrollInterface(const LLString& id) const;
189 180
190 // This is the magic bullet for data-driven UI 181 // This is the magic bullet for data-driven UI
191 void childSetValue(const LLString& id, LLSD value); 182 void childSetValue(const LLString& id, LLSD value);
@@ -197,21 +188,21 @@ public:
197 BOOL childSetLabelArg(const LLString& id, const LLString& key, const LLStringExplicit& text); 188 BOOL childSetLabelArg(const LLString& id, const LLString& key, const LLStringExplicit& text);
198 BOOL childSetToolTipArg(const LLString& id, const LLString& key, const LLStringExplicit& text); 189 BOOL childSetToolTipArg(const LLString& id, const LLString& key, const LLStringExplicit& text);
199 190
200 // LLSlider / LLSpinCtrl 191 // LLSlider / LLMultiSlider / LLSpinCtrl
201 void childSetMinValue(const LLString& id, LLSD min_value); 192 void childSetMinValue(const LLString& id, LLSD min_value);
202 void childSetMaxValue(const LLString& id, LLSD max_value); 193 void childSetMaxValue(const LLString& id, LLSD max_value);
203 194
204 // LLTabContainer 195 // LLTabContainer
205 void childShowTab(const LLString& id, const LLString& tabname, bool visible = true); 196 void childShowTab(const LLString& id, const LLString& tabname, bool visible = true);
206 LLPanel *childGetVisibleTab(const LLString& id); 197 LLPanel *childGetVisibleTab(const LLString& id) const;
207 void childSetTabChangeCallback(const LLString& id, const LLString& tabname, void (*on_tab_clicked)(void*, bool), void *userdata); 198 void childSetTabChangeCallback(const LLString& id, const LLString& tabname, void (*on_tab_clicked)(void*, bool), void *userdata);
208 199
209 // LLTextBox 200 // LLTextBox
210 void childSetWrappedText(const LLString& id, const LLString& text, bool visible = true); 201 void childSetWrappedText(const LLString& id, const LLString& text, bool visible = true);
211 202
212 // LLTextBox/LLTextEditor/LLLineEditor 203 // LLTextBox/LLTextEditor/LLLineEditor
213 void childSetText(const LLString& id, const LLStringExplicit& text); 204 void childSetText(const LLString& id, const LLStringExplicit& text) { childSetValue(id, LLSD(text)); }
214 LLString childGetText(const LLString& id); 205 LLString childGetText(const LLString& id) const { return childGetValue(id).asString(); }
215 206
216 // LLLineEditor 207 // LLLineEditor
217 void childSetKeystrokeCallback(const LLString& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data); 208 void childSetKeystrokeCallback(const LLString& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data);
@@ -226,16 +217,23 @@ public:
226 void childNotFound(const LLString& id) const; 217 void childNotFound(const LLString& id) const;
227 void childDisplayNotFound(); 218 void childDisplayNotFound();
228 219
229 typedef std::queue<LLAlertInfo> alert_queue_t; 220 static void alertXml(LLString label, LLString::format_map_t args = LLString::format_map_t());
230 static alert_queue_t sAlertQueue; 221 static BOOL nextAlert(LLAlertInfo &alert);
222 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
223
224protected:
225 // Override to set not found list
226 LLButton* getDefaultButton() { return mDefaultBtn; }
227 LLCallbackMap::map_t mFactoryMap;
231 228
232 typedef std::map<LLString, LLUIString> ui_string_map_t; 229 // Override to set not found list:
230 virtual LLView* getChildByName(const LLString& name, BOOL recurse = FALSE) const;
233 231
234private: 232private:
235 // common constructor 233 // common construction logic
236 void init(); 234 void init();
237 235
238protected: 236 // From LLView
239 virtual void addCtrl( LLUICtrl* ctrl, S32 tab_group ); 237 virtual void addCtrl( LLUICtrl* ctrl, S32 tab_group );
240 virtual void addCtrlAtEnd( LLUICtrl* ctrl, S32 tab_group); 238 virtual void addCtrlAtEnd( LLUICtrl* ctrl, S32 tab_group);
241 239
@@ -252,18 +250,20 @@ protected:
252 BOOL mBgOpaque; 250 BOOL mBgOpaque;
253 LLViewBorder* mBorder; 251 LLViewBorder* mBorder;
254 LLButton* mDefaultBtn; 252 LLButton* mDefaultBtn;
255 LLCallbackMap::map_t mFactoryMap;
256 LLString mLabel; 253 LLString mLabel;
257 S32 mLastTabGroup; 254 S32 mLastTabGroup;
255 LLRootHandle<LLPanel> mPanelHandle;
258 256
257 typedef std::map<LLString, LLUIString> ui_string_map_t;
259 ui_string_map_t mUIStrings; 258 ui_string_map_t mUIStrings;
260 259
261 typedef std::map<LLString, EWidgetType> requirements_map_t; 260 typedef std::map<LLString, EWidgetType> requirements_map_t;
262 requirements_map_t mRequirements; 261 requirements_map_t mRequirements;
263 262
264 typedef std::map<LLViewHandle, LLPanel*> panel_map_t; 263 typedef std::queue<LLAlertInfo> alert_queue_t;
265 static panel_map_t sPanelMap; 264 static alert_queue_t sAlertQueue;
266}; 265}; // end class LLPanel
266
267 267
268class LLLayoutStack : public LLView 268class LLLayoutStack : public LLView
269{ 269{
@@ -281,37 +281,33 @@ public:
281 /*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const; 281 /*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
282 /*virtual*/ void removeCtrl(LLUICtrl* ctrl); 282 /*virtual*/ void removeCtrl(LLUICtrl* ctrl);
283 283
284 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_LAYOUT_STACK; } 284 virtual EWidgetType getWidgetType() const;
285 virtual LLString getWidgetTag() const { return LL_LAYOUT_STACK_TAG; } 285 virtual LLString getWidgetTag() const;
286 286
287 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 287 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
288 288
289 S32 getMinWidth(); 289 S32 getMinWidth() const { return mMinWidth; }
290 S32 getMinHeight(); 290 S32 getMinHeight() const { return mMinHeight; }
291 291
292 void addPanel(LLPanel* panel, S32 min_width, S32 min_height, BOOL auto_resize, BOOL user_resize, S32 index = S32_MAX); 292 void addPanel(LLPanel* panel, S32 min_width, S32 min_height, BOOL auto_resize, BOOL user_resize, S32 index = S32_MAX);
293 void removePanel(LLPanel* panel); 293 void removePanel(LLPanel* panel);
294 void updateLayout(BOOL force_resize = FALSE); 294 void updateLayout(BOOL force_resize = FALSE);
295 295
296protected: 296private:
297 struct LLEmbeddedPanel;
298
299 LLEmbeddedPanel* findEmbeddedPanel(LLPanel* panelp);
300 void calcMinExtents(); 297 void calcMinExtents();
301 S32 getMinStackSize();
302 S32 getCurStackSize();
303 S32 getDefaultHeight(S32 cur_height); 298 S32 getDefaultHeight(S32 cur_height);
304 S32 getDefaultWidth(S32 cur_width); 299 S32 getDefaultWidth(S32 cur_width);
305 300
306protected: 301 const eLayoutOrientation mOrientation;
307 eLayoutOrientation mOrientation;
308 302
303 struct LLEmbeddedPanel;
309 typedef std::vector<LLEmbeddedPanel*> e_panel_list_t; 304 typedef std::vector<LLEmbeddedPanel*> e_panel_list_t;
310 e_panel_list_t mPanels; 305 e_panel_list_t mPanels;
306 LLEmbeddedPanel* findEmbeddedPanel(LLPanel* panelp) const;
311 307
312 S32 mMinWidth; 308 S32 mMinWidth;
313 S32 mMinHeight; 309 S32 mMinHeight;
314 S32 mPanelSpacing; 310 S32 mPanelSpacing;
315}; 311}; // end class LLLayoutStack
316 312
317#endif 313#endif
diff --git a/linden/indra/llui/llradiogroup.cpp b/linden/indra/llui/llradiogroup.cpp
index dad1941..039fe81 100644
--- a/linden/indra/llui/llradiogroup.cpp
+++ b/linden/indra/llui/llradiogroup.cpp
@@ -29,9 +29,6 @@
29 * $/LicenseInfo$ 29 * $/LicenseInfo$
30 */ 30 */
31 31
32// An invisible view containing multiple mutually exclusive toggling
33// buttons (usually radio buttons). Automatically handles the mutex
34// condition by highlighting only one button at a time.
35 32
36#include "linden_common.h" 33#include "linden_common.h"
37 34
@@ -45,6 +42,7 @@
45#include "llui.h" 42#include "llui.h"
46#include "llfocusmgr.h" 43#include "llfocusmgr.h"
47 44
45
48LLRadioGroup::LLRadioGroup(const LLString& name, const LLRect& rect, 46LLRadioGroup::LLRadioGroup(const LLString& name, const LLRect& rect,
49 const LLString& control_name, 47 const LLString& control_name,
50 LLUICtrlCallback callback, 48 LLUICtrlCallback callback,
@@ -73,7 +71,7 @@ void LLRadioGroup::init(BOOL border)
73 if (border) 71 if (border)
74 { 72 {
75 addChild( new LLViewBorder( "radio group border", 73 addChild( new LLViewBorder( "radio group border",
76 LLRect(0, mRect.getHeight(), mRect.getWidth(), 0), 74 LLRect(0, getRect().getHeight(), getRect().getWidth(), 0),
77 LLViewBorder::BEVEL_NONE, 75 LLViewBorder::BEVEL_NONE,
78 LLViewBorder::STYLE_LINE, 76 LLViewBorder::STYLE_LINE,
79 1 ) ); 77 1 ) );
@@ -146,11 +144,6 @@ void LLRadioGroup::setIndexEnabled(S32 index, BOOL enabled)
146 } 144 }
147} 145}
148 146
149S32 LLRadioGroup::getSelectedIndex() const
150{
151 return mSelectedIndex;
152}
153
154BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event) 147BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event)
155{ 148{
156 if (index < 0 || index >= (S32)mRadioButtons.size()) 149 if (index < 0 || index >= (S32)mRadioButtons.size())
@@ -245,7 +238,9 @@ void LLRadioGroup::draw()
245 radio->setValue( selected ); 238 radio->setValue( selected );
246 if (take_focus && selected && !gFocusMgr.childHasKeyboardFocus(radio)) 239 if (take_focus && selected && !gFocusMgr.childHasKeyboardFocus(radio))
247 { 240 {
248 radio->focusFirstItem(); 241 // don't flash keyboard focus when navigating via keyboard
242 BOOL DONT_FLASH = FALSE;
243 radio->focusFirstItem(FALSE, DONT_FLASH);
249 } 244 }
250 current_button++; 245 current_button++;
251 } 246 }
@@ -450,12 +445,12 @@ BOOL LLRadioGroup::setCurrentByID( const LLUUID& id )
450 return FALSE; 445 return FALSE;
451} 446}
452 447
453LLUUID LLRadioGroup::getCurrentID() 448LLUUID LLRadioGroup::getCurrentID() const
454{ 449{
455 return LLUUID::null; 450 return LLUUID::null;
456} 451}
457 452
458BOOL LLRadioGroup::setSelectedByValue(LLSD value, BOOL selected) 453BOOL LLRadioGroup::setSelectedByValue(const LLSD& value, BOOL selected)
459{ 454{
460 S32 idx = 0; 455 S32 idx = 0;
461 std::string value_string = value.asString(); 456 std::string value_string = value.asString();
@@ -478,7 +473,7 @@ LLSD LLRadioGroup::getSelectedValue()
478 return getValue(); 473 return getValue();
479} 474}
480 475
481BOOL LLRadioGroup::isSelected(LLSD value) 476BOOL LLRadioGroup::isSelected(const LLSD& value) const
482{ 477{
483 S32 idx = 0; 478 S32 idx = 0;
484 std::string value_string = value.asString(); 479 std::string value_string = value.asString();
@@ -508,13 +503,6 @@ BOOL LLRadioGroup::operateOnAll(EOperation op)
508} 503}
509 504
510 505
511LLRadioCtrl::LLRadioCtrl(const LLString& name, const LLRect& rect, const LLString& label,
512 const LLFontGL* font, void (*commit_callback)(LLUICtrl*, void*), void* callback_userdata) :
513 LLCheckBoxCtrl(name, rect, label, font, commit_callback, callback_userdata, FALSE, RADIO_STYLE)
514{
515 setTabStop(FALSE);
516}
517
518LLRadioCtrl::~LLRadioCtrl() 506LLRadioCtrl::~LLRadioCtrl()
519{ 507{
520} 508}
diff --git a/linden/indra/llui/llradiogroup.h b/linden/indra/llui/llradiogroup.h
index aed8de2..87591a4 100644
--- a/linden/indra/llui/llradiogroup.h
+++ b/linden/indra/llui/llradiogroup.h
@@ -29,10 +29,6 @@
29 * $/LicenseInfo$ 29 * $/LicenseInfo$
30 */ 30 */
31 31
32// An invisible view containing multiple mutually exclusive toggling
33// buttons (usually radio buttons). Automatically handles the mutex
34// condition by highlighting only one button at a time.
35
36#ifndef LL_LLRADIOGROUP_H 32#ifndef LL_LLRADIOGROUP_H
37#define LL_LLRADIOGROUP_H 33#define LL_LLRADIOGROUP_H
38 34
@@ -40,21 +36,30 @@
40#include "llcheckboxctrl.h" 36#include "llcheckboxctrl.h"
41#include "llctrlselectioninterface.h" 37#include "llctrlselectioninterface.h"
42 38
43class LLFontGL;
44 39
45// Radio controls are checkbox controls with use_radio_style true 40/*
41 * A checkbox control with use_radio_style == true.
42 */
46class LLRadioCtrl : public LLCheckBoxCtrl 43class LLRadioCtrl : public LLCheckBoxCtrl
47{ 44{
48public: 45public:
49 LLRadioCtrl(const LLString& name, const LLRect& rect, const LLString& label, 46 LLRadioCtrl(const LLString& name, const LLRect& rect, const LLString& label, const LLFontGL* font = NULL,
50 const LLFontGL* font = NULL, 47 void (*commit_callback)(LLUICtrl*, void*) = NULL, void* callback_userdata = NULL) :
51 void (*commit_callback)(LLUICtrl*, void*) = NULL, 48 LLCheckBoxCtrl(name, rect, label, font, commit_callback, callback_userdata, FALSE, RADIO_STYLE)
52 void* callback_userdata = NULL); 49 {
50 setTabStop(FALSE);
51 }
53 /*virtual*/ ~LLRadioCtrl(); 52 /*virtual*/ ~LLRadioCtrl();
54 53
55 /*virtual*/ void setValue(const LLSD& value); 54 /*virtual*/ void setValue(const LLSD& value);
56}; 55};
57 56
57
58/*
59 * An invisible view containing multiple mutually exclusive toggling
60 * buttons (usually radio buttons). Automatically handles the mutex
61 * condition by highlighting only one button at a time.
62 */
58class LLRadioGroup 63class LLRadioGroup
59: public LLUICtrl, public LLCtrlSelectionInterface 64: public LLUICtrl, public LLCtrlSelectionInterface
60{ 65{
@@ -88,7 +93,7 @@ public:
88 void setIndexEnabled(S32 index, BOOL enabled); 93 void setIndexEnabled(S32 index, BOOL enabled);
89 94
90 // return the index value of the selected item 95 // return the index value of the selected item
91 S32 getSelectedIndex() const; 96 S32 getSelectedIndex() const { return mSelectedIndex; }
92 97
93 // set the index value programatically 98 // set the index value programatically
94 BOOL setSelectedIndex(S32 index, BOOL from_event = FALSE); 99 BOOL setSelectedIndex(S32 index, BOOL from_event = FALSE);
@@ -97,8 +102,7 @@ public:
97 virtual void setValue(const LLSD& value ); 102 virtual void setValue(const LLSD& value );
98 virtual LLSD getValue() const; 103 virtual LLSD getValue() const;
99 104
100 // Draw the group, but also fix the highlighting based on the 105 // Draw the group, but also fix the highlighting based on the control.
101 // control.
102 void draw(); 106 void draw();
103 107
104 // You must use this method to add buttons to a radio group. 108 // You must use this method to add buttons to a radio group.
@@ -106,8 +110,7 @@ public:
106 // correctly. 110 // correctly.
107 LLRadioCtrl* addRadioButton(const LLString& name, const LLString& label, const LLRect& rect, const LLFontGL* font); 111 LLRadioCtrl* addRadioButton(const LLString& name, const LLString& label, const LLRect& rect, const LLFontGL* font);
108 LLRadioCtrl* getRadioButton(const S32& index) { return mRadioButtons[index]; } 112 LLRadioCtrl* getRadioButton(const S32& index) { return mRadioButtons[index]; }
109 // Update the control as needed. Userdata must be a pointer to the 113 // Update the control as needed. Userdata must be a pointer to the button.
110 // button.
111 static void onClickButton(LLUICtrl* radio, void* userdata); 114 static void onClickButton(LLUICtrl* radio, void* userdata);
112 115
113 //======================================================================== 116 //========================================================================
@@ -121,14 +124,14 @@ public:
121 /*virtual*/ BOOL selectItemRange( S32 first, S32 last ) { return setSelectedIndex(first); } 124 /*virtual*/ BOOL selectItemRange( S32 first, S32 last ) { return setSelectedIndex(first); }
122 /*virtual*/ S32 getFirstSelectedIndex() const { return getSelectedIndex(); } 125 /*virtual*/ S32 getFirstSelectedIndex() const { return getSelectedIndex(); }
123 /*virtual*/ BOOL setCurrentByID( const LLUUID& id ); 126 /*virtual*/ BOOL setCurrentByID( const LLUUID& id );
124 /*virtual*/ LLUUID getCurrentID(); // LLUUID::null if no items in menu 127 /*virtual*/ LLUUID getCurrentID() const; // LLUUID::null if no items in menu
125 /*virtual*/ BOOL setSelectedByValue(LLSD value, BOOL selected); 128 /*virtual*/ BOOL setSelectedByValue(const LLSD& value, BOOL selected);
126 /*virtual*/ LLSD getSelectedValue(); 129 /*virtual*/ LLSD getSelectedValue();
127 /*virtual*/ BOOL isSelected(LLSD value); 130 /*virtual*/ BOOL isSelected(const LLSD& value) const;
128 /*virtual*/ BOOL operateOnSelection(EOperation op); 131 /*virtual*/ BOOL operateOnSelection(EOperation op);
129 /*virtual*/ BOOL operateOnAll(EOperation op); 132 /*virtual*/ BOOL operateOnAll(EOperation op);
130 133
131protected: 134private:
132 // protected function shared by the two constructors. 135 // protected function shared by the two constructors.
133 void init(BOOL border); 136 void init(BOOL border);
134 137
diff --git a/linden/indra/llui/llresizebar.cpp b/linden/indra/llui/llresizebar.cpp
index e6ce03b..b4933bd 100644
--- a/linden/indra/llui/llresizebar.cpp
+++ b/linden/indra/llui/llresizebar.cpp
@@ -33,8 +33,6 @@
33 33
34#include "llresizebar.h" 34#include "llresizebar.h"
35 35
36//#include "llviewermenu.h"
37//#include "llviewerimagelist.h"
38#include "llmath.h" 36#include "llmath.h"
39#include "llui.h" 37#include "llui.h"
40#include "llmenugl.h" 38#include "llmenugl.h"
@@ -87,7 +85,7 @@ LLResizeBar::LLResizeBar( const LLString& name, LLView* resizing_view, const LLR
87 85
88BOOL LLResizeBar::handleMouseDown(S32 x, S32 y, MASK mask) 86BOOL LLResizeBar::handleMouseDown(S32 x, S32 y, MASK mask)
89{ 87{
90 if( mEnabled ) 88 if( getEnabled() )
91 { 89 {
92 // Route future Mouse messages here preemptively. (Release on mouse up.) 90 // Route future Mouse messages here preemptively. (Release on mouse up.)
93 // No handler needed for focus lost since this clas has no state that depends on it. 91 // No handler needed for focus lost since this clas has no state that depends on it.
@@ -119,15 +117,6 @@ BOOL LLResizeBar::handleMouseUp(S32 x, S32 y, MASK mask)
119 return handled; 117 return handled;
120} 118}
121 119
122EWidgetType LLResizeBar::getWidgetType() const
123{
124 return WIDGET_TYPE_RESIZE_BAR;
125}
126
127LLString LLResizeBar::getWidgetTag() const
128{
129 return LL_RESIZE_BAR_TAG;
130}
131 120
132BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask) 121BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask)
133{ 122{
@@ -267,5 +256,34 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask)
267 } 256 }
268 257
269 return handled; 258 return handled;
259} // end LLResizeBar::handleHover
260
261BOOL LLResizeBar::handleDoubleClick(S32 x, S32 y, MASK mask)
262{
263 LLRect orig_rect = mResizingView->getRect();
264 LLRect scaled_rect = orig_rect;
265
266 if (mSnappingEnabled)
267 {
268 switch( mSide )
269 {
270 case LEFT:
271 mResizingView->findSnapEdge(scaled_rect.mLeft, LLCoordGL(0, 0), SNAP_LEFT, SNAP_PARENT_AND_SIBLINGS, S32_MAX);
272 break;
273 case TOP:
274 mResizingView->findSnapEdge(scaled_rect.mTop, LLCoordGL(0, 0), SNAP_TOP, SNAP_PARENT_AND_SIBLINGS, S32_MAX);
275 break;
276 case RIGHT:
277 mResizingView->findSnapEdge(scaled_rect.mRight, LLCoordGL(0, 0), SNAP_RIGHT, SNAP_PARENT_AND_SIBLINGS, S32_MAX);
278 break;
279 case BOTTOM:
280 mResizingView->findSnapEdge(scaled_rect.mBottom, LLCoordGL(0, 0), SNAP_BOTTOM, SNAP_PARENT_AND_SIBLINGS, S32_MAX);
281 break;
282 }
283 }
284
285 mResizingView->reshape(scaled_rect.getWidth(), scaled_rect.getHeight());
286 mResizingView->setOrigin(scaled_rect.mLeft, scaled_rect.mBottom);
287 return TRUE;
270} 288}
271 289
diff --git a/linden/indra/llui/llresizebar.h b/linden/indra/llui/llresizebar.h
index 11fca9d..5446811 100644
--- a/linden/indra/llui/llresizebar.h
+++ b/linden/indra/llui/llresizebar.h
@@ -42,18 +42,19 @@ public:
42 42
43 LLResizeBar(const LLString& name, LLView* resizing_view, const LLRect& rect, S32 min_size, S32 max_size, Side side ); 43 LLResizeBar(const LLString& name, LLView* resizing_view, const LLRect& rect, S32 min_size, S32 max_size, Side side );
44 44
45 virtual EWidgetType getWidgetType() const; 45 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_RESIZE_BAR; }
46 virtual LLString getWidgetTag() const; 46 virtual LLString getWidgetTag() const { return LL_RESIZE_BAR_TAG; }
47 47
48// virtual void draw(); No appearance 48// virtual void draw(); No appearance
49 virtual BOOL handleHover(S32 x, S32 y, MASK mask); 49 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
50 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); 50 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
51 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); 51 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
52 virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
52 53
53 void setResizeLimits( S32 min_size, S32 max_size ) { mMinSize = min_size; mMaxSize = max_size; } 54 void setResizeLimits( S32 min_size, S32 max_size ) { mMinSize = min_size; mMaxSize = max_size; }
54 void setEnableSnapping(BOOL enable) { mSnappingEnabled = enable; } 55 void setEnableSnapping(BOOL enable) { mSnappingEnabled = enable; }
55 56
56protected: 57private:
57 S32 mDragLastScreenX; 58 S32 mDragLastScreenX;
58 S32 mDragLastScreenY; 59 S32 mDragLastScreenY;
59 S32 mLastMouseScreenX; 60 S32 mLastMouseScreenX;
@@ -61,13 +62,11 @@ protected:
61 LLCoordGL mLastMouseDir; 62 LLCoordGL mLastMouseDir;
62 S32 mMinSize; 63 S32 mMinSize;
63 S32 mMaxSize; 64 S32 mMaxSize;
64 Side mSide; 65 const Side mSide;
65 BOOL mSnappingEnabled; 66 BOOL mSnappingEnabled;
66 LLView* mResizingView; 67 LLView* mResizingView;
67}; 68};
68 69
69const S32 RESIZE_BAR_HEIGHT = 3;
70
71#endif // LL_RESIZEBAR_H 70#endif // LL_RESIZEBAR_H
72 71
73 72
diff --git a/linden/indra/llui/llresizehandle.cpp b/linden/indra/llui/llresizehandle.cpp
index 739d583..d3e066b 100644
--- a/linden/indra/llui/llresizehandle.cpp
+++ b/linden/indra/llui/llresizehandle.cpp
@@ -75,23 +75,13 @@ LLResizeHandle::LLResizeHandle( const LLString& name, const LLRect& rect, S32 mi
75 setSaveToXML(FALSE); 75 setSaveToXML(FALSE);
76} 76}
77 77
78EWidgetType LLResizeHandle::getWidgetType() const
79{
80 return WIDGET_TYPE_RESIZE_HANDLE;
81}
82
83LLString LLResizeHandle::getWidgetTag() const
84{
85 return LL_RESIZE_HANDLE_TAG;
86}
87
88BOOL LLResizeHandle::handleMouseDown(S32 x, S32 y, MASK mask) 78BOOL LLResizeHandle::handleMouseDown(S32 x, S32 y, MASK mask)
89{ 79{
90 BOOL handled = FALSE; 80 BOOL handled = FALSE;
91 if( getVisible() && pointInHandle(x, y) ) 81 if( getVisible() && pointInHandle(x, y) )
92 { 82 {
93 handled = TRUE; 83 handled = TRUE;
94 if( mEnabled ) 84 if( getEnabled() )
95 { 85 {
96 // Route future Mouse messages here preemptively. (Release on mouse up.) 86 // Route future Mouse messages here preemptively. (Release on mouse up.)
97 // No handler needed for focus lost since this clas has no state that depends on it. 87 // No handler needed for focus lost since this clas has no state that depends on it.
@@ -292,10 +282,12 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask)
292 282
293 handled = TRUE; 283 handled = TRUE;
294 } 284 }
295 else 285 else // don't have mouse capture
296 if( getVisible() && pointInHandle( x, y ) )
297 { 286 {
298 handled = TRUE; 287 if( getVisible() && pointInHandle( x, y ) )
288 {
289 handled = TRUE;
290 }
299 } 291 }
300 292
301 if( handled ) 293 if( handled )
@@ -314,7 +306,8 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask)
314 } 306 }
315 307
316 return handled; 308 return handled;
317} 309} // end handleHover
310
318 311
319// assumes GL state is set for 2D 312// assumes GL state is set for 2D
320void LLResizeHandle::draw() 313void LLResizeHandle::draw()
@@ -330,8 +323,8 @@ BOOL LLResizeHandle::pointInHandle( S32 x, S32 y )
330{ 323{
331 if( pointInView(x, y) ) 324 if( pointInView(x, y) )
332 { 325 {
333 const S32 TOP_BORDER = (mRect.getHeight() - RESIZE_BORDER_WIDTH); 326 const S32 TOP_BORDER = (getRect().getHeight() - RESIZE_BORDER_WIDTH);
334 const S32 RIGHT_BORDER = (mRect.getWidth() - RESIZE_BORDER_WIDTH); 327 const S32 RIGHT_BORDER = (getRect().getWidth() - RESIZE_BORDER_WIDTH);
335 328
336 switch( mCorner ) 329 switch( mCorner )
337 { 330 {
diff --git a/linden/indra/llui/llresizehandle.h b/linden/indra/llui/llresizehandle.h
index 863ce70..77ebcb9 100644
--- a/linden/indra/llui/llresizehandle.h
+++ b/linden/indra/llui/llresizehandle.h
@@ -46,8 +46,8 @@ public:
46 46
47 LLResizeHandle(const LLString& name, const LLRect& rect, S32 min_width, S32 min_height, ECorner corner = RIGHT_BOTTOM ); 47 LLResizeHandle(const LLString& name, const LLRect& rect, S32 min_width, S32 min_height, ECorner corner = RIGHT_BOTTOM );
48 48
49 virtual EWidgetType getWidgetType() const; 49 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_RESIZE_HANDLE; }
50 virtual LLString getWidgetTag() const; 50 virtual LLString getWidgetTag() const { return LL_RESIZE_HANDLE_TAG; }
51 51
52 virtual void draw(); 52 virtual void draw();
53 virtual BOOL handleHover(S32 x, S32 y, MASK mask); 53 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
@@ -56,10 +56,9 @@ public:
56 56
57 void setResizeLimits( S32 min_width, S32 min_height ) { mMinWidth = min_width; mMinHeight = min_height; } 57 void setResizeLimits( S32 min_width, S32 min_height ) { mMinWidth = min_width; mMinHeight = min_height; }
58 58
59protected: 59private:
60 BOOL pointInHandle( S32 x, S32 y ); 60 BOOL pointInHandle( S32 x, S32 y );
61 61
62protected:
63 S32 mDragLastScreenX; 62 S32 mDragLastScreenX;
64 S32 mDragLastScreenY; 63 S32 mDragLastScreenY;
65 S32 mLastMouseScreenX; 64 S32 mLastMouseScreenX;
@@ -68,7 +67,7 @@ protected:
68 LLPointer<LLImageGL> mImage; 67 LLPointer<LLImageGL> mImage;
69 S32 mMinWidth; 68 S32 mMinWidth;
70 S32 mMinHeight; 69 S32 mMinHeight;
71 ECorner mCorner; 70 const ECorner mCorner;
72}; 71};
73 72
74const S32 RESIZE_HANDLE_HEIGHT = 16; 73const S32 RESIZE_HANDLE_HEIGHT = 16;
diff --git a/linden/indra/llui/llresmgr.h b/linden/indra/llui/llresmgr.h
index b851795..810d386 100644
--- a/linden/indra/llui/llresmgr.h
+++ b/linden/indra/llui/llresmgr.h
@@ -29,8 +29,6 @@
29 * $/LicenseInfo$ 29 * $/LicenseInfo$
30 */ 30 */
31 31
32// NOTE: this is a MINIMAL implementation. The interface will remain, but the implementation will
33// (when the time is right) become dynamic and probably use external files.
34 32
35#ifndef LL_LLRESMGR_H 33#ifndef LL_LLRESMGR_H
36#define LL_LLRESMGR_H 34#define LL_LLRESMGR_H
@@ -157,11 +155,10 @@ public:
157 LLLocale(const LLString& locale_string); 155 LLLocale(const LLString& locale_string);
158 virtual ~LLLocale(); 156 virtual ~LLLocale();
159 157
160public:
161 static const LLString USER_LOCALE; 158 static const LLString USER_LOCALE;
162 static const LLString SYSTEM_LOCALE; 159 static const LLString SYSTEM_LOCALE;
163 160
164protected: 161private:
165 LLString mPrevLocaleString; 162 LLString mPrevLocaleString;
166}; 163};
167 164
diff --git a/linden/indra/llui/llrootview.cpp b/linden/indra/llui/llrootview.cpp
index 1580f99..cea9ded 100644
--- a/linden/indra/llui/llrootview.cpp
+++ b/linden/indra/llui/llrootview.cpp
@@ -36,14 +36,4 @@ LLRootView::LLRootView(const LLString& name, const LLRect& rect, BOOL mouse_opaq
36: LLView(name,rect,mouse_opaque,follows) 36: LLView(name,rect,mouse_opaque,follows)
37{ } 37{ }
38 38
39// virtual 39// pretty exciting file, eh?
40EWidgetType LLRootView::getWidgetType() const
41{
42 return WIDGET_TYPE_ROOT_VIEW;
43}
44
45// virtual
46LLString LLRootView::getWidgetTag() const
47{
48 return LL_ROOT_VIEW_TAG;
49}
diff --git a/linden/indra/llui/llrootview.h b/linden/indra/llui/llrootview.h
index 13037f0..5f130b9 100644
--- a/linden/indra/llui/llrootview.h
+++ b/linden/indra/llui/llrootview.h
@@ -39,8 +39,8 @@ class LLRootView : public LLView
39public: 39public:
40 LLRootView(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows=FOLLOWS_NONE); 40 LLRootView(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows=FOLLOWS_NONE);
41 41
42 /*virtual*/ EWidgetType getWidgetType() const; 42 /*virtual*/ EWidgetType getWidgetType() const { return WIDGET_TYPE_ROOT_VIEW; }
43 /*virtual*/ LLString getWidgetTag() const; 43 /*virtual*/ LLString getWidgetTag() const { return LL_ROOT_VIEW_TAG; }
44}; 44};
45 45
46#endif 46#endif
diff --git a/linden/indra/llui/llscrollbar.cpp b/linden/indra/llui/llscrollbar.cpp
index ec46551..cf64742 100644
--- a/linden/indra/llui/llscrollbar.cpp
+++ b/linden/indra/llui/llscrollbar.cpp
@@ -46,6 +46,7 @@
46#include "llwindow.h" 46#include "llwindow.h"
47#include "llglheaders.h" 47#include "llglheaders.h"
48#include "llcontrol.h" 48#include "llcontrol.h"
49#include "llglimmediate.h"
49 50
50LLScrollbar::LLScrollbar( 51LLScrollbar::LLScrollbar(
51 const LLString& name, LLRect rect, 52 const LLString& name, LLRect rect,
@@ -92,7 +93,7 @@ LLScrollbar::LLScrollbar(
92 93
93 if( LLScrollbar::VERTICAL == mOrientation ) 94 if( LLScrollbar::VERTICAL == mOrientation )
94 { 95 {
95 line_up_rect.setLeftTopAndSize( 0, mRect.getHeight(), SCROLLBAR_SIZE, SCROLLBAR_SIZE ); 96 line_up_rect.setLeftTopAndSize( 0, getRect().getHeight(), SCROLLBAR_SIZE, SCROLLBAR_SIZE );
96 line_up_img="UIImgBtnScrollUpOutUUID"; 97 line_up_img="UIImgBtnScrollUpOutUUID";
97 line_up_selected_img="UIImgBtnScrollUpInUUID"; 98 line_up_selected_img="UIImgBtnScrollUpInUUID";
98 99
@@ -107,7 +108,7 @@ LLScrollbar::LLScrollbar(
107 line_up_img="UIImgBtnScrollLeftOutUUID"; 108 line_up_img="UIImgBtnScrollLeftOutUUID";
108 line_up_selected_img="UIImgBtnScrollLeftInUUID"; 109 line_up_selected_img="UIImgBtnScrollLeftInUUID";
109 110
110 line_down_rect.setOriginAndSize( mRect.getWidth() - SCROLLBAR_SIZE, 0, SCROLLBAR_SIZE, SCROLLBAR_SIZE ); 111 line_down_rect.setOriginAndSize( getRect().getWidth() - SCROLLBAR_SIZE, 0, SCROLLBAR_SIZE, SCROLLBAR_SIZE );
111 line_down_img="UIImgBtnScrollRightOutUUID"; 112 line_down_img="UIImgBtnScrollRightOutUUID";
112 line_down_selected_img="UIImgBtnScrollRightInUUID"; 113 line_down_selected_img="UIImgBtnScrollRightInUUID";
113 } 114 }
@@ -210,7 +211,7 @@ void LLScrollbar::updateThumbRect()
210 211
211 const S32 THUMB_MIN_LENGTH = 16; 212 const S32 THUMB_MIN_LENGTH = 16;
212 213
213 S32 window_length = (mOrientation == LLScrollbar::HORIZONTAL) ? mRect.getWidth() : mRect.getHeight(); 214 S32 window_length = (mOrientation == LLScrollbar::HORIZONTAL) ? getRect().getWidth() : getRect().getHeight();
214 S32 thumb_bg_length = window_length - 2 * SCROLLBAR_SIZE; 215 S32 thumb_bg_length = window_length - 2 * SCROLLBAR_SIZE;
215 S32 visible_lines = llmin( mDocSize, mPageSize ); 216 S32 visible_lines = llmin( mDocSize, mPageSize );
216 S32 thumb_length = mDocSize ? llmax( visible_lines * thumb_bg_length / mDocSize, THUMB_MIN_LENGTH ) : thumb_bg_length; 217 S32 thumb_length = mDocSize ? llmax( visible_lines * thumb_bg_length / mDocSize, THUMB_MIN_LENGTH ) : thumb_bg_length;
@@ -300,8 +301,8 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask)
300 BOOL handled = FALSE; 301 BOOL handled = FALSE;
301 if( hasMouseCapture() ) 302 if( hasMouseCapture() )
302 { 303 {
303 S32 height = mRect.getHeight(); 304 S32 height = getRect().getHeight();
304 S32 width = mRect.getWidth(); 305 S32 width = getRect().getWidth();
305 306
306 if( VERTICAL == mOrientation ) 307 if( VERTICAL == mOrientation )
307 { 308 {
@@ -408,13 +409,13 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask)
408 409
409 mDocChanged = FALSE; 410 mDocChanged = FALSE;
410 return handled; 411 return handled;
411} 412} // end handleHover
412 413
413 414
414BOOL LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks) 415BOOL LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks)
415{ 416{
416 BOOL handled = FALSE; 417 BOOL handled = FALSE;
417 if( getVisible() && mRect.localPointInRect( x, y ) ) 418 if( getVisible() && getRect().localPointInRect( x, y ) )
418 { 419 {
419 if( getEnabled() ) 420 if( getEnabled() )
420 { 421 {
@@ -427,7 +428,7 @@ BOOL LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks)
427} 428}
428 429
429BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, 430BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
430 EDragAndDropType cargo_type, void *carge_data, EAcceptance *accept, LLString &tooltip_msg) 431 EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, LLString &tooltip_msg)
431{ 432{
432 // enable this to get drag and drop to control scrollbars 433 // enable this to get drag and drop to control scrollbars
433 //if (!drop) 434 //if (!drop)
@@ -436,7 +437,7 @@ BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
436 // S32 variable_lines = getDocPosMax(); 437 // S32 variable_lines = getDocPosMax();
437 // S32 pos = (VERTICAL == mOrientation) ? y : x; 438 // S32 pos = (VERTICAL == mOrientation) ? y : x;
438 // S32 thumb_length = (VERTICAL == mOrientation) ? mThumbRect.getHeight() : mThumbRect.getWidth(); 439 // S32 thumb_length = (VERTICAL == mOrientation) ? mThumbRect.getHeight() : mThumbRect.getWidth();
439 // S32 thumb_track_length = (VERTICAL == mOrientation) ? (mRect.getHeight() - 2 * SCROLLBAR_SIZE) : (mRect.getWidth() - 2 * SCROLLBAR_SIZE); 440 // S32 thumb_track_length = (VERTICAL == mOrientation) ? (getRect().getHeight() - 2 * SCROLLBAR_SIZE) : (getRect().getWidth() - 2 * SCROLLBAR_SIZE);
440 // S32 usable_track_length = thumb_track_length - thumb_length; 441 // S32 usable_track_length = thumb_track_length - thumb_length;
441 // F32 ratio = (VERTICAL == mOrientation) ? F32(pos - SCROLLBAR_SIZE - thumb_length) / usable_track_length 442 // F32 ratio = (VERTICAL == mOrientation) ? F32(pos - SCROLLBAR_SIZE - thumb_length) / usable_track_length
442 // : F32(pos - SCROLLBAR_SIZE) / usable_track_length; 443 // : F32(pos - SCROLLBAR_SIZE) / usable_track_length;
@@ -485,7 +486,7 @@ void LLScrollbar::draw()
485 486
486 screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, &local_mouse_x, &local_mouse_y); 487 screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, &local_mouse_x, &local_mouse_y);
487 BOOL other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this; 488 BOOL other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this;
488 BOOL hovered = mEnabled && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y)); 489 BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y));
489 if (hovered) 490 if (hovered)
490 { 491 {
491 mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f)); 492 mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f));
@@ -504,8 +505,8 @@ void LLScrollbar::draw()
504 if (!rounded_rect_imagep) 505 if (!rounded_rect_imagep)
505 { 506 {
506 gl_rect_2d(mOrientation == HORIZONTAL ? SCROLLBAR_SIZE : 0, 507 gl_rect_2d(mOrientation == HORIZONTAL ? SCROLLBAR_SIZE : 0,
507 mOrientation == VERTICAL ? mRect.getHeight() - 2 * SCROLLBAR_SIZE : mRect.getHeight(), 508 mOrientation == VERTICAL ? getRect().getHeight() - 2 * SCROLLBAR_SIZE : getRect().getHeight(),
508 mOrientation == HORIZONTAL ? mRect.getWidth() - 2 * SCROLLBAR_SIZE : mRect.getWidth(), 509 mOrientation == HORIZONTAL ? getRect().getWidth() - 2 * SCROLLBAR_SIZE : getRect().getWidth(),
509 mOrientation == VERTICAL ? SCROLLBAR_SIZE : 0, mTrackColor, TRUE); 510 mOrientation == VERTICAL ? SCROLLBAR_SIZE : 0, mTrackColor, TRUE);
510 511
511 gl_rect_2d(mThumbRect, mThumbColor, TRUE); 512 gl_rect_2d(mThumbRect, mThumbColor, TRUE);
@@ -518,8 +519,8 @@ void LLScrollbar::draw()
518 mOrientation == VERTICAL ? SCROLLBAR_SIZE : 0, 519 mOrientation == VERTICAL ? SCROLLBAR_SIZE : 0,
519 16, 520 16,
520 16, 521 16,
521 mOrientation == HORIZONTAL ? mRect.getWidth() - 2 * SCROLLBAR_SIZE : mRect.getWidth(), 522 mOrientation == HORIZONTAL ? getRect().getWidth() - 2 * SCROLLBAR_SIZE : getRect().getWidth(),
522 mOrientation == VERTICAL ? mRect.getHeight() - 2 * SCROLLBAR_SIZE : mRect.getHeight(), 523 mOrientation == VERTICAL ? getRect().getHeight() - 2 * SCROLLBAR_SIZE : getRect().getHeight(),
523 rounded_rect_imagep, 524 rounded_rect_imagep,
524 mTrackColor, 525 mTrackColor,
525 TRUE); 526 TRUE);
@@ -538,10 +539,10 @@ void LLScrollbar::draw()
538 rounded_rect_imagep, mThumbColor ); 539 rounded_rect_imagep, mThumbColor );
539 if (mCurGlowStrength > 0.01f) 540 if (mCurGlowStrength > 0.01f)
540 { 541 {
541 glBlendFunc(GL_SRC_ALPHA, GL_ONE); 542 gGL.blendFunc(GL_SRC_ALPHA, GL_ONE);
542 gl_draw_scaled_image_with_border(mThumbRect.mLeft, mThumbRect.mBottom, 16, 16, mThumbRect.getWidth(), mThumbRect.getHeight(), 543 gl_draw_scaled_image_with_border(mThumbRect.mLeft, mThumbRect.mBottom, 16, 16, mThumbRect.getWidth(), mThumbRect.getHeight(),
543 rounded_rect_imagep, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength), TRUE); 544 rounded_rect_imagep, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength), TRUE);
544 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 545 gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
545 } 546 }
546 } 547 }
547 548
@@ -553,7 +554,8 @@ void LLScrollbar::draw()
553 // Draw children 554 // Draw children
554 LLView::draw(); 555 LLView::draw();
555 } 556 }
556} 557} // end draw
558
557 559
558void LLScrollbar::changeLine( S32 delta, BOOL update_thumb ) 560void LLScrollbar::changeLine( S32 delta, BOOL update_thumb )
559{ 561{
@@ -579,21 +581,12 @@ void LLScrollbar::setValue(const LLSD& value)
579 setDocPos((S32) value.asInteger()); 581 setDocPos((S32) value.asInteger());
580} 582}
581 583
582EWidgetType LLScrollbar::getWidgetType() const
583{
584 return WIDGET_TYPE_SCROLLBAR;
585}
586
587LLString LLScrollbar::getWidgetTag() const
588{
589 return LL_SCROLLBAR_TAG;
590}
591 584
592BOOL LLScrollbar::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) 585BOOL LLScrollbar::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
593{ 586{
594 BOOL handled = FALSE; 587 BOOL handled = FALSE;
595 588
596 if( getVisible() && mEnabled && !called_from_parent ) 589 if( getVisible() && getEnabled() && !called_from_parent )
597 { 590 {
598 switch( key ) 591 switch( key )
599 { 592 {
@@ -661,3 +654,4 @@ void LLScrollbar::onLineDownBtnPressed( void* userdata )
661 self->changeLine( self->mStepSize, TRUE ); 654 self->changeLine( self->mStepSize, TRUE );
662} 655}
663 656
657
diff --git a/linden/indra/llui/llscrollbar.h b/linden/indra/llui/llscrollbar.h
index 464c9c1..b4586c3 100644
--- a/linden/indra/llui/llscrollbar.h
+++ b/linden/indra/llui/llscrollbar.h
@@ -61,8 +61,9 @@ public:
61 virtual ~LLScrollbar(); 61 virtual ~LLScrollbar();
62 62
63 virtual void setValue(const LLSD& value); 63 virtual void setValue(const LLSD& value);
64 virtual EWidgetType getWidgetType() const; 64
65 virtual LLString getWidgetTag() const; 65 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SCROLLBAR; }
66 virtual LLString getWidgetTag() const { return LL_SCROLLBAR_TAG; }
66 67
67 // Overrides from LLView 68 // Overrides from LLView
68 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); 69 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
@@ -71,32 +72,33 @@ public:
71 virtual BOOL handleHover(S32 x, S32 y, MASK mask); 72 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
72 virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); 73 virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
73 virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, 74 virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
74 EDragAndDropType cargo_type, void *carge_data, EAcceptance *accept, LLString &tooltip_msg); 75 EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, LLString &tooltip_msg);
75 76
76 virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); 77 virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
77 78
78 virtual void draw(); 79 virtual void draw();
79 80
80 void setDocParams( S32 size, S32 pos );
81
82 // How long the "document" is. 81 // How long the "document" is.
83 void setDocSize( S32 size ); 82 void setDocSize( S32 size );
84 S32 getDocSize() { return mDocSize; } 83 S32 getDocSize() const { return mDocSize; }
85 84
86 // How many "lines" the "document" has scrolled. 85 // How many "lines" the "document" has scrolled.
87 // 0 <= DocPos <= DocSize - DocVisibile 86 // 0 <= DocPos <= DocSize - DocVisibile
88 void setDocPos( S32 pos ); 87 void setDocPos( S32 pos );
89 S32 getDocPos() { return mDocPos; } 88 S32 getDocPos() const { return mDocPos; }
90 89
91 BOOL isAtBeginning(); 90 BOOL isAtBeginning();
92 BOOL isAtEnd(); 91 BOOL isAtEnd();
93 92
93 // Setting both at once.
94 void setDocParams( S32 size, S32 pos );
95
94 // How many "lines" of the "document" is can appear on a page. 96 // How many "lines" of the "document" is can appear on a page.
95 void setPageSize( S32 page_size ); 97 void setPageSize( S32 page_size );
96 S32 getPageSize() { return mPageSize; } 98 S32 getPageSize() const { return mPageSize; }
97 99
98 // The farthest the document can be scrolled (top of the last page). 100 // The farthest the document can be scrolled (top of the last page).
99 S32 getDocPosMax() { return llmax( 0, mDocSize - mPageSize); } 101 S32 getDocPosMax() const { return llmax( 0, mDocSize - mPageSize); }
100 102
101 void pageUp(S32 overlap); 103 void pageUp(S32 overlap);
102 void pageDown(S32 overlap); 104 void pageDown(S32 overlap);
@@ -110,15 +112,15 @@ public:
110 void setShadowColor( const LLColor4& color ) { mShadowColor = color; } 112 void setShadowColor( const LLColor4& color ) { mShadowColor = color; }
111 113
112 void setOnScrollEndCallback(void (*callback)(void*), void* userdata) { mOnScrollEndCallback = callback; mOnScrollEndData = userdata;} 114 void setOnScrollEndCallback(void (*callback)(void*), void* userdata) { mOnScrollEndCallback = callback; mOnScrollEndData = userdata;}
113protected: 115
116private:
114 void updateThumbRect(); 117 void updateThumbRect();
115 void changeLine(S32 delta, BOOL update_thumb ); 118 void changeLine(S32 delta, BOOL update_thumb );
116 119
117protected:
118 void (*mChangeCallback)( S32 new_pos, LLScrollbar* self, void* userdata ); 120 void (*mChangeCallback)( S32 new_pos, LLScrollbar* self, void* userdata );
119 void* mCallbackUserData; 121 void* mCallbackUserData;
120 122
121 ORIENTATION mOrientation; 123 const ORIENTATION mOrientation;
122 S32 mDocSize; // Size of the document that the scrollbar is modeling. Units depend on the user. 0 <= mDocSize. 124 S32 mDocSize; // Size of the document that the scrollbar is modeling. Units depend on the user. 0 <= mDocSize.
123 S32 mDocPos; // Position within the doc that the scrollbar is modeling, in "lines" (user size) 125 S32 mDocPos; // Position within the doc that the scrollbar is modeling, in "lines" (user size)
124 S32 mPageSize; // Maximum number of lines that can be seen at one time. 126 S32 mPageSize; // Maximum number of lines that can be seen at one time.
diff --git a/linden/indra/llui/llscrollcontainer.cpp b/linden/indra/llui/llscrollcontainer.cpp
index 8c8b40c..15b59d4 100644
--- a/linden/indra/llui/llscrollcontainer.cpp
+++ b/linden/indra/llui/llscrollcontainer.cpp
@@ -29,18 +29,11 @@
29 * $/LicenseInfo$ 29 * $/LicenseInfo$
30 */ 30 */
31 31
32//*****************************************************************************
33//
34// A view meant to encapsulate a clipped region which is
35// scrollable. It automatically takes care of pixel perfect scrolling
36// and cliipping, as well as turning the scrollbars on or off based on
37// the width and height of the view you're scrolling.
38//
39//*****************************************************************************
40 32
41#include "linden_common.h" 33#include "linden_common.h"
42 34
43#include "llgl.h" 35#include "llgl.h"
36#include "llglimmediate.h"
44 37
45#include "llscrollcontainer.h" 38#include "llscrollcontainer.h"
46#include "llscrollbar.h" 39#include "llscrollbar.h"
@@ -112,11 +105,11 @@ LLScrollableContainerView::LLScrollableContainerView( const LLString& name, cons
112 105
113void LLScrollableContainerView::init() 106void LLScrollableContainerView::init()
114{ 107{
115 LLRect border_rect( 0, mRect.getHeight(), mRect.getWidth(), 0 ); 108 LLRect border_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 );
116 mBorder = new LLViewBorder( "scroll border", border_rect, LLViewBorder::BEVEL_IN ); 109 mBorder = new LLViewBorder( "scroll border", border_rect, LLViewBorder::BEVEL_IN );
117 addChild( mBorder ); 110 addChild( mBorder );
118 111
119 mInnerRect.set( 0, mRect.getHeight(), mRect.getWidth(), 0 ); 112 mInnerRect.set( 0, getRect().getHeight(), getRect().getWidth(), 0 );
120 mInnerRect.stretch( -mBorder->getBorderWidth() ); 113 mInnerRect.stretch( -mBorder->getBorderWidth() );
121 114
122 LLRect vertical_scroll_rect = mInnerRect; 115 LLRect vertical_scroll_rect = mInnerRect;
@@ -165,25 +158,6 @@ LLScrollableContainerView::~LLScrollableContainerView( void )
165 mScrolledView = NULL; 158 mScrolledView = NULL;
166} 159}
167 160
168/*
169// scrollbar handlers
170void LLScrollableContainerView::horizontalChange( S32 new_pos,
171 LLScrollbar* sb,
172 void* user_data )
173{
174 LLScrollableContainerView* cont = reinterpret_cast<LLScrollableContainerView*>(user_data);
175// cont->scrollHorizontal( new_pos );
176}
177
178
179void LLScrollableContainerView::verticalChange( S32 new_pos, LLScrollbar* sb,
180 void* user_data )
181{
182 LLScrollableContainerView* cont = reinterpret_cast<LLScrollableContainerView*>(user_data);
183// cont->scrollVertical( new_pos );
184}
185*/
186
187// internal scrollbar handlers 161// internal scrollbar handlers
188// virtual 162// virtual
189void LLScrollableContainerView::scrollHorizontal( S32 new_pos ) 163void LLScrollableContainerView::scrollHorizontal( S32 new_pos )
@@ -215,7 +189,7 @@ void LLScrollableContainerView::reshape(S32 width, S32 height,
215{ 189{
216 LLUICtrl::reshape( width, height, called_from_parent ); 190 LLUICtrl::reshape( width, height, called_from_parent );
217 191
218 mInnerRect.set( 0, mRect.getHeight(), mRect.getWidth(), 0 ); 192 mInnerRect.set( 0, getRect().getHeight(), getRect().getWidth(), 0 );
219 mInnerRect.stretch( -mBorder->getBorderWidth() ); 193 mInnerRect.stretch( -mBorder->getBorderWidth() );
220 194
221 if (mScrolledView) 195 if (mScrolledView)
@@ -238,7 +212,7 @@ void LLScrollableContainerView::reshape(S32 width, S32 height,
238 212
239BOOL LLScrollableContainerView::handleKey( KEY key, MASK mask, BOOL called_from_parent ) 213BOOL LLScrollableContainerView::handleKey( KEY key, MASK mask, BOOL called_from_parent )
240{ 214{
241 if( getVisible() && mEnabled ) 215 if( getVisible() && getEnabled() )
242 { 216 {
243 if( called_from_parent ) 217 if( called_from_parent )
244 { 218 {
@@ -278,7 +252,7 @@ BOOL LLScrollableContainerView::handleKey( KEY key, MASK mask, BOOL called_from_
278 252
279BOOL LLScrollableContainerView::handleScrollWheel( S32 x, S32 y, S32 clicks ) 253BOOL LLScrollableContainerView::handleScrollWheel( S32 x, S32 y, S32 clicks )
280{ 254{
281 if( mEnabled ) 255 if( getEnabled() )
282 { 256 {
283 for( S32 i = 0; i < SCROLLBAR_COUNT; i++ ) 257 for( S32 i = 0; i < SCROLLBAR_COUNT; i++ )
284 { 258 {
@@ -295,7 +269,8 @@ BOOL LLScrollableContainerView::handleScrollWheel( S32 x, S32 y, S32 clicks )
295 // Opaque 269 // Opaque
296 return TRUE; 270 return TRUE;
297} 271}
298BOOL LLScrollableContainerView::needsToScroll(S32 x, S32 y, LLScrollableContainerView::SCROLL_ORIENTATION axis) 272
273BOOL LLScrollableContainerView::needsToScroll(S32 x, S32 y, LLScrollableContainerView::SCROLL_ORIENTATION axis) const
299{ 274{
300 if(mScrollbar[axis]->getVisible()) 275 if(mScrollbar[axis]->getVisible())
301 { 276 {
@@ -315,6 +290,7 @@ BOOL LLScrollableContainerView::needsToScroll(S32 x, S32 y, LLScrollableContaine
315 } 290 }
316 return FALSE; 291 return FALSE;
317} 292}
293
318BOOL LLScrollableContainerView::handleDragAndDrop(S32 x, S32 y, MASK mask, 294BOOL LLScrollableContainerView::handleDragAndDrop(S32 x, S32 y, MASK mask,
319 BOOL drop, 295 BOOL drop,
320 EDragAndDropType cargo_type, 296 EDragAndDropType cargo_type,
@@ -419,19 +395,19 @@ BOOL LLScrollableContainerView::handleToolTip(S32 x, S32 y, LLString& msg, LLRec
419 return TRUE; 395 return TRUE;
420} 396}
421 397
422void LLScrollableContainerView::calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) 398void LLScrollableContainerView::calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const
423{ 399{
424 const LLRect& rect = mScrolledView->getRect(); 400 const LLRect& rect = mScrolledView->getRect();
425 calcVisibleSize(rect, visible_width, visible_height, show_h_scrollbar, show_v_scrollbar); 401 calcVisibleSize(rect, visible_width, visible_height, show_h_scrollbar, show_v_scrollbar);
426} 402}
427 403
428void LLScrollableContainerView::calcVisibleSize( const LLRect& doc_rect, S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) 404void LLScrollableContainerView::calcVisibleSize( const LLRect& doc_rect, S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const
429{ 405{
430 S32 doc_width = doc_rect.getWidth(); 406 S32 doc_width = doc_rect.getWidth();
431 S32 doc_height = doc_rect.getHeight(); 407 S32 doc_height = doc_rect.getHeight();
432 408
433 *visible_width = mRect.getWidth() - 2 * mBorder->getBorderWidth(); 409 *visible_width = getRect().getWidth() - 2 * mBorder->getBorderWidth();
434 *visible_height = mRect.getHeight() - 2 * mBorder->getBorderWidth(); 410 *visible_height = getRect().getHeight() - 2 * mBorder->getBorderWidth();
435 411
436 *show_v_scrollbar = FALSE; 412 *show_v_scrollbar = FALSE;
437 if( *visible_height < doc_height ) 413 if( *visible_height < doc_height )
@@ -484,7 +460,7 @@ void LLScrollableContainerView::draw()
484 if( mIsOpaque ) 460 if( mIsOpaque )
485 { 461 {
486 LLGLSNoTexture no_texture; 462 LLGLSNoTexture no_texture;
487 glColor4fv( mBackgroundColor.mV ); 463 gGL.color4fv( mBackgroundColor.mV );
488 gl_rect_2d( mInnerRect ); 464 gl_rect_2d( mInnerRect );
489 } 465 }
490 466
@@ -544,7 +520,7 @@ void LLScrollableContainerView::draw()
544 drawDebugRect(); 520 drawDebugRect();
545 } 521 }
546 } 522 }
547} 523} // end draw
548 524
549void LLScrollableContainerView::updateScroll() 525void LLScrollableContainerView::updateScroll()
550{ 526{
@@ -560,9 +536,9 @@ void LLScrollableContainerView::updateScroll()
560 S32 border_width = mBorder->getBorderWidth(); 536 S32 border_width = mBorder->getBorderWidth();
561 if( show_v_scrollbar ) 537 if( show_v_scrollbar )
562 { 538 {
563 if( doc_rect.mTop < mRect.getHeight() - border_width ) 539 if( doc_rect.mTop < getRect().getHeight() - border_width )
564 { 540 {
565 mScrolledView->translate( 0, mRect.getHeight() - border_width - doc_rect.mTop ); 541 mScrolledView->translate( 0, getRect().getHeight() - border_width - doc_rect.mTop );
566 } 542 }
567 543
568 scrollVertical( mScrollbar[VERTICAL]->getDocPos() ); 544 scrollVertical( mScrollbar[VERTICAL]->getDocPos() );
@@ -587,7 +563,7 @@ void LLScrollableContainerView::updateScroll()
587 } 563 }
588 else 564 else
589 { 565 {
590 mScrolledView->translate( 0, mRect.getHeight() - border_width - doc_rect.mTop ); 566 mScrolledView->translate( 0, getRect().getHeight() - border_width - doc_rect.mTop );
591 567
592 mScrollbar[VERTICAL]->setVisible( FALSE ); 568 mScrollbar[VERTICAL]->setVisible( FALSE );
593 mScrollbar[VERTICAL]->setDocPos( 0 ); 569 mScrollbar[VERTICAL]->setDocPos( 0 );
@@ -626,7 +602,7 @@ void LLScrollableContainerView::updateScroll()
626 602
627 mScrollbar[VERTICAL]->setDocSize( doc_height ); 603 mScrollbar[VERTICAL]->setDocSize( doc_height );
628 mScrollbar[VERTICAL]->setPageSize( visible_height ); 604 mScrollbar[VERTICAL]->setPageSize( visible_height );
629} 605} // end updateScroll
630 606
631void LLScrollableContainerView::setBorderVisible(BOOL b) 607void LLScrollableContainerView::setBorderVisible(BOOL b)
632{ 608{
@@ -723,7 +699,7 @@ void LLScrollableContainerView::goToBottom()
723 mScrollbar[VERTICAL]->setDocPos(mScrollbar[VERTICAL]->getDocSize()); 699 mScrollbar[VERTICAL]->setDocPos(mScrollbar[VERTICAL]->getDocSize());
724} 700}
725 701
726S32 LLScrollableContainerView::getBorderWidth() 702S32 LLScrollableContainerView::getBorderWidth() const
727{ 703{
728 if (mBorder) 704 if (mBorder)
729 { 705 {
@@ -803,7 +779,3 @@ LLView* LLScrollableContainerView::fromXML(LLXMLNodePtr node, LLView *parent, LL
803 779
804 return ret; 780 return ret;
805} 781}
806
807///----------------------------------------------------------------------------
808/// Local function definitions
809///----------------------------------------------------------------------------
diff --git a/linden/indra/llui/llscrollcontainer.h b/linden/indra/llui/llscrollcontainer.h
index fb7198c..d512957 100644
--- a/linden/indra/llui/llscrollcontainer.h
+++ b/linden/indra/llui/llscrollcontainer.h
@@ -40,21 +40,18 @@
40#include "llcoord.h" 40#include "llcoord.h"
41#include "llscrollbar.h" 41#include "llscrollbar.h"
42 42
43//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44// Class LLScrollableContainerView
45//
46// A view meant to encapsulate a clipped region which is
47// scrollable. It automatically takes care of pixel perfect scrolling
48// and cliipping, as well as turning the scrollbars on or off based on
49// the width and height of the view you're scrolling.
50//
51// This class is a decorator class.
52//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53 43
54class LLViewBorder; 44class LLViewBorder;
55class LLUICtrlFactory; 45class LLUICtrlFactory;
56 46
57 47/*****************************************************************************
48 *
49 * A decorator view class meant to encapsulate a clipped region which is
50 * scrollable. It automatically takes care of pixel perfect scrolling
51 * and cliipping, as well as turning the scrollbars on or off based on
52 * the width and height of the view you're scrolling.
53 *
54 *****************************************************************************/
58class LLScrollableContainerView : public LLUICtrl 55class LLScrollableContainerView : public LLUICtrl
59{ 56{
60public: 57public:
@@ -70,32 +67,26 @@ public:
70 const LLColor4& bg_color = LLColor4(0,0,0,0) ); 67 const LLColor4& bg_color = LLColor4(0,0,0,0) );
71 virtual ~LLScrollableContainerView( void ); 68 virtual ~LLScrollableContainerView( void );
72 69
73 void init();
74
75 void setScrolledView(LLView* view) { mScrolledView = view; } 70 void setScrolledView(LLView* view) { mScrolledView = view; }
76 71
77 virtual void setValue(const LLSD& value) { mInnerRect.setValue(value); } 72 virtual void setValue(const LLSD& value) { mInnerRect.setValue(value); }
78 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SCROLL_CONTAINER; } 73 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SCROLL_CONTAINER; }
79 virtual LLString getWidgetTag() const { return LL_SCROLLABLE_CONTAINER_VIEW_TAG; } 74 virtual LLString getWidgetTag() const { return LL_SCROLLABLE_CONTAINER_VIEW_TAG; }
80 75
81 // scrollbar handlers 76 void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const;
82 static void horizontalChange( S32 new_pos, LLScrollbar* sb, void* user_data ); 77 void calcVisibleSize( const LLRect& doc_rect, S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const;
83 static void verticalChange( S32 new_pos, LLScrollbar* sb, void* user_data );
84
85 void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar );
86 void calcVisibleSize( const LLRect& doc_rect, S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar );
87 void setBorderVisible( BOOL b ); 78 void setBorderVisible( BOOL b );
88 79
89 void scrollToShowRect( const LLRect& rect, const LLCoordGL& desired_offset ); 80 void scrollToShowRect( const LLRect& rect, const LLCoordGL& desired_offset );
90 void setReserveScrollCorner( BOOL b ) { mReserveScrollCorner = b; } 81 void setReserveScrollCorner( BOOL b ) { mReserveScrollCorner = b; }
91 const LLRect& getScrolledViewRect() { return mScrolledView->getRect(); } 82 const LLRect& getScrolledViewRect() const { return mScrolledView->getRect(); }
92 void pageUp(S32 overlap = 0); 83 void pageUp(S32 overlap = 0);
93 void pageDown(S32 overlap = 0); 84 void pageDown(S32 overlap = 0);
94 void goToTop(); 85 void goToTop();
95 void goToBottom(); 86 void goToBottom();
96 S32 getBorderWidth(); 87 S32 getBorderWidth() const;
97 88
98 BOOL needsToScroll(S32 x, S32 y, SCROLL_ORIENTATION axis); 89 BOOL needsToScroll(S32 x, S32 y, SCROLL_ORIENTATION axis) const;
99 90
100 // LLView functionality 91 // LLView functionality
101 virtual void reshape(S32 width, S32 height, BOOL called_from_parent); 92 virtual void reshape(S32 width, S32 height, BOOL called_from_parent);
@@ -113,7 +104,9 @@ public:
113 virtual LLXMLNodePtr getXML(bool save_children = true) const; 104 virtual LLXMLNodePtr getXML(bool save_children = true) const;
114 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 105 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
115 106
116protected: 107private:
108 void init();
109
117 // internal scrollbar handlers 110 // internal scrollbar handlers
118 virtual void scrollHorizontal( S32 new_pos ); 111 virtual void scrollHorizontal( S32 new_pos );
119 virtual void scrollVertical( S32 new_pos ); 112 virtual void scrollVertical( S32 new_pos );
diff --git a/linden/indra/llui/llscrollingpanellist.cpp b/linden/indra/llui/llscrollingpanellist.cpp
index a9d538e..8f85bc8 100644
--- a/linden/indra/llui/llscrollingpanellist.cpp
+++ b/linden/indra/llui/llscrollingpanellist.cpp
@@ -126,20 +126,6 @@ void LLScrollingPanelList::updatePanelVisiblilty()
126 } 126 }
127} 127}
128 128
129void LLScrollingPanelList::setValue(const LLSD& value)
130{
131
132}
133
134EWidgetType LLScrollingPanelList::getWidgetType() const
135{
136 return WIDGET_TYPE_SCROLLING_PANEL_LIST;
137}
138
139LLString LLScrollingPanelList::getWidgetTag() const
140{
141 return LL_SCROLLING_PANEL_LIST_TAG;
142}
143 129
144void LLScrollingPanelList::draw() 130void LLScrollingPanelList::draw()
145{ 131{
@@ -165,9 +151,3 @@ LLView* LLScrollingPanelList::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtr
165 return scrolling_panel_list; 151 return scrolling_panel_list;
166} 152}
167 153
168// virtual
169LLXMLNodePtr LLScrollingPanelList::getXML(bool save_children) const
170{
171 LLXMLNodePtr node = LLUICtrl::getXML();
172 return node;
173}
diff --git a/linden/indra/llui/llscrollingpanellist.h b/linden/indra/llui/llscrollingpanellist.h
index 84dc7f9..6fe35cd 100644
--- a/linden/indra/llui/llscrollingpanellist.h
+++ b/linden/indra/llui/llscrollingpanellist.h
@@ -35,30 +35,31 @@
35#include "llview.h" 35#include "llview.h"
36#include "llpanel.h" 36#include "llpanel.h"
37 37
38// virtual class for scrolling panels 38/*
39 * Pure virtual class represents a scrolling panel.
40 */
39class LLScrollingPanel : public LLPanel 41class LLScrollingPanel : public LLPanel
40{ 42{
41public: 43public:
42 LLScrollingPanel(const LLString& name, const LLRect& rect) 44 LLScrollingPanel(const LLString& name, const LLRect& rect) : LLPanel(name, rect) { }
43 : LLPanel(name, rect)
44 {
45 }
46 virtual void updatePanel(BOOL allow_modify) = 0; 45 virtual void updatePanel(BOOL allow_modify) = 0;
47
48}; 46};
49 47
50// A set of panels that are displayed in a vertical sequence inside a scroll container. 48
49/*
50 * A set of panels that are displayed in a vertical sequence inside a scroll container.
51 */
51class LLScrollingPanelList : public LLUICtrl 52class LLScrollingPanelList : public LLUICtrl
52{ 53{
53public: 54public:
54 LLScrollingPanelList(const LLString& name, const LLRect& rect) 55 LLScrollingPanelList(const LLString& name, const LLRect& rect)
55 : LLUICtrl(name, rect, TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_BOTTOM ) {} 56 : LLUICtrl(name, rect, TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_BOTTOM ) {}
56 57
57 virtual void setValue(const LLSD& value); 58 virtual void setValue(const LLSD& value) {};
58 virtual EWidgetType getWidgetType() const; 59 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SCROLLING_PANEL_LIST; }
59 virtual LLString getWidgetTag() const; 60 virtual LLString getWidgetTag() const { return LL_SCROLLING_PANEL_LIST_TAG; }
60 61
61 virtual LLXMLNodePtr getXML(bool save_children) const; 62 virtual LLXMLNodePtr getXML(bool save_children) const { return LLUICtrl::getXML(); }
62 63
63 virtual void draw(); 64 virtual void draw();
64 65
@@ -68,9 +69,8 @@ public:
68 69
69 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 70 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
70 71
71protected: 72private:
72 void updatePanelVisiblilty(); 73 void updatePanelVisiblilty();
73 74
74protected:
75 std::deque<LLScrollingPanel*> mPanelList; 75 std::deque<LLScrollingPanel*> mPanelList;
76}; 76};
diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp
index 043caa9..eee2bcf 100644
--- a/linden/indra/llui/llscrolllistctrl.cpp
+++ b/linden/indra/llui/llscrolllistctrl.cpp
@@ -1,4 +1,4 @@
1/** 1 /**
2 * @file llscrolllistctrl.cpp 2 * @file llscrolllistctrl.cpp
3 * @brief LLScrollListCtrl base class 3 * @brief LLScrollListCtrl base class
4 * 4 *
@@ -43,6 +43,7 @@
43#include "llclipboard.h" 43#include "llclipboard.h"
44#include "llfocusmgr.h" 44#include "llfocusmgr.h"
45#include "llgl.h" 45#include "llgl.h"
46#include "llglimmediate.h"
46#include "llglheaders.h" 47#include "llglheaders.h"
47#include "llresmgr.h" 48#include "llresmgr.h"
48#include "llscrollbar.h" 49#include "llscrollbar.h"
@@ -126,7 +127,7 @@ LLScrollListIcon::~LLScrollListIcon()
126{ 127{
127} 128}
128 129
129void LLScrollListIcon::setValue(LLSD value) 130void LLScrollListIcon::setValue(const LLSD& value)
130{ 131{
131 mImageUUID = value.asUUID(); 132 mImageUUID = value.asUUID();
132 // don't use default image specified by LLUUID::null, use no image in that case 133 // don't use default image specified by LLUUID::null, use no image in that case
@@ -142,11 +143,11 @@ void LLScrollListIcon::setColor(const LLColor4& color)
142S32 LLScrollListIcon::getWidth() const 143S32 LLScrollListIcon::getWidth() const
143{ 144{
144 // if no specified fix width, use width of icon 145 // if no specified fix width, use width of icon
145 if (mWidth == 0) 146 if (LLScrollListCell::getWidth() == 0)
146 { 147 {
147 return mIcon->getWidth(); 148 return mIcon->getWidth();
148 } 149 }
149 return mWidth; 150 return LLScrollListCell::getWidth();
150} 151}
151 152
152 153
@@ -170,11 +171,11 @@ LLScrollListCheck::LLScrollListCheck(LLCheckBoxCtrl* check_box, S32 width)
170 171
171 rect.mRight = rect.mLeft + width; 172 rect.mRight = rect.mLeft + width;
172 mCheckBox->setRect(rect); 173 mCheckBox->setRect(rect);
173 mWidth = width; 174 setWidth(width);
174 } 175 }
175 else 176 else
176 { 177 {
177 mWidth = rect.getWidth(); //check_box->getWidth(); 178 setWidth(rect.getWidth()); //check_box->getWidth();
178 } 179 }
179} 180}
180 181
@@ -259,6 +260,12 @@ void LLScrollListText::setText(const LLStringExplicit& text)
259 mText = text; 260 mText = text;
260} 261}
261 262
263//virtual
264void LLScrollListText::setValue(const LLSD& text)
265{
266 setText(text.asString());
267}
268
262void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_color) const 269void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_color) const
263{ 270{
264 LLColor4 display_color; 271 LLColor4 display_color;
@@ -274,7 +281,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
274 if (mHighlightCount > 0) 281 if (mHighlightCount > 0)
275 { 282 {
276 mRoundedRectImage->bind(); 283 mRoundedRectImage->bind();
277 glColor4fv(highlight_color.mV); 284 gGL.color4fv(highlight_color.mV);
278 S32 left = 0; 285 S32 left = 0;
279 switch(mFontAlignment) 286 switch(mFontAlignment)
280 { 287 {
@@ -361,7 +368,7 @@ void LLScrollListItem::setColumn( S32 column, LLScrollListCell *cell )
361 } 368 }
362} 369}
363 370
364LLString LLScrollListItem::getContentsCSV() 371LLString LLScrollListItem::getContentsCSV() const
365{ 372{
366 LLString ret; 373 LLString ret;
367 374
@@ -386,7 +393,7 @@ void LLScrollListItem::draw(const LLRect& rect, const LLColor4& fg_color, const
386 bg_rect.stretch(LIST_BORDER_PAD, 0); 393 bg_rect.stretch(LIST_BORDER_PAD, 0);
387 { 394 {
388 LLGLSNoTexture no_texture; 395 LLGLSNoTexture no_texture;
389 glColor4fv(bg_color.mV); 396 gGL.color4fv(bg_color.mV);
390 gl_rect_2d( bg_rect ); 397 gl_rect_2d( bg_rect );
391 } 398 }
392 399
@@ -536,8 +543,8 @@ LLScrollListCtrl::LLScrollListCtrl(const LLString& name, const LLRect& rect,
536 mItemListRect.setOriginAndSize( 543 mItemListRect.setOriginAndSize(
537 mBorderThickness + LIST_BORDER_PAD, 544 mBorderThickness + LIST_BORDER_PAD,
538 mBorderThickness + LIST_BORDER_PAD, 545 mBorderThickness + LIST_BORDER_PAD,
539 mRect.getWidth() - 2*( mBorderThickness + LIST_BORDER_PAD ), 546 getRect().getWidth() - 2*( mBorderThickness + LIST_BORDER_PAD ),
540 mRect.getHeight() - 2*( mBorderThickness + LIST_BORDER_PAD ) ); 547 getRect().getHeight() - 2*( mBorderThickness + LIST_BORDER_PAD ) );
541 548
542 updateLineHeight(); 549 updateLineHeight();
543 550
@@ -546,7 +553,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLString& name, const LLRect& rect,
546 // Init the scrollbar 553 // Init the scrollbar
547 LLRect scroll_rect; 554 LLRect scroll_rect;
548 scroll_rect.setOriginAndSize( 555 scroll_rect.setOriginAndSize(
549 mRect.getWidth() - mBorderThickness - SCROLLBAR_SIZE, 556 getRect().getWidth() - mBorderThickness - SCROLLBAR_SIZE,
550 mItemListRect.mBottom, 557 mItemListRect.mBottom,
551 SCROLLBAR_SIZE, 558 SCROLLBAR_SIZE,
552 mItemListRect.getHeight()); 559 mItemListRect.getHeight());
@@ -567,7 +574,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLString& name, const LLRect& rect,
567 // Border 574 // Border
568 if (show_border) 575 if (show_border)
569 { 576 {
570 LLRect border_rect( 0, mRect.getHeight(), mRect.getWidth(), 0 ); 577 LLRect border_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 );
571 mBorder = new LLViewBorder( "dlg border", border_rect, LLViewBorder::BEVEL_IN, LLViewBorder::STYLE_LINE, 1 ); 578 mBorder = new LLViewBorder( "dlg border", border_rect, LLViewBorder::BEVEL_IN, LLViewBorder::STYLE_LINE, 1 );
572 addChild(mBorder); 579 addChild(mBorder);
573 } 580 }
@@ -733,8 +740,8 @@ void LLScrollListCtrl::updateLayout()
733 mItemListRect.setOriginAndSize( 740 mItemListRect.setOriginAndSize(
734 mBorderThickness + LIST_BORDER_PAD, 741 mBorderThickness + LIST_BORDER_PAD,
735 mBorderThickness + LIST_BORDER_PAD, 742 mBorderThickness + LIST_BORDER_PAD,
736 mRect.getWidth() - 2*( mBorderThickness + LIST_BORDER_PAD ), 743 getRect().getWidth() - 2*( mBorderThickness + LIST_BORDER_PAD ),
737 mRect.getHeight() - 2*( mBorderThickness + LIST_BORDER_PAD ) - heading_size ); 744 getRect().getHeight() - 2*( mBorderThickness + LIST_BORDER_PAD ) - heading_size );
738 745
739 // how many lines of content in a single "page" 746 // how many lines of content in a single "page"
740 mPageLines = mLineHeight? mItemListRect.getHeight() / mLineHeight : 0; 747 mPageLines = mLineHeight? mItemListRect.getHeight() / mLineHeight : 0;
@@ -742,7 +749,7 @@ void LLScrollListCtrl::updateLayout()
742 if (scrollbar_visible) 749 if (scrollbar_visible)
743 { 750 {
744 // provide space on the right for scrollbar 751 // provide space on the right for scrollbar
745 mItemListRect.mRight = mRect.getWidth() - ( mBorderThickness + LIST_BORDER_PAD ) - SCROLLBAR_SIZE; 752 mItemListRect.mRight = getRect().getWidth() - ( mBorderThickness + LIST_BORDER_PAD ) - SCROLLBAR_SIZE;
746 } 753 }
747 754
748 mScrollbar->reshape(SCROLLBAR_SIZE, mItemListRect.getHeight() + (mDisplayColumnHeaders ? mHeadingHeight : 0)); 755 mScrollbar->reshape(SCROLLBAR_SIZE, mItemListRect.getHeight() + (mDisplayColumnHeaders ? mHeadingHeight : 0));
@@ -758,7 +765,7 @@ void LLScrollListCtrl::updateLayout()
758void LLScrollListCtrl::fitContents(S32 max_width, S32 max_height) 765void LLScrollListCtrl::fitContents(S32 max_width, S32 max_height)
759{ 766{
760 S32 height = llmin( getRequiredRect().getHeight(), max_height ); 767 S32 height = llmin( getRequiredRect().getHeight(), max_height );
761 S32 width = mRect.getWidth(); 768 S32 width = getRect().getWidth();
762 769
763 reshape( width, height ); 770 reshape( width, height );
764} 771}
@@ -770,7 +777,7 @@ LLRect LLScrollListCtrl::getRequiredRect()
770 S32 height = (mLineHeight * getItemCount()) 777 S32 height = (mLineHeight * getItemCount())
771 + (2 * ( mBorderThickness + LIST_BORDER_PAD )) 778 + (2 * ( mBorderThickness + LIST_BORDER_PAD ))
772 + heading_size; 779 + heading_size;
773 S32 width = mRect.getWidth(); 780 S32 width = getRect().getWidth();
774 781
775 return LLRect(0, height, width, 0); 782 return LLRect(0, height, width, 0);
776} 783}
@@ -1206,10 +1213,10 @@ S32 LLScrollListCtrl::selectMultiple( LLDynamicArray<LLUUID> ids )
1206 return count; 1213 return count;
1207} 1214}
1208 1215
1209S32 LLScrollListCtrl::getItemIndex( LLScrollListItem* target_item ) 1216S32 LLScrollListCtrl::getItemIndex( LLScrollListItem* target_item ) const
1210{ 1217{
1211 S32 index = 0; 1218 S32 index = 0;
1212 item_list::iterator iter; 1219 item_list::const_iterator iter;
1213 for (iter = mItemList.begin(); iter != mItemList.end(); iter++) 1220 for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
1214 { 1221 {
1215 LLScrollListItem *itemp = *iter; 1222 LLScrollListItem *itemp = *iter;
@@ -1222,10 +1229,10 @@ S32 LLScrollListCtrl::getItemIndex( LLScrollListItem* target_item )
1222 return -1; 1229 return -1;
1223} 1230}
1224 1231
1225S32 LLScrollListCtrl::getItemIndex( const LLUUID& target_id ) 1232S32 LLScrollListCtrl::getItemIndex( const LLUUID& target_id ) const
1226{ 1233{
1227 S32 index = 0; 1234 S32 index = 0;
1228 item_list::iterator iter; 1235 item_list::const_iterator iter;
1229 for (iter = mItemList.begin(); iter != mItemList.end(); iter++) 1236 for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
1230 { 1237 {
1231 LLScrollListItem *itemp = *iter; 1238 LLScrollListItem *itemp = *iter;
@@ -1366,6 +1373,8 @@ LLScrollListItem* LLScrollListCtrl::addSeparator(EAddPosition pos)
1366// Returns false if item not found. 1373// Returns false if item not found.
1367BOOL LLScrollListCtrl::selectItemByLabel(const LLString& label, BOOL case_sensitive) 1374BOOL LLScrollListCtrl::selectItemByLabel(const LLString& label, BOOL case_sensitive)
1368{ 1375{
1376 // ensure that no stale items are selected, even if we don't find a match
1377 deselectAllItems(TRUE);
1369 //RN: assume no empty items 1378 //RN: assume no empty items
1370 if (label.empty()) 1379 if (label.empty())
1371 { 1380 {
@@ -1525,7 +1534,7 @@ BOOL LLScrollListCtrl::selectByID( const LLUUID& id )
1525 return selectByValue( LLSD(id) ); 1534 return selectByValue( LLSD(id) );
1526} 1535}
1527 1536
1528BOOL LLScrollListCtrl::setSelectedByValue(LLSD value, BOOL selected) 1537BOOL LLScrollListCtrl::setSelectedByValue(const LLSD& value, BOOL selected)
1529{ 1538{
1530 BOOL found = FALSE; 1539 BOOL found = FALSE;
1531 1540
@@ -1558,9 +1567,9 @@ BOOL LLScrollListCtrl::setSelectedByValue(LLSD value, BOOL selected)
1558 return found; 1567 return found;
1559} 1568}
1560 1569
1561BOOL LLScrollListCtrl::isSelected(LLSD value) 1570BOOL LLScrollListCtrl::isSelected(const LLSD& value) const
1562{ 1571{
1563 item_list::iterator iter; 1572 item_list::const_iterator iter;
1564 for (iter = mItemList.begin(); iter != mItemList.end(); iter++) 1573 for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
1565 { 1574 {
1566 LLScrollListItem* item = *iter; 1575 LLScrollListItem* item = *iter;
@@ -1572,7 +1581,7 @@ BOOL LLScrollListCtrl::isSelected(LLSD value)
1572 return FALSE; 1581 return FALSE;
1573} 1582}
1574 1583
1575LLUUID LLScrollListCtrl::getStringUUIDSelectedItem() 1584LLUUID LLScrollListCtrl::getStringUUIDSelectedItem() const
1576{ 1585{
1577 LLScrollListItem* item = getFirstSelected(); 1586 LLScrollListItem* item = getFirstSelected();
1578 1587
@@ -1698,12 +1707,12 @@ void LLScrollListCtrl::draw()
1698 scrollToShowSelected(); 1707 scrollToShowSelected();
1699 mNeedsScroll = FALSE; 1708 mNeedsScroll = FALSE;
1700 } 1709 }
1701 LLRect background(0, mRect.getHeight(), mRect.getWidth(), 0); 1710 LLRect background(0, getRect().getHeight(), getRect().getWidth(), 0);
1702 // Draw background 1711 // Draw background
1703 if (mBackgroundVisible) 1712 if (mBackgroundVisible)
1704 { 1713 {
1705 LLGLSNoTexture no_texture; 1714 LLGLSNoTexture no_texture;
1706 glColor4fv( getEnabled() ? mBgWriteableColor.mV : mBgReadOnlyColor.mV ); 1715 gGL.color4fv( getEnabled() ? mBgWriteableColor.mV : mBgReadOnlyColor.mV );
1707 gl_rect_2d(background); 1716 gl_rect_2d(background);
1708 } 1717 }
1709 1718
@@ -1753,10 +1762,9 @@ BOOL LLScrollListCtrl::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky
1753 { 1762 {
1754 LLScrollListCell* hit_cell = hit_item->getColumn(column_index); 1763 LLScrollListCell* hit_cell = hit_item->getColumn(column_index);
1755 if (!hit_cell) return FALSE; 1764 if (!hit_cell) return FALSE;
1756 S32 cell_required_width = hit_cell->getContentWidth(); 1765 //S32 cell_required_width = hit_cell->getContentWidth();
1757 if (hit_cell 1766 if (hit_cell
1758 && hit_cell->isText() 1767 && hit_cell->isText())
1759 && cell_required_width > columnp->mWidth)
1760 { 1768 {
1761 1769
1762 S32 rect_left = getColumnOffsetFromIndex(column_index) + mItemListRect.mLeft; 1770 S32 rect_left = getColumnOffsetFromIndex(column_index) + mItemListRect.mLeft;
@@ -1772,8 +1780,8 @@ BOOL LLScrollListCtrl::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky
1772 &(sticky_rect_screen->mRight), &(sticky_rect_screen->mTop) ); 1780 &(sticky_rect_screen->mRight), &(sticky_rect_screen->mTop) );
1773 1781
1774 msg = hit_cell->getValue().asString(); 1782 msg = hit_cell->getValue().asString();
1775 handled = TRUE;
1776 } 1783 }
1784 handled = TRUE;
1777 } 1785 }
1778 1786
1779 // otherwise, look for a tooltip associated with this column 1787 // otherwise, look for a tooltip associated with this column
@@ -2441,16 +2449,6 @@ void LLScrollListCtrl::commitIfChanged()
2441 } 2449 }
2442} 2450}
2443 2451
2444void LLScrollListCtrl::setSorted(BOOL sorted)
2445{
2446 mSorted = sorted;
2447}
2448
2449BOOL LLScrollListCtrl::isSorted()
2450{
2451 return mSorted;
2452}
2453
2454struct SameSortColumn 2452struct SameSortColumn
2455{ 2453{
2456 SameSortColumn(S32 column) : mColumn(column) {} 2454 SameSortColumn(S32 column) : mColumn(column) {}
@@ -2544,7 +2542,7 @@ void LLScrollListCtrl::dirtyColumns()
2544} 2542}
2545 2543
2546 2544
2547S32 LLScrollListCtrl::getScrollPos() 2545S32 LLScrollListCtrl::getScrollPos() const
2548{ 2546{
2549 return mScrollbar->getDocPos(); 2547 return mScrollbar->getDocPos();
2550} 2548}
@@ -2901,7 +2899,7 @@ void LLScrollListCtrl::copy()
2901} 2899}
2902 2900
2903// virtual 2901// virtual
2904BOOL LLScrollListCtrl::canCopy() 2902BOOL LLScrollListCtrl::canCopy() const
2905{ 2903{
2906 return (getFirstSelected() != NULL); 2904 return (getFirstSelected() != NULL);
2907} 2905}
@@ -2914,25 +2912,12 @@ void LLScrollListCtrl::cut()
2914} 2912}
2915 2913
2916// virtual 2914// virtual
2917BOOL LLScrollListCtrl::canCut() 2915BOOL LLScrollListCtrl::canCut() const
2918{ 2916{
2919 return canCopy() && canDoDelete(); 2917 return canCopy() && canDoDelete();
2920} 2918}
2921 2919
2922// virtual 2920// virtual
2923void LLScrollListCtrl::doDelete()
2924{
2925 // Not yet implemented
2926}
2927
2928// virtual
2929BOOL LLScrollListCtrl::canDoDelete()
2930{
2931 // Not yet implemented
2932 return FALSE;
2933}
2934
2935// virtual
2936void LLScrollListCtrl::selectAll() 2921void LLScrollListCtrl::selectAll()
2937{ 2922{
2938 // Deselects all other items 2923 // Deselects all other items
@@ -2953,7 +2938,7 @@ void LLScrollListCtrl::selectAll()
2953} 2938}
2954 2939
2955// virtual 2940// virtual
2956BOOL LLScrollListCtrl::canSelectAll() 2941BOOL LLScrollListCtrl::canSelectAll() const
2957{ 2942{
2958 return getCanSelect() && mAllowMultipleSelection && !(mMaxSelectable > 0 && mItemList.size() > mMaxSelectable); 2943 return getCanSelect() && mAllowMultipleSelection && !(mMaxSelectable > 0 && mItemList.size() > mMaxSelectable);
2959} 2944}
@@ -2965,7 +2950,7 @@ void LLScrollListCtrl::deselect()
2965} 2950}
2966 2951
2967// virtual 2952// virtual
2968BOOL LLScrollListCtrl::canDeselect() 2953BOOL LLScrollListCtrl::canDeselect() const
2969{ 2954{
2970 return getCanSelect(); 2955 return getCanSelect();
2971} 2956}
@@ -3056,7 +3041,7 @@ void LLScrollListCtrl::onClickColumn(void *userdata)
3056 LLScrollListCtrl *parent = info->mParentCtrl; 3041 LLScrollListCtrl *parent = info->mParentCtrl;
3057 if (!parent) return; 3042 if (!parent) return;
3058 3043
3059 U32 column_index = info->mIndex; 3044 S32 column_index = info->mIndex;
3060 3045
3061 LLScrollListColumn* column = parent->mColumnsIndexed[info->mIndex]; 3046 LLScrollListColumn* column = parent->mColumnsIndexed[info->mIndex];
3062 bool ascending = column->mSortAscending; 3047 bool ascending = column->mSortAscending;
@@ -3430,14 +3415,14 @@ LLColumnHeader::LLColumnHeader(const LLString& label, const LLRect &rect, LLScro
3430 mAscendingText = "[LOW]...[HIGH](Ascending)"; 3415 mAscendingText = "[LOW]...[HIGH](Ascending)";
3431 mDescendingText = "[HIGH]...[LOW](Descending)"; 3416 mDescendingText = "[HIGH]...[LOW](Descending)";
3432 3417
3433 mList->reshape(llmax(mList->getRect().getWidth(), 110, mRect.getWidth()), mList->getRect().getHeight()); 3418 mList->reshape(llmax(mList->getRect().getWidth(), 110, getRect().getWidth()), mList->getRect().getHeight());
3434 3419
3435 // resize handles on left and right 3420 // resize handles on left and right
3436 const S32 RESIZE_BAR_THICKNESS = 3; 3421 const S32 RESIZE_BAR_THICKNESS = 3;
3437 mResizeBar = new LLResizeBar( 3422 mResizeBar = new LLResizeBar(
3438 "resizebar", 3423 "resizebar",
3439 this, 3424 this,
3440 LLRect( mRect.getWidth() - RESIZE_BAR_THICKNESS, mRect.getHeight(), mRect.getWidth(), 0), 3425 LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0),
3441 MIN_COLUMN_WIDTH, S32_MAX, LLResizeBar::RIGHT ); 3426 MIN_COLUMN_WIDTH, S32_MAX, LLResizeBar::RIGHT );
3442 addChild(mResizeBar); 3427 addChild(mResizeBar);
3443 3428
@@ -3458,10 +3443,10 @@ void LLColumnHeader::draw()
3458 mButton->setImageOverlay(is_ascending ? "up_arrow.tga" : "down_arrow.tga", LLFontGL::RIGHT, draw_arrow ? LLColor4::white : LLColor4::transparent); 3443 mButton->setImageOverlay(is_ascending ? "up_arrow.tga" : "down_arrow.tga", LLFontGL::RIGHT, draw_arrow ? LLColor4::white : LLColor4::transparent);
3459 mArrowImage = mButton->getImageOverlay()->getImage(); 3444 mArrowImage = mButton->getImageOverlay()->getImage();
3460 3445
3461 //BOOL clip = mRect.mRight > mColumn->mParentCtrl->getItemListRect().getWidth(); 3446 //BOOL clip = getRect().mRight > mColumn->mParentCtrl->getItemListRect().getWidth();
3462 //LLGLEnable scissor_test(clip ? GL_SCISSOR_TEST : GL_FALSE); 3447 //LLGLEnable scissor_test(clip ? GL_SCISSOR_TEST : GL_FALSE);
3463 3448
3464 //LLRect column_header_local_rect(-mRect.mLeft, mRect.getHeight(), mColumn->mParentCtrl->getItemListRect().getWidth() - mRect.mLeft, 0); 3449 //LLRect column_header_local_rect(-getRect().mLeft, getRect().getHeight(), mColumn->mParentCtrl->getItemListRect().getWidth() - getRect().mLeft, 0);
3465 //LLUI::setScissorRegionLocal(column_header_local_rect); 3450 //LLUI::setScissorRegionLocal(column_header_local_rect);
3466 3451
3467 // Draw children 3452 // Draw children
@@ -3605,13 +3590,13 @@ void LLColumnHeader::showList()
3605 3590
3606 S32 text_width = LLFontGL::sSansSerifSmall->getWidth(ascending_string); 3591 S32 text_width = LLFontGL::sSansSerifSmall->getWidth(ascending_string);
3607 text_width = llmax(text_width, LLFontGL::sSansSerifSmall->getWidth(descending_string)) + 10; 3592 text_width = llmax(text_width, LLFontGL::sSansSerifSmall->getWidth(descending_string)) + 10;
3608 text_width = llmax(text_width, mRect.getWidth() - 30); 3593 text_width = llmax(text_width, getRect().getWidth() - 30);
3609 3594
3610 mList->getColumn(0)->mWidth = text_width; 3595 mList->getColumn(0)->mWidth = text_width;
3611 ((LLScrollListText*)mList->getFirstData()->getColumn(0))->setText(ascending_string); 3596 ((LLScrollListText*)mList->getFirstData()->getColumn(0))->setText(ascending_string);
3612 ((LLScrollListText*)mList->getLastData()->getColumn(0))->setText(descending_string); 3597 ((LLScrollListText*)mList->getLastData()->getColumn(0))->setText(descending_string);
3613 3598
3614 mList->reshape(llmax(text_width + 30, 110, mRect.getWidth()), mList->getRect().getHeight()); 3599 mList->reshape(llmax(text_width + 30, 110, getRect().getWidth()), mList->getRect().getHeight());
3615 3600
3616 LLComboBox::showList(); 3601 LLComboBox::showList();
3617 } 3602 }
@@ -3684,7 +3669,7 @@ LLView* LLColumnHeader::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_d
3684void LLColumnHeader::userSetShape(const LLRect& new_rect) 3669void LLColumnHeader::userSetShape(const LLRect& new_rect)
3685{ 3670{
3686 S32 new_width = new_rect.getWidth(); 3671 S32 new_width = new_rect.getWidth();
3687 S32 delta_width = new_width - (mRect.getWidth() /*+ mColumn->mParentCtrl->getColumnPadding()*/); 3672 S32 delta_width = new_width - (getRect().getWidth() /*+ mColumn->mParentCtrl->getColumnPadding()*/);
3688 3673
3689 if (delta_width != 0) 3674 if (delta_width != 0)
3690 { 3675 {
@@ -3744,7 +3729,7 @@ void LLColumnHeader::userSetShape(const LLRect& new_rect)
3744 } 3729 }
3745 3730
3746 // propagate constrained delta_width to new width for this column 3731 // propagate constrained delta_width to new width for this column
3747 new_width = mRect.getWidth() + delta_width - mColumn->mParentCtrl->getColumnPadding(); 3732 new_width = getRect().getWidth() + delta_width - mColumn->mParentCtrl->getColumnPadding();
3748 3733
3749 // use requested width 3734 // use requested width
3750 mColumn->mWidth = new_width; 3735 mColumn->mWidth = new_width;
diff --git a/linden/indra/llui/llscrolllistctrl.h b/linden/indra/llui/llscrolllistctrl.h
index e9486cb..716d18a 100644
--- a/linden/indra/llui/llscrolllistctrl.h
+++ b/linden/indra/llui/llscrolllistctrl.h
@@ -1,6 +1,5 @@
1/** 1/**
2 * @file llscrolllistctrl.h 2 * @file llscrolllistctrl.h
3 * @brief LLScrollListCtrl base class
4 * 3 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$ 4 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 * 5 *
@@ -43,16 +42,20 @@
43#include "llstring.h" 42#include "llstring.h"
44#include "llimagegl.h" 43#include "llimagegl.h"
45#include "lleditmenuhandler.h" 44#include "lleditmenuhandler.h"
46#include "llviewborder.h"
47#include "llframetimer.h" 45#include "llframetimer.h"
48#include "llcheckboxctrl.h" 46#include "llcheckboxctrl.h"
49#include "llcombobox.h" 47#include "llcombobox.h"
48#include "llscrollbar.h"
49#include "llresizebar.h"
50 50
51class LLScrollbar; 51/*
52class LLScrollListCtrl; 52 * Represents a cell in a scrollable table.
53class LLColumnHeader; 53 *
54class LLResizeBar; 54 * Sub-classes must return height and other properties
55 55 * though width accessors are implemented by the base class.
56 * It is therefore important for sub-class constructors to call
57 * setWidth() with realistic values.
58 */
56class LLScrollListCell 59class LLScrollListCell
57{ 60{
58public: 61public:
@@ -63,21 +66,24 @@ public:
63 virtual S32 getContentWidth() const { return 0; } 66 virtual S32 getContentWidth() const { return 0; }
64 virtual S32 getHeight() const = 0; 67 virtual S32 getHeight() const = 0;
65 virtual const LLSD getValue() const { return LLString::null; } 68 virtual const LLSD getValue() const { return LLString::null; }
66 virtual void setValue(LLSD value) { } 69 virtual void setValue(const LLSD& value) { }
67 virtual BOOL getVisible() const { return TRUE; } 70 virtual BOOL getVisible() const { return TRUE; }
68 virtual void setWidth(S32 width) { mWidth = width; } 71 virtual void setWidth(S32 width) { mWidth = width; }
69 virtual void highlightText(S32 offset, S32 num_chars) {} 72 virtual void highlightText(S32 offset, S32 num_chars) {}
70 virtual BOOL isText() = 0; 73 virtual BOOL isText() const = 0;
71 virtual void setColor(const LLColor4&) {} 74 virtual void setColor(const LLColor4&) {}
72 virtual void onCommit() {}; 75 virtual void onCommit() {};
73 76
74 virtual BOOL handleClick() { return FALSE; } 77 virtual BOOL handleClick() { return FALSE; }
75 virtual void setEnabled(BOOL enable) { } 78 virtual void setEnabled(BOOL enable) { }
76 79
77protected: 80private:
78 S32 mWidth; 81 S32 mWidth;
79}; 82};
80 83
84/*
85 * Draws a horizontal line.
86 */
81class LLScrollListSeparator : public LLScrollListCell 87class LLScrollListSeparator : public LLScrollListCell
82{ 88{
83public: 89public:
@@ -85,9 +91,12 @@ public:
85 virtual ~LLScrollListSeparator() {}; 91 virtual ~LLScrollListSeparator() {};
86 virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const; // truncate to given width, if possible 92 virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const; // truncate to given width, if possible
87 virtual S32 getHeight() const { return 5; }; 93 virtual S32 getHeight() const { return 5; };
88 virtual BOOL isText() { return FALSE; } 94 virtual BOOL isText() const { return FALSE; }
89}; 95};
90 96
97/*
98 * Cell displaying a text label.
99 */
91class LLScrollListText : public LLScrollListCell 100class LLScrollListText : public LLScrollListCell
92{ 101{
93public: 102public:
@@ -97,13 +106,13 @@ public:
97 virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const; 106 virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const;
98 virtual S32 getContentWidth() const; 107 virtual S32 getContentWidth() const;
99 virtual S32 getHeight() const { return llround(mFont->getLineHeight()); } 108 virtual S32 getHeight() const { return llround(mFont->getLineHeight()); }
100 virtual void setValue(LLSD value) { setText(value.asString()); } 109 virtual void setValue(const LLSD& value);
101 virtual const LLSD getValue() const { return LLSD(mText.getString()); } 110 virtual const LLSD getValue() const { return LLSD(mText.getString()); }
102 virtual BOOL getVisible() const { return mVisible; } 111 virtual BOOL getVisible() const { return mVisible; }
103 virtual void highlightText(S32 offset, S32 num_chars) {mHighlightOffset = offset; mHighlightCount = num_chars;} 112 virtual void highlightText(S32 offset, S32 num_chars) {mHighlightOffset = offset; mHighlightCount = num_chars;}
104 113
105 virtual void setColor(const LLColor4&); 114 virtual void setColor(const LLColor4&);
106 virtual BOOL isText() { return TRUE; } 115 virtual BOOL isText() const { return TRUE; }
107 116
108 void setText(const LLStringExplicit& text); 117 void setText(const LLStringExplicit& text);
109 void setFontStyle(const U8 font_style) { mFontStyle = font_style; } 118 void setFontStyle(const U8 font_style) { mFontStyle = font_style; }
@@ -124,6 +133,9 @@ private:
124 static U32 sCount; 133 static U32 sCount;
125}; 134};
126 135
136/*
137 * Cell displaying an image.
138 */
127class LLScrollListIcon : public LLScrollListCell 139class LLScrollListIcon : public LLScrollListCell
128{ 140{
129public: 141public:
@@ -135,8 +147,8 @@ public:
135 // used as sort criterion 147 // used as sort criterion
136 virtual const LLSD getValue() const { return LLSD(mImageUUID); } 148 virtual const LLSD getValue() const { return LLSD(mImageUUID); }
137 virtual void setColor(const LLColor4&); 149 virtual void setColor(const LLColor4&);
138 virtual BOOL isText() { return FALSE; } 150 virtual BOOL isText()const { return FALSE; }
139 virtual void setValue(LLSD value); 151 virtual void setValue(const LLSD& value);
140 152
141private: 153private:
142 LLPointer<LLImageGL> mIcon; 154 LLPointer<LLImageGL> mIcon;
@@ -144,6 +156,9 @@ private:
144 LLColor4 mColor; 156 LLColor4 mColor;
145}; 157};
146 158
159/*
160 * An interactive cell containing a check box.
161 */
147class LLScrollListCheck : public LLScrollListCell 162class LLScrollListCheck : public LLScrollListCell
148{ 163{
149public: 164public:
@@ -152,19 +167,22 @@ public:
152 virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const; 167 virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const;
153 virtual S32 getHeight() const { return 0; } 168 virtual S32 getHeight() const { return 0; }
154 virtual const LLSD getValue() const { return mCheckBox->getValue(); } 169 virtual const LLSD getValue() const { return mCheckBox->getValue(); }
155 virtual void setValue(LLSD value) { mCheckBox->setValue(value); } 170 virtual void setValue(const LLSD& value) { mCheckBox->setValue(value); }
156 virtual void onCommit() { mCheckBox->onCommit(); } 171 virtual void onCommit() { mCheckBox->onCommit(); }
157 172
158 virtual BOOL handleClick(); 173 virtual BOOL handleClick();
159 virtual void setEnabled(BOOL enable) { mCheckBox->setEnabled(enable); } 174 virtual void setEnabled(BOOL enable) { mCheckBox->setEnabled(enable); }
160 175
161 LLCheckBoxCtrl* getCheckBox() { return mCheckBox; } 176 LLCheckBoxCtrl* getCheckBox() { return mCheckBox; }
162 virtual BOOL isText() { return FALSE; } 177 virtual BOOL isText() const { return FALSE; }
163 178
164private: 179private:
165 LLCheckBoxCtrl* mCheckBox; 180 LLCheckBoxCtrl* mCheckBox;
166}; 181};
167 182
183/*
184 * A simple data class describing a column within a scroll list.
185 */
168class LLScrollListColumn 186class LLScrollListColumn
169{ 187{
170public: 188public:
@@ -245,6 +263,9 @@ public:
245 mHeader = NULL; 263 mHeader = NULL;
246 } 264 }
247 265
266 // Public data is fine so long as this remains a simple struct-like data class.
267 // If it ever gets any smarter than that, these should all become private
268 // with protected or public accessor methods added as needed. -MG
248 LLString mName; 269 LLString mName;
249 LLString mSortingColumn; 270 LLString mSortingColumn;
250 BOOL mSortAscending; 271 BOOL mSortAscending;
@@ -255,7 +276,7 @@ public:
255 S32 mMaxContentWidth; 276 S32 mMaxContentWidth;
256 S32 mIndex; 277 S32 mIndex;
257 LLScrollListCtrl* mParentCtrl; 278 LLScrollListCtrl* mParentCtrl;
258 LLColumnHeader* mHeader; 279 class LLColumnHeader* mHeader;
259 LLFontGL::HAlign mFontAlignment; 280 LLFontGL::HAlign mFontAlignment;
260}; 281};
261 282
@@ -284,7 +305,7 @@ public:
284 static void onMouseDown(void* user_data); 305 static void onMouseDown(void* user_data);
285 static void onHeldDown(void* user_data); 306 static void onHeldDown(void* user_data);
286 307
287protected: 308private:
288 LLScrollListColumn* mColumn; 309 LLScrollListColumn* mColumn;
289 LLResizeBar* mResizeBar; 310 LLResizeBar* mResizeBar;
290 LLString mOrigLabel; 311 LLString mOrigLabel;
@@ -331,11 +352,11 @@ public:
331 352
332 void setColumn( S32 column, LLScrollListCell *cell ); 353 void setColumn( S32 column, LLScrollListCell *cell );
333 354
334 S32 getNumColumns() const { return mColumns.size(); } 355 S32 getNumColumns() const { return mColumns.size(); }
335 356
336 LLScrollListCell *getColumn(const S32 i) const { if (0 <= i && i < (S32)mColumns.size()) { return mColumns[i]; } return NULL; } 357 LLScrollListCell *getColumn(const S32 i) const { if (0 <= i && i < (S32)mColumns.size()) { return mColumns[i]; } return NULL; }
337 358
338 LLString getContentsCSV(); 359 LLString getContentsCSV() const;
339 360
340 virtual void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding); 361 virtual void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding);
341 362
@@ -347,6 +368,11 @@ private:
347 std::vector<LLScrollListCell *> mColumns; 368 std::vector<LLScrollListCell *> mColumns;
348}; 369};
349 370
371/*
372 * A graphical control representing a scrollable table.
373 * Cells in the table can be simple text or more complicated things
374 * such as icons or even interactive elements like check boxes.
375 */
350class LLScrollListItemComment : public LLScrollListItem 376class LLScrollListItemComment : public LLScrollListItem
351{ 377{
352public: 378public:
@@ -421,7 +447,7 @@ public:
421 447
422 // DEPRECATED: Use setSelectedByValue() below. 448 // DEPRECATED: Use setSelectedByValue() below.
423 BOOL setCurrentByID( const LLUUID& id ) { return selectByID(id); } 449 BOOL setCurrentByID( const LLUUID& id ) { return selectByID(id); }
424 virtual LLUUID getCurrentID() { return getStringUUIDSelectedItem(); } 450 virtual LLUUID getCurrentID() const { return getStringUUIDSelectedItem(); }
425 451
426 BOOL operateOnSelection(EOperation op); 452 BOOL operateOnSelection(EOperation op);
427 BOOL operateOnAll(EOperation op); 453 BOOL operateOnAll(EOperation op);
@@ -433,11 +459,11 @@ public:
433 459
434 // Match item by value.asString(), which should work for string, integer, uuid. 460 // Match item by value.asString(), which should work for string, integer, uuid.
435 // Returns FALSE if not found. 461 // Returns FALSE if not found.
436 BOOL setSelectedByValue(LLSD value, BOOL selected); 462 BOOL setSelectedByValue(const LLSD& value, BOOL selected);
437 463
438 BOOL isSorted(); 464 BOOL isSorted() const { return mSorted; }
439 465
440 virtual BOOL isSelected(LLSD value); 466 virtual BOOL isSelected(const LLSD& value) const;
441 467
442 BOOL handleClick(S32 x, S32 y, MASK mask); 468 BOOL handleClick(S32 x, S32 y, MASK mask);
443 BOOL selectFirstItem(); 469 BOOL selectFirstItem();
@@ -461,8 +487,8 @@ public:
461 void setCanSelect(BOOL can_select) { mCanSelect = can_select; } 487 void setCanSelect(BOOL can_select) { mCanSelect = can_select; }
462 virtual BOOL getCanSelect() const { return mCanSelect; } 488 virtual BOOL getCanSelect() const { return mCanSelect; }
463 489
464 S32 getItemIndex( LLScrollListItem* item ); 490 S32 getItemIndex( LLScrollListItem* item ) const;
465 S32 getItemIndex( const LLUUID& item_id ); 491 S32 getItemIndex( const LLUUID& item_id ) const;
466 492
467 LLScrollListItem* addCommentText( const LLString& comment_text, EAddPosition pos = ADD_BOTTOM); 493 LLScrollListItem* addCommentText( const LLString& comment_text, EAddPosition pos = ADD_BOTTOM);
468 LLScrollListItem* addSeparator(EAddPosition pos); 494 LLScrollListItem* addSeparator(EAddPosition pos);
@@ -482,12 +508,11 @@ public:
482 // "StringUUID" interface: use this when you're creating a list that contains non-unique strings each of which 508 // "StringUUID" interface: use this when you're creating a list that contains non-unique strings each of which
483 // has an associated, unique UUID, and only one of which can be selected at a time. 509 // has an associated, unique UUID, and only one of which can be selected at a time.
484 LLScrollListItem* addStringUUIDItem(const LLString& item_text, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE, S32 column_width = 0); 510 LLScrollListItem* addStringUUIDItem(const LLString& item_text, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE, S32 column_width = 0);
485 LLUUID getStringUUIDSelectedItem(); 511 LLUUID getStringUUIDSelectedItem() const;
486 512
487 LLScrollListItem* getFirstSelected() const; 513 LLScrollListItem* getFirstSelected() const;
488 virtual S32 getFirstSelectedIndex() const; 514 virtual S32 getFirstSelectedIndex() const;
489 std::vector<LLScrollListItem*> getAllSelected() const; 515 std::vector<LLScrollListItem*> getAllSelected() const;
490
491 LLScrollListItem* getLastSelectedItem() const { return mLastSelected; } 516 LLScrollListItem* getLastSelectedItem() const { return mLastSelected; }
492 517
493 // iterate over all items 518 // iterate over all items
@@ -520,7 +545,7 @@ public:
520 S32 getMaxSelectable() { return mMaxSelectable; } 545 S32 getMaxSelectable() { return mMaxSelectable; }
521 546
522 547
523 virtual S32 getScrollPos(); 548 virtual S32 getScrollPos() const;
524 virtual void setScrollPos( S32 pos ); 549 virtual void setScrollPos( S32 pos );
525 550
526 S32 getSearchColumn() { return mSearchColumn; } 551 S32 getSearchColumn() { return mSearchColumn; }
@@ -576,19 +601,13 @@ public:
576 601
577 // LLEditMenuHandler functions 602 // LLEditMenuHandler functions
578 virtual void copy(); 603 virtual void copy();
579 virtual BOOL canCopy(); 604 virtual BOOL canCopy() const;
580
581 virtual void cut(); 605 virtual void cut();
582 virtual BOOL canCut(); 606 virtual BOOL canCut() const;
583
584 virtual void doDelete();
585 virtual BOOL canDoDelete();
586
587 virtual void selectAll(); 607 virtual void selectAll();
588 virtual BOOL canSelectAll(); 608 virtual BOOL canSelectAll() const;
589
590 virtual void deselect(); 609 virtual void deselect();
591 virtual BOOL canDeselect(); 610 virtual BOOL canDeselect() const;
592 611
593 void setNumDynamicColumns(int num) { mNumDynamicWidthColumns = num; } 612 void setNumDynamicColumns(int num) { mNumDynamicWidthColumns = num; }
594 void setTotalStaticColumnWidth(int width) { mTotalStaticColumnWidth = width; } 613 void setTotalStaticColumnWidth(int width) { mTotalStaticColumnWidth = width; }
@@ -600,7 +619,7 @@ public:
600 S32 selectMultiple( LLDynamicArray<LLUUID> ids ); 619 S32 selectMultiple( LLDynamicArray<LLUUID> ids );
601 void sortItems(); 620 void sortItems();
602 // manually call this whenever editing list items in place to flag need for resorting 621 // manually call this whenever editing list items in place to flag need for resorting
603 void setSorted(BOOL sorted); 622 void setSorted(BOOL sorted) { mSorted = sorted; }
604 void dirtyColumns(); // some operation has potentially affected column layout or ordering 623 void dirtyColumns(); // some operation has potentially affected column layout or ordering
605 624
606protected: 625protected:
@@ -617,9 +636,14 @@ protected:
617 // The LLScrollListCtrl owns its items and is responsible for deleting them 636 // The LLScrollListCtrl owns its items and is responsible for deleting them
618 // (except in the case that the addItem() call fails, in which case it is up 637 // (except in the case that the addItem() call fails, in which case it is up
619 // to the caller to delete the item) 638 // to the caller to delete the item)
620 639 //
621 // returns FALSE if item faile to be added to list, does NOT delete 'item' 640 // returns FALSE if item faile to be added to list, does NOT delete 'item'
622 BOOL addItem( LLScrollListItem* item, EAddPosition pos = ADD_BOTTOM, BOOL requires_column = TRUE ); 641 BOOL addItem( LLScrollListItem* item, EAddPosition pos = ADD_BOTTOM, BOOL requires_column = TRUE );
642
643 typedef std::deque<LLScrollListItem *> item_list;
644 item_list& getItemList() { return mItemList; }
645
646private:
623 void selectPrevItem(BOOL extend_selection); 647 void selectPrevItem(BOOL extend_selection);
624 void selectNextItem(BOOL extend_selection); 648 void selectNextItem(BOOL extend_selection);
625 void drawItems(); 649 void drawItems();
@@ -632,7 +656,7 @@ protected:
632 void commitIfChanged(); 656 void commitIfChanged();
633 BOOL setSort(S32 column, BOOL ascending); 657 BOOL setSort(S32 column, BOOL ascending);
634 658
635protected: 659
636 S32 mCurIndex; // For get[First/Next]Data 660 S32 mCurIndex; // For get[First/Next]Data
637 S32 mCurSelectedIndex; // For get[First/Next]Selected 661 S32 mCurSelectedIndex; // For get[First/Next]Selected
638 662
@@ -652,7 +676,6 @@ protected:
652 BOOL mDisplayColumnHeaders; 676 BOOL mDisplayColumnHeaders;
653 BOOL mColumnsDirty; 677 BOOL mColumnsDirty;
654 678
655 typedef std::deque<LLScrollListItem *> item_list;
656 item_list mItemList; 679 item_list mItemList;
657 680
658 LLScrollListItem *mLastSelected; 681 LLScrollListItem *mLastSelected;
@@ -681,7 +704,7 @@ protected:
681 void (*mOnSortChangedCallback)(void* userdata); 704 void (*mOnSortChangedCallback)(void* userdata);
682 705
683 S32 mHighlightedItem; 706 S32 mHighlightedItem;
684 LLViewBorder* mBorder; 707 class LLViewBorder* mBorder;
685 708
686 LLWString mSearchString; 709 LLWString mSearchString;
687 LLFrameTimer mSearchTimer; 710 LLFrameTimer mSearchTimer;
@@ -704,15 +727,9 @@ protected:
704 typedef std::pair<S32, BOOL> sort_column_t; 727 typedef std::pair<S32, BOOL> sort_column_t;
705 std::vector<sort_column_t> mSortColumns; 728 std::vector<sort_column_t> mSortColumns;
706 729
707public:
708 // HACK: Did we draw one selected item this frame? 730 // HACK: Did we draw one selected item this frame?
709 BOOL mDrewSelected; 731 BOOL mDrewSelected;
710}; 732}; // end class LLScrollListCtrl
711
712const BOOL MULTIPLE_SELECT_YES = TRUE;
713const BOOL MULTIPLE_SELECT_NO = FALSE;
714 733
715const BOOL SHOW_BORDER_YES = TRUE;
716const BOOL SHOW_BORDER_NO = FALSE;
717 734
718#endif // LL_SCROLLLISTCTRL_H 735#endif // LL_SCROLLLISTCTRL_H
diff --git a/linden/indra/llui/llslider.cpp b/linden/indra/llui/llslider.cpp
index e03603d..02841ee 100644
--- a/linden/indra/llui/llslider.cpp
+++ b/linden/indra/llui/llslider.cpp
@@ -82,15 +82,6 @@ LLSlider::LLSlider(
82 mDragStartThumbRect = mThumbRect; 82 mDragStartThumbRect = mThumbRect;
83} 83}
84 84
85EWidgetType LLSlider::getWidgetType() const
86{
87 return WIDGET_TYPE_SLIDER_BAR;
88}
89
90LLString LLSlider::getWidgetTag() const
91{
92 return LL_SLIDER_TAG;
93}
94 85
95void LLSlider::setValue(F32 value, BOOL from_event) 86void LLSlider::setValue(F32 value, BOOL from_event)
96{ 87{
@@ -118,7 +109,7 @@ void LLSlider::updateThumbRect()
118 S32 thumb_width = mThumbImage->getWidth(); 109 S32 thumb_width = mThumbImage->getWidth();
119 S32 thumb_height = mThumbImage->getHeight(); 110 S32 thumb_height = mThumbImage->getHeight();
120 S32 left_edge = (thumb_width / 2); 111 S32 left_edge = (thumb_width / 2);
121 S32 right_edge = mRect.getWidth() - (thumb_width / 2); 112 S32 right_edge = getRect().getWidth() - (thumb_width / 2);
122 113
123 S32 x = left_edge + S32( t * (right_edge - left_edge) ); 114 S32 x = left_edge + S32( t * (right_edge - left_edge) );
124 mThumbRect.mLeft = x - (thumb_width / 2); 115 mThumbRect.mLeft = x - (thumb_width / 2);
@@ -140,18 +131,13 @@ void LLSlider::setValueAndCommit(F32 value)
140} 131}
141 132
142 133
143F32 LLSlider::getValueF32() const
144{
145 return mValue;
146}
147
148BOOL LLSlider::handleHover(S32 x, S32 y, MASK mask) 134BOOL LLSlider::handleHover(S32 x, S32 y, MASK mask)
149{ 135{
150 if( hasMouseCapture() ) 136 if( hasMouseCapture() )
151 { 137 {
152 S32 thumb_half_width = mThumbImage->getWidth()/2; 138 S32 thumb_half_width = mThumbImage->getWidth()/2;
153 S32 left_edge = thumb_half_width; 139 S32 left_edge = thumb_half_width;
154 S32 right_edge = mRect.getWidth() - (thumb_half_width); 140 S32 right_edge = getRect().getWidth() - (thumb_half_width);
155 141
156 x += mMouseOffset; 142 x += mMouseOffset;
157 x = llclamp( x, left_edge, right_edge ); 143 x = llclamp( x, left_edge, right_edge );
@@ -231,10 +217,10 @@ BOOL LLSlider::handleMouseDown(S32 x, S32 y, MASK mask)
231 return TRUE; 217 return TRUE;
232} 218}
233 219
234BOOL LLSlider::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) 220BOOL LLSlider::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
235{ 221{
236 BOOL handled = FALSE; 222 BOOL handled = FALSE;
237 if( getVisible() && mEnabled && !called_from_parent ) 223 if( getVisible() && getEnabled() && !called_from_parent )
238 { 224 {
239 switch(key) 225 switch(key)
240 { 226 {
@@ -272,14 +258,14 @@ void LLSlider::draw()
272 258
273 LLRect rect(mDragStartThumbRect); 259 LLRect rect(mDragStartThumbRect);
274 260
275 F32 opacity = mEnabled ? 1.f : 0.3f; 261 F32 opacity = getEnabled() ? 1.f : 0.3f;
276 LLColor4 center_color = (mThumbCenterColor % opacity); 262 LLColor4 center_color = (mThumbCenterColor % opacity);
277 LLColor4 track_color = (mTrackColor % opacity); 263 LLColor4 track_color = (mTrackColor % opacity);
278 264
279 // Track 265 // Track
280 LLRect track_rect(mThumbImage->getWidth() / 2, 266 LLRect track_rect(mThumbImage->getWidth() / 2,
281 getLocalRect().getCenterY() + (mTrackImage->getHeight() / 2), 267 getLocalRect().getCenterY() + (mTrackImage->getHeight() / 2),
282 mRect.getWidth() - mThumbImage->getWidth() / 2, 268 getRect().getWidth() - mThumbImage->getWidth() / 2,
283 getLocalRect().getCenterY() - (mTrackImage->getHeight() / 2) ); 269 getLocalRect().getCenterY() - (mTrackImage->getHeight() / 2) );
284 270
285 gl_draw_scaled_image_with_border(track_rect.mLeft, track_rect.mBottom, 3, 3, track_rect.getWidth(), track_rect.getHeight(), 271 gl_draw_scaled_image_with_border(track_rect.mLeft, track_rect.mBottom, 3, 3, track_rect.getWidth(), track_rect.getHeight(),
@@ -334,14 +320,14 @@ LLXMLNodePtr LLSlider::getXML(bool save_children) const
334 node->createChild("min_val", TRUE)->setFloatValue(getMinValue()); 320 node->createChild("min_val", TRUE)->setFloatValue(getMinValue());
335 node->createChild("max_val", TRUE)->setFloatValue(getMaxValue()); 321 node->createChild("max_val", TRUE)->setFloatValue(getMaxValue());
336 node->createChild("increment", TRUE)->setFloatValue(getIncrement()); 322 node->createChild("increment", TRUE)->setFloatValue(getIncrement());
337 node->createChild("volume", TRUE)->setBoolValue(getVolumeSlider()); 323 node->createChild("volume", TRUE)->setBoolValue(mVolumeSlider);
338 324
339 return node; 325 return node;
340} 326}
341 327
342 328
343//static 329//static
344LLView* LLSlider::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) 330LLView* LLSlider::fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory)
345{ 331{
346 LLString name("slider_bar"); 332 LLString name("slider_bar");
347 node->getAttributeString("name", name); 333 node->getAttributeString("name", name);
diff --git a/linden/indra/llui/llslider.h b/linden/indra/llui/llslider.h
index 08ab600..506a6bd 100644
--- a/linden/indra/llui/llslider.h
+++ b/linden/indra/llui/llslider.h
@@ -35,7 +35,6 @@
35#include "lluictrl.h" 35#include "lluictrl.h"
36#include "v4color.h" 36#include "v4color.h"
37 37
38class LLUICtrlFactory;
39class LLImageGL; 38class LLImageGL;
40 39
41class LLSlider : public LLUICtrl 40class LLSlider : public LLUICtrl
@@ -50,16 +49,16 @@ public:
50 F32 min_value, 49 F32 min_value,
51 F32 max_value, 50 F32 max_value,
52 F32 increment, 51 F32 increment,
53 BOOL volume, 52 BOOL volume, //TODO: create a "volume" slider sub-class or just use image art, no? -MG
54 const LLString& control_name = LLString::null ); 53 const LLString& control_name = LLString::null );
55 54
56 virtual EWidgetType getWidgetType() const; 55 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SLIDER_BAR; }
57 virtual LLString getWidgetTag() const; 56 virtual LLString getWidgetTag() const { return LL_SLIDER_TAG; }
58 virtual LLXMLNodePtr getXML(bool save_children = true) const; 57 virtual LLXMLNodePtr getXML(bool save_children = true) const;
59 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 58 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory);
60 59
61 void setValue( F32 value, BOOL from_event = FALSE ); 60 void setValue( F32 value, BOOL from_event = FALSE );
62 F32 getValueF32() const; 61 F32 getValueF32() const { return mValue; }
63 62
64 virtual void setValue(const LLSD& value ) { setValue((F32)value.asReal(), TRUE); } 63 virtual void setValue(const LLSD& value ) { setValue((F32)value.asReal(), TRUE); }
65 virtual LLSD getValue() const { return LLSD(getValueF32()); } 64 virtual LLSD getValue() const { return LLSD(getValueF32()); }
@@ -71,9 +70,8 @@ public:
71 F32 getMinValue() const { return mMinValue; } 70 F32 getMinValue() const { return mMinValue; }
72 F32 getMaxValue() const { return mMaxValue; } 71 F32 getMaxValue() const { return mMaxValue; }
73 F32 getIncrement() const { return mIncrement; } 72 F32 getIncrement() const { return mIncrement; }
74 BOOL getVolumeSlider() const { return mVolumeSlider; } 73 void setMinValue(F32 min_value) {mMinValue = min_value; updateThumbRect(); }
75 void setMinValue(F32 min_value) {mMinValue = min_value;} 74 void setMaxValue(F32 max_value) {mMaxValue = max_value; updateThumbRect(); }
76 void setMaxValue(F32 max_value) {mMaxValue = max_value;}
77 void setIncrement(F32 increment) {mIncrement = increment;} 75 void setIncrement(F32 increment) {mIncrement = increment;}
78 void setMouseDownCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseDownCallback = cb; } 76 void setMouseDownCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseDownCallback = cb; }
79 void setMouseUpCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseUpCallback = cb; } 77 void setMouseUpCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseUpCallback = cb; }
@@ -84,11 +82,10 @@ public:
84 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); 82 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
85 virtual void draw(); 83 virtual void draw();
86 84
87protected: 85private:
88 void setValueAndCommit(F32 value); 86 void setValueAndCommit(F32 value);
89 void updateThumbRect(); 87 void updateThumbRect();
90 88
91protected:
92 F32 mValue; 89 F32 mValue;
93 F32 mInitialValue; 90 F32 mInitialValue;
94 F32 mMinValue; 91 F32 mMinValue;
diff --git a/linden/indra/llui/llsliderctrl.cpp b/linden/indra/llui/llsliderctrl.cpp
index 17854d0..58ab4ae 100644
--- a/linden/indra/llui/llsliderctrl.cpp
+++ b/linden/indra/llui/llsliderctrl.cpp
@@ -81,7 +81,7 @@ LLSliderCtrl::LLSliderCtrl(const LLString& name, const LLRect& rect,
81 mSliderMouseUpCallback( NULL ), 81 mSliderMouseUpCallback( NULL ),
82 mSliderMouseDownCallback( NULL ) 82 mSliderMouseDownCallback( NULL )
83{ 83{
84 S32 top = mRect.getHeight(); 84 S32 top = getRect().getHeight();
85 S32 bottom = 0; 85 S32 bottom = 0;
86 S32 left = 0; 86 S32 left = 0;
87 87
@@ -97,7 +97,7 @@ LLSliderCtrl::LLSliderCtrl(const LLString& name, const LLRect& rect,
97 addChild(mLabelBox); 97 addChild(mLabelBox);
98 } 98 }
99 99
100 S32 slider_right = mRect.getWidth(); 100 S32 slider_right = getRect().getWidth();
101 if( show_text ) 101 if( show_text )
102 { 102 {
103 slider_right = text_left - SLIDERCTRL_SPACING; 103 slider_right = text_left - SLIDERCTRL_SPACING;
@@ -115,7 +115,7 @@ LLSliderCtrl::LLSliderCtrl(const LLString& name, const LLRect& rect,
115 115
116 if( show_text ) 116 if( show_text )
117 { 117 {
118 LLRect text_rect( text_left, top, mRect.getWidth(), bottom ); 118 LLRect text_rect( text_left, top, getRect().getWidth(), bottom );
119 if( can_edit_text ) 119 if( can_edit_text )
120 { 120 {
121 mEditor = new LLLineEditor( "SliderCtrl Editor", text_rect, 121 mEditor = new LLLineEditor( "SliderCtrl Editor", text_rect,
@@ -144,10 +144,6 @@ LLSliderCtrl::LLSliderCtrl(const LLString& name, const LLRect& rect,
144 updateText(); 144 updateText();
145} 145}
146 146
147LLSliderCtrl::~LLSliderCtrl()
148{
149 // Children all cleaned up by default view destructor.
150}
151 147
152// static 148// static
153void LLSliderCtrl::onEditorGainFocus( LLFocusableElement* caller, void *userdata ) 149void LLSliderCtrl::onEditorGainFocus( LLFocusableElement* caller, void *userdata )
@@ -158,10 +154,6 @@ void LLSliderCtrl::onEditorGainFocus( LLFocusableElement* caller, void *userdata
158 self->onFocusReceived(); 154 self->onFocusReceived();
159} 155}
160 156
161F32 LLSliderCtrl::getValueF32() const
162{
163 return mSlider->getValueF32();
164}
165 157
166void LLSliderCtrl::setValue(F32 v, BOOL from_event) 158void LLSliderCtrl::setValue(F32 v, BOOL from_event)
167{ 159{
@@ -209,11 +201,6 @@ void LLSliderCtrl::clear()
209 201
210} 202}
211 203
212BOOL LLSliderCtrl::isMouseHeldDown()
213{
214 return mSlider->hasMouseCapture();
215}
216
217void LLSliderCtrl::updateText() 204void LLSliderCtrl::updateText()
218{ 205{
219 if( mEditor || mTextBox ) 206 if( mEditor || mTextBox )
@@ -427,18 +414,6 @@ void LLSliderCtrl::reportInvalidData()
427 make_ui_sound("UISndBadKeystroke"); 414 make_ui_sound("UISndBadKeystroke");
428} 415}
429 416
430//virtual
431LLString LLSliderCtrl::getControlName() const
432{
433 return mSlider->getControlName();
434}
435
436// virtual
437void LLSliderCtrl::setControlName(const LLString& control_name, LLView* context)
438{
439 mSlider->setControlName(control_name, context);
440}
441
442// virtual 417// virtual
443LLXMLNodePtr LLSliderCtrl::getXML(bool save_children) const 418LLXMLNodePtr LLSliderCtrl::getXML(bool save_children) const
444{ 419{
diff --git a/linden/indra/llui/llsliderctrl.h b/linden/indra/llui/llsliderctrl.h
index 7af0abf..705fa5c 100644
--- a/linden/indra/llui/llsliderctrl.h
+++ b/linden/indra/llui/llsliderctrl.h
@@ -1,6 +1,6 @@
1/** 1/**
2 * @file llsliderctrl.h 2 * @file llsliderctrl.h
3 * @brief LLSliderCtrl base class 3 * @brief Decorated wrapper for a LLSlider.
4 * 4 *
5 * $LicenseInfo:firstyear=2002&license=viewergpl$ 5 * $LicenseInfo:firstyear=2002&license=viewergpl$
6 * 6 *
@@ -44,13 +44,6 @@
44const S32 SLIDERCTRL_SPACING = 4; // space between label, slider, and text 44const S32 SLIDERCTRL_SPACING = 4; // space between label, slider, and text
45const S32 SLIDERCTRL_HEIGHT = 16; 45const S32 SLIDERCTRL_HEIGHT = 16;
46 46
47//
48// Classes
49//
50class LLFontGL;
51class LLLineEditor;
52class LLSlider;
53
54 47
55class LLSliderCtrl : public LLUICtrl 48class LLSliderCtrl : public LLUICtrl
56{ 49{
@@ -63,41 +56,41 @@ public:
63 S32 text_left, 56 S32 text_left,
64 BOOL show_text, 57 BOOL show_text,
65 BOOL can_edit_text, 58 BOOL can_edit_text,
66 BOOL volume, 59 BOOL volume, //TODO: create a "volume" slider sub-class or just use image art, no? -MG
67 void (*commit_callback)(LLUICtrl*, void*), 60 void (*commit_callback)(LLUICtrl*, void*),
68 void* callback_userdata, 61 void* callback_userdata,
69 F32 initial_value, F32 min_value, F32 max_value, F32 increment, 62 F32 initial_value, F32 min_value, F32 max_value, F32 increment,
70 const LLString& control_which = LLString::null ); 63 const LLString& control_which = LLString::null );
71 64
72 virtual ~LLSliderCtrl(); 65 virtual ~LLSliderCtrl() {} // Children all cleaned up by default view destructor.
73 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SLIDER; } 66 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SLIDER; }
74 virtual LLString getWidgetTag() const { return LL_SLIDER_CTRL_TAG; } 67 virtual LLString getWidgetTag() const { return LL_SLIDER_CTRL_TAG; }
75 virtual LLXMLNodePtr getXML(bool save_children = true) const; 68 virtual LLXMLNodePtr getXML(bool save_children = true) const;
76 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 69 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
77 70
78 F32 getValueF32() const; 71 F32 getValueF32() const { return mSlider->getValueF32(); }
79 void setValue(F32 v, BOOL from_event = FALSE); 72 void setValue(F32 v, BOOL from_event = FALSE);
80 73
81 virtual void setValue(const LLSD& value ) { setValue((F32)value.asReal(), TRUE); } 74 virtual void setValue(const LLSD& value) { setValue((F32)value.asReal(), TRUE); }
82 virtual LLSD getValue() const { return LLSD(getValueF32()); } 75 virtual LLSD getValue() const { return LLSD(getValueF32()); }
83 virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); 76 virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
84 77
85 virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); } 78 virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); }
86 virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); } 79 virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); }
87 80
88 BOOL isMouseHeldDown(); 81 BOOL isMouseHeldDown() const { return mSlider->hasMouseCapture(); }
89 82
90 virtual void setEnabled( BOOL b ); 83 virtual void setEnabled( BOOL b );
91 virtual void clear(); 84 virtual void clear();
92 virtual void setPrecision(S32 precision); 85 virtual void setPrecision(S32 precision);
93 void setMinValue(F32 min_value) {mSlider->setMinValue(min_value);} 86 void setMinValue(F32 min_value) { mSlider->setMinValue(min_value); updateText(); }
94 void setMaxValue(F32 max_value) {mSlider->setMaxValue(max_value);} 87 void setMaxValue(F32 max_value) { mSlider->setMaxValue(max_value); updateText(); }
95 void setIncrement(F32 increment) {mSlider->setIncrement(increment);} 88 void setIncrement(F32 increment) { mSlider->setIncrement(increment);}
96 89
97 F32 getMinValue() { return mSlider->getMinValue(); } 90 F32 getMinValue() { return mSlider->getMinValue(); }
98 F32 getMaxValue() { return mSlider->getMaxValue(); } 91 F32 getMaxValue() { return mSlider->getMaxValue(); }
99 92
100 void setLabel(const LLStringExplicit& label) { if (mLabelBox) mLabelBox->setText(label); } 93 void setLabel(const LLStringExplicit& label) { if (mLabelBox) mLabelBox->setText(label); }
101 void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; } 94 void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; }
102 void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; } 95 void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; }
103 96
@@ -109,8 +102,13 @@ public:
109 virtual void setTentative(BOOL b); // marks value as tentative 102 virtual void setTentative(BOOL b); // marks value as tentative
110 virtual void onCommit(); // mark not tentative, then commit 103 virtual void onCommit(); // mark not tentative, then commit
111 104
112 virtual void setControlName(const LLString& control_name, LLView* context); 105 virtual void setControlName(const LLString& control_name, LLView* context)
113 virtual LLString getControlName() const; 106 {
107 LLView::setControlName(control_name, context);
108 mSlider->setControlName(control_name, context);
109 }
110
111 virtual LLString getControlName() const { return mSlider->getControlName(); }
114 112
115 static void onSliderCommit(LLUICtrl* caller, void* userdata); 113 static void onSliderCommit(LLUICtrl* caller, void* userdata);
116 static void onSliderMouseDown(LLUICtrl* caller,void* userdata); 114 static void onSliderMouseDown(LLUICtrl* caller,void* userdata);
@@ -124,7 +122,6 @@ private:
124 void updateText(); 122 void updateText();
125 void reportInvalidData(); 123 void reportInvalidData();
126 124
127private:
128 const LLFontGL* mFont; 125 const LLFontGL* mFont;
129 BOOL mShowText; 126 BOOL mShowText;
130 BOOL mCanEditText; 127 BOOL mCanEditText;
@@ -136,7 +133,7 @@ private:
136 133
137 F32 mValue; 134 F32 mValue;
138 LLSlider* mSlider; 135 LLSlider* mSlider;
139 LLLineEditor* mEditor; 136 class LLLineEditor* mEditor;
140 LLTextBox* mTextBox; 137 LLTextBox* mTextBox;
141 138
142 LLColor4 mTextEnabledColor; 139 LLColor4 mTextEnabledColor;
diff --git a/linden/indra/llui/llspinctrl.cpp b/linden/indra/llui/llspinctrl.cpp
index 4bd79e6..98cdae1 100644
--- a/linden/indra/llui/llspinctrl.cpp
+++ b/linden/indra/llui/llspinctrl.cpp
@@ -72,7 +72,7 @@ LLSpinCtrl::LLSpinCtrl( const LLString& name, const LLRect& rect, const LLString
72 mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ), 72 mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ),
73 mbHasBeenSet( FALSE ) 73 mbHasBeenSet( FALSE )
74{ 74{
75 S32 top = mRect.getHeight(); 75 S32 top = getRect().getHeight();
76 S32 bottom = top - 2 * SPINCTRL_BTN_HEIGHT; 76 S32 bottom = top - 2 * SPINCTRL_BTN_HEIGHT;
77 S32 centered_top = top; 77 S32 centered_top = top;
78 S32 centered_bottom = bottom; 78 S32 centered_bottom = bottom;
@@ -121,7 +121,7 @@ LLSpinCtrl::LLSpinCtrl( const LLString& name, const LLRect& rect, const LLString
121 mDownBtn->setTabStop(FALSE); 121 mDownBtn->setTabStop(FALSE);
122 addChild(mDownBtn); 122 addChild(mDownBtn);
123 123
124 LLRect editor_rect( btn_right + 1, centered_top, mRect.getWidth(), centered_bottom ); 124 LLRect editor_rect( btn_right + 1, centered_top, getRect().getWidth(), centered_bottom );
125 mEditor = new LLLineEditor( "SpinCtrl Editor", editor_rect, "", font, 125 mEditor = new LLLineEditor( "SpinCtrl Editor", editor_rect, "", font,
126 MAX_STRING_LENGTH, 126 MAX_STRING_LENGTH,
127 &LLSpinCtrl::onEditorCommit, NULL, NULL, this, 127 &LLSpinCtrl::onEditorCommit, NULL, NULL, this,
@@ -140,11 +140,6 @@ LLSpinCtrl::LLSpinCtrl( const LLString& name, const LLRect& rect, const LLString
140 setUseBoundingRect( TRUE ); 140 setUseBoundingRect( TRUE );
141} 141}
142 142
143LLSpinCtrl::~LLSpinCtrl()
144{
145 // Children all cleaned up by default view destructor.
146}
147
148 143
149F32 clamp_precision(F32 value, S32 decimal_precision) 144F32 clamp_precision(F32 value, S32 decimal_precision)
150{ 145{
@@ -253,10 +248,6 @@ void LLSpinCtrl::setValue(const LLSD& value )
253 } 248 }
254} 249}
255 250
256LLSD LLSpinCtrl::getValue() const
257{
258 return mValue;
259}
260 251
261void LLSpinCtrl::clear() 252void LLSpinCtrl::clear()
262{ 253{
@@ -356,7 +347,7 @@ void LLSpinCtrl::setTentative(BOOL b)
356} 347}
357 348
358 349
359BOOL LLSpinCtrl::isMouseHeldDown() 350BOOL LLSpinCtrl::isMouseHeldDown() const
360{ 351{
361 return 352 return
362 mDownBtn->hasMouseCapture() 353 mDownBtn->hasMouseCapture()
@@ -366,9 +357,7 @@ BOOL LLSpinCtrl::isMouseHeldDown()
366void LLSpinCtrl::onCommit() 357void LLSpinCtrl::onCommit()
367{ 358{
368 setTentative(FALSE); 359 setTentative(FALSE);
369
370 setControlValue(mValue); 360 setControlValue(mValue);
371
372 LLUICtrl::onCommit(); 361 LLUICtrl::onCommit();
373} 362}
374 363
@@ -412,7 +401,7 @@ void LLSpinCtrl::draw()
412{ 401{
413 if( mLabelBox ) 402 if( mLabelBox )
414 { 403 {
415 mLabelBox->setColor( mEnabled ? mTextEnabledColor : mTextDisabledColor ); 404 mLabelBox->setColor( getEnabled() ? mTextEnabledColor : mTextDisabledColor );
416 } 405 }
417 LLUICtrl::draw(); 406 LLUICtrl::draw();
418} 407}
@@ -420,7 +409,7 @@ void LLSpinCtrl::draw()
420 409
421BOOL LLSpinCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) 410BOOL LLSpinCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks)
422{ 411{
423 if( mEnabled ) 412 if( getEnabled() )
424 { 413 {
425 if( clicks > 0 ) 414 if( clicks > 0 )
426 { 415 {
@@ -551,7 +540,3 @@ LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *
551 return spinner; 540 return spinner;
552} 541}
553 542
554BOOL LLSpinCtrl::isDirty() const
555{
556 return( mValue != mInitialValue );
557}
diff --git a/linden/indra/llui/llspinctrl.h b/linden/indra/llui/llspinctrl.h
index c5a36f5..f1f971e 100644
--- a/linden/indra/llui/llspinctrl.h
+++ b/linden/indra/llui/llspinctrl.h
@@ -1,6 +1,6 @@
1/** 1/**
2 * @file llspinctrl.h 2 * @file llspinctrl.h
3 * @brief LLSpinCtrl base class 3 * @brief Typical spinner with "up" and "down" arrow buttons.
4 * 4 *
5 * $LicenseInfo:firstyear=2002&license=viewergpl$ 5 * $LicenseInfo:firstyear=2002&license=viewergpl$
6 * 6 *
@@ -47,15 +47,6 @@ const S32 SPINCTRL_SPACING = 2; // space between label right and button
47const S32 SPINCTRL_HEIGHT = 2 * SPINCTRL_BTN_HEIGHT; 47const S32 SPINCTRL_HEIGHT = 2 * SPINCTRL_BTN_HEIGHT;
48const S32 SPINCTRL_DEFAULT_LABEL_WIDTH = 10; 48const S32 SPINCTRL_DEFAULT_LABEL_WIDTH = 10;
49 49
50//
51// Classes
52//
53class LLFontGL;
54class LLButton;
55class LLTextBox;
56class LLLineEditor;
57class LLUICtrlFactory;
58
59 50
60class LLSpinCtrl 51class LLSpinCtrl
61: public LLUICtrl 52: public LLUICtrl
@@ -70,31 +61,33 @@ public:
70 const LLString& control_name = LLString(), 61 const LLString& control_name = LLString(),
71 S32 label_width = SPINCTRL_DEFAULT_LABEL_WIDTH ); 62 S32 label_width = SPINCTRL_DEFAULT_LABEL_WIDTH );
72 63
73 virtual ~LLSpinCtrl(); 64 virtual ~LLSpinCtrl() {} // Children all cleaned up by default view destructor.
74 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SPINNER; } 65 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_SPINNER; }
75 virtual LLString getWidgetTag() const { return LL_SPIN_CTRL_TAG; } 66 virtual LLString getWidgetTag() const { return LL_SPIN_CTRL_TAG; }
76 virtual LLXMLNodePtr getXML(bool save_children = true) const; 67 virtual LLXMLNodePtr getXML(bool save_children = true) const;
77 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 68 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory);
78 69
79 virtual void setValue(const LLSD& value ); 70 virtual void setValue(const LLSD& value );
80 virtual LLSD getValue() const; 71 virtual LLSD getValue() const { return mValue; }
81 F32 get() { return (F32)getValue().asReal(); } 72 F32 get() const { return (F32)getValue().asReal(); }
82 void set(F32 value) { setValue(value); mInitialValue = value; } 73 void set(F32 value) { setValue(value); mInitialValue = value; }
83 74
84 virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); } 75 virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); }
85 virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); } 76 virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); }
86 77
87 BOOL isMouseHeldDown(); 78 BOOL isMouseHeldDown() const;
88 79
89 virtual void setEnabled( BOOL b ); 80 virtual void setEnabled( BOOL b );
90 virtual void setFocus( BOOL b ); 81 virtual void setFocus( BOOL b );
91 virtual void clear(); 82 virtual void clear();
92 virtual BOOL isDirty() const; 83 virtual BOOL isDirty() const { return( mValue != mInitialValue ); }
93 84
94 virtual void setPrecision(S32 precision); 85 virtual void setPrecision(S32 precision);
95 virtual void setMinValue(F32 min) { mMinValue = min; } 86 virtual void setMinValue(F32 min) { mMinValue = min; }
96 virtual void setMaxValue(F32 max) { mMaxValue = max; } 87 virtual void setMaxValue(F32 max) { mMaxValue = max; }
97 virtual void setIncrement(F32 inc) { mIncrement = inc; } 88 virtual void setIncrement(F32 inc) { mIncrement = inc; }
89 virtual F32 getMinValue() { return mMinValue ; }
90 virtual F32 getMaxValue() { return mMaxValue ; }
98 91
99 void setLabel(const LLStringExplicit& label); 92 void setLabel(const LLStringExplicit& label);
100 void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; } 93 void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; }
@@ -119,12 +112,10 @@ public:
119 static void onUpBtn(void *userdata); 112 static void onUpBtn(void *userdata);
120 static void onDownBtn(void *userdata); 113 static void onDownBtn(void *userdata);
121 114
122protected: 115private:
123 void updateEditor(); 116 void updateEditor();
124 void reportInvalidData(); 117 void reportInvalidData();
125 118
126protected:
127
128 F32 mValue; 119 F32 mValue;
129 F32 mInitialValue; 120 F32 mInitialValue;
130 F32 mMaxValue; 121 F32 mMaxValue;
@@ -132,14 +123,14 @@ protected:
132 F32 mIncrement; 123 F32 mIncrement;
133 124
134 S32 mPrecision; 125 S32 mPrecision;
135 LLTextBox* mLabelBox; 126 class LLTextBox* mLabelBox;
136 127
137 LLLineEditor* mEditor; 128 class LLLineEditor* mEditor;
138 LLColor4 mTextEnabledColor; 129 LLColor4 mTextEnabledColor;
139 LLColor4 mTextDisabledColor; 130 LLColor4 mTextDisabledColor;
140 131
141 LLButton* mUpBtn; 132 class LLButton* mUpBtn;
142 LLButton* mDownBtn; 133 class LLButton* mDownBtn;
143 134
144 BOOL mbHasBeenSet; 135 BOOL mbHasBeenSet;
145}; 136};
diff --git a/linden/indra/llui/llstyle.cpp b/linden/indra/llui/llstyle.cpp
index 693e0be..cdf87d3 100644
--- a/linden/indra/llui/llstyle.cpp
+++ b/linden/indra/llui/llstyle.cpp
@@ -71,11 +71,6 @@ LLStyle::LLStyle(BOOL is_visible, const LLColor4 &color, const LLString& font_na
71 init(is_visible, color, font_name); 71 init(is_visible, color, font_name);
72} 72}
73 73
74LLStyle::~LLStyle()
75{
76 free();
77}
78
79void LLStyle::init(BOOL is_visible, const LLColor4 &color, const LLString& font_name) 74void LLStyle::init(BOOL is_visible, const LLColor4 &color, const LLString& font_name)
80{ 75{
81 mVisible = is_visible; 76 mVisible = is_visible;
@@ -91,14 +86,6 @@ void LLStyle::init(BOOL is_visible, const LLColor4 &color, const LLString& font_
91 mIsEmbeddedItem = FALSE; 86 mIsEmbeddedItem = FALSE;
92} 87}
93 88
94void LLStyle::free()
95{
96}
97
98LLFONT_ID LLStyle::getFontID() const
99{
100 return mFontID;
101}
102 89
103// Copy assignment 90// Copy assignment
104LLStyle &LLStyle::operator=(const LLStyle &rhs) 91LLStyle &LLStyle::operator=(const LLStyle &rhs)
@@ -122,48 +109,6 @@ LLStyle &LLStyle::operator=(const LLStyle &rhs)
122 return *this; 109 return *this;
123} 110}
124 111
125// Compare
126bool LLStyle::operator==(const LLStyle &rhs) const
127{
128 if ((mVisible != rhs.isVisible())
129 || (mColor != rhs.getColor())
130 || (mFontName != rhs.getFontString())
131 || (mLink != rhs.getLinkHREF())
132 || (mImagep != rhs.mImagep)
133 || (mImageHeight != rhs.mImageHeight)
134 || (mImageWidth != rhs.mImageWidth)
135 || (mItalic != rhs.mItalic)
136 || (mBold != rhs.mBold)
137 || (mUnderline != rhs.mUnderline)
138 || (mDropShadow != rhs.mDropShadow)
139 || (mIsEmbeddedItem != rhs.mIsEmbeddedItem)
140 )
141 {
142 return FALSE;
143 }
144 return TRUE;
145}
146
147bool LLStyle::operator!=(const LLStyle& rhs) const
148{
149 return !(*this == rhs);
150}
151
152
153const LLColor4& LLStyle::getColor() const
154{
155 return(mColor);
156}
157
158void LLStyle::setColor(const LLColor4 &color)
159{
160 mColor = color;
161}
162
163const LLString& LLStyle::getFontString() const
164{
165 return mFontName;
166}
167 112
168void LLStyle::setFontName(const LLString& fontname) 113void LLStyle::setFontName(const LLString& fontname)
169{ 114{
@@ -192,52 +137,15 @@ void LLStyle::setFontName(const LLString& fontname)
192 } 137 }
193} 138}
194 139
195const LLString& LLStyle::getLinkHREF() const
196{
197 return mLink;
198}
199
200void LLStyle::setLinkHREF(const LLString& href)
201{
202 mLink = href;
203}
204
205BOOL LLStyle::isLink() const
206{
207 return mLink.size();
208}
209
210BOOL LLStyle::isVisible() const
211{
212 return mVisible;
213}
214
215void LLStyle::setVisible(BOOL is_visible)
216{
217 mVisible = is_visible;
218}
219
220LLImageGL *LLStyle::getImage() const
221{
222 return mImagep;
223}
224 140
225void LLStyle::setImage(const LLString& src) 141void LLStyle::setImage(const LLString& src)
226{ 142{
227 if (src.size() < UUID_STR_LENGTH - 1) 143 if (src.size() >= UUID_STR_LENGTH - 1)
228 {
229 return;
230 }
231 else
232 { 144 {
233 mImagep = LLUI::sImageProvider->getImageByID(LLUUID(src)); 145 mImagep = LLUI::sImageProvider->getImageByID(LLUUID(src));
234 } 146 }
235} 147}
236 148
237BOOL LLStyle::isImage() const
238{
239 return ((mImageWidth != 0) && (mImageHeight != 0));
240}
241 149
242void LLStyle::setImageSize(S32 width, S32 height) 150void LLStyle::setImageSize(S32 width, S32 height)
243{ 151{
diff --git a/linden/indra/llui/llstyle.h b/linden/indra/llui/llstyle.h
index 1712dc0..d6ae900 100644
--- a/linden/indra/llui/llstyle.h
+++ b/linden/indra/llui/llstyle.h
@@ -46,36 +46,52 @@ public:
46 46
47 LLStyle &operator=(const LLStyle &rhs); 47 LLStyle &operator=(const LLStyle &rhs);
48 48
49 virtual ~LLStyle(); 49 virtual ~LLStyle() { }
50 50
51 virtual void init (BOOL is_visible, const LLColor4 &color, const LLString& font_name); 51 virtual void init (BOOL is_visible, const LLColor4 &color, const LLString& font_name);
52 virtual void free ();
53 52
54 bool operator==(const LLStyle &rhs) const; 53 virtual const LLColor4& getColor() const { return mColor; }
55 bool operator!=(const LLStyle &rhs) const; 54 virtual void setColor(const LLColor4 &color) { mColor = color; }
56 55
57 virtual const LLColor4& getColor() const; 56 virtual BOOL isVisible() const { return mVisible; }
58 virtual void setColor(const LLColor4 &color); 57 virtual void setVisible(BOOL is_visible) { mVisible = is_visible; }
59 58
60 virtual BOOL isVisible() const; 59 virtual const LLString& getFontString() const { return mFontName; }
61 virtual void setVisible(BOOL is_visible);
62
63 virtual const LLString& getFontString() const;
64 virtual void setFontName(const LLString& fontname); 60 virtual void setFontName(const LLString& fontname);
65 virtual LLFONT_ID getFontID() const; 61 virtual LLFONT_ID getFontID() const { return mFontID; }
66 62
67 virtual const LLString& getLinkHREF() const; 63 virtual const LLString& getLinkHREF() const { return mLink; }
68 virtual void setLinkHREF(const LLString& fontname); 64 virtual void setLinkHREF(const LLString& href) { mLink = href; }
69 virtual BOOL isLink() const; 65 virtual BOOL isLink() const { return mLink.size(); }
70 66
71 virtual LLImageGL *getImage() const; 67 virtual LLImageGL *getImage() const { return mImagep; }
72 virtual void setImage(const LLString& src); 68 virtual void setImage(const LLString& src);
73 virtual BOOL isImage() const; 69 virtual BOOL isImage() const { return ((mImageWidth != 0) && (mImageHeight != 0)); }
74 virtual void setImageSize(S32 width, S32 height); 70 virtual void setImageSize(S32 width, S32 height);
75 71
76 BOOL getIsEmbeddedItem() const { return mIsEmbeddedItem; } 72 BOOL getIsEmbeddedItem() const { return mIsEmbeddedItem; }
77 void setIsEmbeddedItem( BOOL b ) { mIsEmbeddedItem = b; } 73 void setIsEmbeddedItem( BOOL b ) { mIsEmbeddedItem = b; }
78 74
75 // inlined here to make it easier to compare to member data below. -MG
76 bool operator==(const LLStyle &rhs) const
77 {
78 return
79 mVisible == rhs.isVisible()
80 && mColor == rhs.getColor()
81 && mFontName == rhs.getFontString()
82 && mLink == rhs.getLinkHREF()
83 && mImagep == rhs.mImagep
84 && mImageHeight == rhs.mImageHeight
85 && mImageWidth == rhs.mImageWidth
86 && mItalic == rhs.mItalic
87 && mBold == rhs.mBold
88 && mUnderline == rhs.mUnderline
89 && mDropShadow == rhs.mDropShadow
90 && mIsEmbeddedItem == rhs.mIsEmbeddedItem;
91 }
92
93 bool operator!=(const LLStyle& rhs) const { return !(*this == rhs); }
94
79public: 95public:
80 BOOL mItalic; 96 BOOL mItalic;
81 BOOL mBold; 97 BOOL mBold;
@@ -84,14 +100,13 @@ public:
84 S32 mImageWidth; 100 S32 mImageWidth;
85 S32 mImageHeight; 101 S32 mImageHeight;
86 102
87protected: 103private:
88 BOOL mVisible; 104 BOOL mVisible;
89 LLColor4 mColor; 105 LLColor4 mColor;
90 LLString mFontName; 106 LLString mFontName;
91 LLFONT_ID mFontID; 107 LLFONT_ID mFontID;
92 LLString mLink; 108 LLString mLink;
93 LLPointer<LLImageGL> mImagep; 109 LLPointer<LLImageGL> mImagep;
94
95 BOOL mIsEmbeddedItem; 110 BOOL mIsEmbeddedItem;
96}; 111};
97 112
diff --git a/linden/indra/llui/lltabcontainer.cpp b/linden/indra/llui/lltabcontainer.cpp
index 0400b50..e632cf1 100644
--- a/linden/indra/llui/lltabcontainer.cpp
+++ b/linden/indra/llui/lltabcontainer.cpp
@@ -1,6 +1,6 @@
1/** 1/**
2 * @file lltabcontainer.cpp 2 * @file lltabcontainer.cpp
3 * @brief LLTabContainerCommon base class 3 * @brief LLTabContainer class
4 * 4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$ 5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 * 6 *
@@ -30,33 +30,24 @@
30 */ 30 */
31 31
32#include "linden_common.h" 32#include "linden_common.h"
33
34#include "lltabcontainer.h" 33#include "lltabcontainer.h"
35
36#include "llfocusmgr.h" 34#include "llfocusmgr.h"
37#include "llfontgl.h"
38#include "llgl.h"
39
40#include "llbutton.h" 35#include "llbutton.h"
41#include "llrect.h" 36#include "llrect.h"
42#include "llpanel.h"
43#include "llresmgr.h" 37#include "llresmgr.h"
44#include "llkeyboard.h"
45#include "llresizehandle.h" 38#include "llresizehandle.h"
46#include "llui.h"
47#include "lltextbox.h" 39#include "lltextbox.h"
48#include "llcontrol.h"
49#include "llcriticaldamp.h" 40#include "llcriticaldamp.h"
50#include "lluictrlfactory.h" 41#include "lluictrlfactory.h"
51
52#include "lltabcontainervertical.h" 42#include "lltabcontainervertical.h"
43#include "llglimmediate.h"
53 44
54#include "llglheaders.h"
55 45
56const F32 SCROLL_STEP_TIME = 0.4f; 46const F32 SCROLL_STEP_TIME = 0.4f;
57const F32 SCROLL_DELAY_TIME = 0.5f; 47const F32 SCROLL_DELAY_TIME = 0.5f;
58const S32 TAB_PADDING = 15; 48const S32 TAB_PADDING = 15;
59const S32 TABCNTR_TAB_MIN_WIDTH = 60; 49const S32 TABCNTR_TAB_MIN_WIDTH = 60;
50const S32 TABCNTR_VERT_TAB_MIN_WIDTH = 100;
60const S32 TABCNTR_TAB_MAX_WIDTH = 150; 51const S32 TABCNTR_TAB_MAX_WIDTH = 150;
61const S32 TABCNTR_TAB_PARTIAL_WIDTH = 12; // When tabs are parially obscured, how much can you still see. 52const S32 TABCNTR_TAB_PARTIAL_WIDTH = 12; // When tabs are parially obscured, how much can you still see.
62const S32 TABCNTR_TAB_HEIGHT = 16; 53const S32 TABCNTR_TAB_HEIGHT = 16;
@@ -64,12 +55,19 @@ const S32 TABCNTR_ARROW_BTN_SIZE = 16;
64const S32 TABCNTR_BUTTON_PANEL_OVERLAP = 1; // how many pixels the tab buttons and tab panels overlap. 55const S32 TABCNTR_BUTTON_PANEL_OVERLAP = 1; // how many pixels the tab buttons and tab panels overlap.
65const S32 TABCNTR_TAB_H_PAD = 4; 56const S32 TABCNTR_TAB_H_PAD = 4;
66 57
58const S32 TABCNTR_CLOSE_BTN_SIZE = 16;
59const S32 TABCNTR_HEADER_HEIGHT = LLPANEL_BORDER_WIDTH + TABCNTR_CLOSE_BTN_SIZE;
60
61const S32 TABCNTRV_CLOSE_BTN_SIZE = 16;
62const S32 TABCNTRV_HEADER_HEIGHT = LLPANEL_BORDER_WIDTH + TABCNTRV_CLOSE_BTN_SIZE;
63//const S32 TABCNTRV_TAB_WIDTH = 100;
64const S32 TABCNTRV_ARROW_BTN_SIZE = 16;
65const S32 TABCNTRV_PAD = 0;
66
67 67
68LLTabContainerCommon::LLTabContainerCommon( 68
69 const LLString& name, const LLRect& rect, 69LLTabContainer::LLTabContainer(const LLString& name, const LLRect& rect, TabPosition pos,
70 TabPosition pos, 70 BOOL bordered, BOOL is_vertical )
71 void(*close_callback)(void*), void* callback_userdata,
72 BOOL bordered )
73 : 71 :
74 LLPanel(name, rect, bordered), 72 LLPanel(name, rect, bordered),
75 mCurrentTabIdx(-1), 73 mCurrentTabIdx(-1),
@@ -78,50 +76,65 @@ LLTabContainerCommon::LLTabContainerCommon(
78 mScrollPos(0), 76 mScrollPos(0),
79 mScrollPosPixels(0), 77 mScrollPosPixels(0),
80 mMaxScrollPos(0), 78 mMaxScrollPos(0),
81 mCloseCallback( close_callback ), 79 mCloseCallback( NULL ),
82 mCallbackUserdata( callback_userdata ), 80 mCallbackUserdata( NULL ),
83 mTitleBox(NULL), 81 mTitleBox(NULL),
84 mTopBorderHeight(LLPANEL_BORDER_WIDTH), 82 mTopBorderHeight(LLPANEL_BORDER_WIDTH),
85 mTabPosition(pos), 83 mTabPosition(pos),
86 mLockedTabCount(0) 84 mLockedTabCount(0),
85 mMinTabWidth(TABCNTR_TAB_MIN_WIDTH),
86 mMaxTabWidth(TABCNTR_TAB_MAX_WIDTH),
87 mPrevArrowBtn(NULL),
88 mNextArrowBtn(NULL),
89 mIsVertical(is_vertical),
90 // Horizontal Specific
91 mJumpPrevArrowBtn(NULL),
92 mJumpNextArrowBtn(NULL),
93 mRightTabBtnOffset(0),
94 mTotalTabWidth(0)
87{ 95{
96 //RN: HACK to support default min width for legacy vertical tab containers
97 if (mIsVertical)
98 {
99 mMinTabWidth = TABCNTR_VERT_TAB_MIN_WIDTH;
100 }
88 setMouseOpaque(FALSE); 101 setMouseOpaque(FALSE);
102 initButtons( );
89 mDragAndDropDelayTimer.stop(); 103 mDragAndDropDelayTimer.stop();
90} 104}
91 105
106LLTabContainer::~LLTabContainer()
107{
108 std::for_each(mTabList.begin(), mTabList.end(), DeletePointer());
109}
92 110
93LLTabContainerCommon::LLTabContainerCommon( 111//virtual
94 const LLString& name, 112void LLTabContainer::setValue(const LLSD& value)
95 const LLString& rect_control,
96 TabPosition pos,
97 void(*close_callback)(void*), void* callback_userdata,
98 BOOL bordered )
99 :
100 LLPanel(name, rect_control, bordered),
101 mCurrentTabIdx(-1),
102 mTabsHidden(FALSE),
103 mScrolled(FALSE),
104 mScrollPos(0),
105 mScrollPosPixels(0),
106 mMaxScrollPos(0),
107 mCloseCallback( close_callback ),
108 mCallbackUserdata( callback_userdata ),
109 mTitleBox(NULL),
110 mTopBorderHeight(LLPANEL_BORDER_WIDTH),
111 mTabPosition(pos),
112 mLockedTabCount(0)
113{ 113{
114 setMouseOpaque(FALSE); 114 selectTab((S32) value.asInteger());
115 mDragAndDropDelayTimer.stop();
116} 115}
117 116
117//virtual
118EWidgetType LLTabContainer::getWidgetType() const
119{
120 return WIDGET_TYPE_TAB_CONTAINER;
121}
118 122
119LLTabContainerCommon::~LLTabContainerCommon() 123//virtual
124LLString LLTabContainer::getWidgetTag() const
120{ 125{
121 std::for_each(mTabList.begin(), mTabList.end(), DeletePointer()); 126 return LL_TAB_CONTAINER_COMMON_TAG;
122} 127}
123 128
124LLView* LLTabContainerCommon::getChildByName(const LLString& name, BOOL recurse) const 129//virtual
130void LLTabContainer::reshape(S32 width, S32 height, BOOL called_from_parent)
131{
132 LLPanel::reshape( width, height, called_from_parent );
133 updateMaxScrollPos();
134}
135
136//virtual
137LLView* LLTabContainer::getChildByName(const LLString& name, BOOL recurse) const
125{ 138{
126 tuple_list_t::const_iterator itor; 139 tuple_list_t::const_iterator itor;
127 for (itor = mTabList.begin(); itor != mTabList.end(); ++itor) 140 for (itor = mTabList.begin(); itor != mTabList.end(); ++itor)
@@ -137,7 +150,7 @@ LLView* LLTabContainerCommon::getChildByName(const LLString& name, BOOL recurse)
137 for (itor = mTabList.begin(); itor != mTabList.end(); ++itor) 150 for (itor = mTabList.begin(); itor != mTabList.end(); ++itor)
138 { 151 {
139 LLPanel *panel = (*itor)->mTabPanel; 152 LLPanel *panel = (*itor)->mTabPanel;
140 LLView *child = panel->getChildByName(name, recurse); 153 LLView *child = panel->getChild<LLView>(name, recurse);
141 if (child) 154 if (child)
142 { 155 {
143 return child; 156 return child;
@@ -147,25 +160,753 @@ LLView* LLTabContainerCommon::getChildByName(const LLString& name, BOOL recurse)
147 return LLView::getChildByName(name, recurse); 160 return LLView::getChildByName(name, recurse);
148} 161}
149 162
150void LLTabContainerCommon::addPlaceholder(LLPanel* child, const LLString& label) 163// virtual
164void LLTabContainer::draw()
151{ 165{
152 addTabPanel(child, label, FALSE, NULL, NULL, 0, TRUE); 166 S32 target_pixel_scroll = 0;
167 S32 cur_scroll_pos = mIsVertical ? 0 : getScrollPos();
168 if (cur_scroll_pos > 0)
169 {
170 S32 available_width_with_arrows = getRect().getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1);
171 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
172 {
173 if (cur_scroll_pos == 0)
174 {
175 break;
176 }
177 target_pixel_scroll += (*iter)->mButton->getRect().getWidth();
178 cur_scroll_pos--;
179 }
180
181 // Show part of the tab to the left of what is fully visible
182 target_pixel_scroll -= TABCNTR_TAB_PARTIAL_WIDTH;
183 // clamp so that rightmost tab never leaves right side of screen
184 target_pixel_scroll = llmin(mTotalTabWidth - available_width_with_arrows, target_pixel_scroll);
185 }
186
187 setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f)));
188 if( getVisible() )
189 {
190 BOOL has_scroll_arrows = (mMaxScrollPos > 0) || (mScrollPosPixels > 0);
191 if (!mIsVertical)
192 {
193 mJumpPrevArrowBtn->setVisible( has_scroll_arrows );
194 mJumpNextArrowBtn->setVisible( has_scroll_arrows );
195 }
196 mPrevArrowBtn->setVisible( has_scroll_arrows );
197 mNextArrowBtn->setVisible( has_scroll_arrows );
198
199 S32 left = 0, top = 0;
200 if (mIsVertical)
201 {
202 top = getRect().getHeight() - getTopBorderHeight() - LLPANEL_BORDER_WIDTH - 1 - (has_scroll_arrows ? TABCNTRV_ARROW_BTN_SIZE : 0);
203 top += getScrollPosPixels();
204 }
205 else
206 {
207 // Set the leftmost position of the tab buttons.
208 left = LLPANEL_BORDER_WIDTH + (has_scroll_arrows ? (TABCNTR_ARROW_BTN_SIZE * 2) : TABCNTR_TAB_H_PAD);
209 left -= getScrollPosPixels();
210 }
211
212 // Hide all the buttons
213 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
214 {
215 LLTabTuple* tuple = *iter;
216 tuple->mButton->setVisible( FALSE );
217 }
218
219 LLPanel::draw();
220
221 // if tabs are hidden, don't draw them and leave them in the invisible state
222 if (!getTabsHidden())
223 {
224 // Show all the buttons
225 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
226 {
227 LLTabTuple* tuple = *iter;
228 tuple->mButton->setVisible( TRUE );
229 }
230
231 // Draw some of the buttons...
232 LLRect clip_rect = getLocalRect();
233 if (has_scroll_arrows)
234 {
235 // ...but clip them.
236 if (mIsVertical)
237 {
238 clip_rect.mBottom = mNextArrowBtn->getRect().mTop + 3*TABCNTRV_PAD;
239 clip_rect.mTop = mPrevArrowBtn->getRect().mBottom - 3*TABCNTRV_PAD;
240 }
241 else
242 {
243 clip_rect.mLeft = mPrevArrowBtn->getRect().mRight;
244 clip_rect.mRight = mNextArrowBtn->getRect().mLeft;
245 }
246 }
247 LLLocalClipRect clip(clip_rect);
248
249 S32 max_scroll_visible = getTabCount() - getMaxScrollPos() + getScrollPos();
250 S32 idx = 0;
251 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
252 {
253 LLTabTuple* tuple = *iter;
254
255 tuple->mButton->translate( left ? left - tuple->mButton->getRect().mLeft : 0,
256 top ? top - tuple->mButton->getRect().mTop : 0 );
257 if (top) top -= BTN_HEIGHT + TABCNTRV_PAD;
258 if (left) left += tuple->mButton->getRect().getWidth();
259
260 if (!mIsVertical)
261 {
262 if( idx < getScrollPos() )
263 {
264 if( tuple->mButton->getFlashing() )
265 {
266 mPrevArrowBtn->setFlashing( TRUE );
267 }
268 }
269 else if( max_scroll_visible < idx )
270 {
271 if( tuple->mButton->getFlashing() )
272 {
273 mNextArrowBtn->setFlashing( TRUE );
274 }
275 }
276 }
277 LLUI::pushMatrix();
278 {
279 LLUI::translate((F32)tuple->mButton->getRect().mLeft, (F32)tuple->mButton->getRect().mBottom, 0.f);
280 tuple->mButton->draw();
281 }
282 LLUI::popMatrix();
283
284 idx++;
285 }
286
287
288 if( mIsVertical && has_scroll_arrows )
289 {
290 // Redraw the arrows so that they appears on top.
291 gGL.pushMatrix();
292 gGL.translatef((F32)mPrevArrowBtn->getRect().mLeft, (F32)mPrevArrowBtn->getRect().mBottom, 0.f);
293 mPrevArrowBtn->draw();
294 gGL.popMatrix();
295
296 gGL.pushMatrix();
297 gGL.translatef((F32)mNextArrowBtn->getRect().mLeft, (F32)mNextArrowBtn->getRect().mBottom, 0.f);
298 mNextArrowBtn->draw();
299 gGL.popMatrix();
300 }
301 }
302
303 mPrevArrowBtn->setFlashing(FALSE);
304 mNextArrowBtn->setFlashing(FALSE);
305 }
153} 306}
154 307
155void LLTabContainerCommon::lockTabs(S32 num_tabs) 308
309// virtual
310BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask )
156{ 311{
157 // count current tabs or use supplied value and ensure no new tabs get 312 BOOL handled = FALSE;
158 // inserted between them 313 BOOL has_scroll_arrows = (getMaxScrollPos() > 0);
159 mLockedTabCount = num_tabs > 0 ? llmin(getTabCount(), num_tabs) : getTabCount(); 314
315 if (has_scroll_arrows)
316 {
317 if (mJumpPrevArrowBtn&& mJumpPrevArrowBtn->getRect().pointInRect(x, y))
318 {
319 S32 local_x = x - mJumpPrevArrowBtn->getRect().mLeft;
320 S32 local_y = y - mJumpPrevArrowBtn->getRect().mBottom;
321 handled = mJumpPrevArrowBtn->handleMouseDown(local_x, local_y, mask);
322 }
323 else if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y))
324 {
325 S32 local_x = x - mJumpNextArrowBtn->getRect().mLeft;
326 S32 local_y = y - mJumpNextArrowBtn->getRect().mBottom;
327 handled = mJumpNextArrowBtn->handleMouseDown(local_x, local_y, mask);
328 }
329 else if (mPrevArrowBtn && mPrevArrowBtn->getRect().pointInRect(x, y))
330 {
331 S32 local_x = x - mPrevArrowBtn->getRect().mLeft;
332 S32 local_y = y - mPrevArrowBtn->getRect().mBottom;
333 handled = mPrevArrowBtn->handleMouseDown(local_x, local_y, mask);
334 }
335 else if (mNextArrowBtn && mNextArrowBtn->getRect().pointInRect(x, y))
336 {
337 S32 local_x = x - mNextArrowBtn->getRect().mLeft;
338 S32 local_y = y - mNextArrowBtn->getRect().mBottom;
339 handled = mNextArrowBtn->handleMouseDown(local_x, local_y, mask);
340 }
341 }
342 if (!handled)
343 {
344 handled = LLPanel::handleMouseDown( x, y, mask );
345 }
346
347 S32 tab_count = getTabCount();
348 if (tab_count > 0)
349 {
350 LLTabTuple* firsttuple = getTab(0);
351 LLRect tab_rect;
352 if (mIsVertical)
353 {
354 tab_rect = LLRect(firsttuple->mButton->getRect().mLeft,
355 has_scroll_arrows ? mPrevArrowBtn->getRect().mBottom - TABCNTRV_PAD : mPrevArrowBtn->getRect().mTop,
356 firsttuple->mButton->getRect().mRight,
357 has_scroll_arrows ? mNextArrowBtn->getRect().mTop + TABCNTRV_PAD : mNextArrowBtn->getRect().mBottom );
358 }
359 else
360 {
361 tab_rect = LLRect(has_scroll_arrows ? mPrevArrowBtn->getRect().mRight : mJumpPrevArrowBtn->getRect().mLeft,
362 firsttuple->mButton->getRect().mTop,
363 has_scroll_arrows ? mNextArrowBtn->getRect().mLeft : mJumpNextArrowBtn->getRect().mRight,
364 firsttuple->mButton->getRect().mBottom );
365 }
366 if( tab_rect.pointInRect( x, y ) )
367 {
368 S32 index = getCurrentPanelIndex();
369 index = llclamp(index, 0, tab_count-1);
370 LLButton* tab_button = getTab(index)->mButton;
371 gFocusMgr.setMouseCapture(this);
372 gFocusMgr.setKeyboardFocus(tab_button);
373 }
374 }
375 return handled;
376}
377
378// virtual
379BOOL LLTabContainer::handleHover( S32 x, S32 y, MASK mask )
380{
381 BOOL handled = FALSE;
382 BOOL has_scroll_arrows = (getMaxScrollPos() > 0);
383
384 if (has_scroll_arrows)
385 {
386 if (mJumpPrevArrowBtn && mJumpPrevArrowBtn->getRect().pointInRect(x, y))
387 {
388 S32 local_x = x - mJumpPrevArrowBtn->getRect().mLeft;
389 S32 local_y = y - mJumpPrevArrowBtn->getRect().mBottom;
390 handled = mJumpPrevArrowBtn->handleHover(local_x, local_y, mask);
391 }
392 else if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y))
393 {
394 S32 local_x = x - mJumpNextArrowBtn->getRect().mLeft;
395 S32 local_y = y - mJumpNextArrowBtn->getRect().mBottom;
396 handled = mJumpNextArrowBtn->handleHover(local_x, local_y, mask);
397 }
398 else if (mPrevArrowBtn && mPrevArrowBtn->getRect().pointInRect(x, y))
399 {
400 S32 local_x = x - mPrevArrowBtn->getRect().mLeft;
401 S32 local_y = y - mPrevArrowBtn->getRect().mBottom;
402 handled = mPrevArrowBtn->handleHover(local_x, local_y, mask);
403 }
404 else if (mNextArrowBtn && mNextArrowBtn->getRect().pointInRect(x, y))
405 {
406 S32 local_x = x - mNextArrowBtn->getRect().mLeft;
407 S32 local_y = y - mNextArrowBtn->getRect().mBottom;
408 handled = mNextArrowBtn->handleHover(local_x, local_y, mask);
409 }
410 }
411 if (!handled)
412 {
413 handled = LLPanel::handleHover(x, y, mask);
414 }
415
416 commitHoveredButton(x, y);
417 return handled;
160} 418}
161 419
162void LLTabContainerCommon::unlockTabs() 420// virtual
421BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask )
163{ 422{
164 mLockedTabCount = 0; 423 BOOL handled = FALSE;
424 BOOL has_scroll_arrows = (getMaxScrollPos() > 0);
425
426 if (has_scroll_arrows)
427 {
428 if (mJumpPrevArrowBtn && mJumpPrevArrowBtn->getRect().pointInRect(x, y))
429 {
430 S32 local_x = x - mJumpPrevArrowBtn->getRect().mLeft;
431 S32 local_y = y - mJumpPrevArrowBtn->getRect().mBottom;
432 handled = mJumpPrevArrowBtn->handleMouseUp(local_x, local_y, mask);
433 }
434 else if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y))
435 {
436 S32 local_x = x - mJumpNextArrowBtn->getRect().mLeft;
437 S32 local_y = y - mJumpNextArrowBtn->getRect().mBottom;
438 handled = mJumpNextArrowBtn->handleMouseUp(local_x, local_y, mask);
439 }
440 else if (mPrevArrowBtn && mPrevArrowBtn->getRect().pointInRect(x, y))
441 {
442 S32 local_x = x - mPrevArrowBtn->getRect().mLeft;
443 S32 local_y = y - mPrevArrowBtn->getRect().mBottom;
444 handled = mPrevArrowBtn->handleMouseUp(local_x, local_y, mask);
445 }
446 else if (mNextArrowBtn && mNextArrowBtn->getRect().pointInRect(x, y))
447 {
448 S32 local_x = x - mNextArrowBtn->getRect().mLeft;
449 S32 local_y = y - mNextArrowBtn->getRect().mBottom;
450 handled = mNextArrowBtn->handleMouseUp(local_x, local_y, mask);
451 }
452 }
453 if (!handled)
454 {
455 handled = LLPanel::handleMouseUp( x, y, mask );
456 }
457
458 commitHoveredButton(x, y);
459 LLPanel* cur_panel = getCurrentPanel();
460 if (hasMouseCapture())
461 {
462 if (cur_panel)
463 {
464 if (!cur_panel->focusFirstItem(FALSE))
465 {
466 // if nothing in the panel gets focus, make sure the new tab does
467 // otherwise the last tab might keep focus
468 getTab(getCurrentPanelIndex())->mButton->setFocus(TRUE);
469 }
470 }
471 gFocusMgr.setMouseCapture(NULL);
472 }
473 return handled;
474}
475
476// virtual
477BOOL LLTabContainer::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect )
478{
479 BOOL handled = LLPanel::handleToolTip( x, y, msg, sticky_rect );
480 if (!handled && getTabCount() > 0)
481 {
482 LLTabTuple* firsttuple = getTab(0);
483
484 BOOL has_scroll_arrows = (getMaxScrollPos() > 0);
485 LLRect clip;
486 if (mIsVertical)
487 {
488 clip = LLRect(firsttuple->mButton->getRect().mLeft,
489 has_scroll_arrows ? mPrevArrowBtn->getRect().mBottom - TABCNTRV_PAD : mPrevArrowBtn->getRect().mTop,
490 firsttuple->mButton->getRect().mRight,
491 has_scroll_arrows ? mNextArrowBtn->getRect().mTop + TABCNTRV_PAD : mNextArrowBtn->getRect().mBottom );
492 }
493 else
494 {
495 clip = LLRect(has_scroll_arrows ? mPrevArrowBtn->getRect().mRight : mJumpPrevArrowBtn->getRect().mLeft,
496 firsttuple->mButton->getRect().mTop,
497 has_scroll_arrows ? mNextArrowBtn->getRect().mLeft : mJumpNextArrowBtn->getRect().mRight,
498 firsttuple->mButton->getRect().mBottom );
499 }
500
501 if( clip.pointInRect( x, y ) )
502 {
503 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
504 {
505 LLTabTuple* tuple = *iter;
506 tuple->mButton->setVisible( TRUE );
507 S32 local_x = x - tuple->mButton->getRect().mLeft;
508 S32 local_y = y - tuple->mButton->getRect().mBottom;
509 handled = tuple->mButton->handleToolTip( local_x, local_y, msg, sticky_rect );
510 if( handled )
511 {
512 break;
513 }
514 }
515 }
516
517 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
518 {
519 LLTabTuple* tuple = *iter;
520 tuple->mButton->setVisible( FALSE );
521 }
522 }
523 return handled;
524}
525
526// virtual
527BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
528{
529 if (!getEnabled()) return FALSE;
530
531 if (!gFocusMgr.childHasKeyboardFocus(this)) return FALSE;
532
533 BOOL handled = FALSE;
534 if (key == KEY_LEFT && mask == MASK_ALT)
535 {
536 selectPrevTab();
537 handled = TRUE;
538 }
539 else if (key == KEY_RIGHT && mask == MASK_ALT)
540 {
541 selectNextTab();
542 handled = TRUE;
543 }
544
545 if (handled)
546 {
547 if (getCurrentPanel())
548 {
549 getCurrentPanel()->setFocus(TRUE);
550 }
551 }
552
553 if (!gFocusMgr.childHasKeyboardFocus(getCurrentPanel()))
554 {
555 // if child has focus, but not the current panel, focus is on a button
556 if (mIsVertical)
557 {
558 switch(key)
559 {
560 case KEY_UP:
561 selectPrevTab();
562 handled = TRUE;
563 break;
564 case KEY_DOWN:
565 selectNextTab();
566 handled = TRUE;
567 break;
568 case KEY_LEFT:
569 handled = TRUE;
570 break;
571 case KEY_RIGHT:
572 if (getTabPosition() == LEFT && getCurrentPanel())
573 {
574 getCurrentPanel()->setFocus(TRUE);
575 }
576 handled = TRUE;
577 break;
578 default:
579 break;
580 }
581 }
582 else
583 {
584 switch(key)
585 {
586 case KEY_UP:
587 if (getTabPosition() == BOTTOM && getCurrentPanel())
588 {
589 getCurrentPanel()->setFocus(TRUE);
590 }
591 handled = TRUE;
592 break;
593 case KEY_DOWN:
594 if (getTabPosition() == TOP && getCurrentPanel())
595 {
596 getCurrentPanel()->setFocus(TRUE);
597 }
598 handled = TRUE;
599 break;
600 case KEY_LEFT:
601 selectPrevTab();
602 handled = TRUE;
603 break;
604 case KEY_RIGHT:
605 selectNextTab();
606 handled = TRUE;
607 break;
608 default:
609 break;
610 }
611 }
612 }
613 return handled;
614}
615
616// virtual
617LLXMLNodePtr LLTabContainer::getXML(bool save_children) const
618{
619 LLXMLNodePtr node = LLPanel::getXML();
620 node->createChild("tab_position", TRUE)->setStringValue((getTabPosition() == TOP ? "top" : "bottom"));
621 return node;
622}
623
624// virtual
625BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, LLString &tooltip)
626{
627 BOOL has_scroll_arrows = (getMaxScrollPos() > 0);
628
629 if( mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME )
630 {
631 if (has_scroll_arrows)
632 {
633 if (mJumpPrevArrowBtn->getRect().pointInRect(x, y))
634 {
635 S32 local_x = x - mJumpPrevArrowBtn->getRect().mLeft;
636 S32 local_y = y - mJumpPrevArrowBtn->getRect().mBottom;
637 mJumpPrevArrowBtn->handleHover(local_x, local_y, mask);
638 }
639 if (mJumpNextArrowBtn->getRect().pointInRect(x, y))
640 {
641 S32 local_x = x - mJumpNextArrowBtn->getRect().mLeft;
642 S32 local_y = y - mJumpNextArrowBtn->getRect().mBottom;
643 mJumpNextArrowBtn->handleHover(local_x, local_y, mask);
644 }
645 if (mPrevArrowBtn->getRect().pointInRect(x, y))
646 {
647 S32 local_x = x - mPrevArrowBtn->getRect().mLeft;
648 S32 local_y = y - mPrevArrowBtn->getRect().mBottom;
649 mPrevArrowBtn->handleHover(local_x, local_y, mask);
650 }
651 else if (mNextArrowBtn->getRect().pointInRect(x, y))
652 {
653 S32 local_x = x - mNextArrowBtn->getRect().mLeft;
654 S32 local_y = y - mNextArrowBtn->getRect().mBottom;
655 mNextArrowBtn->handleHover(local_x, local_y, mask);
656 }
657 }
658
659 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
660 {
661 LLTabTuple* tuple = *iter;
662 tuple->mButton->setVisible( TRUE );
663 S32 local_x = x - tuple->mButton->getRect().mLeft;
664 S32 local_y = y - tuple->mButton->getRect().mBottom;
665 if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible())
666 {
667 tuple->mButton->onCommit();
668 mDragAndDropDelayTimer.stop();
669 }
670 }
671 }
672
673 return LLView::handleDragAndDrop(x, y, mask, drop, type, cargo_data, accept, tooltip);
165} 674}
166 675
167void LLTabContainerCommon::removeTabPanel(LLPanel* child) 676void LLTabContainer::addTabPanel(LLPanel* child,
677 const LLString& label,
678 BOOL select,
679 void (*on_tab_clicked)(void*, bool),
680 void* userdata,
681 S32 indent,
682 BOOL placeholder,
683 eInsertionPoint insertion_point)
168{ 684{
685 if (child->getParent() == this)
686 {
687 // already a child of mine
688 return;
689 }
690 const LLFontGL* font = gResMgr->getRes( mIsVertical ? LLFONT_SANSSERIF : LLFONT_SANSSERIF_SMALL );
691
692 // Store the original label for possible xml export.
693 child->setLabel(label);
694 LLString trimmed_label = label;
695 LLString::trim(trimmed_label);
696
697 S32 button_width = mMinTabWidth;
698 if (!mIsVertical)
699 {
700 button_width = llclamp(font->getWidth(trimmed_label) + TAB_PADDING, mMinTabWidth, mMaxTabWidth);
701 }
702
703 // Tab panel
704 S32 tab_panel_top;
705 S32 tab_panel_bottom;
706 if( getTabPosition() == LLTabContainer::TOP )
707 {
708 S32 tab_height = mIsVertical ? BTN_HEIGHT : TABCNTR_TAB_HEIGHT;
709 tab_panel_top = getRect().getHeight() - getTopBorderHeight() - (tab_height - TABCNTR_BUTTON_PANEL_OVERLAP);
710 tab_panel_bottom = LLPANEL_BORDER_WIDTH;
711 }
712 else
713 {
714 tab_panel_top = getRect().getHeight() - getTopBorderHeight();
715 tab_panel_bottom = (TABCNTR_TAB_HEIGHT - TABCNTR_BUTTON_PANEL_OVERLAP); // Run to the edge, covering up the border
716 }
717
718 LLRect tab_panel_rect;
719 if (mIsVertical)
720 {
721 tab_panel_rect = LLRect(mMinTabWidth + (LLPANEL_BORDER_WIDTH * 2) + TABCNTRV_PAD,
722 getRect().getHeight() - LLPANEL_BORDER_WIDTH,
723 getRect().getWidth() - LLPANEL_BORDER_WIDTH,
724 LLPANEL_BORDER_WIDTH);
725 }
726 else
727 {
728 tab_panel_rect = LLRect(LLPANEL_BORDER_WIDTH,
729 tab_panel_top,
730 getRect().getWidth()-LLPANEL_BORDER_WIDTH,
731 tab_panel_bottom );
732 }
733 child->setFollowsAll();
734 child->translate( tab_panel_rect.mLeft - child->getRect().mLeft, tab_panel_rect.mBottom - child->getRect().mBottom);
735 child->reshape( tab_panel_rect.getWidth(), tab_panel_rect.getHeight(), TRUE );
736 child->setBackgroundVisible( FALSE ); // No need to overdraw
737 // add this child later
738
739 child->setVisible( FALSE ); // Will be made visible when selected
740
741 mTotalTabWidth += button_width;
742
743 // Tab button
744 LLRect btn_rect; // Note: btn_rect.mLeft is just a dummy. Will be updated in draw().
745 LLString tab_img;
746 LLString tab_selected_img;
747 S32 tab_fudge = 1; // To make new tab art look better, nudge buttons up 1 pel
748
749 if (mIsVertical)
750 {
751 btn_rect.setLeftTopAndSize(TABCNTRV_PAD + LLPANEL_BORDER_WIDTH + 2, // JC - Fudge factor
752 (getRect().getHeight() - getTopBorderHeight() - LLPANEL_BORDER_WIDTH - 1) - ((BTN_HEIGHT + TABCNTRV_PAD) * getTabCount()),
753 mMinTabWidth,
754 BTN_HEIGHT);
755 }
756 else if( getTabPosition() == LLTabContainer::TOP )
757 {
758 btn_rect.setLeftTopAndSize( 0, getRect().getHeight() - getTopBorderHeight() + tab_fudge, button_width, TABCNTR_TAB_HEIGHT );
759 tab_img = "tab_top_blue.tga";
760 tab_selected_img = "tab_top_selected_blue.tga";
761 }
762 else
763 {
764 btn_rect.setOriginAndSize( 0, 0 + tab_fudge, button_width, TABCNTR_TAB_HEIGHT );
765 tab_img = "tab_bottom_blue.tga";
766 tab_selected_img = "tab_bottom_selected_blue.tga";
767 }
768
769 LLTextBox* textbox = NULL;
770 LLButton* btn = NULL;
771
772 if (placeholder)
773 {
774 btn_rect.translate(0, -LLBUTTON_V_PAD-2);
775 textbox = new LLTextBox(trimmed_label, btn_rect, trimmed_label, font);
776
777 btn = new LLButton("", LLRect(0,0,0,0));
778 }
779 else
780 {
781 if (mIsVertical)
782 {
783 btn = new LLButton("vert tab button",
784 btn_rect,
785 "",
786 "",
787 "",
788 &LLTabContainer::onTabBtn, NULL,
789 font,
790 trimmed_label, trimmed_label);
791 btn->setImages("tab_left.tga", "tab_left_selected.tga");
792 btn->setScaleImage(TRUE);
793 btn->setHAlign(LLFontGL::LEFT);
794 btn->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
795 btn->setTabStop(FALSE);
796 if (indent)
797 {
798 btn->setLeftHPad(indent);
799 }
800 }
801 else
802 {
803 LLString tooltip = trimmed_label;
804 tooltip += "\nAlt-Left arrow for previous tab";
805 tooltip += "\nAlt-Right arrow for next tab";
806
807 btn = new LLButton(LLString(child->getName()) + " tab",
808 btn_rect,
809 "", "", "",
810 &LLTabContainer::onTabBtn, NULL, // set userdata below
811 font,
812 trimmed_label, trimmed_label );
813 btn->setVisible( FALSE );
814 btn->setToolTip( tooltip );
815 btn->setScaleImage(TRUE);
816 btn->setImages(tab_img, tab_selected_img);
817
818 // Try to squeeze in a bit more text
819 btn->setLeftHPad( 4 );
820 btn->setRightHPad( 2 );
821 btn->setHAlign(LLFontGL::LEFT);
822 btn->setTabStop(FALSE);
823 if (indent)
824 {
825 btn->setLeftHPad(indent);
826 }
827
828 if( getTabPosition() == TOP )
829 {
830 btn->setFollowsTop();
831 }
832 else
833 {
834 btn->setFollowsBottom();
835 }
836 }
837 }
838
839 LLTabTuple* tuple = new LLTabTuple( this, child, btn, on_tab_clicked, userdata, textbox );
840 insertTuple( tuple, insertion_point );
841
842 if (textbox)
843 {
844 textbox->setSaveToXML(false);
845 addChild( textbox, 0 );
846 }
847 if (btn)
848 {
849 btn->setSaveToXML(false);
850 btn->setCallbackUserData( tuple );
851 addChild( btn, 0 );
852 }
853 if (child)
854 {
855 addChild(child, 1);
856 }
857
858 if( select )
859 {
860 selectLastTab();
861 }
862
863 updateMaxScrollPos();
864}
865
866void LLTabContainer::addPlaceholder(LLPanel* child, const LLString& label)
867{
868 addTabPanel(child, label, FALSE, NULL, NULL, 0, TRUE);
869}
870
871void LLTabContainer::removeTabPanel(LLPanel* child)
872{
873 if (mIsVertical)
874 {
875 // Fix-up button sizes
876 S32 tab_count = 0;
877 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
878 {
879 LLTabTuple* tuple = *iter;
880 LLRect rect;
881 rect.setLeftTopAndSize(TABCNTRV_PAD + LLPANEL_BORDER_WIDTH + 2, // JC - Fudge factor
882 (getRect().getHeight() - LLPANEL_BORDER_WIDTH - 1) - ((BTN_HEIGHT + TABCNTRV_PAD) * (tab_count)),
883 mMinTabWidth,
884 BTN_HEIGHT);
885 if (tuple->mPlaceholderText)
886 {
887 tuple->mPlaceholderText->setRect(rect);
888 }
889 else
890 {
891 tuple->mButton->setRect(rect);
892 }
893 tab_count++;
894 }
895 }
896 else
897 {
898 // Adjust the total tab width.
899 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
900 {
901 LLTabTuple* tuple = *iter;
902 if( tuple->mTabPanel == child )
903 {
904 mTotalTabWidth -= tuple->mButton->getRect().getWidth();
905 break;
906 }
907 }
908 }
909
169 BOOL has_focus = gFocusMgr.childHasKeyboardFocus(this); 910 BOOL has_focus = gFocusMgr.childHasKeyboardFocus(this);
170 911
171 // If the tab being deleted is the selected one, select a different tab. 912 // If the tab being deleted is the selected one, select a different tab.
@@ -207,7 +948,27 @@ void LLTabContainerCommon::removeTabPanel(LLPanel* child)
207 updateMaxScrollPos(); 948 updateMaxScrollPos();
208} 949}
209 950
210void LLTabContainerCommon::deleteAllTabs() 951void LLTabContainer::lockTabs(S32 num_tabs)
952{
953 // count current tabs or use supplied value and ensure no new tabs get
954 // inserted between them
955 mLockedTabCount = num_tabs > 0 ? llmin(getTabCount(), num_tabs) : getTabCount();
956}
957
958void LLTabContainer::unlockTabs()
959{
960 mLockedTabCount = 0;
961}
962
963void LLTabContainer::enableTabButton(S32 which, BOOL enable)
964{
965 if (which >= 0 && which < (S32)mTabList.size())
966 {
967 mTabList[which]->mButton->setEnabled(enable);
968 }
969}
970
971void LLTabContainer::deleteAllTabs()
211{ 972{
212 // Remove all the tab buttons and delete them. Also, unlink all the child panels. 973 // Remove all the tab buttons and delete them. Also, unlink all the child panels.
213 for(std::vector<LLTabTuple*>::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) 974 for(std::vector<LLTabTuple*>::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
@@ -229,56 +990,26 @@ void LLTabContainerCommon::deleteAllTabs()
229 mCurrentTabIdx = -1; 990 mCurrentTabIdx = -1;
230} 991}
231 992
232 993LLPanel* LLTabContainer::getCurrentPanel()
233LLPanel* LLTabContainerCommon::getCurrentPanel()
234{ 994{
235 if (mCurrentTabIdx < 0 || mCurrentTabIdx >= (S32) mTabList.size()) return NULL; 995 if (mCurrentTabIdx >= 0 && mCurrentTabIdx < (S32) mTabList.size())
236
237 return mTabList[mCurrentTabIdx]->mTabPanel;
238}
239
240LLTabContainerCommon::LLTabTuple* LLTabContainerCommon::getTabByPanel(LLPanel* child)
241{
242 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
243 { 996 {
244 LLTabTuple* tuple = *iter; 997 return mTabList[mCurrentTabIdx]->mTabPanel;
245 if( tuple->mTabPanel == child )
246 {
247 return tuple;
248 }
249 } 998 }
250 return NULL; 999 return NULL;
251} 1000}
252 1001
253void LLTabContainerCommon::setTabChangeCallback(LLPanel* tab, void (*on_tab_clicked)(void*, bool)) 1002S32 LLTabContainer::getCurrentPanelIndex()
254{
255 LLTabTuple* tuplep = getTabByPanel(tab);
256 if (tuplep)
257 {
258 tuplep->mOnChangeCallback = on_tab_clicked;
259 }
260}
261
262void LLTabContainerCommon::setTabUserData(LLPanel* tab, void* userdata)
263{
264 LLTabTuple* tuplep = getTabByPanel(tab);
265 if (tuplep)
266 {
267 tuplep->mUserData = userdata;
268 }
269}
270
271S32 LLTabContainerCommon::getCurrentPanelIndex()
272{ 1003{
273 return mCurrentTabIdx; 1004 return mCurrentTabIdx;
274} 1005}
275 1006
276S32 LLTabContainerCommon::getTabCount() 1007S32 LLTabContainer::getTabCount()
277{ 1008{
278 return mTabList.size(); 1009 return mTabList.size();
279} 1010}
280 1011
281LLPanel* LLTabContainerCommon::getPanelByIndex(S32 index) 1012LLPanel* LLTabContainer::getPanelByIndex(S32 index)
282{ 1013{
283 if (index >= 0 && index < (S32)mTabList.size()) 1014 if (index >= 0 && index < (S32)mTabList.size())
284 { 1015 {
@@ -287,7 +1018,7 @@ LLPanel* LLTabContainerCommon::getPanelByIndex(S32 index)
287 return NULL; 1018 return NULL;
288} 1019}
289 1020
290S32 LLTabContainerCommon::getIndexForPanel(LLPanel* panel) 1021S32 LLTabContainer::getIndexForPanel(LLPanel* panel)
291{ 1022{
292 for (S32 index = 0; index < (S32)mTabList.size(); index++) 1023 for (S32 index = 0; index < (S32)mTabList.size(); index++)
293 { 1024 {
@@ -299,7 +1030,7 @@ S32 LLTabContainerCommon::getIndexForPanel(LLPanel* panel)
299 return -1; 1030 return -1;
300} 1031}
301 1032
302S32 LLTabContainerCommon::getPanelIndexByTitle(const LLString& title) 1033S32 LLTabContainer::getPanelIndexByTitle(const LLString& title)
303{ 1034{
304 for (S32 index = 0 ; index < (S32)mTabList.size(); index++) 1035 for (S32 index = 0 ; index < (S32)mTabList.size(); index++)
305 { 1036 {
@@ -311,7 +1042,7 @@ S32 LLTabContainerCommon::getPanelIndexByTitle(const LLString& title)
311 return -1; 1042 return -1;
312} 1043}
313 1044
314LLPanel *LLTabContainerCommon::getPanelByName(const LLString& name) 1045LLPanel *LLTabContainer::getPanelByName(const LLString& name)
315{ 1046{
316 for (S32 index = 0 ; index < (S32)mTabList.size(); index++) 1047 for (S32 index = 0 ; index < (S32)mTabList.size(); index++)
317 { 1048 {
@@ -324,34 +1055,71 @@ LLPanel *LLTabContainerCommon::getPanelByName(const LLString& name)
324 return NULL; 1055 return NULL;
325} 1056}
326 1057
1058// Change the name of the button for the current tab.
1059void LLTabContainer::setCurrentTabName(const LLString& name)
1060{
1061 // Might not have a tab selected
1062 if (mCurrentTabIdx < 0) return;
1063
1064 mTabList[mCurrentTabIdx]->mButton->setLabelSelected(name);
1065 mTabList[mCurrentTabIdx]->mButton->setLabelUnselected(name);
1066}
327 1067
328void LLTabContainerCommon::scrollNext() 1068void LLTabContainer::selectFirstTab()
329{ 1069{
330 // No wrap 1070 selectTab( 0 );
331 if( mScrollPos < mMaxScrollPos )
332 {
333 mScrollPos++;
334 }
335} 1071}
336 1072
337void LLTabContainerCommon::scrollPrev() 1073
1074void LLTabContainer::selectLastTab()
338{ 1075{
339 // No wrap 1076 selectTab( mTabList.size()-1 );
340 if( mScrollPos > 0 ) 1077}
1078
1079void LLTabContainer::selectNextTab()
1080{
1081 BOOL tab_has_focus = FALSE;
1082 if (mCurrentTabIdx >= 0 && mTabList[mCurrentTabIdx]->mButton->hasFocus())
1083 {
1084 tab_has_focus = TRUE;
1085 }
1086 S32 idx = mCurrentTabIdx+1;
1087 if (idx >= (S32)mTabList.size())
1088 idx = 0;
1089 while (!selectTab(idx) && idx != mCurrentTabIdx)
341 { 1090 {
342 mScrollPos--; 1091 idx = (idx + 1 ) % (S32)mTabList.size();
1092 }
1093
1094 if (tab_has_focus)
1095 {
1096 mTabList[idx]->mButton->setFocus(TRUE);
343 } 1097 }
344} 1098}
345 1099
346void LLTabContainerCommon::enableTabButton(S32 which, BOOL enable) 1100void LLTabContainer::selectPrevTab()
347{ 1101{
348 if (which >= 0 && which < (S32)mTabList.size()) 1102 BOOL tab_has_focus = FALSE;
1103 if (mCurrentTabIdx >= 0 && mTabList[mCurrentTabIdx]->mButton->hasFocus())
349 { 1104 {
350 mTabList[which]->mButton->setEnabled(enable); 1105 tab_has_focus = TRUE;
351 } 1106 }
352} 1107 S32 idx = mCurrentTabIdx-1;
1108 if (idx < 0)
1109 idx = mTabList.size()-1;
1110 while (!selectTab(idx) && idx != mCurrentTabIdx)
1111 {
1112 idx = idx - 1;
1113 if (idx < 0)
1114 idx = mTabList.size()-1;
1115 }
1116 if (tab_has_focus)
1117 {
1118 mTabList[idx]->mButton->setFocus(TRUE);
1119 }
1120}
353 1121
354BOOL LLTabContainerCommon::selectTabPanel(LLPanel* child) 1122BOOL LLTabContainer::selectTabPanel(LLPanel* child)
355{ 1123{
356 S32 idx = 0; 1124 S32 idx = 0;
357 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) 1125 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
@@ -366,12 +1134,108 @@ BOOL LLTabContainerCommon::selectTabPanel(LLPanel* child)
366 return FALSE; 1134 return FALSE;
367} 1135}
368 1136
369BOOL LLTabContainerCommon::selectTabByName(const LLString& name) 1137BOOL LLTabContainer::selectTab(S32 which)
1138{
1139 if (which >= getTabCount()) return FALSE;
1140 if (which < 0) return FALSE;
1141
1142 //if( gFocusMgr.childHasKeyboardFocus( this ) )
1143 //{
1144 // gFocusMgr.setKeyboardFocus( NULL );
1145 //}
1146
1147 LLTabTuple* selected_tuple = getTab(which);
1148 if (!selected_tuple)
1149 {
1150 return FALSE;
1151 }
1152
1153 BOOL is_visible = FALSE;
1154 if (getTab(which)->mButton->getEnabled())
1155 {
1156 setCurrentPanelIndex(which);
1157
1158 S32 i = 0;
1159 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
1160 {
1161 LLTabTuple* tuple = *iter;
1162 BOOL is_selected = ( tuple == selected_tuple );
1163 tuple->mTabPanel->setVisible( is_selected );
1164// tuple->mTabPanel->setFocus(is_selected); // not clear that we want to do this here.
1165 tuple->mButton->setToggleState( is_selected );
1166 // RN: this limits tab-stops to active button only, which would require arrow keys to switch tabs
1167 tuple->mButton->setTabStop( is_selected );
1168
1169 if( is_selected && (mIsVertical || (getMaxScrollPos() > 0)))
1170 {
1171 // Make sure selected tab is within scroll region
1172 if (mIsVertical)
1173 {
1174 S32 num_visible = getTabCount() - getMaxScrollPos();
1175 if( i >= getScrollPos() && i <= getScrollPos() + num_visible)
1176 {
1177 setCurrentPanelIndex(which);
1178 is_visible = TRUE;
1179 }
1180 else
1181 {
1182 is_visible = FALSE;
1183 }
1184 }
1185 else
1186 {
1187 if( i < getScrollPos() )
1188 {
1189 setScrollPos(i);
1190 }
1191 else
1192 {
1193 S32 available_width_with_arrows = getRect().getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1);
1194 S32 running_tab_width = tuple->mButton->getRect().getWidth();
1195 S32 j = i - 1;
1196 S32 min_scroll_pos = i;
1197 if (running_tab_width < available_width_with_arrows)
1198 {
1199 while (j >= 0)
1200 {
1201 LLTabTuple* other_tuple = getTab(j);
1202 running_tab_width += other_tuple->mButton->getRect().getWidth();
1203 if (running_tab_width > available_width_with_arrows)
1204 {
1205 break;
1206 }
1207 j--;
1208 }
1209 min_scroll_pos = j + 1;
1210 }
1211 setScrollPos(llclamp(getScrollPos(), min_scroll_pos, i));
1212 setScrollPos(llmin(getScrollPos(), getMaxScrollPos()));
1213 }
1214 is_visible = TRUE;
1215 }
1216 }
1217 i++;
1218 }
1219 if( selected_tuple->mOnChangeCallback )
1220 {
1221 selected_tuple->mOnChangeCallback( selected_tuple->mUserData, false );
1222 }
1223 }
1224 if (mIsVertical && getCurrentPanelIndex() >= 0)
1225 {
1226 LLTabTuple* tuple = getTab(getCurrentPanelIndex());
1227 tuple->mTabPanel->setVisible( TRUE );
1228 tuple->mButton->setToggleState( TRUE );
1229 }
1230 return is_visible;
1231}
1232
1233BOOL LLTabContainer::selectTabByName(const LLString& name)
370{ 1234{
371 LLPanel* panel = getPanelByName(name); 1235 LLPanel* panel = getPanelByName(name);
372 if (!panel) 1236 if (!panel)
373 { 1237 {
374 llwarns << "LLTabContainerCommon::selectTabByName(" 1238 llwarns << "LLTabContainer::selectTabByName("
375 << name << ") failed" << llendl; 1239 << name << ") failed" << llendl;
376 return FALSE; 1240 return FALSE;
377 } 1241 }
@@ -380,74 +1244,131 @@ BOOL LLTabContainerCommon::selectTabByName(const LLString& name)
380 return result; 1244 return result;
381} 1245}
382 1246
383 1247BOOL LLTabContainer::getTabPanelFlashing(LLPanel *child)
384void LLTabContainerCommon::selectFirstTab()
385{ 1248{
386 selectTab( 0 ); 1249 LLTabTuple* tuple = getTabByPanel(child);
1250 if( tuple )
1251 {
1252 return tuple->mButton->getFlashing();
1253 }
1254 return FALSE;
387} 1255}
388 1256
389 1257void LLTabContainer::setTabPanelFlashing(LLPanel* child, BOOL state )
390void LLTabContainerCommon::selectLastTab()
391{ 1258{
392 selectTab( mTabList.size()-1 ); 1259 LLTabTuple* tuple = getTabByPanel(child);
1260 if( tuple )
1261 {
1262 tuple->mButton->setFlashing( state );
1263 }
393} 1264}
394 1265
395 1266void LLTabContainer::setTabImage(LLPanel* child, std::string image_name, const LLColor4& color)
396void LLTabContainerCommon::selectNextTab()
397{ 1267{
398 BOOL tab_has_focus = FALSE; 1268 LLTabTuple* tuple = getTabByPanel(child);
399 if (mCurrentTabIdx >= 0 && mTabList[mCurrentTabIdx]->mButton->hasFocus()) 1269 if( tuple )
400 {
401 tab_has_focus = TRUE;
402 }
403 S32 idx = mCurrentTabIdx+1;
404 if (idx >= (S32)mTabList.size())
405 idx = 0;
406 while (!selectTab(idx) && idx != mCurrentTabIdx)
407 { 1270 {
408 idx = (idx + 1 ) % (S32)mTabList.size(); 1271 tuple->mButton->setImageOverlay(image_name, LLFontGL::RIGHT, color);
1272
1273 if (!mIsVertical)
1274 {
1275 const LLFontGL* fontp = gResMgr->getRes( LLFONT_SANSSERIF_SMALL );
1276 // remove current width from total tab strip width
1277 mTotalTabWidth -= tuple->mButton->getRect().getWidth();
1278
1279 S32 image_overlay_width = tuple->mButton->getImageOverlay().notNull() ?
1280 tuple->mButton->getImageOverlay()->getImage()->getWidth(0) :
1281 0;
1282
1283 tuple->mPadding = image_overlay_width;
1284
1285 tuple->mButton->setRightHPad(6);
1286 tuple->mButton->reshape(llclamp(fontp->getWidth(tuple->mButton->getLabelSelected()) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth),
1287 tuple->mButton->getRect().getHeight());
1288 // add back in button width to total tab strip width
1289 mTotalTabWidth += tuple->mButton->getRect().getWidth();
1290
1291 // tabs have changed size, might need to scroll to see current tab
1292 updateMaxScrollPos();
1293 }
409 } 1294 }
1295}
410 1296
411 if (tab_has_focus) 1297void LLTabContainer::setTitle(const LLString& title)
1298{
1299 if (mTitleBox)
412 { 1300 {
413 mTabList[idx]->mButton->setFocus(TRUE); 1301 mTitleBox->setText( title );
414 } 1302 }
415} 1303}
416 1304
417void LLTabContainerCommon::selectPrevTab() 1305const LLString LLTabContainer::getPanelTitle(S32 index)
418{ 1306{
419 BOOL tab_has_focus = FALSE; 1307 if (index >= 0 && index < (S32)mTabList.size())
420 if (mCurrentTabIdx >= 0 && mTabList[mCurrentTabIdx]->mButton->hasFocus())
421 { 1308 {
422 tab_has_focus = TRUE; 1309 LLButton* tab_button = mTabList[index]->mButton;
1310 return tab_button->getLabelSelected();
423 } 1311 }
424 S32 idx = mCurrentTabIdx-1; 1312 return LLString::null;
425 if (idx < 0) 1313}
426 idx = mTabList.size()-1; 1314
427 while (!selectTab(idx) && idx != mCurrentTabIdx) 1315void LLTabContainer::setTopBorderHeight(S32 height)
1316{
1317 mTopBorderHeight = height;
1318}
1319
1320S32 LLTabContainer::getTopBorderHeight() const
1321{
1322 return mTopBorderHeight;
1323}
1324
1325void LLTabContainer::setTabChangeCallback(LLPanel* tab, void (*on_tab_clicked)(void*, bool))
1326{
1327 LLTabTuple* tuplep = getTabByPanel(tab);
1328 if (tuplep)
428 { 1329 {
429 idx = idx - 1; 1330 tuplep->mOnChangeCallback = on_tab_clicked;
430 if (idx < 0)
431 idx = mTabList.size()-1;
432 } 1331 }
433 if (tab_has_focus) 1332}
1333
1334void LLTabContainer::setTabUserData(LLPanel* tab, void* userdata)
1335{
1336 LLTabTuple* tuplep = getTabByPanel(tab);
1337 if (tuplep)
434 { 1338 {
435 mTabList[idx]->mButton->setFocus(TRUE); 1339 tuplep->mUserData = userdata;
436 } 1340 }
437} 1341}
438 1342
1343void LLTabContainer::setRightTabBtnOffset(S32 offset)
1344{
1345 mNextArrowBtn->translate( -offset - mRightTabBtnOffset, 0 );
1346 mRightTabBtnOffset = offset;
1347 updateMaxScrollPos();
1348}
439 1349
440void LLTabContainerCommon::reshape(S32 width, S32 height, BOOL called_from_parent) 1350void LLTabContainer::setPanelTitle(S32 index, const LLString& title)
441{ 1351{
442 LLPanel::reshape( width, height, called_from_parent ); 1352 if (index >= 0 && index < getTabCount())
1353 {
1354 LLTabTuple* tuple = getTab(index);
1355 LLButton* tab_button = tuple->mButton;
1356 const LLFontGL* fontp = gResMgr->getRes( LLFONT_SANSSERIF_SMALL );
1357 mTotalTabWidth -= tab_button->getRect().getWidth();
1358 tab_button->reshape(llclamp(fontp->getWidth(title) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth), tab_button->getRect().getHeight());
1359 mTotalTabWidth += tab_button->getRect().getWidth();
1360 tab_button->setLabelSelected(title);
1361 tab_button->setLabelUnselected(title);
1362 }
443 updateMaxScrollPos(); 1363 updateMaxScrollPos();
444} 1364}
445 1365
1366
446// static 1367// static
447void LLTabContainerCommon::onTabBtn( void* userdata ) 1368void LLTabContainer::onTabBtn( void* userdata )
448{ 1369{
449 LLTabTuple* tuple = (LLTabTuple*) userdata; 1370 LLTabTuple* tuple = (LLTabTuple*) userdata;
450 LLTabContainerCommon* self = tuple->mTabContainer; 1371 LLTabContainer* self = tuple->mTabContainer;
451 self->selectTabPanel( tuple->mTabPanel ); 1372 self->selectTabPanel( tuple->mTabPanel );
452 1373
453 if( tuple->mOnChangeCallback ) 1374 if( tuple->mOnChangeCallback )
@@ -459,7 +1380,7 @@ void LLTabContainerCommon::onTabBtn( void* userdata )
459} 1380}
460 1381
461// static 1382// static
462void LLTabContainerCommon::onCloseBtn( void* userdata ) 1383void LLTabContainer::onCloseBtn( void* userdata )
463{ 1384{
464 LLTabContainer* self = (LLTabContainer*) userdata; 1385 LLTabContainer* self = (LLTabContainer*) userdata;
465 if( self->mCloseCallback ) 1386 if( self->mCloseCallback )
@@ -469,7 +1390,7 @@ void LLTabContainerCommon::onCloseBtn( void* userdata )
469} 1390}
470 1391
471// static 1392// static
472void LLTabContainerCommon::onNextBtn( void* userdata ) 1393void LLTabContainer::onNextBtn( void* userdata )
473{ 1394{
474 // Scroll tabs to the left 1395 // Scroll tabs to the left
475 LLTabContainer* self = (LLTabContainer*) userdata; 1396 LLTabContainer* self = (LLTabContainer*) userdata;
@@ -481,7 +1402,7 @@ void LLTabContainerCommon::onNextBtn( void* userdata )
481} 1402}
482 1403
483// static 1404// static
484void LLTabContainerCommon::onNextBtnHeld( void* userdata ) 1405void LLTabContainer::onNextBtnHeld( void* userdata )
485{ 1406{
486 LLTabContainer* self = (LLTabContainer*) userdata; 1407 LLTabContainer* self = (LLTabContainer*) userdata;
487 if (self->mScrollTimer.getElapsedTimeF32() > SCROLL_STEP_TIME) 1408 if (self->mScrollTimer.getElapsedTimeF32() > SCROLL_STEP_TIME)
@@ -493,7 +1414,7 @@ void LLTabContainerCommon::onNextBtnHeld( void* userdata )
493} 1414}
494 1415
495// static 1416// static
496void LLTabContainerCommon::onPrevBtn( void* userdata ) 1417void LLTabContainer::onPrevBtn( void* userdata )
497{ 1418{
498 LLTabContainer* self = (LLTabContainer*) userdata; 1419 LLTabContainer* self = (LLTabContainer*) userdata;
499 if (!self->mScrolled) 1420 if (!self->mScrolled)
@@ -503,26 +1424,22 @@ void LLTabContainerCommon::onPrevBtn( void* userdata )
503 self->mScrolled = FALSE; 1424 self->mScrolled = FALSE;
504} 1425}
505 1426
506 1427// static
507void LLTabContainerCommon::onJumpFirstBtn( void* userdata ) 1428void LLTabContainer::onJumpFirstBtn( void* userdata )
508{ 1429{
509 LLTabContainer* self = (LLTabContainer*) userdata; 1430 LLTabContainer* self = (LLTabContainer*) userdata;
510
511 self->mScrollPos = 0; 1431 self->mScrollPos = 0;
512
513} 1432}
514 1433
515 1434// static
516void LLTabContainerCommon::onJumpLastBtn( void* userdata ) 1435void LLTabContainer::onJumpLastBtn( void* userdata )
517{ 1436{
518 LLTabContainer* self = (LLTabContainer*) userdata; 1437 LLTabContainer* self = (LLTabContainer*) userdata;
519
520 self->mScrollPos = self->mMaxScrollPos; 1438 self->mScrollPos = self->mMaxScrollPos;
521} 1439}
522 1440
523
524// static 1441// static
525void LLTabContainerCommon::onPrevBtnHeld( void* userdata ) 1442void LLTabContainer::onPrevBtnHeld( void* userdata )
526{ 1443{
527 LLTabContainer* self = (LLTabContainer*) userdata; 1444 LLTabContainer* self = (LLTabContainer*) userdata;
528 if (self->mScrollTimer.getElapsedTimeF32() > SCROLL_STEP_TIME) 1445 if (self->mScrollTimer.getElapsedTimeF32() > SCROLL_STEP_TIME)
@@ -533,68 +1450,8 @@ void LLTabContainerCommon::onPrevBtnHeld( void* userdata )
533 } 1450 }
534} 1451}
535 1452
536BOOL LLTabContainerCommon::getTabPanelFlashing(LLPanel *child) 1453// static
537{ 1454LLView* LLTabContainer::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
538 LLTabTuple* tuple = getTabByPanel(child);
539 if( tuple )
540 {
541 return tuple->mButton->getFlashing();
542 }
543 return FALSE;
544}
545
546void LLTabContainerCommon::setTabPanelFlashing(LLPanel* child, BOOL state )
547{
548 LLTabTuple* tuple = getTabByPanel(child);
549 if( tuple )
550 {
551 tuple->mButton->setFlashing( state );
552 }
553}
554
555void LLTabContainerCommon::setTabImage(LLPanel* child, std::string img_name, const LLColor4& color)
556{
557 LLTabTuple* tuple = getTabByPanel(child);
558 if( tuple )
559 {
560 tuple->mButton->setImageOverlay(img_name, LLFontGL::RIGHT, color);
561 }
562}
563
564void LLTabContainerCommon::setTitle(const LLString& title)
565{
566 if (mTitleBox)
567 {
568 mTitleBox->setText( title );
569 }
570}
571
572const LLString LLTabContainerCommon::getPanelTitle(S32 index)
573{
574 if (index >= 0 && index < (S32)mTabList.size())
575 {
576 LLButton* tab_button = mTabList[index]->mButton;
577 return tab_button->getLabelSelected();
578 }
579 return LLString::null;
580}
581
582void LLTabContainerCommon::setTopBorderHeight(S32 height)
583{
584 mTopBorderHeight = height;
585}
586
587// Change the name of the button for the current tab.
588void LLTabContainerCommon::setCurrentTabName(const LLString& name)
589{
590 // Might not have a tab selected
591 if (mCurrentTabIdx < 0) return;
592
593 mTabList[mCurrentTabIdx]->mButton->setLabelSelected(name);
594 mTabList[mCurrentTabIdx]->mButton->setLabelUnselected(name);
595}
596
597LLView* LLTabContainerCommon::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
598{ 1455{
599 LLString name("tab_container"); 1456 LLString name("tab_container");
600 node->getAttributeString("name", name); 1457 node->getAttributeString("name", name);
@@ -626,58 +1483,30 @@ LLView* LLTabContainerCommon::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtr
626 BOOL border = FALSE; 1483 BOOL border = FALSE;
627 node->getAttributeBOOL("border", border); 1484 node->getAttributeBOOL("border", border);
628 1485
629 // Create the correct container type. 1486 LLTabContainer* tab_container = new LLTabContainer(name, LLRect::null, tab_position, border, is_vertical);
630 LLTabContainerCommon* tab_container = NULL; 1487
631 1488 S32 tab_min_width = tab_container->mMinTabWidth;
632 if (is_vertical) 1489 if (node->hasAttribute("tab_width"))
633 { 1490 {
634 // Vertical tabs can specify tab width 1491 node->getAttributeS32("tab_width", tab_min_width);
635 U32 tab_width = TABCNTRV_TAB_WIDTH;
636 if (node->hasAttribute("tab_width"))
637 {
638 node->getAttributeU32("tab_width", tab_width);
639 }
640
641 tab_container = new LLTabContainerVertical(name,
642 LLRect::null,
643 NULL,
644 NULL,
645 tab_width,
646 border);
647
648 } 1492 }
649 else // horizontal tab container 1493 else if( node->hasAttribute("tab_min_width"))
650 { 1494 {
651 // Horizontal tabs can have a title (?) 1495 node->getAttributeS32("tab_min_width", tab_min_width);
652 LLString title(LLString::null); 1496 }
653 if (node->hasAttribute("title"))
654 {
655 node->getAttributeString("title", title);
656 }
657 1497
658 tab_container = new LLTabContainer(name, 1498 S32 tab_max_width = tab_container->mMaxTabWidth;
659 LLRect::null, 1499 if (node->hasAttribute("tab_max_width"))
660 tab_position, 1500 {
661 NULL, 1501 node->getAttributeS32("tab_max_width", tab_max_width);
662 NULL,
663 title,
664 border);
665
666 if(node->hasAttribute("tab_min_width"))
667 {
668 S32 minTabWidth=0;
669 node->getAttributeS32("tab_min_width",minTabWidth);
670 ((LLTabContainer*)tab_container)->setMinTabWidth(minTabWidth);
671 }
672 if(node->hasAttribute("tab_max_width"))
673 {
674 S32 maxTabWidth=0;
675 node->getAttributeS32("tab_max_width",maxTabWidth);
676 ((LLTabContainer*)tab_container)->setMaxTabWidth(maxTabWidth);
677 }
678 } 1502 }
1503
1504 tab_container->setMinTabWidth(tab_min_width);
1505 tab_container->setMaxTabWidth(tab_max_width);
679 1506
680 node->getAttributeBOOL("hide_tabs", tab_container->mTabsHidden); 1507 BOOL hidden(tab_container->getTabsHidden());
1508 node->getAttributeBOOL("hide_tabs", hidden);
1509 tab_container->setTabsHidden(hidden);
681 1510
682 tab_container->setPanelParameters(node, parent); 1511 tab_container->setPanelParameters(node, parent);
683 1512
@@ -718,76 +1547,12 @@ LLView* LLTabContainerCommon::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtr
718 return tab_container; 1547 return tab_container;
719} 1548}
720 1549
721void LLTabContainerCommon::insertTuple(LLTabTuple * tuple, eInsertionPoint insertion_point) 1550// private
722{
723 switch(insertion_point)
724 {
725 case START:
726 // insert the new tab in the front of the list
727 mTabList.insert(mTabList.begin() + mLockedTabCount, tuple);
728 break;
729 case LEFT_OF_CURRENT:
730 // insert the new tab before the current tab (but not before mLockedTabCount)
731 {
732 tuple_list_t::iterator current_iter = mTabList.begin() + llmax(mLockedTabCount, mCurrentTabIdx);
733 mTabList.insert(current_iter, tuple);
734 }
735 break;
736
737 case RIGHT_OF_CURRENT:
738 // insert the new tab after the current tab (but not before mLockedTabCount)
739 {
740 tuple_list_t::iterator current_iter = mTabList.begin() + llmax(mLockedTabCount, mCurrentTabIdx + 1);
741 mTabList.insert(current_iter, tuple);
742 }
743 break;
744 case END:
745 default:
746 mTabList.push_back( tuple );
747 }
748}
749
750
751LLTabContainer::LLTabContainer(
752 const LLString& name, const LLRect& rect, TabPosition pos,
753 void(*close_callback)(void*), void* callback_userdata,
754 const LLString& title, BOOL bordered )
755 :
756 LLTabContainerCommon(name, rect, pos, close_callback, callback_userdata, bordered),
757 mLeftArrowBtn(NULL),
758 mJumpLeftArrowBtn(NULL),
759 mRightArrowBtn(NULL),
760 mJumpRightArrowBtn(NULL),
761 mRightTabBtnOffset(0),
762 mMinTabWidth(TABCNTR_TAB_MIN_WIDTH),
763 mMaxTabWidth(TABCNTR_TAB_MAX_WIDTH),
764 mTotalTabWidth(0)
765{
766 initButtons( );
767}
768
769LLTabContainer::LLTabContainer(
770 const LLString& name, const LLString& rect_control, TabPosition pos,
771 void(*close_callback)(void*), void* callback_userdata,
772 const LLString& title, BOOL bordered )
773 :
774 LLTabContainerCommon(name, rect_control, pos, close_callback, callback_userdata, bordered),
775 mLeftArrowBtn(NULL),
776 mJumpLeftArrowBtn(NULL),
777 mRightArrowBtn(NULL),
778 mJumpRightArrowBtn(NULL),
779 mRightTabBtnOffset(0),
780 mMinTabWidth(TABCNTR_TAB_MIN_WIDTH),
781 mMaxTabWidth(TABCNTR_TAB_MAX_WIDTH),
782 mTotalTabWidth(0)
783{
784 initButtons( );
785}
786 1551
787void LLTabContainer::initButtons() 1552void LLTabContainer::initButtons()
788{ 1553{
789 // Hack: 1554 // Hack:
790 if (mRect.getHeight() == 0 || mLeftArrowBtn) 1555 if (getRect().getHeight() == 0 || mPrevArrowBtn)
791 { 1556 {
792 return; // Don't have a rect yet or already got called 1557 return; // Don't have a rect yet or already got called
793 } 1558 }
@@ -795,881 +1560,255 @@ void LLTabContainer::initButtons()
795 LLString out_id; 1560 LLString out_id;
796 LLString in_id; 1561 LLString in_id;
797 1562
798 S32 arrow_fudge = 1; // match new art better 1563 if (mIsVertical)
799
800 // tabs on bottom reserve room for resize handle (just in case)
801 if (mTabPosition == BOTTOM)
802 { 1564 {
803 mRightTabBtnOffset = RESIZE_HANDLE_WIDTH; 1565 // Left and right scroll arrows (for when there are too many tabs to show all at once).
804 } 1566 S32 btn_top = getRect().getHeight();
805 1567 S32 btn_top_lower = getRect().mBottom+TABCNTRV_ARROW_BTN_SIZE;
806 // Left and right scroll arrows (for when there are too many tabs to show all at once).
807 S32 btn_top = (mTabPosition == TOP ) ? mRect.getHeight() - mTopBorderHeight : TABCNTR_ARROW_BTN_SIZE + 1;
808
809 LLRect left_arrow_btn_rect;
810 left_arrow_btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH+1+TABCNTR_ARROW_BTN_SIZE, btn_top + arrow_fudge, TABCNTR_ARROW_BTN_SIZE, TABCNTR_ARROW_BTN_SIZE );
811
812 LLRect jump_left_arrow_btn_rect;
813 jump_left_arrow_btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH+1, btn_top + arrow_fudge, TABCNTR_ARROW_BTN_SIZE, TABCNTR_ARROW_BTN_SIZE );
814
815 S32 right_pad = TABCNTR_ARROW_BTN_SIZE + LLPANEL_BORDER_WIDTH + 1;
816
817 LLRect right_arrow_btn_rect;
818 right_arrow_btn_rect.setLeftTopAndSize( mRect.getWidth() - mRightTabBtnOffset - right_pad - TABCNTR_ARROW_BTN_SIZE,
819 btn_top + arrow_fudge,
820 TABCNTR_ARROW_BTN_SIZE, TABCNTR_ARROW_BTN_SIZE );
821 1568
1569 LLRect up_arrow_btn_rect;
1570 up_arrow_btn_rect.setLeftTopAndSize( mMinTabWidth/2 , btn_top, TABCNTRV_ARROW_BTN_SIZE, TABCNTRV_ARROW_BTN_SIZE );
822 1571
823 LLRect jump_right_arrow_btn_rect; 1572 LLRect down_arrow_btn_rect;
824 jump_right_arrow_btn_rect.setLeftTopAndSize( mRect.getWidth() - mRightTabBtnOffset - right_pad, 1573 down_arrow_btn_rect.setLeftTopAndSize( mMinTabWidth/2 , btn_top_lower, TABCNTRV_ARROW_BTN_SIZE, TABCNTRV_ARROW_BTN_SIZE );
825 btn_top + arrow_fudge,
826 TABCNTR_ARROW_BTN_SIZE, TABCNTR_ARROW_BTN_SIZE );
827 1574
828 out_id = "UIImgBtnJumpLeftOutUUID"; 1575 out_id = "UIImgBtnScrollUpOutUUID";
829 in_id = "UIImgBtnJumpLeftInUUID"; 1576 in_id = "UIImgBtnScrollUpInUUID";
830 mJumpLeftArrowBtn = new LLButton( 1577 mPrevArrowBtn = new LLButton("Up Arrow", up_arrow_btn_rect,
831 "Jump Left Arrow", jump_left_arrow_btn_rect, 1578 out_id, in_id, "",
832 out_id, in_id, "", 1579 &onPrevBtn, this, NULL );
833 &LLTabContainer::onJumpFirstBtn, this, LLFontGL::sSansSerif ); 1580 mPrevArrowBtn->setFollowsTop();
834 mJumpLeftArrowBtn->setFollowsLeft(); 1581 mPrevArrowBtn->setFollowsLeft();
835 mJumpLeftArrowBtn->setSaveToXML(false);
836 mJumpLeftArrowBtn->setTabStop(FALSE);
837 addChild(mJumpLeftArrowBtn);
838 1582
839 out_id = "UIImgBtnScrollLeftOutUUID"; 1583 out_id = "UIImgBtnScrollDownOutUUID";
840 in_id = "UIImgBtnScrollLeftInUUID"; 1584 in_id = "UIImgBtnScrollDownInUUID";
841 mLeftArrowBtn = new LLButton( 1585 mNextArrowBtn = new LLButton("Down Arrow", down_arrow_btn_rect,
842 "Left Arrow", left_arrow_btn_rect, 1586 out_id, in_id, "",
843 out_id, in_id, "", 1587 &onNextBtn, this, NULL );
844 &LLTabContainer::onPrevBtn, this, LLFontGL::sSansSerif ); 1588 mNextArrowBtn->setFollowsBottom();
845 mLeftArrowBtn->setHeldDownCallback(onPrevBtnHeld); 1589 mNextArrowBtn->setFollowsLeft();
846 mLeftArrowBtn->setFollowsLeft();
847 mLeftArrowBtn->setSaveToXML(false);
848 mLeftArrowBtn->setTabStop(FALSE);
849 addChild(mLeftArrowBtn);
850
851 out_id = "UIImgBtnJumpRightOutUUID";
852 in_id = "UIImgBtnJumpRightInUUID";
853 mJumpRightArrowBtn = new LLButton(
854 "Jump Right Arrow", jump_right_arrow_btn_rect,
855 out_id, in_id, "",
856 &LLTabContainer::onJumpLastBtn, this,
857 LLFontGL::sSansSerif);
858 mJumpRightArrowBtn->setFollowsRight();
859 mJumpRightArrowBtn->setSaveToXML(false);
860 mJumpRightArrowBtn->setTabStop(FALSE);
861 addChild(mJumpRightArrowBtn);
862
863 out_id = "UIImgBtnScrollRightOutUUID";
864 in_id = "UIImgBtnScrollRightInUUID";
865 mRightArrowBtn = new LLButton(
866 "Right Arrow", right_arrow_btn_rect,
867 out_id, in_id, "",
868 &LLTabContainer::onNextBtn, this,
869 LLFontGL::sSansSerif);
870 mRightArrowBtn->setFollowsRight();
871 mRightArrowBtn->setHeldDownCallback(onNextBtnHeld);
872 mRightArrowBtn->setSaveToXML(false);
873 mRightArrowBtn->setTabStop(FALSE);
874 addChild(mRightArrowBtn);
875
876
877 if( mTabPosition == TOP )
878 {
879 mRightArrowBtn->setFollowsTop();
880 mLeftArrowBtn->setFollowsTop();
881 mJumpLeftArrowBtn->setFollowsTop();
882 mJumpRightArrowBtn->setFollowsTop();
883 } 1590 }
884 else 1591 else // Horizontal
885 { 1592 {
886 mRightArrowBtn->setFollowsBottom(); 1593 S32 arrow_fudge = 1; // match new art better
887 mLeftArrowBtn->setFollowsBottom();
888 mJumpLeftArrowBtn->setFollowsBottom();
889 mJumpRightArrowBtn->setFollowsBottom();
890 }
891
892 // set default tab group to be panel contents
893 mDefaultTabGroup = 1;
894}
895 1594
896LLTabContainer::~LLTabContainer() 1595 // tabs on bottom reserve room for resize handle (just in case)
897{ 1596 if (getTabPosition() == BOTTOM)
898} 1597 {
899 1598 mRightTabBtnOffset = RESIZE_HANDLE_WIDTH;
900void LLTabContainer::addTabPanel(LLPanel* child, 1599 }
901 const LLString& label,
902 BOOL select,
903 void (*on_tab_clicked)(void*, bool),
904 void* userdata,
905 S32 indent,
906 BOOL placeholder,
907 eInsertionPoint insertion_point)
908{
909 if (child->getParent() == this)
910 {
911 // already a child of mine
912 return;
913 }
914 const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF_SMALL );
915 1600
916 // Store the original label for possible xml export. 1601 // Left and right scroll arrows (for when there are too many tabs to show all at once).
917 child->setLabel(label); 1602 S32 btn_top = (getTabPosition() == TOP ) ? getRect().getHeight() - getTopBorderHeight() : TABCNTR_ARROW_BTN_SIZE + 1;
918 LLString trimmed_label = label;
919 LLString::trim(trimmed_label);
920 1603
921 S32 button_width = llclamp(font->getWidth(trimmed_label) + TAB_PADDING, mMinTabWidth, mMaxTabWidth); 1604 LLRect left_arrow_btn_rect;
1605 left_arrow_btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH+1+TABCNTR_ARROW_BTN_SIZE, btn_top + arrow_fudge, TABCNTR_ARROW_BTN_SIZE, TABCNTR_ARROW_BTN_SIZE );
922 1606
923 // Tab panel 1607 LLRect jump_left_arrow_btn_rect;
924 S32 tab_panel_top; 1608 jump_left_arrow_btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH+1, btn_top + arrow_fudge, TABCNTR_ARROW_BTN_SIZE, TABCNTR_ARROW_BTN_SIZE );
925 S32 tab_panel_bottom;
926 if( LLTabContainer::TOP == mTabPosition )
927 {
928 tab_panel_top = mRect.getHeight() - mTopBorderHeight - (TABCNTR_TAB_HEIGHT - TABCNTR_BUTTON_PANEL_OVERLAP);
929 tab_panel_bottom = LLPANEL_BORDER_WIDTH;
930 }
931 else
932 {
933 tab_panel_top = mRect.getHeight() - mTopBorderHeight;
934 tab_panel_bottom = (TABCNTR_TAB_HEIGHT - TABCNTR_BUTTON_PANEL_OVERLAP); // Run to the edge, covering up the border
935 }
936
937 LLRect tab_panel_rect(
938 LLPANEL_BORDER_WIDTH,
939 tab_panel_top,
940 mRect.getWidth()-LLPANEL_BORDER_WIDTH,
941 tab_panel_bottom );
942 1609
943 child->setFollowsAll(); 1610 S32 right_pad = TABCNTR_ARROW_BTN_SIZE + LLPANEL_BORDER_WIDTH + 1;
944 child->translate( tab_panel_rect.mLeft - child->getRect().mLeft, tab_panel_rect.mBottom - child->getRect().mBottom);
945 child->reshape( tab_panel_rect.getWidth(), tab_panel_rect.getHeight(), TRUE );
946 child->setBackgroundVisible( FALSE ); // No need to overdraw
947 // add this child later
948 1611
949 child->setVisible( FALSE ); // Will be made visible when selected 1612 LLRect right_arrow_btn_rect;
1613 right_arrow_btn_rect.setLeftTopAndSize( getRect().getWidth() - mRightTabBtnOffset - right_pad - TABCNTR_ARROW_BTN_SIZE,
1614 btn_top + arrow_fudge,
1615 TABCNTR_ARROW_BTN_SIZE, TABCNTR_ARROW_BTN_SIZE );
950 1616
951 mTotalTabWidth += button_width;
952 1617
953 // Tab button 1618 LLRect jump_right_arrow_btn_rect;
954 LLRect btn_rect; // Note: btn_rect.mLeft is just a dummy. Will be updated in draw(). 1619 jump_right_arrow_btn_rect.setLeftTopAndSize( getRect().getWidth() - mRightTabBtnOffset - right_pad,
955 LLString tab_img; 1620 btn_top + arrow_fudge,
956 LLString tab_selected_img; 1621 TABCNTR_ARROW_BTN_SIZE, TABCNTR_ARROW_BTN_SIZE );
957 S32 tab_fudge = 1; // To make new tab art look better, nudge buttons up 1 pel
958 1622
959 if( LLTabContainer::TOP == mTabPosition ) 1623 out_id = "UIImgBtnJumpLeftOutUUID";
960 { 1624 in_id = "UIImgBtnJumpLeftInUUID";
961 btn_rect.setLeftTopAndSize( 0, mRect.getHeight() - mTopBorderHeight + tab_fudge, button_width, TABCNTR_TAB_HEIGHT ); 1625 mJumpPrevArrowBtn = new LLButton("Jump Left Arrow", jump_left_arrow_btn_rect,
962 tab_img = "tab_top_blue.tga"; 1626 out_id, in_id, "",
963 tab_selected_img = "tab_top_selected_blue.tga"; 1627 &LLTabContainer::onJumpFirstBtn, this, LLFontGL::sSansSerif );
964 } 1628 mJumpPrevArrowBtn->setFollowsLeft();
965 else
966 {
967 btn_rect.setOriginAndSize( 0, 0 + tab_fudge, button_width, TABCNTR_TAB_HEIGHT );
968 tab_img = "tab_bottom_blue.tga";
969 tab_selected_img = "tab_bottom_selected_blue.tga";
970 }
971 1629
972 if (placeholder) 1630 out_id = "UIImgBtnScrollLeftOutUUID";
973 { 1631 in_id = "UIImgBtnScrollLeftInUUID";
974 // *FIX: wont work for horizontal tabs 1632 mPrevArrowBtn = new LLButton("Left Arrow", left_arrow_btn_rect,
975 btn_rect.translate(0, -LLBUTTON_V_PAD-2); 1633 out_id, in_id, "",
976 LLString box_label = trimmed_label; 1634 &LLTabContainer::onPrevBtn, this, LLFontGL::sSansSerif );
977 LLTextBox* text = new LLTextBox(box_label, btn_rect, box_label, font); 1635 mPrevArrowBtn->setHeldDownCallback(onPrevBtnHeld);
978 addChild( text, 0 ); 1636 mPrevArrowBtn->setFollowsLeft();
979 1637
980 LLButton* btn = new LLButton("", LLRect(0,0,0,0)); 1638 out_id = "UIImgBtnJumpRightOutUUID";
981 LLTabTuple* tuple = new LLTabTuple( this, child, btn, on_tab_clicked, userdata, text ); 1639 in_id = "UIImgBtnJumpRightInUUID";
982 addChild( btn, 0 ); 1640 mJumpNextArrowBtn = new LLButton("Jump Right Arrow", jump_right_arrow_btn_rect,
983 addChild( child, 1 ); 1641 out_id, in_id, "",
984 insertTuple(tuple, insertion_point); 1642 &LLTabContainer::onJumpLastBtn, this,
985 } 1643 LLFontGL::sSansSerif);
986 else 1644 mJumpNextArrowBtn->setFollowsRight();
987 { 1645
988 LLString tooltip = trimmed_label; 1646 out_id = "UIImgBtnScrollRightOutUUID";
989 tooltip += "\nAlt-Left arrow for previous tab"; 1647 in_id = "UIImgBtnScrollRightInUUID";
990 tooltip += "\nAlt-Right arrow for next tab"; 1648 mNextArrowBtn = new LLButton("Right Arrow", right_arrow_btn_rect,
991 1649 out_id, in_id, "",
992 LLButton* btn = new LLButton( 1650 &LLTabContainer::onNextBtn, this,
993 LLString(child->getName()) + " tab", 1651 LLFontGL::sSansSerif);
994 btn_rect, 1652 mNextArrowBtn->setFollowsRight();
995 "", "", "", 1653
996 &LLTabContainer::onTabBtn, NULL, // set userdata below 1654 if( getTabPosition() == TOP )
997 font,
998 trimmed_label, trimmed_label );
999 btn->setSaveToXML(false);
1000 btn->setVisible( FALSE );
1001 btn->setToolTip( tooltip );
1002 btn->setScaleImage(TRUE);
1003 btn->setImages(tab_img, tab_selected_img);
1004
1005 // Try to squeeze in a bit more text
1006 btn->setLeftHPad( 4 );
1007 btn->setRightHPad( 2 );
1008 btn->setHAlign(LLFontGL::LEFT);
1009 btn->setTabStop(FALSE);
1010 if (indent)
1011 {
1012 btn->setLeftHPad(indent);
1013 }
1014
1015 if( mTabPosition == TOP )
1016 { 1655 {
1017 btn->setFollowsTop(); 1656 mNextArrowBtn->setFollowsTop();
1657 mPrevArrowBtn->setFollowsTop();
1658 mJumpPrevArrowBtn->setFollowsTop();
1659 mJumpNextArrowBtn->setFollowsTop();
1018 } 1660 }
1019 else 1661 else
1020 { 1662 {
1021 btn->setFollowsBottom(); 1663 mNextArrowBtn->setFollowsBottom();
1664 mPrevArrowBtn->setFollowsBottom();
1665 mJumpPrevArrowBtn->setFollowsBottom();
1666 mJumpNextArrowBtn->setFollowsBottom();
1022 } 1667 }
1023
1024 LLTabTuple* tuple = new LLTabTuple( this, child, btn, on_tab_clicked, userdata );
1025 btn->setCallbackUserData( tuple );
1026 addChild( btn, 0 );
1027 addChild( child, 1 );
1028 insertTuple(tuple, insertion_point);
1029 } 1668 }
1030 1669
1031 updateMaxScrollPos(); 1670 mPrevArrowBtn->setHeldDownCallback(onPrevBtnHeld);
1671 mPrevArrowBtn->setSaveToXML(false);
1672 mPrevArrowBtn->setTabStop(FALSE);
1673 addChild(mPrevArrowBtn);
1032 1674
1033 if( select ) 1675 mNextArrowBtn->setHeldDownCallback(onNextBtnHeld);
1676 mNextArrowBtn->setSaveToXML(false);
1677 mNextArrowBtn->setTabStop(FALSE);
1678 addChild(mNextArrowBtn);
1679
1680 if (mJumpPrevArrowBtn)
1034 { 1681 {
1035 selectLastTab(); 1682 mJumpPrevArrowBtn->setSaveToXML(false);
1683 mJumpPrevArrowBtn->setTabStop(FALSE);
1684 addChild(mJumpPrevArrowBtn);
1036 } 1685 }
1686
1687 if (mJumpNextArrowBtn)
1688 {
1689 mJumpNextArrowBtn->setSaveToXML(false);
1690 mJumpNextArrowBtn->setTabStop(FALSE);
1691 addChild(mJumpNextArrowBtn);
1692 }
1693
1694 // set default tab group to be panel contents
1695 setDefaultTabGroup(1);
1037} 1696}
1038 1697
1039void LLTabContainer::removeTabPanel(LLPanel* child) 1698LLTabContainer::LLTabTuple* LLTabContainer::getTabByPanel(LLPanel* child)
1040{ 1699{
1041 // Adjust the total tab width.
1042 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) 1700 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
1043 { 1701 {
1044 LLTabTuple* tuple = *iter; 1702 LLTabTuple* tuple = *iter;
1045 if( tuple->mTabPanel == child ) 1703 if( tuple->mTabPanel == child )
1046 { 1704 {
1047 mTotalTabWidth -= tuple->mButton->getRect().getWidth(); 1705 return tuple;
1048 break;
1049 } 1706 }
1050 } 1707 }
1051 1708 return NULL;
1052 LLTabContainerCommon::removeTabPanel(child);
1053}
1054
1055void LLTabContainer::setPanelTitle(S32 index, const LLString& title)
1056{
1057 if (index >= 0 && index < (S32)mTabList.size())
1058 {
1059 LLTabTuple* tuple = mTabList[index];
1060 LLButton* tab_button = tuple->mButton;
1061 const LLFontGL* fontp = gResMgr->getRes( LLFONT_SANSSERIF_SMALL );
1062 mTotalTabWidth -= tab_button->getRect().getWidth();
1063 tab_button->reshape(llclamp(fontp->getWidth(title) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth), tab_button->getRect().getHeight());
1064 mTotalTabWidth += tab_button->getRect().getWidth();
1065 tab_button->setLabelSelected(title);
1066 tab_button->setLabelUnselected(title);
1067 }
1068 updateMaxScrollPos();
1069} 1709}
1070 1710
1071 1711void LLTabContainer::insertTuple(LLTabTuple * tuple, eInsertionPoint insertion_point)
1072void LLTabContainer::updateMaxScrollPos()
1073{ 1712{
1074 S32 tab_space = 0; 1713 switch(insertion_point)
1075 S32 available_space = 0;
1076 tab_space = mTotalTabWidth;
1077 available_space = mRect.getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_TAB_H_PAD);
1078
1079 if( tab_space > available_space )
1080 { 1714 {
1081 S32 available_width_with_arrows = mRect.getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1); 1715 case START:
1082 // subtract off reserved portion on left 1716 // insert the new tab in the front of the list
1083 available_width_with_arrows -= TABCNTR_TAB_PARTIAL_WIDTH; 1717 mTabList.insert(mTabList.begin() + mLockedTabCount, tuple);
1084 1718 break;
1085 S32 running_tab_width = 0; 1719 case LEFT_OF_CURRENT:
1086 mMaxScrollPos = mTabList.size(); 1720 // insert the new tab before the current tab (but not before mLockedTabCount)
1087 for(tuple_list_t::reverse_iterator tab_it = mTabList.rbegin(); tab_it != mTabList.rend(); ++tab_it)
1088 { 1721 {
1089 running_tab_width += (*tab_it)->mButton->getRect().getWidth(); 1722 tuple_list_t::iterator current_iter = mTabList.begin() + llmax(mLockedTabCount, mCurrentTabIdx);
1090 if (running_tab_width > available_width_with_arrows) 1723 mTabList.insert(current_iter, tuple);
1091 {
1092 break;
1093 }
1094 mMaxScrollPos--;
1095 } 1724 }
1096 // in case last tab doesn't actually fit on screen, make it the last scrolling position 1725 break;
1097 mMaxScrollPos = llmin(mMaxScrollPos, (S32)mTabList.size() - 1);
1098 }
1099 else
1100 {
1101 mMaxScrollPos = 0;
1102 mScrollPos = 0;
1103 }
1104 if (mScrollPos > mMaxScrollPos)
1105 {
1106 mScrollPos = mMaxScrollPos;
1107 }
1108}
1109 1726
1110void LLTabContainer::commitHoveredButton(S32 x, S32 y) 1727 case RIGHT_OF_CURRENT:
1111{ 1728 // insert the new tab after the current tab (but not before mLockedTabCount)
1112 if (hasMouseCapture())
1113 {
1114 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
1115 { 1729 {
1116 LLTabTuple* tuple = *iter; 1730 tuple_list_t::iterator current_iter = mTabList.begin() + llmax(mLockedTabCount, mCurrentTabIdx + 1);
1117 tuple->mButton->setVisible( TRUE ); 1731 mTabList.insert(current_iter, tuple);
1118 S32 local_x = x - tuple->mButton->getRect().mLeft;
1119 S32 local_y = y - tuple->mButton->getRect().mBottom;
1120 if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible())
1121 {
1122 tuple->mButton->onCommit();
1123 }
1124 } 1732 }
1733 break;
1734 case END:
1735 default:
1736 mTabList.push_back( tuple );
1125 } 1737 }
1126} 1738}
1127 1739
1128void LLTabContainer::setMinTabWidth(S32 width)
1129{
1130 mMinTabWidth = width;
1131}
1132
1133void LLTabContainer::setMaxTabWidth(S32 width)
1134{
1135 mMaxTabWidth = width;
1136}
1137
1138S32 LLTabContainer::getMinTabWidth() const
1139{
1140 return mMinTabWidth;
1141}
1142 1740
1143S32 LLTabContainer::getMaxTabWidth() const
1144{
1145 return mMaxTabWidth;
1146}
1147 1741
1148BOOL LLTabContainer::selectTab(S32 which) 1742void LLTabContainer::updateMaxScrollPos()
1149{ 1743{
1150 if (which >= (S32)mTabList.size()) return FALSE; 1744 BOOL no_scroll = TRUE;
1151 if (which < 0) return FALSE; 1745 if (mIsVertical)
1152
1153 //if( gFocusMgr.childHasKeyboardFocus( this ) )
1154 //{
1155 // gFocusMgr.setKeyboardFocus( NULL );
1156 //}
1157
1158 LLTabTuple* selected_tuple = mTabList[which];
1159 if (!selected_tuple)
1160 {
1161 return FALSE;
1162 }
1163
1164 if (mTabList[which]->mButton->getEnabled())
1165 { 1746 {
1166 mCurrentTabIdx = which; 1747 S32 tab_total_height = (BTN_HEIGHT + TABCNTRV_PAD) * getTabCount();
1167 1748 S32 available_height = getRect().getHeight() - getTopBorderHeight();
1168 S32 i = 0; 1749 if( tab_total_height > available_height )
1169 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
1170 { 1750 {
1171 LLTabTuple* tuple = *iter; 1751 S32 available_height_with_arrows = getRect().getHeight() - 2*(TABCNTRV_ARROW_BTN_SIZE + 3*TABCNTRV_PAD);
1172 BOOL is_selected = ( tuple == selected_tuple ); 1752 S32 additional_needed = tab_total_height - available_height_with_arrows;
1173 tuple->mTabPanel->setVisible( is_selected ); 1753 setMaxScrollPos((S32) ceil(additional_needed / float(BTN_HEIGHT) ) );
1174// tuple->mTabPanel->setFocus(is_selected); // not clear that we want to do this here. 1754 no_scroll = FALSE;
1175 tuple->mButton->setToggleState( is_selected );
1176 // RN: this limits tab-stops to active button only, which would require arrow keys to switch tabs
1177 tuple->mButton->setTabStop( is_selected );
1178
1179 if( is_selected && mMaxScrollPos > 0)
1180 {
1181 // Make sure selected tab is within scroll region
1182 if( i < mScrollPos )
1183 {
1184 mScrollPos = i;
1185 }
1186 else
1187 {
1188 S32 available_width_with_arrows = mRect.getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1);
1189 S32 running_tab_width = tuple->mButton->getRect().getWidth();
1190 S32 j = i - 1;
1191 S32 min_scroll_pos = i;
1192 if (running_tab_width < available_width_with_arrows)
1193 {
1194 while (j >= 0)
1195 {
1196 LLTabTuple* other_tuple = mTabList[j];
1197 running_tab_width += other_tuple->mButton->getRect().getWidth();
1198 if (running_tab_width > available_width_with_arrows)
1199 {
1200 break;
1201 }
1202 j--;
1203 }
1204 min_scroll_pos = j + 1;
1205 }
1206 mScrollPos = llclamp(mScrollPos, min_scroll_pos, i);
1207 mScrollPos = llmin(mScrollPos, mMaxScrollPos);
1208 }
1209 }
1210 i++;
1211 }
1212 if( selected_tuple->mOnChangeCallback )
1213 {
1214 selected_tuple->mOnChangeCallback( selected_tuple->mUserData, false );
1215 } 1755 }
1216 return TRUE;
1217 } 1756 }
1218 else 1757 else
1219 { 1758 {
1220 return FALSE; 1759 S32 tab_space = 0;
1221 } 1760 S32 available_space = 0;
1222} 1761 tab_space = mTotalTabWidth;
1762 available_space = getRect().getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_TAB_H_PAD);
1223 1763
1224void LLTabContainer::draw() 1764 if( tab_space > available_space )
1225{
1226 S32 target_pixel_scroll = 0;
1227 S32 cur_scroll_pos = mScrollPos;
1228 if (cur_scroll_pos > 0)
1229 {
1230 S32 available_width_with_arrows = mRect.getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1);
1231 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
1232 { 1765 {
1233 if (cur_scroll_pos == 0) 1766 S32 available_width_with_arrows = getRect().getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1);
1234 { 1767 // subtract off reserved portion on left
1235 break; 1768 available_width_with_arrows -= TABCNTR_TAB_PARTIAL_WIDTH;
1236 }
1237 target_pixel_scroll += (*iter)->mButton->getRect().getWidth();
1238 cur_scroll_pos--;
1239 }
1240 1769
1241 // Show part of the tab to the left of what is fully visible 1770 S32 running_tab_width = 0;
1242 target_pixel_scroll -= TABCNTR_TAB_PARTIAL_WIDTH; 1771 setMaxScrollPos(getTabCount());
1243 // clamp so that rightmost tab never leaves right side of screen 1772 for(tuple_list_t::reverse_iterator tab_it = mTabList.rbegin(); tab_it != mTabList.rend(); ++tab_it)
1244 target_pixel_scroll = llmin(mTotalTabWidth - available_width_with_arrows, target_pixel_scroll);
1245 }
1246
1247 mScrollPosPixels = (S32)lerp((F32)mScrollPosPixels, (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f));
1248 if( getVisible() )
1249 {
1250 BOOL has_scroll_arrows = (mMaxScrollPos > 0) || (mScrollPosPixels > 0);
1251 mJumpLeftArrowBtn->setVisible( has_scroll_arrows );
1252 mJumpRightArrowBtn->setVisible( has_scroll_arrows );
1253 mLeftArrowBtn->setVisible( has_scroll_arrows );
1254 mRightArrowBtn->setVisible( has_scroll_arrows );
1255
1256 // Set the leftmost position of the tab buttons.
1257 S32 left = LLPANEL_BORDER_WIDTH + (has_scroll_arrows ? (TABCNTR_ARROW_BTN_SIZE * 2) : TABCNTR_TAB_H_PAD);
1258 left -= mScrollPosPixels;
1259
1260 // Hide all the buttons
1261 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
1262 {
1263 LLTabTuple* tuple = *iter;
1264 tuple->mButton->setVisible( FALSE );
1265 }
1266
1267 LLPanel::draw();
1268
1269 // if tabs are hidden, don't draw them and leave them in the invisible state
1270 if (!mTabsHidden)
1271 {
1272 // Show all the buttons
1273 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
1274 {
1275 LLTabTuple* tuple = *iter;
1276 tuple->mButton->setVisible( TRUE );
1277 }
1278
1279 // Draw some of the buttons...
1280 LLRect clip_rect = getLocalRect();
1281 if (has_scroll_arrows)
1282 { 1773 {
1283 // ...but clip them. 1774 running_tab_width += (*tab_it)->mButton->getRect().getWidth();
1284 clip_rect.mLeft = mLeftArrowBtn->getRect().mRight; 1775 if (running_tab_width > available_width_with_arrows)
1285 clip_rect.mRight = mRightArrowBtn->getRect().mLeft;
1286 }
1287 LLLocalClipRect clip(clip_rect);
1288
1289 S32 max_scroll_visible = mTabList.size() - mMaxScrollPos + mScrollPos;
1290 S32 idx = 0;
1291 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
1292 {
1293 LLTabTuple* tuple = *iter;
1294
1295 tuple->mButton->translate( left - tuple->mButton->getRect().mLeft, 0 );
1296 left += tuple->mButton->getRect().getWidth();
1297
1298 if( idx < mScrollPos )
1299 {
1300 if( tuple->mButton->getFlashing() )
1301 {
1302 mLeftArrowBtn->setFlashing( TRUE );
1303 }
1304 }
1305 else
1306 if( max_scroll_visible < idx )
1307 { 1776 {
1308 if( tuple->mButton->getFlashing() ) 1777 break;
1309 {
1310 mRightArrowBtn->setFlashing( TRUE );
1311 }
1312 }
1313
1314 LLUI::pushMatrix();
1315 {
1316 LLUI::translate((F32)tuple->mButton->getRect().mLeft, (F32)tuple->mButton->getRect().mBottom, 0.f);
1317 tuple->mButton->draw();
1318 } 1778 }
1319 LLUI::popMatrix(); 1779 setMaxScrollPos(getMaxScrollPos()-1);
1320
1321 idx++;
1322 } 1780 }
1781 // in case last tab doesn't actually fit on screen, make it the last scrolling position
1782 setMaxScrollPos(llmin(getMaxScrollPos(), getTabCount() - 1));
1783 no_scroll = FALSE;
1323 } 1784 }
1324
1325 mLeftArrowBtn->setFlashing(FALSE);
1326 mRightArrowBtn->setFlashing(FALSE);
1327 } 1785 }
1328} 1786 if (no_scroll)
1329
1330
1331void LLTabContainer::setRightTabBtnOffset(S32 offset)
1332{
1333 mRightArrowBtn->translate( -offset - mRightTabBtnOffset, 0 );
1334 mRightTabBtnOffset = offset;
1335 updateMaxScrollPos();
1336}
1337
1338BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask )
1339{
1340 BOOL handled = FALSE;
1341 BOOL has_scroll_arrows = (mMaxScrollPos > 0);
1342
1343 if (has_scroll_arrows)
1344 {
1345 if (mJumpLeftArrowBtn->getRect().pointInRect(x, y))
1346 {
1347 S32 local_x = x - mJumpLeftArrowBtn->getRect().mLeft;
1348 S32 local_y = y - mJumpLeftArrowBtn->getRect().mBottom;
1349 handled = mJumpLeftArrowBtn->handleMouseDown(local_x, local_y, mask);
1350 }
1351 if (mJumpRightArrowBtn->getRect().pointInRect(x, y))
1352 {
1353 S32 local_x = x - mJumpRightArrowBtn->getRect().mLeft;
1354 S32 local_y = y - mJumpRightArrowBtn->getRect().mBottom;
1355 handled = mJumpRightArrowBtn->handleMouseDown(local_x, local_y, mask);
1356 }
1357 if (mLeftArrowBtn->getRect().pointInRect(x, y))
1358 {
1359 S32 local_x = x - mLeftArrowBtn->getRect().mLeft;
1360 S32 local_y = y - mLeftArrowBtn->getRect().mBottom;
1361 handled = mLeftArrowBtn->handleMouseDown(local_x, local_y, mask);
1362 }
1363 else if (mRightArrowBtn->getRect().pointInRect(x, y))
1364 {
1365 S32 local_x = x - mRightArrowBtn->getRect().mLeft;
1366 S32 local_y = y - mRightArrowBtn->getRect().mBottom;
1367 handled = mRightArrowBtn->handleMouseDown(local_x, local_y, mask);
1368 }
1369 }
1370 if (!handled)
1371 { 1787 {
1372 handled = LLPanel::handleMouseDown( x, y, mask ); 1788 setMaxScrollPos(0);
1373 } 1789 setScrollPos(0);
1374
1375 if (mTabList.size() > 0)
1376 {
1377 LLTabTuple* firsttuple = mTabList[0];
1378 LLRect tab_rect(has_scroll_arrows ? mLeftArrowBtn->getRect().mRight : mJumpLeftArrowBtn->getRect().mLeft,
1379 firsttuple->mButton->getRect().mTop,
1380 has_scroll_arrows ? mRightArrowBtn->getRect().mLeft : mJumpRightArrowBtn->getRect().mRight,
1381 firsttuple->mButton->getRect().mBottom );
1382 if( tab_rect.pointInRect( x, y ) )
1383 {
1384 LLButton* tab_button = mTabList[getCurrentPanelIndex()]->mButton;
1385 gFocusMgr.setMouseCapture(this);
1386 gFocusMgr.setKeyboardFocus(tab_button);
1387 }
1388 }
1389 return handled;
1390}
1391
1392BOOL LLTabContainer::handleHover( S32 x, S32 y, MASK mask )
1393{
1394 BOOL handled = FALSE;
1395 BOOL has_scroll_arrows = (mMaxScrollPos > 0);
1396
1397 if (has_scroll_arrows)
1398 {
1399 if (mJumpLeftArrowBtn->getRect().pointInRect(x, y))
1400 {
1401 S32 local_x = x - mJumpLeftArrowBtn->getRect().mLeft;
1402 S32 local_y = y - mJumpLeftArrowBtn->getRect().mBottom;
1403 handled = mJumpLeftArrowBtn->handleHover(local_x, local_y, mask);
1404 }
1405 if (mJumpRightArrowBtn->getRect().pointInRect(x, y))
1406 {
1407 S32 local_x = x - mJumpRightArrowBtn->getRect().mLeft;
1408 S32 local_y = y - mJumpRightArrowBtn->getRect().mBottom;
1409 handled = mJumpRightArrowBtn->handleHover(local_x, local_y, mask);
1410 }
1411 if (mLeftArrowBtn->getRect().pointInRect(x, y))
1412 {
1413 S32 local_x = x - mLeftArrowBtn->getRect().mLeft;
1414 S32 local_y = y - mLeftArrowBtn->getRect().mBottom;
1415 handled = mLeftArrowBtn->handleHover(local_x, local_y, mask);
1416 }
1417 else if (mRightArrowBtn->getRect().pointInRect(x, y))
1418 {
1419 S32 local_x = x - mRightArrowBtn->getRect().mLeft;
1420 S32 local_y = y - mRightArrowBtn->getRect().mBottom;
1421 handled = mRightArrowBtn->handleHover(local_x, local_y, mask);
1422 }
1423 } 1790 }
1424 if (!handled) 1791 if (getScrollPos() > getMaxScrollPos())
1425 { 1792 {
1426 handled = LLPanel::handleHover(x, y, mask); 1793 setScrollPos(getMaxScrollPos()); // maybe just enforce this via limits in setScrollPos instead?
1427 } 1794 }
1428
1429 commitHoveredButton(x, y);
1430 return handled;
1431} 1795}
1432 1796
1433BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) 1797void LLTabContainer::commitHoveredButton(S32 x, S32 y)
1434{ 1798{
1435 BOOL handled = FALSE;
1436 BOOL has_scroll_arrows = (mMaxScrollPos > 0);
1437
1438 if (has_scroll_arrows)
1439 {
1440 if (mJumpLeftArrowBtn->getRect().pointInRect(x, y))
1441 {
1442 S32 local_x = x - mJumpLeftArrowBtn->getRect().mLeft;
1443 S32 local_y = y - mJumpLeftArrowBtn->getRect().mBottom;
1444 handled = mJumpLeftArrowBtn->handleMouseUp(local_x, local_y, mask);
1445 }
1446 if (mJumpRightArrowBtn->getRect().pointInRect(x, y))
1447 {
1448 S32 local_x = x - mJumpRightArrowBtn->getRect().mLeft;
1449 S32 local_y = y - mJumpRightArrowBtn->getRect().mBottom;
1450 handled = mJumpRightArrowBtn->handleMouseUp(local_x, local_y, mask);
1451 }
1452 if (mLeftArrowBtn->getRect().pointInRect(x, y))
1453 {
1454 S32 local_x = x - mLeftArrowBtn->getRect().mLeft;
1455 S32 local_y = y - mLeftArrowBtn->getRect().mBottom;
1456 handled = mLeftArrowBtn->handleMouseUp(local_x, local_y, mask);
1457 }
1458 else if (mRightArrowBtn->getRect().pointInRect(x, y))
1459 {
1460 S32 local_x = x - mRightArrowBtn->getRect().mLeft;
1461 S32 local_y = y - mRightArrowBtn->getRect().mBottom;
1462 handled = mRightArrowBtn->handleMouseUp(local_x, local_y, mask);
1463 }
1464 }
1465 if (!handled)
1466 {
1467 handled = LLPanel::handleMouseUp( x, y, mask );
1468 }
1469
1470 commitHoveredButton(x, y);
1471 LLPanel* cur_panel = getCurrentPanel();
1472 if (hasMouseCapture()) 1799 if (hasMouseCapture())
1473 { 1800 {
1474 if (cur_panel)
1475 {
1476 if (!cur_panel->focusFirstItem(FALSE))
1477 {
1478 // if nothing in the panel gets focus, make sure the new tab does
1479 // otherwise the last tab might keep focus
1480 mTabList[getCurrentPanelIndex()]->mButton->setFocus(TRUE);
1481 }
1482 }
1483 gFocusMgr.setMouseCapture(NULL);
1484 }
1485 return handled;
1486}
1487
1488BOOL LLTabContainer::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect )
1489{
1490 BOOL handled = LLPanel::handleToolTip( x, y, msg, sticky_rect );
1491 if (!handled && mTabList.size() > 0)
1492 {
1493 LLTabTuple* firsttuple = mTabList[0];
1494
1495 BOOL has_scroll_arrows = (mMaxScrollPos > 0);
1496 LLRect clip(
1497 has_scroll_arrows ? mJumpLeftArrowBtn->getRect().mRight : mJumpLeftArrowBtn->getRect().mLeft,
1498 firsttuple->mButton->getRect().mTop,
1499 has_scroll_arrows ? mRightArrowBtn->getRect().mLeft : mRightArrowBtn->getRect().mRight,
1500 0 );
1501 if( clip.pointInRect( x, y ) )
1502 {
1503 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
1504 {
1505 LLTabTuple* tuple = *iter;
1506 tuple->mButton->setVisible( TRUE );
1507 S32 local_x = x - tuple->mButton->getRect().mLeft;
1508 S32 local_y = y - tuple->mButton->getRect().mBottom;
1509 handled = tuple->mButton->handleToolTip( local_x, local_y, msg, sticky_rect );
1510 if( handled )
1511 {
1512 break;
1513 }
1514 }
1515 }
1516
1517 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) 1801 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
1518 { 1802 {
1519 LLTabTuple* tuple = *iter; 1803 LLTabTuple* tuple = *iter;
1520 tuple->mButton->setVisible( FALSE ); 1804 tuple->mButton->setVisible( TRUE );
1521 } 1805 S32 local_x = x - tuple->mButton->getRect().mLeft;
1522 } 1806 S32 local_y = y - tuple->mButton->getRect().mBottom;
1523 return handled; 1807 if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible())
1524}
1525
1526BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
1527{
1528 if (!getEnabled()) return FALSE;
1529
1530 if (!gFocusMgr.childHasKeyboardFocus(this)) return FALSE;
1531
1532 BOOL handled = FALSE;
1533 if (key == KEY_LEFT && mask == MASK_ALT)
1534 {
1535 selectPrevTab();
1536 handled = TRUE;
1537 }
1538 else if (key == KEY_RIGHT && mask == MASK_ALT)
1539 {
1540 selectNextTab();
1541 handled = TRUE;
1542 }
1543
1544 if (handled)
1545 {
1546 if (getCurrentPanel())
1547 {
1548 getCurrentPanel()->setFocus(TRUE);
1549 }
1550 }
1551
1552 if (!gFocusMgr.childHasKeyboardFocus(getCurrentPanel()))
1553 {
1554 // if child has focus, but not the current panel, focus
1555 // is on a button
1556 switch(key)
1557 {
1558 case KEY_UP:
1559 if (getTabPosition() == BOTTOM && getCurrentPanel())
1560 {
1561 getCurrentPanel()->setFocus(TRUE);
1562 }
1563 handled = TRUE;
1564 break;
1565 case KEY_DOWN:
1566 if (getTabPosition() == TOP && getCurrentPanel())
1567 {
1568 getCurrentPanel()->setFocus(TRUE);
1569 }
1570 handled = TRUE;
1571 break;
1572 case KEY_LEFT:
1573 selectPrevTab();
1574 handled = TRUE;
1575 break;
1576 case KEY_RIGHT:
1577 selectNextTab();
1578 handled = TRUE;
1579 break;
1580 default:
1581 break;
1582 }
1583 }
1584 return handled;
1585}
1586
1587// virtual
1588LLXMLNodePtr LLTabContainer::getXML(bool save_children) const
1589{
1590 LLXMLNodePtr node = LLTabContainerCommon::getXML();
1591
1592 node->createChild("tab_position", TRUE)->setStringValue((mTabPosition == TOP ? "top" : "bottom"));
1593
1594 return node;
1595}
1596
1597BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, LLString &tooltip)
1598{
1599 BOOL has_scroll_arrows = (mMaxScrollPos > 0);
1600
1601 if( mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME )
1602 {
1603
1604 if (has_scroll_arrows)
1605 {
1606 if (mJumpLeftArrowBtn->getRect().pointInRect(x, y))
1607 {
1608 S32 local_x = x - mJumpLeftArrowBtn->getRect().mLeft;
1609 S32 local_y = y - mJumpLeftArrowBtn->getRect().mBottom;
1610 mJumpLeftArrowBtn->handleHover(local_x, local_y, mask);
1611 }
1612 if (mJumpRightArrowBtn->getRect().pointInRect(x, y))
1613 {
1614 S32 local_x = x - mJumpRightArrowBtn->getRect().mLeft;
1615 S32 local_y = y - mJumpRightArrowBtn->getRect().mBottom;
1616 mJumpRightArrowBtn->handleHover(local_x, local_y, mask);
1617 }
1618 if (mLeftArrowBtn->getRect().pointInRect(x, y))
1619 {
1620 S32 local_x = x - mLeftArrowBtn->getRect().mLeft;
1621 S32 local_y = y - mLeftArrowBtn->getRect().mBottom;
1622 mLeftArrowBtn->handleHover(local_x, local_y, mask);
1623 }
1624 else if (mRightArrowBtn->getRect().pointInRect(x, y))
1625 {
1626 S32 local_x = x - mRightArrowBtn->getRect().mLeft;
1627 S32 local_y = y - mRightArrowBtn->getRect().mBottom;
1628 mRightArrowBtn->handleHover(local_x, local_y, mask);
1629 }
1630 }
1631
1632 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
1633 {
1634 LLTabTuple* tuple = *iter;
1635 tuple->mButton->setVisible( TRUE );
1636 S32 local_x = x - tuple->mButton->getRect().mLeft;
1637 S32 local_y = y - tuple->mButton->getRect().mBottom;
1638 if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible())
1639 { 1808 {
1640 tuple->mButton->onCommit(); 1809 tuple->mButton->onCommit();
1641 mDragAndDropDelayTimer.stop();
1642 } 1810 }
1643 } 1811 }
1644 } 1812 }
1645
1646 return LLView::handleDragAndDrop(x, y, mask, drop, type, cargo_data, accept, tooltip);
1647} 1813}
1648 1814
1649void LLTabContainer::setTabImage(LLPanel* child, std::string image_name, const LLColor4& color)
1650{
1651 LLTabTuple* tuple = getTabByPanel(child);
1652 if( tuple )
1653 {
1654 tuple->mButton->setImageOverlay(image_name, LLFontGL::RIGHT, color);
1655
1656 const LLFontGL* fontp = gResMgr->getRes( LLFONT_SANSSERIF_SMALL );
1657 // remove current width from total tab strip width
1658 mTotalTabWidth -= tuple->mButton->getRect().getWidth();
1659
1660 S32 image_overlay_width = tuple->mButton->getImageOverlay().notNull() ?
1661 tuple->mButton->getImageOverlay()->getImage()->getWidth(0) :
1662 0;
1663
1664 tuple->mPadding = image_overlay_width;
1665
1666 tuple->mButton->setRightHPad(6);
1667 tuple->mButton->reshape(llclamp(fontp->getWidth(tuple->mButton->getLabelSelected()) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth),
1668 tuple->mButton->getRect().getHeight());
1669 // add back in button width to total tab strip width
1670 mTotalTabWidth += tuple->mButton->getRect().getWidth();
1671
1672 // tabs have changed size, might need to scroll to see current tab
1673 updateMaxScrollPos();
1674 }
1675}
diff --git a/linden/indra/llui/lltabcontainer.h b/linden/indra/llui/lltabcontainer.h
index e2770ee..07554b4 100644
--- a/linden/indra/llui/lltabcontainer.h
+++ b/linden/indra/llui/lltabcontainer.h
@@ -1,6 +1,6 @@
1/** 1/**
2 * @file lltabcontainer.h 2 * @file lltabcontainer.h
3 * @brief LLTabContainerCommon base class 3 * @brief LLTabContainer class
4 * 4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$ 5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 * 6 *
@@ -29,19 +29,16 @@
29 * $/LicenseInfo$ 29 * $/LicenseInfo$
30 */ 30 */
31 31
32// Fear my script-fu!
33
34#ifndef LL_TABCONTAINER_H 32#ifndef LL_TABCONTAINER_H
35#define LL_TABCONTAINER_H 33#define LL_TABCONTAINER_H
36 34
37#include "llpanel.h" 35#include "llpanel.h"
36#include "lltextbox.h"
38#include "llframetimer.h" 37#include "llframetimer.h"
39 38
40class LLButton; 39extern const S32 TABCNTR_HEADER_HEIGHT;
41class LLTextBox;
42
43 40
44class LLTabContainerCommon : public LLPanel 41class LLTabContainer : public LLPanel
45{ 42{
46public: 43public:
47 enum TabPosition 44 enum TabPosition
@@ -58,81 +55,82 @@ public:
58 RIGHT_OF_CURRENT 55 RIGHT_OF_CURRENT
59 } eInsertionPoint; 56 } eInsertionPoint;
60 57
61 LLTabContainerCommon( const LLString& name, 58 LLTabContainer( const LLString& name, const LLRect& rect, TabPosition pos,
62 const LLRect& rect, 59 BOOL bordered, BOOL is_vertical);
63 TabPosition pos,
64 void(*close_callback)(void*), void* callback_userdata,
65 BOOL bordered = TRUE);
66
67 LLTabContainerCommon( const LLString& name,
68 const LLString& rect_control,
69 TabPosition pos,
70 void(*close_callback)(void*), void* callback_userdata,
71 BOOL bordered = TRUE);
72 60
73 virtual ~LLTabContainerCommon(); 61 /*virtual*/ ~LLTabContainer();
74 62
75 virtual void initButtons() = 0; 63 // from LLView
76 64 /*virtual*/ void setValue(const LLSD& value);
77 virtual void setValue(const LLSD& value) { selectTab((S32) value.asInteger()); } 65 /*virtual*/ EWidgetType getWidgetType() const;
78 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_TAB_CONTAINER; } 66 /*virtual*/ LLString getWidgetTag() const;
79 virtual LLString getWidgetTag() const { return LL_TAB_CONTAINER_COMMON_TAG; } 67 /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent);
80 68 /*virtual*/ void draw();
81 virtual LLView* getChildByName(const LLString& name, BOOL recurse = FALSE) const; 69 /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask );
82 70 /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask );
83 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 71 /*virtual*/ BOOL handleMouseUp( S32 x, S32 y, MASK mask );
84 72 /*virtual*/ BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect );
85 virtual void addTabPanel(LLPanel* child, 73 /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
86 const LLString& label, 74 /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
87 BOOL select = FALSE, 75 EDragAndDropType type, void* cargo_data,
88 void (*on_tab_clicked)(void*, bool) = NULL, 76 EAcceptance* accept, LLString& tooltip);
89 void* userdata = NULL, 77 /*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
90 S32 indent = 0, 78
91 BOOL placeholder = FALSE, 79 void addTabPanel(LLPanel* child,
92 eInsertionPoint insertion_point = END) = 0; 80 const LLString& label,
93 virtual void addPlaceholder(LLPanel* child, const LLString& label); 81 BOOL select = FALSE,
94 virtual void lockTabs(S32 num_tabs = 0); 82 void (*on_tab_clicked)(void*, bool) = NULL,
95 virtual void unlockTabs(); 83 void* userdata = NULL,
96 S32 getNumLockedTabs() { return mLockedTabCount; } 84 S32 indent = 0,
97 85 BOOL placeholder = FALSE,
98 virtual void enableTabButton(S32 which, BOOL enable); 86 eInsertionPoint insertion_point = END);
99 87 void addPlaceholder(LLPanel* child, const LLString& label);
100 virtual void removeTabPanel( LLPanel* child ); 88 void removeTabPanel( LLPanel* child );
101 virtual void deleteAllTabs(); 89 void lockTabs(S32 num_tabs = 0);
102 virtual LLPanel* getCurrentPanel(); 90 void unlockTabs();
103 virtual S32 getCurrentPanelIndex(); 91 S32 getNumLockedTabs() { return mLockedTabCount; }
104 virtual S32 getTabCount(); 92 void enableTabButton(S32 which, BOOL enable);
105 virtual S32 getPanelIndexByTitle(const LLString& title); 93 void deleteAllTabs();
106 virtual LLPanel* getPanelByIndex(S32 index); 94 LLPanel* getCurrentPanel();
107 virtual LLPanel* getPanelByName(const LLString& name); 95 S32 getCurrentPanelIndex();
108 virtual S32 getIndexForPanel(LLPanel* panel); 96 S32 getTabCount();
109 97 LLPanel* getPanelByIndex(S32 index);
110 virtual void setCurrentTabName(const LLString& name); 98 S32 getIndexForPanel(LLPanel* panel);
111 99 S32 getPanelIndexByTitle(const LLString& title);
112 100 LLPanel* getPanelByName(const LLString& name);
113 virtual void selectFirstTab(); 101 void setCurrentTabName(const LLString& name);
114 virtual void selectLastTab(); 102
115 virtual BOOL selectTabPanel( LLPanel* child ); 103 void selectFirstTab();
116 virtual BOOL selectTab(S32 which) = 0; 104 void selectLastTab();
117 virtual BOOL selectTabByName(const LLString& title); 105 void selectNextTab();
118 virtual void selectNextTab(); 106 void selectPrevTab();
119 virtual void selectPrevTab(); 107 BOOL selectTabPanel( LLPanel* child );
108 BOOL selectTab(S32 which);
109 BOOL selectTabByName(const LLString& title);
120 110
121 BOOL getTabPanelFlashing(LLPanel* child); 111 BOOL getTabPanelFlashing(LLPanel* child);
122 void setTabPanelFlashing(LLPanel* child, BOOL state); 112 void setTabPanelFlashing(LLPanel* child, BOOL state);
123 virtual void setTabImage(LLPanel* child, std::string img_name, const LLColor4& color = LLColor4::white); 113 void setTabImage(LLPanel* child, std::string img_name, const LLColor4& color = LLColor4::white);
124 void setTitle( const LLString& title ); 114 void setTitle( const LLString& title );
125 const LLString getPanelTitle(S32 index); 115 const LLString getPanelTitle(S32 index);
126 116
127 void setDragAndDropDelayTimer() { mDragAndDropDelayTimer.start(); } 117 void setTopBorderHeight(S32 height);
128 118 S32 getTopBorderHeight() const;
129 virtual void setTopBorderHeight(S32 height);
130 119
131 virtual void setTabChangeCallback(LLPanel* tab, void (*on_tab_clicked)(void*,bool)); 120 void setTabChangeCallback(LLPanel* tab, void (*on_tab_clicked)(void*,bool));
132 virtual void setTabUserData(LLPanel* tab, void* userdata); 121 void setTabUserData(LLPanel* tab, void* userdata);
133 122
134 virtual void reshape(S32 width, S32 height, BOOL called_from_parent); 123 void setRightTabBtnOffset( S32 offset );
124 void setPanelTitle(S32 index, const LLString& title);
135 125
126 TabPosition getTabPosition() const { return mTabPosition; }
127 void setMinTabWidth(S32 width) { mMinTabWidth = width; }
128 void setMaxTabWidth(S32 width) { mMaxTabWidth = width; }
129 S32 getMinTabWidth() const { return mMinTabWidth; }
130 S32 getMaxTabWidth() const { return mMaxTabWidth; }
131
132 void startDragAndDropDelayTimer() { mDragAndDropDelayTimer.start(); }
133
136 static void onCloseBtn(void* userdata); 134 static void onCloseBtn(void* userdata);
137 static void onTabBtn(void* userdata); 135 static void onTabBtn(void* userdata);
138 static void onNextBtn(void* userdata); 136 static void onNextBtn(void* userdata);
@@ -142,17 +140,17 @@ public:
142 static void onJumpFirstBtn( void* userdata ); 140 static void onJumpFirstBtn( void* userdata );
143 static void onJumpLastBtn( void* userdata ); 141 static void onJumpLastBtn( void* userdata );
144 142
145 virtual void setRightTabBtnOffset( S32 offset ) { } 143 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
146 virtual void setPanelTitle(S32 index, const LLString& title) { }
147 144
148 virtual TabPosition getTabPosition() { return mTabPosition; } 145protected:
146 /*virtual*/ LLView* getChildByName(const LLString& name, BOOL recurse = FALSE) const;
149 147
150 148
151protected: 149private:
152 // Structure used to map tab buttons to and from tab panels 150 // Structure used to map tab buttons to and from tab panels
153 struct LLTabTuple 151 struct LLTabTuple
154 { 152 {
155 LLTabTuple( LLTabContainerCommon* c, LLPanel* p, LLButton* b, 153 LLTabTuple( LLTabContainer* c, LLPanel* p, LLButton* b,
156 void (*cb)(void*,bool), void* userdata, LLTextBox* placeholder = NULL ) 154 void (*cb)(void*,bool), void* userdata, LLTextBox* placeholder = NULL )
157 : 155 :
158 mTabContainer(c), 156 mTabContainer(c),
@@ -165,7 +163,7 @@ protected:
165 mPadding(0) 163 mPadding(0)
166 {} 164 {}
167 165
168 LLTabContainerCommon* mTabContainer; 166 LLTabContainer* mTabContainer;
169 LLPanel* mTabPanel; 167 LLPanel* mTabPanel;
170 LLButton* mButton; 168 LLButton* mButton;
171 void (*mOnChangeCallback)(void*, bool); 169 void (*mOnChangeCallback)(void*, bool);
@@ -175,8 +173,35 @@ protected:
175 S32 mPadding; 173 S32 mPadding;
176 }; 174 };
177 175
176 void initButtons();
177
178 LLTabTuple* getTab(S32 index) { return mTabList[index]; }
179 LLTabTuple* getTabByPanel(LLPanel* child);
180 void insertTuple(LLTabTuple * tuple, eInsertionPoint insertion_point);
181
182 S32 getScrollPos() const { return mScrollPos; }
183 void setScrollPos(S32 pos) { mScrollPos = pos; }
184 S32 getMaxScrollPos() const { return mMaxScrollPos; }
185 void setMaxScrollPos(S32 pos) { mMaxScrollPos = pos; }
186 S32 getScrollPosPixels() const { return mScrollPosPixels; }
187 void setScrollPosPixels(S32 pixels) { mScrollPosPixels = pixels; }
188
189 void setTabsHidden(BOOL hidden) { mTabsHidden = hidden; }
190 BOOL getTabsHidden() const { return mTabsHidden; }
191
192 void setCurrentPanelIndex(S32 index) { mCurrentTabIdx = index; }
193
194 void scrollPrev() { mScrollPos = llmax(0, mScrollPos-1); } // No wrap
195 void scrollNext() { mScrollPos = llmin(mScrollPos+1, mMaxScrollPos); } // No wrap
196
197 void updateMaxScrollPos();
198 void commitHoveredButton(S32 x, S32 y);
199
200 // Variables
201
178 typedef std::vector<LLTabTuple*> tuple_list_t; 202 typedef std::vector<LLTabTuple*> tuple_list_t;
179 tuple_list_t mTabList; 203 tuple_list_t mTabList;
204
180 S32 mCurrentTabIdx; 205 S32 mCurrentTabIdx;
181 BOOL mTabsHidden; 206 BOOL mTabsHidden;
182 207
@@ -186,8 +211,6 @@ protected:
186 S32 mScrollPosPixels; 211 S32 mScrollPosPixels;
187 S32 mMaxScrollPos; 212 S32 mMaxScrollPos;
188 213
189 LLFrameTimer mDragAndDropDelayTimer;
190
191 void (*mCloseCallback)(void*); 214 void (*mCloseCallback)(void*);
192 void* mCallbackUserdata; 215 void* mCallbackUserdata;
193 216
@@ -196,87 +219,23 @@ protected:
196 S32 mTopBorderHeight; 219 S32 mTopBorderHeight;
197 TabPosition mTabPosition; 220 TabPosition mTabPosition;
198 S32 mLockedTabCount; 221 S32 mLockedTabCount;
222 S32 mMinTabWidth;
223 LLButton* mPrevArrowBtn;
224 LLButton* mNextArrowBtn;
199 225
200protected: 226 BOOL mIsVertical;
201 void scrollPrev();
202 void scrollNext();
203
204 virtual void updateMaxScrollPos() = 0;
205 virtual void commitHoveredButton(S32 x, S32 y) = 0;
206 LLTabTuple* getTabByPanel(LLPanel* child);
207 void insertTuple(LLTabTuple * tuple, eInsertionPoint insertion_point);
208};
209
210class LLTabContainer : public LLTabContainerCommon
211{
212public:
213 LLTabContainer( const LLString& name, const LLRect& rect, TabPosition pos,
214 void(*close_callback)(void*), void* callback_userdata,
215 const LLString& title=LLString::null, BOOL bordered = TRUE );
216
217 LLTabContainer( const LLString& name, const LLString& rect_control, TabPosition pos,
218 void(*close_callback)(void*), void* callback_userdata,
219 const LLString& title=LLString::null, BOOL bordered = TRUE );
220
221 ~LLTabContainer();
222
223 /*virtual*/ void initButtons();
224
225 /*virtual*/ void draw();
226
227 /*virtual*/ void addTabPanel(LLPanel* child,
228 const LLString& label,
229 BOOL select = FALSE,
230 void (*on_tab_clicked)(void*, bool) = NULL,
231 void* userdata = NULL,
232 S32 indent = 0,
233 BOOL placeholder = FALSE,
234 eInsertionPoint insertion_point = END);
235
236 /*virtual*/ BOOL selectTab(S32 which);
237 /*virtual*/ void removeTabPanel( LLPanel* child );
238
239 /*virtual*/ void setPanelTitle(S32 index, const LLString& title);
240 /*virtual*/ void setTabImage(LLPanel* child, std::string img_name, const LLColor4& color = LLColor4::white);
241 /*virtual*/ void setRightTabBtnOffset( S32 offset );
242
243 /*virtual*/ void setMinTabWidth(S32 width);
244 /*virtual*/ void setMaxTabWidth(S32 width);
245
246 /*virtual*/ S32 getMinTabWidth() const;
247 /*virtual*/ S32 getMaxTabWidth() const;
248
249 /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask );
250 /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask );
251 /*virtual*/ BOOL handleMouseUp( S32 x, S32 y, MASK mask );
252 /*virtual*/ BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect );
253 /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
254 /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
255 EDragAndDropType type, void* cargo_data,
256 EAcceptance* accept, LLString& tooltip);
257
258 virtual LLXMLNodePtr getXML(bool save_children = true) const;
259
260 227
261protected: 228 // Horizontal specific
262 229 LLButton* mJumpPrevArrowBtn;
263 LLButton* mLeftArrowBtn; 230 LLButton* mJumpNextArrowBtn;
264 LLButton* mJumpLeftArrowBtn;
265 LLButton* mRightArrowBtn;
266 LLButton* mJumpRightArrowBtn;
267 231
268 S32 mRightTabBtnOffset; // Extra room to the right of the tab buttons. 232 S32 mRightTabBtnOffset; // Extra room to the right of the tab buttons.
269 233
270protected:
271 virtual void updateMaxScrollPos();
272 virtual void commitHoveredButton(S32 x, S32 y);
273
274 S32 mMinTabWidth;
275 S32 mMaxTabWidth; 234 S32 mMaxTabWidth;
276 S32 mTotalTabWidth; 235 S32 mTotalTabWidth;
236
237 LLFrameTimer mDragAndDropDelayTimer;
277}; 238};
278 239
279const S32 TABCNTR_CLOSE_BTN_SIZE = 16;
280const S32 TABCNTR_HEADER_HEIGHT = LLPANEL_BORDER_WIDTH + TABCNTR_CLOSE_BTN_SIZE;
281 240
282#endif // LL_TABCONTAINER_H 241#endif // LL_TABCONTAINER_H
diff --git a/linden/indra/llui/lltabcontainervertical.cpp b/linden/indra/llui/lltabcontainervertical.cpp
index 334cb43..b4b2710 100644
--- a/linden/indra/llui/lltabcontainervertical.cpp
+++ b/linden/indra/llui/lltabcontainervertical.cpp
@@ -29,584 +29,4 @@
29 * $/LicenseInfo$ 29 * $/LicenseInfo$
30 */ 30 */
31 31
32// Fear my script-fu! 32// deprecated: see LLTabContainer
33
34#include "linden_common.h"
35
36#include "lltabcontainervertical.h"
37
38#include "llfocusmgr.h"
39#include "llfontgl.h"
40#include "llgl.h"
41
42#include "llbutton.h"
43#include "llrect.h"
44#include "llpanel.h"
45#include "llresmgr.h"
46#include "llkeyboard.h"
47#include "llui.h"
48#include "lltextbox.h"
49#include "llcontrol.h"
50#include "llcriticaldamp.h"
51
52#include "llglheaders.h"
53
54LLTabContainerVertical::LLTabContainerVertical(
55 const LLString& name, const LLRect& rect,
56 void(*close_callback)(void*), void* callback_userdata,
57 U32 tab_width, BOOL bordered)
58 :
59 LLTabContainerCommon(name, rect, LEFT, close_callback, callback_userdata, bordered),
60 mTabWidth(tab_width),
61 mUpArrowBtn(NULL),
62 mDownArrowBtn(NULL)
63{
64 initButtons();
65}
66
67LLTabContainerVertical::LLTabContainerVertical(
68 const LLString& name, const LLString& rect_control,
69 void(*close_callback)(void*), void* callback_userdata,
70 U32 tab_width, BOOL bordered)
71 :
72 LLTabContainerCommon(name, rect_control, LEFT, close_callback, callback_userdata, bordered),
73 mTabWidth(tab_width)
74{
75 initButtons();
76}
77
78// Called from all constructors
79void LLTabContainerVertical::initButtons()
80{
81 // Hack:
82 if (mRect.getHeight() == 0 || mUpArrowBtn)
83 {
84 return; // Don't have a rect yet or already got called
85 }
86
87 LLString out_id;
88 LLString in_id;
89
90 //S32 arrow_fudge = 1; // match new art better
91
92 // Left and right scroll arrows (for when there are too many tabs to show all at once).
93 S32 btn_top = mRect.getHeight();
94 S32 btn_top_lower = mRect.mBottom+TABCNTRV_ARROW_BTN_SIZE;
95
96 LLRect up_arrow_btn_rect;
97 up_arrow_btn_rect.setLeftTopAndSize( mTabWidth/2 , btn_top, TABCNTRV_ARROW_BTN_SIZE, TABCNTRV_ARROW_BTN_SIZE );
98
99 LLRect down_arrow_btn_rect;
100 down_arrow_btn_rect.setLeftTopAndSize( mTabWidth/2 , btn_top_lower, TABCNTRV_ARROW_BTN_SIZE, TABCNTRV_ARROW_BTN_SIZE );
101
102 out_id = "UIImgBtnScrollUpOutUUID";
103 in_id = "UIImgBtnScrollUpInUUID";
104 mUpArrowBtn = new LLButton(
105 "Up Arrow", up_arrow_btn_rect,
106 out_id, in_id, "",
107 &onPrevBtn, this, NULL );
108 mUpArrowBtn->setHeldDownCallback(onPrevBtnHeld);
109 mUpArrowBtn->setSaveToXML(false);
110 mUpArrowBtn->setFollowsTop();
111 mUpArrowBtn->setFollowsLeft();
112 mUpArrowBtn->setTabStop(FALSE);
113 addChild(mUpArrowBtn);
114
115 out_id = "UIImgBtnScrollDownOutUUID";
116 in_id = "UIImgBtnScrollDownInUUID";
117 mDownArrowBtn = new LLButton(
118 "Down Arrow", down_arrow_btn_rect,
119 out_id, in_id, "",
120 &onNextBtn, this, NULL );
121 mDownArrowBtn->setHeldDownCallback(onNextBtnHeld);
122 mDownArrowBtn->setSaveToXML(false);
123 mDownArrowBtn->setFollowsBottom();
124 mDownArrowBtn->setFollowsLeft();
125 mDownArrowBtn->setTabStop(FALSE);
126 addChild(mDownArrowBtn);
127
128 // set default tab group to be panel contents
129 mDefaultTabGroup = 1;
130}
131
132LLTabContainerVertical::~LLTabContainerVertical()
133{ }
134
135void LLTabContainerVertical::addTabPanel(LLPanel* child, const LLString& label,
136 BOOL select,
137 void (*on_tab_clicked)(void*, bool), void* userdata,
138 S32 indent,
139 BOOL placeholder, eInsertionPoint insertion_point)
140{
141 if (child->getParent() == this)
142 {
143 // already a child of mine
144 return;
145 }
146
147 const LLFontGL* font = gResMgr->getRes( LLFONT_SANSSERIF );
148
149 // Store the original label for possible xml export.
150 child->setLabel(label);
151 // Replace long label with truncated version (e.g., "FooBa...")
152 LLString trimmed_label = label;
153 LLString::trim(trimmed_label);
154
155 // Tab panel
156 S32 tab_panel_top;
157 S32 tab_panel_bottom;
158 tab_panel_top = mRect.getHeight()
159 - mTopBorderHeight
160 - (BTN_HEIGHT - TABCNTRV_BUTTON_PANEL_OVERLAP);
161 tab_panel_bottom = LLPANEL_BORDER_WIDTH;
162
163 LLRect tab_panel_rect(
164 mTabWidth + (LLPANEL_BORDER_WIDTH * 2) + TABCNTRV_PAD,
165 mRect.getHeight() - LLPANEL_BORDER_WIDTH,
166 mRect.getWidth() - LLPANEL_BORDER_WIDTH,
167 LLPANEL_BORDER_WIDTH);
168
169 child->setFollowsAll();
170 child->translate( tab_panel_rect.mLeft - child->getRect().mLeft, tab_panel_rect.mBottom - child->getRect().mBottom);
171 child->reshape( tab_panel_rect.getWidth(), tab_panel_rect.getHeight(), TRUE );
172 child->setBackgroundVisible( FALSE ); // No need to overdraw
173
174 child->setVisible( FALSE ); // Will be made visible when selected
175
176 // Tab button
177 LLRect btn_rect;
178 btn_rect.setLeftTopAndSize(
179 TABCNTRV_PAD + LLPANEL_BORDER_WIDTH + 2, // JC - Fudge factor
180 (mRect.getHeight() - mTopBorderHeight - LLPANEL_BORDER_WIDTH - 1) - ((BTN_HEIGHT + TABCNTRV_PAD) * mTabList.size()),
181 mTabWidth,
182 BTN_HEIGHT);
183
184 if (!placeholder)
185 {
186 LLButton *btn = new LLButton("vert tab button",
187 btn_rect,
188 "",
189 "",
190 "",
191 &LLTabContainerVertical::onTabBtn, NULL,
192 font,
193 trimmed_label, trimmed_label);
194 btn->setSaveToXML(false);
195 btn->setImages("tab_left.tga", "tab_left_selected.tga");
196 btn->setScaleImage(TRUE);
197 btn->setHAlign(LLFontGL::LEFT);
198 btn->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
199 btn->setTabStop(FALSE);
200 if (indent)
201 {
202 btn->setLeftHPad(indent);
203 }
204
205 LLTabTuple* tuple = new LLTabTuple( this, child, btn, on_tab_clicked, userdata );
206 insertTuple( tuple, insertion_point );
207
208 btn->setCallbackUserData( tuple );
209 addChild( btn, 0 );
210 addChild(child, 1);
211
212 if( select )
213 {
214 selectTab( mTabList.size()-1 );
215 }
216 }
217 else
218 {
219 btn_rect.translate(0, -LLBUTTON_V_PAD-2);
220 LLString box_label = trimmed_label;
221 LLTextBox* text = new LLTextBox(box_label, btn_rect, box_label, font);
222 text->setSaveToXML(false);
223 addChild( text, 0 );
224
225 LLButton* btn = new LLButton("", LLRect(0,0,0,0));
226 btn->setSaveToXML(false);
227 addChild(btn, 0);
228 addChild(child, 1);
229
230 LLTabTuple* tuple = new LLTabTuple( this, child, btn, on_tab_clicked, userdata, text );
231 insertTuple( tuple, insertion_point );
232 }
233
234 updateMaxScrollPos();
235}
236
237void LLTabContainerVertical::removeTabPanel(LLPanel* child)
238{
239 LLTabContainerCommon::removeTabPanel(child);
240
241 // Fix-up button sizes
242 S32 tab_count = 0;
243 for(std::vector<LLTabTuple*>::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
244 {
245 LLTabTuple* tuple = *iter;
246 LLRect rect;
247 rect.setLeftTopAndSize(TABCNTRV_PAD + LLPANEL_BORDER_WIDTH + 2, // JC - Fudge factor
248 (mRect.getHeight() - LLPANEL_BORDER_WIDTH - 1) - ((BTN_HEIGHT + TABCNTRV_PAD) * (tab_count)),
249 mTabWidth,
250 BTN_HEIGHT);
251 if (tuple->mPlaceholderText)
252 {
253 tuple->mPlaceholderText->setRect(rect);
254 }
255 else
256 {
257 tuple->mButton->setRect(rect);
258 }
259 tab_count++;
260 }
261}
262
263void LLTabContainerVertical::updateMaxScrollPos()
264{
265 S32 tab_total_height = (BTN_HEIGHT + TABCNTRV_PAD) * mTabList.size();
266 S32 available_height = mRect.getHeight() - mTopBorderHeight;
267 if( tab_total_height > available_height )
268 {
269 S32 available_height_with_arrows = mRect.getHeight() - 2*(TABCNTRV_ARROW_BTN_SIZE + 3*TABCNTRV_PAD);
270 S32 additional_needed = tab_total_height - available_height_with_arrows;
271 mMaxScrollPos = S32( ceil(additional_needed / float(BTN_HEIGHT) ) );
272 }
273 else
274 {
275 mMaxScrollPos = 0;
276 mScrollPos = 0;
277 }
278 if (mScrollPos > mMaxScrollPos)
279 {
280 mScrollPos = mMaxScrollPos;
281 }
282}
283
284void LLTabContainerVertical::commitHoveredButton(S32 x, S32 y)
285{
286 if (hasMouseCapture())
287 {
288 for(std::vector<LLTabTuple*>::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
289 {
290 LLTabTuple* tuple = *iter;
291 tuple->mButton->setVisible( TRUE );
292 S32 local_x = x - tuple->mButton->getRect().mLeft;
293 S32 local_y = y - tuple->mButton->getRect().mBottom;
294 if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible())
295 {
296 tuple->mButton->onCommit();
297 }
298 }
299 }
300}
301
302BOOL LLTabContainerVertical::selectTab(S32 which)
303{
304 if (which >= (S32)mTabList.size()) return FALSE;
305 if (which < 0) return FALSE;
306
307 //if( gFocusMgr.childHasKeyboardFocus( this ) )
308 //{
309 // gFocusMgr.setKeyboardFocus( NULL );
310 //}
311
312 LLTabTuple* selected_tuple = mTabList[which];
313 if (!selected_tuple)
314 {
315 return FALSE;
316 }
317
318 BOOL is_visible = FALSE;
319 if (which != mCurrentTabIdx)
320 {
321 mCurrentTabIdx = which;
322
323 S32 i = 0;
324 for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
325 {
326 LLTabTuple* tuple = *iter;
327 BOOL is_selected = ( tuple == selected_tuple );
328 tuple->mTabPanel->setVisible( is_selected );
329// tuple->mTabPanel->setFocus(is_selected); // not clear that we want to do this here.
330 tuple->mButton->setToggleState( is_selected );
331 // RN: this limits tab-stops to active button only, which would require arrow keys to switch tabs
332 tuple->mButton->setTabStop( is_selected );
333
334 if( is_selected )
335 {
336 // Make sure tab is within scroll
337 S32 num_visible = mTabList.size() - mMaxScrollPos;
338 if( i >= mScrollPos && i <= mScrollPos + num_visible)
339 {
340 mCurrentTabIdx = which;
341 is_visible = TRUE;
342 }
343 else
344 {
345 is_visible = FALSE;
346 }
347 }
348 i++;
349 }
350 if( selected_tuple->mOnChangeCallback )
351 {
352 selected_tuple->mOnChangeCallback( selected_tuple->mUserData, false );
353 }
354 }
355 if(mCurrentTabIdx >= 0)
356 {
357 LLTabTuple* tuple = mTabList[mCurrentTabIdx];
358 tuple->mTabPanel->setVisible( TRUE );
359 tuple->mButton->setToggleState( TRUE );
360 }
361 return is_visible;
362}
363
364
365
366void LLTabContainerVertical::draw()
367{
368 S32 target_pixel_scroll = mScrollPos * (BTN_HEIGHT + TABCNTRV_PAD);
369
370 mScrollPosPixels = (S32)lerp((F32)mScrollPosPixels, (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f));
371 if( getVisible() )
372 {
373 BOOL has_scroll_arrows = (mMaxScrollPos > 0) || (mScrollPosPixels > 0);
374 mUpArrowBtn->setVisible( has_scroll_arrows );
375 mDownArrowBtn->setVisible( has_scroll_arrows );
376
377 // Set the topmost position of the tab buttons.
378 S32 top = mRect.getHeight() - mTopBorderHeight - LLPANEL_BORDER_WIDTH - 1 - (has_scroll_arrows ? TABCNTRV_ARROW_BTN_SIZE : 0);
379 top += mScrollPosPixels;
380
381 // Hide all the buttons
382 for(std::vector<LLTabTuple*>::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
383 {
384 LLTabTuple* tuple = *iter;
385 tuple->mButton->setVisible( FALSE );
386 }
387
388 LLPanel::draw();
389
390 // Show all the buttons
391 for(std::vector<LLTabTuple*>::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
392 {
393 LLTabTuple* tuple = *iter;
394 tuple->mButton->setVisible( TRUE );
395 }
396
397 // Draw some of the buttons...
398 {
399 LLRect clip_rect = getLocalRect();
400 if (has_scroll_arrows)
401 {
402 // ...but clip them.
403 clip_rect.mBottom = mDownArrowBtn->getRect().mTop + 3*TABCNTRV_PAD;
404 clip_rect.mTop = mUpArrowBtn->getRect().mBottom - 3*TABCNTRV_PAD;
405 }
406 LLLocalClipRect clip(clip_rect);
407
408 //S32 max_scroll_visible = mTabList.size() - mMaxScrollPos + mScrollPos;
409 S32 idx = 0;
410 for(std::vector<LLTabTuple*>::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
411 {
412 LLTabTuple* tuple = *iter;
413 tuple->mButton->translate( 0 , top - tuple->mButton->getRect().mTop);
414 top -= BTN_HEIGHT + TABCNTRV_PAD;
415
416 LLUI::pushMatrix();
417 {
418 LLUI::translate((F32)tuple->mButton->getRect().mLeft, (F32)tuple->mButton->getRect().mBottom, 0.f);
419 tuple->mButton->draw();
420 }
421 LLUI::popMatrix();
422
423 idx++;
424 }
425
426 if( has_scroll_arrows )
427 {
428 // Redraw the arrows so that they appears on top.
429 glPushMatrix();
430 glTranslatef((F32)mUpArrowBtn->getRect().mLeft, (F32)mUpArrowBtn->getRect().mBottom, 0.f);
431 mUpArrowBtn->draw();
432 glPopMatrix();
433
434 glPushMatrix();
435 glTranslatef((F32)mDownArrowBtn->getRect().mLeft, (F32)mDownArrowBtn->getRect().mBottom, 0.f);
436 mDownArrowBtn->draw();
437 glPopMatrix();
438 }
439 }
440 }
441}
442
443BOOL LLTabContainerVertical::handleMouseDown( S32 x, S32 y, MASK mask )
444{
445 BOOL handled = FALSE;
446 BOOL has_scroll_arrows = (mMaxScrollPos > 0);
447
448 if (has_scroll_arrows)
449 {
450 if (mUpArrowBtn->getRect().pointInRect(x, y))
451 {
452 S32 local_x = x - mUpArrowBtn->getRect().mLeft;
453 S32 local_y = y - mUpArrowBtn->getRect().mBottom;
454 handled = mUpArrowBtn->handleMouseDown(local_x, local_y, mask);
455 }
456 else if (mDownArrowBtn->getRect().pointInRect(x, y))
457 {
458 S32 local_x = x - mDownArrowBtn->getRect().mLeft;
459 S32 local_y = y - mDownArrowBtn->getRect().mBottom;
460 handled = mDownArrowBtn->handleMouseDown(local_x, local_y, mask);
461 }
462 }
463 if (!handled)
464 {
465 handled = LLPanel::handleMouseDown( x, y, mask );
466 }
467
468 if (mTabList.size() > 0)
469 {
470 LLTabTuple* firsttuple = mTabList[0];
471 LLRect tab_rect(firsttuple->mButton->getRect().mLeft,
472 has_scroll_arrows ? mUpArrowBtn->getRect().mBottom - TABCNTRV_PAD : mUpArrowBtn->getRect().mTop,
473 firsttuple->mButton->getRect().mRight,
474 has_scroll_arrows ? mDownArrowBtn->getRect().mTop + TABCNTRV_PAD : mDownArrowBtn->getRect().mBottom );
475 if( tab_rect.pointInRect( x, y ) )
476 {
477 LLButton* tab_button = mTabList[getCurrentPanelIndex()]->mButton;
478 gFocusMgr.setMouseCapture(this);
479 gFocusMgr.setKeyboardFocus(tab_button);
480 }
481 }
482 return handled;
483}
484
485BOOL LLTabContainerVertical::handleHover( S32 x, S32 y, MASK mask )
486{
487 BOOL handled = FALSE;
488 BOOL has_scroll_arrows = (mMaxScrollPos > 0);
489
490 if (has_scroll_arrows)
491 {
492 if (mUpArrowBtn->getRect().pointInRect(x, y))
493 {
494 S32 local_x = x - mUpArrowBtn->getRect().mLeft;
495 S32 local_y = y - mUpArrowBtn->getRect().mBottom;
496 handled = mUpArrowBtn->handleHover(local_x, local_y, mask);
497 }
498 else if (mDownArrowBtn->getRect().pointInRect(x, y))
499 {
500 S32 local_x = x - mDownArrowBtn->getRect().mLeft;
501 S32 local_y = y - mDownArrowBtn->getRect().mBottom;
502 handled = mDownArrowBtn->handleHover(local_x, local_y, mask);
503 }
504 }
505 if (!handled)
506 {
507 handled = LLPanel::handleHover(x, y, mask);
508 }
509
510 commitHoveredButton(x, y);
511 return handled;
512}
513
514BOOL LLTabContainerVertical::handleMouseUp( S32 x, S32 y, MASK mask )
515{
516 BOOL handled = FALSE;
517 BOOL has_scroll_arrows = (mMaxScrollPos > 0);
518
519 if (has_scroll_arrows)
520 {
521 if (mUpArrowBtn->getRect().pointInRect(x, y))
522 {
523 S32 local_x = x - mUpArrowBtn->getRect().mLeft;
524 S32 local_y = y - mUpArrowBtn->getRect().mBottom;
525 handled = mUpArrowBtn->handleMouseUp(local_x, local_y, mask);
526 }
527 else if (mDownArrowBtn->getRect().pointInRect(x, y))
528 {
529 S32 local_x = x - mDownArrowBtn->getRect().mLeft;
530 S32 local_y = y - mDownArrowBtn->getRect().mBottom;
531 handled = mDownArrowBtn->handleMouseUp(local_x, local_y, mask);
532 }
533 }
534 if (!handled)
535 {
536 handled = LLPanel::handleMouseUp( x, y, mask );
537 }
538
539 commitHoveredButton(x, y);
540 LLPanel* cur_panel = getCurrentPanel();
541 if (hasMouseCapture())
542 {
543 if (cur_panel)
544 {
545 if (!cur_panel->focusFirstItem(FALSE))
546 {
547 mTabList[getCurrentPanelIndex()]->mButton->setFocus(TRUE);
548 }
549 }
550 gFocusMgr.setMouseCapture(NULL);
551 }
552
553 return handled;
554}
555
556BOOL LLTabContainerVertical::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
557{
558 BOOL handled = FALSE;
559 if (getEnabled())
560 {
561 if (key == KEY_LEFT && mask == MASK_ALT)
562 {
563 selectPrevTab();
564 handled = TRUE;
565 }
566 else if (key == KEY_RIGHT && mask == MASK_ALT)
567 {
568 selectNextTab();
569 handled = TRUE;
570 }
571
572 // focus is on button
573 if (!handled && !gFocusMgr.childHasKeyboardFocus(getCurrentPanel()))
574 {
575 switch(key)
576 {
577 case KEY_UP:
578 selectPrevTab();
579 handled = TRUE;
580 break;
581 case KEY_DOWN:
582 selectNextTab();
583 handled = TRUE;
584 break;
585 case KEY_LEFT:
586 handled = TRUE;
587 break;
588 case KEY_RIGHT:
589 if (getTabPosition() == LEFT && getCurrentPanel())
590 {
591 getCurrentPanel()->setFocus(TRUE);
592 }
593 handled = TRUE;
594 break;
595 default:
596 break;
597 }
598 }
599 }
600 return handled;
601}
602
603// virtual
604LLXMLNodePtr LLTabContainerVertical::getXML(bool save_children) const
605{
606 LLXMLNodePtr node = LLTabContainerCommon::getXML();
607
608 // TomY TODO Is this redundant or will it be used later?
609 node->createChild("tab_position", TRUE)->setStringValue("left");
610
611 return node;
612}
diff --git a/linden/indra/llui/lltabcontainervertical.h b/linden/indra/llui/lltabcontainervertical.h
index e887e53..ffe65be 100644
--- a/linden/indra/llui/lltabcontainervertical.h
+++ b/linden/indra/llui/lltabcontainervertical.h
@@ -29,69 +29,4 @@
29 * $/LicenseInfo$ 29 * $/LicenseInfo$
30 */ 30 */
31 31
32// Fear my script-fu! 32// deprecated: see LLTabContainer
33
34#ifndef LL_TABCONTAINERVERTICAL_H
35#define LL_TABCONTAINERVERTICAL_H
36
37#include "lltabcontainer.h"
38
39const S32 TABCNTRV_CLOSE_BTN_SIZE = 16;
40const S32 TABCNTRV_HEADER_HEIGHT = LLPANEL_BORDER_WIDTH + TABCNTRV_CLOSE_BTN_SIZE;
41const S32 TABCNTRV_TAB_WIDTH = 100;
42// const S32 TABCNTRV_TAB_HEIGHT = 16; Use BTN_HEIGHT instead, JC.
43const S32 TABCNTRV_ARROW_BTN_SIZE = 16;
44const S32 TABCNTRV_BUTTON_PANEL_OVERLAP = 1; // how many pixels the tab buttons and tab panels overlap.
45const S32 TABCNTRV_PAD = 0;
46
47class LLButton;
48class LLTextBox;
49
50class LLTabContainerVertical : public LLTabContainerCommon
51{
52public:
53 LLTabContainerVertical( const LLString& name, const LLRect& rect,
54 void(*close_callback)(void*), void* callback_userdata,
55 U32 tab_width = TABCNTRV_TAB_WIDTH, BOOL bordered = TRUE);
56
57 LLTabContainerVertical( const LLString& name, const LLString& rect_control,
58 void(*close_callback)(void*), void* callback_userdata,
59 U32 tab_width = TABCNTRV_TAB_WIDTH, BOOL bordered = TRUE);
60
61 /*virtual*/ void initButtons();
62
63 /*virtual*/ ~LLTabContainerVertical();
64
65 virtual LLXMLNodePtr getXML(bool save_children = true) const;
66 /*virtual*/ void draw();
67
68 /*virtual*/ void addTabPanel(LLPanel* child,
69 const LLString& label,
70 BOOL select = FALSE,
71 void (*on_tab_clicked)(void*, bool) = NULL,
72 void* userdata = NULL,
73 S32 indent = 0,
74 BOOL placeholder = FALSE,
75 eInsertionPoint insertion_point = END);
76
77 /*virtual*/ BOOL selectTab(S32 which);
78 /*virtual*/ void removeTabPanel( LLPanel* child );
79
80 /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask );
81 /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask );
82 /*virtual*/ BOOL handleMouseUp( S32 x, S32 y, MASK mask );
83 /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
84
85protected:
86 U32 mTabWidth;
87
88 LLButton* mUpArrowBtn;
89 LLButton* mDownArrowBtn;
90
91protected:
92 virtual void updateMaxScrollPos();
93 virtual void commitHoveredButton(S32 x, S32 y);
94};
95
96
97#endif
diff --git a/linden/indra/llui/lltextbox.cpp b/linden/indra/llui/lltextbox.cpp
index 1422e0a..9ad7849 100644
--- a/linden/indra/llui/lltextbox.cpp
+++ b/linden/indra/llui/lltextbox.cpp
@@ -30,21 +30,14 @@
30 */ 30 */
31 31
32#include "linden_common.h" 32#include "linden_common.h"
33
34#include "lltextbox.h" 33#include "lltextbox.h"
35
36#include "llerror.h"
37#include "llgl.h"
38#include "llui.h"
39#include "lluictrlfactory.h" 34#include "lluictrlfactory.h"
40#include "llcontrol.h"
41#include "llfocusmgr.h" 35#include "llfocusmgr.h"
42#include "llstl.h"
43#include <boost/tokenizer.hpp>
44 36
45LLTextBox::LLTextBox(const LLString& name, const LLRect& rect, const LLString& text, 37LLTextBox::LLTextBox(const LLString& name, const LLRect& rect, const LLString& text,
46 const LLFontGL* font, BOOL mouse_opaque) 38 const LLFontGL* font, BOOL mouse_opaque)
47: LLUICtrl(name, rect, mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP ), 39: LLUICtrl(name, rect, mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP ),
40 mFontGL(font ? font : LLFontGL::sSansSerifSmall),
48 mTextColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ), 41 mTextColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ),
49 mDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ), 42 mDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ),
50 mBackgroundColor( LLUI::sColorsGroup->getColor( "DefaultBackgroundColor" ) ), 43 mBackgroundColor( LLUI::sColorsGroup->getColor( "DefaultBackgroundColor" ) ),
@@ -64,9 +57,7 @@ LLTextBox::LLTextBox(const LLString& name, const LLRect& rect, const LLString& t
64 mClickedCallback(NULL), 57 mClickedCallback(NULL),
65 mCallbackUserData(NULL) 58 mCallbackUserData(NULL)
66{ 59{
67 // TomY TODO Nuke this eventually 60 setText( text );
68 setText( !text.empty() ? text : name );
69 mFontGL = font ? font : LLFontGL::sSansSerifSmall;
70 setTabStop(FALSE); 61 setTabStop(FALSE);
71} 62}
72 63
@@ -93,25 +84,54 @@ LLTextBox::LLTextBox(const LLString& name, const LLString& text, F32 max_width,
93 mClickedCallback(NULL), 84 mClickedCallback(NULL),
94 mCallbackUserData(NULL) 85 mCallbackUserData(NULL)
95{ 86{
96 setWrappedText(!text.empty() ? text : name, max_width); 87 setWrappedText(text, max_width);
97 reshapeToFitText(); 88 reshapeToFitText();
98 setTabStop(FALSE); 89 setTabStop(FALSE);
99} 90}
100 91
101LLTextBox::~LLTextBox() 92LLTextBox::LLTextBox(const LLString& name_and_label, const LLRect& rect) :
102{ 93 LLUICtrl(name_and_label, rect, TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP),
103} 94 mFontGL(LLFontGL::sSansSerifSmall),
104 95 mTextColor(LLUI::sColorsGroup->getColor("LabelTextColor")),
105// virtual 96 mDisabledColor(LLUI::sColorsGroup->getColor("LabelDisabledColor")),
106EWidgetType LLTextBox::getWidgetType() const 97 mBackgroundColor(LLUI::sColorsGroup->getColor("DefaultBackgroundColor")),
98 mBorderColor(LLUI::sColorsGroup->getColor("DefaultHighlightLight")),
99 mBackgroundVisible(FALSE),
100 mBorderVisible(FALSE),
101 mFontStyle(LLFontGL::DROP_SHADOW_SOFT),
102 mBorderDropShadowVisible(FALSE),
103 mHPad(0),
104 mVPad(0),
105 mHAlign(LLFontGL::LEFT),
106 mVAlign( LLFontGL::TOP ),
107 mClickedCallback(NULL),
108 mCallbackUserData(NULL)
107{ 109{
108 return WIDGET_TYPE_TEXT_BOX; 110 setText( name_and_label );
111 setTabStop(FALSE);
109} 112}
110 113
111// virtual 114LLTextBox::LLTextBox(const LLString& name_and_label) :
112LLString LLTextBox::getWidgetTag() const 115 LLUICtrl(name_and_label, LLRect(0, 0, 1, 1), TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP),
116 mFontGL(LLFontGL::sSansSerifSmall),
117 mTextColor(LLUI::sColorsGroup->getColor("LabelTextColor")),
118 mDisabledColor(LLUI::sColorsGroup->getColor("LabelDisabledColor")),
119 mBackgroundColor(LLUI::sColorsGroup->getColor("DefaultBackgroundColor")),
120 mBorderColor(LLUI::sColorsGroup->getColor("DefaultHighlightLight")),
121 mBackgroundVisible(FALSE),
122 mBorderVisible(FALSE),
123 mFontStyle(LLFontGL::DROP_SHADOW_SOFT),
124 mBorderDropShadowVisible(FALSE),
125 mHPad(0),
126 mVPad(0),
127 mHAlign(LLFontGL::LEFT),
128 mVAlign( LLFontGL::TOP ),
129 mClickedCallback(NULL),
130 mCallbackUserData(NULL)
113{ 131{
114 return LL_TEXT_BOX_TAG; 132 setWrappedText(name_and_label);
133 reshapeToFitText();
134 setTabStop(FALSE);
115} 135}
116 136
117BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) 137BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask)
@@ -127,7 +147,7 @@ BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask)
127 // Route future Mouse messages here preemptively. (Release on mouse up.) 147 // Route future Mouse messages here preemptively. (Release on mouse up.)
128 gFocusMgr.setMouseCapture( this ); 148 gFocusMgr.setMouseCapture( this );
129 149
130 if (mSoundFlags & MOUSE_DOWN) 150 if (getSoundFlags() & MOUSE_DOWN)
131 { 151 {
132 make_ui_sound("UISndClick"); 152 make_ui_sound("UISndClick");
133 } 153 }
@@ -153,7 +173,7 @@ BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask)
153 // Release the mouse 173 // Release the mouse
154 gFocusMgr.setMouseCapture( NULL ); 174 gFocusMgr.setMouseCapture( NULL );
155 175
156 if (mSoundFlags & MOUSE_UP) 176 if (getSoundFlags() & MOUSE_UP)
157 { 177 {
158 make_ui_sound("UISndClickRelease"); 178 make_ui_sound("UISndClickRelease");
159 } 179 }
@@ -294,16 +314,6 @@ S32 LLTextBox::getTextPixelHeight()
294} 314}
295 315
296 316
297void LLTextBox::setValue(const LLSD& value )
298{
299 setText(value.asString());
300}
301
302LLSD LLTextBox::getValue() const
303{
304 return LLSD(getText());
305}
306
307BOOL LLTextBox::setTextArg( const LLString& key, const LLStringExplicit& text ) 317BOOL LLTextBox::setTextArg( const LLString& key, const LLStringExplicit& text )
308{ 318{
309 mText.setArg(key, text); 319 mText.setArg(key, text);
@@ -324,13 +334,13 @@ void LLTextBox::draw()
324 { 334 {
325 static LLColor4 color_drop_shadow = LLUI::sColorsGroup->getColor("ColorDropShadow"); 335 static LLColor4 color_drop_shadow = LLUI::sColorsGroup->getColor("ColorDropShadow");
326 static S32 drop_shadow_tooltip = LLUI::sConfigGroup->getS32("DropShadowTooltip"); 336 static S32 drop_shadow_tooltip = LLUI::sConfigGroup->getS32("DropShadowTooltip");
327 gl_drop_shadow(0, mRect.getHeight(), mRect.getWidth(), 0, 337 gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0,
328 color_drop_shadow, drop_shadow_tooltip); 338 color_drop_shadow, drop_shadow_tooltip);
329 } 339 }
330 340
331 if (mBackgroundVisible) 341 if (mBackgroundVisible)
332 { 342 {
333 LLRect r( 0, mRect.getHeight(), mRect.getWidth(), 0 ); 343 LLRect r( 0, getRect().getHeight(), getRect().getWidth(), 0 );
334 gl_rect_2d( r, mBackgroundColor ); 344 gl_rect_2d( r, mBackgroundColor );
335 } 345 }
336 346
@@ -341,14 +351,14 @@ void LLTextBox::draw()
341 text_x = mHPad; 351 text_x = mHPad;
342 break; 352 break;
343 case LLFontGL::HCENTER: 353 case LLFontGL::HCENTER:
344 text_x = mRect.getWidth() / 2; 354 text_x = getRect().getWidth() / 2;
345 break; 355 break;
346 case LLFontGL::RIGHT: 356 case LLFontGL::RIGHT:
347 text_x = mRect.getWidth() - mHPad; 357 text_x = getRect().getWidth() - mHPad;
348 break; 358 break;
349 } 359 }
350 360
351 S32 text_y = mRect.getHeight() - mVPad; 361 S32 text_y = getRect().getHeight() - mVPad;
352 362
353 if ( getEnabled() ) 363 if ( getEnabled() )
354 { 364 {
@@ -360,7 +370,6 @@ void LLTextBox::draw()
360 { 370 {
361 drawText( text_x, text_y, mTextColor ); 371 drawText( text_x, text_y, mTextColor );
362 } 372 }
363
364 } 373 }
365 else 374 else
366 { 375 {
@@ -385,7 +394,14 @@ void LLTextBox::reshape(S32 width, S32 height, BOOL called_from_parent)
385 394
386void LLTextBox::drawText( S32 x, S32 y, const LLColor4& color ) 395void LLTextBox::drawText( S32 x, S32 y, const LLColor4& color )
387{ 396{
388 if( !mLineLengthList.empty() ) 397 if( mLineLengthList.empty() )
398 {
399 mFontGL->render(mText.getWString(), 0, (F32)x, (F32)y, color,
400 mHAlign, mVAlign,
401 mFontStyle,
402 S32_MAX, getRect().getWidth(), NULL, TRUE, mUseEllipses);
403 }
404 else
389 { 405 {
390 S32 cur_pos = 0; 406 S32 cur_pos = 0;
391 for (std::vector<S32>::iterator iter = mLineLengthList.begin(); 407 for (std::vector<S32>::iterator iter = mLineLengthList.begin();
@@ -395,21 +411,13 @@ void LLTextBox::drawText( S32 x, S32 y, const LLColor4& color )
395 mFontGL->render(mText.getWString(), cur_pos, (F32)x, (F32)y, color, 411 mFontGL->render(mText.getWString(), cur_pos, (F32)x, (F32)y, color,
396 mHAlign, mVAlign, 412 mHAlign, mVAlign,
397 mFontStyle, 413 mFontStyle,
398 line_length, mRect.getWidth(), NULL, TRUE, mUseEllipses ); 414 line_length, getRect().getWidth(), NULL, TRUE, mUseEllipses );
399 cur_pos += line_length + 1; 415 cur_pos += line_length + 1;
400 y -= llfloor(mFontGL->getLineHeight()); 416 y -= llfloor(mFontGL->getLineHeight());
401 } 417 }
402 } 418 }
403 else
404 {
405 mFontGL->render(mText.getWString(), 0, (F32)x, (F32)y, color,
406 mHAlign, mVAlign,
407 mFontStyle,
408 S32_MAX, mRect.getWidth(), NULL, TRUE, mUseEllipses);
409 }
410} 419}
411 420
412
413void LLTextBox::reshapeToFitText() 421void LLTextBox::reshapeToFitText()
414{ 422{
415 S32 width = getTextPixelWidth(); 423 S32 width = getTextPixelWidth();
@@ -423,28 +431,19 @@ LLXMLNodePtr LLTextBox::getXML(bool save_children) const
423 LLXMLNodePtr node = LLUICtrl::getXML(); 431 LLXMLNodePtr node = LLUICtrl::getXML();
424 432
425 // Attributes 433 // Attributes
426
427 node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mFontGL)); 434 node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mFontGL));
428
429 node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(mHAlign)); 435 node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(mHAlign));
430
431 addColorXML(node, mTextColor, "text_color", "LabelTextColor"); 436 addColorXML(node, mTextColor, "text_color", "LabelTextColor");
432 addColorXML(node, mDisabledColor, "disabled_color", "LabelDisabledColor"); 437 addColorXML(node, mDisabledColor, "disabled_color", "LabelDisabledColor");
433 addColorXML(node, mBackgroundColor, "bg_color", "DefaultBackgroundColor"); 438 addColorXML(node, mBackgroundColor, "bg_color", "DefaultBackgroundColor");
434 addColorXML(node, mBorderColor, "border_color", "DefaultHighlightLight"); 439 addColorXML(node, mBorderColor, "border_color", "DefaultHighlightLight");
435
436 node->createChild("bg_visible", TRUE)->setBoolValue(mBackgroundVisible); 440 node->createChild("bg_visible", TRUE)->setBoolValue(mBackgroundVisible);
437
438 node->createChild("border_visible", TRUE)->setBoolValue(mBorderVisible); 441 node->createChild("border_visible", TRUE)->setBoolValue(mBorderVisible);
439
440 node->createChild("border_drop_shadow_visible", TRUE)->setBoolValue(mBorderDropShadowVisible); 442 node->createChild("border_drop_shadow_visible", TRUE)->setBoolValue(mBorderDropShadowVisible);
441
442 node->createChild("h_pad", TRUE)->setIntValue(mHPad); 443 node->createChild("h_pad", TRUE)->setIntValue(mHPad);
443
444 node->createChild("v_pad", TRUE)->setIntValue(mVPad); 444 node->createChild("v_pad", TRUE)->setIntValue(mVPad);
445 445
446 // Contents 446 // Contents
447
448 node->setStringValue(mText); 447 node->setStringValue(mText);
449 448
450 return node; 449 return node;
@@ -459,12 +458,6 @@ LLView* LLTextBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f
459 458
460 LLString text = node->getTextContents(); 459 LLString text = node->getTextContents();
461 460
462 // TomY Yes I know this is a hack, but insert a space to make a blank text field
463 if (text == "")
464 {
465 text = " ";
466 }
467
468 LLTextBox* text_box = new LLTextBox(name, 461 LLTextBox* text_box = new LLTextBox(name,
469 LLRect(), 462 LLRect(),
470 text, 463 text,
@@ -510,6 +503,5 @@ LLView* LLTextBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f
510 text_box->setHoverActive(hover_active); 503 text_box->setHoverActive(hover_active);
511 } 504 }
512 505
513
514 return text_box; 506 return text_box;
515} 507}
diff --git a/linden/indra/llui/lltextbox.h b/linden/indra/llui/lltextbox.h
index c8bdfc5..7bea722 100644
--- a/linden/indra/llui/lltextbox.h
+++ b/linden/indra/llui/lltextbox.h
@@ -35,11 +35,8 @@
35#include "lluictrl.h" 35#include "lluictrl.h"
36#include "v4color.h" 36#include "v4color.h"
37#include "llstring.h" 37#include "llstring.h"
38#include "llfontgl.h"
39#include "lluistring.h" 38#include "lluistring.h"
40 39
41class LLUICtrlFactory;
42
43 40
44class LLTextBox 41class LLTextBox
45: public LLUICtrl 42: public LLUICtrl
@@ -48,18 +45,22 @@ public:
48 // By default, follows top and left and is mouse-opaque. 45 // By default, follows top and left and is mouse-opaque.
49 // If no text, text = name. 46 // If no text, text = name.
50 // If no font, uses default system font. 47 // If no font, uses default system font.
51 LLTextBox(const LLString& name, const LLRect& rect, const LLString& text = LLString::null, 48 LLTextBox(const LLString& name, const LLRect& rect, const LLString& text,
52 const LLFontGL* font = NULL, BOOL mouse_opaque = TRUE ); 49 const LLFontGL* font = NULL, BOOL mouse_opaque = TRUE );
53 50
54 // Construct a textbox which handles word wrapping for us. 51 // Construct a textbox which handles word wrapping for us.
55 LLTextBox(const LLString& name, const LLString& text, F32 max_width = 200, 52 LLTextBox(const LLString& name, const LLString& text, F32 max_width = 200,
56 const LLFontGL* font = NULL, BOOL mouse_opaque = TRUE ); 53 const LLFontGL* font = NULL, BOOL mouse_opaque = TRUE );
57 54
58 virtual ~LLTextBox(); 55 // "Simple" constructors for text boxes that have the same name and label *TO BE DEPRECATED*
59 virtual EWidgetType getWidgetType() const; 56 LLTextBox(const LLString& name_and_label, const LLRect& rect);
60 virtual LLString getWidgetTag() const; 57 LLTextBox(const LLString& name_and_label);
58
59 virtual ~LLTextBox() {}
60 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_TEXT_BOX; }
61 virtual LLString getWidgetTag() const { return LL_TEXT_BOX_TAG; }
61 virtual LLXMLNodePtr getXML(bool save_children = true) const; 62 virtual LLXMLNodePtr getXML(bool save_children = true) const;
62 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 63 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory);
63 64
64 virtual void draw(); 65 virtual void draw();
65 virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); 66 virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
@@ -77,8 +78,7 @@ public:
77 void setHoverActive( BOOL active ) { mHoverActive = active; } 78 void setHoverActive( BOOL active ) { mHoverActive = active; }
78 79
79 void setText( const LLStringExplicit& text ); 80 void setText( const LLStringExplicit& text );
80 void setWrappedText(const LLStringExplicit& text, F32 max_width = -1.0); 81 void setWrappedText(const LLStringExplicit& text, F32 max_width = -1.0); // -1 means use existing control width
81 // default width means use existing control width
82 void setUseEllipses( BOOL use_ellipses ) { mUseEllipses = use_ellipses; } 82 void setUseEllipses( BOOL use_ellipses ) { mUseEllipses = use_ellipses; }
83 83
84 void setBackgroundVisible(BOOL visible) { mBackgroundVisible = visible; } 84 void setBackgroundVisible(BOOL visible) { mBackgroundVisible = visible; }
@@ -90,7 +90,7 @@ public:
90 void setRightAlign() { mHAlign = LLFontGL::RIGHT; } 90 void setRightAlign() { mHAlign = LLFontGL::RIGHT; }
91 void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; } 91 void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; }
92 void setClickedCallback( void (*cb)(void *data) ){ mClickedCallback = cb; } // mouse down and up within button 92 void setClickedCallback( void (*cb)(void *data) ){ mClickedCallback = cb; } // mouse down and up within button
93 void setCallbackUserData( void* data ) { mCallbackUserData = data; } 93 void setCallbackUserData( void* data ) { mCallbackUserData = data; }
94 94
95 const LLFontGL* getFont() const { return mFontGL; } 95 const LLFontGL* getFont() const { return mFontGL; }
96 96
@@ -100,16 +100,14 @@ public:
100 S32 getTextPixelWidth(); 100 S32 getTextPixelWidth();
101 S32 getTextPixelHeight(); 101 S32 getTextPixelHeight();
102 102
103 103 virtual void setValue(const LLSD& value ) { setText(value.asString()); }
104 virtual void setValue(const LLSD& value ); 104 virtual LLSD getValue() const { return LLSD(getText()); }
105 virtual LLSD getValue() const;
106 virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text ); 105 virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text );
107 106
108protected: 107private:
109 void setLineLengths(); 108 void setLineLengths();
110 void drawText(S32 x, S32 y, const LLColor4& color ); 109 void drawText(S32 x, S32 y, const LLColor4& color );
111 110
112protected:
113 LLUIString mText; 111 LLUIString mText;
114 const LLFontGL* mFontGL; 112 const LLFontGL* mFontGL;
115 LLColor4 mTextColor; 113 LLColor4 mTextColor;
diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp
index 9061ca3..545fddb 100644
--- a/linden/indra/llui/lltexteditor.cpp
+++ b/linden/indra/llui/lltexteditor.cpp
@@ -37,6 +37,7 @@
37 37
38#include "llfontgl.h" 38#include "llfontgl.h"
39#include "llgl.h" 39#include "llgl.h"
40#include "llglimmediate.h"
40#include "llui.h" 41#include "llui.h"
41#include "lluictrlfactory.h" 42#include "lluictrlfactory.h"
42#include "llrect.h" 43#include "llrect.h"
@@ -63,15 +64,12 @@
63// 64//
64// Globals 65// Globals
65// 66//
66
67BOOL gDebugTextEditorTips = FALSE; 67BOOL gDebugTextEditorTips = FALSE;
68 68
69// 69//
70// Constants 70// Constants
71// 71//
72
73const S32 UI_TEXTEDITOR_BUFFER_BLOCK_SIZE = 512; 72const S32 UI_TEXTEDITOR_BUFFER_BLOCK_SIZE = 512;
74
75const S32 UI_TEXTEDITOR_BORDER = 1; 73const S32 UI_TEXTEDITOR_BORDER = 1;
76const S32 UI_TEXTEDITOR_H_PAD = 4; 74const S32 UI_TEXTEDITOR_H_PAD = 4;
77const S32 UI_TEXTEDITOR_V_PAD_TOP = 4; 75const S32 UI_TEXTEDITOR_V_PAD_TOP = 4;
@@ -93,67 +91,33 @@ void (* LLTextEditor::mURLcallback)(const char*) = NULL;
93bool (* LLTextEditor::mSecondlifeURLcallback)(const std::string&) = NULL; 91bool (* LLTextEditor::mSecondlifeURLcallback)(const std::string&) = NULL;
94bool (* LLTextEditor::mSecondlifeURLcallbackRightClick)(const std::string&) = NULL; 92bool (* LLTextEditor::mSecondlifeURLcallbackRightClick)(const std::string&) = NULL;
95 93
96///////////////////////////////////////////////////////////////////
97//virtuals
98BOOL LLTextCmd::canExtend(S32 pos)
99{
100 return FALSE;
101}
102
103void LLTextCmd::blockExtensions()
104{
105}
106
107BOOL LLTextCmd::extendAndExecute( LLTextEditor* editor, S32 pos, llwchar c, S32* delta )
108{
109 llassert(0);
110 return 0;
111}
112
113BOOL LLTextCmd::hasExtCharValue( llwchar value )
114{
115 return FALSE;
116}
117
118// Utility funcs
119S32 LLTextCmd::insert(LLTextEditor* editor, S32 pos, const LLWString &wstr)
120{
121 return editor->insertStringNoUndo( pos, wstr );
122}
123S32 LLTextCmd::remove(LLTextEditor* editor, S32 pos, S32 length)
124{
125 return editor->removeStringNoUndo( pos, length );
126}
127S32 LLTextCmd::overwrite(LLTextEditor* editor, S32 pos, llwchar wc)
128{
129 return editor->overwriteCharNoUndo(pos, wc);
130}
131 94
132/////////////////////////////////////////////////////////////////// 95///////////////////////////////////////////////////////////////////
133 96
134class LLTextCmdInsert : public LLTextCmd 97class LLTextEditor::LLTextCmdInsert : public LLTextEditor::LLTextCmd
135{ 98{
136public: 99public:
137 LLTextCmdInsert(S32 pos, BOOL group_with_next, const LLWString &ws) 100 LLTextCmdInsert(S32 pos, BOOL group_with_next, const LLWString &ws)
138 : LLTextCmd(pos, group_with_next), mWString(ws) 101 : LLTextCmd(pos, group_with_next), mWString(ws)
139 { 102 {
140 } 103 }
104 virtual ~LLTextCmdInsert() {}
141 virtual BOOL execute( LLTextEditor* editor, S32* delta ) 105 virtual BOOL execute( LLTextEditor* editor, S32* delta )
142 { 106 {
143 *delta = insert(editor, mPos, mWString ); 107 *delta = insert(editor, getPosition(), mWString );
144 LLWString::truncate(mWString, *delta); 108 LLWString::truncate(mWString, *delta);
145 //mWString = wstring_truncate(mWString, *delta); 109 //mWString = wstring_truncate(mWString, *delta);
146 return (*delta != 0); 110 return (*delta != 0);
147 } 111 }
148 virtual S32 undo( LLTextEditor* editor ) 112 virtual S32 undo( LLTextEditor* editor )
149 { 113 {
150 remove(editor, mPos, mWString.length() ); 114 remove(editor, getPosition(), mWString.length() );
151 return mPos; 115 return getPosition();
152 } 116 }
153 virtual S32 redo( LLTextEditor* editor ) 117 virtual S32 redo( LLTextEditor* editor )
154 { 118 {
155 insert(editor, mPos, mWString ); 119 insert(editor, getPosition(), mWString );
156 return mPos + mWString.length(); 120 return getPosition() + mWString.length();
157 } 121 }
158 122
159private: 123private:
@@ -161,8 +125,7 @@ private:
161}; 125};
162 126
163/////////////////////////////////////////////////////////////////// 127///////////////////////////////////////////////////////////////////
164 128class LLTextEditor::LLTextCmdAddChar : public LLTextEditor::LLTextCmd
165class LLTextCmdAddChar : public LLTextCmd
166{ 129{
167public: 130public:
168 LLTextCmdAddChar( S32 pos, BOOL group_with_next, llwchar wc) 131 LLTextCmdAddChar( S32 pos, BOOL group_with_next, llwchar wc)
@@ -173,13 +136,13 @@ public:
173 { 136 {
174 mBlockExtensions = TRUE; 137 mBlockExtensions = TRUE;
175 } 138 }
176 virtual BOOL canExtend(S32 pos) 139 virtual BOOL canExtend(S32 pos) const
177 { 140 {
178 return !mBlockExtensions && (pos == mPos + (S32)mWString.length()); 141 return !mBlockExtensions && (pos == getPosition() + (S32)mWString.length());
179 } 142 }
180 virtual BOOL execute( LLTextEditor* editor, S32* delta ) 143 virtual BOOL execute( LLTextEditor* editor, S32* delta )
181 { 144 {
182 *delta = insert(editor, mPos, mWString); 145 *delta = insert(editor, getPosition(), mWString);
183 LLWString::truncate(mWString, *delta); 146 LLWString::truncate(mWString, *delta);
184 //mWString = wstring_truncate(mWString, *delta); 147 //mWString = wstring_truncate(mWString, *delta);
185 return (*delta != 0); 148 return (*delta != 0);
@@ -198,13 +161,13 @@ public:
198 } 161 }
199 virtual S32 undo( LLTextEditor* editor ) 162 virtual S32 undo( LLTextEditor* editor )
200 { 163 {
201 remove(editor, mPos, mWString.length() ); 164 remove(editor, getPosition(), mWString.length() );
202 return mPos; 165 return getPosition();
203 } 166 }
204 virtual S32 redo( LLTextEditor* editor ) 167 virtual S32 redo( LLTextEditor* editor )
205 { 168 {
206 insert(editor, mPos, mWString ); 169 insert(editor, getPosition(), mWString );
207 return mPos + mWString.length(); 170 return getPosition() + mWString.length();
208 } 171 }
209 172
210private: 173private:
@@ -215,7 +178,7 @@ private:
215 178
216/////////////////////////////////////////////////////////////////// 179///////////////////////////////////////////////////////////////////
217 180
218class LLTextCmdOverwriteChar : public LLTextCmd 181class LLTextEditor::LLTextCmdOverwriteChar : public LLTextEditor::LLTextCmd
219{ 182{
220public: 183public:
221 LLTextCmdOverwriteChar( S32 pos, BOOL group_with_next, llwchar wc) 184 LLTextCmdOverwriteChar( S32 pos, BOOL group_with_next, llwchar wc)
@@ -223,20 +186,20 @@ public:
223 186
224 virtual BOOL execute( LLTextEditor* editor, S32* delta ) 187 virtual BOOL execute( LLTextEditor* editor, S32* delta )
225 { 188 {
226 mOldChar = editor->getWChar(mPos); 189 mOldChar = editor->getWChar(getPosition());
227 overwrite(editor, mPos, mChar); 190 overwrite(editor, getPosition(), mChar);
228 *delta = 0; 191 *delta = 0;
229 return TRUE; 192 return TRUE;
230 } 193 }
231 virtual S32 undo( LLTextEditor* editor ) 194 virtual S32 undo( LLTextEditor* editor )
232 { 195 {
233 overwrite(editor, mPos, mOldChar); 196 overwrite(editor, getPosition(), mOldChar);
234 return mPos; 197 return getPosition();
235 } 198 }
236 virtual S32 redo( LLTextEditor* editor ) 199 virtual S32 redo( LLTextEditor* editor )
237 { 200 {
238 overwrite(editor, mPos, mChar); 201 overwrite(editor, getPosition(), mChar);
239 return mPos+1; 202 return getPosition()+1;
240 } 203 }
241 204
242private: 205private:
@@ -246,7 +209,7 @@ private:
246 209
247/////////////////////////////////////////////////////////////////// 210///////////////////////////////////////////////////////////////////
248 211
249class LLTextCmdRemove : public LLTextCmd 212class LLTextEditor::LLTextCmdRemove : public LLTextEditor::LLTextCmd
250{ 213{
251public: 214public:
252 LLTextCmdRemove( S32 pos, BOOL group_with_next, S32 len ) : 215 LLTextCmdRemove( S32 pos, BOOL group_with_next, S32 len ) :
@@ -255,30 +218,27 @@ public:
255 } 218 }
256 virtual BOOL execute( LLTextEditor* editor, S32* delta ) 219 virtual BOOL execute( LLTextEditor* editor, S32* delta )
257 { 220 {
258 mWString = editor->getWSubString(mPos, mLen); 221 mWString = editor->getWSubString(getPosition(), mLen);
259 *delta = remove(editor, mPos, mLen ); 222 *delta = remove(editor, getPosition(), mLen );
260 return (*delta != 0); 223 return (*delta != 0);
261 } 224 }
262 virtual S32 undo( LLTextEditor* editor ) 225 virtual S32 undo( LLTextEditor* editor )
263 { 226 {
264 insert(editor, mPos, mWString ); 227 insert(editor, getPosition(), mWString );
265 return mPos + mWString.length(); 228 return getPosition() + mWString.length();
266 } 229 }
267 virtual S32 redo( LLTextEditor* editor ) 230 virtual S32 redo( LLTextEditor* editor )
268 { 231 {
269 remove(editor, mPos, mLen ); 232 remove(editor, getPosition(), mLen );
270 return mPos; 233 return getPosition();
271 } 234 }
272private: 235private:
273 LLWString mWString; 236 LLWString mWString;
274 S32 mLen; 237 S32 mLen;
275}; 238};
276 239
277///////////////////////////////////////////////////////////////////
278 240
279// 241///////////////////////////////////////////////////////////////////
280// Member functions
281//
282 242
283LLTextEditor::LLTextEditor( 243LLTextEditor::LLTextEditor(
284 const LLString& name, 244 const LLString& name,
@@ -309,7 +269,7 @@ LLTextEditor::LLTextEditor(
309 mFocusBgColor( LLUI::sColorsGroup->getColor( "TextBgFocusColor" ) ), 269 mFocusBgColor( LLUI::sColorsGroup->getColor( "TextBgFocusColor" ) ),
310 mReadOnly(FALSE), 270 mReadOnly(FALSE),
311 mWordWrap( FALSE ), 271 mWordWrap( FALSE ),
312 mTabToNextField( TRUE ), 272 mTabsToNextField( TRUE ),
313 mCommitOnFocusLost( FALSE ), 273 mCommitOnFocusLost( FALSE ),
314 mHideScrollbarForShortDocs( FALSE ), 274 mHideScrollbarForShortDocs( FALSE ),
315 mTakesNonScrollClicks( TRUE ), 275 mTakesNonScrollClicks( TRUE ),
@@ -344,10 +304,10 @@ LLTextEditor::LLTextEditor(
344 // Init the scrollbar 304 // Init the scrollbar
345 LLRect scroll_rect; 305 LLRect scroll_rect;
346 scroll_rect.setOriginAndSize( 306 scroll_rect.setOriginAndSize(
347 mRect.getWidth() - UI_TEXTEDITOR_BORDER - SCROLLBAR_SIZE, 307 getRect().getWidth() - UI_TEXTEDITOR_BORDER - SCROLLBAR_SIZE,
348 UI_TEXTEDITOR_BORDER, 308 UI_TEXTEDITOR_BORDER,
349 SCROLLBAR_SIZE, 309 SCROLLBAR_SIZE,
350 mRect.getHeight() - 2 * UI_TEXTEDITOR_BORDER ); 310 getRect().getHeight() - 2 * UI_TEXTEDITOR_BORDER );
351 S32 lines_in_doc = getLineCount(); 311 S32 lines_in_doc = getLineCount();
352 mScrollbar = new LLScrollbar( "Scrollbar", scroll_rect, 312 mScrollbar = new LLScrollbar( "Scrollbar", scroll_rect,
353 LLScrollbar::VERTICAL, 313 LLScrollbar::VERTICAL,
@@ -363,7 +323,7 @@ LLTextEditor::LLTextEditor(
363 mScrollbar->setOnScrollEndCallback(mOnScrollEndCallback, mOnScrollEndData); 323 mScrollbar->setOnScrollEndCallback(mOnScrollEndCallback, mOnScrollEndData);
364 addChild(mScrollbar); 324 addChild(mScrollbar);
365 325
366 mBorder = new LLViewBorder( "text ed border", LLRect(0, mRect.getHeight(), mRect.getWidth(), 0), LLViewBorder::BEVEL_IN, LLViewBorder::STYLE_LINE, UI_TEXTEDITOR_BORDER ); 326 mBorder = new LLViewBorder( "text ed border", LLRect(0, getRect().getHeight(), getRect().getWidth(), 0), LLViewBorder::BEVEL_IN, LLViewBorder::STYLE_LINE, UI_TEXTEDITOR_BORDER );
367 addChild( mBorder ); 327 addChild( mBorder );
368 328
369 appendText(default_text, FALSE, FALSE); 329 appendText(default_text, FALSE, FALSE);
@@ -392,12 +352,6 @@ LLTextEditor::~LLTextEditor()
392 std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer()); 352 std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer());
393} 353}
394 354
395//virtual
396LLString LLTextEditor::getWidgetTag() const
397{
398 return LL_TEXT_EDITOR_TAG;
399}
400
401void LLTextEditor::setTrackColor( const LLColor4& color ) 355void LLTextEditor::setTrackColor( const LLColor4& color )
402{ 356{
403 mScrollbar->setTrackColor(color); 357 mScrollbar->setTrackColor(color);
@@ -422,7 +376,7 @@ void LLTextEditor::updateLineStartList(S32 startpos)
422{ 376{
423 updateSegments(); 377 updateSegments();
424 378
425 bindEmbeddedChars( mGLFont ); 379 bindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
426 380
427 S32 seg_num = mSegments.size(); 381 S32 seg_num = mSegments.size();
428 S32 seg_idx = 0; 382 S32 seg_idx = 0;
@@ -471,7 +425,7 @@ void LLTextEditor::updateLineStartList(S32 startpos)
471 else 425 else
472 { 426 {
473 const llwchar* str = mWText.c_str() + start_idx; 427 const llwchar* str = mWText.c_str() + start_idx;
474 S32 drawn = mGLFont->maxDrawableChars(str, (F32)mTextRect.getWidth() - line_width, 428 S32 drawn = mGLFont->maxDrawableChars(str, (F32)abs(mTextRect.getWidth()) - line_width,
475 end_idx - start_idx, mWordWrap, mAllowEmbeddedItems ); 429 end_idx - start_idx, mWordWrap, mAllowEmbeddedItems );
476 if( 0 == drawn && line_width == 0) 430 if( 0 == drawn && line_width == 0)
477 { 431 {
@@ -499,7 +453,7 @@ void LLTextEditor::updateLineStartList(S32 startpos)
499 } 453 }
500 } 454 }
501 455
502 unbindEmbeddedChars(mGLFont); 456 unbindEmbeddedChars(const_cast<LLFontGL*>(mGLFont));
503 457
504 mScrollbar->setDocSize( getLineCount() ); 458 mScrollbar->setDocSize( getLineCount() );
505 459
@@ -515,11 +469,6 @@ void LLTextEditor::updateLineStartList(S32 startpos)
515// LLTextEditor 469// LLTextEditor
516// Public methods 470// Public methods
517 471
518//static
519BOOL LLTextEditor::isPartOfWord(llwchar c) { return (c == '_') || isalnum(c); }
520
521
522
523BOOL LLTextEditor::truncate() 472BOOL LLTextEditor::truncate()
524{ 473{
525 BOOL did_truncate = FALSE; 474 BOOL did_truncate = FALSE;
@@ -581,6 +530,7 @@ void LLTextEditor::setWText(const LLWString &wtext)
581 resetDirty(); 530 resetDirty();
582} 531}
583 532
533// virtual
584void LLTextEditor::setValue(const LLSD& value) 534void LLTextEditor::setValue(const LLSD& value)
585{ 535{
586 setText(value.asString()); 536 setText(value.asString());
@@ -600,6 +550,7 @@ const LLString& LLTextEditor::getText() const
600 return mUTF8Text; 550 return mUTF8Text;
601} 551}
602 552
553// virtual
603LLSD LLTextEditor::getValue() const 554LLSD LLTextEditor::getValue() const
604{ 555{
605 return LLSD(getText()); 556 return LLSD(getText());
@@ -622,7 +573,10 @@ void LLTextEditor::setBorderVisible(BOOL b)
622 mBorder->setVisible(b); 573 mBorder->setVisible(b);
623} 574}
624 575
625 576BOOL LLTextEditor::isBorderVisible() const
577{
578 return mBorder->getVisible();
579}
626 580
627void LLTextEditor::setHideScrollbarForShortDocs(BOOL b) 581void LLTextEditor::setHideScrollbarForShortDocs(BOOL b)
628{ 582{
@@ -734,12 +688,6 @@ void LLTextEditor::replaceTextAll(const LLString& search_text, const LLString& r
734 mScrollbar->setDocPos(cur_pos); 688 mScrollbar->setDocPos(cur_pos);
735} 689}
736 690
737void LLTextEditor::setTakesNonScrollClicks(BOOL b)
738{
739 mTakesNonScrollClicks = b;
740}
741
742
743// Picks a new cursor position based on the screen size of text being drawn. 691// Picks a new cursor position based on the screen size of text being drawn.
744void LLTextEditor::setCursorAtLocalPos( S32 local_x, S32 local_y, BOOL round ) 692void LLTextEditor::setCursorAtLocalPos( S32 local_x, S32 local_y, BOOL round )
745{ 693{
@@ -774,11 +722,6 @@ S32 LLTextEditor::nextWordPos(S32 cursorPos) const
774 return cursorPos; 722 return cursorPos;
775} 723}
776 724
777S32 LLTextEditor::getLineCount() const
778{
779 return mLineStartList.size();
780}
781
782S32 LLTextEditor::getLineStart( S32 line ) const 725S32 LLTextEditor::getLineStart( S32 line ) const
783{ 726{
784 S32 num_lines = getLineCount(); 727 S32 num_lines = getLineCount();
@@ -796,7 +739,7 @@ S32 LLTextEditor::getLineStart( S32 line ) const
796} 739}
797 740
798// Given an offset into text (pos), find the corresponding line (from the start of the doc) and an offset into the line. 741// Given an offset into text (pos), find the corresponding line (from the start of the doc) and an offset into the line.
799void LLTextEditor::getLineAndOffset( S32 startpos, S32* linep, S32* offsetp ) 742void LLTextEditor::getLineAndOffset( S32 startpos, S32* linep, S32* offsetp ) const
800{ 743{
801 if (mLineStartList.empty()) 744 if (mLineStartList.empty())
802 { 745 {
@@ -809,7 +752,7 @@ void LLTextEditor::getLineAndOffset( S32 startpos, S32* linep, S32* offsetp )
809 getSegmentAndOffset( startpos, &seg_idx, &seg_offset ); 752 getSegmentAndOffset( startpos, &seg_idx, &seg_offset );
810 753
811 line_info tline(seg_idx, seg_offset); 754 line_info tline(seg_idx, seg_offset);
812 line_list_t::iterator iter = std::upper_bound(mLineStartList.begin(), mLineStartList.end(), tline, line_info_compare()); 755 line_list_t::const_iterator iter = std::upper_bound(mLineStartList.begin(), mLineStartList.end(), tline, line_info_compare());
813 if (iter != mLineStartList.begin()) --iter; 756 if (iter != mLineStartList.begin()) --iter;
814 *linep = iter - mLineStartList.begin(); 757 *linep = iter - mLineStartList.begin();
815 S32 line_start = mSegments[iter->mSegment]->getStart() + iter->mOffset; 758 S32 line_start = mSegments[iter->mSegment]->getStart() + iter->mOffset;
@@ -817,7 +760,7 @@ void LLTextEditor::getLineAndOffset( S32 startpos, S32* linep, S32* offsetp )
817 } 760 }
818} 761}
819 762
820void LLTextEditor::getSegmentAndOffset( S32 startpos, S32* segidxp, S32* offsetp ) 763void LLTextEditor::getSegmentAndOffset( S32 startpos, S32* segidxp, S32* offsetp ) const
821{ 764{
822 if (mSegments.empty()) 765 if (mSegments.empty())
823 { 766 {
@@ -826,46 +769,21 @@ void LLTextEditor::getSegmentAndOffset( S32 startpos, S32* segidxp, S32* offsetp
826 } 769 }
827 770
828 LLTextSegment tseg(startpos); 771 LLTextSegment tseg(startpos);
829 segment_list_t::iterator seg_iter; 772 segment_list_t::const_iterator seg_iter;
830 seg_iter = std::upper_bound(mSegments.begin(), mSegments.end(), &tseg, LLTextSegment::compare()); 773 seg_iter = std::upper_bound(mSegments.begin(), mSegments.end(), &tseg, LLTextSegment::compare());
831 if (seg_iter != mSegments.begin()) --seg_iter; 774 if (seg_iter != mSegments.begin()) --seg_iter;
832 *segidxp = seg_iter - mSegments.begin(); 775 *segidxp = seg_iter - mSegments.begin();
833 *offsetp = startpos - (*seg_iter)->getStart(); 776 *offsetp = startpos - (*seg_iter)->getStart();
834} 777}
835 778
836const LLWString& LLTextEditor::getWText() const 779const LLTextSegment* LLTextEditor::getPreviousSegment()
837{
838 return mWText;
839}
840
841S32 LLTextEditor::getLength() const
842{
843 return mWText.length();
844}
845
846llwchar LLTextEditor::getWChar(S32 pos)
847{
848 return mWText[pos];
849}
850
851LLWString LLTextEditor::getWSubString(S32 pos, S32 len)
852{
853 return mWText.substr(pos, len);
854}
855
856LLTextSegment* LLTextEditor::getCurrentSegment()
857{
858 return getSegmentAtOffset(mCursorPos);
859}
860
861LLTextSegment* LLTextEditor::getPreviousSegment()
862{ 780{
863 // find segment index at character to left of cursor (or rightmost edge of selection) 781 // find segment index at character to left of cursor (or rightmost edge of selection)
864 S32 idx = llmax(0, getSegmentIdxAtOffset(mCursorPos) - 1); 782 S32 idx = llmax(0, getSegmentIdxAtOffset(mCursorPos) - 1);
865 return idx >= 0 ? mSegments[idx] : NULL; 783 return idx >= 0 ? mSegments[idx] : NULL;
866} 784}
867 785
868void LLTextEditor::getSelectedSegments(std::vector<LLTextSegment*>& segments) 786void LLTextEditor::getSelectedSegments(std::vector<const LLTextSegment*>& segments)
869{ 787{
870 S32 left = hasSelection() ? llmin(mSelectionStart, mSelectionEnd) : mCursorPos; 788 S32 left = hasSelection() ? llmin(mSelectionStart, mSelectionEnd) : mCursorPos;
871 S32 right = hasSelection() ? llmax(mSelectionStart, mSelectionEnd) : mCursorPos; 789 S32 right = hasSelection() ? llmax(mSelectionStart, mSelectionEnd) : mCursorPos;
@@ -878,7 +796,7 @@ void LLTextEditor::getSelectedSegments(std::vector<LLTextSegment*>& segments)
878 } 796 }
879} 797}
880 798
881S32 LLTextEditor::getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL round ) 799S32 LLTextEditor::getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL round ) const
882{ 800{
883 // If round is true, if the position is on the right half of a character, the cursor 801 // If round is true, if the position is on the right half of a character, the cursor
884 // will be put to its right. If round is false, the cursor will always be put to the 802 // will be put to its right. If round is false, the cursor will always be put to the
@@ -916,13 +834,13 @@ S32 LLTextEditor::getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL rou
916 if (mAllowEmbeddedItems) 834 if (mAllowEmbeddedItems)
917 { 835 {
918 // Figure out which character we're nearest to. 836 // Figure out which character we're nearest to.
919 bindEmbeddedChars(mGLFont); 837 bindEmbeddedChars(const_cast<LLFontGL*>(mGLFont));
920 pos = mGLFont->charFromPixelOffset(mWText.c_str(), line_start, 838 pos = mGLFont->charFromPixelOffset(mWText.c_str(), line_start,
921 (F32)(local_x - mTextRect.mLeft), 839 (F32)(local_x - mTextRect.mLeft),
922 (F32)(mTextRect.getWidth()), 840 (F32)(mTextRect.getWidth()),
923 line_len, 841 line_len,
924 round, TRUE); 842 round, TRUE);
925 unbindEmbeddedChars(mGLFont); 843 unbindEmbeddedChars(const_cast<LLFontGL*>(mGLFont));
926 } 844 }
927 else 845 else
928 { 846 {
@@ -958,8 +876,8 @@ void LLTextEditor::setCursorPos(S32 offset)
958 mDesiredXPixel = -1; 876 mDesiredXPixel = -1;
959} 877}
960 878
961 879// virtual
962BOOL LLTextEditor::canDeselect() 880BOOL LLTextEditor::canDeselect() const
963{ 881{
964 return hasSelection(); 882 return hasSelection();
965} 883}
@@ -1126,12 +1044,13 @@ void LLTextEditor::indentSelectedLines( S32 spaces )
1126 } 1044 }
1127} 1045}
1128 1046
1129 1047//virtual
1130BOOL LLTextEditor::canSelectAll() 1048BOOL LLTextEditor::canSelectAll() const
1131{ 1049{
1132 return TRUE; 1050 return TRUE;
1133} 1051}
1134 1052
1053// virtual
1135void LLTextEditor::selectAll() 1054void LLTextEditor::selectAll()
1136{ 1055{
1137 mSelectionStart = getLength(); 1056 mSelectionStart = getLength();
@@ -1143,7 +1062,7 @@ void LLTextEditor::selectAll()
1143BOOL LLTextEditor::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) 1062BOOL LLTextEditor::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen)
1144{ 1063{
1145 for ( child_list_const_iter_t child_it = getChildList()->begin(); 1064 for ( child_list_const_iter_t child_it = getChildList()->begin();
1146 child_it != getChildList()->end(); ++child_it) 1065 child_it != getChildList()->end(); ++child_it)
1147 { 1066 {
1148 LLView* viewp = *child_it; 1067 LLView* viewp = *child_it;
1149 S32 local_x = x - viewp->getRect().mLeft; 1068 S32 local_x = x - viewp->getRect().mLeft;
@@ -1159,7 +1078,7 @@ BOOL LLTextEditor::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rec
1159 return TRUE; 1078 return TRUE;
1160 } 1079 }
1161 1080
1162 LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); 1081 const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
1163 if( cur_segment ) 1082 if( cur_segment )
1164 { 1083 {
1165 BOOL has_tool_tip = FALSE; 1084 BOOL has_tool_tip = FALSE;
@@ -1267,7 +1186,7 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
1267 } 1186 }
1268 1187
1269 // Delay cursor flashing 1188 // Delay cursor flashing
1270 mKeystrokeTimer.reset(); 1189 resetKeystrokeTimer();
1271 1190
1272 return handled; 1191 return handled;
1273} 1192}
@@ -1320,7 +1239,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
1320 if( handled ) 1239 if( handled )
1321 { 1240 {
1322 // Delay cursor flashing 1241 // Delay cursor flashing
1323 mKeystrokeTimer.reset(); 1242 resetKeystrokeTimer();
1324 } 1243 }
1325 1244
1326 // Opaque 1245 // Opaque
@@ -1329,7 +1248,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
1329 // Check to see if we're over an HTML-style link 1248 // Check to see if we're over an HTML-style link
1330 if( !mSegments.empty() ) 1249 if( !mSegments.empty() )
1331 { 1250 {
1332 LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); 1251 const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
1333 if( cur_segment ) 1252 if( cur_segment )
1334 { 1253 {
1335 if(cur_segment->getStyle().isLink()) 1254 if(cur_segment->getStyle().isLink())
@@ -1353,7 +1272,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
1353 if( !handled ) 1272 if( !handled )
1354 { 1273 {
1355 lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl; 1274 lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl;
1356 if (!mScrollbar->getVisible() || x < mRect.getWidth() - SCROLLBAR_SIZE) 1275 if (!mScrollbar->getVisible() || x < getRect().getWidth() - SCROLLBAR_SIZE)
1357 { 1276 {
1358 getWindow()->setCursor(UI_CURSOR_IBEAM); 1277 getWindow()->setCursor(UI_CURSOR_IBEAM);
1359 } 1278 }
@@ -1411,7 +1330,7 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
1411 } 1330 }
1412 1331
1413 // Delay cursor flashing 1332 // Delay cursor flashing
1414 mKeystrokeTimer.reset(); 1333 resetKeystrokeTimer();
1415 1334
1416 if( hasMouseCapture() ) 1335 if( hasMouseCapture() )
1417 { 1336 {
@@ -1467,7 +1386,7 @@ BOOL LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
1467 mIsSelecting = FALSE; 1386 mIsSelecting = FALSE;
1468 1387
1469 // delay cursor flashing 1388 // delay cursor flashing
1470 mKeystrokeTimer.reset(); 1389 resetKeystrokeTimer();
1471 1390
1472 handled = TRUE; 1391 handled = TRUE;
1473 } 1392 }
@@ -1548,50 +1467,51 @@ S32 LLTextEditor::overwriteChar(S32 pos, llwchar wc)
1548// a pseudo-tab (up to for spaces in a row) 1467// a pseudo-tab (up to for spaces in a row)
1549void LLTextEditor::removeCharOrTab() 1468void LLTextEditor::removeCharOrTab()
1550{ 1469{
1551 if( getEnabled() ) 1470 if( !getEnabled() )
1552 { 1471 {
1553 if( mCursorPos > 0 ) 1472 return;
1554 { 1473 }
1555 S32 chars_to_remove = 1; 1474 if( mCursorPos > 0 )
1475 {
1476 S32 chars_to_remove = 1;
1556 1477
1557 const LLWString &text = mWText; 1478 const LLWString &text = mWText;
1558 if (text[mCursorPos - 1] == ' ') 1479 if (text[mCursorPos - 1] == ' ')
1480 {
1481 // Try to remove a "tab"
1482 S32 line, offset;
1483 getLineAndOffset(mCursorPos, &line, &offset);
1484 if (offset > 0)
1559 { 1485 {
1560 // Try to remove a "tab" 1486 chars_to_remove = offset % SPACES_PER_TAB;
1561 S32 line, offset; 1487 if( chars_to_remove == 0 )
1562 getLineAndOffset(mCursorPos, &line, &offset);
1563 if (offset > 0)
1564 { 1488 {
1565 chars_to_remove = offset % SPACES_PER_TAB; 1489 chars_to_remove = SPACES_PER_TAB;
1566 if( chars_to_remove == 0 ) 1490 }
1567 {
1568 chars_to_remove = SPACES_PER_TAB;
1569 }
1570 1491
1571 for( S32 i = 0; i < chars_to_remove; i++ ) 1492 for( S32 i = 0; i < chars_to_remove; i++ )
1493 {
1494 if (text[ mCursorPos - i - 1] != ' ')
1572 { 1495 {
1573 if (text[ mCursorPos - i - 1] != ' ') 1496 // Fewer than a full tab's worth of spaces, so
1574 { 1497 // just delete a single character.
1575 // Fewer than a full tab's worth of spaces, so 1498 chars_to_remove = 1;
1576 // just delete a single character. 1499 break;
1577 chars_to_remove = 1;
1578 break;
1579 }
1580 } 1500 }
1581 } 1501 }
1582 } 1502 }
1583
1584 for (S32 i = 0; i < chars_to_remove; i++)
1585 {
1586 setCursorPos(mCursorPos - 1);
1587 remove( mCursorPos, 1, FALSE );
1588 }
1589 } 1503 }
1590 else 1504
1505 for (S32 i = 0; i < chars_to_remove; i++)
1591 { 1506 {
1592 reportBadKeystroke(); 1507 setCursorPos(mCursorPos - 1);
1508 remove( mCursorPos, 1, FALSE );
1593 } 1509 }
1594 } 1510 }
1511 else
1512 {
1513 reportBadKeystroke();
1514 }
1595} 1515}
1596 1516
1597// Remove a single character from the text 1517// Remove a single character from the text
@@ -1602,17 +1522,18 @@ S32 LLTextEditor::removeChar(S32 pos)
1602 1522
1603void LLTextEditor::removeChar() 1523void LLTextEditor::removeChar()
1604{ 1524{
1605 if (getEnabled()) 1525 if (!getEnabled())
1606 { 1526 {
1607 if (mCursorPos > 0) 1527 return;
1608 { 1528 }
1609 setCursorPos(mCursorPos - 1); 1529 if (mCursorPos > 0)
1610 removeChar(mCursorPos); 1530 {
1611 } 1531 setCursorPos(mCursorPos - 1);
1612 else 1532 removeChar(mCursorPos);
1613 { 1533 }
1614 reportBadKeystroke(); 1534 else
1615 } 1535 {
1536 reportBadKeystroke();
1616 } 1537 }
1617} 1538}
1618 1539
@@ -1639,19 +1560,20 @@ S32 LLTextEditor::addChar(S32 pos, llwchar wc)
1639 1560
1640void LLTextEditor::addChar(llwchar wc) 1561void LLTextEditor::addChar(llwchar wc)
1641{ 1562{
1642 if( getEnabled() ) 1563 if( !getEnabled() )
1643 { 1564 {
1644 if( hasSelection() ) 1565 return;
1645 {
1646 deleteSelection(TRUE);
1647 }
1648 else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode())
1649 {
1650 removeChar(mCursorPos);
1651 }
1652
1653 setCursorPos(mCursorPos + addChar( mCursorPos, wc ));
1654 } 1566 }
1567 if( hasSelection() )
1568 {
1569 deleteSelection(TRUE);
1570 }
1571 else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode())
1572 {
1573 removeChar(mCursorPos);
1574 }
1575
1576 setCursorPos(mCursorPos + addChar( mCursorPos, wc ));
1655} 1577}
1656 1578
1657 1579
@@ -1747,7 +1669,6 @@ BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask)
1747 } 1669 }
1748 } 1670 }
1749 1671
1750
1751 if( !handled && mHandleEditKeysDirectly ) 1672 if( !handled && mHandleEditKeysDirectly )
1752 { 1673 {
1753 if( (MASK_CONTROL & mask) && ('A' == key) ) 1674 if( (MASK_CONTROL & mask) && ('A' == key) )
@@ -1900,7 +1821,8 @@ void LLTextEditor::deleteSelection(BOOL group_with_next_op )
1900 } 1821 }
1901} 1822}
1902 1823
1903BOOL LLTextEditor::canCut() 1824// virtual
1825BOOL LLTextEditor::canCut() const
1904{ 1826{
1905 return !mReadOnly && hasSelection(); 1827 return !mReadOnly && hasSelection();
1906} 1828}
@@ -1908,36 +1830,37 @@ BOOL LLTextEditor::canCut()
1908// cut selection to clipboard 1830// cut selection to clipboard
1909void LLTextEditor::cut() 1831void LLTextEditor::cut()
1910{ 1832{
1911 if( canCut() ) 1833 if( !canCut() )
1912 { 1834 {
1913 S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); 1835 return;
1914 S32 length = abs( mSelectionStart - mSelectionEnd );
1915 gClipboard.copyFromSubstring( mWText, left_pos, length, mSourceID );
1916 deleteSelection( FALSE );
1917
1918 updateLineStartList();
1919 updateScrollFromCursor();
1920 } 1836 }
1837 S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
1838 S32 length = abs( mSelectionStart - mSelectionEnd );
1839 gClipboard.copyFromSubstring( mWText, left_pos, length, mSourceID );
1840 deleteSelection( FALSE );
1841
1842 updateLineStartList();
1843 updateScrollFromCursor();
1921} 1844}
1922 1845
1923BOOL LLTextEditor::canCopy() 1846BOOL LLTextEditor::canCopy() const
1924{ 1847{
1925 return hasSelection(); 1848 return hasSelection();
1926} 1849}
1927 1850
1928
1929// copy selection to clipboard 1851// copy selection to clipboard
1930void LLTextEditor::copy() 1852void LLTextEditor::copy()
1931{ 1853{
1932 if( canCopy() ) 1854 if( !canCopy() )
1933 { 1855 {
1934 S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); 1856 return;
1935 S32 length = abs( mSelectionStart - mSelectionEnd );
1936 gClipboard.copyFromSubstring(mWText, left_pos, length, mSourceID);
1937 } 1857 }
1858 S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
1859 S32 length = abs( mSelectionStart - mSelectionEnd );
1860 gClipboard.copyFromSubstring(mWText, left_pos, length, mSourceID);
1938} 1861}
1939 1862
1940BOOL LLTextEditor::canPaste() 1863BOOL LLTextEditor::canPaste() const
1941{ 1864{
1942 return !mReadOnly && gClipboard.canPasteString(); 1865 return !mReadOnly && gClipboard.canPasteString();
1943} 1866}
@@ -1946,47 +1869,49 @@ BOOL LLTextEditor::canPaste()
1946// paste from clipboard 1869// paste from clipboard
1947void LLTextEditor::paste() 1870void LLTextEditor::paste()
1948{ 1871{
1949 if (canPaste()) 1872 if (!canPaste())
1873 {
1874 return;
1875 }
1876 LLUUID source_id;
1877 LLWString paste = gClipboard.getPasteWString(&source_id);
1878 if (paste.empty())
1950 { 1879 {
1951 LLUUID source_id; 1880 return;
1952 LLWString paste = gClipboard.getPasteWString(&source_id); 1881 }
1953 if (!paste.empty()) 1882 // Delete any selected characters (the paste replaces them)
1883 if( hasSelection() )
1884 {
1885 deleteSelection(TRUE);
1886 }
1887
1888 // Clean up string (replace tabs and remove characters that our fonts don't support).
1889 LLWString clean_string(paste);
1890 LLWString::replaceTabsWithSpaces(clean_string, SPACES_PER_TAB);
1891 if( mAllowEmbeddedItems )
1892 {
1893 const llwchar LF = 10;
1894 S32 len = clean_string.length();
1895 for( S32 i = 0; i < len; i++ )
1954 { 1896 {
1955 // Delete any selected characters (the paste replaces them) 1897 llwchar wc = clean_string[i];
1956 if( hasSelection() ) 1898 if( (wc < LLFont::FIRST_CHAR) && (wc != LF) )
1957 { 1899 {
1958 deleteSelection(TRUE); 1900 clean_string[i] = LL_UNKNOWN_CHAR;
1959 } 1901 }
1960 1902 else if (wc >= FIRST_EMBEDDED_CHAR && wc <= LAST_EMBEDDED_CHAR)
1961 // Clean up string (replace tabs and remove characters that our fonts don't support).
1962 LLWString clean_string(paste);
1963 LLWString::replaceTabsWithSpaces(clean_string, SPACES_PER_TAB);
1964 if( mAllowEmbeddedItems )
1965 { 1903 {
1966 const llwchar LF = 10; 1904 clean_string[i] = pasteEmbeddedItem(wc);
1967 S32 len = clean_string.length();
1968 for( S32 i = 0; i < len; i++ )
1969 {
1970 llwchar wc = clean_string[i];
1971 if( (wc < LLFont::FIRST_CHAR) && (wc != LF) )
1972 {
1973 clean_string[i] = LL_UNKNOWN_CHAR;
1974 }
1975 else if (wc >= FIRST_EMBEDDED_CHAR && wc <= LAST_EMBEDDED_CHAR)
1976 {
1977 clean_string[i] = pasteEmbeddedItem(wc);
1978 }
1979 }
1980 } 1905 }
1981
1982 // Insert the new text into the existing text.
1983 setCursorPos(mCursorPos + insert(mCursorPos, clean_string, FALSE));
1984 deselect();
1985
1986 updateLineStartList();
1987 updateScrollFromCursor();
1988 } 1906 }
1989 } 1907 }
1908
1909 // Insert the new text into the existing text.
1910 setCursorPos(mCursorPos + insert(mCursorPos, clean_string, FALSE));
1911 deselect();
1912
1913 updateLineStartList();
1914 updateScrollFromCursor();
1990} 1915}
1991 1916
1992 1917
@@ -2240,7 +2165,7 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent )
2240 { 2165 {
2241 // Special case for TAB. If want to move to next field, report 2166 // Special case for TAB. If want to move to next field, report
2242 // not handled and let the parent take care of field movement. 2167 // not handled and let the parent take care of field movement.
2243 if (KEY_TAB == key && mTabToNextField) 2168 if (KEY_TAB == key && mTabsToNextField)
2244 { 2169 {
2245 return FALSE; 2170 return FALSE;
2246 } 2171 }
@@ -2296,7 +2221,7 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent )
2296 2221
2297 if( handled ) 2222 if( handled )
2298 { 2223 {
2299 mKeystrokeTimer.reset(); 2224 resetKeystrokeTimer();
2300 2225
2301 // Most keystrokes will make the selection box go away, but not all will. 2226 // Most keystrokes will make the selection box go away, but not all will.
2302 if( !selection_modified && 2227 if( !selection_modified &&
@@ -2350,7 +2275,7 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_pare
2350 2275
2351 if( handled ) 2276 if( handled )
2352 { 2277 {
2353 mKeystrokeTimer.reset(); 2278 resetKeystrokeTimer();
2354 2279
2355 // Most keystrokes will make the selection box go away, but not all will. 2280 // Most keystrokes will make the selection box go away, but not all will.
2356 deselect(); 2281 deselect();
@@ -2364,58 +2289,58 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_pare
2364} 2289}
2365 2290
2366 2291
2367 2292// virtual
2368BOOL LLTextEditor::canDoDelete() 2293BOOL LLTextEditor::canDoDelete() const
2369{ 2294{
2370 return !mReadOnly && ( hasSelection() || (mCursorPos < getLength()) ); 2295 return !mReadOnly && ( hasSelection() || (mCursorPos < getLength()) );
2371} 2296}
2372 2297
2373void LLTextEditor::doDelete() 2298void LLTextEditor::doDelete()
2374{ 2299{
2375 if( canDoDelete() ) 2300 if( !canDoDelete() )
2376 { 2301 {
2377 if( hasSelection() ) 2302 return;
2303 }
2304 if( hasSelection() )
2305 {
2306 deleteSelection(FALSE);
2307 }
2308 else
2309 if( mCursorPos < getLength() )
2310 {
2311 S32 i;
2312 S32 chars_to_remove = 1;
2313 const LLWString &text = mWText;
2314 if( (text[ mCursorPos ] == ' ') && (mCursorPos + SPACES_PER_TAB < getLength()) )
2378 { 2315 {
2379 deleteSelection(FALSE); 2316 // Try to remove a full tab's worth of spaces
2380 } 2317 S32 line, offset;
2381 else 2318 getLineAndOffset( mCursorPos, &line, &offset );
2382 if( mCursorPos < getLength() ) 2319 chars_to_remove = SPACES_PER_TAB - (offset % SPACES_PER_TAB);
2383 { 2320 if( chars_to_remove == 0 )
2384 S32 i;
2385 S32 chars_to_remove = 1;
2386 const LLWString &text = mWText;
2387 if( (text[ mCursorPos ] == ' ') && (mCursorPos + SPACES_PER_TAB < getLength()) )
2388 { 2321 {
2389 // Try to remove a full tab's worth of spaces 2322 chars_to_remove = SPACES_PER_TAB;
2390 S32 line, offset;
2391 getLineAndOffset( mCursorPos, &line, &offset );
2392 chars_to_remove = SPACES_PER_TAB - (offset % SPACES_PER_TAB);
2393 if( chars_to_remove == 0 )
2394 {
2395 chars_to_remove = SPACES_PER_TAB;
2396 }
2397
2398 for( i = 0; i < chars_to_remove; i++ )
2399 {
2400 if( text[mCursorPos + i] != ' ' )
2401 {
2402 chars_to_remove = 1;
2403 break;
2404 }
2405 }
2406 } 2323 }
2407 2324
2408
2409 for( i = 0; i < chars_to_remove; i++ ) 2325 for( i = 0; i < chars_to_remove; i++ )
2410 { 2326 {
2411 setCursorPos(mCursorPos + 1); 2327 if( text[mCursorPos + i] != ' ' )
2412 removeChar(); 2328 {
2329 chars_to_remove = 1;
2330 break;
2331 }
2413 } 2332 }
2414 } 2333 }
2415 2334
2416 updateLineStartList(); 2335 for( i = 0; i < chars_to_remove; i++ )
2417 updateScrollFromCursor(); 2336 {
2337 setCursorPos(mCursorPos + 1);
2338 removeChar();
2339 }
2418 } 2340 }
2341
2342 updateLineStartList();
2343 updateScrollFromCursor();
2419} 2344}
2420 2345
2421//---------------------------------------------------------------------------- 2346//----------------------------------------------------------------------------
@@ -2429,65 +2354,66 @@ void LLTextEditor::blockUndo()
2429 mUndoStack.clear(); 2354 mUndoStack.clear();
2430} 2355}
2431 2356
2432 2357// virtual
2433BOOL LLTextEditor::canUndo() 2358BOOL LLTextEditor::canUndo() const
2434{ 2359{
2435 return !mReadOnly && mLastCmd != NULL; 2360 return !mReadOnly && mLastCmd != NULL;
2436} 2361}
2437 2362
2438void LLTextEditor::undo() 2363void LLTextEditor::undo()
2439{ 2364{
2440 if( canUndo() ) 2365 if( !canUndo() )
2441 { 2366 {
2442 deselect(); 2367 return;
2443 2368 }
2444 S32 pos = 0; 2369 deselect();
2445 do 2370 S32 pos = 0;
2446 { 2371 do
2447 pos = mLastCmd->undo(this); 2372 {
2448 undo_stack_t::iterator iter = std::find(mUndoStack.begin(), mUndoStack.end(), mLastCmd); 2373 pos = mLastCmd->undo(this);
2449 if (iter != mUndoStack.end()) 2374 undo_stack_t::iterator iter = std::find(mUndoStack.begin(), mUndoStack.end(), mLastCmd);
2450 ++iter; 2375 if (iter != mUndoStack.end())
2451 if (iter != mUndoStack.end()) 2376 ++iter;
2452 mLastCmd = *iter; 2377 if (iter != mUndoStack.end())
2453 else 2378 mLastCmd = *iter;
2454 mLastCmd = NULL; 2379 else
2380 mLastCmd = NULL;
2455 2381
2456 } while( mLastCmd && mLastCmd->groupWithNext() ); 2382 } while( mLastCmd && mLastCmd->groupWithNext() );
2457 2383
2458 setCursorPos(pos); 2384 setCursorPos(pos);
2459 2385
2460 updateLineStartList(); 2386 updateLineStartList();
2461 updateScrollFromCursor(); 2387 updateScrollFromCursor();
2462 }
2463} 2388}
2464 2389
2465BOOL LLTextEditor::canRedo() 2390BOOL LLTextEditor::canRedo() const
2466{ 2391{
2467 return !mReadOnly && (mUndoStack.size() > 0) && (mLastCmd != mUndoStack.front()); 2392 return !mReadOnly && (mUndoStack.size() > 0) && (mLastCmd != mUndoStack.front());
2468} 2393}
2469 2394
2470void LLTextEditor::redo() 2395void LLTextEditor::redo()
2471{ 2396{
2472 if( canRedo() ) 2397 if( !canRedo() )
2473 { 2398 {
2474 deselect(); 2399 return;
2475 2400 }
2476 S32 pos = 0; 2401 deselect();
2477 do 2402 S32 pos = 0;
2403 do
2404 {
2405 if( !mLastCmd )
2478 { 2406 {
2479 if( !mLastCmd ) 2407 mLastCmd = mUndoStack.back();
2480 { 2408 }
2481 mLastCmd = mUndoStack.back(); 2409 else
2482 } 2410 {
2411 undo_stack_t::iterator iter = std::find(mUndoStack.begin(), mUndoStack.end(), mLastCmd);
2412 if (iter != mUndoStack.begin())
2413 mLastCmd = *(--iter);
2483 else 2414 else
2484 { 2415 mLastCmd = NULL;
2485 undo_stack_t::iterator iter = std::find(mUndoStack.begin(), mUndoStack.end(), mLastCmd); 2416 }
2486 if (iter != mUndoStack.begin())
2487 mLastCmd = *(--iter);
2488 else
2489 mLastCmd = NULL;
2490 }
2491 2417
2492 if( mLastCmd ) 2418 if( mLastCmd )
2493 { 2419 {
@@ -2500,9 +2426,8 @@ void LLTextEditor::redo()
2500 2426
2501 setCursorPos(pos); 2427 setCursorPos(pos);
2502 2428
2503 updateLineStartList(); 2429 updateLineStartList();
2504 updateScrollFromCursor(); 2430 updateScrollFromCursor();
2505 }
2506} 2431}
2507 2432
2508void LLTextEditor::onFocusReceived() 2433void LLTextEditor::onFocusReceived()
@@ -2548,8 +2473,8 @@ void LLTextEditor::setEnabled(BOOL enabled)
2548void LLTextEditor::drawBackground() 2473void LLTextEditor::drawBackground()
2549{ 2474{
2550 S32 left = 0; 2475 S32 left = 0;
2551 S32 top = mRect.getHeight(); 2476 S32 top = getRect().getHeight();
2552 S32 right = mRect.getWidth(); 2477 S32 right = getRect().getWidth();
2553 S32 bottom = 0; 2478 S32 bottom = 0;
2554 2479
2555 LLColor4 bg_color = mReadOnlyBgColor; 2480 LLColor4 bg_color = mReadOnlyBgColor;
@@ -2677,7 +2602,7 @@ void LLTextEditor::drawSelectionBackground()
2677 LLGLSNoTexture no_texture; 2602 LLGLSNoTexture no_texture;
2678 const LLColor4& color = mReadOnly ? mReadOnlyBgColor : mWriteableBgColor; 2603 const LLColor4& color = mReadOnly ? mReadOnlyBgColor : mWriteableBgColor;
2679 F32 alpha = hasFocus() ? 1.f : 0.5f; 2604 F32 alpha = hasFocus() ? 1.f : 0.5f;
2680 glColor4f( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], alpha ); 2605 gGL.color4f( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], alpha );
2681 2606
2682 if( selection_left_y == selection_right_y ) 2607 if( selection_left_y == selection_right_y )
2683 { 2608 {
@@ -2805,14 +2730,14 @@ void LLTextEditor::drawCursor()
2805 2730
2806 LLGLSNoTexture no_texture; 2731 LLGLSNoTexture no_texture;
2807 2732
2808 glColor4fv( mCursorColor.mV ); 2733 gGL.color4fv( mCursorColor.mV );
2809 2734
2810 gl_rect_2d(llfloor(cursor_left), llfloor(cursor_top), 2735 gl_rect_2d(llfloor(cursor_left), llfloor(cursor_top),
2811 llfloor(cursor_right), llfloor(cursor_bottom)); 2736 llfloor(cursor_right), llfloor(cursor_bottom));
2812 2737
2813 if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode() && !hasSelection() && text[mCursorPos] != '\n') 2738 if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode() && !hasSelection() && text[mCursorPos] != '\n')
2814 { 2739 {
2815 LLTextSegment* segmentp = getSegmentAtOffset(mCursorPos); 2740 const LLTextSegment* segmentp = getSegmentAtOffset(mCursorPos);
2816 LLColor4 text_color; 2741 LLColor4 text_color;
2817 if (segmentp) 2742 if (segmentp)
2818 { 2743 {
@@ -2826,7 +2751,6 @@ void LLTextEditor::drawCursor()
2826 { 2751 {
2827 text_color = mFgColor; 2752 text_color = mFgColor;
2828 } 2753 }
2829 LLGLSTexture texture;
2830 mGLFont->render(text, mCursorPos, next_char_left, cursor_bottom + line_height, 2754 mGLFont->render(text, mCursorPos, next_char_left, cursor_bottom + line_height,
2831 LLColor4(1.f - text_color.mV[VRED], 1.f - text_color.mV[VGREEN], 1.f - text_color.mV[VBLUE], 1.f), 2755 LLColor4(1.f - text_color.mV[VRED], 1.f - text_color.mV[VGREEN], 1.f - text_color.mV[VBLUE], 1.f),
2832 LLFontGL::LEFT, LLFontGL::TOP, 2756 LLFontGL::LEFT, LLFontGL::TOP,
@@ -2945,122 +2869,118 @@ void LLTextEditor::drawText()
2945{ 2869{
2946 const LLWString &text = mWText; 2870 const LLWString &text = mWText;
2947 const S32 text_len = getLength(); 2871 const S32 text_len = getLength();
2872 if( text_len <= 0 )
2873 {
2874 return;
2875 }
2876 S32 selection_left = -1;
2877 S32 selection_right = -1;
2878 // Draw selection even if we don't have keyboard focus for search/replace
2879 if( hasSelection())
2880 {
2881 selection_left = llmin( mSelectionStart, mSelectionEnd );
2882 selection_right = llmax( mSelectionStart, mSelectionEnd );
2883 }
2948 2884
2949 if( text_len > 0 ) 2885 LLGLSUIDefault gls_ui;
2886
2887 S32 cur_line = mScrollbar->getDocPos();
2888 S32 num_lines = getLineCount();
2889 if (cur_line >= num_lines)
2890 {
2891 return;
2892 }
2893
2894 S32 line_start = getLineStart(cur_line);
2895 LLTextSegment t(line_start);
2896 segment_list_t::iterator seg_iter;
2897 seg_iter = std::upper_bound(mSegments.begin(), mSegments.end(), &t, LLTextSegment::compare());
2898 if (seg_iter == mSegments.end() || (*seg_iter)->getStart() > line_start) --seg_iter;
2899 LLTextSegment* cur_segment = *seg_iter;
2900
2901 S32 line_height = llround( mGLFont->getLineHeight() );
2902 F32 text_y = (F32)(mTextRect.mTop - line_height);
2903 while((mTextRect.mBottom <= text_y) && (cur_line < num_lines))
2950 { 2904 {
2951 S32 selection_left = -1; 2905 S32 next_start = -1;
2952 S32 selection_right = -1; 2906 S32 line_end = text_len;
2953 // Draw selection even if we don't have keyboard focus for search/replace 2907
2954 if( hasSelection()) 2908 if ((cur_line + 1) < num_lines)
2955 { 2909 {
2956 selection_left = llmin( mSelectionStart, mSelectionEnd ); 2910 next_start = getLineStart(cur_line + 1);
2957 selection_right = llmax( mSelectionStart, mSelectionEnd ); 2911 line_end = next_start;
2958 } 2912 }
2959 2913 if ( text[line_end-1] == '\n' )
2960 LLGLSUIDefault gls_ui;
2961
2962 S32 cur_line = mScrollbar->getDocPos();
2963 S32 num_lines = getLineCount();
2964 if (cur_line >= num_lines)
2965 { 2914 {
2966 return; 2915 --line_end;
2967 } 2916 }
2968 2917
2969 S32 line_start = getLineStart(cur_line); 2918 F32 text_x = (F32)mTextRect.mLeft;
2970 LLTextSegment t(line_start);
2971 segment_list_t::iterator seg_iter;
2972 seg_iter = std::upper_bound(mSegments.begin(), mSegments.end(), &t, LLTextSegment::compare());
2973 if (seg_iter == mSegments.end() || (*seg_iter)->getStart() > line_start) --seg_iter;
2974 LLTextSegment* cur_segment = *seg_iter;
2975
2976 S32 line_height = llround( mGLFont->getLineHeight() );
2977 F32 text_y = (F32)(mTextRect.mTop - line_height);
2978 while((mTextRect.mBottom <= text_y) && (cur_line < num_lines))
2979 {
2980 S32 next_start = -1;
2981 S32 line_end = text_len;
2982 2919
2983 if ((cur_line + 1) < num_lines) 2920 S32 seg_start = line_start;
2984 { 2921 while( seg_start < line_end )
2985 next_start = getLineStart(cur_line + 1); 2922 {
2986 line_end = next_start; 2923 while( cur_segment->getEnd() <= seg_start )
2987 }
2988 if ( text[line_end-1] == '\n' )
2989 { 2924 {
2990 --line_end; 2925 seg_iter++;
2926 if (seg_iter == mSegments.end())
2927 {
2928 llwarns << "Ran off the segmentation end!" << llendl;
2929 return;
2930 }
2931 cur_segment = *seg_iter;
2991 } 2932 }
2992 2933
2993 F32 text_x = (F32)mTextRect.mLeft; 2934 // Draw a segment within the line
2994 2935 S32 clipped_end = llmin( line_end, cur_segment->getEnd() );
2995 S32 seg_start = line_start; 2936 S32 clipped_len = clipped_end - seg_start;
2996 while( seg_start < line_end ) 2937 if( clipped_len > 0 )
2997 { 2938 {
2998 while( cur_segment->getEnd() <= seg_start ) 2939 LLStyle style = cur_segment->getStyle();
2940 if ( style.isImage() && (cur_segment->getStart() >= seg_start) && (cur_segment->getStart() <= clipped_end))
2999 { 2941 {
3000 seg_iter++; 2942 LLImageGL *image = style.getImage();
3001 if (seg_iter == mSegments.end()) 2943 gl_draw_scaled_image( llround(text_x), llround(text_y)+line_height-style.mImageHeight, style.mImageWidth, style.mImageHeight, image, LLColor4::white );
3002 {
3003 llwarns << "Ran off the segmentation end!" << llendl;
3004 return;
3005 }
3006 cur_segment = *seg_iter;
3007 } 2944 }
3008
3009 // Draw a segment within the line
3010 S32 clipped_end = llmin( line_end, cur_segment->getEnd() );
3011 S32 clipped_len = clipped_end - seg_start;
3012 if( clipped_len > 0 )
3013 {
3014 LLStyle style = cur_segment->getStyle();
3015 if ( style.isImage() && (cur_segment->getStart() >= seg_start) && (cur_segment->getStart() <= clipped_end))
3016 {
3017 LLImageGL *image = style.getImage();
3018
3019 gl_draw_scaled_image( llround(text_x), llround(text_y)+line_height-style.mImageHeight, style.mImageWidth, style.mImageHeight, image, LLColor4::white );
3020
3021 }
3022 2945
3023 if (cur_segment == mHoverSegment && style.getIsEmbeddedItem()) 2946 if (cur_segment == mHoverSegment && style.getIsEmbeddedItem())
3024 { 2947 {
3025 style.mUnderline = TRUE; 2948 style.mUnderline = TRUE;
3026 } 2949 }
3027 2950
3028 S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); 2951 S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
3029 2952
3030 if ( (mParseHTML) && (left_pos > seg_start) && (left_pos < clipped_end) && mIsSelecting && (mSelectionStart == mSelectionEnd) ) 2953 if ( (mParseHTML) && (left_pos > seg_start) && (left_pos < clipped_end) && mIsSelecting && (mSelectionStart == mSelectionEnd) )
3031 { 2954 {
3032 mHTML = style.getLinkHREF(); 2955 mHTML = style.getLinkHREF();
3033 } 2956 }
3034 2957
3035 drawClippedSegment( text, seg_start, clipped_end, text_x, text_y, selection_left, selection_right, style, &text_x ); 2958 drawClippedSegment( text, seg_start, clipped_end, text_x, text_y, selection_left, selection_right, style, &text_x );
3036 2959
3037 // Note: text_x is incremented by drawClippedSegment() 2960 // Note: text_x is incremented by drawClippedSegment()
3038 seg_start += clipped_len; 2961 seg_start += clipped_len;
3039 }
3040 } 2962 }
2963 }
3041 2964
3042 // move down one line 2965 // move down one line
3043 text_y -= (F32)line_height; 2966 text_y -= (F32)line_height;
3044 2967
3045 line_start = next_start; 2968 line_start = next_start;
3046 cur_line++; 2969 cur_line++;
3047 }
3048 } 2970 }
3049} 2971}
3050 2972
3051// Draws a single text segment, reversing the color for selection if needed. 2973// Draws a single text segment, reversing the color for selection if needed.
3052void LLTextEditor::drawClippedSegment(const LLWString &text, S32 seg_start, S32 seg_end, F32 x, F32 y, S32 selection_left, S32 selection_right, const LLStyle& style, F32* right_x ) 2974void LLTextEditor::drawClippedSegment(const LLWString &text, S32 seg_start, S32 seg_end, F32 x, F32 y, S32 selection_left, S32 selection_right, const LLStyle& style, F32* right_x )
3053{ 2975{
3054 const LLFontGL* font = mGLFont;
3055
3056 LLColor4 color;
3057
3058 if (!style.isVisible()) 2976 if (!style.isVisible())
3059 { 2977 {
3060 return; 2978 return;
3061 } 2979 }
3062 2980
3063 color = style.getColor(); 2981 const LLFontGL* font = mGLFont;
2982
2983 LLColor4 color = style.getColor();
3064 2984
3065 if ( style.getFontString()[0] ) 2985 if ( style.getFontString()[0] )
3066 { 2986 {
@@ -3131,12 +3051,14 @@ void LLTextEditor::drawClippedSegment(const LLWString &text, S32 seg_start, S32
3131 3051
3132void LLTextEditor::draw() 3052void LLTextEditor::draw()
3133{ 3053{
3134 if( getVisible() ) 3054 if( !getVisible() )
3135 { 3055 {
3136 { 3056 return;
3137 LLLocalClipRect clip(LLRect(0, mRect.getHeight(), mRect.getWidth() - (mScrollbar->getVisible() ? SCROLLBAR_SIZE : 0), 0)); 3057 }
3058 {
3059 LLLocalClipRect clip(LLRect(0, getRect().getHeight(), getRect().getWidth() - (mScrollbar->getVisible() ? SCROLLBAR_SIZE : 0), 0));
3138 3060
3139 bindEmbeddedChars( mGLFont ); 3061 bindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
3140 3062
3141 drawBackground(); 3063 drawBackground();
3142 drawSelectionBackground(); 3064 drawSelectionBackground();
@@ -3144,34 +3066,30 @@ void LLTextEditor::draw()
3144 drawText(); 3066 drawText();
3145 drawCursor(); 3067 drawCursor();
3146 3068
3147 unbindEmbeddedChars( mGLFont ); 3069 unbindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
3148 3070
3149 //RN: the decision was made to always show the orange border for keyboard focus but do not put an insertion caret 3071 //RN: the decision was made to always show the orange border for keyboard focus but do not put an insertion caret
3150 // when in readonly mode 3072 // when in readonly mode
3151 mBorder->setKeyboardFocusHighlight( gFocusMgr.getKeyboardFocus() == this);// && !mReadOnly); 3073 mBorder->setKeyboardFocusHighlight( gFocusMgr.getKeyboardFocus() == this);// && !mReadOnly);
3152 }
3153 LLView::draw(); // Draw children (scrollbar and border)
3154 } 3074 }
3155 3075
3156 // remember if we are supposed to be at the bottom of the buffer 3076 // remember if we are supposed to be at the bottom of the buffer
3157 mScrolledToBottom = isScrolledToBottom(); 3077 mScrolledToBottom = isScrolledToBottom();
3158}
3159 3078
3160void LLTextEditor::reportBadKeystroke() 3079 LLView::draw(); // Draw children (scrollbar and border)
3161{
3162 make_ui_sound("UISndBadKeystroke");
3163} 3080}
3164 3081
3165 3082
3166void LLTextEditor::onTabInto() 3083void LLTextEditor::onTabInto()
3167{ 3084{
3168 // selecting all on tabInto causes users to hit tab twice and replace their text with a tab character 3085 // selecting all on tabInto causes users to hit tab twice and replace their text with a tab character
3169 // theoretically, one could selectAll if mTabToNextField is true, but we couldn't think of a use case 3086 // theoretically, one could selectAll if mTabsToNextField is true, but we couldn't think of a use case
3170 // where you'd want to select all anyway 3087 // where you'd want to select all anyway
3171 // preserve insertion point when returning to the editor 3088 // preserve insertion point when returning to the editor
3172 //selectAll(); 3089 //selectAll();
3173} 3090}
3174 3091
3092// virtual
3175void LLTextEditor::clear() 3093void LLTextEditor::clear()
3176{ 3094{
3177 setText(LLString::null); 3095 setText(LLString::null);
@@ -3200,7 +3118,7 @@ void LLTextEditor::setFocus( BOOL new_state )
3200 gEditMenuHandler = this; 3118 gEditMenuHandler = this;
3201 3119
3202 // Don't start the cursor flashing right away 3120 // Don't start the cursor flashing right away
3203 mKeystrokeTimer.reset(); 3121 resetKeystrokeTimer();
3204 } 3122 }
3205 else 3123 else
3206 { 3124 {
@@ -3214,6 +3132,7 @@ void LLTextEditor::setFocus( BOOL new_state )
3214 } 3132 }
3215} 3133}
3216 3134
3135// virtual
3217BOOL LLTextEditor::acceptsTextInput() const 3136BOOL LLTextEditor::acceptsTextInput() const
3218{ 3137{
3219 return !mReadOnly; 3138 return !mReadOnly;
@@ -3268,7 +3187,7 @@ void LLTextEditor::changePage( S32 delta )
3268 3187
3269void LLTextEditor::changeLine( S32 delta ) 3188void LLTextEditor::changeLine( S32 delta )
3270{ 3189{
3271 bindEmbeddedChars( mGLFont ); 3190 bindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
3272 3191
3273 S32 line, offset; 3192 S32 line, offset;
3274 getLineAndOffset( mCursorPos, &line, &offset ); 3193 getLineAndOffset( mCursorPos, &line, &offset );
@@ -3295,7 +3214,7 @@ void LLTextEditor::changeLine( S32 delta )
3295 } 3214 }
3296 else 3215 else
3297 { 3216 {
3298 unbindEmbeddedChars( mGLFont ); 3217 unbindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
3299 return; 3218 return;
3300 } 3219 }
3301 3220
@@ -3320,7 +3239,7 @@ void LLTextEditor::changeLine( S32 delta )
3320 3239
3321 // put desired position into remember-buffer after setCursorPos() 3240 // put desired position into remember-buffer after setCursorPos()
3322 mDesiredXPixel = desired_x_pixel; 3241 mDesiredXPixel = desired_x_pixel;
3323 unbindEmbeddedChars( mGLFont ); 3242 unbindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
3324} 3243}
3325 3244
3326BOOL LLTextEditor::isScrolledToTop() 3245BOOL LLTextEditor::isScrolledToTop()
@@ -3768,20 +3687,14 @@ BOOL LLTextEditor::tryToRevertToPristineState()
3768 return isPristine(); // TRUE => success 3687 return isPristine(); // TRUE => success
3769} 3688}
3770 3689
3771// virtual Return TRUE if changes have been made
3772BOOL LLTextEditor::isDirty() const
3773{
3774 return( mLastCmd != NULL || (mPristineCmd && (mPristineCmd != mLastCmd)) );
3775}
3776
3777 3690
3778void LLTextEditor::updateTextRect() 3691void LLTextEditor::updateTextRect()
3779{ 3692{
3780 mTextRect.setOriginAndSize( 3693 mTextRect.setOriginAndSize(
3781 UI_TEXTEDITOR_BORDER + UI_TEXTEDITOR_H_PAD, 3694 UI_TEXTEDITOR_BORDER + UI_TEXTEDITOR_H_PAD,
3782 UI_TEXTEDITOR_BORDER, 3695 UI_TEXTEDITOR_BORDER,
3783 mRect.getWidth() - SCROLLBAR_SIZE - 2 * (UI_TEXTEDITOR_BORDER + UI_TEXTEDITOR_H_PAD), 3696 getRect().getWidth() - SCROLLBAR_SIZE - 2 * (UI_TEXTEDITOR_BORDER + UI_TEXTEDITOR_H_PAD),
3784 mRect.getHeight() - 2 * UI_TEXTEDITOR_BORDER - UI_TEXTEDITOR_V_PAD_TOP ); 3697 getRect().getHeight() - 2 * UI_TEXTEDITOR_BORDER - UI_TEXTEDITOR_V_PAD_TOP );
3785} 3698}
3786 3699
3787void LLTextEditor::loadKeywords(const LLString& filename, 3700void LLTextEditor::loadKeywords(const LLString& filename,
@@ -3862,8 +3775,7 @@ void LLTextEditor::pruneSegments()
3862 } 3775 }
3863 else 3776 else
3864 { 3777 {
3865 llwarns << "Tried to erase end of empty LLTextEditor" 3778 llwarns << "Tried to erase end of empty LLTextEditor" << llendl;
3866 << llendl;
3867 } 3779 }
3868} 3780}
3869 3781
@@ -3949,21 +3861,9 @@ BOOL LLTextEditor::handleMouseUpOverSegment(S32 x, S32 y, MASK mask)
3949 return FALSE; 3861 return FALSE;
3950} 3862}
3951 3863
3952llwchar LLTextEditor::pasteEmbeddedItem(llwchar ext_char)
3953{
3954 return ext_char;
3955}
3956
3957void LLTextEditor::bindEmbeddedChars(const LLFontGL* font)
3958{
3959}
3960
3961void LLTextEditor::unbindEmbeddedChars(const LLFontGL* font)
3962{
3963}
3964 3864
3965// Finds the text segment (if any) at the give local screen position 3865// Finds the text segment (if any) at the give local screen position
3966LLTextSegment* LLTextEditor::getSegmentAtLocalPos( S32 x, S32 y ) 3866const LLTextSegment* LLTextEditor::getSegmentAtLocalPos( S32 x, S32 y ) const
3967{ 3867{
3968 // Find the cursor position at the requested local screen position 3868 // Find the cursor position at the requested local screen position
3969 S32 offset = getCursorPosFromLocalCoord( x, y, FALSE ); 3869 S32 offset = getCursorPosFromLocalCoord( x, y, FALSE );
@@ -3971,13 +3871,13 @@ LLTextSegment* LLTextEditor::getSegmentAtLocalPos( S32 x, S32 y )
3971 return idx >= 0 ? mSegments[idx] : NULL; 3871 return idx >= 0 ? mSegments[idx] : NULL;
3972} 3872}
3973 3873
3974LLTextSegment* LLTextEditor::getSegmentAtOffset(S32 offset) 3874const LLTextSegment* LLTextEditor::getSegmentAtOffset(S32 offset) const
3975{ 3875{
3976 S32 idx = getSegmentIdxAtOffset(offset); 3876 S32 idx = getSegmentIdxAtOffset(offset);
3977 return idx >= 0 ? mSegments[idx] : NULL; 3877 return idx >= 0 ? mSegments[idx] : NULL;
3978} 3878}
3979 3879
3980S32 LLTextEditor::getSegmentIdxAtOffset(S32 offset) 3880S32 LLTextEditor::getSegmentIdxAtOffset(S32 offset) const
3981{ 3881{
3982 if (mSegments.empty() || offset < 0 || offset >= getLength()) 3882 if (mSegments.empty() || offset < 0 || offset >= getLength())
3983 { 3883 {
@@ -4149,7 +4049,7 @@ LLTextSegment::LLTextSegment( const LLColor3& color, S32 start, S32 end ) :
4149{ 4049{
4150} 4050}
4151 4051
4152BOOL LLTextSegment::getToolTip(LLString& msg) 4052BOOL LLTextSegment::getToolTip(LLString& msg) const
4153{ 4053{
4154 if (mToken && !mToken->getToolTip().empty()) 4054 if (mToken && !mToken->getToolTip().empty())
4155 { 4055 {
@@ -4162,7 +4062,7 @@ BOOL LLTextSegment::getToolTip(LLString& msg)
4162 4062
4163 4063
4164 4064
4165void LLTextSegment::dump() 4065void LLTextSegment::dump() const
4166{ 4066{
4167 llinfos << "Segment [" << 4067 llinfos << "Segment [" <<
4168// mColor.mV[VX] << ", " << 4068// mColor.mV[VX] << ", " <<
@@ -4182,13 +4082,9 @@ LLXMLNodePtr LLTextEditor::getXML(bool save_children) const
4182 // Attributes 4082 // Attributes
4183 4083
4184 node->createChild("max_length", TRUE)->setIntValue(getMaxLength()); 4084 node->createChild("max_length", TRUE)->setIntValue(getMaxLength());
4185
4186 node->createChild("embedded_items", TRUE)->setBoolValue(mAllowEmbeddedItems); 4085 node->createChild("embedded_items", TRUE)->setBoolValue(mAllowEmbeddedItems);
4187
4188 node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mGLFont)); 4086 node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mGLFont));
4189
4190 node->createChild("word_wrap", TRUE)->setBoolValue(mWordWrap); 4087 node->createChild("word_wrap", TRUE)->setBoolValue(mWordWrap);
4191
4192 node->createChild("hide_scrollbar", TRUE)->setBoolValue(mHideScrollbarForShortDocs); 4088 node->createChild("hide_scrollbar", TRUE)->setBoolValue(mHideScrollbarForShortDocs);
4193 4089
4194 addColorXML(node, mCursorColor, "cursor_color", "TextCursorColor"); 4090 addColorXML(node, mCursorColor, "cursor_color", "TextCursorColor");
@@ -4274,7 +4170,7 @@ void LLTextEditor::setTextEditorParameters(LLXMLNodePtr node)
4274} 4170}
4275 4171
4276/////////////////////////////////////////////////////////////////// 4172///////////////////////////////////////////////////////////////////
4277S32 LLTextEditor::findHTMLToken(const LLString &line, S32 pos, BOOL reverse) 4173S32 LLTextEditor::findHTMLToken(const LLString &line, S32 pos, BOOL reverse) const
4278{ 4174{
4279 LLString openers=" \t('\"[{<>"; 4175 LLString openers=" \t('\"[{<>";
4280 LLString closers=" \t)'\"]}><;"; 4176 LLString closers=" \t)'\"]}><;";
@@ -4311,7 +4207,7 @@ S32 LLTextEditor::findHTMLToken(const LLString &line, S32 pos, BOOL reverse)
4311 return retval; 4207 return retval;
4312} 4208}
4313 4209
4314BOOL LLTextEditor::findHTML(const LLString &line, S32 *begin, S32 *end) 4210BOOL LLTextEditor::findHTML(const LLString &line, S32 *begin, S32 *end) const
4315{ 4211{
4316 4212
4317 S32 m1,m2,m3; 4213 S32 m1,m2,m3;
diff --git a/linden/indra/llui/lltexteditor.h b/linden/indra/llui/lltexteditor.h
index 4c92297..82d9069 100644
--- a/linden/indra/llui/lltexteditor.h
+++ b/linden/indra/llui/lltexteditor.h
@@ -52,24 +52,16 @@ class LLKeywordToken;
52class LLTextCmd; 52class LLTextCmd;
53class LLUICtrlFactory; 53class LLUICtrlFactory;
54 54
55//
56// Constants
57//
58
59const llwchar FIRST_EMBEDDED_CHAR = 0x100000;
60const llwchar LAST_EMBEDDED_CHAR = 0x10ffff;
61const S32 MAX_EMBEDDED_ITEMS = LAST_EMBEDDED_CHAR - FIRST_EMBEDDED_CHAR + 1;
62
63//
64// Classes
65//
66class LLTextSegment;
67class LLTextCmd;
68
69class LLTextEditor : public LLUICtrl, LLEditMenuHandler, protected LLPreeditor 55class LLTextEditor : public LLUICtrl, LLEditMenuHandler, protected LLPreeditor
70{ 56{
71 friend class LLTextCmd;
72public: 57public:
58 //
59 // Constants
60 //
61 static const llwchar FIRST_EMBEDDED_CHAR = 0x100000;
62 static const llwchar LAST_EMBEDDED_CHAR = 0x10ffff;
63 static const S32 MAX_EMBEDDED_ITEMS = LAST_EMBEDDED_CHAR - FIRST_EMBEDDED_CHAR + 1;
64
73 LLTextEditor(const LLString& name, 65 LLTextEditor(const LLString& name,
74 const LLRect& rect, 66 const LLRect& rect,
75 S32 max_length, 67 S32 max_length,
@@ -80,10 +72,10 @@ public:
80 virtual ~LLTextEditor(); 72 virtual ~LLTextEditor();
81 73
82 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_TEXT_EDITOR; } 74 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_TEXT_EDITOR; }
83 virtual LLString getWidgetTag() const; 75 virtual LLString getWidgetTag() const { return LL_TEXT_EDITOR_TAG; }
84 76
85 virtual LLXMLNodePtr getXML(bool save_children = true) const; 77 virtual LLXMLNodePtr getXML(bool save_children = true) const;
86 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 78 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory);
87 void setTextEditorParameters(LLXMLNodePtr node); 79 void setTextEditorParameters(LLXMLNodePtr node);
88 void setParseHTML(BOOL parsing) {mParseHTML=parsing;} 80 void setParseHTML(BOOL parsing) {mParseHTML=parsing;}
89 81
@@ -102,7 +94,6 @@ public:
102 EAcceptance *accept, LLString& tooltip_msg); 94 EAcceptance *accept, LLString& tooltip_msg);
103 virtual void onMouseCaptureLost(); 95 virtual void onMouseCaptureLost();
104 96
105
106 // view overrides 97 // view overrides
107 virtual void reshape(S32 width, S32 height, BOOL called_from_parent); 98 virtual void reshape(S32 width, S32 height, BOOL called_from_parent);
108 virtual void draw(); 99 virtual void draw();
@@ -115,32 +106,25 @@ public:
115 virtual void clear(); 106 virtual void clear();
116 virtual void setFocus( BOOL b ); 107 virtual void setFocus( BOOL b );
117 virtual BOOL acceptsTextInput() const; 108 virtual BOOL acceptsTextInput() const;
118 virtual BOOL isDirty() const; 109 virtual BOOL isDirty() const { return( mLastCmd != NULL || (mPristineCmd && (mPristineCmd != mLastCmd)) ); }
119 110
120 // LLEditMenuHandler interface 111 // LLEditMenuHandler interface
121 virtual void undo(); 112 virtual void undo();
122 virtual BOOL canUndo(); 113 virtual BOOL canUndo() const;
123
124 virtual void redo(); 114 virtual void redo();
125 virtual BOOL canRedo(); 115 virtual BOOL canRedo() const;
126
127 virtual void cut(); 116 virtual void cut();
128 virtual BOOL canCut(); 117 virtual BOOL canCut() const;
129
130 virtual void copy(); 118 virtual void copy();
131 virtual BOOL canCopy(); 119 virtual BOOL canCopy() const;
132
133 virtual void paste(); 120 virtual void paste();
134 virtual BOOL canPaste(); 121 virtual BOOL canPaste() const;
135
136 virtual void doDelete(); 122 virtual void doDelete();
137 virtual BOOL canDoDelete(); 123 virtual BOOL canDoDelete() const;
138
139 virtual void selectAll(); 124 virtual void selectAll();
140 virtual BOOL canSelectAll(); 125 virtual BOOL canSelectAll() const;
141
142 virtual void deselect(); 126 virtual void deselect();
143 virtual BOOL canDeselect(); 127 virtual BOOL canDeselect() const;
144 128
145 void selectNext(const LLString& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE); 129 void selectNext(const LLString& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE);
146 BOOL replaceText(const LLString& search_text, const LLString& replace_text, BOOL case_insensitive, BOOL wrap = TRUE); 130 BOOL replaceText(const LLString& search_text, const LLString& replace_text, BOOL case_insensitive, BOOL wrap = TRUE);
@@ -152,6 +136,7 @@ public:
152 // Text editing 136 // Text editing
153 virtual void makePristine(); 137 virtual void makePristine();
154 BOOL isPristine() const; 138 BOOL isPristine() const;
139 BOOL allowsEmbeddedItems() const { return mAllowEmbeddedItems; }
155 140
156 // inserts text at cursor 141 // inserts text at cursor
157 void insertText(const LLString &text); 142 void insertText(const LLString &text);
@@ -180,18 +165,21 @@ public:
180 165
181 void getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wordwrap ); 166 void getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wordwrap );
182 167
168 // Keywords support
183 void loadKeywords(const LLString& filename, 169 void loadKeywords(const LLString& filename,
184 const LLDynamicArray<const char*>& funcs, 170 const LLDynamicArray<const char*>& funcs,
185 const LLDynamicArray<const char*>& tooltips, 171 const LLDynamicArray<const char*>& tooltips,
186 const LLColor3& func_color); 172 const LLColor3& func_color);
173 LLKeywords::keyword_iterator_t keywordsBegin() { return mKeywords.begin(); }
174 LLKeywords::keyword_iterator_t keywordsEnd() { return mKeywords.end(); }
187 175
176 // Color support
188 void setCursorColor(const LLColor4& c) { mCursorColor = c; } 177 void setCursorColor(const LLColor4& c) { mCursorColor = c; }
189 void setFgColor( const LLColor4& c ) { mFgColor = c; } 178 void setFgColor( const LLColor4& c ) { mFgColor = c; }
190 void setTextDefaultColor( const LLColor4& c ) { mDefaultColor = c; } 179 void setTextDefaultColor( const LLColor4& c ) { mDefaultColor = c; }
191 void setReadOnlyFgColor( const LLColor4& c ) { mReadOnlyFgColor = c; } 180 void setReadOnlyFgColor( const LLColor4& c ) { mReadOnlyFgColor = c; }
192 void setWriteableBgColor( const LLColor4& c ) { mWriteableBgColor = c; } 181 void setWriteableBgColor( const LLColor4& c ) { mWriteableBgColor = c; }
193 void setReadOnlyBgColor( const LLColor4& c ) { mReadOnlyBgColor = c; } 182 void setReadOnlyBgColor( const LLColor4& c ) { mReadOnlyBgColor = c; }
194
195 void setTrackColor( const LLColor4& color ); 183 void setTrackColor( const LLColor4& color );
196 void setThumbColor( const LLColor4& color ); 184 void setThumbColor( const LLColor4& color );
197 void setHighlightColor( const LLColor4& color ); 185 void setHighlightColor( const LLColor4& color );
@@ -200,11 +188,13 @@ public:
200 // Hacky methods to make it into a word-wrapping, potentially scrolling, 188 // Hacky methods to make it into a word-wrapping, potentially scrolling,
201 // read-only text box. 189 // read-only text box.
202 void setBorderVisible(BOOL b); 190 void setBorderVisible(BOOL b);
203 void setTakesNonScrollClicks(BOOL b); 191 BOOL isBorderVisible() const;
192 void setTakesNonScrollClicks(BOOL b) { mTakesNonScrollClicks = b; }
204 void setHideScrollbarForShortDocs(BOOL b); 193 void setHideScrollbarForShortDocs(BOOL b);
205 194
206 void setWordWrap( BOOL b ); 195 void setWordWrap( BOOL b );
207 void setTabToNextField(BOOL b) { mTabToNextField = b; } 196 void setTabsToNextField(BOOL b) { mTabsToNextField = b; }
197 BOOL tabsToNextField() const { return mTabsToNextField; }
208 void setCommitOnFocusLost(BOOL b) { mCommitOnFocusLost = b; } 198 void setCommitOnFocusLost(BOOL b) { mCommitOnFocusLost = b; }
209 199
210 // Hack to handle Notecards 200 // Hack to handle Notecards
@@ -215,7 +205,9 @@ public:
215 void setTakesFocus(BOOL b) { mTakesFocus = b; } 205 void setTakesFocus(BOOL b) { mTakesFocus = b; }
216 206
217 void setSourceID(const LLUUID& id) { mSourceID = id; } 207 void setSourceID(const LLUUID& id) { mSourceID = id; }
208 const LLUUID& getSourceID() const { return mSourceID; }
218 void setAcceptCallingCardNames(BOOL enable) { mAcceptCallingCardNames = enable; } 209 void setAcceptCallingCardNames(BOOL enable) { mAcceptCallingCardNames = enable; }
210 BOOL acceptsCallingCardNames() const { return mAcceptCallingCardNames; }
219 211
220 void setHandleEditKeysDirectly( BOOL b ) { mHandleEditKeysDirectly = b; } 212 void setHandleEditKeysDirectly( BOOL b ) { mHandleEditKeysDirectly = b; }
221 213
@@ -250,49 +242,46 @@ public:
250 BOOL isScrolledToBottom(); 242 BOOL isScrolledToBottom();
251 243
252 // Getters 244 // Getters
253 const LLWString& getWText() const; 245 const LLWString& getWText() const { return mWText; }
254 llwchar getWChar(S32 pos); 246 llwchar getWChar(S32 pos) const { return mWText[pos]; }
255 LLWString getWSubString(S32 pos, S32 len); 247 LLWString getWSubString(S32 pos, S32 len) const { return mWText.substr(pos, len); }
256 248
257 LLTextSegment* getCurrentSegment(); 249 const LLTextSegment* getCurrentSegment() { return getSegmentAtOffset(mCursorPos); }
258 LLTextSegment* getPreviousSegment(); 250 const LLTextSegment* getPreviousSegment();
259 void getSelectedSegments(std::vector<LLTextSegment*>& segments); 251 void getSelectedSegments(std::vector<const LLTextSegment*>& segments);
260 252
261protected: 253protected:
262 S32 getLength() const; 254 //
263 void getSegmentAndOffset( S32 startpos, S32* segidxp, S32* offsetp ); 255 // Methods
256 //
264 257
265 void drawBackground(); 258 S32 getLength() const { return mWText.length(); }
266 void drawSelectionBackground(); 259 void getSegmentAndOffset( S32 startpos, S32* segidxp, S32* offsetp ) const;
267 void drawCursor();
268 void drawText();
269 void drawClippedSegment(const LLWString &wtext, S32 seg_start, S32 seg_end, F32 x, F32 y, S32 selection_left, S32 selection_right, const LLStyle& color, F32* right_x);
270 void drawPreeditMarker(); 260 void drawPreeditMarker();
271 261
272 void updateLineStartList(S32 startpos = 0); 262 void updateLineStartList(S32 startpos = 0);
273 void updateScrollFromCursor(); 263 void updateScrollFromCursor();
274 void updateTextRect(); 264 void updateTextRect();
275 void updateSegments(); 265 const LLRect& getTextRect() const { return mTextRect; }
276 void pruneSegments();
277 266
278 void assignEmbedded(const LLString &s); 267 void assignEmbedded(const LLString &s);
279 BOOL truncate(); // Returns true if truncation occurs 268 BOOL truncate(); // Returns true if truncation occurs
280 269
281 static BOOL isPartOfWord(llwchar c); 270 static BOOL isPartOfWord(llwchar c) { return (c == '_') || isalnum(c); }
282 271
283 void removeCharOrTab(); 272 void removeCharOrTab();
284 void setCursorAtLocalPos(S32 x, S32 y, BOOL round); 273 void setCursorAtLocalPos(S32 x, S32 y, BOOL round);
285 S32 getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL round ); 274 S32 getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL round ) const;
286 275
287 void indentSelectedLines( S32 spaces ); 276 void indentSelectedLines( S32 spaces );
288 S32 indentLine( S32 pos, S32 spaces ); 277 S32 indentLine( S32 pos, S32 spaces );
289 void unindentLineBeforeCloseBrace(); 278 void unindentLineBeforeCloseBrace();
290 279
291 S32 getSegmentIdxAtOffset(S32 offset); 280 S32 getSegmentIdxAtOffset(S32 offset) const;
292 LLTextSegment* getSegmentAtLocalPos(S32 x, S32 y); 281 const LLTextSegment* getSegmentAtLocalPos(S32 x, S32 y) const;
293 LLTextSegment* getSegmentAtOffset(S32 offset); 282 const LLTextSegment* getSegmentAtOffset(S32 offset) const;
294 283
295 void reportBadKeystroke(); 284 void reportBadKeystroke() { make_ui_sound("UISndBadKeystroke"); }
296 285
297 BOOL handleNavigationKey(const KEY key, const MASK mask); 286 BOOL handleNavigationKey(const KEY key, const MASK mask);
298 BOOL handleSpecialKey(const KEY key, const MASK mask, BOOL* return_key_hit); 287 BOOL handleSpecialKey(const KEY key, const MASK mask, BOOL* return_key_hit);
@@ -309,29 +298,58 @@ protected:
309 S32 prevWordPos(S32 cursorPos) const; 298 S32 prevWordPos(S32 cursorPos) const;
310 S32 nextWordPos(S32 cursorPos) const; 299 S32 nextWordPos(S32 cursorPos) const;
311 300
312 S32 getLineCount() const; 301 S32 getLineCount() const { return mLineStartList.size(); }
313 S32 getLineStart( S32 line ) const; 302 S32 getLineStart( S32 line ) const;
314 void getLineAndOffset(S32 pos, S32* linep, S32* offsetp); 303 void getLineAndOffset(S32 pos, S32* linep, S32* offsetp) const;
315 S32 getPos(S32 line, S32 offset); 304 S32 getPos(S32 line, S32 offset);
316 305
317 void changePage(S32 delta); 306 void changePage(S32 delta);
318 void changeLine(S32 delta); 307 void changeLine(S32 delta);
319 308
320 void autoIndent(); 309 void autoIndent();
321
322 S32 execute(LLTextCmd* cmd);
323 310
324 void findEmbeddedItemSegments(); 311 void findEmbeddedItemSegments();
325 312
326 virtual BOOL handleMouseUpOverSegment(S32 x, S32 y, MASK mask); 313 virtual BOOL handleMouseUpOverSegment(S32 x, S32 y, MASK mask);
327 virtual llwchar pasteEmbeddedItem(llwchar ext_char); 314
328 virtual void bindEmbeddedChars(const LLFontGL* font); 315 virtual llwchar pasteEmbeddedItem(llwchar ext_char) { return ext_char; }
329 virtual void unbindEmbeddedChars(const LLFontGL* font); 316 virtual void bindEmbeddedChars(LLFontGL* font) const {}
317 virtual void unbindEmbeddedChars(LLFontGL* font) const {}
330 318
331 S32 findHTMLToken(const LLString &line, S32 pos, BOOL reverse); 319 S32 findHTMLToken(const LLString &line, S32 pos, BOOL reverse) const;
332 BOOL findHTML(const LLString &line, S32 *begin, S32 *end); 320 BOOL findHTML(const LLString &line, S32 *begin, S32 *end) const;
321
322 // Abstract inner base class representing an undoable editor command.
323 // Concrete sub-classes can be defined for operations such as insert, remove, etc.
324 // Used as arguments to the execute() method below.
325 class LLTextCmd
326 {
327 public:
328 LLTextCmd( S32 pos, BOOL group_with_next ) : mPos(pos), mGroupWithNext(group_with_next) {}
329 virtual ~LLTextCmd() {}
330 virtual BOOL execute(LLTextEditor* editor, S32* delta) = 0;
331 virtual S32 undo(LLTextEditor* editor) = 0;
332 virtual S32 redo(LLTextEditor* editor) = 0;
333 virtual BOOL canExtend(S32 pos) const { return FALSE; }
334 virtual void blockExtensions() {}
335 virtual BOOL extendAndExecute( LLTextEditor* editor, S32 pos, llwchar c, S32* delta ) { llassert(0); return 0; }
336 virtual BOOL hasExtCharValue( llwchar value ) const { return FALSE; }
337
338 // Defined here so they can access protected LLTextEditor editing methods
339 S32 insert(LLTextEditor* editor, S32 pos, const LLWString &wstr) { return editor->insertStringNoUndo( pos, wstr ); }
340 S32 remove(LLTextEditor* editor, S32 pos, S32 length) { return editor->removeStringNoUndo( pos, length ); }
341 S32 overwrite(LLTextEditor* editor, S32 pos, llwchar wc) { return editor->overwriteCharNoUndo(pos, wc); }
342
343 S32 getPosition() const { return mPos; }
344 BOOL groupWithNext() const { return mGroupWithNext; }
345
346 private:
347 const S32 mPos;
348 BOOL mGroupWithNext;
349 };
350 // Here's the method that takes and applies text commands.
351 S32 execute(LLTextCmd* cmd);
333 352
334protected:
335 // Undoable operations 353 // Undoable operations
336 void addChar(llwchar c); // at mCursorPos 354 void addChar(llwchar c); // at mCursorPos
337 S32 addChar(S32 pos, llwchar wc); 355 S32 addChar(S32 pos, llwchar wc);
@@ -342,12 +360,13 @@ protected:
342 S32 remove(const S32 pos, const S32 length, const BOOL group_with_next_op); 360 S32 remove(const S32 pos, const S32 length, const BOOL group_with_next_op);
343 S32 append(const LLWString &wstr, const BOOL group_with_next_op); 361 S32 append(const LLWString &wstr, const BOOL group_with_next_op);
344 362
345 // direct operations 363 // Direct operations
346 S32 insertStringNoUndo(S32 pos, const LLWString &wstr); // returns num of chars actually inserted 364 S32 insertStringNoUndo(S32 pos, const LLWString &wstr); // returns num of chars actually inserted
347 S32 removeStringNoUndo(S32 pos, S32 length); 365 S32 removeStringNoUndo(S32 pos, S32 length);
348 S32 overwriteCharNoUndo(S32 pos, llwchar wc); 366 S32 overwriteCharNoUndo(S32 pos, llwchar wc);
349 367
350protected: 368 void resetKeystrokeTimer() { mKeystrokeTimer.reset(); }
369
351 void updateAllowingLanguageInput(); 370 void updateAllowingLanguageInput();
352 BOOL hasPreeditString() const; 371 BOOL hasPreeditString() const;
353 372
@@ -360,14 +379,76 @@ protected:
360 virtual void getSelectionRange(S32 *position, S32 *length) const; 379 virtual void getSelectionRange(S32 *position, S32 *length) const;
361 virtual BOOL getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const; 380 virtual BOOL getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const;
362 virtual S32 getPreeditFontSize() const; 381 virtual S32 getPreeditFontSize() const;
382 //
383 // Protected data
384 //
385 // Probably deserves serious thought to hiding as many of these
386 // as possible behind protected accessor methods.
387 //
363 388
364public: 389 // I-beam is just after the mCursorPos-th character.
390 S32 mCursorPos;
391
392 // Use these to determine if a click on an embedded item is a drag or not.
393 S32 mMouseDownX;
394 S32 mMouseDownY;
395
396 // Are we in the middle of a drag-select? To figure out if there is a current
397 // selection, call hasSelection().
398 BOOL mIsSelecting;
399 S32 mSelectionStart;
400 S32 mSelectionEnd;
401 S32 mLastSelectionX;
402 S32 mLastSelectionY;
403
404 BOOL mParseHTML;
405 LLString mHTML;
406
407 typedef std::vector<LLTextSegment *> segment_list_t;
408 segment_list_t mSegments;
409 const LLTextSegment* mHoverSegment;
410
411 // Scrollbar data
412 class LLScrollbar* mScrollbar;
413 BOOL mHideScrollbarForShortDocs;
414 BOOL mTakesNonScrollClicks;
415 void (*mOnScrollEndCallback)(void*);
416 void *mOnScrollEndData;
417
418 LLWString mPreeditWString;
419 LLWString mPreeditOverwrittenWString;
420 std::vector<S32> mPreeditPositions;
421 std::vector<BOOL> mPreeditStandouts;
422
423private:
424
425 //
426 // Methods
427 //
428 void updateSegments();
429 void pruneSegments();
430
431 void drawBackground();
432 void drawSelectionBackground();
433 void drawCursor();
434 void drawText();
435 void drawClippedSegment(const LLWString &wtext, S32 seg_start, S32 seg_end, F32 x, F32 y, S32 selection_left, S32 selection_right, const LLStyle& color, F32* right_x);
436
437 //
438 // Data
439 //
365 LLKeywords mKeywords; 440 LLKeywords mKeywords;
366 static LLColor4 mLinkColor; 441 static LLColor4 mLinkColor;
367 static void (*mURLcallback) (const char* url); 442 static void (*mURLcallback) (const char* url);
368 static bool (*mSecondlifeURLcallback) (const std::string& url); 443 static bool (*mSecondlifeURLcallback) (const std::string& url);
369 static bool (*mSecondlifeURLcallbackRightClick) (const std::string& url); 444 static bool (*mSecondlifeURLcallbackRightClick) (const std::string& url);
370protected: 445
446 // Concrete LLTextCmd sub-classes used by the LLTextEditor base class
447 class LLTextCmdInsert;
448 class LLTextCmdAddChar;
449 class LLTextCmdOverwriteChar;
450 class LLTextCmdRemove;
451
371 LLWString mWText; 452 LLWString mWText;
372 mutable LLString mUTF8Text; 453 mutable LLString mUTF8Text;
373 mutable BOOL mTextIsUpToDate; 454 mutable BOOL mTextIsUpToDate;
@@ -376,8 +457,7 @@ protected:
376 457
377 const LLFontGL* mGLFont; 458 const LLFontGL* mGLFont;
378 459
379 LLScrollbar* mScrollbar; 460 class LLViewBorder* mBorder;
380 LLViewBorder* mBorder;
381 461
382 BOOL mBaseDocIsPristine; 462 BOOL mBaseDocIsPristine;
383 LLTextCmd* mPristineCmd; 463 LLTextCmd* mPristineCmd;
@@ -387,7 +467,6 @@ protected:
387 typedef std::deque<LLTextCmd*> undo_stack_t; 467 typedef std::deque<LLTextCmd*> undo_stack_t;
388 undo_stack_t mUndoStack; 468 undo_stack_t mUndoStack;
389 469
390 S32 mCursorPos; // I-beam is just after the mCursorPos-th character.
391 S32 mDesiredXPixel; // X pixel position where the user wants the cursor to be 470 S32 mDesiredXPixel; // X pixel position where the user wants the cursor to be
392 LLRect mTextRect; // The rect in which text is drawn. Excludes borders. 471 LLRect mTextRect; // The rect in which text is drawn. Excludes borders.
393 // List of offsets and segment index of the start of each line. Always has at least one node (0). 472 // List of offsets and segment index of the start of each line. Always has at least one node (0).
@@ -411,20 +490,7 @@ protected:
411 }; 490 };
412 typedef std::vector<line_info> line_list_t; 491 typedef std::vector<line_info> line_list_t;
413 line_list_t mLineStartList; 492 line_list_t mLineStartList;
414
415 // Are we in the middle of a drag-select? To figure out if there is a current
416 // selection, call hasSelection().
417 BOOL mIsSelecting;
418
419 S32 mSelectionStart;
420 S32 mSelectionEnd;
421
422 void (*mOnScrollEndCallback)(void*);
423 void *mOnScrollEndData;
424 493
425 typedef std::vector<LLTextSegment *> segment_list_t;
426 segment_list_t mSegments;
427 LLTextSegment* mHoverSegment;
428 LLFrameTimer mKeystrokeTimer; 494 LLFrameTimer mKeystrokeTimer;
429 495
430 LLColor4 mCursorColor; 496 LLColor4 mCursorColor;
@@ -439,11 +505,9 @@ protected:
439 BOOL mReadOnly; 505 BOOL mReadOnly;
440 BOOL mWordWrap; 506 BOOL mWordWrap;
441 507
442 BOOL mTabToNextField; // if true, tab moves focus to next field, else inserts spaces 508 BOOL mTabsToNextField; // if true, tab moves focus to next field, else inserts spaces
443 BOOL mCommitOnFocusLost; 509 BOOL mCommitOnFocusLost;
444 BOOL mTakesFocus; 510 BOOL mTakesFocus;
445 BOOL mHideScrollbarForShortDocs;
446 BOOL mTakesNonScrollClicks;
447 BOOL mTrackBottom; // if true, keeps scroll position at bottom during resize 511 BOOL mTrackBottom; // if true, keeps scroll position at bottom during resize
448 BOOL mScrolledToBottom; 512 BOOL mScrolledToBottom;
449 513
@@ -453,24 +517,14 @@ protected:
453 517
454 LLUUID mSourceID; 518 LLUUID mSourceID;
455 519
456 BOOL mHandleEditKeysDirectly; // If true, the standard edit keys (Ctrl-X, Delete, etc,) are handled here instead of routed by the menu system 520 // If true, the standard edit keys (Ctrl-X, Delete, etc,) are handled here
521 //instead of routed by the menu system
522 BOOL mHandleEditKeysDirectly;
457 523
458 // Use these to determine if a click on an embedded item is a drag 524 LLCoordGL mLastIMEPosition; // Last position of the IME editor
459 // or not. 525}; // end class LLTextEditor
460 S32 mMouseDownX;
461 S32 mMouseDownY;
462 526
463 S32 mLastSelectionX;
464 S32 mLastSelectionY;
465 527
466 BOOL mParseHTML;
467 LLString mHTML;
468
469 LLWString mPreeditWString;
470 LLWString mPreeditOverwrittenWString;
471 std::vector<S32> mPreeditPositions;
472 std::vector<BOOL> mPreeditStandouts;
473};
474 528
475class LLTextSegment 529class LLTextSegment
476{ 530{
@@ -482,21 +536,20 @@ public:
482 LLTextSegment( const LLColor4& color, S32 start, S32 end ); 536 LLTextSegment( const LLColor4& color, S32 start, S32 end );
483 LLTextSegment( const LLColor3& color, S32 start, S32 end ); 537 LLTextSegment( const LLColor3& color, S32 start, S32 end );
484 538
485 S32 getStart() { return mStart; } 539 S32 getStart() const { return mStart; }
486 S32 getEnd() { return mEnd; } 540 S32 getEnd() const { return mEnd; }
487 void setEnd( S32 end ) { mEnd = end; } 541 void setEnd( S32 end ) { mEnd = end; }
488 const LLColor4& getColor() { return mStyle.getColor(); } 542 const LLColor4& getColor() const { return mStyle.getColor(); }
489 void setColor(const LLColor4 &color) { mStyle.setColor(color); } 543 void setColor(const LLColor4 &color) { mStyle.setColor(color); }
490 const LLStyle& getStyle() { return mStyle; } 544 const LLStyle& getStyle() const { return mStyle; }
491 void setStyle(const LLStyle &style) { mStyle = style; } 545 void setStyle(const LLStyle &style) { mStyle = style; }
492 void setIsDefault(BOOL b) { mIsDefault = b; } 546 void setIsDefault(BOOL b) { mIsDefault = b; }
493 BOOL getIsDefault() { return mIsDefault; } 547 BOOL getIsDefault() const { return mIsDefault; }
494
495 void setToken( LLKeywordToken* token ) { mToken = token; } 548 void setToken( LLKeywordToken* token ) { mToken = token; }
496 LLKeywordToken* getToken() { return mToken; } 549 LLKeywordToken* getToken() const { return mToken; }
497 BOOL getToolTip( LLString& msg ); 550 BOOL getToolTip( LLString& msg ) const;
498 551
499 void dump(); 552 void dump() const;
500 553
501 struct compare 554 struct compare
502 { 555 {
@@ -514,34 +567,5 @@ private:
514 BOOL mIsDefault; 567 BOOL mIsDefault;
515}; 568};
516 569
517class LLTextCmd
518{
519public:
520 LLTextCmd( S32 pos, BOOL group_with_next )
521 : mPos(pos),
522 mGroupWithNext(group_with_next)
523 {
524 }
525 virtual ~LLTextCmd() {}
526 virtual BOOL execute(LLTextEditor* editor, S32* delta) = 0;
527 virtual S32 undo(LLTextEditor* editor) = 0;
528 virtual S32 redo(LLTextEditor* editor) = 0;
529 virtual BOOL canExtend(S32 pos);
530 virtual void blockExtensions();
531 virtual BOOL extendAndExecute( LLTextEditor* editor, S32 pos, llwchar c, S32* delta );
532 virtual BOOL hasExtCharValue( llwchar value );
533
534 // Define these here so they can access LLTextEditor through the friend relationship
535 S32 insert(LLTextEditor* editor, S32 pos, const LLWString &wstr);
536 S32 remove(LLTextEditor* editor, S32 pos, S32 length);
537 S32 overwrite(LLTextEditor* editor, S32 pos, llwchar wc);
538
539 BOOL groupWithNext() { return mGroupWithNext; }
540
541protected:
542 S32 mPos;
543 BOOL mGroupWithNext;
544};
545
546 570
547#endif // LL_TEXTEDITOR_ 571#endif // LL_TEXTEDITOR_
diff --git a/linden/indra/llui/llui.cpp b/linden/indra/llui/llui.cpp
index f6ce985..5904573 100644
--- a/linden/indra/llui/llui.cpp
+++ b/linden/indra/llui/llui.cpp
@@ -42,6 +42,7 @@
42#include "v2math.h" 42#include "v2math.h"
43#include "v4color.h" 43#include "v4color.h"
44#include "llgl.h" 44#include "llgl.h"
45#include "llglimmediate.h"
45#include "llrect.h" 46#include "llrect.h"
46#include "llimagegl.h" 47#include "llimagegl.h"
47//#include "llviewerimage.h" 48//#include "llviewerimage.h"
@@ -148,26 +149,26 @@ void gl_draw_x(const LLRect& rect, const LLColor4& color)
148{ 149{
149 LLGLSNoTexture no_texture; 150 LLGLSNoTexture no_texture;
150 151
151 glColor4fv( color.mV ); 152 gGL.color4fv( color.mV );
152 153
153 glBegin( GL_LINES ); 154 gGL.begin( GL_LINES );
154 glVertex2i( rect.mLeft, rect.mTop ); 155 gGL.vertex2i( rect.mLeft, rect.mTop );
155 glVertex2i( rect.mRight, rect.mBottom ); 156 gGL.vertex2i( rect.mRight, rect.mBottom );
156 glVertex2i( rect.mLeft, rect.mBottom ); 157 gGL.vertex2i( rect.mLeft, rect.mBottom );
157 glVertex2i( rect.mRight, rect.mTop ); 158 gGL.vertex2i( rect.mRight, rect.mTop );
158 glEnd(); 159 gGL.end();
159} 160}
160 161
161 162
162void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset, BOOL filled) 163void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset, BOOL filled)
163{ 164{
164 glColor4fv(color.mV); 165 gGL.color4fv(color.mV);
165 gl_rect_2d_offset_local(left, top, right, bottom, pixel_offset, filled); 166 gl_rect_2d_offset_local(left, top, right, bottom, pixel_offset, filled);
166} 167}
167 168
168void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset, BOOL filled) 169void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset, BOOL filled)
169{ 170{
170 glPushMatrix(); 171 gGL.pushMatrix();
171 left += LLFontGL::sCurOrigin.mX; 172 left += LLFontGL::sCurOrigin.mX;
172 right += LLFontGL::sCurOrigin.mX; 173 right += LLFontGL::sCurOrigin.mX;
173 bottom += LLFontGL::sCurOrigin.mY; 174 bottom += LLFontGL::sCurOrigin.mY;
@@ -179,7 +180,7 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixe
179 llfloor((F32)right * LLUI::sGLScaleFactor.mV[VX]) + pixel_offset, 180 llfloor((F32)right * LLUI::sGLScaleFactor.mV[VX]) + pixel_offset,
180 llfloor((F32)bottom * LLUI::sGLScaleFactor.mV[VY]) - pixel_offset, 181 llfloor((F32)bottom * LLUI::sGLScaleFactor.mV[VY]) - pixel_offset,
181 filled); 182 filled);
182 glPopMatrix(); 183 gGL.popMatrix();
183} 184}
184 185
185 186
@@ -191,48 +192,48 @@ void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled )
191 // Counterclockwise quad will face the viewer 192 // Counterclockwise quad will face the viewer
192 if( filled ) 193 if( filled )
193 { 194 {
194 glBegin( GL_QUADS ); 195 gGL.begin( GL_QUADS );
195 glVertex2i(left, top); 196 gGL.vertex2i(left, top);
196 glVertex2i(left, bottom); 197 gGL.vertex2i(left, bottom);
197 glVertex2i(right, bottom); 198 gGL.vertex2i(right, bottom);
198 glVertex2i(right, top); 199 gGL.vertex2i(right, top);
199 glEnd(); 200 gGL.end();
200 } 201 }
201 else 202 else
202 { 203 {
203 if( gGLManager.mATIOffsetVerticalLines ) 204 if( gGLManager.mATIOffsetVerticalLines )
204 { 205 {
205 // Work around bug in ATI driver: vertical lines are offset by (-1,-1) 206 // Work around bug in ATI driver: vertical lines are offset by (-1,-1)
206 glBegin( GL_LINES ); 207 gGL.begin( GL_LINES );
207 208
208 // Verticals 209 // Verticals
209 glVertex2i(left + 1, top); 210 gGL.vertex2i(left + 1, top);
210 glVertex2i(left + 1, bottom); 211 gGL.vertex2i(left + 1, bottom);
211 212
212 glVertex2i(right, bottom); 213 gGL.vertex2i(right, bottom);
213 glVertex2i(right, top); 214 gGL.vertex2i(right, top);
214 215
215 // Horizontals 216 // Horizontals
216 top--; 217 top--;
217 right--; 218 right--;
218 glVertex2i(left, bottom); 219 gGL.vertex2i(left, bottom);
219 glVertex2i(right, bottom); 220 gGL.vertex2i(right, bottom);
220 221
221 glVertex2i(left, top); 222 gGL.vertex2i(left, top);
222 glVertex2i(right, top); 223 gGL.vertex2i(right, top);
223 glEnd(); 224 gGL.end();
224 } 225 }
225 else 226 else
226 { 227 {
227 top--; 228 top--;
228 right--; 229 right--;
229 glBegin( GL_LINE_STRIP ); 230 gGL.begin( GL_LINE_STRIP );
230 glVertex2i(left, top); 231 gGL.vertex2i(left, top);
231 glVertex2i(left, bottom); 232 gGL.vertex2i(left, bottom);
232 glVertex2i(right, bottom); 233 gGL.vertex2i(right, bottom);
233 glVertex2i(right, top); 234 gGL.vertex2i(right, top);
234 glVertex2i(left, top); 235 gGL.vertex2i(left, top);
235 glEnd(); 236 gGL.end();
236 } 237 }
237 } 238 }
238 stop_glerror(); 239 stop_glerror();
@@ -240,14 +241,14 @@ void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled )
240 241
241void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, BOOL filled ) 242void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, BOOL filled )
242{ 243{
243 glColor4fv( color.mV ); 244 gGL.color4fv( color.mV );
244 gl_rect_2d( left, top, right, bottom, filled ); 245 gl_rect_2d( left, top, right, bottom, filled );
245} 246}
246 247
247 248
248void gl_rect_2d( const LLRect& rect, const LLColor4& color, BOOL filled ) 249void gl_rect_2d( const LLRect& rect, const LLColor4& color, BOOL filled )
249{ 250{
250 glColor4fv( color.mV ); 251 gGL.color4fv( color.mV );
251 gl_rect_2d( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, filled ); 252 gl_rect_2d( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, filled );
252} 253}
253 254
@@ -267,52 +268,52 @@ void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &st
267 LLColor4 end_color = start_color; 268 LLColor4 end_color = start_color;
268 end_color.mV[VALPHA] = 0.f; 269 end_color.mV[VALPHA] = 0.f;
269 270
270 glBegin(GL_QUADS); 271 gGL.begin(GL_QUADS);
271 272
272 // Right edge, CCW faces screen 273 // Right edge, CCW faces screen
273 glColor4fv(start_color.mV); 274 gGL.color4fv(start_color.mV);
274 glVertex2i(right, top-lines); 275 gGL.vertex2i(right, top-lines);
275 glVertex2i(right, bottom); 276 gGL.vertex2i(right, bottom);
276 glColor4fv(end_color.mV); 277 gGL.color4fv(end_color.mV);
277 glVertex2i(right+lines, bottom); 278 gGL.vertex2i(right+lines, bottom);
278 glVertex2i(right+lines, top-lines); 279 gGL.vertex2i(right+lines, top-lines);
279 280
280 // Bottom edge, CCW faces screen 281 // Bottom edge, CCW faces screen
281 glColor4fv(start_color.mV); 282 gGL.color4fv(start_color.mV);
282 glVertex2i(right, bottom); 283 gGL.vertex2i(right, bottom);
283 glVertex2i(left+lines, bottom); 284 gGL.vertex2i(left+lines, bottom);
284 glColor4fv(end_color.mV); 285 gGL.color4fv(end_color.mV);
285 glVertex2i(left+lines, bottom-lines); 286 gGL.vertex2i(left+lines, bottom-lines);
286 glVertex2i(right, bottom-lines); 287 gGL.vertex2i(right, bottom-lines);
287 288
288 // bottom left Corner 289 // bottom left Corner
289 glColor4fv(start_color.mV); 290 gGL.color4fv(start_color.mV);
290 glVertex2i(left+lines, bottom); 291 gGL.vertex2i(left+lines, bottom);
291 glColor4fv(end_color.mV); 292 gGL.color4fv(end_color.mV);
292 glVertex2i(left, bottom); 293 gGL.vertex2i(left, bottom);
293 // make the bottom left corner not sharp 294 // make the bottom left corner not sharp
294 glVertex2i(left+1, bottom-lines+1); 295 gGL.vertex2i(left+1, bottom-lines+1);
295 glVertex2i(left+lines, bottom-lines); 296 gGL.vertex2i(left+lines, bottom-lines);
296 297
297 // bottom right corner 298 // bottom right corner
298 glColor4fv(start_color.mV); 299 gGL.color4fv(start_color.mV);
299 glVertex2i(right, bottom); 300 gGL.vertex2i(right, bottom);
300 glColor4fv(end_color.mV); 301 gGL.color4fv(end_color.mV);
301 glVertex2i(right, bottom-lines); 302 gGL.vertex2i(right, bottom-lines);
302 // make the rightmost corner not sharp 303 // make the rightmost corner not sharp
303 glVertex2i(right+lines-1, bottom-lines+1); 304 gGL.vertex2i(right+lines-1, bottom-lines+1);
304 glVertex2i(right+lines, bottom); 305 gGL.vertex2i(right+lines, bottom);
305 306
306 // top right corner 307 // top right corner
307 glColor4fv(start_color.mV); 308 gGL.color4fv(start_color.mV);
308 glVertex2i( right, top-lines ); 309 gGL.vertex2i( right, top-lines );
309 glColor4fv(end_color.mV); 310 gGL.color4fv(end_color.mV);
310 glVertex2i( right+lines, top-lines ); 311 gGL.vertex2i( right+lines, top-lines );
311 // make the corner not sharp 312 // make the corner not sharp
312 glVertex2i( right+lines-1, top-1 ); 313 gGL.vertex2i( right+lines-1, top-1 );
313 glVertex2i( right, top ); 314 gGL.vertex2i( right, top );
314 315
315 glEnd(); 316 gGL.end();
316 stop_glerror(); 317 stop_glerror();
317} 318}
318 319
@@ -329,10 +330,10 @@ void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2 )
329 330
330 LLGLSNoTexture no_texture; 331 LLGLSNoTexture no_texture;
331 332
332 glBegin(GL_LINES); 333 gGL.begin(GL_LINES);
333 glVertex2i(x1, y1); 334 gGL.vertex2i(x1, y1);
334 glVertex2i(x2, y2); 335 gGL.vertex2i(x2, y2);
335 glEnd(); 336 gGL.end();
336} 337}
337 338
338void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color ) 339void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color )
@@ -348,32 +349,32 @@ void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color )
348 349
349 LLGLSNoTexture no_texture; 350 LLGLSNoTexture no_texture;
350 351
351 glColor4fv( color.mV ); 352 gGL.color4fv( color.mV );
352 353
353 glBegin(GL_LINES); 354 gGL.begin(GL_LINES);
354 glVertex2i(x1, y1); 355 gGL.vertex2i(x1, y1);
355 glVertex2i(x2, y2); 356 gGL.vertex2i(x2, y2);
356 glEnd(); 357 gGL.end();
357} 358}
358 359
359void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled) 360void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled)
360{ 361{
361 LLGLSNoTexture no_texture; 362 LLGLSNoTexture no_texture;
362 363
363 glColor4fv(color.mV); 364 gGL.color4fv(color.mV);
364 365
365 if (filled) 366 if (filled)
366 { 367 {
367 glBegin(GL_TRIANGLES); 368 gGL.begin(GL_TRIANGLES);
368 } 369 }
369 else 370 else
370 { 371 {
371 glBegin(GL_LINE_LOOP); 372 gGL.begin(GL_LINE_LOOP);
372 } 373 }
373 glVertex2i(x1, y1); 374 gGL.vertex2i(x1, y1);
374 glVertex2i(x2, y2); 375 gGL.vertex2i(x2, y2);
375 glVertex2i(x3, y3); 376 gGL.vertex2i(x3, y3);
376 glEnd(); 377 gGL.end();
377} 378}
378 379
379void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max_frac) 380void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max_frac)
@@ -382,31 +383,31 @@ void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max
382 383
383 length = llmin((S32)(max_frac*(right - left)), length); 384 length = llmin((S32)(max_frac*(right - left)), length);
384 length = llmin((S32)(max_frac*(top - bottom)), length); 385 length = llmin((S32)(max_frac*(top - bottom)), length);
385 glBegin(GL_LINES); 386 gGL.begin(GL_LINES);
386 glVertex2i(left, top); 387 gGL.vertex2i(left, top);
387 glVertex2i(left + length, top); 388 gGL.vertex2i(left + length, top);
388 389
389 glVertex2i(left, top); 390 gGL.vertex2i(left, top);
390 glVertex2i(left, top - length); 391 gGL.vertex2i(left, top - length);
391 392
392 glVertex2i(left, bottom); 393 gGL.vertex2i(left, bottom);
393 glVertex2i(left + length, bottom); 394 gGL.vertex2i(left + length, bottom);
394 395
395 glVertex2i(left, bottom); 396 gGL.vertex2i(left, bottom);
396 glVertex2i(left, bottom + length); 397 gGL.vertex2i(left, bottom + length);
397 398
398 glVertex2i(right, top); 399 gGL.vertex2i(right, top);
399 glVertex2i(right - length, top); 400 gGL.vertex2i(right - length, top);
400 401
401 glVertex2i(right, top); 402 gGL.vertex2i(right, top);
402 glVertex2i(right, top - length); 403 gGL.vertex2i(right, top - length);
403 404
404 glVertex2i(right, bottom); 405 gGL.vertex2i(right, bottom);
405 glVertex2i(right - length, bottom); 406 gGL.vertex2i(right - length, bottom);
406 407
407 glVertex2i(right, bottom); 408 gGL.vertex2i(right, bottom);
408 glVertex2i(right, bottom + length); 409 gGL.vertex2i(right, bottom + length);
409 glEnd(); 410 gGL.end();
410} 411}
411 412
412 413
@@ -499,136 +500,136 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLIma
499 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, GL_SRC_ALPHA); 500 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, GL_SRC_ALPHA);
500 } 501 }
501 502
502 glPushMatrix(); 503 gGL.pushMatrix();
503 { 504 {
504 glTranslatef((F32)x, (F32)y, 0.f); 505 gGL.translatef((F32)x, (F32)y, 0.f);
505 506
506 image->bind(); 507 image->bind();
507 508
508 glColor4fv(color.mV); 509 gGL.color4fv(color.mV);
509 510
510 glBegin(GL_QUADS); 511 gGL.begin(GL_QUADS);
511 { 512 {
512 // draw bottom left 513 // draw bottom left
513 glTexCoord2d(uv_rect.mLeft, uv_rect.mBottom); 514 gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
514 glVertex2i(0, 0); 515 gGL.vertex2i(0, 0);
515 516
516 glTexCoord2f(clipped_scale_rect.mLeft, uv_rect.mBottom); 517 gGL.texCoord2f(clipped_scale_rect.mLeft, uv_rect.mBottom);
517 glVertex2i(draw_scale_rect.mLeft, 0); 518 gGL.vertex2i(draw_scale_rect.mLeft, 0);
518 519
519 glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom); 520 gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom);
520 glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); 521 gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom);
521 522
522 glTexCoord2d(uv_rect.mLeft, clipped_scale_rect.mBottom); 523 gGL.texCoord2f(uv_rect.mLeft, clipped_scale_rect.mBottom);
523 glVertex2i(0, draw_scale_rect.mBottom); 524 gGL.vertex2i(0, draw_scale_rect.mBottom);
524 525
525 // draw bottom middle 526 // draw bottom middle
526 glTexCoord2f(clipped_scale_rect.mLeft, uv_rect.mBottom); 527 gGL.texCoord2f(clipped_scale_rect.mLeft, uv_rect.mBottom);
527 glVertex2i(draw_scale_rect.mLeft, 0); 528 gGL.vertex2i(draw_scale_rect.mLeft, 0);
528 529
529 glTexCoord2d(clipped_scale_rect.mRight, uv_rect.mBottom); 530 gGL.texCoord2f(clipped_scale_rect.mRight, uv_rect.mBottom);
530 glVertex2i(draw_scale_rect.mRight, 0); 531 gGL.vertex2i(draw_scale_rect.mRight, 0);
531 532
532 glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mBottom); 533 gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mBottom);
533 glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); 534 gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom);
534 535
535 glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom); 536 gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom);
536 glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); 537 gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom);
537 538
538 // draw bottom right 539 // draw bottom right
539 glTexCoord2d(clipped_scale_rect.mRight, uv_rect.mBottom); 540 gGL.texCoord2f(clipped_scale_rect.mRight, uv_rect.mBottom);
540 glVertex2i(draw_scale_rect.mRight, 0); 541 gGL.vertex2i(draw_scale_rect.mRight, 0);
541 542
542 glTexCoord2d(uv_rect.mRight, uv_rect.mBottom); 543 gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
543 glVertex2i(width, 0); 544 gGL.vertex2i(width, 0);
544 545
545 glTexCoord2d(uv_rect.mRight, clipped_scale_rect.mBottom); 546 gGL.texCoord2f(uv_rect.mRight, clipped_scale_rect.mBottom);
546 glVertex2i(width, draw_scale_rect.mBottom); 547 gGL.vertex2i(width, draw_scale_rect.mBottom);
547 548
548 glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mBottom); 549 gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mBottom);
549 glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); 550 gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom);
550 551
551 // draw left 552 // draw left
552 glTexCoord2d(uv_rect.mLeft, clipped_scale_rect.mBottom); 553 gGL.texCoord2f(uv_rect.mLeft, clipped_scale_rect.mBottom);
553 glVertex2i(0, draw_scale_rect.mBottom); 554 gGL.vertex2i(0, draw_scale_rect.mBottom);
554 555
555 glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom); 556 gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom);
556 glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); 557 gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom);
557 558
558 glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop); 559 gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop);
559 glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); 560 gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop);
560 561
561 glTexCoord2d(uv_rect.mLeft, clipped_scale_rect.mTop); 562 gGL.texCoord2f(uv_rect.mLeft, clipped_scale_rect.mTop);
562 glVertex2i(0, draw_scale_rect.mTop); 563 gGL.vertex2i(0, draw_scale_rect.mTop);
563 564
564 // draw middle 565 // draw middle
565 glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom); 566 gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom);
566 glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom); 567 gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom);
567 568
568 glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mBottom); 569 gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mBottom);
569 glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); 570 gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom);
570 571
571 glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mTop); 572 gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mTop);
572 glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); 573 gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop);
573 574
574 glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop); 575 gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop);
575 glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); 576 gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop);
576 577
577 // draw right 578 // draw right
578 glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mBottom); 579 gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mBottom);
579 glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom); 580 gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom);
580 581
581 glTexCoord2d(uv_rect.mRight, clipped_scale_rect.mBottom); 582 gGL.texCoord2f(uv_rect.mRight, clipped_scale_rect.mBottom);
582 glVertex2i(width, draw_scale_rect.mBottom); 583 gGL.vertex2i(width, draw_scale_rect.mBottom);
583 584
584 glTexCoord2d(uv_rect.mRight, clipped_scale_rect.mTop); 585 gGL.texCoord2f(uv_rect.mRight, clipped_scale_rect.mTop);
585 glVertex2i(width, draw_scale_rect.mTop); 586 gGL.vertex2i(width, draw_scale_rect.mTop);
586 587
587 glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mTop); 588 gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mTop);
588 glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); 589 gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop);
589 590
590 // draw top left 591 // draw top left
591 glTexCoord2d(uv_rect.mLeft, clipped_scale_rect.mTop); 592 gGL.texCoord2f(uv_rect.mLeft, clipped_scale_rect.mTop);
592 glVertex2i(0, draw_scale_rect.mTop); 593 gGL.vertex2i(0, draw_scale_rect.mTop);
593 594
594 glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop); 595 gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop);
595 glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); 596 gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop);
596 597
597 glTexCoord2f(clipped_scale_rect.mLeft, uv_rect.mTop); 598 gGL.texCoord2f(clipped_scale_rect.mLeft, uv_rect.mTop);
598 glVertex2i(draw_scale_rect.mLeft, height); 599 gGL.vertex2i(draw_scale_rect.mLeft, height);
599 600
600 glTexCoord2d(uv_rect.mLeft, uv_rect.mTop); 601 gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
601 glVertex2i(0, height); 602 gGL.vertex2i(0, height);
602 603
603 // draw top middle 604 // draw top middle
604 glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop); 605 gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop);
605 glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop); 606 gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop);
606 607
607 glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mTop); 608 gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mTop);
608 glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); 609 gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop);
609 610
610 glTexCoord2d(clipped_scale_rect.mRight, uv_rect.mTop); 611 gGL.texCoord2f(clipped_scale_rect.mRight, uv_rect.mTop);
611 glVertex2i(draw_scale_rect.mRight, height); 612 gGL.vertex2i(draw_scale_rect.mRight, height);
612 613
613 glTexCoord2f(clipped_scale_rect.mLeft, uv_rect.mTop); 614 gGL.texCoord2f(clipped_scale_rect.mLeft, uv_rect.mTop);
614 glVertex2i(draw_scale_rect.mLeft, height); 615 gGL.vertex2i(draw_scale_rect.mLeft, height);
615 616
616 // draw top right 617 // draw top right
617 glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mTop); 618 gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mTop);
618 glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop); 619 gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop);
619 620
620 glTexCoord2d(uv_rect.mRight, clipped_scale_rect.mTop); 621 gGL.texCoord2f(uv_rect.mRight, clipped_scale_rect.mTop);
621 glVertex2i(width, draw_scale_rect.mTop); 622 gGL.vertex2i(width, draw_scale_rect.mTop);
622 623
623 glTexCoord2d(uv_rect.mRight, uv_rect.mTop); 624 gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
624 glVertex2i(width, height); 625 gGL.vertex2i(width, height);
625 626
626 glTexCoord2d(clipped_scale_rect.mRight, uv_rect.mTop); 627 gGL.texCoord2f(clipped_scale_rect.mRight, uv_rect.mTop);
627 glVertex2i(draw_scale_rect.mRight, height); 628 gGL.vertex2i(draw_scale_rect.mRight, height);
628 } 629 }
629 glEnd(); 630 gGL.end();
630 } 631 }
631 glPopMatrix(); 632 gGL.popMatrix();
632 633
633 if (solid_color) 634 if (solid_color)
634 { 635 {
@@ -651,39 +652,39 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
651 652
652 LLGLSUIDefault gls_ui; 653 LLGLSUIDefault gls_ui;
653 654
654 glPushMatrix(); 655 gGL.pushMatrix();
655 { 656 {
656 glTranslatef((F32)x, (F32)y, 0.f); 657 gGL.translatef((F32)x, (F32)y, 0.f);
657 if( degrees ) 658 if( degrees )
658 { 659 {
659 F32 offset_x = F32(width/2); 660 F32 offset_x = F32(width/2);
660 F32 offset_y = F32(height/2); 661 F32 offset_y = F32(height/2);
661 glTranslatef( offset_x, offset_y, 0.f); 662 gGL.translatef( offset_x, offset_y, 0.f);
662 glRotatef( degrees, 0.f, 0.f, 1.f ); 663 glRotatef( degrees, 0.f, 0.f, 1.f );
663 glTranslatef( -offset_x, -offset_y, 0.f ); 664 gGL.translatef( -offset_x, -offset_y, 0.f );
664 } 665 }
665 666
666 image->bind(); 667 image->bind();
667 668
668 glColor4fv(color.mV); 669 gGL.color4fv(color.mV);
669 670
670 glBegin(GL_QUADS); 671 gGL.begin(GL_QUADS);
671 { 672 {
672 glTexCoord2f(uv_rect.mRight, uv_rect.mTop); 673 gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
673 glVertex2i(width, height ); 674 gGL.vertex2i(width, height );
674 675
675 glTexCoord2f(uv_rect.mLeft, uv_rect.mTop); 676 gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
676 glVertex2i(0, height ); 677 gGL.vertex2i(0, height );
677 678
678 glTexCoord2f(uv_rect.mLeft, uv_rect.mBottom); 679 gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
679 glVertex2i(0, 0); 680 gGL.vertex2i(0, 0);
680 681
681 glTexCoord2f(uv_rect.mRight, uv_rect.mBottom); 682 gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
682 glVertex2i(width, 0); 683 gGL.vertex2i(width, 0);
683 } 684 }
684 glEnd(); 685 gGL.end();
685 } 686 }
686 glPopMatrix(); 687 gGL.popMatrix();
687} 688}
688 689
689 690
@@ -697,31 +698,31 @@ void gl_draw_scaled_image_inverted(S32 x, S32 y, S32 width, S32 height, LLImageG
697 698
698 LLGLSUIDefault gls_ui; 699 LLGLSUIDefault gls_ui;
699 700
700 glPushMatrix(); 701 gGL.pushMatrix();
701 { 702 {
702 glTranslatef((F32)x, (F32)y, 0.f); 703 gGL.translatef((F32)x, (F32)y, 0.f);
703 704
704 image->bind(); 705 image->bind();
705 706
706 glColor4fv(color.mV); 707 gGL.color4fv(color.mV);
707 708
708 glBegin(GL_QUADS); 709 gGL.begin(GL_QUADS);
709 { 710 {
710 glTexCoord2f(uv_rect.mRight, uv_rect.mBottom); 711 gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
711 glVertex2i(width, height ); 712 gGL.vertex2i(width, height );
712 713
713 glTexCoord2f(uv_rect.mLeft, uv_rect.mBottom); 714 gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
714 glVertex2i(0, height ); 715 gGL.vertex2i(0, height );
715 716
716 glTexCoord2f(uv_rect.mLeft, uv_rect.mTop); 717 gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
717 glVertex2i(0, 0); 718 gGL.vertex2i(0, 0);
718 719
719 glTexCoord2f(uv_rect.mRight, uv_rect.mTop); 720 gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
720 glVertex2i(width, 0); 721 gGL.vertex2i(width, 0);
721 } 722 }
722 glEnd(); 723 gGL.end();
723 } 724 }
724 glPopMatrix(); 725 gGL.popMatrix();
725} 726}
726 727
727 728
@@ -734,16 +735,18 @@ void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LL
734 // Stippled line 735 // Stippled line
735 LLGLEnable stipple(GL_LINE_STIPPLE); 736 LLGLEnable stipple(GL_LINE_STIPPLE);
736 737
737 glColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], color.mV[VALPHA]); 738 gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], color.mV[VALPHA]);
739
740 gGL.flush();
738 glLineWidth(2.5f); 741 glLineWidth(2.5f);
739 glLineStipple(2, 0x3333 << shift); 742 glLineStipple(2, 0x3333 << shift);
740 743
741 glBegin(GL_LINES); 744 gGL.begin(GL_LINES);
742 { 745 {
743 glVertex3fv( start.mV ); 746 gGL.vertex3fv( start.mV );
744 glVertex3fv( end.mV ); 747 gGL.vertex3fv( end.mV );
745 } 748 }
746 glEnd(); 749 gGL.end();
747 750
748 LLUI::setLineWidth(1.f); 751 LLUI::setLineWidth(1.f);
749} 752}
@@ -751,16 +754,16 @@ void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LL
751 754
752void gl_rect_2d_xor(S32 left, S32 top, S32 right, S32 bottom) 755void gl_rect_2d_xor(S32 left, S32 top, S32 right, S32 bottom)
753{ 756{
754 glColor4fv( LLColor4::white.mV ); 757 gGL.color4fv( LLColor4::white.mV );
755 glLogicOp( GL_XOR ); 758 glLogicOp( GL_XOR );
756 stop_glerror(); 759 stop_glerror();
757 760
758 glBegin(GL_QUADS); 761 gGL.begin(GL_QUADS);
759 glVertex2i(left, top); 762 gGL.vertex2i(left, top);
760 glVertex2i(left, bottom); 763 gGL.vertex2i(left, bottom);
761 glVertex2i(right, bottom); 764 gGL.vertex2i(right, bottom);
762 glVertex2i(right, top); 765 gGL.vertex2i(right, top);
763 glEnd(); 766 gGL.end();
764 767
765 glLogicOp( GL_COPY ); 768 glLogicOp( GL_COPY );
766 stop_glerror(); 769 stop_glerror();
@@ -774,9 +777,9 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F
774 end_angle += F_TWO_PI; 777 end_angle += F_TWO_PI;
775 } 778 }
776 779
777 glPushMatrix(); 780 gGL.pushMatrix();
778 { 781 {
779 glTranslatef(center_x, center_y, 0.f); 782 gGL.translatef(center_x, center_y, 0.f);
780 783
781 // Inexact, but reasonably fast. 784 // Inexact, but reasonably fast.
782 F32 delta = (end_angle - start_angle) / steps; 785 F32 delta = (end_angle - start_angle) / steps;
@@ -787,35 +790,35 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F
787 790
788 if (filled) 791 if (filled)
789 { 792 {
790 glBegin(GL_TRIANGLE_FAN); 793 gGL.begin(GL_TRIANGLE_FAN);
791 glVertex2f(0.f, 0.f); 794 gGL.vertex2f(0.f, 0.f);
792 // make sure circle is complete 795 // make sure circle is complete
793 steps += 1; 796 steps += 1;
794 } 797 }
795 else 798 else
796 { 799 {
797 glBegin(GL_LINE_STRIP); 800 gGL.begin(GL_LINE_STRIP);
798 } 801 }
799 802
800 while( steps-- ) 803 while( steps-- )
801 { 804 {
802 // Successive rotations 805 // Successive rotations
803 glVertex2f( x, y ); 806 gGL.vertex2f( x, y );
804 F32 x_new = x * cos_delta - y * sin_delta; 807 F32 x_new = x * cos_delta - y * sin_delta;
805 y = x * sin_delta + y * cos_delta; 808 y = x * sin_delta + y * cos_delta;
806 x = x_new; 809 x = x_new;
807 } 810 }
808 glEnd(); 811 gGL.end();
809 } 812 }
810 glPopMatrix(); 813 gGL.popMatrix();
811} 814}
812 815
813void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled) 816void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled)
814{ 817{
815 glPushMatrix(); 818 gGL.pushMatrix();
816 { 819 {
817 LLGLSNoTexture gls_no_texture; 820 LLGLSNoTexture gls_no_texture;
818 glTranslatef(center_x, center_y, 0.f); 821 gGL.translatef(center_x, center_y, 0.f);
819 822
820 // Inexact, but reasonably fast. 823 // Inexact, but reasonably fast.
821 F32 delta = F_TWO_PI / steps; 824 F32 delta = F_TWO_PI / steps;
@@ -826,27 +829,27 @@ void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled
826 829
827 if (filled) 830 if (filled)
828 { 831 {
829 glBegin(GL_TRIANGLE_FAN); 832 gGL.begin(GL_TRIANGLE_FAN);
830 glVertex2f(0.f, 0.f); 833 gGL.vertex2f(0.f, 0.f);
831 // make sure circle is complete 834 // make sure circle is complete
832 steps += 1; 835 steps += 1;
833 } 836 }
834 else 837 else
835 { 838 {
836 glBegin(GL_LINE_LOOP); 839 gGL.begin(GL_LINE_LOOP);
837 } 840 }
838 841
839 while( steps-- ) 842 while( steps-- )
840 { 843 {
841 // Successive rotations 844 // Successive rotations
842 glVertex2f( x, y ); 845 gGL.vertex2f( x, y );
843 F32 x_new = x * cos_delta - y * sin_delta; 846 F32 x_new = x * cos_delta - y * sin_delta;
844 y = x * sin_delta + y * cos_delta; 847 y = x * sin_delta + y * cos_delta;
845 x = x_new; 848 x = x_new;
846 } 849 }
847 glEnd(); 850 gGL.end();
848 } 851 }
849 glPopMatrix(); 852 gGL.popMatrix();
850} 853}
851 854
852// Renders a ring with sides (tube shape) 855// Renders a ring with sides (tube shape)
@@ -855,40 +858,40 @@ void gl_deep_circle( F32 radius, F32 depth, S32 steps )
855 F32 x = radius; 858 F32 x = radius;
856 F32 y = 0.f; 859 F32 y = 0.f;
857 F32 angle_delta = F_TWO_PI / (F32)steps; 860 F32 angle_delta = F_TWO_PI / (F32)steps;
858 glBegin( GL_TRIANGLE_STRIP ); 861 gGL.begin( GL_TRIANGLE_STRIP );
859 { 862 {
860 S32 step = steps + 1; // An extra step to close the circle. 863 S32 step = steps + 1; // An extra step to close the circle.
861 while( step-- ) 864 while( step-- )
862 { 865 {
863 glVertex3f( x, y, depth ); 866 gGL.vertex3f( x, y, depth );
864 glVertex3f( x, y, 0.f ); 867 gGL.vertex3f( x, y, 0.f );
865 868
866 F32 x_new = x * cosf(angle_delta) - y * sinf(angle_delta); 869 F32 x_new = x * cosf(angle_delta) - y * sinf(angle_delta);
867 y = x * sinf(angle_delta) + y * cosf(angle_delta); 870 y = x * sinf(angle_delta) + y * cosf(angle_delta);
868 x = x_new; 871 x = x_new;
869 } 872 }
870 } 873 }
871 glEnd(); 874 gGL.end();
872} 875}
873 876
874void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center ) 877void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center )
875{ 878{
876 glPushMatrix(); 879 gGL.pushMatrix();
877 { 880 {
878 glTranslatef(0.f, 0.f, -width / 2); 881 gGL.translatef(0.f, 0.f, -width / 2);
879 if( render_center ) 882 if( render_center )
880 { 883 {
881 glColor4fv(center_color.mV); 884 gGL.color4fv(center_color.mV);
882 gl_deep_circle( radius, width, steps ); 885 gl_deep_circle( radius, width, steps );
883 } 886 }
884 else 887 else
885 { 888 {
886 gl_washer_2d(radius, radius - width, steps, side_color, side_color); 889 gl_washer_2d(radius, radius - width, steps, side_color, side_color);
887 glTranslatef(0.f, 0.f, width); 890 gGL.translatef(0.f, 0.f, width);
888 gl_washer_2d(radius - width, radius, steps, side_color, side_color); 891 gl_washer_2d(radius - width, radius, steps, side_color, side_color);
889 } 892 }
890 } 893 }
891 glPopMatrix(); 894 gGL.popMatrix();
892} 895}
893 896
894// Draw gray and white checkerboard with black border 897// Draw gray and white checkerboard with black border
@@ -913,15 +916,17 @@ void gl_rect_2d_checkerboard(const LLRect& rect)
913 LLGLSNoTexture gls_no_texture; 916 LLGLSNoTexture gls_no_texture;
914 917
915 // ...white squares 918 // ...white squares
916 glColor3f( 1.f, 1.f, 1.f ); 919 gGL.color3f( 1.f, 1.f, 1.f );
917 gl_rect_2d(rect); 920 gl_rect_2d(rect);
918 921
919 // ...gray squares 922 // ...gray squares
920 glColor3f( .7f, .7f, .7f ); 923 gGL.color3f( .7f, .7f, .7f );
924 gGL.flush();
921 glPolygonStipple( checkerboard ); 925 glPolygonStipple( checkerboard );
922 926
923 LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE); 927 LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE);
924 gl_rect_2d(rect); 928 gl_rect_2d(rect);
929 gGL.flush();
925} 930}
926 931
927 932
@@ -940,15 +945,15 @@ void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4&
940 945
941 LLGLSNoTexture gls_no_texture; 946 LLGLSNoTexture gls_no_texture;
942 947
943 glBegin( GL_TRIANGLE_STRIP ); 948 gGL.begin( GL_TRIANGLE_STRIP );
944 { 949 {
945 steps += 1; // An extra step to close the circle. 950 steps += 1; // An extra step to close the circle.
946 while( steps-- ) 951 while( steps-- )
947 { 952 {
948 glColor4fv(outer_color.mV); 953 gGL.color4fv(outer_color.mV);
949 glVertex2f( x1, y1 ); 954 gGL.vertex2f( x1, y1 );
950 glColor4fv(inner_color.mV); 955 gGL.color4fv(inner_color.mV);
951 glVertex2f( x2, y2 ); 956 gGL.vertex2f( x2, y2 );
952 957
953 F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA; 958 F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA;
954 y1 = x1 * SIN_DELTA + y1 * COS_DELTA; 959 y1 = x1 * SIN_DELTA + y1 * COS_DELTA;
@@ -959,7 +964,7 @@ void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4&
959 x2 = x2_new; 964 x2 = x2_new;
960 } 965 }
961 } 966 }
962 glEnd(); 967 gGL.end();
963} 968}
964 969
965// Draws the area between two concentric circles, like 970// Draws the area between two concentric circles, like
@@ -976,15 +981,15 @@ void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians,
976 F32 y2 = inner_radius * sin( start_radians ); 981 F32 y2 = inner_radius * sin( start_radians );
977 982
978 LLGLSNoTexture gls_no_texture; 983 LLGLSNoTexture gls_no_texture;
979 glBegin( GL_TRIANGLE_STRIP ); 984 gGL.begin( GL_TRIANGLE_STRIP );
980 { 985 {
981 steps += 1; // An extra step to close the circle. 986 steps += 1; // An extra step to close the circle.
982 while( steps-- ) 987 while( steps-- )
983 { 988 {
984 glColor4fv(outer_color.mV); 989 gGL.color4fv(outer_color.mV);
985 glVertex2f( x1, y1 ); 990 gGL.vertex2f( x1, y1 );
986 glColor4fv(inner_color.mV); 991 gGL.color4fv(inner_color.mV);
987 glVertex2f( x2, y2 ); 992 gGL.vertex2f( x2, y2 );
988 993
989 F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA; 994 F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA;
990 y1 = x1 * SIN_DELTA + y1 * COS_DELTA; 995 y1 = x1 * SIN_DELTA + y1 * COS_DELTA;
@@ -995,7 +1000,7 @@ void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians,
995 x2 = x2_new; 1000 x2 = x2_new;
996 } 1001 }
997 } 1002 }
998 glEnd(); 1003 gGL.end();
999} 1004}
1000 1005
1001// Draws spokes around a circle. 1006// Draws spokes around a circle.
@@ -1013,14 +1018,14 @@ void gl_washer_spokes_2d(F32 outer_radius, F32 inner_radius, S32 count, const LL
1013 1018
1014 LLGLSNoTexture gls_no_texture; 1019 LLGLSNoTexture gls_no_texture;
1015 1020
1016 glBegin( GL_LINES ); 1021 gGL.begin( GL_LINES );
1017 { 1022 {
1018 while( count-- ) 1023 while( count-- )
1019 { 1024 {
1020 glColor4fv(outer_color.mV); 1025 gGL.color4fv(outer_color.mV);
1021 glVertex2f( x1, y1 ); 1026 gGL.vertex2f( x1, y1 );
1022 glColor4fv(inner_color.mV); 1027 gGL.color4fv(inner_color.mV);
1023 glVertex2f( x2, y2 ); 1028 gGL.vertex2f( x2, y2 );
1024 1029
1025 F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA; 1030 F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA;
1026 y1 = x1 * SIN_DELTA + y1 * COS_DELTA; 1031 y1 = x1 * SIN_DELTA + y1 * COS_DELTA;
@@ -1031,36 +1036,36 @@ void gl_washer_spokes_2d(F32 outer_radius, F32 inner_radius, S32 count, const LL
1031 x2 = x2_new; 1036 x2 = x2_new;
1032 } 1037 }
1033 } 1038 }
1034 glEnd(); 1039 gGL.end();
1035} 1040}
1036 1041
1037void gl_rect_2d_simple_tex( S32 width, S32 height ) 1042void gl_rect_2d_simple_tex( S32 width, S32 height )
1038{ 1043{
1039 glBegin( GL_QUADS ); 1044 gGL.begin( GL_QUADS );
1040 1045
1041 glTexCoord2f(1.f, 1.f); 1046 gGL.texCoord2f(1.f, 1.f);
1042 glVertex2i(width, height); 1047 gGL.vertex2i(width, height);
1043 1048
1044 glTexCoord2f(0.f, 1.f); 1049 gGL.texCoord2f(0.f, 1.f);
1045 glVertex2i(0, height); 1050 gGL.vertex2i(0, height);
1046 1051
1047 glTexCoord2f(0.f, 0.f); 1052 gGL.texCoord2f(0.f, 0.f);
1048 glVertex2i(0, 0); 1053 gGL.vertex2i(0, 0);
1049 1054
1050 glTexCoord2f(1.f, 0.f); 1055 gGL.texCoord2f(1.f, 0.f);
1051 glVertex2i(width, 0); 1056 gGL.vertex2i(width, 0);
1052 1057
1053 glEnd(); 1058 gGL.end();
1054} 1059}
1055 1060
1056void gl_rect_2d_simple( S32 width, S32 height ) 1061void gl_rect_2d_simple( S32 width, S32 height )
1057{ 1062{
1058 glBegin( GL_QUADS ); 1063 gGL.begin( GL_QUADS );
1059 glVertex2i(width, height); 1064 gGL.vertex2i(width, height);
1060 glVertex2i(0, height); 1065 gGL.vertex2i(0, height);
1061 glVertex2i(0, 0); 1066 gGL.vertex2i(0, 0);
1062 glVertex2i(width, 0); 1067 gGL.vertex2i(width, 0);
1063 glEnd(); 1068 gGL.end();
1064} 1069}
1065 1070
1066void gl_segmented_rect_2d_tex(const S32 left, 1071void gl_segmented_rect_2d_tex(const S32 left,
@@ -1075,9 +1080,9 @@ void gl_segmented_rect_2d_tex(const S32 left,
1075 S32 width = llabs(right - left); 1080 S32 width = llabs(right - left);
1076 S32 height = llabs(top - bottom); 1081 S32 height = llabs(top - bottom);
1077 1082
1078 glPushMatrix(); 1083 gGL.pushMatrix();
1079 1084
1080 glTranslatef((F32)left, (F32)bottom, 0.f); 1085 gGL.translatef((F32)left, (F32)bottom, 0.f);
1081 LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height); 1086 LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height);
1082 1087
1083 if (border_uv_scale.mV[VX] > 0.5f) 1088 if (border_uv_scale.mV[VX] > 0.5f)
@@ -1097,128 +1102,128 @@ void gl_segmented_rect_2d_tex(const S32 left,
1097 LLVector2 width_vec((F32)width, 0.f); 1102 LLVector2 width_vec((F32)width, 0.f);
1098 LLVector2 height_vec(0.f, (F32)height); 1103 LLVector2 height_vec(0.f, (F32)height);
1099 1104
1100 glBegin(GL_QUADS); 1105 gGL.begin(GL_QUADS);
1101 { 1106 {
1102 // draw bottom left 1107 // draw bottom left
1103 glTexCoord2f(0.f, 0.f); 1108 gGL.texCoord2f(0.f, 0.f);
1104 glVertex2f(0.f, 0.f); 1109 gGL.vertex2f(0.f, 0.f);
1105 1110
1106 glTexCoord2f(border_uv_scale.mV[VX], 0.f); 1111 gGL.texCoord2f(border_uv_scale.mV[VX], 0.f);
1107 glVertex2fv(border_width_left.mV); 1112 gGL.vertex2fv(border_width_left.mV);
1108 1113
1109 glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); 1114 gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
1110 glVertex2fv((border_width_left + border_height_bottom).mV); 1115 gGL.vertex2fv((border_width_left + border_height_bottom).mV);
1111 1116
1112 glTexCoord2f(0.f, border_uv_scale.mV[VY]); 1117 gGL.texCoord2f(0.f, border_uv_scale.mV[VY]);
1113 glVertex2fv(border_height_bottom.mV); 1118 gGL.vertex2fv(border_height_bottom.mV);
1114 1119
1115 // draw bottom middle 1120 // draw bottom middle
1116 glTexCoord2f(border_uv_scale.mV[VX], 0.f); 1121 gGL.texCoord2f(border_uv_scale.mV[VX], 0.f);
1117 glVertex2fv(border_width_left.mV); 1122 gGL.vertex2fv(border_width_left.mV);
1118 1123
1119 glTexCoord2f(1.f - border_uv_scale.mV[VX], 0.f); 1124 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 0.f);
1120 glVertex2fv((width_vec - border_width_right).mV); 1125 gGL.vertex2fv((width_vec - border_width_right).mV);
1121 1126
1122 glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); 1127 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
1123 glVertex2fv((width_vec - border_width_right + border_height_bottom).mV); 1128 gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV);
1124 1129
1125 glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); 1130 gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
1126 glVertex2fv((border_width_left + border_height_bottom).mV); 1131 gGL.vertex2fv((border_width_left + border_height_bottom).mV);
1127 1132
1128 // draw bottom right 1133 // draw bottom right
1129 glTexCoord2f(1.f - border_uv_scale.mV[VX], 0.f); 1134 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 0.f);
1130 glVertex2fv((width_vec - border_width_right).mV); 1135 gGL.vertex2fv((width_vec - border_width_right).mV);
1131 1136
1132 glTexCoord2f(1.f, 0.f); 1137 gGL.texCoord2f(1.f, 0.f);
1133 glVertex2fv(width_vec.mV); 1138 gGL.vertex2fv(width_vec.mV);
1134 1139
1135 glTexCoord2f(1.f, border_uv_scale.mV[VY]); 1140 gGL.texCoord2f(1.f, border_uv_scale.mV[VY]);
1136 glVertex2fv((width_vec + border_height_bottom).mV); 1141 gGL.vertex2fv((width_vec + border_height_bottom).mV);
1137 1142
1138 glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); 1143 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
1139 glVertex2fv((width_vec - border_width_right + border_height_bottom).mV); 1144 gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV);
1140 1145
1141 // draw left 1146 // draw left
1142 glTexCoord2f(0.f, border_uv_scale.mV[VY]); 1147 gGL.texCoord2f(0.f, border_uv_scale.mV[VY]);
1143 glVertex2fv(border_height_bottom.mV); 1148 gGL.vertex2fv(border_height_bottom.mV);
1144 1149
1145 glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); 1150 gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
1146 glVertex2fv((border_width_left + border_height_bottom).mV); 1151 gGL.vertex2fv((border_width_left + border_height_bottom).mV);
1147 1152
1148 glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); 1153 gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
1149 glVertex2fv((border_width_left + height_vec - border_height_top).mV); 1154 gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV);
1150 1155
1151 glTexCoord2f(0.f, 1.f - border_uv_scale.mV[VY]); 1156 gGL.texCoord2f(0.f, 1.f - border_uv_scale.mV[VY]);
1152 glVertex2fv((height_vec - border_height_top).mV); 1157 gGL.vertex2fv((height_vec - border_height_top).mV);
1153 1158
1154 // draw middle 1159 // draw middle
1155 glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); 1160 gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
1156 glVertex2fv((border_width_left + border_height_bottom).mV); 1161 gGL.vertex2fv((border_width_left + border_height_bottom).mV);
1157 1162
1158 glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); 1163 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
1159 glVertex2fv((width_vec - border_width_right + border_height_bottom).mV); 1164 gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV);
1160 1165
1161 glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); 1166 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
1162 glVertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); 1167 gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV);
1163 1168
1164 glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); 1169 gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
1165 glVertex2fv((border_width_left + height_vec - border_height_top).mV); 1170 gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV);
1166 1171
1167 // draw right 1172 // draw right
1168 glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); 1173 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
1169 glVertex2fv((width_vec - border_width_right + border_height_bottom).mV); 1174 gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV);
1170 1175
1171 glTexCoord2f(1.f, border_uv_scale.mV[VY]); 1176 gGL.texCoord2f(1.f, border_uv_scale.mV[VY]);
1172 glVertex2fv((width_vec + border_height_bottom).mV); 1177 gGL.vertex2fv((width_vec + border_height_bottom).mV);
1173 1178
1174 glTexCoord2f(1.f, 1.f - border_uv_scale.mV[VY]); 1179 gGL.texCoord2f(1.f, 1.f - border_uv_scale.mV[VY]);
1175 glVertex2fv((width_vec + height_vec - border_height_top).mV); 1180 gGL.vertex2fv((width_vec + height_vec - border_height_top).mV);
1176 1181
1177 glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); 1182 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
1178 glVertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); 1183 gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV);
1179 1184
1180 // draw top left 1185 // draw top left
1181 glTexCoord2f(0.f, 1.f - border_uv_scale.mV[VY]); 1186 gGL.texCoord2f(0.f, 1.f - border_uv_scale.mV[VY]);
1182 glVertex2fv((height_vec - border_height_top).mV); 1187 gGL.vertex2fv((height_vec - border_height_top).mV);
1183 1188
1184 glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); 1189 gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
1185 glVertex2fv((border_width_left + height_vec - border_height_top).mV); 1190 gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV);
1186 1191
1187 glTexCoord2f(border_uv_scale.mV[VX], 1.f); 1192 gGL.texCoord2f(border_uv_scale.mV[VX], 1.f);
1188 glVertex2fv((border_width_left + height_vec).mV); 1193 gGL.vertex2fv((border_width_left + height_vec).mV);
1189 1194
1190 glTexCoord2f(0.f, 1.f); 1195 gGL.texCoord2f(0.f, 1.f);
1191 glVertex2fv((height_vec).mV); 1196 gGL.vertex2fv((height_vec).mV);
1192 1197
1193 // draw top middle 1198 // draw top middle
1194 glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); 1199 gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
1195 glVertex2fv((border_width_left + height_vec - border_height_top).mV); 1200 gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV);
1196 1201
1197 glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); 1202 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
1198 glVertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); 1203 gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV);
1199 1204
1200 glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f); 1205 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f);
1201 glVertex2fv((width_vec - border_width_right + height_vec).mV); 1206 gGL.vertex2fv((width_vec - border_width_right + height_vec).mV);
1202 1207
1203 glTexCoord2f(border_uv_scale.mV[VX], 1.f); 1208 gGL.texCoord2f(border_uv_scale.mV[VX], 1.f);
1204 glVertex2fv((border_width_left + height_vec).mV); 1209 gGL.vertex2fv((border_width_left + height_vec).mV);
1205 1210
1206 // draw top right 1211 // draw top right
1207 glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); 1212 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
1208 glVertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); 1213 gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV);
1209 1214
1210 glTexCoord2f(1.f, 1.f - border_uv_scale.mV[VY]); 1215 gGL.texCoord2f(1.f, 1.f - border_uv_scale.mV[VY]);
1211 glVertex2fv((width_vec + height_vec - border_height_top).mV); 1216 gGL.vertex2fv((width_vec + height_vec - border_height_top).mV);
1212 1217
1213 glTexCoord2f(1.f, 1.f); 1218 gGL.texCoord2f(1.f, 1.f);
1214 glVertex2fv((width_vec + height_vec).mV); 1219 gGL.vertex2fv((width_vec + height_vec).mV);
1215 1220
1216 glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f); 1221 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f);
1217 glVertex2fv((width_vec - border_width_right + height_vec).mV); 1222 gGL.vertex2fv((width_vec - border_width_right + height_vec).mV);
1218 } 1223 }
1219 glEnd(); 1224 gGL.end();
1220 1225
1221 glPopMatrix(); 1226 gGL.popMatrix();
1222} 1227}
1223 1228
1224void gl_segmented_rect_2d_fragment_tex(const S32 left, 1229void gl_segmented_rect_2d_fragment_tex(const S32 left,
@@ -1235,9 +1240,9 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
1235 S32 width = llabs(right - left); 1240 S32 width = llabs(right - left);
1236 S32 height = llabs(top - bottom); 1241 S32 height = llabs(top - bottom);
1237 1242
1238 glPushMatrix(); 1243 gGL.pushMatrix();
1239 1244
1240 glTranslatef((F32)left, (F32)bottom, 0.f); 1245 gGL.translatef((F32)left, (F32)bottom, 0.f);
1241 LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height); 1246 LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height);
1242 1247
1243 if (border_uv_scale.mV[VX] > 0.5f) 1248 if (border_uv_scale.mV[VX] > 0.5f)
@@ -1265,7 +1270,7 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
1265 LLVector2 x_min; 1270 LLVector2 x_min;
1266 LLVector2 x_max; 1271 LLVector2 x_max;
1267 1272
1268 glBegin(GL_QUADS); 1273 gGL.begin(GL_QUADS);
1269 { 1274 {
1270 if (start_fragment < middle_start) 1275 if (start_fragment < middle_start)
1271 { 1276 {
@@ -1275,43 +1280,43 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
1275 x_max = llmin(end_fragment / middle_start, 1.f) * border_width_left; 1280 x_max = llmin(end_fragment / middle_start, 1.f) * border_width_left;
1276 1281
1277 // draw bottom left 1282 // draw bottom left
1278 glTexCoord2f(u_min, 0.f); 1283 gGL.texCoord2f(u_min, 0.f);
1279 glVertex2fv(x_min.mV); 1284 gGL.vertex2fv(x_min.mV);
1280 1285
1281 glTexCoord2f(border_uv_scale.mV[VX], 0.f); 1286 gGL.texCoord2f(border_uv_scale.mV[VX], 0.f);
1282 glVertex2fv(x_max.mV); 1287 gGL.vertex2fv(x_max.mV);
1283 1288
1284 glTexCoord2f(u_max, border_uv_scale.mV[VY]); 1289 gGL.texCoord2f(u_max, border_uv_scale.mV[VY]);
1285 glVertex2fv((x_max + border_height_bottom).mV); 1290 gGL.vertex2fv((x_max + border_height_bottom).mV);
1286 1291
1287 glTexCoord2f(u_min, border_uv_scale.mV[VY]); 1292 gGL.texCoord2f(u_min, border_uv_scale.mV[VY]);
1288 glVertex2fv((x_min + border_height_bottom).mV); 1293 gGL.vertex2fv((x_min + border_height_bottom).mV);
1289 1294
1290 // draw left 1295 // draw left
1291 glTexCoord2f(u_min, border_uv_scale.mV[VY]); 1296 gGL.texCoord2f(u_min, border_uv_scale.mV[VY]);
1292 glVertex2fv((x_min + border_height_bottom).mV); 1297 gGL.vertex2fv((x_min + border_height_bottom).mV);
1293 1298
1294 glTexCoord2f(u_max, border_uv_scale.mV[VY]); 1299 gGL.texCoord2f(u_max, border_uv_scale.mV[VY]);
1295 glVertex2fv((x_max + border_height_bottom).mV); 1300 gGL.vertex2fv((x_max + border_height_bottom).mV);
1296 1301
1297 glTexCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); 1302 gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]);
1298 glVertex2fv((x_max + height_vec - border_height_top).mV); 1303 gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
1299 1304
1300 glTexCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); 1305 gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
1301 glVertex2fv((x_min + height_vec - border_height_top).mV); 1306 gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
1302 1307
1303 // draw top left 1308 // draw top left
1304 glTexCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); 1309 gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
1305 glVertex2fv((x_min + height_vec - border_height_top).mV); 1310 gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
1306 1311
1307 glTexCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); 1312 gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]);
1308 glVertex2fv((x_max + height_vec - border_height_top).mV); 1313 gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
1309 1314
1310 glTexCoord2f(u_max, 1.f); 1315 gGL.texCoord2f(u_max, 1.f);
1311 glVertex2fv((x_max + height_vec).mV); 1316 gGL.vertex2fv((x_max + height_vec).mV);
1312 1317
1313 glTexCoord2f(u_min, 1.f); 1318 gGL.texCoord2f(u_min, 1.f);
1314 glVertex2fv((x_min + height_vec).mV); 1319 gGL.vertex2fv((x_min + height_vec).mV);
1315 } 1320 }
1316 1321
1317 if (end_fragment > middle_start || start_fragment < middle_end) 1322 if (end_fragment > middle_start || start_fragment < middle_end)
@@ -1320,43 +1325,43 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
1320 x_max = border_width_left + ((llclamp(end_fragment, middle_start, middle_end) - middle_start)) * width_vec; 1325 x_max = border_width_left + ((llclamp(end_fragment, middle_start, middle_end) - middle_start)) * width_vec;
1321 1326
1322 // draw bottom middle 1327 // draw bottom middle
1323 glTexCoord2f(border_uv_scale.mV[VX], 0.f); 1328 gGL.texCoord2f(border_uv_scale.mV[VX], 0.f);
1324 glVertex2fv(x_min.mV); 1329 gGL.vertex2fv(x_min.mV);
1325 1330
1326 glTexCoord2f(1.f - border_uv_scale.mV[VX], 0.f); 1331 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 0.f);
1327 glVertex2fv((x_max).mV); 1332 gGL.vertex2fv((x_max).mV);
1328 1333
1329 glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); 1334 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
1330 glVertex2fv((x_max + border_height_bottom).mV); 1335 gGL.vertex2fv((x_max + border_height_bottom).mV);
1331 1336
1332 glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); 1337 gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
1333 glVertex2fv((x_min + border_height_bottom).mV); 1338 gGL.vertex2fv((x_min + border_height_bottom).mV);
1334 1339
1335 // draw middle 1340 // draw middle
1336 glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); 1341 gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
1337 glVertex2fv((x_min + border_height_bottom).mV); 1342 gGL.vertex2fv((x_min + border_height_bottom).mV);
1338 1343
1339 glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); 1344 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
1340 glVertex2fv((x_max + border_height_bottom).mV); 1345 gGL.vertex2fv((x_max + border_height_bottom).mV);
1341 1346
1342 glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); 1347 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
1343 glVertex2fv((x_max + height_vec - border_height_top).mV); 1348 gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
1344 1349
1345 glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); 1350 gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
1346 glVertex2fv((x_min + height_vec - border_height_top).mV); 1351 gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
1347 1352
1348 // draw top middle 1353 // draw top middle
1349 glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); 1354 gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
1350 glVertex2fv((x_min + height_vec - border_height_top).mV); 1355 gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
1351 1356
1352 glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); 1357 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
1353 glVertex2fv((x_max + height_vec - border_height_top).mV); 1358 gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
1354 1359
1355 glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f); 1360 gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f);
1356 glVertex2fv((x_max + height_vec).mV); 1361 gGL.vertex2fv((x_max + height_vec).mV);
1357 1362
1358 glTexCoord2f(border_uv_scale.mV[VX], 1.f); 1363 gGL.texCoord2f(border_uv_scale.mV[VX], 1.f);
1359 glVertex2fv((x_min + height_vec).mV); 1364 gGL.vertex2fv((x_min + height_vec).mV);
1360 } 1365 }
1361 1366
1362 if (end_fragment > middle_end) 1367 if (end_fragment > middle_end)
@@ -1367,48 +1372,48 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
1367 x_max = width_vec - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_width_right); 1372 x_max = width_vec - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_width_right);
1368 1373
1369 // draw bottom right 1374 // draw bottom right
1370 glTexCoord2f(u_min, 0.f); 1375 gGL.texCoord2f(u_min, 0.f);
1371 glVertex2fv((x_min).mV); 1376 gGL.vertex2fv((x_min).mV);
1372 1377
1373 glTexCoord2f(u_max, 0.f); 1378 gGL.texCoord2f(u_max, 0.f);
1374 glVertex2fv(x_max.mV); 1379 gGL.vertex2fv(x_max.mV);
1375 1380
1376 glTexCoord2f(u_max, border_uv_scale.mV[VY]); 1381 gGL.texCoord2f(u_max, border_uv_scale.mV[VY]);
1377 glVertex2fv((x_max + border_height_bottom).mV); 1382 gGL.vertex2fv((x_max + border_height_bottom).mV);
1378 1383
1379 glTexCoord2f(u_min, border_uv_scale.mV[VY]); 1384 gGL.texCoord2f(u_min, border_uv_scale.mV[VY]);
1380 glVertex2fv((x_min + border_height_bottom).mV); 1385 gGL.vertex2fv((x_min + border_height_bottom).mV);
1381 1386
1382 // draw right 1387 // draw right
1383 glTexCoord2f(u_min, border_uv_scale.mV[VY]); 1388 gGL.texCoord2f(u_min, border_uv_scale.mV[VY]);
1384 glVertex2fv((x_min + border_height_bottom).mV); 1389 gGL.vertex2fv((x_min + border_height_bottom).mV);
1385 1390
1386 glTexCoord2f(u_max, border_uv_scale.mV[VY]); 1391 gGL.texCoord2f(u_max, border_uv_scale.mV[VY]);
1387 glVertex2fv((x_max + border_height_bottom).mV); 1392 gGL.vertex2fv((x_max + border_height_bottom).mV);
1388 1393
1389 glTexCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); 1394 gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]);
1390 glVertex2fv((x_max + height_vec - border_height_top).mV); 1395 gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
1391 1396
1392 glTexCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); 1397 gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
1393 glVertex2fv((x_min + height_vec - border_height_top).mV); 1398 gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
1394 1399
1395 // draw top right 1400 // draw top right
1396 glTexCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); 1401 gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
1397 glVertex2fv((x_min + height_vec - border_height_top).mV); 1402 gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
1398 1403
1399 glTexCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); 1404 gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]);
1400 glVertex2fv((x_max + height_vec - border_height_top).mV); 1405 gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
1401 1406
1402 glTexCoord2f(u_max, 1.f); 1407 gGL.texCoord2f(u_max, 1.f);
1403 glVertex2fv((x_max + height_vec).mV); 1408 gGL.vertex2fv((x_max + height_vec).mV);
1404 1409
1405 glTexCoord2f(u_min, 1.f); 1410 gGL.texCoord2f(u_min, 1.f);
1406 glVertex2fv((x_min + height_vec).mV); 1411 gGL.vertex2fv((x_min + height_vec).mV);
1407 } 1412 }
1408 } 1413 }
1409 glEnd(); 1414 gGL.end();
1410 1415
1411 glPopMatrix(); 1416 gGL.popMatrix();
1412} 1417}
1413 1418
1414void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& border_width, 1419void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& border_width,
@@ -1421,126 +1426,128 @@ void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& bo
1421 LLVector3 top_border_height = ((edges & (~(U32)ROUNDED_RECT_BOTTOM)) != 0) ? border_height : LLVector3::zero; 1426 LLVector3 top_border_height = ((edges & (~(U32)ROUNDED_RECT_BOTTOM)) != 0) ? border_height : LLVector3::zero;
1422 LLVector3 bottom_border_height = ((edges & (~(U32)ROUNDED_RECT_TOP)) != 0) ? border_height : LLVector3::zero; 1427 LLVector3 bottom_border_height = ((edges & (~(U32)ROUNDED_RECT_TOP)) != 0) ? border_height : LLVector3::zero;
1423 1428
1424 glBegin(GL_QUADS); 1429
1430 gGL.begin(GL_QUADS);
1425 { 1431 {
1426 // draw bottom left 1432 // draw bottom left
1427 glTexCoord2f(0.f, 0.f); 1433 gGL.texCoord2f(0.f, 0.f);
1428 glVertex3f(0.f, 0.f, 0.f); 1434 gGL.vertex3f(0.f, 0.f, 0.f);
1429 1435
1430 glTexCoord2f(border_scale.mV[VX], 0.f); 1436 gGL.texCoord2f(border_scale.mV[VX], 0.f);
1431 glVertex3fv(left_border_width.mV); 1437 gGL.vertex3fv(left_border_width.mV);
1432 1438
1433 glTexCoord2f(border_scale.mV[VX], border_scale.mV[VY]); 1439 gGL.texCoord2f(border_scale.mV[VX], border_scale.mV[VY]);
1434 glVertex3fv((left_border_width + bottom_border_height).mV); 1440 gGL.vertex3fv((left_border_width + bottom_border_height).mV);
1435 1441
1436 glTexCoord2f(0.f, border_scale.mV[VY]); 1442 gGL.texCoord2f(0.f, border_scale.mV[VY]);
1437 glVertex3fv(bottom_border_height.mV); 1443 gGL.vertex3fv(bottom_border_height.mV);
1438 1444
1439 // draw bottom middle 1445 // draw bottom middle
1440 glTexCoord2f(border_scale.mV[VX], 0.f); 1446 gGL.texCoord2f(border_scale.mV[VX], 0.f);
1441 glVertex3fv(left_border_width.mV); 1447 gGL.vertex3fv(left_border_width.mV);
1442 1448
1443 glTexCoord2f(1.f - border_scale.mV[VX], 0.f); 1449 gGL.texCoord2f(1.f - border_scale.mV[VX], 0.f);
1444 glVertex3fv((width_vec - right_border_width).mV); 1450 gGL.vertex3fv((width_vec - right_border_width).mV);
1445 1451
1446 glTexCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]); 1452 gGL.texCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]);
1447 glVertex3fv((width_vec - right_border_width + bottom_border_height).mV); 1453 gGL.vertex3fv((width_vec - right_border_width + bottom_border_height).mV);
1448 1454
1449 glTexCoord2f(border_scale.mV[VX], border_scale.mV[VY]); 1455 gGL.texCoord2f(border_scale.mV[VX], border_scale.mV[VY]);
1450 glVertex3fv((left_border_width + bottom_border_height).mV); 1456 gGL.vertex3fv((left_border_width + bottom_border_height).mV);
1451 1457
1452 // draw bottom right 1458 // draw bottom right
1453 glTexCoord2f(1.f - border_scale.mV[VX], 0.f); 1459 gGL.texCoord2f(1.f - border_scale.mV[VX], 0.f);
1454 glVertex3fv((width_vec - right_border_width).mV); 1460 gGL.vertex3fv((width_vec - right_border_width).mV);
1455 1461
1456 glTexCoord2f(1.f, 0.f); 1462 gGL.texCoord2f(1.f, 0.f);
1457 glVertex3fv(width_vec.mV); 1463 gGL.vertex3fv(width_vec.mV);
1458 1464
1459 glTexCoord2f(1.f, border_scale.mV[VY]); 1465 gGL.texCoord2f(1.f, border_scale.mV[VY]);
1460 glVertex3fv((width_vec + bottom_border_height).mV); 1466 gGL.vertex3fv((width_vec + bottom_border_height).mV);
1461 1467
1462 glTexCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]); 1468 gGL.texCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]);
1463 glVertex3fv((width_vec - right_border_width + bottom_border_height).mV); 1469 gGL.vertex3fv((width_vec - right_border_width + bottom_border_height).mV);
1464 1470
1465 // draw left 1471 // draw left
1466 glTexCoord2f(0.f, border_scale.mV[VY]); 1472 gGL.texCoord2f(0.f, border_scale.mV[VY]);
1467 glVertex3fv(bottom_border_height.mV); 1473 gGL.vertex3fv(bottom_border_height.mV);
1468 1474
1469 glTexCoord2f(border_scale.mV[VX], border_scale.mV[VY]); 1475 gGL.texCoord2f(border_scale.mV[VX], border_scale.mV[VY]);
1470 glVertex3fv((left_border_width + bottom_border_height).mV); 1476 gGL.vertex3fv((left_border_width + bottom_border_height).mV);
1471 1477
1472 glTexCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]); 1478 gGL.texCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]);
1473 glVertex3fv((left_border_width + height_vec - top_border_height).mV); 1479 gGL.vertex3fv((left_border_width + height_vec - top_border_height).mV);
1474 1480
1475 glTexCoord2f(0.f, 1.f - border_scale.mV[VY]); 1481 gGL.texCoord2f(0.f, 1.f - border_scale.mV[VY]);
1476 glVertex3fv((height_vec - top_border_height).mV); 1482 gGL.vertex3fv((height_vec - top_border_height).mV);
1477 1483
1478 // draw middle 1484 // draw middle
1479 glTexCoord2f(border_scale.mV[VX], border_scale.mV[VY]); 1485 gGL.texCoord2f(border_scale.mV[VX], border_scale.mV[VY]);
1480 glVertex3fv((left_border_width + bottom_border_height).mV); 1486 gGL.vertex3fv((left_border_width + bottom_border_height).mV);
1481 1487
1482 glTexCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]); 1488 gGL.texCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]);
1483 glVertex3fv((width_vec - right_border_width + bottom_border_height).mV); 1489 gGL.vertex3fv((width_vec - right_border_width + bottom_border_height).mV);
1484 1490
1485 glTexCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]); 1491 gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]);
1486 glVertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV); 1492 gGL.vertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV);
1487 1493
1488 glTexCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]); 1494 gGL.texCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]);
1489 glVertex3fv((left_border_width + height_vec - top_border_height).mV); 1495 gGL.vertex3fv((left_border_width + height_vec - top_border_height).mV);
1490 1496
1491 // draw right 1497 // draw right
1492 glTexCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]); 1498 gGL.texCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]);
1493 glVertex3fv((width_vec - right_border_width + bottom_border_height).mV); 1499 gGL.vertex3fv((width_vec - right_border_width + bottom_border_height).mV);
1494 1500
1495 glTexCoord2f(1.f, border_scale.mV[VY]); 1501 gGL.texCoord2f(1.f, border_scale.mV[VY]);
1496 glVertex3fv((width_vec + bottom_border_height).mV); 1502 gGL.vertex3fv((width_vec + bottom_border_height).mV);
1497 1503
1498 glTexCoord2f(1.f, 1.f - border_scale.mV[VY]); 1504 gGL.texCoord2f(1.f, 1.f - border_scale.mV[VY]);
1499 glVertex3fv((width_vec + height_vec - top_border_height).mV); 1505 gGL.vertex3fv((width_vec + height_vec - top_border_height).mV);
1500 1506
1501 glTexCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]); 1507 gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]);
1502 glVertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV); 1508 gGL.vertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV);
1503 1509
1504 // draw top left 1510 // draw top left
1505 glTexCoord2f(0.f, 1.f - border_scale.mV[VY]); 1511 gGL.texCoord2f(0.f, 1.f - border_scale.mV[VY]);
1506 glVertex3fv((height_vec - top_border_height).mV); 1512 gGL.vertex3fv((height_vec - top_border_height).mV);
1507 1513
1508 glTexCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]); 1514 gGL.texCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]);
1509 glVertex3fv((left_border_width + height_vec - top_border_height).mV); 1515 gGL.vertex3fv((left_border_width + height_vec - top_border_height).mV);
1510 1516
1511 glTexCoord2f(border_scale.mV[VX], 1.f); 1517 gGL.texCoord2f(border_scale.mV[VX], 1.f);
1512 glVertex3fv((left_border_width + height_vec).mV); 1518 gGL.vertex3fv((left_border_width + height_vec).mV);
1513 1519
1514 glTexCoord2f(0.f, 1.f); 1520 gGL.texCoord2f(0.f, 1.f);
1515 glVertex3fv((height_vec).mV); 1521 gGL.vertex3fv((height_vec).mV);
1516 1522
1517 // draw top middle 1523 // draw top middle
1518 glTexCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]); 1524 gGL.texCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]);
1519 glVertex3fv((left_border_width + height_vec - top_border_height).mV); 1525 gGL.vertex3fv((left_border_width + height_vec - top_border_height).mV);
1520 1526
1521 glTexCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]); 1527 gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]);
1522 glVertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV); 1528 gGL.vertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV);
1523 1529
1524 glTexCoord2f(1.f - border_scale.mV[VX], 1.f); 1530 gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f);
1525 glVertex3fv((width_vec - right_border_width + height_vec).mV); 1531 gGL.vertex3fv((width_vec - right_border_width + height_vec).mV);
1526 1532
1527 glTexCoord2f(border_scale.mV[VX], 1.f); 1533 gGL.texCoord2f(border_scale.mV[VX], 1.f);
1528 glVertex3fv((left_border_width + height_vec).mV); 1534 gGL.vertex3fv((left_border_width + height_vec).mV);
1529 1535
1530 // draw top right 1536 // draw top right
1531 glTexCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]); 1537 gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]);
1532 glVertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV); 1538 gGL.vertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV);
1533 1539
1534 glTexCoord2f(1.f, 1.f - border_scale.mV[VY]); 1540 gGL.texCoord2f(1.f, 1.f - border_scale.mV[VY]);
1535 glVertex3fv((width_vec + height_vec - top_border_height).mV); 1541 gGL.vertex3fv((width_vec + height_vec - top_border_height).mV);
1536 1542
1537 glTexCoord2f(1.f, 1.f); 1543 gGL.texCoord2f(1.f, 1.f);
1538 glVertex3fv((width_vec + height_vec).mV); 1544 gGL.vertex3fv((width_vec + height_vec).mV);
1539 1545
1540 glTexCoord2f(1.f - border_scale.mV[VX], 1.f); 1546 gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f);
1541 glVertex3fv((width_vec - right_border_width + height_vec).mV); 1547 gGL.vertex3fv((width_vec - right_border_width + height_vec).mV);
1542 } 1548 }
1543 glEnd(); 1549 gGL.end();
1550
1544} 1551}
1545 1552
1546void gl_segmented_rect_3d_tex_top(const LLVector2& border_scale, const LLVector3& border_width, const LLVector3& border_height, const LLVector3& width_vec, const LLVector3& height_vec) 1553void gl_segmented_rect_3d_tex_top(const LLVector2& border_scale, const LLVector3& border_width, const LLVector3& border_height, const LLVector3& width_vec, const LLVector3& height_vec)
@@ -1588,7 +1595,7 @@ void LLUI::cleanupClass()
1588//static 1595//static
1589void LLUI::translate(F32 x, F32 y, F32 z) 1596void LLUI::translate(F32 x, F32 y, F32 z)
1590{ 1597{
1591 glTranslatef(x,y,z); 1598 gGL.translatef(x,y,z);
1592 LLFontGL::sCurOrigin.mX += (S32) x; 1599 LLFontGL::sCurOrigin.mX += (S32) x;
1593 LLFontGL::sCurOrigin.mY += (S32) y; 1600 LLFontGL::sCurOrigin.mY += (S32) y;
1594 LLFontGL::sCurOrigin.mZ += z; 1601 LLFontGL::sCurOrigin.mZ += z;
@@ -1597,14 +1604,14 @@ void LLUI::translate(F32 x, F32 y, F32 z)
1597//static 1604//static
1598void LLUI::pushMatrix() 1605void LLUI::pushMatrix()
1599{ 1606{
1600 glPushMatrix(); 1607 gGL.pushMatrix();
1601 LLFontGL::sOriginStack.push_back(LLFontGL::sCurOrigin); 1608 LLFontGL::sOriginStack.push_back(LLFontGL::sCurOrigin);
1602} 1609}
1603 1610
1604//static 1611//static
1605void LLUI::popMatrix() 1612void LLUI::popMatrix()
1606{ 1613{
1607 glPopMatrix(); 1614 gGL.popMatrix();
1608 LLFontGL::sCurOrigin = *LLFontGL::sOriginStack.rbegin(); 1615 LLFontGL::sCurOrigin = *LLFontGL::sOriginStack.rbegin();
1609 LLFontGL::sOriginStack.pop_back(); 1616 LLFontGL::sOriginStack.pop_back();
1610} 1617}
@@ -1627,6 +1634,7 @@ void LLUI::setScaleFactor(const LLVector2 &scale_factor)
1627//static 1634//static
1628void LLUI::setLineWidth(F32 width) 1635void LLUI::setLineWidth(F32 width)
1629{ 1636{
1637 gGL.flush();
1630 glLineWidth(width * lerp(sGLScaleFactor.mV[VX], sGLScaleFactor.mV[VY], 0.5f)); 1638 glLineWidth(width * lerp(sGLScaleFactor.mV[VX], sGLScaleFactor.mV[VY], 0.5f));
1631} 1639}
1632 1640
@@ -1644,7 +1652,7 @@ void LLUI::setCursorPositionScreen(S32 x, S32 y)
1644} 1652}
1645 1653
1646//static 1654//static
1647void LLUI::setCursorPositionLocal(LLView* viewp, S32 x, S32 y) 1655void LLUI::setCursorPositionLocal(const LLView* viewp, S32 x, S32 y)
1648{ 1656{
1649 S32 screen_x, screen_y; 1657 S32 screen_x, screen_y;
1650 viewp->localPointToScreen(x, y, &screen_x, &screen_y); 1658 viewp->localPointToScreen(x, y, &screen_x, &screen_y);
@@ -1847,12 +1855,12 @@ void LLUIImage::setScaleRegion(const LLRectf& region)
1847} 1855}
1848 1856
1849//TODO: move drawing implementation inside class 1857//TODO: move drawing implementation inside class
1850void LLUIImage::draw(S32 x, S32 y, const LLColor4& color) 1858void LLUIImage::draw(S32 x, S32 y, const LLColor4& color) const
1851{ 1859{
1852 gl_draw_image(x, y, mImage, color, mClipRegion); 1860 gl_draw_image(x, y, mImage, color, mClipRegion);
1853} 1861}
1854 1862
1855void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) 1863void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const
1856{ 1864{
1857 if (mUniformScaling) 1865 if (mUniformScaling)
1858 { 1866 {
@@ -1871,7 +1879,7 @@ void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color)
1871 } 1879 }
1872} 1880}
1873 1881
1874void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) 1882void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const
1875{ 1883{
1876 gl_draw_scaled_image_with_border( 1884 gl_draw_scaled_image_with_border(
1877 x, y, 1885 x, y,
@@ -1883,7 +1891,7 @@ void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& c
1883 mScaleRegion); 1891 mScaleRegion);
1884} 1892}
1885 1893
1886void LLUIImage::drawSolid(S32 x, S32 y, const LLColor4& color) 1894void LLUIImage::drawSolid(S32 x, S32 y, const LLColor4& color) const
1887{ 1895{
1888 gl_draw_scaled_image_with_border( 1896 gl_draw_scaled_image_with_border(
1889 x, y, 1897 x, y,
@@ -1895,12 +1903,12 @@ void LLUIImage::drawSolid(S32 x, S32 y, const LLColor4& color)
1895 mScaleRegion); 1903 mScaleRegion);
1896} 1904}
1897 1905
1898S32 LLUIImage::getWidth() 1906S32 LLUIImage::getWidth() const
1899{ 1907{
1900 return mImage->getWidth(0); 1908 return mImage->getWidth(0);
1901} 1909}
1902 1910
1903S32 LLUIImage::getHeight() 1911S32 LLUIImage::getHeight() const
1904{ 1912{
1905 return mImage->getHeight(0); 1913 return mImage->getHeight(0);
1906} 1914}
diff --git a/linden/indra/llui/llui.h b/linden/indra/llui/llui.h
index 9d98620..c419cb6 100644
--- a/linden/indra/llui/llui.h
+++ b/linden/indra/llui/llui.h
@@ -1,6 +1,6 @@
1/** 1/**
2 * @file llui.h 2 * @file llui.h
3 * @brief UI implementation 3 * @brief GL function declarations and other general static UI services.
4 * 4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$ 5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 * 6 *
@@ -43,7 +43,10 @@
43#include <stack> 43#include <stack>
44#include "llimagegl.h" 44#include "llimagegl.h"
45 45
46class LLColor4; 46// LLUIFactory
47#include "llsd.h"
48
49class LLColor4;
47class LLVector3; 50class LLVector3;
48class LLVector2; 51class LLVector2;
49class LLUUID; 52class LLUUID;
@@ -147,11 +150,15 @@ inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, BOOL
147extern BOOL gShowTextEditCursor; 150extern BOOL gShowTextEditCursor;
148 151
149class LLImageProviderInterface; 152class LLImageProviderInterface;
153
150typedef void (*LLUIAudioCallback)(const LLUUID& uuid); 154typedef void (*LLUIAudioCallback)(const LLUUID& uuid);
151 155
152class LLUI 156class LLUI
153{ 157{
154public: 158public:
159 //
160 // Methods
161 //
155 static void initClass(LLControlGroup* config, 162 static void initClass(LLControlGroup* config,
156 LLControlGroup* colors, 163 LLControlGroup* colors,
157 LLControlGroup* assets, 164 LLControlGroup* assets,
@@ -169,10 +176,10 @@ public:
169 //helper functions (should probably move free standing rendering helper functions here) 176 //helper functions (should probably move free standing rendering helper functions here)
170 static LLString locateSkin(const LLString& filename); 177 static LLString locateSkin(const LLString& filename);
171 static void setCursorPositionScreen(S32 x, S32 y); 178 static void setCursorPositionScreen(S32 x, S32 y);
172 static void setCursorPositionLocal(LLView* viewp, S32 x, S32 y); 179 static void setCursorPositionLocal(const LLView* viewp, S32 x, S32 y);
173 static void setScaleFactor(const LLVector2& scale_factor); 180 static void setScaleFactor(const LLVector2& scale_factor);
174 static void setLineWidth(F32 width); 181 static void setLineWidth(F32 width);
175 static LLUUID findAssetUUIDByName(const LLString& name); 182 static LLUUID findAssetUUIDByName(const LLString& name);
176 static LLUIImage* getUIImageByName(const LLString& name); 183 static LLUIImage* getUIImageByName(const LLString& name);
177 static LLVector2 getWindowSize(); 184 static LLVector2 getWindowSize();
178 static void screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y); 185 static void screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y);
@@ -181,7 +188,9 @@ public:
181 static void glRectToScreen(const LLRect& gl, LLRect *screen); 188 static void glRectToScreen(const LLRect& gl, LLRect *screen);
182 static void setHtmlHelp(LLHtmlHelp* html_help); 189 static void setHtmlHelp(LLHtmlHelp* html_help);
183 190
184public: 191 //
192 // Data
193 //
185 static LLControlGroup* sConfigGroup; 194 static LLControlGroup* sConfigGroup;
186 static LLControlGroup* sColorsGroup; 195 static LLControlGroup* sColorsGroup;
187 static LLControlGroup* sAssetsGroup; 196 static LLControlGroup* sAssetsGroup;
@@ -215,6 +224,8 @@ typedef enum e_widget_type
215 WIDGET_TYPE_SLIDER, // actually LLSliderCtrl 224 WIDGET_TYPE_SLIDER, // actually LLSliderCtrl
216 WIDGET_TYPE_SLIDER_BAR, // actually LLSlider 225 WIDGET_TYPE_SLIDER_BAR, // actually LLSlider
217 WIDGET_TYPE_VOLUME_SLIDER,//actually LLVolumeSliderCtrl 226 WIDGET_TYPE_VOLUME_SLIDER,//actually LLVolumeSliderCtrl
227 WIDGET_TYPE_MULTI_SLIDER, // actually LLMultiSliderCtrl
228 WIDGET_TYPE_MULTI_SLIDER_BAR, // actually LLMultiSlider
218 WIDGET_TYPE_SPINNER, 229 WIDGET_TYPE_SPINNER,
219 WIDGET_TYPE_TEXT_EDITOR, 230 WIDGET_TYPE_TEXT_EDITOR,
220 WIDGET_TYPE_TEXTURE_PICKER, 231 WIDGET_TYPE_TEXTURE_PICKER,
@@ -287,93 +298,179 @@ typedef enum e_widget_type
287 WIDGET_TYPE_COUNT 298 WIDGET_TYPE_COUNT
288} EWidgetType; 299} EWidgetType;
289 300
290// Manages generation of UI elements by LLSD, such that there is 301// FactoryPolicy is a static class that controls the creation and lookup of UI elements,
291// only one instance per uniquely identified LLSD parameter 302// such as floaters.
292// Class T is the instance type being managed, and INSTANCE_ADDAPTOR 303// The key parameter is used to provide a unique identifier and/or associated construction
293// wraps an instance of the class with handlers for show/hide semantics, etc. 304// parameters for a given UI instance
294template <class T, class INSTANCE_ADAPTOR = T> 305//
295class LLUIInstanceMgr 306// Specialize this traits for different types, or provide a class with an identical interface
307// in the place of the traits parameter
308//
309// For example:
310//
311// template <>
312// class FactoryPolicy<MyClass> /* FactoryPolicy specialized for MyClass */
313// {
314// public:
315// static MyClass* findInstance(const LLSD& key = LLSD())
316// {
317// /* return instance of MyClass associated with key */
318// }
319//
320// static MyClass* createInstance(const LLSD& key = LLSD())
321// {
322// /* create new instance of MyClass using key for construction parameters */
323// }
324// }
325//
326// class MyClass : public LLUIFactory<MyClass>
327// {
328// /* uses FactoryPolicy<MyClass> by default */
329// }
330
331template <class T>
332class FactoryPolicy
333{
334public:
335 // basic factory methods
336 static T* findInstance(const LLSD& key); // unimplemented, provide specialiation
337 static T* createInstance(const LLSD& key); // unimplemented, provide specialiation
338};
339
340// VisibilityPolicy controls the visibility of UI elements, such as floaters.
341// The key parameter is used to store the unique identifier of a given UI instance
342//
343// Specialize this traits for different types, or duplicate this interface for specific instances
344// (see above)
345
346template <class T>
347class VisibilityPolicy
348{
349public:
350 // visibility methods
351 static bool visible(T* instance, const LLSD& key); // unimplemented, provide specialiation
352 static void show(T* instance, const LLSD& key); // unimplemented, provide specialiation
353 static void hide(T* instance, const LLSD& key); // unimplemented, provide specialiation
354};
355
356// Manages generation of UI elements by LLSD, such that (generally) there is
357// a unique instance per distinct LLSD parameter
358// Class T is the instance type being managed, and the FACTORY_POLICY and VISIBILITY_POLICY
359// classes provide static methods for creating, accessing, showing and hiding the associated
360// element T
361template <class T, class FACTORY_POLICY = FactoryPolicy<T>, class VISIBILITY_POLICY = VisibilityPolicy<T> >
362class LLUIFactory
296{ 363{
297public: 364public:
298 LLUIInstanceMgr() 365 // give names to the template parameters so derived classes can refer to them
366 // except this doesn't work in gcc
367 typedef FACTORY_POLICY factory_policy_t;
368 typedef VISIBILITY_POLICY visibility_policy_t;
369
370 LLUIFactory()
299 { 371 {
300 } 372 }
301 373
302 virtual ~LLUIInstanceMgr() 374 virtual ~LLUIFactory()
303 { 375 {
304 } 376 }
305 377
306 // default show and hide methods 378 // default show and hide methods
307 static T* showInstance(const LLSD& seed = LLSD()) 379 static T* showInstance(const LLSD& key = LLSD())
308 { 380 {
309 T* instance = INSTANCE_ADAPTOR::getInstance(seed); 381 T* instance = getInstance(key);
310 INSTANCE_ADAPTOR::show(instance); 382 if (instance != NULL)
383 {
384 VISIBILITY_POLICY::show(instance, key);
385 }
311 return instance; 386 return instance;
312 } 387 }
313 388
314 static void hideInstance(const LLSD& seed = LLSD()) 389 static void hideInstance(const LLSD& key = LLSD())
315 { 390 {
316 T* instance = INSTANCE_ADAPTOR::getInstance(seed); 391 T* instance = getInstance(key);
317 INSTANCE_ADAPTOR::hide(instance); 392 if (instance != NULL)
393 {
394 VISIBILITY_POLICY::hide(instance, key);
395 }
318 } 396 }
319 397
320 static void toggleInstance(const LLSD& seed = LLSD()) 398 static void toggleInstance(const LLSD& key = LLSD())
321 { 399 {
322 if (INSTANCE_ADAPTOR::instanceVisible(seed)) 400 if (instanceVisible(key))
323 { 401 {
324 INSTANCE_ADAPTOR::hideInstance(seed); 402 hideInstance(key);
325 } 403 }
326 else 404 else
327 { 405 {
328 INSTANCE_ADAPTOR::showInstance(seed); 406 showInstance(key);
329 } 407 }
330 } 408 }
331 409
332 static BOOL instanceVisible(const LLSD& seed = LLSD()) 410 static bool instanceVisible(const LLSD& key = LLSD())
333 { 411 {
334 T* instance = INSTANCE_ADAPTOR::findInstance(seed); 412 T* instance = FACTORY_POLICY::findInstance(key);
335 return instance != NULL && INSTANCE_ADAPTOR::visible(instance); 413 return instance != NULL && VISIBILITY_POLICY::visible(instance, key);
336 } 414 }
337 415
338 static T* getInstance(const LLSD& seed = LLSD()) 416 static T* getInstance(const LLSD& key = LLSD())
339 { 417 {
340 T* instance = INSTANCE_ADAPTOR::findInstance(seed); 418 T* instance = FACTORY_POLICY::findInstance(key);
341 if (instance == NULL) 419 if (instance == NULL)
342 { 420 {
343 instance = INSTANCE_ADAPTOR::createInstance(seed); 421 instance = FACTORY_POLICY::createInstance(key);
344 } 422 }
345 return instance; 423 return instance;
346 } 424 }
347 425
348}; 426};
349 427
350// Creates a UI singleton by ignoring the identifying parameter 428
351// and always generating the same instance via the LLUIInstanceMgr interface. 429// Creates a UI singleton by ignoring the identifying parameter
352// Note that since UI elements can be destroyed by their hierarchy, this singleton 430// and always generating the same instance via the LLUIFactory interface.
353// pattern uses a static pointer to an instance that will be re-created as needed. 431// Note that since UI elements can be destroyed by their hierarchy, this singleton
354template <class T, class INSTANCE_ADAPTOR = T> 432// pattern uses a static pointer to an instance that will be re-created as needed.
355class LLUISingleton: public LLUIInstanceMgr<T, INSTANCE_ADAPTOR> 433//
434// Usage Pattern:
435//
436// class LLFloaterFoo : public LLFloater, public LLUISingleton<LLFloaterFoo>
437// {
438// friend class LLUISingleton<LLFloaterFoo>;
439// private:
440// LLFloaterFoo(const LLSD& key);
441// };
442//
443// Note that LLUISingleton takes an option VisibilityPolicy parameter that defines
444// how showInstance(), hideInstance(), etc. work.
445//
446// https://wiki.lindenlab.com/mediawiki/index.php?title=LLUISingleton&oldid=79352
447
448template <class T, class VISIBILITY_POLICY = VisibilityPolicy<T> >
449class LLUISingleton: public LLUIFactory<T, LLUISingleton<T, VISIBILITY_POLICY>, VISIBILITY_POLICY>
356{ 450{
357public: 451protected:
358 // default constructor assumes T is derived from LLUISingleton (a true singleton) 452
359 LLUISingleton() : LLUIInstanceMgr<T, INSTANCE_ADAPTOR>() { sInstance = (T*)this; } 453 // T must derive from LLUISingleton<T>
454 LLUISingleton() { sInstance = static_cast<T*>(this); }
455
360 ~LLUISingleton() { sInstance = NULL; } 456 ~LLUISingleton() { sInstance = NULL; }
361 457
362 static T* findInstance(const LLSD& seed = LLSD()) 458public:
459 static T* findInstance(const LLSD& key = LLSD())
363 { 460 {
364 return sInstance; 461 return sInstance;
365 } 462 }
366 463
367 static T* createInstance(const LLSD& seed = LLSD()) 464 static T* createInstance(const LLSD& key = LLSD())
368 { 465 {
369 if (sInstance == NULL) 466 if (sInstance == NULL)
370 { 467 {
371 sInstance = new T(seed); 468 sInstance = new T(key);
372 } 469 }
373 return sInstance; 470 return sInstance;
374 } 471 }
375 472
376protected: 473private:
377 static T* sInstance; 474 static T* sInstance;
378}; 475};
379 476
@@ -412,14 +509,15 @@ public:
412 void setScaleRegion(const LLRectf& region); 509 void setScaleRegion(const LLRectf& region);
413 510
414 LLPointer<LLImageGL> getImage() { return mImage; } 511 LLPointer<LLImageGL> getImage() { return mImage; }
512 const LLPointer<LLImageGL>& getImage() const { return mImage; }
415 513
416 void draw(S32 x, S32 y, const LLColor4& color = UI_VERTEX_COLOR); 514 void draw(S32 x, S32 y, const LLColor4& color = UI_VERTEX_COLOR) const;
417 void draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color = UI_VERTEX_COLOR); 515 void draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color = UI_VERTEX_COLOR) const;
418 void drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color); 516 void drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const;
419 void drawSolid(S32 x, S32 y, const LLColor4& color); 517 void drawSolid(S32 x, S32 y, const LLColor4& color) const;
420 518
421 S32 getWidth(); 519 S32 getWidth() const;
422 S32 getHeight(); 520 S32 getHeight() const;
423 521
424protected: 522protected:
425 LLRectf mScaleRegion; 523 LLRectf mScaleRegion;
@@ -429,6 +527,140 @@ protected:
429 BOOL mNoClip; 527 BOOL mNoClip;
430}; 528};
431 529
530
531template <typename T>
532class LLTombStone : public LLRefCount
533{
534public:
535 LLTombStone(T* target = NULL) : mTarget(target) {}
536
537 void setTarget(T* target) { mTarget = target; }
538 T* getTarget() const { return mTarget; }
539private:
540 T* mTarget;
541};
542
543// LLHandles are used to refer to objects whose lifetime you do not control or influence.
544// Calling get() on a handle will return a pointer to the referenced object or NULL,
545// if the object no longer exists. Note that during the lifetime of the returned pointer,
546// you are assuming that the object will not be deleted by any action you perform,
547// or any other thread, as normal when using pointers, so avoid using that pointer outside of
548// the local code block.
549//
550// https://wiki.lindenlab.com/mediawiki/index.php?title=LLHandle&oldid=79669
551
552template <typename T>
553class LLHandle
554{
555public:
556 LLHandle() : mTombStone(sDefaultTombStone) {}
557 const LLHandle<T>& operator =(const LLHandle<T>& other)
558 {
559 mTombStone = other.mTombStone;
560 return *this;
561 }
562
563 bool isDead() const
564 {
565 return mTombStone->getTarget() == NULL;
566 }
567
568 void markDead()
569 {
570 mTombStone = sDefaultTombStone;
571 }
572
573 T* get() const
574 {
575 return mTombStone->getTarget();
576 }
577
578 friend bool operator== (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
579 {
580 return lhs.mTombStone == rhs.mTombStone;
581 }
582 friend bool operator!= (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
583 {
584 return !(lhs == rhs);
585 }
586 friend bool operator< (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
587 {
588 return lhs.mTombStone < rhs.mTombStone;
589 }
590 friend bool operator> (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
591 {
592 return lhs.mTombStone > rhs.mTombStone;
593 }
594protected:
595
596protected:
597 LLPointer<LLTombStone<T> > mTombStone;
598
599private:
600 static LLPointer<LLTombStone<T> > sDefaultTombStone;
601};
602
603// initialize static "empty" tombstone pointer
604template <typename T> LLPointer<LLTombStone<T> > LLHandle<T>::sDefaultTombStone = new LLTombStone<T>();
605
606
607template <typename T>
608class LLRootHandle : public LLHandle<T>
609{
610public:
611 LLRootHandle(T* object) { bind(object); }
612 LLRootHandle() {};
613 ~LLRootHandle() { unbind(); }
614
615 // this is redundant, since a LLRootHandle *is* an LLHandle
616 LLHandle<T> getHandle() { return LLHandle<T>(*this); }
617
618 void bind(T* object)
619 {
620 // unbind existing tombstone
621 if (LLHandle<T>::mTombStone.notNull())
622 {
623 if (LLHandle<T>::mTombStone->getTarget() == object) return;
624 LLHandle<T>::mTombStone->setTarget(NULL);
625 }
626 // tombstone reference counted, so no paired delete
627 LLHandle<T>::mTombStone = new LLTombStone<T>(object);
628 }
629
630 void unbind()
631 {
632 LLHandle<T>::mTombStone->setTarget(NULL);
633 }
634
635 //don't allow copying of root handles, since there should only be one
636private:
637 LLRootHandle(const LLRootHandle& other) {};
638};
639
640// Use this as a mixin for simple classes that need handles and when you don't
641// want handles at multiple points of the inheritance hierarchy
642template <typename T>
643class LLHandleProvider
644{
645protected:
646 typedef LLHandle<T> handle_type_t;
647 LLHandleProvider()
648 {
649 // provided here to enforce T deriving from LLHandleProvider<T>
650 }
651
652 LLHandle<T> getHandle()
653 {
654 // perform lazy binding to avoid small tombstone allocations for handle
655 // providers whose handles are never referenced
656 mHandle.bind(static_cast<T*>(this));
657 return mHandle;
658 }
659
660private:
661 LLRootHandle<T> mHandle;
662};
663
432//RN: maybe this needs to moved elsewhere? 664//RN: maybe this needs to moved elsewhere?
433class LLImageProviderInterface 665class LLImageProviderInterface
434{ 666{
diff --git a/linden/indra/llui/llui.vcproj b/linden/indra/llui/llui.vcproj
index dad42c6..f5e7df5 100644
--- a/linden/indra/llui/llui.vcproj
+++ b/linden/indra/llui/llui.vcproj
@@ -26,6 +26,7 @@
26 RuntimeLibrary="1" 26 RuntimeLibrary="1"
27 StructMemberAlignment="4" 27 StructMemberAlignment="4"
28 ForceConformanceInForLoopScope="TRUE" 28 ForceConformanceInForLoopScope="TRUE"
29 RuntimeTypeInfo="TRUE"
29 UsePrecompiledHeader="0" 30 UsePrecompiledHeader="0"
30 WarningLevel="3" 31 WarningLevel="3"
31 WarnAsError="TRUE" 32 WarnAsError="TRUE"
@@ -69,6 +70,7 @@
69 RuntimeLibrary="0" 70 RuntimeLibrary="0"
70 StructMemberAlignment="0" 71 StructMemberAlignment="0"
71 ForceConformanceInForLoopScope="TRUE" 72 ForceConformanceInForLoopScope="TRUE"
73 RuntimeTypeInfo="TRUE"
72 UsePrecompiledHeader="0" 74 UsePrecompiledHeader="0"
73 WarningLevel="3" 75 WarningLevel="3"
74 WarnAsError="TRUE" 76 WarnAsError="TRUE"
@@ -113,6 +115,7 @@
113 RuntimeLibrary="0" 115 RuntimeLibrary="0"
114 StructMemberAlignment="0" 116 StructMemberAlignment="0"
115 ForceConformanceInForLoopScope="TRUE" 117 ForceConformanceInForLoopScope="TRUE"
118 RuntimeTypeInfo="TRUE"
116 UsePrecompiledHeader="0" 119 UsePrecompiledHeader="0"
117 WarningLevel="3" 120 WarningLevel="3"
118 WarnAsError="TRUE" 121 WarnAsError="TRUE"
@@ -196,6 +199,12 @@
196 RelativePath=".\llmodaldialog.cpp"> 199 RelativePath=".\llmodaldialog.cpp">
197 </File> 200 </File>
198 <File 201 <File
202 RelativePath=".\llmultislider.cpp">
203 </File>
204 <File
205 RelativePath=".\llmultisliderctrl.cpp">
206 </File>
207 <File
199 RelativePath=".\llpanel.cpp"> 208 RelativePath=".\llpanel.cpp">
200 </File> 209 </File>
201 <File 210 <File
@@ -333,6 +342,12 @@
333 RelativePath=".\llmodaldialog.h"> 342 RelativePath=".\llmodaldialog.h">
334 </File> 343 </File>
335 <File 344 <File
345 RelativePath=".\llmultislider.h">
346 </File>
347 <File
348 RelativePath=".\llmultisliderctrl.h">
349 </File>
350 <File
336 RelativePath=".\llpanel.h"> 351 RelativePath=".\llpanel.h">
337 </File> 352 </File>
338 <File 353 <File
@@ -399,6 +414,9 @@
399 RelativePath=".\lluictrlfactory.h"> 414 RelativePath=".\lluictrlfactory.h">
400 </File> 415 </File>
401 <File 416 <File
417 RelativePath=".\lluifwd.h">
418 </File>
419 <File
402 RelativePath=".\lluistring.h"> 420 RelativePath=".\lluistring.h">
403 </File> 421 </File>
404 <File 422 <File
diff --git a/linden/indra/llui/llui_vc8.vcproj b/linden/indra/llui/llui_vc8.vcproj
index 71fdc83..daef3f6 100644
--- a/linden/indra/llui/llui_vc8.vcproj
+++ b/linden/indra/llui/llui_vc8.vcproj
@@ -1,595 +1,611 @@
1<?xml version="1.0" encoding="Windows-1252"?> 1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject 2<VisualStudioProject
3 ProjectType="Visual C++" 3 ProjectType="Visual C++"
4 Version="8.00" 4 Version="8.00"
5 Name="llui" 5 Name="llui"
6 ProjectGUID="{DE55D666-6A3D-476C-937F-109269B83681}" 6 ProjectGUID="{DE55D666-6A3D-476C-937F-109269B83681}"
7 RootNamespace="llui" 7 RootNamespace="llui"
8 Keyword="Win32Proj" 8 Keyword="Win32Proj"
9 > 9 >
10 <Platforms> 10 <Platforms>
11 <Platform 11 <Platform
12 Name="Win32" 12 Name="Win32"
13 /> 13 />
14 </Platforms> 14 </Platforms>
15 <ToolFiles> 15 <ToolFiles>
16 </ToolFiles> 16 </ToolFiles>
17 <Configurations> 17 <Configurations>
18 <Configuration 18 <Configuration
19 Name="Debug|Win32" 19 Name="Debug|Win32"
20 OutputDirectory="../lib_$(ConfigurationName)/i686-win32" 20 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
21 IntermediateDirectory="Debug" 21 IntermediateDirectory="Debug"
22 ConfigurationType="4" 22 ConfigurationType="4"
23 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" 23 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
24 CharacterSet="1" 24 CharacterSet="1"
25 > 25 >
26 <Tool 26 <Tool
27 Name="VCPreBuildEventTool" 27 Name="VCPreBuildEventTool"
28 /> 28 />
29 <Tool 29 <Tool
30 Name="VCCustomBuildTool" 30 Name="VCCustomBuildTool"
31 /> 31 />
32 <Tool 32 <Tool
33 Name="VCXMLDataGeneratorTool" 33 Name="VCXMLDataGeneratorTool"
34 /> 34 />
35 <Tool 35 <Tool
36 Name="VCWebServiceProxyGeneratorTool" 36 Name="VCWebServiceProxyGeneratorTool"
37 /> 37 />
38 <Tool 38 <Tool
39 Name="VCMIDLTool" 39 Name="VCMIDLTool"
40 /> 40 />
41 <Tool 41 <Tool
42 Name="VCCLCompilerTool" 42 Name="VCCLCompilerTool"
43 Optimization="0" 43 Optimization="0"
44 AdditionalIncludeDirectories="..\llmath;..\llvfs;..\llcommon;..\llprimitive;..\llwindow;..\llrender;..\llimage;..\llaudio;..\llxml;..\llmessage;&quot;..\..\libraries\i686-win32\include&quot;;..\..\libraries\include\" 44 AdditionalIncludeDirectories="..\llmath;..\llvfs;..\llcommon;..\llprimitive;..\llwindow;..\llrender;..\llimage;..\llaudio;..\llxml;..\llmessage;&quot;..\..\libraries\i686-win32\include&quot;;..\..\libraries\include\"
45 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG" 45 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG"
46 MinimalRebuild="true" 46 MinimalRebuild="true"
47 BasicRuntimeChecks="3" 47 BasicRuntimeChecks="3"
48 RuntimeLibrary="1" 48 RuntimeLibrary="1"
49 StructMemberAlignment="4" 49 StructMemberAlignment="4"
50 TreatWChar_tAsBuiltInType="false" 50 TreatWChar_tAsBuiltInType="false"
51 ForceConformanceInForLoopScope="true" 51 ForceConformanceInForLoopScope="true"
52 UsePrecompiledHeader="0" 52 UsePrecompiledHeader="0"
53 WarningLevel="3" 53 WarningLevel="3"
54 WarnAsError="true" 54 WarnAsError="true"
55 Detect64BitPortabilityProblems="false" 55 Detect64BitPortabilityProblems="false"
56 DebugInformationFormat="4" 56 DebugInformationFormat="4"
57 /> 57 />
58 <Tool 58 <Tool
59 Name="VCManagedResourceCompilerTool" 59 Name="VCManagedResourceCompilerTool"
60 /> 60 />
61 <Tool 61 <Tool
62 Name="VCResourceCompilerTool" 62 Name="VCResourceCompilerTool"
63 /> 63 />
64 <Tool 64 <Tool
65 Name="VCPreLinkEventTool" 65 Name="VCPreLinkEventTool"
66 /> 66 />
67 <Tool 67 <Tool
68 Name="VCLibrarianTool" 68 Name="VCLibrarianTool"
69 OutputFile="$(OutDir)/llui.lib" 69 OutputFile="$(OutDir)/llui.lib"
70 /> 70 />
71 <Tool 71 <Tool
72 Name="VCALinkTool" 72 Name="VCALinkTool"
73 /> 73 />
74 <Tool 74 <Tool
75 Name="VCXDCMakeTool" 75 Name="VCXDCMakeTool"
76 /> 76 />
77 <Tool 77 <Tool
78 Name="VCBscMakeTool" 78 Name="VCBscMakeTool"
79 /> 79 />
80 <Tool 80 <Tool
81 Name="VCFxCopTool" 81 Name="VCFxCopTool"
82 /> 82 />
83 <Tool 83 <Tool
84 Name="VCPostBuildEventTool" 84 Name="VCPostBuildEventTool"
85 /> 85 />
86 </Configuration> 86 </Configuration>
87 <Configuration 87 <Configuration
88 Name="Release|Win32" 88 Name="Release|Win32"
89 OutputDirectory="../lib_$(ConfigurationName)/i686-win32" 89 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
90 IntermediateDirectory="Release" 90 IntermediateDirectory="Release"
91 ConfigurationType="4" 91 ConfigurationType="4"
92 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" 92 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
93 CharacterSet="1" 93 CharacterSet="1"
94 > 94 >
95 <Tool 95 <Tool
96 Name="VCPreBuildEventTool" 96 Name="VCPreBuildEventTool"
97 /> 97 />
98 <Tool 98 <Tool
99 Name="VCCustomBuildTool" 99 Name="VCCustomBuildTool"
100 /> 100 />
101 <Tool 101 <Tool
102 Name="VCXMLDataGeneratorTool" 102 Name="VCXMLDataGeneratorTool"
103 /> 103 />
104 <Tool 104 <Tool
105 Name="VCWebServiceProxyGeneratorTool" 105 Name="VCWebServiceProxyGeneratorTool"
106 /> 106 />
107 <Tool 107 <Tool
108 Name="VCMIDLTool" 108 Name="VCMIDLTool"
109 /> 109 />
110 <Tool 110 <Tool
111 Name="VCCLCompilerTool" 111 Name="VCCLCompilerTool"
112 AdditionalOptions="/Oy-" 112 AdditionalOptions="/Oy-"
113 AdditionalIncludeDirectories="..\llmath;..\llvfs;..\llcommon;..\llprimitive;..\llwindow;..\llrender;..\llimage;..\llaudio;..\llxml;..\llmessage;&quot;..\..\libraries\i686-win32\include&quot;;..\..\libraries\include\" 113 AdditionalIncludeDirectories="..\llmath;..\llvfs;..\llcommon;..\llprimitive;..\llwindow;..\llrender;..\llimage;..\llaudio;..\llxml;..\llmessage;&quot;..\..\libraries\i686-win32\include&quot;;..\..\libraries\include\"
114 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE" 114 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE"
115 RuntimeLibrary="0" 115 RuntimeLibrary="0"
116 StructMemberAlignment="0" 116 StructMemberAlignment="0"
117 TreatWChar_tAsBuiltInType="false" 117 TreatWChar_tAsBuiltInType="false"
118 ForceConformanceInForLoopScope="true" 118 ForceConformanceInForLoopScope="true"
119 UsePrecompiledHeader="0" 119 UsePrecompiledHeader="0"
120 WarningLevel="3" 120 WarningLevel="3"
121 WarnAsError="true" 121 WarnAsError="true"
122 Detect64BitPortabilityProblems="false" 122 Detect64BitPortabilityProblems="false"
123 DebugInformationFormat="3" 123 DebugInformationFormat="3"
124 /> 124 />
125 <Tool 125 <Tool
126 Name="VCManagedResourceCompilerTool" 126 Name="VCManagedResourceCompilerTool"
127 /> 127 />
128 <Tool 128 <Tool
129 Name="VCResourceCompilerTool" 129 Name="VCResourceCompilerTool"
130 /> 130 />
131 <Tool 131 <Tool
132 Name="VCPreLinkEventTool" 132 Name="VCPreLinkEventTool"
133 /> 133 />
134 <Tool 134 <Tool
135 Name="VCLibrarianTool" 135 Name="VCLibrarianTool"
136 OutputFile="$(OutDir)/llui.lib" 136 OutputFile="$(OutDir)/llui.lib"
137 /> 137 />
138 <Tool 138 <Tool
139 Name="VCALinkTool" 139 Name="VCALinkTool"
140 /> 140 />
141 <Tool 141 <Tool
142 Name="VCXDCMakeTool" 142 Name="VCXDCMakeTool"
143 /> 143 />
144 <Tool 144 <Tool
145 Name="VCBscMakeTool" 145 Name="VCBscMakeTool"
146 /> 146 />
147 <Tool 147 <Tool
148 Name="VCFxCopTool" 148 Name="VCFxCopTool"
149 /> 149 />
150 <Tool 150 <Tool
151 Name="VCPostBuildEventTool" 151 Name="VCPostBuildEventTool"
152 /> 152 />
153 </Configuration> 153 </Configuration>
154 <Configuration 154 <Configuration
155 Name="ReleaseNoOpt|Win32" 155 Name="ReleaseNoOpt|Win32"
156 OutputDirectory="../lib_$(ConfigurationName)/i686-win32" 156 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
157 IntermediateDirectory="$(ConfigurationName)" 157 IntermediateDirectory="$(ConfigurationName)"
158 ConfigurationType="4" 158 ConfigurationType="4"
159 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" 159 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
160 CharacterSet="1" 160 CharacterSet="1"
161 > 161 >
162 <Tool 162 <Tool
163 Name="VCPreBuildEventTool" 163 Name="VCPreBuildEventTool"
164 /> 164 />
165 <Tool 165 <Tool
166 Name="VCCustomBuildTool" 166 Name="VCCustomBuildTool"
167 /> 167 />
168 <Tool 168 <Tool
169 Name="VCXMLDataGeneratorTool" 169 Name="VCXMLDataGeneratorTool"
170 /> 170 />
171 <Tool 171 <Tool
172 Name="VCWebServiceProxyGeneratorTool" 172 Name="VCWebServiceProxyGeneratorTool"
173 /> 173 />
174 <Tool 174 <Tool
175 Name="VCMIDLTool" 175 Name="VCMIDLTool"
176 /> 176 />
177 <Tool 177 <Tool
178 Name="VCCLCompilerTool" 178 Name="VCCLCompilerTool"
179 AdditionalOptions="/Oy-" 179 AdditionalOptions="/Oy-"
180 Optimization="0" 180 Optimization="0"
181 AdditionalIncludeDirectories="..\llmath;..\llvfs;..\llcommon;..\llprimitive;..\llwindow;..\llrender;..\llimage;..\llaudio;..\llxml;..\llmessage;&quot;..\..\libraries\i686-win32\include&quot;;..\..\libraries\include\" 181 AdditionalIncludeDirectories="..\llmath;..\llvfs;..\llcommon;..\llprimitive;..\llwindow;..\llrender;..\llimage;..\llaudio;..\llxml;..\llmessage;&quot;..\..\libraries\i686-win32\include&quot;;..\..\libraries\include\"
182 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE" 182 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE"
183 RuntimeLibrary="0" 183 RuntimeLibrary="0"
184 StructMemberAlignment="0" 184 StructMemberAlignment="0"
185 TreatWChar_tAsBuiltInType="false" 185 TreatWChar_tAsBuiltInType="false"
186 ForceConformanceInForLoopScope="true" 186 ForceConformanceInForLoopScope="true"
187 UsePrecompiledHeader="0" 187 UsePrecompiledHeader="0"
188 WarningLevel="3" 188 WarningLevel="3"
189 WarnAsError="true" 189 WarnAsError="true"
190 Detect64BitPortabilityProblems="false" 190 Detect64BitPortabilityProblems="false"
191 DebugInformationFormat="3" 191 DebugInformationFormat="3"
192 /> 192 />
193 <Tool 193 <Tool
194 Name="VCManagedResourceCompilerTool" 194 Name="VCManagedResourceCompilerTool"
195 /> 195 />
196 <Tool 196 <Tool
197 Name="VCResourceCompilerTool" 197 Name="VCResourceCompilerTool"
198 /> 198 />
199 <Tool 199 <Tool
200 Name="VCPreLinkEventTool" 200 Name="VCPreLinkEventTool"
201 /> 201 />
202 <Tool 202 <Tool
203 Name="VCLibrarianTool" 203 Name="VCLibrarianTool"
204 OutputFile="$(OutDir)/llui.lib" 204 OutputFile="$(OutDir)/llui.lib"
205 /> 205 />
206 <Tool 206 <Tool
207 Name="VCALinkTool" 207 Name="VCALinkTool"
208 /> 208 />
209 <Tool 209 <Tool
210 Name="VCXDCMakeTool" 210 Name="VCXDCMakeTool"
211 /> 211 />
212 <Tool 212 <Tool
213 Name="VCBscMakeTool" 213 Name="VCBscMakeTool"
214 /> 214 />
215 <Tool 215 <Tool
216 Name="VCFxCopTool" 216 Name="VCFxCopTool"
217 /> 217 />
218 <Tool 218 <Tool
219 Name="VCPostBuildEventTool" 219 Name="VCPostBuildEventTool"
220 /> 220 />
221 </Configuration> 221 </Configuration>
222 </Configurations> 222 </Configurations>
223 <References> 223 <References>
224 </References> 224 </References>
225 <Files> 225 <Files>
226 <Filter 226 <Filter
227 Name="Source Files" 227 Name="Source Files"
228 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" 228 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
229 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" 229 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
230 > 230 >
231 <File 231 <File
232 RelativePath=".\llalertdialog.cpp" 232 RelativePath=".\llalertdialog.cpp"
233 > 233 >
234 </File> 234 </File>
235 <File 235 <File
236 RelativePath=".\llbutton.cpp" 236 RelativePath=".\llbutton.cpp"
237 > 237 >
238 </File> 238 </File>
239 <File 239 <File
240 RelativePath=".\llcheckboxctrl.cpp" 240 RelativePath=".\llcheckboxctrl.cpp"
241 > 241 >
242 </File> 242 </File>
243 <File 243 <File
244 RelativePath=".\llclipboard.cpp" 244 RelativePath=".\llclipboard.cpp"
245 > 245 >
246 </File> 246 </File>
247 <File 247 <File
248 RelativePath=".\llcombobox.cpp" 248 RelativePath=".\llcombobox.cpp"
249 > 249 >
250 </File> 250 </File>
251 <File 251 <File
252 RelativePath=".\llctrlselectioninterface.cpp" 252 RelativePath=".\llctrlselectioninterface.cpp"
253 > 253 >
254 </File> 254 </File>
255 <File 255 <File
256 RelativePath=".\lldraghandle.cpp" 256 RelativePath=".\lldraghandle.cpp"
257 > 257 >
258 </File> 258 </File>
259 <File 259 <File
260 RelativePath=".\lleditmenuhandler.cpp" 260 RelativePath=".\lleditmenuhandler.cpp"
261 > 261 >
262 </File> 262 </File>
263 <File 263 <File
264 RelativePath=".\llfloater.cpp" 264 RelativePath=".\llfloater.cpp"
265 > 265 >
266 </File> 266 </File>
267 <File 267 <File
268 RelativePath=".\llfocusmgr.cpp" 268 RelativePath=".\llfocusmgr.cpp"
269 > 269 >
270 </File> 270 </File>
271 <File 271 <File
272 RelativePath=".\lliconctrl.cpp" 272 RelativePath=".\lliconctrl.cpp"
273 > 273 >
274 </File> 274 </File>
275 <File 275 <File
276 RelativePath=".\llkeywords.cpp" 276 RelativePath=".\llkeywords.cpp"
277 > 277 >
278 </File> 278 </File>
279 <File 279 <File
280 RelativePath=".\lllineeditor.cpp" 280 RelativePath=".\lllineeditor.cpp"
281 > 281 >
282 </File> 282 </File>
283 <File 283 <File
284 RelativePath=".\llmenugl.cpp" 284 RelativePath=".\llmenugl.cpp"
285 > 285 >
286 </File> 286 </File>
287 <File 287 <File
288 RelativePath=".\llmodaldialog.cpp" 288 RelativePath=".\llmodaldialog.cpp"
289 > 289 >
290 </File> 290 </File>
291 <File 291 <File
292 RelativePath=".\llpanel.cpp" 292 RelativePath=".\llmultislider.cpp"
293 > 293 >
294 </File> 294 </File>
295 <File 295 <File
296 RelativePath=".\llradiogroup.cpp" 296 RelativePath=".\llmultisliderctrl.cpp"
297 > 297 >
298 </File> 298 </File>
299 <File 299 <File
300 RelativePath=".\llresizebar.cpp" 300 RelativePath=".\llpanel.cpp"
301 > 301 >
302 </File> 302 </File>
303 <File 303 <File
304 RelativePath=".\llresizehandle.cpp" 304 RelativePath=".\llradiogroup.cpp"
305 > 305 >
306 </File> 306 </File>
307 <File 307 <File
308 RelativePath=".\llresmgr.cpp" 308 RelativePath=".\llresizebar.cpp"
309 > 309 >
310 </File> 310 </File>
311 <File 311 <File
312 RelativePath=".\llrootview.cpp" 312 RelativePath=".\llresizehandle.cpp"
313 > 313 >
314 </File> 314 </File>
315 <File 315 <File
316 RelativePath=".\llscrollbar.cpp" 316 RelativePath=".\llresmgr.cpp"
317 > 317 >
318 </File> 318 </File>
319 <File 319 <File
320 RelativePath=".\llscrollcontainer.cpp" 320 RelativePath=".\llrootview.cpp"
321 > 321 >
322 </File> 322 </File>
323 <File 323 <File
324 RelativePath=".\llscrollingpanellist.cpp" 324 RelativePath=".\llscrollbar.cpp"
325 > 325 >
326 </File> 326 </File>
327 <File 327 <File
328 RelativePath=".\llscrolllistctrl.cpp" 328 RelativePath=".\llscrollcontainer.cpp"
329 > 329 >
330 </File> 330 </File>
331 <File 331 <File
332 RelativePath=".\llslider.cpp" 332 RelativePath=".\llscrollingpanellist.cpp"
333 > 333 >
334 </File> 334 </File>
335 <File 335 <File
336 RelativePath=".\llsliderctrl.cpp" 336 RelativePath=".\llscrolllistctrl.cpp"
337 > 337 >
338 </File> 338 </File>
339 <File 339 <File
340 RelativePath=".\llspinctrl.cpp" 340 RelativePath=".\llslider.cpp"
341 > 341 >
342 </File> 342 </File>
343 <File 343 <File
344 RelativePath=".\llstyle.cpp" 344 RelativePath=".\llsliderctrl.cpp"
345 > 345 >
346 </File> 346 </File>
347 <File 347 <File
348 RelativePath=".\lltabcontainer.cpp" 348 RelativePath=".\llspinctrl.cpp"
349 > 349 >
350 </File> 350 </File>
351 <File 351 <File
352 RelativePath=".\lltabcontainervertical.cpp" 352 RelativePath=".\llstyle.cpp"
353 > 353 >
354 </File> 354 </File>
355 <File 355 <File
356 RelativePath=".\lltextbox.cpp" 356 RelativePath=".\lltabcontainer.cpp"
357 > 357 >
358 </File> 358 </File>
359 <File 359 <File
360 RelativePath=".\lltexteditor.cpp" 360 RelativePath=".\lltabcontainervertical.cpp"
361 > 361 >
362 </File> 362 </File>
363 <File 363 <File
364 RelativePath=".\llui.cpp" 364 RelativePath=".\lltextbox.cpp"
365 > 365 >
366 </File> 366 </File>
367 <File 367 <File
368 RelativePath=".\lluictrl.cpp" 368 RelativePath=".\lltexteditor.cpp"
369 > 369 >
370 </File> 370 </File>
371 <File 371 <File
372 RelativePath=".\lluictrlfactory.cpp" 372 RelativePath=".\llui.cpp"
373 > 373 >
374 </File> 374 </File>
375 <File 375 <File
376 RelativePath=".\lluistring.cpp" 376 RelativePath=".\lluictrl.cpp"
377 > 377 >
378 </File> 378 </File>
379 <File 379 <File
380 RelativePath=".\llundo.cpp" 380 RelativePath=".\lluictrlfactory.cpp"
381 > 381 >
382 </File> 382 </File>
383 <File 383 <File
384 RelativePath=".\llview.cpp" 384 RelativePath=".\lluistring.cpp"
385 > 385 >
386 </File> 386 </File>
387 <File 387 <File
388 RelativePath=".\llviewborder.cpp" 388 RelativePath=".\llundo.cpp"
389 > 389 >
390 </File> 390 </File>
391 <File 391 <File
392 RelativePath=".\llviewquery.cpp" 392 RelativePath=".\llview.cpp"
393 > 393 >
394 </File> 394 </File>
395 </Filter> 395 <File
396 <Filter 396 RelativePath=".\llviewborder.cpp"
397 Name="Header Files" 397 >
398 Filter="h;hpp;hxx;hm;inl;inc;xsd" 398 </File>
399 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" 399 <File
400 > 400 RelativePath=".\llviewquery.cpp"
401 <File 401 >
402 RelativePath=".\llalertdialog.h" 402 </File>
403 > 403 </Filter>
404 </File> 404 <Filter
405 <File 405 Name="Header Files"
406 RelativePath=".\llbutton.h" 406 Filter="h;hpp;hxx;hm;inl;inc;xsd"
407 > 407 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
408 </File> 408 >
409 <File 409 <File
410 RelativePath=".\llcallbackmap.h" 410 RelativePath=".\llalertdialog.h"
411 > 411 >
412 </File> 412 </File>
413 <File 413 <File
414 RelativePath=".\llcheckboxctrl.h" 414 RelativePath=".\llbutton.h"
415 > 415 >
416 </File> 416 </File>
417 <File 417 <File
418 RelativePath=".\llclipboard.h" 418 RelativePath=".\llcallbackmap.h"
419 > 419 >
420 </File> 420 </File>
421 <File 421 <File
422 RelativePath=".\llcombobox.h" 422 RelativePath=".\llcheckboxctrl.h"
423 > 423 >
424 </File> 424 </File>
425 <File 425 <File
426 RelativePath=".\llctrlselectioninterface.h" 426 RelativePath=".\llclipboard.h"
427 > 427 >
428 </File> 428 </File>
429 <File 429 <File
430 RelativePath=".\lldraghandle.h" 430 RelativePath=".\llcombobox.h"
431 > 431 >
432 </File> 432 </File>
433 <File 433 <File
434 RelativePath=".\lleditmenuhandler.h" 434 RelativePath=".\llctrlselectioninterface.h"
435 > 435 >
436 </File> 436 </File>
437 <File 437 <File
438 RelativePath=".\llfloater.h" 438 RelativePath=".\lldraghandle.h"
439 > 439 >
440 </File> 440 </File>
441 <File 441 <File
442 RelativePath=".\llfocusmgr.h" 442 RelativePath=".\lleditmenuhandler.h"
443 > 443 >
444 </File> 444 </File>
445 <File 445 <File
446 RelativePath=".\llhtmlhelp.h" 446 RelativePath=".\llfloater.h"
447 > 447 >
448 </File> 448 </File>
449 <File 449 <File
450 RelativePath=".\lliconctrl.h" 450 RelativePath=".\llfocusmgr.h"
451 > 451 >
452 </File> 452 </File>
453 <File 453 <File
454 RelativePath=".\llkeywords.h" 454 RelativePath=".\llhtmlhelp.h"
455 > 455 >
456 </File> 456 </File>
457 <File 457 <File
458 RelativePath=".\lllineeditor.h" 458 RelativePath=".\lliconctrl.h"
459 > 459 >
460 </File> 460 </File>
461 <File 461 <File
462 RelativePath=".\llmemberlistener.h" 462 RelativePath=".\llkeywords.h"
463 > 463 >
464 </File> 464 </File>
465 <File 465 <File
466 RelativePath=".\llmenugl.h" 466 RelativePath=".\lllineeditor.h"
467 > 467 >
468 </File> 468 </File>
469 <File 469 <File
470 RelativePath=".\llmodaldialog.h" 470 RelativePath=".\llmemberlistener.h"
471 > 471 >
472 </File> 472 </File>
473 <File 473 <File
474 RelativePath=".\llpanel.h" 474 RelativePath=".\llmenugl.h"
475 > 475 >
476 </File> 476 </File>
477 <File 477 <File
478 RelativePath=".\llradiogroup.h" 478 RelativePath=".\llmodaldialog.h"
479 > 479 >
480 </File> 480 </File>
481 <File 481 <File
482 RelativePath=".\llresizebar.h" 482 RelativePath=".\llmultislider.h"
483 > 483 >
484 </File> 484 </File>
485 <File 485 <File
486 RelativePath=".\llresizehandle.h" 486 RelativePath=".\llmultisliderctrl.h"
487 > 487 >
488 </File> 488 </File>
489 <File 489 <File
490 RelativePath=".\llresmgr.h" 490 RelativePath=".\llpanel.h"
491 > 491 >
492 </File> 492 </File>
493 <File 493 <File
494 RelativePath=".\llrootview.h" 494 RelativePath=".\llradiogroup.h"
495 > 495 >
496 </File> 496 </File>
497 <File 497 <File
498 RelativePath=".\llscrollbar.h" 498 RelativePath=".\llresizebar.h"
499 > 499 >
500 </File> 500 </File>
501 <File 501 <File
502 RelativePath=".\llscrollcontainer.h" 502 RelativePath=".\llresizehandle.h"
503 > 503 >
504 </File> 504 </File>
505 <File 505 <File
506 RelativePath=".\llscrollingpanellist.h" 506 RelativePath=".\llresmgr.h"
507 > 507 >
508 </File> 508 </File>
509 <File 509 <File
510 RelativePath=".\llscrolllistctrl.h" 510 RelativePath=".\llrootview.h"
511 > 511 >
512 </File> 512 </File>
513 <File 513 <File
514 RelativePath=".\llslider.h" 514 RelativePath=".\llscrollbar.h"
515 > 515 >
516 </File> 516 </File>
517 <File 517 <File
518 RelativePath=".\llsliderctrl.h" 518 RelativePath=".\llscrollcontainer.h"
519 > 519 >
520 </File> 520 </File>
521 <File 521 <File
522 RelativePath=".\llspinctrl.h" 522 RelativePath=".\llscrollingpanellist.h"
523 > 523 >
524 </File> 524 </File>
525 <File 525 <File
526 RelativePath=".\llstyle.h" 526 RelativePath=".\llscrolllistctrl.h"
527 > 527 >
528 </File> 528 </File>
529 <File 529 <File
530 RelativePath=".\lltabcontainer.h" 530 RelativePath=".\llslider.h"
531 > 531 >
532 </File> 532 </File>
533 <File 533 <File
534 RelativePath=".\lltabcontainervertical.h" 534 RelativePath=".\llsliderctrl.h"
535 > 535 >
536 </File> 536 </File>
537 <File 537 <File
538 RelativePath=".\lltextbox.h" 538 RelativePath=".\llspinctrl.h"
539 > 539 >
540 </File> 540 </File>
541 <File 541 <File
542 RelativePath=".\lltexteditor.h" 542 RelativePath=".\llstyle.h"
543 > 543 >
544 </File> 544 </File>
545 <File 545 <File
546 RelativePath=".\llui.h" 546 RelativePath=".\lltabcontainer.h"
547 > 547 >
548 </File> 548 </File>
549 <File 549 <File
550 RelativePath=".\lluiconstants.h" 550 RelativePath=".\lltabcontainervertical.h"
551 > 551 >
552 </File> 552 </File>
553 <File 553 <File
554 RelativePath=".\lluictrl.h" 554 RelativePath=".\lltextbox.h"
555 > 555 >
556 </File> 556 </File>
557 <File 557 <File
558 RelativePath=".\lluictrlfactory.h" 558 RelativePath=".\lltexteditor.h"
559 > 559 >
560 </File> 560 </File>
561 <File 561 <File
562 RelativePath=".\lluistring.h" 562 RelativePath=".\llui.h"
563 > 563 >
564 </File> 564 </File>
565 <File 565 <File
566 RelativePath=".\lluixmltags.h" 566 RelativePath=".\lluiconstants.h"
567 > 567 >
568 </File> 568 </File>
569 <File 569 <File
570 RelativePath=".\llundo.h" 570 RelativePath=".\lluictrl.h"
571 > 571 >
572 </File> 572 </File>
573 <File 573 <File
574 RelativePath=".\llview.h" 574 RelativePath=".\lluictrlfactory.h"
575 > 575 >
576 </File> 576 </File>
577 <File 577 <File
578 RelativePath=".\llviewborder.h" 578 RelativePath=".\lluistring.h"
579 > 579 >
580 </File> 580 </File>
581 <File 581 <File
582 RelativePath=".\llviewquery.h" 582 RelativePath=".\lluixmltags.h"
583 > 583 >
584 </File> 584 </File>
585 </Filter> 585 <File
586 <Filter 586 RelativePath=".\llundo.h"
587 Name="Resource Files" 587 >
588 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" 588 </File>
589 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" 589 <File
590 > 590 RelativePath=".\llview.h"
591 </Filter> 591 >
592 </Files> 592 </File>
593 <Globals> 593 <File
594 </Globals> 594 RelativePath=".\llviewborder.h"
595</VisualStudioProject> 595 >
596 </File>
597 <File
598 RelativePath=".\llviewquery.h"
599 >
600 </File>
601 </Filter>
602 <Filter
603 Name="Resource Files"
604 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
605 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
606 >
607 </Filter>
608 </Files>
609 <Globals>
610 </Globals>
611</VisualStudioProject>
diff --git a/linden/indra/llui/llui_vc9.vcproj b/linden/indra/llui/llui_vc9.vcproj
index cfaaf66..cedc726 100644
--- a/linden/indra/llui/llui_vc9.vcproj
+++ b/linden/indra/llui/llui_vc9.vcproj
@@ -1,596 +1,612 @@
1<?xml version="1.0" encoding="Windows-1252"?> 1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject 2<VisualStudioProject
3 ProjectType="Visual C++" 3 ProjectType="Visual C++"
4 Version="9.00" 4 Version="9.00"
5 Name="llui" 5 Name="llui"
6 ProjectGUID="{DE55D666-6A3D-476C-937F-109269B83681}" 6 ProjectGUID="{DE55D666-6A3D-476C-937F-109269B83681}"
7 RootNamespace="llui" 7 RootNamespace="llui"
8 Keyword="Win32Proj" 8 Keyword="Win32Proj"
9 TargetFrameworkVersion="131072" 9 TargetFrameworkVersion="131072"
10 > 10 >
11 <Platforms> 11 <Platforms>
12 <Platform 12 <Platform
13 Name="Win32" 13 Name="Win32"
14 /> 14 />
15 </Platforms> 15 </Platforms>
16 <ToolFiles> 16 <ToolFiles>
17 </ToolFiles> 17 </ToolFiles>
18 <Configurations> 18 <Configurations>
19 <Configuration 19 <Configuration
20 Name="Debug|Win32" 20 Name="Debug|Win32"
21 OutputDirectory="../lib_$(ConfigurationName)/i686-win32" 21 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
22 IntermediateDirectory="Debug" 22 IntermediateDirectory="Debug"
23 ConfigurationType="4" 23 ConfigurationType="4"
24 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" 24 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
25 CharacterSet="1" 25 CharacterSet="1"
26 > 26 >
27 <Tool 27 <Tool
28 Name="VCPreBuildEventTool" 28 Name="VCPreBuildEventTool"
29 /> 29 />
30 <Tool 30 <Tool
31 Name="VCCustomBuildTool" 31 Name="VCCustomBuildTool"
32 /> 32 />
33 <Tool 33 <Tool
34 Name="VCXMLDataGeneratorTool" 34 Name="VCXMLDataGeneratorTool"
35 /> 35 />
36 <Tool 36 <Tool
37 Name="VCWebServiceProxyGeneratorTool" 37 Name="VCWebServiceProxyGeneratorTool"
38 /> 38 />
39 <Tool 39 <Tool
40 Name="VCMIDLTool" 40 Name="VCMIDLTool"
41 /> 41 />
42 <Tool 42 <Tool
43 Name="VCCLCompilerTool" 43 Name="VCCLCompilerTool"
44 Optimization="0" 44 Optimization="0"
45 AdditionalIncludeDirectories="..\llmath;..\llvfs;..\llcommon;..\llprimitive;..\llwindow;..\llrender;..\llimage;..\llaudio;..\llxml;..\llmessage;&quot;..\..\libraries\i686-win32\include&quot;;..\..\libraries\include\" 45 AdditionalIncludeDirectories="..\llmath;..\llvfs;..\llcommon;..\llprimitive;..\llwindow;..\llrender;..\llimage;..\llaudio;..\llxml;..\llmessage;&quot;..\..\libraries\i686-win32\include&quot;;..\..\libraries\include\"
46 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG" 46 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG"
47 MinimalRebuild="true" 47 MinimalRebuild="true"
48 BasicRuntimeChecks="3" 48 BasicRuntimeChecks="3"
49 RuntimeLibrary="1" 49 RuntimeLibrary="1"
50 StructMemberAlignment="4" 50 StructMemberAlignment="4"
51 TreatWChar_tAsBuiltInType="false" 51 TreatWChar_tAsBuiltInType="false"
52 ForceConformanceInForLoopScope="true" 52 ForceConformanceInForLoopScope="true"
53 UsePrecompiledHeader="0" 53 UsePrecompiledHeader="0"
54 WarningLevel="3" 54 WarningLevel="3"
55 WarnAsError="true" 55 WarnAsError="true"
56 Detect64BitPortabilityProblems="false" 56 Detect64BitPortabilityProblems="false"
57 DebugInformationFormat="4" 57 DebugInformationFormat="4"
58 /> 58 />
59 <Tool 59 <Tool
60 Name="VCManagedResourceCompilerTool" 60 Name="VCManagedResourceCompilerTool"
61 /> 61 />
62 <Tool 62 <Tool
63 Name="VCResourceCompilerTool" 63 Name="VCResourceCompilerTool"
64 /> 64 />
65 <Tool 65 <Tool
66 Name="VCPreLinkEventTool" 66 Name="VCPreLinkEventTool"
67 /> 67 />
68 <Tool 68 <Tool
69 Name="VCLibrarianTool" 69 Name="VCLibrarianTool"
70 OutputFile="$(OutDir)/llui.lib" 70 OutputFile="$(OutDir)/llui.lib"
71 /> 71 />
72 <Tool 72 <Tool
73 Name="VCALinkTool" 73 Name="VCALinkTool"
74 /> 74 />
75 <Tool 75 <Tool
76 Name="VCXDCMakeTool" 76 Name="VCXDCMakeTool"
77 /> 77 />
78 <Tool 78 <Tool
79 Name="VCBscMakeTool" 79 Name="VCBscMakeTool"
80 /> 80 />
81 <Tool 81 <Tool
82 Name="VCFxCopTool" 82 Name="VCFxCopTool"
83 /> 83 />
84 <Tool 84 <Tool
85 Name="VCPostBuildEventTool" 85 Name="VCPostBuildEventTool"
86 /> 86 />
87 </Configuration> 87 </Configuration>
88 <Configuration 88 <Configuration
89 Name="Release|Win32" 89 Name="Release|Win32"
90 OutputDirectory="../lib_$(ConfigurationName)/i686-win32" 90 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
91 IntermediateDirectory="Release" 91 IntermediateDirectory="Release"
92 ConfigurationType="4" 92 ConfigurationType="4"
93 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" 93 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
94 CharacterSet="1" 94 CharacterSet="1"
95 > 95 >
96 <Tool 96 <Tool
97 Name="VCPreBuildEventTool" 97 Name="VCPreBuildEventTool"
98 /> 98 />
99 <Tool 99 <Tool
100 Name="VCCustomBuildTool" 100 Name="VCCustomBuildTool"
101 /> 101 />
102 <Tool 102 <Tool
103 Name="VCXMLDataGeneratorTool" 103 Name="VCXMLDataGeneratorTool"
104 /> 104 />
105 <Tool 105 <Tool
106 Name="VCWebServiceProxyGeneratorTool" 106 Name="VCWebServiceProxyGeneratorTool"
107 /> 107 />
108 <Tool 108 <Tool
109 Name="VCMIDLTool" 109 Name="VCMIDLTool"
110 /> 110 />
111 <Tool 111 <Tool
112 Name="VCCLCompilerTool" 112 Name="VCCLCompilerTool"
113 AdditionalOptions="/Oy-" 113 AdditionalOptions="/Oy-"
114 AdditionalIncludeDirectories="..\llmath;..\llvfs;..\llcommon;..\llprimitive;..\llwindow;..\llrender;..\llimage;..\llaudio;..\llxml;..\llmessage;&quot;..\..\libraries\i686-win32\include&quot;;..\..\libraries\include\" 114 AdditionalIncludeDirectories="..\llmath;..\llvfs;..\llcommon;..\llprimitive;..\llwindow;..\llrender;..\llimage;..\llaudio;..\llxml;..\llmessage;&quot;..\..\libraries\i686-win32\include&quot;;..\..\libraries\include\"
115 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE" 115 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE"
116 RuntimeLibrary="0" 116 RuntimeLibrary="0"
117 StructMemberAlignment="0" 117 StructMemberAlignment="0"
118 TreatWChar_tAsBuiltInType="false" 118 TreatWChar_tAsBuiltInType="false"
119 ForceConformanceInForLoopScope="true" 119 ForceConformanceInForLoopScope="true"
120 UsePrecompiledHeader="0" 120 UsePrecompiledHeader="0"
121 WarningLevel="3" 121 WarningLevel="3"
122 WarnAsError="true" 122 WarnAsError="true"
123 Detect64BitPortabilityProblems="false" 123 Detect64BitPortabilityProblems="false"
124 DebugInformationFormat="3" 124 DebugInformationFormat="3"
125 /> 125 />
126 <Tool 126 <Tool
127 Name="VCManagedResourceCompilerTool" 127 Name="VCManagedResourceCompilerTool"
128 /> 128 />
129 <Tool 129 <Tool
130 Name="VCResourceCompilerTool" 130 Name="VCResourceCompilerTool"
131 /> 131 />
132 <Tool 132 <Tool
133 Name="VCPreLinkEventTool" 133 Name="VCPreLinkEventTool"
134 /> 134 />
135 <Tool 135 <Tool
136 Name="VCLibrarianTool" 136 Name="VCLibrarianTool"
137 OutputFile="$(OutDir)/llui.lib" 137 OutputFile="$(OutDir)/llui.lib"
138 /> 138 />
139 <Tool 139 <Tool
140 Name="VCALinkTool" 140 Name="VCALinkTool"
141 /> 141 />
142 <Tool 142 <Tool
143 Name="VCXDCMakeTool" 143 Name="VCXDCMakeTool"
144 /> 144 />
145 <Tool 145 <Tool
146 Name="VCBscMakeTool" 146 Name="VCBscMakeTool"
147 /> 147 />
148 <Tool 148 <Tool
149 Name="VCFxCopTool" 149 Name="VCFxCopTool"
150 /> 150 />
151 <Tool 151 <Tool
152 Name="VCPostBuildEventTool" 152 Name="VCPostBuildEventTool"
153 /> 153 />
154 </Configuration> 154 </Configuration>
155 <Configuration 155 <Configuration
156 Name="ReleaseNoOpt|Win32" 156 Name="ReleaseNoOpt|Win32"
157 OutputDirectory="../lib_$(ConfigurationName)/i686-win32" 157 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
158 IntermediateDirectory="$(ConfigurationName)" 158 IntermediateDirectory="$(ConfigurationName)"
159 ConfigurationType="4" 159 ConfigurationType="4"
160 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" 160 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
161 CharacterSet="1" 161 CharacterSet="1"
162 > 162 >
163 <Tool 163 <Tool
164 Name="VCPreBuildEventTool" 164 Name="VCPreBuildEventTool"
165 /> 165 />
166 <Tool 166 <Tool
167 Name="VCCustomBuildTool" 167 Name="VCCustomBuildTool"
168 /> 168 />
169 <Tool 169 <Tool
170 Name="VCXMLDataGeneratorTool" 170 Name="VCXMLDataGeneratorTool"
171 /> 171 />
172 <Tool 172 <Tool
173 Name="VCWebServiceProxyGeneratorTool" 173 Name="VCWebServiceProxyGeneratorTool"
174 /> 174 />
175 <Tool 175 <Tool
176 Name="VCMIDLTool" 176 Name="VCMIDLTool"
177 /> 177 />
178 <Tool 178 <Tool
179 Name="VCCLCompilerTool" 179 Name="VCCLCompilerTool"
180 AdditionalOptions="/Oy-" 180 AdditionalOptions="/Oy-"
181 Optimization="0" 181 Optimization="0"
182 AdditionalIncludeDirectories="..\llmath;..\llvfs;..\llcommon;..\llprimitive;..\llwindow;..\llrender;..\llimage;..\llaudio;..\llxml;..\llmessage;&quot;..\..\libraries\i686-win32\include&quot;;..\..\libraries\include\" 182 AdditionalIncludeDirectories="..\llmath;..\llvfs;..\llcommon;..\llprimitive;..\llwindow;..\llrender;..\llimage;..\llaudio;..\llxml;..\llmessage;&quot;..\..\libraries\i686-win32\include&quot;;..\..\libraries\include\"
183 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE" 183 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE"
184 RuntimeLibrary="0" 184 RuntimeLibrary="0"
185 StructMemberAlignment="0" 185 StructMemberAlignment="0"
186 TreatWChar_tAsBuiltInType="false" 186 TreatWChar_tAsBuiltInType="false"
187 ForceConformanceInForLoopScope="true" 187 ForceConformanceInForLoopScope="true"
188 UsePrecompiledHeader="0" 188 UsePrecompiledHeader="0"
189 WarningLevel="3" 189 WarningLevel="3"
190 WarnAsError="true" 190 WarnAsError="true"
191 Detect64BitPortabilityProblems="false" 191 Detect64BitPortabilityProblems="false"
192 DebugInformationFormat="3" 192 DebugInformationFormat="3"
193 /> 193 />
194 <Tool 194 <Tool
195 Name="VCManagedResourceCompilerTool" 195 Name="VCManagedResourceCompilerTool"
196 /> 196 />
197 <Tool 197 <Tool
198 Name="VCResourceCompilerTool" 198 Name="VCResourceCompilerTool"
199 /> 199 />
200 <Tool 200 <Tool
201 Name="VCPreLinkEventTool" 201 Name="VCPreLinkEventTool"
202 /> 202 />
203 <Tool 203 <Tool
204 Name="VCLibrarianTool" 204 Name="VCLibrarianTool"
205 OutputFile="$(OutDir)/llui.lib" 205 OutputFile="$(OutDir)/llui.lib"
206 /> 206 />
207 <Tool 207 <Tool
208 Name="VCALinkTool" 208 Name="VCALinkTool"
209 /> 209 />
210 <Tool 210 <Tool
211 Name="VCXDCMakeTool" 211 Name="VCXDCMakeTool"
212 /> 212 />
213 <Tool 213 <Tool
214 Name="VCBscMakeTool" 214 Name="VCBscMakeTool"
215 /> 215 />
216 <Tool 216 <Tool
217 Name="VCFxCopTool" 217 Name="VCFxCopTool"
218 /> 218 />
219 <Tool 219 <Tool
220 Name="VCPostBuildEventTool" 220 Name="VCPostBuildEventTool"
221 /> 221 />
222 </Configuration> 222 </Configuration>
223 </Configurations> 223 </Configurations>
224 <References> 224 <References>
225 </References> 225 </References>
226 <Files> 226 <Files>
227 <Filter 227 <Filter
228 Name="Source Files" 228 Name="Source Files"
229 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" 229 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
230 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" 230 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
231 > 231 >
232 <File 232 <File
233 RelativePath=".\llalertdialog.cpp" 233 RelativePath=".\llalertdialog.cpp"
234 > 234 >
235 </File> 235 </File>
236 <File 236 <File
237 RelativePath=".\llbutton.cpp" 237 RelativePath=".\llbutton.cpp"
238 > 238 >
239 </File> 239 </File>
240 <File 240 <File
241 RelativePath=".\llcheckboxctrl.cpp" 241 RelativePath=".\llcheckboxctrl.cpp"
242 > 242 >
243 </File> 243 </File>
244 <File 244 <File
245 RelativePath=".\llclipboard.cpp" 245 RelativePath=".\llclipboard.cpp"
246 > 246 >
247 </File> 247 </File>
248 <File 248 <File
249 RelativePath=".\llcombobox.cpp" 249 RelativePath=".\llcombobox.cpp"
250 > 250 >
251 </File> 251 </File>
252 <File 252 <File
253 RelativePath=".\llctrlselectioninterface.cpp" 253 RelativePath=".\llctrlselectioninterface.cpp"
254 > 254 >
255 </File> 255 </File>
256 <File 256 <File
257 RelativePath=".\lldraghandle.cpp" 257 RelativePath=".\lldraghandle.cpp"
258 > 258 >
259 </File> 259 </File>
260 <File 260 <File
261 RelativePath=".\lleditmenuhandler.cpp" 261 RelativePath=".\lleditmenuhandler.cpp"
262 > 262 >
263 </File> 263 </File>
264 <File 264 <File
265 RelativePath=".\llfloater.cpp" 265 RelativePath=".\llfloater.cpp"
266 > 266 >
267 </File> 267 </File>
268 <File 268 <File
269 RelativePath=".\llfocusmgr.cpp" 269 RelativePath=".\llfocusmgr.cpp"
270 > 270 >
271 </File> 271 </File>
272 <File 272 <File
273 RelativePath=".\lliconctrl.cpp" 273 RelativePath=".\lliconctrl.cpp"
274 > 274 >
275 </File> 275 </File>
276 <File 276 <File
277 RelativePath=".\llkeywords.cpp" 277 RelativePath=".\llkeywords.cpp"
278 > 278 >
279 </File> 279 </File>
280 <File 280 <File
281 RelativePath=".\lllineeditor.cpp" 281 RelativePath=".\lllineeditor.cpp"
282 > 282 >
283 </File> 283 </File>
284 <File 284 <File
285 RelativePath=".\llmenugl.cpp" 285 RelativePath=".\llmenugl.cpp"
286 > 286 >
287 </File> 287 </File>
288 <File 288 <File
289 RelativePath=".\llmodaldialog.cpp" 289 RelativePath=".\llmodaldialog.cpp"
290 > 290 >
291 </File> 291 </File>
292 <File 292 <File
293 RelativePath=".\llpanel.cpp" 293 RelativePath=".\llmultislider.cpp"
294 > 294 >
295 </File> 295 </File>
296 <File 296 <File
297 RelativePath=".\llradiogroup.cpp" 297 RelativePath=".\llmultisliderctrl.cpp"
298 > 298 >
299 </File> 299 </File>
300 <File 300 <File
301 RelativePath=".\llresizebar.cpp" 301 RelativePath=".\llpanel.cpp"
302 > 302 >
303 </File> 303 </File>
304 <File 304 <File
305 RelativePath=".\llresizehandle.cpp" 305 RelativePath=".\llradiogroup.cpp"
306 > 306 >
307 </File> 307 </File>
308 <File 308 <File
309 RelativePath=".\llresmgr.cpp" 309 RelativePath=".\llresizebar.cpp"
310 > 310 >
311 </File> 311 </File>
312 <File 312 <File
313 RelativePath=".\llrootview.cpp" 313 RelativePath=".\llresizehandle.cpp"
314 > 314 >
315 </File> 315 </File>
316 <File 316 <File
317 RelativePath=".\llscrollbar.cpp" 317 RelativePath=".\llresmgr.cpp"
318 > 318 >
319 </File> 319 </File>
320 <File 320 <File
321 RelativePath=".\llscrollcontainer.cpp" 321 RelativePath=".\llrootview.cpp"
322 > 322 >
323 </File> 323 </File>
324 <File 324 <File
325 RelativePath=".\llscrollingpanellist.cpp" 325 RelativePath=".\llscrollbar.cpp"
326 > 326 >
327 </File> 327 </File>
328 <File 328 <File
329 RelativePath=".\llscrolllistctrl.cpp" 329 RelativePath=".\llscrollcontainer.cpp"
330 > 330 >
331 </File> 331 </File>
332 <File 332 <File
333 RelativePath=".\llslider.cpp" 333 RelativePath=".\llscrollingpanellist.cpp"
334 > 334 >
335 </File> 335 </File>
336 <File 336 <File
337 RelativePath=".\llsliderctrl.cpp" 337 RelativePath=".\llscrolllistctrl.cpp"
338 > 338 >
339 </File> 339 </File>
340 <File 340 <File
341 RelativePath=".\llspinctrl.cpp" 341 RelativePath=".\llslider.cpp"
342 > 342 >
343 </File> 343 </File>
344 <File 344 <File
345 RelativePath=".\llstyle.cpp" 345 RelativePath=".\llsliderctrl.cpp"
346 > 346 >
347 </File> 347 </File>
348 <File 348 <File
349 RelativePath=".\lltabcontainer.cpp" 349 RelativePath=".\llspinctrl.cpp"
350 > 350 >
351 </File> 351 </File>
352 <File 352 <File
353 RelativePath=".\lltabcontainervertical.cpp" 353 RelativePath=".\llstyle.cpp"
354 > 354 >
355 </File> 355 </File>
356 <File 356 <File
357 RelativePath=".\lltextbox.cpp" 357 RelativePath=".\lltabcontainer.cpp"
358 > 358 >
359 </File> 359 </File>
360 <File 360 <File
361 RelativePath=".\lltexteditor.cpp" 361 RelativePath=".\lltabcontainervertical.cpp"
362 > 362 >
363 </File> 363 </File>
364 <File 364 <File
365 RelativePath=".\llui.cpp" 365 RelativePath=".\lltextbox.cpp"
366 > 366 >
367 </File> 367 </File>
368 <File 368 <File
369 RelativePath=".\lluictrl.cpp" 369 RelativePath=".\lltexteditor.cpp"
370 > 370 >
371 </File> 371 </File>
372 <File 372 <File
373 RelativePath=".\lluictrlfactory.cpp" 373 RelativePath=".\llui.cpp"
374 > 374 >
375 </File> 375 </File>
376 <File 376 <File
377 RelativePath=".\lluistring.cpp" 377 RelativePath=".\lluictrl.cpp"
378 > 378 >
379 </File> 379 </File>
380 <File 380 <File
381 RelativePath=".\llundo.cpp" 381 RelativePath=".\lluictrlfactory.cpp"
382 > 382 >
383 </File> 383 </File>
384 <File 384 <File
385 RelativePath=".\llview.cpp" 385 RelativePath=".\lluistring.cpp"
386 > 386 >
387 </File> 387 </File>
388 <File 388 <File
389 RelativePath=".\llviewborder.cpp" 389 RelativePath=".\llundo.cpp"
390 > 390 >
391 </File> 391 </File>
392 <File 392 <File
393 RelativePath=".\llviewquery.cpp" 393 RelativePath=".\llview.cpp"
394 > 394 >
395 </File> 395 </File>
396 </Filter> 396 <File
397 <Filter 397 RelativePath=".\llviewborder.cpp"
398 Name="Header Files" 398 >
399 Filter="h;hpp;hxx;hm;inl;inc;xsd" 399 </File>
400 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" 400 <File
401 > 401 RelativePath=".\llviewquery.cpp"
402 <File 402 >
403 RelativePath=".\llalertdialog.h" 403 </File>
404 > 404 </Filter>
405 </File> 405 <Filter
406 <File 406 Name="Header Files"
407 RelativePath=".\llbutton.h" 407 Filter="h;hpp;hxx;hm;inl;inc;xsd"
408 > 408 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
409 </File> 409 >
410 <File 410 <File
411 RelativePath=".\llcallbackmap.h" 411 RelativePath=".\llalertdialog.h"
412 > 412 >
413 </File> 413 </File>
414 <File 414 <File
415 RelativePath=".\llcheckboxctrl.h" 415 RelativePath=".\llbutton.h"
416 > 416 >
417 </File> 417 </File>
418 <File 418 <File
419 RelativePath=".\llclipboard.h" 419 RelativePath=".\llcallbackmap.h"
420 > 420 >
421 </File> 421 </File>
422 <File 422 <File
423 RelativePath=".\llcombobox.h" 423 RelativePath=".\llcheckboxctrl.h"
424 > 424 >
425 </File> 425 </File>
426 <File 426 <File
427 RelativePath=".\llctrlselectioninterface.h" 427 RelativePath=".\llclipboard.h"
428 > 428 >
429 </File> 429 </File>
430 <File 430 <File
431 RelativePath=".\lldraghandle.h" 431 RelativePath=".\llcombobox.h"
432 > 432 >
433 </File> 433 </File>
434 <File 434 <File
435 RelativePath=".\lleditmenuhandler.h" 435 RelativePath=".\llctrlselectioninterface.h"
436 > 436 >
437 </File> 437 </File>
438 <File 438 <File
439 RelativePath=".\llfloater.h" 439 RelativePath=".\lldraghandle.h"
440 > 440 >
441 </File> 441 </File>
442 <File 442 <File
443 RelativePath=".\llfocusmgr.h" 443 RelativePath=".\lleditmenuhandler.h"
444 > 444 >
445 </File> 445 </File>
446 <File 446 <File
447 RelativePath=".\llhtmlhelp.h" 447 RelativePath=".\llfloater.h"
448 > 448 >
449 </File> 449 </File>
450 <File 450 <File
451 RelativePath=".\lliconctrl.h" 451 RelativePath=".\llfocusmgr.h"
452 > 452 >
453 </File> 453 </File>
454 <File 454 <File
455 RelativePath=".\llkeywords.h" 455 RelativePath=".\llhtmlhelp.h"
456 > 456 >
457 </File> 457 </File>
458 <File 458 <File
459 RelativePath=".\lllineeditor.h" 459 RelativePath=".\lliconctrl.h"
460 > 460 >
461 </File> 461 </File>
462 <File 462 <File
463 RelativePath=".\llmemberlistener.h" 463 RelativePath=".\llkeywords.h"
464 > 464 >
465 </File> 465 </File>
466 <File 466 <File
467 RelativePath=".\llmenugl.h" 467 RelativePath=".\lllineeditor.h"
468 > 468 >
469 </File> 469 </File>
470 <File 470 <File
471 RelativePath=".\llmodaldialog.h" 471 RelativePath=".\llmemberlistener.h"
472 > 472 >
473 </File> 473 </File>
474 <File 474 <File
475 RelativePath=".\llpanel.h" 475 RelativePath=".\llmenugl.h"
476 > 476 >
477 </File> 477 </File>
478 <File 478 <File
479 RelativePath=".\llradiogroup.h" 479 RelativePath=".\llmodaldialog.h"
480 > 480 >
481 </File> 481 </File>
482 <File 482 <File
483 RelativePath=".\llresizebar.h" 483 RelativePath=".\llmultislider.h"
484 > 484 >
485 </File> 485 </File>
486 <File 486 <File
487 RelativePath=".\llresizehandle.h" 487 RelativePath=".\llmultisliderctrl.h"
488 > 488 >
489 </File> 489 </File>
490 <File 490 <File
491 RelativePath=".\llresmgr.h" 491 RelativePath=".\llpanel.h"
492 > 492 >
493 </File> 493 </File>
494 <File 494 <File
495 RelativePath=".\llrootview.h" 495 RelativePath=".\llradiogroup.h"
496 > 496 >
497 </File> 497 </File>
498 <File 498 <File
499 RelativePath=".\llscrollbar.h" 499 RelativePath=".\llresizebar.h"
500 > 500 >
501 </File> 501 </File>
502 <File 502 <File
503 RelativePath=".\llscrollcontainer.h" 503 RelativePath=".\llresizehandle.h"
504 > 504 >
505 </File> 505 </File>
506 <File 506 <File
507 RelativePath=".\llscrollingpanellist.h" 507 RelativePath=".\llresmgr.h"
508 > 508 >
509 </File> 509 </File>
510 <File 510 <File
511 RelativePath=".\llscrolllistctrl.h" 511 RelativePath=".\llrootview.h"
512 > 512 >
513 </File> 513 </File>
514 <File 514 <File
515 RelativePath=".\llslider.h" 515 RelativePath=".\llscrollbar.h"
516 > 516 >
517 </File> 517 </File>
518 <File 518 <File
519 RelativePath=".\llsliderctrl.h" 519 RelativePath=".\llscrollcontainer.h"
520 > 520 >
521 </File> 521 </File>
522 <File 522 <File
523 RelativePath=".\llspinctrl.h" 523 RelativePath=".\llscrollingpanellist.h"
524 > 524 >
525 </File> 525 </File>
526 <File 526 <File
527 RelativePath=".\llstyle.h" 527 RelativePath=".\llscrolllistctrl.h"
528 > 528 >
529 </File> 529 </File>
530 <File 530 <File
531 RelativePath=".\lltabcontainer.h" 531 RelativePath=".\llslider.h"
532 > 532 >
533 </File> 533 </File>
534 <File 534 <File
535 RelativePath=".\lltabcontainervertical.h" 535 RelativePath=".\llsliderctrl.h"
536 > 536 >
537 </File> 537 </File>
538 <File 538 <File
539 RelativePath=".\lltextbox.h" 539 RelativePath=".\llspinctrl.h"
540 > 540 >
541 </File> 541 </File>
542 <File 542 <File
543 RelativePath=".\lltexteditor.h" 543 RelativePath=".\llstyle.h"
544 > 544 >
545 </File> 545 </File>
546 <File 546 <File
547 RelativePath=".\llui.h" 547 RelativePath=".\lltabcontainer.h"
548 > 548 >
549 </File> 549 </File>
550 <File 550 <File
551 RelativePath=".\lluiconstants.h" 551 RelativePath=".\lltabcontainervertical.h"
552 > 552 >
553 </File> 553 </File>
554 <File 554 <File
555 RelativePath=".\lluictrl.h" 555 RelativePath=".\lltextbox.h"
556 > 556 >
557 </File> 557 </File>
558 <File 558 <File
559 RelativePath=".\lluictrlfactory.h" 559 RelativePath=".\lltexteditor.h"
560 > 560 >
561 </File> 561 </File>
562 <File 562 <File
563 RelativePath=".\lluistring.h" 563 RelativePath=".\llui.h"
564 > 564 >
565 </File> 565 </File>
566 <File 566 <File
567 RelativePath=".\lluixmltags.h" 567 RelativePath=".\lluiconstants.h"
568 > 568 >
569 </File> 569 </File>
570 <File 570 <File
571 RelativePath=".\llundo.h" 571 RelativePath=".\lluictrl.h"
572 > 572 >
573 </File> 573 </File>
574 <File 574 <File
575 RelativePath=".\llview.h" 575 RelativePath=".\lluictrlfactory.h"
576 > 576 >
577 </File> 577 </File>
578 <File 578 <File
579 RelativePath=".\llviewborder.h" 579 RelativePath=".\lluistring.h"
580 > 580 >
581 </File> 581 </File>
582 <File 582 <File
583 RelativePath=".\llviewquery.h" 583 RelativePath=".\lluixmltags.h"
584 > 584 >
585 </File> 585 </File>
586 </Filter> 586 <File
587 <Filter 587 RelativePath=".\llundo.h"
588 Name="Resource Files" 588 >
589 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" 589 </File>
590 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" 590 <File
591 > 591 RelativePath=".\llview.h"
592 </Filter> 592 >
593 </Files> 593 </File>
594 <Globals> 594 <File
595 </Globals> 595 RelativePath=".\llviewborder.h"
596</VisualStudioProject> 596 >
597 </File>
598 <File
599 RelativePath=".\llviewquery.h"
600 >
601 </File>
602 </Filter>
603 <Filter
604 Name="Resource Files"
605 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
606 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
607 >
608 </Filter>
609 </Files>
610 <Globals>
611 </Globals>
612</VisualStudioProject>
diff --git a/linden/indra/llui/lluictrl.cpp b/linden/indra/llui/lluictrl.cpp
index 63db1cc..0e6c155 100644
--- a/linden/indra/llui/lluictrl.cpp
+++ b/linden/indra/llui/lluictrl.cpp
@@ -32,20 +32,9 @@
32 32
33//#include "llviewerprecompiledheaders.h" 33//#include "llviewerprecompiledheaders.h"
34#include "linden_common.h" 34#include "linden_common.h"
35
36#include "lluictrl.h" 35#include "lluictrl.h"
37
38#include "llgl.h"
39#include "llui.h"
40#include "lluiconstants.h"
41#include "llfocusmgr.h" 36#include "llfocusmgr.h"
42#include "v3color.h"
43
44#include "llstring.h"
45#include "llfontgl.h"
46#include "llkeyboard.h"
47 37
48const U32 MAX_STRING_LENGTH = 10;
49 38
50LLFocusableElement::LLFocusableElement() 39LLFocusableElement::LLFocusableElement()
51: mFocusLostCallback(NULL), 40: mFocusLostCallback(NULL),
@@ -55,6 +44,11 @@ LLFocusableElement::LLFocusableElement()
55{ 44{
56} 45}
57 46
47//virtual
48LLFocusableElement::~LLFocusableElement()
49{
50}
51
58void LLFocusableElement::onFocusReceived() 52void LLFocusableElement::onFocusReceived()
59{ 53{
60 if( mFocusReceivedCallback ) 54 if( mFocusReceivedCallback )
@@ -138,6 +132,18 @@ void LLUICtrl::onCommit()
138 } 132 }
139} 133}
140 134
135//virtual
136BOOL LLUICtrl::isCtrl() const
137{
138 return TRUE;
139}
140
141//virtual
142LLSD LLUICtrl::getValue() const
143{
144 return LLSD();
145}
146
141// virtual 147// virtual
142BOOL LLUICtrl::setTextArg( const LLString& key, const LLStringExplicit& text ) 148BOOL LLUICtrl::setTextArg( const LLString& key, const LLStringExplicit& text )
143{ 149{
@@ -176,7 +182,7 @@ BOOL LLUICtrl::hasFocus() const
176void LLUICtrl::setFocus(BOOL b) 182void LLUICtrl::setFocus(BOOL b)
177{ 183{
178 // focus NEVER goes to ui ctrls that are disabled! 184 // focus NEVER goes to ui ctrls that are disabled!
179 if (!mEnabled) 185 if (!getEnabled())
180 { 186 {
181 return; 187 return;
182 } 188 }
@@ -266,6 +272,17 @@ BOOL LLUICtrl::acceptsTextInput() const
266 return FALSE; 272 return FALSE;
267} 273}
268 274
275//virtual
276BOOL LLUICtrl::isDirty() const
277{
278 return FALSE;
279};
280
281//virtual
282void LLUICtrl::resetDirty()
283{
284}
285
269// virtual 286// virtual
270void LLUICtrl::onTabInto() 287void LLUICtrl::onTabInto()
271{ 288{
@@ -285,8 +302,6 @@ void LLUICtrl::setIsChrome(BOOL is_chrome)
285// virtual 302// virtual
286BOOL LLUICtrl::getIsChrome() const 303BOOL LLUICtrl::getIsChrome() const
287{ 304{
288 // am I or any of my ancestors flagged as "chrome"?
289 if (mIsChrome) return TRUE;
290 305
291 LLView* parent_ctrl = getParent(); 306 LLView* parent_ctrl = getParent();
292 while(parent_ctrl) 307 while(parent_ctrl)
@@ -300,11 +315,12 @@ BOOL LLUICtrl::getIsChrome() const
300 315
301 if(parent_ctrl) 316 if(parent_ctrl)
302 { 317 {
303 // recurse into parent_ctrl and ask if it is in a chrome subtree 318 return mIsChrome || ((LLUICtrl*)parent_ctrl)->getIsChrome();
304 return ((LLUICtrl*)parent_ctrl)->getIsChrome(); 319 }
320 else
321 {
322 return mIsChrome ;
305 } 323 }
306
307 return FALSE;
308} 324}
309 325
310// this comparator uses the crazy disambiguating logic of LLCompareByTabOrder, 326// this comparator uses the crazy disambiguating logic of LLCompareByTabOrder,
@@ -316,7 +332,7 @@ public:
316 CompareByDefaultTabGroup(LLView::child_tab_order_t order, S32 default_tab_group): 332 CompareByDefaultTabGroup(LLView::child_tab_order_t order, S32 default_tab_group):
317 LLCompareByTabOrder(order), 333 LLCompareByTabOrder(order),
318 mDefaultTabGroup(default_tab_group) {} 334 mDefaultTabGroup(default_tab_group) {}
319protected: 335private:
320 /*virtual*/ bool compareTabOrders(const LLView::tab_order_t & a, const LLView::tab_order_t & b) const 336 /*virtual*/ bool compareTabOrders(const LLView::tab_order_t & a, const LLView::tab_order_t & b) const
321 { 337 {
322 S32 ag = a.first; // tab group for a 338 S32 ag = a.first; // tab group for a
@@ -330,8 +346,10 @@ protected:
330 S32 mDefaultTabGroup; 346 S32 mDefaultTabGroup;
331}; 347};
332 348
333// sorter for plugging into the query 349
334class DefaultTabGroupFirstSorter : public LLQuerySorter, public LLSingleton<DefaultTabGroupFirstSorter> 350// Sorter for plugging into the query.
351// I'd have defined it local to the one method that uses it but that broke the VS 05 compiler. -MG
352class LLUICtrl::DefaultTabGroupFirstSorter : public LLQuerySorter, public LLSingleton<DefaultTabGroupFirstSorter>
335{ 353{
336public: 354public:
337 /*virtual*/ void operator() (LLView * parent, viewList_t &children) const 355 /*virtual*/ void operator() (LLView * parent, viewList_t &children) const
@@ -340,14 +358,47 @@ public:
340 } 358 }
341}; 359};
342 360
343 361BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash)
344BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields)
345{ 362{
346 // try to select default tab group child 363 // try to select default tab group child
347 LLCtrlQuery query = LLView::getTabOrderQuery(); 364 LLCtrlQuery query = getTabOrderQuery();
348 // sort things such that the default tab group is at the front 365 // sort things such that the default tab group is at the front
349 query.setSorter(DefaultTabGroupFirstSorter::getInstance()); 366 query.setSorter(DefaultTabGroupFirstSorter::getInstance());
350 LLView::child_list_t result = query(this); 367 child_list_t result = query(this);
368 if(result.size() > 0)
369 {
370 LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front());
371 if(!ctrl->hasFocus())
372 {
373 ctrl->setFocus(TRUE);
374 ctrl->onTabInto();
375 if(focus_flash)
376 {
377 gFocusMgr.triggerFocusFlash();
378 }
379 }
380 return TRUE;
381 }
382 // search for text field first
383 if(prefer_text_fields)
384 {
385 LLCtrlQuery query = getTabOrderQuery();
386 query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
387 child_list_t result = query(this);
388 if(result.size() > 0)
389 {
390 LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front());
391 if(!ctrl->hasFocus())
392 {
393 ctrl->setFocus(TRUE);
394 ctrl->onTabInto();
395 gFocusMgr.triggerFocusFlash();
396 }
397 return TRUE;
398 }
399 }
400 // no text field found, or we don't care about text fields
401 result = getTabOrderQuery().run(this);
351 if(result.size() > 0) 402 if(result.size() > 0)
352 { 403 {
353 LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front()); 404 LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front());
@@ -359,10 +410,85 @@ BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields)
359 } 410 }
360 return TRUE; 411 return TRUE;
361 } 412 }
362 // fall back on default behavior if we didn't find anything 413 return FALSE;
363 return LLView::focusFirstItem(prefer_text_fields);
364} 414}
365 415
416BOOL LLUICtrl::focusLastItem(BOOL prefer_text_fields)
417{
418 // search for text field first
419 if(prefer_text_fields)
420 {
421 LLCtrlQuery query = getTabOrderQuery();
422 query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
423 child_list_t result = query(this);
424 if(result.size() > 0)
425 {
426 LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back());
427 if(!ctrl->hasFocus())
428 {
429 ctrl->setFocus(TRUE);
430 ctrl->onTabInto();
431 gFocusMgr.triggerFocusFlash();
432 }
433 return TRUE;
434 }
435 }
436 // no text field found, or we don't care about text fields
437 child_list_t result = getTabOrderQuery().run(this);
438 if(result.size() > 0)
439 {
440 LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back());
441 if(!ctrl->hasFocus())
442 {
443 ctrl->setFocus(TRUE);
444 ctrl->onTabInto();
445 gFocusMgr.triggerFocusFlash();
446 }
447 return TRUE;
448 }
449 return FALSE;
450}
451
452BOOL LLUICtrl::focusNextItem(BOOL text_fields_only)
453{
454 // this assumes that this method is called on the focus root.
455 LLCtrlQuery query = getTabOrderQuery();
456 if(text_fields_only || LLUI::sConfigGroup->getBOOL("TabToTextFieldsOnly"))
457 {
458 query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
459 }
460 child_list_t result = query(this);
461 return focusNext(result);
462}
463
464BOOL LLUICtrl::focusPrevItem(BOOL text_fields_only)
465{
466 // this assumes that this method is called on the focus root.
467 LLCtrlQuery query = getTabOrderQuery();
468 if(text_fields_only || LLUI::sConfigGroup->getBOOL("TabToTextFieldsOnly"))
469 {
470 query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
471 }
472 child_list_t result = query(this);
473 return focusPrev(result);
474}
475
476const LLUICtrl* LLUICtrl::findRootMostFocusRoot() const
477{
478 const LLUICtrl* focus_root = NULL;
479 const LLUICtrl* next_view = this;
480 while(next_view)
481 {
482 if (next_view->isFocusRoot())
483 {
484 focus_root = next_view;
485 }
486 next_view = next_view->getParentUICtrl();
487 }
488 return focus_root;
489}
490
491
366/* 492/*
367// Don't let the children handle the tool tip. Handle it here instead. 493// Don't let the children handle the tool tip. Handle it here instead.
368BOOL LLUICtrl::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) 494BOOL LLUICtrl::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen)
@@ -379,7 +505,7 @@ BOOL LLUICtrl::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_sc
379 0, 0, 505 0, 0,
380 &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); 506 &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );
381 localPointToScreen( 507 localPointToScreen(
382 mRect.getWidth(), mRect.getHeight(), 508 getRect().getWidth(), getRect().getHeight(),
383 &(sticky_rect_screen->mRight), &(sticky_rect_screen->mTop) ); 509 &(sticky_rect_screen->mRight), &(sticky_rect_screen->mTop) );
384 510
385 handled = TRUE; 511 handled = TRUE;
@@ -423,7 +549,26 @@ LLPanel* LLUICtrl::getParentPanel() const
423 { 549 {
424 parent = parent->getParent(); 550 parent = parent->getParent();
425 } 551 }
426 return reinterpret_cast<LLPanel*>(parent); 552 return (LLPanel*)(parent);
553}
554
555// Skip over any parents that are not LLUICtrl's
556// Used in focus logic since only LLUICtrl elements can have focus
557LLUICtrl* LLUICtrl::getParentUICtrl() const
558{
559 LLView* parent = getParent();
560 while (parent)
561 {
562 if (parent->isCtrl())
563 {
564 return (LLUICtrl*)(parent);
565 }
566 else
567 {
568 parent = parent->getParent();
569 }
570 }
571 return NULL;
427} 572}
428 573
429// virtual 574// virtual
diff --git a/linden/indra/llui/lluictrl.h b/linden/indra/llui/lluictrl.h
index 55e804c..0c43297 100644
--- a/linden/indra/llui/lluictrl.h
+++ b/linden/indra/llui/lluictrl.h
@@ -37,28 +37,13 @@
37#include "llrect.h" 37#include "llrect.h"
38#include "llsd.h" 38#include "llsd.h"
39 39
40//
41// Classes
42//
43class LLFontGL;
44class LLButton;
45class LLTextBox;
46class LLLineEditor;
47class LLUICtrl;
48class LLPanel;
49class LLCtrlSelectionInterface;
50class LLCtrlListInterface;
51class LLCtrlScrollInterface;
52
53typedef void (*LLUICtrlCallback)(LLUICtrl* ctrl, void* userdata);
54typedef BOOL (*LLUICtrlValidate)(LLUICtrl* ctrl, void* userdata);
55 40
56class LLFocusableElement 41class LLFocusableElement
57{ 42{
58 friend class LLFocusMgr; // allow access to focus change handlers 43 friend class LLFocusMgr; // allow access to focus change handlers
59public: 44public:
60 LLFocusableElement(); 45 LLFocusableElement();
61 virtual ~LLFocusableElement() {}; 46 virtual ~LLFocusableElement();
62 47
63 virtual void setFocus( BOOL b ); 48 virtual void setFocus( BOOL b );
64 virtual BOOL hasFocus() const; 49 virtual BOOL hasFocus() const;
@@ -80,63 +65,74 @@ class LLUICtrl
80: public LLView, public LLFocusableElement 65: public LLView, public LLFocusableElement
81{ 66{
82public: 67public:
68 typedef void (*LLUICtrlCallback)(LLUICtrl* ctrl, void* userdata);
69 typedef BOOL (*LLUICtrlValidate)(LLUICtrl* ctrl, void* userdata);
70
83 LLUICtrl(); 71 LLUICtrl();
84 LLUICtrl( const LLString& name, const LLRect& rect, BOOL mouse_opaque, 72 LLUICtrl( const LLString& name, const LLRect& rect, BOOL mouse_opaque,
85 LLUICtrlCallback callback, 73 LLUICtrlCallback callback,
86 void* callback_userdata, 74 void* callback_userdata,
87 U32 reshape=FOLLOWS_NONE); 75 U32 reshape=FOLLOWS_NONE);
88 virtual ~LLUICtrl(); 76 /*virtual*/ ~LLUICtrl();
89 77
90 // LLView interface 78 // LLView interface
91 //virtual BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect); 79 /*virtual*/ void initFromXML(LLXMLNodePtr node, LLView* parent);
92 virtual void initFromXML(LLXMLNodePtr node, LLView* parent); 80 /*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
93 virtual LLXMLNodePtr getXML(bool save_children = true) const; 81 /*virtual*/ BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
94 82 /*virtual*/ void onFocusReceived();
95 virtual LLSD getValue() const { return LLSD(); } 83 /*virtual*/ void onFocusLost();
96 84 /*virtual*/ BOOL isCtrl() const;
97 // Defaults to no-op 85 /*virtual*/ void setTentative(BOOL b);
98 virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text ); 86 /*virtual*/ BOOL getTentative() const;
99 87
100 // Defaults to no-op 88 // From LLFocusableElement
101 virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); 89 /*virtual*/ void setFocus( BOOL b );
90 /*virtual*/ BOOL hasFocus() const;
91
92 // New virtuals
102 93
103 // Defaults to return NULL 94 // Return NULL by default (overrride if the class has the appropriate interface)
104 virtual LLCtrlSelectionInterface* getSelectionInterface(); 95 virtual class LLCtrlSelectionInterface* getSelectionInterface();
105 virtual LLCtrlListInterface* getListInterface(); 96 virtual class LLCtrlListInterface* getListInterface();
106 virtual LLCtrlScrollInterface* getScrollInterface(); 97 virtual class LLCtrlScrollInterface* getScrollInterface();
107 98
108 virtual void setFocus( BOOL b ); 99 virtual LLSD getValue() const;
109 virtual BOOL hasFocus() const; 100 virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text );
101 virtual void setIsChrome(BOOL is_chrome);
110 102
111 virtual void onFocusReceived(); 103 virtual BOOL acceptsTextInput() const; // Defaults to false
112 virtual void onFocusLost();
113 104
105 // A control is dirty if the user has modified its value.
106 // Editable controls should override this.
107 virtual BOOL isDirty() const; // Defauls to false
108 virtual void resetDirty(); //Defaults to no-op
109
110 // Call appropriate callbacks
114 virtual void onLostTop(); // called when registered as top ctrl and user clicks elsewhere 111 virtual void onLostTop(); // called when registered as top ctrl and user clicks elsewhere
115 112 virtual void onCommit();
116 virtual void setTabStop( BOOL b ); 113
117 virtual BOOL hasTabStop() const; 114 // Default to no-op:
118
119 // Defaults to false
120 virtual BOOL acceptsTextInput() const;
121
122 // Default to no-op
123 virtual void onTabInto(); 115 virtual void onTabInto();
124 virtual void clear(); 116 virtual void clear();
117 virtual void setDoubleClickCallback( void (*cb)(void*) );
118 virtual void setColor(const LLColor4& color);
119 virtual void setMinValue(LLSD min_value);
120 virtual void setMaxValue(LLSD max_value);
125 121
126 virtual void setIsChrome(BOOL is_chrome); 122 BOOL focusNextItem(BOOL text_entry_only);
127 virtual BOOL getIsChrome() const; 123 BOOL focusPrevItem(BOOL text_entry_only);
128 124 BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE );
129 virtual void onCommit(); 125 BOOL focusLastItem(BOOL prefer_text_fields = FALSE);
130 126
131 virtual BOOL isCtrl() const { return TRUE; } 127 // Non Virtuals
132 // "Tentative" controls have a proposed value, but haven't committed 128 BOOL getIsChrome() const;
133 // it yet. This is used when multiple objects are selected and we 129
134 // want to display a parameter that differs between the objects. 130 void setTabStop( BOOL b );
135 virtual void setTentative(BOOL b); 131 BOOL hasTabStop() const;
136 virtual BOOL getTentative() const;
137 132
138 // Returns containing panel/floater or NULL if none found. 133 // Returns containing panel/floater or NULL if none found.
139 LLPanel* getParentPanel() const; 134 class LLPanel* getParentPanel() const;
135 class LLUICtrl* getParentUICtrl() const;
140 136
141 void* getCallbackUserData() const { return mCallbackUserData; } 137 void* getCallbackUserData() const { return mCallbackUserData; }
142 void setCallbackUserData( void* data ) { mCallbackUserData = data; } 138 void setCallbackUserData( void* data ) { mCallbackUserData = data; }
@@ -144,18 +140,8 @@ public:
144 void setCommitCallback( void (*cb)(LLUICtrl*, void*) ) { mCommitCallback = cb; } 140 void setCommitCallback( void (*cb)(LLUICtrl*, void*) ) { mCommitCallback = cb; }
145 void setValidateBeforeCommit( BOOL(*cb)(LLUICtrl*, void*) ) { mValidateCallback = cb; } 141 void setValidateBeforeCommit( BOOL(*cb)(LLUICtrl*, void*) ) { mValidateCallback = cb; }
146 void setLostTopCallback( void (*cb)(LLUICtrl*, void*) ) { mLostTopCallback = cb; } 142 void setLostTopCallback( void (*cb)(LLUICtrl*, void*) ) { mLostTopCallback = cb; }
147 143
148 // Defaults to no-op! 144 const LLUICtrl* findRootMostFocusRoot() const;
149 virtual void setDoubleClickCallback( void (*cb)(void*) );
150
151 // Defaults to no-op
152 virtual void setColor(const LLColor4& color);
153
154 // Defaults to no-op
155 virtual void setMinValue(LLSD min_value);
156 virtual void setMaxValue(LLSD max_value);
157
158 /*virtual*/ BOOL focusFirstItem(BOOL prefer_text_fields = FALSE );
159 145
160 class LLTextInputFilter : public LLQueryFilter, public LLSingleton<LLTextInputFilter> 146 class LLTextInputFilter : public LLQueryFilter, public LLSingleton<LLTextInputFilter>
161 { 147 {
@@ -165,11 +151,6 @@ public:
165 } 151 }
166 }; 152 };
167 153
168 // Returns TRUE if the user has modified this control. Editable controls should override this.
169 virtual BOOL isDirty() const { return FALSE; };
170 // Clear the dirty state
171 virtual void resetDirty() {};
172
173protected: 154protected:
174 155
175 void (*mCommitCallback)( LLUICtrl* ctrl, void* userdata ); 156 void (*mCommitCallback)( LLUICtrl* ctrl, void* userdata );
@@ -177,13 +158,14 @@ protected:
177 BOOL (*mValidateCallback)( LLUICtrl* ctrl, void* userdata ); 158 BOOL (*mValidateCallback)( LLUICtrl* ctrl, void* userdata );
178 159
179 void* mCallbackUserData; 160 void* mCallbackUserData;
180 BOOL mTentative;
181 BOOL mTabStop;
182 161
183private: 162private:
184 BOOL mIsChrome;
185 163
164 BOOL mTabStop;
165 BOOL mIsChrome;
166 BOOL mTentative;
186 167
168 class DefaultTabGroupFirstSorter;
187}; 169};
188 170
189#endif // LL_LLUICTRL_H 171#endif // LL_LLUICTRL_H
diff --git a/linden/indra/llui/lluictrlfactory.cpp b/linden/indra/llui/lluictrlfactory.cpp
index a51d8e4..cfee76a 100644
--- a/linden/indra/llui/lluictrlfactory.cpp
+++ b/linden/indra/llui/lluictrlfactory.cpp
@@ -59,6 +59,8 @@
59#include "llscrolllistctrl.h" 59#include "llscrolllistctrl.h"
60#include "llslider.h" 60#include "llslider.h"
61#include "llsliderctrl.h" 61#include "llsliderctrl.h"
62#include "llmultislider.h"
63#include "llmultisliderctrl.h"
62#include "llspinctrl.h" 64#include "llspinctrl.h"
63#include "lltabcontainer.h" 65#include "lltabcontainer.h"
64#include "lltabcontainervertical.h" 66#include "lltabcontainervertical.h"
@@ -67,7 +69,6 @@
67#include "llui.h" 69#include "llui.h"
68#include "llviewborder.h" 70#include "llviewborder.h"
69 71
70
71const char XML_HEADER[] = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n"; 72const char XML_HEADER[] = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n";
72 73
73// *NOTE: If you add a new class derived from LLPanel, add a check for its 74// *NOTE: If you add a new class derived from LLPanel, add a check for its
@@ -93,6 +94,8 @@ const LLString LLUICtrlFactory::sUICtrlNames[WIDGET_TYPE_COUNT] =
93 LLString("slider"), //WIDGET_TYPE_SLIDER, actually LLSliderCtrl 94 LLString("slider"), //WIDGET_TYPE_SLIDER, actually LLSliderCtrl
94 LLString("slider_bar"), //WIDGET_TYPE_SLIDER_BAR, actually LLSlider 95 LLString("slider_bar"), //WIDGET_TYPE_SLIDER_BAR, actually LLSlider
95 LLString("volume_slider"), //WIDGET_TYPE_VOLUME_SLIDER, actually LLSlider + "volume" param 96 LLString("volume_slider"), //WIDGET_TYPE_VOLUME_SLIDER, actually LLSlider + "volume" param
97 LLString("multi_slider"), //WIDGET_TYPE_MULTI_SLIDER, actually LLMultiSliderCtrl
98 LLString("multi_slider_bar"), //WIDGET_TYPE_MULTI_SLIDER_BAR, actually LLMultiSlider
96 LLString("spinner"), //WIDGET_TYPE_SPINNER, actually LLSpinCtrl 99 LLString("spinner"), //WIDGET_TYPE_SPINNER, actually LLSpinCtrl
97 LLString("text_editor"), //WIDGET_TYPE_TEXT_EDITOR 100 LLString("text_editor"), //WIDGET_TYPE_TEXT_EDITOR
98 LLString("texture_picker"),//WIDGET_TYPE_TEXTURE_PICKER 101 LLString("texture_picker"),//WIDGET_TYPE_TEXTURE_PICKER
@@ -207,6 +210,8 @@ LLUICtrlFactory::LLUICtrlFactory()
207 LLUICtrlCreator<LLSliderCtrl>::registerCreator(LL_SLIDER_CTRL_TAG, this); 210 LLUICtrlCreator<LLSliderCtrl>::registerCreator(LL_SLIDER_CTRL_TAG, this);
208 LLUICtrlCreator<LLSlider>::registerCreator(LL_SLIDER_TAG, this); 211 LLUICtrlCreator<LLSlider>::registerCreator(LL_SLIDER_TAG, this);
209 LLUICtrlCreator<LLSlider>::registerCreator(LL_VOLUME_SLIDER_CTRL_TAG, this); 212 LLUICtrlCreator<LLSlider>::registerCreator(LL_VOLUME_SLIDER_CTRL_TAG, this);
213 LLUICtrlCreator<LLMultiSliderCtrl>::registerCreator(LL_MULTI_SLIDER_CTRL_TAG, this);
214 LLUICtrlCreator<LLMultiSlider>::registerCreator(LL_MULTI_SLIDER_TAG, this);
210 LLUICtrlCreator<LLSpinCtrl>::registerCreator(LL_SPIN_CTRL_TAG, this); 215 LLUICtrlCreator<LLSpinCtrl>::registerCreator(LL_SPIN_CTRL_TAG, this);
211 LLUICtrlCreator<LLTextBox>::registerCreator(LL_TEXT_BOX_TAG, this); 216 LLUICtrlCreator<LLTextBox>::registerCreator(LL_TEXT_BOX_TAG, this);
212 LLUICtrlCreator<LLRadioGroup>::registerCreator(LL_RADIO_GROUP_TAG, this); 217 LLUICtrlCreator<LLRadioGroup>::registerCreator(LL_RADIO_GROUP_TAG, this);
@@ -214,7 +219,7 @@ LLUICtrlFactory::LLUICtrlFactory()
214 LLUICtrlCreator<LLUICtrlLocate>::registerCreator(LL_UI_CTRL_LOCATE_TAG, this); 219 LLUICtrlCreator<LLUICtrlLocate>::registerCreator(LL_UI_CTRL_LOCATE_TAG, this);
215 LLUICtrlCreator<LLUICtrlLocate>::registerCreator(LL_PAD_TAG, this); 220 LLUICtrlCreator<LLUICtrlLocate>::registerCreator(LL_PAD_TAG, this);
216 LLUICtrlCreator<LLViewBorder>::registerCreator(LL_VIEW_BORDER_TAG, this); 221 LLUICtrlCreator<LLViewBorder>::registerCreator(LL_VIEW_BORDER_TAG, this);
217 LLUICtrlCreator<LLTabContainerCommon>::registerCreator(LL_TAB_CONTAINER_COMMON_TAG, this); 222 LLUICtrlCreator<LLTabContainer>::registerCreator(LL_TAB_CONTAINER_COMMON_TAG, this);
218 LLUICtrlCreator<LLScrollableContainerView>::registerCreator(LL_SCROLLABLE_CONTAINER_VIEW_TAG, this); 223 LLUICtrlCreator<LLScrollableContainerView>::registerCreator(LL_SCROLLABLE_CONTAINER_VIEW_TAG, this);
219 LLUICtrlCreator<LLPanel>::registerCreator(LL_PANEL_TAG, this); 224 LLUICtrlCreator<LLPanel>::registerCreator(LL_PANEL_TAG, this);
220 LLUICtrlCreator<LLMenuGL>::registerCreator(LL_MENU_GL_TAG, this); 225 LLUICtrlCreator<LLMenuGL>::registerCreator(LL_MENU_GL_TAG, this);
@@ -223,7 +228,6 @@ LLUICtrlFactory::LLUICtrlFactory()
223 LLUICtrlCreator<LLLayoutStack>::registerCreator(LL_LAYOUT_STACK_TAG, this); 228 LLUICtrlCreator<LLLayoutStack>::registerCreator(LL_LAYOUT_STACK_TAG, this);
224 229
225 setupPaths(); 230 setupPaths();
226
227} 231}
228 232
229void LLUICtrlFactory::setupPaths() 233void LLUICtrlFactory::setupPaths()
@@ -234,14 +238,7 @@ void LLUICtrlFactory::setupPaths()
234 BOOL success = LLXMLNode::parseFile(filename, root, NULL); 238 BOOL success = LLXMLNode::parseFile(filename, root, NULL);
235 mXUIPaths.clear(); 239 mXUIPaths.clear();
236 240
237 if (!success) 241 if (success)
238 {
239 LLString slash = gDirUtilp->getDirDelimiter();
240 LLString dir = gDirUtilp->getAppRODataDir() + slash + "skins" + slash + "xui" + slash + "en-us" + slash;
241 llwarns << "XUI::config file unable to open." << llendl;
242 mXUIPaths.push_back(dir);
243 }
244 else
245 { 242 {
246 LLXMLNodePtr path; 243 LLXMLNodePtr path;
247 LLString app_dir = gDirUtilp->getAppRODataDir(); 244 LLString app_dir = gDirUtilp->getAppRODataDir();
@@ -267,16 +264,15 @@ void LLUICtrlFactory::setupPaths()
267 } 264 }
268 } 265 }
269 } 266 }
270 267 else // parsing failed
271 268 {
269 LLString slash = gDirUtilp->getDirDelimiter();
270 LLString dir = gDirUtilp->getAppRODataDir() + slash + "skins" + slash + "xui" + slash + "en-us" + slash;
271 llwarns << "XUI::config file unable to open." << llendl;
272 mXUIPaths.push_back(dir);
273 }
272} 274}
273 275
274//-----------------------------------------------------------------------------
275// ~LLUICtrlFactory()
276//-----------------------------------------------------------------------------
277LLUICtrlFactory::~LLUICtrlFactory()
278{
279}
280 276
281 277
282//----------------------------------------------------------------------------- 278//-----------------------------------------------------------------------------
@@ -284,7 +280,6 @@ LLUICtrlFactory::~LLUICtrlFactory()
284//----------------------------------------------------------------------------- 280//-----------------------------------------------------------------------------
285bool LLUICtrlFactory::getLayeredXMLNode(const LLString &filename, LLXMLNodePtr& root) 281bool LLUICtrlFactory::getLayeredXMLNode(const LLString &filename, LLXMLNodePtr& root)
286{ 282{
287
288 if (!LLXMLNode::parseFile(mXUIPaths.front() + filename, root, NULL)) 283 if (!LLXMLNode::parseFile(mXUIPaths.front() + filename, root, NULL))
289 { 284 {
290 if (!LLXMLNode::parseFile(filename, root, NULL)) 285 if (!LLXMLNode::parseFile(filename, root, NULL))
@@ -347,7 +342,7 @@ void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const LLString &filename
347 342
348 if (LLUI::sShowXUINames) 343 if (LLUI::sShowXUINames)
349 { 344 {
350 floaterp->mToolTipMsg = filename; 345 floaterp->setToolTip(filename);
351 } 346 }
352 347
353 if (factory_map) 348 if (factory_map)
@@ -355,7 +350,7 @@ void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const LLString &filename
355 mFactoryStack.pop_front(); 350 mFactoryStack.pop_front();
356 } 351 }
357 352
358 LLViewHandle handle = floaterp->getHandle(); 353 LLHandle<LLFloater> handle = floaterp->getHandle();
359 mBuiltFloaters[handle] = filename; 354 mBuiltFloaters[handle] = filename;
360} 355}
361 356
@@ -411,10 +406,10 @@ BOOL LLUICtrlFactory::buildPanel(LLPanel* panelp, const LLString &filename,
411 406
412 if (LLUI::sShowXUINames) 407 if (LLUI::sShowXUINames)
413 { 408 {
414 panelp->mToolTipMsg = filename; 409 panelp->setToolTip(filename);
415 } 410 }
416 411
417 LLViewHandle handle = panelp->getHandle(); 412 LLHandle<LLPanel> handle = panelp->getHandle();
418 mBuiltPanels[handle] = filename; 413 mBuiltPanels[handle] = filename;
419 414
420 if (factory_map) 415 if (factory_map)
@@ -446,8 +441,6 @@ LLMenuGL *LLUICtrlFactory::buildMenu(const LLString &filename, LLView* parentp)
446 return NULL; 441 return NULL;
447 } 442 }
448 443
449
450
451 if (root->hasName("menu")) 444 if (root->hasName("menu"))
452 { 445 {
453 menu = (LLMenuGL*)LLMenuGL::fromXML(root, parentp, this); 446 menu = (LLMenuGL*)LLMenuGL::fromXML(root, parentp, this);
@@ -459,7 +452,7 @@ LLMenuGL *LLUICtrlFactory::buildMenu(const LLString &filename, LLView* parentp)
459 452
460 if (LLUI::sShowXUINames) 453 if (LLUI::sShowXUINames)
461 { 454 {
462 menu->mToolTipMsg = filename; 455 menu->setToolTip(filename);
463 } 456 }
464 457
465 return menu; 458 return menu;
@@ -470,7 +463,6 @@ LLMenuGL *LLUICtrlFactory::buildMenu(const LLString &filename, LLView* parentp)
470//----------------------------------------------------------------------------- 463//-----------------------------------------------------------------------------
471LLPieMenu *LLUICtrlFactory::buildPieMenu(const LLString &filename, LLView* parentp) 464LLPieMenu *LLUICtrlFactory::buildPieMenu(const LLString &filename, LLView* parentp)
472{ 465{
473
474 LLXMLNodePtr root; 466 LLXMLNodePtr root;
475 467
476 if (!LLUICtrlFactory::getLayeredXMLNode(filename, root)) 468 if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
@@ -494,29 +486,13 @@ LLPieMenu *LLUICtrlFactory::buildPieMenu(const LLString &filename, LLView* paren
494 486
495 if (LLUI::sShowXUINames) 487 if (LLUI::sShowXUINames)
496 { 488 {
497 menu->mToolTipMsg = filename; 489 menu->setToolTip(filename);
498 } 490 }
499 491
500 return menu; 492 return menu;
501} 493}
502 494
503//----------------------------------------------------------------------------- 495//-----------------------------------------------------------------------------
504// removePanel()
505//-----------------------------------------------------------------------------
506void LLUICtrlFactory::removePanel(LLPanel* panelp)
507{
508 mBuiltPanels.erase(panelp->getHandle());
509}
510
511//-----------------------------------------------------------------------------
512// removeFloater()
513//-----------------------------------------------------------------------------
514void LLUICtrlFactory::removeFloater(LLFloater* floaterp)
515{
516 mBuiltFloaters.erase(floaterp->getHandle());
517}
518
519//-----------------------------------------------------------------------------
520// rebuild() 496// rebuild()
521//----------------------------------------------------------------------------- 497//-----------------------------------------------------------------------------
522void LLUICtrlFactory::rebuild() 498void LLUICtrlFactory::rebuild()
@@ -525,48 +501,48 @@ void LLUICtrlFactory::rebuild()
525 for (built_panel_it = mBuiltPanels.begin(); 501 for (built_panel_it = mBuiltPanels.begin();
526 built_panel_it != mBuiltPanels.end(); 502 built_panel_it != mBuiltPanels.end();
527 ++built_panel_it) 503 ++built_panel_it)
504 {
505 LLString filename = built_panel_it->second;
506 LLPanel* panelp = built_panel_it->first.get();
507 if (!panelp)
528 { 508 {
529 LLString filename = built_panel_it->second; 509 continue;
530 LLPanel* panelp = LLPanel::getPanelByHandle(built_panel_it->first);
531 if (!panelp)
532 {
533 continue;
534 }
535 llinfos << "Rebuilding UI panel " << panelp->getName()
536 << " from " << filename
537 << llendl;
538 BOOL visible = panelp->getVisible();
539 panelp->setVisible(FALSE);
540 panelp->setFocus(FALSE);
541 panelp->deleteAllChildren();
542
543 buildPanel(panelp, filename.c_str(), &panelp->getFactoryMap());
544 panelp->setVisible(visible);
545 } 510 }
511 llinfos << "Rebuilding UI panel " << panelp->getName()
512 << " from " << filename
513 << llendl;
514 BOOL visible = panelp->getVisible();
515 panelp->setVisible(FALSE);
516 panelp->setFocus(FALSE);
517 panelp->deleteAllChildren();
518
519 buildPanel(panelp, filename.c_str(), &panelp->getFactoryMap());
520 panelp->setVisible(visible);
521 }
546 522
547 built_floater_t::iterator built_floater_it; 523 built_floater_t::iterator built_floater_it;
548 for (built_floater_it = mBuiltFloaters.begin(); 524 for (built_floater_it = mBuiltFloaters.begin();
549 built_floater_it != mBuiltFloaters.end(); 525 built_floater_it != mBuiltFloaters.end();
550 ++built_floater_it) 526 ++built_floater_it)
527 {
528 LLFloater* floaterp = built_floater_it->first.get();
529 if (!floaterp)
551 { 530 {
552 LLFloater* floaterp = LLFloater::getFloaterByHandle(built_floater_it->first); 531 continue;
553 if (!floaterp)
554 {
555 continue;
556 }
557 LLString filename = built_floater_it->second;
558 llinfos << "Rebuilding UI floater " << floaterp->getName()
559 << " from " << filename
560 << llendl;
561 BOOL visible = floaterp->getVisible();
562 floaterp->setVisible(FALSE);
563 floaterp->setFocus(FALSE);
564 floaterp->deleteAllChildren();
565
566 gFloaterView->removeChild(floaterp);
567 buildFloater(floaterp, filename, &floaterp->getFactoryMap());
568 floaterp->setVisible(visible);
569 } 532 }
533 LLString filename = built_floater_it->second;
534 llinfos << "Rebuilding UI floater " << floaterp->getName()
535 << " from " << filename
536 << llendl;
537 BOOL visible = floaterp->getVisible();
538 floaterp->setVisible(FALSE);
539 floaterp->setFocus(FALSE);
540 floaterp->deleteAllChildren();
541
542 gFloaterView->removeChild(floaterp);
543 buildFloater(floaterp, filename, &floaterp->getFactoryMap());
544 floaterp->setVisible(visible);
545 }
570} 546}
571 547
572//----------------------------------------------------------------------------- 548//-----------------------------------------------------------------------------
@@ -674,113 +650,103 @@ BOOL LLUICtrlFactory::getAttributeColor(LLXMLNodePtr node, const LLString& name,
674 650
675//============================================================================ 651//============================================================================
676 652
677LLButton* LLUICtrlFactory::getButtonByName(LLPanel* panelp, const LLString& name) 653LLButton* LLUICtrlFactory::getButtonByName(const LLPanel* panelp, const LLString& name)
678{ 654{
679 return (LLButton*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_BUTTON); 655 return panelp->getChild<LLButton>(name);
680} 656}
681 657
682LLCheckBoxCtrl* LLUICtrlFactory::getCheckBoxByName(LLPanel* panelp, const LLString& name) 658LLCheckBoxCtrl* LLUICtrlFactory::getCheckBoxByName(const LLPanel* panelp, const LLString& name)
683{ 659{
684 return (LLCheckBoxCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_CHECKBOX); 660 return panelp->getChild<LLCheckBoxCtrl>(name);
685} 661}
686 662
687LLComboBox* LLUICtrlFactory::getComboBoxByName(LLPanel* panelp, const LLString& name) 663LLComboBox* LLUICtrlFactory::getComboBoxByName(const LLPanel* panelp, const LLString& name)
688{ 664{
689 return (LLComboBox*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_COMBO_BOX); 665 return panelp->getChild<LLComboBox>(name);
690} 666}
691 667
692LLIconCtrl* LLUICtrlFactory::getIconByName(LLPanel* panelp, const LLString& name) 668LLIconCtrl* LLUICtrlFactory::getIconByName(const LLPanel* panelp, const LLString& name)
693{ 669{
694 return (LLIconCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_ICON); 670 return panelp->getChild<LLIconCtrl>(name);
695} 671}
696 672
697LLLineEditor* LLUICtrlFactory::getLineEditorByName(LLPanel* panelp, const LLString& name) 673LLLineEditor* LLUICtrlFactory::getLineEditorByName(const LLPanel* panelp, const LLString& name)
698{ 674{
699 return (LLLineEditor*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_LINE_EDITOR); 675 return panelp->getChild<LLLineEditor>(name);
700} 676}
701 677
702LLNameListCtrl* LLUICtrlFactory::getNameListByName(LLPanel* panelp, const LLString& name) 678LLRadioGroup* LLUICtrlFactory::getRadioGroupByName(const LLPanel* panelp, const LLString& name)
703{ 679{
704 return (LLNameListCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_NAME_LIST); 680 return panelp->getChild<LLRadioGroup>(name);
705} 681}
706 682
707LLRadioGroup* LLUICtrlFactory::getRadioGroupByName(LLPanel* panelp, const LLString& name) 683LLScrollListCtrl* LLUICtrlFactory::getScrollListByName(const LLPanel* panelp, const LLString& name)
708{ 684{
709 return (LLRadioGroup*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_RADIO_GROUP); 685 return panelp->getChild<LLScrollListCtrl>(name);
710} 686}
711 687
712LLScrollListCtrl* LLUICtrlFactory::getScrollListByName(LLPanel* panelp, const LLString& name) 688LLSliderCtrl* LLUICtrlFactory::getSliderByName(const LLPanel* panelp, const LLString& name)
713{ 689{
714 return (LLScrollListCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_SCROLL_LIST); 690 return panelp->getChild<LLSliderCtrl>(name);
715} 691}
716 692
717LLSliderCtrl* LLUICtrlFactory::getSliderByName(LLPanel* panelp, const LLString& name) 693LLSlider* LLUICtrlFactory::getSliderBarByName(const LLPanel* panelp, const LLString& name)
718{ 694{
719 return (LLSliderCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_SLIDER); 695 return panelp->getChild<LLSlider>(name);
720} 696}
721 697
722LLSlider* LLUICtrlFactory::getSliderBarByName(LLPanel* panelp, const LLString& name) 698LLSpinCtrl* LLUICtrlFactory::getSpinnerByName(const LLPanel* panelp, const LLString& name)
723{ 699{
724 return (LLSlider*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_SLIDER_BAR); 700 return panelp->getChild<LLSpinCtrl>(name);
725} 701}
726 702
727LLSpinCtrl* LLUICtrlFactory::getSpinnerByName(LLPanel* panelp, const LLString& name) 703LLTextBox* LLUICtrlFactory::getTextBoxByName(const LLPanel* panelp, const LLString& name)
728{ 704{
729 return (LLSpinCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_SPINNER); 705 return panelp->getChild<LLTextBox>(name);
730} 706}
731 707
732LLTextBox* LLUICtrlFactory::getTextBoxByName(LLPanel* panelp, const LLString& name) 708LLTextEditor* LLUICtrlFactory::getTextEditorByName(const LLPanel* panelp, const LLString& name)
733{ 709{
734 return (LLTextBox*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_TEXT_BOX); 710 return panelp->getChild<LLTextEditor>(name);
735} 711}
736 712
737LLTextEditor* LLUICtrlFactory::getTextEditorByName(LLPanel* panelp, const LLString& name) 713LLTabContainer* LLUICtrlFactory::getTabContainerByName(const LLPanel* panelp, const LLString& name)
738{ 714{
739 return (LLTextEditor*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_TEXT_EDITOR); 715 return panelp->getChild<LLTabContainer>(name);
740}
741
742LLTabContainerCommon* LLUICtrlFactory::getTabContainerByName(LLPanel* panelp, const LLString& name)
743{
744 return (LLTabContainerCommon*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_TAB_CONTAINER);
745}
746
747LLScrollableContainerView* LLUICtrlFactory::getScrollableContainerByName(LLPanel* panelp, const LLString& name)
748{
749 return (LLScrollableContainerView*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_SCROLL_CONTAINER);
750} 716}
751 717
752LLTextureCtrl* LLUICtrlFactory::getTexturePickerByName(LLPanel* panelp, const LLString& name) 718LLScrollableContainerView* LLUICtrlFactory::getScrollableContainerByName(const LLPanel* panelp, const LLString& name)
753{ 719{
754 return (LLTextureCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_TEXTURE_PICKER); 720 return panelp->getChild<LLScrollableContainerView>(name);
755} 721}
756 722
757LLPanel* LLUICtrlFactory::getPanelByName(LLPanel* panelp, const LLString& name) 723LLPanel* LLUICtrlFactory::getPanelByName(const LLPanel* panelp, const LLString& name)
758{ 724{
759 return (LLPanel*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_PANEL); 725 return panelp->getChild<LLPanel>(name);
760} 726}
761 727
762LLColorSwatchCtrl* LLUICtrlFactory::getColorSwatchByName(LLPanel* panelp, const LLString& name) 728LLMenuItemCallGL* LLUICtrlFactory::getMenuItemCallByName(const LLPanel* panelp, const LLString& name)
763{ 729{
764 return (LLColorSwatchCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_COLOR_SWATCH); 730 return panelp->getChild<LLMenuItemCallGL>(name);
765} 731}
766 732
767LLWebBrowserCtrl* LLUICtrlFactory::getWebBrowserCtrlByName(LLPanel* panelp, const LLString& name) 733LLScrollingPanelList* LLUICtrlFactory::getScrollingPanelList(const LLPanel* panelp, const LLString& name)
768{ 734{
769 return (LLWebBrowserCtrl*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_WEBBROWSER); 735 return panelp->getChild<LLScrollingPanelList>(name);
770} 736}
771 737
772LLMenuItemCallGL* LLUICtrlFactory::getMenuItemCallByName(LLPanel* panelp, const LLString& name) 738LLMultiSliderCtrl* LLUICtrlFactory::getMultiSliderByName(const LLPanel* panelp, const LLString& name)
773{ 739{
774 return (LLMenuItemCallGL*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_MENU_ITEM_CALL); 740 return panelp->getChild<LLMultiSliderCtrl>(name);
775} 741}
776 742
777LLScrollingPanelList* LLUICtrlFactory::getScrollingPanelList(LLPanel* panelp, const LLString& name) 743LLMultiSlider* LLUICtrlFactory::getMultiSliderBarByName(const LLPanel* panelp, const LLString& name)
778{ 744{
779 return (LLScrollingPanelList*)panelp->getCtrlByNameAndType(name, WIDGET_TYPE_SCROLLING_PANEL_LIST); 745 return panelp->getChild<LLMultiSlider>(name);
780} 746}
781 747
782 748
783LLCtrlListInterface* LLUICtrlFactory::getListInterfaceByName(LLPanel* panelp, const LLString& name) 749LLCtrlListInterface* LLUICtrlFactory::getListInterfaceByName(const LLPanel* panelp, const LLString& name)
784{ 750{
785 LLView* viewp = panelp->getCtrlByNameAndType(name, WIDGET_TYPE_DONTCARE); 751 LLView* viewp = panelp->getCtrlByNameAndType(name, WIDGET_TYPE_DONTCARE);
786 if (viewp && viewp->isCtrl()) 752 if (viewp && viewp->isCtrl())
@@ -790,7 +756,7 @@ LLCtrlListInterface* LLUICtrlFactory::getListInterfaceByName(LLPanel* panelp, co
790 return NULL; 756 return NULL;
791} 757}
792 758
793LLCtrlSelectionInterface* LLUICtrlFactory::getSelectionInterfaceByName(LLPanel* panelp, const LLString& name) 759LLCtrlSelectionInterface* LLUICtrlFactory::getSelectionInterfaceByName(const LLPanel* panelp, const LLString& name)
794{ 760{
795 LLView* viewp = panelp->getCtrlByNameAndType(name, WIDGET_TYPE_DONTCARE); 761 LLView* viewp = panelp->getCtrlByNameAndType(name, WIDGET_TYPE_DONTCARE);
796 if (viewp && viewp->isCtrl()) 762 if (viewp && viewp->isCtrl())
@@ -800,7 +766,7 @@ LLCtrlSelectionInterface* LLUICtrlFactory::getSelectionInterfaceByName(LLPanel*
800 return NULL; 766 return NULL;
801} 767}
802 768
803LLCtrlScrollInterface* LLUICtrlFactory::getScrollInterfaceByName(LLPanel* panelp, const LLString& name) 769LLCtrlScrollInterface* LLUICtrlFactory::getScrollInterfaceByName(const LLPanel* panelp, const LLString& name)
804{ 770{
805 LLView* viewp = panelp->getCtrlByNameAndType(name, WIDGET_TYPE_DONTCARE); 771 LLView* viewp = panelp->getCtrlByNameAndType(name, WIDGET_TYPE_DONTCARE);
806 if (viewp && viewp->isCtrl()) 772 if (viewp && viewp->isCtrl())
diff --git a/linden/indra/llui/lluictrlfactory.h b/linden/indra/llui/lluictrlfactory.h
index fbb8d96..e6a2cd3 100644
--- a/linden/indra/llui/lluictrlfactory.h
+++ b/linden/indra/llui/lluictrlfactory.h
@@ -38,68 +38,35 @@
38#include "llcallbackmap.h" 38#include "llcallbackmap.h"
39#include "llfloater.h" 39#include "llfloater.h"
40 40
41class LLControlGroup;
42class LLView; 41class LLView;
43class LLFontGL;
44
45class LLFloater;
46class LLPanel; 42class LLPanel;
47class LLButton;
48class LLCheckBoxCtrl;
49class LLComboBox;
50class LLIconCtrl;
51class LLLineEditor;
52class LLMenuGL;
53class LLMenuBarGL;
54class LLMenuItemCallGL;
55class LLNameListCtrl;
56class LLPieMenu;
57class LLRadioGroup;
58class LLSearchEditor;
59class LLScrollableContainerView;
60class LLScrollListCtrl;
61class LLSlider;
62class LLSliderCtrl;
63class LLSpinCtrl;
64class LLTextBox;
65class LLTextEditor;
66class LLTextureCtrl;
67class LLWebBrowserCtrl;
68class LLViewBorder;
69class LLColorSwatchCtrl;
70class LLScrollingPanelList;
71class LLCtrlListInterface;
72class LLCtrlSelectionInterface;
73class LLCtrlScrollInterface;
74
75// Widget
76 43
77class LLUICtrlFactory 44class LLUICtrlFactory
78{ 45{
79public: 46public:
80 LLUICtrlFactory(); 47 LLUICtrlFactory();
81 // do not call! needs to be public so run-time can clean up the singleton 48 // do not call! needs to be public so run-time can clean up the singleton
82 virtual ~LLUICtrlFactory(); 49 virtual ~LLUICtrlFactory() {}
83 50
84 void setupPaths(); 51 void setupPaths();
85 52
86 void buildFloater(LLFloater* floaterp, const LLString &filename, 53 void buildFloater(LLFloater* floaterp, const LLString &filename,
87 const LLCallbackMap::map_t* factory_map = NULL, BOOL open = TRUE); 54 const LLCallbackMap::map_t* factory_map = NULL, BOOL open = TRUE);
88
89 BOOL buildPanel(LLPanel* panelp, const LLString &filename, 55 BOOL buildPanel(LLPanel* panelp, const LLString &filename,
90 const LLCallbackMap::map_t* factory_map = NULL); 56 const LLCallbackMap::map_t* factory_map = NULL);
91 57
92 LLMenuGL *buildMenu(const LLString &filename, LLView* parentp); 58 void removePanel(LLPanel* panelp) { mBuiltPanels.erase(panelp->getHandle()); }
59 void removeFloater(LLFloater* floaterp) { mBuiltFloaters.erase(floaterp->getHandle()); }
93 60
94 LLPieMenu *buildPieMenu(const LLString &filename, LLView* parentp); 61 class LLMenuGL *buildMenu(const LLString &filename, LLView* parentp);
62 class LLPieMenu *buildPieMenu(const LLString &filename, LLView* parentp);
95 63
96 // Does what you want for LLFloaters and LLPanels 64 // Does what you want for LLFloaters and LLPanels
97 // Returns 0 on success 65 // Returns 0 on success
98 S32 saveToXML(LLView* viewp, const LLString& filename); 66 S32 saveToXML(LLView* viewp, const LLString& filename);
99 67
100 void removePanel(LLPanel* panelp);
101 void removeFloater(LLFloater* floaterp);
102 68
69 // Rebuilds all currently built panels.
103 void rebuild(); 70 void rebuild();
104 71
105 static EWidgetType getWidgetType(const LLString& ctrl_type); 72 static EWidgetType getWidgetType(const LLString& ctrl_type);
@@ -107,38 +74,44 @@ public:
107 static BOOL getAttributeColor(LLXMLNodePtr node, const LLString& name, LLColor4& color); 74 static BOOL getAttributeColor(LLXMLNodePtr node, const LLString& name, LLColor4& color);
108 75
109 // specific typed getters 76 // specific typed getters
110 static LLButton* getButtonByName( LLPanel* panelp, const LLString& name); 77 static class LLButton* getButtonByName( const LLPanel* panelp, const LLString& name);
111 static LLCheckBoxCtrl* getCheckBoxByName( LLPanel* panelp, const LLString& name); 78 static class LLCheckBoxCtrl* getCheckBoxByName( const LLPanel* panelp, const LLString& name);
112 static LLComboBox* getComboBoxByName( LLPanel* panelp, const LLString& name); 79 static class LLComboBox* getComboBoxByName( const LLPanel* panelp, const LLString& name);
113 static LLIconCtrl* getIconByName( LLPanel* panelp, const LLString& name); 80 static class LLIconCtrl* getIconByName( const LLPanel* panelp, const LLString& name);
114 static LLLineEditor* getLineEditorByName( LLPanel* panelp, const LLString& name); 81 static class LLLineEditor* getLineEditorByName( const LLPanel* panelp, const LLString& name);
115 static LLNameListCtrl* getNameListByName( LLPanel* panelp, const LLString& name); 82 static class LLRadioGroup* getRadioGroupByName( const LLPanel* panelp, const LLString& name);
116 static LLRadioGroup* getRadioGroupByName( LLPanel* panelp, const LLString& name); 83 static class LLScrollListCtrl* getScrollListByName( const LLPanel* panelp, const LLString& name);
117 static LLScrollListCtrl* getScrollListByName( LLPanel* panelp, const LLString& name); 84 static class LLSliderCtrl* getSliderByName( const LLPanel* panelp, const LLString& name);
118 static LLSliderCtrl* getSliderByName( LLPanel* panelp, const LLString& name); 85 static class LLSlider* getSliderBarByName( const LLPanel* panelp, const LLString& name);
119 static LLSlider* getSliderBarByName( LLPanel* panelp, const LLString& name); 86 static class LLSpinCtrl* getSpinnerByName( const LLPanel* panelp, const LLString& name);
120 static LLSpinCtrl* getSpinnerByName( LLPanel* panelp, const LLString& name); 87 static class LLTextBox* getTextBoxByName( const LLPanel* panelp, const LLString& name);
121 static LLTextBox* getTextBoxByName( LLPanel* panelp, const LLString& name); 88 static class LLTextEditor* getTextEditorByName( const LLPanel* panelp, const LLString& name);
122 static LLTextEditor* getTextEditorByName( LLPanel* panelp, const LLString& name); 89 static class LLTabContainer* getTabContainerByName( const LLPanel* panelp, const LLString& name);
123 static LLTabContainerCommon* getTabContainerByName( LLPanel* panelp, const LLString& name); 90 static class LLScrollableContainerView* getScrollableContainerByName(const LLPanel* panelp, const LLString& name);
124 static LLScrollableContainerView* getScrollableContainerByName(LLPanel* panelp, const LLString& name); 91 static class LLPanel* getPanelByName( const LLPanel* panelp, const LLString& name);
125 static LLTextureCtrl* getTexturePickerByName( LLPanel* panelp, const LLString& name); 92 static class LLMenuItemCallGL* getMenuItemCallByName( const LLPanel* panelp, const LLString& name);
126 static LLPanel* getPanelByName(LLPanel* panelp, const LLString& name); 93 static class LLScrollingPanelList* getScrollingPanelList( const LLPanel* panelp, const LLString& name);
127 static LLColorSwatchCtrl* getColorSwatchByName(LLPanel* panelp, const LLString& name); 94 static class LLMultiSliderCtrl* getMultiSliderByName( const LLPanel* panelp, const LLString& name);
128 static LLWebBrowserCtrl* getWebBrowserCtrlByName(LLPanel* panelp, const LLString& name); 95 static class LLMultiSlider* getMultiSliderBarByName(const LLPanel* panelp, const LLString& name);
129 static LLMenuItemCallGL* getMenuItemCallByName(LLPanel* panelp, const LLString& name);
130 static LLScrollingPanelList* getScrollingPanelList(LLPanel* panelp, const LLString& name);
131 96
132 // interface getters 97 // interface getters
133 static LLCtrlListInterface* getListInterfaceByName(LLPanel* panelp, const LLString& name); 98 static LLCtrlListInterface* getListInterfaceByName( const LLPanel* panelp, const LLString& name);
134 static LLCtrlSelectionInterface* getSelectionInterfaceByName(LLPanel* panelp, const LLString& name); 99 static LLCtrlSelectionInterface* getSelectionInterfaceByName(const LLPanel* panelp, const LLString& name);
135 static LLCtrlScrollInterface* getScrollInterfaceByName(LLPanel* panelp, const LLString& name); 100 static LLCtrlScrollInterface* getScrollInterfaceByName(const LLPanel* panelp, const LLString& name);
136 101
137 LLPanel* createFactoryPanel(LLString name); 102 LLPanel* createFactoryPanel(LLString name);
138 103
139 virtual LLView* createCtrlWidget(LLPanel *parent, LLXMLNodePtr node); 104 virtual LLView* createCtrlWidget(LLPanel *parent, LLXMLNodePtr node);
140 virtual void createWidget(LLPanel *parent, LLXMLNodePtr node); 105 virtual void createWidget(LLPanel *parent, LLXMLNodePtr node);
141 106
107 template <class T> T* createDummyWidget(const LLString& name)
108 {
109 return NULL;
110 //static LLPanel dummy_panel;
111 //LLXMLNodePtr new_node_ptr = new LLXMLNode(T::getWidgetTag(), FALSE);
112 //return createWidget(&dummy_panel, new_node_ptr);
113 }
114
142 // Creator library 115 // Creator library
143 typedef LLView* (*creator_function_t)(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 116 typedef LLView* (*creator_function_t)(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
144 void registerCreator(LLString ctrlname, creator_function_t function); 117 void registerCreator(LLString ctrlname, creator_function_t function);
@@ -147,10 +120,21 @@ public:
147 120
148protected: 121protected:
149 122
123 template<class T>
124 class LLUICtrlCreator
125 {
126 public:
127 static void registerCreator(LLString name, LLUICtrlFactory *factory)
128 {
129 factory->registerCreator(name, T::fromXML);
130 }
131 };
132
133private:
150 134
151 typedef std::map<LLViewHandle, LLString> built_panel_t; 135 typedef std::map<LLHandle<LLPanel>, LLString> built_panel_t;
152 built_panel_t mBuiltPanels; 136 built_panel_t mBuiltPanels;
153 typedef std::map<LLViewHandle, LLString> built_floater_t; 137 typedef std::map<LLHandle<LLFloater>, LLString> built_floater_t;
154 built_floater_t mBuiltFloaters; 138 built_floater_t mBuiltFloaters;
155 139
156 std::deque<const LLCallbackMap::map_t*> mFactoryStack; 140 std::deque<const LLCallbackMap::map_t*> mFactoryStack;
@@ -162,14 +146,5 @@ protected:
162 static std::vector<LLString> mXUIPaths; 146 static std::vector<LLString> mXUIPaths;
163}; 147};
164 148
165template<class T>
166class LLUICtrlCreator
167{
168public:
169 static void registerCreator(LLString name, LLUICtrlFactory *factory)
170 {
171 factory->registerCreator(name, T::fromXML);
172 }
173};
174 149
175#endif //LL_LLWIDGETFACTORY_H 150#endif //LLUICTRLFACTORY_H
diff --git a/linden/indra/llui/lluifwd.h b/linden/indra/llui/lluifwd.h
new file mode 100644
index 0000000..758a0e4
--- /dev/null
+++ b/linden/indra/llui/lluifwd.h
@@ -0,0 +1,63 @@
1/**
2 * @file lluifwd.h
3 * @brief Forward declarations of common LLUI widget types.
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2008, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
30 */
31
32#ifndef LLUIFWD_H
33#define LLUIFWD_H
34
35class LLButton;
36class LLCheckBoxCtrl;
37class LLComboBox;
38class LLDragHandle;
39class LLFloater;
40class LLIconCtrl;
41class LLLineEditor;
42class LLMenuGL;
43class LLPanel;
44class LLRadioGroup;
45class LLResizeBar;
46class LLResizeHandle;
47class LLScrollbar;
48class LLScrollContainer;
49class LLScrollingPanelList;
50class LLScrollListCtrl;
51class LLSlider;
52class LLSliderCtrl;
53class LLSpinCtrl;
54class LLTabContainer;
55class LLTabContainerVertical;
56class LLTextBox;
57class LLTextEditor;
58class LLTextureCtrl;
59class LLUICtrl;
60class LLView;
61class LLViewBorder;
62
63#endif
diff --git a/linden/indra/llui/lluistring.cpp b/linden/indra/llui/lluistring.cpp
index d3b5a52..2eb7f28 100644
--- a/linden/indra/llui/lluistring.cpp
+++ b/linden/indra/llui/lluistring.cpp
@@ -1,6 +1,6 @@
1/** 1/**
2 * @file lluistring.cpp 2 * @file lluistring.cpp
3 * @brief LLUIString base class 3 * @brief LLUIString implementation.
4 * 4 *
5 * $LicenseInfo:firstyear=2006&license=viewergpl$ 5 * $LicenseInfo:firstyear=2006&license=viewergpl$
6 * 6 *
@@ -30,14 +30,11 @@
30 */ 30 */
31 31
32#include "linden_common.h" 32#include "linden_common.h"
33
34#include "lluistring.h" 33#include "lluistring.h"
35 34
36const LLString::format_map_t LLUIString::sNullArgs; 35const LLString::format_map_t LLUIString::sNullArgs;
37 36
38 37
39// public
40
41LLUIString::LLUIString(const LLString& instring, const LLString::format_map_t& args) 38LLUIString::LLUIString(const LLString& instring, const LLString::format_map_t& args)
42 : mOrig(instring), 39 : mOrig(instring),
43 mArgs(args) 40 mArgs(args)
@@ -98,13 +95,6 @@ void LLUIString::clear()
98 mWResult.clear(); 95 mWResult.clear();
99} 96}
100 97
101void LLUIString::clearArgs()
102{
103 mArgs.clear();
104}
105
106// private
107
108void LLUIString::format() 98void LLUIString::format()
109{ 99{
110 mResult = mOrig; 100 mResult = mOrig;
diff --git a/linden/indra/llui/lluistring.h b/linden/indra/llui/lluistring.h
index 4e9bb55..e8a86f4 100644
--- a/linden/indra/llui/lluistring.h
+++ b/linden/indra/llui/lluistring.h
@@ -1,7 +1,7 @@
1/** 1/**
2 * @file lluistring.h 2 * @file lluistring.h
3 * @author: Steve Bennetts 3 * @author: Steve Bennetts
4 * @brief LLUIString base class 4 * @brief A fancy wrapper for LLString supporting argument substitutions.
5 * 5 *
6 * $LicenseInfo:firstyear=2006&license=viewergpl$ 6 * $LicenseInfo:firstyear=2006&license=viewergpl$
7 * 7 *
@@ -33,12 +33,6 @@
33#ifndef LL_LLUISTRING_H 33#ifndef LL_LLUISTRING_H
34#define LL_LLUISTRING_H 34#define LL_LLUISTRING_H
35 35
36// lluistring.h
37//
38// Copyright 2006, Linden Research, Inc.
39// Original aurthor: Steve
40
41#include "stdtypes.h"
42#include "llstring.h" 36#include "llstring.h"
43#include <string> 37#include <string>
44 38
@@ -89,7 +83,7 @@ public:
89 S32 length() const { return mWResult.size(); } 83 S32 length() const { return mWResult.size(); }
90 84
91 void clear(); 85 void clear();
92 void clearArgs(); 86 void clearArgs() { mArgs.clear(); }
93 87
94 // These utuilty functions are included for text editing. 88 // These utuilty functions are included for text editing.
95 // They do not affect mOrig and do not perform argument substitution 89 // They do not affect mOrig and do not perform argument substitution
diff --git a/linden/indra/llui/lluixmltags.h b/linden/indra/llui/lluixmltags.h
index 1afcb00..cfc57b1 100644
--- a/linden/indra/llui/lluixmltags.h
+++ b/linden/indra/llui/lluixmltags.h
@@ -31,94 +31,95 @@
31#ifndef LL_UI_XML_TAGS_H 31#ifndef LL_UI_XML_TAGS_H
32#define LL_UI_XML_TAGS_H 32#define LL_UI_XML_TAGS_H
33 33
34#define LL_BUTTON_TAG LLString("button") 34const LLString
35#define LL_UI_CTRL_LOCATE_TAG LLString("locate") 35 LL_BUTTON_TAG("button"),
36#define LL_PAD_TAG LLString("pad") 36 LL_UI_CTRL_LOCATE_TAG("locate"),
37#define LL_CHECK_BOX_CTRL_TAG LLString("check_box") 37 LL_PAD_TAG("pad"),
38#define LL_COMBO_BOX_TAG LLString("combo_box") 38 LL_CHECK_BOX_CTRL_TAG("check_box"),
39#define LL_DRAG_HANDLE_TOP_TAG LLString("drag_handle_top") 39 LL_COMBO_BOX_TAG("combo_box"),
40#define LL_DRAG_HANDLE_LEFT_TAG LLString("drag_handle_left") 40 LL_DRAG_HANDLE_TOP_TAG("drag_handle_top"),
41#define LL_FLOATER_TAG LLString("floater") 41 LL_DRAG_HANDLE_LEFT_TAG("drag_handle_left"),
42#define LL_FLOATER_VIEW_TAG LLString("floater_view") 42 LL_FLOATER_TAG("floater"),
43#define LL_MULTI_FLOATER_TAG LLString("multi_floater") 43 LL_FLOATER_VIEW_TAG("floater_view"),
44#define LL_ICON_CTRL_TAG LLString("icon") 44 LL_MULTI_FLOATER_TAG("multi_floater"),
45#define LL_LINE_EDITOR_TAG LLString("line_editor") 45 LL_ICON_CTRL_TAG("icon"),
46#define LL_SEARCH_EDITOR_TAG LLString("search_editor") 46 LL_LINE_EDITOR_TAG("line_editor"),
47#define LL_MENU_ITEM_TAG LLString("menu_item") 47 LL_SEARCH_EDITOR_TAG("search_editor"),
48#define LL_MENU_GL_TAG LLString("menu") 48 LL_MENU_ITEM_TAG("menu_item"),
49#define LL_MENU_BAR_GL_TAG LLString("menu_bar") 49 LL_MENU_GL_TAG("menu"),
50#define LL_MENU_HOLDER_GL_TAG LLString("menu_holder") 50 LL_MENU_BAR_GL_TAG("menu_bar"),
51#define LL_PANEL_TAG LLString("panel") 51 LL_MENU_HOLDER_GL_TAG("menu_holder"),
52#define LL_RADIO_GROUP_TAG LLString("radio_group") 52 LL_PANEL_TAG("panel"),
53#define LL_RESIZE_BAR_TAG LLString("resize_bar") 53 LL_RADIO_GROUP_TAG("radio_group"),
54#define LL_RESIZE_HANDLE_TAG LLString("resize_handle") 54 LL_RESIZE_BAR_TAG("resize_bar"),
55#define LL_SCROLLBAR_TAG LLString("scrollbar") 55 LL_RESIZE_HANDLE_TAG("resize_handle"),
56#define LL_SCROLLABLE_CONTAINER_VIEW_TAG LLString("scroll_container") 56 LL_SCROLLBAR_TAG("scrollbar"),
57#define LL_SCROLL_LIST_CTRL_TAG LLString("scroll_list") 57 LL_SCROLLABLE_CONTAINER_VIEW_TAG("scroll_container"),
58#define LL_SLIDER_CTRL_TAG LLString("slider") 58 LL_SCROLL_LIST_CTRL_TAG("scroll_list"),
59#define LL_SLIDER_TAG LLString("slider_bar") 59 LL_SLIDER_CTRL_TAG("slider"),
60#define LL_SPIN_CTRL_TAG LLString("spinner") 60 LL_SLIDER_TAG("slider_bar"),
61#define LL_TAB_CONTAINER_COMMON_TAG LLString("tab_container") 61 LL_MULTI_SLIDER_CTRL_TAG("multi_slider"),
62#define LL_TEXT_BOX_TAG LLString("text") 62 LL_MULTI_SLIDER_TAG("multi_slider_bar"),
63#define LL_TEXT_EDITOR_TAG LLString("text_editor") 63 LL_SPIN_CTRL_TAG("spinner"),
64#define LL_VIEW_BORDER_TAG LLString("view_border") 64 LL_TAB_CONTAINER_COMMON_TAG("tab_container"),
65#define LL_COLOR_SWATCH_TAG LLString("color_swatch") 65 LL_TEXT_BOX_TAG("text"),
66#define LL_INVENTORY_PANEL_TAG LLString("inventory_panel") 66 LL_TEXT_EDITOR_TAG("text_editor"),
67#define LL_NAME_EDITOR_TAG LLString("name_editor") 67 LL_VIEW_BORDER_TAG("view_border"),
68#define LL_NAME_LIST_TAG LLString("name_list") 68 LL_COLOR_SWATCH_TAG("color_swatch"),
69#define LL_TEXTURE_PICKER_TAG LLString("texture_picker") 69 LL_INVENTORY_PANEL_TAG("inventory_panel"),
70#define LL_VOLUME_SLIDER_CTRL_TAG LLString("volume_slider") 70 LL_NAME_EDITOR_TAG("name_editor"),
71#define LL_WEB_BROWSER_CTRL_TAG LLString("web_browser") 71 LL_NAME_LIST_TAG("name_list"),
72#define LL_STAT_VIEW_TAG LLString("stat_view") 72 LL_TEXTURE_PICKER_TAG("texture_picker"),
73#define LL_INVENTORY_PANEL_TAG LLString("inventory_panel") 73 LL_VOLUME_SLIDER_CTRL_TAG("volume_slider"),
74#define LL_PROGRESS_VIEW_TAG LLString("progress_view") 74 LL_WEB_BROWSER_CTRL_TAG("web_browser"),
75#define LL_STAT_BAR_TAG LLString("stat_bar") 75 LL_STAT_VIEW_TAG("stat_view"),
76#define LL_STATUS_BAR_TAG LLString("status_bar") 76 LL_PROGRESS_VIEW_TAG("progress_view"),
77#define LL_VIEWER_TEXT_EDITOR_TAG LLString("viewer_text_editor") 77 LL_STAT_BAR_TAG("stat_bar"),
78#define LL_TALK_VIEW_TAG LLString("talk_view") 78 LL_STATUS_BAR_TAG("status_bar"),
79#define LL_COLOR_SWATCH_CTRL_TAG LLString("color_swatch") 79 LL_VIEWER_TEXT_EDITOR_TAG("viewer_text_editor"),
80#define LL_GL_TEX_MEM_BAR_TAG LLString("tex_mem_bar") 80 LL_TALK_VIEW_TAG("talk_view"),
81#define LL_TEXTURE_CTRL_TAG LLString("texture_picker") 81 LL_COLOR_SWATCH_CTRL_TAG("color_swatch"),
82#define LL_TEXTURE_VIEW_TAG LLString("texture_view") 82 LL_GL_TEX_MEM_BAR_TAG("tex_mem_bar"),
83#define LL_NAME_LIST_CTRL_TAG LLString("name_list") 83 LL_TEXTURE_CTRL_TAG("texture_picker"),
84#define LL_STAT_GRAPH_TAG LLString("stat_graph") 84 LL_TEXTURE_VIEW_TAG("texture_view"),
85#define LL_NAME_EDITOR_TAG LLString("name_editor") 85 LL_NAME_LIST_CTRL_TAG("name_list"),
86#define LL_DROP_TARGET_TAG LLString("drop_target") 86 LL_STAT_GRAPH_TAG("stat_graph"),
87#define LL_OVERLAY_BAR_TAG LLString("overlay_bar") 87 LL_DROP_TARGET_TAG("drop_target"),
88#define LL_NET_MAP_TAG LLString("net_map") 88 LL_OVERLAY_BAR_TAG("overlay_bar"),
89#define LL_HUD_VIEW_TAG LLString("hud_view") 89 LL_NET_MAP_TAG("net_map"),
90#define LL_MEMORY_VIEW_TAG LLString("memory_view") 90 LL_HUD_VIEW_TAG("hud_view"),
91#define LL_MEDIA_REMOTE_CTRL_TAG LLString("media_remote") 91 LL_MEMORY_VIEW_TAG("memory_view"),
92#define LL_MORPH_VIEW_TAG LLString("morph_view") 92 LL_MEDIA_REMOTE_CTRL_TAG("media_remote"),
93#define LL_FRAME_STAT_VIEW_TAG LLString("frame_stat_view") 93 LL_MORPH_VIEW_TAG("morph_view"),
94#define LL_FOLDER_VIEW_TAG LLString("folder_view") 94 LL_FRAME_STAT_VIEW_TAG("frame_stat_view"),
95#define LL_SNAPSHOT_LIVE_PREVIEW_TAG LLString("snapshot_preview") 95 LL_FOLDER_VIEW_TAG("folder_view"),
96#define LL_HOVER_VIEW_TAG LLString("hover_view") 96 LL_SNAPSHOT_LIVE_PREVIEW_TAG("snapshot_preview"),
97#define LL_VELOCITY_BAR_TAG LLString("velocity_bar") 97 LL_HOVER_VIEW_TAG("hover_view"),
98#define LL_PERMISSIONS_VIEW_TAG LLString("permissions_view") 98 LL_VELOCITY_BAR_TAG("velocity_bar"),
99#define LL_SCROLLING_PANEL_LIST_TAG LLString("scrolling_panel_list") 99 LL_PERMISSIONS_VIEW_TAG("permissions_view"),
100#define LL_CONTAINER_VIEW_TAG LLString("container_view") 100 LL_SCROLLING_PANEL_LIST_TAG("scrolling_panel_list"),
101#define LL_CONSOLE_TAG LLString("console") 101 LL_CONTAINER_VIEW_TAG("container_view"),
102#define LL_DEBUG_VIEW_TAG LLString("debug_view") 102 LL_CONSOLE_TAG("console"),
103#define LL_AUDIOSTATUS_TAG LLString("audio_status") 103 LL_DEBUG_VIEW_TAG("debug_view"),
104#define LL_FAST_TIMER_VIEW_TAG LLString("fast_timer_view") 104 LL_AUDIOSTATUS_TAG("audio_status"),
105#define LL_MENU_ITEM_TEAR_OFF_GL_TAG LLString("tearoff_menu") 105 LL_FAST_TIMER_VIEW_TAG("fast_timer_view"),
106#define LL_MENU_ITEM_BLANK_GL_TAG LLString("menu_item_blank") 106 LL_MENU_ITEM_TEAR_OFF_GL_TAG("tearoff_menu"),
107#define LL_MENU_ITEM_CALL_GL_TAG LLString("menu_item_call") 107 LL_MENU_ITEM_BLANK_GL_TAG("menu_item_blank"),
108#define LL_MENU_ITEM_CHECK_GL_TAG LLString("menu_item_check") 108 LL_MENU_ITEM_CALL_GL_TAG("menu_item_call"),
109#define LL_MENU_ITEM_BRANCH_GL_TAG LLString("menu_item_branch") 109 LL_MENU_ITEM_CHECK_GL_TAG("menu_item_check"),
110#define LL_MENU_ITEM_BRANCH_DOWN_GL_TAG LLString("menu_item_branch_down") 110 LL_MENU_ITEM_BRANCH_GL_TAG("menu_item_branch"),
111#define LL_PIE_MENU_BRANCH_TAG LLString("pie_menu_branch") 111 LL_MENU_ITEM_BRANCH_DOWN_GL_TAG("menu_item_branch_down"),
112#define LL_PIE_MENU_TAG LLString("pie_menu") 112 LL_PIE_MENU_BRANCH_TAG("pie_menu_branch"),
113#define LL_MENU_ITEM_SEPARATOR_GL_TAG LLString("menu_item_separator") 113 LL_PIE_MENU_TAG("pie_menu"),
114#define LL_MENU_ITEM_VERTICAL_SEPARATOR_GL_TAG LLString("menu_item_vertical_separator") 114 LL_MENU_ITEM_SEPARATOR_GL_TAG("menu_item_separator"),
115#define LL_ROOT_VIEW_TAG LLString("root_view") 115 LL_MENU_ITEM_VERTICAL_SEPARATOR_GL_TAG("menu_item_vertical_separator"),
116#define LL_FOLDER_VIEW_ITEM_TAG LLString("folder_item") 116 LL_ROOT_VIEW_TAG("root_view"),
117#define LL_FOLDER_VIEW_FOLDER_TAG LLString("folder") 117 LL_FOLDER_VIEW_ITEM_TAG("folder_item"),
118#define LL_TEXTURE_BAR_TAG LLString("texture_bar") 118 LL_FOLDER_VIEW_FOLDER_TAG("folder"),
119#define LL_JOYSTICK_SLIDE LLString("joystick_slide") 119 LL_TEXTURE_BAR_TAG("texture_bar"),
120#define LL_JOYSTICK_TURN LLString("joystick_turn") 120 LL_JOYSTICK_SLIDE("joystick_slide"),
121#define LL_GROUP_DROP_TARGET_TAG LLString("group_drop_target") 121 LL_JOYSTICK_TURN("joystick_turn"),
122#define LL_LAYOUT_STACK_TAG LLString("layout_stack") 122 LL_GROUP_DROP_TARGET_TAG("group_drop_target"),
123 LL_LAYOUT_STACK_TAG("layout_stack");
123#define LL_FLYOUT_BUTTON_TAG "flyout_button" 124#define LL_FLYOUT_BUTTON_TAG "flyout_button"
124#endif 125#endif
diff --git a/linden/indra/llui/llundo.cpp b/linden/indra/llui/llundo.cpp
index a267ae2..4fdf9d3 100644
--- a/linden/indra/llui/llundo.cpp
+++ b/linden/indra/llui/llundo.cpp
@@ -1,6 +1,5 @@
1/** 1/**
2 * @file llundo.cpp 2 * @file llundo.cpp
3 * @brief LLUndo class
4 * 3 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$ 4 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 * 5 *
@@ -29,12 +28,8 @@
29 * $/LicenseInfo$ 28 * $/LicenseInfo$
30 */ 29 */
31 30
32// Generic interface for undo/redo circular buffer
33
34#include "linden_common.h" 31#include "linden_common.h"
35
36#include "llundo.h" 32#include "llundo.h"
37#include "llerror.h"
38 33
39 34
40// TODO: 35// TODO:
@@ -82,7 +77,7 @@ LLUndoBuffer::~LLUndoBuffer()
82//----------------------------------------------------------------------------- 77//-----------------------------------------------------------------------------
83// getNextAction() 78// getNextAction()
84//----------------------------------------------------------------------------- 79//-----------------------------------------------------------------------------
85LLUndoAction *LLUndoBuffer::getNextAction(BOOL setClusterBegin) 80LLUndoBuffer::LLUndoAction* LLUndoBuffer::getNextAction(BOOL setClusterBegin)
86{ 81{
87 LLUndoAction *nextAction = mActions[mNextAction]; 82 LLUndoAction *nextAction = mActions[mNextAction];
88 83
diff --git a/linden/indra/llui/llundo.h b/linden/indra/llui/llundo.h
index 2bf04bc..6921259 100644
--- a/linden/indra/llui/llundo.h
+++ b/linden/indra/llui/llundo.h
@@ -1,6 +1,6 @@
1/** 1/**
2 * @file llundo.h 2 * @file llundo.h
3 * @brief LLUndo class header file 3 * @brief Generic interface for undo/redo circular buffer.
4 * 4 *
5 * $LicenseInfo:firstyear=2000&license=viewergpl$ 5 * $LicenseInfo:firstyear=2000&license=viewergpl$
6 * 6 *
@@ -32,34 +32,24 @@
32#ifndef LL_LLUNDO_H 32#ifndef LL_LLUNDO_H
33#define LL_LLUNDO_H 33#define LL_LLUNDO_H
34 34
35class LLUndoAction
36{
37 friend class LLUndoBuffer;
38protected:
39 S32 mClusterID;
40protected:
41 LLUndoAction(): mClusterID(0) {};
42 virtual ~LLUndoAction(){};
43
44public:
45 static LLUndoAction *create() { return NULL; }
46
47 virtual void undo() = 0;
48 virtual void redo() = 0;
49 virtual void cleanup() {};
50};
51 35
52class LLUndoBuffer 36class LLUndoBuffer
53{ 37{
54protected:
55 LLUndoAction **mActions; // array of pointers to undoactions
56 S32 mNumActions; // total number of actions in ring buffer
57 S32 mNextAction; // next action to perform undo/redo on
58 S32 mLastAction; // last action actually added to undo buffer
59 S32 mFirstAction; // beginning of ring buffer (don't undo any further)
60 S32 mOperationID; // current operation id, for undoing and redoing in clusters
61
62public: 38public:
39 class LLUndoAction
40 {
41 friend class LLUndoBuffer;
42 public:
43 virtual void undo() = 0;
44 virtual void redo() = 0;
45 virtual void cleanup() {};
46 protected:
47 LLUndoAction(): mClusterID(0) {};
48 virtual ~LLUndoAction(){};
49 private:
50 S32 mClusterID;
51 };
52
63 LLUndoBuffer( LLUndoAction (*create_func()), S32 initial_count ); 53 LLUndoBuffer( LLUndoAction (*create_func()), S32 initial_count );
64 virtual ~LLUndoBuffer(); 54 virtual ~LLUndoBuffer();
65 55
@@ -70,6 +60,14 @@ public:
70 BOOL canRedo() { return (mNextAction != mLastAction); } 60 BOOL canRedo() { return (mNextAction != mLastAction); }
71 61
72 void flushActions(); 62 void flushActions();
63
64private:
65 LLUndoAction **mActions; // array of pointers to undoactions
66 S32 mNumActions; // total number of actions in ring buffer
67 S32 mNextAction; // next action to perform undo/redo on
68 S32 mLastAction; // last action actually added to undo buffer
69 S32 mFirstAction; // beginning of ring buffer (don't undo any further)
70 S32 mOperationID; // current operation id, for undoing and redoing in clusters
73}; 71};
74 72
75#endif //LL_LLUNDO_H 73#endif //LL_LLUNDO_H
diff --git a/linden/indra/llui/llview.cpp b/linden/indra/llui/llview.cpp
index 39398b0..fbcb69e 100644
--- a/linden/indra/llui/llview.cpp
+++ b/linden/indra/llui/llview.cpp
@@ -37,6 +37,7 @@
37#include <cassert> 37#include <cassert>
38#include <boost/tokenizer.hpp> 38#include <boost/tokenizer.hpp>
39 39
40#include "llglimmediate.h"
40#include "llevent.h" 41#include "llevent.h"
41#include "llfontgl.h" 42#include "llfontgl.h"
42#include "llfocusmgr.h" 43#include "llfocusmgr.h"
@@ -61,48 +62,11 @@ BOOL LLView::sForceReshape = FALSE;
61LLView* LLView::sEditingUIView = NULL; 62LLView* LLView::sEditingUIView = NULL;
62S32 LLView::sLastLeftXML = S32_MIN; 63S32 LLView::sLastLeftXML = S32_MIN;
63S32 LLView::sLastBottomXML = S32_MIN; 64S32 LLView::sLastBottomXML = S32_MIN;
64std::map<LLViewHandle,LLView*> LLView::sViewHandleMap;
65
66S32 LLViewHandle::sNextID = 0;
67LLViewHandle LLViewHandle::sDeadHandle;
68 65
69#if LL_DEBUG 66#if LL_DEBUG
70BOOL LLView::sIsDrawing = FALSE; 67BOOL LLView::sIsDrawing = FALSE;
71#endif 68#endif
72 69
73//static
74LLView* LLView::getViewByHandle(LLViewHandle handle)
75{
76 if (handle == LLViewHandle::sDeadHandle)
77 {
78 return NULL;
79 }
80 std::map<LLViewHandle,LLView*>::iterator iter = sViewHandleMap.find(handle);
81 if (iter != sViewHandleMap.end())
82 {
83 return iter->second;
84 }
85 else
86 {
87 return NULL;
88 }
89}
90
91//static
92BOOL LLView::deleteViewByHandle(LLViewHandle handle)
93{
94 std::map<LLViewHandle,LLView*>::iterator iter = sViewHandleMap.find(handle);
95 if (iter != sViewHandleMap.end())
96 {
97 delete iter->second; // will remove from map
98 return TRUE;
99 }
100 else
101 {
102 return FALSE;
103 }
104}
105
106LLView::LLView() : 70LLView::LLView() :
107 mParentView(NULL), 71 mParentView(NULL),
108 mReshapeFlags(FOLLOWS_NONE), 72 mReshapeFlags(FOLLOWS_NONE),
@@ -115,11 +79,8 @@ LLView::LLView() :
115 mLastVisible(TRUE), 79 mLastVisible(TRUE),
116 mUseBoundingRect(FALSE), 80 mUseBoundingRect(FALSE),
117 mVisible(TRUE), 81 mVisible(TRUE),
118 mHidden(FALSE),
119 mNextInsertionOrdinal(0) 82 mNextInsertionOrdinal(0)
120{ 83{
121 mViewHandle.init();
122 sViewHandleMap[mViewHandle] = this;
123} 84}
124 85
125LLView::LLView(const LLString& name, BOOL mouse_opaque) : 86LLView::LLView(const LLString& name, BOOL mouse_opaque) :
@@ -135,11 +96,8 @@ LLView::LLView(const LLString& name, BOOL mouse_opaque) :
135 mLastVisible(TRUE), 96 mLastVisible(TRUE),
136 mUseBoundingRect(FALSE), 97 mUseBoundingRect(FALSE),
137 mVisible(TRUE), 98 mVisible(TRUE),
138 mHidden(FALSE),
139 mNextInsertionOrdinal(0) 99 mNextInsertionOrdinal(0)
140{ 100{
141 mViewHandle.init();
142 sViewHandleMap[mViewHandle] = this;
143} 101}
144 102
145 103
@@ -159,11 +117,8 @@ LLView::LLView(
159 mLastVisible(TRUE), 117 mLastVisible(TRUE),
160 mUseBoundingRect(FALSE), 118 mUseBoundingRect(FALSE),
161 mVisible(TRUE), 119 mVisible(TRUE),
162 mHidden(FALSE),
163 mNextInsertionOrdinal(0) 120 mNextInsertionOrdinal(0)
164{ 121{
165 mViewHandle.init();
166 sViewHandleMap[mViewHandle] = this;
167} 122}
168 123
169 124
@@ -183,8 +138,6 @@ LLView::~LLView()
183 gFocusMgr.removeMouseCaptureWithoutCallback( this ); 138 gFocusMgr.removeMouseCaptureWithoutCallback( this );
184 } 139 }
185 140
186 sViewHandleMap.erase(mViewHandle);
187
188 deleteAllChildren(); 141 deleteAllChildren();
189 142
190 if (mParentView != NULL) 143 if (mParentView != NULL)
@@ -203,7 +156,7 @@ LLView::~LLView()
203} 156}
204 157
205// virtual 158// virtual
206BOOL LLView::isView() 159BOOL LLView::isView() const
207{ 160{
208 return TRUE; 161 return TRUE;
209} 162}
@@ -215,16 +168,12 @@ BOOL LLView::isCtrl() const
215} 168}
216 169
217// virtual 170// virtual
218BOOL LLView::isPanel() 171BOOL LLView::isPanel() const
219{ 172{
220 return FALSE; 173 return FALSE;
221} 174}
222 175
223void LLView::setMouseOpaque(BOOL b) 176// virtual
224{
225 mMouseOpaque = b;
226}
227
228void LLView::setToolTip(const LLStringExplicit& msg) 177void LLView::setToolTip(const LLStringExplicit& msg)
229{ 178{
230 mToolTipMsg = msg; 179 mToolTipMsg = msg;
@@ -248,52 +197,6 @@ void LLView::setRect(const LLRect& rect)
248 updateBoundingRect(); 197 updateBoundingRect();
249} 198}
250 199
251
252void LLView::setFollows(U32 flags)
253{
254 mReshapeFlags = flags;
255}
256
257void LLView::setFollowsNone()
258{
259 mReshapeFlags = FOLLOWS_NONE;
260}
261
262void LLView::setFollowsLeft()
263{
264 mReshapeFlags |= FOLLOWS_LEFT;
265}
266
267void LLView::setFollowsTop()
268{
269 mReshapeFlags |= FOLLOWS_TOP;
270}
271
272void LLView::setFollowsRight()
273{
274 mReshapeFlags |= FOLLOWS_RIGHT;
275}
276
277void LLView::setFollowsBottom()
278{
279 mReshapeFlags |= FOLLOWS_BOTTOM;
280}
281
282void LLView::setFollowsAll()
283{
284 mReshapeFlags |= FOLLOWS_ALL;
285}
286
287void LLView::setSoundFlags(U8 flags)
288{
289 mSoundFlags = flags;
290}
291
292void LLView::setName(LLString name)
293{
294 mName = name;
295}
296
297void LLView::setUseBoundingRect( BOOL use_bounding_rect ) 200void LLView::setUseBoundingRect( BOOL use_bounding_rect )
298{ 201{
299 if (mUseBoundingRect != use_bounding_rect) 202 if (mUseBoundingRect != use_bounding_rect)
@@ -308,11 +211,6 @@ BOOL LLView::getUseBoundingRect()
308 return mUseBoundingRect; 211 return mUseBoundingRect;
309} 212}
310 213
311const LLString& LLView::getToolTip()
312{
313 return mToolTipMsg.getString();
314}
315
316// virtual 214// virtual
317const LLString& LLView::getName() const 215const LLString& LLView::getName() const
318{ 216{
@@ -452,8 +350,6 @@ void LLView::removeCtrl(LLUICtrl* ctrl)
452 } 350 }
453} 351}
454 352
455S32 LLView::getDefaultTabGroup() const { return mDefaultTabGroup; }
456
457LLView::ctrl_list_t LLView::getCtrlList() const 353LLView::ctrl_list_t LLView::getCtrlList() const
458{ 354{
459 ctrl_list_t controls; 355 ctrl_list_t controls;
@@ -476,12 +372,6 @@ LLView::ctrl_list_t LLView::getCtrlListSorted() const
476 return controls; 372 return controls;
477} 373}
478 374
479LLCompareByTabOrder::LLCompareByTabOrder(LLView::child_tab_order_t order): mTabOrder(order) {}
480
481bool LLCompareByTabOrder::compareTabOrders(const LLView::tab_order_t & a, const LLView::tab_order_t & b) const
482{
483 return a < b;
484}
485 375
486// This method compares two LLViews by the tab order specified in the comparator object. The 376// This method compares two LLViews by the tab order specified in the comparator object. The
487// code for this is a little convoluted because each argument can have four states: 377// code for this is a little convoluted because each argument can have four states:
@@ -537,68 +427,69 @@ BOOL LLView::isInEnabledChain() const
537 return TRUE; 427 return TRUE;
538} 428}
539 429
540BOOL LLView::isFocusRoot() const 430// virtual
431BOOL LLView::canFocusChildren() const
541{ 432{
542 return mIsFocusRoot; 433 return TRUE;
543} 434}
544 435
545LLView* LLView::findRootMostFocusRoot() 436//virtual
437void LLView::setTentative(BOOL b)
546{ 438{
547 LLView* focus_root = NULL;
548 LLView* next_view = this;
549 while(next_view)
550 {
551 if (next_view->isFocusRoot())
552 {
553 focus_root = next_view;
554 }
555 next_view = next_view->getParent();
556 }
557 return focus_root;
558} 439}
559 440
560BOOL LLView::canFocusChildren() const 441//virtual
442BOOL LLView::getTentative() const
561{ 443{
562 return TRUE; 444 return FALSE;
563} 445}
564 446
565BOOL LLView::focusNextRoot() 447//virtual
448void LLView::setEnabled(BOOL enabled)
566{ 449{
567 LLView::child_list_t result = LLView::getFocusRootsQuery().run(this); 450 mEnabled = enabled;
568 return LLView::focusNext(result);
569} 451}
570 452
571BOOL LLView::focusPrevRoot() 453//virtual
454BOOL LLView::setLabelArg( const LLString& key, const LLStringExplicit& text )
572{ 455{
573 LLView::child_list_t result = LLView::getFocusRootsQuery().run(this); 456 return FALSE;
574 return LLView::focusPrev(result);
575} 457}
576 458
577BOOL LLView::focusNextItem(BOOL text_fields_only) 459//virtual
460LLRect LLView::getSnapRect() const
578{ 461{
579 // this assumes that this method is called on the focus root. 462 return mRect;
580 LLCtrlQuery query = LLView::getTabOrderQuery(); 463}
581 if(text_fields_only || LLUI::sConfigGroup->getBOOL("TabToTextFieldsOnly")) 464
582 { 465//virtual
583 query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance()); 466LLRect LLView::getRequiredRect()
584 } 467{
585 LLView::child_list_t result = query(this); 468 return mRect;
469}
470
471//virtual
472void LLView::onFocusLost()
473{
474}
475
476//virtual
477void LLView::onFocusReceived()
478{
479}
480
481BOOL LLView::focusNextRoot()
482{
483 LLView::child_list_t result = LLView::getFocusRootsQuery().run(this);
586 return LLView::focusNext(result); 484 return LLView::focusNext(result);
587} 485}
588 486
589BOOL LLView::focusPrevItem(BOOL text_fields_only) 487BOOL LLView::focusPrevRoot()
590{ 488{
591 // this assumes that this method is called on the focus root. 489 LLView::child_list_t result = LLView::getFocusRootsQuery().run(this);
592 LLCtrlQuery query = LLView::getTabOrderQuery();
593 if(text_fields_only || LLUI::sConfigGroup->getBOOL("TabToTextFieldsOnly"))
594 {
595 query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
596 }
597 LLView::child_list_t result = query(this);
598 return LLView::focusPrev(result); 490 return LLView::focusPrev(result);
599} 491}
600 492
601
602// static 493// static
603BOOL LLView::focusNext(LLView::child_list_t & result) 494BOOL LLView::focusNext(LLView::child_list_t & result)
604{ 495{
@@ -674,80 +565,6 @@ BOOL LLView::focusPrev(LLView::child_list_t & result)
674 return FALSE; 565 return FALSE;
675} 566}
676 567
677BOOL LLView::focusFirstItem(BOOL prefer_text_fields)
678{
679 // search for text field first
680 if(prefer_text_fields)
681 {
682 LLCtrlQuery query = LLView::getTabOrderQuery();
683 query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
684 LLView::child_list_t result = query(this);
685 if(result.size() > 0)
686 {
687 LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front());
688 if(!ctrl->hasFocus())
689 {
690 ctrl->setFocus(TRUE);
691 ctrl->onTabInto();
692 gFocusMgr.triggerFocusFlash();
693 }
694 return TRUE;
695 }
696 }
697 // no text field found, or we don't care about text fields
698 LLView::child_list_t result = LLView::getTabOrderQuery().run(this);
699 if(result.size() > 0)
700 {
701 LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front());
702 if(!ctrl->hasFocus())
703 {
704 ctrl->setFocus(TRUE);
705 ctrl->onTabInto();
706 gFocusMgr.triggerFocusFlash();
707 }
708 return TRUE;
709 }
710 return FALSE;
711}
712
713BOOL LLView::focusLastItem(BOOL prefer_text_fields)
714{
715 // search for text field first
716 if(prefer_text_fields)
717 {
718 LLCtrlQuery query = LLView::getTabOrderQuery();
719 query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
720 LLView::child_list_t result = query(this);
721 if(result.size() > 0)
722 {
723 LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back());
724 if(!ctrl->hasFocus())
725 {
726 ctrl->setFocus(TRUE);
727 ctrl->onTabInto();
728 gFocusMgr.triggerFocusFlash();
729 }
730 return TRUE;
731 }
732 }
733 // no text field found, or we don't care about text fields
734 LLView::child_list_t result = LLView::getTabOrderQuery().run(this);
735 if(result.size() > 0)
736 {
737 LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back());
738 if(!ctrl->hasFocus())
739 {
740 ctrl->setFocus(TRUE);
741 ctrl->onTabInto();
742 gFocusMgr.triggerFocusFlash();
743 }
744 return TRUE;
745 }
746 return FALSE;
747}
748
749
750
751// delete all children. Override this function if you need to 568// delete all children. Override this function if you need to
752// perform any extra clean up such as cached pointers to selected 569// perform any extra clean up such as cached pointers to selected
753// children, etc. 570// children, etc.
@@ -773,23 +590,6 @@ void LLView::setAllChildrenEnabled(BOOL b)
773} 590}
774 591
775// virtual 592// virtual
776void LLView::setTentative(BOOL b)
777{
778}
779
780// virtual
781BOOL LLView::getTentative() const
782{
783 return FALSE;
784}
785
786// virtual
787void LLView::setEnabled(BOOL enabled)
788{
789 mEnabled = enabled;
790}
791
792// virtual
793void LLView::setVisible(BOOL visible) 593void LLView::setVisible(BOOL visible)
794{ 594{
795 if ( mVisible != visible ) 595 if ( mVisible != visible )
@@ -812,18 +612,6 @@ void LLView::setVisible(BOOL visible)
812} 612}
813 613
814// virtual 614// virtual
815void LLView::setHidden(BOOL hidden)
816{
817 mHidden = hidden;
818}
819
820// virtual
821BOOL LLView::setLabelArg(const LLString& key, const LLStringExplicit& text)
822{
823 return FALSE;
824}
825
826// virtual
827void LLView::onVisibilityChange ( BOOL new_visibility ) 615void LLView::onVisibilityChange ( BOOL new_visibility )
828{ 616{
829 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) 617 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
@@ -845,9 +633,9 @@ void LLView::translate(S32 x, S32 y)
845} 633}
846 634
847// virtual 635// virtual
848BOOL LLView::canSnapTo(LLView* other_view) 636BOOL LLView::canSnapTo(const LLView* other_view) const
849{ 637{
850 return other_view->getVisible(); 638 return other_view != this && other_view->getVisible();
851} 639}
852 640
853// virtual 641// virtual
@@ -956,7 +744,7 @@ BOOL LLView::handleKey(KEY key, MASK mask, BOOL called_from_parent)
956 if( called_from_parent ) 744 if( called_from_parent )
957 { 745 {
958 // Downward traversal 746 // Downward traversal
959 if (getVisible() && mEnabled) 747 if (getVisible() && getEnabled())
960 { 748 {
961 handled = childrenHandleKey( key, mask ) != NULL; 749 handled = childrenHandleKey( key, mask ) != NULL;
962 } 750 }
@@ -995,7 +783,7 @@ BOOL LLView::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent)
995 if( called_from_parent ) 783 if( called_from_parent )
996 { 784 {
997 // Downward traversal 785 // Downward traversal
998 if (getVisible() && mEnabled) 786 if (getVisible() && getEnabled())
999 { 787 {
1000 handled = childrenHandleUnicodeChar( uni_char ) != NULL; 788 handled = childrenHandleUnicodeChar( uni_char ) != NULL;
1001 } 789 }
@@ -1058,16 +846,16 @@ LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask,
1058 LLView* handled_view = FALSE; 846 LLView* handled_view = FALSE;
1059 // CRO this is an experiment to allow drag and drop into object inventory based on the DragAndDrop tool's permissions rather than the parent 847 // CRO this is an experiment to allow drag and drop into object inventory based on the DragAndDrop tool's permissions rather than the parent
1060 if( getVisible() ) 848 if( getVisible() )
1061// if( getVisible() && mEnabled ) 849// if( getVisible() && getEnabled() )
1062 { 850 {
1063 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) 851 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
1064 { 852 {
1065 LLView* viewp = *child_it; 853 LLView* viewp = *child_it;
1066 S32 local_x = x - viewp->mRect.mLeft; 854 S32 local_x = x - viewp->getRect().mLeft;
1067 S32 local_y = y - viewp->mRect.mBottom; 855 S32 local_y = y - viewp->getRect().mBottom;
1068 if( viewp->pointInView(local_x, local_y) && 856 if( viewp->pointInView(local_x, local_y) &&
1069 viewp->getVisible() && 857 viewp->getVisible() &&
1070 viewp->mEnabled && 858 viewp->getEnabled() &&
1071 viewp->handleDragAndDrop(local_x, local_y, mask, drop, 859 viewp->handleDragAndDrop(local_x, local_y, mask, drop,
1072 cargo_type, 860 cargo_type,
1073 cargo_data, 861 cargo_data,
@@ -1142,7 +930,7 @@ BOOL LLView::handleDoubleClick(S32 x, S32 y, MASK mask)
1142BOOL LLView::handleScrollWheel(S32 x, S32 y, S32 clicks) 930BOOL LLView::handleScrollWheel(S32 x, S32 y, S32 clicks)
1143{ 931{
1144 BOOL handled = FALSE; 932 BOOL handled = FALSE;
1145 if( getVisible() && mEnabled ) 933 if( getVisible() && getEnabled() )
1146 { 934 {
1147 handled = childrenHandleScrollWheel( x, y, clicks ) != NULL; 935 handled = childrenHandleScrollWheel( x, y, clicks ) != NULL;
1148 if( !handled && blockMouseEvent(x, y) ) 936 if( !handled && blockMouseEvent(x, y) )
@@ -1176,13 +964,13 @@ BOOL LLView::handleRightMouseUp(S32 x, S32 y, MASK mask)
1176LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks) 964LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks)
1177{ 965{
1178 LLView* handled_view = NULL; 966 LLView* handled_view = NULL;
1179 if (getVisible() && mEnabled ) 967 if (getVisible() && getEnabled() )
1180 { 968 {
1181 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) 969 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
1182 { 970 {
1183 LLView* viewp = *child_it; 971 LLView* viewp = *child_it;
1184 S32 local_x = x - viewp->mRect.mLeft; 972 S32 local_x = x - viewp->getRect().mLeft;
1185 S32 local_y = y - viewp->mRect.mBottom; 973 S32 local_y = y - viewp->getRect().mBottom;
1186 if (viewp->pointInView(local_x, local_y) && 974 if (viewp->pointInView(local_x, local_y) &&
1187 viewp->handleScrollWheel( local_x, local_y, clicks )) 975 viewp->handleScrollWheel( local_x, local_y, clicks ))
1188 { 976 {
@@ -1202,13 +990,13 @@ LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks)
1202LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask) 990LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask)
1203{ 991{
1204 LLView* handled_view = NULL; 992 LLView* handled_view = NULL;
1205 if (getVisible() && mEnabled ) 993 if (getVisible() && getEnabled() )
1206 { 994 {
1207 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) 995 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
1208 { 996 {
1209 LLView* viewp = *child_it; 997 LLView* viewp = *child_it;
1210 S32 local_x = x - viewp->mRect.mLeft; 998 S32 local_x = x - viewp->getRect().mLeft;
1211 S32 local_y = y - viewp->mRect.mBottom; 999 S32 local_y = y - viewp->getRect().mBottom;
1212 if(viewp->pointInView(local_x, local_y) && 1000 if(viewp->pointInView(local_x, local_y) &&
1213 viewp->getVisible() && 1001 viewp->getVisible() &&
1214 viewp->getEnabled() && 1002 viewp->getEnabled() &&
@@ -1232,7 +1020,7 @@ LLView* LLView::childrenHandleKey(KEY key, MASK mask)
1232{ 1020{
1233 LLView* handled_view = NULL; 1021 LLView* handled_view = NULL;
1234 1022
1235 if ( getVisible() && mEnabled ) 1023 if ( getVisible() && getEnabled() )
1236 { 1024 {
1237 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) 1025 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
1238 { 1026 {
@@ -1257,7 +1045,7 @@ LLView* LLView::childrenHandleUnicodeChar(llwchar uni_char)
1257{ 1045{
1258 LLView* handled_view = NULL; 1046 LLView* handled_view = NULL;
1259 1047
1260 if ( getVisible() && mEnabled ) 1048 if ( getVisible() && getEnabled() )
1261 { 1049 {
1262 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) 1050 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
1263 { 1051 {
@@ -1284,12 +1072,12 @@ LLView* LLView::childrenHandleMouseDown(S32 x, S32 y, MASK mask)
1284 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) 1072 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
1285 { 1073 {
1286 LLView* viewp = *child_it; 1074 LLView* viewp = *child_it;
1287 S32 local_x = x - viewp->mRect.mLeft; 1075 S32 local_x = x - viewp->getRect().mLeft;
1288 S32 local_y = y - viewp->mRect.mBottom; 1076 S32 local_y = y - viewp->getRect().mBottom;
1289 1077
1290 if (viewp->pointInView(local_x, local_y) && 1078 if (viewp->pointInView(local_x, local_y) &&
1291 viewp->getVisible() && 1079 viewp->getVisible() &&
1292 viewp->mEnabled && 1080 viewp->getEnabled() &&
1293 viewp->handleMouseDown( local_x, local_y, mask )) 1081 viewp->handleMouseDown( local_x, local_y, mask ))
1294 { 1082 {
1295 if (sDebugMouseHandling) 1083 if (sDebugMouseHandling)
@@ -1307,16 +1095,16 @@ LLView* LLView::childrenHandleRightMouseDown(S32 x, S32 y, MASK mask)
1307{ 1095{
1308 LLView* handled_view = NULL; 1096 LLView* handled_view = NULL;
1309 1097
1310 if (getVisible() && mEnabled ) 1098 if (getVisible() && getEnabled() )
1311 { 1099 {
1312 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) 1100 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
1313 { 1101 {
1314 LLView* viewp = *child_it; 1102 LLView* viewp = *child_it;
1315 S32 local_x = x - viewp->mRect.mLeft; 1103 S32 local_x = x - viewp->getRect().mLeft;
1316 S32 local_y = y - viewp->mRect.mBottom; 1104 S32 local_y = y - viewp->getRect().mBottom;
1317 if (viewp->pointInView(local_x, local_y) && 1105 if (viewp->pointInView(local_x, local_y) &&
1318 viewp->getVisible() && 1106 viewp->getVisible() &&
1319 viewp->mEnabled && 1107 viewp->getEnabled() &&
1320 viewp->handleRightMouseDown( local_x, local_y, mask )) 1108 viewp->handleRightMouseDown( local_x, local_y, mask ))
1321 { 1109 {
1322 if (sDebugMouseHandling) 1110 if (sDebugMouseHandling)
@@ -1335,16 +1123,16 @@ LLView* LLView::childrenHandleDoubleClick(S32 x, S32 y, MASK mask)
1335{ 1123{
1336 LLView* handled_view = NULL; 1124 LLView* handled_view = NULL;
1337 1125
1338 if (getVisible() && mEnabled ) 1126 if (getVisible() && getEnabled() )
1339 { 1127 {
1340 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) 1128 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
1341 { 1129 {
1342 LLView* viewp = *child_it; 1130 LLView* viewp = *child_it;
1343 S32 local_x = x - viewp->mRect.mLeft; 1131 S32 local_x = x - viewp->getRect().mLeft;
1344 S32 local_y = y - viewp->mRect.mBottom; 1132 S32 local_y = y - viewp->getRect().mBottom;
1345 if (viewp->pointInView(local_x, local_y) && 1133 if (viewp->pointInView(local_x, local_y) &&
1346 viewp->getVisible() && 1134 viewp->getVisible() &&
1347 viewp->mEnabled && 1135 viewp->getEnabled() &&
1348 viewp->handleDoubleClick( local_x, local_y, mask )) 1136 viewp->handleDoubleClick( local_x, local_y, mask ))
1349 { 1137 {
1350 if (sDebugMouseHandling) 1138 if (sDebugMouseHandling)
@@ -1362,18 +1150,18 @@ LLView* LLView::childrenHandleDoubleClick(S32 x, S32 y, MASK mask)
1362LLView* LLView::childrenHandleMouseUp(S32 x, S32 y, MASK mask) 1150LLView* LLView::childrenHandleMouseUp(S32 x, S32 y, MASK mask)
1363{ 1151{
1364 LLView* handled_view = NULL; 1152 LLView* handled_view = NULL;
1365 if( getVisible() && mEnabled ) 1153 if( getVisible() && getEnabled() )
1366 { 1154 {
1367 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) 1155 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
1368 { 1156 {
1369 LLView* viewp = *child_it; 1157 LLView* viewp = *child_it;
1370 S32 local_x = x - viewp->mRect.mLeft; 1158 S32 local_x = x - viewp->getRect().mLeft;
1371 S32 local_y = y - viewp->mRect.mBottom; 1159 S32 local_y = y - viewp->getRect().mBottom;
1372 if (!viewp->pointInView(local_x, local_y)) 1160 if (!viewp->pointInView(local_x, local_y))
1373 continue; 1161 continue;
1374 if (!viewp->getVisible()) 1162 if (!viewp->getVisible())
1375 continue; 1163 continue;
1376 if (!viewp->mEnabled) 1164 if (!viewp->getEnabled())
1377 continue; 1165 continue;
1378 if (viewp->handleMouseUp( local_x, local_y, mask )) 1166 if (viewp->handleMouseUp( local_x, local_y, mask ))
1379 { 1167 {
@@ -1392,16 +1180,16 @@ LLView* LLView::childrenHandleMouseUp(S32 x, S32 y, MASK mask)
1392LLView* LLView::childrenHandleRightMouseUp(S32 x, S32 y, MASK mask) 1180LLView* LLView::childrenHandleRightMouseUp(S32 x, S32 y, MASK mask)
1393{ 1181{
1394 LLView* handled_view = NULL; 1182 LLView* handled_view = NULL;
1395 if( getVisible() && mEnabled ) 1183 if( getVisible() && getEnabled() )
1396 { 1184 {
1397 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) 1185 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
1398 { 1186 {
1399 LLView* viewp = *child_it; 1187 LLView* viewp = *child_it;
1400 S32 local_x = x - viewp->mRect.mLeft; 1188 S32 local_x = x - viewp->getRect().mLeft;
1401 S32 local_y = y - viewp->mRect.mBottom; 1189 S32 local_y = y - viewp->getRect().mBottom;
1402 if (viewp->pointInView(local_x, local_y) && 1190 if (viewp->pointInView(local_x, local_y) &&
1403 viewp->getVisible() && 1191 viewp->getVisible() &&
1404 viewp->mEnabled && 1192 viewp->getEnabled() &&
1405 viewp->handleRightMouseUp( local_x, local_y, mask )) 1193 viewp->handleRightMouseUp( local_x, local_y, mask ))
1406 { 1194 {
1407 if (sDebugMouseHandling) 1195 if (sDebugMouseHandling)
@@ -1424,8 +1212,8 @@ void LLView::draw()
1424 drawDebugRect(); 1212 drawDebugRect();
1425 1213
1426 // Check for bogus rectangle 1214 // Check for bogus rectangle
1427 if (mRect.mRight <= mRect.mLeft 1215 if (getRect().mRight <= getRect().mLeft
1428 || mRect.mTop <= mRect.mBottom) 1216 || getRect().mTop <= getRect().mBottom)
1429 { 1217 {
1430 llwarns << "Bogus rectangle for " << getName() << " with " << mRect << llendl; 1218 llwarns << "Bogus rectangle for " << getName() << " with " << mRect << llendl;
1431 } 1219 }
@@ -1503,28 +1291,28 @@ void LLView::drawDebugRect()
1503 border_color.mV[sDepth%3] = 1.f; 1291 border_color.mV[sDepth%3] = 1.f;
1504 } 1292 }
1505 1293
1506 glColor4fv( border_color.mV ); 1294 gGL.color4fv( border_color.mV );
1507 1295
1508 glBegin(GL_LINES); 1296 gGL.begin(GL_LINES);
1509 glVertex2i(0, debug_rect.getHeight() - 1); 1297 gGL.vertex2i(0, debug_rect.getHeight() - 1);
1510 glVertex2i(0, 0); 1298 gGL.vertex2i(0, 0);
1511 1299
1512 glVertex2i(0, 0); 1300 gGL.vertex2i(0, 0);
1513 glVertex2i(debug_rect.getWidth() - 1, 0); 1301 gGL.vertex2i(debug_rect.getWidth() - 1, 0);
1514 1302
1515 glVertex2i(debug_rect.getWidth() - 1, 0); 1303 gGL.vertex2i(debug_rect.getWidth() - 1, 0);
1516 glVertex2i(debug_rect.getWidth() - 1, debug_rect.getHeight() - 1); 1304 gGL.vertex2i(debug_rect.getWidth() - 1, debug_rect.getHeight() - 1);
1517 1305
1518 glVertex2i(debug_rect.getWidth() - 1, debug_rect.getHeight() - 1); 1306 gGL.vertex2i(debug_rect.getWidth() - 1, debug_rect.getHeight() - 1);
1519 glVertex2i(0, debug_rect.getHeight() - 1); 1307 gGL.vertex2i(0, debug_rect.getHeight() - 1);
1520 glEnd(); 1308 gGL.end();
1521 1309
1522 // Draw the name if it's not a leaf node 1310 // Draw the name if it's not a leaf node
1523 if (mChildList.size() && !sEditingUI) 1311 if (mChildList.size() && !sEditingUI)
1524 { 1312 {
1525 //char temp[256]; 1313 //char temp[256];
1526 S32 x, y; 1314 S32 x, y;
1527 glColor4fv( border_color.mV ); 1315 gGL.color4fv( border_color.mV );
1528 x = debug_rect.getWidth()/2; 1316 x = debug_rect.getWidth()/2;
1529 y = debug_rect.getHeight()/2; 1317 y = debug_rect.getHeight()/2;
1530 LLString debug_text = llformat("%s (%d x %d)", getName().c_str(), 1318 LLString debug_text = llformat("%s (%d x %d)", getName().c_str(),
@@ -1562,14 +1350,14 @@ void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, BOOL force_dr
1562void LLView::reshape(S32 width, S32 height, BOOL called_from_parent) 1350void LLView::reshape(S32 width, S32 height, BOOL called_from_parent)
1563{ 1351{
1564 // compute how much things changed and apply reshape logic to children 1352 // compute how much things changed and apply reshape logic to children
1565 S32 delta_width = width - mRect.getWidth(); 1353 S32 delta_width = width - getRect().getWidth();
1566 S32 delta_height = height - mRect.getHeight(); 1354 S32 delta_height = height - getRect().getHeight();
1567 1355
1568 if (delta_width || delta_height || sForceReshape) 1356 if (delta_width || delta_height || sForceReshape)
1569 { 1357 {
1570 // adjust our rectangle 1358 // adjust our rectangle
1571 mRect.mRight = mRect.mLeft + width; 1359 mRect.mRight = getRect().mLeft + width;
1572 mRect.mTop = mRect.mBottom + height; 1360 mRect.mTop = getRect().mBottom + height;
1573 1361
1574 // move child views according to reshape flags 1362 // move child views according to reshape flags
1575 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) 1363 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
@@ -1615,8 +1403,8 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent)
1615 // for now, same as bottom 1403 // for now, same as bottom
1616 } 1404 }
1617 1405
1618 S32 delta_x = child_rect.mLeft - viewp->mRect.mLeft; 1406 S32 delta_x = child_rect.mLeft - viewp->getRect().mLeft;
1619 S32 delta_y = child_rect.mBottom - viewp->mRect.mBottom; 1407 S32 delta_y = child_rect.mBottom - viewp->getRect().mBottom;
1620 viewp->translate( delta_x, delta_y ); 1408 viewp->translate( delta_x, delta_y );
1621 viewp->reshape(child_rect.getWidth(), child_rect.getHeight()); 1409 viewp->reshape(child_rect.getWidth(), child_rect.getHeight());
1622 } 1410 }
@@ -1633,11 +1421,6 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent)
1633 updateBoundingRect(); 1421 updateBoundingRect();
1634} 1422}
1635 1423
1636LLRect LLView::getRequiredRect()
1637{
1638 return mRect;
1639}
1640
1641void LLView::updateBoundingRect() 1424void LLView::updateBoundingRect()
1642{ 1425{
1643 if (isDead()) return; 1426 if (isDead()) return;
@@ -1690,16 +1473,16 @@ void LLView::updateBoundingRect()
1690 } 1473 }
1691} 1474}
1692 1475
1693const LLRect LLView::getScreenRect() const 1476LLRect LLView::getScreenRect() const
1694{ 1477{
1695 // *FIX: check for one-off error 1478 // *FIX: check for one-off error
1696 LLRect screen_rect; 1479 LLRect screen_rect;
1697 localPointToScreen(0, 0, &screen_rect.mLeft, &screen_rect.mBottom); 1480 localPointToScreen(0, 0, &screen_rect.mLeft, &screen_rect.mBottom);
1698 localPointToScreen(mRect.getWidth(), mRect.getHeight(), &screen_rect.mRight, &screen_rect.mTop); 1481 localPointToScreen(getRect().getWidth(), getRect().getHeight(), &screen_rect.mRight, &screen_rect.mTop);
1699 return screen_rect; 1482 return screen_rect;
1700} 1483}
1701 1484
1702const LLRect LLView::getLocalBoundingRect() const 1485LLRect LLView::getLocalBoundingRect() const
1703{ 1486{
1704 LLRect local_bounding_rect = getBoundingRect(); 1487 LLRect local_bounding_rect = getBoundingRect();
1705 local_bounding_rect.translate(-mRect.mLeft, -mRect.mBottom); 1488 local_bounding_rect.translate(-mRect.mLeft, -mRect.mBottom);
@@ -1708,20 +1491,20 @@ const LLRect LLView::getLocalBoundingRect() const
1708} 1491}
1709 1492
1710 1493
1711const LLRect LLView::getLocalRect() const 1494LLRect LLView::getLocalRect() const
1712{ 1495{
1713 LLRect local_rect(0, mRect.getHeight(), mRect.getWidth(), 0); 1496 LLRect local_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
1714 return local_rect; 1497 return local_rect;
1715} 1498}
1716 1499
1717const LLRect LLView::getLocalSnapRect() const 1500LLRect LLView::getLocalSnapRect() const
1718{ 1501{
1719 LLRect local_snap_rect = getSnapRect(); 1502 LLRect local_snap_rect = getSnapRect();
1720 local_snap_rect.translate(-mRect.mLeft, -mRect.mBottom); 1503 local_snap_rect.translate(-getRect().mLeft, -getRect().mBottom);
1721 return local_snap_rect; 1504 return local_snap_rect;
1722} 1505}
1723 1506
1724BOOL LLView::hasAncestor(const LLView* parentp) 1507BOOL LLView::hasAncestor(const LLView* parentp) const
1725{ 1508{
1726 if (!parentp) 1509 if (!parentp)
1727 { 1510 {
@@ -1760,7 +1543,7 @@ BOOL LLView::childHasKeyboardFocus( const LLString& childname ) const
1760 1543
1761BOOL LLView::hasChild(const LLString& childname, BOOL recurse) const 1544BOOL LLView::hasChild(const LLString& childname, BOOL recurse) const
1762{ 1545{
1763 return getChildByName(childname, recurse) ? TRUE : FALSE; 1546 return getChildByName(childname, recurse) != NULL;
1764} 1547}
1765 1548
1766//----------------------------------------------------------------------------- 1549//-----------------------------------------------------------------------------
@@ -1818,55 +1601,55 @@ BOOL LLView::blockMouseEvent(S32 x, S32 y) const
1818// virtual 1601// virtual
1819void LLView::screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const 1602void LLView::screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const
1820{ 1603{
1821 *local_x = screen_x - mRect.mLeft; 1604 *local_x = screen_x - getRect().mLeft;
1822 *local_y = screen_y - mRect.mBottom; 1605 *local_y = screen_y - getRect().mBottom;
1823 1606
1824 const LLView* cur = this; 1607 const LLView* cur = this;
1825 while( cur->mParentView ) 1608 while( cur->mParentView )
1826 { 1609 {
1827 cur = cur->mParentView; 1610 cur = cur->mParentView;
1828 *local_x -= cur->mRect.mLeft; 1611 *local_x -= cur->getRect().mLeft;
1829 *local_y -= cur->mRect.mBottom; 1612 *local_y -= cur->getRect().mBottom;
1830 } 1613 }
1831} 1614}
1832 1615
1833void LLView::localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const 1616void LLView::localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const
1834{ 1617{
1835 *screen_x = local_x + mRect.mLeft; 1618 *screen_x = local_x + getRect().mLeft;
1836 *screen_y = local_y + mRect.mBottom; 1619 *screen_y = local_y + getRect().mBottom;
1837 1620
1838 const LLView* cur = this; 1621 const LLView* cur = this;
1839 while( cur->mParentView ) 1622 while( cur->mParentView )
1840 { 1623 {
1841 cur = cur->mParentView; 1624 cur = cur->mParentView;
1842 *screen_x += cur->mRect.mLeft; 1625 *screen_x += cur->getRect().mLeft;
1843 *screen_y += cur->mRect.mBottom; 1626 *screen_y += cur->getRect().mBottom;
1844 } 1627 }
1845} 1628}
1846 1629
1847void LLView::screenRectToLocal(const LLRect& screen, LLRect* local) const 1630void LLView::screenRectToLocal(const LLRect& screen, LLRect* local) const
1848{ 1631{
1849 *local = screen; 1632 *local = screen;
1850 local->translate( -mRect.mLeft, -mRect.mBottom ); 1633 local->translate( -getRect().mLeft, -getRect().mBottom );
1851 1634
1852 const LLView* cur = this; 1635 const LLView* cur = this;
1853 while( cur->mParentView ) 1636 while( cur->mParentView )
1854 { 1637 {
1855 cur = cur->mParentView; 1638 cur = cur->mParentView;
1856 local->translate( -cur->mRect.mLeft, -cur->mRect.mBottom ); 1639 local->translate( -cur->getRect().mLeft, -cur->getRect().mBottom );
1857 } 1640 }
1858} 1641}
1859 1642
1860void LLView::localRectToScreen(const LLRect& local, LLRect* screen) const 1643void LLView::localRectToScreen(const LLRect& local, LLRect* screen) const
1861{ 1644{
1862 *screen = local; 1645 *screen = local;
1863 screen->translate( mRect.mLeft, mRect.mBottom ); 1646 screen->translate( getRect().mLeft, getRect().mBottom );
1864 1647
1865 const LLView* cur = this; 1648 const LLView* cur = this;
1866 while( cur->mParentView ) 1649 while( cur->mParentView )
1867 { 1650 {
1868 cur = cur->mParentView; 1651 cur = cur->mParentView;
1869 screen->translate( cur->mRect.mLeft, cur->mRect.mBottom ); 1652 screen->translate( cur->getRect().mLeft, cur->getRect().mBottom );
1870 } 1653 }
1871} 1654}
1872 1655
@@ -1880,12 +1663,15 @@ LLView* LLView::getRootView()
1880 return view; 1663 return view;
1881} 1664}
1882 1665
1883//static 1666BOOL LLView::deleteViewByHandle(LLHandle<LLView> handle)
1884LLWindow* LLView::getWindow(void)
1885{ 1667{
1886 return LLUI::sWindow; 1668 LLView* viewp = handle.get();
1669
1670 delete viewp;
1671 return viewp != NULL;
1887} 1672}
1888 1673
1674
1889// Moves the view so that it is entirely inside of constraint. 1675// Moves the view so that it is entirely inside of constraint.
1890// If the view will not fit because it's too big, aligns with the top and left. 1676// If the view will not fit because it's too big, aligns with the top and left.
1891// (Why top and left? That's where the drag bars are for floaters.) 1677// (Why top and left? That's where the drag bars are for floaters.)
@@ -1898,50 +1684,50 @@ BOOL LLView::translateIntoRect(const LLRect& constraint, BOOL allow_partial_outs
1898 { 1684 {
1899 const S32 KEEP_ONSCREEN_PIXELS = 16; 1685 const S32 KEEP_ONSCREEN_PIXELS = 16;
1900 1686
1901 if( mRect.mRight - KEEP_ONSCREEN_PIXELS < constraint.mLeft ) 1687 if( getRect().mRight - KEEP_ONSCREEN_PIXELS < constraint.mLeft )
1902 { 1688 {
1903 delta_x = constraint.mLeft - (mRect.mRight - KEEP_ONSCREEN_PIXELS); 1689 delta_x = constraint.mLeft - (getRect().mRight - KEEP_ONSCREEN_PIXELS);
1904 } 1690 }
1905 else 1691 else
1906 if( mRect.mLeft + KEEP_ONSCREEN_PIXELS > constraint.mRight ) 1692 if( getRect().mLeft + KEEP_ONSCREEN_PIXELS > constraint.mRight )
1907 { 1693 {
1908 delta_x = constraint.mRight - (mRect.mLeft + KEEP_ONSCREEN_PIXELS); 1694 delta_x = constraint.mRight - (getRect().mLeft + KEEP_ONSCREEN_PIXELS);
1909 delta_x += llmax( 0, mRect.getWidth() - constraint.getWidth() ); 1695 delta_x += llmax( 0, getRect().getWidth() - constraint.getWidth() );
1910 } 1696 }
1911 1697
1912 if( mRect.mTop > constraint.mTop ) 1698 if( getRect().mTop > constraint.mTop )
1913 { 1699 {
1914 delta_y = constraint.mTop - mRect.mTop; 1700 delta_y = constraint.mTop - getRect().mTop;
1915 } 1701 }
1916 else 1702 else
1917 if( mRect.mTop - KEEP_ONSCREEN_PIXELS < constraint.mBottom ) 1703 if( getRect().mTop - KEEP_ONSCREEN_PIXELS < constraint.mBottom )
1918 { 1704 {
1919 delta_y = constraint.mBottom - (mRect.mTop - KEEP_ONSCREEN_PIXELS); 1705 delta_y = constraint.mBottom - (getRect().mTop - KEEP_ONSCREEN_PIXELS);
1920 delta_y -= llmax( 0, mRect.getHeight() - constraint.getHeight() ); 1706 delta_y -= llmax( 0, getRect().getHeight() - constraint.getHeight() );
1921 } 1707 }
1922 } 1708 }
1923 else 1709 else
1924 { 1710 {
1925 if( mRect.mLeft < constraint.mLeft ) 1711 if( getRect().mLeft < constraint.mLeft )
1926 { 1712 {
1927 delta_x = constraint.mLeft - mRect.mLeft; 1713 delta_x = constraint.mLeft - getRect().mLeft;
1928 } 1714 }
1929 else 1715 else
1930 if( mRect.mRight > constraint.mRight ) 1716 if( getRect().mRight > constraint.mRight )
1931 { 1717 {
1932 delta_x = constraint.mRight - mRect.mRight; 1718 delta_x = constraint.mRight - getRect().mRight;
1933 delta_x += llmax( 0, mRect.getWidth() - constraint.getWidth() ); 1719 delta_x += llmax( 0, getRect().getWidth() - constraint.getWidth() );
1934 } 1720 }
1935 1721
1936 if( mRect.mTop > constraint.mTop ) 1722 if( getRect().mTop > constraint.mTop )
1937 { 1723 {
1938 delta_y = constraint.mTop - mRect.mTop; 1724 delta_y = constraint.mTop - getRect().mTop;
1939 } 1725 }
1940 else 1726 else
1941 if( mRect.mBottom < constraint.mBottom ) 1727 if( getRect().mBottom < constraint.mBottom )
1942 { 1728 {
1943 delta_y = constraint.mBottom - mRect.mBottom; 1729 delta_y = constraint.mBottom - getRect().mBottom;
1944 delta_y -= llmax( 0, mRect.getHeight() - constraint.getHeight() ); 1730 delta_y -= llmax( 0, getRect().getHeight() - constraint.getHeight() );
1945 } 1731 }
1946 } 1732 }
1947 1733
@@ -1953,10 +1739,18 @@ BOOL LLView::translateIntoRect(const LLRect& constraint, BOOL allow_partial_outs
1953 return FALSE; 1739 return FALSE;
1954} 1740}
1955 1741
1956BOOL LLView::localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, LLView* other_view) 1742void LLView::centerWithin(const LLRect& bounds)
1957{ 1743{
1958 LLView* cur_view = this; 1744 S32 left = bounds.mLeft + (bounds.getWidth() - getRect().getWidth()) / 2;
1959 LLView* root_view = NULL; 1745 S32 bottom = bounds.mBottom + (bounds.getHeight() - getRect().getHeight()) / 2;
1746
1747 translate( left - getRect().mLeft, bottom - getRect().mBottom );
1748}
1749
1750BOOL LLView::localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, LLView* other_view) const
1751{
1752 const LLView* cur_view = this;
1753 const LLView* root_view = NULL;
1960 1754
1961 while (cur_view) 1755 while (cur_view)
1962 { 1756 {
@@ -2047,8 +1841,8 @@ LLXMLNodePtr LLView::getXML(bool save_children) const
2047 node->createChild("height", TRUE)->setIntValue(getRect().getHeight()); 1841 node->createChild("height", TRUE)->setIntValue(getRect().getHeight());
2048 1842
2049 LLView* parent = getParent(); 1843 LLView* parent = getParent();
2050 S32 left = mRect.mLeft; 1844 S32 left = getRect().mLeft;
2051 S32 bottom = mRect.mBottom; 1845 S32 bottom = getRect().mBottom;
2052 if (parent) bottom -= parent->getRect().getHeight(); 1846 if (parent) bottom -= parent->getRect().getHeight();
2053 1847
2054 node->createChild("left", TRUE)->setIntValue(left); 1848 node->createChild("left", TRUE)->setIntValue(left);
@@ -2084,7 +1878,6 @@ LLXMLNodePtr LLView::getXML(bool save_children) const
2084 node->createChild("follows", TRUE)->setStringValue(buffer.str()); 1878 node->createChild("follows", TRUE)->setStringValue(buffer.str());
2085 } 1879 }
2086 // Export all widgets as enabled and visible - code must disable. 1880 // Export all widgets as enabled and visible - code must disable.
2087 node->createChild("hidden", TRUE)->setBoolValue(mHidden);
2088 node->createChild("mouse_opaque", TRUE)->setBoolValue(mMouseOpaque ); 1881 node->createChild("mouse_opaque", TRUE)->setBoolValue(mMouseOpaque );
2089 if (!mToolTipMsg.getString().empty()) 1882 if (!mToolTipMsg.getString().empty())
2090 { 1883 {
@@ -2095,7 +1888,7 @@ LLXMLNodePtr LLView::getXML(bool save_children) const
2095 node->createChild("sound_flags", TRUE)->setIntValue((S32)mSoundFlags); 1888 node->createChild("sound_flags", TRUE)->setIntValue((S32)mSoundFlags);
2096 } 1889 }
2097 1890
2098 node->createChild("enabled", TRUE)->setBoolValue(mEnabled); 1891 node->createChild("enabled", TRUE)->setBoolValue(getEnabled());
2099 1892
2100 if (!mControlName.empty()) 1893 if (!mControlName.empty())
2101 { 1894 {
@@ -2183,6 +1976,15 @@ const LLCtrlQuery & LLView::getTabOrderQuery()
2183 return query; 1976 return query;
2184} 1977}
2185 1978
1979// This class is only used internally by getFocusRootsQuery below.
1980class LLFocusRootsFilter : public LLQueryFilter, public LLSingleton<LLFocusRootsFilter>
1981{
1982 /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const
1983 {
1984 return filterResult_t(view->isCtrl() && view->isFocusRoot(), !view->isFocusRoot());
1985 }
1986};
1987
2186// static 1988// static
2187const LLCtrlQuery & LLView::getFocusRootsQuery() 1989const LLCtrlQuery & LLView::getFocusRootsQuery()
2188{ 1990{
@@ -2190,7 +1992,7 @@ const LLCtrlQuery & LLView::getFocusRootsQuery()
2190 if(query.getPreFilters().size() == 0) { 1992 if(query.getPreFilters().size() == 0) {
2191 query.addPreFilter(LLVisibleFilter::getInstance()); 1993 query.addPreFilter(LLVisibleFilter::getInstance());
2192 query.addPreFilter(LLEnabledFilter::getInstance()); 1994 query.addPreFilter(LLEnabledFilter::getInstance());
2193 query.addPreFilter(LLView::LLFocusRootsFilter::getInstance()); 1995 query.addPreFilter(LLFocusRootsFilter::getInstance());
2194 query.addPostFilter(LLRootsFilter::getInstance()); 1996 query.addPostFilter(LLRootsFilter::getInstance());
2195 } 1997 }
2196 return query; 1998 return query;
@@ -2200,167 +2002,189 @@ const LLCtrlQuery & LLView::getFocusRootsQuery()
2200void LLView::userSetShape(const LLRect& new_rect) 2002void LLView::userSetShape(const LLRect& new_rect)
2201{ 2003{
2202 reshape(new_rect.getWidth(), new_rect.getHeight()); 2004 reshape(new_rect.getWidth(), new_rect.getHeight());
2203 translate(new_rect.mLeft - mRect.mLeft, new_rect.mBottom - mRect.mBottom); 2005 translate(new_rect.mLeft - getRect().mLeft, new_rect.mBottom - getRect().mBottom);
2204} 2006}
2205 2007
2206LLView* LLView::findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, 2008LLView* LLView::findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir,
2207 LLView::ESnapType snap_type, S32 threshold, S32 padding) 2009 LLView::ESnapType snap_type, S32 threshold, S32 padding)
2208{ 2010{
2011 new_rect = mRect;
2209 LLView* snap_view = NULL; 2012 LLView* snap_view = NULL;
2210 2013
2211 if (!mParentView) 2014 if (!mParentView)
2212 { 2015 {
2213 new_rect = mRect; 2016 return NULL;
2214 return snap_view;
2215 } 2017 }
2216 2018
2217 // If the view is near the edge of its parent, snap it to 2019 S32 delta_x = 0;
2218 // the edge. 2020 S32 delta_y = 0;
2219 LLRect test_rect = getSnapRect(); 2021 if (mouse_dir.mX >= 0)
2220 LLRect view_rect = getSnapRect();
2221 test_rect.stretch(padding);
2222 view_rect.stretch(padding);
2223
2224 BOOL snapped_x = FALSE;
2225 BOOL snapped_y = FALSE;
2226
2227 LLRect parent_local_snap_rect = mParentView->getLocalSnapRect();
2228
2229 if (snap_type == SNAP_PARENT || snap_type == SNAP_PARENT_AND_SIBLINGS)
2230 { 2022 {
2231 if (llabs(parent_local_snap_rect.mRight - test_rect.mRight) <= threshold && (parent_local_snap_rect.mRight - test_rect.mRight) * mouse_dir.mX >= 0) 2023 S32 new_right = mRect.mRight;
2232 { 2024 LLView* view = findSnapEdge(new_right, mouse_dir, SNAP_RIGHT, snap_type, threshold, padding);
2233 view_rect.translate(parent_local_snap_rect.mRight - view_rect.mRight, 0); 2025 delta_x = new_right - mRect.mRight;
2234 snap_view = mParentView; 2026 snap_view = view ? view : snap_view;
2235 snapped_x = TRUE;
2236 }
2237
2238 if (llabs(test_rect.mLeft - parent_local_snap_rect.mLeft) <= threshold && test_rect.mLeft * mouse_dir.mX <= 0)
2239 {
2240 view_rect.translate(parent_local_snap_rect.mLeft - view_rect.mLeft, 0);
2241 snap_view = mParentView;
2242 snapped_x = TRUE;
2243 }
2244
2245 if (llabs(test_rect.mBottom - parent_local_snap_rect.mBottom) <= threshold && test_rect.mBottom * mouse_dir.mY <= 0)
2246 {
2247 view_rect.translate(0, parent_local_snap_rect.mBottom - view_rect.mBottom);
2248 snap_view = mParentView;
2249 snapped_y = TRUE;
2250 }
2251
2252 if (llabs(parent_local_snap_rect.mTop - test_rect.mTop) <= threshold && (parent_local_snap_rect.mTop - test_rect.mTop) * mouse_dir.mY >= 0)
2253 {
2254 view_rect.translate(0, parent_local_snap_rect.mTop - view_rect.mTop);
2255 snap_view = mParentView;
2256 snapped_y = TRUE;
2257 }
2258 } 2027 }
2259 if (snap_type == SNAP_SIBLINGS || snap_type == SNAP_PARENT_AND_SIBLINGS)
2260 {
2261 for ( child_list_const_iter_t child_it = mParentView->getChildList()->begin();
2262 child_it != mParentView->getChildList()->end(); ++child_it)
2263 {
2264 LLView* siblingp = *child_it;
2265 // skip self
2266 if (siblingp == this || !siblingp->getVisible() || !canSnapTo(siblingp))
2267 {
2268 continue;
2269 }
2270
2271 LLRect sibling_rect = siblingp->getSnapRect();
2272
2273 if (!snapped_x && llabs(test_rect.mRight - sibling_rect.mLeft) <= threshold && (test_rect.mRight - sibling_rect.mLeft) * mouse_dir.mX <= 0)
2274 {
2275 view_rect.translate(sibling_rect.mLeft - view_rect.mRight, 0);
2276 if (!snapped_y)
2277 {
2278 if (llabs(test_rect.mTop - sibling_rect.mTop) <= threshold && (test_rect.mTop - sibling_rect.mTop) * mouse_dir.mY <= 0)
2279 {
2280 view_rect.translate(0, sibling_rect.mTop - test_rect.mTop);
2281 snapped_y = TRUE;
2282 }
2283 else if (llabs(test_rect.mBottom - sibling_rect.mBottom) <= threshold && (test_rect.mBottom - sibling_rect.mBottom) * mouse_dir.mY <= 0)
2284 {
2285 view_rect.translate(0, sibling_rect.mBottom - test_rect.mBottom);
2286 snapped_y = TRUE;
2287 }
2288 }
2289 snap_view = siblingp;
2290 snapped_x = TRUE;
2291 }
2292 2028
2293 if (!snapped_x && llabs(test_rect.mLeft - sibling_rect.mRight) <= threshold && (test_rect.mLeft - sibling_rect.mRight) * mouse_dir.mX <= 0) 2029 if (mouse_dir.mX <= 0)
2294 { 2030 {
2295 view_rect.translate(sibling_rect.mRight - view_rect.mLeft, 0); 2031 S32 new_left = mRect.mLeft;
2296 if (!snapped_y) 2032 LLView* view = findSnapEdge(new_left, mouse_dir, SNAP_LEFT, snap_type, threshold, padding);
2297 { 2033 delta_x = new_left - mRect.mLeft;
2298 if (llabs(test_rect.mTop - sibling_rect.mTop) <= threshold && (test_rect.mTop - sibling_rect.mTop) * mouse_dir.mY <= 0) 2034 snap_view = view ? view : snap_view;
2299 { 2035 }
2300 view_rect.translate(0, sibling_rect.mTop - test_rect.mTop);
2301 snapped_y = TRUE;
2302 }
2303 else if (llabs(test_rect.mBottom - sibling_rect.mBottom) <= threshold && (test_rect.mBottom - sibling_rect.mBottom) * mouse_dir.mY <= 0)
2304 {
2305 view_rect.translate(0, sibling_rect.mBottom - test_rect.mBottom);
2306 snapped_y = TRUE;
2307 }
2308 }
2309 snap_view = siblingp;
2310 snapped_x = TRUE;
2311 }
2312 2036
2313 if (!snapped_y && llabs(test_rect.mBottom - sibling_rect.mTop) <= threshold && (test_rect.mBottom - sibling_rect.mTop) * mouse_dir.mY <= 0) 2037 if (mouse_dir.mY >= 0)
2314 { 2038 {
2315 view_rect.translate(0, sibling_rect.mTop - view_rect.mBottom); 2039 S32 new_top = mRect.mTop;
2316 if (!snapped_x) 2040 LLView* view = findSnapEdge(new_top, mouse_dir, SNAP_TOP, snap_type, threshold, padding);
2317 { 2041 delta_y = new_top - mRect.mTop;
2318 if (llabs(test_rect.mLeft - sibling_rect.mLeft) <= threshold && (test_rect.mLeft - sibling_rect.mLeft) * mouse_dir.mX <= 0) 2042 snap_view = view ? view : snap_view;
2319 { 2043 }
2320 view_rect.translate(sibling_rect.mLeft - test_rect.mLeft, 0);
2321 snapped_x = TRUE;
2322 }
2323 else if (llabs(test_rect.mRight - sibling_rect.mRight) <= threshold && (test_rect.mRight - sibling_rect.mRight) * mouse_dir.mX <= 0)
2324 {
2325 view_rect.translate(sibling_rect.mRight - test_rect.mRight, 0);
2326 snapped_x = TRUE;
2327 }
2328 }
2329 snap_view = siblingp;
2330 snapped_y = TRUE;
2331 }
2332 2044
2333 if (!snapped_y && llabs(test_rect.mTop - sibling_rect.mBottom) <= threshold && (test_rect.mTop - sibling_rect.mBottom) * mouse_dir.mY <= 0) 2045 if (mouse_dir.mY <= 0)
2334 { 2046 {
2335 view_rect.translate(0, sibling_rect.mBottom - view_rect.mTop); 2047 S32 new_bottom = mRect.mBottom;
2336 if (!snapped_x) 2048 LLView* view = findSnapEdge(new_bottom, mouse_dir, SNAP_BOTTOM, snap_type, threshold, padding);
2337 { 2049 delta_y = new_bottom - mRect.mBottom;
2338 if (llabs(test_rect.mLeft - sibling_rect.mLeft) <= threshold && (test_rect.mLeft - sibling_rect.mLeft) * mouse_dir.mX <= 0) 2050 snap_view = view ? view : snap_view;
2339 {
2340 view_rect.translate(sibling_rect.mLeft - test_rect.mLeft, 0);
2341 snapped_x = TRUE;
2342 }
2343 else if (llabs(test_rect.mRight - sibling_rect.mRight) <= threshold && (test_rect.mRight - sibling_rect.mRight) * mouse_dir.mX <= 0)
2344 {
2345 view_rect.translate(sibling_rect.mRight - test_rect.mRight, 0);
2346 snapped_x = TRUE;
2347 }
2348 }
2349 snap_view = siblingp;
2350 snapped_y = TRUE;
2351 }
2352
2353 if (snapped_x && snapped_y)
2354 {
2355 break;
2356 }
2357 }
2358 } 2051 }
2359 2052
2360 // shrink actual view rect back down 2053 new_rect.translate(delta_x, delta_y);
2361 view_rect.stretch(-padding);
2362 new_rect = view_rect;
2363 return snap_view; 2054 return snap_view;
2055
2056 //// If the view is near the edge of its parent, snap it to
2057 //// the edge.
2058 //LLRect test_rect = getSnapRect();
2059 //LLRect view_rect = getSnapRect();
2060 //test_rect.stretch(padding);
2061 //view_rect.stretch(padding);
2062
2063 //S32 x_threshold = threshold;
2064 //S32 y_threshold = threshold;
2065
2066 //LLRect parent_local_snap_rect = mParentView->getLocalSnapRect();
2067
2068 //if (snap_type == SNAP_PARENT || snap_type == SNAP_PARENT_AND_SIBLINGS)
2069 //{
2070 // if (llabs(parent_local_snap_rect.mRight - test_rect.mRight) <= x_threshold && (parent_local_snap_rect.mRight - test_rect.mRight) * mouse_dir.mX >= 0)
2071 // {
2072 // view_rect.translate(parent_local_snap_rect.mRight - view_rect.mRight, 0);
2073 // snap_view = mParentView;
2074 // x_threshold = llabs(parent_local_snap_rect.mRight - test_rect.mRight);
2075 // }
2076
2077 // if (llabs(test_rect.mLeft - parent_local_snap_rect.mLeft) <= x_threshold && test_rect.mLeft * mouse_dir.mX <= 0)
2078 // {
2079 // view_rect.translate(parent_local_snap_rect.mLeft - view_rect.mLeft, 0);
2080 // snap_view = mParentView;
2081 // x_threshold = llabs(test_rect.mLeft - parent_local_snap_rect.mLeft);
2082 // }
2083
2084 // if (llabs(test_rect.mBottom - parent_local_snap_rect.mBottom) <= y_threshold && test_rect.mBottom * mouse_dir.mY <= 0)
2085 // {
2086 // view_rect.translate(0, parent_local_snap_rect.mBottom - view_rect.mBottom);
2087 // snap_view = mParentView;
2088 // y_threshold = llabs(test_rect.mBottom - parent_local_snap_rect.mBottom);
2089 // }
2090
2091 // if (llabs(parent_local_snap_rect.mTop - test_rect.mTop) <= y_threshold && (parent_local_snap_rect.mTop - test_rect.mTop) * mouse_dir.mY >= 0)
2092 // {
2093 // view_rect.translate(0, parent_local_snap_rect.mTop - view_rect.mTop);
2094 // snap_view = mParentView;
2095 // y_threshold = llabs(parent_local_snap_rect.mTop - test_rect.mTop);
2096 // }
2097 //}
2098 //if (snap_type == SNAP_SIBLINGS || snap_type == SNAP_PARENT_AND_SIBLINGS)
2099 //{
2100 // for ( child_list_const_iter_t child_it = mParentView->getChildList()->begin();
2101 // child_it != mParentView->getChildList()->end(); ++child_it)
2102 // {
2103 // LLView* siblingp = *child_it;
2104
2105 // // skip non-snappable views (self, invisible views, etc)
2106 // if (!canSnapTo(siblingp)) continue;
2107
2108 // LLRect sibling_rect = siblingp->getSnapRect();
2109
2110 // if (llabs(test_rect.mRight - sibling_rect.mLeft) <= x_threshold
2111 // && (test_rect.mRight - sibling_rect.mLeft) * mouse_dir.mX <= 0)
2112 // {
2113 // view_rect.translate(sibling_rect.mLeft - view_rect.mRight, 0);
2114 // if (llabs(test_rect.mTop - sibling_rect.mTop) <= y_threshold && (test_rect.mTop - sibling_rect.mTop) * mouse_dir.mY <= 0)
2115 // {
2116 // view_rect.translate(0, sibling_rect.mTop - test_rect.mTop);
2117 // y_threshold = llabs(test_rect.mTop - sibling_rect.mTop);
2118 // }
2119 // else if (llabs(test_rect.mBottom - sibling_rect.mBottom) <= y_threshold && (test_rect.mBottom - sibling_rect.mBottom) * mouse_dir.mY <= 0)
2120 // {
2121 // view_rect.translate(0, sibling_rect.mBottom - test_rect.mBottom);
2122 // y_threshold = llabs(test_rect.mBottom - sibling_rect.mBottom);
2123 // }
2124 // snap_view = siblingp;
2125 // x_threshold = llabs(test_rect.mRight - sibling_rect.mLeft);
2126 // }
2127
2128 // if (llabs(test_rect.mLeft - sibling_rect.mRight) <= x_threshold
2129 // && (test_rect.mLeft - sibling_rect.mRight) * mouse_dir.mX <= 0)
2130 // {
2131 // view_rect.translate(sibling_rect.mRight - view_rect.mLeft, 0);
2132 // if (llabs(test_rect.mTop - sibling_rect.mTop) <= y_threshold && (test_rect.mTop - sibling_rect.mTop) * mouse_dir.mY <= 0)
2133 // {
2134 // view_rect.translate(0, sibling_rect.mTop - test_rect.mTop);
2135 // y_threshold = llabs(test_rect.mTop - sibling_rect.mTop);
2136 // }
2137 // else if (llabs(test_rect.mBottom - sibling_rect.mBottom) <= y_threshold && (test_rect.mBottom - sibling_rect.mBottom) * mouse_dir.mY <= 0)
2138 // {
2139 // view_rect.translate(0, sibling_rect.mBottom - test_rect.mBottom);
2140 // y_threshold = llabs(test_rect.mBottom - sibling_rect.mBottom);
2141 // }
2142 // snap_view = siblingp;
2143 // x_threshold = llabs(test_rect.mLeft - sibling_rect.mRight);
2144 // }
2145
2146 // if (llabs(test_rect.mBottom - sibling_rect.mTop) <= y_threshold
2147 // && (test_rect.mBottom - sibling_rect.mTop) * mouse_dir.mY <= 0)
2148 // {
2149 // view_rect.translate(0, sibling_rect.mTop - view_rect.mBottom);
2150 // if (llabs(test_rect.mLeft - sibling_rect.mLeft) <= x_threshold && (test_rect.mLeft - sibling_rect.mLeft) * mouse_dir.mX <= 0)
2151 // {
2152 // view_rect.translate(sibling_rect.mLeft - test_rect.mLeft, 0);
2153 // x_threshold = llabs(test_rect.mLeft - sibling_rect.mLeft);
2154 // }
2155 // else if (llabs(test_rect.mRight - sibling_rect.mRight) <= x_threshold && (test_rect.mRight - sibling_rect.mRight) * mouse_dir.mX <= 0)
2156 // {
2157 // view_rect.translate(sibling_rect.mRight - test_rect.mRight, 0);
2158 // x_threshold = llabs(test_rect.mRight - sibling_rect.mRight);
2159 // }
2160 // snap_view = siblingp;
2161 // y_threshold = llabs(test_rect.mBottom - sibling_rect.mTop);
2162 // }
2163
2164 // if (llabs(test_rect.mTop - sibling_rect.mBottom) <= y_threshold
2165 // && (test_rect.mTop - sibling_rect.mBottom) * mouse_dir.mY <= 0)
2166 // {
2167 // view_rect.translate(0, sibling_rect.mBottom - view_rect.mTop);
2168 // if (llabs(test_rect.mLeft - sibling_rect.mLeft) <= x_threshold && (test_rect.mLeft - sibling_rect.mLeft) * mouse_dir.mX <= 0)
2169 // {
2170 // view_rect.translate(sibling_rect.mLeft - test_rect.mLeft, 0);
2171 // x_threshold = llabs(test_rect.mLeft - sibling_rect.mLeft);
2172 // }
2173 // else if (llabs(test_rect.mRight - sibling_rect.mRight) <= x_threshold && (test_rect.mRight - sibling_rect.mRight) * mouse_dir.mX <= 0)
2174 // {
2175 // view_rect.translate(sibling_rect.mRight - test_rect.mRight, 0);
2176 // x_threshold = llabs(test_rect.mRight - sibling_rect.mRight);
2177 // }
2178 // snap_view = siblingp;
2179 // y_threshold = llabs(test_rect.mTop - sibling_rect.mBottom);
2180 // }
2181 // }
2182 //}
2183
2184 //// shrink actual view rect back down
2185 //view_rect.stretch(-padding);
2186 //new_rect = view_rect;
2187 //return snap_view;
2364} 2188}
2365 2189
2366LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding) 2190LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding)
@@ -2396,8 +2220,8 @@ LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESna
2396 LLRect test_rect = snap_rect; 2220 LLRect test_rect = snap_rect;
2397 test_rect.stretch(padding); 2221 test_rect.stretch(padding);
2398 2222
2399 BOOL snapped_x = FALSE; 2223 S32 x_threshold = threshold;
2400 BOOL snapped_y = FALSE; 2224 S32 y_threshold = threshold;
2401 2225
2402 LLRect parent_local_snap_rect = mParentView->getLocalSnapRect(); 2226 LLRect parent_local_snap_rect = mParentView->getLocalSnapRect();
2403 2227
@@ -2406,35 +2230,38 @@ LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESna
2406 switch(snap_edge) 2230 switch(snap_edge)
2407 { 2231 {
2408 case SNAP_RIGHT: 2232 case SNAP_RIGHT:
2409 if (llabs(parent_local_snap_rect.mRight - test_rect.mRight) <= threshold && (parent_local_snap_rect.mRight - test_rect.mRight) * mouse_dir.mX >= 0) 2233 if (llabs(parent_local_snap_rect.mRight - test_rect.mRight) <= x_threshold
2234 && (parent_local_snap_rect.mRight - test_rect.mRight) * mouse_dir.mX >= 0)
2410 { 2235 {
2411 snap_pos = parent_local_snap_rect.mRight - padding; 2236 snap_pos = parent_local_snap_rect.mRight - padding;
2412 snap_view = mParentView; 2237 snap_view = mParentView;
2413 snapped_x = TRUE; 2238 x_threshold = llabs(parent_local_snap_rect.mRight - test_rect.mRight);
2414 } 2239 }
2415 break; 2240 break;
2416 case SNAP_LEFT: 2241 case SNAP_LEFT:
2417 if (llabs(test_rect.mLeft - parent_local_snap_rect.mLeft) <= threshold && test_rect.mLeft * mouse_dir.mX <= 0) 2242 if (llabs(test_rect.mLeft - parent_local_snap_rect.mLeft) <= x_threshold
2243 && test_rect.mLeft * mouse_dir.mX <= 0)
2418 { 2244 {
2419 snap_pos = parent_local_snap_rect.mLeft + padding; 2245 snap_pos = parent_local_snap_rect.mLeft + padding;
2420 snap_view = mParentView; 2246 snap_view = mParentView;
2421 snapped_x = TRUE; 2247 x_threshold = llabs(test_rect.mLeft - parent_local_snap_rect.mLeft);
2422 } 2248 }
2423 break; 2249 break;
2424 case SNAP_BOTTOM: 2250 case SNAP_BOTTOM:
2425 if (llabs(test_rect.mBottom - parent_local_snap_rect.mBottom) <= threshold && test_rect.mBottom * mouse_dir.mY <= 0) 2251 if (llabs(test_rect.mBottom - parent_local_snap_rect.mBottom) <= y_threshold
2252 && test_rect.mBottom * mouse_dir.mY <= 0)
2426 { 2253 {
2427 snap_pos = parent_local_snap_rect.mBottom + padding; 2254 snap_pos = parent_local_snap_rect.mBottom + padding;
2428 snap_view = mParentView; 2255 snap_view = mParentView;
2429 snapped_y = TRUE; 2256 y_threshold = llabs(test_rect.mBottom - parent_local_snap_rect.mBottom);
2430 } 2257 }
2431 break; 2258 break;
2432 case SNAP_TOP: 2259 case SNAP_TOP:
2433 if (llabs(parent_local_snap_rect.mTop - test_rect.mTop) <= threshold && (parent_local_snap_rect.mTop - test_rect.mTop) * mouse_dir.mY >= 0) 2260 if (llabs(parent_local_snap_rect.mTop - test_rect.mTop) <= y_threshold && (parent_local_snap_rect.mTop - test_rect.mTop) * mouse_dir.mY >= 0)
2434 { 2261 {
2435 snap_pos = parent_local_snap_rect.mTop - padding; 2262 snap_pos = parent_local_snap_rect.mTop - padding;
2436 snap_view = mParentView; 2263 snap_view = mParentView;
2437 snapped_y = TRUE; 2264 y_threshold = llabs(parent_local_snap_rect.mTop - test_rect.mTop);
2438 } 2265 }
2439 break; 2266 break;
2440 default: 2267 default:
@@ -2448,111 +2275,100 @@ LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESna
2448 child_it != mParentView->getChildList()->end(); ++child_it) 2275 child_it != mParentView->getChildList()->end(); ++child_it)
2449 { 2276 {
2450 LLView* siblingp = *child_it; 2277 LLView* siblingp = *child_it;
2451 // skip self 2278
2452 if (siblingp == this || !siblingp->getVisible() || !canSnapTo(siblingp)) 2279 if (!canSnapTo(siblingp)) continue;
2453 {
2454 continue;
2455 }
2456 2280
2457 LLRect sibling_rect = siblingp->getSnapRect(); 2281 LLRect sibling_rect = siblingp->getSnapRect();
2458 2282
2459 switch(snap_edge) 2283 switch(snap_edge)
2460 { 2284 {
2461 case SNAP_RIGHT: 2285 case SNAP_RIGHT:
2462 if (!snapped_x) 2286 if (llabs(test_rect.mRight - sibling_rect.mLeft) <= x_threshold
2287 && (test_rect.mRight - sibling_rect.mLeft) * mouse_dir.mX <= 0)
2463 { 2288 {
2464 if (llabs(test_rect.mRight - sibling_rect.mLeft) <= threshold && (test_rect.mRight - sibling_rect.mLeft) * mouse_dir.mX <= 0) 2289 snap_pos = sibling_rect.mLeft - padding;
2290 snap_view = siblingp;
2291 x_threshold = llabs(test_rect.mRight - sibling_rect.mLeft);
2292 }
2293 // if snapped with sibling along other axis, check for shared edge
2294 else if (llabs(sibling_rect.mTop - (test_rect.mBottom - padding)) <= y_threshold
2295 || llabs(sibling_rect.mBottom - (test_rect.mTop + padding)) <= x_threshold)
2296 {
2297 if (llabs(test_rect.mRight - sibling_rect.mRight) <= x_threshold
2298 && (test_rect.mRight - sibling_rect.mRight) * mouse_dir.mX <= 0)
2465 { 2299 {
2466 snap_pos = sibling_rect.mLeft - padding; 2300 snap_pos = sibling_rect.mRight;
2467 snap_view = siblingp; 2301 snap_view = siblingp;
2468 snapped_x = TRUE; 2302 x_threshold = llabs(test_rect.mRight - sibling_rect.mRight);
2469 }
2470 // if snapped with sibling along other axis, check for shared edge
2471 else if (llabs(sibling_rect.mTop - (test_rect.mBottom - padding)) <= threshold ||
2472 llabs(sibling_rect.mBottom - (test_rect.mTop + padding)) <= threshold)
2473 {
2474 if (llabs(test_rect.mRight - sibling_rect.mRight) <= threshold && (test_rect.mRight - sibling_rect.mRight) * mouse_dir.mX <= 0)
2475 {
2476 snap_pos = sibling_rect.mRight;
2477 snap_view = siblingp;
2478 snapped_x = TRUE;
2479 }
2480 } 2303 }
2481 } 2304 }
2482 break; 2305 break;
2483 case SNAP_LEFT: 2306 case SNAP_LEFT:
2484 if (!snapped_x) 2307 if (llabs(test_rect.mLeft - sibling_rect.mRight) <= x_threshold
2308 && (test_rect.mLeft - sibling_rect.mRight) * mouse_dir.mX <= 0)
2309 {
2310 snap_pos = sibling_rect.mRight + padding;
2311 snap_view = siblingp;
2312 x_threshold = llabs(test_rect.mLeft - sibling_rect.mRight);
2313 }
2314 // if snapped with sibling along other axis, check for shared edge
2315 else if (llabs(sibling_rect.mTop - (test_rect.mBottom - padding)) <= y_threshold
2316 || llabs(sibling_rect.mBottom - (test_rect.mTop + padding)) <= y_threshold)
2485 { 2317 {
2486 if (llabs(test_rect.mLeft - sibling_rect.mRight) <= threshold && (test_rect.mLeft - sibling_rect.mRight) * mouse_dir.mX <= 0) 2318 if (llabs(test_rect.mLeft - sibling_rect.mLeft) <= x_threshold
2319 && (test_rect.mLeft - sibling_rect.mLeft) * mouse_dir.mX <= 0)
2487 { 2320 {
2488 snap_pos = sibling_rect.mRight + padding; 2321 snap_pos = sibling_rect.mLeft;
2489 snap_view = siblingp; 2322 snap_view = siblingp;
2490 snapped_x = TRUE; 2323 x_threshold = llabs(test_rect.mLeft - sibling_rect.mLeft);
2491 }
2492 // if snapped with sibling along other axis, check for shared edge
2493 else if (llabs(sibling_rect.mTop - (test_rect.mBottom - padding)) <= threshold ||
2494 llabs(sibling_rect.mBottom - (test_rect.mTop + padding)) <= threshold)
2495 {
2496 if (llabs(test_rect.mLeft - sibling_rect.mLeft) <= threshold && (test_rect.mLeft - sibling_rect.mLeft) * mouse_dir.mX <= 0)
2497 {
2498 snap_pos = sibling_rect.mLeft;
2499 snap_view = siblingp;
2500 snapped_x = TRUE;
2501 }
2502 } 2324 }
2503 } 2325 }
2504 break; 2326 break;
2505 case SNAP_BOTTOM: 2327 case SNAP_BOTTOM:
2506 if (!snapped_y) 2328 if (llabs(test_rect.mBottom - sibling_rect.mTop) <= y_threshold
2329 && (test_rect.mBottom - sibling_rect.mTop) * mouse_dir.mY <= 0)
2507 { 2330 {
2508 if (llabs(test_rect.mBottom - sibling_rect.mTop) <= threshold && (test_rect.mBottom - sibling_rect.mTop) * mouse_dir.mY <= 0) 2331 snap_pos = sibling_rect.mTop + padding;
2332 snap_view = siblingp;
2333 y_threshold = llabs(test_rect.mBottom - sibling_rect.mTop);
2334 }
2335 // if snapped with sibling along other axis, check for shared edge
2336 else if (llabs(sibling_rect.mRight - (test_rect.mLeft - padding)) <= x_threshold
2337 || llabs(sibling_rect.mLeft - (test_rect.mRight + padding)) <= x_threshold)
2338 {
2339 if (llabs(test_rect.mBottom - sibling_rect.mBottom) <= y_threshold
2340 && (test_rect.mBottom - sibling_rect.mBottom) * mouse_dir.mY <= 0)
2509 { 2341 {
2510 snap_pos = sibling_rect.mTop + padding; 2342 snap_pos = sibling_rect.mBottom;
2511 snap_view = siblingp; 2343 snap_view = siblingp;
2512 snapped_y = TRUE; 2344 y_threshold = llabs(test_rect.mBottom - sibling_rect.mBottom);
2513 }
2514 // if snapped with sibling along other axis, check for shared edge
2515 else if (llabs(sibling_rect.mRight - (test_rect.mLeft - padding)) <= threshold ||
2516 llabs(sibling_rect.mLeft - (test_rect.mRight + padding)) <= threshold)
2517 {
2518 if (llabs(test_rect.mBottom - sibling_rect.mBottom) <= threshold && (test_rect.mBottom - sibling_rect.mBottom) * mouse_dir.mY <= 0)
2519 {
2520 snap_pos = sibling_rect.mBottom;
2521 snap_view = siblingp;
2522 snapped_y = TRUE;
2523 }
2524 } 2345 }
2525 } 2346 }
2526 break; 2347 break;
2527 case SNAP_TOP: 2348 case SNAP_TOP:
2528 if (!snapped_y) 2349 if (llabs(test_rect.mTop - sibling_rect.mBottom) <= y_threshold
2350 && (test_rect.mTop - sibling_rect.mBottom) * mouse_dir.mY <= 0)
2351 {
2352 snap_pos = sibling_rect.mBottom - padding;
2353 snap_view = siblingp;
2354 y_threshold = llabs(test_rect.mTop - sibling_rect.mBottom);
2355 }
2356 // if snapped with sibling along other axis, check for shared edge
2357 else if (llabs(sibling_rect.mRight - (test_rect.mLeft - padding)) <= x_threshold
2358 || llabs(sibling_rect.mLeft - (test_rect.mRight + padding)) <= x_threshold)
2529 { 2359 {
2530 if (llabs(test_rect.mTop - sibling_rect.mBottom) <= threshold && (test_rect.mTop - sibling_rect.mBottom) * mouse_dir.mY <= 0) 2360 if (llabs(test_rect.mTop - sibling_rect.mTop) <= y_threshold
2361 && (test_rect.mTop - sibling_rect.mTop) * mouse_dir.mY <= 0)
2531 { 2362 {
2532 snap_pos = sibling_rect.mBottom - padding; 2363 snap_pos = sibling_rect.mTop;
2533 snap_view = siblingp; 2364 snap_view = siblingp;
2534 snapped_y = TRUE; 2365 y_threshold = llabs(test_rect.mTop - sibling_rect.mTop);
2535 }
2536 // if snapped with sibling along other axis, check for shared edge
2537 else if (llabs(sibling_rect.mRight - (test_rect.mLeft - padding)) <= threshold ||
2538 llabs(sibling_rect.mLeft - (test_rect.mRight + padding)) <= threshold)
2539 {
2540 if (llabs(test_rect.mTop - sibling_rect.mTop) <= threshold && (test_rect.mTop - sibling_rect.mTop) * mouse_dir.mY <= 0)
2541 {
2542 snap_pos = sibling_rect.mTop;
2543 snap_view = siblingp;
2544 snapped_y = TRUE;
2545 }
2546 } 2366 }
2547 } 2367 }
2548 break; 2368 break;
2549 default: 2369 default:
2550 llerrs << "Invalid snap edge" << llendl; 2370 llerrs << "Invalid snap edge" << llendl;
2551 } 2371 }
2552 if (snapped_x && snapped_y)
2553 {
2554 break;
2555 }
2556 } 2372 }
2557 } 2373 }
2558 2374
@@ -2560,21 +2376,6 @@ LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESna
2560 return snap_view; 2376 return snap_view;
2561} 2377}
2562 2378
2563bool operator==(const LLViewHandle& lhs, const LLViewHandle& rhs)
2564{
2565 return lhs.mID == rhs.mID;
2566}
2567
2568bool operator!=(const LLViewHandle& lhs, const LLViewHandle& rhs)
2569{
2570 return lhs.mID != rhs.mID;
2571}
2572
2573bool operator<(const LLViewHandle &lhs, const LLViewHandle &rhs)
2574{
2575 return lhs.mID < rhs.mID;
2576}
2577
2578//----------------------------------------------------------------------------- 2379//-----------------------------------------------------------------------------
2579// Listener dispatch functions 2380// Listener dispatch functions
2580//----------------------------------------------------------------------------- 2381//-----------------------------------------------------------------------------
@@ -2865,13 +2666,6 @@ void LLView::initFromXML(LLXMLNodePtr node, LLView* parent)
2865 setVisible(visible); 2666 setVisible(visible);
2866 } 2667 }
2867 2668
2868 if (node->hasAttribute("hidden"))
2869 {
2870 BOOL hidden;
2871 node->getAttributeBOOL("hidden", hidden);
2872 setHidden(hidden);
2873 }
2874
2875 node->getAttributeBOOL("use_bounding_rect", mUseBoundingRect); 2669 node->getAttributeBOOL("use_bounding_rect", mUseBoundingRect);
2876 node->getAttributeBOOL("mouse_opaque", mMouseOpaque); 2670 node->getAttributeBOOL("mouse_opaque", mMouseOpaque);
2877 2671
@@ -3003,12 +2797,6 @@ void LLView::setControlValue(const LLSD& value)
3003} 2797}
3004 2798
3005//virtual 2799//virtual
3006LLString LLView::getControlName() const
3007{
3008 return mControlName;
3009}
3010
3011//virtual
3012void LLView::setControlName(const LLString& control_name, LLView *context) 2800void LLView::setControlName(const LLString& control_name, LLView *context)
3013{ 2801{
3014 if (context == NULL) 2802 if (context == NULL)
@@ -3047,11 +2835,6 @@ bool LLView::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
3047 return FALSE; 2835 return FALSE;
3048} 2836}
3049 2837
3050void LLView::setValue(const LLSD& value)
3051{
3052}
3053
3054
3055void LLView::addBoolControl(LLString name, bool initial_value) 2838void LLView::addBoolControl(LLString name, bool initial_value)
3056{ 2839{
3057 mFloaterControls[name] = new LLControl(name, TYPE_BOOLEAN, initial_value, "Internal floater control"); 2840 mFloaterControls[name] = new LLControl(name, TYPE_BOOLEAN, initial_value, "Internal floater control");
@@ -3066,3 +2849,14 @@ LLControlBase *LLView::getControl(LLString name)
3066 } 2849 }
3067 return NULL; 2850 return NULL;
3068} 2851}
2852
2853//virtual
2854void LLView::setValue(const LLSD& value)
2855{
2856}
2857
2858//virtual
2859LLSD LLView::getValue() const
2860{
2861 return LLSD();
2862}
diff --git a/linden/indra/llui/llview.h b/linden/indra/llui/llview.h
index 67a4d56..52c7e3d 100644
--- a/linden/indra/llui/llview.h
+++ b/linden/indra/llui/llview.h
@@ -52,10 +52,6 @@
52#include "stdenums.h" 52#include "stdenums.h"
53#include "lluistring.h" 53#include "lluistring.h"
54 54
55class LLColor4;
56class LLWindow;
57class LLUICtrl;
58class LLScrollListItem;
59 55
60const U32 FOLLOWS_NONE = 0x00; 56const U32 FOLLOWS_NONE = 0x00;
61const U32 FOLLOWS_LEFT = 0x01; 57const U32 FOLLOWS_LEFT = 0x01;
@@ -69,29 +65,90 @@ const BOOL NOT_MOUSE_OPAQUE = FALSE;
69 65
70const U32 GL_NAME_UI_RESERVED = 2; 66const U32 GL_NAME_UI_RESERVED = 2;
71 67
72class LLSimpleListener;
73class LLEventDispatcher;
74 68
75class LLViewHandle 69/*
76{ 70// virtual functions defined in LLView:
77public: 71
78 LLViewHandle() { mID = 0; } 72virtual BOOL isCtrl() const;
79 73 LLUICtrl
80 void init() { mID = ++sNextID; } 74virtual BOOL isPanel();
81 void markDead() { mID = 0; } 75 LLPanel
82 BOOL isDead() { return (mID == 0); } 76virtual void setRect(const LLRect &rect);
83 friend bool operator==(const LLViewHandle& lhs, const LLViewHandle& rhs); 77 LLLineEditor
84 friend bool operator!=(const LLViewHandle& lhs, const LLViewHandle& rhs); 78virtual void addCtrl( LLUICtrl* ctrl, S32 tab_group);
85 friend bool operator<(const LLViewHandle &a, const LLViewHandle &b); 79virtual void addCtrlAtEnd( LLUICtrl* ctrl, S32 tab_group);
86 80virtual void removeCtrl( LLUICtrl* ctrl);
87public: 81 LLPanel
88 static LLViewHandle sDeadHandle; 82virtual BOOL canFocusChildren() const { return TRUE; }
83 LLFolderView
84virtual void deleteAllChildren();
85 LLFolderView, LLPanelInventory
86virtual void setTentative(BOOL b) {}
87 LLUICtrl, LLSliderCtrl, LLSpinCtrl
88virtual BOOL getTentative() const { return FALSE; }
89 LLUICtrl, LLCheckBoxCtrl
90virtual void setVisible(BOOL visible);
91 LLFloater, LLAlertDialog, LLMenuItemGL, LLModalDialog
92virtual void setEnabled(BOOL enabled) { mEnabled = enabled; }
93 LLCheckBoxCtrl, LLComboBox, LLLineEditor, LLMenuGL, LLRadioGroup, etc
94virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ) { return FALSE; }
95 LLUICtrl, LLButton, LLCheckBoxCtrl, LLLineEditor, LLMenuGL, LLSliderCtrl
96virtual void onVisibilityChange ( BOOL curVisibilityIn );
97 LLMenuGL
98virtual LLRect getSnapRect() const { return mRect; } *TODO: Make non virtual
99 LLFloater
100virtual LLRect getRequiredRect() { return mRect; }
101 LLScrolllistCtrl
102virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
103 LLUICtrl, et. al.
104virtual void translate( S32 x, S32 y );
105 LLMenuGL
106virtual void userSetShape(const LLRect& new_rect);
107 LLFloater, LLScrollLIstVtrl
108virtual LLView* findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, LLView::ESnapType snap_type, S32 threshold, S32 padding = 0);
109virtual LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding = 0);
110 LLScrollListCtrl
111virtual BOOL canSnapTo(const LLView* other_view) const { return other_view != this && other_view->getVisible(); }
112 LLFloater
113virtual void snappedTo(LLView* snap_view) {}
114 LLFloater
115virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
116 *
117virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
118 *
119virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,EDragAndDropType cargo_type,void* cargo_data,EAcceptance* accept,LLString& tooltip_msg);
120 *
121virtual void draw();
122 *
123virtual EWidgetType getWidgetType() const = 0;
124 *
125virtual LLString getWidgetTag() const = 0;
126 *
127virtual LLXMLNodePtr getXML(bool save_children = true) const;
128 *
129virtual void initFromXML(LLXMLNodePtr node, LLView* parent);
130 *
131virtual void onFocusLost() {}
132 LLUICtrl, LLScrollListCtrl, LLMenuGL, LLLineEditor, LLComboBox
133virtual void onFocusReceived() {}
134 LLUICtrl, LLTextEditor, LLScrollListVtrl, LLMenuGL, LLLineEditor
135virtual LLView* getChildByName(const LLString& name, BOOL recurse = FALSE) const;
136 LLTabContainer, LLPanel, LLMenuGL
137virtual void setControlName(const LLString& control, LLView *context);
138 LLSliderCtrl, LLCheckBoxCtrl
139virtual LLString getControlName() const { return mControlName; }
140 LLSliderCtrl, LLCheckBoxCtrl
141virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
142 LLMenuItem
143virtual void setValue(const LLSD& value);
144 *
89 145
90protected: 146protected:
91 S32 mID; 147virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
92 148 *
93 static S32 sNextID; 149virtual BOOL handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent);
94}; 150 *
151*/
95 152
96class LLView : public LLMouseHandler, public LLMortician, public LLSimpleListenerObservable 153class LLView : public LLMouseHandler, public LLMortician, public LLSimpleListenerObservable
97{ 154{
@@ -128,7 +185,7 @@ public:
128 typedef child_list_t::reverse_iterator child_list_reverse_iter_t; 185 typedef child_list_t::reverse_iterator child_list_reverse_iter_t;
129 typedef child_list_t::const_reverse_iterator child_list_const_reverse_iter_t; 186 typedef child_list_t::const_reverse_iterator child_list_const_reverse_iter_t;
130 187
131 typedef std::vector<LLUICtrl *> ctrl_list_t; 188 typedef std::vector<class LLUICtrl *> ctrl_list_t;
132 189
133 typedef std::pair<S32, S32> tab_order_t; 190 typedef std::pair<S32, S32> tab_order_t;
134 typedef std::pair<LLUICtrl *, tab_order_t> tab_order_pair_t; 191 typedef std::pair<LLUICtrl *, tab_order_t> tab_order_pair_t;
@@ -139,105 +196,48 @@ public:
139 typedef child_tab_order_t::reverse_iterator child_tab_order_reverse_iter_t; 196 typedef child_tab_order_t::reverse_iterator child_tab_order_reverse_iter_t;
140 typedef child_tab_order_t::const_reverse_iterator child_tab_order_const_reverse_iter_t; 197 typedef child_tab_order_t::const_reverse_iterator child_tab_order_const_reverse_iter_t;
141 198
142private:
143 LLView* mParentView;
144 child_list_t mChildList;
145
146protected:
147 LLString mName;
148 // location in pixels, relative to surrounding structure, bottom,left=0,0
149 LLRect mRect;
150 LLRect mBoundingRect;
151
152 U32 mReshapeFlags;
153
154 child_tab_order_t mCtrlOrder;
155 S32 mDefaultTabGroup;
156
157 BOOL mEnabled; // Enabled means "accepts input that has an effect on the state of the application."
158 // A disabled view, for example, may still have a scrollbar that responds to mouse events.
159 BOOL mMouseOpaque; // Opaque views handle all mouse events that are over their rect.
160 LLUIString mToolTipMsg; // isNull() is true if none.
161
162 U8 mSoundFlags;
163 BOOL mSaveToXML;
164
165 BOOL mIsFocusRoot;
166 BOOL mUseBoundingRect; // hit test against bounding rectangle that includes all child elements
167
168public:
169 LLViewHandle mViewHandle;
170 BOOL mLastVisible;
171
172private:
173 BOOL mVisible;
174 BOOL mHidden; // Never show (generally for replacement text only)
175
176 S32 mNextInsertionOrdinal;
177
178protected:
179 static LLWindow* sWindow; // All root views must know about their window.
180
181public:
182 static BOOL sDebugRects; // Draw debug rects behind everything.
183 static BOOL sDebugKeys;
184 static S32 sDepth;
185 static BOOL sDebugMouseHandling;
186 static LLString sMouseHandlerMessage;
187 static S32 sSelectID;
188 static BOOL sEditingUI;
189 static LLView* sEditingUIView;
190 static S32 sLastLeftXML;
191 static S32 sLastBottomXML;
192 static std::map<LLViewHandle,LLView*> sViewHandleMap;
193 static BOOL sForceReshape;
194
195public:
196 static LLView* getViewByHandle(LLViewHandle handle);
197 static BOOL deleteViewByHandle(LLViewHandle handle);
198
199public:
200 LLView(); 199 LLView();
201 LLView(const LLString& name, BOOL mouse_opaque); 200 LLView(const LLString& name, BOOL mouse_opaque);
202 LLView(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows=FOLLOWS_NONE); 201 LLView(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows=FOLLOWS_NONE);
203 202
204 virtual ~LLView(); 203 virtual ~LLView();
205 204
206 // Hack to support LLFocusMgr 205 // Hack to support LLFocusMgr (from LLMouseHandler)
207 virtual BOOL isView(); 206 /*virtual*/ BOOL isView() const;
208 207
209 // Some UI widgets need to be added as controls. Others need to 208 // Some UI widgets need to be added as controls. Others need to
210 // be added as regular view children. isCtrl should return TRUE 209 // be added as regular view children. isCtrl should return TRUE
211 // if a widget needs to be added as a ctrl 210 // if a widget needs to be added as a ctrl
212 virtual BOOL isCtrl() const; 211 virtual BOOL isCtrl() const;
213 212
214 virtual BOOL isPanel(); 213 virtual BOOL isPanel() const;
215 214
216 // 215 //
217 // MANIPULATORS 216 // MANIPULATORS
218 // 217 //
219 void setMouseOpaque( BOOL b ); 218 void setMouseOpaque( BOOL b ) { mMouseOpaque = b; }
219 BOOL getMouseOpaque() const { return mMouseOpaque; }
220 void setToolTip( const LLStringExplicit& msg ); 220 void setToolTip( const LLStringExplicit& msg );
221 BOOL setToolTipArg( const LLStringExplicit& key, const LLStringExplicit& text ); 221 BOOL setToolTipArg( const LLStringExplicit& key, const LLStringExplicit& text );
222 void setToolTipArgs( const LLString::format_map_t& args ); 222 void setToolTipArgs( const LLString::format_map_t& args );
223 223
224 virtual void setRect(const LLRect &rect); 224 virtual void setRect(const LLRect &rect);
225 void setFollows(U32 flags); 225 void setFollows(U32 flags) { mReshapeFlags = flags; }
226 226
227 // deprecated, use setFollows() with FOLLOWS_LEFT | FOLLOWS_TOP, etc. 227 // deprecated, use setFollows() with FOLLOWS_LEFT | FOLLOWS_TOP, etc.
228 void setFollowsNone(); 228 void setFollowsNone() { mReshapeFlags = FOLLOWS_NONE; }
229 void setFollowsLeft(); 229 void setFollowsLeft() { mReshapeFlags |= FOLLOWS_LEFT; }
230 void setFollowsTop(); 230 void setFollowsTop() { mReshapeFlags |= FOLLOWS_TOP; }
231 void setFollowsRight(); 231 void setFollowsRight() { mReshapeFlags |= FOLLOWS_RIGHT; }
232 void setFollowsBottom(); 232 void setFollowsBottom() { mReshapeFlags |= FOLLOWS_BOTTOM; }
233 void setFollowsAll(); 233 void setFollowsAll() { mReshapeFlags |= FOLLOWS_ALL; }
234 234
235 void setSoundFlags(U8 flags); 235 void setSoundFlags(U8 flags) { mSoundFlags = flags; }
236 void setName(LLString name); 236 void setName(LLString name) { mName = name; }
237 void setUseBoundingRect( BOOL use_bounding_rect ); 237 void setUseBoundingRect( BOOL use_bounding_rect );
238 BOOL getUseBoundingRect(); 238 BOOL getUseBoundingRect();
239 239
240 const LLString& getToolTip(); 240 const LLString& getToolTip() const { return mToolTipMsg.getString(); }
241 241
242 void sendChildToFront(LLView* child); 242 void sendChildToFront(LLView* child);
243 void sendChildToBack(LLView* child); 243 void sendChildToBack(LLView* child);
@@ -253,61 +253,47 @@ public:
253 virtual void addCtrlAtEnd( LLUICtrl* ctrl, S32 tab_group); 253 virtual void addCtrlAtEnd( LLUICtrl* ctrl, S32 tab_group);
254 virtual void removeCtrl( LLUICtrl* ctrl); 254 virtual void removeCtrl( LLUICtrl* ctrl);
255 255
256 child_tab_order_t getCtrlOrder() const { return mCtrlOrder; } 256 child_tab_order_t getCtrlOrder() const { return mCtrlOrder; }
257 ctrl_list_t getCtrlList() const; 257 ctrl_list_t getCtrlList() const;
258 ctrl_list_t getCtrlListSorted() const; 258 ctrl_list_t getCtrlListSorted() const;
259 S32 getDefaultTabGroup() const; 259
260 void setDefaultTabGroup(S32 d) { mDefaultTabGroup = d; }
261 S32 getDefaultTabGroup() const { return mDefaultTabGroup; }
260 262
261 BOOL isInVisibleChain() const; 263 BOOL isInVisibleChain() const;
262 BOOL isInEnabledChain() const; 264 BOOL isInEnabledChain() const;
263 265
264 BOOL isFocusRoot() const; 266 void setFocusRoot(BOOL b) { mIsFocusRoot = b; }
265 LLView* findRootMostFocusRoot(); 267 BOOL isFocusRoot() const { return mIsFocusRoot; }
266 virtual BOOL canFocusChildren() const; 268 virtual BOOL canFocusChildren() const;
267 269
268 class LLFocusRootsFilter : public LLQueryFilter, public LLSingleton<LLFocusRootsFilter> 270 BOOL focusNextRoot();
269 { 271 BOOL focusPrevRoot();
270 /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const
271 {
272 return filterResult_t(view->isCtrl() && view->isFocusRoot(), TRUE);
273 }
274 };
275
276 virtual BOOL focusNextRoot();
277 virtual BOOL focusPrevRoot();
278
279 virtual BOOL focusNextItem(BOOL text_entry_only);
280 virtual BOOL focusPrevItem(BOOL text_entry_only);
281 virtual BOOL focusFirstItem(BOOL prefer_text_fields = FALSE );
282 virtual BOOL focusLastItem(BOOL prefer_text_fields = FALSE);
283 272
284 // delete all children. Override this function if you need to 273 // delete all children. Override this function if you need to
285 // perform any extra clean up such as cached pointers to selected 274 // perform any extra clean up such as cached pointers to selected
286 // children, etc. 275 // children, etc.
287 virtual void deleteAllChildren(); 276 virtual void deleteAllChildren();
288 277
289 // by default, does nothing
290 virtual void setTentative(BOOL b); 278 virtual void setTentative(BOOL b);
291 // by default, returns false
292 virtual BOOL getTentative() const; 279 virtual BOOL getTentative() const;
293 virtual void setAllChildrenEnabled(BOOL b); 280 void setAllChildrenEnabled(BOOL b);
294 281
295 virtual void setEnabled(BOOL enabled);
296 virtual void setVisible(BOOL visible); 282 virtual void setVisible(BOOL visible);
297 virtual void setHidden(BOOL hidden); // Never show (replacement text) 283 BOOL getVisible() const { return mVisible; }
284 virtual void setEnabled(BOOL enabled);
285 BOOL getEnabled() const { return mEnabled; }
286 U8 getSoundFlags() const { return mSoundFlags; }
298 287
299 // by default, does nothing and returns false
300 virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); 288 virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
301 289
302 virtual void onVisibilityChange ( BOOL curVisibilityIn ); 290 virtual void onVisibilityChange ( BOOL curVisibilityIn );
303 291
304 void pushVisible(BOOL visible) { mLastVisible = mVisible; setVisible(visible); } 292 void pushVisible(BOOL visible) { mLastVisible = mVisible; setVisible(visible); }
305 void popVisible() { setVisible(mLastVisible); mLastVisible = TRUE; } 293 void popVisible() { setVisible(mLastVisible); mLastVisible = TRUE; }
294
295 LLHandle<LLView> getHandle() { mHandle.bind(this); return mHandle; }
306 296
307 //
308 // ACCESSORS
309 //
310 BOOL getMouseOpaque() const { return mMouseOpaque; }
311 297
312 U32 getFollows() const { return mReshapeFlags; } 298 U32 getFollows() const { return mReshapeFlags; }
313 BOOL followsLeft() const { return mReshapeFlags & FOLLOWS_LEFT; } 299 BOOL followsLeft() const { return mReshapeFlags & FOLLOWS_LEFT; }
@@ -318,26 +304,26 @@ public:
318 304
319 const LLRect& getRect() const { return mRect; } 305 const LLRect& getRect() const { return mRect; }
320 const LLRect& getBoundingRect() const { return mBoundingRect; } 306 const LLRect& getBoundingRect() const { return mBoundingRect; }
321 const LLRect getLocalBoundingRect() const; 307 LLRect getLocalBoundingRect() const;
322 const LLRect getScreenRect() const; 308 LLRect getScreenRect() const;
323 const LLRect getLocalRect() const; 309 LLRect getLocalRect() const;
324 virtual const LLRect getSnapRect() const { return mRect; } 310 virtual LLRect getSnapRect() const;
325 virtual const LLRect getLocalSnapRect() const; 311 LLRect getLocalSnapRect() const;
326 312
327 virtual LLRect getRequiredRect(); // Get required size for this object. 0 for width/height means don't care. 313 // Override and return required size for this object. 0 for width/height means don't care.
314 virtual LLRect getRequiredRect();
328 void updateBoundingRect(); 315 void updateBoundingRect();
329 316
330 LLView* getRootView(); 317 LLView* getRootView();
331 LLView* getParent() const { return mParentView; } 318 LLView* getParent() const { return mParentView; }
332 LLView* getFirstChild() { return (mChildList.empty()) ? NULL : *(mChildList.begin()); } 319 LLView* getFirstChild() const { return (mChildList.empty()) ? NULL : *(mChildList.begin()); }
333 S32 getChildCount() const { return (S32)mChildList.size(); } 320 S32 getChildCount() const { return (S32)mChildList.size(); }
334 template<class _Pr3> void sortChildren(_Pr3 _Pred) { mChildList.sort(_Pred); } 321 template<class _Pr3> void sortChildren(_Pr3 _Pred) { mChildList.sort(_Pred); }
335 BOOL hasAncestor(const LLView* parentp); 322 BOOL hasAncestor(const LLView* parentp) const;
336
337 BOOL hasChild(const LLString& childname, BOOL recurse = FALSE) const; 323 BOOL hasChild(const LLString& childname, BOOL recurse = FALSE) const;
338
339 BOOL childHasKeyboardFocus( const LLString& childname ) const; 324 BOOL childHasKeyboardFocus( const LLString& childname ) const;
340 325
326
341 // 327 //
342 // UTILITIES 328 // UTILITIES
343 // 329 //
@@ -345,15 +331,15 @@ public:
345 // Default behavior is to use reshape flags to resize child views 331 // Default behavior is to use reshape flags to resize child views
346 virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); 332 virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
347 virtual void translate( S32 x, S32 y ); 333 virtual void translate( S32 x, S32 y );
348 virtual void setOrigin( S32 x, S32 y ) { mRect.translate( x - mRect.mLeft, y - mRect.mBottom ); } 334 void setOrigin( S32 x, S32 y ) { mRect.translate( x - mRect.mLeft, y - mRect.mBottom ); }
349 BOOL translateIntoRect( const LLRect& constraint, BOOL allow_partial_outside ); 335 BOOL translateIntoRect( const LLRect& constraint, BOOL allow_partial_outside );
336 void centerWithin(const LLRect& bounds);
350 337
351 virtual void userSetShape(const LLRect& new_rect); 338 virtual void userSetShape(const LLRect& new_rect);
352 virtual LLView* findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, LLView::ESnapType snap_type, S32 threshold, S32 padding = 0); 339 virtual LLView* findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, LLView::ESnapType snap_type, S32 threshold, S32 padding = 0);
353 virtual LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding = 0); 340 virtual LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding = 0);
354 341
355 // Defaults to other_view->getVisible() 342 virtual BOOL canSnapTo(const LLView* other_view) const;
356 virtual BOOL canSnapTo(LLView* other_view);
357 343
358 virtual void snappedTo(LLView* snap_view); 344 virtual void snappedTo(LLView* snap_view);
359 345
@@ -365,49 +351,97 @@ public:
365 EAcceptance* accept, 351 EAcceptance* accept,
366 LLString& tooltip_msg); 352 LLString& tooltip_msg);
367 353
368 // LLMouseHandler functions
369 // Default behavior is to pass events to children
370
371 /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
372 /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
373 /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
374 /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
375 /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
376 /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
377 /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
378 /*virtual*/ void onMouseCaptureLost();
379 /*virtual*/ BOOL hasMouseCapture();
380
381 // Default behavior is to pass the tooltip event to children,
382 // then display mToolTipMsg if no child handled it.
383 /*virtual*/ BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect);
384
385 LLString getShowNamesToolTip(); 354 LLString getShowNamesToolTip();
386 355
387 virtual void draw(); 356 virtual void draw();
388 357
389 void drawDebugRect();
390 void drawChild(LLView* childp, S32 x_offset = 0, S32 y_offset = 0, BOOL force_draw = FALSE);
391
392 virtual const LLString& getName() const;
393
394 virtual EWidgetType getWidgetType() const = 0; 358 virtual EWidgetType getWidgetType() const = 0;
395 virtual LLString getWidgetTag() const = 0; 359 virtual LLString getWidgetTag() const = 0;
396 virtual LLXMLNodePtr getXML(bool save_children = true) const; 360 virtual LLXMLNodePtr getXML(bool save_children = true) const;
397 361
398 static U32 createRect(LLXMLNodePtr node, LLRect &rect, LLView* parent_view, const LLRect &required_rect = LLRect());
399 virtual void initFromXML(LLXMLNodePtr node, LLView* parent); 362 virtual void initFromXML(LLXMLNodePtr node, LLView* parent);
400 void parseFollowsFlags(LLXMLNodePtr node); 363 void parseFollowsFlags(LLXMLNodePtr node);
401 364
365 // Some widgets, like close box buttons, don't need to be saved
366 BOOL getSaveToXML() const { return mSaveToXML; }
367 void setSaveToXML(BOOL b) { mSaveToXML = b; }
368
369 virtual void onFocusLost();
370 virtual void onFocusReceived();
371
372 typedef enum e_hit_test_type
373 {
374 HIT_TEST_USE_BOUNDING_RECT,
375 HIT_TEST_IGNORE_BOUNDING_RECT
376 }EHitTestType;
377
378 BOOL parentPointInView(S32 x, S32 y, EHitTestType type = HIT_TEST_USE_BOUNDING_RECT) const;
379 BOOL pointInView(S32 x, S32 y, EHitTestType type = HIT_TEST_USE_BOUNDING_RECT) const;
380 BOOL blockMouseEvent(S32 x, S32 y) const;
381
382 // See LLMouseHandler virtuals for screenPointToLocal and localPointToScreen
383 BOOL localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, LLView* other_view) const;
384 BOOL localRectToOtherView( const LLRect& local, LLRect* other, LLView* other_view ) const;
385 void screenRectToLocal( const LLRect& screen, LLRect* local ) const;
386 void localRectToScreen( const LLRect& local, LLRect* screen ) const;
387
388 // Listener dispatching functions (Dispatcher deletes pointers to listeners on deregistration or destruction)
389 LLSimpleListener* getListenerByName(const LLString &callback_name);
390 void registerEventListener(LLString name, LLSimpleListener* function);
391 void deregisterEventListener(LLString name);
392 LLString findEventListener(LLSimpleListener *listener) const;
393 void addListenerToControl(LLEventDispatcher *observer, const LLString& name, LLSD filter, LLSD userdata);
394
395 void addBoolControl(LLString name, bool initial_value);
396 LLControlBase *getControl(LLString name);
397 LLControlBase *findControl(LLString name);
398
399 void setControlValue(const LLSD& value);
400 virtual void setControlName(const LLString& control, LLView *context);
401 virtual LLString getControlName() const { return mControlName; }
402 virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
403 virtual void setValue(const LLSD& value);
404 virtual LLSD getValue() const;
405
406 const child_list_t* getChildList() const { return &mChildList; }
407
408 // LLMouseHandler functions
409 // Default behavior is to pass events to children
410 /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
411 /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
412 /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
413 /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
414 /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
415 /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
416 /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
417 /*virtual*/ BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect); // Display mToolTipMsg if no child handles it.
418 /*virtual*/ const LLString& getName() const;
419 /*virtual*/ void onMouseCaptureLost();
420 /*virtual*/ BOOL hasMouseCapture();
421 /*virtual*/ BOOL isView(); // Hack to support LLFocusMgr
422 /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const;
423 /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const;
424
425 template <class T> T* getChild(const LLString& name, BOOL recurse = TRUE) const
426 {
427 T* result = dynamic_cast<T*>(getChildByName(name, TRUE));
428 //if (!result)
429 //{
430 // // create dummy widget instance here
431 // result = gUICtrlFactory->createDummyWidget<T>(name);
432 //}
433 return result;
434 }
435
436 // statics
437 static U32 createRect(LLXMLNodePtr node, LLRect &rect, LLView* parent_view, const LLRect &required_rect = LLRect());
438
402 static LLFontGL* selectFont(LLXMLNodePtr node); 439 static LLFontGL* selectFont(LLXMLNodePtr node);
403 static LLFontGL::HAlign selectFontHAlign(LLXMLNodePtr node); 440 static LLFontGL::HAlign selectFontHAlign(LLXMLNodePtr node);
404 static LLFontGL::VAlign selectFontVAlign(LLXMLNodePtr node); 441 static LLFontGL::VAlign selectFontVAlign(LLXMLNodePtr node);
405 static LLFontGL::StyleFlags selectFontStyle(LLXMLNodePtr node); 442 static LLFontGL::StyleFlags selectFontStyle(LLXMLNodePtr node);
406 443
407 // Some widgets, like close box buttons, don't need to be saved 444
408 BOOL getSaveToXML() const { return mSaveToXML; }
409 void setSaveToXML(BOOL b) { mSaveToXML = b; }
410
411 // Only saves color if different from default setting. 445 // Only saves color if different from default setting.
412 static void addColorXML(LLXMLNodePtr node, const LLColor4& color, 446 static void addColorXML(LLXMLNodePtr node, const LLColor4& color,
413 const LLString& xml_name, const LLString& control_name); 447 const LLString& xml_name, const LLString& control_name);
@@ -432,54 +466,17 @@ public:
432 // return query for iterating over focus roots in tab order 466 // return query for iterating over focus roots in tab order
433 static const LLCtrlQuery & getFocusRootsQuery(); 467 static const LLCtrlQuery & getFocusRootsQuery();
434 468
435 BOOL getEnabled() const { return mEnabled; } 469 static BOOL deleteViewByHandle(LLHandle<LLView> handle);
436 BOOL getVisible() const { return mVisible && !mHidden; } 470 static LLWindow* getWindow(void) { return LLUI::sWindow; }
437 U8 getSoundFlags() const { return mSoundFlags; }
438
439 typedef enum e_hit_test_type
440 {
441 HIT_TEST_USE_BOUNDING_RECT,
442 HIT_TEST_IGNORE_BOUNDING_RECT
443 }EHitTestType;
444
445 BOOL parentPointInView(S32 x, S32 y, EHitTestType type = HIT_TEST_USE_BOUNDING_RECT) const;
446 BOOL pointInView(S32 x, S32 y, EHitTestType type = HIT_TEST_USE_BOUNDING_RECT) const;
447 BOOL blockMouseEvent(S32 x, S32 y) const;
448
449 virtual void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const;
450 virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const;
451 virtual BOOL localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, LLView* other_view);
452 virtual void screenRectToLocal( const LLRect& screen, LLRect* local ) const;
453 virtual void localRectToScreen( const LLRect& local, LLRect* screen ) const;
454 virtual BOOL localRectToOtherView( const LLRect& local, LLRect* other, LLView* other_view ) const;
455
456
457 static LLWindow* getWindow(void);
458
459 // Listener dispatching functions (Dispatcher deletes pointers to listeners on deregistration or destruction)
460 LLSimpleListener* getListenerByName(const LLString &callback_name);
461 void registerEventListener(LLString name, LLSimpleListener* function);
462 void deregisterEventListener(LLString name);
463 LLString findEventListener(LLSimpleListener *listener) const;
464 void addListenerToControl(LLEventDispatcher *observer, const LLString& name, LLSD filter, LLSD userdata);
465
466 virtual LLView* getChildByName(const LLString& name, BOOL recurse = FALSE) const;
467
468 void addBoolControl(LLString name, bool initial_value);
469 LLControlBase *getControl(LLString name);
470 virtual LLControlBase *findControl(LLString name);
471
472 void setControlValue(const LLSD& value);
473 virtual void setControlName(const LLString& control, LLView *context);
474 virtual LLString getControlName() const;
475 virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
476 virtual void setValue(const LLSD& value);
477 const child_list_t* getChildList() const { return &mChildList; }
478 471
472
479protected: 473protected:
480 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); 474 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
481 virtual BOOL handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent); 475 virtual BOOL handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent);
482 476
477 void drawDebugRect();
478 void drawChild(LLView* childp, S32 x_offset = 0, S32 y_offset = 0, BOOL force_draw = FALSE);
479
483 LLView* childrenHandleKey(KEY key, MASK mask); 480 LLView* childrenHandleKey(KEY key, MASK mask);
484 LLView* childrenHandleUnicodeChar(llwchar uni_char); 481 LLView* childrenHandleUnicodeChar(llwchar uni_char);
485 LLView* childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, 482 LLView* childrenHandleDragAndDrop(S32 x, S32 y, MASK mask,
@@ -497,15 +494,64 @@ protected:
497 LLView* childrenHandleRightMouseDown(S32 x, S32 y, MASK mask); 494 LLView* childrenHandleRightMouseDown(S32 x, S32 y, MASK mask);
498 LLView* childrenHandleRightMouseUp(S32 x, S32 y, MASK mask); 495 LLView* childrenHandleRightMouseUp(S32 x, S32 y, MASK mask);
499 496
500 typedef std::map<LLString, LLPointer<LLSimpleListener> > dispatch_list_t;
501 dispatch_list_t mDispatchList;
502
503protected:
504 typedef std::map<LLString, LLControlBase*> control_map_t; 497 typedef std::map<LLString, LLControlBase*> control_map_t;
505 control_map_t mFloaterControls; 498 control_map_t mFloaterControls;
506 499
500 virtual LLView* getChildByName(const LLString& name, BOOL recurse = FALSE) const;
501
502private:
503 LLView* mParentView;
504 child_list_t mChildList;
505
506 LLString mName;
507 // location in pixels, relative to surrounding structure, bottom,left=0,0
508 LLRect mRect;
509 LLRect mBoundingRect;
510
511 U32 mReshapeFlags;
512
513 child_tab_order_t mCtrlOrder;
514 S32 mDefaultTabGroup;
515
516 BOOL mEnabled; // Enabled means "accepts input that has an effect on the state of the application."
517 // A disabled view, for example, may still have a scrollbar that responds to mouse events.
518 BOOL mMouseOpaque; // Opaque views handle all mouse events that are over their rect.
519 LLUIString mToolTipMsg; // isNull() is true if none.
520
521 U8 mSoundFlags;
522 BOOL mSaveToXML;
523
524 BOOL mIsFocusRoot;
525 BOOL mUseBoundingRect; // hit test against bounding rectangle that includes all child elements
526
527 LLRootHandle<LLView> mHandle;
528 BOOL mLastVisible;
529
530 BOOL mVisible;
531
532 S32 mNextInsertionOrdinal;
533
534 static LLWindow* sWindow; // All root views must know about their window.
535
536 typedef std::map<LLString, LLPointer<LLSimpleListener> > dispatch_list_t;
537 dispatch_list_t mDispatchList;
538
507 LLString mControlName; 539 LLString mControlName;
508 friend class LLUICtrlFactory; 540
541
542// Just debugging stuff? We should try to hide anything that's not. -MG
543public:
544 static BOOL sDebugRects; // Draw debug rects behind everything.
545 static BOOL sDebugKeys;
546 static S32 sDepth;
547 static BOOL sDebugMouseHandling;
548 static LLString sMouseHandlerMessage;
549 static S32 sSelectID;
550 static BOOL sEditingUI;
551 static LLView* sEditingUIView;
552 static S32 sLastLeftXML;
553 static S32 sLastBottomXML;
554 static BOOL sForceReshape;
509}; 555};
510 556
511 557
@@ -514,12 +560,12 @@ protected:
514class LLCompareByTabOrder 560class LLCompareByTabOrder
515{ 561{
516public: 562public:
517 LLCompareByTabOrder(LLView::child_tab_order_t order); 563 LLCompareByTabOrder(LLView::child_tab_order_t order) : mTabOrder(order) {}
518 virtual ~LLCompareByTabOrder() {} 564 virtual ~LLCompareByTabOrder() {}
519 bool operator() (const LLView* const a, const LLView* const b) const; 565 bool operator() (const LLView* const a, const LLView* const b) const;
520protected: 566private:
521 virtual bool compareTabOrders(const LLView::tab_order_t & a, const LLView::tab_order_t & b) const; 567 virtual bool compareTabOrders(const LLView::tab_order_t & a, const LLView::tab_order_t & b) const { return a < b; }
522 LLView::child_tab_order_t mTabOrder; 568 LLView::child_tab_order_t mTabOrder;
523}; 569};
524 570
525#endif 571#endif //LL_LLVIEW_H
diff --git a/linden/indra/llui/llviewborder.cpp b/linden/indra/llui/llviewborder.cpp
index b70edec..6c2d9fa 100644
--- a/linden/indra/llui/llviewborder.cpp
+++ b/linden/indra/llui/llviewborder.cpp
@@ -1,6 +1,5 @@
1/** 1/**
2 * @file llviewborder.cpp 2 * @file llviewborder.cpp
3 * @brief LLViewBorder base class
4 * 3 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$ 4 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 * 5 *
@@ -29,19 +28,9 @@
29 * $/LicenseInfo$ 28 * $/LicenseInfo$
30 */ 29 */
31 30
32// A customizable decorative border. Does not interact with mouse events.
33
34#include "linden_common.h" 31#include "linden_common.h"
35
36#include "llviewborder.h" 32#include "llviewborder.h"
37 33#include "llglimmediate.h"
38#include "llgl.h"
39#include "llui.h"
40#include "llimagegl.h"
41//#include "llviewerimagelist.h"
42#include "llcontrol.h"
43#include "llglheaders.h"
44#include "v2math.h"
45#include "llfocusmgr.h" 34#include "llfocusmgr.h"
46 35
47LLViewBorder::LLViewBorder( const LLString& name, const LLRect& rect, EBevel bevel, EStyle style, S32 width ) 36LLViewBorder::LLViewBorder( const LLString& name, const LLRect& rect, EBevel bevel, EStyle style, S32 width )
@@ -53,7 +42,6 @@ LLViewBorder::LLViewBorder( const LLString& name, const LLRect& rect, EBevel bev
53 mHighlightDark( LLUI::sColorsGroup->getColor( "DefaultHighlightDark" ) ), 42 mHighlightDark( LLUI::sColorsGroup->getColor( "DefaultHighlightDark" ) ),
54 mShadowLight( LLUI::sColorsGroup->getColor( "DefaultShadowLight" ) ), 43 mShadowLight( LLUI::sColorsGroup->getColor( "DefaultShadowLight" ) ),
55 mShadowDark( LLUI::sColorsGroup->getColor( "DefaultShadowDark" ) ), 44 mShadowDark( LLUI::sColorsGroup->getColor( "DefaultShadowDark" ) ),
56// mKeyboardFocusColor(LLUI::sColorsGroup->getColor( "FocusColor" ) ),
57 mBorderWidth( width ), 45 mBorderWidth( width ),
58 mTexture( NULL ), 46 mTexture( NULL ),
59 mHasKeyboardFocus( FALSE ) 47 mHasKeyboardFocus( FALSE )
@@ -61,12 +49,6 @@ LLViewBorder::LLViewBorder( const LLString& name, const LLRect& rect, EBevel bev
61 setFollowsAll(); 49 setFollowsAll();
62} 50}
63 51
64// virtual
65BOOL LLViewBorder::isCtrl() const
66{
67 return FALSE;
68}
69
70void LLViewBorder::setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light ) 52void LLViewBorder::setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light )
71{ 53{
72 mShadowDark = shadow_dark; 54 mShadowDark = shadow_dark;
@@ -160,15 +142,15 @@ void LLViewBorder::drawOnePixelLines()
160 } 142 }
161 143
162 S32 left = 0; 144 S32 left = 0;
163 S32 top = mRect.getHeight(); 145 S32 top = getRect().getHeight();
164 S32 right = mRect.getWidth(); 146 S32 right = getRect().getWidth();
165 S32 bottom = 0; 147 S32 bottom = 0;
166 148
167 glColor4fv( top_color.mV ); 149 gGL.color4fv( top_color.mV );
168 gl_line_2d(left, bottom, left, top); 150 gl_line_2d(left, bottom, left, top);
169 gl_line_2d(left, top, right, top); 151 gl_line_2d(left, top, right, top);
170 152
171 glColor4fv( bottom_color.mV ); 153 gGL.color4fv( bottom_color.mV );
172 gl_line_2d(right, top, right, bottom); 154 gl_line_2d(right, top, right, bottom);
173 gl_line_2d(left, bottom, right, bottom); 155 gl_line_2d(left, bottom, right, bottom);
174 156
@@ -219,24 +201,24 @@ void LLViewBorder::drawTwoPixelLines()
219 } 201 }
220 202
221 S32 left = 0; 203 S32 left = 0;
222 S32 top = mRect.getHeight(); 204 S32 top = getRect().getHeight();
223 S32 right = mRect.getWidth(); 205 S32 right = getRect().getWidth();
224 S32 bottom = 0; 206 S32 bottom = 0;
225 207
226 // draw borders 208 // draw borders
227 glColor3fv( top_out_color ); 209 gGL.color3fv( top_out_color );
228 gl_line_2d(left, bottom, left, top-1); 210 gl_line_2d(left, bottom, left, top-1);
229 gl_line_2d(left, top-1, right, top-1); 211 gl_line_2d(left, top-1, right, top-1);
230 212
231 glColor3fv( top_in_color ); 213 gGL.color3fv( top_in_color );
232 gl_line_2d(left+1, bottom+1, left+1, top-2); 214 gl_line_2d(left+1, bottom+1, left+1, top-2);
233 gl_line_2d(left+1, top-2, right-1, top-2); 215 gl_line_2d(left+1, top-2, right-1, top-2);
234 216
235 glColor3fv( bottom_out_color ); 217 gGL.color3fv( bottom_out_color );
236 gl_line_2d(right-1, top-1, right-1, bottom); 218 gl_line_2d(right-1, top-1, right-1, bottom);
237 gl_line_2d(left, bottom, right, bottom); 219 gl_line_2d(left, bottom, right, bottom);
238 220
239 glColor3fv( bottom_in_color ); 221 gGL.color3fv( bottom_in_color );
240 gl_line_2d(right-2, top-2, right-2, bottom+1); 222 gl_line_2d(right-2, top-2, right-2, bottom+1);
241 gl_line_2d(left+1, bottom+1, right-1, bottom+1); 223 gl_line_2d(left+1, bottom+1, right-1, bottom+1);
242} 224}
@@ -247,27 +229,27 @@ void LLViewBorder::drawTextures()
247 229
248 llassert( FALSE ); // TODO: finish implementing 230 llassert( FALSE ); // TODO: finish implementing
249 231
250 glColor4fv(UI_VERTEX_COLOR.mV); 232 gGL.color4fv(UI_VERTEX_COLOR.mV);
251 233
252 mTexture->bind(); 234 mTexture->bind();
253 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); 235 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
254 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); 236 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
255 237
256 drawTextureTrapezoid( 0.f, mBorderWidth, mRect.getWidth(), 0, 0 ); 238 drawTextureTrapezoid( 0.f, mBorderWidth, getRect().getWidth(), 0, 0 );
257 drawTextureTrapezoid( 90.f, mBorderWidth, mRect.getHeight(), (F32)mRect.getWidth(),0 ); 239 drawTextureTrapezoid( 90.f, mBorderWidth, getRect().getHeight(), (F32)getRect().getWidth(),0 );
258 drawTextureTrapezoid( 180.f, mBorderWidth, mRect.getWidth(), (F32)mRect.getWidth(),(F32)mRect.getHeight() ); 240 drawTextureTrapezoid( 180.f, mBorderWidth, getRect().getWidth(), (F32)getRect().getWidth(),(F32)getRect().getHeight() );
259 drawTextureTrapezoid( 270.f, mBorderWidth, mRect.getHeight(), 0, (F32)mRect.getHeight() ); 241 drawTextureTrapezoid( 270.f, mBorderWidth, getRect().getHeight(), 0, (F32)getRect().getHeight() );
260} 242}
261 243
262 244
263void LLViewBorder::drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32 start_x, F32 start_y ) 245void LLViewBorder::drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32 start_x, F32 start_y )
264{ 246{
265 glPushMatrix(); 247 gGL.pushMatrix();
266 { 248 {
267 glTranslatef(start_x, start_y, 0.f); 249 gGL.translatef(start_x, start_y, 0.f);
268 glRotatef( degrees, 0, 0, 1 ); 250 glRotatef( degrees, 0, 0, 1 );
269 251
270 glBegin(GL_QUADS); 252 gGL.begin(GL_QUADS);
271 { 253 {
272 // width, width /---------\ length-width, width // 254 // width, width /---------\ length-width, width //
273 // / \ // 255 // / \ //
@@ -275,24 +257,24 @@ void LLViewBorder::drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32
275 // /---------------\ // 257 // /---------------\ //
276 // 0,0 length, 0 // 258 // 0,0 length, 0 //
277 259
278 glTexCoord2f( 0, 0 ); 260 gGL.texCoord2f( 0, 0 );
279 glVertex2i( 0, 0 ); 261 gGL.vertex2i( 0, 0 );
280 262
281 glTexCoord2f( (GLfloat)length, 0 ); 263 gGL.texCoord2f( (GLfloat)length, 0 );
282 glVertex2i( length, 0 ); 264 gGL.vertex2i( length, 0 );
283 265
284 glTexCoord2f( (GLfloat)(length - width), (GLfloat)width ); 266 gGL.texCoord2f( (GLfloat)(length - width), (GLfloat)width );
285 glVertex2i( length - width, width ); 267 gGL.vertex2i( length - width, width );
286 268
287 glTexCoord2f( (GLfloat)width, (GLfloat)width ); 269 gGL.texCoord2f( (GLfloat)width, (GLfloat)width );
288 glVertex2i( width, width ); 270 gGL.vertex2i( width, width );
289 } 271 }
290 glEnd(); 272 gGL.end();
291 } 273 }
292 glPopMatrix(); 274 gGL.popMatrix();
293} 275}
294 276
295bool LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style) 277BOOL LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style)
296{ 278{
297 if (node->hasAttribute("bevel_style")) 279 if (node->hasAttribute("bevel_style"))
298 { 280 {
@@ -316,25 +298,11 @@ bool LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel
316 { 298 {
317 bevel_style = LLViewBorder::BEVEL_BRIGHT; 299 bevel_style = LLViewBorder::BEVEL_BRIGHT;
318 } 300 }
319 return true; 301 return TRUE;
320 } 302 }
321 return false; 303 return FALSE;
322}
323
324void LLViewBorder::setValue(const LLSD& val)
325{
326 setRect(LLRect(val));
327}
328
329EWidgetType LLViewBorder::getWidgetType() const
330{
331 return WIDGET_TYPE_VIEW_BORDER;
332} 304}
333 305
334LLString LLViewBorder::getWidgetTag() const
335{
336 return LL_VIEW_BORDER_TAG;
337}
338 306
339// static 307// static
340LLView* LLViewBorder::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) 308LLView* LLViewBorder::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
diff --git a/linden/indra/llui/llviewborder.h b/linden/indra/llui/llviewborder.h
index d9c2916..4e5dfee 100644
--- a/linden/indra/llui/llviewborder.h
+++ b/linden/indra/llui/llviewborder.h
@@ -1,6 +1,6 @@
1/** 1/**
2 * @file llviewborder.h 2 * @file llviewborder.h
3 * @brief LLViewBorder base class 3 * @brief A customizable decorative border. Does not interact with mouse events.
4 * 4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$ 5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 * 6 *
@@ -29,64 +29,56 @@
29 * $/LicenseInfo$ 29 * $/LicenseInfo$
30 */ 30 */
31 31
32// A customizable decorative border. Does not interact with mouse events.
33
34#ifndef LL_LLVIEWBORDER_H 32#ifndef LL_LLVIEWBORDER_H
35#define LL_LLVIEWBORDER_H 33#define LL_LLVIEWBORDER_H
36 34
37#include "llview.h" 35#include "llview.h"
38#include "v4color.h"
39#include "lluuid.h"
40#include "llimagegl.h"
41#include "llxmlnode.h"
42
43class LLUUID;
44class LLUICtrlFactory;
45 36
46 37
47class LLViewBorder : public LLView 38class LLViewBorder : public LLView
48{ 39{
49public: 40public:
50 enum EBevel { BEVEL_IN, BEVEL_OUT, BEVEL_BRIGHT, BEVEL_NONE }; 41 enum EBevel { BEVEL_IN, BEVEL_OUT, BEVEL_BRIGHT, BEVEL_NONE };
51
52 enum EStyle { STYLE_LINE, STYLE_TEXTURE }; 42 enum EStyle { STYLE_LINE, STYLE_TEXTURE };
53 43
54 LLViewBorder( const LLString& name, const LLRect& rect, EBevel bevel = BEVEL_OUT, EStyle style = STYLE_LINE, S32 width = 1 ); 44 LLViewBorder( const LLString& name, const LLRect& rect, EBevel bevel = BEVEL_OUT, EStyle style = STYLE_LINE, S32 width = 1 );
55 45
56 virtual void setValue(const LLSD& val); 46 virtual void setValue(const LLSD& val) { setRect(LLRect(val)); }
57 virtual EWidgetType getWidgetType() const; 47 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_VIEW_BORDER; }
58 virtual LLString getWidgetTag() const; 48 virtual LLString getWidgetTag() const { return LL_VIEW_BORDER_TAG; }
59 49
60 virtual BOOL isCtrl() const; 50 virtual BOOL isCtrl() const { return FALSE; }
61 51
62 // llview functionality 52 // llview functionality
63 virtual void draw(); 53 virtual void draw();
64 54
65 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 55 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory);
66 static bool getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style); 56 static BOOL getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style);
67 57
68 void setBorderWidth(S32 width) { mBorderWidth = width; } 58 void setBorderWidth(S32 width) { mBorderWidth = width; }
59 S32 getBorderWidth() const { return mBorderWidth; }
69 void setBevel(EBevel bevel) { mBevel = bevel; } 60 void setBevel(EBevel bevel) { mBevel = bevel; }
61 EBevel getBevel() const { return mBevel; }
70 void setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light ); 62 void setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light );
71 void setColorsExtended( const LLColor4& shadow_light, const LLColor4& shadow_dark, 63 void setColorsExtended( const LLColor4& shadow_light, const LLColor4& shadow_dark,
72 const LLColor4& highlight_light, const LLColor4& highlight_dark ); 64 const LLColor4& highlight_light, const LLColor4& highlight_dark );
73 void setTexture( const LLUUID &image_id ); 65 void setTexture( const class LLUUID &image_id );
66
67 LLColor4 getHighlightLight() {return mHighlightLight;}
68 LLColor4 getShadowDark() {return mHighlightDark;}
74 69
75 EBevel getBevel() const { return mBevel; }
76 EStyle getStyle() const { return mStyle; } 70 EStyle getStyle() const { return mStyle; }
77 S32 getBorderWidth() const { return mBorderWidth; }
78 71
79 void setKeyboardFocusHighlight( BOOL b ) { mHasKeyboardFocus = b; } 72 void setKeyboardFocusHighlight( BOOL b ) { mHasKeyboardFocus = b; }
80 73
81protected: 74private:
82 void drawOnePixelLines(); 75 void drawOnePixelLines();
83 void drawTwoPixelLines(); 76 void drawTwoPixelLines();
84 void drawTextures(); 77 void drawTextures();
85 void drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32 start_x, F32 start_y ); 78 void drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32 start_x, F32 start_y );
86 79
87protected:
88 EBevel mBevel; 80 EBevel mBevel;
89 EStyle mStyle; 81 const EStyle mStyle;
90 LLColor4 mHighlightLight; 82 LLColor4 mHighlightLight;
91 LLColor4 mHighlightDark; 83 LLColor4 mHighlightDark;
92 LLColor4 mShadowLight; 84 LLColor4 mShadowLight;
diff --git a/linden/indra/llui/llviewquery.cpp b/linden/indra/llui/llviewquery.cpp
index 40c2d61..5c58ad6 100644
--- a/linden/indra/llui/llviewquery.cpp
+++ b/linden/indra/llui/llviewquery.cpp
@@ -71,22 +71,9 @@ filterResult_t LLWidgetTypeFilter::operator() (const LLView* const view, const v
71 return filterResult_t(view->getWidgetType() == mType, TRUE); 71 return filterResult_t(view->getWidgetType() == mType, TRUE);
72} 72}
73 73
74//
74// LLViewQuery 75// LLViewQuery
75 76//
76LLViewQuery::LLViewQuery(): mPreFilters(), mPostFilters(), mSorterp()
77{
78}
79
80void LLViewQuery::addPreFilter(const LLQueryFilter* prefilter) { mPreFilters.push_back(prefilter); }
81
82void LLViewQuery::addPostFilter(const LLQueryFilter* postfilter) { mPostFilters.push_back(postfilter); }
83
84const LLViewQuery::filterList_t & LLViewQuery::getPreFilters() const { return mPreFilters; }
85
86const LLViewQuery::filterList_t & LLViewQuery::getPostFilters() const { return mPostFilters; }
87
88void LLViewQuery::setSorter(const LLQuerySorter* sorterp) { mSorterp = sorterp; }
89const LLQuerySorter* LLViewQuery::getSorter() const { return mSorterp; }
90 77
91viewList_t LLViewQuery::run(LLView* view) const 78viewList_t LLViewQuery::run(LLView* view) const
92{ 79{
diff --git a/linden/indra/llui/llviewquery.h b/linden/indra/llui/llviewquery.h
index 2e2b50d..7e947cd 100644
--- a/linden/indra/llui/llviewquery.h
+++ b/linden/indra/llui/llviewquery.h
@@ -42,12 +42,12 @@ class LLView;
42typedef std::list<LLView *> viewList_t; 42typedef std::list<LLView *> viewList_t;
43typedef std::pair<BOOL, BOOL> filterResult_t; 43typedef std::pair<BOOL, BOOL> filterResult_t;
44 44
45// Abstract base class for all filters. 45// Abstract base class for all query filters.
46class LLQueryFilter 46class LLQueryFilter
47{ 47{
48public: 48public:
49 virtual ~LLQueryFilter() {}; 49 virtual ~LLQueryFilter() {};
50 virtual filterResult_t operator() (const LLView* const view, const viewList_t & children) const =0; 50 virtual filterResult_t operator() (const LLView* const view, const viewList_t & children) const = 0;
51}; 51};
52 52
53class LLQuerySorter 53class LLQuerySorter
@@ -105,25 +105,28 @@ public:
105 typedef filterList_t::iterator filterList_iter_t; 105 typedef filterList_t::iterator filterList_iter_t;
106 typedef filterList_t::const_iterator filterList_const_iter_t; 106 typedef filterList_t::const_iterator filterList_const_iter_t;
107 107
108 LLViewQuery(); 108 LLViewQuery() : mPreFilters(), mPostFilters(), mSorterp() {}
109 virtual ~LLViewQuery() {} 109 virtual ~LLViewQuery() {}
110 110
111 void addPreFilter(const LLQueryFilter* prefilter); 111 void addPreFilter(const LLQueryFilter* prefilter) { mPreFilters.push_back(prefilter); }
112 void addPostFilter(const LLQueryFilter* postfilter); 112 void addPostFilter(const LLQueryFilter* postfilter) { mPostFilters.push_back(postfilter); }
113 const filterList_t & getPreFilters() const; 113 const filterList_t & getPreFilters() const { return mPreFilters; }
114 const filterList_t & getPostFilters() const; 114 const filterList_t & getPostFilters() const { return mPostFilters; }
115 115
116 void setSorter(const LLQuerySorter* sorter); 116 void setSorter(const LLQuerySorter* sorter) { mSorterp = sorter; }
117 const LLQuerySorter* getSorter() const; 117 const LLQuerySorter* getSorter() const { return mSorterp; }
118 118
119 viewList_t run(LLView * view) const; 119 viewList_t run(LLView * view) const;
120 // syntactic sugar 120 // syntactic sugar
121 viewList_t operator () (LLView * view) const { return run(view); } 121 viewList_t operator () (LLView * view) const { return run(view); }
122protected: 122
123 // override this method to provide iteration over other types of children 123 // override this method to provide iteration over other types of children
124 virtual void filterChildren(LLView * view, viewList_t & filtered_children) const; 124 virtual void filterChildren(LLView * view, viewList_t & filtered_children) const;
125
126private:
127
125 filterResult_t runFilters(LLView * view, const viewList_t children, const filterList_t filters) const; 128 filterResult_t runFilters(LLView * view, const viewList_t children, const filterList_t filters) const;
126protected: 129
127 filterList_t mPreFilters; 130 filterList_t mPreFilters;
128 filterList_t mPostFilters; 131 filterList_t mPostFilters;
129 const LLQuerySorter* mSorterp; 132 const LLQuerySorter* mSorterp;
@@ -135,4 +138,4 @@ public:
135 LLCtrlQuery(); 138 LLCtrlQuery();
136}; 139};
137 140
138#endif 141#endif // LL_LLVIEWQUERY_H