Update qtoolalign (Fixes issue 704)

- Removes shortcut ctrl-a for align tool
-- to avoid ctrl-a for select all text in UI controls messing up prim selection
- Adds llselectmgr select all function
-- to replace ctrl-a select all prims functionality that was a side effect of qtoolalign having this shortcut
- Adds toggle button (up/down arrow) to build floater for toggling display of the lower tab container area
-- This is to satisfy users who relied on ctrl-a to use align while the build floater was minimized and out of the way
- Syncs qtoolalign from Alchemy
This commit is contained in:
Lirusaito
2014-03-09 19:00:52 -04:00
parent 9d6092faaa
commit 30f5a3a162
10 changed files with 82 additions and 97 deletions

View File

@@ -790,6 +790,17 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>LiruMiniBuildFloater</key>
<map>
<key>Comment</key>
<string>Whether or not the build tools floater is tinified (except in Land tool)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<boolean>0</boolean>
</map>
<key>LiruMouselookHidesFloaters</key>
<map>
<key>Comment</key>

View File

@@ -829,7 +829,18 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
childSetVisible("link_num_obj_count", !land_visible);
childSetVisible("prim_count", !land_visible);
mTab->setVisible(!land_visible);
static const LLCachedControl<bool> mini("LiruMiniBuildFloater");
mTab->setVisible(!mini && !land_visible);
getChildView("mini_button")->setVisible(!land_visible);
bool small = mini && !land_visible;
const S32 cur_height = getRect().getHeight();
static const S32 full_height = cur_height;
if (small == (cur_height == full_height))
{
S32 new_height = small ? full_height - mTab->getRect().getHeight() + 8 : full_height;
translate(0, cur_height - new_height);
reshape(getRect().getWidth(), new_height);
}
mPanelLandInfo->setVisible(land_visible);
}

View File

@@ -6734,6 +6734,24 @@ void LLSelectMgr::doDelete()
selectDelete();
}
// <Singu> Note: Allow Ctrl-A for select all linked prims
//-----------------------------------------------------------------------------
// canSelectAll()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::canSelectAll() const
{
return !mSelectedObjects->isEmpty();
}
//-----------------------------------------------------------------------------
// selectAll()
//-----------------------------------------------------------------------------
void LLSelectMgr::selectAll()
{
promoteSelectionToRoot();
}
// </Singu>
//-----------------------------------------------------------------------------
// canDeselect()
//-----------------------------------------------------------------------------

View File

@@ -389,6 +389,9 @@ public:
virtual BOOL canDoDelete() const;
virtual void doDelete();
virtual void selectAll();
virtual BOOL canSelectAll() const;
virtual void deselect();
virtual BOOL canDeselect() const;

View File

