From 798d367d54a6c6379ad355bd8345fa40e31e7fe9 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sat, 6 Sep 2008 18:24:57 -0500 Subject: Second Life viewer sources 1.21.0-RC --- linden/indra/llui/CMakeLists.txt | 133 ++++++ linden/indra/llui/files.lst | 46 -- linden/indra/llui/llalertdialog.cpp | 104 ++--- linden/indra/llui/llalertdialog.h | 69 +-- linden/indra/llui/llbutton.cpp | 153 ++++--- linden/indra/llui/llbutton.h | 73 +-- linden/indra/llui/llcallbackmap.h | 2 +- linden/indra/llui/llcheckboxctrl.cpp | 42 +- linden/indra/llui/llcheckboxctrl.h | 12 +- linden/indra/llui/llcombobox.cpp | 108 ++--- linden/indra/llui/llcombobox.h | 30 +- linden/indra/llui/llctrlselectioninterface.cpp | 4 +- linden/indra/llui/llctrlselectioninterface.h | 10 +- linden/indra/llui/lldraghandle.cpp | 24 +- linden/indra/llui/lldraghandle.h | 18 +- linden/indra/llui/llfloater.cpp | 242 +++++----- linden/indra/llui/llfloater.h | 56 +-- linden/indra/llui/llfocusmgr.cpp | 12 +- linden/indra/llui/llfocusmgr.h | 6 +- linden/indra/llui/lliconctrl.cpp | 10 +- linden/indra/llui/lliconctrl.h | 10 +- linden/indra/llui/llkeywords.cpp | 63 ++- linden/indra/llui/llkeywords.h | 8 +- linden/indra/llui/lllineeditor.cpp | 142 +++--- linden/indra/llui/lllineeditor.h | 36 +- linden/indra/llui/llmemberlistener.h | 4 +- linden/indra/llui/llmenugl.cpp | 262 ++++++----- linden/indra/llui/llmenugl.h | 90 ++-- linden/indra/llui/llmodaldialog.cpp | 4 +- linden/indra/llui/llmodaldialog.h | 2 +- linden/indra/llui/llmultislider.cpp | 32 +- linden/indra/llui/llmultislider.h | 22 +- linden/indra/llui/llmultisliderctrl.cpp | 64 +-- linden/indra/llui/llmultisliderctrl.h | 28 +- linden/indra/llui/llpanel.cpp | 130 +++--- linden/indra/llui/llpanel.h | 126 ++--- linden/indra/llui/llradiogroup.cpp | 28 +- linden/indra/llui/llradiogroup.h | 10 +- linden/indra/llui/llresizebar.cpp | 2 +- linden/indra/llui/llresizebar.h | 2 +- linden/indra/llui/llresizehandle.cpp | 2 +- linden/indra/llui/llresizehandle.h | 2 +- linden/indra/llui/llresmgr.cpp | 38 +- linden/indra/llui/llresmgr.h | 12 +- linden/indra/llui/llrootview.cpp | 2 +- linden/indra/llui/llrootview.h | 2 +- linden/indra/llui/llscrollbar.cpp | 28 +- linden/indra/llui/llscrollbar.h | 4 +- linden/indra/llui/llscrollcontainer.cpp | 22 +- linden/indra/llui/llscrollcontainer.h | 8 +- linden/indra/llui/llscrollingpanellist.cpp | 2 +- linden/indra/llui/llscrollingpanellist.h | 4 +- linden/indra/llui/llscrolllistctrl.cpp | 166 +++---- linden/indra/llui/llscrolllistctrl.h | 53 +-- linden/indra/llui/llslider.cpp | 6 +- linden/indra/llui/llslider.h | 4 +- linden/indra/llui/llsliderctrl.cpp | 54 ++- linden/indra/llui/llsliderctrl.h | 12 +- linden/indra/llui/llspinctrl.cpp | 63 +-- linden/indra/llui/llspinctrl.h | 8 +- linden/indra/llui/llstyle.cpp | 18 +- linden/indra/llui/llstyle.h | 16 +- linden/indra/llui/lltabcontainer.cpp | 141 +++--- linden/indra/llui/lltabcontainer.h | 26 +- linden/indra/llui/lltextbox.cpp | 28 +- linden/indra/llui/lltextbox.h | 12 +- linden/indra/llui/lltexteditor.cpp | 328 ++++++++----- linden/indra/llui/lltexteditor.h | 57 +-- linden/indra/llui/llui.cpp | 31 +- linden/indra/llui/llui.h | 18 +- linden/indra/llui/llui.vcproj | 446 ------------------ linden/indra/llui/llui_vc8.vcproj | 611 ------------------------ linden/indra/llui/llui_vc9.vcproj | 612 ------------------------- linden/indra/llui/lluictrl.cpp | 8 +- linden/indra/llui/lluictrl.h | 6 +- linden/indra/llui/lluictrlfactory.cpp | 56 +-- linden/indra/llui/lluictrlfactory.h | 22 +- linden/indra/llui/lluistring.cpp | 14 +- linden/indra/llui/lluistring.h | 34 +- linden/indra/llui/lluixmltags.h | 6 +- linden/indra/llui/llview.cpp | 138 +++--- linden/indra/llui/llview.h | 103 ++--- linden/indra/llui/llviewborder.cpp | 8 +- linden/indra/llui/llviewborder.h | 2 +- 84 files changed, 2040 insertions(+), 3412 deletions(-) create mode 100644 linden/indra/llui/CMakeLists.txt delete mode 100644 linden/indra/llui/files.lst delete mode 100644 linden/indra/llui/llui.vcproj delete mode 100644 linden/indra/llui/llui_vc8.vcproj delete mode 100644 linden/indra/llui/llui_vc9.vcproj (limited to 'linden/indra/llui') diff --git a/linden/indra/llui/CMakeLists.txt b/linden/indra/llui/CMakeLists.txt new file mode 100644 index 0000000..77efec5 --- /dev/null +++ b/linden/indra/llui/CMakeLists.txt @@ -0,0 +1,133 @@ +# -*- cmake -*- + +project(llui) + +include(00-Common) +include(LLAudio) +include(LLCommon) +include(LLImage) +include(LLMath) +include(LLMessage) +include(LLRender) +include(LLWindow) +include(LLVFS) +include(LLXML) + +include_directories( + ${LLAUDIO_INCLUDE_DIRS} + ${LLCOMMON_INCLUDE_DIRS} + ${LLIMAGE_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLRENDER_INCLUDE_DIRS} + ${LLWINDOW_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${LLXML_INCLUDE_DIRS} + ) + +set(llui_SOURCE_FILES + llalertdialog.cpp + llbutton.cpp + llcheckboxctrl.cpp + llclipboard.cpp + llcombobox.cpp + llctrlselectioninterface.cpp + lldraghandle.cpp + lleditmenuhandler.cpp + llfloater.cpp + llfocusmgr.cpp + lliconctrl.cpp + llkeywords.cpp + lllineeditor.cpp + llmenugl.cpp + llmodaldialog.cpp + llmultislider.cpp + llmultisliderctrl.cpp + llpanel.cpp + llradiogroup.cpp + llresizebar.cpp + llresizehandle.cpp + llresmgr.cpp + llrootview.cpp + llscrollbar.cpp + llscrollcontainer.cpp + llscrollingpanellist.cpp + llscrolllistctrl.cpp + llslider.cpp + llsliderctrl.cpp + llspinctrl.cpp + llstyle.cpp + lltabcontainer.cpp + lltabcontainervertical.cpp + lltextbox.cpp + lltexteditor.cpp + llui.cpp + lluictrl.cpp + lluictrlfactory.cpp + lluistring.cpp + llundo.cpp + llviewborder.cpp + llview.cpp + llviewquery.cpp + ) + +set(llui_HEADER_FILES + CMakeLists.txt + + llalertdialog.h + llbutton.h + llcallbackmap.h + llcheckboxctrl.h + llclipboard.h + llcombobox.h + llctrlselectioninterface.h + lldraghandle.h + lleditmenuhandler.h + llfloater.h + llfocusmgr.h + llhtmlhelp.h + lliconctrl.h + llkeywords.h + lllineeditor.h + llmemberlistener.h + llmenugl.h + llmodaldialog.h + llmultisliderctrl.h + llmultislider.h + llpanel.h + llradiogroup.h + llresizebar.h + llresizehandle.h + llresmgr.h + llrootview.h + llscrollbar.h + llscrollcontainer.h + llscrollingpanellist.h + llscrolllistctrl.h + llsliderctrl.h + llslider.h + llspinctrl.h + llstyle.h + lltabcontainer.h + lltabcontainervertical.h + lltextbox.h + lltexteditor.h + lluiconstants.h + lluictrlfactory.h + lluictrl.h + lluifwd.h + llui.h + lluistring.h + lluixmltags.h + llundo.h + llviewborder.h + llview.h + llviewquery.h + ) + +set_source_files_properties(${llui_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llui_SOURCE_FILES ${llui_HEADER_FILES}) + +add_library (llui ${llui_SOURCE_FILES}) diff --git a/linden/indra/llui/files.lst b/linden/indra/llui/files.lst deleted file mode 100644 index 56bc2c3..0000000 --- a/linden/indra/llui/files.lst +++ /dev/null @@ -1,46 +0,0 @@ -llui/llalertdialog.cpp -llui/llbutton.cpp -llui/llcheckboxctrl.cpp -llui/llclipboard.cpp -llui/llcombobox.cpp -llui/llctrlselectioninterface.cpp -llui/lldraghandle.cpp -llui/lleditmenuhandler.cpp -llui/llfloater.cpp -llui/llfocusmgr.cpp -llui/lliconctrl.cpp -llui/llkeywords.cpp -llui/lllineeditor.cpp -llui/llmenugl.cpp -llui/llmodaldialog.cpp -llui/llmultislider.cpp -llui/llmultisliderctrl.cpp -llui/llpanel.cpp -llui/llradiogroup.cpp -llui/llresizebar.cpp -llui/llresizehandle.cpp -llui/llresmgr.cpp -llui/llrootview.cpp -llui/llscrollbar.cpp -llui/llscrollcontainer.cpp -llui/llscrollingpanellist.cpp -llui/llscrolllistctrl.cpp -llui/llslider.cpp -llui/llsliderctrl.cpp -llui/llspinctrl.cpp -llui/llstyle.cpp -llui/lltabcontainer.cpp -llui/lltabcontainervertical.cpp -llui/lltextbox.cpp -llui/lltexteditor.cpp -llui/llui.cpp -llui/lluictrl.cpp -llui/lluictrlfactory.cpp -llui/lluistring.cpp -llui/llundo.cpp -llui/llview.cpp -llui/llviewborder.cpp -llui/llviewquery.cpp -llui/llmultislider.cpp -llui/llmultisliderctrl.cpp - diff --git a/linden/indra/llui/llalertdialog.cpp b/linden/indra/llui/llalertdialog.cpp index 4ca9dc8..4be07e9 100644 --- a/linden/indra/llui/llalertdialog.cpp +++ b/linden/indra/llui/llalertdialog.cpp @@ -55,23 +55,23 @@ const S32 MSG_PAD = 8; /*static*/ LLAlertDialog::template_map_t LLAlertDialog::sAlertTemplates; /*static*/ LLAlertDialog::template_map_t LLAlertDialog::sIgnorableTemplates; /*static*/ LLControlGroup* LLAlertDialog::sSettings = NULL; -/*static*/ std::map LLAlertDialog::sUniqueActiveMap; +/*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*/ std::string LLAlertDialog::sStringSkipNextTime("Skip this dialog next time"); +/*static*/ std::string LLAlertDialog::sStringAlwaysChoose("Always choose this option"); /*static*/ LLAlertDialog::URLLoader* LLAlertDialog::sURLLoader; //static -LLAlertDialog* LLAlertDialog::createXml( const LLString& xml_desc, +LLAlertDialog* LLAlertDialog::createXml( const std::string& xml_desc, alert_callback_t callback, void *user_data) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; return createXml(xml_desc, args, callback, user_data); } //static -LLAlertDialog* LLAlertDialog::createXml( const LLString& xml_desc, const LLString::format_map_t& args, +LLAlertDialog* LLAlertDialog::createXml( const std::string& xml_desc, const LLStringUtil::format_map_t& args, alert_callback_t callback, void *user_data) { template_map_t::iterator iter = sAlertTemplates.find(xml_desc); @@ -85,7 +85,7 @@ LLAlertDialog* LLAlertDialog::createXml( const LLString& xml_desc, const LLStrin } else { - LLString::format_map_t args; + LLStringUtil::format_map_t args; args["[ALERT_NAME]"] = xml_desc; llwarns << "Missing Alert: [" << xml_desc << "]" << llendl; LLAlertDialog* dialogp = LLAlertDialog::showXml("MissingAlert", args); @@ -98,15 +98,15 @@ LLAlertDialog* LLAlertDialog::createXml( const LLString& xml_desc, const LLStrin } //static -LLAlertDialog* LLAlertDialog::showXml( const LLString& xml_desc, +LLAlertDialog* LLAlertDialog::showXml( const std::string& xml_desc, alert_callback_t callback, void *user_data) { - LLString::format_map_t args; + LLStringUtil::format_map_t args; return showXml(xml_desc, args, callback, user_data); } //static -LLAlertDialog* LLAlertDialog::showXml( const LLString& xml_desc, const LLString::format_map_t& args, +LLAlertDialog* LLAlertDialog::showXml( const std::string& xml_desc, const LLStringUtil::format_map_t& args, alert_callback_t callback, void *user_data) { LLAlertDialog* dialog = createXml(xml_desc, args, callback, user_data); @@ -114,10 +114,10 @@ LLAlertDialog* LLAlertDialog::showXml( const LLString& xml_desc, const LLString: } //static -LLAlertDialog* LLAlertDialog::showCritical( const LLString& desc, alert_callback_t callback, void *user_data) +LLAlertDialog* LLAlertDialog::showCritical( const std::string& desc, alert_callback_t callback, void *user_data) { LLAlertDialogTemplate xml_template; - LLString::format_map_t args; + LLStringUtil::format_map_t args; xml_template.mTitle = "Critical Error"; xml_template.mMessage = desc; xml_template.mModal = TRUE; @@ -135,7 +135,7 @@ static const S32 BTN_HPAD = 8; static const LLFONT_ID font_name = LLFONT_SANSSERIF; LLAlertDialog::LLAlertDialog( const LLAlertDialogTemplate* xml_template, - const LLString::format_map_t& args, + const LLStringUtil::format_map_t& args, alert_callback_t callback, void *user_data) : LLModalDialog( xml_template->mTitle, 100, 100, xml_template->mModal ), // dummy size. Will reshape below. mCallback( callback ), @@ -156,7 +156,7 @@ LLAlertDialog::LLAlertDialog( const LLAlertDialogTemplate* xml_template, { mURL = xml_template->mURL; mURLOption = xml_template->mURLOption; - createDialog(&(xml_template->mOptions), xml_template->mDefaultOption, + createDialog(xml_template->mOptions, xml_template->mDefaultOption, xml_template->mMessage, args, xml_template->mEditLineText); setTitle(xml_template->mTitle); @@ -226,7 +226,7 @@ bool LLAlertDialog::show() // Check to see if we are already displaying the alert if (mUnique) { - std::map::iterator iter = sUniqueActiveMap.find(mLabel); + std::map::iterator iter = sUniqueActiveMap.find(mLabel); if (iter != sUniqueActiveMap.end()) { gFloaterView->bringToFront(iter->second); @@ -254,18 +254,18 @@ bool LLAlertDialog::show() return true; } -void LLAlertDialog::format(LLString& msg, const LLString::format_map_t& args) +void LLAlertDialog::format(std::string& msg, const LLStringUtil::format_map_t& args) { // XUI:translate! - LLString::format_map_t targs = args; + LLStringUtil::format_map_t targs = args; targs["[SECOND_LIFE]"] = "Second Life"; targs["[_URL]"] = mURL; - LLString::format(msg, targs); + LLStringUtil::format(msg, targs); } -void LLAlertDialog::createDialog(const std::vector* optionsp, S32 default_option, - const LLString& msg_in, const LLString::format_map_t& args, - const LLString& edit_text) +void LLAlertDialog::createDialog(const options_list_t& options_in, S32 default_option, + const std::string& msg_in, const LLStringUtil::format_map_t& args, + const std::string& edit_text) { setBackgroundVisible(TRUE); setBackgroundOpaque(TRUE); @@ -274,9 +274,11 @@ void LLAlertDialog::createDialog(const std::vector* optionsp, S32 defa const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f); const S32 EDITOR_HEIGHT = 20; + const options_list_t* optionsp = &options_in; + // Buttons - std::vector default_option_list; - mNumOptions = optionsp->size(); + options_list_t default_option_list; + mNumOptions = options_in.size(); if( 0 == mNumOptions ) { default_option_list.push_back("Close"); @@ -285,12 +287,13 @@ void LLAlertDialog::createDialog(const std::vector* optionsp, S32 defa mNumOptions = 1; } - const std::vector& options = *optionsp; + const options_list_t& options= *optionsp; + mButtonData = new ButtonData[mNumOptions]; // Calc total width of buttons S32 button_width = 0; - S32 sp = font->getWidth("OO"); + S32 sp = font->getWidth(std::string("OO")); for( S32 i = 0; i < mNumOptions; i++ ) { S32 w = S32(font->getWidth( options[i] ) + 0.99f) + sp + 2 * LLBUTTON_H_PAD; @@ -304,10 +307,10 @@ void LLAlertDialog::createDialog(const std::vector* optionsp, S32 defa // Message: create text box using raw string, as text has been structure deliberately // Use size of created text box to generate dialog box size - LLString msg = msg_in; + std::string msg = msg_in; format( msg, args ); llwarns << "Alert: " << msg << llendl; - LLTextBox* msg_box = new LLTextBox( "Alert message", msg, (F32)MAX_ALLOWED_MSG_WIDTH, font ); + LLTextBox* msg_box = new LLTextBox( std::string("Alert message"), msg, (F32)MAX_ALLOWED_MSG_WIDTH, font ); const LLRect& text_rect = msg_box->getRect(); S32 dialog_width = llmax( btn_total_width, text_rect.getWidth() ) + 2 * HPAD; @@ -339,7 +342,7 @@ void LLAlertDialog::createDialog(const std::vector* optionsp, S32 defa if (mCaution) { - LLIconCtrl* icon = new LLIconCtrl("icon", LLRect(msg_x, msg_y, msg_x+32, msg_y-32), "notify_caution_icon.tga"); + LLIconCtrl* icon = new LLIconCtrl(std::string("icon"), LLRect(msg_x, msg_y, msg_x+32, msg_y-32), std::string("notify_caution_icon.tga")); icon->setMouseOpaque(FALSE); addChild(icon); msg_x += 32 + HPAD; @@ -362,13 +365,12 @@ void LLAlertDialog::createDialog(const std::vector* optionsp, S32 defa LLRect button_rect; button_rect.setOriginAndSize( button_left, VPAD, button_width, BTN_HEIGHT ); - LLButton* btn = new LLButton( - "btn", button_rect, - "","", "", - &LLAlertDialog::onButtonPressed, (void*)(&mButtonData[i]), - font, - options[i], - options[i]); + LLButton* btn = new LLButton(std::string("btn"), button_rect, + LLStringUtil::null, LLStringUtil::null, LLStringUtil::null, + &LLAlertDialog::onButtonPressed, (void*)(&mButtonData[i]), + font, + options[i], + options[i]); mButtonData[i].mSelf = this; mButtonData[i].mButton = btn; @@ -388,7 +390,7 @@ void LLAlertDialog::createDialog(const std::vector* optionsp, S32 defa if (edit_text.size() > 0) { S32 y = VPAD + BTN_HEIGHT + VPAD/2; - mLineEditor = new LLLineEditor("lineeditor", + mLineEditor = new LLLineEditor(std::string("lineeditor"), LLRect( HPAD, y+EDITOR_HEIGHT, dialog_width-HPAD, y), edit_text, LLFontGL::sSansSerif, @@ -397,7 +399,7 @@ void LLAlertDialog::createDialog(const std::vector* optionsp, S32 defa } } -bool LLAlertDialog::setCheckBox( const LLString& check_title, const LLString& check_control ) +bool LLAlertDialog::setCheckBox( const std::string& check_title, const std::string& check_control ) { const LLFontGL* font = LLResMgr::getInstance()->getRes( font_name ); const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f); @@ -420,7 +422,7 @@ bool LLAlertDialog::setCheckBox( const LLString& check_title, const LLString& ch check_rect.setOriginAndSize(msg_x, VPAD+BTN_HEIGHT+LINE_HEIGHT/2, max_msg_width, LINE_HEIGHT); - mCheck = new LLCheckboxCtrl("check", check_rect, check_title, font); + mCheck = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font); addChild(mCheck); // mCheck is sometimes "show again" and sometimes "hide" :-( @@ -508,7 +510,7 @@ void LLAlertDialog::handleCallbacks() } BOOL LLAlertDialog::hasTitleBar() const { - return (getTitle() != "" && getTitle() != " ") // has title + return (getCurrentTitle() != "" && getCurrentTitle() != " ") // has title || isMinimizeable() || isCloseable(); } @@ -586,11 +588,11 @@ void LLAlertDialog::setEditTextCallback(alert_text_callback_t callback, void *us } } -void LLAlertDialog::setEditTextArgs(const LLString::format_map_t& edit_args) +void LLAlertDialog::setEditTextArgs(const LLStringUtil::format_map_t& edit_args) { if (mLineEditor) { - LLString msg = mLineEditor->getText(); + std::string msg = mLineEditor->getText(); format(msg, edit_args); mLineEditor->setText(msg); } @@ -625,7 +627,7 @@ void LLAlertDialog::onButtonPressed( void* userdata ) //============================================================================= //static -const LLString& LLAlertDialog::getTemplateMessage(const LLString& xml_desc) +const std::string& LLAlertDialog::getTemplateMessage(const std::string& xml_desc) { template_map_t::iterator iter = sAlertTemplates.find(xml_desc); if (iter != sAlertTemplates.end()) @@ -639,7 +641,7 @@ const LLString& LLAlertDialog::getTemplateMessage(const LLString& xml_desc) } //static -bool LLAlertDialog::parseAlerts(const LLString& xml_filename, LLControlGroup* settings, BOOL settings_only) +bool LLAlertDialog::parseAlerts(const std::string& xml_filename, LLControlGroup* settings, BOOL settings_only) { LLXMLNodePtr root; BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); @@ -663,7 +665,7 @@ bool LLAlertDialog::parseAlerts(const LLString& xml_filename, LLControlGroup* se { if (alert->hasName("global")) { - LLString global_name; + std::string global_name; if (alert->getAttributeString("name", global_name)) { if (global_name == "skipnexttime") @@ -686,7 +688,7 @@ bool LLAlertDialog::parseAlerts(const LLString& xml_filename, LLControlGroup* se LLAlertDialogTemplate* xml_template = settings_only ? NULL : new LLAlertDialogTemplate; // name= - LLString alert_name; + std::string alert_name; if (alert->getAttributeString("name", alert_name)) { if (xml_template) @@ -701,7 +703,7 @@ bool LLAlertDialog::parseAlerts(const LLString& xml_filename, LLControlGroup* se continue; } // title= - LLString title; + std::string title; if (alert->getAttributeString("title", title)) { if (xml_template) @@ -767,10 +769,10 @@ bool LLAlertDialog::parseAlerts(const LLString& xml_filename, LLControlGroup* se //