diff options
author | James Cook <james@lindenlab.com> | 2009-07-14 19:06:17 +0000 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2009-07-14 19:06:17 +0000 |
commit | 83a6ea234f32bf30d1f16b276d128debb2aeea02 (patch) | |
tree | 0950d0cccb1effa90c1da7f479adb591f3de3d68 | |
parent | 9ecdbd8b72fec5182d2a5f843c9e4a050069ed51 (diff) |
Merge skinning-15 to viewer-2. Fixes include:
DEV-35175 Spawning context menu should not move mouse cursor (Note: introduces regression where menu can fall off bottom of screen, will fix shortly)
DEV-35143 Modal alerts appear behind side tray
DEV-35141 Landmarks image and description outside of landmarks
Merging revisions 126418-126419,126726-126727,126856-126857,127010-127011,127014-127016 of svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/skinning-15 into G:\viewer-2.0.0-3, respecting ancestry
-rw-r--r-- | indra/llui/llfloater.cpp | 45 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 32 | ||||
-rw-r--r-- | indra/llui/llmenugl.cpp | 10 | ||||
-rw-r--r-- | indra/llui/llmenugl.h | 2 | ||||
-rw-r--r-- | indra/llui/llpanel.cpp | 7 | ||||
-rw-r--r-- | indra/llui/lluictrl.cpp | 4 | ||||
-rw-r--r-- | indra/llui/lluictrl.h | 6 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 24 | ||||
-rw-r--r-- | indra/llui/llview.h | 1 | ||||
-rw-r--r-- | indra/newview/llfloateruipreview.cpp | 8 | ||||
-rw-r--r-- | indra/newview/lllistview.cpp | 2 | ||||
-rw-r--r-- | indra/newview/lllocationhistory.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llpanelpicks.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 11 |
14 files changed, 101 insertions, 54 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index f89bee6cfb..153e025385 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -631,7 +631,7 @@ void LLFloater::closeFloater(bool app_quitting) } // Let floater do cleanup. - mCloseSignal(this, getValue()); + mCloseSignal(this, getValue(), app_quitting); onClose(app_quitting); } } @@ -1730,7 +1730,7 @@ void LLFloater::initOpenCallback(const OpenCallbackParam& cb, open_signal_t& sig else { std::string function_name = cb.function_name; - open_callback_t* func = (CallbackRegistry<open_callback_t>::getValue(function_name)); + open_callback_t* func = (OpenCallbackRegistry::getValue(function_name)); if (func) { if (cb.parameter.isProvided()) @@ -1745,6 +1745,45 @@ void LLFloater::initOpenCallback(const OpenCallbackParam& cb, open_signal_t& sig } } +void LLFloater::initCloseCallback(const CloseCallbackParam& cb, close_signal_t& sig) +{ + if (cb.function.isProvided()) + { + if (cb.parameter.isProvided()) + sig.connect(boost::bind(cb.function(), _1, cb.parameter, _3)); + else + sig.connect(cb.function()); + } + else + { + std::string function_name = cb.function_name; + close_callback_t* func = (CloseCallbackRegistry::getValue(function_name)); + if (func) + { + if (cb.parameter.isProvided()) + sig.connect(boost::bind((*func), _1, cb.parameter,_3)); + else + sig.connect(*func); + } + else if (!function_name.empty()) + { + llwarns << "No callback found for: '" << function_name << "' in control: " << getName() << llendl; + } + } +} + +namespace LLInitParam +{ + + template<> + bool ParamCompare<LLFloater::close_callback_t>::equals( + const LLFloater::close_callback_t &a, + const LLFloater::close_callback_t &b) + { + return false; + } +} + ///////////////////////////////////////////////////// // LLFloaterView @@ -2505,7 +2544,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p) initOpenCallback(p.open_callback, mOpenSignal); // close callback if (p.close_callback.isProvided()) - initOpenCallback(p.close_callback, mCloseSignal); + initCloseCallback(p.close_callback, mCloseSignal); } void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, BOOL open_floater, LLXMLNodePtr output_node) diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index c23978b9da..5a609a2e40 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -108,14 +108,19 @@ public: typedef boost::function<void (LLUICtrl* ctrl, const LLSD& param)> open_callback_t; typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param)> open_signal_t; - typedef boost::function<void (LLUICtrl* ctrl, const LLSD& param)> close_callback_t; - typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param)> close_signal_t; - + typedef boost::function<void (LLUICtrl* ctrl, const LLSD& param, bool app_quitting)> close_callback_t; + typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param, bool app_quitting)> close_signal_t; + struct OpenCallbackParam : public LLInitParam::Block<OpenCallbackParam, CallbackParam > { Optional<open_callback_t> function; }; - + + struct CloseCallbackParam : public LLInitParam::Block<CloseCallbackParam, CallbackParam > + { + Optional<close_callback_t> function; + }; + struct Params : public LLInitParam::Block<Params, LLPanel::Params> { @@ -132,8 +137,8 @@ public: save_rect, save_visibility; - Optional<OpenCallbackParam> open_callback, - close_callback; + Optional<OpenCallbackParam> open_callback; + Optional<CloseCallbackParam> close_callback; Params() : title("title"), @@ -306,6 +311,7 @@ protected: void destroy() { die(); } // Don't call this directly. You probably want to call close(). JC void initOpenCallback(const OpenCallbackParam& cb, open_signal_t& sig); + void initCloseCallback(const CloseCallbackParam& cb, close_signal_t& sig); private: void setForeground(BOOL b); // called only by floaterview @@ -318,13 +324,14 @@ private: void addDragHandle(); public: - typedef CallbackRegistry<open_callback_t> OpenCallbackRegistry; + class OpenCallbackRegistry : public CallbackRegistry<open_callback_t, OpenCallbackRegistry> {}; + class CloseCallbackRegistry : public CallbackRegistry<close_callback_t, CloseCallbackRegistry> {}; protected: std::string mRectControl; std::string mVisibilityControl; open_signal_t mOpenSignal; - open_signal_t mCloseSignal; + close_signal_t mCloseSignal; LLSD mKey; // Key used for retrieving instances; set (for now) by LLFLoaterReg private: @@ -486,6 +493,15 @@ public: extern LLFloaterView* gFloaterView; +namespace LLInitParam +{ + template<> + bool ParamCompare<LLFloater::close_callback_t>::equals( + const LLFloater::close_callback_t &a, + const LLFloater::close_callback_t &b); +} + + #endif // LL_FLOATER_H diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 4d2374a7e8..d24eb1ec56 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3532,7 +3532,7 @@ void LLContextMenuBranch::showSubMenu() S32 center_x; S32 center_y; localPointToScreen(getRect().getWidth(), getRect().getHeight() , ¢er_x, ¢er_y); - mBranch->show( center_x, center_y, FALSE); + mBranch->show( center_x, center_y); } // onCommit() - do the primary funcationality of the menu item. @@ -3580,7 +3580,7 @@ void LLContextMenu::setVisible(BOOL visible) hide(); } -void LLContextMenu::show(S32 x, S32 y,BOOL adjustCursor) +void LLContextMenu::show(S32 x, S32 y) { arrangeAndClear(); @@ -3604,12 +3604,6 @@ void LLContextMenu::show(S32 x, S32 y,BOOL adjustCursor) const_cast<LLRect&>(getRect()).setCenterAndSize(local_x + width/2, local_y - height/2, width, height); arrange(); - - if (translateIntoRect(menu_region_rect,FALSE) && adjustCursor) - { - LLUI::setCursorPositionLocal(getParent(), getRect().mLeft , getRect().mTop); - } - LLView::setVisible(TRUE); } diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index ef27c2c9c8..897b43a614 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -659,7 +659,7 @@ public: virtual void draw (); - virtual void show (S32 x, S32 y, BOOL adjustCursor = TRUE); + virtual void show (S32 x, S32 y); virtual void hide (); diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index de102e47ac..b18a750178 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -418,10 +418,11 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_ void LLPanel::initFromParams(const LLPanel::Params& p) { - // The LLPanel constructor doesn't correctly receive Params yet - setEnabled(p.enabled); + //setting these here since panel constructor not called with params + //and LLView::initFromParams will use them to set visible and enabled setVisible(p.visible); - + setEnabled(p.enabled); + // control_name, tab_stop, focus_lost_callback, initial_value, rect, enabled, visible LLUICtrl::initFromParams(p); diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 7d33a5ad1a..2a6dd97f31 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -191,7 +191,7 @@ void LLUICtrl::initFromParams(const Params& p) } else { - commit_callback_t* initfunc = (CallbackRegistry<commit_callback_t>::getValue(p.init_callback.function_name)); + commit_callback_t* initfunc = (CommitCallbackRegistry::getValue(p.init_callback.function_name)); if (initfunc) { (*initfunc)(this, p.init_callback.parameter); @@ -233,7 +233,7 @@ void LLUICtrl::initCommitCallback(const CommitCallbackParam& cb, commit_signal_t else { std::string function_name = cb.function_name; - commit_callback_t* func = (CallbackRegistry<commit_callback_t>::getValue(function_name)); + commit_callback_t* func = (CommitCallbackRegistry::getValue(function_name)); if (func) { if (cb.parameter.isProvided()) diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index f4c7cf36f2..ff37efb5f7 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -269,11 +269,11 @@ public: } }; - template <typename F> class CallbackRegistry : public LLRegistrySingleton<std::string, F, CallbackRegistry<F> > + template <typename F, typename DERIVED> class CallbackRegistry : public LLRegistrySingleton<std::string, F, DERIVED > {}; - typedef CallbackRegistry<commit_callback_t> CommitCallbackRegistry; - typedef CallbackRegistry<enable_callback_t> EnableCallbackRegistry; + class CommitCallbackRegistry : public CallbackRegistry<commit_callback_t, CommitCallbackRegistry>{}; + class EnableCallbackRegistry : public CallbackRegistry<enable_callback_t, EnableCallbackRegistry>{}; protected: diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index f01aacb797..2f9a6e7d46 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -401,32 +401,28 @@ bool LLCompareByTabOrder::operator() (const LLView* const a, const LLView* const return (a_score == b_score) ? a < b : a_score < b_score; } -BOOL LLView::isInVisibleChain() const +bool LLView::trueToRoot(const boost::function<bool (const LLView*)>& predicate) const { const LLView* cur_view = this; while(cur_view) { - if (!cur_view->getVisible()) + if(!predicate(cur_view)) { - return FALSE; + return false; } cur_view = cur_view->getParent(); } - return TRUE; + return true; +} + +BOOL LLView::isInVisibleChain() const +{ + return trueToRoot(&LLView::getVisible); } BOOL LLView::isInEnabledChain() const { - const LLView* cur_view = this; - while(cur_view) - { - if (!cur_view->getEnabled()) - { - return FALSE; - } - cur_view = cur_view->getParent(); - } - return TRUE; + return trueToRoot(&LLView::getEnabled); } // virtual diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 5f6341daa6..9138b04258 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -321,6 +321,7 @@ public: S32 getDefaultTabGroup() const { return mDefaultTabGroup; } S32 getLastTabGroup() { return mLastTabGroup; } + bool trueToRoot(const boost::function<bool (const LLView*)>& predicate) const; BOOL isInVisibleChain() const; BOOL isInEnabledChain() const; diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp index e7304ea5a9..599f1598cf 100644 --- a/indra/newview/llfloateruipreview.cpp +++ b/indra/newview/llfloateruipreview.cpp @@ -77,6 +77,8 @@ std::string LLFloaterUIPreview::mSavedDiffPath = std::string(""); static const S32 PRIMARY_FLOATER = 1; static const S32 SECONDARY_FLOATER = 2; +static LLDefaultChildRegistry::Register<LLOverlapPanel> register_overlap_panel("overlap_panel"); + static std::string get_xui_dir() { std::string delim = gDirUtilp->getDirDelimiter(); @@ -186,11 +188,6 @@ BOOL LLFadeEventTimer::tick() return FALSE; } -void* create_overlap_panel(void* data) -{ - return new LLOverlapPanel(); -} - // Constructor LLFloaterUIPreview::LLFloaterUIPreview(const LLSD& key) : LLFloater(key), @@ -204,7 +201,6 @@ LLFloaterUIPreview::LLFloaterUIPreview(const LLSD& key) { sInstance = this; - mFactoryMap["overlap_panel"] = LLCallbackMap(create_overlap_panel, NULL); // called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_ui_preview.xml"); } diff --git a/indra/newview/lllistview.cpp b/indra/newview/lllistview.cpp index 568655b500..3019d5d3d5 100644 --- a/indra/newview/lllistview.cpp +++ b/indra/newview/lllistview.cpp @@ -35,7 +35,7 @@ #include "lllistview.h" #include "lltextbox.h" -#include "lluictrlfactory.h" // LLDefaultWidgetRegistry +#include "lluictrlfactory.h" // LLDefaultChildRegistry // linker optimizes this out on Windows until there is a real reference // to this file diff --git a/indra/newview/lllocationhistory.cpp b/indra/newview/lllocationhistory.cpp index 0059bfd2dc..9ab57a9d76 100644 --- a/indra/newview/lllocationhistory.cpp +++ b/indra/newview/lllocationhistory.cpp @@ -42,7 +42,6 @@ #include "llviewerregion.h" #include "llviewerparcelmgr.h" - void addLocationHistory() { LLVector3 position = gAgent.getPositionAgent(); diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 778a2299f5..7bfe94043f 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -337,7 +337,7 @@ BOOL LLPanelPicks::handleRightMouseDown(S32 x, S32 y, MASK mask) { mPopupMenu->buildDrawLabels(); mPopupMenu->updateParent(LLMenuGL::sMenuContainer); - ((LLContextMenu*)mPopupMenu)->show(x, y, FALSE); + ((LLContextMenu*)mPopupMenu)->show(x, y); LLMenuGL::showPopup(this, mPopupMenu, x, y); } return TRUE; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 637d072cf4..039faa2bf9 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1550,6 +1550,12 @@ void LLViewerWindow::initWorldUI() gIMMgr = LLIMMgr::getInstance(); + // side tray + getRootView()->addChild(LLSideTray::getInstance()); + + getRootView()->sendChildToFront(gFloaterView); + getRootView()->sendChildToFront(gSnapshotFloaterView); + // new bottom panel gBottomTray = new LLBottomTray(); LLRect rc = gBottomTray->getRect(); @@ -1628,13 +1634,12 @@ void LLViewerWindow::initWorldUI() getRootView()->addChild(gStatusBar); getRootView()->addChild(navbar); - // side tray - getRootView()->addChild(LLSideTray::getInstance()); //sidetray //then notify area //then menu - getRootView()->sendChildToFront(LLSideTray::getInstance()); + //getRootView()->sendChildToFront(LLSideTray::getInstance()); + getRootView()->sendChildToFront(gNotifyBoxView); // menu holder appears on top to get first pass at all mouse events getRootView()->sendChildToFront(gMenuHolder); |