@@ -50,7 +50,6 @@
#include "llagent.h"
#include "llagentcamera.h"
#include "llfloatertools.h"
#include "qtoolalign.h"
#include "llviewercontrol.h"
@@ -278,20 +277,13 @@ BOOL LLToolCompTranslate::handleMouseUp(S32 x, S32 y, MASK mask)
LLTool* LLToolCompTranslate::getOverrideTool(MASK mask)
{
if (gKeyboard->getKeyDown('A') && mask & MASK_CONTROL)
if (mask == MASK_CONTROL)
{
return QToolAlign::getInstance();
return LLToolCompRotate::getInstance();
}
else
else if (mask == (MASK_CONTROL | MASK_SHIFT))
{
if (mask == MASK_CONTROL)
{
return LLToolCompRotate::getInstance();
}
else if (mask == (MASK_CONTROL | MASK_SHIFT))
{
return LLToolCompScale::getInstance();
}
return LLToolCompScale::getInstance();
}
return LLToolComposite::getOverrideTool(mask);
}
@@ -404,11 +396,7 @@ BOOL LLToolCompScale::handleMouseUp(S32 x, S32 y, MASK mask)
LLTool* LLToolCompScale::getOverrideTool(MASK mask)
{
if (gKeyboard->getKeyDown('A') && mask & MASK_CONTROL)
{
return QToolAlign::getInstance();
}
else if (mask == MASK_CONTROL)
if (mask == MASK_CONTROL)
{
return LLToolCompRotate::getInstance();
}
@@ -607,11 +595,7 @@ BOOL LLToolCompRotate::handleMouseUp(S32 x, S32 y, MASK mask)
LLTool* LLToolCompRotate::getOverrideTool(MASK mask)
{
if (gKeyboard->getKeyDown('A') && mask & MASK_CONTROL)
{
return QToolAlign::getInstance();
}
else if (mask == (MASK_CONTROL | MASK_SHIFT))
if (mask == (MASK_CONTROL | MASK_SHIFT))
{
return LLToolCompScale::getInstance();
}

View File

@@ -1,5 +1,5 @@
/**
* @file lltoolface.cpp
* @file qtoolalign.cpp
* @brief A tool to align objects
*/
@@ -13,14 +13,11 @@
#include "v3math.h"
// Viewer includes
#include "llagent.h"
#include "llagentcamera.h"
#include "llbox.h"
#include "llcylinder.h"
#include "llfloatertools.h"
#include "llmanip.h"
#include "llselectmgr.h"
#include "lltoolcomp.h"
#include "llviewercamera.h"
#include "llviewercontrol.h"
#include "llviewerobject.h"
@@ -33,7 +30,7 @@ const F32 MANIPULATOR_SELECT_SIZE = 20.0;
QToolAlign::QToolAlign()
: LLToolComposite(std::string("Align"))
: LLTool(std::string("Align"))
{
}
@@ -48,51 +45,16 @@ BOOL QToolAlign::handleMouseDown(S32 x, S32 y, MASK mask)
{
if (mHighlightedAxis != -1)
{
align();
align();
}
else
{
gViewerWindow->pickAsync(x, y, mask, pickCallback);
}
return TRUE;
}
BOOL QToolAlign::handleMouseUp(S32 x, S32 y, MASK mask)
{
// first, perform normal processing in case this was a quick-click
handleHover(x, y, mask);
LLSelectMgr::getInstance()->updateSelectionCenter();
BOOL handled = FALSE;
if( hasMouseCapture() )
{
handled = TRUE;
setMouseCapture( FALSE );
}
return handled;
}
BOOL QToolAlign::handleDoubleClick(S32 x, S32 y, MASK mask)
{
return FALSE;
}
LLTool* QToolAlign::getOverrideTool(MASK mask)
{
if (!gKeyboard->getKeyDown('A'))
{
if (mask == MASK_CONTROL)
{
return LLToolCompRotate::getInstance();
}
else if (mask == (MASK_CONTROL | MASK_SHIFT))
{
return LLToolCompScale::getInstance();
}
}
return LLToolComposite::getOverrideTool(mask);
}
void QToolAlign::pickCallback(const LLPickInfo& pick_info)
{
LLViewerObject* object = pick_info.getObject();
@@ -140,9 +102,8 @@ void QToolAlign::handleSelect()
{
// no parts, please
//llwarns << "in select" << llendl;
LL_DEBUGS("ALIGNTOOL") << "in select" << LL_ENDL;
LLSelectMgr::getInstance()->promoteSelectionToRoot();
LLSelectMgr::getInstance()->updateSelectionCenter();
gFloaterTools->setStatusText("align");
}
@@ -151,6 +112,7 @@ void QToolAlign::handleDeselect()
{
}
BOOL QToolAlign::findSelectedManipulator(S32 x, S32 y)
{
mHighlightedAxis = -1;
@@ -182,8 +144,9 @@ BOOL QToolAlign::findSelectedManipulator(S32 x, S32 y)
}
F32 half_width = (F32)gViewerWindow->getWindowWidth() / 2.f;
F32 half_height = (F32)gViewerWindow->getWindowHeight() / 2.f;
LLRect world_view_rect = gViewerWindow->getWorldViewRectScaled();
F32 half_width = (F32)world_view_rect.getWidth() / 2.f;
F32 half_height = (F32)world_view_rect.getHeight() / 2.f;
LLVector2 manip2d;
LLVector2 mousePos((F32)x - half_width, (F32)y - half_height);
LLVector2 delta;
@@ -416,25 +379,24 @@ void QToolAlign::render()
LLColor4 default_normal_color( 0.7f, 0.7f, 0.7f, 0.1f );
gGL.color4fv( default_normal_color.mV );
// <edit>
LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getEditSelection();
BOOL can_move = selection->getObjectCount() != 0;
if (can_move)
if (selection->getObjectCount() == 0) return;
struct F : public LLSelectedObjectFunctor
{
struct f : public LLSelectedObjectFunctor
virtual bool apply(LLViewerObject* objectp)
{
virtual bool apply(LLViewerObject* objectp)
{
return objectp->permMove() && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts"));
}
} func;
can_move = selection->applyToObjects(&func);
}
if (can_move)
{
render_bbox(mBBox);
renderManipulators();
}
if (!objectp->permMove()) return false;
if (objectp->permModify()) return true;
static const LLCachedControl<bool> edit_linked("EditLinkedParts");
return !edit_linked;
}
} f;
if (!selection->applyToObjects(&f)) return;
// </edit>
render_bbox(mBBox);
renderManipulators();
}
// only works for our specialized (AABB, position centered) bboxes
@@ -564,7 +526,7 @@ void QToolAlign::align()
// check to see if it overlaps the previously placed objects
BOOL overlap = FALSE;
llwarns << "i=" << i << " j=" << j << llendl;
LL_DEBUGS("ALIGNTOOL") << "i=" << i << " j=" << j << LL_ENDL;
if (!mForce) // well, don't check if in force mode
{
@@ -577,8 +539,8 @@ void QToolAlign::align()
if (overlaps_this)
{
llwarns << "overlap" << new_bbox.getCenterAgent() << other_bbox.getCenterAgent() << llendl;
llwarns << "extent" << new_bbox.getExtentLocal() << other_bbox.getExtentLocal() << llendl;
LL_DEBUGS("ALIGNTOOL") << "overlap" << new_bbox.getCenterAgent() << other_bbox.getCenterAgent() << LL_ENDL;
LL_DEBUGS("ALIGNTOOL") << "extent" << new_bbox.getExtentLocal() << other_bbox.getExtentLocal() << LL_ENDL;
}
overlap = (overlap || overlaps_this);

View File

@@ -8,14 +8,13 @@
#include "lltool.h"
#include "llbbox.h"
#include "lltoolcomp.h"
class LLViewerObject;
class LLPickInfo;
class LLToolSelectRect;
class QToolAlign
: public LLToolComposite, public LLSingleton<QToolAlign>
: public LLTool, public LLSingleton<QToolAlign>
{
public:
QToolAlign();
@@ -24,13 +23,9 @@ public:
virtual void handleSelect();
virtual void handleDeselect();
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
virtual void render();
virtual LLTool* getOverrideTool(MASK mask);
static void pickCallback(const LLPickInfo& pick_info);
private:

View File

@@ -38,7 +38,7 @@
<check_box label="Drehen (Strg)" name="radio rotate"/>
<check_box label="Dehnen (Strg-Umschalt)" name="radio stretch"/>
<check_box label="Textur auswählen" name="radio select face"/>
<check_box label="Ausrichten (Strg-A)" name="radio align"/>
<check_box label="Ausrichten" name="radio align"/>
<check_box label="Verknüpfte Teile bearbeiten" name="checkbox edit linked parts"/>
<text name="text ruler mode">Lineal:</text>
<combo_box name="combobox grid mode">

View File

@@ -52,6 +52,7 @@
function="BuildTool.setTool"
parameter="Land" />
</button>
<button name="mini_button" bottom="-34" left="245" height="22" width="22" control_name="LiruMiniBuildFloater" label="" image_selected="down_arrow.tga" image_unselected="up_arrow.tga" scale_image="true" toggle="true" tool_tip="Toggle tiny build floater"/>
<!-- Focus panel -->
@@ -128,7 +129,7 @@
function="BuildTool.commitRadioEdit"/>
</check_box>
<check_box bottom_delta="-15" follows="left|top" font="SansSerifSmall" height="16"
initial_value="false" label="Align (Ctrl-A)" left="4" mouse_opaque="true"
initial_value="false" label="Align" left="4" mouse_opaque="true"
name="radio align" radio_style="true" width="114" >
<check_box.commit_callback
function="BuildTool.commitRadioEdit"/>

View File

@@ -27,7 +27,7 @@
<check_box label="Girar (Ctrl)" name="radio rotate"/>
<check_box label="Estirar (Ctrl-Mayús)" name="radio stretch"/>
<check_box label="Elegir Cara" name="radio select face"/>
<check_box label="Alinear (Ctrl-A)" name="radio align"/>
<check_box label="Alinear" name="radio align"/>
<check_box label="Editar partes enlazadas" name="checkbox edit linked parts"/>
<text name="text ruler mode">
Regla: