From 19d0384cd8dd930989733d6c5b901cbfcbfea74c Mon Sep 17 00:00:00 2001 From: ziree Date: Mon, 23 Jan 2012 00:26:01 +0100 Subject: [PATCH] Redesigned snapshot panel with advanced options at the bottom --- indra/newview/llfloatersnapshot.cpp | 64 ++++++++++--- indra/newview/llfloatersnapshot.h | 2 + indra/newview/llpanelsnapshotoptions.cpp | 2 + .../skins/default/xui/en/floater_snapshot.xml | 90 ++++++++++++------- .../default/xui/en/panel_postcard_message.xml | 21 ++--- .../xui/en/panel_snapshot_inventory.xml | 19 ++-- .../default/xui/en/panel_snapshot_local.xml | 14 +-- .../default/xui/en/panel_snapshot_options.xml | 2 + .../xui/en/panel_snapshot_postcard.xml | 15 +++- .../default/xui/en/panel_snapshot_profile.xml | 37 ++++---- 10 files changed, 177 insertions(+), 89 deletions(-) diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 7f71000e55..616edec731 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -1144,12 +1144,16 @@ public: // static LLPanelSnapshot* LLFloaterSnapshot::Impl::getActivePanel(LLFloaterSnapshot* floater, bool ok_if_not_found) { - LLSideTrayPanelContainer* panel_container = floater->getChild("panel_container"); - LLPanelSnapshot* active_panel = dynamic_cast(panel_container->getCurrentPanel()); - if (!ok_if_not_found) - { - llassert_always(active_panel != NULL); - } + // We don't use the in the new version, since a tab widget makes a lot more sense +// LLSideTrayPanelContainer* panel_container = floater->getChild("panel_container"); +// LLPanelSnapshot* active_panel = dynamic_cast(panel_container->getCurrentPanel()); +// if (!ok_if_not_found) +// { +// llassert_always(active_panel != NULL); +// } + LLTabContainer* tab_container=floater->getChild("panel_tab_container"); + LLPanelSnapshot* active_panel=(LLPanelSnapshot*) tab_container->getCurrentPanel(); + // return active_panel; } @@ -1267,11 +1271,18 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) floaterp->getChild("advanced_options_btn")->setImageOverlay(advanced ? "TabIcon_Open_Off" : "TabIcon_Close_Off"); if (advanced != advanced_options_panel->getVisible()) { - S32 panel_width = advanced_options_panel->getRect().getWidth(); + // New calculation method for advanced options at the bottom of the floater +// S32 panel_width = advanced_options_panel->getRect().getWidth(); floaterp->getChild("advanced_options_panel")->setVisible(advanced); - S32 floater_width = floaterp->getRect().getWidth(); - floater_width += (advanced ? panel_width : -panel_width); - floaterp->reshape(floater_width, floaterp->getRect().getHeight()); +// S32 floater_width = floaterp->getRect().getWidth(); +// floater_width += (advanced ? panel_width : -panel_width); +// floaterp->reshape(floater_width, floaterp->getRect().getHeight()); + S32 panel_height = advanced_options_panel->getRect().getHeight(); + S32 floater_height = floaterp->getRect().getHeight(); + floater_height+=(advanced) ? panel_height : -panel_height; + floaterp->reshape(floaterp->getRect().getWidth(),floater_height); + floaterp->translate(0,(advanced) ? -panel_height : panel_height); + // } if(!advanced) //set to original window resolution @@ -2012,6 +2023,9 @@ LLFloaterSnapshot::LLFloaterSnapshot(const LLSD& key) mFailureLblPanel(NULL), impl (*(new Impl)) { + // Add a commit handler to react on switching snapshot destination tab pages + mCommitCallbackRegistrar.add("Snapshot.SelectDestination",boost::bind(&LLFloaterSnapshot::onSelectDestination,this)); + // } // Destroys the object @@ -2446,12 +2460,38 @@ void LLFloaterSnapshot::setAgentEmail(const std::string& email) LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance("snapshot"); if (instance) { - LLSideTrayPanelContainer* panel_container = instance->getChild("panel_container"); - LLPanel* postcard_panel = panel_container->getPanelByName("panel_snapshot_postcard"); + // Adapt code to new tab widget +// LLSideTrayPanelContainer* panel_container = instance->getChild("panel_container"); +// LLPanel* postcard_panel = panel_container->getPanelByName("panel_snapshot_postcard"); + LLPanel* postcard_panel=instance->getChild("panel_snapshot_postcard"); postcard_panel->notify(LLSD().with("agent-email", email)); + // } } +// Called whenever the snapshot destination is changed +void LLFloaterSnapshot::onSelectDestination() +{ + static LLPanelSnapshot* previousPanel; + + LLPanelSnapshot* panel=(LLPanelSnapshot*) getChild("panel_tab_container")->getCurrentPanel(); + if(!panel) + { + llwarns << "no active snapshot destination found" << llendl; + return; + } + + // postPanelSwitch uses getInstance() on us, but we won't have retgistered in the singleton handler + // until then, so we'd run into a loop. Make sure we don't update on first run. + if(previousPanel!=0) + { + panel->onOpen(LLSD()); + postPanelSwitch(); + } + previousPanel=panel; +} +// + ///---------------------------------------------------------------------------- /// Class LLSnapshotFloaterView ///---------------------------------------------------------------------------- diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index afe135fa40..ab61791279 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -74,6 +74,8 @@ private: LLUICtrl *mRefreshBtn, *mRefreshLabel; LLUICtrl *mSucceessLblPanel, *mFailureLblPanel; + void onSelectDestination(); // Called whenever the snapshot destination is changed + class Impl; Impl& impl; }; diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 554fabe5b3..e1f6a3f9ce 100644 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -32,6 +32,8 @@ #include "llfloatersnapshot.h" // FIXME: create a snapshot model +// This file is not used in Firestorm + /** * Provides several ways to save a snapshot. */ diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml index 0c38283d59..67c66c72ae 100644 --- a/indra/newview/skins/default/xui/en/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml @@ -4,14 +4,14 @@ legacy_header_height="18" can_minimize="true" can_close="true" - height="500" + height="560" layout="topleft" name="Snapshot" help_topic="snapshot" save_rect="true" save_visibility="false" title="SNAPSHOT PREVIEW" - width="470"> + width="270"> unknown @@ -64,23 +64,13 @@ name="local_failed_str"> Failed to save to computer. - + --> + --> + --> This file is unused in Firestorm --> + Sending... - --> + - + + diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml b/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml index 91ac9ad658..9dc67677df 100644 --- a/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml +++ b/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml @@ -1,10 +1,11 @@ - + />--> + right="-1" + top="5"> - + visible="true">--> - + Caption: @@ -171,7 +172,7 @@ left_delta="0" name="add_location_cb" top_pad="15" /> - +