summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorDmitry Zaporozhan <dzaporozhan@productengine.com>2010-03-04 12:18:24 +0200
committerDmitry Zaporozhan <dzaporozhan@productengine.com>2010-03-04 12:18:24 +0200
commit5301d4189fde3332237b52ce26ab08f5c7fb0baa (patch)
tree2429f1f7678b4521962a071dc6263571901c2b19 /indra
parentbb4e48e1d1eada7d0b6f94e7e693bd8341c15102 (diff)
Updated major sub task EXT-5858 - Assigned picture is stretched in the Classified Info panel.
Fixed reshape issues. Added stretching to edit classified panel. --HG-- branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llpanelclassified.cpp64
-rw-r--r--indra/newview/llpanelclassified.h15
-rw-r--r--indra/newview/skins/default/xui/en/panel_classified_info.xml14
-rw-r--r--indra/newview/skins/default/xui/en/panel_edit_classified.xml21
4 files changed, 89 insertions, 25 deletions
diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp
index 6f0b7df935..ee722a048b 100644
--- a/indra/newview/llpanelclassified.cpp
+++ b/indra/newview/llpanelclassified.cpp
@@ -1166,6 +1166,7 @@ LLPanelClassifiedInfo::LLPanelClassifiedInfo()
, mTeleportClicksNew(0)
, mMapClicksNew(0)
, mProfileClicksNew(0)
+ , mSnapshotCtrl(NULL)
{
sAllPanels.push_back(this);
}
@@ -1195,7 +1196,8 @@ BOOL LLPanelClassifiedInfo::postBuild()
mScrollingPanelMinHeight = mScrollContainer->getScrolledViewRect().getHeight();
mScrollingPanelWidth = mScrollingPanel->getRect().getWidth();
- mSnapshotRect = getChild<LLUICtrl>("classified_snapshot")->getRect();
+ mSnapshotCtrl = getChild<LLTextureCtrl>("classified_snapshot");
+ mSnapshotRect = getDefaultSnapshotRect();
return TRUE;
}
@@ -1229,7 +1231,8 @@ void LLPanelClassifiedInfo::reshape(S32 width, S32 height, BOOL called_from_pare
mScrollingPanel->reshape(mScrollingPanelWidth + scrollbar_size, scroll_height);
}
- mSnapshotRect = getChild<LLUICtrl>("classified_snapshot")->getRect();
+ mSnapshotRect = getDefaultSnapshotRect();
+ stretchSnapshot();
}
void LLPanelClassifiedInfo::onOpen(const LLSD& key)
@@ -1359,12 +1362,7 @@ void LLPanelClassifiedInfo::setClassifiedLocation(const std::string& location)
void LLPanelClassifiedInfo::setSnapshotId(const LLUUID& id)
{
- childSetValue("classified_snapshot", id);
- if(!mSnapshotStreched)
- {
- LLUICtrl* snapshot = getChild<LLUICtrl>("classified_snapshot");
- snapshot->setRect(mSnapshotRect);
- }
+ mSnapshotCtrl->setValue(id);
mSnapshotStreched = false;
}
@@ -1374,7 +1372,10 @@ void LLPanelClassifiedInfo::draw()
// Stretch in draw because it takes some time to load a texture,
// going to try to stretch snapshot until texture is loaded
- stretchSnapshot();
+ if(!mSnapshotStreched)
+ {
+ stretchSnapshot();
+ }
}
LLUUID LLPanelClassifiedInfo::getSnapshotId()
@@ -1474,10 +1475,9 @@ void LLPanelClassifiedInfo::stretchSnapshot()
// *NOTE dzaporozhan
// Could be moved to LLTextureCtrl
- LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("classified_snapshot");
- LLViewerFetchedTexture* texture = texture_ctrl->getTexture();
+ LLViewerFetchedTexture* texture = mSnapshotCtrl->getTexture();
- if(!texture || mSnapshotStreched)
+ if(!texture)
{
return;
}
@@ -1485,11 +1485,16 @@ void LLPanelClassifiedInfo::stretchSnapshot()
if(0 == texture->getOriginalWidth() || 0 == texture->getOriginalHeight())
{
// looks like texture is not loaded yet
- llinfos << "Missing image size" << llendl;
return;
}
LLRect rc = mSnapshotRect;
+ // *HACK dzaporozhan
+ // LLTextureCtrl uses BTN_HEIGHT_SMALL as bottom for texture which causes
+ // drawn texture to be smaller than expected. (see LLTextureCtrl::draw())
+ // Lets increase texture height to force texture look as expected.
+ rc.mBottom -= BTN_HEIGHT_SMALL;
+
F32 t_width = texture->getFullWidth();
F32 t_height = texture->getFullHeight();
@@ -1499,11 +1504,19 @@ void LLPanelClassifiedInfo::stretchSnapshot()
t_height *= ratio;
rc.setCenterAndSize(rc.getCenterX(), rc.getCenterY(), llfloor(t_width), llfloor(t_height));
- texture_ctrl->setRect(rc);
+ mSnapshotCtrl->setShape(rc);
mSnapshotStreched = true;
}
+LLRect LLPanelClassifiedInfo::getDefaultSnapshotRect()
+{
+ // Using scroll container makes getting default rect a hard task
+ // because rect in postBuild() and in first reshape() is not the same.
+ // Using snapshot_panel makes it easier to reshape snapshot.
+ return getChild<LLUICtrl>("snapshot_panel")->getLocalRect();
+}
+
void LLPanelClassifiedInfo::onMapClick()
{
LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal());
@@ -1587,6 +1600,8 @@ BOOL LLPanelClassifiedEdit::postBuild()
childSetAction("save_changes_btn", boost::bind(&LLPanelClassifiedEdit::onSaveClick, this));
childSetAction("set_to_curr_location_btn", boost::bind(&LLPanelClassifiedEdit::onSetLocationClick, this));
+ mSnapshotCtrl->setOnSelectCallback(boost::bind(&LLPanelClassifiedEdit::onTextureSelected, this));
+
return TRUE;
}
@@ -1734,6 +1749,22 @@ bool LLPanelClassifiedEdit::canClose()
return mCanClose;
}
+void LLPanelClassifiedEdit::draw()
+{
+ LLPanel::draw();
+
+ // Need to re-stretch on every draw because LLTextureCtrl::onSelectCallback
+ // does not trigger callbacks when user navigates through images.
+ stretchSnapshot();
+}
+
+void LLPanelClassifiedEdit::stretchSnapshot()
+{
+ LLPanelClassifiedInfo::stretchSnapshot();
+
+ getChild<LLUICtrl>("edit_icon")->setShape(mSnapshotCtrl->getRect());
+}
+
void LLPanelClassifiedEdit::sendUpdate()
{
LLAvatarClassifiedInfo c_data;
@@ -1913,4 +1944,9 @@ void LLPanelClassifiedEdit::onTexturePickerMouseLeave(LLUICtrl* ctrl)
ctrl->setVisible(FALSE);
}
+void LLPanelClassifiedEdit::onTextureSelected()
+{
+ setSnapshotId(mSnapshotCtrl->getValue().asUUID());
+}
+
//EOF
diff --git a/indra/newview/llpanelclassified.h b/indra/newview/llpanelclassified.h
index 43b47d4e3e..3df3a2255b 100644
--- a/indra/newview/llpanelclassified.h
+++ b/indra/newview/llpanelclassified.h
@@ -280,10 +280,16 @@ protected:
void stretchSnapshot();
+ LLRect getDefaultSnapshotRect();
+
void onMapClick();
void onTeleportClick();
void onExit();
+ bool mSnapshotStreched;
+ LLRect mSnapshotRect;
+ LLTextureCtrl* mSnapshotCtrl;
+
private:
LLUUID mAvatarId;
@@ -292,9 +298,6 @@ private:
LLUUID mParcelId;
bool mInfoLoaded;
- bool mSnapshotStreched;
- LLRect mSnapshotRect;
-
LLScrollContainer* mScrollContainer;
LLPanel* mScrollingPanel;
@@ -341,6 +344,10 @@ public:
bool canClose();
+ void draw();
+
+ void stretchSnapshot();
+
protected:
LLPanelClassifiedEdit();
@@ -372,6 +379,8 @@ protected:
void onTexturePickerMouseEnter(LLUICtrl* ctrl);
void onTexturePickerMouseLeave(LLUICtrl* ctrl);
+ void onTextureSelected();
+
private:
bool mIsNew;
bool mCanClose;
diff --git a/indra/newview/skins/default/xui/en/panel_classified_info.xml b/indra/newview/skins/default/xui/en/panel_classified_info.xml
index 869a05f27d..65c154daee 100644
--- a/indra/newview/skins/default/xui/en/panel_classified_info.xml
+++ b/indra/newview/skins/default/xui/en/panel_classified_info.xml
@@ -74,15 +74,25 @@
height="500"
left="0"
width="285">
+ <panel
+ name="snapshot_panel"
+ layout="topleft"
+ follows="left|top|right"
+ height="197"
+ left="10"
+ top="10"
+ width="275"
+ >
<texture_picker
enabled="false"
follows="left|top|right"
height="197"
layout="topleft"
- left="10"
+ left="0"
name="classified_snapshot"
- top="10"
+ top="0"
width="275" />
+ </panel>
<text_editor
allow_scroll="false"
bg_visible="false"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_classified.xml b/indra/newview/skins/default/xui/en/panel_edit_classified.xml
index 6cc6c51fe0..4fba0e5d90 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_classified.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_classified.xml
@@ -62,24 +62,33 @@
height="690"
left="0"
width="285">
+ <panel
+ name="snapshot_panel"
+ layout="topleft"
+ follows="left|top|right"
+ height="197"
+ left="10"
+ top="10"
+ width="272">
<texture_picker
follows="left|top|right"
height="197"
width="272"
layout="topleft"
- top="10"
- left="11"
+ top="0"
+ left="0"
name="classified_snapshot" />
- <icon
+ <icon
height="197"
image_name="spacer24.tga"
layout="topleft"
name="edit_icon"
label=""
tool_tip="Click to select an image"
- top="10"
- left="11"
- width="286" />
+ top="0"
+ left="0"
+ width="272" />
+ </panel>
<text
type="string"
length="1"