made toolbars conform to visual specs
added ability to specify clip rects in textures.xmlmeow-7.2.2
parent
f787208903
commit
63a8fce12b
|
|
@ -82,9 +82,6 @@ LLToolBar::Params::Params()
|
|||
button_icon_and_text("button_icon_and_text"),
|
||||
read_only("read_only", false),
|
||||
wrap("wrap", true),
|
||||
min_button_width("min_button_width", 0),
|
||||
max_button_width("max_button_width", S32_MAX),
|
||||
button_height("button_height"),
|
||||
pad_left("pad_left"),
|
||||
pad_top("pad_top"),
|
||||
pad_right("pad_right"),
|
||||
|
|
@ -102,9 +99,6 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
|
|||
mNeedsLayout(false),
|
||||
mButtonPanel(NULL),
|
||||
mCenteringStack(NULL),
|
||||
mMinButtonWidth(llmin(p.min_button_width(), p.max_button_width())),
|
||||
mMaxButtonWidth(llmax(p.max_button_width(), p.min_button_width())),
|
||||
mButtonHeight(p.button_height),
|
||||
mPadLeft(p.pad_left),
|
||||
mPadRight(p.pad_right),
|
||||
mPadTop(p.pad_top),
|
||||
|
|
@ -325,7 +319,7 @@ void LLToolBar::resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row
|
|||
{
|
||||
if (getOrientation(mSideType) == LLLayoutStack::HORIZONTAL)
|
||||
{
|
||||
button->reshape(llclamp(button->getRect().getWidth(), mMinButtonWidth, mMaxButtonWidth), max_row_girth);
|
||||
button->reshape(llclamp(button->getRect().getWidth(), button->mMinWidth, button->mMaxWidth), max_row_girth);
|
||||
}
|
||||
else // VERTICAL
|
||||
{
|
||||
|
|
@ -384,10 +378,10 @@ void LLToolBar::updateLayoutAsNeeded()
|
|||
|
||||
BOOST_FOREACH(LLToolBarButton* button, mButtons)
|
||||
{
|
||||
button->reshape(mMinButtonWidth, mButtonHeight);
|
||||
button->reshape(button->mMinWidth, button->mDesiredHeight);
|
||||
button->autoResize();
|
||||
|
||||
S32 button_clamped_width = llclamp(button->getRect().getWidth(), mMinButtonWidth, mMaxButtonWidth);
|
||||
S32 button_clamped_width = llclamp(button->getRect().getWidth(), button->mMinWidth, button->mMaxWidth);
|
||||
S32 button_length = (orientation == LLLayoutStack::HORIZONTAL)
|
||||
? button_clamped_width
|
||||
: button->getRect().getHeight();
|
||||
|
|
@ -402,7 +396,7 @@ void LLToolBar::updateLayoutAsNeeded()
|
|||
{
|
||||
if (orientation == LLLayoutStack::VERTICAL)
|
||||
{ // row girth (width in this case) is clamped to allowable button widths
|
||||
max_row_girth = llclamp(max_row_girth, mMinButtonWidth, mMaxButtonWidth);
|
||||
max_row_girth = llclamp(max_row_girth, button->mMinWidth, button->mMaxWidth);
|
||||
}
|
||||
|
||||
// make buttons in current row all same girth
|
||||
|
|
@ -546,6 +540,9 @@ LLToolBarButton::LLToolBarButton(const Params& p)
|
|||
: LLButton(p),
|
||||
mMouseDownX(0),
|
||||
mMouseDownY(0),
|
||||
mMinWidth(p.min_button_width),
|
||||
mMaxWidth(p.max_button_width),
|
||||
mDesiredHeight(p.desired_height),
|
||||
mId("")
|
||||
{}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,9 +37,20 @@
|
|||
|
||||
class LLToolBarButton : public LLButton
|
||||
{
|
||||
friend class LLToolBar;
|
||||
public:
|
||||
struct Params : public LLInitParam::Block<Params, LLButton::Params>
|
||||
{
|
||||
Optional<S32> min_button_width,
|
||||
max_button_width,
|
||||
desired_height;
|
||||
|
||||
Params()
|
||||
: min_button_width("min_button_width", 0),
|
||||
max_button_width("max_button_width", S32_MAX),
|
||||
desired_height("desired_height", 20)
|
||||
{}
|
||||
|
||||
};
|
||||
|
||||
LLToolBarButton(const Params& p);
|
||||
|
|
@ -51,6 +62,9 @@ private:
|
|||
LLCommandId mId;
|
||||
S32 mMouseDownX;
|
||||
S32 mMouseDownY;
|
||||
S32 mMinWidth;
|
||||
S32 mMaxWidth;
|
||||
S32 mDesiredHeight;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -106,10 +120,6 @@ public:
|
|||
Optional<bool> read_only,
|
||||
wrap;
|
||||
|
||||
Optional<S32> min_button_width,
|
||||
max_button_width,
|
||||
button_height;
|
||||
|
||||
Optional<S32> pad_left,
|
||||
pad_top,
|
||||
pad_right,
|
||||
|
|
@ -171,10 +181,7 @@ private:
|
|||
|
||||
bool mWrap;
|
||||
bool mNeedsLayout;
|
||||
S32 mMinButtonWidth,
|
||||
mMaxButtonWidth,
|
||||
mButtonHeight,
|
||||
mPadLeft,
|
||||
S32 mPadLeft,
|
||||
mPadRight,
|
||||
mPadTop,
|
||||
mPadBottom,
|
||||
|
|
|
|||
|
|
@ -1342,7 +1342,8 @@ LLUIImagePtr LLUIImageList::getUIImageByID(const LLUUID& image_id, S32 priority)
|
|||
|
||||
const BOOL use_mips = FALSE;
|
||||
const LLRect scale_rect = LLRect::null;
|
||||
return loadUIImageByID(image_id, use_mips, scale_rect, (LLViewerTexture::EBoostLevel)priority);
|
||||
const LLRect clip_rect = LLRect::null;
|
||||
return loadUIImageByID(image_id, use_mips, scale_rect, clip_rect, (LLViewerTexture::EBoostLevel)priority);
|
||||
}
|
||||
|
||||
LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name, S32 priority)
|
||||
|
|
@ -1356,32 +1357,33 @@ LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name, S32 priori
|
|||
|
||||
const BOOL use_mips = FALSE;
|
||||
const LLRect scale_rect = LLRect::null;
|
||||
return loadUIImageByName(image_name, image_name, use_mips, scale_rect, (LLViewerTexture::EBoostLevel)priority);
|
||||
const LLRect clip_rect = LLRect::null;
|
||||
return loadUIImageByName(image_name, image_name, use_mips, scale_rect, clip_rect, (LLViewerTexture::EBoostLevel)priority);
|
||||
}
|
||||
|
||||
LLUIImagePtr LLUIImageList::loadUIImageByName(const std::string& name, const std::string& filename,
|
||||
BOOL use_mips, const LLRect& scale_rect, LLViewerTexture::EBoostLevel boost_priority )
|
||||
BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority )
|
||||
{
|
||||
if (boost_priority == LLViewerTexture::BOOST_NONE)
|
||||
{
|
||||
boost_priority = LLViewerTexture::BOOST_UI;
|
||||
}
|
||||
LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTextureFromFile(filename, MIPMAP_NO, boost_priority);
|
||||
return loadUIImage(imagep, name, use_mips, scale_rect);
|
||||
return loadUIImage(imagep, name, use_mips, scale_rect, clip_rect);
|
||||
}
|
||||
|
||||
LLUIImagePtr LLUIImageList::loadUIImageByID(const LLUUID& id,
|
||||
BOOL use_mips, const LLRect& scale_rect, LLViewerTexture::EBoostLevel boost_priority)
|
||||
BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority)
|
||||
{
|
||||
if (boost_priority == LLViewerTexture::BOOST_NONE)
|
||||
{
|
||||
boost_priority = LLViewerTexture::BOOST_UI;
|
||||
}
|
||||
LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(id, MIPMAP_NO, boost_priority);
|
||||
return loadUIImage(imagep, id.asString(), use_mips, scale_rect);
|
||||
return loadUIImage(imagep, id.asString(), use_mips, scale_rect, clip_rect);
|
||||
}
|
||||
|
||||
LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips, const LLRect& scale_rect)
|
||||
LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect)
|
||||
{
|
||||
if (!imagep) return NULL;
|
||||
|
||||
|
|
@ -1402,13 +1404,14 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const st
|
|||
LLUIImageLoadData* datap = new LLUIImageLoadData;
|
||||
datap->mImageName = name;
|
||||
datap->mImageScaleRegion = scale_rect;
|
||||
datap->mImageClipRegion = clip_rect;
|
||||
|
||||
imagep->setLoadedCallback(onUIImageLoaded, 0, FALSE, FALSE, datap, NULL);
|
||||
}
|
||||
return new_imagep;
|
||||
}
|
||||
|
||||
LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect)
|
||||
LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect)
|
||||
{
|
||||
// look for existing image
|
||||
uuid_ui_image_map_t::iterator found_it = mUIImages.find(name);
|
||||
|
|
@ -1418,7 +1421,7 @@ LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::s
|
|||
llerrs << "UI Image " << name << " already loaded." << llendl;
|
||||
}
|
||||
|
||||
return loadUIImageByName(name, filename, use_mips, scale_rect);
|
||||
return loadUIImageByName(name, filename, use_mips, scale_rect, clip_rect);
|
||||
}
|
||||
|
||||
//static
|
||||
|
|
@ -1432,6 +1435,7 @@ void LLUIImageList::onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_v
|
|||
LLUIImageLoadData* image_datap = (LLUIImageLoadData*)user_data;
|
||||
std::string ui_image_name = image_datap->mImageName;
|
||||
LLRect scale_rect = image_datap->mImageScaleRegion;
|
||||
LLRect clip_rect = image_datap->mImageClipRegion;
|
||||
if (final)
|
||||
{
|
||||
delete image_datap;
|
||||
|
|
@ -1448,9 +1452,21 @@ void LLUIImageList::onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_v
|
|||
// from power-of-2 gl image
|
||||
if (success && imagep.notNull() && src_vi && (src_vi->getUrl().compare(0, 7, "file://")==0))
|
||||
{
|
||||
F32 clip_x = (F32)src_vi->getOriginalWidth() / (F32)src_vi->getFullWidth();
|
||||
F32 clip_y = (F32)src_vi->getOriginalHeight() / (F32)src_vi->getFullHeight();
|
||||
imagep->setClipRegion(LLRectf(0.f, clip_y, clip_x, 0.f));
|
||||
F32 full_width = (F32)src_vi->getFullWidth();
|
||||
F32 full_height = (F32)src_vi->getFullHeight();
|
||||
F32 clip_x = (F32)src_vi->getOriginalWidth() / full_width;
|
||||
F32 clip_y = (F32)src_vi->getOriginalHeight() / full_height;
|
||||
if (clip_rect != LLRect::null)
|
||||
{
|
||||
imagep->setClipRegion(LLRectf(llclamp((F32)clip_rect.mLeft / full_width, 0.f, 1.f),
|
||||
llclamp((F32)clip_rect.mTop / full_height, 0.f, 1.f),
|
||||
llclamp((F32)clip_rect.mRight / full_width, 0.f, 1.f),
|
||||
llclamp((F32)clip_rect.mBottom / full_height, 0.f, 1.f)));
|
||||
}
|
||||
else
|
||||
{
|
||||
imagep->setClipRegion(LLRectf(0.f, clip_y, clip_x, 0.f));
|
||||
}
|
||||
if (scale_rect != LLRect::null)
|
||||
{
|
||||
imagep->setScaleRegion(
|
||||
|
|
@ -1471,6 +1487,7 @@ struct UIImageDeclaration : public LLInitParam::Block<UIImageDeclaration>
|
|||
Optional<std::string> file_name;
|
||||
Optional<bool> preload;
|
||||
Optional<LLRect> scale;
|
||||
Optional<LLRect> clip;
|
||||
Optional<bool> use_mips;
|
||||
|
||||
UIImageDeclaration()
|
||||
|
|
@ -1478,6 +1495,7 @@ struct UIImageDeclaration : public LLInitParam::Block<UIImageDeclaration>
|
|||
file_name("file_name"),
|
||||
preload("preload", false),
|
||||
scale("scale"),
|
||||
clip("clip"),
|
||||
use_mips("use_mips", false)
|
||||
{}
|
||||
};
|
||||
|
|
@ -1572,7 +1590,7 @@ bool LLUIImageList::initFromFile()
|
|||
{
|
||||
continue;
|
||||
}
|
||||
preloadUIImage(image.name, file_name, image.use_mips, image.scale);
|
||||
preloadUIImage(image.name, file_name, image.use_mips, image.scale, image.clip);
|
||||
}
|
||||
|
||||
if (cur_pass == PASS_DECODE_NOW && !gSavedSettings.getBOOL("NoPreload"))
|
||||
|
|
|
|||
|
|
@ -220,24 +220,27 @@ public:
|
|||
|
||||
bool initFromFile();
|
||||
|
||||
LLPointer<LLUIImage> preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect);
|
||||
LLPointer<LLUIImage> preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect);
|
||||
|
||||
static void onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata );
|
||||
private:
|
||||
LLPointer<LLUIImage> loadUIImageByName(const std::string& name, const std::string& filename,
|
||||
BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null,
|
||||
const LLRect& clip_rect = LLRect::null,
|
||||
LLViewerTexture::EBoostLevel boost_priority = LLViewerTexture::BOOST_UI);
|
||||
LLPointer<LLUIImage> loadUIImageByID(const LLUUID& id,
|
||||
BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null,
|
||||
const LLRect& clip_rect = LLRect::null,
|
||||
LLViewerTexture::EBoostLevel boost_priority = LLViewerTexture::BOOST_UI);
|
||||
|
||||
LLPointer<LLUIImage> loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null);
|
||||
LLPointer<LLUIImage> loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null);
|
||||
|
||||
|
||||
struct LLUIImageLoadData
|
||||
{
|
||||
std::string mImageName;
|
||||
LLRect mImageScaleRegion;
|
||||
LLRect mImageClipRegion;
|
||||
};
|
||||
|
||||
typedef std::map< std::string, LLPointer<LLUIImage> > uuid_ui_image_map_t;
|
||||
|
|
|
|||
|
|
@ -473,7 +473,11 @@ with the same filename but different name
|
|||
|
||||
<texture name="Resize_Corner" file_name="windows/Resize_Corner.png" preload="true" />
|
||||
|
||||
<texture name="Rounded_Rect" file_name="Rounded_Rect.png" preload="true" scale.left="6" scale.top="24" scale.right="58" scale.bottom="6" />
|
||||
<texture name="Rounded_Rect" file_name="Rounded_Rect.png" preload="true" scale.left="6" scale.top="26" scale.right="58" scale.bottom="6" />
|
||||
<texture name="Rounded_Rect_Top" file_name="Rounded_Rect.png" preload="true" scale.left="6" scale.top="8" scale.right="58" scale.bottom="0" clip.left="0" clip.right="64" clip.bottom="16" clip.top="32" />
|
||||
<texture name="Rounded_Rect_Bottom" file_name="Rounded_Rect.png" preload="true" scale.left="6" scale.top="16" scale.right="58" scale.bottom="8" clip.left="0" clip.right="64" clip.bottom="0" clip.top="16" />
|
||||
<texture name="Rounded_Rect_Left" file_name="Rounded_Rect.png" preload="true" scale.left="6" scale.top="26" scale.right="32" scale.bottom="6" clip.left="0" clip.right="32" clip.bottom="0" clip.top="32" />
|
||||
<texture name="Rounded_Rect_Right" file_name="Rounded_Rect.png" preload="true" scale.left="0" scale.top="26" scale.right="26" scale.bottom="6" clip.left="32" clip.right="64" clip.bottom="0" clip.top="32" />
|
||||
<texture name="Rounded_Square" file_name="rounded_square.j2c" preload="true" scale.left="16" scale.top="16" scale.right="112" scale.bottom="16" />
|
||||
<texture name="Row_Selection" file_name="navbar/Row_Selection.png" preload="false" />
|
||||
|
||||
|
|
|
|||
|
|
@ -100,12 +100,12 @@
|
|||
visible="false"
|
||||
width="500"/>
|
||||
</layout_panel>
|
||||
<layout_panel auto_resize="false"
|
||||
<!--<layout_panel auto_resize="false"
|
||||
min_height="33"
|
||||
height="33"
|
||||
mouse_opaque="false"
|
||||
name="bottom_tray_container"
|
||||
visible="false"/>
|
||||
visible="false"/>-->
|
||||
</layout_stack>
|
||||
</layout_panel>
|
||||
</layout_stack>
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
width="30"
|
||||
mouse_opaque="false">
|
||||
<toolbar follows="left|top|bottom"
|
||||
button_panel.bg_opaque_image="Rounded_Rect_Right"
|
||||
name="toolbar_left"
|
||||
height="500"
|
||||
width="30"
|
||||
|
|
@ -59,6 +60,7 @@
|
|||
width="30"
|
||||
mouse_opaque="false">
|
||||
<toolbar
|
||||
button_panel.bg_opaque_image="Rounded_Rect_Left"
|
||||
follows="right|top|bottom"
|
||||
name="toolbar_right"
|
||||
height="500"
|
||||
|
|
@ -78,6 +80,7 @@
|
|||
width="1024"
|
||||
mouse_opaque="false">
|
||||
<toolbar layout="topleft"
|
||||
button_panel.bg_opaque_image="Rounded_Rect_Top"
|
||||
name="toolbar_bottom"
|
||||
height="30"
|
||||
width="1024"
|
||||
|
|
|
|||
|
|
@ -1,23 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<toolbar button_height="30"
|
||||
pad_left="5"
|
||||
pad_right="5"
|
||||
pad_top="5"
|
||||
pad_bottom="5"
|
||||
pad_between="5"
|
||||
<toolbar pad_left="1"
|
||||
pad_right="1"
|
||||
pad_top="1"
|
||||
pad_bottom="1"
|
||||
pad_between="1"
|
||||
mouse_opaque="false"
|
||||
read_only="false">
|
||||
<button_panel name="button_panel"
|
||||
bg_opaque_image="Rounded_Rect"
|
||||
background_visible="true"
|
||||
bg_opaque_color="MouseGray"
|
||||
bg_opaque_image_overlay="MouseGray"
|
||||
background_opaque="true"/>
|
||||
<button_icon_and_text follows="left|top"
|
||||
<button_icon_and_text imgoverlay_label_space="7"
|
||||
min_button_width="70"
|
||||
max_button_width="140"
|
||||
desired_height="24"
|
||||
pad_left="10"
|
||||
pad_right="10"
|
||||
follows="left|top"
|
||||
chrome="true"
|
||||
image_overlay_alignment="left"
|
||||
use_ellipses="true"
|
||||
auto_resize="true"/>
|
||||
<button_icon follows="left|top"
|
||||
<button_icon pad_left="10"
|
||||
pad_right="10"
|
||||
desired_height="35"
|
||||
min_button_width="35"
|
||||
max_button_width="35"
|
||||
follows="left|top"
|
||||
label=""
|
||||
chrome="true"
|
||||
use_ellipses="true"
|
||||
|
|
|
|||
Loading…
Reference in New Issue