UI cleanup.

-Added ui-local transformation matrix.
-Gutted legacy commitcallbacks throughout ui widget ctors.
-Created filter_editor ui widget which issues commit on keypress
   -search_editor commits on focus loss/enter press
   -search_editor and filter_editor now have a built in 'x' button to clear text.
-LLComboBox::setPrearrangeCallback now uses boost::function
-LLComboBox::setTextEntryCallback now uses boost::function
-LLLineEditor::setKeystrokeCallback now uses boost::function
-LLLineEditor::setPrevalidate now uses boost::function
-LLPanel::childSetKeystrokeCallback removed
-LLPanel::childSetPrevalidate removed
-LLPanel::childSetActionTextbox now uses boost::function
-LLTextBox::setClickedCallback now uses boost::function
-LLTextEditor::setKeystrokeCallback added.
-Cleaned up JCFloaterAreaSearch
This commit is contained in:
Shyotl
2013-04-16 00:25:59 -05:00
parent 4cbf8b16b6
commit a5dad6be5c
191 changed files with 3020 additions and 3456 deletions

View File

@@ -219,17 +219,15 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
} }
} }
gGL.pushMatrix(); gGL.pushUIMatrix();
gGL.loadIdentity();
gGL.translatef(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurDepth);
// this code snaps the text origin to a pixel grid to start with gGL.loadUIIdentity();
F32 pixel_offset_x = llround((F32)sCurOrigin.mX) - (sCurOrigin.mX);
F32 pixel_offset_y = llround((F32)sCurOrigin.mY) - (sCurOrigin.mY); LLVector2 origin(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY));
gGL.translatef(-pixel_offset_x, -pixel_offset_y, 0.f);
// Depth translation, so that floating text appears 'in-world'
gGL.color4fv( color.mV ); // and is correctly occluded.
gGL.translatef(0.f,0.f,sCurDepth);
S32 chars_drawn = 0; S32 chars_drawn = 0;
S32 i; S32 i;
@@ -249,20 +247,21 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
// Not guaranteed to be set correctly // Not guaranteed to be set correctly
gGL.setSceneBlendType(LLRender::BT_ALPHA); gGL.setSceneBlendType(LLRender::BT_ALPHA);
cur_x = ((F32)x * sScaleX); cur_x = ((F32)x * sScaleX) + origin.mV[VX];
cur_y = ((F32)y * sScaleY); cur_y = ((F32)y * sScaleY) + origin.mV[VY];
// Offset y by vertical alignment. // Offset y by vertical alignment.
// use unscaled font metrics here
switch (valign) switch (valign)
{ {
case TOP: case TOP:
cur_y -= mAscender; cur_y -= llceil(mAscender);
break; break;
case BOTTOM: case BOTTOM:
cur_y += mDescender; cur_y += llceil(mDescender);
break; break;
case VCENTER: case VCENTER:
cur_y -= ((mAscender - mDescender)/2.f); cur_y -= llceil((llceil(mAscender) - llceil(mDescender))/2.f);
break; break;
case BASELINE: case BASELINE:
// Baseline, do nothing. // Baseline, do nothing.
@@ -276,10 +275,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
case LEFT: case LEFT:
break; break;
case RIGHT: case RIGHT:
cur_x -= llmin(scaled_max_pixels, llround(getWidthF32(wstr.c_str(), 0, length) * sScaleX)); cur_x -= llmin(scaled_max_pixels, llround(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX));
break; break;
case HCENTER: case HCENTER:
cur_x -= llmin(scaled_max_pixels, llround(getWidthF32(wstr.c_str(), 0, length) * sScaleX)) / 2; cur_x -= llmin(scaled_max_pixels, llround(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX)) / 2;
break; break;
default: default:
break; break;
@@ -288,10 +287,12 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
cur_render_y = cur_y; cur_render_y = cur_y;
cur_render_x = cur_x; cur_render_x = cur_x;
F32 start_x = cur_x; F32 start_x = (F32)llround(cur_x);
F32 inv_width = 1.f / mFontBitmapCachep->getBitmapWidth(); const LLFontBitmapCache* font_bitmap_cache = mFontBitmapCachep;
F32 inv_height = 1.f / mFontBitmapCachep->getBitmapHeight();
F32 inv_width = 1.f / font_bitmap_cache->getBitmapWidth();
F32 inv_height = 1.f / font_bitmap_cache->getBitmapHeight();
const S32 LAST_CHARACTER = LLFontFreetype::LAST_CHAR_FULL; const S32 LAST_CHARACTER = LLFontFreetype::LAST_CHAR_FULL;
@@ -300,7 +301,8 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
if (use_ellipses && halign == LEFT) if (use_ellipses && halign == LEFT)
{ {
// check for too long of a string // check for too long of a string
if (getWidthF32(wstr.c_str(), 0, max_chars) * sScaleX > scaled_max_pixels) S32 string_width = llround(getWidthF32(wstr.c_str(), begin_offset, max_chars) * sScaleX);
if (string_width > scaled_max_pixels)
{ {
// use four dots for ellipsis width to generate padding // use four dots for ellipsis width to generate padding
const LLWString dots(utf8str_to_wstring(std::string("...."))); const LLWString dots(utf8str_to_wstring(std::string("....")));
@@ -358,12 +360,9 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
if (!label.empty()) if (!label.empty())
{ {
gGL.pushMatrix(); gGL.pushMatrix();
//gGL.loadIdentity();
//gGL.translatef(sCurOrigin.mX, sCurOrigin.mY, 0.0f);
//gGL.scalef(sScaleX, sScaleY, 1.f);
getFontExtChar()->render(label, 0, getFontExtChar()->render(label, 0,
/*llfloor*/((ext_x + (F32)ext_image->getWidth() + EXT_X_BEARING) / sScaleX), /*llfloor*/(ext_x / sScaleX) + ext_image->getWidth() + EXT_X_BEARING - sCurOrigin.mX,
/*llfloor*/(cur_y / sScaleY), /*llfloor*/(cur_render_y / sScaleY) - sCurOrigin.mY,
color, color,
halign, BASELINE, NORMAL, NO_SHADOW, S32_MAX, S32_MAX, NULL, halign, BASELINE, NORMAL, NO_SHADOW, S32_MAX, S32_MAX, NULL,
TRUE ); TRUE );
@@ -412,12 +411,12 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
LLRectf uv_rect((fgi->mXBitmapOffset) * inv_width, LLRectf uv_rect((fgi->mXBitmapOffset) * inv_width,
(fgi->mYBitmapOffset + fgi->mHeight + PAD_UVY) * inv_height, (fgi->mYBitmapOffset + fgi->mHeight + PAD_UVY) * inv_height,
(fgi->mXBitmapOffset + fgi->mWidth) * inv_width, (fgi->mXBitmapOffset + fgi->mWidth) * inv_width,
(fgi->mYBitmapOffset - PAD_UVY) * inv_height); (fgi->mYBitmapOffset - PAD_UVY) * inv_height);
// snap glyph origin to whole screen pixel // snap glyph origin to whole screen pixel
LLRectf screen_rect(llround(cur_render_x + (F32)fgi->mXBearing), LLRectf screen_rect((F32)llround(cur_render_x + (F32)fgi->mXBearing),
llround(cur_render_y + (F32)fgi->mYBearing), (F32)llround(cur_render_y + (F32)fgi->mYBearing),
llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth, (F32)llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth,
llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight); (F32)llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight);
drawGlyph(screen_rect, uv_rect, color, style, shadow, drop_shadow_strength); drawGlyph(screen_rect, uv_rect, color, style, shadow, drop_shadow_strength);
@@ -440,8 +439,8 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
// Must do this to cur_x, not just to cur_render_x, otherwise you // Must do this to cur_x, not just to cur_render_x, otherwise you
// will squish sub-pixel kerned characters too close together. // will squish sub-pixel kerned characters too close together.
// For example, "CCCCC" looks bad. // For example, "CCCCC" looks bad.
cur_x = (F32)llfloor(cur_x + 0.5f); cur_x = (F32)llround(cur_x);
//cur_y = (F32)llfloor(cur_y + 0.5f); //cur_y = (F32)llround(cur_y);
cur_render_x = cur_x; cur_render_x = cur_x;
cur_render_y = cur_y; cur_render_y = cur_y;
@@ -450,41 +449,40 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
if (right_x) if (right_x)
{ {
*right_x = cur_x / sScaleX; *right_x = (cur_x - origin.mV[VX]) / sScaleX;
} }
if (style & UNDERLINE) if (style & UNDERLINE)
{ {
F32 descender = (F32)llfloor(mDescender);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.begin(LLRender::LINES); gGL.begin(LLRender::LINES);
gGL.vertex2f(start_x, cur_y - (mDescender)); gGL.vertex2f(start_x, cur_y - descender);
gGL.vertex2f(cur_x, cur_y - (mDescender)); gGL.vertex2f(cur_x, cur_y - descender);
gGL.end(); gGL.end();
} }
// *FIX: get this working in all alignment cases, etc.
if (draw_ellipses) if (draw_ellipses)
{ {
// recursively render ellipses at end of string // recursively render ellipses at end of string
// we've already reserved enough room // we've already reserved enough room
gGL.pushMatrix(); gGL.pushUIMatrix();
//gGL.loadIdentity();
//gGL.translatef(sCurOrigin.mX, sCurOrigin.mY, 0.0f);
//gGL.scalef(sScaleX, sScaleY, 1.f);
renderUTF8(std::string("..."), renderUTF8(std::string("..."),
0, 0,
cur_x / sScaleX, (F32)y, (cur_x - origin.mV[VX]) / sScaleX, (F32)y,
color, color,
LEFT, valign, LEFT, valign,
style, style,
LLFontGL::NO_SHADOW, shadow,
S32_MAX, max_pixels, S32_MAX, max_pixels,
right_x, right_x,
FALSE); FALSE);
gGL.popMatrix(); gGL.popUIMatrix();
} }
gGL.popMatrix(); gGL.popUIMatrix();
return chars_drawn; return chars_drawn;
} }
@@ -578,7 +576,7 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars, const S32 begin_offset, const S
cur_x += getXAdvance(wch); cur_x += getXAdvance(wch);
llwchar next_char = wchars[i+1]; llwchar next_char = wchars[i+1];
if (((i + 1) < max_chars) if (((i + 1) < begin_offset + max_chars)
&& next_char && next_char
&& (next_char < LAST_CHARACTER)) && (next_char < LAST_CHARACTER))
{ {
@@ -587,7 +585,7 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars, const S32 begin_offset, const S
} }
} }
// Round after kerning. // Round after kerning.
cur_x = (F32)llfloor(cur_x + 0.5f); cur_x = (F32)llround(cur_x);
} }
return cur_x / sScaleX; return cur_x / sScaleX;
@@ -694,7 +692,7 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch
} }
} }
// Round after kerning. // Round after kerning.
cur_x = (F32)llfloor(cur_x + 0.5f); cur_x = (F32)llround(cur_x);
drawn_x = cur_x; drawn_x = cur_x;
} }
@@ -871,7 +869,7 @@ S32 LLFontGL::charFromPixelOffset(const llwchar* wchars, const S32 begin_offset,
} }
// Round after kerning. // Round after kerning.
cur_x = (F32)llfloor(cur_x + 0.5f); cur_x = (F32)llround(cur_x);
} }
} }

View File

@@ -100,22 +100,21 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LL
void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset, BOOL filled) void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset, BOOL filled)
{ {
gGL.pushMatrix(); gGL.pushUIMatrix();
left += LLFontGL::sCurOrigin.mX; left += LLFontGL::sCurOrigin.mX;
right += LLFontGL::sCurOrigin.mX; right += LLFontGL::sCurOrigin.mX;
bottom += LLFontGL::sCurOrigin.mY; bottom += LLFontGL::sCurOrigin.mY;
top += LLFontGL::sCurOrigin.mY; top += LLFontGL::sCurOrigin.mY;
gGL.loadIdentity(); gGL.loadUIIdentity();
gl_rect_2d(llfloor((F32)left * LLRender2D::sGLScaleFactor.mV[VX]) - pixel_offset, gl_rect_2d(llfloor((F32)left * LLRender2D::sGLScaleFactor.mV[VX]) - pixel_offset,
llfloor((F32)top * LLRender2D::sGLScaleFactor.mV[VY]) + pixel_offset, llfloor((F32)top * LLRender2D::sGLScaleFactor.mV[VY]) + pixel_offset,
llfloor((F32)right * LLRender2D::sGLScaleFactor.mV[VX]) + pixel_offset, llfloor((F32)right * LLRender2D::sGLScaleFactor.mV[VX]) + pixel_offset,
llfloor((F32)bottom * LLRender2D::sGLScaleFactor.mV[VY]) - pixel_offset, llfloor((F32)bottom * LLRender2D::sGLScaleFactor.mV[VY]) - pixel_offset,
filled); filled);
gGL.popMatrix(); gGL.popUIMatrix();
} }
void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled ) void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled )
{ {
stop_glerror(); stop_glerror();
@@ -386,8 +385,8 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
} }
// add in offset of current image to current UI translation // add in offset of current image to current UI translation
const LLVector3 ui_scale = LLVector3(1.f,1.f,1.f);//gGL.getUIScale(); const LLVector3 ui_scale = gGL.getUIScale();
const LLVector3 ui_translation = LLVector3(x,y,0.f);//(gGL.getUITranslation() + LLVector3(x, y, 0.f)).scaledVec(ui_scale); const LLVector3 ui_translation = (gGL.getUITranslation() + LLVector3(x, y, 0.f)).scaledVec(ui_scale);
F32 uv_width = uv_outer_rect.getWidth(); F32 uv_width = uv_outer_rect.getWidth();
F32 uv_height = uv_outer_rect.getHeight(); F32 uv_height = uv_outer_rect.getHeight();
@@ -658,8 +657,8 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
gGL.begin(LLRender::QUADS); gGL.begin(LLRender::QUADS);
{ {
LLVector3 ui_scale = LLVector3(1.f,1.f,1.f);//gGL.getUIScale(); LLVector3 ui_scale = gGL.getUIScale();
LLVector3 ui_translation = LLVector3(0.f,0.f,0.f); //gGL.getUITranslation(); LLVector3 ui_translation = gGL.getUITranslation();
ui_translation.mV[VX] += x; ui_translation.mV[VX] += x;
ui_translation.mV[VY] += y; ui_translation.mV[VY] += y;
ui_translation.scaleVec(ui_scale); ui_translation.scaleVec(ui_scale);
@@ -689,13 +688,13 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
} }
else else
{ {
gGL.pushMatrix(); gGL.pushUIMatrix();
gGL.translatef((F32)x, (F32)y, 0.f); gGL.translateUI((F32)x, (F32)y, 0.f);
F32 offset_x = F32(width/2); F32 offset_x = F32(width/2);
F32 offset_y = F32(height/2); F32 offset_y = F32(height/2);
gGL.translatef(offset_x, offset_y, 0.f); gGL.translateUI(offset_x, offset_y, 0.f);
LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD); LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD);
@@ -724,7 +723,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
gGL.vertex2f(v.mV[0], v.mV[1] ); gGL.vertex2f(v.mV[0], v.mV[1] );
} }
gGL.end(); gGL.end();
gGL.popMatrix(); gGL.popUIMatrix();
} }
} }
@@ -765,9 +764,9 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F
end_angle += F_TWO_PI; end_angle += F_TWO_PI;
} }
gGL.pushMatrix(); gGL.pushUIMatrix();
{ {
gGL.translatef(center_x, center_y, 0.f); gGL.translateUI(center_x, center_y, 0.f);
// Inexact, but reasonably fast. // Inexact, but reasonably fast.
F32 delta = (end_angle - start_angle) / steps; F32 delta = (end_angle - start_angle) / steps;
@@ -798,15 +797,15 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F
} }
gGL.end(); gGL.end();
} }
gGL.popMatrix(); gGL.popUIMatrix();
} }
void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled) void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled)
{ {
gGL.pushMatrix(); gGL.pushUIMatrix();
{ {
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.translatef(center_x, center_y, 0.f); gGL.translateUI(center_x, center_y, 0.f);
// Inexact, but reasonably fast. // Inexact, but reasonably fast.
F32 delta = F_TWO_PI / steps; F32 delta = F_TWO_PI / steps;
@@ -837,7 +836,7 @@ void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled
} }
gGL.end(); gGL.end();
} }
gGL.popMatrix(); gGL.popUIMatrix();
} }
// Renders a ring with sides (tube shape) // Renders a ring with sides (tube shape)
@@ -864,9 +863,9 @@ void gl_deep_circle( F32 radius, F32 depth, S32 steps )
void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center ) void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center )
{ {
gGL.pushMatrix(); gGL.pushUIMatrix();
{ {
gGL.translatef(0.f, 0.f, -width / 2); gGL.translateUI(0.f, 0.f, -width / 2);
if( render_center ) if( render_center )
{ {
gGL.color4fv(center_color.mV); gGL.color4fv(center_color.mV);
@@ -877,11 +876,11 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor
{ {
gGL.diffuseColor4fv(side_color.mV); gGL.diffuseColor4fv(side_color.mV);
gl_washer_2d(radius, radius - width, steps, side_color, side_color); gl_washer_2d(radius, radius - width, steps, side_color, side_color);
gGL.translatef(0.f, 0.f, width); gGL.translateUI(0.f, 0.f, width);
gl_washer_2d(radius - width, radius, steps, side_color, side_color); gl_washer_2d(radius - width, radius, steps, side_color, side_color);
} }
} }
gGL.popMatrix(); gGL.popUIMatrix();
} }
// Draw gray and white checkerboard with black border // Draw gray and white checkerboard with black border
@@ -1056,9 +1055,9 @@ void gl_segmented_rect_2d_tex(const S32 left,
S32 width = llabs(right - left); S32 width = llabs(right - left);
S32 height = llabs(top - bottom); S32 height = llabs(top - bottom);
gGL.pushMatrix(); gGL.pushUIMatrix();
gGL.translatef((F32)left, (F32)bottom, 0.f); gGL.translateUI((F32)left, (F32)bottom, 0.f);
LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height); LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height);
if (border_uv_scale.mV[VX] > 0.5f) if (border_uv_scale.mV[VX] > 0.5f)
@@ -1199,7 +1198,7 @@ void gl_segmented_rect_2d_tex(const S32 left,
} }
gGL.end(); gGL.end();
gGL.popMatrix(); gGL.popUIMatrix();
} }
//FIXME: rewrite to use scissor? //FIXME: rewrite to use scissor?
@@ -1217,9 +1216,9 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
S32 width = llabs(right - left); S32 width = llabs(right - left);
S32 height = llabs(top - bottom); S32 height = llabs(top - bottom);
gGL.pushMatrix(); gGL.pushUIMatrix();
gGL.translatef((F32)left, (F32)bottom, 0.f); gGL.translateUI((F32)left, (F32)bottom, 0.f);
LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height); LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height);
if (border_uv_scale.mV[VX] > 0.5f) if (border_uv_scale.mV[VX] > 0.5f)
@@ -1390,7 +1389,7 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
} }
gGL.end(); gGL.end();
gGL.popMatrix(); gGL.popUIMatrix();
} }
void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& border_width, void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& border_width,
@@ -1553,7 +1552,7 @@ void LLRender2D::cleanupClass()
//static //static
void LLRender2D::translate(F32 x, F32 y, F32 z) void LLRender2D::translate(F32 x, F32 y, F32 z)
{ {
gGL.translatef(x,y,z); gGL.translateUI(x,y,z);
LLFontGL::sCurOrigin.mX += (S32) x; LLFontGL::sCurOrigin.mX += (S32) x;
LLFontGL::sCurOrigin.mY += (S32) y; LLFontGL::sCurOrigin.mY += (S32) y;
LLFontGL::sCurDepth += z; LLFontGL::sCurDepth += z;
@@ -1562,14 +1561,14 @@ void LLRender2D::translate(F32 x, F32 y, F32 z)
//static //static
void LLRender2D::pushMatrix() void LLRender2D::pushMatrix()
{ {
gGL.pushMatrix(); gGL.pushUIMatrix();
LLFontGL::sOriginStack.push_back(std::make_pair(LLFontGL::sCurOrigin, LLFontGL::sCurDepth)); LLFontGL::sOriginStack.push_back(std::make_pair(LLFontGL::sCurOrigin, LLFontGL::sCurDepth));
} }
//static //static
void LLRender2D::popMatrix() void LLRender2D::popMatrix()
{ {
gGL.popMatrix(); gGL.popUIMatrix();
LLFontGL::sCurOrigin = LLFontGL::sOriginStack.back().first; LLFontGL::sCurOrigin = LLFontGL::sOriginStack.back().first;
LLFontGL::sCurDepth = LLFontGL::sOriginStack.back().second; LLFontGL::sCurDepth = LLFontGL::sOriginStack.back().second;
LLFontGL::sOriginStack.pop_back(); LLFontGL::sOriginStack.pop_back();
@@ -1578,7 +1577,7 @@ void LLRender2D::popMatrix()
//static //static
void LLRender2D::loadIdentity() void LLRender2D::loadIdentity()
{ {
gGL.loadIdentity(); gGL.loadUIIdentity();
LLFontGL::sCurOrigin.mX = 0; LLFontGL::sCurOrigin.mX = 0;
LLFontGL::sCurOrigin.mY = 0; LLFontGL::sCurOrigin.mY = 0;
LLFontGL::sCurDepth = 0.f; LLFontGL::sCurDepth = 0.f;

View File

@@ -32,6 +32,7 @@ set(llui_SOURCE_FILES
llctrlselectioninterface.cpp llctrlselectioninterface.cpp
lldraghandle.cpp lldraghandle.cpp
lleditmenuhandler.cpp lleditmenuhandler.cpp
llfiltereditor.cpp
llfloater.cpp llfloater.cpp
llfocusmgr.cpp llfocusmgr.cpp
llfunctorregistry.cpp llfunctorregistry.cpp
@@ -57,6 +58,7 @@ set(llui_SOURCE_FILES
llscrollcontainer.cpp llscrollcontainer.cpp
llscrollingpanellist.cpp llscrollingpanellist.cpp
llscrolllistctrl.cpp llscrolllistctrl.cpp
llsearcheditor.cpp
llslider.cpp llslider.cpp
llsliderctrl.cpp llsliderctrl.cpp
llspinctrl.cpp llspinctrl.cpp
@@ -91,6 +93,7 @@ set(llui_HEADER_FILES
llctrlselectioninterface.h llctrlselectioninterface.h
lldraghandle.h lldraghandle.h
lleditmenuhandler.h lleditmenuhandler.h
llfiltereditor.h
llfloater.h llfloater.h
llfocusmgr.h llfocusmgr.h
llfunctorregistry.h llfunctorregistry.h
@@ -116,6 +119,7 @@ set(llui_HEADER_FILES
llresizehandle.h llresizehandle.h
llresmgr.h llresmgr.h
llrootview.h llrootview.h
llsearcheditor.h
llscrollbar.h llscrollbar.h
llscrollcontainer.h llscrollcontainer.h
llscrollingpanellist.h llscrollingpanellist.h

View File

@@ -251,7 +251,7 @@ LLAlertDialog::LLAlertDialog( LLNotificationPtr notification, bool modal)
LLButton* btn = new LLButton( LLButton* btn = new LLButton(
button_data.mName, button_rect, button_data.mName, button_rect,
"","", "", "","", "",
NULL, NULL, NULL,
font, font,
button_data.mText, button_data.mText,
button_data.mText); button_data.mText);
@@ -369,8 +369,7 @@ bool LLAlertDialog::setCheckBox( const std::string& check_title, const std::stri
check_rect.setOriginAndSize(msg_x, VPAD+BTN_HEIGHT+LINE_HEIGHT/2, check_rect.setOriginAndSize(msg_x, VPAD+BTN_HEIGHT+LINE_HEIGHT/2,
max_msg_width, LINE_HEIGHT); max_msg_width, LINE_HEIGHT);
mCheck = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font); mCheck = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font, boost::bind(&LLAlertDialog::onClickIgnore, this, _1));
mCheck->setCommitCallback(boost::bind(&LLAlertDialog::onClickIgnore, this, _1));
addChild(mCheck); addChild(mCheck);
return true; return true;

View File

@@ -61,8 +61,8 @@ S32 BTN_HEIGHT = 0;
S32 BTN_GRID = 12; S32 BTN_GRID = 12;
S32 BORDER_SIZE = 1; S32 BORDER_SIZE = 1;
LLButton::LLButton( const std::string& name, const LLRect& rect, const std::string& control_name, void (*click_callback)(void*), void *callback_data) LLButton::LLButton( const std::string& name, const LLRect& rect, const std::string& control_name, commit_callback_t commit_callback)
: LLUICtrl(name, rect, TRUE, NULL, NULL), : LLUICtrl(name, rect, TRUE, commit_callback),
mMouseDownFrame( 0 ), mMouseDownFrame( 0 ),
mMouseHeldDownCount(0), mMouseHeldDownCount(0),
@@ -120,7 +120,7 @@ LLButton::LLButton( const std::string& name, const LLRect& rect, const std::stri
mButtonFlashRate(LLUI::sConfigGroup->getF32("ButtonFlashRate")), mButtonFlashRate(LLUI::sConfigGroup->getF32("ButtonFlashRate")),
mAlpha(1.f) mAlpha(1.f)
{ {
init(click_callback, callback_data, control_name); init(control_name);
} }
@@ -128,12 +128,11 @@ LLButton::LLButton(const std::string& name, const LLRect& rect,
const std::string &unselected_image_name, const std::string &unselected_image_name,
const std::string &selected_image_name, const std::string &selected_image_name,
const std::string& control_name, const std::string& control_name,
void (*click_callback)(void*), commit_callback_t commit_callback,
void *callback_data,
const LLFontGL *font, const LLFontGL *font,
const std::string& unselected_label, const std::string& unselected_label,
const std::string& selected_label ) const std::string& selected_label )
: LLUICtrl(name, rect, TRUE, NULL, NULL), : LLUICtrl(name, rect, TRUE, commit_callback),
mMouseDownFrame( 0 ), mMouseDownFrame( 0 ),
mMouseHeldDownCount(0), mMouseHeldDownCount(0),
mBorderEnabled( FALSE ), mBorderEnabled( FALSE ),
@@ -215,10 +214,10 @@ LLButton::LLButton(const std::string& name, const LLRect& rect,
mImagePressed = mImageSelected; mImagePressed = mImageSelected;
} }
init(click_callback, callback_data, control_name); init(control_name);
} }
void LLButton::init(void (*click_callback)(void*), void *callback_data, const std::string& control_name) void LLButton::init(const std::string& control_name)
{ {
// Hack to make sure there is space for at least one character // Hack to make sure there is space for at least one character
if (getRect().getWidth() - (mRightHPad + mLeftHPad) < mGLFont->getWidth(std::string(" "))) if (getRect().getWidth() - (mRightHPad + mLeftHPad) < mGLFont->getWidth(std::string(" ")))
@@ -230,11 +229,7 @@ void LLButton::init(void (*click_callback)(void*), void *callback_data, const st
mMouseDownTimer.stop(); mMouseDownTimer.stop();
if(click_callback)
setClickedCallback(click_callback, callback_data);
setControlName(control_name, NULL); setControlName(control_name, NULL);
} }
@@ -1219,7 +1214,6 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa
image_selected, image_selected,
LLStringUtil::null, LLStringUtil::null,
NULL, NULL,
parent,
font, font,
label, label,
label_selected); label_selected);

View File

@@ -75,15 +75,14 @@ class LLButton
{ {
public: public:
// simple button with text label // simple button with text label
LLButton(const std::string& name, const LLRect &rect, const std::string& control_name = std::string(), LLButton(const std::string& name, const LLRect &rect = LLRect(), const std::string& control_name = std::string(),
void (*on_click)(void*) = NULL, void *data = NULL); commit_callback_t commit_callback = NULL);
LLButton(const std::string& name, const LLRect& rect, LLButton(const std::string& name, const LLRect& rect,
const std::string &unselected_image, const std::string &unselected_image,
const std::string &selected_image, const std::string &selected_image,
const std::string& control_name, const std::string& control_name,
void (*click_callback)(void*), commit_callback_t commit_callback,
void *callback_data = NULL,
const LLFontGL* mGLFont = NULL, const LLFontGL* mGLFont = NULL,
const std::string& unselected_label = LLStringUtil::null, const std::string& unselected_label = LLStringUtil::null,
const std::string& selected_label = LLStringUtil::null ); const std::string& selected_label = LLStringUtil::null );
@@ -94,7 +93,7 @@ public:
typedef boost::function<void(void*)> button_callback_t; typedef boost::function<void(void*)> button_callback_t;
void addImageAttributeToXML(LLXMLNodePtr node, const LLPointer<LLUIImage>, const std::string& xmlTagName) const; void addImageAttributeToXML(LLXMLNodePtr node, const LLPointer<LLUIImage>, const std::string& xmlTagName) const;
void init(void (*click_callback)(void*), void *callback_data, const std::string& control_name); void init(const std::string& control_name);
virtual LLXMLNodePtr getXML(bool save_children = true) const; virtual LLXMLNodePtr getXML(bool save_children = true) const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);

View File

@@ -55,12 +55,11 @@ static LLRegisterWidget<LLCheckBoxCtrl> r("check_box");
LLCheckBoxCtrl::LLCheckBoxCtrl(const std::string& name, const LLRect& rect, LLCheckBoxCtrl::LLCheckBoxCtrl(const std::string& name, const LLRect& rect,
const std::string& label, const std::string& label,
const LLFontGL* font, const LLFontGL* font,
void (*commit_callback)(LLUICtrl* ctrl, void* userdata), commit_callback_t commit_callback,
void* callback_user_data,
BOOL initial_value, BOOL initial_value,
BOOL use_radio_style, BOOL use_radio_style,
const std::string& control_which) const std::string& control_which)
: LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data, FOLLOWS_LEFT | FOLLOWS_TOP), : LLUICtrl(name, rect, TRUE, commit_callback, FOLLOWS_LEFT | FOLLOWS_TOP),
mTextEnabledColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ), mTextEnabledColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ),
mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ), mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ),
mRadioStyle( use_radio_style ), mRadioStyle( use_radio_style ),
@@ -122,7 +121,7 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const std::string& name, const LLRect& rect,
mButton = new LLButton( button_name, btn_rect, mButton = new LLButton( button_name, btn_rect,
active_false_id, active_true_id, control_which, active_false_id, active_true_id, control_which,
&LLCheckBoxCtrl::onButtonPress, this, LLFontGL::getFontSansSerif() ); boost::bind(&LLCheckBoxCtrl::onButtonPress, this, _2), LLFontGL::getFontSansSerif() );
mButton->setImageDisabledSelected(LLUI::getUIImage(inactive_true_id)); mButton->setImageDisabledSelected(LLUI::getUIImage(inactive_true_id));
mButton->setImageDisabled(LLUI::getUIImage(inactive_false_id)); mButton->setImageDisabled(LLUI::getUIImage(inactive_false_id));
@@ -144,10 +143,14 @@ LLCheckBoxCtrl::~LLCheckBoxCtrl()
// static // static
void LLCheckBoxCtrl::onButtonPress( void *userdata ) void LLCheckBoxCtrl::onButtonPress( const LLSD& data )
{ {
LLCheckBoxCtrl* self = (LLCheckBoxCtrl*)userdata; //if (mRadioStyle)
self->onCommit(); //{
// setValue(TRUE);
//}
onCommit();
} }
void LLCheckBoxCtrl::onCommit() void LLCheckBoxCtrl::onCommit()
@@ -315,8 +318,6 @@ LLView* LLCheckBoxCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto
BOOL radio_style = FALSE; BOOL radio_style = FALSE;
node->getAttributeBOOL("radio_style", radio_style); node->getAttributeBOOL("radio_style", radio_style);
LLUICtrlCallback callback = NULL;
if (label.empty()) if (label.empty())
{ {
label.assign(node->getTextContents()); label.assign(node->getTextContents());
@@ -329,7 +330,6 @@ LLView* LLCheckBoxCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto
rect, rect,
label, label,
font, font,
callback,
NULL, NULL,
FALSE, FALSE,
radio_style); // if true, draw radio button style icons radio_style); // if true, draw radio button style icons

View File

@@ -68,8 +68,7 @@ class LLCheckBoxCtrl
public: public:
LLCheckBoxCtrl(const std::string& name, const LLRect& rect, const std::string& label, LLCheckBoxCtrl(const std::string& name, const LLRect& rect, const std::string& label,
const LLFontGL* font = NULL, const LLFontGL* font = NULL,
void (*commit_callback)(LLUICtrl*, void*) = NULL, commit_callback_t commit_callback = NULL,
void* callback_userdata = NULL,
BOOL initial_value = FALSE, BOOL initial_value = FALSE,
BOOL use_radio_style = FALSE, // if true, draw radio button style icons BOOL use_radio_style = FALSE, // if true, draw radio button style icons
const std::string& control_which = LLStringUtil::null); const std::string& control_which = LLStringUtil::null);
@@ -113,7 +112,7 @@ public:
virtual void setControlName(const std::string& control_name, LLView* context); virtual void setControlName(const std::string& control_name, LLView* context);
virtual std::string getControlName() const; virtual std::string getControlName() const;
static void onButtonPress(void *userdata); void onButtonPress(const LLSD& data);
virtual BOOL isDirty() const; // Returns TRUE if the user has modified this control. virtual BOOL isDirty() const; // Returns TRUE if the user has modified this control.
virtual void resetDirty(); // Clear dirty state virtual void resetDirty(); // Clear dirty state

View File

@@ -61,11 +61,8 @@ S32 MAX_COMBO_WIDTH = 500;
static LLRegisterWidget<LLComboBox> r1("combo_box"); static LLRegisterWidget<LLComboBox> r1("combo_box");
LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::string& label, LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::string& label,
void (*commit_callback)(LLUICtrl*,void*), commit_callback_t commit_callback)
void *callback_userdata : LLUICtrl(name, rect, TRUE, commit_callback, FOLLOWS_LEFT | FOLLOWS_TOP),
)
: LLUICtrl(name, rect, TRUE, commit_callback, callback_userdata,
FOLLOWS_LEFT | FOLLOWS_TOP),
mTextEntry(NULL), mTextEntry(NULL),
mArrowImage(NULL), mArrowImage(NULL),
mAllowTextEntry(FALSE), mAllowTextEntry(FALSE),
@@ -83,15 +80,14 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::
// Text label button // Text label button
mButton = new LLButton(mLabel, mButton = new LLButton(mLabel,
LLRect(), LLRect(),
LLStringUtil::null, LLStringUtil::null);
NULL, this);
mButton->setImageUnselected(LLUI::getUIImage("square_btn_32x128.tga")); mButton->setImageUnselected(LLUI::getUIImage("square_btn_32x128.tga"));
mButton->setImageSelected(LLUI::getUIImage("square_btn_selected_32x128.tga")); mButton->setImageSelected(LLUI::getUIImage("square_btn_selected_32x128.tga"));
mButton->setImageDisabled(LLUI::getUIImage("square_btn_32x128.tga")); mButton->setImageDisabled(LLUI::getUIImage("square_btn_32x128.tga"));
mButton->setImageDisabledSelected(LLUI::getUIImage("square_btn_selected_32x128.tga")); mButton->setImageDisabledSelected(LLUI::getUIImage("square_btn_selected_32x128.tga"));
mButton->setScaleImage(TRUE); mButton->setScaleImage(TRUE);
mButton->setMouseDownCallback(boost::bind(&LLComboBox::onButtonDown,this)); mButton->setMouseDownCallback(boost::bind(&LLComboBox::onButtonMouseDown,this));
mButton->setFont(LLFontGL::getFontSansSerifSmall()); mButton->setFont(LLFontGL::getFontSansSerifSmall());
mButton->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM | FOLLOWS_RIGHT); mButton->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM | FOLLOWS_RIGHT);
mButton->setHAlign( LLFontGL::LEFT ); mButton->setHAlign( LLFontGL::LEFT );
@@ -100,7 +96,7 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::
// disallow multiple selection // disallow multiple selection
mList = new LLScrollListCtrl(std::string("ComboBox"), LLRect(), mList = new LLScrollListCtrl(std::string("ComboBox"), LLRect(),
&LLComboBox::onItemSelected, this, FALSE); boost::bind(&LLComboBox::onItemSelected, this), FALSE);
mList->setVisible(FALSE); mList->setVisible(FALSE);
mList->setBgWriteableColor(mListColor); mList->setBgWriteableColor(mListColor);
mList->setCommitOnKeyboardMovement(FALSE); mList->setCommitOnKeyboardMovement(FALSE);
@@ -168,13 +164,9 @@ LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *
S32 max_chars = 20; S32 max_chars = 20;
node->getAttributeS32("max_chars", max_chars); node->getAttributeS32("max_chars", max_chars);
LLUICtrlCallback callback = NULL;
LLComboBox* combo_box = new LLComboBox(name, LLComboBox* combo_box = new LLComboBox(name,
rect, rect,
label, label);
callback,
NULL);
combo_box->setAllowTextEntry(allow_text_entry, max_chars); combo_box->setAllowTextEntry(allow_text_entry, max_chars);
const std::string& contents = node->getValue(); const std::string& contents = node->getValue();
@@ -550,10 +542,8 @@ void LLComboBox::updateLayout()
LLStringUtil::null, LLStringUtil::null,
LLFontGL::getFontSansSerifSmall(), LLFontGL::getFontSansSerifSmall(),
mMaxChars, mMaxChars,
onTextCommit, boost::bind(&LLComboBox::onTextCommit, this, _2),
onTextEntry, boost::bind(&LLComboBox::onTextEntry, this, _1));
NULL,
this);
mTextEntry->setSelectAllonFocusReceived(TRUE); mTextEntry->setSelectAllonFocusReceived(TRUE);
mTextEntry->setHandleEditKeysDirectly(TRUE); mTextEntry->setHandleEditKeysDirectly(TRUE);
mTextEntry->setCommitOnFocusLost(FALSE); mTextEntry->setCommitOnFocusLost(FALSE);
@@ -720,31 +710,27 @@ void LLComboBox::hideList()
// static functions // static functions
//------------------------------------------------------------------ //------------------------------------------------------------------
// static void LLComboBox::onButtonMouseDown()
void LLComboBox::onButtonDown(void *userdata)
{ {
LLComboBox *self = (LLComboBox *)userdata; if (!mList->getVisible())
if (!self->mList->getVisible())
{ {
LLScrollListItem* last_selected_item = self->mList->getLastSelectedItem(); // this might change selection, so do it first
prearrangeList();
// highlight the last selected item from the original selection before potentially selecting a new item
// as visual cue to original value of combo box
LLScrollListItem* last_selected_item = mList->getLastSelectedItem();
if (last_selected_item) if (last_selected_item)
{ {
// highlight the original selection before potentially selecting a new item mList->mouseOverHighlightNthItem(mList->getItemIndex(last_selected_item));
self->mList->mouseOverHighlightNthItem(self->mList->getItemIndex(last_selected_item));
} }
if( self->mPrearrangeCallback ) if (mList->getItemCount() != 0)
{ {
self->mPrearrangeCallback( self, self->mCallbackUserData ); showList();
} }
if (self->mList->getItemCount() != 0) setFocus( TRUE );
{
self->showList();
}
self->setFocus( TRUE );
// pass mouse capture on to list if button is depressed // pass mouse capture on to list if button is depressed
/*if (self->mButton->hasMouseCapture()) /*if (self->mButton->hasMouseCapture())
@@ -754,36 +740,33 @@ void LLComboBox::onButtonDown(void *userdata)
} }
else else
{ {
self->hideList(); hideList();
} }
} }
// static void LLComboBox::onItemSelected()
void LLComboBox::onItemSelected(LLUICtrl* item, void *userdata)
{ {
// Note: item is the LLScrollListCtrl // Note: item is the LLScrollListCtrl
LLComboBox *self = (LLComboBox *) userdata; const std::string name = mList->getSelectedItemLabel();
const std::string name = self->mList->getSelectedItemLabel(); S32 cur_id = getCurrentIndex();
S32 cur_id = self->getCurrentIndex();
if (cur_id != -1) if (cur_id != -1)
{ {
self->setLabel(name); setLabel(name);
if (self->mAllowTextEntry) if (mAllowTextEntry)
{ {
gFocusMgr.setKeyboardFocus(self->mTextEntry); gFocusMgr.setKeyboardFocus(mTextEntry);
self->mTextEntry->selectAll(); mTextEntry->selectAll();
} }
} }
// hiding the list reasserts the old value stored in the text editor/dropdown button // hiding the list reasserts the old value stored in the text editor/dropdown button
self->hideList(); hideList();
// commit does the reverse, asserting the value in the list // commit does the reverse, asserting the value in the list
self->onCommit(); onCommit();
} }
BOOL LLComboBox::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) BOOL LLComboBox::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen)
@@ -908,28 +891,26 @@ const std::string LLComboBox::getTextEntry() const
return mTextEntry->getText(); return mTextEntry->getText();
} }
//static void LLComboBox::onTextEntry(LLLineEditor* line_editor)
void LLComboBox::onTextEntry(LLLineEditor* line_editor, void* user_data)
{ {
LLComboBox* self = (LLComboBox*)user_data; if (mTextEntryCallback != NULL)
if (self->mTextEntryCallback)
{ {
(*self->mTextEntryCallback)(line_editor, self->mCallbackUserData); (mTextEntryCallback)(line_editor, LLSD());
} }
KEY key = gKeyboard->currentKey(); KEY key = gKeyboard->currentKey();
if (key == KEY_BACKSPACE || if (key == KEY_BACKSPACE ||
key == KEY_DELETE) key == KEY_DELETE)
{ {
if (self->mList->selectItemByLabel(line_editor->getText(), FALSE)) if (mList->selectItemByLabel(line_editor->getText(), FALSE))
{ {
line_editor->setTentative(FALSE); line_editor->setTentative(FALSE);
} }
else else
{ {
if (!self->mSuppressTentative) line_editor->setTentative(self->mTextEntryTentative); if (!mSuppressTentative)
self->mList->deselectAllItems(); line_editor->setTentative(mTextEntryTentative);
mList->deselectAllItems();
} }
return; return;
} }
@@ -942,17 +923,14 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor, void* user_data)
if (key == KEY_DOWN) if (key == KEY_DOWN)
{ {
self->setCurrentByIndex(llmin(self->getItemCount() - 1, self->getCurrentIndex() + 1)); setCurrentByIndex(llmin(getItemCount() - 1, getCurrentIndex() + 1));
if (!self->mList->getVisible()) if (!mList->getVisible())
{ {
if( self->mPrearrangeCallback ) prearrangeList();
{
self->mPrearrangeCallback( self, self->mCallbackUserData );
}
if (self->mList->getItemCount() != 0) if (mList->getItemCount() != 0)
{ {
self->showList(); showList();
} }
} }
line_editor->selectAll(); line_editor->selectAll();
@@ -960,17 +938,14 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor, void* user_data)
} }
else if (key == KEY_UP) else if (key == KEY_UP)
{ {
self->setCurrentByIndex(llmax(0, self->getCurrentIndex() - 1)); setCurrentByIndex(llmax(0, getCurrentIndex() - 1));
if (!self->mList->getVisible()) if (!mList->getVisible())
{ {
if( self->mPrearrangeCallback ) prearrangeList();
{
self->mPrearrangeCallback( self, self->mCallbackUserData );
}
if (self->mList->getItemCount() != 0) if (mList->getItemCount() != 0)
{ {
self->showList(); showList();
} }
} }
line_editor->selectAll(); line_editor->selectAll();
@@ -979,7 +954,7 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor, void* user_data)
else else
{ {
// RN: presumably text entry // RN: presumably text entry
self->updateSelection(); updateSelection();
} }
} }
@@ -1000,10 +975,7 @@ void LLComboBox::updateSelection()
// callback to populate content // callback to populate content
if( mTextEntry->getWText().size() == 1 ) if( mTextEntry->getWText().size() == 1 )
{ {
if (mPrearrangeCallback) prearrangeList(mTextEntry->getText());
{
mPrearrangeCallback( this, mCallbackUserData );
}
} }
if (mList->selectItemByLabel(full_string, FALSE)) if (mList->selectItemByLabel(full_string, FALSE))
@@ -1027,14 +999,12 @@ void LLComboBox::updateSelection()
} }
} }
//static void LLComboBox::onTextCommit(const LLSD& data)
void LLComboBox::onTextCommit(LLUICtrl* caller, void* user_data)
{ {
LLComboBox* self = (LLComboBox*)user_data; std::string text = mTextEntry->getText();
std::string text = self->mTextEntry->getText(); setSimple(text);
self->setSimple(text); onCommit();
self->onCommit(); mTextEntry->selectAll();
self->mTextEntry->selectAll();
} }
void LLComboBox::setSuppressTentative(bool suppress) void LLComboBox::setSuppressTentative(bool suppress)
@@ -1081,6 +1051,14 @@ void LLComboBox::setPrevalidate( BOOL (*func)(const LLWString &) )
if (mTextEntry) mTextEntry->setPrevalidate(func); if (mTextEntry) mTextEntry->setPrevalidate(func);
} }
void LLComboBox::prearrangeList(std::string filter)
{
if (mPrearrangeCallback)
{
mPrearrangeCallback(this, LLSD(filter));
}
}
//============================================================================ //============================================================================
// LLCtrlListInterface functions // LLCtrlListInterface functions
@@ -1201,20 +1179,16 @@ const S32 FLYOUT_BUTTON_ARROW_WIDTH = 24;
LLFlyoutButton::LLFlyoutButton( LLFlyoutButton::LLFlyoutButton(
const std::string& name, const std::string& name,
const LLRect &rect, const LLRect &rect,
const std::string& label, const std::string& label)
void (*commit_callback)(LLUICtrl*, void*) , : LLComboBox(name, rect, LLStringUtil::null),
void *callback_userdata)
: LLComboBox(name, rect, LLStringUtil::null, commit_callback, callback_userdata),
mToggleState(FALSE), mToggleState(FALSE),
mActionButton(NULL) mActionButton(NULL)
{ {
// Always use text box // Always use text box
// Text label button // Text label button
mActionButton = new LLButton(label, mActionButton = new LLButton(label,
LLRect(), LLStringUtil::null, NULL, this); LLRect(), LLStringUtil::null, boost::bind(&LLFlyoutButton::onActionButtonClick, this));
mActionButton->setScaleImage(TRUE); mActionButton->setScaleImage(TRUE);
mActionButton->setClickedCallback(boost::bind(&LLFlyoutButton::onActionButtonClick, this));
mActionButton->setFollowsAll(); mActionButton->setFollowsAll();
mActionButton->setHAlign( LLFontGL::HCENTER ); mActionButton->setHAlign( LLFontGL::HCENTER );
mActionButton->setLabel(label); mActionButton->setLabel(label);
@@ -1280,13 +1254,9 @@ LLView* LLFlyoutButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto
LLRect rect; LLRect rect;
createRect(node, rect, parent, LLRect()); createRect(node, rect, parent, LLRect());
LLUICtrlCallback callback = NULL;
LLFlyoutButton* flyout_button = new LLFlyoutButton(name, LLFlyoutButton* flyout_button = new LLFlyoutButton(name,
rect, rect,
label, label);
callback,
NULL);
std::string list_position; std::string list_position;
node->getAttributeString("list_position", list_position); node->getAttributeString("list_position", list_position);
@@ -1335,13 +1305,11 @@ void LLFlyoutButton::updateLayout()
mActionButton->reshape(getRect().getWidth() - FLYOUT_BUTTON_ARROW_WIDTH, getRect().getHeight()); mActionButton->reshape(getRect().getWidth() - FLYOUT_BUTTON_ARROW_WIDTH, getRect().getHeight());
} }
//static void LLFlyoutButton::onActionButtonClick()
void LLFlyoutButton::onActionButtonClick(void *user_data)
{ {
LLFlyoutButton* buttonp = (LLFlyoutButton*)user_data;
// remember last list selection? // remember last list selection?
buttonp->mList->deselect(); mList->deselect();
buttonp->onCommit(); onCommit();
} }
void LLFlyoutButton::draw() void LLFlyoutButton::draw()

View File

@@ -68,11 +68,13 @@ public:
const std::string& name, const std::string& name,
const LLRect &rect, const LLRect &rect,
const std::string& label, const std::string& label,
void (*commit_callback)(LLUICtrl*, void*) = NULL, commit_callback_t commit_callback = NULL
void *callback_userdata = NULL
); );
virtual ~LLComboBox(); virtual ~LLComboBox();
protected:
void prearrangeList(std::string filter = "");
public:
// LLView interface // LLView interface
virtual LLXMLNodePtr getXML(bool save_children = true) const; virtual LLXMLNodePtr getXML(bool save_children = true) const;
@@ -176,15 +178,16 @@ public:
void* getCurrentUserdata(); void* getCurrentUserdata();
void setPrearrangeCallback( void (*cb)(LLUICtrl*,void*) ) { mPrearrangeCallback = cb; } void setPrearrangeCallback( commit_callback_t cb ) { mPrearrangeCallback = cb; }
void setTextEntryCallback( void (*cb)(LLLineEditor*, void*) ) { mTextEntryCallback = cb; } void setTextEntryCallback( commit_callback_t cb ) { mTextEntryCallback = cb; }
void setButtonVisible(BOOL visible); void setButtonVisible(BOOL visible);
static void onButtonDown(void *userdata); void onButtonMouseDown();
static void onItemSelected(LLUICtrl* item, void *userdata); void onItemSelected();
static void onTextEntry(LLLineEditor* line_editor, void* user_data);
static void onTextCommit(LLUICtrl* caller, void* user_data); void onTextCommit(const LLSD& data);
void setSuppressTentative(bool suppress); void setSuppressTentative(bool suppress);
void setSuppressAutoComplete(bool suppress); void setSuppressAutoComplete(bool suppress);
@@ -193,8 +196,11 @@ public:
virtual void showList(); virtual void showList();
virtual void hideList(); virtual void hideList();
virtual void onTextEntry(LLLineEditor* line_editor);
protected: protected:
LLButton* mButton; LLButton* mButton;
LLLineEditor* mTextEntry;
LLScrollListCtrl* mList; LLScrollListCtrl* mList;
EPreferredPosition mListPosition; EPreferredPosition mListPosition;
LLPointer<LLUIImage> mArrowImage; LLPointer<LLUIImage> mArrowImage;
@@ -203,14 +209,13 @@ protected:
private: private:
S32 mButtonPadding; S32 mButtonPadding;
LLLineEditor* mTextEntry;
BOOL mAllowTextEntry; BOOL mAllowTextEntry;
S32 mMaxChars; S32 mMaxChars;
BOOL mTextEntryTentative; BOOL mTextEntryTentative;
bool mSuppressAutoComplete; bool mSuppressAutoComplete;
bool mSuppressTentative; bool mSuppressTentative;
void (*mPrearrangeCallback)(LLUICtrl*,void*); commit_callback_t mPrearrangeCallback;
void (*mTextEntryCallback)(LLLineEditor*, void*); commit_callback_t mTextEntryCallback;
boost::signals2::connection mTopLostSignalConnection; boost::signals2::connection mTopLostSignalConnection;
}; };
@@ -220,9 +225,7 @@ public:
LLFlyoutButton( LLFlyoutButton(
const std::string& name, const std::string& name,
const LLRect &rect, const LLRect &rect,
const std::string& label, const std::string& label);
void (*commit_callback)(LLUICtrl*, void*) = NULL,
void *callback_userdata = NULL);
virtual void updateLayout(); virtual void updateLayout();
virtual void draw(); virtual void draw();
@@ -232,8 +235,8 @@ public:
virtual LLXMLNodePtr getXML(bool save_children = true) const; virtual LLXMLNodePtr getXML(bool save_children = true) const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
static void onActionButtonClick(void *userdata); void onActionButtonClick();
static void onSelectAction(LLUICtrl* ctrl, void *userdata); void onSelectAction(LLUICtrl* ctrl);
protected: protected:
LLButton* mActionButton; LLButton* mActionButton;

View File

@@ -0,0 +1,81 @@
/**
* @file llfiltereditor.cpp
* @brief LLFilterEditor implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
// Text editor widget to let users enter a single line.
#include "linden_common.h"
#include "llfiltereditor.h"
static LLRegisterWidget<LLFilterEditor> r2("filter_editor");
LLFilterEditor::LLFilterEditor(const std::string& name,
const LLRect& rect,
S32 max_length_bytes)
: LLSearchEditor(name,rect,max_length_bytes)
{
setCommitOnFocusLost(FALSE); // we'll commit on every keystroke, don't re-commit when we take focus away (i.e. we go to interact with the actual results!)
}
void LLFilterEditor::handleKeystroke()
{
this->LLSearchEditor::handleKeystroke();
// Commit on every keystroke.
onCommit();
}
// static
LLView* LLFilterEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("filter_editor");
node->getAttributeString("name", name);
LLRect rect;
createRect(node, rect, parent, LLRect());
S32 max_text_length = 128;
node->getAttributeS32("max_length", max_text_length);
std::string text = node->getValue().substr(0, max_text_length - 1);
LLFilterEditor* search_editor = new LLFilterEditor(name,
rect,
max_text_length);
std::string label;
if(node->getAttributeString("label", label))
{
search_editor->setLabel(label);
}
search_editor->setText(text);
search_editor->initFromXML(node, parent);
return search_editor;
}

View File

@@ -0,0 +1,54 @@
/**
* @file llfiltereditor.h
* @brief Text editor widget that represents a filter operation
*
* Features:
* Text entry of a single line (text, delete, left and right arrow, insert, return).
* Callbacks either on every keystroke or just on the return key.
* Focus (allow multiple text entry widgets)
* Clipboard (cut, copy, and paste)
* Horizontal scrolling to allow strings longer than widget size allows
* Pre-validation (limit which keys can be used)
* Optional line history so previous entries can be recalled by CTRL UP/DOWN
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_FILTEREDITOR_H
#define LL_FILTEREDITOR_H
#include "llsearcheditor.h"
class LLFilterEditor : public LLSearchEditor
{
public:
LLFilterEditor(const std::string& name,
const LLRect& rect,
S32 max_length_bytes);
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
protected:
friend class LLUICtrlFactory;
/*virtual*/ void handleKeystroke();
};
#endif // LL_FILTEREDITOR_H

View File

@@ -113,13 +113,14 @@ std::string LLFloater::sButtonToolTips[BUTTON_COUNT] =
"Edit", //BUTTON_EDIT "Edit", //BUTTON_EDIT
}; };
LLFloater::click_callback LLFloater::sButtonCallbacks[BUTTON_COUNT] =
LLFloater::button_callback LLFloater::sButtonCallbacks[BUTTON_COUNT] =
{ {
LLFloater::onClickClose, //BUTTON_CLOSE &LLFloater::onClickClose, //BUTTON_CLOSE
LLFloater::onClickMinimize, //BUTTON_RESTORE &LLFloater::onClickMinimize, //BUTTON_RESTORE
LLFloater::onClickMinimize, //BUTTON_MINIMIZE &LLFloater::onClickMinimize, //BUTTON_MINIMIZE
LLFloater::onClickTearOff, //BUTTON_TEAR_OFF &LLFloater::onClickTearOff, //BUTTON_TEAR_OFF
LLFloater::onClickEdit, //BUTTON_EDIT &LLFloater::onClickEdit, //BUTTON_EDIT
}; };
LLMultiFloater* LLFloater::sHostp = NULL; LLMultiFloater* LLFloater::sHostp = NULL;
@@ -1286,60 +1287,49 @@ void LLFloater::setEditModeEnabled(BOOL enable)
} }
// static void LLFloater::onClickMinimize()
void LLFloater::onClickMinimize(void *userdata)
{ {
LLFloater* self = (LLFloater*) userdata; setMinimized( !isMinimized() );
if (!self) return;
self->setMinimized( !self->isMinimized() );
} }
void LLFloater::onClickTearOff(void *userdata) void LLFloater::onClickTearOff()
{ {
LLFloater* self = (LLFloater*) userdata; LLMultiFloater* host_floater = getHost();
if (!self) return;
LLMultiFloater* host_floater = self->getHost();
if (host_floater) //Tear off if (host_floater) //Tear off
{ {
LLRect new_rect; LLRect new_rect;
host_floater->removeFloater(self); host_floater->removeFloater(this);
// reparent to floater view // reparent to floater view
gFloaterView->addChild(self); gFloaterView->addChild(this);
self->open(); /* Flawfinder: ignore */ open(); /* Flawfinder: ignore */
// only force position for floaters that don't have that data saved // only force position for floaters that don't have that data saved
if (self->getRectControl().empty()) if (getRectControl().empty())
{ {
new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - LLFLOATER_HEADER_SIZE - 5, self->getRect().getWidth(), self->getRect().getHeight()); new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - LLFLOATER_HEADER_SIZE - 5, getRect().getWidth(), getRect().getHeight());
self->setRect(new_rect); setRect(new_rect);
} }
gFloaterView->adjustToFitScreen(self, FALSE); gFloaterView->adjustToFitScreen(this, FALSE);
// give focus to new window to keep continuity for the user // give focus to new window to keep continuity for the user
self->setFocus(TRUE); setFocus(TRUE);
} }
else //Attach to parent. else //Attach to parent.
{ {
LLMultiFloater* new_host = (LLMultiFloater*)self->mLastHostHandle.get(); LLMultiFloater* new_host = (LLMultiFloater*)mLastHostHandle.get();
if (new_host) if (new_host)
{ {
self->setMinimized(FALSE); // to reenable minimize button if it was minimized setMinimized(FALSE); // to reenable minimize button if it was minimized
new_host->showFloater(self); new_host->showFloater(this);
// make sure host is visible // make sure host is visible
new_host->open(); new_host->open();
} }
} }
} }
// static void LLFloater::onClickEdit()
void LLFloater::onClickEdit(void *userdata)
{ {
LLFloater* self = (LLFloater*) userdata; mEditing = mEditing ? FALSE : TRUE;
if (!self) return;
self->mEditing = self->mEditing ? FALSE : TRUE;
} }
// static // static
@@ -1393,13 +1383,9 @@ void LLFloater::closeFocusedFloater()
} }
// static void LLFloater::onClickClose()
void LLFloater::onClickClose( void* userdata )
{ {
LLFloater* self = (LLFloater*) userdata; close();
if (!self) return;
self->close();
} }
@@ -1716,8 +1702,7 @@ void LLFloater::buildButtons()
sButtonActiveImageNames[i], sButtonActiveImageNames[i],
sButtonPressedImageNames[i], sButtonPressedImageNames[i],
LLStringUtil::null, LLStringUtil::null,
sButtonCallbacks[i], boost::bind(sButtonCallbacks[i],this),
this,
LLFontGL::getFontSansSerif()); LLFontGL::getFontSansSerif());
buttonp->setTabStop(FALSE); buttonp->setTabStop(FALSE);
@@ -1740,7 +1725,7 @@ void LLFloater::buildButtons()
// LLFloaterView // LLFloaterView
LLFloaterView::LLFloaterView( const std::string& name, const LLRect& rect ) LLFloaterView::LLFloaterView( const std::string& name, const LLRect& rect )
: LLUICtrl( name, rect, FALSE, NULL, NULL, FOLLOWS_ALL ), : LLUICtrl( name, rect, FALSE, NULL, FOLLOWS_ALL ),
mFocusCycleMode(FALSE), mFocusCycleMode(FALSE),
mSnapOffsetBottom(0) mSnapOffsetBottom(0)
{ {

View File

@@ -241,10 +241,10 @@ public:
return LLNotification::Params(name).context(mNotificationContext); return LLNotification::Params(name).context(mNotificationContext);
} }
static void onClickClose(void *userdata); void onClickClose();
static void onClickMinimize(void *userdata); void onClickMinimize();
static void onClickTearOff(void *userdata); void onClickTearOff();
static void onClickEdit(void *userdata); void onClickEdit();
static void setFloaterHost(LLMultiFloater* hostp) {sHostp = hostp; } static void setFloaterHost(LLMultiFloater* hostp) {sHostp = hostp; }
static void setEditModeEnabled(BOOL enable); static void setEditModeEnabled(BOOL enable);
@@ -317,8 +317,10 @@ private:
static std::string sButtonPressedImageNames[BUTTON_COUNT]; static std::string sButtonPressedImageNames[BUTTON_COUNT];
static std::string sButtonNames[BUTTON_COUNT]; static std::string sButtonNames[BUTTON_COUNT];
static std::string sButtonToolTips[BUTTON_COUNT]; static std::string sButtonToolTips[BUTTON_COUNT];
typedef void (*click_callback)(void *);
static click_callback sButtonCallbacks[BUTTON_COUNT]; typedef void (LLFloater::*button_callback)();
static button_callback sButtonCallbacks[BUTTON_COUNT];
typedef std::map<LLHandle<LLFloater>, LLFloater*> handle_map_t; typedef std::map<LLHandle<LLFloater>, LLFloater*> handle_map_t;
typedef std::map<LLHandle<LLFloater>, LLFloater*>::iterator handle_map_iter_t; typedef std::map<LLHandle<LLFloater>, LLFloater*>::iterator handle_map_iter_t;

View File

@@ -49,7 +49,7 @@ LLIconCtrl::LLIconCtrl(const std::string& name, const LLRect &rect, const LLUUID
: LLUICtrl(name, : LLUICtrl(name,
rect, rect,
FALSE, // mouse opaque FALSE, // mouse opaque
NULL, NULL, NULL,
FOLLOWS_LEFT | FOLLOWS_TOP), FOLLOWS_LEFT | FOLLOWS_TOP),
mColor( LLColor4::white ) mColor( LLColor4::white )
{ {
@@ -61,7 +61,7 @@ LLIconCtrl::LLIconCtrl(const std::string& name, const LLRect &rect, const std::s
: LLUICtrl(name, : LLUICtrl(name,
rect, rect,
FALSE, // mouse opaque FALSE, // mouse opaque
NULL, NULL, NULL,
FOLLOWS_LEFT | FOLLOWS_TOP), FOLLOWS_LEFT | FOLLOWS_TOP),
mColor( LLColor4::white ), mColor( LLColor4::white ),
mImageName(image_name) mImageName(image_name)

View File

@@ -93,16 +93,15 @@ static LLRegisterWidget<LLLineEditor> r1("line_editor");
LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect, LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect,
const std::string& default_text, const LLFontGL* font, const std::string& default_text, const LLFontGL* font,
S32 max_length_bytes, S32 max_length_bytes,
void (*commit_callback)(LLUICtrl* caller, void* user_data ), commit_callback_t commit_callback,
void (*keystroke_callback)(LLLineEditor* caller, void* user_data ), keystroke_callback_t keystroke_callback,
void (*focus_lost_callback)(LLFocusableElement* caller, void* user_data ), focus_lost_callback_t focus_lost_callback,
void* userdata, validate_func_t prevalidate_func,
LLLinePrevalidateFunc prevalidate_func,
LLViewBorder::EBevel border_bevel, LLViewBorder::EBevel border_bevel,
LLViewBorder::EStyle border_style, LLViewBorder::EStyle border_style,
S32 border_thickness) S32 border_thickness)
: :
LLUICtrl( name, rect, TRUE, commit_callback, userdata, FOLLOWS_TOP | FOLLOWS_LEFT ), LLUICtrl( name, rect, TRUE, commit_callback, FOLLOWS_TOP | FOLLOWS_LEFT ),
mMaxLengthBytes(max_length_bytes), mMaxLengthBytes(max_length_bytes),
mCursorPos( 0 ), mCursorPos( 0 ),
mScrollHPos( 0 ), mScrollHPos( 0 ),
@@ -142,6 +141,9 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect,
mSpellCheckable( FALSE ), mSpellCheckable( FALSE ),
mContextMenuHandle() mContextMenuHandle()
{ {
if(focus_lost_callback)
setFocusLostCallback(focus_lost_callback);
llassert( max_length_bytes > 0 ); llassert( max_length_bytes > 0 );
// Initialize current history line iterator // Initialize current history line iterator
@@ -156,9 +158,6 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect,
mGLFont = LLFontGL::getFontSansSerifSmall(); mGLFont = LLFontGL::getFontSansSerifSmall();
} }
if(focus_lost_callback)
setFocusLostCallback(boost::bind(focus_lost_callback,_1,(void*)NULL));
setTextPadding(0, 0); setTextPadding(0, 0);
mScrollTimer.reset(); mScrollTimer.reset();
@@ -1112,9 +1111,8 @@ void LLLineEditor::cut()
reportBadKeystroke(); reportBadKeystroke();
} }
else else
if( mKeystrokeCallback )
{ {
mKeystrokeCallback( this, mCallbackUserData ); onKeystroke();
} }
} }
} }
@@ -1160,8 +1158,10 @@ void LLLineEditor::insert(std::string what, S32 wher)
rollback.doRollback( this ); rollback.doRollback( this );
reportBadKeystroke(); reportBadKeystroke();
} }
else if( mKeystrokeCallback ) else
mKeystrokeCallback( this, mCallbackUserData ); {
onKeystroke();
}
} }
BOOL LLLineEditor::canPaste() const BOOL LLLineEditor::canPaste() const
@@ -1261,9 +1261,8 @@ void LLLineEditor::pasteHelper(bool is_primary)
reportBadKeystroke(); reportBadKeystroke();
} }
else else
if( mKeystrokeCallback )
{ {
mKeystrokeCallback( this, mCallbackUserData ); onKeystroke();
} }
} }
} }
@@ -1582,10 +1581,7 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask )
// Notify owner if requested // Notify owner if requested
if (!need_to_rollback && handled) if (!need_to_rollback && handled)
{ {
if (mKeystrokeCallback) onKeystroke();
{
mKeystrokeCallback(this, mCallbackUserData);
}
} }
} }
} }
@@ -1637,12 +1633,10 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char)
// Notify owner if requested // Notify owner if requested
if( !need_to_rollback && handled ) if( !need_to_rollback && handled )
{ {
if( mKeystrokeCallback ) // HACK! The only usage of this callback doesn't do anything with the character.
{ // We'll have to do something about this if something ever changes! - Doug
// HACK! The only usage of this callback doesn't do anything with the character. onKeystroke();
// We'll have to do something about this if something ever changes! - Doug
mKeystrokeCallback( this, mCallbackUserData );
}
} }
} }
return handled; return handled;
@@ -1651,7 +1645,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char)
BOOL LLLineEditor::canDoDelete() const BOOL LLLineEditor::canDoDelete() const
{ {
return ( !mReadOnly && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) ); return ( !mReadOnly && mText.length() > 0 && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) );
} }
void LLLineEditor::doDelete() void LLLineEditor::doDelete()
@@ -1680,10 +1674,7 @@ void LLLineEditor::doDelete()
} }
else else
{ {
if( mKeystrokeCallback ) onKeystroke();
{
mKeystrokeCallback( this, mCallbackUserData );
}
} }
} }
} }
@@ -1757,7 +1748,8 @@ void LLLineEditor::draw()
} }
// draw rectangle for the background // draw rectangle for the background
LLRect background( 0, getRect().getHeight(), getRect().getWidth(), 0 ); //LLRect background( 0, getRect().getHeight(), getRect().getWidth(), 0 );
LLRect background = getLocalRect();
background.stretch( -mBorderThickness ); background.stretch( -mBorderThickness );
LLColor4 bg_color = mReadOnlyBgColor; LLColor4 bg_color = mReadOnlyBgColor;
@@ -2131,7 +2123,7 @@ void LLLineEditor::setRect(const LLRect& rect)
} }
} }
void LLLineEditor::setPrevalidate(BOOL (*func)(const LLWString &)) void LLLineEditor::setPrevalidate(LLLineEditor::validate_func_t func)
{ {
mPrevalidateFunc = func; mPrevalidateFunc = func;
updateAllowingLanguageInput(); updateAllowingLanguageInput();
@@ -2483,12 +2475,21 @@ void LLLineEditor::setSelectAllonFocusReceived(BOOL b)
mSelectAllonFocusReceived = b; mSelectAllonFocusReceived = b;
} }
void LLLineEditor::onKeystroke()
void LLLineEditor::setKeystrokeCallback(void (*keystroke_callback)(LLLineEditor* caller, void* user_data))
{ {
mKeystrokeCallback = keystroke_callback; if (mKeystrokeCallback)
{
mKeystrokeCallback(this);
}
} }
void LLLineEditor::setKeystrokeCallback(keystroke_callback_t callback)
{
mKeystrokeCallback = callback;
}
// virtual // virtual
LLXMLNodePtr LLLineEditor::getXML(bool save_children) const LLXMLNodePtr LLLineEditor::getXML(bool save_children) const
{ {
@@ -2579,14 +2580,11 @@ LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
S32 border_thickness = 1; S32 border_thickness = 1;
node->getAttributeS32("border_thickness", border_thickness); node->getAttributeS32("border_thickness", border_thickness);
LLUICtrlCallback commit_callback = NULL;
LLLineEditor* line_editor = new LLLineEditor(name, LLLineEditor* line_editor = new LLLineEditor(name,
rect, rect,
text, text,
font, font,
max_text_length, max_text_length,
commit_callback,
NULL, NULL,
NULL, NULL,
NULL, NULL,
@@ -2833,10 +2831,8 @@ void LLLineEditor::updatePreedit(const LLWString &preedit_string,
// Update of the preedit should be caused by some key strokes. // Update of the preedit should be caused by some key strokes.
mKeystrokeTimer.reset(); mKeystrokeTimer.reset();
if( mKeystrokeCallback ) onKeystroke();
{
mKeystrokeCallback( this, mCallbackUserData );
}
} }
BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const
@@ -3093,156 +3089,3 @@ void LLLineEditor::setContextMenu(LLMenuGL* new_context_menu)
mContextMenuHandle.markDead(); mContextMenuHandle.markDead();
} }
static LLRegisterWidget<LLSearchEditor> r2("search_editor");
LLSearchEditor::LLSearchEditor(const std::string& name,
const LLRect& rect,
S32 max_length_bytes,
void (*search_callback)(const std::string& search_string, void* user_data),
void* userdata)
:
LLUICtrl(name, rect, TRUE, NULL, userdata),
mSearchCallback(search_callback)
{
LLRect search_edit_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
mSearchEdit = new LLLineEditor(std::string("search edit"),
search_edit_rect,
LLStringUtil::null,
NULL,
max_length_bytes,
NULL,
onSearchEdit,
NULL,
this);
mSearchEdit->setFollowsAll();
mSearchEdit->setSelectAllonFocusReceived(TRUE);
addChild(mSearchEdit);
S32 btn_width = rect.getHeight(); // button is square, and as tall as search editor
LLRect clear_btn_rect(rect.getWidth() - btn_width, rect.getHeight(), rect.getWidth(), 0);
mClearSearchButton = new LLButton(std::string("clear search"),
clear_btn_rect,
std::string("icn_clear_lineeditor.tga"),
std::string("UIImgBtnCloseInactiveUUID"),
LLStringUtil::null,
onClearSearch,
this,
NULL,
LLStringUtil::null);
mClearSearchButton->setFollowsRight();
mClearSearchButton->setFollowsTop();
mClearSearchButton->setImageColor(LLUI::sColorsGroup->getColor("TextFgTentativeColor"));
mClearSearchButton->setTabStop(FALSE);
mSearchEdit->addChild(mClearSearchButton);
mSearchEdit->setTextPadding(0, btn_width);
}
//virtual
void LLSearchEditor::setValue(const LLSD& value )
{
mSearchEdit->setValue(value);
}
//virtual
LLSD LLSearchEditor::getValue() const
{
return mSearchEdit->getValue();
}
//virtual
BOOL LLSearchEditor::setTextArg( const std::string& key, const LLStringExplicit& text )
{
return mSearchEdit->setTextArg(key, text);
}
//virtual
BOOL LLSearchEditor::setLabelArg( const std::string& key, const LLStringExplicit& text )
{
return mSearchEdit->setLabelArg(key, text);
}
//virtual
void LLSearchEditor::clear()
{
if (mSearchEdit)
{
mSearchEdit->clear();
}
}
void LLSearchEditor::draw()
{
mClearSearchButton->setVisible(!mSearchEdit->getWText().empty());
LLUICtrl::draw();
}
//static
void LLSearchEditor::onSearchEdit(LLLineEditor* caller, void* user_data )
{
LLSearchEditor* search_editor = (LLSearchEditor*)user_data;
if (search_editor->mSearchCallback)
{
search_editor->mSearchCallback(caller->getText(), search_editor->mCallbackUserData);
}
}
//static
void LLSearchEditor::onClearSearch(void* user_data)
{
LLSearchEditor* search_editor = (LLSearchEditor*)user_data;
search_editor->setText(LLStringUtil::null);
if (search_editor->mSearchCallback)
{
search_editor->mSearchCallback(LLStringUtil::null, search_editor->mCallbackUserData);
}
}
// virtual
LLXMLNodePtr LLSearchEditor::getXML(bool save_children) const
{
LLXMLNodePtr node = LLUICtrl::getXML();
node->setName(LL_SEARCH_EDITOR_TAG);
return node;
}
// static
LLView* LLSearchEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("search_editor");
node->getAttributeString("name", name);
LLRect rect;
createRect(node, rect, parent, LLRect());
S32 max_text_length = 128;
node->getAttributeS32("max_length", max_text_length);
std::string text = node->getValue().substr(0, max_text_length - 1);
LLSearchEditor* search_editor = new LLSearchEditor(name,
rect,
max_text_length,
NULL, NULL);
std::string label;
if(node->getAttributeString("label", label))
{
search_editor->mSearchEdit->setLabel(label);
}
search_editor->setText(text);
search_editor->initFromXML(node, parent);
return search_editor;
}

View File

@@ -58,24 +58,24 @@ class LLLineEditorRollback;
class LLButton; class LLButton;
class LLMenuGL; class LLMenuGL;
typedef BOOL (*LLLinePrevalidateFunc)(const LLWString &wstr);
class LLLineEditor class LLLineEditor
: public LLUICtrl, public LLEditMenuHandler, protected LLPreeditor : public LLUICtrl, public LLEditMenuHandler, protected LLPreeditor
{ {
public: public:
typedef boost::function<void (LLLineEditor* caller)> keystroke_callback_t;
typedef boost::function<void (LLFocusableElement*)> focus_lost_callback_t;
typedef boost::function<BOOL (const LLWString &wstr)> validate_func_t;
LLLineEditor(const std::string& name, LLLineEditor(const std::string& name,
const LLRect& rect, const LLRect& rect,
const std::string& default_text = LLStringUtil::null, const std::string& default_text = LLStringUtil::null,
const LLFontGL* glfont = NULL, const LLFontGL* glfont = NULL,
S32 max_length_bytes = 254, S32 max_length_bytes = 254,
void (*commit_callback)(LLUICtrl* caller, void* user_data) = NULL, commit_callback_t commit_callback = NULL,
void (*keystroke_callback)(LLLineEditor* caller, void* user_data) = NULL, keystroke_callback_t keystroke_callback = NULL,
void (*focus_lost_callback)(LLFocusableElement* caller, void* user_data) = NULL, focus_lost_callback_t focus_lost_callback = NULL,
void* userdata = NULL, validate_func_t prevalidate_func = NULL,
LLLinePrevalidateFunc prevalidate_func = NULL,
LLViewBorder::EBevel border_bevel = LLViewBorder::BEVEL_IN, LLViewBorder::EBevel border_bevel = LLViewBorder::BEVEL_IN,
LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE, LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE,
S32 border_thickness = 1); S32 border_thickness = 1);
@@ -230,13 +230,14 @@ public:
void setSelectAllonFocusReceived(BOOL b); void setSelectAllonFocusReceived(BOOL b);
void setSelectAllonCommit(BOOL b) { mSelectAllonCommit = b; } void setSelectAllonCommit(BOOL b) { mSelectAllonCommit = b; }
void setKeystrokeCallback(void (*keystroke_callback)(LLLineEditor* caller, void* user_data)); void onKeystroke();
void setKeystrokeCallback(keystroke_callback_t callback);
void setMaxTextLength(S32 max_text_length); void setMaxTextLength(S32 max_text_length);
void setTextPadding(S32 left, S32 right); // Used to specify room for children before or after text. void setTextPadding(S32 left, S32 right); // Used to specify room for children before or after text.
// Prevalidation controls which keystrokes can affect the editor // Prevalidation controls which keystrokes can affect the editor
void setPrevalidate( BOOL (*func)(const LLWString &) ); void setPrevalidate( validate_func_t func );
static BOOL prevalidateFloat(const LLWString &str ); static BOOL prevalidateFloat(const LLWString &str );
static BOOL prevalidateInt(const LLWString &str ); static BOOL prevalidateInt(const LLWString &str );
static BOOL prevalidatePositiveS32(const LLWString &str); static BOOL prevalidatePositiveS32(const LLWString &str);
@@ -323,7 +324,7 @@ protected:
BOOL mCommitOnFocusLost; BOOL mCommitOnFocusLost;
BOOL mRevertOnEsc; BOOL mRevertOnEsc;
void (*mKeystrokeCallback)( LLLineEditor* caller, void* userdata ); keystroke_callback_t mKeystrokeCallback;
BOOL mIsSelecting; // Selection for clipboard operations BOOL mIsSelecting; // Selection for clipboard operations
S32 mSelectionStart; S32 mSelectionStart;
@@ -333,8 +334,7 @@ protected:
S32 mLastSelectionStart; S32 mLastSelectionStart;
S32 mLastSelectionEnd; S32 mLastSelectionEnd;
S32 (*mPrevalidateFunc)(const LLWString &str); validate_func_t mPrevalidateFunc;
LLFrameTimer mKeystrokeTimer; LLFrameTimer mKeystrokeTimer;
LLColor4 mCursorColor; LLColor4 mCursorColor;
@@ -418,46 +418,4 @@ private:
/*
* @brief A line editor with a button to clear it and a callback to call on every edit event.
*/
class LLSearchEditor : public LLUICtrl
{
public:
LLSearchEditor(const std::string& name,
const LLRect& rect,
S32 max_length_bytes,
void (*search_callback)(const std::string& search_string, void* user_data),
void* userdata);
virtual ~LLSearchEditor() {}
/*virtual*/ void draw();
virtual LLXMLNodePtr getXML(bool save_children = true) const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
void setText(const LLStringExplicit &new_text) { mSearchEdit->setText(new_text); }
typedef boost::function<void (const std::string&, void *)> search_callback_t;
void setSearchCallback(search_callback_t cb,void *user_data) { mSearchCallback = boost::bind(cb,_1,user_data); }
// LLUICtrl interface
virtual void setValue(const LLSD& value );
virtual LLSD getValue() const;
virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text );
virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text );
virtual void clear();
private:
static void onSearchEdit(LLLineEditor* caller, void* user_data );
static void onClearSearch(void* user_data);
LLLineEditor* mSearchEdit;
class LLButton* mClearSearchButton;
search_callback_t mSearchCallback;
};
#endif // LL_LINEEDITOR_ #endif // LL_LINEEDITOR_

View File

@@ -136,7 +136,7 @@ const F32 ACTIVATE_HIGHLIGHT_TIME = 0.3f;
// Default constructor // Default constructor
LLMenuItemGL::LLMenuItemGL( const std::string& name, const std::string& label, KEY key, MASK mask ) : LLMenuItemGL::LLMenuItemGL( const std::string& name, const std::string& label, KEY key, MASK mask ) :
LLUICtrl( name, LLRect(), TRUE, NULL, NULL ), LLUICtrl( name ),
mJumpKey(KEY_NONE), mJumpKey(KEY_NONE),
mAllowKeyRepeat(FALSE), mAllowKeyRepeat(FALSE),
mHighlight( FALSE ), mHighlight( FALSE ),
@@ -268,19 +268,6 @@ BOOL LLMenuItemGL::addToAcceleratorList(std::list <LLKeyBinding*> *listp)
accelerator = *list_it; accelerator = *list_it;
if ((accelerator->mKey == mAcceleratorKey) && (accelerator->mMask == (mAcceleratorMask & MASK_NORMALKEYS))) if ((accelerator->mKey == mAcceleratorKey) && (accelerator->mMask == (mAcceleratorMask & MASK_NORMALKEYS)))
{ {
// *NOTE: get calling code to throw up warning or route
// warning messages back to app-provided output
// std::string warning;
// warning.append("Duplicate key binding <");
// appendAcceleratorString( warning );
// warning.append("> for menu items:\n ");
// warning.append(accelerator->mName);
// warning.append("\n ");
// warning.append(mLabel);
// llwarns << warning << llendl;
// LLAlertDialog::modalAlert(warning);
return FALSE; return FALSE;
} }
} }
@@ -1826,7 +1813,7 @@ static LLRegisterWidget<LLMenuGL> r1("menu");
// Default constructor // Default constructor
LLMenuGL::LLMenuGL( const std::string& name, const std::string& label ) LLMenuGL::LLMenuGL( const std::string& name, const std::string& label )
: LLUICtrl( name, LLRect(), FALSE, NULL, NULL ), : LLUICtrl( name, LLRect(), FALSE),
mBackgroundColor( sDefaultBackgroundColor ), mBackgroundColor( sDefaultBackgroundColor ),
mBgVisible( TRUE ), mBgVisible( TRUE ),
mHasSelection( FALSE ), mHasSelection( FALSE ),
@@ -1852,7 +1839,7 @@ LLMenuGL::LLMenuGL( const std::string& name, const std::string& label )
} }
LLMenuGL::LLMenuGL( const std::string& label) LLMenuGL::LLMenuGL( const std::string& label)
: LLUICtrl( label, LLRect(), FALSE, NULL, NULL ), : LLUICtrl( label, LLRect(), FALSE),
mBackgroundColor( sDefaultBackgroundColor ), mBackgroundColor( sDefaultBackgroundColor ),
mBgVisible( TRUE ), mBgVisible( TRUE ),
mHasSelection( FALSE ), mHasSelection( FALSE ),

View File

@@ -57,8 +57,7 @@ S32 LLMultiSlider::mNameCounter = 0;
LLMultiSlider::LLMultiSlider( LLMultiSlider::LLMultiSlider(
const std::string& name, const std::string& name,
const LLRect& rect, const LLRect& rect,
void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), commit_callback_t commit_callback,
void* callback_userdata,
F32 initial_value, F32 initial_value,
F32 min_value, F32 min_value,
F32 max_value, F32 max_value,
@@ -69,8 +68,7 @@ LLMultiSlider::LLMultiSlider(
BOOL use_triangle, BOOL use_triangle,
const std::string& control_name) const std::string& control_name)
: :
LLUICtrl( name, rect, TRUE, on_commit_callback, callback_userdata, LLUICtrl( name, rect, TRUE, commit_callback, FOLLOWS_LEFT | FOLLOWS_TOP),
FOLLOWS_LEFT | FOLLOWS_TOP),
mInitialValue( initial_value ), mInitialValue( initial_value ),
mMinValue( min_value ), mMinValue( min_value ),
@@ -659,7 +657,6 @@ LLView* LLMultiSlider::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor
LLMultiSlider* multiSlider = new LLMultiSlider(name, LLMultiSlider* multiSlider = new LLMultiSlider(name,
rect, rect,
NULL, NULL,
NULL,
initial_value, initial_value,
min_value, min_value,
max_value, max_value,

View File

@@ -44,8 +44,7 @@ public:
LLMultiSlider( LLMultiSlider(
const std::string& name, const std::string& name,
const LLRect& rect, const LLRect& rect,
void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), commit_callback_t commit_callback,
void* callback_userdata,
F32 initial_value, F32 initial_value,
F32 min_value, F32 min_value,
F32 max_value, F32 max_value,

View File

@@ -60,14 +60,12 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const std::string& name, const LLRect& rect
S32 text_left, S32 text_left,
BOOL show_text, BOOL show_text,
BOOL can_edit_text, BOOL can_edit_text,
void (*commit_callback)(LLUICtrl*, void*),
void* callback_user_data,
F32 initial_value, F32 min_value, F32 max_value, F32 increment, F32 initial_value, F32 min_value, F32 max_value, F32 increment,
S32 max_sliders, BOOL allow_overlap, S32 max_sliders, BOOL allow_overlap,
BOOL draw_track, BOOL draw_track,
BOOL use_triangle, BOOL use_triangle,
const std::string& control_which) const std::string& control_which)
: LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data ), : LLUICtrl(name, rect, TRUE ),
mFont(font), mFont(font),
mShowText( show_text ), mShowText( show_text ),
mCanEditText( can_edit_text ), mCanEditText( can_edit_text ),
@@ -107,7 +105,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const std::string& name, const LLRect& rect
mMultiSlider = new LLMultiSlider( mMultiSlider = new LLMultiSlider(
std::string("multi_slider"), std::string("multi_slider"),
slider_rect, slider_rect,
LLMultiSliderCtrl::onSliderCommit, this, boost::bind(&LLMultiSliderCtrl::onSliderCommit,this,_2),
initial_value, min_value, max_value, increment, initial_value, min_value, max_value, increment,
max_sliders, allow_overlap, draw_track, max_sliders, allow_overlap, draw_track,
use_triangle, use_triangle,
@@ -123,8 +121,10 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const std::string& name, const LLRect& rect
mEditor = new LLLineEditor( std::string("MultiSliderCtrl Editor"), text_rect, mEditor = new LLLineEditor( std::string("MultiSliderCtrl Editor"), text_rect,
LLStringUtil::null, font, LLStringUtil::null, font,
MAX_STRING_LENGTH, MAX_STRING_LENGTH,
&LLMultiSliderCtrl::onEditorCommit, NULL, NULL, this, boost::bind(&LLMultiSliderCtrl::onEditorCommit,this,_2),
&LLLineEditor::prevalidateFloat ); NULL,
NULL,
boost::bind(&LLLineEditor::prevalidateFloat, _1) );
mEditor->setFollowsLeft(); mEditor->setFollowsLeft();
mEditor->setFollowsBottom(); mEditor->setFollowsBottom();
mEditor->setFocusReceivedCallback( boost::bind(&LLMultiSliderCtrl::onFocusReceived, this) ); mEditor->setFocusReceivedCallback( boost::bind(&LLMultiSliderCtrl::onFocusReceived, this) );
@@ -278,26 +278,24 @@ void LLMultiSliderCtrl::updateText()
} }
} }
// static void LLMultiSliderCtrl::onEditorCommit(const LLSD& value)
void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* caller, void *userdata )
{ {
LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata; llassert( caller == mEditor );
llassert( caller == self->mEditor );
BOOL success = FALSE; BOOL success = FALSE;
F32 val = self->mCurValue; F32 val = mCurValue;
F32 saved_val = self->mCurValue; F32 saved_val = mCurValue;
std::string text = self->mEditor->getText(); std::string text = value.asString();
if( LLLineEditor::postvalidateFloat( text ) ) if( LLLineEditor::postvalidateFloat( text ) )
{ {
LLLocale locale(LLLocale::USER_LOCALE); LLLocale locale(LLLocale::USER_LOCALE);
val = (F32) atof( text.c_str() ); val = (F32) atof( text.c_str() );
if( self->mMultiSlider->getMinValue() <= val && val <= self->mMultiSlider->getMaxValue() ) if( mMultiSlider->getMinValue() <= val && val <= mMultiSlider->getMaxValue() )
{ {
self->setCurSliderValue( val ); setCurSliderValue( val );
if( (!self->mValidateCallback || self->mValidateCallback( self, self->mCallbackUserData )) && if( (!mValidateCallback || mValidateCallback( this, mCallbackUserData )) &&
(!self->mValidateSignal || (*(self->mValidateSignal))(self, val))) (!mValidateSignal || (*(mValidateSignal))(this, val)))
{ {
success = TRUE; success = TRUE;
} }
@@ -306,49 +304,45 @@ void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* caller, void *userdata )
if( success ) if( success )
{ {
self->onCommit(); onCommit();
} }
else else
{ {
if( self->getCurSliderValue() != saved_val ) if( getCurSliderValue() != saved_val )
{ {
self->setCurSliderValue( saved_val ); setCurSliderValue( saved_val );
} }
self->reportInvalidData(); reportInvalidData();
} }
self->updateText(); updateText();
} }
// static void LLMultiSliderCtrl::onSliderCommit(const LLSD& value)
void LLMultiSliderCtrl::onSliderCommit( LLUICtrl* caller, void *userdata )
{ {
LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
//llassert( caller == self->mSlider );
BOOL success = FALSE; BOOL success = FALSE;
F32 saved_val = self->mCurValue; F32 saved_val = mCurValue;
F32 new_val = self->mMultiSlider->getCurSliderValue(); F32 new_val = mMultiSlider->getCurSliderValue();
self->mCurValue = new_val; // set the value temporarily so that the callback can retrieve it. mCurValue = new_val; // set the value temporarily so that the callback can retrieve it.
if( (!self->mValidateCallback || self->mValidateCallback( self, self->mCallbackUserData )) && if( (!mValidateCallback || mValidateCallback( this, mCallbackUserData )) &&
(!self->mValidateSignal || (*(self->mValidateSignal))(self, new_val ))) (!mValidateSignal || (*mValidateSignal)(this, new_val ) ))
{ {
success = TRUE; success = TRUE;
} }
if( success ) if( success )
{ {
self->onCommit(); onCommit();
} }
else else
{ {
if( self->mCurValue != saved_val ) if( mCurValue != saved_val )
{ {
self->setCurSliderValue( saved_val ); setCurSliderValue( saved_val );
} }
self->reportInvalidData(); reportInvalidData();
} }
self->updateText(); updateText();
} }
void LLMultiSliderCtrl::setEnabled(BOOL b) void LLMultiSliderCtrl::setEnabled(BOOL b)
@@ -561,8 +555,6 @@ LLView* LLMultiSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFa
} }
} }
LLUICtrlCallback callback = NULL;
if (label.empty()) if (label.empty())
{ {
label.assign(node->getTextContents()); label.assign(node->getTextContents());
@@ -576,8 +568,6 @@ LLView* LLMultiSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFa
rect.getWidth() - text_left, rect.getWidth() - text_left,
show_text, show_text,
can_edit_text, can_edit_text,
callback,
NULL,
initial_value, initial_value,
min_value, min_value,
max_value, max_value,

View File

@@ -64,8 +64,6 @@ public:
S32 text_left, S32 text_left,
BOOL show_text, BOOL show_text,
BOOL can_edit_text, BOOL can_edit_text,
void (*commit_callback)(LLUICtrl*, void*),
void* callback_userdata,
F32 initial_value, F32 min_value, F32 max_value, F32 increment, F32 initial_value, F32 min_value, F32 max_value, F32 increment,
S32 max_sliders, BOOL allow_overlap, BOOL draw_track, S32 max_sliders, BOOL allow_overlap, BOOL draw_track,
BOOL use_triangle, BOOL use_triangle,
@@ -123,10 +121,9 @@ public:
virtual void setControlName(const std::string& control_name, LLView* context); virtual void setControlName(const std::string& control_name, LLView* context);
virtual std::string getControlName() const; virtual std::string getControlName() const;
static void onSliderCommit(LLUICtrl* caller, void* userdata); void onSliderCommit(const LLSD& value);
static void onEditorCommit(LLUICtrl* ctrl, void* userdata); void onEditorCommit(const LLSD& value);
static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata);
private: private:
void updateText(); void updateText();

View File

@@ -880,6 +880,7 @@ bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPt
assert(!wasFound); assert(!wasFound);
if (passesFilter) if (passesFilter)
{ {
llinfos << "Inserting " << pNotification->getName() << llendl;
// not in our list, add it and say so // not in our list, add it and say so
mItems.insert(pNotification); mItems.insert(pNotification);
abortProcessing = mChanged(payload); abortProcessing = mChanged(payload);

View File

@@ -36,7 +36,6 @@
#include "llpanel.h" #include "llpanel.h"
#include "llalertdialog.h"
#include "llfocusmgr.h" #include "llfocusmgr.h"
#include "llfontgl.h" #include "llfontgl.h"
#include "lllocalcliprect.h" #include "lllocalcliprect.h"
@@ -92,7 +91,7 @@ LLPanel::LLPanel()
} }
LLPanel::LLPanel(const std::string& name) LLPanel::LLPanel(const std::string& name)
: LLUICtrl(name, LLRect(0, 0, 0, 0), TRUE, NULL, NULL), : LLUICtrl(name),
mRectControl() mRectControl()
{ {
init(); init();
@@ -100,7 +99,7 @@ LLPanel::LLPanel(const std::string& name)
LLPanel::LLPanel(const std::string& name, const LLRect& rect, BOOL bordered) LLPanel::LLPanel(const std::string& name, const LLRect& rect, BOOL bordered)
: LLUICtrl(name, rect, TRUE, NULL, NULL), : LLUICtrl(name,rect),
mRectControl() mRectControl()
{ {
init(); init();
@@ -112,7 +111,7 @@ LLPanel::LLPanel(const std::string& name, const LLRect& rect, BOOL bordered)
LLPanel::LLPanel(const std::string& name, const std::string& rect_control, BOOL bordered) LLPanel::LLPanel(const std::string& name, const std::string& rect_control, BOOL bordered)
: LLUICtrl(name, LLUI::sConfigGroup->getRect(rect_control), TRUE, NULL, NULL), : LLUICtrl(name, LLUI::sConfigGroup->getRect(rect_control)),
mRectControl( rect_control ) mRectControl( rect_control )
{ {
init(); init();
@@ -186,19 +185,14 @@ void LLPanel::draw()
// draw background // draw background
if( mBgVisible ) if( mBgVisible )
{ {
//RN: I don't see the point of this LLRect local_rect = getLocalRect();
S32 left = 0;//LLPANEL_BORDER_WIDTH;
S32 top = getRect().getHeight();// - LLPANEL_BORDER_WIDTH;
S32 right = getRect().getWidth();// - LLPANEL_BORDER_WIDTH;
S32 bottom = 0;//LLPANEL_BORDER_WIDTH;
if (mBgOpaque ) if (mBgOpaque )
{ {
gl_rect_2d( left, top, right, bottom, mBgColorOpaque ); gl_rect_2d( local_rect, mBgColorOpaque );
} }
else else
{ {
gl_rect_2d( left, top, right, bottom, mBgColorAlpha ); gl_rect_2d( local_rect, mBgColorAlpha );
} }
} }
@@ -611,6 +605,11 @@ void LLPanel::setPanelParameters(LLXMLNodePtr node, LLView* parent)
setLabel(label); setLabel(label);
} }
bool LLPanel::hasString(const std::string& name)
{
return mUIStrings.find(name) != mUIStrings.end();
}
std::string LLPanel::getString(const std::string& name, const LLStringUtil::format_map_t& args) const std::string LLPanel::getString(const std::string& name, const LLStringUtil::format_map_t& args) const
{ {
ui_string_map_t::const_iterator found_it = mUIStrings.find(name); ui_string_map_t::const_iterator found_it = mUIStrings.find(name);
@@ -916,29 +915,6 @@ LLPanel *LLPanel::childGetVisibleTab(const std::string& id) const
} }
return NULL; return NULL;
} }
void LLPanel::childSetKeystrokeCallback(const std::string& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data)
{
LLLineEditor* child = getChild<LLLineEditor>(id);
if (child)
{
child->setKeystrokeCallback(keystroke_callback);
if (user_data)
{
child->setCallbackUserData(user_data);
}
}
}
void LLPanel::childSetPrevalidate(const std::string& id, BOOL (*func)(const LLWString &) )
{
LLLineEditor* child = getChild<LLLineEditor>(id);
if (child)
{
child->setPrevalidate(func);
}
}
void LLPanel::childSetWrappedText(const std::string& id, const std::string& text, bool visible) void LLPanel::childSetWrappedText(const std::string& id, const std::string& text, bool visible)
{ {
LLTextBox* child = getChild<LLTextBox>(id); LLTextBox* child = getChild<LLTextBox>(id);
@@ -949,14 +925,7 @@ void LLPanel::childSetWrappedText(const std::string& id, const std::string& text
} }
} }
void LLPanel::childSetAction(const std::string& id, boost::function<void(void*)> function, void* value)
{
LLButton* button = getChild<LLButton>(id);
if (button)
{
button->setClickedCallback(function, value);
}
}
void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_type& function) void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_type& function)
{ {
@@ -967,12 +936,21 @@ void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_
} }
} }
void LLPanel::childSetActionTextbox(const std::string& id, void(*function)(void*), void* value) void LLPanel::childSetAction(const std::string& id, boost::function<void(void*)> function, void* value)
{
LLButton* button = getChild<LLButton>(id);
if (button)
{
button->setClickedCallback(boost::bind(function, value));
}
}
void LLPanel::childSetActionTextbox(const std::string& id, boost::function<void(void*)> function, void* value)
{ {
LLTextBox* textbox = getChild<LLTextBox>(id); LLTextBox* textbox = getChild<LLTextBox>(id);
if (textbox) if (textbox)
{ {
textbox->setClickedCallback(function, value); textbox->setClickedCallback(boost::bind(function, value));
} }
} }

View File

@@ -144,6 +144,7 @@ public:
void initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory); void initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory);
void setPanelParameters(LLXMLNodePtr node, LLView *parentp); void setPanelParameters(LLXMLNodePtr node, LLView *parentp);
bool hasString(const std::string& name);
std::string getString(const std::string& name, const LLStringUtil::format_map_t& args) const; std::string getString(const std::string& name, const LLStringUtil::format_map_t& args) const;
std::string getString(const std::string& name) const; std::string getString(const std::string& name) const;
@@ -205,14 +206,13 @@ public:
void childSetText(const std::string& id, const LLStringExplicit& text) { childSetValue(id, LLSD(text)); } void childSetText(const std::string& id, const LLStringExplicit& text) { childSetValue(id, LLSD(text)); }
std::string childGetText(const std::string& id) const { return childGetValue(id).asString(); } std::string childGetText(const std::string& id) const { return childGetValue(id).asString(); }
// LLLineEditor
void childSetKeystrokeCallback(const std::string& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data);
void childSetPrevalidate(const std::string& id, BOOL (*func)(const LLWString &) );
// LLButton // LLButton
void childSetAction(const std::string& id, boost::function<void(void*)> function, void* value); void childSetAction(const std::string& id, boost::function<void(void*)> function, void* value);
void childSetAction(const std::string& id, const commit_signal_t::slot_type& function); void childSetAction(const std::string& id, const commit_signal_t::slot_type& function);
void childSetActionTextbox(const std::string& id, void(*function)(void*), void* value = NULL);
// LLTextBox
void childSetActionTextbox(const std::string& id, boost::function<void(void*)> function, void* value = NULL);
void childSetControlName(const std::string& id, const std::string& control_name); void childSetControlName(const std::string& id, const std::string& control_name);
// Error reporting // Error reporting

View File

@@ -47,19 +47,9 @@
static LLRegisterWidget<LLRadioGroup> r("radio_group"); static LLRegisterWidget<LLRadioGroup> r("radio_group");
LLRadioGroup::LLRadioGroup(const std::string& name, const LLRect& rect, LLRadioGroup::LLRadioGroup(const std::string& name, const LLRect& rect,
const std::string& control_name, LLUICtrlCallback callback, S32 initial_index, commit_callback_t commit_callback,
void* userdata, BOOL border) : BOOL border) :
LLUICtrl(name, rect, TRUE, callback, userdata, FOLLOWS_LEFT | FOLLOWS_TOP), LLUICtrl(name, rect, TRUE, commit_callback, FOLLOWS_LEFT | FOLLOWS_TOP),
mSelectedIndex(0)
{
setControlName(control_name, NULL);
init(border);
}
LLRadioGroup::LLRadioGroup(const std::string& name, const LLRect& rect,
S32 initial_index, LLUICtrlCallback callback,
void* userdata, BOOL border) :
LLUICtrl(name, rect, TRUE, callback, userdata, FOLLOWS_LEFT | FOLLOWS_TOP),
mSelectedIndex(initial_index) mSelectedIndex(initial_index)
{ {
init(border); init(border);
@@ -251,7 +241,7 @@ void LLRadioGroup::draw()
LLRadioCtrl* LLRadioGroup::addRadioButton(const std::string& name, const std::string& label, const LLRect& rect, const LLFontGL* font ) LLRadioCtrl* LLRadioGroup::addRadioButton(const std::string& name, const std::string& label, const LLRect& rect, const LLFontGL* font )
{ {
// Highlight will get fixed in draw method above // Highlight will get fixed in draw method above
LLRadioCtrl* radio = new LLRadioCtrl(name, rect, label, font, onClickButton, this); LLRadioCtrl* radio = new LLRadioCtrl(name, rect, label, font, boost::bind(&LLRadioGroup::onClickButton, this, _1));
addChild(radio); addChild(radio);
mRadioButtons.push_back(radio); mRadioButtons.push_back(radio);
return radio; return radio;
@@ -260,32 +250,30 @@ LLRadioCtrl* LLRadioGroup::addRadioButton(const std::string& name, const std::st
// Handle one button being clicked. All child buttons must have this // Handle one button being clicked. All child buttons must have this
// function as their callback function. // function as their callback function.
// static void LLRadioGroup::onClickButton(LLUICtrl* ctrl)
void LLRadioGroup::onClickButton(LLUICtrl* ui_ctrl, void* userdata)
{ {
// llinfos << "LLRadioGroup::onClickButton" << llendl; // llinfos << "LLRadioGroup::onClickButton" << llendl;
LLRadioCtrl* clicked_radio = dynamic_cast<LLRadioCtrl*>(ctrl);
LLRadioCtrl* clickedRadio = (LLRadioCtrl*) ui_ctrl; if (!clicked_radio)
LLRadioGroup* self = (LLRadioGroup*) userdata; return;
S32 index = 0;
S32 counter = 0; for (button_list_t::iterator iter = mRadioButtons.begin();
for (button_list_t::iterator iter = self->mRadioButtons.begin(); iter != mRadioButtons.end(); ++iter)
iter != self->mRadioButtons.end(); ++iter)
{ {
LLRadioCtrl* radio = *iter; LLRadioCtrl* radio = *iter;
if (radio == clickedRadio) if (radio == clicked_radio)
{ {
// llinfos << "clicked button " << counter << llendl; // llinfos << "clicked button " << counter << llendl;
self->setSelectedIndex(counter); setSelectedIndex(index);
self->setControlValue(counter); setControlValue(index);
// BUG: Calls click callback even if button didn't actually change // BUG: Calls click callback even if button didn't actually change
self->onCommit(); onCommit();
return; return;
} }
counter++; index++;
} }
llwarns << "LLRadioGroup::onClickButton - clicked button that isn't a child" << llendl; llwarns << "LLRadioGroup::onClickButton - clicked button that isn't a child" << llendl;
@@ -380,7 +368,6 @@ LLView* LLRadioGroup::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
rect, rect,
initial_value, initial_value,
NULL, NULL,
NULL,
draw_border); draw_border);
const std::string& contents = node->getValue(); const std::string& contents = node->getValue();

View File

@@ -45,8 +45,8 @@ class LLRadioCtrl : public LLCheckBoxCtrl
{ {
public: public:
LLRadioCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLFontGL* font = NULL, LLRadioCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLFontGL* font = NULL,
void (*commit_callback)(LLUICtrl*, void*) = NULL, void* callback_userdata = NULL) : commit_callback_t commit_callback = NULL) :
LLCheckBoxCtrl(name, rect, label, font, commit_callback, callback_userdata, FALSE, RADIO_STYLE) LLCheckBoxCtrl(name, rect, label, font, commit_callback, FALSE, RADIO_STYLE)
{ {
setTabStop(FALSE); setTabStop(FALSE);
} }
@@ -66,21 +66,11 @@ class LLRadioGroup
: public LLUICtrl, public LLCtrlSelectionInterface : public LLUICtrl, public LLCtrlSelectionInterface
{ {
public: public:
// Build a radio group. The number (0...n-1) of the currently selected // Radio group constructor. Doesn't rely on
// element will be stored in the named control. After the control is
// changed the callback will be called.
LLRadioGroup(const std::string& name, const LLRect& rect,
const std::string& control_name,
LLUICtrlCallback callback = NULL,
void* userdata = NULL,
BOOL border = TRUE);
// Another radio group constructor, but this one doesn't rely on
// needing a control // needing a control
LLRadioGroup(const std::string& name, const LLRect& rect, LLRadioGroup(const std::string& name, const LLRect& rect,
S32 initial_index, S32 initial_index,
LLUICtrlCallback callback = NULL, commit_callback_t commit_callback,
void* userdata = NULL,
BOOL border = TRUE); BOOL border = TRUE);
virtual ~LLRadioGroup(); virtual ~LLRadioGroup();
@@ -111,7 +101,7 @@ public:
LLRadioCtrl* addRadioButton(const std::string& name, const std::string& label, const LLRect& rect, const LLFontGL* font); LLRadioCtrl* addRadioButton(const std::string& name, const std::string& label, const LLRect& rect, const LLFontGL* font);
LLRadioCtrl* getRadioButton(const S32& index) { return mRadioButtons[index]; } LLRadioCtrl* getRadioButton(const S32& index) { return mRadioButtons[index]; }
// Update the control as needed. Userdata must be a pointer to the button. // Update the control as needed. Userdata must be a pointer to the button.
static void onClickButton(LLUICtrl* radio, void* userdata); void onClickButton(LLUICtrl* clicked_radio);
//======================================================================== //========================================================================
LLCtrlSelectionInterface* getSelectionInterface() { return (LLCtrlSelectionInterface*)this; }; LLCtrlSelectionInterface* getSelectionInterface() { return (LLCtrlSelectionInterface*)this; };

View File

@@ -51,13 +51,11 @@ LLScrollbar::LLScrollbar(
const std::string& name, LLRect rect, const std::string& name, LLRect rect,
LLScrollbar::ORIENTATION orientation, LLScrollbar::ORIENTATION orientation,
S32 doc_size, S32 doc_pos, S32 page_size, S32 doc_size, S32 doc_pos, S32 page_size,
void (*change_callback)( S32 new_pos, LLScrollbar* self, void* userdata ), callback_t change_callback,
void* callback_user_data,
S32 step_size) S32 step_size)
: LLUICtrl( name, rect, TRUE, NULL, NULL ), : LLUICtrl( name, rect ),
mChangeCallback( change_callback ), mChangeCallback( change_callback ),
mCallbackUserData( callback_user_data ),
mOrientation( orientation ), mOrientation( orientation ),
mDocSize( doc_size ), mDocSize( doc_size ),
mDocPos( doc_pos ), mDocPos( doc_pos ),
@@ -115,7 +113,7 @@ LLScrollbar::LLScrollbar(
LLButton* line_up_btn = new LLButton(std::string("Line Up"), line_up_rect, LLButton* line_up_btn = new LLButton(std::string("Line Up"), line_up_rect,
line_up_img, line_up_selected_img, LLStringUtil::null, line_up_img, line_up_selected_img, LLStringUtil::null,
&LLScrollbar::onLineUpBtnPressed, this, LLFontGL::getFontSansSerif() ); boost::bind(&LLScrollbar::onLineUpBtnPressed, this, _2), LLFontGL::getFontSansSerif() );
if( LLScrollbar::VERTICAL == mOrientation ) if( LLScrollbar::VERTICAL == mOrientation )
{ {
line_up_btn->setFollowsRight(); line_up_btn->setFollowsRight();
@@ -127,7 +125,7 @@ LLScrollbar::LLScrollbar(
line_up_btn->setFollowsLeft(); line_up_btn->setFollowsLeft();
line_up_btn->setFollowsBottom(); line_up_btn->setFollowsBottom();
} }
line_up_btn->setHeldDownCallback( boost::bind(&LLScrollbar::onLineUpBtnPressed, (void*)this) ); line_up_btn->setHeldDownCallback( boost::bind(&LLScrollbar::onLineUpBtnPressed, this, _2) );
line_up_btn->setTabStop(FALSE); line_up_btn->setTabStop(FALSE);
line_up_btn->setScaleImage(TRUE); line_up_btn->setScaleImage(TRUE);
@@ -135,10 +133,10 @@ LLScrollbar::LLScrollbar(
LLButton* line_down_btn = new LLButton(std::string("Line Down"), line_down_rect, LLButton* line_down_btn = new LLButton(std::string("Line Down"), line_down_rect,
line_down_img, line_down_selected_img, LLStringUtil::null, line_down_img, line_down_selected_img, LLStringUtil::null,
&LLScrollbar::onLineDownBtnPressed, this, LLFontGL::getFontSansSerif() ); boost::bind(&LLScrollbar::onLineDownBtnPressed, this, _2), LLFontGL::getFontSansSerif() );
line_down_btn->setFollowsRight(); line_down_btn->setFollowsRight();
line_down_btn->setFollowsBottom(); line_down_btn->setFollowsBottom();
line_down_btn->setHeldDownCallback( boost::bind(&LLScrollbar::onLineDownBtnPressed, this) ); line_down_btn->setHeldDownCallback( boost::bind(&LLScrollbar::onLineDownBtnPressed, this, _2) );
line_down_btn->setTabStop(FALSE); line_down_btn->setTabStop(FALSE);
line_down_btn->setScaleImage(TRUE); line_down_btn->setScaleImage(TRUE);
addChild(line_down_btn); addChild(line_down_btn);
@@ -170,7 +168,7 @@ bool LLScrollbar::setDocPos(S32 pos, BOOL update_thumb)
if( mChangeCallback ) if( mChangeCallback )
{ {
mChangeCallback( mDocPos, this, mCallbackUserData ); mChangeCallback( mDocPos, this );
} }
if( update_thumb ) if( update_thumb )
@@ -629,19 +627,12 @@ void LLScrollbar::pageDown(S32 overlap)
} }
} }
// static void LLScrollbar::onLineUpBtnPressed( const LLSD& data )
void LLScrollbar::onLineUpBtnPressed( void* userdata )
{ {
LLScrollbar* self = (LLScrollbar*) userdata; changeLine( -mStepSize, TRUE );
self->changeLine( - self->mStepSize, TRUE );
} }
// static void LLScrollbar::onLineDownBtnPressed( const LLSD& data )
void LLScrollbar::onLineDownBtnPressed( void* userdata )
{ {
LLScrollbar* self = (LLScrollbar*) userdata; changeLine( mStepSize, TRUE );
self->changeLine( self->mStepSize, TRUE );
} }

View File

@@ -52,11 +52,11 @@ class LLScrollbar
public: public:
enum ORIENTATION { HORIZONTAL, VERTICAL }; enum ORIENTATION { HORIZONTAL, VERTICAL };
typedef boost::function<void (S32, LLScrollbar*)> callback_t;
LLScrollbar(const std::string& name, LLRect rect, LLScrollbar(const std::string& name, LLRect rect,
ORIENTATION orientation, ORIENTATION orientation,
S32 doc_size, S32 doc_pos, S32 page_size, S32 doc_size, S32 doc_pos, S32 page_size,
void(*change_callback)( S32 new_pos, LLScrollbar* self, void* userdata ), callback_t change_callback,
void* callback_user_data = NULL,
S32 step_size = 1); S32 step_size = 1);
virtual ~LLScrollbar(); virtual ~LLScrollbar();
@@ -101,8 +101,8 @@ public:
void pageUp(S32 overlap); void pageUp(S32 overlap);
void pageDown(S32 overlap); void pageDown(S32 overlap);
static void onLineUpBtnPressed(void* userdata); void onLineUpBtnPressed(const LLSD& data);
static void onLineDownBtnPressed(void* userdata); void onLineDownBtnPressed(const LLSD& data);
void setTrackColor( const LLColor4& color ) { mTrackColor = color; } void setTrackColor( const LLColor4& color ) { mTrackColor = color; }
void setThumbColor( const LLColor4& color ) { mThumbColor = color; } void setThumbColor( const LLColor4& color ) { mThumbColor = color; }
@@ -115,8 +115,7 @@ private:
void updateThumbRect(); void updateThumbRect();
bool changeLine(S32 delta, BOOL update_thumb ); bool changeLine(S32 delta, BOOL update_thumb );
void (*mChangeCallback)( S32 new_pos, LLScrollbar* self, void* userdata ); callback_t mChangeCallback;
void* mCallbackUserData;
const ORIENTATION mOrientation; const ORIENTATION mOrientation;
S32 mDocSize; // Size of the document that the scrollbar is modeling. Units depend on the user. 0 <= mDocSize. S32 mDocSize; // Size of the document that the scrollbar is modeling. Units depend on the user. 0 <= mDocSize.

View File

@@ -68,7 +68,7 @@ LLScrollableContainerView::LLScrollableContainerView( const std::string& name,
LLView* scrolled_view, LLView* scrolled_view,
BOOL is_opaque, BOOL is_opaque,
const LLColor4& bg_color ) : const LLColor4& bg_color ) :
LLUICtrl( name, rect, FALSE, NULL, NULL ), LLUICtrl( name, rect, FALSE ),
mAutoScrolling( FALSE ), mAutoScrolling( FALSE ),
mAutoScrollRate( 0.f ), mAutoScrollRate( 0.f ),
mBackgroundColor( bg_color ), mBackgroundColor( bg_color ),
@@ -101,7 +101,7 @@ LLScrollableContainerView::LLScrollableContainerView( const std::string& name,
mInnerRect.getHeight(), mInnerRect.getHeight(),
0, 0,
mInnerRect.getHeight(), mInnerRect.getHeight(),
NULL, this, NULL,
VERTICAL_MULTIPLE); VERTICAL_MULTIPLE);
LLView::addChild( mScrollbar[VERTICAL] ); LLView::addChild( mScrollbar[VERTICAL] );
mScrollbar[VERTICAL]->setVisible( FALSE ); mScrollbar[VERTICAL]->setVisible( FALSE );
@@ -117,7 +117,7 @@ LLScrollableContainerView::LLScrollableContainerView( const std::string& name,
mInnerRect.getWidth(), mInnerRect.getWidth(),
0, 0,
mInnerRect.getWidth(), mInnerRect.getWidth(),
NULL, this, NULL,
HORIZONTAL_MULTIPLE); HORIZONTAL_MULTIPLE);
LLView::addChild( mScrollbar[HORIZONTAL] ); LLView::addChild( mScrollbar[HORIZONTAL] );
mScrollbar[HORIZONTAL]->setVisible( FALSE ); mScrollbar[HORIZONTAL]->setVisible( FALSE );

View File

@@ -57,7 +57,7 @@ class LLScrollingPanelList : public LLUICtrl
{ {
public: public:
LLScrollingPanelList(const std::string& name, const LLRect& rect) LLScrollingPanelList(const std::string& name, const LLRect& rect)
: LLUICtrl(name, rect, TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_BOTTOM ) {} : LLUICtrl(name, rect, TRUE, NULL, FOLLOWS_LEFT | FOLLOWS_BOTTOM ) {}
typedef std::deque<LLScrollingPanel*> panel_list_t; typedef std::deque<LLScrollingPanel*> panel_list_t;

View File

@@ -662,13 +662,12 @@ public:
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
LLScrollListCtrl::LLScrollListCtrl(const std::string& name, const LLRect& rect, LLScrollListCtrl::LLScrollListCtrl(const std::string& name, const LLRect& rect,
void (*commit_callback)(LLUICtrl* ctrl, void* userdata), commit_callback_t commit_callback,
void* callback_user_data,
BOOL allow_multiple_selection, BOOL allow_multiple_selection,
BOOL show_border, BOOL show_border,
bool draw_heading bool draw_heading
) )
: LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data), : LLUICtrl(name, rect, TRUE, commit_callback),
mLineHeight(0), mLineHeight(0),
mScrollLines(0), mScrollLines(0),
mMouseWheelOpaque(true), mMouseWheelOpaque(true),
@@ -735,7 +734,7 @@ LLScrollListCtrl::LLScrollListCtrl(const std::string& name, const LLRect& rect,
getItemCount(), getItemCount(),
mScrollLines, mScrollLines,
getLinesPerPage(), getLinesPerPage(),
&LLScrollListCtrl::onScrollChange, this ); boost::bind(&LLScrollListCtrl::onScrollChange, this, _1, _2) );
mScrollbar->setFollowsRight(); mScrollbar->setFollowsRight();
mScrollbar->setFollowsTop(); mScrollbar->setFollowsTop();
mScrollbar->setFollowsBottom(); mScrollbar->setFollowsBottom();
@@ -2853,11 +2852,9 @@ S32 LLScrollListCtrl::getLinesPerPage()
} }
// Called by scrollbar // Called by scrollbar
//static void LLScrollListCtrl::onScrollChange( S32 new_pos, LLScrollbar* scrollbar )
void LLScrollListCtrl::onScrollChange( S32 new_pos, LLScrollbar* scrollbar, void* userdata )
{ {
LLScrollListCtrl* self = (LLScrollListCtrl*) userdata; mScrollLines = new_pos;
self->mScrollLines = new_pos;
} }
@@ -2932,7 +2929,7 @@ void LLScrollListCtrl::setScrollPos( S32 pos )
{ {
mScrollbar->setDocPos( pos ); mScrollbar->setDocPos( pos );
onScrollChange(mScrollbar->getDocPos(), mScrollbar, this); onScrollChange(mScrollbar->getDocPos(), mScrollbar);
} }
@@ -3134,12 +3131,9 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
BOOL mouse_wheel_opaque = TRUE; BOOL mouse_wheel_opaque = TRUE;
node->getAttributeBOOL("mouse_wheel_opaque", mouse_wheel_opaque); node->getAttributeBOOL("mouse_wheel_opaque", mouse_wheel_opaque);
LLUICtrlCallback callback = NULL;
LLScrollListCtrl* scroll_list = new LLScrollListCtrl( LLScrollListCtrl* scroll_list = new LLScrollListCtrl(
name, name,
rect, rect,
callback,
NULL, NULL,
multi_select, multi_select,
draw_border, draw_border,
@@ -3868,7 +3862,7 @@ void LLScrollListCtrl::onFocusLost()
} }
LLScrollColumnHeader::LLScrollColumnHeader(const std::string& label, const LLRect &rect, LLScrollListColumn* column, const LLFontGL* fontp) : LLScrollColumnHeader::LLScrollColumnHeader(const std::string& label, const LLRect &rect, LLScrollListColumn* column, const LLFontGL* fontp) :
LLComboBox(label, rect, label, NULL, NULL), LLComboBox(label, rect, label),
mColumn(column), mColumn(column),
mOrigLabel(label), mOrigLabel(label),
mShowSortOptions(FALSE), mShowSortOptions(FALSE),

View File

@@ -390,8 +390,7 @@ public:
LLScrollListCtrl( LLScrollListCtrl(
const std::string& name, const std::string& name,
const LLRect& rect, const LLRect& rect,
void (*commit_callback)(LLUICtrl*, void*), commit_callback_t commit_callback,
void* callback_userdata,
BOOL allow_multiple_selection, BOOL allow_multiple_selection,
BOOL draw_border = TRUE, bool draw_heading = false); BOOL draw_border = TRUE, bool draw_heading = false);
@@ -594,7 +593,7 @@ public:
LLRect getCellRect(S32 row_index, S32 column_index); LLRect getCellRect(S32 row_index, S32 column_index);
// Used "internally" by the scroll bar. // Used "internally" by the scroll bar.
static void onScrollChange( S32 new_pos, LLScrollbar* src, void* userdata ); void onScrollChange( S32 new_pos, LLScrollbar* src);
static void onClickColumn(void *userdata); static void onClickColumn(void *userdata);

View File

@@ -0,0 +1,176 @@
/**
* @file llsearcheditor.cpp
* @brief LLSearchEditor implementation
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
// Text editor widget to let users enter a single line.
#include "linden_common.h"
#include "llsearcheditor.h"
static LLRegisterWidget<LLSearchEditor> r2("search_editor");
LLSearchEditor::LLSearchEditor(const std::string& name,
const LLRect& rect,
S32 max_length_bytes)
:
LLUICtrl(name, rect),
mSearchEditor(NULL),
mClearButton(NULL)
{
mSearchEditor = new LLLineEditor(std::string("filter edit box"),
getLocalRect(),
LLStringUtil::null,
NULL,
max_length_bytes,
boost::bind(&LLUICtrl::onCommit, this),
boost::bind(&LLSearchEditor::handleKeystroke, this));
mSearchEditor->setFollowsAll();
mSearchEditor->setSelectAllonFocusReceived(TRUE);
mSearchEditor->setRevertOnEsc( FALSE );
mSearchEditor->setPassDelete(TRUE);
addChild(mSearchEditor);
S32 btn_width = rect.getHeight(); // button is square, and as tall as search editor
LLRect clear_btn_rect(rect.getWidth() - btn_width, rect.getHeight(), rect.getWidth(), 0);
mClearButton = new LLButton(std::string("clear button"),
clear_btn_rect,
std::string("icn_clear_lineeditor.tga"),
std::string("UIImgBtnCloseInactiveUUID"),
LLStringUtil::null,
boost::bind(&LLSearchEditor::onClearButtonClick, this, _2));
mClearButton->setFollowsRight();
mClearButton->setFollowsTop();
mClearButton->setImageColor(LLUI::sColorsGroup->getColor("TextFgTentativeColor"));
mClearButton->setTabStop(FALSE);
mSearchEditor->addChild(mClearButton);
mSearchEditor->setTextPadding(0, btn_width);
}
//virtual
void LLSearchEditor::draw()
{
if (mClearButton)
mClearButton->setVisible(!mSearchEditor->getWText().empty());
LLUICtrl::draw();
}
//virtual
void LLSearchEditor::setValue(const LLSD& value )
{
mSearchEditor->setValue(value);
}
//virtual
LLSD LLSearchEditor::getValue() const
{
return mSearchEditor->getValue();
}
//virtual
BOOL LLSearchEditor::setTextArg( const std::string& key, const LLStringExplicit& text )
{
return mSearchEditor->setTextArg(key, text);
}
//virtual
BOOL LLSearchEditor::setLabelArg( const std::string& key, const LLStringExplicit& text )
{
return mSearchEditor->setLabelArg(key, text);
}
//virtual
void LLSearchEditor::setLabel( const LLStringExplicit &new_label )
{
mSearchEditor->setLabel(new_label);
}
//virtual
void LLSearchEditor::clear()
{
if (mSearchEditor)
{
mSearchEditor->clear();
}
}
//virtual
void LLSearchEditor::setFocus( BOOL b )
{
if (mSearchEditor)
{
mSearchEditor->setFocus(b);
}
}
void LLSearchEditor::onClearButtonClick(const LLSD& data)
{
setText(LLStringUtil::null);
mSearchEditor->onCommit(); // force keystroke callback
}
void LLSearchEditor::handleKeystroke()
{
if (mKeystrokeCallback)
{
mKeystrokeCallback(this, getValue());
}
}
// static
LLView* LLSearchEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("search_editor");
node->getAttributeString("name", name);
LLRect rect;
createRect(node, rect, parent, LLRect());
S32 max_text_length = 128;
node->getAttributeS32("max_length", max_text_length);
std::string text = node->getValue().substr(0, max_text_length - 1);
LLSearchEditor* search_editor = new LLSearchEditor(name,
rect,
max_text_length);
std::string label;
if(node->getAttributeString("label", label))
{
search_editor->setLabel(label);
}
search_editor->setText(text);
search_editor->initFromXML(node, parent);
return search_editor;
}

View File

@@ -0,0 +1,80 @@
/**
* @file llsearcheditor.h
* @brief Text editor widget that represents a search operation
*
* Features:
* Text entry of a single line (text, delete, left and right arrow, insert, return).
* Callbacks either on every keystroke or just on the return key.
* Focus (allow multiple text entry widgets)
* Clipboard (cut, copy, and paste)
* Horizontal scrolling to allow strings longer than widget size allows
* Pre-validation (limit which keys can be used)
* Optional line history so previous entries can be recalled by CTRL UP/DOWN
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_SEARCHEDITOR_H
#define LL_SEARCHEDITOR_H
#include "lllineeditor.h"
#include "llbutton.h"
class LLSearchEditor : public LLUICtrl
{
public:
LLSearchEditor(const std::string& name,
const LLRect& rect,
S32 max_length_bytes);
void setCommitOnFocusLost(BOOL b) { if (mSearchEditor) mSearchEditor->setCommitOnFocusLost(b); }
virtual ~LLSearchEditor() {}
/*virtual*/ void draw();
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
void setText(const LLStringExplicit &new_text) { mSearchEditor->setText(new_text); }
const std::string& getText() const { return mSearchEditor->getText(); }
// LLUICtrl interface
virtual void setValue(const LLSD& value );
virtual LLSD getValue() const;
virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text );
virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text );
virtual void setLabel( const LLStringExplicit &new_label );
virtual void clear();
virtual void setFocus( BOOL b );
void setKeystrokeCallback( commit_callback_t cb ) { mKeystrokeCallback = cb; }
protected:
void onClearButtonClick(const LLSD& data);
virtual void handleKeystroke();
commit_callback_t mKeystrokeCallback;
LLLineEditor* mSearchEditor;
LLButton* mClearButton;
};
#endif //LL_SEARCHEDITOR_H

View File

@@ -49,8 +49,7 @@ static LLRegisterWidget<LLSlider> r2("volume_slider");
LLSlider::LLSlider( LLSlider::LLSlider(
const std::string& name, const std::string& name,
const LLRect& rect, const LLRect& rect,
void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), commit_callback_t commit_callback,
void* callback_userdata,
F32 initial_value, F32 initial_value,
F32 min_value, F32 min_value,
F32 max_value, F32 max_value,
@@ -58,7 +57,7 @@ LLSlider::LLSlider(
BOOL volume, BOOL volume,
const std::string& control_name) const std::string& control_name)
: :
LLUICtrl( name, rect, TRUE, on_commit_callback, callback_userdata, LLUICtrl( name, rect, TRUE, commit_callback,
FOLLOWS_LEFT | FOLLOWS_TOP), FOLLOWS_LEFT | FOLLOWS_TOP),
mValue( initial_value ), mValue( initial_value ),
mInitialValue( initial_value ), mInitialValue( initial_value ),
@@ -350,7 +349,6 @@ LLView* LLSlider::fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFacto
LLSlider* slider = new LLSlider(name, LLSlider* slider = new LLSlider(name,
rect, rect,
NULL, NULL,
NULL,
initial_value, initial_value,
min_value, min_value,
max_value, max_value,

View File

@@ -43,8 +43,7 @@ public:
LLSlider( LLSlider(
const std::string& name, const std::string& name,
const LLRect& rect, const LLRect& rect,
void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), commit_callback_t commit_callback,
void* callback_userdata,
F32 initial_value, F32 initial_value,
F32 min_value, F32 min_value,
F32 max_value, F32 max_value,

View File

@@ -60,11 +60,10 @@ LLSliderCtrl::LLSliderCtrl(const std::string& name, const LLRect& rect,
BOOL show_text, BOOL show_text,
BOOL can_edit_text, BOOL can_edit_text,
BOOL volume, BOOL volume,
void (*commit_callback)(LLUICtrl*, void*), commit_callback_t commit_callback,
void* callback_user_data,
F32 initial_value, F32 min_value, F32 max_value, F32 increment, F32 initial_value, F32 min_value, F32 max_value, F32 increment,
const std::string& control_which) const std::string& control_which)
: LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data ), : LLUICtrl(name, rect, TRUE, commit_callback ),
mFont(font), mFont(font),
mShowText( show_text ), mShowText( show_text ),
mCanEditText( can_edit_text ), mCanEditText( can_edit_text ),
@@ -104,7 +103,7 @@ LLSliderCtrl::LLSliderCtrl(const std::string& name, const LLRect& rect,
LLRect slider_rect( slider_left, top, slider_right, bottom ); LLRect slider_rect( slider_left, top, slider_right, bottom );
mSlider = new LLSlider(std::string("slider"), mSlider = new LLSlider(std::string("slider"),
slider_rect, slider_rect,
LLSliderCtrl::onSliderCommit, this, boost::bind(&LLSliderCtrl::onSliderCommit,_1,_2),
initial_value, min_value, max_value, increment, volume, initial_value, min_value, max_value, increment, volume,
control_which ); control_which );
addChild( mSlider ); addChild( mSlider );
@@ -117,7 +116,9 @@ LLSliderCtrl::LLSliderCtrl(const std::string& name, const LLRect& rect,
mEditor = new LLLineEditor( std::string("SliderCtrl Editor"), text_rect, mEditor = new LLLineEditor( std::string("SliderCtrl Editor"), text_rect,
LLStringUtil::null, font, LLStringUtil::null, font,
MAX_STRING_LENGTH, MAX_STRING_LENGTH,
&LLSliderCtrl::onEditorCommit, NULL, NULL, this, &LLSliderCtrl::onEditorCommit,
NULL,
NULL,
&LLLineEditor::prevalidateFloat ); &LLLineEditor::prevalidateFloat );
mEditor->setFollowsLeft(); mEditor->setFollowsLeft();
mEditor->setFollowsBottom(); mEditor->setFollowsBottom();
@@ -209,10 +210,11 @@ void LLSliderCtrl::updateText()
} }
// static // static
void LLSliderCtrl::onEditorCommit( LLUICtrl* caller, void *userdata ) void LLSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata )
{ {
LLSliderCtrl* self = (LLSliderCtrl*) userdata; LLSliderCtrl* self = dynamic_cast<LLSliderCtrl*>(ctrl->getParent());
llassert( caller == self->mEditor ); if (!self)
return;
BOOL success = FALSE; BOOL success = FALSE;
F32 val = self->mValue; F32 val = self->mValue;
@@ -250,10 +252,11 @@ void LLSliderCtrl::onEditorCommit( LLUICtrl* caller, void *userdata )
} }
// static // static
void LLSliderCtrl::onSliderCommit( LLUICtrl* caller, void *userdata ) void LLSliderCtrl::onSliderCommit( LLUICtrl* ctrl, const LLSD& userdata )
{ {
LLSliderCtrl* self = (LLSliderCtrl*) userdata; LLSliderCtrl* self = dynamic_cast<LLSliderCtrl*>(ctrl->getParent());
llassert( caller == self->mSlider ); if (!self)
return;
BOOL success = FALSE; BOOL success = FALSE;
F32 saved_val = self->mValue; F32 saved_val = self->mValue;
@@ -472,8 +475,6 @@ LLView* LLSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
} }
} }
LLUICtrlCallback callback = NULL;
if (label.empty()) if (label.empty())
{ {
label.assign(node->getTextContents()); label.assign(node->getTextContents());
@@ -488,7 +489,6 @@ LLView* LLSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
show_text, show_text,
can_edit_text, can_edit_text,
volume, volume,
callback,
NULL, NULL,
initial_value, initial_value,
min_value, min_value,

View File

@@ -58,8 +58,7 @@ public:
BOOL show_text, BOOL show_text,
BOOL can_edit_text, BOOL can_edit_text,
BOOL volume, //TODO: create a "volume" slider sub-class or just use image art, no? -MG BOOL volume, //TODO: create a "volume" slider sub-class or just use image art, no? -MG
void (*commit_callback)(LLUICtrl*, void*), commit_callback_t commit_callback,
void* callback_userdata,
F32 initial_value, F32 min_value, F32 max_value, F32 increment, F32 initial_value, F32 min_value, F32 max_value, F32 increment,
const std::string& control_which = LLStringUtil::null ); const std::string& control_which = LLStringUtil::null );
@@ -114,10 +113,9 @@ public:
virtual std::string getControlName() const { return mSlider->getControlName(); } virtual std::string getControlName() const { return mSlider->getControlName(); }
static void onSliderCommit(LLUICtrl* caller, void* userdata); static void onSliderCommit(LLUICtrl* ctrl, const LLSD& userdata);
static void onEditorCommit(LLUICtrl* caller, void* userdata); static void onEditorCommit(LLUICtrl* ctrl, const LLSD& userdata);
static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata);
private: private:
void updateText(); void updateText();

View File

@@ -54,13 +54,12 @@ const U32 MAX_STRING_LENGTH = 32;
static LLRegisterWidget<LLSpinCtrl> r2("spinner"); static LLRegisterWidget<LLSpinCtrl> r2("spinner");
LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std::string& label, const LLFontGL* font, LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std::string& label, const LLFontGL* font,
void (*commit_callback)(LLUICtrl*, void*), commit_callback_t commit_callback,
void* callback_user_data,
F32 initial_value, F32 min_value, F32 max_value, F32 increment, F32 initial_value, F32 min_value, F32 max_value, F32 increment,
const std::string& control_name, const std::string& control_name,
S32 label_width) S32 label_width)
: :
LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data, FOLLOWS_LEFT | FOLLOWS_TOP ), LLUICtrl(name, rect, TRUE, commit_callback, FOLLOWS_LEFT | FOLLOWS_TOP ),
mValue( initial_value ), mValue( initial_value ),
mInitialValue( initial_value ), mInitialValue( initial_value ),
mMaxValue( max_value ), mMaxValue( max_value ),
@@ -98,10 +97,10 @@ LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std::
out_id, out_id,
in_id, in_id,
LLStringUtil::null, LLStringUtil::null,
&LLSpinCtrl::onUpBtn, this, LLFontGL::getFontSansSerif() ); boost::bind(&LLSpinCtrl::onUpBtn, this, _2), LLFontGL::getFontSansSerif() );
mUpBtn->setFollowsLeft(); mUpBtn->setFollowsLeft();
mUpBtn->setFollowsBottom(); mUpBtn->setFollowsBottom();
mUpBtn->setHeldDownCallback(boost::bind(&LLSpinCtrl::onUpBtn,this)); mUpBtn->setHeldDownCallback(boost::bind(&LLSpinCtrl::onUpBtn,this, _2));
mUpBtn->setTabStop(FALSE); mUpBtn->setTabStop(FALSE);
addChild(mUpBtn); addChild(mUpBtn);
@@ -112,17 +111,17 @@ LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std::
out_id, out_id,
in_id, in_id,
LLStringUtil::null, LLStringUtil::null,
&LLSpinCtrl::onDownBtn, this, LLFontGL::getFontSansSerif() ); boost::bind(&LLSpinCtrl::onDownBtn, this, _2), LLFontGL::getFontSansSerif() );
mDownBtn->setFollowsLeft(); mDownBtn->setFollowsLeft();
mDownBtn->setFollowsBottom(); mDownBtn->setFollowsBottom();
mDownBtn->setHeldDownCallback(boost::bind(&LLSpinCtrl::onDownBtn,this)); mDownBtn->setHeldDownCallback(boost::bind(&LLSpinCtrl::onDownBtn,this, _2));
mDownBtn->setTabStop(FALSE); mDownBtn->setTabStop(FALSE);
addChild(mDownBtn); addChild(mDownBtn);
LLRect editor_rect( btn_right + 1, centered_top, getRect().getWidth(), centered_bottom ); LLRect editor_rect( btn_right + 1, centered_top, getRect().getWidth(), centered_bottom );
mEditor = new LLLineEditor( std::string("SpinCtrl Editor"), editor_rect, LLStringUtil::null, font, mEditor = new LLLineEditor( std::string("SpinCtrl Editor"), editor_rect, LLStringUtil::null, font,
MAX_STRING_LENGTH, MAX_STRING_LENGTH,
&LLSpinCtrl::onEditorCommit, NULL, NULL, this, boost::bind(&LLSpinCtrl::onEditorCommit, this, _2), NULL, NULL,
&LLLineEditor::prevalidateASCII ); &LLLineEditor::prevalidateASCII );
mEditor->setFollowsLeft(); mEditor->setFollowsLeft();
mEditor->setFollowsBottom(); mEditor->setFollowsBottom();
@@ -186,60 +185,59 @@ F32 get_increment(F32 inc, S32 decimal_precision) //CF: finetune increments
// static // static
void LLSpinCtrl::onUpBtn( void *userdata ) void LLSpinCtrl::onUpBtn( const LLSD& data )
{ {
LLSpinCtrl* self = (LLSpinCtrl*) userdata; if( getEnabled() )
if( self->getEnabled() )
{ {
// use getValue()/setValue() to force reload from/to control // use getValue()/setValue() to force reload from/to control
F32 val = (F32)self->getValue().asReal() + get_increment(self->mIncrement, self->mPrecision); F32 val = (F32)getValue().asReal() + get_increment(mIncrement, mPrecision);
val = clamp_precision(val, self->mPrecision); val = clamp_precision(val, mPrecision);
val = llmin( val, self->mMaxValue ); val = llmin( val, mMaxValue );
if (val < mMinValue) val = mMinValue;
if (val > mMaxValue) val = mMaxValue;
F32 saved_val = (F32)self->getValue().asReal(); F32 saved_val = (F32)getValue().asReal();
self->setValue(val); setValue(val);
if( (self->mValidateCallback && !self->mValidateCallback( self, self->mCallbackUserData ) ) || if( (mValidateCallback && !mValidateCallback( this, mCallbackUserData ) ) ||
(self->mValidateSignal && !(*(self->mValidateSignal))( self, val ) )) (mValidateSignal && !(*mValidateSignal)( this, val ) ))
{ {
self->setValue( saved_val ); setValue( saved_val );
self->reportInvalidData(); reportInvalidData();
self->updateEditor(); updateEditor();
return; return;
} }
self->updateEditor(); updateEditor();
self->onCommit(); onCommit();
} }
} }
// static
void LLSpinCtrl::onDownBtn( void *userdata ) void LLSpinCtrl::onDownBtn( const LLSD& data )
{ {
LLSpinCtrl* self = (LLSpinCtrl*) userdata; if( getEnabled() )
if( self->getEnabled() )
{ {
F32 val = (F32)self->getValue().asReal() - get_increment(self->mIncrement, self->mPrecision); F32 val = (F32)getValue().asReal() - get_increment(mIncrement, mPrecision);
val = clamp_precision(val, self->mPrecision); val = clamp_precision(val, mPrecision);
val = llmax( val, self->mMinValue ); val = llmax( val, mMinValue );
if (val < self->mMinValue) val = self->mMinValue; if (val < mMinValue) val = mMinValue;
if (val > self->mMaxValue) val = self->mMaxValue; if (val > mMaxValue) val = mMaxValue;
F32 saved_val = (F32)self->getValue().asReal(); F32 saved_val = (F32)getValue().asReal();
self->setValue(val); setValue(val);
if( (self->mValidateCallback && !self->mValidateCallback( self, self->mCallbackUserData ) ) || if( (mValidateCallback && !mValidateCallback( this, mCallbackUserData ) ) ||
(self->mValidateSignal && !(*(self->mValidateSignal))( self, val ) )) (mValidateSignal && !(*mValidateSignal)( this, val ) ))
{ {
self->setValue( saved_val ); setValue( saved_val );
self->reportInvalidData(); reportInvalidData();
self->updateEditor(); updateEditor();
return; return;
} }
self->updateEditor(); updateEditor();
self->onCommit(); onCommit();
} }
} }
@@ -278,7 +276,13 @@ void LLSpinCtrl::clear()
mbHasBeenSet = FALSE; mbHasBeenSet = FALSE;
} }
void LLSpinCtrl::updateLabelColor()
{
if( mLabelBox )
{
mLabelBox->setColor( getEnabled() ? mTextEnabledColor : mTextDisabledColor );
}
}
void LLSpinCtrl::updateEditor() void LLSpinCtrl::updateEditor()
{ {
@@ -297,52 +301,50 @@ void LLSpinCtrl::updateEditor()
mEditor->setText( text ); mEditor->setText( text );
} }
void LLSpinCtrl::onEditorCommit( LLUICtrl* caller, void *userdata ) void LLSpinCtrl::onEditorCommit( const LLSD& data )
{ {
BOOL success = FALSE; BOOL success = FALSE;
LLSpinCtrl* self = (LLSpinCtrl*) userdata; if( mEditor->evaluateFloat() )
llassert( caller == self->mEditor );
if( self->mEditor->evaluateFloat() )
{ {
std::string text = self->mEditor->getText(); std::string text = mEditor->getText();
LLLocale locale(LLLocale::USER_LOCALE); LLLocale locale(LLLocale::USER_LOCALE);
F32 val = (F32) atof(text.c_str()); F32 val = (F32) atof(text.c_str());
if (val < self->mMinValue) val = self->mMinValue; if (val < mMinValue) val = mMinValue;
if (val > self->mMaxValue) val = self->mMaxValue; if (val > mMaxValue) val = mMaxValue;
F32 saved_val = self->mValue; F32 saved_val = mValue;
self->mValue = val; mValue = val;
if( (!self->mValidateCallback || self->mValidateCallback( self, self->mCallbackUserData )) && if( (!mValidateCallback || mValidateCallback( this, mCallbackUserData )) &&
(!self->mValidateSignal || (*(self->mValidateSignal))(self, val))) (!mValidateSignal || (*mValidateSignal)(this, val) ))
{ {
success = TRUE; success = TRUE;
self->onCommit(); onCommit();
} }
else else
{ {
self->mValue = saved_val; mValue = saved_val;
} }
} }
updateEditor();
if( success ) if( success )
{ {
self->updateEditor(); updateEditor();
} }
else else
{ {
self->reportInvalidData(); reportInvalidData();
} }
} }
void LLSpinCtrl::forceEditorCommit() void LLSpinCtrl::forceEditorCommit()
{ {
onEditorCommit(mEditor, this); onEditorCommit( LLSD() );
} }
@@ -356,6 +358,7 @@ void LLSpinCtrl::setEnabled(BOOL b)
{ {
LLView::setEnabled( b ); LLView::setEnabled( b );
mEditor->setEnabled( b ); mEditor->setEnabled( b );
updateLabelColor();
} }
@@ -403,6 +406,7 @@ void LLSpinCtrl::setLabel(const LLStringExplicit& label)
{ {
llwarns << "Attempting to set label on LLSpinCtrl constructed without one " << getName() << llendl; llwarns << "Attempting to set label on LLSpinCtrl constructed without one " << getName() << llendl;
} }
updateLabelColor();
} }
BOOL LLSpinCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) BOOL LLSpinCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text )
@@ -434,29 +438,19 @@ void LLSpinCtrl::reportInvalidData()
make_ui_sound("UISndBadKeystroke"); make_ui_sound("UISndBadKeystroke");
} }
void LLSpinCtrl::draw()
{
if( mLabelBox )
{
mLabelBox->setColor( getEnabled() ? mTextEnabledColor : mTextDisabledColor );
}
LLUICtrl::draw();
}
BOOL LLSpinCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) BOOL LLSpinCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks)
{ {
if( clicks > 0 ) if( clicks > 0 )
{ {
while( clicks-- ) while( clicks-- )
{ {
LLSpinCtrl::onDownBtn(this); onDownBtn(getValue());
} }
} }
else else
while( clicks++ ) while( clicks++ )
{ {
LLSpinCtrl::onUpBtn(this); onUpBtn(getValue());
} }
return TRUE; return TRUE;
@@ -476,12 +470,12 @@ BOOL LLSpinCtrl::handleKeyHere(KEY key, MASK mask)
} }
if(key == KEY_UP) if(key == KEY_UP)
{ {
LLSpinCtrl::onUpBtn(this); onUpBtn(getValue());
return TRUE; return TRUE;
} }
if(key == KEY_DOWN) if(key == KEY_DOWN)
{ {
LLSpinCtrl::onDownBtn(this); onDownBtn(getValue());
return TRUE; return TRUE;
} }
if(key == KEY_RETURN) if(key == KEY_RETURN)
@@ -557,8 +551,6 @@ LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *
BOOL allow_text_entry = TRUE; BOOL allow_text_entry = TRUE;
node->getAttributeBOOL("allow_text_entry", allow_text_entry); node->getAttributeBOOL("allow_text_entry", allow_text_entry);
LLUICtrlCallback callback = NULL;
if(label.empty()) if(label.empty())
{ {
label.assign( node->getValue() ); label.assign( node->getValue() );
@@ -568,7 +560,6 @@ LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *
rect, rect,
label, label,
font, font,
callback,
NULL, NULL,
initial_value, initial_value,
min_value, min_value,

View File

@@ -56,8 +56,7 @@ public:
LLSpinCtrl(const std::string& name, const LLRect& rect, LLSpinCtrl(const std::string& name, const LLRect& rect,
const std::string& label, const std::string& label,
const LLFontGL* font, const LLFontGL* font,
void (*commit_callback)(LLUICtrl*, void*), commit_callback_t commit_callback,
void* callback_userdata,
F32 initial_value, F32 min_value, F32 max_value, F32 increment, F32 initial_value, F32 min_value, F32 max_value, F32 increment,
const std::string& control_name = std::string(), const std::string& control_name = std::string(),
S32 label_width = SPINCTRL_DEFAULT_LABEL_WIDTH ); S32 label_width = SPINCTRL_DEFAULT_LABEL_WIDTH );
@@ -93,8 +92,8 @@ public:
virtual F32 getIncrement() { return mIncrement ; } virtual F32 getIncrement() { return mIncrement ; }
void setLabel(const LLStringExplicit& label); void setLabel(const LLStringExplicit& label);
void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; } void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; updateLabelColor(); }
void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; } void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; updateLabelColor();}
void setAllowEdit(BOOL allow_edit); void setAllowEdit(BOOL allow_edit);
virtual void onTabInto(); virtual void onTabInto();
@@ -107,17 +106,15 @@ public:
virtual BOOL handleScrollWheel(S32 x,S32 y,S32 clicks); virtual BOOL handleScrollWheel(S32 x,S32 y,S32 clicks);
virtual BOOL handleKeyHere(KEY key, MASK mask); virtual BOOL handleKeyHere(KEY key, MASK mask);
virtual void draw(); void onEditorCommit(const LLSD& data);
static void onEditorCommit(LLUICtrl* caller, void* userdata); void onUpBtn(const LLSD& data);
static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata); void onDownBtn(const LLSD& data);
static void onUpBtn(void *userdata);
static void onDownBtn(void *userdata);
virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text );
private: private:
void updateLabelColor();
void updateEditor(); void updateEditor();
void reportInvalidData(); void reportInvalidData();

View File

@@ -318,15 +318,15 @@ void LLTabContainer::draw()
if( mIsVertical && has_scroll_arrows ) if( mIsVertical && has_scroll_arrows )
{ {
// Redraw the arrows so that they appears on top. // Redraw the arrows so that they appears on top.
gGL.pushMatrix(); gGL.pushUIMatrix();
gGL.translatef((F32)mPrevArrowBtn->getRect().mLeft, (F32)mPrevArrowBtn->getRect().mBottom, 0.f); gGL.translateUI((F32)mPrevArrowBtn->getRect().mLeft, (F32)mPrevArrowBtn->getRect().mBottom, 0.f);
mPrevArrowBtn->draw(); mPrevArrowBtn->draw();
gGL.popMatrix(); gGL.popUIMatrix();
gGL.pushMatrix(); gGL.pushUIMatrix();
gGL.translatef((F32)mNextArrowBtn->getRect().mLeft, (F32)mNextArrowBtn->getRect().mBottom, 0.f); gGL.translateUI((F32)mNextArrowBtn->getRect().mLeft, (F32)mNextArrowBtn->getRect().mBottom, 0.f);
mNextArrowBtn->draw(); mNextArrowBtn->draw();
gGL.popMatrix(); gGL.popUIMatrix();
} }
} }
@@ -817,7 +817,7 @@ void LLTabContainer::addTabPanel(LLPanel* child,
btn_rect.translate(0, -LLBUTTON_V_PAD-2); btn_rect.translate(0, -LLBUTTON_V_PAD-2);
textbox = new LLTextBox(trimmed_label, btn_rect, trimmed_label, font); textbox = new LLTextBox(trimmed_label, btn_rect, trimmed_label, font);
btn = new LLButton(LLStringUtil::null, LLRect(0,0,0,0)); btn = new LLButton(LLStringUtil::null);
} }
else else
{ {
@@ -828,7 +828,7 @@ void LLTabContainer::addTabPanel(LLPanel* child,
LLStringUtil::null, LLStringUtil::null,
LLStringUtil::null, LLStringUtil::null,
LLStringUtil::null, LLStringUtil::null,
NULL, NULL, NULL,
font, font,
trimmed_label, trimmed_label); trimmed_label, trimmed_label);
btn->setImages(std::string("tab_left.tga"), std::string("tab_left_selected.tga")); btn->setImages(std::string("tab_left.tga"), std::string("tab_left_selected.tga"));
@@ -850,7 +850,7 @@ void LLTabContainer::addTabPanel(LLPanel* child,
btn = new LLButton(std::string(child->getName()) + " tab", btn = new LLButton(std::string(child->getName()) + " tab",
btn_rect, btn_rect,
LLStringUtil::null, LLStringUtil::null, LLStringUtil::null, LLStringUtil::null, LLStringUtil::null, LLStringUtil::null,
NULL, NULL, // set userdata below NULL, // set userdata below
font, font,
trimmed_label, trimmed_label ); trimmed_label, trimmed_label );
btn->setVisible( FALSE ); btn->setVisible( FALSE );
@@ -1646,19 +1646,17 @@ void LLTabContainer::initButtons()
out_id = "UIImgBtnScrollUpOutUUID"; out_id = "UIImgBtnScrollUpOutUUID";
in_id = "UIImgBtnScrollUpInUUID"; in_id = "UIImgBtnScrollUpInUUID";
mPrevArrowBtn = new LLButton(std::string("Up Arrow"), up_arrow_btn_rect, mPrevArrowBtn = new LLButton(std::string("Up Arrow"), up_arrow_btn_rect,
out_id, in_id, LLStringUtil::null, NULL ); out_id, in_id, LLStringUtil::null, boost::bind(&LLTabContainer::onPrevBtn,this,_2));
mPrevArrowBtn->setFollowsTop(); mPrevArrowBtn->setFollowsTop();
mPrevArrowBtn->setFollowsLeft(); mPrevArrowBtn->setFollowsLeft();
mPrevArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onPrevBtn,this,_2));
mPrevArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onPrevBtnHeld, this, _2)); mPrevArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onPrevBtnHeld, this, _2));
out_id = "UIImgBtnScrollDownOutUUID"; out_id = "UIImgBtnScrollDownOutUUID";
in_id = "UIImgBtnScrollDownInUUID"; in_id = "UIImgBtnScrollDownInUUID";
mNextArrowBtn = new LLButton(std::string("Down Arrow"), down_arrow_btn_rect, mNextArrowBtn = new LLButton(std::string("Down Arrow"), down_arrow_btn_rect,
out_id, in_id, LLStringUtil::null, NULL ); out_id, in_id, LLStringUtil::null, boost::bind(&LLTabContainer::onNextBtn,this,_2) );
mNextArrowBtn->setFollowsBottom(); mNextArrowBtn->setFollowsBottom();
mNextArrowBtn->setFollowsLeft(); mNextArrowBtn->setFollowsLeft();
mNextArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onNextBtn,this,_2));
mNextArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onNextBtnHeld, this, _2)); mNextArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onNextBtnHeld, this, _2));
} }
else // Horizontal else // Horizontal
@@ -1697,17 +1695,14 @@ void LLTabContainer::initButtons()
in_id = "UIImgBtnJumpLeftInUUID"; in_id = "UIImgBtnJumpLeftInUUID";
mJumpPrevArrowBtn = new LLButton(std::string("Jump Left Arrow"), jump_left_arrow_btn_rect, mJumpPrevArrowBtn = new LLButton(std::string("Jump Left Arrow"), jump_left_arrow_btn_rect,
out_id, in_id, LLStringUtil::null, out_id, in_id, LLStringUtil::null,
NULL, NULL, LLFontGL::getFontSansSerif() ); boost::bind(&LLTabContainer::onJumpFirstBtn, this, _2), LLFontGL::getFontSansSerif() );
mJumpPrevArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onJumpFirstBtn, this, _2));
mJumpPrevArrowBtn->setFollowsLeft(); mJumpPrevArrowBtn->setFollowsLeft();
out_id = "UIImgBtnScrollLeftOutUUID"; out_id = "UIImgBtnScrollLeftOutUUID";
in_id = "UIImgBtnScrollLeftInUUID"; in_id = "UIImgBtnScrollLeftInUUID";
mPrevArrowBtn = new LLButton(std::string("Left Arrow"), left_arrow_btn_rect, mPrevArrowBtn = new LLButton(std::string("Left Arrow"), left_arrow_btn_rect,
out_id, in_id, LLStringUtil::null, out_id, in_id, LLStringUtil::null,
NULL, NULL, LLFontGL::getFontSansSerif() ); boost::bind(&LLTabContainer::onPrevBtn, this, _2), LLFontGL::getFontSansSerif() );
mPrevArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onPrevBtn, this, _2));
mPrevArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onPrevBtnHeld, this, _2)); mPrevArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onPrevBtnHeld, this, _2));
mPrevArrowBtn->setFollowsLeft(); mPrevArrowBtn->setFollowsLeft();
@@ -1715,16 +1710,14 @@ void LLTabContainer::initButtons()
in_id = "UIImgBtnJumpRightInUUID"; in_id = "UIImgBtnJumpRightInUUID";
mJumpNextArrowBtn = new LLButton(std::string("Jump Right Arrow"), jump_right_arrow_btn_rect, mJumpNextArrowBtn = new LLButton(std::string("Jump Right Arrow"), jump_right_arrow_btn_rect,
out_id, in_id, LLStringUtil::null, out_id, in_id, LLStringUtil::null,
NULL, NULL, LLFontGL::getFontSansSerif()); boost::bind(&LLTabContainer::onJumpLastBtn, this, _2), LLFontGL::getFontSansSerif());
mJumpNextArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onJumpLastBtn, this, _2));
mJumpNextArrowBtn->setFollowsRight(); mJumpNextArrowBtn->setFollowsRight();
out_id = "UIImgBtnScrollRightOutUUID"; out_id = "UIImgBtnScrollRightOutUUID";
in_id = "UIImgBtnScrollRightInUUID"; in_id = "UIImgBtnScrollRightInUUID";
mNextArrowBtn = new LLButton(std::string("Right Arrow"), right_arrow_btn_rect, mNextArrowBtn = new LLButton(std::string("Right Arrow"), right_arrow_btn_rect,
out_id, in_id, LLStringUtil::null, out_id, in_id, LLStringUtil::null,
NULL, NULL, LLFontGL::getFontSansSerif()); boost::bind(&LLTabContainer::onNextBtn, this, _2), LLFontGL::getFontSansSerif());
mNextArrowBtn->setCommitCallback(boost::bind(&LLTabContainer::onNextBtn, this, _2));
mNextArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onNextBtnHeld, this, _2)); mNextArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onNextBtnHeld, this, _2));
mNextArrowBtn->setFollowsRight(); mNextArrowBtn->setFollowsRight();

View File

@@ -40,7 +40,7 @@ static LLRegisterWidget<LLTextBox> r("text");
LLTextBox::LLTextBox(const std::string& name, const LLRect& rect, const std::string& text, LLTextBox::LLTextBox(const std::string& name, const LLRect& rect, const std::string& text,
const LLFontGL* font, BOOL mouse_opaque) const LLFontGL* font, BOOL mouse_opaque)
: LLUICtrl(name, rect, mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP ), : LLUICtrl(name, rect, mouse_opaque, NULL, FOLLOWS_LEFT | FOLLOWS_TOP ),
mFontGL(font ? font : LLFontGL::getFontSansSerifSmall()) mFontGL(font ? font : LLFontGL::getFontSansSerifSmall())
{ {
initDefaults(); initDefaults();
@@ -50,7 +50,7 @@ LLTextBox::LLTextBox(const std::string& name, const LLRect& rect, const std::str
LLTextBox::LLTextBox(const std::string& name, const std::string& text, F32 max_width, LLTextBox::LLTextBox(const std::string& name, const std::string& text, F32 max_width,
const LLFontGL* font, BOOL mouse_opaque) : const LLFontGL* font, BOOL mouse_opaque) :
LLUICtrl(name, LLRect(0, 0, 1, 1), mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), LLUICtrl(name, LLRect(0, 0, 1, 1), mouse_opaque, NULL, FOLLOWS_LEFT | FOLLOWS_TOP),
mFontGL(font ? font : LLFontGL::getFontSansSerifSmall()) mFontGL(font ? font : LLFontGL::getFontSansSerifSmall())
{ {
initDefaults(); initDefaults();
@@ -60,7 +60,7 @@ LLTextBox::LLTextBox(const std::string& name, const std::string& text, F32 max_w
} }
LLTextBox::LLTextBox(const std::string& name_and_label, const LLRect& rect) : LLTextBox::LLTextBox(const std::string& name_and_label, const LLRect& rect) :
LLUICtrl(name_and_label, rect, TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), LLUICtrl(name_and_label, rect, TRUE, NULL, FOLLOWS_LEFT | FOLLOWS_TOP),
mFontGL(LLFontGL::getFontSansSerifSmall()) mFontGL(LLFontGL::getFontSansSerifSmall())
{ {
initDefaults(); initDefaults();
@@ -89,7 +89,6 @@ void LLTextBox::initDefaults()
mHAlign = LLFontGL::LEFT; mHAlign = LLFontGL::LEFT;
mVAlign = LLFontGL::TOP; mVAlign = LLFontGL::TOP;
mClickedCallback = NULL; mClickedCallback = NULL;
mCallbackUserData = NULL;
} }
BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask)
@@ -140,7 +139,7 @@ BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask)
// If mouseup in the widget, it's been clicked // If mouseup in the widget, it's been clicked
if (mClickedCallback) if (mClickedCallback)
{ {
(*mClickedCallback)( mCallbackUserData ); mClickedCallback();
} }
} }
@@ -298,8 +297,7 @@ void LLTextBox::draw()
if (mBackgroundVisible) if (mBackgroundVisible)
{ {
LLRect r( 0, getRect().getHeight(), getRect().getWidth(), 0 ); gl_rect_2d( getLocalRect(), mBackgroundColor );
gl_rect_2d( r, mBackgroundColor );
} }
S32 text_x = 0; S32 text_x = 0;

View File

@@ -43,6 +43,7 @@ class LLTextBox
: public LLUICtrl : public LLUICtrl
{ {
public: public:
typedef boost::function<void (void)> callback_t;
// By default, follows top and left and is mouse-opaque. // By default, follows top and left and is mouse-opaque.
// If no text, text = name. // If no text, text = name.
// If no font, uses default system font. // If no font, uses default system font.
@@ -93,7 +94,7 @@ public:
void setVPad(S32 pixels) { mVPad = pixels; } void setVPad(S32 pixels) { mVPad = pixels; }
void setRightAlign() { mHAlign = LLFontGL::RIGHT; } void setRightAlign() { mHAlign = LLFontGL::RIGHT; }
void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; } void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; }
void setClickedCallback( void (*cb)(void *data), void* data = NULL ){ mClickedCallback = cb; mCallbackUserData = data; } // mouse down and up within button void setClickedCallback( callback_t cb ) { mClickedCallback = cb; }
const LLFontGL* getFont() const { return mFontGL; } const LLFontGL* getFont() const { return mFontGL; }
@@ -137,7 +138,7 @@ private:
LLFontGL::VAlign mVAlign; LLFontGL::VAlign mVAlign;
std::vector<S32> mLineLengthList; std::vector<S32> mLineLengthList;
void (*mClickedCallback)(void* data ); callback_t mClickedCallback;
void* mCallbackUserData; void* mCallbackUserData;
}; };

View File

@@ -257,7 +257,7 @@ LLTextEditor::LLTextEditor(
const LLFontGL* font, const LLFontGL* font,
BOOL allow_embedded_items) BOOL allow_embedded_items)
: :
LLUICtrl( name, rect, TRUE, NULL, NULL, FOLLOWS_TOP | FOLLOWS_LEFT ), LLUICtrl( name, rect, TRUE, NULL, FOLLOWS_TOP | FOLLOWS_LEFT ),
mTextIsUpToDate(TRUE), mTextIsUpToDate(TRUE),
mMaxTextByteLength( max_length ), mMaxTextByteLength( max_length ),
mPopupMenuHandle(), mPopupMenuHandle(),
@@ -331,7 +331,7 @@ LLTextEditor::LLTextEditor(
lines_in_doc, lines_in_doc,
0, 0,
page_size, page_size,
NULL, this ); NULL);
mScrollbar->setFollowsRight(); mScrollbar->setFollowsRight();
mScrollbar->setFollowsTop(); mScrollbar->setFollowsTop();
mScrollbar->setFollowsBottom(); mScrollbar->setFollowsBottom();
@@ -2128,6 +2128,8 @@ void LLTextEditor::cut()
deleteSelection( FALSE ); deleteSelection( FALSE );
needsReflow(); needsReflow();
onKeyStroke();
} }
BOOL LLTextEditor::canCopy() const BOOL LLTextEditor::canCopy() const
@@ -2244,6 +2246,8 @@ void LLTextEditor::pasteHelper(bool is_primary)
deselect(); deselect();
needsReflow(); needsReflow();
onKeyStroke();
} }
@@ -2506,6 +2510,10 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask, BOOL* return
break; break;
} }
if (handled)
{
onKeyStroke();
}
return handled; return handled;
} }
@@ -2665,6 +2673,7 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char)
deselect(); deselect();
needsReflow(); needsReflow();
onKeyStroke();
} }
} }
@@ -2723,6 +2732,7 @@ void LLTextEditor::doDelete()
} }
needsReflow(); needsReflow();
onKeyStroke();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -2766,6 +2776,7 @@ void LLTextEditor::undo()
setCursorPos(pos); setCursorPos(pos);
needsReflow(); needsReflow();
onKeyStroke();
} }
BOOL LLTextEditor::canRedo() const BOOL LLTextEditor::canRedo() const
@@ -2808,6 +2819,7 @@ void LLTextEditor::redo()
setCursorPos(pos); setCursorPos(pos);
needsReflow(); needsReflow();
onKeyStroke();
} }
void LLTextEditor::onFocusReceived() void LLTextEditor::onFocusReceived()
@@ -5068,6 +5080,7 @@ void LLTextEditor::updatePreedit(const LLWString &preedit_string,
// Update of the preedit should be caused by some key strokes. // Update of the preedit should be caused by some key strokes.
mKeystrokeTimer.reset(); mKeystrokeTimer.reset();
onKeyStroke();
} }
BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const
@@ -5226,3 +5239,13 @@ S32 LLTextEditor::getPreeditFontSize() const
{ {
return llround(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]); return llround(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]);
} }
void LLTextEditor::setKeystrokeCallback(const keystroke_signal_t::slot_type& callback)
{
mKeystrokeSignal.connect(callback);
}
void LLTextEditor::onKeyStroke()
{
mKeystrokeSignal(this);
}

View File

@@ -73,6 +73,10 @@ public:
virtual ~LLTextEditor(); virtual ~LLTextEditor();
typedef boost::signals2::signal<void (LLTextEditor* caller)> keystroke_signal_t;
void setKeystrokeCallback(const keystroke_signal_t::slot_type& callback);
virtual LLXMLNodePtr getXML(bool save_children = true) const; virtual LLXMLNodePtr getXML(bool save_children = true) const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory); static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory);
void setTextEditorParameters(LLXMLNodePtr node); void setTextEditorParameters(LLXMLNodePtr node);
@@ -480,6 +484,7 @@ private:
// Methods // Methods
// //
void pasteHelper(bool is_primary); void pasteHelper(bool is_primary);
void onKeyStroke();
void updateSegments(); void updateSegments();
void pruneSegments(); void pruneSegments();
@@ -603,6 +608,7 @@ private:
BOOL mHandleEditKeysDirectly; BOOL mHandleEditKeysDirectly;
LLCoordGL mLastIMEPosition; // Last position of the IME editor LLCoordGL mLastIMEPosition; // Last position of the IME editor
keystroke_signal_t mKeystrokeSignal;
}; // end class LLTextEditor }; // end class LLTextEditor

View File

@@ -35,7 +35,6 @@
#include "lltrans.h" #include "lltrans.h"
#include "llxmlnode.h" #include "llxmlnode.h"
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
#include "llalertdialog.h"
#include "llnotificationsutil.h" #include "llnotificationsutil.h"
#include <map> #include <map>

View File

@@ -54,23 +54,24 @@ LLUICtrl::LLUICtrl() :
{ {
} }
LLUICtrl::LLUICtrl(const std::string& name, const LLRect& rect, BOOL mouse_opaque, LLUICtrl::LLUICtrl(const std::string& name, const LLRect rect, BOOL mouse_opaque,
void (*on_commit_callback)(LLUICtrl*, void*), commit_callback_t commit_callback,
void* callback_userdata,
U32 reshape) U32 reshape)
: // can't make this automatically follow top and left, breaks lots : // can't make this automatically follow top and left, breaks lots
// of buttons in the UI. JC 7/20/2002 // of buttons in the UI. JC 7/20/2002
LLView( name, rect, mouse_opaque, reshape ), LLView( name, rect, mouse_opaque, reshape ),
mCommitSignal(NULL), mCommitSignal(NULL),
mValidateSignal(NULL), mValidateSignal(NULL),
mCommitCallback(NULL),
mViewModel(LLViewModelPtr(new LLViewModel)), mViewModel(LLViewModelPtr(new LLViewModel)),
mCommitCallback( on_commit_callback),
mValidateCallback( NULL ), mValidateCallback( NULL ),
mCallbackUserData( callback_userdata ), mCallbackUserData( NULL ),
mTentative( FALSE ), mTentative( FALSE ),
mTabStop( TRUE ), mTabStop( TRUE ),
mIsChrome(FALSE) mIsChrome(FALSE)
{ {
if(commit_callback)
setCommitCallback(commit_callback);
} }
LLUICtrl::~LLUICtrl() LLUICtrl::~LLUICtrl()

View File

@@ -54,9 +54,8 @@ public:
typedef BOOL (*LLUICtrlValidate)(LLUICtrl* ctrl, void* userdata); typedef BOOL (*LLUICtrlValidate)(LLUICtrl* ctrl, void* userdata);
LLUICtrl(); LLUICtrl();
LLUICtrl( const std::string& name, const LLRect& rect, BOOL mouse_opaque, LLUICtrl( const std::string& name, const LLRect rect = LLRect(), BOOL mouse_opaque = TRUE,
LLUICtrlCallback callback, commit_callback_t commit_callback = NULL,
void* callback_userdata,
U32 reshape=FOLLOWS_NONE); U32 reshape=FOLLOWS_NONE);
/*virtual*/ ~LLUICtrl(); /*virtual*/ ~LLUICtrl();

View File

@@ -83,7 +83,7 @@ std::vector<std::string> LLUICtrlFactory::sXUIPaths;
class LLUICtrlLocate : public LLUICtrl class LLUICtrlLocate : public LLUICtrl
{ {
public: public:
LLUICtrlLocate() : LLUICtrl(std::string("locate"), LLRect(0,0,0,0), FALSE, NULL, NULL) { setTabStop(FALSE); } LLUICtrlLocate() : LLUICtrl(std::string("locate"), LLRect(0,0,0,0), FALSE) { setTabStop(FALSE); }
virtual void draw() { } virtual void draw() { }
virtual LLXMLNodePtr getXML(bool save_children = true) const virtual LLXMLNodePtr getXML(bool save_children = true) const

View File

@@ -38,180 +38,132 @@
#include "llscrolllistctrl.h" #include "llscrolllistctrl.h"
#include "llagent.h" #include "llagent.h"
#include "llfiltereditor.h"
#include "lltracker.h" #include "lltracker.h"
#include "llviewerobjectlist.h" #include "llviewerobjectlist.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "jcfloaterareasearch.h" #include "jcfloaterareasearch.h"
JCFloaterAreaSearch* JCFloaterAreaSearch::sInstance = NULL;
LLViewerRegion* JCFloaterAreaSearch::sLastRegion = NULL;
S32 JCFloaterAreaSearch::sRequested = 0;
std::map<LLUUID, AObjectDetails> JCFloaterAreaSearch::sObjectDetails;
std::string JCFloaterAreaSearch::sSearchedName;
std::string JCFloaterAreaSearch::sSearchedDesc;
std::string JCFloaterAreaSearch::sSearchedOwner;
std::string JCFloaterAreaSearch::sSearchedGroup;
const std::string request_string = "JCFloaterAreaSearch::Requested_\xF8\xA7\xB5"; const std::string request_string = "JCFloaterAreaSearch::Requested_\xF8\xA7\xB5";
const F32 min_refresh_interval = 0.25f; // Minimum interval between list refreshes in seconds. const F32 min_refresh_interval = 0.25f; // Minimum interval between list refreshes in seconds.
JCFloaterAreaSearch::JCFloaterAreaSearch() : JCFloaterAreaSearch::JCFloaterAreaSearch(const LLSD& data) :
LLFloater(), LLFloater(),
mCounterText(0), mCounterText(0),
mResultList(0) mResultList(0),
mLastRegion(0),
mStopped(false)
{ {
llassert_always(sInstance == NULL);
sInstance = this;
mLastUpdateTimer.reset(); mLastUpdateTimer.reset();
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_area_search.xml");
} }
JCFloaterAreaSearch::~JCFloaterAreaSearch() JCFloaterAreaSearch::~JCFloaterAreaSearch()
{ {
sInstance = NULL;
} }
void JCFloaterAreaSearch::close(bool app) void JCFloaterAreaSearch::close(bool app)
{ {
if (app) if (app || mStopped)
{ {
LLFloater::close(app); LLFloater::close(app);
} }
else else
{ {
if (sInstance) setVisible(FALSE);
{
sInstance->setVisible(FALSE);
}
} }
} }
BOOL JCFloaterAreaSearch::postBuild() BOOL JCFloaterAreaSearch::postBuild()
{ {
mResultList = getChild<LLScrollListCtrl>("result_list"); mResultList = getChild<LLScrollListCtrl>("result_list");
mResultList->setDoubleClickCallback(onDoubleClick,this); mResultList->setDoubleClickCallback(boost::bind(&JCFloaterAreaSearch::onDoubleClick,this));
mResultList->sortByColumn("Name", TRUE); mResultList->sortByColumn("Name", TRUE);
mCounterText = getChild<LLTextBox>("counter"); mCounterText = getChild<LLTextBox>("counter");
childSetAction("Refresh", search, this); getChild<LLButton>("Refresh")->setClickedCallback(boost::bind(&JCFloaterAreaSearch::onRefresh,this));
childSetAction("Stop", cancel, this); getChild<LLButton>("Stop")->setClickedCallback(boost::bind(&JCFloaterAreaSearch::onStop,this));
childSetKeystrokeCallback("Name query chunk", onCommitLine, 0); getChild<LLFilterEditor>("Name query chunk")->setCommitCallback(boost::bind(&JCFloaterAreaSearch::onCommitLine,this,_1,_2,LIST_OBJECT_NAME));
childSetKeystrokeCallback("Description query chunk", onCommitLine, 0); getChild<LLFilterEditor>("Description query chunk")->setCommitCallback(boost::bind(&JCFloaterAreaSearch::onCommitLine,this,_1,_2,LIST_OBJECT_DESC));
childSetKeystrokeCallback("Owner query chunk", onCommitLine, 0); getChild<LLFilterEditor>("Owner query chunk")->setCommitCallback(boost::bind(&JCFloaterAreaSearch::onCommitLine,this,_1,_2,LIST_OBJECT_OWNER));
childSetKeystrokeCallback("Group query chunk", onCommitLine, 0); getChild<LLFilterEditor>("Group query chunk")->setCommitCallback(boost::bind(&JCFloaterAreaSearch::onCommitLine,this,_1,_2,LIST_OBJECT_GROUP));
return TRUE; return TRUE;
} }
// static void JCFloaterAreaSearch::onOpen()
void JCFloaterAreaSearch::checkRegion()
{ {
// Check if we changed region, and if we did, clear the object details cache.
LLViewerRegion* region = gAgent.getRegion();
if (region != sLastRegion)
{
sLastRegion = region;
sRequested = 0;
sObjectDetails.clear();
if (sInstance)
{
sInstance->mResultList->deleteAllItems();
sInstance->mCounterText->setText(std::string("Listed/Pending/Total"));
}
}
}
// static
void JCFloaterAreaSearch::toggle()
{
if (sInstance)
{
if (sInstance->getVisible())
{
sInstance->setVisible(FALSE);
}
else
{
checkRegion();
sInstance->setVisible(TRUE);
}
}
else
{
sInstance = new JCFloaterAreaSearch();
LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_area_search.xml");
}
}
// static
void JCFloaterAreaSearch::onDoubleClick(void *userdata)
{
JCFloaterAreaSearch *self = (JCFloaterAreaSearch*)userdata;
LLScrollListItem *item = self->mResultList->getFirstSelected();
if (!item) return;
LLUUID object_id = item->getUUID();
LLViewerObject* objectp = gObjectList.findObject(object_id);
if (objectp)
{
LLTracker::trackLocation(objectp->getPositionGlobal(), sObjectDetails[object_id].name, "", LLTracker::LOCATION_ITEM);
}
}
// static
void JCFloaterAreaSearch::cancel(void* data)
{
checkRegion();
if (sInstance)
{
sInstance->close(TRUE);
}
sSearchedName = "";
sSearchedDesc = "";
sSearchedOwner = "";
sSearchedGroup = "";
}
// static
void JCFloaterAreaSearch::search(void* data)
{
//llinfos << "Clicked search" << llendl;
checkRegion(); checkRegion();
results(); results();
} }
// static void JCFloaterAreaSearch::checkRegion(bool force_clear)
void JCFloaterAreaSearch::onCommitLine(LLLineEditor* line, void* user_data)
{ {
std::string name = line->getName(); // Check if we changed region, and if we did, clear the object details cache.
std::string text = line->getText(); LLViewerRegion* region = gAgent.getRegion();
LLStringUtil::toLower(text); if (force_clear || region != mLastRegion)
line->setText(text);
if (name == "Name query chunk") sSearchedName = text;
else if (name == "Description query chunk") sSearchedDesc = text;
else if (name == "Owner query chunk") sSearchedOwner = text;
else if (name == "Group query chunk") sSearchedGroup = text;
//llinfos << "loaded " << name << " with "<< text << llendl;
if (text.length() > 3)
{ {
checkRegion(); mLastRegion = region;
results(); mPendingObjects.clear();
mCachedObjects.clear();
mResultList->deleteAllItems();
mCounterText->setText(std::string("Listed/Pending/Total"));
} }
} }
// static void JCFloaterAreaSearch::onDoubleClick()
void JCFloaterAreaSearch::requestIfNeeded(LLViewerObject *objectp)
{ {
LLUUID object_id = objectp->getID(); LLScrollListItem *item = mResultList->getFirstSelected();
if (sObjectDetails.count(object_id) == 0) if (!item) return;
LLUUID object_id = item->getUUID();
std::map<LLUUID,ObjectData>::iterator it = mCachedObjects.find(object_id);
if(it != mCachedObjects.end())
{ {
LLViewerObject* objectp = gObjectList.findObject(object_id);
if (objectp)
{
LLTracker::trackLocation(objectp->getPositionGlobal(), it->second.name, "", LLTracker::LOCATION_ITEM);
}
}
}
void JCFloaterAreaSearch::onStop()
{
mStopped = true;
mPendingObjects.clear();
mCounterText->setText(std::string("Stopped"));
}
void JCFloaterAreaSearch::onRefresh()
{
//llinfos << "Clicked search" << llendl;
mStopped = false;
checkRegion(true);
results();
}
void JCFloaterAreaSearch::onCommitLine(LLUICtrl* caller, const LLSD& value, OBJECT_COLUMN_ORDER type)
{
std::string text = value.asString();
LLStringUtil::toLower(text);
caller->setValue(text);
mFilterStrings[type] = text;
//llinfos << "loaded " << name << " with "<< text << llendl;
checkRegion();
results();
}
bool JCFloaterAreaSearch::requestIfNeeded(LLUUID object_id)
{
if (!mCachedObjects.count(object_id) && !mPendingObjects.count(object_id))
{
if(mStopped)
return true;
//llinfos << "not in list" << llendl; //llinfos << "not in list" << llendl;
AObjectDetails* details = &sObjectDetails[object_id]; mPendingObjects.insert(object_id);
details->name = request_string;
details->desc = request_string;
details->owner_id = LLUUID::null;
details->group_id = LLUUID::null;
LLMessageSystem* msg = gMessageSystem; LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily); msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily);
@@ -223,20 +175,20 @@ void JCFloaterAreaSearch::requestIfNeeded(LLViewerObject *objectp)
msg->addUUIDFast(_PREHASH_ObjectID, object_id); msg->addUUIDFast(_PREHASH_ObjectID, object_id);
gAgent.sendReliableMessage(); gAgent.sendReliableMessage();
//llinfos << "Sent data request for object " << object_id << llendl; //llinfos << "Sent data request for object " << object_id << llendl;
sRequested++; return true;
} }
return false;
} }
// static
void JCFloaterAreaSearch::results() void JCFloaterAreaSearch::results()
{ {
if (!sInstance) return; if (!getVisible()) return;
if (!(sInstance->getVisible())) return;
if (sRequested > 0 && sInstance->mLastUpdateTimer.getElapsedTimeF32() < min_refresh_interval) return; if (mPendingObjects.size() > 0 && mLastUpdateTimer.getElapsedTimeF32() < min_refresh_interval) return;
//llinfos << "results()" << llendl; //llinfos << "results()" << llendl;
uuid_vec_t selected = sInstance->mResultList->getSelectedIDs(); uuid_vec_t selected = mResultList->getSelectedIDs();
S32 scrollpos = sInstance->mResultList->getScrollPos(); S32 scrollpos = mResultList->getScrollPos();
sInstance->mResultList->deleteAllItems(); mResultList->deleteAllItems();
S32 i; S32 i;
S32 total = gObjectList.getNumObjects(); S32 total = gObjectList.getNumObjects();
@@ -250,23 +202,18 @@ void JCFloaterAreaSearch::results()
!objectp->flagTemporary() && !objectp->flagTemporaryOnRez()) !objectp->flagTemporary() && !objectp->flagTemporaryOnRez())
{ {
LLUUID object_id = objectp->getID(); LLUUID object_id = objectp->getID();
if (sObjectDetails.count(object_id) == 0) if(!requestIfNeeded(object_id))
{ {
//llinfos << "not all entries are \"\"" << llendl; std::map<LLUUID,ObjectData>::iterator it = mCachedObjects.find(object_id);
requestIfNeeded(objectp); if(it != mCachedObjects.end())
}
else
{
//llinfos << "all entries are \"\" or we have data" << llendl;
AObjectDetails* details = &sObjectDetails[object_id];
std::string object_name = details->name;
std::string object_desc = details->desc;
std::string object_owner;
std::string object_group;
gCacheName->getFullName(details->owner_id, object_owner);
gCacheName->getGroupName(details->group_id, object_group);
if (object_name != request_string)
{ {
//llinfos << "all entries are \"\" or we have data" << llendl;
std::string object_name = it->second.name;
std::string object_desc = it->second.desc;
std::string object_owner;
std::string object_group;
gCacheName->getFullName(it->second.owner_id, object_owner);
gCacheName->getGroupName(it->second.group_id, object_group);
//llinfos << "both names are loaded or aren't needed" << llendl; //llinfos << "both names are loaded or aren't needed" << llendl;
std::string onU = object_owner; std::string onU = object_owner;
std::string cnU = object_group; std::string cnU = object_group;
@@ -274,62 +221,67 @@ void JCFloaterAreaSearch::results()
LLStringUtil::toLower(object_desc); LLStringUtil::toLower(object_desc);
LLStringUtil::toLower(object_owner); LLStringUtil::toLower(object_owner);
LLStringUtil::toLower(object_group); LLStringUtil::toLower(object_group);
if ((sSearchedName == "" || object_name.find(sSearchedName) != -1) && if ((mFilterStrings[LIST_OBJECT_NAME].empty() || object_name.find(mFilterStrings[LIST_OBJECT_NAME]) != -1) &&
(sSearchedDesc == "" || object_desc.find(sSearchedDesc) != -1) && (mFilterStrings[LIST_OBJECT_DESC].empty() || object_desc.find(mFilterStrings[LIST_OBJECT_DESC]) != -1) &&
(sSearchedOwner == "" || object_owner.find(sSearchedOwner) != -1) && (mFilterStrings[LIST_OBJECT_OWNER].empty() || object_owner.find(mFilterStrings[LIST_OBJECT_OWNER]) != -1) &&
(sSearchedGroup == "" || object_group.find(sSearchedGroup) != -1)) (mFilterStrings[LIST_OBJECT_GROUP].empty() || object_group.find(mFilterStrings[LIST_OBJECT_GROUP]) != -1))
{ {
//llinfos << "pass" << llendl; //llinfos << "pass" << llendl;
LLSD element; LLSD element;
element["id"] = object_id; element["id"] = object_id;
element["columns"][LIST_OBJECT_NAME]["column"] = "Name"; element["columns"][LIST_OBJECT_NAME]["column"] = "Name";
element["columns"][LIST_OBJECT_NAME]["type"] = "text"; element["columns"][LIST_OBJECT_NAME]["type"] = "text";
element["columns"][LIST_OBJECT_NAME]["value"] = details->name; //item->getName();//ai->second//"avatar_icon"; element["columns"][LIST_OBJECT_NAME]["value"] = it->second.name;
element["columns"][LIST_OBJECT_DESC]["column"] = "Description"; element["columns"][LIST_OBJECT_DESC]["column"] = "Description";
element["columns"][LIST_OBJECT_DESC]["type"] = "text"; element["columns"][LIST_OBJECT_DESC]["type"] = "text";
element["columns"][LIST_OBJECT_DESC]["value"] = details->desc; //ai->second; element["columns"][LIST_OBJECT_DESC]["value"] = it->second.desc;
element["columns"][LIST_OBJECT_OWNER]["column"] = "Owner"; element["columns"][LIST_OBJECT_OWNER]["column"] = "Owner";
element["columns"][LIST_OBJECT_OWNER]["type"] = "text"; element["columns"][LIST_OBJECT_OWNER]["type"] = "text";
element["columns"][LIST_OBJECT_OWNER]["value"] = onU; //ai->first; element["columns"][LIST_OBJECT_OWNER]["value"] = onU;
element["columns"][LIST_OBJECT_GROUP]["column"] = "Group"; element["columns"][LIST_OBJECT_GROUP]["column"] = "Group";
element["columns"][LIST_OBJECT_GROUP]["type"] = "text"; element["columns"][LIST_OBJECT_GROUP]["type"] = "text";
element["columns"][LIST_OBJECT_GROUP]["value"] = cnU; //ai->second; element["columns"][LIST_OBJECT_GROUP]["value"] = cnU; //ai->second;
sInstance->mResultList->addElement(element, ADD_BOTTOM); mResultList->addElement(element, ADD_BOTTOM);
} }
} }
} }
} }
} }
} }
sInstance->mResultList->updateSort(); mResultList->updateSort();
sInstance->mResultList->selectMultiple(selected); mResultList->selectMultiple(selected);
sInstance->mResultList->setScrollPos(scrollpos); mResultList->setScrollPos(scrollpos);
sInstance->mCounterText->setText(llformat("%d listed/%d pending/%d total", sInstance->mResultList->getItemCount(), sRequested, sObjectDetails.size())); mCounterText->setText(llformat("%d listed/%d pending/%d total", mResultList->getItemCount(), mPendingObjects.size(), mPendingObjects.size()+mCachedObjects.size()));
sInstance->mLastUpdateTimer.reset(); mLastUpdateTimer.reset();
} }
// static // static
void JCFloaterAreaSearch::processObjectPropertiesFamily(LLMessageSystem* msg, void** user_data) void JCFloaterAreaSearch::processObjectPropertiesFamily(LLMessageSystem* msg, void** user_data)
{ {
checkRegion(); JCFloaterAreaSearch* floater = findInstance();
if(!floater)
return;
floater->checkRegion();
LLUUID object_id; LLUUID object_id;
msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, object_id); msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, object_id);
bool exists = (sObjectDetails.count(object_id) != 0); std::set<LLUUID>::iterator it = floater->mPendingObjects.find(object_id);
AObjectDetails* details = &sObjectDetails[object_id]; if(it != floater->mPendingObjects.end())
if (!exists || details->name == request_string) floater->mPendingObjects.erase(it);
{ //else if(floater->mCachedObjects.count(object_id)) //Let entries update.
// We cache unknown objects (to avoid having to request them later) // return;
// and requested objects.
if (exists && sRequested > 0) sRequested--; ObjectData* data = &floater->mCachedObjects[object_id];
msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_OwnerID, details->owner_id); // We cache unknown objects (to avoid having to request them later)
msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_GroupID, details->group_id); // and requested objects.
msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, details->name); msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_OwnerID, data->owner_id);
msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, details->desc); msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_GroupID, data->group_id);
gCacheName->get(details->owner_id, false, boost::bind(&JCFloaterAreaSearch::results)); msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, data->name);
gCacheName->get(details->group_id, true, boost::bind(&JCFloaterAreaSearch::results)); msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, data->desc);
//llinfos << "Got info for " << (exists ? "requested" : "unknown") << " object " << object_id << llendl; gCacheName->get(data->owner_id, false, boost::bind(&JCFloaterAreaSearch::results,floater));
} gCacheName->get(data->group_id, true, boost::bind(&JCFloaterAreaSearch::results,floater));
//llinfos << "Got info for " << (exists ? "requested" : "unknown") << " object " << object_id << llendl;
} }

View File

@@ -40,59 +40,53 @@ class LLTextBox;
class LLScrollListCtrl; class LLScrollListCtrl;
class LLViewerRegion; class LLViewerRegion;
struct AObjectDetails class JCFloaterAreaSearch : public LLFloater, public LLFloaterSingleton<JCFloaterAreaSearch>
{
LLUUID id;
std::string name;
std::string desc;
LLUUID owner_id;
LLUUID group_id;
};
class JCFloaterAreaSearch : public LLFloater
{ {
public: public:
JCFloaterAreaSearch(); JCFloaterAreaSearch(const LLSD& data);
virtual ~JCFloaterAreaSearch(); virtual ~JCFloaterAreaSearch();
/*virtual*/ BOOL postBuild(); /*virtual*/ BOOL postBuild();
/*virtual*/ void close(bool app = false); /*virtual*/ void close(bool app = false);
/*virtual*/ void onOpen();
static void results(); void results();
static void toggle();
static JCFloaterAreaSearch* getInstance() { return sInstance; }
static void processObjectPropertiesFamily(LLMessageSystem* msg, void** user_data); static void processObjectPropertiesFamily(LLMessageSystem* msg, void** user_data);
private: private:
static void checkRegion();
static void cancel(void* data);
static void search(void* data);
static void onCommitLine(LLLineEditor* line, void* user_data);
static void requestIfNeeded(LLViewerObject *objectp);
static void onDoubleClick(void *userdata);
enum OBJECT_COLUMN_ORDER enum OBJECT_COLUMN_ORDER
{ {
LIST_OBJECT_NAME, LIST_OBJECT_NAME = 0,
LIST_OBJECT_DESC, LIST_OBJECT_DESC,
LIST_OBJECT_OWNER, LIST_OBJECT_OWNER,
LIST_OBJECT_GROUP LIST_OBJECT_GROUP,
LIST_OBJECT_COUNT
}; };
static JCFloaterAreaSearch* sInstance; void checkRegion(bool force_clear = false);
void onStop();
static S32 sRequested; void onRefresh();
void onCommitLine(LLUICtrl* caller, const LLSD& value, OBJECT_COLUMN_ORDER type);
bool requestIfNeeded(LLUUID object_id);
void onDoubleClick();
LLTextBox* mCounterText; LLTextBox* mCounterText;
LLScrollListCtrl* mResultList; LLScrollListCtrl* mResultList;
LLFrameTimer mLastUpdateTimer; LLFrameTimer mLastUpdateTimer;
LLViewerRegion* mLastRegion;
bool mStopped;
static std::map<LLUUID, AObjectDetails> sObjectDetails; struct ObjectData
{
LLUUID id;
std::string name;
std::string desc;
LLUUID owner_id;
LLUUID group_id;
};
std::set<LLUUID> mPendingObjects;
std::map<LLUUID, ObjectData> mCachedObjects;
static std::string sSearchedName; std::string mFilterStrings[LIST_OBJECT_COUNT];
static std::string sSearchedDesc;
static std::string sSearchedOwner;
static std::string sSearchedGroup;
static LLViewerRegion* sLastRegion;
}; };

View File

@@ -41,7 +41,6 @@
#include "llfeaturemanager.h" #include "llfeaturemanager.h"
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
#include "lltexteditor.h" #include "lltexteditor.h"
#include "llalertdialog.h"
#include "llerrorcontrol.h" #include "llerrorcontrol.h"
#include "lleventtimer.h" #include "lleventtimer.h"
#include "llviewertexturelist.h" #include "llviewertexturelist.h"
@@ -55,6 +54,7 @@
#include "llmarketplacenotifications.h" #include "llmarketplacenotifications.h"
#include "llmd5.h" #include "llmd5.h"
#include "llmeshrepository.h" #include "llmeshrepository.h"
#include "llmodaldialog.h"
#include "llpumpio.h" #include "llpumpio.h"
#include "llimpanel.h" #include "llimpanel.h"
#include "llmimetypes.h" #include "llmimetypes.h"

View File

@@ -87,7 +87,7 @@ const F32 AGENT_TYPING_TIMEOUT = 5.f; // seconds
LLChatBar *gChatBar = NULL; LLChatBar *gChatBar = NULL;
// legacy calllback glue // legacy calllback glue
void toggleChatHistory(LLUICtrl*, const LLSD&); void toggleChatHistory();
//void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); //void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel);
// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.2a // [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.2a
void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel); void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel);
@@ -138,7 +138,7 @@ LLChatBar::~LLChatBar()
BOOL LLChatBar::postBuild() BOOL LLChatBar::postBuild()
{ {
if (LLUICtrl* history_ctrl = findChild<LLUICtrl>("History")) if (LLUICtrl* history_ctrl = findChild<LLUICtrl>("History"))
history_ctrl->setCommitCallback(toggleChatHistory); history_ctrl->setCommitCallback(boost::bind(&toggleChatHistory));
if (LLUICtrl* say_ctrl = getChild<LLUICtrl>("Say")) if (LLUICtrl* say_ctrl = getChild<LLUICtrl>("Say"))
say_ctrl->setCommitCallback(boost::bind(&LLChatBar::onClickSay, this, _1)); say_ctrl->setCommitCallback(boost::bind(&LLChatBar::onClickSay, this, _1));
@@ -149,8 +149,7 @@ BOOL LLChatBar::postBuild()
mInputEditor = findChild<LLLineEditor>("Chat Editor"); mInputEditor = findChild<LLLineEditor>("Chat Editor");
if (mInputEditor) if (mInputEditor)
{ {
mInputEditor->setCallbackUserData(this); mInputEditor->setKeystrokeCallback(boost::bind(&LLChatBar::onInputEditorKeystroke,this));
mInputEditor->setKeystrokeCallback(&onInputEditorKeystroke);
mInputEditor->setFocusLostCallback(boost::bind(&LLChatBar::onInputEditorFocusLost)); mInputEditor->setFocusLostCallback(boost::bind(&LLChatBar::onInputEditorFocusLost));
mInputEditor->setFocusReceivedCallback(boost::bind(&LLChatBar::onInputEditorGainFocus)); mInputEditor->setFocusReceivedCallback(boost::bind(&LLChatBar::onInputEditorGainFocus));
mInputEditor->setCommitOnFocusLost( FALSE ); mInputEditor->setCommitOnFocusLost( FALSE );
@@ -545,13 +544,10 @@ void LLChatBar::stopChat()
gSavedSettings.setBOOL("ChatVisible", FALSE); gSavedSettings.setBOOL("ChatVisible", FALSE);
} }
// static void LLChatBar::onInputEditorKeystroke()
void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata )
{ {
LLChatBar* self = (LLChatBar *)userdata;
LLWString raw_text; LLWString raw_text;
if (self->mInputEditor) raw_text = self->mInputEditor->getWText(); if (mInputEditor) raw_text = mInputEditor->getWText();
// Can't trim the end, because that will cause autocompletion // Can't trim the end, because that will cause autocompletion
// to eat trailing spaces that might be part of a gesture. // to eat trailing spaces that might be part of a gesture.
@@ -580,8 +576,8 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata )
// the selection will already be deleted, but we need to trim // the selection will already be deleted, but we need to trim
// off the character before // off the character before
std::string new_text = raw_text.substr(0, length-1); std::string new_text = raw_text.substr(0, length-1);
self->mInputEditor->setText( new_text ); mInputEditor->setText( new_text );
self->mInputEditor->setCursorToEnd(); mInputEditor->setCursorToEnd();
length = length - 1; length = length - 1;
} }
*/ */
@@ -600,15 +596,15 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata )
if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str)) if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str))
{ {
if (self->mInputEditor) if (mInputEditor)
{ {
std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size()); std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
self->mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part
S32 outlength = self->mInputEditor->getLength(); // in characters S32 outlength = mInputEditor->getLength(); // in characters
// Select to end of line, starting from the character // Select to end of line, starting from the character
// after the last one the user typed. // after the last one the user typed.
self->mInputEditor->setSelection(length, outlength); mInputEditor->setSelection(length, outlength);
} }
} }
@@ -890,7 +886,7 @@ void LLChatBar::onCommitGesture(LLUICtrl* ctrl)
} }
} }
void toggleChatHistory(LLUICtrl* ctrl, const LLSD&) void toggleChatHistory()
{ {
LLFloaterChat::toggleInstance(LLSD()); LLFloaterChat::toggleInstance(LLSD());
} }

View File

@@ -85,7 +85,7 @@ public:
void onClickSay(LLUICtrl* ctrl); void onClickSay(LLUICtrl* ctrl);
static void onTabClick( void* userdata ); static void onTabClick( void* userdata );
static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata); void onInputEditorKeystroke();
static void onInputEditorFocusLost(); static void onInputEditorFocusLost();
static void onInputEditorGainFocus(); static void onInputEditorGainFocus();

View File

@@ -53,37 +53,8 @@
static LLRegisterWidget<LLColorSwatchCtrl> r("color_swatch"); static LLRegisterWidget<LLColorSwatchCtrl> r("color_swatch");
LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const LLColor4& color, LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLColor4& color)
void (*commit_callback)(LLUICtrl* ctrl, void* userdata), : LLUICtrl(name, rect, TRUE, NULL, FOLLOWS_LEFT | FOLLOWS_TOP),
void* userdata )
: LLUICtrl(name, rect, TRUE, commit_callback, userdata, FOLLOWS_LEFT | FOLLOWS_TOP),
mValid( TRUE ),
mColor( color ),
mBorderColor( gColors.getColor("DefaultHighlightLight") ),
mCanApplyImmediately(FALSE),
mOnCancelCallback(NULL),
mOnSelectCallback(NULL)
{
mCaption = new LLTextBox( name,
LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ),
name,
LLFontGL::getFontSansSerifSmall() );
mCaption->setFollows( FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM );
addChild( mCaption );
// Scalable UI made this off-by-one, I don't know why. JC
LLRect border_rect(0, getRect().getHeight()-1, getRect().getWidth()-1, 0);
border_rect.mBottom += BTN_HEIGHT_SMALL;
mBorder = new LLViewBorder(std::string("border"), border_rect, LLViewBorder::BEVEL_IN);
addChild(mBorder);
mAlphaGradientImage = LLUI::getUIImage("color_swatch_alpha.tga");
}
LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLColor4& color,
void (*commit_callback)(LLUICtrl* ctrl, void* userdata),
void* userdata )
: LLUICtrl(name, rect, TRUE, commit_callback, userdata, FOLLOWS_LEFT | FOLLOWS_TOP),
mValid( TRUE ), mValid( TRUE ),
mColor( color ), mColor( color ),
mBorderColor( gColors.getColor("DefaultHighlightLight") ), mBorderColor( gColors.getColor("DefaultHighlightLight") ),
@@ -217,26 +188,34 @@ void LLColorSwatchCtrl::draw()
// Check state // Check state
if ( mValid ) if ( mValid )
{ {
// Draw the color swatch if (!mColor.isOpaque())
gl_rect_2d_checkerboard( calcScreenRect(), interior );
gl_rect_2d(interior, mColor, TRUE);
LLColor4 opaque_color = mColor;
opaque_color.mV[VALPHA] = 1.f;
gGL.color4fv(opaque_color.mV);
if (mAlphaGradientImage.notNull())
{ {
gGL.pushMatrix(); gl_rect_2d_checkerboard( calcScreenRect(), interior );
// Draw the color swatch
}
gl_rect_2d(interior, mColor, TRUE);
if (!mColor.isOpaque())
{
LLColor4 opaque_color = mColor;
opaque_color.mV[VALPHA] = 1.f;
gGL.color4fv(opaque_color.mV);
if (mAlphaGradientImage.notNull())
{ {
mAlphaGradientImage->draw(interior, mColor); gGL.pushMatrix();
{
mAlphaGradientImage->draw(interior, mColor);
}
gGL.popMatrix();
} }
gGL.popMatrix();
} }
} }
else else
{ {
if (!mFallbackImageName.empty()) if (!mFallbackImageName.empty())
{ {
LLPointer<LLViewerFetchedTexture> fallback_image = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName); LLPointer<LLViewerFetchedTexture> fallback_image = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName, TRUE,
LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
if( fallback_image->getComponents() == 4 ) if( fallback_image->getComponents() == 4 )
{ {
gl_rect_2d_checkerboard( calcScreenRect(), interior ); gl_rect_2d_checkerboard( calcScreenRect(), interior );
@@ -388,8 +367,6 @@ LLView* LLColorSwatchCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFa
BOOL can_apply_immediately = FALSE; BOOL can_apply_immediately = FALSE;
node->getAttributeBOOL("can_apply_immediately", can_apply_immediately); node->getAttributeBOOL("can_apply_immediately", can_apply_immediately);
LLUICtrlCallback callback = NULL;
if (label.empty()) if (label.empty())
{ {
label.assign(node->getValue()); label.assign(node->getValue());
@@ -399,9 +376,7 @@ LLView* LLColorSwatchCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFa
name, name,
rect, rect,
label, label,
color, color );
callback,
NULL );
color_swatch->setCanApplyImmediately(can_apply_immediately); color_swatch->setCanApplyImmediately(can_apply_immediately);
color_swatch->initFromXML(node, parent); color_swatch->initFromXML(node, parent);

View File

@@ -56,12 +56,7 @@ public:
COLOR_CANCEL COLOR_CANCEL
} EColorPickOp; } EColorPickOp;
LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const LLColor4& color, LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLColor4& color);
void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata),
void* callback_userdata);
LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLColor4& color,
void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata),
void* callback_userdata);
~LLColorSwatchCtrl (); ~LLColorSwatchCtrl ();

View File

@@ -113,7 +113,7 @@ public:
bool considerUpdateCurrency(); bool considerUpdateCurrency();
// return true if update needed // return true if update needed
void currencyKey(S32); void currencyKey(S32);
static void onCurrencyKey(LLLineEditor* caller, void* data); void onCurrencyKey(LLLineEditor* caller);
void prepare(); void prepare();
void updateUI(); void updateUI();
@@ -337,13 +337,9 @@ void LLCurrencyUIManager::Impl::currencyKey(S32 value)
mCurrencyChanged = true; mCurrencyChanged = true;
} }
// static void LLCurrencyUIManager::Impl::onCurrencyKey(LLLineEditor* caller)
void LLCurrencyUIManager::Impl::onCurrencyKey(
LLLineEditor* caller, void* data)
{ {
S32 value = atoi(caller->getText().c_str()); currencyKey(caller->getValue().asInteger());
LLCurrencyUIManager::Impl* self = (LLCurrencyUIManager::Impl*)data;
self->currencyKey(value);
} }
void LLCurrencyUIManager::Impl::prepare() void LLCurrencyUIManager::Impl::prepare()
@@ -352,8 +348,7 @@ void LLCurrencyUIManager::Impl::prepare()
if (lindenAmount) if (lindenAmount)
{ {
lindenAmount->setPrevalidate(LLLineEditor::prevalidateNonNegativeS32); lindenAmount->setPrevalidate(LLLineEditor::prevalidateNonNegativeS32);
lindenAmount->setKeystrokeCallback(onCurrencyKey); lindenAmount->setKeystrokeCallback(boost::bind(&LLCurrencyUIManager::Impl::onCurrencyKey,this,_1));
lindenAmount->setCallbackUserData(this);
} }
} }

View File

@@ -56,25 +56,25 @@ LLDebugVarMessageBox::LLDebugVarMessageBox(const std::string& title, EDebugVarTy
switch(var_type) switch(var_type)
{ {
case VAR_TYPE_F32: case VAR_TYPE_F32:
mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,130,190,110), title, NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, *((F32*)var), -100.f, 100.f, 0.1f, LLStringUtil::null); mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,130,190,110), title, NULL, 70, 130, TRUE, TRUE, FALSE, NULL, *((F32*)var), -100.f, 100.f, 0.1f, LLStringUtil::null);
mSlider1->setPrecision(3); mSlider1->setPrecision(3);
addChild(mSlider1); addChild(mSlider1);
mSlider2 = NULL; mSlider2 = NULL;
mSlider3 = NULL; mSlider3 = NULL;
break; break;
case VAR_TYPE_S32: case VAR_TYPE_S32:
mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,100,190,80), title, NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, (F32)*((S32*)var), -255.f, 255.f, 1.f, LLStringUtil::null); mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,100,190,80), title, NULL, 70, 130, TRUE, TRUE, FALSE, NULL, (F32)*((S32*)var), -255.f, 255.f, 1.f, LLStringUtil::null);
mSlider1->setPrecision(0); mSlider1->setPrecision(0);
addChild(mSlider1); addChild(mSlider1);
mSlider2 = NULL; mSlider2 = NULL;
mSlider3 = NULL; mSlider3 = NULL;
break; break;
case VAR_TYPE_VEC3: case VAR_TYPE_VEC3:
mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,130,190,110), std::string("x: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, ((LLVector3*)var)->mV[VX], -100.f, 100.f, 0.1f, LLStringUtil::null); mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,130,190,110), std::string("x: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, ((LLVector3*)var)->mV[VX], -100.f, 100.f, 0.1f, LLStringUtil::null);
mSlider1->setPrecision(3); mSlider1->setPrecision(3);
mSlider2 = new LLSliderCtrl(std::string("slider 2"), LLRect(20,100,190,80), std::string("y: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, ((LLVector3*)var)->mV[VY], -100.f, 100.f, 0.1f, LLStringUtil::null); mSlider2 = new LLSliderCtrl(std::string("slider 2"), LLRect(20,100,190,80), std::string("y: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, ((LLVector3*)var)->mV[VY], -100.f, 100.f, 0.1f, LLStringUtil::null);
mSlider2->setPrecision(3); mSlider2->setPrecision(3);
mSlider3 = new LLSliderCtrl(std::string("slider 3"), LLRect(20,70,190,50), std::string("z: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, ((LLVector3*)var)->mV[VZ], -100.f, 100.f, 0.1f, LLStringUtil::null); mSlider3 = new LLSliderCtrl(std::string("slider 3"), LLRect(20,70,190,50), std::string("z: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, ((LLVector3*)var)->mV[VZ], -100.f, 100.f, 0.1f, LLStringUtil::null);
mSlider3->setPrecision(3); mSlider3->setPrecision(3);
addChild(mSlider1); addChild(mSlider1);
addChild(mSlider2); addChild(mSlider2);
@@ -85,7 +85,7 @@ LLDebugVarMessageBox::LLDebugVarMessageBox(const std::string& title, EDebugVarTy
break; break;
} }
mAnimateButton = new LLButton(std::string("Animate"), LLRect(20, 45, 180, 25), LLStringUtil::null, onAnimateClicked, this); mAnimateButton = new LLButton(std::string("Animate"), LLRect(20, 45, 180, 25), LLStringUtil::null, boost::bind(&LLDebugVarMessageBox::onAnimateClicked, this));
addChild(mAnimateButton); addChild(mAnimateButton);
mText = new LLTextBox(std::string("value"), LLRect(20,20,190,0)); mText = new LLTextBox(std::string("value"), LLRect(20,20,190,0));
@@ -113,7 +113,6 @@ void LLDebugVarMessageBox::show(const std::string& title, F32 *var, F32 max_valu
box->mSlider1->setValue(*var); box->mSlider1->setValue(*var);
} }
box->mSlider1->setCommitCallback(boost::bind(&LLDebugVarMessageBox::slider_changed,_1,box)); box->mSlider1->setCommitCallback(boost::bind(&LLDebugVarMessageBox::slider_changed,_1,box));
box->mSlider1->setCallbackUserData(box);
#endif #endif
} }
@@ -200,11 +199,10 @@ void LLDebugVarMessageBox::slider_changed(LLUICtrl* ctrl, void* user_data)
} }
} }
void LLDebugVarMessageBox::onAnimateClicked(void* user_data) void LLDebugVarMessageBox::onAnimateClicked()
{ {
LLDebugVarMessageBox* msg_boxp = (LLDebugVarMessageBox*)user_data; mAnimate = !mAnimate;
msg_boxp->mAnimate = !msg_boxp->mAnimate; mAnimateButton->setToggleState(mAnimate);
msg_boxp->mAnimateButton->setToggleState(msg_boxp->mAnimate);
} }
void LLDebugVarMessageBox::onClose(bool app_quitting) void LLDebugVarMessageBox::onClose(bool app_quitting)

View File

@@ -67,7 +67,7 @@ protected:
static LLDebugVarMessageBox* show(const std::string& title, EDebugVarType var_type, void *var); static LLDebugVarMessageBox* show(const std::string& title, EDebugVarType var_type, void *var);
static void slider_changed(LLUICtrl* ctrl, void* user_data); static void slider_changed(LLUICtrl* ctrl, void* user_data);
static void onAnimateClicked(void* user_data); void onAnimateClicked();
public: public:
static void show(const std::string& title, F32 *var, F32 max_value = 100.f, F32 increment = 0.1f); static void show(const std::string& title, F32 *var, F32 max_value = 100.f, F32 increment = 0.1f);

View File

@@ -265,10 +265,9 @@ BOOL LLFloaterAnimPreview::postBuild()
mPlayButton = getChild<LLButton>( "play_btn"); mPlayButton = getChild<LLButton>( "play_btn");
if (!mPlayButton) if (!mPlayButton)
{ {
mPlayButton = new LLButton(std::string("play_btn"), LLRect(0,0,0,0)); mPlayButton = new LLButton("play_btn");
} }
mPlayButton->setClickedCallback(boost::bind(&LLFloaterAnimPreview::onBtnPlay,this)); mPlayButton->setClickedCallback(boost::bind(&LLFloaterAnimPreview::onBtnPlay,this));
mPlayButton->setImages(std::string("button_anim_play.tga"), mPlayButton->setImages(std::string("button_anim_play.tga"),
std::string("button_anim_play_selected.tga")); std::string("button_anim_play_selected.tga"));
@@ -280,10 +279,9 @@ BOOL LLFloaterAnimPreview::postBuild()
mStopButton = getChild<LLButton>( "stop_btn"); mStopButton = getChild<LLButton>( "stop_btn");
if (!mStopButton) if (!mStopButton)
{ {
mStopButton = new LLButton(std::string("stop_btn"), LLRect(0,0,0,0)); mStopButton = new LLButton("stop_btn");
} }
mStopButton->setClickedCallback(boost::bind(&LLFloaterAnimPreview::onBtnStop, this)); mStopButton->setClickedCallback(boost::bind(&LLFloaterAnimPreview::onBtnStop, this));
mStopButton->setImages(std::string("button_anim_stop.tga"), mStopButton->setImages(std::string("button_anim_stop.tga"),
std::string("button_anim_stop_selected.tga")); std::string("button_anim_stop_selected.tga"));
@@ -748,16 +746,15 @@ void LLFloaterAnimPreview::onMouseCaptureLost()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// onBtnPlay() // onBtnPlay()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onBtnPlay(void* user_data) void LLFloaterAnimPreview::onBtnPlay()
{ {
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; if (!getEnabled())
if (!previewp->getEnabled())
return; return;
if (previewp->mMotionID.notNull()) if (mMotionID.notNull())
{ {
LLVOAvatar* avatarp; LLVOAvatar* avatarp;
if (previewp->mInWorld) if (mInWorld)
{ {
if (!gAgentAvatarp) if (!gAgentAvatarp)
{ {
@@ -767,27 +764,27 @@ void LLFloaterAnimPreview::onBtnPlay(void* user_data)
} }
else else
{ {
if (!previewp->mAnimPreview) if (!mAnimPreview)
{ {
return; return;
} }
avatarp = previewp->mAnimPreview->getDummyAvatar(); avatarp = mAnimPreview->getDummyAvatar();
} }
if(!avatarp->isMotionActive(previewp->mMotionID)) if(!avatarp->isMotionActive(mMotionID))
{ {
previewp->resetMotion(); resetMotion();
previewp->mPauseRequest = NULL; mPauseRequest = NULL;
} }
else else
{ {
if (avatarp->areAnimationsPaused()) if (avatarp->areAnimationsPaused())
{ {
previewp->mPauseRequest = NULL; mPauseRequest = NULL;
} }
else else
{ {
previewp->mPauseRequest = avatarp->requestPause(); mPauseRequest = avatarp->requestPause();
} }
} }
} }
@@ -796,16 +793,15 @@ void LLFloaterAnimPreview::onBtnPlay(void* user_data)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// onBtnStop() // onBtnStop()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onBtnStop(void* user_data) void LLFloaterAnimPreview::onBtnStop()
{ {
LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; if (!getEnabled())
if (!previewp->getEnabled())
return; return;
if (previewp->mMotionID.notNull()) if (mMotionID.notNull())
{ {
LLVOAvatar* avatarp; LLVOAvatar* avatarp;
if (previewp->mInWorld) if (mInWorld)
{ {
if (!gAgentAvatarp) if (!gAgentAvatarp)
{ {
@@ -815,14 +811,14 @@ void LLFloaterAnimPreview::onBtnStop(void* user_data)
} }
else else
{ {
if (!previewp->mAnimPreview) if (!mAnimPreview)
{ {
return; return;
} }
avatarp = previewp->mAnimPreview->getDummyAvatar(); avatarp = mAnimPreview->getDummyAvatar();
} }
previewp->resetMotion(); resetMotion();
previewp->mPauseRequest = avatarp->requestPause(); mPauseRequest = avatarp->requestPause();
} }
} }

View File

@@ -90,8 +90,8 @@ public:
void refresh(); void refresh();
static void onBtnPlay(void*); void onBtnPlay();
static void onBtnStop(void*); void onBtnStop();
static void setUploadAmount(S32 amount) { sUploadAmount = amount; } static void setUploadAmount(S32 amount) { sUploadAmount = amount; }
static void onSliderMove(LLUICtrl*, void*); static void onSliderMove(LLUICtrl*, void*);
static void onCommitBaseAnim(LLUICtrl*, void*); static void onCommitBaseAnim(LLUICtrl*, void*);

View File

@@ -92,8 +92,8 @@ LLFloaterAvatarPicker::LLFloaterAvatarPicker() :
BOOL LLFloaterAvatarPicker::postBuild() BOOL LLFloaterAvatarPicker::postBuild()
{ {
childSetKeystrokeCallback("Edit", &LLFloaterAvatarPicker::editKeystroke, (void*)this); getChild<LLLineEditor>("Edit")->setKeystrokeCallback(boost::bind(&LLFloaterAvatarPicker::editKeystroke,this,_1));
childSetKeystrokeCallback("EditUUID", &LLFloaterAvatarPicker::editKeystroke, (void*)this); getChild<LLLineEditor>("EditUUID")->setKeystrokeCallback(boost::bind(&LLFloaterAvatarPicker::editKeystroke, this,_1));
childSetAction("Find", boost::bind(&LLFloaterAvatarPicker::onBtnFind, this)); childSetAction("Find", boost::bind(&LLFloaterAvatarPicker::onBtnFind, this));
getChildView("Find")->setEnabled(FALSE); getChildView("Find")->setEnabled(FALSE);
@@ -716,14 +716,12 @@ void LLFloaterAvatarPicker::processResponse(const LLUUID& query_id, const LLSD&
search_results->setFocus(TRUE); search_results->setFocus(TRUE);
} }
//static void LLFloaterAvatarPicker::editKeystroke(LLLineEditor* caller)
void LLFloaterAvatarPicker::editKeystroke(LLLineEditor* caller, void* user_data)
{ {
LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)user_data;
if(caller->getName() == "Edit") if(caller->getName() == "Edit")
self->getChildView("Find")->setEnabled(caller->getText().size() >= 3); getChildView("Find")->setEnabled(caller->getText().size() >= 3);
else else
self->childSetEnabled("Select", caller->getValue().asUUID().notNull()); childSetEnabled("Select", caller->getValue().asUUID().notNull());
} }
// virtual // virtual

View File

@@ -65,7 +65,7 @@ public:
void openFriendsTab(); void openFriendsTab();
private: private:
static void editKeystroke(class LLLineEditor* caller, void* user_data); void editKeystroke(class LLLineEditor* caller);
void onBtnFind(); void onBtnFind();
void onBtnSelect(); void onBtnSelect();

View File

@@ -41,7 +41,6 @@
#include "llfloaterbuy.h" #include "llfloaterbuy.h"
#include "llagent.h" // for agent id #include "llagent.h" // for agent id
#include "llalertdialog.h"
#include "llinventorymodel.h" // for gInventory #include "llinventorymodel.h" // for gInventory
#include "llinventorydefines.h" #include "llinventorydefines.h"
#include "llinventoryicon.h" #include "llinventoryicon.h"

View File

@@ -44,7 +44,7 @@
LLFloaterEditUI* LLFloaterEditUI::sInstance = NULL; LLFloaterEditUI* LLFloaterEditUI::sInstance = NULL;
void LLFloaterEditUI::navigateHierarchyButtonPressed(void* data) void LLFloaterEditUI::navigateHierarchyButtonPressed(S32 i)
{ {
LLView* view = LLView::sEditingUIView; LLView* view = LLView::sEditingUIView;
if( !view ) return; if( !view ) return;
@@ -62,7 +62,7 @@ void LLFloaterEditUI::navigateHierarchyButtonPressed(void* data)
for(idx = 0,itor = parentChildren->begin();itor!=parentChildren->end();itor++,idx++){ for(idx = 0,itor = parentChildren->begin();itor!=parentChildren->end();itor++,idx++){
if((*itor)==view)break; if((*itor)==view)break;
} }
switch((intptr_t)data) switch(i)
{ {
case 0 ://up case 0 ://up
view = view->getParent(); view = view->getParent();
@@ -142,10 +142,7 @@ LLFloaterEditUI::LLFloaterEditUI()
LLStringUtil::null, LLStringUtil::null,
NULL, NULL,
254, 254,
onCommitLabel, boost::bind(&LLFloaterEditUI::onCommitLabel,_1));
NULL,
NULL,
this);
addChild(line); addChild(line);
mLabelLine = line; mLabelLine = line;
@@ -154,8 +151,7 @@ LLFloaterEditUI::LLFloaterEditUI()
spin = new LLSpinCtrl(std::string("height_spin"), LLRect(x, y+20, x+100, y), spin = new LLSpinCtrl(std::string("height_spin"), LLRect(x, y+20, x+100, y),
std::string("Height:"), LLFontGL::getFontSansSerifSmall(), std::string("Height:"), LLFontGL::getFontSansSerifSmall(),
onCommitHeight, boost::bind(&LLFloaterEditUI::onCommitHeight,_1),
this,
0.f, 0.f,
2.f, 2.f,
1000.f, 1000.f,
@@ -168,8 +164,7 @@ LLFloaterEditUI::LLFloaterEditUI()
spin = new LLSpinCtrl(std::string("width_spin"), LLRect(x, y+20, x+100, y), spin = new LLSpinCtrl(std::string("width_spin"), LLRect(x, y+20, x+100, y),
std::string("Width:"), LLFontGL::getFontSansSerifSmall(), std::string("Width:"), LLFontGL::getFontSansSerifSmall(),
onCommitWidth, boost::bind(&LLFloaterEditUI::onCommitHeight,_1),
this,
0.f, 0.f,
2.f, 2.f,
1000.f, 1000.f,
@@ -190,28 +185,22 @@ LLFloaterEditUI::LLFloaterEditUI()
y -= VPAD + 20; y -= VPAD + 20;
x += 40; x += 40;
button = new LLButton(std::string("up"),LLRect(x, y+16, x+32, y)); button = new LLButton(std::string("up"),LLRect(x, y+16, x+32, y), std::string(), boost::bind(LLFloaterEditUI::navigateHierarchyButtonPressed,0));
addChild(button); addChild(button);
x -= 40; x -= 40;
y -= VPAD + 20; y -= VPAD + 20;
button = new LLButton(std::string("<<"),LLRect(x, y+16, x+32, y)); button = new LLButton(std::string("<<"),LLRect(x, y+16, x+32, y), std::string(), boost::bind(LLFloaterEditUI::navigateHierarchyButtonPressed,2));
addChild(button); addChild(button);
x += 40; x += 40;
button = new LLButton(std::string("rfrsh"),LLRect(x, y+16, x+32, y)); button = new LLButton(std::string("rfrsh"),LLRect(x, y+16, x+32, y), std::string(), boost::bind(LLFloaterEditUI::navigateHierarchyButtonPressed,4));
addChild(button); addChild(button);
x += 40; x += 40;
button = new LLButton(std::string(">>"),LLRect(x, y+16, x+32, y)); button = new LLButton(std::string(">>"),LLRect(x, y+16, x+32, y), std::string(), boost::bind(LLFloaterEditUI::navigateHierarchyButtonPressed,3));
addChild(button); addChild(button);
x -= 40; x -= 40;
y -= VPAD + 20; y -= VPAD + 20;
button = new LLButton(std::string("dn"),LLRect(x, y+16, x+32, y)); button = new LLButton(std::string("dn"),LLRect(x, y+16, x+32, y), std::string(), boost::bind(LLFloaterEditUI::navigateHierarchyButtonPressed,1));
addChild(button); addChild(button);
childSetAction("up",navigateHierarchyButtonPressed,(void*)0);
childSetAction("dn",navigateHierarchyButtonPressed,(void*)1);
childSetAction("<<",navigateHierarchyButtonPressed,(void*)2);
childSetAction(">>",navigateHierarchyButtonPressed,(void*)3);
childSetAction("rfrsh",navigateHierarchyButtonPressed,(void*)4);
sInstance = this; sInstance = this;
} }
@@ -380,7 +369,7 @@ BOOL LLFloaterEditUI::processKeystroke(KEY key, MASK mask)
} }
// static // static
void LLFloaterEditUI::onCommitLabel(LLUICtrl* ctrl, void* data) void LLFloaterEditUI::onCommitLabel(LLUICtrl* ctrl)
{ {
LLView* view = LLView::sEditingUIView; LLView* view = LLView::sEditingUIView;
if (!view) return; if (!view) return;
@@ -396,7 +385,7 @@ void LLFloaterEditUI::onCommitLabel(LLUICtrl* ctrl, void* data)
} }
// static // static
void LLFloaterEditUI::onCommitHeight(LLUICtrl* ctrl, void* data) void LLFloaterEditUI::onCommitHeight(LLUICtrl* ctrl)
{ {
LLView* view = LLView::sEditingUIView; LLView* view = LLView::sEditingUIView;
if (!view) return; if (!view) return;
@@ -410,7 +399,7 @@ void LLFloaterEditUI::onCommitHeight(LLUICtrl* ctrl, void* data)
} }
// static // static
void LLFloaterEditUI::onCommitWidth(LLUICtrl* ctrl, void* data) void LLFloaterEditUI::onCommitWidth(LLUICtrl* ctrl)
{ {
LLView* view = LLView::sEditingUIView; LLView* view = LLView::sEditingUIView;
if (!view) return; if (!view) return;

View File

@@ -51,14 +51,14 @@ public:
void refreshView(LLView* view); void refreshView(LLView* view);
void refreshButton(LLView* view); void refreshButton(LLView* view);
static void navigateHierarchyButtonPressed(void* data); static void navigateHierarchyButtonPressed(S32 i);
static void show(void* unused = NULL); static void show(void* unused = NULL);
static BOOL processKeystroke(KEY key, MASK mask); static BOOL processKeystroke(KEY key, MASK mask);
static void onCommitLabel(LLUICtrl* ctrl, void* data); static void onCommitLabel(LLUICtrl* ctrl);
static void onCommitHeight(LLUICtrl* ctrl, void* data); static void onCommitHeight(LLUICtrl* ctrl);
static void onCommitWidth(LLUICtrl* ctrl, void* data); static void onCommitWidth(LLUICtrl* ctrl);
protected: protected:
LLView* mLastView; LLView* mLastView;

View File

@@ -49,6 +49,7 @@
#include "llfloateravatarpicker.h" #include "llfloateravatarpicker.h"
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "llbutton.h" #include "llbutton.h"
#include "llfiltereditor.h"
#include "llfloateravatarinfo.h" #include "llfloateravatarinfo.h"
#include "llinventorymodel.h" #include "llinventorymodel.h"
#include "llnamelistctrl.h" #include "llnamelistctrl.h"
@@ -353,14 +354,9 @@ void LLPanelFriends::filterContacts(const std::string& search_name)
mLastContactSearch = search_name; mLastContactSearch = search_name;
} }
//static void LLPanelFriends::onContactFilterEdit(const std::string& search_string)
void LLPanelFriends::onContactSearchEdit(const std::string& search_string, void* user_data)
{ {
LLPanelFriends* panelp = (LLPanelFriends*)user_data; filterContacts(search_string);
if (panelp)
{
panelp->filterContacts(search_string);
}
} }
/*void LLPanelFriends::onChangeContactGroup(LLUICtrl* ctrl, void* user_data) /*void LLPanelFriends::onChangeContactGroup(LLUICtrl* ctrl, void* user_data)
@@ -387,10 +383,10 @@ BOOL LLPanelFriends::postBuild()
// <dogmode> // <dogmode>
// Contact search and group system. // Contact search and group system.
// 09/05/2010 - Charley Levenque // 09/05/2010 - Charley Levenque
LLSearchEditor* contact = getChild<LLSearchEditor>("buddy_search_lineedit"); LLFilterEditor* contact = getChild<LLFilterEditor>("buddy_search_lineedit");
if (contact) if (contact)
{ {
contact->setSearchCallback(&onContactSearchEdit, this); contact->setCommitCallback(boost::bind(&LLPanelFriends::onContactFilterEdit, this, _2));
} }
getChild<LLTextBox>("s_num")->setValue("0"); getChild<LLTextBox>("s_num")->setValue("0");

View File

@@ -133,7 +133,7 @@ private:
static bool callbackAddFriend(const LLSD& notification, const LLSD& response); static bool callbackAddFriend(const LLSD& notification, const LLSD& response);
static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response);
static void onPickAvatar(const uuid_vec_t& ids, const std::vector<LLAvatarName>& names ); static void onPickAvatar(const uuid_vec_t& ids, const std::vector<LLAvatarName>& names );
static void onContactSearchEdit(const std::string& search_string, void* user_data); void onContactFilterEdit(const std::string& search_string);
static void onClickIM(void* user_data); static void onClickIM(void* user_data);
static void onClickAssign(void* user_data); static void onClickAssign(void* user_data);
static void onClickExpand(void* user_data); static void onClickExpand(void* user_data);

View File

@@ -40,7 +40,6 @@
#include "message.h" #include "message.h"
#include "llagent.h" #include "llagent.h"
#include "llalertdialog.h"
#include "llbutton.h" #include "llbutton.h"
#include "llcheckboxctrl.h" #include "llcheckboxctrl.h"
#include "llcombobox.h" #include "llcombobox.h"
@@ -448,9 +447,10 @@ LLPanelRegionTools::LLPanelRegionTools(const std::string& title)
BOOL LLPanelRegionTools::postBuild() BOOL LLPanelRegionTools::postBuild()
{ {
getChild<LLUICtrl>("region name")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); LLLineEditor* region_name = getChild<LLLineEditor>("region name");
childSetKeystrokeCallback("region name", onChangeSimName, this); region_name->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this));
childSetPrevalidate("region name", &LLLineEditor::prevalidatePrintableNotPipe); region_name->setKeystrokeCallback(boost::bind(&LLPanelRegionTools::onChangeSimName, this));
region_name->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe);
getChild<LLUICtrl>("check prelude")->setCommitCallback(boost::bind(&LLPanelRegionTools:: onChangePrelude, this)); getChild<LLUICtrl>("check prelude")->setCommitCallback(boost::bind(&LLPanelRegionTools:: onChangePrelude, this));
getChild<LLUICtrl>("check fixed sun")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); getChild<LLUICtrl>("check fixed sun")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this));
@@ -470,36 +470,42 @@ BOOL LLPanelRegionTools::postBuild()
childSetAction("Revert Terrain", boost::bind(&LLPanelRegionTools::onRevertTerrain, this)); childSetAction("Revert Terrain", boost::bind(&LLPanelRegionTools::onRevertTerrain, this));
childSetAction("Swap Terrain", boost::bind(&LLPanelRegionTools::onSwapTerrain, this)); childSetAction("Swap Terrain", boost::bind(&LLPanelRegionTools::onSwapTerrain, this));
getChild<LLUICtrl>("estate")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); LLLineEditor* estate = getChild<LLLineEditor>("estate name");
childSetPrevalidate("estate", &LLLineEditor::prevalidatePositiveS32); estate->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this));
estate->setPrevalidate(&LLLineEditor::prevalidatePositiveS32);
getChild<LLUICtrl>("parentestate")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); LLLineEditor* parentestate = getChild<LLLineEditor>("parentestate");
childSetPrevalidate("parentestate", &LLLineEditor::prevalidatePositiveS32); parentestate->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this));
childDisable("parentestate"); parentestate->setPrevalidate(&LLLineEditor::prevalidatePositiveS32);
parentestate->setEnabled(false);
getChild<LLUICtrl>("gridposx")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); LLLineEditor* gridposx = getChild<LLLineEditor>("gridposx");
childSetPrevalidate("gridposx", &LLLineEditor::prevalidatePositiveS32); gridposx->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this));
childDisable("gridposx"); gridposx->setPrevalidate(&LLLineEditor::prevalidatePositiveS32);
gridposx->setEnabled(false);
getChild<LLUICtrl>("gridposy")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); LLLineEditor* gridposy = getChild<LLLineEditor>("gridposy");
childSetPrevalidate("gridposy", &LLLineEditor::prevalidatePositiveS32); gridposy->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this));
childDisable("gridposy"); gridposy->setPrevalidate(&LLLineEditor::prevalidatePositiveS32);
gridposy->setEnabled(false);
getChild<LLUICtrl>("redirectx")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); LLLineEditor* redirectx = getChild<LLLineEditor>("redirectx");
childSetPrevalidate("redirectx", &LLLineEditor::prevalidatePositiveS32); redirectx->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this));
redirectx->setPrevalidate(&LLLineEditor::prevalidatePositiveS32);
getChild<LLUICtrl>("redirecty")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); LLLineEditor* redirecty = getChild<LLLineEditor>("redirecty");
childSetPrevalidate("redirecty", &LLLineEditor::prevalidatePositiveS32); redirecty->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this));
redirecty->setPrevalidate(&LLLineEditor::prevalidatePositiveS32);
getChild<LLUICtrl>("billable factor")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); getChild<LLUICtrl>("billable factor")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this));
getChild<LLUICtrl>("land cost")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); getChild<LLUICtrl>("land cost")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this));
childSetAction("Refresh", boost::bind(&LLPanelRegionTools::onRefresh, this)); getChild<LLButton>("Refresh")->setClickedCallback(boost::bind(&LLPanelRegionTools::onRefresh, this));
childSetAction("Apply", boost::bind(&LLPanelRegionTools::onApplyChanges, this)); getChild<LLButton>("Apply")->setClickedCallback(boost::bind(&LLPanelRegionTools::onApplyChanges, this));
childSetAction("Select Region", boost::bind(&LLPanelRegionTools::onSelectRegion, this)); getChild<LLButton>("Select Region")->setClickedCallback(boost::bind(&LLPanelRegionTools::onSelectRegion, this));
childSetAction("Autosave now", boost::bind(onSaveState, this)); getChild<LLButton>("Autosave now")->setClickedCallback(boost::bind(&LLPanelRegionTools::onSaveState,(void*)NULL));
return TRUE; return TRUE;
} }
@@ -586,7 +592,8 @@ void LLPanelRegionTools::enableAllWidgets()
getChildView("Autosave now")->setEnabled(TRUE); getChildView("Autosave now")->setEnabled(TRUE);
} }
void LLPanelRegionTools::onSaveState(void* userdata) //static
void LLPanelRegionTools::onSaveState(void*)
{ {
if (gAgent.isGodlike()) if (gAgent.isGodlike())
{ {
@@ -820,13 +827,11 @@ void LLPanelRegionTools::onChangePrelude()
onChangeAnything(); onChangeAnything();
} }
// static void LLPanelRegionTools::onChangeSimName()
void LLPanelRegionTools::onChangeSimName(LLLineEditor* caller, void* userdata )
{ {
if (userdata && gAgent.isGodlike()) if ( gAgent.isGodlike())
{ {
LLPanelRegionTools* region_tools = (LLPanelRegionTools*) userdata; getChildView("Apply")->setEnabled(TRUE);
region_tools->getChildView("Apply")->setEnabled(TRUE);
} }
} }

View File

@@ -135,8 +135,8 @@ public:
/*virtual*/ void refresh(); /*virtual*/ void refresh();
static void onSaveState(void* userdata); static void onSaveState(void*);
static void onChangeSimName(LLLineEditor* caller, void* userdata); void onChangeSimName();
void onChangeAnything(); void onChangeAnything();
void onChangePrelude(); void onChangePrelude();

View File

@@ -114,6 +114,10 @@ LLFloaterGroupInfo::LLFloaterGroupInfo(const std::string& name, const LLRect &re
: LLFloater(name, rect, title), : LLFloater(name, rect, title),
mGroupID( group_id ) mGroupID( group_id )
{ {
llinfos << name << " : " << title << llendl;
llinfos << rect << llendl;
llinfos << getRect() << llendl;
llinfos << getLocalRect() << llendl;
// Construct the filename of the group panel xml definition file. // Construct the filename of the group panel xml definition file.
mPanelGroupp = new LLPanelGroup("panel_group.xml", mPanelGroupp = new LLPanelGroup("panel_group.xml",
"PanelGroup", "PanelGroup",

View File

@@ -51,7 +51,6 @@
#include "llfloatergroupinfo.h" #include "llfloatergroupinfo.h"
#include "llfloaterdirectory.h" #include "llfloaterdirectory.h"
#include "llfocusmgr.h" #include "llfocusmgr.h"
#include "llalertdialog.h"
#include "llselectmgr.h" #include "llselectmgr.h"
#include "llscrolllistctrl.h" #include "llscrolllistctrl.h"
#include "llnotificationsutil.h" #include "llnotificationsutil.h"

View File

@@ -37,7 +37,6 @@
// Viewer libs // Viewer libs
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llmediactrl.h" #include "llmediactrl.h"
#include "llalertdialog.h"
// Linden libs // Linden libs
#include "llnotificationsutil.h" #include "llnotificationsutil.h"

View File

@@ -721,6 +721,8 @@ BOOL LLImagePreviewAvatar::render()
mNeedsUpdate = FALSE; mNeedsUpdate = FALSE;
LLVOAvatar* avatarp = mDummyAvatar; LLVOAvatar* avatarp = mDummyAvatar;
gGL.pushUIMatrix();
gGL.loadUIIdentity();
gGL.matrixMode(LLRender::MM_PROJECTION); gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix(); gGL.pushMatrix();
@@ -785,6 +787,7 @@ BOOL LLImagePreviewAvatar::render()
} }
} }
gGL.popUIMatrix();
gGL.color4f(1,1,1,1); gGL.color4f(1,1,1,1);
return TRUE; return TRUE;
} }

View File

@@ -1129,11 +1129,10 @@ BOOL LLPanelLandObjects::postBuild()
mCleanOtherObjectsTime = getChild<LLLineEditor>("clean other time"); mCleanOtherObjectsTime = getChild<LLLineEditor>("clean other time");
mCleanOtherObjectsTime->setFocusLostCallback(boost::bind(&LLPanelLandObjects::onLostFocus, _1, this)); mCleanOtherObjectsTime->setFocusLostCallback(boost::bind(&LLPanelLandObjects::onLostFocus, _1, this));
mCleanOtherObjectsTime->setCommitCallback(onCommitClean); mCleanOtherObjectsTime->setCommitCallback(onCommitClean, this);
mCleanOtherObjectsTime->setPrevalidate(LLLineEditor::prevalidateNonNegativeS32);
childSetPrevalidate("clean other time", LLLineEditor::prevalidateNonNegativeS32);
childSetUserData("clean other time", this);
mBtnRefresh = getChild<LLButton>("Refresh List"); mBtnRefresh = getChild<LLButton>("Refresh List");
mBtnRefresh->setClickedCallback(onClickRefresh, this); mBtnRefresh->setClickedCallback(onClickRefresh, this);

View File

@@ -37,16 +37,18 @@
#include "llagent.h" #include "llagent.h"
#include "llagentui.h" #include "llagentui.h"
#include "llcheckboxctrl.h" #include "llcheckboxctrl.h"
#include "llviewerparcelmgr.h" #include "llfiltereditor.h"
#include "llfolderview.h" #include "llfolderview.h"
#include "llfoldervieweventlistener.h" #include "llfoldervieweventlistener.h"
#include "llinventory.h" #include "llinventory.h"
#include "llinventoryfunctions.h" #include "llinventoryfunctions.h"
#include "llinventorypanel.h" #include "llinventorypanel.h"
#include "llviewerinventory.h" #include "llparcel.h"
#include "llpermissions.h" #include "llpermissions.h"
#include "llsaleinfo.h" #include "llsaleinfo.h"
#include "llparcel.h" #include "llviewerinventory.h"
#include "llviewerparcelmgr.h"
#include "llnotificationsutil.h" #include "llnotificationsutil.h"
#include "llviewerwindow.h" // alertXml #include "llviewerwindow.h" // alertXml
@@ -67,21 +69,26 @@ LLFloaterLandmark::LLFloaterLandmark(const LLSD& data)
mResolutionLabel(NULL), mResolutionLabel(NULL),
mIsDirty( FALSE ), mIsDirty( FALSE ),
mActive( TRUE ), mActive( TRUE ),
mSearchEdit(NULL), mFilterEdit(NULL),
mContextConeOpacity(0.f) mContextConeOpacity(0.f),
mInventoryPanel(NULL),
mSavedFolderState(NULL),
mNoCopyLandmarkSelected( FALSE )
{ {
LLUICtrlFactory::getInstance()->buildFloater(this,"floater_landmark_ctrl.xml"); LLUICtrlFactory::getInstance()->buildFloater(this,"floater_landmark_ctrl.xml");
}
BOOL LLFloaterLandmark::postBuild()
{
mTentativeLabel = getChild<LLTextBox>("Multiple"); mTentativeLabel = getChild<LLTextBox>("Multiple");
mResolutionLabel = getChild<LLTextBox>("unknown"); mResolutionLabel = getChild<LLTextBox>("unknown");
LLUICtrl* show_folders_check = getChild<LLUICtrl>("show_folders_check");
childSetCommitCallback("show_folders_check", onShowFolders, this); show_folders_check->setCommitCallback(boost::bind(&LLFloaterLandmark::onShowFolders,this, _1));
childSetVisible("show_folders_check", FALSE); show_folders_check->setVisible(FALSE);
mSearchEdit = getChild<LLSearchEditor>("inventory search editor"); mFilterEdit = getChild<LLFilterEditor>("inventory search editor");
mSearchEdit->setSearchCallback(onSearchEdit, this); mFilterEdit->setCommitCallback(boost::bind(&LLFloaterLandmark::onFilterEdit, this, _2));
mInventoryPanel = getChild<LLInventoryPanel>("inventory panel"); mInventoryPanel = getChild<LLInventoryPanel>("inventory panel");
@@ -93,7 +100,7 @@ LLFloaterLandmark::LLFloaterLandmark(const LLSD& data)
mInventoryPanel->setFilterTypes(filter_types); mInventoryPanel->setFilterTypes(filter_types);
//mInventoryPanel->setFilterPermMask(getFilterPermMask()); //Commented out due to no-copy texture loss. //mInventoryPanel->setFilterPermMask(getFilterPermMask()); //Commented out due to no-copy texture loss.
mInventoryPanel->setSelectCallback(boost::bind(&LLFloaterLandmark::onSelectionChange, _1, _2, (void*)this)); mInventoryPanel->setSelectCallback(boost::bind(&LLFloaterLandmark::onSelectionChange, this, _1, _2));
mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
mInventoryPanel->setAllowMultiSelect(FALSE); mInventoryPanel->setAllowMultiSelect(FALSE);
@@ -110,17 +117,19 @@ LLFloaterLandmark::LLFloaterLandmark(const LLSD& data)
mSavedFolderState = new LLSaveFolderState(); mSavedFolderState = new LLSaveFolderState();
mNoCopyLandmarkSelected = FALSE; mNoCopyLandmarkSelected = FALSE;
childSetAction("Close", LLFloaterLandmark::onBtnClose,this); getChild<LLButton>("Close")->setClickedCallback(boost::bind(&LLFloaterLandmark::onBtnClose,this));
childSetAction("New", LLFloaterLandmark::onBtnNew,this); getChild<LLButton>("New")->setClickedCallback(boost::bind(&LLFloaterLandmark::onBtnNew,this));
childSetAction("NewFolder", LLFloaterLandmark::onBtnNewFolder,this); getChild<LLButton>("NewFolder")->setClickedCallback(boost::bind(&LLFloaterLandmark::onBtnNewFolder,this));
childSetAction("Edit", LLFloaterLandmark::onBtnEdit,this); getChild<LLButton>("Edit")->setClickedCallback(boost::bind(&LLFloaterLandmark::onBtnEdit,this));
childSetAction("Rename", LLFloaterLandmark::onBtnRename,this); getChild<LLButton>("Rename")->setClickedCallback(boost::bind(&LLFloaterLandmark::onBtnRename,this));
childSetAction("Delete", LLFloaterLandmark::onBtnDelete,this); getChild<LLButton>("Delete")->setClickedCallback(boost::bind(&LLFloaterLandmark::onBtnDelete,this));
setCanMinimize(FALSE); setCanMinimize(FALSE);
mSavedFolderState->setApply(FALSE); mSavedFolderState->setApply(FALSE);
return true;
} }
LLFloaterLandmark::~LLFloaterLandmark() LLFloaterLandmark::~LLFloaterLandmark()
@@ -185,9 +194,9 @@ BOOL LLFloaterLandmark::handleKeyHere(KEY key, MASK mask)
{ {
LLFolderView* root_folder = mInventoryPanel->getRootFolder(); LLFolderView* root_folder = mInventoryPanel->getRootFolder();
if (root_folder && mSearchEdit) if (root_folder && mFilterEdit)
{ {
if (mSearchEdit->hasFocus() && if (mFilterEdit->hasFocus() &&
(key == KEY_RETURN || key == KEY_DOWN) && (key == KEY_RETURN || key == KEY_DOWN) &&
mask == MASK_NONE) mask == MASK_NONE)
{ {
@@ -209,7 +218,7 @@ BOOL LLFloaterLandmark::handleKeyHere(KEY key, MASK mask)
if (root_folder->hasFocus() && key == KEY_UP) if (root_folder->hasFocus() && key == KEY_UP)
{ {
mSearchEdit->focusFirstItem(TRUE); mFilterEdit->focusFirstItem(TRUE);
} }
} }
@@ -261,27 +270,23 @@ const LLUUID& LLFloaterLandmark::findItemID(const LLUUID& asset_id, BOOL copyabl
return LLUUID::null; return LLUUID::null;
} }
// static void LLFloaterLandmark::onBtnClose()
void LLFloaterLandmark::onBtnClose(void* userdata)
{ {
LLFloaterLandmark* self = (LLFloaterLandmark*) userdata; mIsDirty = FALSE;
self->mIsDirty = FALSE; close();
self->close();
} }
// static void LLFloaterLandmark::onBtnEdit()
void LLFloaterLandmark::onBtnEdit(void* userdata)
{ {
LLFloaterLandmark* self = (LLFloaterLandmark*) userdata;
// There isn't one, so make a new preview // There isn't one, so make a new preview
LLViewerInventoryItem* itemp = gInventory.getItem(self->mImageAssetID); LLViewerInventoryItem* itemp = gInventory.getItem(mImageAssetID);
if(itemp) if(itemp)
{ {
open_landmark(itemp, itemp->getName(), TRUE); open_landmark(itemp, itemp->getName(), TRUE);
} }
} }
// static
void LLFloaterLandmark::onBtnNew(void* userdata) void LLFloaterLandmark::onBtnNew()
{ {
LLViewerRegion* agent_region = gAgent.getRegion(); LLViewerRegion* agent_region = gAgent.getRegion();
if(!agent_region) if(!agent_region)
@@ -316,17 +321,15 @@ void LLFloaterLandmark::onBtnNew(void* userdata)
NOT_WEARABLE, PERM_ALL, NOT_WEARABLE, PERM_ALL,
NULL); NULL);
} }
// static
void LLFloaterLandmark::onBtnNewFolder(void* userdata) void LLFloaterLandmark::onBtnNewFolder()
{ {
} }
// static
void LLFloaterLandmark::onBtnDelete(void* userdata)
{
LLFloaterLandmark* self = (LLFloaterLandmark*)userdata;
LLViewerInventoryItem* item = gInventory.getItem(self->mImageAssetID); void LLFloaterLandmark::onBtnDelete()
{
LLViewerInventoryItem* item = gInventory.getItem(mImageAssetID);
if(item) if(item)
{ {
// Move the item to the trash // Move the item to the trash
@@ -360,82 +363,75 @@ void LLFloaterLandmark::onBtnDelete(void* userdata)
} }
// static void LLFloaterLandmark::onBtnRename()
void LLFloaterLandmark::onBtnRename(void* userdata)
{ {
} }
// static void LLFloaterLandmark::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action)
void LLFloaterLandmark::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data)
{ {
LLFloaterLandmark* self = (LLFloaterLandmark*)data;
if (items.size()) if (items.size())
{ {
LLFolderViewItem* first_item = items.front(); LLFolderViewItem* first_item = items.front();
LLInventoryItem* itemp = gInventory.getItem(first_item->getListener()->getUUID()); LLInventoryItem* itemp = gInventory.getItem(first_item->getListener()->getUUID());
self->mNoCopyLandmarkSelected = FALSE; mNoCopyLandmarkSelected = FALSE;
if (itemp) if (itemp)
{ {
if (!itemp->getPermissions().allowCopyBy(gAgent.getID())) if (!itemp->getPermissions().allowCopyBy(gAgent.getID()))
{ {
self->mNoCopyLandmarkSelected = TRUE; mNoCopyLandmarkSelected = TRUE;
} }
self->mImageAssetID = itemp->getUUID(); mImageAssetID = itemp->getUUID();
self->mIsDirty = TRUE; mIsDirty = TRUE;
} }
} }
} }
// static void LLFloaterLandmark::onShowFolders(LLUICtrl* ctrl)
void LLFloaterLandmark::onShowFolders(LLUICtrl* ctrl, void *user_data)
{ {
LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl; LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl;
LLFloaterLandmark* picker = (LLFloaterLandmark*)user_data;
if (check_box->get()) if (check_box->get())
{ {
picker->mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
} }
else else
{ {
picker->mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NO_FOLDERS); mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NO_FOLDERS);
} }
} }
void LLFloaterLandmark::onSearchEdit(const std::string& search_string, void* user_data ) void LLFloaterLandmark::onFilterEdit(const LLSD& value )
{ {
LLFloaterLandmark* picker = (LLFloaterLandmark*)user_data; std::string upper_case_search_string = value.asString();
std::string upper_case_search_string = search_string;
LLStringUtil::toUpper(upper_case_search_string); LLStringUtil::toUpper(upper_case_search_string);
if (upper_case_search_string.empty()) if (upper_case_search_string.empty())
{ {
if (picker->mInventoryPanel->getFilterSubString().empty()) if (mInventoryPanel->getFilterSubString().empty())
{ {
// current filter and new filter empty, do nothing // current filter and new filter empty, do nothing
return; return;
} }
picker->mSavedFolderState->setApply(TRUE); mSavedFolderState->setApply(TRUE);
picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(*picker->mSavedFolderState); mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
// add folder with current item to list of previously opened folders // add folder with current item to list of previously opened folders
LLOpenFoldersWithSelection opener; LLOpenFoldersWithSelection opener;
picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener); mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener);
picker->mInventoryPanel->getRootFolder()->scrollToShowSelection(); mInventoryPanel->getRootFolder()->scrollToShowSelection();
} }
else if (picker->mInventoryPanel->getFilterSubString().empty()) else if (mInventoryPanel->getFilterSubString().empty())
{ {
// first letter in search term, save existing folder open state // first letter in search term, save existing folder open state
if (!picker->mInventoryPanel->getRootFolder()->isFilterModified()) if (!mInventoryPanel->getRootFolder()->isFilterModified())
{ {
picker->mSavedFolderState->setApply(FALSE); mSavedFolderState->setApply(FALSE);
picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(*picker->mSavedFolderState); mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
} }
} }
picker->mInventoryPanel->setFilterSubString(upper_case_search_string); mInventoryPanel->setFilterSubString(upper_case_search_string);
} }

View File

@@ -47,6 +47,7 @@ class LLSearchEditor;
class LLInventoryPanel; class LLInventoryPanel;
class LLSaveFolderState; class LLSaveFolderState;
class LLViewerTexture; class LLViewerTexture;
class LLFilterEditor;
// used for setting drag & drop callbacks. // used for setting drag & drop callbacks.
typedef BOOL (*drag_n_drop_callback)(LLUICtrl*, LLInventoryItem*, void*); typedef BOOL (*drag_n_drop_callback)(LLUICtrl*, LLInventoryItem*, void*);
@@ -61,6 +62,8 @@ public:
LLFloaterLandmark(const LLSD& data); LLFloaterLandmark(const LLSD& data);
virtual ~LLFloaterLandmark(); virtual ~LLFloaterLandmark();
BOOL postBuild();
// LLView overrides // LLView overrides
virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
BOOL drop, EDragAndDropType cargo_type, void *cargo_data, BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
@@ -78,15 +81,15 @@ public:
BOOL isDirty() const { return mIsDirty; } BOOL isDirty() const { return mIsDirty; }
void setActive( BOOL active ); void setActive( BOOL active );
static void onBtnClose( void* userdata ); void onBtnClose();
static void onBtnNew( void* userdata ); void onBtnNew();
static void onBtnEdit( void* userdata ); void onBtnEdit();
static void onBtnDelete( void* userdata ); void onBtnDelete();
static void onBtnNewFolder( void* userdata ); void onBtnNewFolder();
static void onBtnRename( void* userdata ); void onBtnRename();
static void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data); void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
static void onShowFolders(LLUICtrl* ctrl, void* userdata); void onShowFolders(LLUICtrl* ctrl);
static void onSearchEdit(const std::string& search_string, void* user_data ); void onFilterEdit(const LLSD& value);
protected: protected:
LLPointer<LLViewerTexture> mLandmarkp; LLPointer<LLViewerTexture> mLandmarkp;
@@ -104,7 +107,7 @@ protected:
BOOL mIsDirty; BOOL mIsDirty;
BOOL mActive; BOOL mActive;
LLSearchEditor* mSearchEdit; LLFilterEditor* mFilterEdit;
LLInventoryPanel* mInventoryPanel; LLInventoryPanel* mInventoryPanel;
PermissionMask mImmediateFilterPermMask; PermissionMask mImmediateFilterPermMask;
PermissionMask mNonImmediateFilterPermMask; PermissionMask mNonImmediateFilterPermMask;

View File

@@ -45,7 +45,6 @@
#include "lltextbox.h" #include "lltextbox.h"
#include "llagent.h" // for agent id #include "llagent.h" // for agent id
#include "llalertdialog.h"
#include "llfloaterinventory.h" #include "llfloaterinventory.h"
#include "llinventorybridge.h" #include "llinventorybridge.h"
#include "llinventorymodel.h" #include "llinventorymodel.h"

View File

@@ -107,15 +107,11 @@ LLPermissionsView::LLPermissionsView(const LLRect &rect) : LLView(std::string("p
void LLPermissionsView::clearPermissionsData() void LLPermissionsView::clearPermissionsData()
{ {
deleteAllChildren(); deleteAllChildren();
std::for_each(mPermData.begin(), mPermData.end(), DeletePairedPointer());
mPermData.clear();
} }
void LLPermissionsView::addPermissionsData(const std::string& object_name, const LLUUID& object_id, U32 permissions_flags) void LLPermissionsView::addPermissionsData(const std::string& object_name, const LLUUID& object_id, U32 permissions_flags)
{ {
// grow to make room for new element // grow to make room for new element
LLPermissionsData* perm_datap = new LLPermissionsData(object_id, permissions_flags);
reshape(getRect().getWidth(), getRect().getHeight() + LINE + VPAD + BTN_HEIGHT + VPAD); reshape(getRect().getWidth(), getRect().getHeight() + LINE + VPAD + BTN_HEIGHT + VPAD);
S32 y = getRect().getHeight() - LINE - VPAD; S32 y = getRect().getHeight() - LINE - VPAD;
LLRect label_rect(HPAD, y + LINE, getRect().getWidth(), y); LLRect label_rect(HPAD, y + LINE, getRect().getWidth(), y);
@@ -126,39 +122,33 @@ void LLPermissionsView::addPermissionsData(const std::string& object_name, const
y -= LINE + VPAD; y -= LINE + VPAD;
LLRect btn_rect(HPAD, y + BTN_HEIGHT, 120, y); LLRect btn_rect(HPAD, y + BTN_HEIGHT, 120, y);
LLButton* button = new LLButton(std::string("Revoke permissions"), btn_rect, LLStringUtil::null, revokePermissions, (void*)perm_datap); LLButton* button = new LLButton(std::string("Revoke permissions"), btn_rect, LLStringUtil::null, std::bind(&LLPermissionsView::revokePermissions, object_id, permissions_flags));
button->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM); button->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM);
addChild(button); addChild(button);
btn_rect.set(HPAD + 120 + HPAD, y + BTN_HEIGHT, HPAD + 120 + HPAD + 120, y); /*btn_rect.set(HPAD + 120 + HPAD, y + BTN_HEIGHT, HPAD + 120 + HPAD + 120, y);
button = new LLButton(std::string("Find in world"), btn_rect, LLStringUtil::null, findObject, (void*)perm_datap); button = new LLButton(std::string("Find in world"), btn_rect, LLStringUtil::null, std::bind(&LLPermissionsView::findObject, object_id, permissions_flags));
button->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM); button->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM);
addChild(button); addChild(button);*/
mPermData.insert(std::make_pair(object_id, perm_datap));
} }
void LLPermissionsView::revokePermissions(void *userdata) void LLPermissionsView::revokePermissions(const LLUUID& object_id, U32 permission_flags)
{ {
LLPermissionsData* perm_data = (LLPermissionsData*)userdata; LLViewerObject* objectp = gObjectList.findObject(object_id);
if (perm_data) if (objectp)
{ {
LLViewerObject* objectp = gObjectList.findObject(perm_data->mObjectID); LLMessageSystem* msg = gMessageSystem;
if (objectp) msg->newMessageFast(_PREHASH_RevokePermissions);
{ msg->nextBlockFast(_PREHASH_AgentData);
LLMessageSystem* msg = gMessageSystem; msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->newMessageFast(_PREHASH_RevokePermissions); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_AgentData); msg->nextBlockFast(_PREHASH_Data);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_ObjectID, object_id);
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addU32Fast(_PREHASH_ObjectPermissions, permission_flags);
msg->nextBlockFast(_PREHASH_Data); msg->sendReliable(objectp->getRegion()->getHost());
msg->addUUIDFast(_PREHASH_ObjectID, perm_data->mObjectID);
msg->addU32Fast(_PREHASH_ObjectPermissions, perm_data->mPermFlags);
msg->sendReliable(objectp->getRegion()->getHost());
}
} }
} }
void LLPermissionsView::findObject(void *userdata) /*void LLPermissionsView::findObject(const LLUUID& object_id, U32 permission_flags)
{ {
} }*/

View File

@@ -64,15 +64,6 @@ protected:
static LLFloaterPermissionsMgr* sInstance; static LLFloaterPermissionsMgr* sInstance;
}; };
class LLPermissionsData
{
public:
LLPermissionsData(const LLUUID& object_id, U32 permission_flags) : mObjectID(object_id), mPermFlags(permission_flags) {};
LLUUID mObjectID;
U32 mPermFlags;
};
class LLPermissionsView : public LLView class LLPermissionsView : public LLView
{ {
public: public:
@@ -83,11 +74,8 @@ public:
void clearPermissionsData(); void clearPermissionsData();
void addPermissionsData(const std::string& object_name, const LLUUID& object_id, U32 permissions_flags); void addPermissionsData(const std::string& object_name, const LLUUID& object_id, U32 permissions_flags);
static void revokePermissions(void *userdata); static void revokePermissions(const LLUUID& object_id, U32 permission_flags);
static void findObject(void *userdata); //static void findObject(const LLUUID& object_id, U32 permission_flags);
protected:
std::map<LLUUID, LLPermissionsData*> mPermData;
}; };

View File

@@ -32,7 +32,6 @@
*/ */
#include "llviewerprecompiledheaders.h" #include "llviewerprecompiledheaders.h"
#include "llalertdialog.h"
#include "llcheckboxctrl.h" #include "llcheckboxctrl.h"
#include "llfloaterperms.h" #include "llfloaterperms.h"
#include "llnotificationsutil.h" #include "llnotificationsutil.h"

View File

@@ -80,7 +80,8 @@
class LLPropertiesObserver : public LLInventoryObserver class LLPropertiesObserver : public LLInventoryObserver
{ {
public: public:
LLPropertiesObserver() LLPropertiesObserver(LLFloaterProperties* floater)
: mFloater(floater)
{ {
gInventory.addObserver(this); gInventory.addObserver(this);
} }
@@ -89,6 +90,8 @@ public:
gInventory.removeObserver(this); gInventory.removeObserver(this);
} }
virtual void changed(U32 mask); virtual void changed(U32 mask);
private:
LLFloaterProperties* mFloater;
}; };
void LLPropertiesObserver::changed(U32 mask) void LLPropertiesObserver::changed(U32 mask)
@@ -96,7 +99,7 @@ void LLPropertiesObserver::changed(U32 mask)
// if there's a change we're interested in. // if there's a change we're interested in.
if((mask & (LLInventoryObserver::LABEL | LLInventoryObserver::INTERNAL | LLInventoryObserver::REMOVE)) != 0) if((mask & (LLInventoryObserver::LABEL | LLInventoryObserver::INTERNAL | LLInventoryObserver::REMOVE)) != 0)
{ {
LLFloaterProperties::dirtyAll(); mFloater->dirty();
} }
} }
@@ -106,25 +109,10 @@ void LLPropertiesObserver::changed(U32 mask)
/// Class LLFloaterProperties /// Class LLFloaterProperties
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
// static //static
LLFloaterProperties::instance_map LLFloaterProperties::sInstances; LLFloaterProperties* LLFloaterProperties::find(const LLUUID& item_id, const LLUUID &object_id)
LLPropertiesObserver* LLFloaterProperties::sPropertiesObserver = NULL;
S32 LLFloaterProperties::sPropertiesObserverCount = 0;
// static
LLFloaterProperties* LLFloaterProperties::find(const LLUUID& item_id,
const LLUUID& object_id)
{ {
// for simplicity's sake, we key the properties window with a return getInstance(item_id ^ object_id);
// single uuid. However, the items are keyed by item and object
// (obj == null -> agent inventory). So, we xor the two ids, and
// use that as a lookup key
instance_map::iterator it = sInstances.find(item_id ^ object_id);
if(it != sInstances.end())
{
return (*it).second;
}
return NULL;
} }
// static // static
@@ -147,84 +135,68 @@ LLFloaterProperties* LLFloaterProperties::show(const LLUUID& item_id,
return instance; return instance;
} }
void LLFloaterProperties::dirtyAll()
{
// ...this is more clear. Possibly more correct, because the
// refresh method may delete the object.
for(instance_map::iterator it = sInstances.begin(); it!=sInstances.end(); )
{
(*it++).second->dirty();
}
}
// Default constructor // Default constructor
LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_id, const LLUUID& object_id) : LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_id, const LLUUID& object_id) :
LLFloater(name, rect, title), LLFloater(name, rect, title), LLInstanceTracker<LLFloaterProperties,LLUUID>(object_id ^ item_id),
mItemID(item_id), mItemID(item_id),
mObjectID(object_id), mObjectID(object_id),
mDirty(TRUE) mDirty(TRUE)
{ {
mPropertiesObserver = new LLPropertiesObserver(this);
LLUICtrlFactory::getInstance()->buildFloater(this,"floater_inventory_item_properties.xml"); LLUICtrlFactory::getInstance()->buildFloater(this,"floater_inventory_item_properties.xml");
if (!sPropertiesObserver)
{
sPropertiesObserver = new LLPropertiesObserver;
}
sPropertiesObserverCount++;
childSetTextArg("TextPrice", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());
// add the object to the static structure
LLUUID key = mItemID ^ mObjectID;
sInstances.insert(instance_map::value_type(key, this));
// build the UI
// item name & description
childSetPrevalidate("LabelItemName",&LLLineEditor::prevalidatePrintableNotPipe);
childSetCommitCallback("LabelItemName",onCommitName,this);
childSetPrevalidate("LabelItemDesc",&LLLineEditor::prevalidatePrintableNotPipe);
childSetCommitCallback("LabelItemDesc", onCommitDescription, this);
// Creator information
childSetAction("BtnCreator",onClickCreator,this);
// owner information
childSetAction("BtnOwner",onClickOwner,this);
// acquired date
// owner permissions
// Permissions debug text
// group permissions
childSetCommitCallback("CheckGroupCopy",&onCommitPermissions, this);
childSetCommitCallback("CheckGroupMod",&onCommitPermissions, this);
childSetCommitCallback("CheckGroupMove",&onCommitPermissions, this);
// everyone permissions
childSetCommitCallback("CheckEveryoneCopy",&onCommitPermissions, this);
childSetCommitCallback("CheckEveryoneMove",&onCommitPermissions, this);
// next owner permissions
childSetCommitCallback("CheckNextOwnerModify",&onCommitPermissions, this);
childSetCommitCallback("CheckNextOwnerCopy",&onCommitPermissions, this);
childSetCommitCallback("CheckNextOwnerTransfer",&onCommitPermissions, this);
// Mark for sale or not, and sale info
childSetCommitCallback("CheckPurchase",&onCommitSaleInfo, this);
childSetCommitCallback("RadioSaleType",&onCommitSaleType, this);
// "Price" label for edit
childSetCommitCallback("EditPrice",&onCommitSaleInfo, this);
// The UI has been built, now fill in all the values
refresh();
} }
// Destroys the object // Destroys the object
LLFloaterProperties::~LLFloaterProperties() LLFloaterProperties::~LLFloaterProperties()
{ {
// clean up the static data. delete mPropertiesObserver;
instance_map::iterator it = sInstances.find(mItemID ^ mObjectID); mPropertiesObserver = NULL;
if(it != sInstances.end()) }
{
sInstances.erase(it); // virtual
} BOOL LLFloaterProperties::postBuild()
sPropertiesObserverCount--; {
if (!sPropertiesObserverCount)
{ childSetTextArg("TextPrice", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());
delete sPropertiesObserver; // build the UI
sPropertiesObserver = NULL; // item name & description
} getChild<LLLineEditor>("LabelItemName")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe);
getChild<LLUICtrl>("LabelItemName")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitName,this));
getChild<LLLineEditor>("LabelItemDesc")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe);
getChild<LLUICtrl>("LabelItemDesc")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitDescription,this));
// Creator information
getChild<LLUICtrl>("BtnCreator")->setCommitCallback(boost::bind(&LLFloaterProperties::onClickCreator,this));
// owner information
getChild<LLUICtrl>("BtnOwner")->setCommitCallback(boost::bind(&LLFloaterProperties::onClickOwner,this));
// acquired date
// owner permissions
// Permissions debug text
// group permissions
getChild<LLUICtrl>("CheckGroupCopy")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this));
getChild<LLUICtrl>("CheckGroupMod")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this));
getChild<LLUICtrl>("CheckGroupMove")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this));
// everyone permissions
getChild<LLUICtrl>("CheckEveryoneCopy")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this));
getChild<LLUICtrl>("CheckEveryoneMove")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this));
// next owner permissions
getChild<LLUICtrl>("CheckNextOwnerModify")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this));
getChild<LLUICtrl>("CheckNextOwnerCopy")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this));
getChild<LLUICtrl>("CheckNextOwnerTransfer")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this));
// Mark for sale or not, and sale info
getChild<LLUICtrl>("CheckPurchase")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitSaleInfo, this));
getChild<LLUICtrl>("RadioSaleType")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitSaleType, this));
// "Price" label for edit
getChild<LLUICtrl>("Edit Cost")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitSaleInfo, this));
// The UI has been built, now fill in all the values
refresh();
return TRUE;
}
// virtual
void LLFloaterProperties::onOpen()
{
refresh();
} }
void LLFloaterProperties::refresh() void LLFloaterProperties::refresh()
@@ -261,11 +233,11 @@ void LLFloaterProperties::refresh()
"CheckNextOwnerTransfer", "CheckNextOwnerTransfer",
"CheckPurchase", "CheckPurchase",
"RadioSaleType", "RadioSaleType",
"EditPrice" "Edit Cost"
}; };
for(size_t t=0; t<LL_ARRAY_SIZE(enableNames); ++t) for(size_t t=0; t<LL_ARRAY_SIZE(enableNames); ++t)
{ {
childSetEnabled(enableNames[t],false); getChildView(enableNames[t])->setEnabled(false);
} }
const char* hideNames[]={ const char* hideNames[]={
"BaseMaskDebug", "BaseMaskDebug",
@@ -276,7 +248,7 @@ void LLFloaterProperties::refresh()
}; };
for(size_t t=0; t<LL_ARRAY_SIZE(hideNames); ++t) for(size_t t=0; t<LL_ARRAY_SIZE(hideNames); ++t)
{ {
childSetVisible(hideNames[t],false); getChildView(hideNames[t])->setVisible(false);
} }
} }
} }
@@ -301,14 +273,16 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
// do not enable the UI for incomplete items. // do not enable the UI for incomplete items.
LLViewerInventoryItem* i = (LLViewerInventoryItem*)item; LLViewerInventoryItem* i = (LLViewerInventoryItem*)item;
BOOL is_complete = i->isComplete(); BOOL is_complete = i->isFinished();
const BOOL cannot_restrict_permissions = LLInventoryType::cannotRestrictPermissions(i->getInventoryType());
const BOOL is_calling_card = (i->getInventoryType() == LLInventoryType::IT_CALLINGCARD);
const LLPermissions& perm = item->getPermissions(); const LLPermissions& perm = item->getPermissions();
BOOL can_agent_manipulate = gAgent.allowOperation(PERM_OWNER, perm, const BOOL can_agent_manipulate = gAgent.allowOperation(PERM_OWNER, perm,
GP_OBJECT_MANIPULATE); GP_OBJECT_MANIPULATE);
BOOL can_agent_sell = gAgent.allowOperation(PERM_OWNER, perm, const BOOL can_agent_sell = gAgent.allowOperation(PERM_OWNER, perm,
GP_OBJECT_SET_SALE); GP_OBJECT_SET_SALE) &&
BOOL is_link = i->getIsLinkType(); !cannot_restrict_permissions;
const BOOL is_link = i->getIsLinkType();
// You need permission to modify the object to modify an inventory // You need permission to modify the object to modify an inventory
// item in it. // item in it.
@@ -324,16 +298,16 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
// ITEM NAME & DESC // // ITEM NAME & DESC //
////////////////////// //////////////////////
BOOL is_modifiable = gAgent.allowOperation(PERM_MODIFY, perm, BOOL is_modifiable = gAgent.allowOperation(PERM_MODIFY, perm,
GP_OBJECT_MANIPULATE) GP_OBJECT_MANIPULATE)
&& is_obj_modify && is_complete; && is_obj_modify && is_complete;
childSetEnabled("LabelItemNameTitle",TRUE); getChildView("LabelItemNameTitle")->setEnabled(TRUE);
childSetEnabled("LabelItemName",is_modifiable); getChildView("LabelItemName")->setEnabled(is_modifiable && !is_calling_card); // for now, don't allow rename of calling cards
childSetText("LabelItemName",item->getName()); getChild<LLUICtrl>("LabelItemName")->setValue(item->getName());
childSetEnabled("LabelItemDescTitle",TRUE); getChildView("LabelItemDescTitle")->setEnabled(TRUE);
childSetEnabled("LabelItemDesc",is_modifiable); getChildView("LabelItemDesc")->setEnabled(is_modifiable);
childSetVisible("IconLocked",!is_modifiable); getChildView("IconLocked")->setVisible(!is_modifiable);
childSetText("LabelItemDesc",item->getDescription()); getChild<LLUICtrl>("LabelItemDesc")->setValue(item->getDescription());
////////////////// //////////////////
// CREATOR NAME // // CREATOR NAME //
@@ -345,17 +319,17 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
{ {
std::string name; std::string name;
gCacheName->getFullName(item->getCreatorUUID(), name); gCacheName->getFullName(item->getCreatorUUID(), name);
childSetEnabled("BtnCreator",TRUE); getChildView("BtnCreator")->setEnabled(TRUE);
childSetEnabled("LabelCreatorTitle",TRUE); getChildView("LabelCreatorTitle")->setEnabled(TRUE);
childSetEnabled("LabelCreatorName",TRUE); getChildView("LabelCreatorName")->setEnabled(TRUE);
childSetText("LabelCreatorName",name); getChild<LLUICtrl>("LabelCreatorName")->setValue(name);
} }
else else
{ {
childSetEnabled("BtnCreator",FALSE); getChildView("BtnCreator")->setEnabled(FALSE);
childSetEnabled("LabelCreatorTitle",FALSE); getChildView("LabelCreatorTitle")->setEnabled(FALSE);
childSetEnabled("LabelCreatorName",FALSE); getChildView("LabelCreatorName")->setEnabled(FALSE);
childSetText("LabelCreatorName",getString("unknown")); getChild<LLUICtrl>("LabelCreatorName")->setValue(getString("unknown"));
} }
//////////////// ////////////////
@@ -378,20 +352,20 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
} }
// [/RLVa:KB] // [/RLVa:KB]
} }
//childSetEnabled("BtnOwner",TRUE); getChildView("BtnOwner")->setEnabled(TRUE);
// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-1.0.0e // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-1.0.0e
childSetEnabled("BtnOwner", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); getChildView("BtnOwner")->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES));
// [/RLVa:KB] // [/RLVa:KB]
childSetEnabled("LabelOwnerTitle",TRUE); getChildView("LabelOwnerTitle")->setEnabled(TRUE);
childSetEnabled("LabelOwnerName",TRUE); getChildView("LabelOwnerName")->setEnabled(TRUE);
childSetText("LabelOwnerName",name); getChild<LLUICtrl>("LabelOwnerName")->setValue(name);
} }
else else
{ {
childSetEnabled("BtnOwner",FALSE); getChildView("BtnOwner")->setEnabled(FALSE);
childSetEnabled("LabelOwnerTitle",FALSE); getChildView("LabelOwnerTitle")->setEnabled(FALSE);
childSetEnabled("LabelOwnerName",FALSE); getChildView("LabelOwnerName")->setEnabled(FALSE);
childSetText("LabelOwnerName",getString("public")); getChild<LLUICtrl>("LabelOwnerName")->setValue(getString("public"));
} }
////////////////// //////////////////
@@ -402,13 +376,13 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
time_t time_utc = item->getCreationDate(); time_t time_utc = item->getCreationDate();
if (0 == time_utc) if (0 == time_utc)
{ {
childSetText("LabelAcquiredDate",getString("unknown")); getChild<LLUICtrl>("LabelAcquiredDate")->setValue(getString("unknown"));
} }
else else
{ {
std::string timestr; std::string timeStr;
timeToFormattedString(time_utc, gSavedSettings.getString("TimestampFormat"), timestr); timeToFormattedString(time_utc, gSavedSettings.getString("TimestampFormat"), timeStr);
childSetText("LabelAcquiredDate", timestr); getChild<LLUICtrl>("LabelAcquiredDate")->setValue(timeStr);
} }
/////////////////////// ///////////////////////
@@ -416,11 +390,11 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
/////////////////////// ///////////////////////
if(can_agent_manipulate) if(can_agent_manipulate)
{ {
childSetText("OwnerLabel",getString("you_can")); getChild<LLUICtrl>("OwnerLabel")->setValue(getString("you_can"));
} }
else else
{ {
childSetText("OwnerLabel",getString("owner_can")); getChild<LLUICtrl>("OwnerLabel")->setValue(getString("owner_can"));
} }
U32 base_mask = perm.getMaskBase(); U32 base_mask = perm.getMaskBase();
@@ -429,13 +403,13 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
U32 everyone_mask = perm.getMaskEveryone(); U32 everyone_mask = perm.getMaskEveryone();
U32 next_owner_mask = perm.getMaskNextOwner(); U32 next_owner_mask = perm.getMaskNextOwner();
childSetEnabled("OwnerLabel",TRUE); getChildView("OwnerLabel")->setEnabled(TRUE);
childSetEnabled("CheckOwnerModify",FALSE); getChildView("CheckOwnerModify")->setEnabled(FALSE);
childSetValue("CheckOwnerModify",LLSD((BOOL)(owner_mask & PERM_MODIFY))); getChild<LLUICtrl>("CheckOwnerModify")->setValue(LLSD((BOOL)(owner_mask & PERM_MODIFY)));
childSetEnabled("CheckOwnerCopy",FALSE); getChildView("CheckOwnerCopy")->setEnabled(FALSE);
childSetValue("CheckOwnerCopy",LLSD((BOOL)(owner_mask & PERM_COPY))); getChild<LLUICtrl>("CheckOwnerCopy")->setValue(LLSD((BOOL)(owner_mask & PERM_COPY)));
childSetEnabled("CheckOwnerTransfer",FALSE); getChildView("CheckOwnerTransfer")->setEnabled(FALSE);
childSetValue("CheckOwnerTransfer",LLSD((BOOL)(owner_mask & PERM_TRANSFER))); getChild<LLUICtrl>("CheckOwnerTransfer")->setValue(LLSD((BOOL)(owner_mask & PERM_TRANSFER)));
/////////////////////// ///////////////////////
// DEBUG PERMISSIONS // // DEBUG PERMISSIONS //
@@ -459,39 +433,39 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
perm_string = "B: "; perm_string = "B: ";
perm_string += mask_to_string(base_mask); perm_string += mask_to_string(base_mask);
childSetText("BaseMaskDebug",perm_string); getChild<LLUICtrl>("BaseMaskDebug")->setValue(perm_string);
childSetVisible("BaseMaskDebug",TRUE); getChildView("BaseMaskDebug")->setVisible(TRUE);
perm_string = "O: "; perm_string = "O: ";
perm_string += mask_to_string(owner_mask); perm_string += mask_to_string(owner_mask);
childSetText("OwnerMaskDebug",perm_string); getChild<LLUICtrl>("OwnerMaskDebug")->setValue(perm_string);
childSetVisible("OwnerMaskDebug",TRUE); getChildView("OwnerMaskDebug")->setVisible(TRUE);
perm_string = "G"; perm_string = "G";
perm_string += overwrite_group ? "*: " : ": "; perm_string += overwrite_group ? "*: " : ": ";
perm_string += mask_to_string(group_mask); perm_string += mask_to_string(group_mask);
childSetText("GroupMaskDebug",perm_string); getChild<LLUICtrl>("GroupMaskDebug")->setValue(perm_string);
childSetVisible("GroupMaskDebug",TRUE); getChildView("GroupMaskDebug")->setVisible(TRUE);
perm_string = "E"; perm_string = "E";
perm_string += overwrite_everyone ? "*: " : ": "; perm_string += overwrite_everyone ? "*: " : ": ";
perm_string += mask_to_string(everyone_mask); perm_string += mask_to_string(everyone_mask);
childSetText("EveryoneMaskDebug",perm_string); getChild<LLUICtrl>("EveryoneMaskDebug")->setValue(perm_string);
childSetVisible("EveryoneMaskDebug",TRUE); getChildView("EveryoneMaskDebug")->setVisible(TRUE);
perm_string = "N"; perm_string = "N";
perm_string += slam_perm ? "*: " : ": "; perm_string += slam_perm ? "*: " : ": ";
perm_string += mask_to_string(next_owner_mask); perm_string += mask_to_string(next_owner_mask);
childSetText("NextMaskDebug",perm_string); getChild<LLUICtrl>("NextMaskDebug")->setValue(perm_string);
childSetVisible("NextMaskDebug",TRUE); getChildView("NextMaskDebug")->setVisible(TRUE);
} }
else else
{ {
childSetVisible("BaseMaskDebug",FALSE); getChildView("BaseMaskDebug")->setVisible(FALSE);
childSetVisible("OwnerMaskDebug",FALSE); getChildView("OwnerMaskDebug")->setVisible(FALSE);
childSetVisible("GroupMaskDebug",FALSE); getChildView("GroupMaskDebug")->setVisible(FALSE);
childSetVisible("EveryoneMaskDebug",FALSE); getChildView("EveryoneMaskDebug")->setVisible(FALSE);
childSetVisible("NextMaskDebug",FALSE); getChildView("NextMaskDebug")->setVisible(FALSE);
} }
///////////// /////////////
@@ -501,23 +475,23 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
// Check for ability to change values. // Check for ability to change values.
if (!is_link && is_obj_modify && can_agent_manipulate) if (!is_link && is_obj_modify && can_agent_manipulate)
{ {
childSetEnabled("GroupLabel", true); getChild<LLUICtrl>("GroupLabel")->setEnabled(TRUE);
childSetEnabled("CheckGroupCopy", (owner_mask & (PERM_TRANSFER|PERM_COPY)) == (PERM_TRANSFER|PERM_COPY)); getChild<LLUICtrl>("CheckGroupCopy")->setEnabled((owner_mask & (PERM_TRANSFER|PERM_COPY)) == (PERM_TRANSFER|PERM_COPY));
childSetEnabled("CheckGroupMod", owner_mask & PERM_MODIFY); getChild<LLUICtrl>("CheckGroupMod")->setEnabled(owner_mask & PERM_MODIFY);
childSetEnabled("CheckGroupMove", true); getChild<LLUICtrl>("CheckGroupMove")->setEnabled(TRUE);
childSetEnabled("EveryoneLabel", true); getChild<LLUICtrl>("EveryoneLabel")->setEnabled(TRUE);
childSetEnabled("CheckEveryoneCopy", (owner_mask & (PERM_TRANSFER|PERM_COPY)) == (PERM_TRANSFER|PERM_COPY)); getChild<LLUICtrl>("CheckEveryoneCopy")->setEnabled((owner_mask & (PERM_TRANSFER|PERM_COPY)) == (PERM_TRANSFER|PERM_COPY));
childSetEnabled("CheckEveryoneMove",true); getChild<LLUICtrl>("CheckEveryoneMove")->setEnabled(TRUE);
} }
else else
{ {
childSetEnabled("GroupLabel", false); getChild<LLUICtrl>("GroupLabel")->setEnabled(FALSE);
childSetEnabled("CheckGroupCopy", false); getChild<LLUICtrl>("CheckGroupCopy")->setEnabled(FALSE);
childSetEnabled("CheckGroupMod", false); getChild<LLUICtrl>("CheckGroupMod")->setEnabled(FALSE);
childSetEnabled("CheckGroupMove", false); getChild<LLUICtrl>("CheckGroupMove")->setEnabled(FALSE);
childSetEnabled("EveryoneLabel", false); getChild<LLUICtrl>("EveryoneLabel")->setEnabled(FALSE);
childSetEnabled("CheckEveryoneCopy",false); getChild<LLUICtrl>("CheckEveryoneCopy")->setEnabled(FALSE);
childSetEnabled("CheckEveryoneMove",false); getChild<LLUICtrl>("CheckEveryoneMove")->setEnabled(FALSE);
} }
// Set values. // Set values.
@@ -525,12 +499,12 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
BOOL is_group_modify = (group_mask & PERM_MODIFY) ? TRUE : FALSE; BOOL is_group_modify = (group_mask & PERM_MODIFY) ? TRUE : FALSE;
BOOL is_group_move = (group_mask & PERM_MOVE) ? TRUE : FALSE; BOOL is_group_move = (group_mask & PERM_MOVE) ? TRUE : FALSE;
childSetValue("CheckGroupCopy", is_group_copy); getChild<LLUICtrl>("CheckGroupCopy")->setValue(LLSD((BOOL)is_group_copy));
childSetValue("CheckGroupMod", is_group_modify); getChild<LLUICtrl>("CheckGroupMod")->setValue(LLSD((BOOL)is_group_modify));
childSetValue("CheckGroupMove", is_group_move); getChild<LLUICtrl>("CheckGroupMove")->setValue(LLSD((BOOL)is_group_move));
childSetValue("CheckEveryoneCopy",LLSD((BOOL)(everyone_mask & PERM_COPY))); getChild<LLUICtrl>("CheckEveryoneCopy")->setValue(LLSD((BOOL)(everyone_mask & PERM_COPY)));
childSetValue("CheckEveryoneMove",LLSD((BOOL)(everyone_mask & PERM_MOVE))); getChild<LLUICtrl>("CheckEveryoneMove")->setValue(LLSD((BOOL)(everyone_mask & PERM_MOVE)));
/////////////// ///////////////
// SALE INFO // // SALE INFO //
@@ -542,38 +516,39 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
if (is_obj_modify && can_agent_sell if (is_obj_modify && can_agent_sell
&& gAgent.allowOperation(PERM_TRANSFER, perm, GP_OBJECT_MANIPULATE)) && gAgent.allowOperation(PERM_TRANSFER, perm, GP_OBJECT_MANIPULATE))
{ {
childSetEnabled("SaleLabel",is_complete); getChildView("SaleLabel")->setEnabled(is_complete);
childSetEnabled("CheckPurchase",is_complete); getChildView("CheckPurchase")->setEnabled(is_complete);
childSetEnabled("NextOwnerLabel",TRUE); getChildView("NextOwnerLabel")->setEnabled(TRUE);
childSetEnabled("CheckNextOwnerModify",base_mask & PERM_MODIFY); getChildView("CheckNextOwnerModify")->setEnabled((base_mask & PERM_MODIFY) && !cannot_restrict_permissions);
childSetEnabled("CheckNextOwnerCopy",base_mask & PERM_COPY); getChildView("CheckNextOwnerCopy")->setEnabled((base_mask & PERM_COPY) && !cannot_restrict_permissions);
childSetEnabled("CheckNextOwnerTransfer",next_owner_mask & PERM_COPY); getChildView("CheckNextOwnerTransfer")->setEnabled((next_owner_mask & PERM_COPY) && !cannot_restrict_permissions);
childSetEnabled("RadioSaleType",is_complete && is_for_sale); getChildView("RadioSaleType")->setEnabled(is_complete && is_for_sale);
childSetEnabled("TextPrice",is_complete && is_for_sale); getChildView("TextPrice")->setEnabled(is_complete && is_for_sale);
childSetEnabled("EditPrice",is_complete && is_for_sale); getChildView("Edit Cost")->setEnabled(is_complete && is_for_sale);
} }
else else
{ {
childSetEnabled("SaleLabel",FALSE); getChildView("SaleLabel")->setEnabled(FALSE);
childSetEnabled("CheckPurchase",FALSE); getChildView("CheckPurchase")->setEnabled(FALSE);
childSetEnabled("NextOwnerLabel",FALSE); getChildView("NextOwnerLabel")->setEnabled(FALSE);
childSetEnabled("CheckNextOwnerModify",FALSE); getChildView("CheckNextOwnerModify")->setEnabled(FALSE);
childSetEnabled("CheckNextOwnerCopy",FALSE); getChildView("CheckNextOwnerCopy")->setEnabled(FALSE);
childSetEnabled("CheckNextOwnerTransfer",FALSE); getChildView("CheckNextOwnerTransfer")->setEnabled(FALSE);
childSetEnabled("RadioSaleType",FALSE); getChildView("RadioSaleType")->setEnabled(FALSE);
childSetEnabled("TextPrice",FALSE); getChildView("TextPrice")->setEnabled(FALSE);
childSetEnabled("EditPrice",FALSE); getChildView("Edit Cost")->setEnabled(FALSE);
} }
// Set values. // Set values.
childSetValue("CheckPurchase", is_for_sale); getChild<LLUICtrl>("CheckPurchase")->setValue(is_for_sale);
childSetValue("CheckNextOwnerModify",LLSD(BOOL(next_owner_mask & PERM_MODIFY))); getChildView("Edit Cost")->setEnabled(is_for_sale);
childSetValue("CheckNextOwnerCopy",LLSD(BOOL(next_owner_mask & PERM_COPY))); getChild<LLUICtrl>("CheckNextOwnerModify")->setValue(LLSD(BOOL(next_owner_mask & PERM_MODIFY)));
childSetValue("CheckNextOwnerTransfer",LLSD(BOOL(next_owner_mask & PERM_TRANSFER))); getChild<LLUICtrl>("CheckNextOwnerCopy")->setValue(LLSD(BOOL(next_owner_mask & PERM_COPY)));
getChild<LLUICtrl>("CheckNextOwnerTransfer")->setValue(LLSD(BOOL(next_owner_mask & PERM_TRANSFER)));
LLRadioGroup* radioSaleType = getChild<LLRadioGroup>("RadioSaleType"); LLRadioGroup* radioSaleType = getChild<LLRadioGroup>("RadioSaleType");
if (is_for_sale) if (is_for_sale)
@@ -581,21 +556,18 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
radioSaleType->setSelectedIndex((S32)sale_info.getSaleType() - 1); radioSaleType->setSelectedIndex((S32)sale_info.getSaleType() - 1);
S32 numerical_price; S32 numerical_price;
numerical_price = sale_info.getSalePrice(); numerical_price = sale_info.getSalePrice();
childSetText("EditPrice",llformat("%d",numerical_price)); getChild<LLUICtrl>("Edit Cost")->setValue(llformat("%d",numerical_price));
} }
else else
{ {
radioSaleType->setSelectedIndex(-1); radioSaleType->setSelectedIndex(-1);
childSetText("EditPrice",llformat("%d",0)); getChild<LLUICtrl>("Edit Cost")->setValue(llformat("%d",0));
} }
} }
// static void LLFloaterProperties::onClickCreator()
void LLFloaterProperties::onClickCreator(void* data)
{ {
LLFloaterProperties* self = (LLFloaterProperties*)data; LLInventoryItem* item = findItem();
if(!self) return;
LLInventoryItem* item = self->findItem();
if(!item) return; if(!item) return;
if(!item->getCreatorUUID().isNull()) if(!item->getCreatorUUID().isNull())
{ {
@@ -604,11 +576,9 @@ void LLFloaterProperties::onClickCreator(void* data)
} }
// static // static
void LLFloaterProperties::onClickOwner(void* data) void LLFloaterProperties::onClickOwner()
{ {
LLFloaterProperties* self = (LLFloaterProperties*)data; LLInventoryItem* item = findItem();
if(!self) return;
LLInventoryItem* item = self->findItem();
if(!item) return; if(!item) return;
if(item->getPermissions().isGroupOwned()) if(item->getPermissions().isGroupOwned())
{ {
@@ -627,20 +597,15 @@ void LLFloaterProperties::onClickOwner(void* data)
} }
// static // static
void LLFloaterProperties::onCommitName(LLUICtrl* ctrl, void* data) void LLFloaterProperties::onCommitName()
{ {
//llinfos << "LLFloaterProperties::onCommitName()" << llendl; //llinfos << "LLFloaterProperties::onCommitName()" << llendl;
LLFloaterProperties* self = (LLFloaterProperties*)data; LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem();
if(!self)
{
return;
}
LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->findItem();
if(!item) if(!item)
{ {
return; return;
} }
LLLineEditor* labelItemName = self->getChild<LLLineEditor>("LabelItemName"); LLLineEditor* labelItemName = getChild<LLLineEditor>("LabelItemName");
if(labelItemName&& if(labelItemName&&
(item->getName() != labelItemName->getText()) && (item->getName() != labelItemName->getText()) &&
@@ -648,7 +613,7 @@ void LLFloaterProperties::onCommitName(LLUICtrl* ctrl, void* data)
{ {
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
new_item->rename(labelItemName->getText()); new_item->rename(labelItemName->getText());
if(self->mObjectID.isNull()) if(mObjectID.isNull())
{ {
new_item->updateServer(FALSE); new_item->updateServer(FALSE);
gInventory.updateItem(new_item); gInventory.updateItem(new_item);
@@ -656,7 +621,7 @@ void LLFloaterProperties::onCommitName(LLUICtrl* ctrl, void* data)
} }
else else
{ {
LLViewerObject* object = gObjectList.findObject(self->mObjectID); LLViewerObject* object = gObjectList.findObject(mObjectID);
if(object) if(object)
{ {
object->updateInventory( object->updateInventory(
@@ -668,16 +633,13 @@ void LLFloaterProperties::onCommitName(LLUICtrl* ctrl, void* data)
} }
} }
// static void LLFloaterProperties::onCommitDescription()
void LLFloaterProperties::onCommitDescription(LLUICtrl* ctrl, void* data)
{ {
//llinfos << "LLFloaterProperties::onCommitDescription()" << llendl; //llinfos << "LLFloaterProperties::onCommitDescription()" << llendl;
LLFloaterProperties* self = (LLFloaterProperties*)data; LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem();
if(!self) return;
LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->findItem();
if(!item) return; if(!item) return;
LLLineEditor* labelItemDesc = self->getChild<LLLineEditor>("LabelItemDesc"); LLLineEditor* labelItemDesc = getChild<LLLineEditor>("LabelItemDesc");
if(!labelItemDesc) if(!labelItemDesc)
{ {
return; return;
@@ -688,7 +650,7 @@ void LLFloaterProperties::onCommitDescription(LLUICtrl* ctrl, void* data)
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
new_item->setDescription(labelItemDesc->getText()); new_item->setDescription(labelItemDesc->getText());
if(self->mObjectID.isNull()) if(mObjectID.isNull())
{ {
new_item->updateServer(FALSE); new_item->updateServer(FALSE);
gInventory.updateItem(new_item); gInventory.updateItem(new_item);
@@ -696,7 +658,7 @@ void LLFloaterProperties::onCommitDescription(LLUICtrl* ctrl, void* data)
} }
else else
{ {
LLViewerObject* object = gObjectList.findObject(self->mObjectID); LLViewerObject* object = gObjectList.findObject(mObjectID);
if(object) if(object)
{ {
object->updateInventory( object->updateInventory(
@@ -709,68 +671,66 @@ void LLFloaterProperties::onCommitDescription(LLUICtrl* ctrl, void* data)
} }
// static // static
void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data) void LLFloaterProperties::onCommitPermissions()
{ {
//llinfos << "LLFloaterProperties::onCommitPermissions()" << llendl; //llinfos << "LLFloaterProperties::onCommitPermissions()" << llendl;
LLFloaterProperties* self = (LLFloaterProperties*)data; LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem();
if(!self) return;
LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->findItem();
if(!item) return; if(!item) return;
LLPermissions perm(item->getPermissions()); LLPermissions perm(item->getPermissions());
LLCheckBoxCtrl* CheckGroupCopy = self->getChild<LLCheckBoxCtrl>("CheckGroupCopy"); LLCheckBoxCtrl* CheckGroupCopy = getChild<LLCheckBoxCtrl>("CheckGroupCopy");
if(CheckGroupCopy) if(CheckGroupCopy)
{ {
perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(), perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(),
CheckGroupCopy->get(), PERM_COPY); CheckGroupCopy->get(), PERM_COPY);
} }
LLCheckBoxCtrl* CheckGroupMod = self->getChild<LLCheckBoxCtrl>("CheckGroupMod"); LLCheckBoxCtrl* CheckGroupMod = getChild<LLCheckBoxCtrl>("CheckGroupMod");
if(CheckGroupMod) if(CheckGroupMod)
{ {
perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(), perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(),
CheckGroupMod->get(), PERM_MODIFY); CheckGroupMod->get(), PERM_MODIFY);
} }
LLCheckBoxCtrl* CheckGroupMove = self->getChild<LLCheckBoxCtrl>("CheckGroupMove"); LLCheckBoxCtrl* CheckGroupMove = getChild<LLCheckBoxCtrl>("CheckGroupMove");
if(CheckGroupMove) if(CheckGroupMove)
{ {
perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(), perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(),
CheckGroupMove->get(), PERM_MOVE); CheckGroupMove->get(), PERM_MOVE);
} }
LLCheckBoxCtrl* CheckEveryoneMove = self->getChild<LLCheckBoxCtrl>("CheckEveryoneMove"); LLCheckBoxCtrl* CheckEveryoneMove = getChild<LLCheckBoxCtrl>("CheckEveryoneMove");
if(CheckEveryoneMove) if(CheckEveryoneMove)
{ {
perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(), perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(),
CheckEveryoneMove->get(), PERM_MOVE); CheckEveryoneMove->get(), PERM_MOVE);
} }
LLCheckBoxCtrl* CheckEveryoneCopy = self->getChild<LLCheckBoxCtrl>("CheckEveryoneCopy"); LLCheckBoxCtrl* CheckEveryoneCopy = getChild<LLCheckBoxCtrl>("CheckEveryoneCopy");
if(CheckEveryoneCopy) if(CheckEveryoneCopy)
{ {
perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(), perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(),
CheckEveryoneCopy->get(), PERM_COPY); CheckEveryoneCopy->get(), PERM_COPY);
} }
LLCheckBoxCtrl* CheckNextOwnerModify = self->getChild<LLCheckBoxCtrl>("CheckNextOwnerModify"); LLCheckBoxCtrl* CheckNextOwnerModify = getChild<LLCheckBoxCtrl>("CheckNextOwnerModify");
if(CheckNextOwnerModify) if(CheckNextOwnerModify)
{ {
perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(), perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(),
CheckNextOwnerModify->get(), PERM_MODIFY); CheckNextOwnerModify->get(), PERM_MODIFY);
} }
LLCheckBoxCtrl* CheckNextOwnerCopy = self->getChild<LLCheckBoxCtrl>("CheckNextOwnerCopy"); LLCheckBoxCtrl* CheckNextOwnerCopy = getChild<LLCheckBoxCtrl>("CheckNextOwnerCopy");
if(CheckNextOwnerCopy) if(CheckNextOwnerCopy)
{ {
perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(), perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(),
CheckNextOwnerCopy->get(), PERM_COPY); CheckNextOwnerCopy->get(), PERM_COPY);
} }
LLCheckBoxCtrl* CheckNextOwnerTransfer = self->getChild<LLCheckBoxCtrl>("CheckNextOwnerTransfer"); LLCheckBoxCtrl* CheckNextOwnerTransfer = getChild<LLCheckBoxCtrl>("CheckNextOwnerTransfer");
if(CheckNextOwnerTransfer) if(CheckNextOwnerTransfer)
{ {
perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(), perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(),
CheckNextOwnerTransfer->get(), PERM_TRANSFER); CheckNextOwnerTransfer->get(), PERM_TRANSFER);
} }
if(perm != item->getPermissions() if(perm != item->getPermissions()
&& item->isComplete()) && item->isFinished())
{ {
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
new_item->setPermissions(perm); new_item->setPermissions(perm);
@@ -799,7 +759,7 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data)
flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
} }
new_item->setFlags(flags); new_item->setFlags(flags);
if(self->mObjectID.isNull()) if(mObjectID.isNull())
{ {
new_item->updateServer(FALSE); new_item->updateServer(FALSE);
gInventory.updateItem(new_item); gInventory.updateItem(new_item);
@@ -807,7 +767,7 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data)
} }
else else
{ {
LLViewerObject* object = gObjectList.findObject(self->mObjectID); LLViewerObject* object = gObjectList.findObject(mObjectID);
if(object) if(object)
{ {
object->updateInventory( object->updateInventory(
@@ -820,26 +780,22 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data)
else else
{ {
// need to make sure we don't just follow the click // need to make sure we don't just follow the click
self->refresh(); refresh();
} }
} }
// static // static
void LLFloaterProperties::onCommitSaleInfo(LLUICtrl* ctrl, void* data) void LLFloaterProperties::onCommitSaleInfo()
{ {
//llinfos << "LLFloaterProperties::onCommitSaleInfo()" << llendl; //llinfos << "LLFloaterProperties::onCommitSaleInfo()" << llendl;
LLFloaterProperties* self = (LLFloaterProperties*)data; updateSaleInfo();
if(!self) return;
self->updateSaleInfo();
} }
// static // static
void LLFloaterProperties::onCommitSaleType(LLUICtrl* ctrl, void* data) void LLFloaterProperties::onCommitSaleType()
{ {
//llinfos << "LLFloaterProperties::onCommitSaleType()" << llendl; //llinfos << "LLFloaterProperties::onCommitSaleType()" << llendl;
LLFloaterProperties* self = (LLFloaterProperties*)data; updateSaleInfo();
if(!self) return;
self->updateSaleInfo();
} }
void LLFloaterProperties::updateSaleInfo() void LLFloaterProperties::updateSaleInfo()
@@ -849,10 +805,10 @@ void LLFloaterProperties::updateSaleInfo()
LLSaleInfo sale_info(item->getSaleInfo()); LLSaleInfo sale_info(item->getSaleInfo());
if(!gAgent.allowOperation(PERM_TRANSFER, item->getPermissions(), GP_OBJECT_SET_SALE)) if(!gAgent.allowOperation(PERM_TRANSFER, item->getPermissions(), GP_OBJECT_SET_SALE))
{ {
childSetValue("CheckPurchase",LLSD((BOOL)FALSE)); getChild<LLUICtrl>("CheckPurchase")->setValue(LLSD((BOOL)FALSE));
} }
if((BOOL)childGetValue("CheckPurchase")) if((BOOL)getChild<LLUICtrl>("CheckPurchase")->getValue())
{ {
// turn on sale info // turn on sale info
LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_COPY; LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_COPY;
@@ -884,13 +840,11 @@ void LLFloaterProperties::updateSaleInfo()
sale_type = LLSaleInfo::FS_ORIGINAL; sale_type = LLSaleInfo::FS_ORIGINAL;
} }
LLLineEditor* EditPrice = getChild<LLLineEditor>("EditPrice");
S32 price = -1; S32 price = -1;
if(EditPrice) price = getChild<LLUICtrl>("Edit Cost")->getValue().asInteger();;
{
price = atoi(EditPrice->getText().c_str());
}
// Invalid data - turn off the sale // Invalid data - turn off the sale
if (price < 0) if (price < 0)
{ {
@@ -906,7 +860,7 @@ void LLFloaterProperties::updateSaleInfo()
sale_info.setSaleType(LLSaleInfo::FS_NOT); sale_info.setSaleType(LLSaleInfo::FS_NOT);
} }
if(sale_info != item->getSaleInfo() if(sale_info != item->getSaleInfo()
&& item->isComplete()) && item->isFinished())
{ {
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
@@ -965,16 +919,25 @@ LLInventoryItem* LLFloaterProperties::findItem() const
return item; return item;
} }
//static
void LLFloaterProperties::closeByID(const LLUUID& item_id, const LLUUID &object_id) void LLFloaterProperties::closeByID(const LLUUID& item_id, const LLUUID &object_id)
{ {
LLFloaterProperties* floaterp = find(item_id, object_id); LLFloaterProperties* floaterp = getInstance(item_id ^ object_id);
if (floaterp) if (floaterp)
{ {
floaterp->close(); floaterp->close();
} }
} }
//static
void LLFloaterProperties::dirtyAll()
{
for(instance_iter it = beginInstances();it!=endInstances();++it)
{
it->dirty();
}
}
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
/// LLMultiProperties /// LLMultiProperties
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------

View File

@@ -36,6 +36,8 @@
#include <map> #include <map>
#include "llmultifloater.h" #include "llmultifloater.h"
#include "lliconctrl.h" #include "lliconctrl.h"
#include "llinstancetracker.h"
#include "lluuid.h"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLFloaterProperties // Class LLFloaterProperties
@@ -50,7 +52,7 @@ class LLTextBox;
class LLPropertiesObserver; class LLPropertiesObserver;
class LLFloaterProperties : public LLFloater class LLFloaterProperties : public LLFloater, LLInstanceTracker<LLFloaterProperties, LLUUID>
{ {
public: public:
static LLFloaterProperties* find(const LLUUID& item_id, static LLFloaterProperties* find(const LLUUID& item_id,
@@ -62,21 +64,23 @@ public:
static void closeByID(const LLUUID& item_id, const LLUUID& object_id); static void closeByID(const LLUUID& item_id, const LLUUID& object_id);
LLFloaterProperties(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_id, const LLUUID& object_id); LLFloaterProperties(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_id, const LLUUID& object_id);
virtual ~LLFloaterProperties(); /*virtual*/ ~LLFloaterProperties();
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen();
// do everything necessary // do everything necessary
void dirty() { mDirty = TRUE; } void dirty() { mDirty = TRUE; }
void refresh(); void refresh();
protected: protected:
// ui callbacks // ui callbacks
static void onClickCreator(void* data); void onClickCreator();
static void onClickOwner(void* data); void onClickOwner();
static void onCommitName(LLUICtrl* ctrl, void* data); void onCommitName();
static void onCommitDescription(LLUICtrl* ctrl, void* data); void onCommitDescription();
static void onCommitPermissions(LLUICtrl* ctrl, void* data); void onCommitPermissions();
static void onCommitSaleInfo(LLUICtrl* ctrl, void* data); void onCommitSaleInfo();
static void onCommitSaleType(LLUICtrl* ctrl, void* data); void onCommitSaleType();
void updateSaleInfo(); void updateSaleInfo();
LLInventoryItem* findItem() const; LLInventoryItem* findItem() const;
@@ -95,10 +99,7 @@ protected:
BOOL mDirty; BOOL mDirty;
typedef std::map<LLUUID, LLFloaterProperties*, lluuid_less> instance_map; LLPropertiesObserver* mPropertiesObserver;
static instance_map sInstances;
static LLPropertiesObserver* sPropertiesObserver;
static S32 sPropertiesObserverCount;
}; };
class LLMultiProperties : public LLMultiFloater class LLMultiProperties : public LLMultiFloater

View File

@@ -49,7 +49,6 @@
#include "llradiogroup.h" #include "llradiogroup.h"
#include "llagent.h" #include "llagent.h"
#include "llalertdialog.h"
#include "llappviewer.h" #include "llappviewer.h"
#include "llavatarnamecache.h" #include "llavatarnamecache.h"
#include "llfloateravatarpicker.h" #include "llfloateravatarpicker.h"

View File

@@ -184,7 +184,7 @@ BOOL LLFloaterSellLandUI::postBuild()
{ {
childSetCommitCallback("sell_to", onChangeValue, this); childSetCommitCallback("sell_to", onChangeValue, this);
childSetCommitCallback("price", onChangeValue, this); childSetCommitCallback("price", onChangeValue, this);
childSetPrevalidate("price", LLLineEditor::prevalidateNonNegativeS32); getChild<LLLineEditor>("price")->setPrevalidate(LLLineEditor::prevalidateNonNegativeS32);
childSetCommitCallback("sell_objects", onChangeValue, this); childSetCommitCallback("sell_objects", onChangeValue, this);
childSetAction("sell_to_select_agent", doSelectAgent, this); childSetAction("sell_to_select_agent", doSelectAgent, this);
childSetAction("cancel_btn", doCancel, this); childSetAction("cancel_btn", doCancel, this);

View File

@@ -37,6 +37,7 @@
#include "llcolorswatch.h" #include "llcolorswatch.h"
//#include "llfirstuse.h" //#include "llfirstuse.h"
#include "llfloater.h" #include "llfloater.h"
#include "llfiltereditor.h"
#include "llscrolllistctrl.h" #include "llscrolllistctrl.h"
#include "llspinctrl.h" #include "llspinctrl.h"
#include "lltexteditor.h" #include "lltexteditor.h"
@@ -107,7 +108,7 @@ BOOL LLFloaterSettingsDebug::postBuild()
getChild<LLUICtrl>("boolean_combo")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); getChild<LLUICtrl>("boolean_combo")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this));
getChild<LLUICtrl>("copy_btn")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCopyToClipboard, this)); getChild<LLUICtrl>("copy_btn")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCopyToClipboard, this));
getChild<LLUICtrl>("default_btn")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onClickDefault, this)); getChild<LLUICtrl>("default_btn")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onClickDefault, this));
getChild<LLSearchEditor>("search_settings_input")->setSearchCallback(onUpdateFilter, this); getChild<LLFilterEditor>("search_settings_input")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onUpdateFilter, this, _2));
mComment = getChild<LLTextEditor>("comment_text"); mComment = getChild<LLTextEditor>("comment_text");
return TRUE; return TRUE;
} }
@@ -532,9 +533,9 @@ void LLFloaterSettingsDebug::updateControl()
} }
void LLFloaterSettingsDebug::onUpdateFilter(const std::string& searchTerm, void*) void LLFloaterSettingsDebug::onUpdateFilter(const LLSD& value)
{ {
LLFloaterSettingsDebug::getInstance()->updateFilter(searchTerm); updateFilter(value.asString());
} }
void LLFloaterSettingsDebug::updateFilter(std::string searchTerm) void LLFloaterSettingsDebug::updateFilter(std::string searchTerm)

View File

@@ -53,7 +53,7 @@ public:
void updateControl(); void updateControl();
// updates control filter to display in the controls list on keystroke // updates control filter to display in the controls list on keystroke
static void onUpdateFilter(const std::string& searchTerm, void*); void onUpdateFilter(const LLSD& value);
void updateFilter(std::string searchTerm); void updateFilter(std::string searchTerm);
void onSettingSelect(); void onSettingSelect();

View File

@@ -62,15 +62,15 @@ public:
LLFloaterTestImpl(); LLFloaterTestImpl();
private: private:
static void onClickButton(void*); static void onClickButton();
static void onClickText(void*); static void onClickText();
static void onClickTab(void*, bool); static void onClickTab();
static void onCommitCheck(LLUICtrl*, void*); static void onCommitCheck();
static void onCommitCombo(LLUICtrl*, void*); static void onCommitCombo(LLUICtrl* ctrl, const LLSD& value);
static void onCommitLine(LLUICtrl*, void*); static void onCommitLine();
static void onKeyLine(LLLineEditor*, void*); static void onKeyLine();
static void onFocusLostLine(LLFocusableElement*, void*); static void onFocusLostLine();
static void onChangeRadioGroup(LLUICtrl*, void*); static void onChangeRadioGroup();
LLButton* mBtnSimple; LLButton* mBtnSimple;
LLButton* mBtnUnicode; LLButton* mBtnUnicode;
@@ -118,7 +118,7 @@ LLFloaterTestImpl::LLFloaterTestImpl()
btn = new LLButton(std::string("can't click"), btn = new LLButton(std::string("can't click"),
LLRect(LEFT+150, y, LEFT+150+100, y-LINE), LLRect(LEFT+150, y, LEFT+150+100, y-LINE),
LLStringUtil::null, LLStringUtil::null,
onClickButton, this); boost::bind(&LLFloaterTestImpl::onClickButton));
btn->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP); btn->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP);
btn->setFont(LLFontGL::getFontSansSerifSmall()); btn->setFont(LLFontGL::getFontSansSerifSmall());
addChild(btn); addChild(btn);
@@ -128,7 +128,7 @@ LLFloaterTestImpl::LLFloaterTestImpl()
50, // max_width 50, // max_width
LLFontGL::getFontSansSerifSmall(), LLFontGL::getFontSansSerifSmall(),
TRUE); // mouse_opaque TRUE); // mouse_opaque
text->setClickedCallback(onClickText); text->setClickedCallback(boost::bind(&onClickText));
text->setRect(LLRect(LEFT, y, RIGHT, y-LINE)); text->setRect(LLRect(LEFT, y, RIGHT, y-LINE));
addChild(text); addChild(text);
@@ -137,7 +137,7 @@ LLFloaterTestImpl::LLFloaterTestImpl()
btn = new LLButton(std::string("can click"), btn = new LLButton(std::string("can click"),
LLRect(LEFT+150, y, LEFT+150+100, y-LINE), LLRect(LEFT+150, y, LEFT+150+100, y-LINE),
LLStringUtil::null, LLStringUtil::null,
onClickButton, this); boost::bind(&LLFloaterTestImpl::onClickButton));
btn->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP); btn->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP);
btn->setFont(LLFontGL::getFontSansSerifSmall()); btn->setFont(LLFontGL::getFontSansSerifSmall());
addChild(btn); addChild(btn);
@@ -160,7 +160,7 @@ LLFloaterTestImpl::LLFloaterTestImpl()
addChild(tab); addChild(tab);
mTab = tab; mTab = tab;
tab->setCommitCallback(boost::bind(&LLFloaterTestImpl::onClickTab,_1,_2)); tab->setCommitCallback(boost::bind(&LLFloaterTestImpl::onClickTab));
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// First tab container panel // First tab container panel
@@ -194,7 +194,7 @@ LLFloaterTestImpl::LLFloaterTestImpl()
std::string("tool_zoom.tga"), std::string("tool_zoom.tga"),
std::string("tool_zoom_active.tga"), std::string("tool_zoom_active.tga"),
LLStringUtil::null, LLStringUtil::null,
onClickButton, this, boost::bind(&LLFloaterTestImpl::onClickButton),
LLFontGL::getFontSansSerifSmall()); LLFontGL::getFontSansSerifSmall());
btn->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); btn->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP);
panel->addChild(btn); panel->addChild(btn);
@@ -205,7 +205,7 @@ LLFloaterTestImpl::LLFloaterTestImpl()
LLRect(LEFT, y, LEFT+150, y-LLCHECKBOXCTRL_HEIGHT), LLRect(LEFT, y, LEFT+150, y-LLCHECKBOXCTRL_HEIGHT),
std::string("Simple Checkbox"), std::string("Simple Checkbox"),
LLFontGL::getFontSansSerifSmall(), LLFontGL::getFontSansSerifSmall(),
onCommitCheck, this, boost::bind(&LLFloaterTestImpl::onCommitCheck),
TRUE, // initial_value TRUE, // initial_value
FALSE, // radio_style FALSE, // radio_style
std::string("UIFloaterTestBool")); // control_which std::string("UIFloaterTestBool")); // control_which
@@ -217,7 +217,7 @@ LLFloaterTestImpl::LLFloaterTestImpl()
LLRect(LEFT, y, LEFT+150, y-LLCHECKBOXCTRL_HEIGHT), LLRect(LEFT, y, LEFT+150, y-LLCHECKBOXCTRL_HEIGHT),
std::string("TODO: Unicode Checkbox"), std::string("TODO: Unicode Checkbox"),
LLFontGL::getFontSansSerifSmall(), LLFontGL::getFontSansSerifSmall(),
onCommitCheck, this, boost::bind(&LLFloaterTestImpl::onCommitCheck),
TRUE, // initial_value TRUE, // initial_value
FALSE, // radio_style FALSE, // radio_style
LLStringUtil::null); // control_which LLStringUtil::null); // control_which
@@ -229,7 +229,7 @@ LLFloaterTestImpl::LLFloaterTestImpl()
combo = new LLComboBox(std::string("combo"), combo = new LLComboBox(std::string("combo"),
LLRect(LEFT, y, LEFT+100, y-LLCOMBOBOX_HEIGHT), LLRect(LEFT, y, LEFT+100, y-LLCOMBOBOX_HEIGHT),
std::string("Combobox Label"), std::string("Combobox Label"),
onCommitCombo, this); boost::bind(&LLFloaterTestImpl::onCommitCombo, _1,_2) );
combo->add(std::string("first item")); combo->add(std::string("first item"));
combo->add(std::string("second item")); combo->add(std::string("second item"));
combo->add(std::string("should go to the top"), ADD_TOP); combo->add(std::string("should go to the top"), ADD_TOP);
@@ -253,10 +253,9 @@ LLFloaterTestImpl::LLFloaterTestImpl()
std::string("test some unicode text here"), std::string("test some unicode text here"),
LLFontGL::getFontSansSerif(), LLFontGL::getFontSansSerif(),
200, // max_length_bytes 200, // max_length_bytes
onCommitLine, boost::bind(&LLFloaterTestImpl::onCommitLine),
onKeyLine, boost::bind(&LLFloaterTestImpl::onKeyLine),
onFocusLostLine, boost::bind(&LLFloaterTestImpl::onFocusLostLine));
this);
line->setHandleEditKeysDirectly(true); line->setHandleEditKeysDirectly(true);
panel->addChild(line); panel->addChild(line);
@@ -266,7 +265,7 @@ LLFloaterTestImpl::LLFloaterTestImpl()
std::string("radio_group"), std::string("radio_group"),
LLRect(LEFT, y, LEFT+200, y - 50), LLRect(LEFT, y, LEFT+200, y - 50),
0, // initial_index 0, // initial_index
onChangeRadioGroup, this, boost::bind(&LLFloaterTestImpl::onChangeRadioGroup),
TRUE); // border TRUE); // border
panel->addChild(group); panel->addChild(group);
@@ -292,7 +291,7 @@ LLFloaterTestImpl::LLFloaterTestImpl()
btn = new LLButton(std::string("Simple Button"), btn = new LLButton(std::string("Simple Button"),
LLRect(LEFT, y, LEFT+100, y - 20), LLRect(LEFT, y, LEFT+100, y - 20),
LLStringUtil::null, LLStringUtil::null,
onClickButton, this); boost::bind(&LLFloaterTestImpl::onClickButton));
btn->setFollows(FOLLOWS_TOP|FOLLOWS_LEFT); btn->setFollows(FOLLOWS_TOP|FOLLOWS_LEFT);
panel->addChild(btn); panel->addChild(btn);
mBtnSimple = btn; mBtnSimple = btn;
@@ -305,58 +304,56 @@ LLFloaterTestImpl::LLFloaterTestImpl()
} }
// static // static
void LLFloaterTestImpl::onClickButton(void*) void LLFloaterTestImpl::onClickButton()
{ {
llinfos << "button clicked" << llendl; llinfos << "button clicked" << llendl;
} }
// static // static
void LLFloaterTestImpl::onClickText(void*) void LLFloaterTestImpl::onClickText()
{ {
llinfos << "text clicked" << llendl; llinfos << "text clicked" << llendl;
} }
// static // static
void LLFloaterTestImpl::onClickTab(void*, bool) void LLFloaterTestImpl::onClickTab()
{ {
llinfos << "click tab" << llendl; llinfos << "click tab" << llendl;
} }
// static // static
void LLFloaterTestImpl::onCommitCheck(LLUICtrl*, void*) void LLFloaterTestImpl::onCommitCheck()
{ {
llinfos << "commit check" << llendl; llinfos << "commit check" << llendl;
} }
// static // static
void LLFloaterTestImpl::onCommitCombo(LLUICtrl* ctrl, void*) void LLFloaterTestImpl::onCommitCombo(LLUICtrl* ctrl, const LLSD& value)
{ {
LLComboBox* combo = (LLComboBox*)ctrl; LLComboBox* combo = (LLComboBox*)ctrl;
std::string name = combo->getSimple(); llinfos << "commit combo name " << combo->getSimple() << " value " << value.asString() << llendl;
LLSD value = combo->getValue();
llinfos << "commit combo name " << name << " value " << value.asString() << llendl;
} }
// static // static
void LLFloaterTestImpl::onCommitLine(LLUICtrl*, void*) void LLFloaterTestImpl::onCommitLine()
{ {
llinfos << "commit line editor" << llendl; llinfos << "commit line editor" << llendl;
} }
// static // static
void LLFloaterTestImpl::onKeyLine(LLLineEditor*, void*) void LLFloaterTestImpl::onKeyLine()
{ {
llinfos << "keystroke line editor" << llendl; llinfos << "keystroke line editor" << llendl;
} }
// static // static
void LLFloaterTestImpl::onFocusLostLine(LLFocusableElement*, void*) void LLFloaterTestImpl::onFocusLostLine()
{ {
llinfos << "focus lost line editor" << llendl; llinfos << "focus lost line editor" << llendl;
} }
// static // static
void LLFloaterTestImpl::onChangeRadioGroup(LLUICtrl*, void*) void LLFloaterTestImpl::onChangeRadioGroup()
{ {
llinfos << "change radio group" << llendl; llinfos << "change radio group" << llendl;
} }

View File

@@ -62,6 +62,7 @@
#include "llpreviewlandmark.h" #include "llpreviewlandmark.h"
#include "llregionhandle.h" #include "llregionhandle.h"
#include "llscrolllistctrl.h" #include "llscrolllistctrl.h"
#include "llsearcheditor.h"
#include "lltextbox.h" #include "lltextbox.h"
#include "lltracker.h" #include "lltracker.h"
#include "lltrans.h" #include "lltrans.h"
@@ -211,23 +212,22 @@ BOOL LLFloaterWorldMap::postBuild()
LLComboBox *avatar_combo = getChild<LLComboBox>("friend combo"); LLComboBox *avatar_combo = getChild<LLComboBox>("friend combo");
avatar_combo->selectFirstItem(); avatar_combo->selectFirstItem();
avatar_combo->setPrearrangeCallback( onAvatarComboPrearrange ); avatar_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboPrearrange,this) );
avatar_combo->setTextEntryCallback( onComboTextEntry ); avatar_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry,this) );
mListFriendCombo = dynamic_cast<LLCtrlListInterface *>(avatar_combo); mListFriendCombo = dynamic_cast<LLCtrlListInterface *>(avatar_combo);
LLLineEditor *location_editor = getChild<LLLineEditor>("location"); LLSearchEditor *location_editor = getChild<LLSearchEditor>("location");
location_editor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1)); location_editor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1));
location_editor->setKeystrokeCallback( onSearchTextEntry ); location_editor->setKeystrokeCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this));
LLScrollListCtrl* search_results = getChild<LLScrollListCtrl>("search_results"); LLScrollListCtrl* search_results = getChild<LLScrollListCtrl>("search_results");
search_results->setDoubleClickCallback(boost::bind(&LLFloaterWorldMap::onClickTeleportBtn,this)); search_results->setDoubleClickCallback(boost::bind(&LLFloaterWorldMap::onClickTeleportBtn,this));
mListSearchResults = dynamic_cast<LLCtrlListInterface *>(search_results); mListSearchResults = dynamic_cast<LLCtrlListInterface *>(search_results);
LLComboBox *landmark_combo = getChild<LLComboBox>( "landmark combo"); LLComboBox *landmark_combo = getChild<LLComboBox>( "landmark combo");
landmark_combo->selectFirstItem(); landmark_combo->selectFirstItem();
landmark_combo->setPrearrangeCallback( onLandmarkComboPrearrange ); landmark_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onLandmarkComboPrearrange, this) );
landmark_combo->setTextEntryCallback( onComboTextEntry ); landmark_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) );
mListLandmarkCombo = dynamic_cast<LLCtrlListInterface *>(landmark_combo); mListLandmarkCombo = dynamic_cast<LLCtrlListInterface *>(landmark_combo);
avatar_combo->setCommitCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboCommit,this) ); avatar_combo->setCommitCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboCommit,this) );
@@ -1082,22 +1082,20 @@ void LLFloaterWorldMap::onGoHome()
} }
// static void LLFloaterWorldMap::onLandmarkComboPrearrange( )
void LLFloaterWorldMap::onLandmarkComboPrearrange( LLUICtrl* ctrl, void* userdata )
{ {
LLFloaterWorldMap* self = gFloaterWorldMap; if( mIsClosing )
if( !self || self->mIsClosing )
{ {
return; return;
} }
LLCtrlListInterface *list = self->childGetListInterface("landmark combo"); LLCtrlListInterface *list = mListLandmarkCombo;
if (!list) return; if (!list) return;
LLUUID current_choice = list->getCurrentID(); LLUUID current_choice = list->getCurrentID();
gFloaterWorldMap->buildLandmarkIDLists(); buildLandmarkIDLists();
if( current_choice.isNull() || !list->setCurrentByID( current_choice ) ) if( current_choice.isNull() || !list->setCurrentByID( current_choice ) )
{ {
LLTracker::stopTracking(NULL); LLTracker::stopTracking(NULL);
@@ -1105,7 +1103,7 @@ void LLFloaterWorldMap::onLandmarkComboPrearrange( LLUICtrl* ctrl, void* userdat
} }
void LLFloaterWorldMap::onComboTextEntry( LLLineEditor* ctrl, void* userdata ) void LLFloaterWorldMap::onComboTextEntry()
{ {
// Reset the tracking whenever we start typing into any of the search fields, // Reset the tracking whenever we start typing into any of the search fields,
// so that hitting <enter> does an auto-complete versus teleporting us to the // so that hitting <enter> does an auto-complete versus teleporting us to the
@@ -1113,11 +1111,10 @@ void LLFloaterWorldMap::onComboTextEntry( LLLineEditor* ctrl, void* userdata )
LLTracker::stopTracking(NULL); LLTracker::stopTracking(NULL);
} }
// static void LLFloaterWorldMap::onSearchTextEntry( )
void LLFloaterWorldMap::onSearchTextEntry( LLLineEditor* ctrl, void* userdata )
{ {
onComboTextEntry(ctrl, userdata); onComboTextEntry();
gFloaterWorldMap->updateSearchEnabled(); updateSearchEnabled();
} }
// static // static
@@ -1168,26 +1165,25 @@ void LLFloaterWorldMap::onLandmarkComboCommit()
} }
// static // static
void LLFloaterWorldMap::onAvatarComboPrearrange( LLUICtrl* ctrl, void* userdata ) void LLFloaterWorldMap::onAvatarComboPrearrange( )
{ {
LLFloaterWorldMap* self = gFloaterWorldMap; if( mIsClosing )
if( !self || self->mIsClosing )
{ {
return; return;
} }
LLCtrlListInterface *list = self->childGetListInterface("friend combo"); LLCtrlListInterface *list = mListFriendCombo;
if (!list) return; if (!list) return;
LLUUID current_choice; LLUUID current_choice;
if( LLAvatarTracker::instance().haveTrackingInfo() ) if( LLAvatarTracker::instance().haveTrackingInfo() )
{ {
current_choice = LLAvatarTracker::instance().getAvatarID(); current_choice = LLAvatarTracker::instance().getAvatarID();
} }
self->buildAvatarIDList(); buildAvatarIDList();
if( !list->setCurrentByID( current_choice ) || current_choice.isNull() ) if( !list->setCurrentByID( current_choice ) || current_choice.isNull() )
{ {
LLTracker::stopTracking(NULL); LLTracker::stopTracking(NULL);

View File

@@ -116,14 +116,14 @@ public:
protected: protected:
void onGoHome(); void onGoHome();
static void onLandmarkComboPrearrange( LLUICtrl* ctrl, void* data ); void onLandmarkComboPrearrange();
void onLandmarkComboCommit(); void onLandmarkComboCommit();
static void onAvatarComboPrearrange( LLUICtrl* ctrl, void* data ); void onAvatarComboPrearrange();
void onAvatarComboCommit(); void onAvatarComboCommit();
static void onComboTextEntry( LLLineEditor* ctrl, void* data ); void onComboTextEntry( );
static void onSearchTextEntry( LLLineEditor* ctrl, void* data ); void onSearchTextEntry( );
void onClearBtn(); void onClearBtn();
void onClickTeleportBtn(); void onClickTeleportBtn();

View File

@@ -235,10 +235,9 @@ LLFolderView::LLFolderView( const std::string& name,
mRenamer = new LLLineEditor(std::string("ren"), getRect(), LLStringUtil::null, getLabelFontForStyle(LLFontGL::NORMAL), mRenamer = new LLLineEditor(std::string("ren"), getRect(), LLStringUtil::null, getLabelFontForStyle(LLFontGL::NORMAL),
DB_INV_ITEM_NAME_STR_LEN, DB_INV_ITEM_NAME_STR_LEN,
&LLFolderView::commitRename, boost::bind(&LLFolderView::commitRename,this),
NULL, NULL,
NULL, NULL,
this,
&LLLineEditor::prevalidatePrintableNotPipe); &LLLineEditor::prevalidatePrintableNotPipe);
//mRenamer->setWriteableBgColor(LLColor4::white); //mRenamer->setWriteableBgColor(LLColor4::white);
// Escape is handled by reverting the rename, not commiting it (default behavior) // Escape is handled by reverting the rename, not commiting it (default behavior)
@@ -897,13 +896,9 @@ BOOL LLFolderView::startDrag(LLToolDragAndDrop::ESource source)
return can_drag; return can_drag;
} }
void LLFolderView::commitRename( LLUICtrl* renamer, void* user_data ) void LLFolderView::commitRename( )
{ {
LLFolderView* root = reinterpret_cast<LLFolderView*>(user_data); finishRenamingItem();
if( root )
{
root->finishRenamingItem();
}
} }
void LLFolderView::draw() void LLFolderView::draw()

View File

@@ -260,7 +260,7 @@ private:
protected: protected:
LLScrollableContainerView* mScrollContainer; // NULL if this is not a child of a scroll container. LLScrollableContainerView* mScrollContainer; // NULL if this is not a child of a scroll container.
static void commitRename( LLUICtrl* renamer, void* user_data ); void commitRename( );
void onRenamerLost(); void onRenamerLost();
void finishRenamingItem( void ); void finishRenamingItem( void );

View File

@@ -93,7 +93,7 @@ LLFolderViewItem::LLFolderViewItem( const std::string& name, LLUIImagePtr icon,
S32 creation_date, S32 creation_date,
LLFolderView* root, LLFolderView* root,
LLFolderViewEventListener* listener ) : LLFolderViewEventListener* listener ) :
LLUICtrl( name, LLRect(0, 0, 0, 0), TRUE, NULL, NULL, FOLLOWS_LEFT|FOLLOWS_TOP|FOLLOWS_RIGHT), LLUICtrl( name, LLRect(0, 0, 0, 0), TRUE, NULL, FOLLOWS_LEFT|FOLLOWS_TOP|FOLLOWS_RIGHT),
mLabelWidth(0), mLabelWidth(0),
mLabelWidthDirty(false), mLabelWidthDirty(false),
mParentFolder( NULL ), mParentFolder( NULL ),

View File

@@ -54,24 +54,11 @@
#include "hippogridmanager.h" #include "hippogridmanager.h"
#include <boost/lexical_cast.hpp>
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
/// Local function declarations, constants, enums, and typedefs /// Local function declarations, constants, enums, and typedefs
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLGiveMoneyInfo
//
// A small class used to track callback information
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
struct LLGiveMoneyInfo
{
LLFloaterPay* mFloater;
S32 mAmount;
LLGiveMoneyInfo(LLFloaterPay* floater, S32 amount) :
mFloater(floater), mAmount(amount){}
};
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
/// Class LLFloaterPay /// Class LLFloaterPay
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
@@ -88,13 +75,19 @@ LLFloaterPay::LLFloaterPay(const std::string& name,
LLFloater(name, std::string("FloaterPayRectB"), LLStringUtil::null, RESIZE_NO, LLFloater(name, std::string("FloaterPayRectB"), LLStringUtil::null, RESIZE_NO,
DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, DRAG_ON_TOP, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, DRAG_ON_TOP,
MINIMIZE_NO, CLOSE_YES), MINIMIZE_NO, CLOSE_YES),
mCallbackData(),
mCallback(callback), mCallback(callback),
mObjectNameText(NULL), mObjectNameText(NULL),
mTargetUUID(uuid), mTargetUUID(uuid),
mTargetIsObject(target_is_object), mTargetIsObject(target_is_object),
mTargetIsGroup(FALSE) mTargetIsGroup(FALSE),
mDefaultValue(0)
{ {
mQuickPayInfo[0] = PAY_BUTTON_DEFAULT_0;
mQuickPayInfo[1] = PAY_BUTTON_DEFAULT_1;
mQuickPayInfo[2] = PAY_BUTTON_DEFAULT_2;
mQuickPayInfo[3] = PAY_BUTTON_DEFAULT_3;
BOOST_STATIC_ASSERT(MAX_PAY_BUTTONS == 4);
if (target_is_object) if (target_is_object)
{ {
LLUICtrlFactory::getInstance()->buildFloater(this,"floater_pay_object.xml"); LLUICtrlFactory::getInstance()->buildFloater(this,"floater_pay_object.xml");
@@ -105,55 +98,14 @@ LLFloaterPay::LLFloaterPay(const std::string& name,
LLUICtrlFactory::getInstance()->buildFloater(this,"floater_pay.xml"); LLUICtrlFactory::getInstance()->buildFloater(this,"floater_pay.xml");
} }
for(U32 i = 0; i < MAX_PAY_BUTTONS; ++i)
S32 i =0; {
mQuickPayButton[i] = getChild<LLButton>("fastpay " + boost::lexical_cast<std::string>(mQuickPayInfo[i]));
mQuickPayButton[i]->setClickedCallback(boost::bind(&LLFloaterPay::onGive,this,std::ref(mQuickPayInfo[i])));
mQuickPayButton[i]->setVisible(FALSE);
mQuickPayButton[i]->setLabelArg("[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());
}
LLGiveMoneyInfo* info = new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_0);
mCallbackData.push_back(info);
childSetAction("fastpay 1",&LLFloaterPay::onGive,info);
childSetVisible("fastpay 1", FALSE);
childSetLabelArg("fastpay 1", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());
mQuickPayButton[i] = getChild<LLButton>("fastpay 1");
mQuickPayInfo[i] = info;
++i;
info = new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_1);
mCallbackData.push_back(info);
childSetAction("fastpay 5",&LLFloaterPay::onGive,info);
childSetVisible("fastpay 5", FALSE);
childSetLabelArg("fastpay 5", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());
mQuickPayButton[i] = getChild<LLButton>("fastpay 5");
mQuickPayInfo[i] = info;
++i;
info = new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_2);
mCallbackData.push_back(info);
childSetAction("fastpay 10",&LLFloaterPay::onGive,info);
childSetVisible("fastpay 10", FALSE);
childSetLabelArg("fastpay 10", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());
mQuickPayButton[i] = getChild<LLButton>("fastpay 10");
mQuickPayInfo[i] = info;
++i;
info = new LLGiveMoneyInfo(this, PAY_BUTTON_DEFAULT_3);
mCallbackData.push_back(info);
childSetAction("fastpay 20",&LLFloaterPay::onGive,info);
childSetVisible("fastpay 20", FALSE);
childSetLabelArg("fastpay 20", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());
mQuickPayButton[i] = getChild<LLButton>("fastpay 20");
mQuickPayInfo[i] = info;
++i;
childSetVisible("amount text", FALSE); childSetVisible("amount text", FALSE);
std::string last_amount; std::string last_amount;
@@ -162,21 +114,20 @@ LLFloaterPay::LLFloaterPay(const std::string& name,
last_amount = llformat("%d", sLastAmount); last_amount = llformat("%d", sLastAmount);
} }
childSetVisible("amount", FALSE); LLLineEditor* amount = getChild<LLLineEditor>("amount");
amount->setVisible(false);
childSetKeystrokeCallback("amount", &LLFloaterPay::onKeystroke, this); amount->setKeystrokeCallback(boost::bind(&LLFloaterPay::onKeystroke, this, _1));
childSetText("amount", last_amount); amount->setText(last_amount);
childSetPrevalidate("amount", LLLineEditor::prevalidateNonNegativeS32); amount->setPrevalidate(&LLLineEditor::prevalidateNonNegativeS32);
info = new LLGiveMoneyInfo(this, 0);
mCallbackData.push_back(info);
childSetAction("pay btn",&LLFloaterPay::onGive,info); LLButton* pay_btn = getChild<LLButton>("pay btn");
setDefaultBtn("pay btn"); pay_btn->setClickedCallback(boost::bind(&LLFloaterPay::onGive,this,std::ref(mDefaultValue)));
childSetVisible("pay btn", FALSE); setDefaultBtn(pay_btn);
childSetEnabled("pay btn", (sLastAmount > 0)); pay_btn->setVisible(false);
pay_btn->setEnabled(sLastAmount > 0);
childSetAction("cancel btn",&LLFloaterPay::onCancel,this); getChild<LLButton>("cancel btn")->setClickedCallback(boost::bind(&LLFloaterPay::onCancel,this));
center(); center();
open(); /*Flawfinder: ignore*/ open(); /*Flawfinder: ignore*/
@@ -185,7 +136,6 @@ LLFloaterPay::LLFloaterPay(const std::string& name,
// Destroys the object // Destroys the object
LLFloaterPay::~LLFloaterPay() LLFloaterPay::~LLFloaterPay()
{ {
std::for_each(mCallbackData.begin(), mCallbackData.end(), DeletePointer());
} }
// static // static
@@ -250,7 +200,7 @@ void LLFloaterPay::processPayPriceReply(LLMessageSystem* msg, void **userdata)
self->mQuickPayButton[i]->setLabelSelected(button_str); self->mQuickPayButton[i]->setLabelSelected(button_str);
self->mQuickPayButton[i]->setLabelUnselected(button_str); self->mQuickPayButton[i]->setLabelUnselected(button_str);
self->mQuickPayButton[i]->setVisible(TRUE); self->mQuickPayButton[i]->setVisible(TRUE);
self->mQuickPayInfo[i]->mAmount = pay_button; self->mQuickPayInfo[i] = pay_button;
self->childSetVisible("fastpay text",TRUE); self->childSetVisible("fastpay text",TRUE);
if ( pay_button > max_pay_amount ) if ( pay_button > max_pay_amount )
@@ -411,37 +361,22 @@ void LLFloaterPay::onCacheOwnerName(const LLUUID& owner_id,
childSetTextArg("payee_name", "[NAME]", full_name); childSetTextArg("payee_name", "[NAME]", full_name);
} }
// static void LLFloaterPay::onCancel()
void LLFloaterPay::onCancel(void* data)
{ {
LLFloaterPay* self = reinterpret_cast<LLFloaterPay*>(data); close();
if(self)
{
self->close();
}
} }
// static void LLFloaterPay::onKeystroke(LLLineEditor* caller)
void LLFloaterPay::onKeystroke(LLLineEditor*, void* data)
{ {
LLFloaterPay* self = reinterpret_cast<LLFloaterPay*>(data); // enable the Pay button when amount is non-empty and positive, disable otherwise
if(self) std::string amtstr = caller->getValue().asString();
{ childSetEnabled("pay btn", !amtstr.empty() && atoi(amtstr.c_str()) > 0);
// enable the Pay button when amount is non-empty and positive, disable otherwise
std::string amtstr = self->childGetText("amount");
self->childSetEnabled("pay btn", !amtstr.empty() && atoi(amtstr.c_str()) > 0);
}
} }
// static void LLFloaterPay::onGive(const S32& amount)
void LLFloaterPay::onGive(void* data)
{ {
LLGiveMoneyInfo* info = reinterpret_cast<LLGiveMoneyInfo*>(data); give(amount);
if(info && info->mFloater) close();
{
info->mFloater->give(info->mAmount);
info->mFloater->close();
}
} }
void LLFloaterPay::give(S32 amount) void LLFloaterPay::give(S32 amount)

View File

@@ -46,7 +46,6 @@ class LLLineEditor;
class LLTextBox; class LLTextBox;
class LLButton; class LLButton;
class LLObjectSelection; class LLObjectSelection;
struct LLGiveMoneyInfo;
typedef void (*money_callback)(const LLUUID&, LLViewerRegion*,S32,BOOL,S32,const std::string&); typedef void (*money_callback)(const LLUUID&, LLViewerRegion*,S32,BOOL,S32,const std::string&);
@@ -72,16 +71,15 @@ public:
BOOL is_group); BOOL is_group);
private: private:
static void onCancel(void* data); void onCancel();
static void onKeystroke(LLLineEditor* editor, void* data); void onKeystroke(LLLineEditor* caller);
static void onGive(void* data); void onGive(const S32& amount);
void give(S32 amount); void give(S32 amount);
static void processPayPriceReply(LLMessageSystem* msg, void **userdata); static void processPayPriceReply(LLMessageSystem* msg, void **userdata);
void onCacheOwnerName( const LLUUID& owner_id, const std::string& full_name, bool is_group); void onCacheOwnerName( const LLUUID& owner_id, const std::string& full_name, bool is_group);
void finishPayUI(const LLUUID& target_id, BOOL is_group); void finishPayUI(const LLUUID& target_id, BOOL is_group);
protected: protected:
std::vector<LLGiveMoneyInfo*> mCallbackData;
money_callback mCallback; money_callback mCallback;
LLTextBox* mObjectNameText; LLTextBox* mObjectNameText;
LLUUID mTargetUUID; LLUUID mTargetUUID;
@@ -90,7 +88,8 @@ protected:
BOOL mHaveName; BOOL mHaveName;
LLButton* mQuickPayButton[MAX_PAY_BUTTONS]; LLButton* mQuickPayButton[MAX_PAY_BUTTONS];
LLGiveMoneyInfo* mQuickPayInfo[MAX_PAY_BUTTONS]; S32 mQuickPayInfo[MAX_PAY_BUTTONS];
S32 mDefaultValue;
LLSafeHandle<LLObjectSelection> mObjectSelection; LLSafeHandle<LLObjectSelection> mObjectSelection;

View File

@@ -66,7 +66,7 @@
#pragma warning(pop) // Restore all warnings to the previous state #pragma warning(pop) // Restore all warnings to the previous state
#endif #endif
const U32 MAX_CACHED_GROUPS = 10; const U32 MAX_CACHED_GROUPS = 20;
// //
// LLRoleActionSet // LLRoleActionSet
@@ -236,8 +236,15 @@ LLGroupMgrGroupData::LLGroupMgrGroupData(const LLUUID& id) :
mRoleDataComplete(FALSE), mRoleDataComplete(FALSE),
mRoleMemberDataComplete(FALSE), mRoleMemberDataComplete(FALSE),
mGroupPropertiesDataComplete(FALSE), mGroupPropertiesDataComplete(FALSE),
mPendingRoleMemberRequest(FALSE) mPendingRoleMemberRequest(FALSE),
mAccessTime(0.0f)
{ {
mMemberVersion.generate();
}
void LLGroupMgrGroupData::setAccessed()
{
mAccessTime = (F32)LLFrameTimer::getTotalSeconds();
} }
BOOL LLGroupMgrGroupData::getRoleData(const LLUUID& role_id, LLRoleData& role_data) BOOL LLGroupMgrGroupData::getRoleData(const LLUUID& role_id, LLRoleData& role_data)
@@ -419,6 +426,7 @@ void LLGroupMgrGroupData::removeMemberData()
} }
mMembers.clear(); mMembers.clear();
mMemberDataComplete = FALSE; mMemberDataComplete = FALSE;
mMemberVersion.generate();
} }
void LLGroupMgrGroupData::removeRoleData() void LLGroupMgrGroupData::removeRoleData()
@@ -947,7 +955,7 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data)
LLUUID request_id; LLUUID request_id;
msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_RequestID, request_id); msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_RequestID, request_id);
LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->createGroupData(group_id); LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
if (!group_datap || (group_datap->mMemberRequestID != request_id)) if (!group_datap || (group_datap->mMemberRequestID != request_id))
{ {
llwarns << "processGroupMembersReply: Received incorrect (stale?) group or request id" << llendl; llwarns << "processGroupMembersReply: Received incorrect (stale?) group or request id" << llendl;
@@ -1017,6 +1025,8 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data)
} }
} }
group_datap->mMemberVersion.generate();
if (group_datap->mMembers.size() == (U32)group_datap->mMemberCount) if (group_datap->mMembers.size() == (U32)group_datap->mMemberCount)
{ {
group_datap->mMemberDataComplete = TRUE; group_datap->mMemberDataComplete = TRUE;
@@ -1118,7 +1128,7 @@ void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data)
LLUUID request_id; LLUUID request_id;
msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_RequestID, request_id); msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_RequestID, request_id);
LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->createGroupData(group_id); LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
if (!group_datap || (group_datap->mRoleDataRequestID != request_id)) if (!group_datap || (group_datap->mRoleDataRequestID != request_id))
{ {
llwarns << "processGroupPropertiesReply: Received incorrect (stale?) group or request id" << llendl; llwarns << "processGroupPropertiesReply: Received incorrect (stale?) group or request id" << llendl;
@@ -1207,7 +1217,7 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data)
U32 total_pairs; U32 total_pairs;
msg->getU32(_PREHASH_AgentData, "TotalPairs", total_pairs); msg->getU32(_PREHASH_AgentData, "TotalPairs", total_pairs);
LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->createGroupData(group_id); LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
if (!group_datap || (group_datap->mRoleMembersRequestID != request_id)) if (!group_datap || (group_datap->mRoleMembersRequestID != request_id))
{ {
llwarns << "processGroupRoleMembersReply: Received incorrect (stale?) group or request id" << llendl; llwarns << "processGroupRoleMembersReply: Received incorrect (stale?) group or request id" << llendl;
@@ -1311,7 +1321,7 @@ void LLGroupMgr::processGroupTitlesReply(LLMessageSystem* msg, void** data)
LLUUID request_id; LLUUID request_id;
msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_RequestID, request_id); msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_RequestID, request_id);
LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->createGroupData(group_id); LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
if (!group_datap || (group_datap->mTitlesRequestID != request_id)) if (!group_datap || (group_datap->mTitlesRequestID != request_id))
{ {
llwarns << "processGroupTitlesReply: Received incorrect (stale?) group" << llendl; llwarns << "processGroupTitlesReply: Received incorrect (stale?) group" << llendl;
@@ -1443,7 +1453,7 @@ void LLGroupMgr::processCreateGroupReply(LLMessageSystem* msg, void ** data)
LLGroupMgrGroupData* LLGroupMgr::createGroupData(const LLUUID& id) LLGroupMgrGroupData* LLGroupMgr::createGroupData(const LLUUID& id)
{ {
LLGroupMgrGroupData* group_datap; LLGroupMgrGroupData* group_datap = NULL;
group_map_t::iterator existing_group = LLGroupMgr::getInstance()->mGroups.find(id); group_map_t::iterator existing_group = LLGroupMgr::getInstance()->mGroups.find(id);
if (existing_group == LLGroupMgr::getInstance()->mGroups.end()) if (existing_group == LLGroupMgr::getInstance()->mGroups.end())
@@ -1456,6 +1466,11 @@ LLGroupMgrGroupData* LLGroupMgr::createGroupData(const LLUUID& id)
group_datap = existing_group->second; group_datap = existing_group->second;
} }
if (group_datap)
{
group_datap->setAccessed();
}
return group_datap; return group_datap;
} }
@@ -1496,25 +1511,41 @@ void LLGroupMgr::notifyObservers(LLGroupChange gc)
void LLGroupMgr::addGroup(LLGroupMgrGroupData* group_datap) void LLGroupMgr::addGroup(LLGroupMgrGroupData* group_datap)
{ {
if (mGroups.size() > MAX_CACHED_GROUPS) while (mGroups.size() >= MAX_CACHED_GROUPS)
{ {
// get rid of groups that aren't observed // LRU: Remove the oldest un-observed group from cache until group size is small enough
for (group_map_t::iterator gi = mGroups.begin(); gi != mGroups.end() && mGroups.size() > MAX_CACHED_GROUPS / 2; )
F32 oldest_access = LLFrameTimer::getTotalSeconds();
group_map_t::iterator oldest_gi = mGroups.end();
for (group_map_t::iterator gi = mGroups.begin(); gi != mGroups.end(); ++gi )
{ {
observer_multimap_t::iterator oi = mObservers.find(gi->first); observer_multimap_t::iterator oi = mObservers.find(gi->first);
if (oi == mObservers.end()) if (oi == mObservers.end())
{ {
// not observed if (gi->second
LLGroupMgrGroupData* unobserved_groupp = gi->second; && (gi->second->getAccessTime() < oldest_access))
delete unobserved_groupp; {
mGroups.erase(gi++); oldest_access = gi->second->getAccessTime();
} oldest_gi = gi;
else }
{
++gi;
} }
} }
if (oldest_gi != mGroups.end())
{
delete oldest_gi->second;
mGroups.erase(oldest_gi);
}
else
{
// All groups must be currently open, none to remove.
// Just add the new group anyway, but get out of this loop as it
// will never drop below max_cached_groups.
break;
}
} }
mGroups[group_datap->getID()] = group_datap; mGroups[group_datap->getID()] = group_datap;
} }
@@ -1886,6 +1917,8 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id,
{ {
gAgent.sendReliableMessage(); gAgent.sendReliableMessage();
} }
group_datap->mMemberVersion.generate();
} }
@@ -2047,8 +2080,10 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content)
group_datap->mMembers[member_id] = data; group_datap->mMembers[member_id] = data;
} }
group_datap->mMemberVersion.generate();
// Technically, we have this data, but to prevent completely overhauling // Technically, we have this data, but to prevent completely overhauling
// this entire system (it would be nice, but I don't have the time), // this entire system (it would be nice, but I don't have the time),
// I'm going to be dumb and just call services I most likely don't need // I'm going to be dumb and just call services I most likely don't need
// with the thought being that the system might need it to be done. // with the thought being that the system might need it to be done.
// //

View File

@@ -86,7 +86,7 @@ public:
BOOL isInRole(const LLUUID& role_id) { return (mRolesList.find(role_id) != mRolesList.end()); } BOOL isInRole(const LLUUID& role_id) { return (mRolesList.find(role_id) != mRolesList.end()); }
protected: private:
LLUUID mID; LLUUID mID;
S32 mContribution; S32 mContribution;
U64 mAgentPowers; U64 mAgentPowers;
@@ -233,6 +233,10 @@ public:
BOOL isRoleMemberDataComplete() { return mRoleMemberDataComplete; } BOOL isRoleMemberDataComplete() { return mRoleMemberDataComplete; }
BOOL isGroupPropertiesDataComplete() { return mGroupPropertiesDataComplete; } BOOL isGroupPropertiesDataComplete() { return mGroupPropertiesDataComplete; }
F32 getAccessTime() const { return mAccessTime; }
void setAccessed();
const LLUUID& getMemberVersion() const { return mMemberVersion; }
public: public:
typedef std::map<LLUUID,LLGroupMemberData*> member_list_t; typedef std::map<LLUUID,LLGroupMemberData*> member_list_t;
typedef std::map<LLUUID,LLGroupRoleData*> role_list_t; typedef std::map<LLUUID,LLGroupRoleData*> role_list_t;
@@ -279,6 +283,10 @@ private:
BOOL mGroupPropertiesDataComplete; BOOL mGroupPropertiesDataComplete;
BOOL mPendingRoleMemberRequest; BOOL mPendingRoleMemberRequest;
F32 mAccessTime;
// Generate a new ID every time mMembers
LLUUID mMemberVersion;
}; };
struct LLRoleAction struct LLRoleAction

View File

@@ -250,8 +250,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject,
std::string("notify_next.png"), std::string("notify_next.png"),
std::string("notify_next.png"), std::string("notify_next.png"),
LLStringUtil::null, LLStringUtil::null,
onClickNext, boost::bind(&LLGroupNotifyBox::onClickNext, this),
this,
LLFontGL::getFontSansSerif()); LLFontGL::getFontSansSerif());
btn->setToolTip(LLTrans::getString("next")); btn->setToolTip(LLTrans::getString("next"));
btn->setScaleImage(TRUE); btn->setScaleImage(TRUE);
@@ -268,7 +267,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject,
btn_width, btn_width,
BTN_HEIGHT); BTN_HEIGHT);
btn = new LLButton(LLTrans::getString("ok"), btn_rect, LLStringUtil::null, onClickOk, this); btn = new LLButton(LLTrans::getString("ok"), btn_rect, LLStringUtil::null, boost::bind(&LLGroupNotifyBox::onClickOk,this));
addChild(btn, -1); addChild(btn, -1);
setDefaultBtn(btn); setDefaultBtn(btn);
@@ -280,7 +279,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject,
wide_btn_width, wide_btn_width,
BTN_HEIGHT); BTN_HEIGHT);
btn = new LLButton(LLTrans::getString("GroupNotifyGroupNotices"), btn_rect, LLStringUtil::null, onClickGroupInfo, this); btn = new LLButton(LLTrans::getString("GroupNotifyGroupNotices"), btn_rect, LLStringUtil::null, boost::bind(&LLGroupNotifyBox::onClickGroupInfo,this));
btn->setToolTip(LLTrans::getString("GroupNotifyViewPastNotices")); btn->setToolTip(LLTrans::getString("GroupNotifyViewPastNotices"));
addChild(btn, -1); addChild(btn, -1);
@@ -302,7 +301,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject,
{ {
btn_lbl = LLTrans::getString("GroupNotifySaveAttachment"); btn_lbl = LLTrans::getString("GroupNotifySaveAttachment");
} }
mSaveInventoryBtn = new LLButton(btn_lbl, btn_rect, LLStringUtil::null, onClickSaveInventory, this); mSaveInventoryBtn = new LLButton(btn_lbl, btn_rect, LLStringUtil::null, boost::bind(&LLGroupNotifyBox::onClickSaveInventory,this));
mSaveInventoryBtn->setVisible(mHasInventory); mSaveInventoryBtn->setVisible(mHasInventory);
addChild(mSaveInventoryBtn); addChild(mSaveInventoryBtn);
} }
@@ -453,41 +452,29 @@ LLRect LLGroupNotifyBox::getGroupNotifyRect()
} }
// static void LLGroupNotifyBox::onClickOk()
void LLGroupNotifyBox::onClickOk(void* data)
{ {
LLGroupNotifyBox* self = (LLGroupNotifyBox*)data; close();
if (self) self->close();
} }
void LLGroupNotifyBox::onClickGroupInfo(void* data) void LLGroupNotifyBox::onClickGroupInfo()
{ {
LLGroupNotifyBox* self = (LLGroupNotifyBox*)data; LLFloaterGroupInfo::showFromUUID(mGroupID, "notices_tab");
if (self)
{
LLFloaterGroupInfo::showFromUUID(self->mGroupID, "notices_tab");
}
//Leave notice open until explicitly closed //Leave notice open until explicitly closed
} }
void LLGroupNotifyBox::onClickSaveInventory(void* data) void LLGroupNotifyBox::onClickSaveInventory()
{ {
LLGroupNotifyBox* self = (LLGroupNotifyBox*)data; mInventoryOffer->forceResponse(IOR_ACCEPT);
self->mInventoryOffer->forceResponse(IOR_ACCEPT); mInventoryOffer = NULL;
mHasInventory = FALSE;
self->mInventoryOffer = NULL;
self->mHasInventory = FALSE;
// Each item can only be received once, so disable the button. // Each item can only be received once, so disable the button.
self->mSaveInventoryBtn->setEnabled(FALSE); mSaveInventoryBtn->setEnabled(FALSE);
} }
// static void LLGroupNotifyBox::onClickNext()
void LLGroupNotifyBox::onClickNext(void* data)
{ {
LLGroupNotifyBox* self = (LLGroupNotifyBox*)data; moveToBack();
self->moveToBack();
} }

View File

@@ -89,12 +89,12 @@ protected:
static LLRect getGroupNotifyRect(); static LLRect getGroupNotifyRect();
// internal handler for button being clicked // internal handler for button being clicked
static void onClickOk(void* data); void onClickOk();
static void onClickGroupInfo(void* data); void onClickGroupInfo();
static void onClickSaveInventory(void* data); void onClickSaveInventory();
// for "next" button // for "next" button
static void onClickNext(void* data); void onClickNext();
private: private:
// Are we sliding onscreen? // Are we sliding onscreen?

Some files were not shown because too many files have changed in this diff Show More