From 3f27ba891ac4d032753b219b4b96d1ffbc9fb488 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:16 -0500 Subject: Second Life viewer sources 1.18.5.0-RC --- linden/indra/llui/llalertdialog.cpp | 26 ++++++++++++++++++++----- linden/indra/llui/llalertdialog.h | 3 +++ linden/indra/llui/llbutton.cpp | 2 +- linden/indra/llui/llcallbackmap.h | 4 ---- linden/indra/llui/llhtmlhelp.h | 2 +- linden/indra/llui/lllineeditor.cpp | 8 ++++++++ linden/indra/llui/llmenugl.cpp | 18 ++++++++++++----- linden/indra/llui/llmenugl.h | 13 +++++++------ linden/indra/llui/llresmgr.cpp | 9 +++++---- linden/indra/llui/llresmgr.h | 2 +- linden/indra/llui/lltexteditor.cpp | 39 +++++++++++++++++++++++++------------ linden/indra/llui/llui.h | 1 + linden/indra/llui/lluixmltags.h | 4 ++-- 13 files changed, 90 insertions(+), 41 deletions(-) (limited to 'linden/indra/llui') diff --git a/linden/indra/llui/llalertdialog.cpp b/linden/indra/llui/llalertdialog.cpp index 0fa3585..258b523 100644 --- a/linden/indra/llui/llalertdialog.cpp +++ b/linden/indra/llui/llalertdialog.cpp @@ -56,6 +56,8 @@ const S32 MSG_PAD = 8; /*static*/ LLControlGroup* LLAlertDialog::sSettings = NULL; /*static*/ std::map LLAlertDialog::sUniqueActiveMap; /*static*/ LLAlertDialog::display_callback_t LLAlertDialog::sDisplayCallback; +/*static*/ LLString LLAlertDialog::sStringSkipNextTime("Skip this dialog next time"); +/*static*/ LLString LLAlertDialog::sStringAlwaysChoose("Always choose this option"); //static LLAlertDialog* LLAlertDialog::createXml( const LLString& xml_desc, @@ -153,17 +155,14 @@ LLAlertDialog::LLAlertDialog( const LLAlertDialogTemplate* xml_template, setTitle(xml_template->mTitle); if (xml_template->mIgnorable) { - //XUI:translate! - LLString msg; if (xml_template->mIgnorable == IGNORE_USE_DEFAULT) { - msg = "Skip this dialog next time"; + setCheckBox(sStringSkipNextTime, xml_template->mIgnoreLabel); } else // xml_template->mIgnorable == IGNORE_USE_SAVED { - msg = "Always choose this option"; + setCheckBox(sStringAlwaysChoose, xml_template->mIgnoreLabel); } - setCheckBox(msg, xml_template->mIgnoreLabel); } } @@ -618,6 +617,23 @@ bool LLAlertDialog::parseAlerts(const LLString& xml_filename, LLControlGroup* se for (LLXMLNode* alert = root->getFirstChild(); alert != NULL; alert = alert->getNextSibling()) { + if (alert->hasName("global")) + { + LLString global_name; + if (alert->getAttributeString("name", global_name)) + { + if (global_name == "skipnexttime") + { + sStringSkipNextTime = alert->getTextContents(); + } + else if (global_name == "alwayschoose") + { + sStringAlwaysChoose = alert->getTextContents(); + } + } + continue; + } + if (!alert->hasName("alert")) { continue; diff --git a/linden/indra/llui/llalertdialog.h b/linden/indra/llui/llalertdialog.h index acd0b7f..ddf4112 100644 --- a/linden/indra/llui/llalertdialog.h +++ b/linden/indra/llui/llalertdialog.h @@ -135,6 +135,9 @@ public: static LLControlGroup* sSettings; static std::map sUniqueActiveMap; static display_callback_t sDisplayCallback; + + static LLString sStringSkipNextTime; + static LLString sStringAlwaysChoose; }; //============================================================================ diff --git a/linden/indra/llui/llbutton.cpp b/linden/indra/llui/llbutton.cpp index 65cbcf3..36ccc32 100644 --- a/linden/indra/llui/llbutton.cpp +++ b/linden/indra/llui/llbutton.cpp @@ -1037,7 +1037,7 @@ void clicked_help(void* data) return; } - LLUI::sHtmlHelp->show(self->getHelpURL()); + LLUI::sHtmlHelp->show(self->getHelpURL(), ""); } // static diff --git a/linden/indra/llui/llcallbackmap.h b/linden/indra/llui/llcallbackmap.h index 0efda5d..496d722 100644 --- a/linden/indra/llui/llcallbackmap.h +++ b/linden/indra/llui/llcallbackmap.h @@ -29,10 +29,6 @@ * $/LicenseInfo$ */ -// llcallbackmap.h -// -// Copyright 2006, Linden Research, Inc. - #ifndef LL_CALLBACK_MAP_H #define LL_CALLBACK_MAP_H diff --git a/linden/indra/llui/llhtmlhelp.h b/linden/indra/llui/llhtmlhelp.h index 816d0dd..9658f8f 100644 --- a/linden/indra/llui/llhtmlhelp.h +++ b/linden/indra/llui/llhtmlhelp.h @@ -36,7 +36,7 @@ class LLHtmlHelp { public: virtual ~LLHtmlHelp() {} - virtual void show(std::string start_url = "")=0; + virtual void show(std::string start_url, std::string title) = 0; virtual BOOL getFloaterOpened()=0; }; diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp index 9671065..78fe29c 100644 --- a/linden/indra/llui/lllineeditor.cpp +++ b/linden/indra/llui/lllineeditor.cpp @@ -1642,6 +1642,9 @@ void LLLineEditor::draw() { mLastIMEPosition.mX = ime_pos.mX; mLastIMEPosition.mY = ime_pos.mY; + + ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]); + ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]); getWindow()->setLanguageTextInput( ime_pos ); } } @@ -2219,6 +2222,11 @@ LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory { line_editor->setHandleEditKeysDirectly(handle_edit_keys_directly); } + BOOL commit_on_focus_lost = TRUE; + if (node->getAttributeBOOL("commit_on_focus_lost", commit_on_focus_lost)) + { + line_editor->setCommitOnFocusLost(commit_on_focus_lost); + } line_editor->setColorParameters(node); diff --git a/linden/indra/llui/llmenugl.cpp b/linden/indra/llui/llmenugl.cpp index 5d2a052..8ec5656 100644 --- a/linden/indra/llui/llmenugl.cpp +++ b/linden/indra/llui/llmenugl.cpp @@ -2495,6 +2495,9 @@ void LLMenuGL::cleanupSpilloverBranch() mItems.erase(found_iter); } + delete mSpilloverBranch; + mSpilloverBranch = NULL; + // pop off spillover items while (mSpilloverMenu->getItemCount()) { @@ -2607,6 +2610,8 @@ void LLMenuGL::createJumpKeys() // remove all items on the menu void LLMenuGL::empty( void ) { + cleanupSpilloverBranch(); + mItems.clear(); deleteAllChildren(); @@ -4245,11 +4250,14 @@ void LLMenuBarGL::arrange( void ) for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter) { LLMenuItemGL* item = *item_iter; - rect.mLeft = pos; - pos += item->getNominalWidth(); - rect.mRight = pos; - item->setRect( rect ); - item->buildDrawLabel(); + if (item->getVisible()) + { + rect.mLeft = pos; + pos += item->getNominalWidth(); + rect.mRight = pos; + item->setRect( rect ); + item->buildDrawLabel(); + } } reshape(rect.mRight, rect.getHeight()); } diff --git a/linden/indra/llui/llmenugl.h b/linden/indra/llui/llmenugl.h index 6dc9282..ce33f8a 100644 --- a/linden/indra/llui/llmenugl.h +++ b/linden/indra/llui/llmenugl.h @@ -238,11 +238,6 @@ protected: on_disabled_callback mOnDisabledCallback; public: - - - void setMenuCallback(menu_callback callback, void* data) { mCallback = callback; mUserData = data; }; - void setEnabledCallback(enabled_callback callback) { mEnabledCallback = callback; }; - // normal constructor LLMenuItemCallGL( const LLString& name, menu_callback clicked_cb, @@ -288,7 +283,13 @@ public: void setEnabledControl(LLString enabled_control, LLView *context); void setVisibleControl(LLString enabled_control, LLView *context); - virtual void setUserData(void *userdata) { mUserData = userdata; } + void setMenuCallback(menu_callback callback, void* data) { mCallback = callback; mUserData = data; }; + menu_callback getMenuCallback() const { return mCallback; } + + void setEnabledCallback(enabled_callback callback) { mEnabledCallback = callback; }; + + void setUserData(void *userdata) { mUserData = userdata; } + void* getUserData() const { return mUserData; } // called to rebuild the draw label virtual void buildDrawLabel( void ); diff --git a/linden/indra/llui/llresmgr.cpp b/linden/indra/llui/llresmgr.cpp index e77faa9..0e1b9bf 100644 --- a/linden/indra/llui/llresmgr.cpp +++ b/linden/indra/llui/llresmgr.cpp @@ -247,8 +247,10 @@ char LLResMgr::getMonetaryThousandsSeparator() const // Sets output to a string of integers with monetary separators inserted according to the locale. -void LLResMgr::getMonetaryString( LLString& output, S32 input ) const +std::string LLResMgr::getMonetaryString( S32 input ) const { + std::string output; + LLLocale locale(LLLocale::USER_LOCALE); struct lconv *conv = localeconv(); @@ -295,7 +297,6 @@ void LLResMgr::getMonetaryString( LLString& output, S32 input ) const LLString digits = llformat("%u", abs(input)); if( !grouping || !grouping[0] ) { - output.assign("L$"); if( negative_before ) { output.append( negative_sign ); @@ -305,7 +306,7 @@ void LLResMgr::getMonetaryString( LLString& output, S32 input ) const { output.append( negative_sign ); } - return; + return output; } S32 groupings[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -367,7 +368,6 @@ void LLResMgr::getMonetaryString( LLString& output, S32 input ) const forward_output[ output_pos - 1 - i ] = reversed_output[ i ]; } - output.assign("L$"); if( negative_before ) { output.append( negative_sign ); @@ -377,6 +377,7 @@ void LLResMgr::getMonetaryString( LLString& output, S32 input ) const { output.append( negative_sign ); } + return output; } void LLResMgr::getIntegerString( LLString& output, S32 input ) const diff --git a/linden/indra/llui/llresmgr.h b/linden/indra/llui/llresmgr.h index d9e58bc..be2a355 100644 --- a/linden/indra/llui/llresmgr.h +++ b/linden/indra/llui/llresmgr.h @@ -132,7 +132,7 @@ public: char getMonetaryDecimalPoint() const; char getMonetaryThousandsSeparator() const; - void getMonetaryString( LLString& output, S32 input ) const; + std::string getMonetaryString( S32 input ) const; void getIntegerString( LLString& output, S32 input ) const; // const char* getRes( LLSTR_ID string_id ) const { return mStrings[ string_id ]; } diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp index 12ad339..1f13bbb 100644 --- a/linden/indra/llui/lltexteditor.cpp +++ b/linden/indra/llui/lltexteditor.cpp @@ -967,17 +967,6 @@ void LLTextEditor::endSelection() mIsSelecting = FALSE; mSelectionEnd = mCursorPos; } - if (mParseHTML && mHTML.length() > 0) - { - //Special handling for slurls - if ( (mSecondlifeURLcallback!=NULL) && !(*mSecondlifeURLcallback)(mHTML) ) - { - if (mURLcallback!=NULL) (*mURLcallback)(mHTML.c_str()); - - //load_url(url.c_str()); - } - mHTML=""; - } } BOOL LLTextEditor::selectionContainsLineBreaks() @@ -1408,6 +1397,7 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) if( hasMouseCapture() ) { gFocusMgr.setMouseCapture( NULL ); + handled = TRUE; } @@ -2831,7 +2821,10 @@ void LLTextEditor::drawCursor() { mLastIMEPosition.mX = ime_pos.mX; mLastIMEPosition.mY = ime_pos.mY; - getWindow()->setLanguageTextInput( ime_pos ); + + ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]); + ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]); + getWindow()->setLanguageTextInput( ime_pos ); } } } @@ -3814,6 +3807,22 @@ void LLTextEditor::findEmbeddedItemSegments() BOOL LLTextEditor::handleMouseUpOverSegment(S32 x, S32 y, MASK mask) { + if ( hasMouseCapture() ) + { + // This mouse up was part of a click. + // Regardless of where the cursor is, see if we recently touched a link + // and launch it if we did. + if (mParseHTML && mHTML.length() > 0) + { + //Special handling for slurls + if ( (mSecondlifeURLcallback!=NULL) && !(*mSecondlifeURLcallback)(mHTML) ) + { + if (mURLcallback!=NULL) (*mURLcallback)(mHTML.c_str()); + } + mHTML=""; + } + } + return FALSE; } @@ -4245,6 +4254,12 @@ BOOL LLTextEditor::findHTML(const LLString &line, S32 *begin, S32 *end) strpos = url.find(slurlID); } + if (strpos < 0) + { + slurlID="sl://"; + strpos = url.find(slurlID); + } + if (strpos >= 0) { strpos+=slurlID.length(); diff --git a/linden/indra/llui/llui.h b/linden/indra/llui/llui.h index b806f7a..b78b046 100644 --- a/linden/indra/llui/llui.h +++ b/linden/indra/llui/llui.h @@ -222,6 +222,7 @@ typedef enum e_widget_type WIDGET_TYPE_PAD, // used in XML for positioning, not a real widget WIDGET_TYPE_RADIO_GROUP, WIDGET_TYPE_ICON, + WIDGET_TYPE_LANDMARK_PICKER, WIDGET_TYPE_LOCATE, // used in XML for positioning, not a real widget WIDGET_TYPE_VIEW_BORDER, // decorative border WIDGET_TYPE_PANEL, diff --git a/linden/indra/llui/lluixmltags.h b/linden/indra/llui/lluixmltags.h index 305223d..93e9fe0 100644 --- a/linden/indra/llui/lluixmltags.h +++ b/linden/indra/llui/lluixmltags.h @@ -116,8 +116,8 @@ #define LL_FOLDER_VIEW_ITEM_TAG LLString("folder_item") #define LL_FOLDER_VIEW_FOLDER_TAG LLString("folder") #define LL_TEXTURE_BAR_TAG LLString("texture_bar") -#define LL_JOYSTICK_SLIDE "joystick_slide" -#define LL_JOYSTICK_TURN "joystick_turn" +#define LL_JOYSTICK_SLIDE LLString("joystick_slide") +#define LL_JOYSTICK_TURN LLString("joystick_turn") #define LL_GROUP_DROP_TARGET_TAG LLString("group_drop_target") #define LL_LAYOUT_STACK_TAG LLString("layout_stack") #endif -- cgit v1.1