Updated LLView:
-Removed a few extra unneeded virtuals -Pulled tabgroups out of llpanel and into LLView -removeChild doesn't support delete. Delete manually. -addChildAtEnd renamed to addChildInBack -getScreenRect renamed to calcScreenRect -added calcScreenBoundingRect and calcBoundingRect(which updateBoundingRect calls -General cleanup. Someone at LL figured out that dynamic_cast actually exists. Fixed PieMenu not reliably centering on cursor. Fixed context menu crash in line and text editors. Classes with LLEditMenuHandler as a base do not need to set gEditMenuHandler to NULL, since LLEditMenuHandler's dtor does that already!
This commit is contained in:
@@ -1568,10 +1568,12 @@ void LLFloater::setCanResize(BOOL can_resize)
|
||||
{
|
||||
for (S32 i = 0; i < 4; i++)
|
||||
{
|
||||
removeChild(mResizeBar[i], TRUE);
|
||||
removeChild(mResizeBar[i]);
|
||||
delete mResizeBar[i];
|
||||
mResizeBar[i] = NULL;
|
||||
|
||||
removeChild(mResizeHandle[i], TRUE);
|
||||
removeChild(mResizeHandle[i]);
|
||||
delete mResizeHandle[i];
|
||||
mResizeHandle[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,6 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect,
|
||||
:
|
||||
LLUICtrl( name, rect, TRUE, commit_callback, userdata, FOLLOWS_TOP | FOLLOWS_LEFT ),
|
||||
mMaxLengthBytes(max_length_bytes),
|
||||
mPopupMenuHandle(),
|
||||
mCursorPos( 0 ),
|
||||
mScrollHPos( 0 ),
|
||||
mTextPadLeft(0),
|
||||
@@ -140,7 +139,8 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect,
|
||||
mHaveHistory(FALSE),
|
||||
mImage( sImage ),
|
||||
mReplaceNewlinesWithSpaces( TRUE ),
|
||||
mSpellCheckable( FALSE )
|
||||
mSpellCheckable( FALSE ),
|
||||
mContextMenuHandle()
|
||||
{
|
||||
llassert( max_length_bytes > 0 );
|
||||
|
||||
@@ -195,26 +195,21 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect,
|
||||
//menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor"));
|
||||
menu->setCanTearOff(FALSE);
|
||||
menu->setVisible(FALSE);
|
||||
mPopupMenuHandle = menu->getHandle();
|
||||
setContextMenu(menu);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LLLineEditor::~LLLineEditor()
|
||||
{
|
||||
mCommitOnFocusLost = FALSE;
|
||||
|
||||
// calls onCommit() while LLLineEditor still valid
|
||||
gFocusMgr.releaseFocusIfNeeded( this );
|
||||
|
||||
if( gEditMenuHandler == this )
|
||||
{
|
||||
gEditMenuHandler = NULL;
|
||||
}
|
||||
LLView::deleteViewByHandle(mPopupMenuHandle);
|
||||
}
|
||||
|
||||
|
||||
void LLLineEditor::onFocusReceived()
|
||||
{
|
||||
gEditMenuHandler = this;
|
||||
LLUICtrl::onFocusReceived();
|
||||
updateAllowingLanguageInput();
|
||||
}
|
||||
@@ -646,105 +641,6 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOL LLLineEditor::handleRightMouseDown( S32 x, S32 y, MASK mask )
|
||||
{
|
||||
setFocus(TRUE);
|
||||
|
||||
//setCursorAtLocalPos( x);
|
||||
S32 wordStart = 0;
|
||||
S32 wordLen = 0;
|
||||
S32 pos = calculateCursorFromMouse(x);
|
||||
|
||||
LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
|
||||
if (menu)
|
||||
{
|
||||
if(menu->isOpen())
|
||||
{
|
||||
menu->setVisible(FALSE);
|
||||
}
|
||||
for (int i = 0;i<(int)suggestionMenuItems.size();i++)
|
||||
{
|
||||
SpellMenuBind * tempBind = suggestionMenuItems[i];
|
||||
if(tempBind)
|
||||
{
|
||||
menu->removeChild((LLMenuItemCallGL *)tempBind->menuItem);
|
||||
((LLMenuItemCallGL *)tempBind->menuItem)->die();
|
||||
//delete tempBind->menuItem;
|
||||
//tempBind->menuItem = NULL;
|
||||
delete tempBind;
|
||||
}
|
||||
}
|
||||
suggestionMenuItems.clear();
|
||||
|
||||
// spell_check="true" in xui
|
||||
menu->setItemVisible("Spelsep", !mReadOnly && mSpellCheckable);
|
||||
if (!mReadOnly && mSpellCheckable)
|
||||
{
|
||||
// search for word matches
|
||||
bool is_word_part = getWordBoundriesAt(pos, &wordStart, &wordLen);
|
||||
if (is_word_part)
|
||||
{
|
||||
const LLWString& text = mText.getWString();
|
||||
std::string selectedWord(std::string(text.begin(), text.end()).substr(wordStart,wordLen));
|
||||
|
||||
if (!glggHunSpell->isSpelledRight(selectedWord))
|
||||
{
|
||||
//misspelled word here, and you have just right clicked on it!
|
||||
std::vector<std::string> suggs = glggHunSpell->getSuggestionList(selectedWord);
|
||||
|
||||
for (int i = 0; i<(int)suggs.size() ;i++)
|
||||
{
|
||||
SpellMenuBind * tempStruct = new SpellMenuBind;
|
||||
tempStruct->origin = this;
|
||||
tempStruct->word = suggs[i];
|
||||
tempStruct->wordPositionEnd = wordStart + wordLen;
|
||||
tempStruct->wordPositionStart=wordStart;
|
||||
LLMenuItemCallGL * suggMenuItem = new LLMenuItemCallGL(
|
||||
tempStruct->word, spell_correct, NULL, tempStruct);
|
||||
//new LLMenuItemCallGL("Select All", context_selectall, NULL, this));
|
||||
tempStruct->menuItem = suggMenuItem;
|
||||
suggestionMenuItems.push_back(tempStruct);
|
||||
menu->addChild(suggMenuItem);
|
||||
}
|
||||
SpellMenuBind * tempStruct = new SpellMenuBind;
|
||||
tempStruct->origin = this;
|
||||
tempStruct->word = selectedWord;
|
||||
tempStruct->wordPositionEnd = wordStart + wordLen;
|
||||
tempStruct->wordPositionStart=wordStart;
|
||||
LLMenuItemCallGL * suggMenuItem = new LLMenuItemCallGL(
|
||||
"Add Word", spell_add, NULL, tempStruct);
|
||||
tempStruct->menuItem = suggMenuItem;
|
||||
suggestionMenuItems.push_back(tempStruct);
|
||||
menu->addChild(suggMenuItem);
|
||||
}
|
||||
}
|
||||
|
||||
SpellMenuBind * tempStruct = new SpellMenuBind;
|
||||
tempStruct->origin = this;
|
||||
if (glggHunSpell->getSpellCheckHighlight())
|
||||
{
|
||||
tempStruct->word = "Hide Misspellings";
|
||||
}
|
||||
else
|
||||
{
|
||||
tempStruct->word = "Show Misspellings";
|
||||
}
|
||||
LLMenuItemCallGL * suggMenuItem = new LLMenuItemCallGL(
|
||||
tempStruct->word, spell_show, NULL, tempStruct);
|
||||
tempStruct->menuItem = suggMenuItem;
|
||||
suggestionMenuItems.push_back(tempStruct);
|
||||
menu->addChild(suggMenuItem);
|
||||
}
|
||||
|
||||
mLastContextMenuX = x;
|
||||
menu->buildDrawLabels();
|
||||
menu->updateParent(LLMenuGL::sMenuContainer);
|
||||
LLMenuGL::showPopup(this, menu, x, y);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
// Check first whether the "clear search" button wants to deal with this.
|
||||
@@ -836,6 +732,16 @@ BOOL LLLineEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL LLLineEditor::handleRightMouseDown(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
setFocus(TRUE);
|
||||
if (!LLUICtrl::handleRightMouseDown(x, y, mask))
|
||||
{
|
||||
showContextMenu(x, y);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
BOOL handled = FALSE;
|
||||
@@ -1616,7 +1522,7 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask )
|
||||
|
||||
// SL-51858: Key presses are not being passed to the Popup menu.
|
||||
// A proper fix is non-trivial so instead just close the menu.
|
||||
LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
|
||||
LLMenuGL* menu = (LLMenuGL*)mContextMenuHandle.get();
|
||||
if (menu && menu->isOpen())
|
||||
{
|
||||
LLMenuGL::sMenuContainer->hideMenus();
|
||||
@@ -1698,7 +1604,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char)
|
||||
{
|
||||
// SL-51858: Key presses are not being passed to the Popup menu.
|
||||
// A proper fix is non-trivial so instead just close the menu.
|
||||
LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
|
||||
LLMenuGL* menu = (LLMenuGL*)mContextMenuHandle.get();
|
||||
if (menu && menu->isOpen())
|
||||
{
|
||||
LLMenuGL::sMenuContainer->hideMenus();
|
||||
@@ -2061,7 +1967,7 @@ void LLLineEditor::draw()
|
||||
|
||||
// Make sure the IME is in the right place
|
||||
S32 pixels_after_scroll = findPixelNearestPos(); // RCalculcate for IME position
|
||||
LLRect screen_pos = getScreenRect();
|
||||
LLRect screen_pos = calcScreenRect();
|
||||
LLCoordGL ime_pos( screen_pos.mLeft + pixels_after_scroll, screen_pos.mTop - UI_LINEEDITOR_V_PAD );
|
||||
|
||||
ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]);
|
||||
@@ -3070,6 +2976,121 @@ LLWString LLLineEditor::getConvertedText() const
|
||||
return text;
|
||||
}
|
||||
|
||||
void LLLineEditor::showContextMenu(S32 x, S32 y)
|
||||
{
|
||||
LLMenuGL* menu = static_cast<LLMenuGL*>(mContextMenuHandle.get());
|
||||
|
||||
if (menu)
|
||||
{
|
||||
gEditMenuHandler = this;
|
||||
|
||||
/*S32 screen_x, screen_y;
|
||||
localPointToScreen(x, y, &screen_x, &screen_y);
|
||||
menu->show(screen_x, screen_y);*/
|
||||
|
||||
|
||||
//setCursorAtLocalPos( x);
|
||||
S32 wordStart = 0;
|
||||
S32 wordLen = 0;
|
||||
S32 pos = calculateCursorFromMouse(x);
|
||||
|
||||
LLMenuGL* menu = (LLMenuGL*)mContextMenuHandle.get();
|
||||
if (menu)
|
||||
{
|
||||
if(menu->isOpen())
|
||||
{
|
||||
menu->setVisible(FALSE);
|
||||
}
|
||||
for (int i = 0;i<(int)suggestionMenuItems.size();i++)
|
||||
{
|
||||
SpellMenuBind * tempBind = suggestionMenuItems[i];
|
||||
if(tempBind)
|
||||
{
|
||||
menu->removeChild((LLMenuItemCallGL *)tempBind->menuItem);
|
||||
((LLMenuItemCallGL *)tempBind->menuItem)->die();
|
||||
//delete tempBind->menuItem;
|
||||
//tempBind->menuItem = NULL;
|
||||
delete tempBind;
|
||||
}
|
||||
}
|
||||
suggestionMenuItems.clear();
|
||||
|
||||
// spell_check="true" in xui
|
||||
menu->setItemVisible("Spelsep", !mReadOnly && mSpellCheckable);
|
||||
if (!mReadOnly && mSpellCheckable)
|
||||
{
|
||||
// search for word matches
|
||||
bool is_word_part = getWordBoundriesAt(pos, &wordStart, &wordLen);
|
||||
if (is_word_part)
|
||||
{
|
||||
const LLWString& text = mText.getWString();
|
||||
std::string selectedWord(std::string(text.begin(), text.end()).substr(wordStart,wordLen));
|
||||
|
||||
if (!glggHunSpell->isSpelledRight(selectedWord))
|
||||
{
|
||||
//misspelled word here, and you have just right clicked on it!
|
||||
std::vector<std::string> suggs = glggHunSpell->getSuggestionList(selectedWord);
|
||||
|
||||
for (int i = 0; i<(int)suggs.size() ;i++)
|
||||
{
|
||||
SpellMenuBind * tempStruct = new SpellMenuBind;
|
||||
tempStruct->origin = this;
|
||||
tempStruct->word = suggs[i];
|
||||
tempStruct->wordPositionEnd = wordStart + wordLen;
|
||||
tempStruct->wordPositionStart=wordStart;
|
||||
LLMenuItemCallGL * suggMenuItem = new LLMenuItemCallGL(
|
||||
tempStruct->word, spell_correct, NULL, tempStruct);
|
||||
//new LLMenuItemCallGL("Select All", context_selectall, NULL, this));
|
||||
tempStruct->menuItem = suggMenuItem;
|
||||
suggestionMenuItems.push_back(tempStruct);
|
||||
menu->addChild(suggMenuItem);
|
||||
}
|
||||
SpellMenuBind * tempStruct = new SpellMenuBind;
|
||||
tempStruct->origin = this;
|
||||
tempStruct->word = selectedWord;
|
||||
tempStruct->wordPositionEnd = wordStart + wordLen;
|
||||
tempStruct->wordPositionStart=wordStart;
|
||||
LLMenuItemCallGL * suggMenuItem = new LLMenuItemCallGL(
|
||||
"Add Word", spell_add, NULL, tempStruct);
|
||||
tempStruct->menuItem = suggMenuItem;
|
||||
suggestionMenuItems.push_back(tempStruct);
|
||||
menu->addChild(suggMenuItem);
|
||||
}
|
||||
}
|
||||
|
||||
SpellMenuBind * tempStruct = new SpellMenuBind;
|
||||
tempStruct->origin = this;
|
||||
if (glggHunSpell->getSpellCheckHighlight())
|
||||
{
|
||||
tempStruct->word = "Hide Misspellings";
|
||||
}
|
||||
else
|
||||
{
|
||||
tempStruct->word = "Show Misspellings";
|
||||
}
|
||||
LLMenuItemCallGL * suggMenuItem = new LLMenuItemCallGL(
|
||||
tempStruct->word, spell_show, NULL, tempStruct);
|
||||
tempStruct->menuItem = suggMenuItem;
|
||||
suggestionMenuItems.push_back(tempStruct);
|
||||
menu->addChild(suggMenuItem);
|
||||
}
|
||||
|
||||
mLastContextMenuX = x;
|
||||
menu->buildDrawLabels();
|
||||
menu->updateParent(LLMenuGL::sMenuContainer);
|
||||
LLMenuGL::showPopup(this, menu, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLLineEditor::setContextMenu(LLMenuGL* new_context_menu)
|
||||
{
|
||||
if (new_context_menu)
|
||||
mContextMenuHandle = new_context_menu->getHandle();
|
||||
else
|
||||
mContextMenuHandle.markDead();
|
||||
}
|
||||
|
||||
static LLRegisterWidget<LLSearchEditor> r2("search_editor");
|
||||
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
class LLFontGL;
|
||||
class LLLineEditorRollback;
|
||||
class LLButton;
|
||||
class LLMenuGL;
|
||||
|
||||
typedef BOOL (*LLLinePrevalidateFunc)(const LLWString &wstr);
|
||||
|
||||
@@ -79,6 +80,9 @@ public:
|
||||
LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE,
|
||||
S32 border_thickness = 1);
|
||||
|
||||
protected:
|
||||
void showContextMenu(S32 x, S32 y);
|
||||
public:
|
||||
virtual ~LLLineEditor();
|
||||
|
||||
virtual LLXMLNodePtr getXML(bool save_children = true) const;
|
||||
@@ -252,7 +256,9 @@ public:
|
||||
void updateHistory(); // stores current line in history
|
||||
|
||||
void setReplaceNewlinesWithSpaces(BOOL replace);
|
||||
|
||||
|
||||
void setContextMenu(LLMenuGL* new_context_menu);
|
||||
|
||||
private:
|
||||
// private helper methods
|
||||
|
||||
@@ -285,7 +291,6 @@ private:
|
||||
virtual S32 getPreeditFontSize() const;
|
||||
|
||||
protected:
|
||||
LLHandle<LLView> mPopupMenuHandle;
|
||||
LLUIString mText; // The string being edited.
|
||||
std::string mPrevText; // Saved string for 'ESC' revert
|
||||
LLUIString mLabel; // text label that is visible when no user text provided
|
||||
@@ -359,6 +364,8 @@ protected:
|
||||
std::vector<S32> mPreeditPositions;
|
||||
LLPreeditor::standouts_t mPreeditStandouts;
|
||||
|
||||
LLHandle<LLView> mContextMenuHandle;
|
||||
|
||||
private:
|
||||
// Utility on top of LLUI::getUIImage, looks up a named image in a given XML node and returns it if possible
|
||||
// or returns a given default image if anything in the process fails.
|
||||
|
||||
@@ -1699,7 +1699,7 @@ BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask)
|
||||
{
|
||||
BOOL menu_open = getBranch()->getVisible();
|
||||
// don't do keyboard navigation of top-level menus unless in keyboard mode, or menu expanded
|
||||
if (getHighlight() && getMenu()->getVisible() && (isActive() || LLMenuGL::getKeyboardMode()))
|
||||
if (getHighlight() && getMenu()->isOpen() && (isActive() || LLMenuGL::getKeyboardMode()))
|
||||
{
|
||||
if (key == KEY_LEFT)
|
||||
{
|
||||
@@ -3314,6 +3314,9 @@ protected:
|
||||
LLPieMenu* mBranch;
|
||||
};
|
||||
|
||||
const F32 PIE_MENU_WIDTH = 190;
|
||||
const F32 PIE_MENU_HEIGHT = 190;
|
||||
|
||||
LLPieMenuBranch::LLPieMenuBranch(const std::string& name,
|
||||
const std::string& label,
|
||||
LLPieMenu* branch)
|
||||
@@ -3396,6 +3399,7 @@ LLPieMenu::LLPieMenu(const std::string& name, const std::string& label)
|
||||
mCurRadius(0.f),
|
||||
mRightMouseDown(FALSE)
|
||||
{
|
||||
setRect(LLRect(0,PIE_MENU_HEIGHT,PIE_MENU_WIDTH,0));
|
||||
LLMenuGL::setVisible(FALSE);
|
||||
}
|
||||
|
||||
@@ -3410,6 +3414,7 @@ LLPieMenu::LLPieMenu(const std::string& name)
|
||||
mCurRadius(0.f),
|
||||
mRightMouseDown(FALSE)
|
||||
{
|
||||
setRect(LLRect(0,PIE_MENU_HEIGHT,PIE_MENU_WIDTH,0));
|
||||
LLMenuGL::setVisible(FALSE);
|
||||
}
|
||||
|
||||
@@ -3836,9 +3841,6 @@ BOOL LLPieMenu::appendPieMenu(LLPieMenu *menu)
|
||||
// virtual
|
||||
void LLPieMenu::arrange()
|
||||
{
|
||||
const S32 rect_height = 190;
|
||||
const S32 rect_width = 190;
|
||||
|
||||
// all divide by 6
|
||||
const S32 CARD_X = 60;
|
||||
const S32 DIAG_X = 48;
|
||||
@@ -3848,8 +3850,6 @@ void LLPieMenu::arrange()
|
||||
const S32 ITEM_CENTER_X[] = { CARD_X, DIAG_X, 0, -DIAG_X, -CARD_X, -DIAG_X, 0, DIAG_X };
|
||||
const S32 ITEM_CENTER_Y[] = { 0, DIAG_Y, CARD_Y, DIAG_Y, 0, -DIAG_Y, -CARD_Y, -DIAG_Y };
|
||||
|
||||
LLRect rect;
|
||||
|
||||
S32 font_height = 0;
|
||||
if( mItems.size() )
|
||||
{
|
||||
@@ -3862,8 +3862,7 @@ void LLPieMenu::arrange()
|
||||
|
||||
// TODO: Compute actual bounding rect for menu
|
||||
|
||||
// HACK: casting away const. Should use setRect or some helper function instead.
|
||||
const_cast<LLRect&>(getRect()).setOriginAndSize(getRect().mLeft, getRect().mBottom, rect_width, rect_height );
|
||||
LLRect rect = getRect();
|
||||
|
||||
// place items around a circle, with item 0 at positive X,
|
||||
// rotating counter-clockwise
|
||||
@@ -3881,7 +3880,7 @@ void LLPieMenu::arrange()
|
||||
item_width, font_height );
|
||||
|
||||
// Correct for the actual rectangle size
|
||||
rect.translate( rect_width/2, rect_height/2 );
|
||||
rect.translate( getRect().getWidth()/2, getRect().getHeight()/2 );
|
||||
|
||||
item->setRect( rect );
|
||||
|
||||
@@ -3979,62 +3978,38 @@ void LLPieMenu::show(S32 x, S32 y, BOOL mouse_down)
|
||||
const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getMenuRect();
|
||||
|
||||
LLView* parent_view = getParent();
|
||||
BOOL moved = FALSE;
|
||||
|
||||
S32 local_x, local_y;
|
||||
parent_view->screenPointToLocal(x, y, &local_x, &local_y);
|
||||
|
||||
// HACK: casting away const. Should use setRect or some helper function instead.
|
||||
const_cast<LLRect&>(getRect()).setCenterAndSize(local_x, local_y, width, height);
|
||||
LLRect rect;
|
||||
rect.setCenterAndSize(local_x, local_y, width, height);
|
||||
setRect(rect);
|
||||
|
||||
arrange();
|
||||
|
||||
// Adjust the pie rectangle to keep it on screen
|
||||
if (getRect().mLeft < menu_region_rect.mLeft)
|
||||
if(!menu_region_rect.contains(rect))
|
||||
{
|
||||
//mShiftHoriz = menu_region_rect.mLeft - getRect().mLeft;
|
||||
//getRect().translate( mShiftHoriz, 0 );
|
||||
// HACK: casting away const. Should use setRect or some helper function instead.
|
||||
const_cast<LLRect&>(getRect()).translate( menu_region_rect.mLeft - getRect().mLeft, 0 );
|
||||
moved = TRUE;
|
||||
}
|
||||
|
||||
if (getRect().mRight > menu_region_rect.mRight)
|
||||
{
|
||||
//mShiftHoriz = menu_region_rect.mRight - getRect().mRight;
|
||||
//getRect().translate( mShiftHoriz, 0);
|
||||
// HACK: casting away const. Should use setRect or some helper function instead.
|
||||
const_cast<LLRect&>(getRect()).translate( menu_region_rect.mRight - getRect().mRight, 0 );
|
||||
moved = TRUE;
|
||||
}
|
||||
|
||||
if (getRect().mBottom < menu_region_rect.mBottom)
|
||||
{
|
||||
//mShiftVert = menu_region_rect.mBottom - getRect().mBottom;
|
||||
//getRect().translate( 0, mShiftVert );
|
||||
// HACK: casting away const. Should use setRect or some helper function instead.
|
||||
const_cast<LLRect&>(getRect()).translate( 0, menu_region_rect.mBottom - getRect().mBottom );
|
||||
moved = TRUE;
|
||||
}
|
||||
|
||||
|
||||
if (getRect().mTop > menu_region_rect.mTop)
|
||||
{
|
||||
//mShiftVert = menu_region_rect.mTop - getRect().mTop;
|
||||
//getRect().translate( 0, mShiftVert );
|
||||
// HACK: casting away const. Should use setRect or some helper function instead.
|
||||
const_cast<LLRect&>(getRect()).translate( 0, menu_region_rect.mTop - getRect().mTop );
|
||||
moved = TRUE;
|
||||
}
|
||||
|
||||
// If we had to relocate the pie menu, put the cursor in the
|
||||
// center of its rectangle
|
||||
if (moved)
|
||||
{
|
||||
LLCoordGL center;
|
||||
center.mX = (getRect().mLeft + getRect().mRight) / 2;
|
||||
center.mY = (getRect().mTop + getRect().mBottom) / 2;
|
||||
|
||||
LLUI::setMousePositionLocal(getParent(), center.mX, center.mY);
|
||||
S32 trans[2]={0,0};
|
||||
if (rect.mLeft < menu_region_rect.mLeft)
|
||||
{
|
||||
trans[0] = menu_region_rect.mLeft - rect.mLeft;
|
||||
}
|
||||
else if (rect.mRight > menu_region_rect.mRight)
|
||||
{
|
||||
trans[0] = menu_region_rect.mRight - rect.mRight;
|
||||
}
|
||||
if (rect.mBottom < menu_region_rect.mBottom)
|
||||
{
|
||||
trans[1] = menu_region_rect.mBottom - rect.mBottom;
|
||||
}
|
||||
else if (rect.mTop > menu_region_rect.mTop)
|
||||
{
|
||||
trans[1] = menu_region_rect.mTop - rect.mTop;
|
||||
}
|
||||
setRect(rect.translate(trans[0],trans[1]));
|
||||
LLUI::setMousePositionLocal(getParent(),rect.getCenterX(), rect.getCenterY());
|
||||
}
|
||||
|
||||
// *FIX: what happens when mouse buttons reversed?
|
||||
|
||||
@@ -79,7 +79,6 @@ void LLPanel::init()
|
||||
mBorder = NULL;
|
||||
mDefaultBtn = NULL;
|
||||
setIsChrome(FALSE); //is this a decorator to a live window or a form?
|
||||
mLastTabGroup = 0;
|
||||
|
||||
mPanelHandle.bind(this);
|
||||
setTabStop(FALSE);
|
||||
@@ -269,20 +268,6 @@ void LLPanel::setDefaultBtn(const std::string& id)
|
||||
}
|
||||
}
|
||||
|
||||
void LLPanel::addCtrl( LLUICtrl* ctrl, S32 tab_group)
|
||||
{
|
||||
mLastTabGroup = tab_group;
|
||||
|
||||
LLView::addCtrl(ctrl, tab_group);
|
||||
}
|
||||
|
||||
void LLPanel::addCtrlAtEnd( LLUICtrl* ctrl, S32 tab_group)
|
||||
{
|
||||
mLastTabGroup = tab_group;
|
||||
|
||||
LLView::addCtrlAtEnd(ctrl, tab_group);
|
||||
}
|
||||
|
||||
BOOL LLPanel::handleKeyHere( KEY key, MASK mask )
|
||||
{
|
||||
BOOL handled = FALSE;
|
||||
@@ -1189,9 +1174,13 @@ void LLLayoutStack::draw()
|
||||
}
|
||||
}
|
||||
|
||||
void LLLayoutStack::removeCtrl(LLUICtrl* ctrl)
|
||||
void LLLayoutStack::removeChild(LLView* ctrl)
|
||||
{
|
||||
LLEmbeddedPanel* embedded_panelp = findEmbeddedPanel((LLPanel*)ctrl);
|
||||
LLView::removeChild(ctrl);
|
||||
LLPanel* panel = dynamic_cast<LLPanel*>(ctrl);
|
||||
if(!panel)
|
||||
return;
|
||||
LLEmbeddedPanel* embedded_panelp = findEmbeddedPanel(panel);
|
||||
|
||||
if (embedded_panelp)
|
||||
{
|
||||
@@ -1200,10 +1189,8 @@ void LLLayoutStack::removeCtrl(LLUICtrl* ctrl)
|
||||
}
|
||||
|
||||
// need to update resizebars
|
||||
|
||||
|
||||
calcMinExtents();
|
||||
|
||||
LLView::removeCtrl(ctrl);
|
||||
}
|
||||
|
||||
LLXMLNodePtr LLLayoutStack::getXML(bool save_children) const
|
||||
|
||||
@@ -138,8 +138,6 @@ public:
|
||||
|
||||
LLHandle<LLPanel> getHandle() const { return mPanelHandle; }
|
||||
|
||||
S32 getLastTabGroup() const { return mLastTabGroup; }
|
||||
|
||||
const LLCallbackMap::map_t& getFactoryMap() const { return mFactoryMap; }
|
||||
|
||||
BOOL initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
|
||||
@@ -235,10 +233,6 @@ private:
|
||||
// common construction logic
|
||||
void init();
|
||||
|
||||
// From LLView
|
||||
virtual void addCtrl( LLUICtrl* ctrl, S32 tab_group );
|
||||
virtual void addCtrlAtEnd( LLUICtrl* ctrl, S32 tab_group);
|
||||
|
||||
// Unified error reporting for the child* functions
|
||||
typedef std::set<std::string> expected_members_list_t;
|
||||
mutable expected_members_list_t mExpectedMembers;
|
||||
@@ -253,7 +247,6 @@ private:
|
||||
LLViewBorder* mBorder;
|
||||
LLButton* mDefaultBtn;
|
||||
std::string mLabel;
|
||||
S32 mLastTabGroup;
|
||||
LLRootHandle<LLPanel> mPanelHandle;
|
||||
|
||||
typedef std::map<std::string, std::string> ui_string_map_t;
|
||||
@@ -278,7 +271,7 @@ public:
|
||||
|
||||
/*virtual*/ void draw();
|
||||
/*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
|
||||
/*virtual*/ void removeCtrl(LLUICtrl* ctrl);
|
||||
/*virtual*/ void removeChild(LLView* ctrl);
|
||||
|
||||
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ void LLScrollingPanelList::clearPanels()
|
||||
|
||||
void LLScrollingPanelList::addPanel( LLScrollingPanel* panel )
|
||||
{
|
||||
addChildAtEnd( panel );
|
||||
addChildInBack( panel );
|
||||
mPanelList.push_front( panel );
|
||||
|
||||
const S32 GAP_BETWEEN_PANELS = 6;
|
||||
|
||||
@@ -745,11 +745,6 @@ S32 LLScrollListCtrl::getSearchColumn()
|
||||
LLScrollListCtrl::~LLScrollListCtrl()
|
||||
{
|
||||
std::for_each(mItemList.begin(), mItemList.end(), DeletePointer());
|
||||
|
||||
if( gEditMenuHandler == this )
|
||||
{
|
||||
gEditMenuHandler = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -372,18 +372,12 @@ LLTextEditor::~LLTextEditor()
|
||||
{
|
||||
gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit()
|
||||
|
||||
// Route menu back to the default
|
||||
if( gEditMenuHandler == this )
|
||||
{
|
||||
gEditMenuHandler = NULL;
|
||||
}
|
||||
|
||||
// Scrollbar is deleted by LLView
|
||||
mHoverSegment = NULL;
|
||||
std::for_each(mSegments.begin(), mSegments.end(), DeletePointer());
|
||||
|
||||
std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer());
|
||||
LLView::deleteViewByHandle(mPopupMenuHandle);
|
||||
//LLView::deleteViewByHandle(mPopupMenuHandle);
|
||||
}
|
||||
void LLTextEditor::context_cut(void* data)
|
||||
{
|
||||
@@ -1461,6 +1455,7 @@ BOOL LLTextEditor::handleRightMouseDown( S32 x, S32 y, MASK mask )
|
||||
mLastContextMenuX = x;
|
||||
mLastContextMenuY = y;
|
||||
menu->buildDrawLabels();
|
||||
menu->updateParent(LLMenuGL::sMenuContainer);
|
||||
LLMenuGL::showPopup(this, menu, x, y);
|
||||
}
|
||||
return TRUE;
|
||||
@@ -3245,7 +3240,7 @@ void LLTextEditor::drawCursor()
|
||||
}
|
||||
|
||||
// Make sure the IME is in the right place
|
||||
LLRect screen_pos = getScreenRect();
|
||||
LLRect screen_pos = calcScreenRect();
|
||||
LLCoordGL ime_pos( screen_pos.mLeft + llfloor(cursor_left), screen_pos.mBottom + llfloor(cursor_top) );
|
||||
|
||||
ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]);
|
||||
|
||||
@@ -81,7 +81,9 @@ S32 LLView::sLastBottomXML = S32_MIN;
|
||||
BOOL LLView::sIsDrawing = FALSE;
|
||||
#endif
|
||||
|
||||
LLView::LLView() :
|
||||
LLView::LLView()
|
||||
: mVisible(TRUE),
|
||||
mInDraw(false),
|
||||
mParentView(NULL),
|
||||
mReshapeFlags(FOLLOWS_NONE),
|
||||
mDefaultTabGroup(0),
|
||||
@@ -92,18 +94,20 @@ LLView::LLView() :
|
||||
mIsFocusRoot(FALSE),
|
||||
mLastVisible(TRUE),
|
||||
mUseBoundingRect(FALSE),
|
||||
mVisible(TRUE),
|
||||
mNextInsertionOrdinal(0),
|
||||
mHoverCursor(UI_CURSOR_ARROW),
|
||||
mLastTabGroup(0),
|
||||
// <edit>
|
||||
mDelayedDelete(FALSE)
|
||||
// </edit>
|
||||
{
|
||||
}
|
||||
|
||||
LLView::LLView(const std::string& name, BOOL mouse_opaque) :
|
||||
mParentView(NULL),
|
||||
LLView::LLView(const std::string& name, BOOL mouse_opaque)
|
||||
: mVisible(TRUE),
|
||||
mInDraw(false),
|
||||
mName(name),
|
||||
mParentView(NULL),
|
||||
mReshapeFlags(FOLLOWS_NONE),
|
||||
mDefaultTabGroup(0),
|
||||
mEnabled(TRUE),
|
||||
@@ -113,9 +117,9 @@ LLView::LLView(const std::string& name, BOOL mouse_opaque) :
|
||||
mIsFocusRoot(FALSE),
|
||||
mLastVisible(TRUE),
|
||||
mUseBoundingRect(FALSE),
|
||||
mVisible(TRUE),
|
||||
mNextInsertionOrdinal(0),
|
||||
mHoverCursor(UI_CURSOR_ARROW),
|
||||
mLastTabGroup(0),
|
||||
// <edit>
|
||||
mDelayedDelete(FALSE)
|
||||
// </edit>
|
||||
@@ -124,9 +128,11 @@ LLView::LLView(const std::string& name, BOOL mouse_opaque) :
|
||||
|
||||
|
||||
LLView::LLView(
|
||||
const std::string& name, const LLRect& rect, BOOL mouse_opaque, U32 reshape) :
|
||||
mParentView(NULL),
|
||||
const std::string& name, const LLRect& rect, BOOL mouse_opaque, U32 reshape)
|
||||
: mVisible(TRUE),
|
||||
mInDraw(false),
|
||||
mName(name),
|
||||
mParentView(NULL),
|
||||
mRect(rect),
|
||||
mBoundingRect(rect),
|
||||
mReshapeFlags(reshape),
|
||||
@@ -138,9 +144,9 @@ LLView::LLView(
|
||||
mIsFocusRoot(FALSE),
|
||||
mLastVisible(TRUE),
|
||||
mUseBoundingRect(FALSE),
|
||||
mVisible(TRUE),
|
||||
mNextInsertionOrdinal(0),
|
||||
mHoverCursor(UI_CURSOR_ARROW),
|
||||
mLastTabGroup(0),
|
||||
// <edit>
|
||||
mDelayedDelete(FALSE)
|
||||
// </edit>
|
||||
@@ -234,7 +240,7 @@ void LLView::setUseBoundingRect( BOOL use_bounding_rect )
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLView::getUseBoundingRect()
|
||||
BOOL LLView::getUseBoundingRect() const
|
||||
{
|
||||
return mUseBoundingRect;
|
||||
}
|
||||
@@ -263,6 +269,7 @@ void LLView::sendChildToFront(LLView* child)
|
||||
|
||||
void LLView::sendChildToBack(LLView* child)
|
||||
{
|
||||
// llassert_always(sDepth == 0); // Avoid re-ordering while drawing; it can cause subtle iterator bugs
|
||||
if (child && child->getParent() == this)
|
||||
{
|
||||
// minor optimization, but more importantly,
|
||||
@@ -291,16 +298,18 @@ void LLView::moveChildToBackOfTabGroup(LLUICtrl* child)
|
||||
}
|
||||
}
|
||||
|
||||
void LLView::addChild(LLView* child, S32 tab_group)
|
||||
// virtual
|
||||
bool LLView::addChild(LLView* child, S32 tab_group)
|
||||
{
|
||||
if (!child)
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (mParentView == child)
|
||||
{
|
||||
llerrs << "Adding view " << child->getName() << " as child of itself" << llendl;
|
||||
}
|
||||
|
||||
// remove from current parent
|
||||
if (child->mParentView)
|
||||
{
|
||||
@@ -313,86 +322,57 @@ void LLView::addChild(LLView* child, S32 tab_group)
|
||||
// add to ctrl list if is LLUICtrl
|
||||
if (child->isCtrl())
|
||||
{
|
||||
// controls are stored in reverse order from render order
|
||||
addCtrlAtEnd((LLUICtrl*) child, tab_group);
|
||||
LLUICtrl* ctrl = static_cast<LLUICtrl*>(child);
|
||||
mCtrlOrder.insert(tab_order_pair_t(ctrl,
|
||||
tab_order_t(tab_group, mNextInsertionOrdinal)));
|
||||
|
||||
mNextInsertionOrdinal++;
|
||||
}
|
||||
|
||||
child->mParentView = this;
|
||||
updateBoundingRect();
|
||||
mLastTabGroup = tab_group;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void LLView::addChildAtEnd(LLView* child, S32 tab_group)
|
||||
bool LLView::addChildInBack(LLView* child, S32 tab_group)
|
||||
{
|
||||
if (mParentView == child)
|
||||
if(addChild(child, tab_group))
|
||||
{
|
||||
llerrs << "Adding view " << child->getName() << " as child of itself" << llendl;
|
||||
}
|
||||
// remove from current parent
|
||||
if (child->mParentView)
|
||||
{
|
||||
child->mParentView->removeChild(child);
|
||||
sendChildToBack(child);
|
||||
return true;
|
||||
}
|
||||
|
||||
// add to back of child list
|
||||
mChildList.push_back(child);
|
||||
|
||||
// add to ctrl list if is LLUICtrl
|
||||
if (child->isCtrl())
|
||||
{
|
||||
// controls are stored in reverse order from render order
|
||||
addCtrl((LLUICtrl*) child, tab_group);
|
||||
}
|
||||
|
||||
child->mParentView = this;
|
||||
updateBoundingRect();
|
||||
return false;
|
||||
}
|
||||
|
||||
// remove the specified child from the view, and set it's parent to NULL.
|
||||
void LLView::removeChild(LLView* child, BOOL deleteIt)
|
||||
void LLView::removeChild(LLView* child)
|
||||
{
|
||||
//llassert_always(sDepth == 0); // Avoid re-ordering while drawing; it can cause subtle iterator bugs
|
||||
if (child->mParentView == this)
|
||||
{
|
||||
// if we are removing an item we are currently iterating over, that would be bad
|
||||
llassert(child->mInDraw == false);
|
||||
mChildList.remove( child );
|
||||
child->mParentView = NULL;
|
||||
if (child->isCtrl())
|
||||
{
|
||||
removeCtrl((LLUICtrl*)child);
|
||||
}
|
||||
if (deleteIt)
|
||||
{
|
||||
delete child;
|
||||
child_tab_order_t::iterator found = mCtrlOrder.find(static_cast<LLUICtrl*>(child));
|
||||
if(found != mCtrlOrder.end())
|
||||
{
|
||||
mCtrlOrder.erase(found);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
llerrs << "LLView::removeChild called with non-child" << llendl;
|
||||
llwarns << child->getName() << "is not a child of " << getName() << llendl;
|
||||
}
|
||||
updateBoundingRect();
|
||||
}
|
||||
|
||||
void LLView::addCtrlAtEnd(LLUICtrl* ctrl, S32 tab_group)
|
||||
{
|
||||
mCtrlOrder.insert(tab_order_pair_t(ctrl,
|
||||
tab_order_t(tab_group, mNextInsertionOrdinal++)));
|
||||
}
|
||||
|
||||
void LLView::addCtrl( LLUICtrl* ctrl, S32 tab_group)
|
||||
{
|
||||
// add to front of list by using negative ordinal, which monotonically increases
|
||||
mCtrlOrder.insert(tab_order_pair_t(ctrl,
|
||||
tab_order_t(tab_group, -1 * mNextInsertionOrdinal++)));
|
||||
}
|
||||
|
||||
void LLView::removeCtrl(LLUICtrl* ctrl)
|
||||
{
|
||||
child_tab_order_t::iterator found = mCtrlOrder.find(ctrl);
|
||||
if(found != mCtrlOrder.end())
|
||||
{
|
||||
mCtrlOrder.erase(found);
|
||||
}
|
||||
}
|
||||
|
||||
LLView::ctrl_list_t LLView::getCtrlList() const
|
||||
{
|
||||
ctrl_list_t controls;
|
||||
@@ -1325,56 +1305,72 @@ LLView* LLView::childrenHandleMiddleMouseUp(S32 x, S32 y, MASK mask)
|
||||
|
||||
void LLView::draw()
|
||||
{
|
||||
if (sDebugRects)
|
||||
{
|
||||
drawDebugRect();
|
||||
drawChildren();
|
||||
}
|
||||
|
||||
// Check for bogus rectangle
|
||||
if (getRect().mRight <= getRect().mLeft
|
||||
|| getRect().mTop <= getRect().mBottom)
|
||||
{
|
||||
llwarns << "Bogus rectangle for " << getName() << " with " << mRect << llendl;
|
||||
}
|
||||
}
|
||||
|
||||
LLRect rootRect = getRootView()->getRect();
|
||||
LLRect screenRect;
|
||||
void LLView::drawChildren()
|
||||
{
|
||||
|
||||
// draw focused control on top of everything else
|
||||
LLUICtrl* focus_view = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
|
||||
/*LLUICtrl* focus_view = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
|
||||
if (focus_view && focus_view->getParent() != this)
|
||||
{
|
||||
focus_view = NULL;
|
||||
}
|
||||
|
||||
++sDepth;
|
||||
for (child_list_reverse_iter_t child_iter = mChildList.rbegin(); child_iter != mChildList.rend(); ++child_iter)
|
||||
}*/
|
||||
if (!mChildList.empty())
|
||||
{
|
||||
LLView *viewp = *child_iter;
|
||||
LLView* rootp = getRootView();
|
||||
++sDepth;
|
||||
|
||||
if (viewp->getVisible() && viewp != focus_view && viewp->getRect().isValid())
|
||||
for (child_list_reverse_iter_t child_iter = mChildList.rbegin(); child_iter != mChildList.rend();) // ++child_iter)
|
||||
{
|
||||
// Only draw views that are within the root view
|
||||
localRectToScreen(viewp->getRect(),&screenRect);
|
||||
if ( rootRect.overlaps(screenRect) )
|
||||
{
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
LLUI::pushMatrix();
|
||||
child_list_reverse_iter_t child = child_iter++;
|
||||
LLView *viewp = *child;
|
||||
|
||||
if (viewp == NULL)
|
||||
{
|
||||
LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom, 0.f);
|
||||
viewp->draw();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (viewp->getVisible() && /*viewp != focus_view && */viewp->getRect().isValid())
|
||||
{
|
||||
// Only draw views that are within the root view
|
||||
LLRect screen_rect = viewp->calcScreenRect();
|
||||
if ( rootp->getLocalRect().overlaps(screen_rect) )
|
||||
{
|
||||
//gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
LLUI::pushMatrix();
|
||||
{
|
||||
LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom, 0.f);
|
||||
// flag the fact we are in draw here, in case overridden draw() method attempts to remove this widget
|
||||
viewp->mInDraw = true;
|
||||
viewp->draw();
|
||||
viewp->mInDraw = false;
|
||||
|
||||
if (sDebugRects)
|
||||
{
|
||||
viewp->drawDebugRect();
|
||||
|
||||
// Check for bogus rectangle
|
||||
if (!getRect().isValid())
|
||||
{
|
||||
llwarns << "Bogus rectangle for " << getName() << " with " << mRect << llendl;
|
||||
}
|
||||
}
|
||||
}
|
||||
LLUI::popMatrix();
|
||||
}
|
||||
LLUI::popMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
--sDepth;
|
||||
}
|
||||
--sDepth;
|
||||
|
||||
if (focus_view && focus_view->getVisible())
|
||||
/*if (focus_view && focus_view->getVisible())
|
||||
{
|
||||
drawChild(focus_view);
|
||||
}
|
||||
}*/
|
||||
|
||||
// HACK
|
||||
if (sEditingUI && this == sEditingUIView)
|
||||
@@ -1391,12 +1387,12 @@ void LLView::drawDebugRect()
|
||||
// drawing solids requires texturing be disabled
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
|
||||
if (mUseBoundingRect)
|
||||
if (getUseBoundingRect())
|
||||
{
|
||||
LLUI::translate((F32)mBoundingRect.mLeft - (F32)mRect.mLeft, (F32)mBoundingRect.mBottom - (F32)mRect.mBottom, 0.f);
|
||||
}
|
||||
|
||||
LLRect debug_rect = mUseBoundingRect ? mBoundingRect : mRect;
|
||||
LLRect debug_rect = getUseBoundingRect() ? mBoundingRect : mRect;
|
||||
|
||||
// draw red rectangle for the border
|
||||
LLColor4 border_color(0.f, 0.f, 0.f, 1.f);
|
||||
@@ -1539,43 +1535,51 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent)
|
||||
updateBoundingRect();
|
||||
}
|
||||
|
||||
void LLView::updateBoundingRect()
|
||||
LLRect LLView::calcBoundingRect()
|
||||
{
|
||||
if (isDead()) return;
|
||||
|
||||
if (mUseBoundingRect)
|
||||
{
|
||||
LLRect local_bounding_rect = LLRect::null;
|
||||
LLRect local_bounding_rect = LLRect::null;
|
||||
|
||||
BOOST_FOREACH(LLView* childp, mChildList)
|
||||
{
|
||||
// ignore invisible and "top" children when calculating bounding rect
|
||||
// such as combobox popups
|
||||
if (!childp->getVisible() || childp == gFocusMgr.getTopCtrl())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
LLRect child_bounding_rect = childp->getBoundingRect();
|
||||
|
||||
if (local_bounding_rect.isEmpty())
|
||||
{
|
||||
// start out with bounding rect equal to first visible child's bounding rect
|
||||
local_bounding_rect = child_bounding_rect;
|
||||
}
|
||||
else
|
||||
{
|
||||
// accumulate non-null children rectangles
|
||||
if (child_bounding_rect.notEmpty())
|
||||
{
|
||||
local_bounding_rect.unionWith(child_bounding_rect);
|
||||
}
|
||||
}
|
||||
// such as combobox popups
|
||||
if (!childp->getVisible() || childp == gFocusMgr.getTopCtrl())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
mBoundingRect = local_bounding_rect;
|
||||
// translate into parent-relative coordinates
|
||||
mBoundingRect.translate(mRect.mLeft, mRect.mBottom);
|
||||
LLRect child_bounding_rect = childp->getBoundingRect();
|
||||
|
||||
if (local_bounding_rect.isEmpty())
|
||||
{
|
||||
// start out with bounding rect equal to first visible child's bounding rect
|
||||
local_bounding_rect = child_bounding_rect;
|
||||
}
|
||||
else
|
||||
{
|
||||
// accumulate non-null children rectangles
|
||||
if (!child_bounding_rect.isEmpty())
|
||||
{
|
||||
local_bounding_rect.unionWith(child_bounding_rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// convert to parent-relative coordinates
|
||||
local_bounding_rect.translate(mRect.mLeft, mRect.mBottom);
|
||||
return local_bounding_rect;
|
||||
}
|
||||
|
||||
|
||||
void LLView::updateBoundingRect()
|
||||
{
|
||||
if (isDead()) return;
|
||||
|
||||
LLRect cur_rect = mBoundingRect;
|
||||
|
||||
if (getUseBoundingRect())
|
||||
{
|
||||
mBoundingRect = calcBoundingRect();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1583,21 +1587,40 @@ void LLView::updateBoundingRect()
|
||||
}
|
||||
|
||||
// give parent view a chance to resize, in case we just moved, for example
|
||||
if (getParent() && getParent()->mUseBoundingRect)
|
||||
if (getParent() && getParent()->getUseBoundingRect())
|
||||
{
|
||||
getParent()->updateBoundingRect();
|
||||
}
|
||||
|
||||
/*if (mBoundingRect != cur_rect)
|
||||
{
|
||||
dirtyRect();
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
LLRect LLView::getScreenRect() const
|
||||
LLRect LLView::calcScreenRect() const
|
||||
{
|
||||
// *FIX: check for one-off error
|
||||
LLRect screen_rect;
|
||||
localPointToScreen(0, 0, &screen_rect.mLeft, &screen_rect.mBottom);
|
||||
localPointToScreen(getRect().getWidth(), getRect().getHeight(), &screen_rect.mRight, &screen_rect.mTop);
|
||||
return screen_rect;
|
||||
}
|
||||
|
||||
LLRect LLView::calcScreenBoundingRect() const
|
||||
{
|
||||
LLRect screen_rect;
|
||||
// get bounding rect, if used
|
||||
LLRect bounding_rect = getUseBoundingRect() ? mBoundingRect : mRect;
|
||||
|
||||
// convert to local coordinates, as defined by mRect
|
||||
bounding_rect.translate(-mRect.mLeft, -mRect.mBottom);
|
||||
|
||||
localPointToScreen(bounding_rect.mLeft, bounding_rect.mBottom, &screen_rect.mLeft, &screen_rect.mBottom);
|
||||
localPointToScreen(bounding_rect.mRight, bounding_rect.mTop, &screen_rect.mRight, &screen_rect.mTop);
|
||||
return screen_rect;
|
||||
}
|
||||
|
||||
LLRect LLView::getLocalBoundingRect() const
|
||||
{
|
||||
LLRect local_bounding_rect = getBoundingRect();
|
||||
@@ -1644,15 +1667,19 @@ BOOL LLView::hasAncestor(const LLView* parentp) const
|
||||
|
||||
BOOL LLView::childHasKeyboardFocus( const std::string& childname ) const
|
||||
{
|
||||
LLView *child = getChildView(childname, TRUE, FALSE);
|
||||
if (child)
|
||||
LLView *focus = dynamic_cast<LLView *>(gFocusMgr.getKeyboardFocus());
|
||||
|
||||
while (focus != NULL)
|
||||
{
|
||||
return gFocusMgr.childHasKeyboardFocus(child);
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
if (focus->getName() == childname)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
focus = focus->getParent();
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -294,7 +294,7 @@ public:
|
||||
void setSoundFlags(U8 flags) { mSoundFlags = flags; }
|
||||
void setName(std::string name) { mName = name; }
|
||||
void setUseBoundingRect( BOOL use_bounding_rect );
|
||||
BOOL getUseBoundingRect();
|
||||
BOOL getUseBoundingRect() const;
|
||||
|
||||
const std::string& getToolTip() const { return mToolTipMsg.getString(); }
|
||||
|
||||
@@ -302,15 +302,14 @@ public:
|
||||
void sendChildToBack(LLView* child);
|
||||
void moveChildToFrontOfTabGroup(LLUICtrl* child);
|
||||
void moveChildToBackOfTabGroup(LLUICtrl* child);
|
||||
|
||||
virtual bool addChild(LLView* view, S32 tab_group = 0);
|
||||
|
||||
// implemented in terms of addChild()
|
||||
bool addChildInBack(LLView* view, S32 tab_group = 0);
|
||||
|
||||
void addChild(LLView* view, S32 tab_group = 0);
|
||||
void addChildAtEnd(LLView* view, S32 tab_group = 0);
|
||||
// remove the specified child from the view, and set it's parent to NULL.
|
||||
void removeChild(LLView* view, BOOL deleteIt = FALSE);
|
||||
|
||||
virtual void addCtrl( LLUICtrl* ctrl, S32 tab_group);
|
||||
virtual void addCtrlAtEnd( LLUICtrl* ctrl, S32 tab_group);
|
||||
virtual void removeCtrl( LLUICtrl* ctrl);
|
||||
virtual void removeChild(LLView* view);
|
||||
|
||||
child_tab_order_t getCtrlOrder() const { return mCtrlOrder; }
|
||||
ctrl_list_t getCtrlList() const;
|
||||
@@ -318,6 +317,7 @@ public:
|
||||
|
||||
void setDefaultTabGroup(S32 d) { mDefaultTabGroup = d; }
|
||||
S32 getDefaultTabGroup() const { return mDefaultTabGroup; }
|
||||
S32 getLastTabGroup() { return mLastTabGroup; }
|
||||
|
||||
BOOL isInVisibleChain() const;
|
||||
BOOL isInEnabledChain() const;
|
||||
@@ -336,14 +336,14 @@ public:
|
||||
void setAllChildrenEnabled(BOOL b);
|
||||
|
||||
virtual void setVisible(BOOL visible);
|
||||
BOOL getVisible() const { return mVisible; }
|
||||
const BOOL& getVisible() const { return mVisible; }
|
||||
virtual void setEnabled(BOOL enabled);
|
||||
BOOL getEnabled() const { return mEnabled; }
|
||||
U8 getSoundFlags() const { return mSoundFlags; }
|
||||
|
||||
virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text );
|
||||
|
||||
virtual void handleVisibilityChange ( BOOL curVisibilityIn );
|
||||
virtual void handleVisibilityChange ( BOOL new_visibility );
|
||||
|
||||
void pushVisible(BOOL visible) { mLastVisible = mVisible; setVisible(visible); }
|
||||
void popVisible() { setVisible(mLastVisible); }
|
||||
@@ -361,13 +361,15 @@ public:
|
||||
const LLRect& getRect() const { return mRect; }
|
||||
const LLRect& getBoundingRect() const { return mBoundingRect; }
|
||||
LLRect getLocalBoundingRect() const;
|
||||
LLRect getScreenRect() const;
|
||||
LLRect calcScreenRect() const;
|
||||
LLRect calcScreenBoundingRect() const;
|
||||
LLRect getLocalRect() const;
|
||||
virtual LLRect getSnapRect() const;
|
||||
LLRect getLocalSnapRect() const;
|
||||
|
||||
// Override and return required size for this object. 0 for width/height means don't care.
|
||||
virtual LLRect getRequiredRect();
|
||||
LLRect calcBoundingRect();
|
||||
void updateBoundingRect();
|
||||
|
||||
LLView* getRootView();
|
||||
@@ -469,6 +471,8 @@ public:
|
||||
virtual LLSD getValue() const;
|
||||
|
||||
const child_list_t* getChildList() const { return &mChildList; }
|
||||
child_list_const_iter_t beginChild() const { return mChildList.begin(); }
|
||||
child_list_const_iter_t endChild() const { return mChildList.end(); }
|
||||
|
||||
// LLMouseHandler functions
|
||||
// Default behavior is to pass events to children
|
||||
@@ -602,6 +606,7 @@ protected:
|
||||
|
||||
void drawDebugRect();
|
||||
void drawChild(LLView* childp, S32 x_offset = 0, S32 y_offset = 0, BOOL force_draw = FALSE);
|
||||
void drawChildren();
|
||||
|
||||
LLView* childrenHandleKey(KEY key, MASK mask);
|
||||
LLView* childrenHandleUnicodeChar(llwchar uni_char);
|
||||
@@ -631,15 +636,18 @@ private:
|
||||
LLView* mParentView;
|
||||
child_list_t mChildList;
|
||||
|
||||
std::string mName;
|
||||
// location in pixels, relative to surrounding structure, bottom,left=0,0
|
||||
BOOL mVisible;
|
||||
LLRect mRect;
|
||||
LLRect mBoundingRect;
|
||||
|
||||
std::string mName;
|
||||
|
||||
U32 mReshapeFlags;
|
||||
|
||||
child_tab_order_t mCtrlOrder;
|
||||
S32 mDefaultTabGroup;
|
||||
S32 mLastTabGroup;
|
||||
|
||||
BOOL mEnabled; // Enabled means "accepts input that has an effect on the state of the application."
|
||||
// A disabled view, for example, may still have a scrollbar that responds to mouse events.
|
||||
@@ -655,10 +663,11 @@ private:
|
||||
LLRootHandle<LLView> mHandle;
|
||||
BOOL mLastVisible;
|
||||
|
||||
BOOL mVisible;
|
||||
|
||||
|
||||
S32 mNextInsertionOrdinal;
|
||||
|
||||
bool mInDraw;
|
||||
// <edit>
|
||||
public:
|
||||
BOOL mDelayedDelete;
|
||||
|
||||
@@ -81,10 +81,6 @@ DOHexEditor::DOHexEditor(const std::string& name, const LLRect& rect)
|
||||
DOHexEditor::~DOHexEditor()
|
||||
{
|
||||
gFocusMgr.releaseFocusIfNeeded(this);
|
||||
if(gEditMenuHandler == this)
|
||||
{
|
||||
gEditMenuHandler = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
LLView* DOHexEditor::fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory)
|
||||
|
||||
@@ -259,7 +259,7 @@ void LLFloaterSculptPreview::draw()
|
||||
|
||||
if (selected <= 0)
|
||||
{
|
||||
gl_rect_2d_checkerboard(getScreenRect(),mPreviewRect);
|
||||
gl_rect_2d_checkerboard(calcScreenRect(),mPreviewRect);
|
||||
LLGLDisable gls_alpha(GL_ALPHA_TEST);
|
||||
|
||||
if(mImagep.notNull())
|
||||
|
||||
@@ -218,7 +218,7 @@ void LLColorSwatchCtrl::draw()
|
||||
if ( mValid )
|
||||
{
|
||||
// Draw the color swatch
|
||||
gl_rect_2d_checkerboard( getScreenRect(), interior );
|
||||
gl_rect_2d_checkerboard( calcScreenRect(), interior );
|
||||
gl_rect_2d(interior, mColor, TRUE);
|
||||
LLColor4 opaque_color = mColor;
|
||||
opaque_color.mV[VALPHA] = 1.f;
|
||||
@@ -239,7 +239,7 @@ void LLColorSwatchCtrl::draw()
|
||||
LLPointer<LLViewerFetchedTexture> fallback_image = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName);
|
||||
if( fallback_image->getComponents() == 4 )
|
||||
{
|
||||
gl_rect_2d_checkerboard( getScreenRect(), interior );
|
||||
gl_rect_2d_checkerboard( calcScreenRect(), interior );
|
||||
}
|
||||
gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), fallback_image);
|
||||
fallback_image->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) );
|
||||
|
||||
@@ -1398,7 +1398,8 @@ LLScrollingPanelParam::LLScrollingPanelParam( const std::string& name,
|
||||
}
|
||||
for (it = to_remove.begin(); it != to_remove.end(); it++)
|
||||
{
|
||||
removeChild(*it, TRUE);
|
||||
removeChild(*it);
|
||||
delete (*it);
|
||||
}
|
||||
slider->translate(0,PARAM_HINT_HEIGHT);
|
||||
reshape(getRect().getWidth(),getRect().getHeight()-PARAM_HINT_HEIGHT);
|
||||
|
||||
@@ -264,7 +264,7 @@ void LLFloaterImagePreview::draw()
|
||||
|
||||
if (selected <= 0)
|
||||
{
|
||||
gl_rect_2d_checkerboard( getScreenRect(), mPreviewRect);
|
||||
gl_rect_2d_checkerboard( calcScreenRect(), mPreviewRect);
|
||||
LLGLDisable gls_alpha(GL_ALPHA_TEST);
|
||||
|
||||
if(mImagep.notNull())
|
||||
|
||||
@@ -602,7 +602,7 @@ void LLFloaterStats::reshape(S32 width, S32 height, BOOL called_from_parent)
|
||||
|
||||
void LLFloaterStats::addStatView(LLStatView* stat)
|
||||
{
|
||||
mStatsContainer->addChildAtEnd(stat);
|
||||
mStatsContainer->addChildInBack(stat);
|
||||
}
|
||||
|
||||
// virtual
|
||||
|
||||
@@ -417,7 +417,7 @@ void LLGroupNotifyBox::moveToBack()
|
||||
{
|
||||
// Move this dialog to the back.
|
||||
gNotifyBoxView->removeChild(this);
|
||||
gNotifyBoxView->addChildAtEnd(this);
|
||||
gNotifyBoxView->addChildInBack(this);
|
||||
mNextBtn->setVisible(FALSE);
|
||||
|
||||
// And enable the next button on the frontmost one, if there is one
|
||||
|
||||
@@ -587,7 +587,7 @@ void LLPanelAvatarSecondLife::onClickPartnerInfo(void *data)
|
||||
if (self->mPartnerID.notNull())
|
||||
{
|
||||
LLFloaterAvatarInfo::showFromProfile(self->mPartnerID,
|
||||
self->getScreenRect());
|
||||
self->calcScreenRect());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,8 @@ BOOL LLPanelGroupGeneral::postBuild()
|
||||
if (founder)
|
||||
{
|
||||
mFounderName = new LLNameBox(founder->getName(),founder->getRect(),LLUUID::null,FALSE,founder->getFont(),founder->getMouseOpaque());
|
||||
removeChild(founder, TRUE);
|
||||
removeChild(founder);
|
||||
delete founder;
|
||||
addChild(mFounderName);
|
||||
}
|
||||
|
||||
|
||||
@@ -278,7 +278,8 @@ BOOL LLPanelGroupNotices::postBuild()
|
||||
target->setToolTip(dtv->getToolTip());
|
||||
|
||||
mPanelCreateNotice->addChild(target);
|
||||
mPanelCreateNotice->removeChild(dtv, TRUE);
|
||||
mPanelCreateNotice->removeChild(dtv);
|
||||
delete dtv;
|
||||
|
||||
arrangeNoticeView(VIEW_PAST_NOTICE);
|
||||
|
||||
|
||||
@@ -521,21 +521,24 @@ BOOL LLPanelGroupSubTab::postBuild()
|
||||
if (icon && !icon->getImageName().empty())
|
||||
{
|
||||
mActionIcons["folder"] = icon->getImageName();
|
||||
removeChild(icon, TRUE);
|
||||
removeChild(icon);
|
||||
delete icon;
|
||||
}
|
||||
|
||||
icon = getChild<LLIconCtrl>("power_all_have_icon",no_recurse);
|
||||
if (icon && !icon->getImageName().empty())
|
||||
{
|
||||
mActionIcons["full"] = icon->getImageName();
|
||||
removeChild(icon, TRUE);
|
||||
removeChild(icon);
|
||||
delete icon;
|
||||
}
|
||||
|
||||
icon = getChild<LLIconCtrl>("power_partial_icon",no_recurse);
|
||||
if (icon && !icon->getImageName().empty())
|
||||
{
|
||||
mActionIcons["partial"] = icon->getImageName();
|
||||
removeChild(icon, TRUE);
|
||||
removeChild(icon);
|
||||
delete icon;
|
||||
}
|
||||
|
||||
return LLPanelGroupTab::postBuild();
|
||||
|
||||
@@ -247,7 +247,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
|
||||
LLPanelLogin::sInstance = this;
|
||||
|
||||
// add to front so we are the bottom-most child
|
||||
gViewerWindow->getRootView()->addChildAtEnd(this);
|
||||
gViewerWindow->getRootView()->addChildInBack(this);
|
||||
|
||||
// Logo
|
||||
mLogoImage = LLUI::getUIImage("startup_logo.j2c");
|
||||
|
||||
@@ -269,7 +269,7 @@ void LLPreviewTexture::draw()
|
||||
|
||||
// ...border
|
||||
gl_rect_2d( border, LLColor4(0.f, 0.f, 0.f, 1.f));
|
||||
gl_rect_2d_checkerboard( getScreenRect(), interior );
|
||||
gl_rect_2d_checkerboard( calcScreenRect(), interior );
|
||||
|
||||
if ( mImage.notNull() )
|
||||
{
|
||||
|
||||
@@ -86,7 +86,7 @@ LLStatBar *LLStatView::addStat(const std::string& name, LLStat *statp,
|
||||
stat_barp->mStatp = statp;
|
||||
|
||||
stat_barp->setVisible(mDisplayChildren);
|
||||
addChildAtEnd(stat_barp);
|
||||
addChildInBack(stat_barp);
|
||||
mStatBars.push_back(stat_barp);
|
||||
|
||||
// Rearrange all child bars.
|
||||
@@ -98,7 +98,7 @@ LLStatView *LLStatView::addStatView(const std::string& name, const std::string&
|
||||
{
|
||||
LLStatView *statview = new LLStatView(name, label, setting, rect);
|
||||
statview->setVisible(mDisplayChildren);
|
||||
addChildAtEnd(statview);
|
||||
addChildInBack(statview);
|
||||
return statview;
|
||||
}
|
||||
|
||||
|
||||
@@ -650,7 +650,7 @@ void LLFloaterTexturePicker::draw()
|
||||
{
|
||||
if( mTexturep->getComponents() == 4 )
|
||||
{
|
||||
gl_rect_2d_checkerboard( getScreenRect(), interior );
|
||||
gl_rect_2d_checkerboard( calcScreenRect(), interior );
|
||||
}
|
||||
|
||||
gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep );
|
||||
@@ -1528,7 +1528,7 @@ void LLTextureCtrl::draw()
|
||||
{
|
||||
if( mTexturep->getComponents() == 4 )
|
||||
{
|
||||
gl_rect_2d_checkerboard( getScreenRect(), interior );
|
||||
gl_rect_2d_checkerboard( calcScreenRect(), interior );
|
||||
}
|
||||
|
||||
gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep);
|
||||
|
||||
@@ -176,7 +176,7 @@ BOOL LLToolBar::postBuild()
|
||||
{
|
||||
LLRect rect(0, 0, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT);
|
||||
mResizeHandle = new LLFakeResizeHandle(std::string(""), rect, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT);
|
||||
this->addChildAtEnd(mResizeHandle);
|
||||
this->addChildInBack(mResizeHandle);
|
||||
LLLayoutStack* toolbar_stack = getChild<LLLayoutStack>("toolbar_stack");
|
||||
toolbar_stack->reshape(toolbar_stack->getRect().getWidth() - RESIZE_HANDLE_WIDTH, toolbar_stack->getRect().getHeight());
|
||||
}
|
||||
|
||||
@@ -317,11 +317,6 @@ LLViewerMediaImpl::LLViewerMediaImpl(const std::string& media_url,
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
LLViewerMediaImpl::~LLViewerMediaImpl()
|
||||
{
|
||||
if( gEditMenuHandler == this )
|
||||
{
|
||||
gEditMenuHandler = NULL;
|
||||
}
|
||||
|
||||
destroyMediaSource();
|
||||
LLViewerMedia::removeMedia(this);
|
||||
}
|
||||
|
||||
@@ -1945,7 +1945,7 @@ void LLViewerWindow::initWorldUI()
|
||||
}
|
||||
gHUDView = new LLHUDView(hud_rect);
|
||||
// put behind everything else in the UI
|
||||
mRootView->addChildAtEnd(gHUDView);
|
||||
mRootView->addChildInBack(gHUDView);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user