diff options
-rw-r--r-- | indra/llui/lltoolbar.cpp | 4 | ||||
-rw-r--r-- | indra/llui/lltoolbar.h | 6 | ||||
-rw-r--r-- | indra/newview/llfloatertoybox.cpp | 6 | ||||
-rw-r--r-- | indra/newview/lltoolbarview.cpp | 69 | ||||
-rw-r--r-- | indra/newview/lltoolbarview.h | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/colors.xml | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/widgets/toolbar.xml | 1 |
7 files changed, 57 insertions, 40 deletions
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 1f5fa5f361..5f7afb07fc 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -86,6 +86,7 @@ LLToolBar::Params::Params() pad_right("pad_right"), pad_bottom("pad_bottom"), pad_between("pad_between"), + min_girth("min_girth"), button_panel("button_panel") {} @@ -103,6 +104,7 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) mPadTop(p.pad_top), mPadBottom(p.pad_bottom), mPadBetween(p.pad_between), + mMinGirth(p.min_girth), mPopupMenuHandle(), mStartDragItemCallback(NULL), mHandleDragItemCallback(NULL), @@ -517,6 +519,8 @@ void LLToolBar::updateLayoutAsNeeded() S32 total_girth = cur_row // current row position... + max_row_girth // ...incremented by size of final row... + girth_pad_end; // ...plus padding reserved on end + total_girth = llmax(total_girth,mMinGirth); + max_row_length = llmax(max_row_length, row_running_length - mPadBetween + row_pad_end); resizeButtonsInRow(buttons_in_row, max_row_girth); diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 4fac081130..be0589f3c6 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -141,7 +141,8 @@ public: pad_top, pad_right, pad_bottom, - pad_between; + pad_between, + min_girth; // get rid of this Multiple<LLCommandId::Params> commands; @@ -219,7 +220,8 @@ private: mPadRight, mPadTop, mPadBottom, - mPadBetween; + mPadBetween, + mMinGirth; LLToolBarButton::Params mButtonParams[LLToolBarEnums::BTNTYPE_COUNT]; diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index 58bb417b71..609041803a 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -62,9 +62,9 @@ BOOL LLFloaterToybox::postBuild() mBtnRestoreDefaults = getChild<LLButton>("btn_restore_defaults"); mToolBar = getChild<LLToolBar>("toybox_toolbar"); - mToolBar->setStartDragCallback(boost::bind(LLToolBarView::startDragItem,_1,_2,_3)); - mToolBar->setHandleDragCallback(boost::bind(LLToolBarView::handleDragItem,_1,_2,_3,_4)); - mToolBar->setHandleDropCallback(boost::bind(LLToolBarView::handleDrop,_1,_2,_3,_4)); + mToolBar->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3)); + mToolBar->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4)); + mToolBar->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4)); LLCommandManager& cmdMgr = LLCommandManager::instance(); diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 95ed603bbf..8c7dc53af0 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -43,6 +43,11 @@ LLToolBarView* gToolBarView = NULL; static LLDefaultChildRegistry::Register<LLToolBarView> r("toolbar_view"); bool LLToolBarView::sDragStarted = false; +bool isToolDragged() +{ + return (LLToolDragAndDrop::getInstance()->getSource() == LLToolDragAndDrop::SOURCE_VIEWER); +} + LLToolBarView::Toolbar::Toolbar() : button_display_mode("button_display_mode"), commands("command") @@ -80,17 +85,17 @@ BOOL LLToolBarView::postBuild() mToolbarRight = getChild<LLToolBar>("toolbar_right"); mToolbarBottom = getChild<LLToolBar>("toolbar_bottom"); - mToolbarLeft->setStartDragCallback(boost::bind(LLToolBarView::startDragItem,_1,_2,_3)); - mToolbarLeft->setHandleDragCallback(boost::bind(LLToolBarView::handleDragItem,_1,_2,_3,_4)); - mToolbarLeft->setHandleDropCallback(boost::bind(LLToolBarView::handleDrop,_1,_2,_3,_4)); + mToolbarLeft->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3)); + mToolbarLeft->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4)); + mToolbarLeft->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4)); - mToolbarRight->setStartDragCallback(boost::bind(LLToolBarView::startDragItem,_1,_2,_3)); - mToolbarRight->setHandleDragCallback(boost::bind(LLToolBarView::handleDragItem,_1,_2,_3,_4)); - mToolbarRight->setHandleDropCallback(boost::bind(LLToolBarView::handleDrop,_1,_2,_3,_4)); + mToolbarRight->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3)); + mToolbarRight->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4)); + mToolbarRight->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4)); - mToolbarBottom->setStartDragCallback(boost::bind(LLToolBarView::startDragItem,_1,_2,_3)); - mToolbarBottom->setHandleDragCallback(boost::bind(LLToolBarView::handleDragItem,_1,_2,_3,_4)); - mToolbarBottom->setHandleDropCallback(boost::bind(LLToolBarView::handleDrop,_1,_2,_3,_4)); + mToolbarBottom->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3)); + mToolbarBottom->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4)); + mToolbarBottom->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4)); return TRUE; } @@ -306,37 +311,34 @@ void LLToolBarView::draw() mToolbarRight->localRectToOtherView(mToolbarRight->getLocalRect(), &right_rect, this); } - // Debug draw - LLColor4 back_color = LLColor4::blue; - LLColor4 back_color_vert = LLColor4::red; - LLColor4 back_color_hori = LLColor4::yellow; - back_color[VALPHA] = 0.5f; - back_color_hori[VALPHA] = 0.5f; - back_color_vert[VALPHA] = 0.5f; - //gl_rect_2d(getLocalRect(), back_color, TRUE); - //gl_rect_2d(bottom_rect, back_color_hori, TRUE); - //gl_rect_2d(left_rect, back_color_vert, TRUE); - //gl_rect_2d(right_rect, back_color_vert, TRUE); + // Draw drop zones if drop of a tool is active + if (isToolDragged()) + { + LLColor4 drop_color = LLUIColorTable::instance().getColor( "ToolbarDropZoneColor" ); + gl_rect_2d(bottom_rect, drop_color, TRUE); + gl_rect_2d(left_rect, drop_color, TRUE); + gl_rect_2d(right_rect, drop_color, TRUE); + } LLUICtrl::draw(); } // ---------------------------------------- -// Drag and Drop hacks (under construction) +// Drag and Drop Handling // ---------------------------------------- -void LLToolBarView::startDragItem( S32 x, S32 y, const LLUUID& uuid) +void LLToolBarView::startDragTool( S32 x, S32 y, const LLUUID& uuid) { - //llinfos << "Merov debug: startDragItem() : x = " << x << ", y = " << y << llendl; + //llinfos << "Merov debug: startDragTool() : x = " << x << ", y = " << y << llendl; LLToolDragAndDrop::getInstance()->setDragStart( x, y ); sDragStarted = false; } -BOOL LLToolBarView::handleDragItem( S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type) +BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type) { -// llinfos << "Merov debug: handleDragItem() : x = " << x << ", y = " << y << ", uuid = " << uuid << llendl; +// llinfos << "Merov debug: handleDragTool() : x = " << x << ", y = " << y << ", uuid = " << uuid << llendl; if (LLToolDragAndDrop::getInstance()->isOverThreshold( x, y )) { if (!sDragStarted) @@ -348,7 +350,7 @@ BOOL LLToolBarView::handleDragItem( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp gClipboard.setSourceObject(uuid,LLAssetType::AT_WIDGET); LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_VIEWER; LLUUID srcID; - //llinfos << "Merov debug: handleDragItem() : beginMultiDrag()" << llendl; + //llinfos << "Merov debug: handleDragTool() : beginMultiDrag()" << llendl; LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, src, srcID); sDragStarted = true; return TRUE; @@ -362,15 +364,15 @@ BOOL LLToolBarView::handleDragItem( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp return FALSE; } -BOOL LLToolBarView::handleDrop( void* cargo_data, S32 x, S32 y, LLToolBar* toolbar) +BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* toolbar) { LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data; - //llinfos << "Merov debug : handleDrop. Drop " << inv_item->getUUID() << " named " << inv_item->getName() << " of type " << inv_item->getType() << llendl; - + //llinfos << "Merov debug : handleDropTool. Drop " << inv_item->getUUID() << " named " << inv_item->getName() << " of type " << inv_item->getType() << llendl; + LLAssetType::EType type = inv_item->getType(); if (type == LLAssetType::AT_WIDGET) { - //llinfos << "Merov debug : handleDrop. Drop source is a widget -> drop it in place..." << llendl; + //llinfos << "Merov debug : handleDropTool. Drop source is a widget -> drop it in place..." << llendl; // Get the command from its uuid LLCommandManager& mgr = LLCommandManager::instance(); LLCommandId command_id(inv_item->getUUID()); @@ -399,8 +401,11 @@ BOOL LLToolBarView::handleDrop( void* cargo_data, S32 x, S32 y, LLToolBar* toolb llwarns << "Command couldn't be found in command manager" << llendl; } } - + stopDragTool(); return TRUE; } - +void LLToolBarView::stopDragTool() +{ + sDragStarted = false; +} diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h index 414fcd8751..a0c526ac54 100644 --- a/indra/newview/lltoolbarview.h +++ b/indra/newview/lltoolbarview.h @@ -74,9 +74,10 @@ public: static bool loadDefaultToolbars(); - static void startDragItem( S32 x, S32 y, const LLUUID& uuid); - static BOOL handleDragItem( S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type); - static BOOL handleDrop( void* cargo_data, S32 x, S32 y, LLToolBar* toolbar); + static void startDragTool( S32 x, S32 y, const LLUUID& uuid); + static BOOL handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type); + static BOOL handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* toolbar); + static void stopDragTool(); protected: friend class LLUICtrlFactory; diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index b5cc949ebf..8baaa14595 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -795,6 +795,10 @@ <color name="DirectChatColor" reference="LtOrange" /> + + <color + name="ToolbarDropZoneColor" + value=".48 .69 1 .5" /> <!-- Generic color names (legacy) --> <color diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index 613dc66762..d36b015005 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -4,6 +4,7 @@ pad_top="1" pad_bottom="1" pad_between="1" + min_girth="24" mouse_opaque="false" read_only="false"> <button_panel name="button_panel" |