EXP-109 WIP strip down main_view.xml

made menu keyboard access only work when menus are visible
dummy widgets are now added with a parent view that is invisible
popupview can now be default-built
master
Richard Linden 2010-09-22 12:27:26 -07:00
parent 7648bb425a
commit f8a17515f5
7 changed files with 46 additions and 29 deletions

View File

@ -3066,7 +3066,10 @@ BOOL LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask)
mAltKeyTrigger = FALSE;
}
if(!result && (key == KEY_F10 && mask == MASK_CONTROL) && !gKeyboard->getKeyRepeated(key))
if(!result
&& (key == KEY_F10 && mask == MASK_CONTROL)
&& !gKeyboard->getKeyRepeated(key)
&& isInVisibleChain())
{
if (getHighlightedItem())
{

View File

@ -163,8 +163,6 @@ LLView::~LLView()
if (mDefaultWidgets)
{
std::for_each(mDefaultWidgets->begin(), mDefaultWidgets->end(),
DeletePairedPointer());
delete mDefaultWidgets;
mDefaultWidgets = NULL;
}
@ -1682,18 +1680,7 @@ BOOL LLView::hasChild(const std::string& childname, BOOL recurse) const
//-----------------------------------------------------------------------------
LLView* LLView::getChildView(const std::string& name, BOOL recurse) const
{
LLView* child = findChildView(name, recurse);
if (!child)
{
child = getDefaultWidget<LLView>(name);
if (!child)
{
LLView::Params view_params;
view_params.name = name;
child = LLUICtrlFactory::create<LLView>(view_params);
}
}
return child;
return getChild<LLView>(name, recurse);
}
static LLFastTimer::DeclareTimer FTM_FIND_VIEWS("Find Widgets");
@ -2804,11 +2791,14 @@ LLView::root_to_view_iterator_t LLView::endRootToView()
// only create maps on demand, as they incur heap allocation/deallocation cost
// when a view is constructed/deconstructed
LLView::default_widget_map_t& LLView::getDefaultWidgetMap() const
LLView& LLView::getDefaultWidgetContainer() const
{
if (!mDefaultWidgets)
{
mDefaultWidgets = new default_widget_map_t();
LLView::Params p;
p.name = "default widget container";
p.visible = false; // ensures default widgets can't steal focus, etc.
mDefaultWidgets = new LLView(p);
}
return *mDefaultWidgets;
}

View File

@ -461,12 +461,8 @@ public:
template <class T> T* getDefaultWidget(const std::string& name) const
{
default_widget_map_t::const_iterator found_it = getDefaultWidgetMap().find(name);
if (found_it == getDefaultWidgetMap().end())
{
return NULL;
}
return dynamic_cast<T*>(found_it->second);
LLView* widgetp = getDefaultWidgetContainer().findChildView(name);
return dynamic_cast<T*>(widgetp);
}
//////////////////////////////////////////////
@ -580,9 +576,9 @@ private:
typedef std::map<std::string, LLView*> default_widget_map_t;
// allocate this map no demand, as it is rarely needed
mutable default_widget_map_t* mDefaultWidgets;
mutable LLView* mDefaultWidgets;
default_widget_map_t& getDefaultWidgetMap() const;
LLView& getDefaultWidgetContainer() const;
public:
// Depth in view hierarchy during rendering
@ -649,7 +645,7 @@ template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) co
return NULL;
}
getDefaultWidgetMap()[name] = result;
getDefaultWidgetContainer().addChild(result);
}
}
return result;

View File

@ -40,7 +40,8 @@ bool view_visible(LLView* viewp)
}
LLPopupView::LLPopupView()
LLPopupView::LLPopupView(const LLPopupView::Params& p)
: LLPanel(p)
{
// register ourself as handler of UI popups
LLUI::setPopupFuncs(boost::bind(&LLPopupView::addPopup, this, _1), boost::bind(&LLPopupView::removePopup, this, _1), boost::bind(&LLPopupView::clearPopups, this));

View File

@ -32,7 +32,7 @@
class LLPopupView : public LLPanel
{
public:
LLPopupView();
LLPopupView(const Params& p = LLPanel::Params());
~LLPopupView();
/*virtual*/ void draw();

View File

@ -1524,7 +1524,7 @@ void LLViewerWindow::initBase()
mWorldViewPlaceholder = main_view->getChildView("world_view_rect")->getHandle();
mNonSideTrayView = main_view->getChildView("non_side_tray_view")->getHandle();
mFloaterViewHolder = main_view->getChildView("floater_view_holder")->getHandle();
mPopupView = main_view->findChild<LLPopupView>("popup_holder");
mPopupView = main_view->getChild<LLPopupView>("popup_holder");
mHintHolder = main_view->getChild<LLView>("hint_holder")->getHandle();
// Constrain floaters to inside the menu and status bar regions.

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
follows="left|right|top|bottom"
height="768"
layout="topleft"
left="0"
mouse_opaque="false"
tab_stop="false"
name="main_view"
width="1024">
<view top="0"
follows="all"
height="768"
left="0"
mouse_opaque="false"
name="world_view_rect"
width="1024"/>
<panel top="0"
follows="all"
height="768"
mouse_opaque="true"
name="progress_view"
filename="panel_progress.xml"
class="progress_view"
width="1024"
visible="false"/>
</panel>