summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/CMakeLists.txt7
-rw-r--r--indra/llui/llbutton.cpp4
-rw-r--r--indra/llui/llbutton.h8
-rw-r--r--indra/llui/llcombobox.cpp2
-rw-r--r--indra/llui/llconsole.h3
-rw-r--r--indra/llui/lldraghandle.cpp17
-rw-r--r--indra/llui/lldraghandle.h3
-rw-r--r--indra/llui/llfiltereditor.cpp110
-rw-r--r--indra/llui/llfiltereditor.h86
-rw-r--r--indra/llui/llfloater.cpp89
-rw-r--r--indra/llui/llfloater.h39
-rw-r--r--indra/llui/llhandle.h171
-rw-r--r--indra/llui/lllayoutstack.cpp8
-rw-r--r--indra/llui/lllayoutstack.h4
-rw-r--r--indra/llui/lllineeditor.cpp133
-rw-r--r--indra/llui/lllineeditor.h40
-rw-r--r--indra/llui/llmenugl.cpp13
-rw-r--r--indra/llui/llmenugl.h1
-rw-r--r--indra/llui/llnotifications.cpp2
-rw-r--r--indra/llui/llnotifications.h18
-rw-r--r--indra/llui/llpanel.cpp5
-rw-r--r--indra/llui/llpanel.h7
-rw-r--r--indra/llui/llprogressbar.cpp10
-rw-r--r--indra/llui/llprogressbar.h8
-rw-r--r--indra/llui/llresizehandle.cpp4
-rw-r--r--indra/llui/llrngwriter.cpp315
-rw-r--r--indra/llui/llrngwriter.h69
-rw-r--r--indra/llui/llscrolllistcell.cpp10
-rw-r--r--indra/llui/llscrolllistcell.h3
-rw-r--r--indra/llui/llscrolllistcolumn.h2
-rw-r--r--indra/llui/llscrolllistctrl.cpp37
-rw-r--r--indra/llui/llscrolllistctrl.h2
-rw-r--r--indra/llui/llscrolllistitem.h6
-rw-r--r--indra/llui/llsearcheditor.cpp82
-rw-r--r--indra/llui/llsearcheditor.h33
-rw-r--r--indra/llui/llstyle.h1
-rw-r--r--indra/llui/lltabcontainer.cpp1
-rw-r--r--indra/llui/lltabcontainer.h4
-rw-r--r--indra/llui/lltextbox.cpp7
-rw-r--r--indra/llui/lltextbox.h1
-rw-r--r--indra/llui/lltexteditor.cpp37
-rw-r--r--indra/llui/lltexteditor.h28
-rw-r--r--indra/llui/llui.cpp19
-rw-r--r--indra/llui/llui.h137
-rw-r--r--indra/llui/lluictrl.cpp6
-rw-r--r--indra/llui/lluictrl.h2
-rw-r--r--indra/llui/lluictrlfactory.cpp420
-rw-r--r--indra/llui/lluictrlfactory.h39
48 files changed, 1275 insertions, 778 deletions
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt
index e62d875a01..edd3fe2beb 100644
--- a/indra/llui/CMakeLists.txt
+++ b/indra/llui/CMakeLists.txt
@@ -37,6 +37,7 @@ set(llui_SOURCE_FILES
lldraghandle.cpp
lleditmenuhandler.cpp
llf32uictrl.cpp
+ llfiltereditor.cpp
llfloater.cpp
llfloaterreg.cpp
llflyoutbutton.cpp
@@ -59,6 +60,7 @@ set(llui_SOURCE_FILES
llresizebar.cpp
llresizehandle.cpp
llresmgr.cpp
+ llrngwriter.cpp
llscrollbar.cpp
llscrollcontainer.cpp
llscrollingpanellist.cpp
@@ -67,7 +69,7 @@ set(llui_SOURCE_FILES
llscrolllistctrl.cpp
llscrolllistitem.cpp
llsdparam.cpp
- llsearcheditor.cpp
+ llsearcheditor.cpp
llslider.cpp
llsliderctrl.cpp
llspinctrl.cpp
@@ -109,11 +111,13 @@ set(llui_HEADER_FILES
lldraghandle.h
lleditmenuhandler.h
llf32uictrl.h
+ llfiltereditor.h
llfloater.h
llfloaterreg.h
llflyoutbutton.h
llfocusmgr.h
llfunctorregistry.h
+ llhandle.h
llhtmlhelp.h
lliconctrl.h
llinitparam.h
@@ -134,6 +138,7 @@ set(llui_HEADER_FILES
llresizebar.h
llresizehandle.h
llresmgr.h
+ llrngwriter.h
llsearcheditor.h
llscrollbar.h
llscrollcontainer.h
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 9ad27e7c41..fc3af34951 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -62,7 +62,7 @@ S32 BTN_HEIGHT = 0;
LLButton::Params::Params()
: label_selected("label_selected"), // requires is_toggle true
- label_dropshadow("label_shadow", true),
+ label_shadow("label_shadow", true),
auto_resize("auto_resize", false),
image_unselected("image_unselected"),
image_selected("image_selected"),
@@ -133,7 +133,7 @@ LLButton::LLButton(const LLButton::Params& p)
mImageOverlayAlignment(LLFontGL::hAlignFromName(p.image_overlay_alignment)),
mIsToggle(p.is_toggle),
mScaleImage(p.scale_image),
- mDropShadowedText(p.label_dropshadow),
+ mDropShadowedText(p.label_shadow),
mAutoResize(p.auto_resize),
mHAlign(p.font_halign),
mLeftHPad(p.pad_left),
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 3fa62cc351..e387c91a17 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -74,7 +74,7 @@ public:
{
// text label
Optional<std::string> label_selected;
- Optional<bool> label_dropshadow;
+ Optional<bool> label_shadow;
Optional<bool> auto_resize;
// images
@@ -105,9 +105,9 @@ public:
// callbacks
Optional<CommitCallbackParam> click_callback, // alias -> commit_callback
- mouse_down_callback,
- mouse_up_callback,
- mouse_held_callback;
+ mouse_down_callback,
+ mouse_up_callback,
+ mouse_held_callback;
// misc
Optional<bool> is_toggle,
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 5caad1919a..51f9d6bd18 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -141,7 +141,7 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
LLScrollListItem::Params item_params = *it;
if (it->label.isProvided())
{
- item_params.cells.add().value(it->label());
+ item_params.columns.add().value(it->label());
}
mList->addRow(item_params);
diff --git a/indra/llui/llconsole.h b/indra/llui/llconsole.h
index 65149b217f..56e1614948 100644
--- a/indra/llui/llconsole.h
+++ b/indra/llui/llconsole.h
@@ -58,7 +58,8 @@ public:
Optional<S32> font_size_index;
Params()
: max_lines("max_lines", LLUI::sSettingGroups["config"]->getS32("ConsoleMaxLines")),
- persist_time("persist_time", 0.f) // forever
+ persist_time("persist_time", 0.f), // forever
+ font_size_index("font_size_index")
{
mouse_opaque(false);
}
diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp
index 8ecbdb98e1..6e8e37ded3 100644
--- a/indra/llui/lldraghandle.cpp
+++ b/indra/llui/lldraghandle.cpp
@@ -317,6 +317,23 @@ BOOL LLDragHandle::handleHover(S32 x, S32 y, MASK mask)
S32 delta_x = screen_x - mDragLastScreenX;
S32 delta_y = screen_y - mDragLastScreenY;
+ // if dragging a docked floater we want to undock
+ if (((LLFloater*)getParent())->isDocked())
+ {
+ const S32 SLOP = 12;
+
+ if (delta_y <= -SLOP ||
+ delta_y >= SLOP)
+ {
+ ((LLFloater*)getParent())->setDocked(false, false);
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+
LLRect original_rect = getParent()->getRect();
LLRect translated_rect = getParent()->getRect();
translated_rect.translate(delta_x, delta_y);
diff --git a/indra/llui/lldraghandle.h b/indra/llui/lldraghandle.h
index 86eef7c42c..88ec1d21f8 100644
--- a/indra/llui/lldraghandle.h
+++ b/indra/llui/lldraghandle.h
@@ -53,7 +53,8 @@ public:
Optional<LLUIColor> drag_shadow_color;
Params()
- : drag_highlight_color("drag_highlight_color", LLUIColorTable::instance().getColor("DefaultHighlightLight")),
+ : label("label"),
+ drag_highlight_color("drag_highlight_color", LLUIColorTable::instance().getColor("DefaultHighlightLight")),
drag_shadow_color("drag_shadow_color", LLUIColorTable::instance().getColor("DefaultShadowDark"))
{
mouse_opaque(true);
diff --git a/indra/llui/llfiltereditor.cpp b/indra/llui/llfiltereditor.cpp
new file mode 100644
index 0000000000..0f36483fc2
--- /dev/null
+++ b/indra/llui/llfiltereditor.cpp
@@ -0,0 +1,110 @@
+/**
+ * @file llfiltereditor.cpp
+ * @brief LLFilterEditor implementation
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-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$
+ */
+
+// Text editor widget to let users enter a single line.
+
+#include "linden_common.h"
+
+#include "llfiltereditor.h"
+
+LLFilterEditor::LLFilterEditor(const LLFilterEditor::Params& p)
+: LLUICtrl(p)
+{
+ LLLineEditor::Params line_editor_p(p);
+ line_editor_p.name("filter edit box");
+ line_editor_p.rect(getLocalRect());
+ line_editor_p.follows.flags(FOLLOWS_ALL);
+ line_editor_p.text_pad_right(getRect().getHeight());
+ line_editor_p.keystroke_callback(boost::bind(&LLUICtrl::onCommit, this));
+
+ mFilterEditor = LLUICtrlFactory::create<LLLineEditor>(line_editor_p);
+ addChild(mFilterEditor);
+
+ S32 btn_width = getRect().getHeight(); // button is square, and as tall as search editor
+ LLRect clear_btn_rect(getRect().getWidth() - btn_width, getRect().getHeight(), getRect().getWidth(), 0);
+ LLButton::Params button_params(p.clear_filter_button);
+ button_params.name(std::string("clear filter"));
+ button_params.rect(clear_btn_rect) ;
+ button_params.follows.flags(FOLLOWS_RIGHT|FOLLOWS_TOP);
+ button_params.tab_stop(false);
+ button_params.click_callback.function(boost::bind(&LLFilterEditor::onClearFilter, this, _2));
+
+ mClearFilterButton = LLUICtrlFactory::create<LLButton>(button_params);
+ mFilterEditor->addChild(mClearFilterButton);
+}
+
+//virtual
+void LLFilterEditor::setValue(const LLSD& value )
+{
+ mFilterEditor->setValue(value);
+}
+
+//virtual
+LLSD LLFilterEditor::getValue() const
+{
+ return mFilterEditor->getValue();
+}
+
+//virtual
+BOOL LLFilterEditor::setTextArg( const std::string& key, const LLStringExplicit& text )
+{
+ return mFilterEditor->setTextArg(key, text);
+}
+
+//virtual
+BOOL LLFilterEditor::setLabelArg( const std::string& key, const LLStringExplicit& text )
+{
+ return mFilterEditor->setLabelArg(key, text);
+}
+
+//virtual
+void LLFilterEditor::clear()
+{
+ if (mFilterEditor)
+ {
+ mFilterEditor->clear();
+ }
+}
+
+void LLFilterEditor::draw()
+{
+ mClearFilterButton->setVisible(!mFilterEditor->getWText().empty());
+
+ LLUICtrl::draw();
+}
+
+void LLFilterEditor::onClearFilter(const LLSD& data)
+{
+ setText(LLStringUtil::null);
+ onCommit();
+}
+
diff --git a/indra/llui/llfiltereditor.h b/indra/llui/llfiltereditor.h
new file mode 100644
index 0000000000..4240fd770c
--- /dev/null
+++ b/indra/llui/llfiltereditor.h
@@ -0,0 +1,86 @@
+/**
+ * @file llfiltereditor.h
+ * @brief Text editor widget that represents a filter operation
+ *
+ * Features:
+ * Text entry of a single line (text, delete, left and right arrow, insert, return).
+ * Callbacks either on every keystroke or just on the return key.
+ * Focus (allow multiple text entry widgets)
+ * Clipboard (cut, copy, and paste)
+ * Horizontal scrolling to allow strings longer than widget size allows
+ * Pre-validation (limit which keys can be used)
+ * Optional line history so previous entries can be recalled by CTRL UP/DOWN
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-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 LL_FILTEREDITOR_H
+#define LL_FILTEREDITOR_H
+
+#include "lllineeditor.h"
+#include "llbutton.h"
+
+class LLFilterEditor : public LLUICtrl
+{
+public:
+ struct Params : public LLInitParam::Block<Params, LLLineEditor::Params>
+ {
+ Optional<LLButton::Params> clear_filter_button;
+
+ Params()
+ : clear_filter_button("clear_filter_button")
+ {
+ name = "filter_editor";
+ }
+ };
+
+protected:
+ LLFilterEditor(const Params&);
+ friend class LLUICtrlFactory;
+public:
+ virtual ~LLFilterEditor() {}
+
+ /*virtual*/ void draw();
+
+ void setText(const LLStringExplicit &new_text) { mFilterEditor->setText(new_text); }
+
+ // LLUICtrl interface
+ virtual void setValue(const LLSD& value );
+ virtual LLSD getValue() const;
+ virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text );
+ virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text );
+ virtual void clear();
+
+private:
+ void onClearFilter(const LLSD& data);
+
+ LLLineEditor* mFilterEditor;
+ LLButton* mClearFilterButton;
+};
+
+#endif // LL_FILTEREDITOR_H
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 153e025385..a397278a2b 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -71,15 +71,8 @@ std::string LLFloater::sButtonActiveImageNames[BUTTON_COUNT] =
"minimize.tga", //BUTTON_MINIMIZE
"tearoffbox.tga", //BUTTON_TEAR_OFF
"closebox.tga", //BUTTON_EDIT
-};
-
-std::string LLFloater::sButtonInactiveImageNames[BUTTON_COUNT] =
-{
- "close_inactive_blue.tga", //BUTTON_CLOSE
- "restore_inactive.tga", //BUTTON_RESTORE
- "minimize_inactive.tga", //BUTTON_MINIMIZE
- "tearoffbox.tga", //BUTTON_TEAR_OFF
- "close_inactive_blue.tga", //BUTTON_EDIT
+ "Icon_Dock_Foreground",
+ "Icon_Undock_Foreground"
};
std::string LLFloater::sButtonPressedImageNames[BUTTON_COUNT] =
@@ -89,6 +82,8 @@ std::string LLFloater::sButtonPressedImageNames[BUTTON_COUNT] =
"minimize_pressed.tga", //BUTTON_MINIMIZE
"tearoff_pressed.tga", //BUTTON_TEAR_OFF
"close_in_blue.tga", //BUTTON_EDIT
+ "Icon_Dock_Press",
+ "Icon_Undock_Press"
};
std::string LLFloater::sButtonNames[BUTTON_COUNT] =
@@ -98,6 +93,8 @@ std::string LLFloater::sButtonNames[BUTTON_COUNT] =
"llfloater_minimize_btn", //BUTTON_MINIMIZE
"llfloater_tear_off_btn", //BUTTON_TEAR_OFF
"llfloater_edit_btn", //BUTTON_EDIT
+ "llfloater_dock_btn",
+ "llfloater_undock_btn"
};
std::string LLFloater::sButtonToolTips[BUTTON_COUNT] = {};
@@ -114,6 +111,8 @@ std::string LLFloater::sButtonToolTipsIndex[BUTTON_COUNT]=
"BUTTON_MINIMIZE",//LLTrans::getString("BUTTON_MINIMIZE"), //"Minimize", //BUTTON_MINIMIZE
"BUTTON_TEAR_OFF",//LLTrans::getString("BUTTON_TEAR_OFF"), //"Tear Off", //BUTTON_TEAR_OFF
"BUTTON_EDIT", //LLTrans::getString("BUTTON_EDIT"), // "Edit", //BUTTON_EDIT
+ "BUTTON_DOCK",
+ "BUTTON_UNDOCK"
};
LLFloater::click_callback LLFloater::sButtonCallbacks[BUTTON_COUNT] =
@@ -123,6 +122,8 @@ LLFloater::click_callback LLFloater::sButtonCallbacks[BUTTON_COUNT] =
LLFloater::onClickMinimize, //BUTTON_MINIMIZE
LLFloater::onClickTearOff, //BUTTON_TEAR_OFF
LLFloater::onClickEdit, //BUTTON_EDIT
+ LLFloater::onClickDock,
+ LLFloater::onClickDock
};
LLMultiFloater* LLFloater::sHostp = NULL;
@@ -189,6 +190,29 @@ bool LLFloater::KeyCompare::equate(const LLSD& a, const LLSD& b)
//************************************
+LLFloater::Params::Params()
+: title("title"),
+ short_title("short_title"),
+ single_instance("single_instance", false),
+ auto_tile("auto_tile", false),
+ can_resize("can_resize", false),
+ can_minimize("can_minimize", true),
+ can_close("can_close", true),
+ can_drag_on_left("can_drag_on_left", false),
+ can_tear_off("can_tear_off", true),
+ save_rect("save_rect", false),
+ save_visibility("save_visibility", false),
+ open_callback("open_callback"),
+ close_callback("close_callback"),
+ can_dock("can_dock", false)
+{
+ name = "floater";
+ // defaults that differ from LLPanel:
+ background_visible = true;
+ visible = false;
+}
+
+
//static
const LLFloater::Params& LLFloater::getDefaultParams()
{
@@ -217,6 +241,8 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
mEditing(FALSE),
mButtonScale(1.0f),
mAutoFocus(TRUE), // automatically take focus when opened
+ mCanDock(false),
+ mDocked(false),
mHasBeenDraggedWhileMinimized(FALSE),
mPreviousMinimizedBottom(0),
mPreviousMinimizedLeft(0),
@@ -289,6 +315,11 @@ void LLFloater::initFloater()
mButtonsEnabled[BUTTON_MINIMIZE] = TRUE;
}
+ if(mCanDock)
+ {
+ mButtonsEnabled[BUTTON_DOCK] = TRUE;
+ }
+
buildButtons();
// Floaters are created in the invisible state
@@ -1305,6 +1336,36 @@ void LLFloater::setFrontmost(BOOL take_focus)
}
}
+void LLFloater::setCanDock(bool b)
+{
+ if(b != mCanDock)
+ {
+ mCanDock = b;
+ if(mCanDock)
+ {
+ mButtonsEnabled[BUTTON_DOCK] = !mDocked;
+ mButtonsEnabled[BUTTON_UNDOCK] = mDocked;
+ }
+ else
+ {
+ mButtonsEnabled[BUTTON_DOCK] = FALSE;
+ mButtonsEnabled[BUTTON_UNDOCK] = FALSE;
+ }
+ }
+ updateButtons();
+}
+
+void LLFloater::setDocked(bool docked, bool pop_on_undock)
+{
+ if(docked != mDocked && mCanDock)
+ {
+ mDocked = docked;
+ mButtonsEnabled[BUTTON_DOCK] = !mDocked;
+ mButtonsEnabled[BUTTON_UNDOCK] = mDocked;
+ updateButtons();
+ }
+}
+
//static
void LLFloater::setEditModeEnabled(BOOL enable)
{
@@ -1381,6 +1442,15 @@ void LLFloater::onClickEdit(LLFloater* self)
self->mEditing = self->mEditing ? FALSE : TRUE;
}
+// static
+void LLFloater::onClickDock(LLFloater* self)
+{
+ if(self && self->mCanDock)
+ {
+ self->setDocked(!self->mDocked, true);
+ }
+}
+
// static
LLFloater* LLFloater::getClosableFloaterFromFocus()
{
@@ -2522,6 +2592,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
setCanTearOff(p.can_tear_off);
setCanMinimize(p.can_minimize);
setCanClose(p.can_close);
+ setCanDock(p.can_dock);
mDragOnLeft = p.can_drag_on_left;
mResizable = p.can_resize;
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index b1d33f48e9..f6c6dcf277 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -102,6 +102,8 @@ public:
BUTTON_MINIMIZE,
BUTTON_TEAR_OFF,
BUTTON_EDIT,
+ BUTTON_DOCK,
+ BUTTON_UNDOCK,
BUTTON_COUNT
};
@@ -120,7 +122,7 @@ public:
{
Optional<close_callback_t> function;
};
-
+
struct Params
: public LLInitParam::Block<Params, LLPanel::Params>
{
@@ -135,31 +137,13 @@ public:
can_drag_on_left,
can_tear_off,
save_rect,
- save_visibility;
+ save_visibility,
+ can_dock;
Optional<OpenCallbackParam> open_callback;
Optional<CloseCallbackParam> close_callback;
- Params() :
- title("title"),
- short_title("short_title"),
- single_instance("single_instance", false),
- auto_tile("auto_tile", false),
- can_resize("can_resize", false),
- can_minimize("can_minimize", true),
- can_close("can_close", true),
- can_drag_on_left("can_drag_on_left", false),
- can_tear_off("can_tear_off", true),
- save_rect("save_rect", false),
- save_visibility("save_visibility", false),
- open_callback("open_callback"),
- close_callback("close_callback")
- {
- name = "floater";
- // defaults that differ from LLPanel:
- background_visible = true;
- visible = false;
- }
+ Params();
};
// use this to avoid creating your own default LLFloater::Param instance
@@ -267,6 +251,12 @@ public:
const LLSD& getKey() { return mKey; }
BOOL matchesKey(const LLSD& key) { return mSingleInstance || KeyCompare::equate(key, mKey); }
+ bool isDockable() const { return mCanDock; }
+ void setCanDock(bool b);
+
+ bool isDocked() const { return mDocked; }
+ virtual void setDocked(bool docked, bool pop_on_undock = true);
+
// Return a closeable floater, if any, given the current focus.
static LLFloater* getClosableFloaterFromFocus();
@@ -283,6 +273,7 @@ public:
static void onClickMinimize(LLFloater* floater);
static void onClickTearOff(LLFloater* floater);
static void onClickEdit(LLFloater* floater);
+ static void onClickDock(LLFloater* floater);
static void setFloaterHost(LLMultiFloater* hostp) {sHostp = hostp; }
static void setEditModeEnabled(BOOL enable);
@@ -378,11 +369,13 @@ private:
LLHandle<LLFloater> mHostHandle;
LLHandle<LLFloater> mLastHostHandle;
+ bool mCanDock;
+ bool mDocked;
+
static LLMultiFloater* sHostp;
static BOOL sEditModeEnabled;
static BOOL sQuitting;
static std::string sButtonActiveImageNames[BUTTON_COUNT];
- static std::string sButtonInactiveImageNames[BUTTON_COUNT];
static std::string sButtonPressedImageNames[BUTTON_COUNT];
static std::string sButtonNames[BUTTON_COUNT];
static std::string sButtonToolTips[BUTTON_COUNT];
diff --git a/indra/llui/llhandle.h b/indra/llui/llhandle.h
new file mode 100644
index 0000000000..10a7fd4544
--- /dev/null
+++ b/indra/llui/llhandle.h
@@ -0,0 +1,171 @@
+/**
+* @file llhandle.h
+* @brief "Handle" to an object (usually a floater) whose lifetime you don't
+* control.
+*
+* $LicenseInfo:firstyear=2001&license=viewergpl$
+*
+* Copyright (c) 2001-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 LLHANDLE_H
+#define LLHANDLE_H
+
+#include "llpointer.h"
+
+template <typename T>
+class LLTombStone : public LLRefCount
+{
+public:
+ LLTombStone(T* target = NULL) : mTarget(target) {}
+
+ void setTarget(T* target) { mTarget = target; }
+ T* getTarget() const { return mTarget; }
+private:
+ T* mTarget;
+};
+
+// LLHandles are used to refer to objects whose lifetime you do not control or influence.
+// Calling get() on a handle will return a pointer to the referenced object or NULL,
+// if the object no longer exists. Note that during the lifetime of the returned pointer,
+// you are assuming that the object will not be deleted by any action you perform,
+// or any other thread, as normal when using pointers, so avoid using that pointer outside of
+// the local code block.
+//
+// https://wiki.lindenlab.com/mediawiki/index.php?title=LLHandle&oldid=79669
+
+template <typename T>
+class LLHandle
+{
+public:
+ LLHandle() : mTombStone(sDefaultTombStone) {}
+ const LLHandle<T>& operator =(const LLHandle<T>& other)
+ {
+ mTombStone = other.mTombStone;
+ return *this;
+ }
+
+ bool isDead() const
+ {
+ return mTombStone->getTarget() == NULL;
+ }
+
+ void markDead()
+ {
+ mTombStone = sDefaultTombStone;
+ }
+
+ T* get() const
+ {
+ return mTombStone->getTarget();
+ }
+
+ friend bool operator== (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
+ {
+ return lhs.mTombStone == rhs.mTombStone;
+ }
+ friend bool operator!= (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
+ {
+ return !(lhs == rhs);
+ }
+ friend bool operator< (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
+ {
+ return lhs.mTombStone < rhs.mTombStone;
+ }
+ friend bool operator> (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
+ {
+ return lhs.mTombStone > rhs.mTombStone;
+ }
+protected:
+
+protected:
+ LLPointer<LLTombStone<T> > mTombStone;
+
+private:
+ static LLPointer<LLTombStone<T> > sDefaultTombStone;
+};
+
+// initialize static "empty" tombstone pointer
+template <typename T> LLPointer<LLTombStone<T> > LLHandle<T>::sDefaultTombStone = new LLTombStone<T>();
+
+
+template <typename T>
+class LLRootHandle : public LLHandle<T>
+{
+public:
+ LLRootHandle(T* object) { bind(object); }
+ LLRootHandle() {};
+ ~LLRootHandle() { unbind(); }
+
+ // this is redundant, since a LLRootHandle *is* an LLHandle
+ LLHandle<T> getHandle() { return LLHandle<T>(*this); }
+
+ void bind(T* object)
+ {
+ // unbind existing tombstone
+ if (LLHandle<T>::mTombStone.notNull())
+ {
+ if (LLHandle<T>::mTombStone->getTarget() == object) return;
+ LLHandle<T>::mTombStone->setTarget(NULL);
+ }
+ // tombstone reference counted, so no paired delete
+ LLHandle<T>::mTombStone = new LLTombStone<T>(object);
+ }
+
+ void unbind()
+ {
+ LLHandle<T>::mTombStone->setTarget(NULL);
+ }
+
+ //don't allow copying of root handles, since there should only be one
+private:
+ LLRootHandle(const LLRootHandle& other) {};
+};
+
+// Use this as a mixin for simple classes that need handles and when you don't
+// want handles at multiple points of the inheritance hierarchy
+template <typename T>
+class LLHandleProvider
+{
+protected:
+ typedef LLHandle<T> handle_type_t;
+ LLHandleProvider()
+ {
+ // provided here to enforce T deriving from LLHandleProvider<T>
+ }
+
+ LLHandle<T> getHandle()
+ {
+ // perform lazy binding to avoid small tombstone allocations for handle
+ // providers whose handles are never referenced
+ mHandle.bind(static_cast<T*>(this));
+ return mHandle;
+ }
+
+private:
+ LLRootHandle<T> mHandle;
+};
+
+#endif
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index f1e7d791d4..702d8e4a39 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -120,7 +120,8 @@ struct LLLayoutStack::LayoutPanel
LLLayoutStack::Params::Params()
: orientation("orientation", std::string("vertical")),
- animate("animate", TRUE),
+ animate("animate", true),
+ clip("clip", true),
border_size("border_size", LLCachedControl<S32>(*LLUI::sSettingGroups["config"], "UIResizeBarHeight", 0))
{
name="stack";
@@ -132,7 +133,8 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p)
mMinHeight(0),
mPanelSpacing(p.border_size),
mOrientation((p.orientation() == "vertical") ? VERTICAL : HORIZONTAL),
- mAnimate(p.animate)
+ mAnimate(p.animate),
+ mClip(p.clip)
{}
LLLayoutStack::~LLLayoutStack()
@@ -163,7 +165,7 @@ void LLLayoutStack::draw()
LLPanel* panelp = (*panel_it)->mPanel;
- LLLocalClipRect clip(clip_rect);
+ LLLocalClipRect clip(clip_rect, mClip);
// only force drawing invisible children if visible amount is non-zero
drawChild(panelp, 0, 0, !clip_rect.isNull());
}
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index 480bdb5c17..9459b9990c 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -43,7 +43,8 @@ public:
{
Optional<std::string> orientation;
Optional<S32> border_size;
- Optional<bool> animate;
+ Optional<bool> animate;
+ Optional<bool> clip;
// mMinWidth and mMinHeight are calculated, not set in XML
Params();
@@ -100,6 +101,7 @@ private:
S32 mPanelSpacing;
bool mAnimate;
+ bool mClip;
}; // end class LLLayoutStack
#endif
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 43c22cbf5d..f94eb7fcc3 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -91,7 +91,11 @@ void LLLineEditor::PrevalidateNamedFuncs::declareValues()
LLLineEditor::Params::Params()
: max_length_bytes("max_length", 254),
+ keystroke_callback("keystroke_callback"),
+ prevalidate_callback("prevalidate_callback"),
background_image("background_image"),
+ background_image_disabled("background_image_disabled"),
+ background_image_focused("background_image_focused"),
select_on_focus("select_on_focus", false),
handle_edit_keys_directly("handle_edit_keys_directly", false),
commit_on_focus_lost("commit_on_focus_lost", true),
@@ -100,9 +104,8 @@ LLLineEditor::Params::Params()
text_color("text_color"),
text_readonly_color("text_readonly_color"),
text_tentative_color("text_tentative_color"),
- bg_readonly_color("bg_readonly_color"),
- bg_writeable_color("bg_writeable_color"),
- bg_focus_color("bg_focus_color"),
+ highlight_color("highlight_color"),
+ preedit_bg_color("preedit_bg_color"),
border(""),
is_unicode("is_unicode"),
drop_shadow_visible("drop_shadow_visible"),
@@ -145,18 +148,18 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
mSelectAllonFocusReceived( p.select_on_focus ),
mPassDelete(FALSE),
mReadOnly(FALSE),
- mImage( NULL ),
+ mBgImage( p.background_image ),
+ mBgImageDisabled( p.background_image_disabled ),
+ mBgImageFocused( p.background_image_focused ),
mReplaceNewlinesWithSpaces( TRUE ),
mLabel(p.label),
mCursorColor(p.cursor_color()),
mFgColor(p.text_color()),
mReadOnlyFgColor(p.text_readonly_color()),
mTentativeFgColor(p.text_tentative_color()),
- mWriteableBgColor(p.bg_writeable_color()),
- mReadOnlyBgColor(p.bg_readonly_color()),
- mFocusBgColor(p.bg_focus_color()),
- mGLFont(p.font),
- mGLFontStyle(LLFontGL::getStyleFromString(p.font.style))
+ mHighlightColor(p.highlight_color()),
+ mPreeditBgColor(p.preedit_bg_color()),
+ mGLFont(p.font)
{
llassert( mMaxLengthBytes > 0 );
@@ -183,11 +186,6 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
mBorder = LLUICtrlFactory::create<LLViewBorder>(border_p);
addChild( mBorder );
- if(p.background_image.isProvided())
- {
- mImage = p.background_image;
- }
-
// clamp text padding to current editor size
updateTextPadding();
setCursor(mText.length());
@@ -237,6 +235,7 @@ void LLLineEditor::onFocusLost()
LLUICtrl::onFocusLost();
}
+// virtual
void LLLineEditor::onCommit()
{
// put current line into the line history
@@ -247,6 +246,33 @@ void LLLineEditor::onCommit()
selectAll();
}
+// Returns TRUE if user changed value at all
+// virtual
+BOOL LLLineEditor::isDirty() const
+{
+ return mText.getString() != mPrevText;
+}
+
+// Clear dirty state
+// virtual
+void LLLineEditor::resetDirty()
+{
+ mPrevText = mText.getString();
+}
+
+// assumes UTF8 text
+// virtual
+void LLLineEditor::setValue(const LLSD& value )
+{
+ setText(value.asString());
+}
+
+//virtual
+LLSD LLLineEditor::getValue() const
+{
+ return LLSD(getText());
+}
+
// line history support
void LLLineEditor::updateHistory()
@@ -1497,6 +1523,33 @@ void LLLineEditor::doDelete()
}
+void LLLineEditor::drawBackground()
+{
+ bool has_focus = hasFocus();
+ LLUIImage* image;
+ if ( mReadOnly )
+ {
+ image = mBgImageDisabled;
+ }
+ else if ( has_focus )
+ {
+ image = mBgImageFocused;
+ }
+ else
+ {
+ image = mBgImage;
+ }
+
+ // optionally draw programmatic border
+ if (has_focus)
+ {
+ image->drawBorder(0, 0, getRect().getWidth(), getRect().getHeight(),
+ gFocusMgr.getFocusColor(),
+ gFocusMgr.getFocusFlashWidth());
+ }
+ image->draw(getLocalRect());
+}
+
void LLLineEditor::draw()
{
S32 text_len = mText.length();
@@ -1527,34 +1580,8 @@ void LLLineEditor::draw()
LLRect background( 0, getRect().getHeight(), getRect().getWidth(), 0 );
background.stretch( -mBorderThickness );
- LLColor4 bg_color = mReadOnlyBgColor.get();
-
-#if 1 // for when we're ready for image art.
- if( hasFocus())
- {
- mImage->drawBorder(0, 0, getRect().getWidth(), getRect().getHeight(), gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth());
- }
- mImage->draw(getLocalRect());
-#else // the old programmer art.
- // drawing solids requires texturing be disabled
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- // draw background for text
- if( !mReadOnly )
- {
- if( gFocusMgr.getKeyboardFocus() == this )
- {
- bg_color = mFocusBgColor.get();
- }
- else
- {
- bg_color = mWriteableBgColor.get();
- }
- }
- gl_rect_2d(background, bg_color);
- }
-#endif
-
+ drawBackground();
+
// draw text
// With viewer-2 art files, input region is 2 pixels up
@@ -1600,7 +1627,8 @@ void LLLineEditor::draw()
background.mBottom + preedit_standout_position,
preedit_pixels_right - preedit_standout_gap - 1,
background.mBottom + preedit_standout_position - preedit_standout_thickness,
- (text_color * preedit_standout_brightness + bg_color * (1 - preedit_standout_brightness)).setAlpha(1.0f));
+ (text_color * preedit_standout_brightness
+ + mPreeditBgColor * (1 - preedit_standout_brightness)).setAlpha(1.0f));
}
else
{
@@ -1608,7 +1636,8 @@ void LLLineEditor::draw()
background.mBottom + preedit_marker_position,
preedit_pixels_right - preedit_marker_gap - 1,
background.mBottom + preedit_marker_position - preedit_marker_thickness,
- (text_color * preedit_marker_brightness + bg_color * (1 - preedit_marker_brightness)).setAlpha(1.0f));
+ (text_color * preedit_marker_brightness
+ + mPreeditBgColor * (1 - preedit_marker_brightness)).setAlpha(1.0f));
}
}
}
@@ -1641,7 +1670,7 @@ void LLLineEditor::draw()
rendered_pixels_right, text_bottom,
text_color,
LLFontGL::LEFT, LLFontGL::BOTTOM,
- mGLFontStyle,
+ 0,
LLFontGL::NO_SHADOW,
select_left - mScrollHPos,
mMaxHPixels - llround(rendered_pixels_right),
@@ -1650,7 +1679,7 @@ void LLLineEditor::draw()
if( (rendered_pixels_right < (F32)mMaxHPixels) && (rendered_text < text_len) )
{
- LLColor4 color(1.f - bg_color.mV[0], 1.f - bg_color.mV[1], 1.f - bg_color.mV[2], 1.f);
+ LLColor4 color = mHighlightColor;
// 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));
@@ -1661,7 +1690,7 @@ void LLLineEditor::draw()
rendered_pixels_right, text_bottom,
LLColor4( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], 1 ),
LLFontGL::LEFT, LLFontGL::BOTTOM,
- mGLFontStyle,
+ 0,
LLFontGL::NO_SHADOW,
select_right - mScrollHPos - rendered_text,
mMaxHPixels - llround(rendered_pixels_right),
@@ -1676,7 +1705,7 @@ void LLLineEditor::draw()
rendered_pixels_right, text_bottom,
text_color,
LLFontGL::LEFT, LLFontGL::BOTTOM,
- mGLFontStyle,
+ 0,
LLFontGL::NO_SHADOW,
S32_MAX,
mMaxHPixels - llround(rendered_pixels_right),
@@ -1690,7 +1719,7 @@ void LLLineEditor::draw()
rendered_pixels_right, text_bottom,
text_color,
LLFontGL::LEFT, LLFontGL::BOTTOM,
- mGLFontStyle,
+ 0,
LLFontGL::NO_SHADOW,
S32_MAX,
mMaxHPixels - llround(rendered_pixels_right),
@@ -1728,7 +1757,7 @@ void LLLineEditor::draw()
mGLFont->render(mText, getCursor(), (F32)(cursor_left + lineeditor_cursor_thickness / 2), text_bottom,
LLColor4( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], 1 ),
LLFontGL::LEFT, LLFontGL::BOTTOM,
- mGLFontStyle,
+ 0,
LLFontGL::NO_SHADOW,
1);
}
@@ -1754,7 +1783,7 @@ void LLLineEditor::draw()
label_color,
LLFontGL::LEFT,
LLFontGL::BOTTOM,
- mGLFontStyle,
+ 0,
LLFontGL::NO_SHADOW,
S32_MAX,
mMaxHPixels - llround(rendered_pixels_right),
@@ -1779,7 +1808,7 @@ void LLLineEditor::draw()
label_color,
LLFontGL::LEFT,
LLFontGL::BOTTOM,
- mGLFontStyle,
+ 0,
LLFontGL::NO_SHADOW,
S32_MAX,
mMaxHPixels - llround(rendered_pixels_right),
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index 4362cff2fe..0986ce5a87 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -84,7 +84,9 @@ public:
Optional<LLViewBorder::Params> border;
- Optional<LLUIImage*> background_image;
+ Optional<LLUIImage*> background_image,
+ background_image_disabled,
+ background_image_focused;
Optional<bool> select_on_focus,
handle_edit_keys_directly,
@@ -96,10 +98,9 @@ public:
text_color,
text_readonly_color,
text_tentative_color,
- bg_readonly_color,
- bg_writeable_color,
- bg_focus_color;
-
+ highlight_color,
+ preedit_bg_color;
+
Optional<S32> text_pad_left,
text_pad_right;
@@ -107,7 +108,7 @@ public:
drop_shadow_visible,
border_drop_shadow_visible,
bg_visible;
-
+
Params();
};
protected:
@@ -163,12 +164,12 @@ public:
virtual void setRect(const LLRect& rect);
virtual BOOL acceptsTextInput() const;
virtual void onCommit();
- virtual BOOL isDirty() const { return mText.getString() != mPrevText; } // Returns TRUE if user changed value at all
- virtual void resetDirty() { mPrevText = mText.getString(); } // Clear dirty state
+ virtual BOOL isDirty() const; // Returns TRUE if user changed value at all
+ virtual void resetDirty(); // Clear dirty state
// assumes UTF8 text
- virtual void setValue(const LLSD& value ) { setText(value.asString()); }
- virtual LLSD getValue() const { return LLSD(getText()); }
+ virtual void setValue(const LLSD& value );
+ virtual LLSD getValue() const;
virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text );
virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text );
@@ -197,16 +198,10 @@ public:
void setFgColor( const LLColor4& c ) { mFgColor = c; }
void setReadOnlyFgColor( const LLColor4& c ) { mReadOnlyFgColor = c; }
void setTentativeFgColor(const LLColor4& c) { mTentativeFgColor = c; }
- void setWriteableBgColor( const LLColor4& c ) { mWriteableBgColor = c; }
- void setReadOnlyBgColor( const LLColor4& c ) { mReadOnlyBgColor = c; }
- void setFocusBgColor(const LLColor4& c) { mFocusBgColor = c; }
const LLColor4& getFgColor() const { return mFgColor.get(); }
const LLColor4& getReadOnlyFgColor() const { return mReadOnlyFgColor.get(); }
const LLColor4& getTentativeFgColor() const { return mTentativeFgColor.get(); }
- const LLColor4& getWriteableBgColor() const { return mWriteableBgColor.get(); }
- const LLColor4& getReadOnlyBgColor() const { return mReadOnlyBgColor.get(); }
- const LLColor4& getFocusBgColor() const { return mFocusBgColor.get(); }
void setIgnoreArrowKeys(BOOL b) { mIgnoreArrowKeys = b; }
void setIgnoreTab(BOOL b) { mIgnoreTab = b; }
@@ -266,6 +261,9 @@ private:
BOOL handleControlKey(KEY key, MASK mask);
S32 handleCommitKey(KEY key, MASK mask);
void updateTextPadding();
+
+ // Draw the background image depending on enabled/focused state.
+ void drawBackground();
//
// private data members
@@ -294,7 +292,6 @@ protected:
LLViewBorder* mBorder;
const LLFontGL* mGLFont;
- U8 mGLFontStyle;
S32 mMaxLengthBytes; // Max length of the UTF8 string in bytes
S32 mCursorPos; // I-beam is just after the mCursorPos-th character.
S32 mScrollHPos; // Horizontal offset from the start of mText. Used for scrolling.
@@ -326,9 +323,8 @@ protected:
LLUIColor mFgColor;
LLUIColor mReadOnlyFgColor;
LLUIColor mTentativeFgColor;
- LLUIColor mWriteableBgColor;
- LLUIColor mReadOnlyBgColor;
- LLUIColor mFocusBgColor;
+ LLUIColor mHighlightColor; // background for selected text
+ LLUIColor mPreeditBgColor; // preedit marker background color
S32 mBorderThickness;
@@ -349,7 +345,9 @@ protected:
private:
// Instances that by default point to the statics but can be overidden in XML.
- LLPointer<LLUIImage> mImage;
+ LLPointer<LLUIImage> mBgImage;
+ LLPointer<LLUIImage> mBgImageDisabled;
+ LLPointer<LLUIImage> mBgImageFocused;
BOOL mReplaceNewlinesWithSpaces; // if false, will replace pasted newlines with paragraph symbol.
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index ade88d2714..fdb4bdd5c1 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -49,12 +49,12 @@
#include "llmath.h"
#include "llrender.h"
#include "llfocusmgr.h"
-#include "llfont.h"
#include "llcoord.h"
#include "llwindow.h"
#include "llcriticaldamp.h"
#include "lluictrlfactory.h"
+#include "llbutton.h"
#include "llfontgl.h"
#include "llresmgr.h"
#include "llui.h"
@@ -1453,6 +1453,7 @@ void LLMenuItemBranchDownGL::draw( void )
setHover(FALSE);
}
+
class LLMenuScrollItem : public LLMenuItemCallGL
{
public:
@@ -1461,10 +1462,18 @@ public:
ARROW_DOWN,
ARROW_UP
};
+ struct ArrowTypes : public LLInitParam::TypeValuesHelper<EArrowType, ArrowTypes>
+ {
+ static void declareValues()
+ {
+ declare("up", ARROW_UP);
+ declare("down", ARROW_DOWN);
+ }
+ };
struct Params : public LLInitParam::Block<Params, LLMenuItemCallGL::Params>
{
- Optional<EArrowType> arrow_type;
+ Optional<EArrowType, ArrowTypes> arrow_type;
Optional<CommitCallbackParam> scroll_callback;
};
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index 7d5cc25e1e..262f75f1e1 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -380,6 +380,7 @@ public:
Params()
: jump_key("jump_key", KEY_NONE),
+ horizontal_layout("horizontal_layout"),
can_tear_off("tear_off", false),
drop_shadow("drop_shadow", true),
bg_visible("bg_visible", true),
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 50fee41029..2b6ae1f67e 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -384,7 +384,7 @@ LLNotificationTemplate::LLNotificationTemplate() :
}
LLNotification::LLNotification(const LLNotification::Params& p) :
- mTimestamp(p.timestamp),
+ mTimestamp(p.time_stamp),
mSubstitutions(p.substitutions),
mPayload(p.payload),
mExpiresAt(0),
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index 512886790c..63eae7278f 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -294,7 +294,7 @@ public:
Optional<LLSD> payload;
Optional<ENotificationPriority> priority;
Optional<LLSD> form_elements;
- Optional<LLDate> timestamp;
+ Optional<LLDate> time_stamp;
Optional<LLNotificationContext*> context;
struct Functor : public LLInitParam::Choice<Functor>
@@ -312,19 +312,23 @@ public:
Params()
: name("name"),
priority("priority", NOTIFICATION_PRIORITY_UNSPECIFIED),
- timestamp("time_stamp")
+ time_stamp("time_stamp"),
+ payload("payload"),
+ form_elements("form_elements")
{
- timestamp = LLDate::now();
+ time_stamp = LLDate::now();
}
Params(const std::string& _name)
- : name("name"),
- priority("priority", NOTIFICATION_PRIORITY_UNSPECIFIED),
- timestamp("time_stamp")
+ : name("name"),
+ priority("priority", NOTIFICATION_PRIORITY_UNSPECIFIED),
+ time_stamp("time_stamp"),
+ payload("payload"),
+ form_elements("form_elements")
{
functor.name = _name;
name = _name;
- timestamp = LLDate::now();
+ time_stamp = LLDate::now();
}
};
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 116096b7b3..9fb38bc316 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -43,6 +43,7 @@
#include "llerror.h"
#include "lltimer.h"
+#include "llbutton.h"
#include "llmenugl.h"
//#include "llstatusbar.h"
#include "llui.h"
@@ -53,7 +54,6 @@
#include "lluictrl.h"
#include "lluictrlfactory.h"
#include "llviewborder.h"
-#include "llbutton.h"
#include "lltabcontainer.h"
static LLDefaultChildRegistry::Register<LLPanel> r1("panel", &LLPanel::fromXML);
@@ -65,6 +65,7 @@ const LLPanel::Params& LLPanel::getDefaultParams()
LLPanel::Params::Params()
: has_border("border", false),
+ border(""),
bg_opaque_color("bg_opaque_color"),
bg_alpha_color("bg_alpha_color"),
background_visible("background_visible", false),
@@ -430,7 +431,7 @@ void LLPanel::initFromParams(const LLPanel::Params& p)
it != p.strings().end();
++it)
{
- mUIStrings[it->name] = it->text;
+ mUIStrings[it->name] = it->value;
}
setLabel(p.label());
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index 381cba2db3..4140e3aa93 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -37,8 +37,6 @@
#include "llcallbackmap.h"
#include "lluictrl.h"
-#include "llbutton.h"
-#include "lllineeditor.h"
#include "llviewborder.h"
#include "lluistring.h"
#include "v4color.h"
@@ -49,6 +47,7 @@ const S32 LLPANEL_BORDER_WIDTH = 1;
const BOOL BORDER_YES = TRUE;
const BOOL BORDER_NO = FALSE;
+class LLButton;
/*
* General purpose concrete view base class.
@@ -62,11 +61,11 @@ public:
struct LocalizedString : public LLInitParam::Block<LocalizedString>
{
Mandatory<std::string> name;
- Mandatory<std::string> text;
+ Mandatory<std::string> value;
LocalizedString()
: name("name"),
- text("value")
+ value("value")
{}
};
diff --git a/indra/llui/llprogressbar.cpp b/indra/llui/llprogressbar.cpp
index 7a34cc6792..c8b6e814e1 100644
--- a/indra/llui/llprogressbar.cpp
+++ b/indra/llui/llprogressbar.cpp
@@ -50,10 +50,7 @@ static LLDefaultChildRegistry::Register<LLProgressBar> r("progress_bar");
LLProgressBar::Params::Params()
: image_bar("image_bar"),
image_fill("image_fill"),
- image_shadow("image_shadow"),
color_bar("color_bar"),
- color_bar2("color_bar2"),
- color_shadow("color_shadow"),
color_bg("color_bg")
{}
@@ -61,12 +58,9 @@ LLProgressBar::Params::Params()
LLProgressBar::LLProgressBar(const LLProgressBar::Params& p)
: LLView(p),
mImageBar(p.image_bar),
- mImageShadow(p.image_shadow),
mImageFill(p.image_fill),
mColorBackground(p.color_bg()),
mColorBar(p.color_bar()),
- mColorBar2(p.color_bar2()),
- mColorShadow(p.color_shadow()),
mPercentDone(0.f)
{}
@@ -85,10 +79,10 @@ void LLProgressBar::draw()
F32 alpha = 0.5f + 0.5f*0.5f*(1.f + (F32)sin(3.f*timer.getElapsedTimeF32()));
LLColor4 bar_color = mColorBar.get();
- bar_color.mV[3] = alpha;
+ bar_color.mV[VALPHA] *= alpha; // modulate alpha
LLRect progress_rect = getLocalRect();
progress_rect.mRight = llround(getRect().getWidth() * (mPercentDone / 100.f));
- mImageFill->draw(progress_rect);
+ mImageFill->draw(progress_rect, bar_color);
}
void LLProgressBar::setPercent(const F32 percent)
diff --git a/indra/llui/llprogressbar.h b/indra/llui/llprogressbar.h
index 5c2f73ef9e..b6a5b0400d 100644
--- a/indra/llui/llprogressbar.h
+++ b/indra/llui/llprogressbar.h
@@ -43,12 +43,9 @@ public:
struct Params : public LLInitParam::Block<Params, LLView::Params>
{
Optional<LLUIImage*> image_bar,
- image_fill,
- image_shadow;
+ image_fill;
Optional<LLUIColor> color_bar,
- color_bar2,
- color_shadow,
color_bg;
Params();
@@ -65,10 +62,7 @@ private:
LLPointer<LLUIImage> mImageBar;
LLUIColor mColorBar;
- LLUIColor mColorBar2;
- LLPointer<LLUIImage> mImageShadow;
- LLUIColor mColorShadow;
LLUIColor mColorBackground;
LLPointer<LLUIImage> mImageFill;
diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp
index 90f51b9919..7449c339a0 100644
--- a/indra/llui/llresizehandle.cpp
+++ b/indra/llui/llresizehandle.cpp
@@ -45,7 +45,9 @@
const S32 RESIZE_BORDER_WIDTH = 3;
LLResizeHandle::Params::Params()
-: corner("corner")
+: corner("corner"),
+ min_width("min_width"),
+ min_height("min_height")
{
name = "resize_handle";
}
diff --git a/indra/llui/llrngwriter.cpp b/indra/llui/llrngwriter.cpp
new file mode 100644
index 0000000000..cf23e3af15
--- /dev/null
+++ b/indra/llui/llrngwriter.cpp
@@ -0,0 +1,315 @@
+/**
+ * @file llrngwriter.cpp
+ * @brief Generates Relax NG schema from param blocks
+ *
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ *
+ * Copyright (c) 2003-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 "llrngwriter.h"
+#include "lluicolor.h"
+#include "lluictrlfactory.h"
+
+//
+// LLRNGWriter - writes Relax NG schema files based on a param block
+//
+LLRNGWriter::LLRNGWriter()
+{
+ // register various callbacks for inspecting the contents of a param block
+ registerInspectFunc<bool>(boost::bind(&LLRNGWriter::writeAttribute, this, "boolean", _1, _2, _3, _4));
+ registerInspectFunc<std::string>(boost::bind(&LLRNGWriter::writeAttribute, this, "string", _1, _2, _3, _4));
+ registerInspectFunc<U8>(boost::bind(&LLRNGWriter::writeAttribute, this, "unsignedByte", _1, _2, _3, _4));
+ registerInspectFunc<S8>(boost::bind(&LLRNGWriter::writeAttribute, this, "signedByte", _1, _2, _3, _4));
+ registerInspectFunc<U16>(boost::bind(&LLRNGWriter::writeAttribute, this, "unsignedShort", _1, _2, _3, _4));
+ registerInspectFunc<S16>(boost::bind(&LLRNGWriter::writeAttribute, this, "signedShort", _1, _2, _3, _4));
+ registerInspectFunc<U32>(boost::bind(&LLRNGWriter::writeAttribute, this, "unsignedInt", _1, _2, _3, _4));
+ registerInspectFunc<S32>(boost::bind(&LLRNGWriter::writeAttribute, this, "integer", _1, _2, _3, _4));
+ registerInspectFunc<F32>(boost::bind(&LLRNGWriter::writeAttribute, this, "float", _1, _2, _3, _4));
+ registerInspectFunc<F64>(boost::bind(&LLRNGWriter::writeAttribute, this, "double", _1, _2, _3, _4));
+ registerInspectFunc<LLColor4>(boost::bind(&LLRNGWriter::writeAttribute, this, "string", _1, _2, _3, _4));
+ registerInspectFunc<LLUIColor>(boost::bind(&LLRNGWriter::writeAttribute, this, "string", _1, _2, _3, _4));
+ registerInspectFunc<LLUUID>(boost::bind(&LLRNGWriter::writeAttribute, this, "string", _1, _2, _3, _4));
+ registerInspectFunc<LLSD>(boost::bind(&LLRNGWriter::writeAttribute, this, "string", _1, _2, _3, _4));
+}
+
+void LLRNGWriter::writeRNG(const std::string& type_name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace)
+{
+ mGrammarNode = node;
+ mGrammarNode->setName("grammar");
+ mGrammarNode->createChild("xmlns", true)->setStringValue("http://relaxng.org/ns/structure/1.0");
+ mGrammarNode->createChild("datatypeLibrary", true)->setStringValue("http://www.w3.org/2001/XMLSchema-datatypes");
+ mGrammarNode->createChild("ns", true)->setStringValue(xml_namespace);
+
+ node = mGrammarNode->createChild("start", false);
+ node = node->createChild("ref", false);
+ node->createChild("name", true)->setStringValue(type_name);
+
+ addDefinition(type_name, block);
+}
+
+void LLRNGWriter::addDefinition(const std::string& type_name, const LLInitParam::BaseBlock& block)
+{
+ if (mDefinedElements.find(type_name) != mDefinedElements.end()) return;
+ mDefinedElements.insert(type_name);
+
+ LLXMLNodePtr node = mGrammarNode->createChild("define", false);
+ node->createChild("name", true)->setStringValue(type_name);
+
+ mElementNode = node->createChild("element", false);
+ mElementNode->createChild("name", true)->setStringValue(type_name);
+ mChildrenNode = mElementNode->createChild("zeroOrMore", false)->createChild("choice", false);
+
+ mAttributesWritten.first = mElementNode;
+ mAttributesWritten.second.clear();
+ mElementsWritten.clear();
+
+ block.inspectBlock(*this);
+
+ // add includes for all possible children
+ const std::type_info* type = *LLWidgetTypeRegistry::instance().getValue(type_name);
+ const widget_registry_t* widget_registryp = LLChildRegistryRegistry::instance().getValue(type);
+
+ // add include declarations for all valid children
+ for (widget_registry_t::Registrar::registry_map_t::const_iterator it = widget_registryp->currentRegistrar().beginItems();
+ it != widget_registryp->currentRegistrar().endItems();
+ ++it)
+ {
+ std::string child_name = it->first;
+ if (child_name == type_name)
+ {
+ continue;
+ }
+
+ LLXMLNodePtr old_element_node = mElementNode;
+ LLXMLNodePtr old_child_node = mChildrenNode;
+ addDefinition(child_name, (*LLDefaultParamBlockRegistry::instance().getValue(type))());
+ mElementNode = old_element_node;
+ mChildrenNode = old_child_node;
+
+ mChildrenNode->createChild("ref", false)->createChild("name", true)->setStringValue(child_name);
+ }
+
+ if (mChildrenNode->mChildren.isNull())
+ {
+ // remove unused children node
+ mChildrenNode->mParent->mParent->deleteChild(mChildrenNode->mParent);
+ }
+}
+
+void LLRNGWriter::writeAttribute(const std::string& type, const Parser::name_stack_t& stack, S32 min_count, S32 max_count, const std::vector<std::string>* possible_values)
+{
+ if (max_count == 0) return;
+
+ name_stack_t non_empty_names;
+ std::string attribute_name;
+ for (name_stack_t::const_iterator it = stack.begin();
+ it != stack.end();
+ ++it)
+ {
+ const std::string& name = it->first;
+ if (!name.empty())
+ {
+ non_empty_names.push_back(*it);
+ }
+ }
+
+ if (non_empty_names.empty()) return;
+
+ for (name_stack_t::const_iterator it = non_empty_names.begin();
+ it != non_empty_names.end();
+ ++it)
+ {
+ if (!attribute_name.empty())
+ {
+ attribute_name += ".";
+ }
+ attribute_name += it->first;
+ }
+
+ // singular attribute, e.g. <foo bar="1"/>
+ if (non_empty_names.size() == 1 && max_count == 1)
+ {
+ if (mAttributesWritten.second.find(attribute_name) == mAttributesWritten.second.end())
+ {
+ LLXMLNodePtr node = createCardinalityNode(mElementNode, min_count, max_count)->createChild("attribute", false);
+ node->createChild("name", true)->setStringValue(attribute_name);
+ node->createChild("data", false)->createChild("type", true)->setStringValue(type);
+
+ mAttributesWritten.second.insert(attribute_name);
+ }
+ }
+ // compound attribute
+ else
+ {
+ std::string element_name;
+
+ // traverse all but last element, leaving that as an attribute name
+ name_stack_t::const_iterator end_it = non_empty_names.end();
+ end_it--;
+
+ for (name_stack_t::const_iterator it = non_empty_names.begin();
+ it != end_it;
+ ++it)
+ {
+ if (it != non_empty_names.begin())
+ {
+ element_name += ".";
+ }
+ element_name += it->first;
+ }
+
+ elements_map_t::iterator found_it = mElementsWritten.find(element_name);
+ // <choice>
+ // <group>
+ // <optional>
+ // <attribute name="foo.bar"><data type="string"/></attribute>
+ // </optional>
+ // <optional>
+ // <attribute name="foo.baz"><data type="integer"/></attribute>
+ // </optional>
+ // </group>
+ // <element name="foo">
+ // <optional>
+ // <attribute name="bar"><data type="string"/></attribute>
+ // </optional>
+ // <optional>
+ // <attribute name="baz"><data type="string"/></attribute>
+ // </optional>
+ // </element>
+ // <element name="outer.foo">
+ // <ref name="foo"/>
+ // </element>
+ // </choice>
+
+ if (found_it != mElementsWritten.end())
+ {
+ // reuse existing element
+ LLXMLNodePtr choice_node = found_it->second.first;
+
+ // attribute with this name not already written?
+ if (found_it->second.second.find(attribute_name) == found_it->second.second.end())
+ {
+ // append to <group>
+ LLXMLNodePtr node = choice_node->mChildren->head;
+ node = createCardinalityNode(node, min_count, max_count)->createChild("attribute", false);
+ node->createChild("name", true)->setStringValue(attribute_name);
+ addTypeNode(node, type, possible_values);
+
+ // append to <element>
+ node = choice_node->mChildren->head->mNext->mChildren->head;
+ node = createCardinalityNode(node, min_count, max_count)->createChild("attribute", false);
+ node->createChild("name", true)->setStringValue(non_empty_names.back().first);
+ addTypeNode(node, type, possible_values);
+
+ // append to <element>
+ //node = choice_node->mChildren->head->mNext->mNext->mChildren->head;
+ //node = createCardinalityNode(node, min_count, max_count)->createChild("attribute", false);
+ //node->createChild("name", true)->setStringValue(non_empty_names.back().first);
+ //addTypeNode(node, type, possible_values);
+
+ found_it->second.second.insert(attribute_name);
+ }
+ }
+ else
+ {
+ LLXMLNodePtr choice_node = mElementNode->createChild("choice", false);
+
+ LLXMLNodePtr node = choice_node->createChild("group", false);
+ node = createCardinalityNode(node, min_count, max_count)->createChild("attribute", false);
+ node->createChild("name", true)->setStringValue(attribute_name);
+ addTypeNode(node, type, possible_values);
+
+ node = choice_node->createChild("optional", false);
+ node = node->createChild("element", false);
+ node->createChild("name", true)->setStringValue(element_name);
+ node = createCardinalityNode(node, min_count, max_count)->createChild("attribute", false);
+ node->createChild("name", true)->setStringValue(non_empty_names.back().first);
+ addTypeNode(node, type, possible_values);
+
+ //node = choice_node->createChild("optional", false);
+ //node = node->createChild("element", false);
+ //node->createChild("name", true)->setStringValue(mDefinitionName + "." + element_name);
+ //node = createCardinalityNode(node, min_count, max_count)->createChild("attribute", false);
+ //node->createChild("name", true)->setStringValue(non_empty_names.back().first);
+ //addTypeNode(node, type, possible_values);
+
+ attribute_data_t& attribute_data = mElementsWritten[element_name];
+ attribute_data.first = choice_node;
+ attribute_data.second.insert(attribute_name);
+ }
+ }
+}
+
+void LLRNGWriter::addTypeNode(LLXMLNodePtr parent_node, const std::string& type, const std::vector<std::string>* possible_values)
+{
+ if (possible_values)
+ {
+ LLXMLNodePtr enum_node = parent_node->createChild("choice", false);
+ for (std::vector<std::string>::const_iterator it = possible_values->begin();
+ it != possible_values->end();
+ ++it)
+ {
+ enum_node->createChild("value", false)->setStringValue(*it);
+ }
+ }
+ else
+ {
+ parent_node->createChild("data", false)->createChild("type", true)->setStringValue(type);
+ }
+}
+
+LLXMLNodePtr LLRNGWriter::createCardinalityNode(LLXMLNodePtr parent_node, S32 min_count, S32 max_count)
+{
+ // unlinked by default, meaning this attribute is forbidden
+ LLXMLNodePtr count_node = new LLXMLNode();
+ if (min_count == 0)
+ {
+ if (max_count == 1)
+ {
+ count_node = parent_node->createChild("optional", false);
+ }
+ else if (max_count > 1)
+ {
+ count_node = parent_node->createChild("zeroOrMore", false);
+ }
+ }
+ else if (min_count >= 1)
+ {
+ if (max_count == 1 && min_count == 1)
+ {
+ // just add raw element, will count as 1 and only 1
+ count_node = parent_node;
+ }
+ else
+ {
+ count_node = parent_node->createChild("oneOrMore", false);
+ }
+ }
+ return count_node;
+}
diff --git a/indra/llui/llrngwriter.h b/indra/llui/llrngwriter.h
new file mode 100644
index 0000000000..66807577b5
--- /dev/null
+++ b/indra/llui/llrngwriter.h
@@ -0,0 +1,69 @@
+/**
+ * @file llrngwriter.h
+ * @brief Generates Relax NG schema files from a param block
+ *
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ *
+ * Copyright (c) 2003-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 LLRNGWRITER_H
+#define LLRNGWRITER_H
+
+#include "llinitparam.h"
+#include "llxmlnode.h"
+
+class LLRNGWriter : public LLInitParam::Parser
+{
+ LOG_CLASS(LLRNGWriter);
+public:
+ void writeRNG(const std::string& name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace);
+ void addDefinition(const std::string& type_name, const LLInitParam::BaseBlock& block);
+
+ /*virtual*/ std::string getCurrentElementName() { return LLStringUtil::null; }
+
+ LLRNGWriter();
+
+private:
+ LLXMLNodePtr createCardinalityNode(LLXMLNodePtr parent_node, S32 min_count, S32 max_count);
+ void addTypeNode(LLXMLNodePtr parent_node, const std::string& type, const std::vector<std::string>* possible_values);
+
+ void writeAttribute(const std::string& type, const Parser::name_stack_t&, S32 min_count, S32 max_count, const std::vector<std::string>* possible_values);
+ LLXMLNodePtr mElementNode;
+ LLXMLNodePtr mChildrenNode;
+ LLXMLNodePtr mGrammarNode;
+ std::string mDefinitionName;
+
+ typedef std::pair<LLXMLNodePtr, std::set<std::string> > attribute_data_t;
+ typedef std::map<std::string, attribute_data_t> elements_map_t;
+ typedef std::set<std::string> defined_elements_t;
+
+ defined_elements_t mDefinedElements;
+ attribute_data_t mAttributesWritten;
+ elements_map_t mElementsWritten;
+};
+
+#endif //LLRNGWRITER_H
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index 4e6de24160..cd43e194d2 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -177,7 +177,6 @@ LLScrollListText::LLScrollListText(const LLScrollListCell::Params& p)
mFont(p.font),
mColor(p.color),
mUseColor(p.color.isProvided()),
- mFontStyle(LLFontGL::NORMAL),
mFontAlignment(p.font_halign),
mVisible(p.visible),
mHighlightCount( 0 ),
@@ -240,6 +239,13 @@ void LLScrollListText::setText(const LLStringExplicit& text)
mText = text;
}
+void LLScrollListText::setFontStyle(const U8 font_style)
+{
+ LLFontDescriptor new_desc(mFont->getFontDesc());
+ new_desc.setStyle(font_style);
+ mFont = LLFontGL::getFont(new_desc);
+}
+
//virtual
void LLScrollListText::setValue(const LLSD& text)
{
@@ -308,7 +314,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
display_color,
mFontAlignment,
LLFontGL::BOTTOM,
- mFontStyle,
+ 0,
LLFontGL::NO_SHADOW,
string_chars,
getWidth(),
diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h
index 2ab13f7618..9d3fa65f64 100644
--- a/indra/llui/llscrolllistcell.h
+++ b/indra/llui/llscrolllistcell.h
@@ -145,14 +145,13 @@ public:
/*virtual*/ BOOL isText() const;
void setText(const LLStringExplicit& text);
- void setFontStyle(const U8 font_style) { mFontStyle = font_style; }
+ void setFontStyle(const U8 font_style);
private:
LLUIString mText;
const LLFontGL* mFont;
LLColor4 mColor;
U8 mUseColor;
- U8 mFontStyle;
LLFontGL::HAlign mFontAlignment;
BOOL mVisible;
S32 mHighlightCount;
diff --git a/indra/llui/llscrolllistcolumn.h b/indra/llui/llscrolllistcolumn.h
index 712ea56454..23318fd7c4 100644
--- a/indra/llui/llscrolllistcolumn.h
+++ b/indra/llui/llscrolllistcolumn.h
@@ -121,7 +121,7 @@ public:
Alternative<F32> relative_width;
Width()
- : dynamic_width("dynamicwidth", false),
+ : dynamic_width("dynamic_width", false),
pixel_width("width"),
relative_width("relative_width", -1.f)
{
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 84a725ce02..e8627586ea 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -102,11 +102,11 @@ struct SortScrollListItem
//---------------------------------------------------------------------------
LLScrollListCtrl::Contents::Contents()
-: columns("columns"),
- rows("rows")
+: columns("column"),
+ rows("row")
{
- addSynonym(columns, "column");
- addSynonym(rows, "row");
+ addSynonym(columns, "columns");
+ addSynonym(rows, "rows");
}
LLScrollListCtrl::Params::Params()
@@ -126,10 +126,11 @@ LLScrollListCtrl::Params::Params()
bg_selected_color("bg_selected_color"),
fg_disable_color("fg_disable_color"),
bg_writeable_color("bg_writeable_color"),
- bg_read_only_color("bg_read_only_color"),
+ bg_readonly_color("bg_readonly_color"),
bg_stripe_color("bg_stripe_color"),
hovered_color("hovered_color"),
- highlighted_color("highlighted_color")
+ highlighted_color("highlighted_color"),
+ contents("")
{
name = "scroll_list";
mouse_opaque = true;
@@ -170,7 +171,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p)
mBackgroundVisible(p.background_visible),
mDrawStripes(p.draw_stripes),
mBgWriteableColor(p.bg_writeable_color()),
- mBgReadOnlyColor(p.bg_read_only_color()),
+ mBgReadOnlyColor(p.bg_readonly_color()),
mBgSelectedColor(p.bg_selected_color()),
mBgStripeColor(p.bg_stripe_color()),
mFgSelectedColor(p.fg_selected_color()),
@@ -1082,12 +1083,12 @@ LLScrollListItem* LLScrollListCtrl::addSeparator(EAddPosition pos)
{
LLScrollListItem::Params separator_params;
separator_params.enabled(false);
- LLScrollListCell::Params cell_params;
- cell_params.type = "icon";
- cell_params.value = "menu_separator";
- cell_params.color = LLColor4(0.f, 0.f, 0.f, 0.7f);
- cell_params.font_halign = LLFontGL::HCENTER;
- separator_params.cells.add(cell_params);
+ LLScrollListCell::Params column_params;
+ column_params.type = "icon";
+ column_params.value = "menu_separator";
+ column_params.color = LLColor4(0.f, 0.f, 0.f, 0.7f);
+ column_params.font_halign = LLFontGL::HCENTER;
+ separator_params.columns.add(column_params);
return addRow( separator_params, pos );
}
@@ -1249,7 +1250,7 @@ LLScrollListItem* LLScrollListCtrl::addStringUUIDItem(const std::string& item_te
LLScrollListItem::Params item_p;
item_p.enabled(enabled);
item_p.value(id);
- item_p.cells.add().value(item_text).type("text");
+ item_p.columns.add().value(item_text).type("text");
return addRow( item_p, pos );
}
@@ -2635,8 +2636,8 @@ LLScrollListItem* LLScrollListCtrl::addRow(const LLScrollListItem::Params& item_
// Add any columns we don't already have
S32 col_index = 0;
- for(LLInitParam::ParamIterator<LLScrollListCell::Params>::const_iterator itor = item_p.cells().begin();
- itor != item_p.cells().end();
+ for(LLInitParam::ParamIterator<LLScrollListCell::Params>::const_iterator itor = item_p.columns().begin();
+ itor != item_p.columns().end();
++itor)
{
LLScrollListCell::Params cell_p = *itor;
@@ -2687,7 +2688,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(const LLScrollListItem::Params& item_
col_index++;
}
- if (item_p.cells().empty())
+ if (item_p.columns().empty())
{
if (mColumns.empty())
{
@@ -2742,7 +2743,7 @@ LLScrollListItem* LLScrollListCtrl::addSimpleElement(const std::string& value, E
LLScrollListItem::Params item_params;
item_params.value(entry_id);
- item_params.cells.add()
+ item_params.columns.add()
.value(value)
.font(LLFontGL::getFontSansSerifSmall());
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index 60cd9239e2..c1800419be 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -99,7 +99,7 @@ public:
bg_selected_color,
fg_disable_color,
bg_writeable_color,
- bg_read_only_color,
+ bg_readonly_color,
bg_stripe_color,
hovered_color,
highlighted_color;
diff --git a/indra/llui/llscrolllistitem.h b/indra/llui/llscrolllistitem.h
index 4237d5b304..c2b7effbc7 100644
--- a/indra/llui/llscrolllistitem.h
+++ b/indra/llui/llscrolllistitem.h
@@ -68,7 +68,7 @@ public:
Ignored type;
Ignored length;
- Multiple<LLScrollListCell::Params> cells;
+ Multiple<LLScrollListCell::Params> columns;
Params()
: enabled("enabled", true),
@@ -76,9 +76,9 @@ public:
name("name"),
type("type"),
length("length"),
- cells("columns")
+ columns("columns")
{
- addSynonym(cells, "column");
+ addSynonym(columns, "column");
addSynonym(value, "id");
}
};
diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp
index 64583071a6..3516712dc9 100644
--- a/indra/llui/llsearcheditor.cpp
+++ b/indra/llui/llsearcheditor.cpp
@@ -1,6 +1,6 @@
/**
- * @file lllineeditor.cpp
- * @brief LLLineEditor base class
+ * @file llsearcheditor.cpp
+ * @brief LLSearchEditor implementation
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
@@ -36,89 +36,63 @@
#include "llsearcheditor.h"
-//static LLDefaultChildRegistry::Register<LLSearchEditor> r2("search_editor");
-
LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p)
: LLUICtrl(p)
{
- LLLineEditor::Params line_editor_p(p);
- line_editor_p.name("search edit box");
- line_editor_p.rect(getLocalRect());
- line_editor_p.follows.flags(FOLLOWS_ALL);
- line_editor_p.text_pad_right(getRect().getHeight());
- line_editor_p.keystroke_callback(boost::bind(&LLSearchEditor::onSearchEdit, this, _1));
-
- mSearchEdit = LLUICtrlFactory::create<LLLineEditor>(line_editor_p);
- addChild(mSearchEdit);
-
- S32 btn_width = getRect().getHeight(); // button is square, and as tall as search editor
- LLRect clear_btn_rect(getRect().getWidth() - btn_width, getRect().getHeight(), getRect().getWidth(), 0);
- LLButton::Params button_params(p.clear_search_button);
- button_params.name(std::string("clear search"));
- button_params.rect(clear_btn_rect) ;
+ const S32 fudge = 2;
+ S32 btn_height = getRect().getHeight() - (fudge * 2);
+
+ LLLineEditor::Params line_editor_params(p);
+ line_editor_params.name("filter edit box");
+ line_editor_params.rect(getLocalRect());
+ line_editor_params.follows.flags(FOLLOWS_ALL);
+ line_editor_params.text_pad_left(btn_height + fudge);
+ line_editor_params.commit_callback.function(boost::bind(&LLUICtrl::onCommit, this));
+
+ mSearchEditor = LLUICtrlFactory::create<LLLineEditor>(line_editor_params);
+ addChild(mSearchEditor);
+
+ LLRect search_btn_rect(fudge, fudge + btn_height, fudge + btn_height, fudge);
+ LLButton::Params button_params(p.search_button);
+ button_params.name(std::string("clear filter"));
+ button_params.rect(search_btn_rect) ;
button_params.follows.flags(FOLLOWS_RIGHT|FOLLOWS_TOP);
button_params.tab_stop(false);
- button_params.click_callback.function(boost::bind(&LLSearchEditor::onClearSearch, this, _2));
+ button_params.click_callback.function(boost::bind(&LLUICtrl::onCommit, this));
- mClearSearchButton = LLUICtrlFactory::create<LLButton>(button_params);
- mSearchEdit->addChild(mClearSearchButton);
+ mSearchButton = LLUICtrlFactory::create<LLButton>(button_params);
+ mSearchEditor->addChild(mSearchButton);
}
//virtual
void LLSearchEditor::setValue(const LLSD& value )
{
- mSearchEdit->setValue(value);
+ mSearchEditor->setValue(value);
}
//virtual
LLSD LLSearchEditor::getValue() const
{
- return mSearchEdit->getValue();
+ return mSearchEditor->getValue();
}
//virtual
BOOL LLSearchEditor::setTextArg( const std::string& key, const LLStringExplicit& text )
{
- return mSearchEdit->setTextArg(key, text);
+ return mSearchEditor->setTextArg(key, text);
}
//virtual
BOOL LLSearchEditor::setLabelArg( const std::string& key, const LLStringExplicit& text )
{
- return mSearchEdit->setLabelArg(key, text);
+ return mSearchEditor->setLabelArg(key, text);
}
//virtual
void LLSearchEditor::clear()
{
- if (mSearchEdit)
+ if (mSearchEditor)
{
- mSearchEdit->clear();
+ mSearchEditor->clear();
}
}
-
-void LLSearchEditor::draw()
-{
- mClearSearchButton->setVisible(!mSearchEdit->getWText().empty());
-
- LLUICtrl::draw();
-}
-
-
-void LLSearchEditor::onSearchEdit(LLLineEditor* caller )
-{
- if (mSearchCallback)
- {
- mSearchCallback(caller->getText());
- }
-}
-
-void LLSearchEditor::onClearSearch(const LLSD& data)
-{
- setText(LLStringUtil::null);
- if (mSearchCallback)
- {
- mSearchCallback(LLStringUtil::null);
- }
-}
-
diff --git a/indra/llui/llsearcheditor.h b/indra/llui/llsearcheditor.h
index d8c5093fbf..368b68baa3 100644
--- a/indra/llui/llsearcheditor.h
+++ b/indra/llui/llsearcheditor.h
@@ -39,28 +39,21 @@
* $/LicenseInfo$
*/
-#ifndef LL_LLSEARCHEDITOR_H
-#define LL_LLSEARCHEDITOR_H
+#ifndef LL_SEARCHEDITOR_H
+#define LL_SEARCHEDITOR_H
#include "lllineeditor.h"
#include "llbutton.h"
-#include <boost/function.hpp>
-
-/*
- * @brief A line editor with a button to clear it and a callback to call on every edit event.
- */
class LLSearchEditor : public LLUICtrl
{
public:
struct Params : public LLInitParam::Block<Params, LLLineEditor::Params>
{
- Optional<boost::function<void(const std::string&, void*)> > search_callback;
-
- Optional<LLButton::Params> clear_search_button;
+ Optional<LLButton::Params> search_button;
Params()
- : clear_search_button("clear_search_button")
+ : search_button("search_button")
{
name = "search_editor";
}
@@ -69,15 +62,11 @@ public:
protected:
LLSearchEditor(const Params&);
friend class LLUICtrlFactory;
+
public:
virtual ~LLSearchEditor() {}
- /*virtual*/ void draw();
-
- void setText(const LLStringExplicit &new_text) { mSearchEdit->setText(new_text); }
-
- typedef boost::function<void (const std::string& search_string)> search_callback_t;
- void setSearchCallback(search_callback_t cb) { mSearchCallback = cb; }
+ void setText(const LLStringExplicit &new_text) { mSearchEditor->setText(new_text); }
// LLUICtrl interface
virtual void setValue(const LLSD& value );
@@ -87,12 +76,8 @@ public:
virtual void clear();
private:
- void onSearchEdit(LLLineEditor* caller );
- void onClearSearch(const LLSD& data);
-
- LLLineEditor* mSearchEdit;
- LLButton* mClearSearchButton;
- search_callback_t mSearchCallback;
+ LLLineEditor* mSearchEditor;
+ LLButton* mSearchButton;
};
-#endif // LL_LLSEARCHEDITOR_H
+#endif // LL_SEARCHEDITOR_H
diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h
index 1a94fcf2c6..32ddded2c8 100644
--- a/indra/llui/llstyle.h
+++ b/indra/llui/llstyle.h
@@ -34,7 +34,6 @@
#define LL_LLSTYLE_H
#include "v4color.h"
-#include "llfont.h"
#include "llui.h"
class LLFontGL;
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 3d5b5caead..29c30004ef 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -108,6 +108,7 @@ LLTabContainer::Params::Params()
tab_min_width("tab_min_width"),
tab_max_width("tab_max_width"),
hide_tabs("hide_tabs", false),
+ tab_padding_right("tab_padding_right"),
tab_top_image_unselected("tab_top_image_unselected"),
tab_top_image_selected("tab_top_image_selected"),
tab_bottom_image_unselected("tab_bottom_image_unselected"),
diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h
index ac8232bbb1..78592a0f9a 100644
--- a/indra/llui/lltabcontainer.h
+++ b/indra/llui/lltabcontainer.h
@@ -122,6 +122,10 @@ public:
TabPanelParams()
: panel("panel", NULL),
+ label("label"),
+ select_tab("select_tab"),
+ is_placeholder("is_placeholder"),
+ indent("indent"),
insert_at("insert_at", END)
{}
};
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index 56019171e1..3dd8d21f6b 100644
--- a/indra/llui/lltextbox.cpp
+++ b/indra/llui/lltextbox.cpp
@@ -82,8 +82,7 @@ LLTextBox::LLTextBox(const LLTextBox::Params& p)
mHAlign(p.font_halign),
mLineSpacing(p.line_spacing),
mWordWrap( p.word_wrap ),
- mDidWordWrap(FALSE),
- mFontStyle(LLFontGL::getStyleFromString(p.font.style))
+ mDidWordWrap(FALSE)
{
setText( p.text() );
}
@@ -382,7 +381,7 @@ void LLTextBox::drawText( S32 x, S32 y, const LLColor4& color )
{
mFontGL->render(mText.getWString(), 0, (F32)x, (F32)y, color,
mHAlign, mVAlign,
- mFontStyle,
+ 0,
mShadowType,
S32_MAX, getRect().getWidth(), NULL, TRUE, mUseEllipses);
}
@@ -395,7 +394,7 @@ void LLTextBox::drawText( S32 x, S32 y, const LLColor4& color )
S32 line_length = *iter;
mFontGL->render(mText.getWString(), cur_pos, (F32)x, (F32)y, color,
mHAlign, mVAlign,
- mFontStyle,
+ 0,
mShadowType,
line_length, getRect().getWidth(), NULL, TRUE, mUseEllipses );
cur_pos += line_length + 1;
diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h
index 53d57ff785..d807fe7639 100644
--- a/indra/llui/lltextbox.h
+++ b/indra/llui/lltextbox.h
@@ -143,7 +143,6 @@ private:
BOOL mWordWrap;
BOOL mDidWordWrap;
- U8 mFontStyle; // style bit flags for font
LLFontGL::ShadowType mShadowType;
BOOL mBorderDropShadowVisible;
BOOL mUseEllipses;
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 421ba32168..adeaf0a279 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -36,6 +36,7 @@
#include "lltexteditor.h"
+#include "llfontfreetype.h" // for LLFontFreetype::FIRST_CHAR
#include "llfontgl.h"
#include "llrender.h"
#include "llui.h"
@@ -227,6 +228,29 @@ private:
///////////////////////////////////////////////////////////////////
+LLTextEditor::Params::Params()
+: default_text("default_text"),
+ max_text_length("max_length", 255),
+ read_only("read_only", false),
+ embedded_items("embedded_items", false),
+ hide_scrollbar("hide_scrollbar", false),
+ hide_border("hide_border", false),
+ word_wrap("word_wrap", false),
+ ignore_tab("ignore_tab", true),
+ track_bottom("track_bottom", false),
+ takes_non_scroll_clicks("takes_non_scroll_clicks", true),
+ cursor_color("cursor_color"),
+ default_color("default_color"),
+ text_color("text_color"),
+ text_readonly_color("text_readonly_color"),
+ bg_readonly_color("bg_readonly_color"),
+ bg_writeable_color("bg_writeable_color"),
+ bg_focus_color("bg_focus_color"),
+ length("length"), // ignored
+ type("type"), // ignored
+ is_unicode("is_unicode")// ignored
+{}
+
LLTextEditor::LLTextEditor(const LLTextEditor::Params& p)
: LLUICtrl(p, LLTextViewModelPtr(new LLTextViewModel)),
mMaxTextByteLength( p.max_text_length ),
@@ -254,7 +278,7 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p)
mHideScrollbarForShortDocs( FALSE ),
mTakesNonScrollClicks( p.takes_non_scroll_clicks ),
mTrackBottom( p.track_bottom ),
- mAllowEmbeddedItems( p.allow_embedded_items ),
+ mAllowEmbeddedItems( p.embedded_items ),
mHandleEditKeysDirectly( FALSE ),
mMouseDownX(0),
mMouseDownY(0),
@@ -263,8 +287,7 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p)
mScrollNeeded(FALSE),
mLastSelectionY(-1),
mTabsToNextField(p.ignore_tab),
- mGLFont(p.font),
- mGLFontStyle(LLFontGL::getStyleFromString(p.font.style))
+ mGLFont(p.font)
{
static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
@@ -1930,7 +1953,7 @@ void LLTextEditor::pasteHelper(bool is_primary)
for( S32 i = 0; i < len; i++ )
{
llwchar wc = clean_string[i];
- if( (wc < LLFont::FIRST_CHAR) && (wc != LF) )
+ if( (wc < LLFontFreetype::FIRST_CHAR) && (wc != LF) )
{
clean_string[i] = LL_UNKNOWN_CHAR;
}
@@ -3101,7 +3124,7 @@ void LLTextEditor::drawClippedSegment(const LLWString &text, S32 seg_start, S32
S32 start = seg_start;
S32 end = llmin( selection_left, seg_end );
S32 length = end - start;
- font->render(text, start, x, y_top, color, LLFontGL::LEFT, LLFontGL::TOP, mGLFontStyle, LLFontGL::NO_SHADOW, length, S32_MAX, right_x, mAllowEmbeddedItems);
+ font->render(text, start, x, y_top, color, LLFontGL::LEFT, LLFontGL::TOP, 0, LLFontGL::NO_SHADOW, length, S32_MAX, right_x, mAllowEmbeddedItems);
}
x = *right_x;
@@ -3114,7 +3137,7 @@ void LLTextEditor::drawClippedSegment(const LLWString &text, S32 seg_start, S32
font->render(text, start, x, y_top,
LLColor4( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], 1.f ),
- LLFontGL::LEFT, LLFontGL::TOP, mGLFontStyle, LLFontGL::NO_SHADOW, length, S32_MAX, right_x, mAllowEmbeddedItems);
+ LLFontGL::LEFT, LLFontGL::TOP, 0, LLFontGL::NO_SHADOW, length, S32_MAX, right_x, mAllowEmbeddedItems);
}
x = *right_x;
if( selection_right < seg_end )
@@ -3123,7 +3146,7 @@ void LLTextEditor::drawClippedSegment(const LLWString &text, S32 seg_start, S32
S32 start = llmax( selection_right, seg_start );
S32 end = seg_end;
S32 length = end - start;
- font->render(text, start, x, y_top, color, LLFontGL::LEFT, LLFontGL::TOP, mGLFontStyle, LLFontGL::NO_SHADOW, length, S32_MAX, right_x, mAllowEmbeddedItems);
+ font->render(text, start, x, y_top, color, LLFontGL::LEFT, LLFontGL::TOP, 0, LLFontGL::NO_SHADOW, length, S32_MAX, right_x, mAllowEmbeddedItems);
}
}
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index 5e423f8548..4da91cc1d7 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -63,7 +63,7 @@ public:
Optional<S32> max_text_length;
Optional<bool> read_only,
- allow_embedded_items,
+ embedded_items,
hide_scrollbar,
word_wrap,
ignore_tab,
@@ -86,30 +86,7 @@ public:
length,
is_unicode;
-
- Params()
- : max_text_length("max_length", 255),
- read_only("read_only", false),
- allow_embedded_items("embedded_items", false),
- hide_scrollbar("hide_scrollbar", false),
- hide_border("hide_border", false),
- word_wrap("word_wrap", false),
- ignore_tab("ignore_tab", true),
- track_bottom("track_bottom", false),
- takes_non_scroll_clicks("takes_non_scroll_clicks", true),
- cursor_color("cursor_color"),
- default_color("default_color"),
- text_color("text_color"),
- text_readonly_color("text_readonly_color"),
- bg_readonly_color("bg_readonly_color"),
- bg_writeable_color("bg_writeable_color"),
- bg_focus_color("bg_focus_color"),
- length("length"),
- type("type"),
- is_unicode("is_unicode")
- {}
-
-
+ Params();
};
void initFromParams(const Params&);
@@ -524,7 +501,6 @@ private:
S32 mMaxTextByteLength; // Maximum length mText is allowed to be in bytes
const LLFontGL* mGLFont;
- U8 mGLFontStyle; // the font style from xml
class LLViewBorder* mBorder;
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 7eaa118222..6906f0befb 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -58,8 +58,9 @@
#include "llwindow.h"
// for registration
-#include "llsearcheditor.h"
+#include "llfiltereditor.h"
#include "llflyoutbutton.h"
+#include "llsearcheditor.h"
// for XUIParse
#include "llquaternion.h"
@@ -88,9 +89,10 @@ std::list<std::string> gUntranslated;
/*static*/ std::vector<std::string> LLUI::sXUIPaths;
-// register searcheditor here
-static LLDefaultChildRegistry::Register<LLSearchEditor> register_search_editor("search_editor");
+// register filtereditor here
+static LLDefaultChildRegistry::Register<LLFilterEditor> register_filter_editor("filter_editor");
static LLDefaultChildRegistry::Register<LLFlyoutButton> register_flyout_button("flyout_button");
+static LLDefaultChildRegistry::Register<LLSearchEditor> register_search_editor("search_editor");
//
@@ -1963,6 +1965,17 @@ namespace LLInitParam
declare("blue", LLColor4::blue);
}
+ template<>
+ class ParamCompare<const LLFontGL*>
+ {
+ public:
+ static bool equals(const LLFontGL* a, const LLFontGL* b)
+ {
+ return !(a->getFontDesc() < b->getFontDesc())
+ && !(b->getFontDesc() < a->getFontDesc());
+ }
+ };
+
TypedParam<const LLFontGL*>::TypedParam(BlockDescriptor& descriptor, const char* name, const LLFontGL*const value, ParamDescriptor::validation_func_t func, S32 min_count, S32 max_count)
: super_t(descriptor, name, value, func, min_count, max_count),
name(""),
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index 9399eff2ab..413733a50b 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -39,7 +39,6 @@
#include "llrect.h"
#include "llcontrol.h"
#include "llcoord.h"
-//#include "llhtmlhelp.h"
#include "llgl.h" // *TODO: break this dependency
#include <stack>
#include "lluiimage.h" // *TODO: break this dependency, need to add #include "lluiimage.h" to all widgets that hold an Optional<LLUIImage*> in their paramblocks
@@ -49,6 +48,8 @@
#include "lluicolortable.h"
#include <boost/signals2.hpp>
#include "lllazyvalue.h"
+#include "llhandle.h" // *TODO: remove this dependency, added as a
+ // convenience when LLHandle moved to llhandle.h
// LLUIFactory
#include "llsd.h"
@@ -433,139 +434,7 @@ public:
LLLocalClipRect(const LLRect& rect, BOOL enabled = TRUE);
};
-template <typename T>
-class LLTombStone : public LLRefCount
-{
-public:
- LLTombStone(T* target = NULL) : mTarget(target) {}
-
- void setTarget(T* target) { mTarget = target; }
- T* getTarget() const { return mTarget; }
-private:
- T* mTarget;
-};
-
-// LLHandles are used to refer to objects whose lifetime you do not control or influence.
-// Calling get() on a handle will return a pointer to the referenced object or NULL,
-// if the object no longer exists. Note that during the lifetime of the returned pointer,
-// you are assuming that the object will not be deleted by any action you perform,
-// or any other thread, as normal when using pointers, so avoid using that pointer outside of
-// the local code block.
-//
-// https://wiki.lindenlab.com/mediawiki/index.php?title=LLHandle&oldid=79669
-
-template <typename T>
-class LLHandle
-{
-public:
- LLHandle() : mTombStone(sDefaultTombStone) {}
- const LLHandle<T>& operator =(const LLHandle<T>& other)
- {
- mTombStone = other.mTombStone;
- return *this;
- }
-
- bool isDead() const
- {
- return mTombStone->getTarget() == NULL;
- }
-
- void markDead()
- {
- mTombStone = sDefaultTombStone;
- }
-
- T* get() const
- {
- return mTombStone->getTarget();
- }
-
- friend bool operator== (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
- {
- return lhs.mTombStone == rhs.mTombStone;
- }
- friend bool operator!= (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
- {
- return !(lhs == rhs);
- }
- friend bool operator< (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
- {
- return lhs.mTombStone < rhs.mTombStone;
- }
- friend bool operator> (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
- {
- return lhs.mTombStone > rhs.mTombStone;
- }
-protected:
-
-protected:
- LLPointer<LLTombStone<T> > mTombStone;
-
-private:
- static LLPointer<LLTombStone<T> > sDefaultTombStone;
-};
-
-// initialize static "empty" tombstone pointer
-template <typename T> LLPointer<LLTombStone<T> > LLHandle<T>::sDefaultTombStone = new LLTombStone<T>();
-
-
-template <typename T>
-class LLRootHandle : public LLHandle<T>
-{
-public:
- LLRootHandle(T* object) { bind(object); }
- LLRootHandle() {};
- ~LLRootHandle() { unbind(); }
-
- // this is redundant, since a LLRootHandle *is* an LLHandle
- LLHandle<T> getHandle() { return LLHandle<T>(*this); }
-
- void bind(T* object)
- {
- // unbind existing tombstone
- if (LLHandle<T>::mTombStone.notNull())
- {
- if (LLHandle<T>::mTombStone->getTarget() == object) return;
- LLHandle<T>::mTombStone->setTarget(NULL);
- }
- // tombstone reference counted, so no paired delete
- LLHandle<T>::mTombStone = new LLTombStone<T>(object);
- }
-
- void unbind()
- {
- LLHandle<T>::mTombStone->setTarget(NULL);
- }
-
- //don't allow copying of root handles, since there should only be one
-private:
- LLRootHandle(const LLRootHandle& other) {};
-};
-
-// Use this as a mixin for simple classes that need handles and when you don't
-// want handles at multiple points of the inheritance hierarchy
-template <typename T>
-class LLHandleProvider
-{
-protected:
- typedef LLHandle<T> handle_type_t;
- LLHandleProvider()
- {
- // provided here to enforce T deriving from LLHandleProvider<T>
- }
-
- LLHandle<T> getHandle()
- {
- // perform lazy binding to avoid small tombstone allocations for handle
- // providers whose handles are never referenced
- mHandle.bind(static_cast<T*>(this));
- return mHandle;
- }
-
-private:
- LLRootHandle<T> mHandle;
-};
-
+// Moved all LLHandle-related code to llhandle.h
//RN: maybe this needs to moved elsewhere?
class LLImageProviderInterface
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index ebf594ff66..aae4a86d87 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -43,7 +43,7 @@ static LLDefaultChildRegistry::Register<LLUICtrl> r("ui_ctrl");
LLUICtrl::Params::Params()
: tab_stop("tab_stop", true),
label("label"),
- initial_value("initial_value"),
+ initial_value("value"),
init_callback("init_callback"),
commit_callback("commit_callback"),
validate_callback("validate_callback"),
@@ -52,9 +52,7 @@ LLUICtrl::Params::Params()
mouseleave_callback("mouseleave_callback"),
control_name("control_name")
{
- addSynonym(initial_value, "initial_val");
- // this is the canonical name for text contents of an xml node
- addSynonym(initial_value, "value");
+ addSynonym(initial_value, "initial_value");
}
LLFocusableElement::LLFocusableElement()
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index 16fbbf79ea..cf6634f370 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -108,7 +108,7 @@ public:
{
Optional<commit_callback_t> function;
};
-
+
struct EnableCallbackParam : public LLInitParam::Block<EnableCallbackParam, CallbackParam >
{
Optional<enable_callback_t> function;
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index 9df22e39b4..3b2b56d48e 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -77,6 +77,7 @@ const S32 HPAD = 4;
const S32 VPAD = 4;
const S32 FLOATER_H_MARGIN = 15;
const S32 MIN_WIDGET_HEIGHT = 10;
+const S32 MAX_STRING_ATTRIBUTE_SIZE = 40;
LLFastTimer::DeclareTimer FTM_WIDGET_CONSTRUCTION("Widget Construction");
LLFastTimer::DeclareTimer FTM_INIT_FROM_PARAMS("Widget InitFromParams");
@@ -449,177 +450,6 @@ void LLUICtrlFactory::popFactoryFunctions()
}
}
-
-//
-// LLRNGWriter - writes Relax NG schema files based on a param block
-//
-LLRNGWriter::LLRNGWriter()
-{
- // register various callbacks for inspecting the contents of a param block
- registerInspectFunc<bool>(boost::bind(&LLRNGWriter::writeAttribute, this, "boolean", _1, _2, _3, _4));
- registerInspectFunc<std::string>(boost::bind(&LLRNGWriter::writeAttribute, this, "string", _1, _2, _3, _4));
- registerInspectFunc<U8>(boost::bind(&LLRNGWriter::writeAttribute, this, "unsignedByte", _1, _2, _3, _4));
- registerInspectFunc<S8>(boost::bind(&LLRNGWriter::writeAttribute, this, "signedByte", _1, _2, _3, _4));
- registerInspectFunc<U16>(boost::bind(&LLRNGWriter::writeAttribute, this, "unsignedShort", _1, _2, _3, _4));
- registerInspectFunc<S16>(boost::bind(&LLRNGWriter::writeAttribute, this, "signedShort", _1, _2, _3, _4));
- registerInspectFunc<U32>(boost::bind(&LLRNGWriter::writeAttribute, this, "unsignedInt", _1, _2, _3, _4));
- registerInspectFunc<S32>(boost::bind(&LLRNGWriter::writeAttribute, this, "integer", _1, _2, _3, _4));
- registerInspectFunc<F32>(boost::bind(&LLRNGWriter::writeAttribute, this, "float", _1, _2, _3, _4));
- registerInspectFunc<F64>(boost::bind(&LLRNGWriter::writeAttribute, this, "double", _1, _2, _3, _4));
- registerInspectFunc<LLColor4>(boost::bind(&LLRNGWriter::writeAttribute, this, "string", _1, _2, _3, _4));
- registerInspectFunc<LLUIColor>(boost::bind(&LLRNGWriter::writeAttribute, this, "string", _1, _2, _3, _4));
- registerInspectFunc<LLUUID>(boost::bind(&LLRNGWriter::writeAttribute, this, "string", _1, _2, _3, _4));
- registerInspectFunc<LLSD>(boost::bind(&LLRNGWriter::writeAttribute, this, "string", _1, _2, _3, _4));
-}
-
-void LLRNGWriter::writeRNG(const std::string& type_name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace)
-{
- mGrammarNode = node;
- mGrammarNode->setName("grammar");
- mGrammarNode->createChild("xmlns", true)->setStringValue("http://relaxng/ns/structure/1.0");
- mGrammarNode->createChild("datatypeLibrary", true)->setStringValue("http://www.w3.org/2001/XMLSchema-datatypes");
- mGrammarNode->createChild("ns", true)->setStringValue(xml_namespace);
-
- node = mGrammarNode->createChild("start", false);
- node = node->createChild("ref", false);
- node->createChild("name", true)->setStringValue(type_name);
-
- node = mGrammarNode->createChild("define", false);
- node->createChild("name", true)->setStringValue(type_name);
-
- mElementNode = node->createChild("element", false);
- mElementNode->createChild("name", true)->setStringValue(type_name);
-
- block.inspectBlock(*this);
-}
-
-void LLRNGWriter::writeAttribute(const std::string& type, const Parser::name_stack_t& stack, S32 min_count, S32 max_count, const std::vector<std::string>* possible_values)
-{
- name_stack_t non_empty_names;
- std::string attribute_name;
- for (name_stack_t::const_iterator it = stack.begin();
- it != stack.end();
- ++it)
- {
- const std::string& name = it->first;
- if (!name.empty())
- {
- non_empty_names.push_back(*it);
- }
- }
-
- if (non_empty_names.empty()) return;
-
- for (name_stack_t::const_iterator it = non_empty_names.begin();
- it != non_empty_names.end();
- ++it)
- {
- if (!attribute_name.empty())
- {
- attribute_name += ".";
- }
- attribute_name += it->first;
- }
-
- // singular attribute
- if (non_empty_names.size() == 1)
- {
- if (max_count == 1)
- {
- LLXMLNodePtr node = getCardinalityNode(mElementNode, min_count, max_count)->createChild("attribute", false);
- node->createChild("name", true)->setStringValue(attribute_name);
- node->createChild("data", false)->createChild("type", true)->setStringValue(type);
- }
- }
- // compound attribute
- else
- {
- std::string element_name;
-
- // traverse all but last element, leaving that as an attribute name
- name_stack_t::const_iterator end_it = non_empty_names.end();
- end_it--;
-
- for (name_stack_t::const_iterator it = non_empty_names.begin();
- it != end_it;
- ++it)
- {
- if (it != non_empty_names.begin())
- {
- element_name += ".";
- }
- element_name += it->first;
- }
-
- elements_map_t::iterator found_it = mElementsWritten.find(element_name);
- if (found_it != mElementsWritten.end())
- {
- // reuse existing element
- LLXMLNodePtr choice_node = found_it->second;
-
- LLXMLNodePtr node = choice_node->mChildren->head;
- node = getCardinalityNode(node, min_count, max_count)->createChild("attribute", false);
- node->createChild("name", true)->setStringValue(attribute_name);
- node->createChild("data", false)->createChild("type", true)->setStringValue(type);
-
- node = choice_node->mChildren->head->mNext->mChildren->head;
- node = getCardinalityNode(node, min_count, max_count)->createChild("attribute", false);
- node->createChild("name", true)->setStringValue(non_empty_names.back().first);
- node->createChild("data", false)->createChild("type", true)->setStringValue(type);
- }
- else
- {
- LLXMLNodePtr choice_node = mElementNode->createChild("choice", false);
-
- LLXMLNodePtr node = choice_node->createChild("group", false);
- node = getCardinalityNode(node, min_count, max_count)->createChild("attribute", false);
- node->createChild("name", true)->setStringValue(attribute_name);
- node->createChild("data", false)->createChild("type", true)->setStringValue(type);
-
- node = choice_node->createChild("element", false);
- node->createChild("name", true)->setStringValue(element_name);
- node = getCardinalityNode(node, min_count, max_count)->createChild("attribute", false);
- node->createChild("name", true)->setStringValue(non_empty_names.back().first);
- node->createChild("data", false)->createChild("type", true)->setStringValue(type);
-
- node = choice_node->createChild("element", false);
- node->createChild("name", true)->setStringValue(type + "." + element_name);
- node->createChild("ref", true)->createChild("name", true)->setStringValue(element_name);
-
- mElementsWritten[element_name] = choice_node;
- }
- }
-}
-
-LLXMLNodePtr LLRNGWriter::getCardinalityNode(LLXMLNodePtr parent_node, S32 min_count, S32 max_count)
-{
- // unlinked by default, meaning this attribute is forbidden
- LLXMLNodePtr count_node = new LLXMLNode();
- if (min_count >= 1)
- {
- if (max_count == 1 && min_count == 1)
- {
- // just add raw element, will count as 1 and only 1
- count_node = mElementNode;
- }
- else
- {
- count_node = mElementNode->createChild("oneOrMore", false);
- }
- }
- else
- {
- if (max_count == 1)
- {
- count_node = mElementNode->createChild("optional", false);
- }
- else if (max_count > 1)
- {
- count_node = mElementNode->createChild("zeroOrMore", false);
- }
- }
- return count_node;
-}
//
// LLXSDWriter
//
@@ -811,7 +641,7 @@ void LLXSDWriter::addAttributeToSchema(LLXMLNodePtr type_declaration_node, const
string_set_t& attributes_written = mAttributesWritten[type_declaration_node];
- string_set_t::iterator found_it = std::lower_bound(attributes_written.begin(), attributes_written.end(), attribute_name);
+ string_set_t::iterator found_it = attributes_written.lower_bound(attribute_name);
// attribute not yet declared
if (found_it == attributes_written.end() || attributes_written.key_comp()(attribute_name, *found_it))
@@ -997,142 +827,6 @@ void LLXUIParser::readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, bool
}
}
-void LLXUIParser::writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock &block, const LLInitParam::BaseBlock* diff_block)
-{
- mLastWriteGeneration = -1;
- mWriteRootNode = node;
- block.serializeBlock(*this, Parser::name_stack_t(), diff_block);
-}
-
-// go from a stack of names to a specific XML node
-LLXMLNodePtr LLXUIParser::getNode(const name_stack_t& stack)
-{
- name_stack_t name_stack;
-
- for (name_stack_t::const_iterator it = stack.begin();
- it != stack.end();
- ++it)
- {
- if (!it->first.empty())
- {
- name_stack.push_back(*it);
- }
- }
-
- if (name_stack.empty() || mWriteRootNode.isNull()) return NULL;
-
- std::string attribute_name = name_stack.front().first;
-
- // heuristic to make font always attribute of parent node
- bool is_font = (attribute_name == "font");
- // XML spec says that attributes have their whitespace normalized
- // on parse: http://www.w3.org/TR/REC-xml/#AVNormalize
- // Therefore text-oriented widgets that might have carriage returns
- // have their values serialized as text contents, not the
- // initial_value attribute. JC
- if (attribute_name == "initial_value")
- {
- const char* root_node_name = mWriteRootNode->getName()->mString;
- if (!strcmp(root_node_name, "text") // LLTextBox
- || !strcmp(root_node_name, "text_editor")
- || !strcmp(root_node_name, "line_editor")) // for consistency
- {
- // writeStringValue will write to this node
- return mWriteRootNode;
- }
- }
-
- for (name_stack_t::const_iterator it = ++name_stack.begin();
- it != name_stack.end();
- ++it)
- {
- attribute_name += ".";
- attribute_name += it->first;
- }
-
- // *NOTE: <string> elements for translation need to have whitespace
- // preserved like "initial_value" above, however, the <string> node
- // becomes an attribute of the containing floater or panel.
- // Because all <string> elements must have a "name" attribute, and
- // "name" is parsed first, just put the value into the last written
- // child.
- if (attribute_name == "string.value")
- {
- // The caller of will shortly call writeStringValue(), which sets
- // this node's type to string, but we don't want to export type="string".
- // Set the default for this node to suppress the export.
- static LLXMLNodePtr default_node;
- if (default_node.isNull())
- {
- default_node = new LLXMLNode();
- // Force the node to have a string type
- default_node->setStringValue( std::string() );
- }
- mLastWrittenChild->setDefault(default_node);
- // mLastWrittenChild is the "string" node part of "string.value",
- // so the caller will call writeStringValue() into that node,
- // setting the node text contents.
- return mLastWrittenChild;
- }
-
- LLXMLNodePtr attribute_node;
-
- const char* attribute_cstr = attribute_name.c_str();
- if (name_stack.size() != 1
- && !is_font)
- {
- std::string child_node_name(mWriteRootNode->getName()->mString);
- child_node_name += ".";
- child_node_name += name_stack.front().first;
-
- LLXMLNodePtr child_node;
-
- if (mLastWriteGeneration == name_stack.front().second)
- {
- child_node = mLastWrittenChild;
- }
- else
- {
- mLastWriteGeneration = name_stack.front().second;
- child_node = mWriteRootNode->createChild(child_node_name.c_str(), false);
- }
-
- mLastWrittenChild = child_node;
-
- name_stack_t::const_iterator it = ++name_stack.begin();
- std::string short_attribute_name(it->first);
-
- for (++it;
- it != name_stack.end();
- ++it)
- {
- short_attribute_name += ".";
- short_attribute_name += it->first;
- }
-
- if (child_node->hasAttribute(short_attribute_name.c_str()))
- {
- llerrs << "Attribute " << short_attribute_name << " already exists!" << llendl;
- }
-
- attribute_node = child_node->createChild(short_attribute_name.c_str(), true);
- }
- else
- {
- if (mWriteRootNode->hasAttribute(attribute_cstr))
- {
- mWriteRootNode->getAttribute(attribute_cstr, attribute_node);
- }
- else
- {
- attribute_node = mWriteRootNode->createChild(attribute_name.c_str(), true);
- }
- }
-
- return attribute_node;
-}
-
-
bool LLXUIParser::readXUIImpl(LLXMLNodePtr nodep, const std::string& scope, LLInitParam::BaseBlock& block)
{
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
@@ -1152,8 +846,15 @@ bool LLXUIParser::readXUIImpl(LLXMLNodePtr nodep, const std::string& scope, LLIn
// child nodes are not necessarily valid parameters (could be a child widget)
// so don't complain once we've recursed
bool silent = mCurReadDepth > 0;
- block.submitValue(mNameStack, *this, silent);
- mNameStack.pop_back();
+ if (!block.submitValue(mNameStack, *this, true))
+ {
+ mNameStack.pop_back();
+ block.submitValue(mNameStack, *this, silent);
+ }
+ else
+ {
+ mNameStack.pop_back();
+ }
}
// then traverse children
@@ -1271,6 +972,62 @@ bool LLXUIParser::readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& blo
return any_parsed;
}
+void LLXUIParser::writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock &block, const LLInitParam::BaseBlock* diff_block)
+{
+ mWriteRootNode = node;
+ block.serializeBlock(*this, Parser::name_stack_t(), diff_block);
+ mOutNodes.clear();
+}
+
+// go from a stack of names to a specific XML node
+LLXMLNodePtr LLXUIParser::getNode(const name_stack_t& stack)
+{
+ name_stack_t name_stack;
+ for (name_stack_t::const_iterator it = stack.begin();
+ it != stack.end();
+ ++it)
+ {
+ if (!it->first.empty())
+ {
+ name_stack.push_back(*it);
+ }
+ }
+
+ LLXMLNodePtr out_node = mWriteRootNode;
+
+ name_stack_t::const_iterator next_it = name_stack.begin();
+ for (name_stack_t::const_iterator it = name_stack.begin();
+ it != name_stack.end();
+ it = next_it)
+ {
+ ++next_it;
+ if (it->first.empty())
+ {
+ continue;
+ }
+
+ out_nodes_t::iterator found_it = mOutNodes.lower_bound(it->second);
+
+ // node with this name not yet written
+ if (found_it == mOutNodes.end() || mOutNodes.key_comp()(found_it->first, it->second))
+ {
+ // make an attribute if we are the last element on the name stack
+ bool is_attribute = next_it == name_stack.end();
+ LLXMLNodePtr new_node = new LLXMLNode(it->first.c_str(), is_attribute);
+ out_node->addChild(new_node);
+ mOutNodes.insert(found_it, std::make_pair(it->second, new_node));
+ out_node = new_node;
+ }
+ else
+ {
+ out_node = found_it->second;
+ }
+ }
+
+ return (out_node == mWriteRootNode ? LLXMLNodePtr(NULL) : out_node);
+}
+
+
bool LLXUIParser::readBoolValue(void* val_ptr)
{
S32 value;
@@ -1301,7 +1058,27 @@ bool LLXUIParser::writeStringValue(const void* val_ptr, const name_stack_t& stac
LLXMLNodePtr node = getNode(stack);
if (node.notNull())
{
- node->setStringValue(*((std::string*)val_ptr));
+ const std::string* string_val = reinterpret_cast<const std::string*>(val_ptr);
+ if (string_val->find('\n') != std::string::npos
+ || string_val->size() > MAX_STRING_ATTRIBUTE_SIZE)
+ {
+ // don't write strings with newlines into attributes
+ std::string attribute_name = node->getName()->mString;
+ LLXMLNodePtr parent_node = node->mParent;
+ parent_node->deleteChild(node);
+ // write results in text contents of node
+ if (attribute_name == "value")
+ {
+ // "value" is implicit, just write to parent
+ node = parent_node;
+ }
+ else
+ {
+ // create a child that is not an attribute, but with same name
+ node = parent_node->createChild(attribute_name.c_str(), false);
+ }
+ }
+ node->setStringValue(*string_val);
return true;
}
return false;
@@ -1538,7 +1315,26 @@ bool LLXUIParser::writeSDValue(const void* val_ptr, const name_stack_t& stack)
LLXMLNodePtr node = getNode(stack);
if (node.notNull())
{
- node->setStringValue(((LLSD*)val_ptr)->asString());
+ std::string string_val = ((LLSD*)val_ptr)->asString();
+ if (string_val.find('\n') != std::string::npos || string_val.size() > MAX_STRING_ATTRIBUTE_SIZE)
+ {
+ // don't write strings with newlines into attributes
+ std::string attribute_name = node->getName()->mString;
+ LLXMLNodePtr parent_node = node->mParent;
+ parent_node->deleteChild(node);
+ // write results in text contents of node
+ if (attribute_name == "value")
+ {
+ // "value" is implicit, just write to parent
+ node = parent_node;
+ }
+ else
+ {
+ node = parent_node->createChild(attribute_name.c_str(), false);
+ }
+ }
+
+ node->setStringValue(string_val);
return true;
}
return false;
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index 894c77888c..6374018ca6 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -47,28 +47,6 @@ class LLPanel;
class LLFloater;
class LLView;
-class LLRNGWriter : public LLInitParam::Parser
-{
- LOG_CLASS(LLRNGWriter);
-public:
- void writeRNG(const std::string& name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace);
-
- /*virtual*/ std::string getCurrentElementName() { return LLStringUtil::null; }
-
- LLRNGWriter();
-
-private:
- LLXMLNodePtr getCardinalityNode(LLXMLNodePtr parent_node, S32 min_count, S32 max_count);
-
- void writeAttribute(const std::string& type, const Parser::name_stack_t&, S32 min_count, S32 max_count, const std::vector<std::string>* possible_values);
- LLXMLNodePtr mElementNode;
- LLXMLNodePtr mGrammarNode;
-
- typedef std::map<std::string, LLXMLNodePtr> elements_map_t;
- elements_map_t mElementsWritten;
-};
-
-
class LLXSDWriter : public LLInitParam::Parser
{
LOG_CLASS(LLXSDWriter);
@@ -161,6 +139,9 @@ private:
LLXMLNodePtr mCurReadNode;
// Root of the widget XML sub-tree, for example, "line_editor"
LLXMLNodePtr mWriteRootNode;
+
+ typedef std::map<S32, LLXMLNodePtr> out_nodes_t;
+ out_nodes_t mOutNodes;
S32 mLastWriteGeneration;
LLXMLNodePtr mLastWrittenChild;
S32 mCurReadDepth;
@@ -489,7 +470,7 @@ LLChildRegistry<DERIVED>::Register<T>::Register(const char* tag, LLWidgetCreator
}
-typedef boost::function<LLPanel* (void)> LLPannelClassCreatorFunc;
+typedef boost::function<LLPanel* (void)> LLPanelClassCreatorFunc;
// local static instance for registering a particular panel class
@@ -498,15 +479,15 @@ class LLRegisterPanelClass
{
public:
// reigister with either the provided builder, or the generic templated builder
- void addPanelClass(const std::string& tag,LLPannelClassCreatorFunc func)
+ void addPanelClass(const std::string& tag,LLPanelClassCreatorFunc func)
{
- mPannelClassesNames[tag] = func;
+ mPanelClassesNames[tag] = func;
}
LLPanel* createPanelClass(const std::string& tag)
{
- param_name_map_t::iterator iT = mPannelClassesNames.find(tag);
- if(iT == mPannelClassesNames.end())
+ param_name_map_t::iterator iT = mPanelClassesNames.find(tag);
+ if(iT == mPanelClassesNames.end())
return 0;
return iT->second();
}
@@ -518,9 +499,9 @@ public:
}
private:
- typedef std::map< std::string, LLPannelClassCreatorFunc> param_name_map_t;
+ typedef std::map< std::string, LLPanelClassCreatorFunc> param_name_map_t;
- param_name_map_t mPannelClassesNames;
+ param_name_map_t mPanelClassesNames;
};