summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorSamuel Kolb <skolb@lindenlab.com>2009-11-30 09:11:04 -0800
committerSamuel Kolb <skolb@lindenlab.com>2009-11-30 09:11:04 -0800
commite2699c64a20262f6fbe6c1432294e8428e8cda5d (patch)
tree5b14a249342021b220df723a91c3e78d2c91f06e /indra/llui
parent6824800fa0001cd4a23a4f98b099af34435b0e06 (diff)
parentd4e01315e3f39dd14bb2c14f09e4e94749542b06 (diff)
merge viewer-2-0 into media
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/CMakeLists.txt3
-rw-r--r--indra/llui/llbutton.cpp4
-rw-r--r--indra/llui/llflatlistview.cpp23
-rw-r--r--indra/llui/llfloater.cpp127
-rw-r--r--indra/llui/llfloater.h61
-rw-r--r--indra/llui/lllineeditor.cpp51
-rw-r--r--indra/llui/lllineeditor.h4
-rw-r--r--indra/llui/llnotificationptr.h41
-rw-r--r--indra/llui/llnotifications.cpp14
-rw-r--r--indra/llui/llnotifications.h11
-rw-r--r--indra/llui/llnotificationsutil.cpp91
-rw-r--r--indra/llui/llnotificationsutil.h68
-rw-r--r--indra/llui/llresizebar.cpp5
-rw-r--r--indra/llui/llscrollcontainer.cpp6
14 files changed, 387 insertions, 122 deletions
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt
index f0b4436df5..74b49b846e 100644
--- a/indra/llui/CMakeLists.txt
+++ b/indra/llui/CMakeLists.txt
@@ -60,6 +60,7 @@ set(llui_SOURCE_FILES
llmultisliderctrl.cpp
llnotifications.cpp
llnotificationslistener.cpp
+ llnotificationsutil.cpp
llpanel.cpp
llprogressbar.cpp
llradiogroup.cpp
@@ -147,8 +148,10 @@ set(llui_HEADER_FILES
llmultifloater.h
llmultisliderctrl.h
llmultislider.h
+ llnotificationptr.h
llnotifications.h
llnotificationslistener.h
+ llnotificationsutil.h
llpanel.h
llprogressbar.h
llradiogroup.h
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 8930e32055..b91c614424 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -48,7 +48,7 @@
#include "llfloaterreg.h"
#include "llfocusmgr.h"
#include "llwindow.h"
-#include "llnotifications.h"
+#include "llnotificationsutil.h"
#include "llrender.h"
#include "lluictrlfactory.h"
#include "llhelp.h"
@@ -1106,7 +1106,7 @@ void LLButton::showHelp(LLUICtrl* ctrl, const LLSD& sdname)
// display an error if we can't find a help_topic string.
// fix this by adding a help_topic attribute to the xui file
- LLNotifications::instance().add("UnableToFindHelpTopic");
+ LLNotificationsUtil::add("UnableToFindHelpTopic");
}
void LLButton::resetMouseDownTimer()
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index 8de3a8a96f..ddfb0f8534 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -484,6 +484,8 @@ void LLFlatListView::rearrangeItems()
void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask)
{
if (!item_pair) return;
+
+ setFocus(TRUE);
bool select_item = !isSelected(item_pair);
@@ -554,12 +556,21 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
break;
}
- if ( key == KEY_UP || key == KEY_DOWN )
+ if ( ( key == KEY_UP || key == KEY_DOWN ) && mSelectedItemPairs.size() )
{
- LLRect selcted_rect = getLastSelectedItemRect().stretch(1);
- LLRect visible_rect = getVisibleContentRect();
- if ( !visible_rect.contains (selcted_rect) )
- scrollToShowRect(selcted_rect);
+ LLRect visible_rc = getVisibleContentRect();
+ LLRect selected_rc = getLastSelectedItemRect();
+
+ if ( !visible_rc.contains (selected_rc) )
+ {
+ // But scroll in Items panel coordinates
+ scrollToShowRect(selected_rc);
+ }
+
+ // In case we are in accordion tab notify parent to show selected rectangle
+ LLRect screen_rc;
+ localRectToScreen(selected_rc, &screen_rc);
+ notifyParent(LLSD().insert("scrollToShowRect",screen_rc.getValue()));
handled = TRUE;
}
@@ -645,8 +656,6 @@ bool LLFlatListView::selectItemPair(item_pair_t* item_pair, bool select)
onCommit();
}
- setFocus(TRUE);
-
// Stretch selected items rect to ensure it won't be clipped
mSelectedItemsBorder->setRect(getSelectedItemsRect().stretch(-1));
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 262afbe661..8cf65fe76a 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -66,27 +66,6 @@
// use this to control "jumping" behavior when Ctrl-Tabbing
const S32 TABBED_FLOATER_OFFSET = 0;
-std::string LLFloater::sButtonActiveImageNames[BUTTON_COUNT] =
-{
- "Icon_Close_Foreground", //BUTTON_CLOSE
- "Icon_Restore_Foreground", //BUTTON_RESTORE
- "Icon_Minimize_Foreground", //BUTTON_MINIMIZE
- "tearoffbox.tga", //BUTTON_TEAR_OFF
- "Icon_Dock_Foreground", //BUTTON_DOCK
- "Icon_Undock_Foreground", //BUTTON_UNDOCK
- "Icon_Help_Foreground" //BUTTON_HELP
-};
-
-std::string LLFloater::sButtonPressedImageNames[BUTTON_COUNT] =
-{
- "Icon_Close_Press", //BUTTON_CLOSE
- "Icon_Restore_Press", //BUTTON_RESTORE
- "Icon_Minimize_Press", //BUTTON_MINIMIZE
- "tearoff_pressed.tga", //BUTTON_TEAR_OFF
- "Icon_Dock_Press", //BUTTON_DOCK
- "Icon_Undock_Press", //BUTTON_UNDOCK
- "Icon_Help_Press" //BUTTON_HELP
-};
std::string LLFloater::sButtonNames[BUTTON_COUNT] =
{
@@ -195,6 +174,20 @@ LLFloater::Params::Params()
can_dock("can_dock", false),
header_height("header_height", 0),
legacy_header_height("legacy_header_height", 0),
+ close_image("close_image"),
+ restore_image("restore_image"),
+ minimize_image("minimize_image"),
+ tear_off_image("tear_off_image"),
+ dock_image("dock_image"),
+ undock_image("undock_image"),
+ help_image("help_image"),
+ close_pressed_image("close_pressed_image"),
+ restore_pressed_image("restore_pressed_image"),
+ minimize_pressed_image("minimize_pressed_image"),
+ tear_off_pressed_image("tear_off_pressed_image"),
+ dock_pressed_image("dock_pressed_image"),
+ undock_pressed_image("undock_pressed_image"),
+ help_pressed_image("help_pressed_image"),
open_callback("open_callback"),
close_callback("close_callback")
{
@@ -247,11 +240,11 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
mDocked(false),
mHasBeenDraggedWhileMinimized(FALSE),
mPreviousMinimizedBottom(0),
- mPreviousMinimizedLeft(0),
- mNotificationContext(NULL)
+ mPreviousMinimizedLeft(0)
+// mNotificationContext(NULL)
{
mHandle.bind(this);
- mNotificationContext = new LLFloaterNotificationContext(getHandle());
+// mNotificationContext = new LLFloaterNotificationContext(getHandle());
// Clicks stop here.
setMouseOpaque(TRUE);
@@ -263,11 +256,9 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
// prior rectangle to be used on restore.
mExpandedRect.set(0,0,0,0);
- for (S32 i = 0; i < BUTTON_COUNT; i++)
- {
- mButtonsEnabled[i] = FALSE;
- mButtons[i] = NULL;
- }
+ memset(mButtonsEnabled, 0, BUTTON_COUNT * sizeof(bool));
+ memset(mButtons, 0, BUTTON_COUNT * sizeof(LLButton*));
+
addDragHandle();
addResizeCtrls();
@@ -276,11 +267,11 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
// chrome floaters don't take focus at all
setFocusRoot(!getIsChrome());
- initFloater();
+ initFloater(p);
}
// Note: Floaters constructed from XML call init() twice!
-void LLFloater::initFloater()
+void LLFloater::initFloater(const Params& p)
{
// Close button.
if (mCanClose)
@@ -305,7 +296,7 @@ void LLFloater::initFloater()
mButtonsEnabled[BUTTON_DOCK] = TRUE;
}
- buildButtons();
+ buildButtons(p);
// Floaters are created in the invisible state
setVisible(FALSE);
@@ -468,8 +459,8 @@ LLFloater::~LLFloater()
{
LLFloaterReg::removeInstance(mInstanceName, mKey);
- delete mNotificationContext;
- mNotificationContext = NULL;
+// delete mNotificationContext;
+// mNotificationContext = NULL;
//// am I not hosted by another floater?
//if (mHostHandle.isDead())
@@ -1280,7 +1271,7 @@ void LLFloater::removeDependentFloater(LLFloater* floaterp)
floaterp->mDependeeHandle = LLHandle<LLFloater>();
}
-BOOL LLFloater::offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButtons index)
+BOOL LLFloater::offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index)
{
if( mButtonsEnabled[index] )
{
@@ -1798,7 +1789,7 @@ void LLFloater::updateButtons()
mDragHandle->setMaxTitleWidth(getRect().getWidth() - (button_count * (floater_close_box_size + 1)));
}
-void LLFloater::buildButtons()
+void LLFloater::buildButtons(const Params& floater_params)
{
static LLUICachedControl<S32> floater_close_box_size ("UIFloaterCloseBoxSize", 0);
static LLUICachedControl<S32> close_box_from_top ("UICloseBoxFromTop", 0);
@@ -1832,17 +1823,18 @@ void LLFloater::buildButtons()
LLButton::Params p;
p.name(sButtonNames[i]);
p.rect(btn_rect);
- p.image_unselected.name(sButtonActiveImageNames[i]);
+ p.image_unselected = getButtonImage(floater_params, (EFloaterButton)i);
// Selected, no matter if hovered or not, is "pressed"
- p.image_selected.name(sButtonPressedImageNames[i]);
- p.image_hover_selected.name(sButtonPressedImageNames[i]);
+ LLUIImage* pressed_image = getButtonPressedImage(floater_params, (EFloaterButton)i);
+ p.image_selected = pressed_image;
+ p.image_hover_selected = pressed_image;
// Use a glow effect when the user hovers over the button
// These icons are really small, need glow amount increased
p.hover_glow_amount( 0.33f );
p.click_callback.function(boost::bind(sButtonCallbacks[i], this));
p.tab_stop(false);
p.follows.flags(FOLLOWS_TOP|FOLLOWS_RIGHT);
- p.tool_tip(sButtonToolTips[i]);
+ p.tool_tip = getButtonTooltip(floater_params, (EFloaterButton)i);
p.scale_image(true);
p.chrome(true);
@@ -1854,6 +1846,59 @@ void LLFloater::buildButtons()
updateButtons();
}
+// static
+LLUIImage* LLFloater::getButtonImage(const Params& p, EFloaterButton e)
+{
+ switch(e)
+ {
+ default:
+ case BUTTON_CLOSE:
+ return p.close_image;
+ case BUTTON_RESTORE:
+ return p.restore_image;
+ case BUTTON_MINIMIZE:
+ return p.minimize_image;
+ case BUTTON_TEAR_OFF:
+ return p.tear_off_image;
+ case BUTTON_DOCK:
+ return p.dock_image;
+ case BUTTON_UNDOCK:
+ return p.undock_image;
+ case BUTTON_HELP:
+ return p.help_image;
+ }
+}
+
+// static
+LLUIImage* LLFloater::getButtonPressedImage(const Params& p, EFloaterButton e)
+{
+ switch(e)
+ {
+ default:
+ case BUTTON_CLOSE:
+ return p.close_pressed_image;
+ case BUTTON_RESTORE:
+ return p.restore_pressed_image;
+ case BUTTON_MINIMIZE:
+ return p.minimize_pressed_image;
+ case BUTTON_TEAR_OFF:
+ return p.tear_off_pressed_image;
+ case BUTTON_DOCK:
+ return p.dock_pressed_image;
+ case BUTTON_UNDOCK:
+ return p.undock_pressed_image;
+ case BUTTON_HELP:
+ return p.help_pressed_image;
+ }
+}
+
+// static
+std::string LLFloater::getButtonTooltip(const Params& p, EFloaterButton e)
+{
+ // TODO: per-floater localizable tooltips set in XML
+ return sButtonToolTips[e];
+}
+
/////////////////////////////////////////////////////
// LLFloaterView
@@ -2672,7 +2717,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr o
setupParams(params, parent);
initFromParams(params);
- initFloater();
+ initFloater(params);
LLMultiFloater* last_host = LLFloater::getFloaterHost();
if (node->hasName("multi_floater"))
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 1b98dddddc..d7ec0aac00 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -39,7 +39,7 @@
#include "llpanel.h"
#include "lluuid.h"
-#include "llnotifications.h"
+//#include "llnotificationsutil.h"
#include <set>
class LLDragHandle;
@@ -65,20 +65,6 @@ const BOOL CLOSE_NO = FALSE;
const BOOL ADJUST_VERTICAL_YES = TRUE;
const BOOL ADJUST_VERTICAL_NO = FALSE;
-// associates a given notification instance with a particular floater
-class LLFloaterNotificationContext :
- public LLNotificationContext
-{
-public:
- LLFloaterNotificationContext(LLHandle<LLFloater> floater_handle) :
- mFloaterHandle(floater_handle)
- {}
-
- LLFloater* getFloater() { return mFloaterHandle.get(); }
-private:
- LLHandle<LLFloater> mFloaterHandle;
-};
-
class LLFloater : public LLPanel
{
friend class LLFloaterView;
@@ -97,7 +83,7 @@ public:
|*==========================================================================*/
};
- enum EFloaterButtons
+ enum EFloaterButton
{
BUTTON_CLOSE = 0,
BUTTON_RESTORE,
@@ -128,6 +114,22 @@ public:
can_dock;
Optional<S32> header_height,
legacy_header_height; // HACK see initFromXML()
+
+ // Images for top-right controls
+ Optional<LLUIImage*> close_image,
+ restore_image,
+ minimize_image,
+ tear_off_image,
+ dock_image,
+ undock_image,
+ help_image;
+ Optional<LLUIImage*> close_pressed_image,
+ restore_pressed_image,
+ minimize_pressed_image,
+ tear_off_pressed_image,
+ dock_pressed_image,
+ undock_pressed_image,
+ help_pressed_image;
Optional<CommitCallbackParam> open_callback,
close_callback;
@@ -158,7 +160,7 @@ public:
/*virtual*/ void setIsChrome(BOOL is_chrome);
/*virtual*/ void setRect(const LLRect &rect);
- void initFloater();
+ void initFloater(const Params& p);
void openFloater(const LLSD& key = LLSD());
@@ -264,10 +266,10 @@ public:
// handle refocusing.
static void closeFocusedFloater();
- LLNotification::Params contextualNotification(const std::string& name)
- {
- return LLNotification::Params(name).context(mNotificationContext);
- }
+// LLNotification::Params contextualNotification(const std::string& name)
+// {
+// return LLNotification::Params(name).context(mNotificationContext);
+// }
static void onClickClose(LLFloater* floater);
static void onClickMinimize(LLFloater* floater);
@@ -309,8 +311,15 @@ private:
void cleanupHandles(); // remove handles to dead floaters
void createMinimizeButton();
void updateButtons();
- void buildButtons();
- BOOL offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButtons index);
+ void buildButtons(const Params& p);
+
+ // Images and tooltips are named in the XML, but we want to look them
+ // up by index.
+ static LLUIImage* getButtonImage(const Params& p, EFloaterButton e);
+ static LLUIImage* getButtonPressedImage(const Params& p, EFloaterButton e);
+ static std::string getButtonTooltip(const Params& p, EFloaterButton e);
+
+ BOOL offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index);
void addResizeCtrls();
void layoutResizeCtrls();
void enableResizeCtrls(bool enable);
@@ -368,7 +377,7 @@ private:
typedef std::set<LLHandle<LLFloater> >::iterator handle_set_iter_t;
handle_set_t mDependents;
- BOOL mButtonsEnabled[BUTTON_COUNT];
+ bool mButtonsEnabled[BUTTON_COUNT];
LLButton* mButtons[BUTTON_COUNT];
F32 mButtonScale;
BOOL mAutoFocus;
@@ -382,8 +391,6 @@ private:
static LLMultiFloater* sHostp;
static BOOL sQuitting;
- static std::string sButtonActiveImageNames[BUTTON_COUNT];
- static std::string sButtonPressedImageNames[BUTTON_COUNT];
static std::string sButtonNames[BUTTON_COUNT];
static std::string sButtonToolTips[BUTTON_COUNT];
static std::string sButtonToolTipsIndex[BUTTON_COUNT];
@@ -401,7 +408,7 @@ private:
S32 mPreviousMinimizedBottom;
S32 mPreviousMinimizedLeft;
- LLFloaterNotificationContext* mNotificationContext;
+// LLFloaterNotificationContext* mNotificationContext;
LLRootHandle<LLFloater> mHandle;
};
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index bd5734312a..4ea30dbd4d 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -125,8 +125,8 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
mScrollHPos( 0 ),
mTextPadLeft(p.text_pad_left),
mTextPadRight(p.text_pad_right),
- mMinHPixels(0), // computed in updateTextPadding() below
- mMaxHPixels(0), // computed in updateTextPadding() below
+ mTextLeftEdge(0), // computed in updateTextPadding() below
+ mTextRightEdge(0), // computed in updateTextPadding() below
mCommitOnFocusLost( p.commit_on_focus_lost ),
mRevertOnEsc( p.revert_on_esc ),
mKeystrokeCallback( p.keystroke_callback() ),
@@ -338,9 +338,8 @@ void LLLineEditor::setTextPadding(S32 left, S32 right)
void LLLineEditor::updateTextPadding()
{
- static LLUICachedControl<S32> line_editor_hpad ("UILineEditorHPad", 0);
- mMinHPixels = line_editor_hpad + llclamp(mTextPadLeft, 0, getRect().getWidth());;
- mMaxHPixels = getRect().getWidth() - mMinHPixels - llclamp(mTextPadRight, 0, getRect().getWidth());
+ mTextLeftEdge = llclamp(mTextPadLeft, 0, getRect().getWidth());
+ mTextRightEdge = getRect().getWidth() - llclamp(mTextPadRight, 0, getRect().getWidth());
}
@@ -406,8 +405,8 @@ void LLLineEditor::setCursorAtLocalPos( S32 local_mouse_x )
mScrollHPos +
mGLFont->charFromPixelOffset(
wtext, mScrollHPos,
- (F32)(local_mouse_x - mMinHPixels),
- (F32)(mMaxHPixels - mMinHPixels + 1)); // min-max range is inclusive
+ (F32)(local_mouse_x - mTextLeftEdge),
+ (F32)(mTextRightEdge - mTextLeftEdge + 1)); // min-max range is inclusive
setCursor(cursor_pos);
}
@@ -417,11 +416,11 @@ void LLLineEditor::setCursor( S32 pos )
mCursorPos = llclamp( pos, 0, mText.length());
S32 pixels_after_scroll = findPixelNearestPos();
- if( pixels_after_scroll > mMaxHPixels )
+ if( pixels_after_scroll > mTextRightEdge )
{
S32 width_chars_to_left = mGLFont->getWidth(mText.getWString().c_str(), 0, mScrollHPos);
- S32 last_visible_char = mGLFont->maxDrawableChars(mText.getWString().c_str(), llmax(0.f, (F32)(mMaxHPixels - mMinHPixels + width_chars_to_left)));
- S32 min_scroll = mGLFont->firstDrawableChar(mText.getWString().c_str(), (F32)(mMaxHPixels - mMinHPixels), mText.length(), getCursor());
+ S32 last_visible_char = mGLFont->maxDrawableChars(mText.getWString().c_str(), llmax(0.f, (F32)(mTextRightEdge - mTextLeftEdge + width_chars_to_left)));
+ S32 min_scroll = mGLFont->firstDrawableChar(mText.getWString().c_str(), (F32)(mTextRightEdge - mTextLeftEdge), mText.length(), getCursor());
if (old_cursor_pos == last_visible_char)
{
mScrollHPos = llmin(mText.length(), llmax(min_scroll, mScrollHPos + SCROLL_INCREMENT_ADD));
@@ -682,17 +681,17 @@ BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask)
S32 increment = llround(mScrollTimer.getElapsedTimeF32() / AUTO_SCROLL_TIME);
mScrollTimer.reset();
mScrollTimer.setTimerExpirySec(AUTO_SCROLL_TIME);
- if( (x < mMinHPixels) && (mScrollHPos > 0 ) )
+ if( (x < mTextLeftEdge) && (mScrollHPos > 0 ) )
{
// Scroll to the left
mScrollHPos = llclamp(mScrollHPos - increment, 0, mText.length());
}
else
- if( (x > mMaxHPixels) && (mCursorPos < (S32)mText.length()) )
+ if( (x > mTextRightEdge) && (mCursorPos < (S32)mText.length()) )
{
// If scrolling one pixel would make a difference...
S32 pixels_after_scrolling_one_char = findPixelNearestPos(1);
- if( pixels_after_scrolling_one_char >= mMaxHPixels )
+ if( pixels_after_scrolling_one_char >= mTextRightEdge )
{
// ...scroll to the right
mScrollHPos = llclamp(mScrollHPos + increment, 0, mText.length());
@@ -1671,7 +1670,7 @@ void LLLineEditor::draw()
}
S32 rendered_text = 0;
- F32 rendered_pixels_right = (F32)mMinHPixels;
+ F32 rendered_pixels_right = (F32)mTextLeftEdge;
F32 text_bottom = (F32)background.mBottom + (F32)lineeditor_v_pad;
if( (gFocusMgr.getKeyboardFocus() == this) && hasSelection() )
@@ -1700,17 +1699,17 @@ void LLLineEditor::draw()
0,
LLFontGL::NO_SHADOW,
select_left - mScrollHPos,
- mMaxHPixels - llround(rendered_pixels_right),
+ mTextRightEdge - llround(rendered_pixels_right),
&rendered_pixels_right);
}
- if( (rendered_pixels_right < (F32)mMaxHPixels) && (rendered_text < text_len) )
+ if( (rendered_pixels_right < (F32)mTextRightEdge) && (rendered_text < text_len) )
{
LLColor4 color = mHighlightColor;
color.setAlpha(alpha);
// selected middle
S32 width = mGLFont->getWidth(mText.getWString().c_str(), mScrollHPos + rendered_text, select_right - mScrollHPos - rendered_text);
- width = llmin(width, mMaxHPixels - llround(rendered_pixels_right));
+ width = llmin(width, mTextRightEdge - llround(rendered_pixels_right));
gl_rect_2d(llround(rendered_pixels_right), cursor_top, llround(rendered_pixels_right)+width, cursor_bottom, color);
LLColor4 tmp_color( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], alpha );
@@ -1722,11 +1721,11 @@ void LLLineEditor::draw()
0,
LLFontGL::NO_SHADOW,
select_right - mScrollHPos - rendered_text,
- mMaxHPixels - llround(rendered_pixels_right),
+ mTextRightEdge - llround(rendered_pixels_right),
&rendered_pixels_right);
}
- if( (rendered_pixels_right < (F32)mMaxHPixels) && (rendered_text < text_len) )
+ if( (rendered_pixels_right < (F32)mTextRightEdge) && (rendered_text < text_len) )
{
// unselected, right side
mGLFont->render(
@@ -1737,7 +1736,7 @@ void LLLineEditor::draw()
0,
LLFontGL::NO_SHADOW,
S32_MAX,
- mMaxHPixels - llround(rendered_pixels_right),
+ mTextRightEdge - llround(rendered_pixels_right),
&rendered_pixels_right);
}
}
@@ -1751,7 +1750,7 @@ void LLLineEditor::draw()
0,
LLFontGL::NO_SHADOW,
S32_MAX,
- mMaxHPixels - llround(rendered_pixels_right),
+ mTextRightEdge - llround(rendered_pixels_right),
&rendered_pixels_right);
}
#if 1 // for when we're ready for image art.
@@ -1809,14 +1808,14 @@ void LLLineEditor::draw()
if (0 == mText.length() && mReadOnly)
{
mGLFont->render(mLabel.getWString(), 0,
- mMinHPixels, (F32)text_bottom,
+ mTextLeftEdge, (F32)text_bottom,
label_color,
LLFontGL::LEFT,
LLFontGL::BOTTOM,
0,
LLFontGL::NO_SHADOW,
S32_MAX,
- mMaxHPixels - llround(rendered_pixels_right),
+ mTextRightEdge - llround(rendered_pixels_right),
&rendered_pixels_right, FALSE);
}
@@ -1834,14 +1833,14 @@ void LLLineEditor::draw()
if (0 == mText.length())
{
mGLFont->render(mLabel.getWString(), 0,
- mMinHPixels, (F32)text_bottom,
+ mTextLeftEdge, (F32)text_bottom,
label_color,
LLFontGL::LEFT,
LLFontGL::BOTTOM,
0,
LLFontGL::NO_SHADOW,
S32_MAX,
- mMaxHPixels - llround(rendered_pixels_right),
+ mTextRightEdge - llround(rendered_pixels_right),
&rendered_pixels_right, FALSE);
}
// Draw children (border)
@@ -1859,7 +1858,7 @@ void LLLineEditor::draw()
S32 LLLineEditor::findPixelNearestPos(const S32 cursor_offset) const
{
S32 dpos = getCursor() - mScrollHPos + cursor_offset;
- S32 result = mGLFont->getWidth(mText.getWString().c_str(), mScrollHPos, dpos) + mMinHPixels;
+ S32 result = mGLFont->getWidth(mText.getWString().c_str(), mScrollHPos, dpos) + mTextLeftEdge;
return result;
}
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index 4c4b00094d..b96220e020 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -303,8 +303,8 @@ protected:
LLFrameTimer mScrollTimer;
S32 mTextPadLeft; // Used to reserve space before the beginning of the text for children.
S32 mTextPadRight; // Used to reserve space after the end of the text for children.
- S32 mMinHPixels;
- S32 mMaxHPixels;
+ S32 mTextLeftEdge; // Pixels, cached left edge of text based on left padding and width
+ S32 mTextRightEdge; // Pixels, cached right edge of text based on right padding and width
BOOL mCommitOnFocusLost;
BOOL mRevertOnEsc;
diff --git a/indra/llui/llnotificationptr.h b/indra/llui/llnotificationptr.h
new file mode 100644
index 0000000000..0718f7d182
--- /dev/null
+++ b/indra/llui/llnotificationptr.h
@@ -0,0 +1,41 @@
+/**
+ * @file llnotificationptr.h
+ *
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ *
+ * Copyright (c) 2008-2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+#ifndef LLNOTIFICATIONPTR_H
+#define LLNOTIFICATIONPTR_H
+
+// Many classes just store a single LLNotificationPtr
+// and llnotifications.h is very large, so define this ligher header.
+#include <boost/shared_ptr.hpp>
+
+class LLNotification;
+typedef boost::shared_ptr<LLNotification> LLNotificationPtr;
+
+#endif
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index eb8cc3e2c5..05f2d3a9cf 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -1395,10 +1395,9 @@ void LLNotifications::addFromCallback(const LLSD& name)
add(LLNotification::Params().name(name.asString()));
}
-// we provide a couple of simple add notification functions so that it's reasonable to create notifications in one line
LLNotificationPtr LLNotifications::add(const std::string& name,
- const LLSD& substitutions,
- const LLSD& payload)
+ const LLSD& substitutions,
+ const LLSD& payload)
{
LLNotification::Params::Functor functor_p;
functor_p.name = name;
@@ -1406,15 +1405,16 @@ LLNotificationPtr LLNotifications::add(const std::string& name,
}
LLNotificationPtr LLNotifications::add(const std::string& name,
- const LLSD& substitutions,
- const LLSD& payload,
- const std::string& functor_name)
+ const LLSD& substitutions,
+ const LLSD& payload,
+ const std::string& functor_name)
{
LLNotification::Params::Functor functor_p;
functor_p.name = functor_name;
return add(LLNotification::Params().name(name).substitutions(substitutions).payload(payload).functor(functor_p));
}
-
+
+//virtual
LLNotificationPtr LLNotifications::add(const std::string& name,
const LLSD& substitutions,
const LLSD& payload,
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index 0d7cb74f70..aeb4cebf1b 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -103,9 +103,7 @@
#include "llpointer.h"
#include "llinitparam.h"
#include "llnotificationslistener.h"
-
-class LLNotification;
-typedef boost::shared_ptr<LLNotification> LLNotificationPtr;
+#include "llnotificationptr.h"
typedef enum e_notification_priority
@@ -841,10 +839,11 @@ public:
// Add a simple notification (from XUI)
void addFromCallback(const LLSD& name);
- // we provide a collection of simple add notification functions so that it's reasonable to create notifications in one line
+ // *NOTE: To add simple notifications, #include "llnotificationsutil.h"
+ // and use LLNotificationsUtil::add("MyNote") or add("MyNote", args)
LLNotificationPtr add(const std::string& name,
- const LLSD& substitutions = LLSD(),
- const LLSD& payload = LLSD());
+ const LLSD& substitutions,
+ const LLSD& payload);
LLNotificationPtr add(const std::string& name,
const LLSD& substitutions,
const LLSD& payload,
diff --git a/indra/llui/llnotificationsutil.cpp b/indra/llui/llnotificationsutil.cpp
new file mode 100644
index 0000000000..2cd165f1b3
--- /dev/null
+++ b/indra/llui/llnotificationsutil.cpp
@@ -0,0 +1,91 @@
+/**
+ * @file llnotificationsutil.cpp
+ *
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ *
+ * Copyright (c) 2008-2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+#include "linden_common.h"
+
+#include "llnotificationsutil.h"
+
+#include "llnotifications.h"
+#include "llsd.h"
+#include "llxmlnode.h" // apparently needed to call LLNotifications::instance()
+
+LLNotificationPtr LLNotificationsUtil::add(const std::string& name)
+{
+ LLNotification::Params::Functor functor_p;
+ functor_p.name = name;
+ return LLNotifications::instance().add(
+ LLNotification::Params().name(name).substitutions(LLSD()).payload(LLSD()).functor(functor_p));
+}
+
+LLNotificationPtr LLNotificationsUtil::add(const std::string& name,
+ const LLSD& substitutions)
+{
+ LLNotification::Params::Functor functor_p;
+ functor_p.name = name;
+ return LLNotifications::instance().add(
+ LLNotification::Params().name(name).substitutions(substitutions).payload(LLSD()).functor(functor_p));
+}
+
+LLNotificationPtr LLNotificationsUtil::add(const std::string& name,
+ const LLSD& substitutions,
+ const LLSD& payload)
+{
+ LLNotification::Params::Functor functor_p;
+ functor_p.name = name;
+ return LLNotifications::instance().add(
+ LLNotification::Params().name(name).substitutions(substitutions).payload(payload).functor(functor_p));
+}
+
+LLNotificationPtr LLNotificationsUtil::add(const std::string& name,
+ const LLSD& substitutions,
+ const LLSD& payload,
+ const std::string& functor_name)
+{
+ LLNotification::Params::Functor functor_p;
+ functor_p.name = functor_name;
+ return LLNotifications::instance().add(
+ LLNotification::Params().name(name).substitutions(substitutions).payload(payload).functor(functor_p));
+}
+
+LLNotificationPtr LLNotificationsUtil::add(const std::string& name,
+ const LLSD& substitutions,
+ const LLSD& payload,
+ boost::function<void (const LLSD&, const LLSD&)> functor)
+{
+ LLNotification::Params::Functor functor_p;
+ functor_p.function = functor;
+ return LLNotifications::instance().add(
+ LLNotification::Params().name(name).substitutions(substitutions).payload(payload).functor(functor_p));
+}
+
+S32 LLNotificationsUtil::getSelectedOption(const LLSD& notification, const LLSD& response)
+{
+ return LLNotification::getSelectedOption(notification, response);
+}
diff --git a/indra/llui/llnotificationsutil.h b/indra/llui/llnotificationsutil.h
new file mode 100644
index 0000000000..a0801b338f
--- /dev/null
+++ b/indra/llui/llnotificationsutil.h
@@ -0,0 +1,68 @@
+/**
+ * @file llnotificationsutil.h
+ *
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ *
+ * Copyright (c) 2008-2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+#ifndef LLNOTIFICATIONSUTIL_H
+#define LLNOTIFICATIONSUTIL_H
+
+// The vast majority of clients of the notifications system just want to add
+// a notification to the screen, so define this lightweight public interface
+// to avoid including the heavyweight llnotifications.h
+
+#include "llnotificationptr.h"
+
+#include <boost/function.hpp>
+
+class LLSD;
+
+namespace LLNotificationsUtil
+{
+ LLNotificationPtr add(const std::string& name);
+
+ LLNotificationPtr add(const std::string& name,
+ const LLSD& substitutions);
+
+ LLNotificationPtr add(const std::string& name,
+ const LLSD& substitutions,
+ const LLSD& payload);
+
+ LLNotificationPtr add(const std::string& name,
+ const LLSD& substitutions,
+ const LLSD& payload,
+ const std::string& functor_name);
+
+ LLNotificationPtr add(const std::string& name,
+ const LLSD& substitutions,
+ const LLSD& payload,
+ boost::function<void (const LLSD&, const LLSD&)> functor);
+
+ S32 getSelectedOption(const LLSD& notification, const LLSD& response);
+}
+
+#endif
diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp
index a7cf9be277..0c46edf300 100644
--- a/indra/llui/llresizebar.cpp
+++ b/indra/llui/llresizebar.cpp
@@ -144,9 +144,10 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask)
if( valid_rect.localPointInRect( screen_x, screen_y ) && mResizingView )
{
// undock floater when user resize it
- if (((LLFloater*)getParent())->isDocked())
+ LLFloater* parent = dynamic_cast<LLFloater*>( getParent());
+ if (parent && parent->isDocked())
{
- ((LLFloater*)getParent())->setDocked(false, false);
+ parent->setDocked( false, false);
}
// Resize the parent
diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp
index 5e17372fe9..d91b58b4ea 100644
--- a/indra/llui/llscrollcontainer.cpp
+++ b/indra/llui/llscrollcontainer.cpp
@@ -111,7 +111,8 @@ LLScrollContainer::LLScrollContainer(const LLScrollContainer::Params& p)
LLView::addChild( mBorder );
mInnerRect.set( 0, getRect().getHeight(), getRect().getWidth(), 0 );
- mInnerRect.stretch( -mBorder->getBorderWidth() );
+ if ( mBorder->getVisible() )
+ mInnerRect.stretch( -mBorder->getBorderWidth() );
LLRect vertical_scroll_rect = mInnerRect;
vertical_scroll_rect.mLeft = vertical_scroll_rect.mRight - scrollbar_size;
@@ -189,7 +190,8 @@ void LLScrollContainer::reshape(S32 width, S32 height,
LLUICtrl::reshape( width, height, called_from_parent );
mInnerRect = getLocalRect();
- mInnerRect.stretch( -mBorder->getBorderWidth() );
+ if ( mBorder->getVisible() )
+ mInnerRect.stretch( -mBorder->getBorderWidth() );
if (mScrolledView)
{