Fixes: EXT-839 EXT-859 EXT-868 EXT-795 EXT-861 EXT-678 EXT-848 EXT-873
master
Steven Bennetts 2009-09-09 04:27:06 +00:00
parent 579d8447d3
commit 4601aef70a
24 changed files with 220 additions and 45 deletions

View File

@ -78,6 +78,7 @@ LLComboBox::ItemParams::ItemParams()
LLComboBox::Params::Params()
: allow_text_entry("allow_text_entry", false),
allow_new_values("allow_new_values", false),
show_text_as_tentative("show_text_as_tentative", true),
max_chars("max_chars", 20),
list_position("list_position", BELOW),
@ -97,6 +98,7 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
mTextEntryTentative(p.show_text_as_tentative),
mHasAutocompletedText(false),
mAllowTextEntry(p.allow_text_entry),
mAllowNewValues(p.allow_new_values),
mMaxChars(p.max_chars),
mPrearrangeCallback(p.prearrange_callback()),
mTextEntryCallback(p.text_entry_callback()),
@ -621,7 +623,15 @@ void LLComboBox::hideList()
if (mList->getVisible())
{
// assert selection in list
mList->selectNthItem(mLastSelectedIndex);
if(mAllowNewValues)
{
// mLastSelectedIndex = -1 means that we entered a new value, don't select
// any of existing items in this case.
if(mLastSelectedIndex >= 0)
mList->selectNthItem(mLastSelectedIndex);
}
else
mList->selectNthItem(mLastSelectedIndex);
mButton->setToggleState(FALSE);
mList->setVisible(FALSE);

View File

@ -78,7 +78,8 @@ public:
: public LLInitParam::Block<Params, LLUICtrl::Params>
{
Optional<bool> allow_text_entry,
show_text_as_tentative;
show_text_as_tentative,
allow_new_values;
Optional<S32> max_chars;
Optional<commit_callback_t> prearrange_callback,
text_entry_callback,
@ -224,6 +225,7 @@ protected:
private:
BOOL mAllowTextEntry;
BOOL mAllowNewValues;
S32 mMaxChars;
BOOL mTextEntryTentative;
commit_callback_t mPrearrangeCallback;

View File

@ -34,10 +34,14 @@
#include "lldockablefloater.h"
//static
LLDockableFloater* LLDockableFloater::instance = NULL;
LLDockableFloater::LLDockableFloater(LLDockControl* dockControl,
const LLSD& key, const Params& params) :
LLFloater(key, params), mDockControl(dockControl)
{
resetInstance();
}
LLDockableFloater::~LLDockableFloater()
@ -51,12 +55,42 @@ BOOL LLDockableFloater::postBuild()
return LLView::postBuild();
}
void LLDockableFloater::resetInstance()
{
if (instance != this)
{
if (instance != NULL && instance->isDocked())
{
//closeFloater() is not virtual
if (instance->canClose())
{
instance->closeFloater();
}
else
{
instance->setVisible(FALSE);
}
}
instance = this;
}
}
void LLDockableFloater::setVisible(BOOL visible)
{
if(visible && isDocked())
{
resetInstance();
}
LLFloater::setVisible(visible);
}
void LLDockableFloater::setDocked(bool docked, bool pop_on_undock)
{
if (mDockControl.get() != NULL)
{
if (docked)
{
resetInstance();
mDockControl.get()->on();
}
else

View File

@ -52,6 +52,14 @@ public:
/* virtula */BOOL postBuild();
/* virtual */void setDocked(bool docked, bool pop_on_undock = true);
/* virtual */void draw();
/*virtual*/ void setVisible(BOOL visible);
private:
/**
* Provides unique of dockable floater.
* If dockable floater already exists it should be closed.
*/
void resetInstance();
protected:
void setDockControl(LLDockControl* dockControl);
@ -61,6 +69,7 @@ protected:
private:
std::auto_ptr<LLDockControl> mDockControl;
LLUIImagePtr mDockTongue;
static LLDockableFloater* instance;
};
#endif /* LL_DOCKABLEFLOATER_H */

View File

@ -44,6 +44,7 @@ LLFilterEditor::LLFilterEditor(const LLFilterEditor::Params& p)
line_editor_p.rect(getLocalRect());
line_editor_p.follows.flags(FOLLOWS_ALL);
line_editor_p.text_pad_right(getRect().getHeight());
line_editor_p.revert_on_esc(false);
line_editor_p.keystroke_callback(boost::bind(&LLUICtrl::onCommit, this));
mFilterEditor = LLUICtrlFactory::create<LLLineEditor>(line_editor_p);

View File

@ -97,6 +97,7 @@ LLLineEditor::Params::Params()
background_image_focused("background_image_focused"),
select_on_focus("select_on_focus", false),
handle_edit_keys_directly("handle_edit_keys_directly", false),
revert_on_esc("revert_on_esc", true),
commit_on_focus_lost("commit_on_focus_lost", true),
ignore_tab("ignore_tab", true),
cursor_color("cursor_color"),
@ -130,7 +131,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
mMinHPixels(0), // computed in updateTextPadding() below
mMaxHPixels(0), // computed in updateTextPadding() below
mCommitOnFocusLost( p.commit_on_focus_lost ),
mRevertOnEsc( TRUE ),
mRevertOnEsc( p.revert_on_esc ),
mKeystrokeCallback( p.keystroke_callback() ),
mIsSelecting( FALSE ),
mSelectionStart( 0 ),

View File

@ -90,6 +90,7 @@ public:
Optional<bool> select_on_focus,
handle_edit_keys_directly,
revert_on_esc,
commit_on_focus_lost,
ignore_tab;

View File

@ -3371,6 +3371,34 @@ BOOL LLMenuHolderGL::handleRightMouseUp( S32 x, S32 y, MASK mask )
return handled;
}
BOOL LLMenuHolderGL::handleKey(KEY key, MASK mask, BOOL called_from_parent)
{
BOOL handled = false;
LLMenuGL* const pMenu = dynamic_cast<LLMenuGL*>(getVisibleMenu());
if (pMenu)
{
//handle ESCAPE and RETURN key
handled = LLPanel::handleKey(key, mask, called_from_parent);
if (!handled)
{
if (pMenu->getHighlightedItem())
{
handled = pMenu->handleKey(key, mask, TRUE);
}
else
{
//highlight first enabled one
pMenu->highlightNextItem(NULL);
handled = true;
}
}
}
return handled;
}
void LLMenuHolderGL::reshape(S32 width, S32 height, BOOL called_from_parent)
{
if (width != getRect().getWidth() || height != getRect().getHeight())
@ -3380,17 +3408,17 @@ void LLMenuHolderGL::reshape(S32 width, S32 height, BOOL called_from_parent)
LLView::reshape(width, height, called_from_parent);
}
BOOL LLMenuHolderGL::hasVisibleMenu() const
LLView* const LLMenuHolderGL::getVisibleMenu() const
{
for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
{
LLView* viewp = *child_it;
if (viewp->getVisible() && dynamic_cast<LLMenuBarGL*>(viewp) == NULL)
{
return TRUE;
return viewp;
}
}
return FALSE;
return NULL;
}

View File

@ -772,8 +772,10 @@ public:
// Close context menus on right mouse up not handled by menus.
/*virtual*/ BOOL handleRightMouseUp( S32 x, S32 y, MASK mask );
virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
virtual const LLRect getMenuRect() const { return getLocalRect(); }
virtual BOOL hasVisibleMenu() const;
LLView*const getVisibleMenu() const;
virtual BOOL hasVisibleMenu() const {return getVisibleMenu() != NULL;}
static void setActivatedItem(LLMenuItemGL* item);

View File

@ -350,7 +350,7 @@ public:
void sortOnce(S32 column, BOOL ascending);
// manually call this whenever editing list items in place to flag need for resorting
void setNeedsSort() { mSorted = false; }
void setNeedsSort(bool val = true) { mSorted = !val; }
void dirtyColumns(); // some operation has potentially affected column layout or ordering
protected:

View File

@ -37,12 +37,12 @@
#include "llchiclet.h"
#include "llfloaterreg.h"
#include "llflyoutbutton.h"
#include "llimpanel.h" // for LLIMFloater
#include "lllayoutstack.h"
#include "llnearbychatbar.h"
#include "llsplitbutton.h"
#include "llsyswellwindow.h"
#include "llfloatercamera.h"
#include "llimpanel.h"
LLBottomTray::LLBottomTray(const LLSD&)
: mChicletPanel(NULL),
@ -119,6 +119,7 @@ void LLBottomTray::onChicletClick(LLUICtrl* ctrl)
}
}
// *TODO Vadim: why void* ?
void* LLBottomTray::createNearbyChatBar(void* userdata)
{
return new LLNearbyChatBar();
@ -126,30 +127,19 @@ void* LLBottomTray::createNearbyChatBar(void* userdata)
LLIMChiclet* LLBottomTray::createIMChiclet(const LLUUID& session_id)
{
if(session_id.isNull())
{
return NULL;
}
LLIMChiclet::EType im_chiclet_type = LLIMChiclet::getIMSessionType(session_id);
LLFloaterIMPanel* im = LLIMMgr::getInstance()->findFloaterBySession(session_id);
if (!im)
switch (im_chiclet_type)
{
return NULL; //should never happen
}
switch(im->getDialogType())
{
case IM_NOTHING_SPECIAL:
case LLIMChiclet::TYPE_IM:
return getChicletPanel()->createChiclet<LLIMP2PChiclet>(session_id);
break;
case IM_SESSION_GROUP_START:
case IM_SESSION_INVITE:
case LLIMChiclet::TYPE_GROUP:
return getChicletPanel()->createChiclet<LLIMGroupChiclet>(session_id);
break;
default:
return NULL;
case LLIMChiclet::TYPE_UNKNOWN:
break;
}
return NULL;
}
//virtual
@ -273,4 +263,10 @@ void LLBottomTray::showCameraAndMoveControls(BOOL visible)
{
mCamPanel->setVisible(visible);
mMovementPanel->setVisible(visible);
if (!visible)
{
LLFloaterReg::hideFloaterInstance("moveview");
LLFloaterReg::hideFloaterInstance("camera");
}
}

View File

@ -214,6 +214,37 @@ void LLIMChiclet::draw()
gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.0f,0.0f,0.0f,1.f), FALSE);
}
// static
LLIMChiclet::EType LLIMChiclet::getIMSessionType(const LLUUID& session_id)
{
EType type = TYPE_UNKNOWN;
LLFloaterIMPanel* im = NULL;
if(session_id.isNull())
return type;
if (!(im = LLIMMgr::getInstance()->findFloaterBySession(session_id)))
{
llassert_always(0 && "IM session not found"); // should never happen
return type;
}
switch(im->getDialogType())
{
case IM_NOTHING_SPECIAL:
type = TYPE_IM;
break;
case IM_SESSION_GROUP_START:
case IM_SESSION_INVITE:
type = TYPE_GROUP;
break;
default:
break;
}
return type;
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@ -224,6 +255,7 @@ LLIMP2PChiclet::Params::Params()
, speaker("speaker")
, show_speaker("show_speaker")
{
// *TODO Vadim: Get rid of hardcoded values.
rect(LLRect(0, 25, 45, 0));
avatar_icon.name("avatar_icon");
@ -1028,11 +1060,14 @@ BOOL LLChicletPanel::handleScrollWheel(S32 x, S32 y, S32 clicks)
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// *TODO Vadim: Move this out of llchiclet.cpp.
LLTalkButton::Params::Params()
: speak_button("speak_button")
, show_button("show_button")
, monitor("monitor")
{
// *TODO Vadim: move hardcoded labels (!) and other params to XUI.
speak_button.name("left");
speak_button.label("Speak");
speak_button.label_selected("Speak");

View File

@ -272,6 +272,11 @@ private:
class LLIMChiclet : public LLChiclet
{
public:
enum EType {
TYPE_UNKNOWN,
TYPE_IM,
TYPE_GROUP
};
/*virtual*/ ~LLIMChiclet() {};
@ -306,6 +311,19 @@ public:
*/
/*virtual*/ void draw();
/**
* Determine whether given ID refers to a group or an IM chat session.
*
* This is used when we need to chose what IM chiclet (P2P/group)
* class to instantiate.
*
* @param session_id session ID.
* @return TYPE_GROUP in case of group chat session,
* TYPE_IM in case of P2P session,
* TYPE_UNKNOWN otherwise.
*/
static EType getIMSessionType(const LLUUID& session_id);
/**
* The action taken on mouse down event.
*
@ -368,7 +386,7 @@ public:
Params();
};
void setOtherParticipantId(const LLUUID& other_participant_id);
/* virtual */ void setOtherParticipantId(const LLUUID& other_participant_id);
/*virtual*/ void setShowSpeaker(bool show);

View File

@ -77,14 +77,20 @@ BOOL LLGroupList::update(const std::string& name_filter)
const LLGroupData& group_data = gAgent.mGroups.get(i);
if (name_filter != LLStringUtil::null && !findInsensitive(group_data.mName, name_filter))
continue;
addItem(id, group_data.mName, highlight_id == id, ADD_BOTTOM);
addItem(id, group_data.mName, highlight_id == id, ADD_BOTTOM); // ADD_SORTED can only sort by first column anyway
}
// Force sorting the list.
updateSort();
// add "none" to list at top
{
std::string loc_none = LLTrans::getString("GroupsNone");
if (name_filter == LLStringUtil::null || findInsensitive(loc_none, name_filter))
addItem(LLUUID::null, loc_none, highlight_id.isNull(), ADD_TOP);
// Prevent the "none" item from being sorted.
setNeedsSort(false);
}
group_list->selectByValue(highlight_id);

View File

@ -324,7 +324,7 @@ BOOL LLLocationInputCtrl::handleKeyHere(KEY key, MASK mask)
{
BOOL result = LLComboBox::handleKeyHere(key, mask);
if (key == KEY_DOWN && hasFocus() && mList->getItemCount() != 0)
if (key == KEY_DOWN && hasFocus() && mList->getItemCount() != 0 && !mList->getVisible())
{
showList();
}

View File

@ -300,8 +300,8 @@ void LLNavigationBar::onSearchCommit()
if(!search_query.empty())
{
LLSearchHistory::getInstance()->addEntry(search_query);
invokeSearch(mSearchComboBox->getValue().asString());
}
invokeSearch(search_query);
}
void LLNavigationBar::onTeleportHistoryMenuItemClicked(const LLSD& userdata)

View File

@ -152,19 +152,16 @@ void LLSearchComboBox::onSelectionCommit()
{
std::string search_query = getSimple();
LLStringUtil::trim(search_query);
if(search_query.empty())
{
mTextEntry->setText(search_query);
setControlValue(search_query);
return;
}
remove(search_query);
add(search_query, ADD_TOP);
mTextEntry->setText(search_query);
setControlValue(search_query);
if(!search_query.empty())
{
remove(search_query);
add(search_query, ADD_TOP);
}
LLUICtrl::onCommit();
}

View File

@ -181,7 +181,7 @@ void LLSysWellWindow::setVisible(BOOL visible)
if(mChannel)
mChannel->setShowToasts(!visible);
LLFloater::setVisible(visible);
LLDockableFloater::setVisible(visible);
}
//---------------------------------------------------------------------------------
@ -331,11 +331,28 @@ void LLSysWellWindow::sessionRemoved(const LLUUID& sessionId)
//---------------------------------------------------------------------------------
LLSysWellWindow::RowPanel::RowPanel(const LLSysWellWindow* parent, const LLUUID& sessionId,
S32 chicletCounter, const std::string& name, const LLUUID& otherParticipantId) :
LLScrollingPanel(LLPanel::Params()), mParent(parent)
LLScrollingPanel(LLPanel::Params()), mChiclet(NULL), mParent(parent)
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_activeim_row.xml", NULL);
mChiclet = getChild<LLIMChiclet>("chiclet");
// Choose which of the pre-created chiclets (IM/group) to use.
// The other one gets hidden.
LLIMChiclet::EType im_chiclet_type = LLIMChiclet::getIMSessionType(sessionId);
switch (im_chiclet_type)
{
case LLIMChiclet::TYPE_GROUP:
mChiclet = getChild<LLIMChiclet>("group_chiclet");
childSetVisible("p2p_chiclet", false);
break;
case LLIMChiclet::TYPE_UNKNOWN: // assign mChiclet a non-null value anyway
case LLIMChiclet::TYPE_IM:
mChiclet = getChild<LLIMChiclet>("p2p_chiclet");
childSetVisible("group_chiclet", false);
break;
}
// Initialize chiclet.
mChiclet->setCounter(chicletCounter);
mChiclet->setSessionId(sessionId);
mChiclet->setIMSessionName(name);

View File

@ -69,6 +69,7 @@ public:
virtual void setVisible(BOOL visible);
void adjustWindowPosition();
void toggleWindow();
/*virtua*/BOOL canClose() { return FALSE; }
// Handlers
void onItemClick(LLSysWellItem* item);

View File

@ -2073,6 +2073,11 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
{
return TRUE;
}
//some of context menus use this container, let context menu handle navigation keys
if(gMenuHolder && gMenuHolder->handleKey(key, mask, TRUE))
{
return TRUE;
}
// Traverses up the hierarchy
LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();

View File

@ -11,7 +11,7 @@
bevel_style="in"
bg_alpha_color="0 0 0 0">
<chiclet_im_p2p
name="chiclet"
name="p2p_chiclet"
layout="topleft"
follows="left"
top="5"
@ -19,6 +19,15 @@
height="25"
width="45">
</chiclet_im_p2p>
<chiclet_im_group
name="group_chiclet"
layout="topleft"
follows="left"
top="5"
left="5"
height="25"
width="45">
</chiclet_im_group>
<text
type="string"
name="contact_name"

View File

@ -33,12 +33,13 @@
top="0"
width="5"/>
<layout_panel
auto_resize="false"
follows="left|right"
height="28"
layout="topleft"
left="5"
min_height="28"
width="500"
width="600"
top="0"
min_width="305"
name="chat_bar"

View File

@ -17,6 +17,7 @@
show_text_as_tentative="false"
max_chars="20"
follows="left|top"
allow_new_values="true"
>
<info_button name="Place Information"
label=""

View File

@ -5,6 +5,7 @@
show_text_as_tentative="false"
dropdown_button_visible="false"
max_chars="256"
allow_new_values="true"
background_image="TextField_Search_Off"
background_image_disabled="TextField_Search_Disabled"
background_image_focused="TextField_Search_Active">