summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAimee Linden <aimee@lindenlab.com>2010-06-08 15:01:35 +0100
committerAimee Linden <aimee@lindenlab.com>2010-06-08 15:01:35 +0100
commitb46826c8210cda7e0c35741fe1f8e3787cc6e6e6 (patch)
treee053bfa14659a5a89f31c88ebfaa0791bd5432e4 /indra/newview
parentbeaf688529cf6c9168c6a336b9d798fe019b7ccc (diff)
EXT-7521 FIXED Snapshot floater not remembering whether to show the advanced panel.
Also removes some redundant code, and registers UI callbacks for use from XUI. Reviewed by: Tofu
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloatersnapshot.cpp118
-rw-r--r--indra/newview/llfloatersnapshot.h9
-rw-r--r--indra/newview/skins/default/xui/en/floater_snapshot.xml192
3 files changed, 150 insertions, 169 deletions
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 5bea3325a8..fa2a9873fc 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -91,10 +91,6 @@
///----------------------------------------------------------------------------
/// Local function declarations, constants, enums, and typedefs
///----------------------------------------------------------------------------
-S32 LLFloaterSnapshot::sUIWinHeightLong = 526 ;
-S32 LLFloaterSnapshot::sUIWinHeightShort = LLFloaterSnapshot::sUIWinHeightLong - 230 ;
-S32 LLFloaterSnapshot::sUIWinWidth = 215 ;
-
LLSnapshotFloaterView* gSnapshotFloaterView = NULL;
const F32 AUTO_SNAPSHOT_TIME_DELAY = 1.f;
@@ -1172,9 +1168,6 @@ public:
}
static void onClickNewSnapshot(void* data);
static void onClickAutoSnap(LLUICtrl *ctrl, void* data);
- //static void onClickAdvanceSnap(LLUICtrl *ctrl, void* data);
- static void onClickLess(void* data) ;
- static void onClickMore(void* data) ;
static void onClickUICheck(LLUICtrl *ctrl, void* data);
static void onClickHUDCheck(LLUICtrl *ctrl, void* data);
static void onClickKeepOpenCheck(LLUICtrl *ctrl, void* data);
@@ -1188,7 +1181,7 @@ public:
static void onCommitCustomResolution(LLUICtrl *ctrl, void* data);
static void onCommitSnapshot(LLFloaterSnapshot* view, LLSnapshotLivePreview::ESnapshotType type);
static void onCommitProfilePic(LLFloaterSnapshot* view);
- static void onToggleAdvanced(LLUICtrl *ctrl, void* data);
+ static void showAdvanced(LLFloaterSnapshot* view, const bool visible);
static void resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) ;
static BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value);
@@ -1399,41 +1392,6 @@ void LLFloaterSnapshot::Impl::onClickAutoSnap(LLUICtrl *ctrl, void* data)
}
}
-void LLFloaterSnapshot::Impl::onClickMore(void* data)
-{
- gSavedSettings.setBOOL( "AdvanceSnapshot", TRUE );
-
- LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
- if (view)
- {
- view->translate( 0, view->getUIWinHeightShort() - view->getUIWinHeightLong() );
- view->reshape(view->getRect().getWidth(), view->getUIWinHeightLong());
- updateControls(view) ;
- updateLayout(view) ;
- if(getPreviewView(view))
- {
- getPreviewView(view)->setThumbnailImageSize() ;
- }
- }
-}
-void LLFloaterSnapshot::Impl::onClickLess(void* data)
-{
- gSavedSettings.setBOOL( "AdvanceSnapshot", FALSE );
-
- LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
- if (view)
- {
- view->translate( 0, view->getUIWinHeightLong() - view->getUIWinHeightShort() );
- view->reshape(view->getRect().getWidth(), view->getUIWinHeightShort());
- updateControls(view) ;
- updateLayout(view) ;
- if(getPreviewView(view))
- {
- getPreviewView(view)->setThumbnailImageSize() ;
- }
- }
-}
-
// static
void LLFloaterSnapshot::Impl::onClickUICheck(LLUICtrl *ctrl, void* data)
{
@@ -1691,30 +1649,28 @@ void LLFloaterSnapshot::Impl::onCommitLayerTypes(LLUICtrl* ctrl, void*data)
}
//static
-void LLFloaterSnapshot::Impl::onToggleAdvanced(LLUICtrl* ctrl, void* data)
+void LLFloaterSnapshot::Impl::showAdvanced(LLFloaterSnapshot* view, const bool visible)
{
- LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
-
LLPanel* advanced_panel = view->getChild<LLPanel>("snapshot_advanced");
- if (advanced_panel->getVisible())
+ if (advanced_panel->getVisible() != visible)
{
- advanced_panel->setVisible(false);
+ gSavedSettings.setBOOL("AdvanceSnapshot", visible);
- // shrink floater back to original size
- view->reshape(view->getRect().getWidth() - advanced_panel->getRect().getWidth(), view->getRect().getHeight());
+ advanced_panel->setVisible(visible);
+ view->getChild<LLButton>("hide_advanced")->setVisible(visible);
+ view->getChild<LLButton>("show_advanced")->setVisible(!visible);
- view->getChild<LLButton>("hide_advanced")->setVisible(false);
- view->getChild<LLButton>("show_advanced")->setVisible(true);
- }
- else
- {
- advanced_panel->setVisible(true);
- // stretch the floater so it can accommodate the advanced panel
- view->reshape(view->getRect().getWidth() + advanced_panel->getRect().getWidth(), view->getRect().getHeight());
-
- view->getChild<LLButton>("hide_advanced")->setVisible(true);
- view->getChild<LLButton>("show_advanced")->setVisible(false);
+ if (visible)
+ {
+ // stretch the floater so it can accommodate the advanced panel
+ view->reshape(view->getRect().getWidth() + advanced_panel->getRect().getWidth(), view->getRect().getHeight());
+ }
+ else
+ {
+ // shrink floater back to original size
+ view->reshape(view->getRect().getWidth() - advanced_panel->getRect().getWidth(), view->getRect().getHeight());
+ }
}
}
@@ -2002,6 +1958,11 @@ LLFloaterSnapshot::LLFloaterSnapshot(const LLSD& key)
impl (*(new Impl))
{
//Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_snapshot.xml", FALSE);
+
+ mCommitCallbackRegistrar.add("Snapshot.ShowButtons", boost::bind(&LLFloaterSnapshot::updateButtons, this, _2));
+ mCommitCallbackRegistrar.add("Snapshot.ShowAdvanced", boost::bind(&Impl::showAdvanced, this, true));
+ mCommitCallbackRegistrar.add("Snapshot.HideAdvanced", boost::bind(&Impl::showAdvanced, this, false));
+ mCommitCallbackRegistrar.add("Snapshot.Refresh", boost::bind(&Impl::onClickNewSnapshot, this));
}
// Destroys the object
@@ -2023,27 +1984,14 @@ LLFloaterSnapshot::~LLFloaterSnapshot()
BOOL LLFloaterSnapshot::postBuild()
{
-
- getChild<LLButton>("share")->setCommitCallback(boost::bind(&LLFloaterSnapshot::updateButtons, this, SNAPSHOT_SHARE));
- getChild<LLButton>("save")->setCommitCallback(boost::bind(&LLFloaterSnapshot::updateButtons, this, SNAPSHOT_SAVE));
- getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterSnapshot::updateButtons, this, SNAPSHOT_MAIN));
-
getChild<LLButton>("share_to_web")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_WEB));
getChild<LLButton>("share_to_email")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_POSTCARD));
getChild<LLButton>("save_to_inventory")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_TEXTURE));
getChild<LLButton>("save_to_computer")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_LOCAL));
getChild<LLButton>("set_profile_pic")->setCommitCallback(boost::bind(&Impl::onCommitProfilePic, this));
- childSetCommitCallback("show_advanced", Impl::onToggleAdvanced, this);
- childSetCommitCallback("hide_advanced", Impl::onToggleAdvanced, this);
-
childSetCommitCallback("local_format_combo", Impl::onCommitSnapshotFormat, this);
- childSetAction("new_snapshot_btn", Impl::onClickNewSnapshot, this);
-
- childSetAction("more_btn", Impl::onClickMore, this);
- childSetAction("less_btn", Impl::onClickLess, this);
-
childSetCommitCallback("image_quality_slider", Impl::onCommitQuality, this);
childSetValue("image_quality_slider", gSavedSettings.getS32("SnapshotQuality"));
@@ -2095,12 +2043,13 @@ BOOL LLFloaterSnapshot::postBuild()
impl.mPreviewHandle = previewp->getHandle();
impl.updateControls(this);
impl.updateLayout(this);
+ impl.showAdvanced(this, gSavedSettings.getBOOL("AdvanceSnapshot"));
//save off the refresh button's rectangle so we can apply offsets with thumbnail resize
mRefreshBtnRect = getChild<LLButton>("new_snapshot_btn")->getRect();
// make sure we share/hide the general buttons
- updateButtons(SNAPSHOT_MAIN);
+ updateButtons(LLSD("main"));
return LLDockableFloater::postBuild();
}
@@ -2190,19 +2139,20 @@ void LLFloaterSnapshot::update()
}
}
-bool LLFloaterSnapshot::updateButtons(ESnapshotMode mode)
+bool LLFloaterSnapshot::updateButtons(const LLSD& mode)
{
- childSetVisible("share", mode == SNAPSHOT_MAIN);
- childSetVisible("save", mode == SNAPSHOT_MAIN);
- childSetVisible("set_profile_pic", mode == SNAPSHOT_MAIN);
+ std::string button_mode = mode.asString();
-// childSetVisible("share_to_web", mode == SNAPSHOT_SHARE);
- childSetVisible("share_to_email", mode == SNAPSHOT_SHARE);
+ bool mode_main("main" == button_mode);
+ bool mode_share("share" == button_mode);
+ bool mode_save("save" == button_mode);
- childSetVisible("save_to_inventory", mode == SNAPSHOT_SAVE);
- childSetVisible("save_to_computer", mode == SNAPSHOT_SAVE);
+ // Default to a known state if mode is invalid.
+ if (!mode_main && !mode_share && !mode_save) mode_main = true;
- childSetVisible("cancel", mode != SNAPSHOT_MAIN);
+ childSetVisible("panel_snapshot_main", mode_main);
+ childSetVisible("panel_snapshot_share", mode_share);
+ childSetVisible("panel_snapshot_save", mode_save);
return true;
}
diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h
index 931d355748..8c4373c35c 100644
--- a/indra/newview/llfloatersnapshot.h
+++ b/indra/newview/llfloatersnapshot.h
@@ -47,13 +47,6 @@ public:
SNAPSHOT_FORMAT_BMP
} ESnapshotFormat;
- enum ESnapshotMode
- {
- SNAPSHOT_SHARE,
- SNAPSHOT_SAVE,
- SNAPSHOT_MAIN
- };
-
LLFloaterSnapshot(const LLSD& key);
virtual ~LLFloaterSnapshot();
@@ -66,7 +59,7 @@ public:
void setAsProfilePic(const LLUUID& image_id);
- bool updateButtons(ESnapshotMode mode);
+ bool updateButtons(const LLSD& mode);
static S32 getUIWinHeightLong() {return sUIWinHeightLong ;}
static S32 getUIWinHeightShort() {return sUIWinHeightShort ;}
diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml
index f3d297c303..7d81c3e551 100644
--- a/indra/newview/skins/default/xui/en/floater_snapshot.xml
+++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml
@@ -38,91 +38,129 @@
left="20"
top_pad="-30"
name="new_snapshot_btn"
- width="23" />
+ width="23"
+ commit_callback.function="Snapshot.Refresh"/>
<line_editor
border_style="line"
border_thickness="1"
- follows="left|top"
- height="20"
- layout="topleft"
+ follows="left|top"
+ height="20"
+ layout="topleft"
left="10"
- max_length="500"
+ max_length="500"
name="description"
- top_pad="15"
- width="230"
+ top_pad="15"
+ width="230"
label="Description"/>
+ <panel
+ top_pad="20"
+ left="10"
+ height="83"
+ name="panel_snapshot_main"
+ width="130">
+ <button
+ label="Share Snapshot"
+ name="share"
+ top="0"
+ left="0"
+ width="130"
+ commit_callback.function="Snapshot.ShowButtons"
+ commit_callback.parameter="share"/>
+ <button
+ label="Save Snapshot"
+ name="save"
+ top_pad="7"
+ left_delta="0"
+ width="130"
+ commit_callback.function="Snapshot.ShowButtons"
+ commit_callback.parameter="save"/>
+ <button
+ label="Set As Profile Pic"
+ name="set_profile_pic"
+ top_pad="7"
+ left_delta="0"
+ width="130"/>
+ </panel>
+ <panel
+ top_delta="0"
+ left_delta="0"
+ height="83"
+ name="panel_snapshot_share"
+ width="130">
+ <button
+ label="Share to Web"
+ name="share_to_web"
+ top="0"
+ left="0"
+ visible="false"
+ width="130"/>
+ <button
+ label="Email Snapshot"
+ name="share_to_email"
+ top_pad="7"
+ left_delta="0"
+ width="130"/>
+ <button
+ label="Back"
+ name="cancel_share"
+ top_pad="7"
+ left_delta="0"
+ width="130"
+ commit_callback.function="Snapshot.ShowButtons"
+ commit_callback.parameter="main"/>
+ </panel>
+ <panel
+ top_delta="0"
+ left_delta="0"
+ height="83"
+ name="panel_snapshot_save"
+ width="130">
+ <button
+ label="Save to My Inventory"
+ name="save_to_inventory"
+ top="0"
+ left="0"
+ width="130"/>
+ <button
+ label="Save to My Computer"
+ name="save_to_computer"
+ top_pad="7"
+ left_delta="0"
+ width="130"/>
+ <button
+ label="Back"
+ name="cancel_save"
+ top_pad="7"
+ left_delta="0"
+ width="130"
+ commit_callback.function="Snapshot.ShowButtons"
+ commit_callback.parameter="main"/>
+ </panel>
<button
- label="Share Snapshot"
- name="share"
- top_pad="20"
- left="10"
- width="130"/>
+ follows="left"
+ height="22"
+ layout="topleft"
+ left="210"
+ name="show_advanced"
+ image_overlay="TabIcon_Close_Off"
+ bottom_delta="0"
+ width="30"
+ commit_callback.function="Snapshot.ShowAdvanced"/>
<button
- label="Share to Web"
- name="share_to_web"
- top_delta="0"
- left="10"
+ follows="left"
+ height="22"
+ layout="topleft"
+ left="210"
+ name="hide_advanced"
+ image_overlay="TabIcon_Open_Off"
+ top_delta="0"
visible="false"
- width="130"/>
- <button
- label="Save to My Inventory"
- name="save_to_inventory"
- top_delta="0"
- left="10"
- width="130"/>
- <button
- label="Save Snapshot"
- name="save"
- top_pad="7"
- left="10"
- width="130"/>
- <button
- label="Email Snapshot"
- name="share_to_email"
- top_delta="0"
- left="10"
- width="130"/>
- <button
- label="Save to My Computer"
- name="save_to_computer"
- top_delta="0"
- left="10"
- width="130"/>
- <button
- label="Set As Profile Pic"
- name="set_profile_pic"
- top_pad="7"
- left="10"
- width="130"/>
- <button
- label="Back"
- name="cancel"
- top_delta="0"
- left="10"
- width="130"/>
- <button
- follows="left"
- height="22"
- layout="topleft"
- left="210"
- name="show_advanced"
- image_overlay="TabIcon_Close_Off"
- top_delta="1"
- width="30"/>
- <button
- follows="left"
- height="22"
- layout="topleft"
- left="210"
- visible="false"
- name="hide_advanced"
- image_overlay="TabIcon_Open_Off"
- top_delta="0"
- width="30"/>
+ width="30"
+ commit_callback.function="Snapshot.HideAdvanced"/>
<panel
- visible="false"
- left="250"
- top="17"
- name="snapshot_advanced"
- filename="panel_snapshot_advanced.xml"/>
+ visible="false"
+ left="250"
+ top="17"
+ name="snapshot_advanced"
+ filename="panel_snapshot_advanced.xml"/>
</floater>