diff options
| author | pavelkproductengine <pavelkproductengine@lindenlab.com> | 2016-06-02 20:23:46 +0300 | 
|---|---|---|
| committer | pavelkproductengine <pavelkproductengine@lindenlab.com> | 2016-06-02 20:23:46 +0300 | 
| commit | 9f789ddfbad656b0a6e1f59b592795ad22bdd061 (patch) | |
| tree | b01b1274f6c766718c7415dfda909a930e135340 | |
| parent | d1b7deda45f778e0fcfb92f38f9f5694ab285d1c (diff) | |
MAINT-5194 Visual Outfit browser
Made refactoring of LLFloaterOutfitSnapshot and LLFloaterSnapshot
25 files changed, 1384 insertions, 2043 deletions
| diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index de0dff61bb..5d7ab0c985 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1144,6 +1144,7 @@ set(viewer_HEADER_FILES      llsky.h      llslurl.h      llsnapshotlivepreview.h +    llsnapshotmodel.h      llspatialpartition.h      llspeakers.h      llspeakingindicatormanager.h diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 86cf1cecf3..a92ad4e41d 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1448,8 +1448,7 @@ bool LLAppViewer::mainLoop()  					display();  					pingMainloopTimeout("Main:Snapshot");  					LLFloaterSnapshot::update(); // take snapshots -                    //TODO: Make one call by moving LLFloaterOutfitSnapshot::update() to LLFloaterSnapshotBase class -                    LLFloaterOutfitSnapshot::update(); +					LLFloaterOutfitSnapshot::update();  					gGLActive = FALSE;  				}  			} diff --git a/indra/newview/llfloaterfacebook.cpp b/indra/newview/llfloaterfacebook.cpp index ff6e342d62..b1d6d8be82 100644 --- a/indra/newview/llfloaterfacebook.cpp +++ b/indra/newview/llfloaterfacebook.cpp @@ -87,7 +87,7 @@ S32 compute_jpeg_quality(S32 width, S32 height)  {      F32 target_compression_ratio = (F32)(width * height * 3) / (F32)(TARGET_DATA_SIZE);      S32 quality = (S32)(110.0f - (2.0f * target_compression_ratio)); -    return llclamp(quality,MIN_QUALITY,MAX_QUALITY); +    return llclamp(quality, MIN_QUALITY, MAX_QUALITY);  }  /////////////////////////// @@ -95,52 +95,52 @@ S32 compute_jpeg_quality(S32 width, S32 height)  ///////////////////////////  LLFacebookStatusPanel::LLFacebookStatusPanel() : -	mMessageTextEditor(NULL), -	mPostButton(NULL), +    mMessageTextEditor(NULL), +    mPostButton(NULL),      mCancelButton(NULL), -	mAccountCaptionLabel(NULL), -	mAccountNameLabel(NULL), -	mPanelButtons(NULL), -	mConnectButton(NULL), -	mDisconnectButton(NULL) +    mAccountCaptionLabel(NULL), +    mAccountNameLabel(NULL), +    mPanelButtons(NULL), +    mConnectButton(NULL), +    mDisconnectButton(NULL)  { -	mCommitCallbackRegistrar.add("SocialSharing.Connect", boost::bind(&LLFacebookStatusPanel::onConnect, this)); -	mCommitCallbackRegistrar.add("SocialSharing.Disconnect", boost::bind(&LLFacebookStatusPanel::onDisconnect, this)); +    mCommitCallbackRegistrar.add("SocialSharing.Connect", boost::bind(&LLFacebookStatusPanel::onConnect, this)); +    mCommitCallbackRegistrar.add("SocialSharing.Disconnect", boost::bind(&LLFacebookStatusPanel::onDisconnect, this)); -	setVisibleCallback(boost::bind(&LLFacebookStatusPanel::onVisibilityChange, this, _2)); +    setVisibleCallback(boost::bind(&LLFacebookStatusPanel::onVisibilityChange, this, _2)); -	mCommitCallbackRegistrar.add("SocialSharing.SendStatus", boost::bind(&LLFacebookStatusPanel::onSend, this)); +    mCommitCallbackRegistrar.add("SocialSharing.SendStatus", boost::bind(&LLFacebookStatusPanel::onSend, this));  }  BOOL LLFacebookStatusPanel::postBuild()  { -	mAccountCaptionLabel = getChild<LLTextBox>("account_caption_label"); -	mAccountNameLabel = getChild<LLTextBox>("account_name_label"); -	mPanelButtons = getChild<LLUICtrl>("panel_buttons"); -	mConnectButton = getChild<LLUICtrl>("connect_btn"); -	mDisconnectButton = getChild<LLUICtrl>("disconnect_btn"); +    mAccountCaptionLabel = getChild<LLTextBox>("account_caption_label"); +    mAccountNameLabel = getChild<LLTextBox>("account_name_label"); +    mPanelButtons = getChild<LLUICtrl>("panel_buttons"); +    mConnectButton = getChild<LLUICtrl>("connect_btn"); +    mDisconnectButton = getChild<LLUICtrl>("disconnect_btn"); -	mMessageTextEditor = getChild<LLUICtrl>("status_message"); -	mPostButton = getChild<LLUICtrl>("post_status_btn"); -	mCancelButton = getChild<LLUICtrl>("cancel_status_btn"); +    mMessageTextEditor = getChild<LLUICtrl>("status_message"); +    mPostButton = getChild<LLUICtrl>("post_status_btn"); +    mCancelButton = getChild<LLUICtrl>("cancel_status_btn"); -	return LLPanel::postBuild(); +    return LLPanel::postBuild();  }  void LLFacebookStatusPanel::draw()  { -	LLFacebookConnect::EConnectionState connection_state = LLFacebookConnect::instance().getConnectionState(); +    LLFacebookConnect::EConnectionState connection_state = LLFacebookConnect::instance().getConnectionState(); -	//Disable the 'disconnect' button and the 'use another account' button when disconnecting in progress -	bool disconnecting = connection_state == LLFacebookConnect::FB_DISCONNECTING; -	mDisconnectButton->setEnabled(!disconnecting); +    //Disable the 'disconnect' button and the 'use another account' button when disconnecting in progress +    bool disconnecting = connection_state == LLFacebookConnect::FB_DISCONNECTING; +    mDisconnectButton->setEnabled(!disconnecting); -	//Disable the 'connect' button when a connection is in progress -	bool connecting = connection_state == LLFacebookConnect::FB_CONNECTION_IN_PROGRESS; -	mConnectButton->setEnabled(!connecting); +    //Disable the 'connect' button when a connection is in progress +    bool connecting = connection_state == LLFacebookConnect::FB_CONNECTION_IN_PROGRESS; +    mConnectButton->setEnabled(!connecting);      if (mMessageTextEditor && mPostButton && mCancelButton) -	{ +    {          bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing());          std::string message = mMessageTextEditor->getValue().asString();          mMessageTextEditor->setEnabled(no_ongoing_connection); @@ -148,175 +148,175 @@ void LLFacebookStatusPanel::draw()          mPostButton->setEnabled(no_ongoing_connection && !message.empty());      } -	LLPanel::draw(); +    LLPanel::draw();  }  void LLFacebookStatusPanel::onSend()  { -	LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookStatusPanel"); // just in case it is already listening -	LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookStatusPanel", boost::bind(&LLFacebookStatusPanel::onFacebookConnectStateChange, this, _1)); -	 -	// Connect to Facebook if necessary and then post -	if (LLFacebookConnect::instance().isConnected()) -	{ -		sendStatus(); -	} -	else -	{ -		LLFacebookConnect::instance().checkConnectionToFacebook(true); -	} +    LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookStatusPanel"); // just in case it is already listening +    LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookStatusPanel", boost::bind(&LLFacebookStatusPanel::onFacebookConnectStateChange, this, _1)); + +    // Connect to Facebook if necessary and then post +    if (LLFacebookConnect::instance().isConnected()) +    { +        sendStatus(); +    } +    else +    { +        LLFacebookConnect::instance().checkConnectionToFacebook(true); +    }  }  bool LLFacebookStatusPanel::onFacebookConnectStateChange(const LLSD& data)  { -	switch (data.get("enum").asInteger()) -	{ -		case LLFacebookConnect::FB_CONNECTED: -			sendStatus(); -			break; - -		case LLFacebookConnect::FB_POSTED: -			LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookStatusPanel"); -			clearAndClose(); -			break; -	} - -	return false; +    switch (data.get("enum").asInteger()) +    { +    case LLFacebookConnect::FB_CONNECTED: +        sendStatus(); +        break; + +    case LLFacebookConnect::FB_POSTED: +        LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookStatusPanel"); +        clearAndClose(); +        break; +    } + +    return false;  }  bool LLFacebookStatusPanel::onFacebookConnectAccountStateChange(const LLSD& data)  { -	if(LLFacebookConnect::instance().isConnected()) -	{ -		//In process of disconnecting so leave the layout as is -		if(data.get("enum").asInteger() != LLFacebookConnect::FB_DISCONNECTING) -		{ -			showConnectedLayout(); -		} -	} -	else -	{ -		showDisconnectedLayout(); -	} - -	return false; +    if (LLFacebookConnect::instance().isConnected()) +    { +        //In process of disconnecting so leave the layout as is +        if (data.get("enum").asInteger() != LLFacebookConnect::FB_DISCONNECTING) +        { +            showConnectedLayout(); +        } +    } +    else +    { +        showDisconnectedLayout(); +    } + +    return false;  }  void LLFacebookStatusPanel::sendStatus()  { -	std::string message = mMessageTextEditor->getValue().asString(); -	if (!message.empty()) -	{ -		LLFacebookConnect::instance().updateStatus(message); -	} +    std::string message = mMessageTextEditor->getValue().asString(); +    if (!message.empty()) +    { +        LLFacebookConnect::instance().updateStatus(message); +    }  }  void LLFacebookStatusPanel::onVisibilityChange(BOOL visible)  { -	if(visible) -	{ -		LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookAccountPanel"); -		LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookAccountPanel", boost::bind(&LLFacebookStatusPanel::onFacebookConnectAccountStateChange, this, _1)); - -		LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLFacebookAccountPanel"); -		LLEventPumps::instance().obtain("FacebookConnectInfo").listen("LLFacebookAccountPanel", boost::bind(&LLFacebookStatusPanel::onFacebookConnectInfoChange, this)); - -		//Connected -		if(LLFacebookConnect::instance().isConnected()) -		{ -			showConnectedLayout(); -		} -		//Check if connected (show disconnected layout in meantime) -		else -		{ -			showDisconnectedLayout(); -		} +    if (visible) +    { +        LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookAccountPanel"); +        LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookAccountPanel", boost::bind(&LLFacebookStatusPanel::onFacebookConnectAccountStateChange, this, _1)); + +        LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLFacebookAccountPanel"); +        LLEventPumps::instance().obtain("FacebookConnectInfo").listen("LLFacebookAccountPanel", boost::bind(&LLFacebookStatusPanel::onFacebookConnectInfoChange, this)); + +        //Connected +        if (LLFacebookConnect::instance().isConnected()) +        { +            showConnectedLayout(); +        } +        //Check if connected (show disconnected layout in meantime) +        else +        { +            showDisconnectedLayout(); +        }          if ((LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_NOT_CONNECTED) ||              (LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_CONNECTION_FAILED))          {              LLFacebookConnect::instance().checkConnectionToFacebook();          } -	} -	else -	{ -		LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookAccountPanel"); -		LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLFacebookAccountPanel"); -	} +    } +    else +    { +        LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookAccountPanel"); +        LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLFacebookAccountPanel"); +    }  }  bool LLFacebookStatusPanel::onFacebookConnectInfoChange()  { -	LLSD info = LLFacebookConnect::instance().getInfo(); -	std::string clickable_name; +    LLSD info = LLFacebookConnect::instance().getInfo(); +    std::string clickable_name; -	//Strings of format [http://www.somewebsite.com Click Me] become clickable text -	if(info.has("link") && info.has("name")) -	{ -		clickable_name = "[" + info["link"].asString() + " " + info["name"].asString() + "]"; -	} +    //Strings of format [http://www.somewebsite.com Click Me] become clickable text +    if (info.has("link") && info.has("name")) +    { +        clickable_name = "[" + info["link"].asString() + " " + info["name"].asString() + "]"; +    } -	mAccountNameLabel->setText(clickable_name); +    mAccountNameLabel->setText(clickable_name); -	return false; +    return false;  }  void LLFacebookStatusPanel::showConnectButton()  { -	if(!mConnectButton->getVisible()) -	{ -		mConnectButton->setVisible(TRUE); -		mDisconnectButton->setVisible(FALSE); -	} +    if (!mConnectButton->getVisible()) +    { +        mConnectButton->setVisible(TRUE); +        mDisconnectButton->setVisible(FALSE); +    }  }  void LLFacebookStatusPanel::hideConnectButton()  { -	if(mConnectButton->getVisible()) -	{ -		mConnectButton->setVisible(FALSE); -		mDisconnectButton->setVisible(TRUE); -	} +    if (mConnectButton->getVisible()) +    { +        mConnectButton->setVisible(FALSE); +        mDisconnectButton->setVisible(TRUE); +    }  }  void LLFacebookStatusPanel::showDisconnectedLayout()  { -	mAccountCaptionLabel->setText(getString("facebook_disconnected")); -	mAccountNameLabel->setText(std::string("")); -	showConnectButton(); +    mAccountCaptionLabel->setText(getString("facebook_disconnected")); +    mAccountNameLabel->setText(std::string("")); +    showConnectButton();  }  void LLFacebookStatusPanel::showConnectedLayout()  { -	LLFacebookConnect::instance().loadFacebookInfo(); +    LLFacebookConnect::instance().loadFacebookInfo(); -	mAccountCaptionLabel->setText(getString("facebook_connected")); -	hideConnectButton(); +    mAccountCaptionLabel->setText(getString("facebook_connected")); +    hideConnectButton();  }  void LLFacebookStatusPanel::onConnect()  { -	LLFacebookConnect::instance().checkConnectionToFacebook(true); +    LLFacebookConnect::instance().checkConnectionToFacebook(true); -	//Clear only the facebook browser cookies so that the facebook login screen appears -	LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com");  +    //Clear only the facebook browser cookies so that the facebook login screen appears +    LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com");  }  void LLFacebookStatusPanel::onDisconnect()  { -	LLFacebookConnect::instance().disconnectFromFacebook(); +    LLFacebookConnect::instance().disconnectFromFacebook(); -	LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com");  +    LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com");  }  void LLFacebookStatusPanel::clearAndClose()  { -	mMessageTextEditor->setValue(""); +    mMessageTextEditor->setValue(""); -	LLFloater* floater = getParentByType<LLFloater>(); -	if (floater) -	{ -		floater->closeFloater(); -	} +    LLFloater* floater = getParentByType<LLFloater>(); +    if (floater) +    { +        floater->closeFloater(); +    }  }  /////////////////////////// @@ -324,89 +324,89 @@ void LLFacebookStatusPanel::clearAndClose()  ///////////////////////////  LLFacebookPhotoPanel::LLFacebookPhotoPanel() : -mResolutionComboBox(NULL), -mRefreshBtn(NULL), -mBtnPreview(NULL), -mWorkingLabel(NULL), -mThumbnailPlaceholder(NULL), -mCaptionTextBox(NULL), -mPostButton(NULL), -mBigPreviewFloater(NULL), -mQuality(MAX_QUALITY) +    mResolutionComboBox(NULL), +    mRefreshBtn(NULL), +    mBtnPreview(NULL), +    mWorkingLabel(NULL), +    mThumbnailPlaceholder(NULL), +    mCaptionTextBox(NULL), +    mPostButton(NULL), +    mBigPreviewFloater(NULL), +    mQuality(MAX_QUALITY)  { -	mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLFacebookPhotoPanel::onSend, this)); -	mCommitCallbackRegistrar.add("SocialSharing.RefreshPhoto", boost::bind(&LLFacebookPhotoPanel::onClickNewSnapshot, this)); -	mCommitCallbackRegistrar.add("SocialSharing.BigPreview", boost::bind(&LLFacebookPhotoPanel::onClickBigPreview, this)); +    mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLFacebookPhotoPanel::onSend, this)); +    mCommitCallbackRegistrar.add("SocialSharing.RefreshPhoto", boost::bind(&LLFacebookPhotoPanel::onClickNewSnapshot, this)); +    mCommitCallbackRegistrar.add("SocialSharing.BigPreview", boost::bind(&LLFacebookPhotoPanel::onClickBigPreview, this));  }  LLFacebookPhotoPanel::~LLFacebookPhotoPanel()  { -	if(mPreviewHandle.get()) -	{ -		mPreviewHandle.get()->die(); -	} +    if (mPreviewHandle.get()) +    { +        mPreviewHandle.get()->die(); +    }  }  BOOL LLFacebookPhotoPanel::postBuild()  { -	setVisibleCallback(boost::bind(&LLFacebookPhotoPanel::onVisibilityChange, this, _2)); -	 -	mResolutionComboBox = getChild<LLUICtrl>("resolution_combobox"); -	mResolutionComboBox->setValue("[i1200,i630]"); // hardcoded defaults ftw! -	mResolutionComboBox->setCommitCallback(boost::bind(&LLFacebookPhotoPanel::updateResolution, this, TRUE)); -	mFilterComboBox = getChild<LLUICtrl>("filters_combobox"); -	mFilterComboBox->setCommitCallback(boost::bind(&LLFacebookPhotoPanel::updateResolution, this, TRUE)); -	mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn"); -	mBtnPreview = getChild<LLButton>("big_preview_btn"); +    setVisibleCallback(boost::bind(&LLFacebookPhotoPanel::onVisibilityChange, this, _2)); + +    mResolutionComboBox = getChild<LLUICtrl>("resolution_combobox"); +    mResolutionComboBox->setValue("[i1200,i630]"); // hardcoded defaults ftw! +    mResolutionComboBox->setCommitCallback(boost::bind(&LLFacebookPhotoPanel::updateResolution, this, TRUE)); +    mFilterComboBox = getChild<LLUICtrl>("filters_combobox"); +    mFilterComboBox->setCommitCallback(boost::bind(&LLFacebookPhotoPanel::updateResolution, this, TRUE)); +    mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn"); +    mBtnPreview = getChild<LLButton>("big_preview_btn");      mWorkingLabel = getChild<LLUICtrl>("working_lbl"); -	mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder"); -	mCaptionTextBox = getChild<LLUICtrl>("photo_caption"); -	mPostButton = getChild<LLUICtrl>("post_photo_btn"); -	mCancelButton = getChild<LLUICtrl>("cancel_photo_btn"); -	mBigPreviewFloater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview")); +    mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder"); +    mCaptionTextBox = getChild<LLUICtrl>("photo_caption"); +    mPostButton = getChild<LLUICtrl>("post_photo_btn"); +    mCancelButton = getChild<LLUICtrl>("cancel_photo_btn"); +    mBigPreviewFloater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview")); -	// Update filter list +    // Update filter list      std::vector<std::string> filter_list = LLImageFiltersManager::getInstance()->getFiltersList(); -	LLComboBox* filterbox = static_cast<LLComboBox *>(mFilterComboBox); +    LLComboBox* filterbox = static_cast<LLComboBox *>(mFilterComboBox);      for (U32 i = 0; i < filter_list.size(); i++) -	{ +    {          filterbox->add(filter_list[i]);      } -	return LLPanel::postBuild(); +    return LLPanel::postBuild();  }  // virtual  S32 LLFacebookPhotoPanel::notify(const LLSD& info)  { -	if (info.has("snapshot-updating")) -	{ +    if (info.has("snapshot-updating")) +    {          // Disable the Post button and whatever else while the snapshot is not updated          // updateControls(); -		return 1; -	} -     -	if (info.has("snapshot-updated")) -	{ +        return 1; +    } + +    if (info.has("snapshot-updated")) +    {          // Enable the send/post/save buttons.          updateControls(); -         -		// The refresh button is initially hidden. We show it after the first update, -		// i.e. after snapshot is taken -		LLUICtrl * refresh_button = getRefreshBtn(); -		if (!refresh_button->getVisible()) -		{ -			refresh_button->setVisible(true); -		} -		return 1; -	} -     -	return 0; + +        // The refresh button is initially hidden. We show it after the first update, +        // i.e. after snapshot is taken +        LLUICtrl * refresh_button = getRefreshBtn(); +        if (!refresh_button->getVisible()) +        { +            refresh_button->setVisible(true); +        } +        return 1; +    } + +    return 0;  }  void LLFacebookPhotoPanel::draw() -{  -	LLSnapshotLivePreview * previewp = static_cast<LLSnapshotLivePreview *>(mPreviewHandle.get()); +{ +    LLSnapshotLivePreview * previewp = static_cast<LLSnapshotLivePreview *>(mPreviewHandle.get());      // Enable interaction only if no transaction with the service is on-going (prevent duplicated posts)      bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); @@ -416,98 +416,98 @@ void LLFacebookPhotoPanel::draw()      mFilterComboBox->setEnabled(no_ongoing_connection);      mRefreshBtn->setEnabled(no_ongoing_connection);      mBtnPreview->setEnabled(no_ongoing_connection); -	 +      // Reassign the preview floater if we have the focus and the preview exists      if (hasFocus() && isPreviewVisible())      {          attachPreview();      } -     +      // Toggle the button state as appropriate      bool preview_active = (isPreviewVisible() && mBigPreviewFloater->isFloaterOwner(getParentByType<LLFloater>())); -	mBtnPreview->setToggleState(preview_active); -     +    mBtnPreview->setToggleState(preview_active); +      // Display the thumbnail if one is available -	if (previewp && previewp->getThumbnailImage()) -	{ -		const LLRect& thumbnail_rect = mThumbnailPlaceholder->getRect(); -		const S32 thumbnail_w = previewp->getThumbnailWidth(); -		const S32 thumbnail_h = previewp->getThumbnailHeight(); - -		// calc preview offset within the preview rect -		const S32 local_offset_x = (thumbnail_rect.getWidth()  - thumbnail_w) / 2 ; -		const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2 ; -		S32 offset_x = thumbnail_rect.mLeft + local_offset_x; -		S32 offset_y = thumbnail_rect.mBottom + local_offset_y; - -		gGL.matrixMode(LLRender::MM_MODELVIEW); -		// Apply floater transparency to the texture unless the floater is focused. -		F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); -		LLColor4 color = LLColor4::white; -		gl_draw_scaled_image(offset_x, offset_y,  -			thumbnail_w, thumbnail_h, -			previewp->getThumbnailImage(), color % alpha); -	} +    if (previewp && previewp->getThumbnailImage()) +    { +        const LLRect& thumbnail_rect = mThumbnailPlaceholder->getRect(); +        const S32 thumbnail_w = previewp->getThumbnailWidth(); +        const S32 thumbnail_h = previewp->getThumbnailHeight(); + +        // calc preview offset within the preview rect +        const S32 local_offset_x = (thumbnail_rect.getWidth() - thumbnail_w) / 2; +        const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2; +        S32 offset_x = thumbnail_rect.mLeft + local_offset_x; +        S32 offset_y = thumbnail_rect.mBottom + local_offset_y; + +        gGL.matrixMode(LLRender::MM_MODELVIEW); +        // Apply floater transparency to the texture unless the floater is focused. +        F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); +        LLColor4 color = LLColor4::white; +        gl_draw_scaled_image(offset_x, offset_y, +            thumbnail_w, thumbnail_h, +            previewp->getThumbnailImage(), color % alpha); +    }      // Update the visibility of the working (computing preview) label      mWorkingLabel->setVisible(!(previewp && previewp->getSnapshotUpToDate())); -     +      // Enable Post if we have a preview to send and no on going connection being processed      mPostButton->setEnabled(no_ongoing_connection && (previewp && previewp->getSnapshotUpToDate())); -     +      // Draw the rest of the panel on top of it -	LLPanel::draw(); +    LLPanel::draw();  }  LLSnapshotLivePreview* LLFacebookPhotoPanel::getPreviewView()  { -	LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)mPreviewHandle.get(); -	return previewp; +    LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)mPreviewHandle.get(); +    return previewp;  }  void LLFacebookPhotoPanel::onVisibilityChange(BOOL visible)  { -	if (visible) -	{ -		if (mPreviewHandle.get()) -		{ -			LLSnapshotLivePreview* preview = getPreviewView(); -			if(preview) -			{ -				LL_DEBUGS() << "opened, updating snapshot" << LL_ENDL; -				preview->updateSnapshot(TRUE); -			} -		} -		else -		{ -			LLRect full_screen_rect = getRootView()->getRect(); -			LLSnapshotLivePreview::Params p; -			p.rect(full_screen_rect); -			LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); -			mPreviewHandle = previewp->getHandle();	 +    if (visible) +    { +        if (mPreviewHandle.get()) +        { +            LLSnapshotLivePreview* preview = getPreviewView(); +            if (preview) +            { +                LL_DEBUGS() << "opened, updating snapshot" << LL_ENDL; +                preview->updateSnapshot(TRUE); +            } +        } +        else +        { +            LLRect full_screen_rect = getRootView()->getRect(); +            LLSnapshotLivePreview::Params p; +            p.rect(full_screen_rect); +            LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); +            mPreviewHandle = previewp->getHandle();              mQuality = MAX_QUALITY;              previewp->setContainer(this); -            previewp->setSnapshotType(LLPanelSnapshot::SNAPSHOT_WEB); -			previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); -			previewp->setSnapshotQuality(mQuality, false); +            previewp->setSnapshotType(LLSnapshotModel::SNAPSHOT_WEB); +            previewp->setSnapshotFormat(LLSnapshotModel::SNAPSHOT_FORMAT_JPEG); +            previewp->setSnapshotQuality(mQuality, false);              previewp->setThumbnailSubsampled(TRUE);     // We want the preview to reflect the *saved* image              previewp->setAllowRenderUI(FALSE);          // We do not want the rendered UI in our snapshots              previewp->setAllowFullScreenPreview(FALSE);  // No full screen preview in SL Share mode -			previewp->setThumbnailPlaceholderRect(mThumbnailPlaceholder->getRect()); +            previewp->setThumbnailPlaceholderRect(mThumbnailPlaceholder->getRect()); -			updateControls(); -		} -	} +            updateControls(); +        } +    }  }  void LLFacebookPhotoPanel::onClickNewSnapshot()  { -	LLSnapshotLivePreview* previewp = getPreviewView(); -	if (previewp) -	{ -		previewp->updateSnapshot(TRUE); -	} +    LLSnapshotLivePreview* previewp = getPreviewView(); +    if (previewp) +    { +        previewp->updateSnapshot(TRUE); +    }  }  void LLFacebookPhotoPanel::onClickBigPreview() @@ -541,167 +541,167 @@ void LLFacebookPhotoPanel::attachPreview()  void LLFacebookPhotoPanel::onSend()  { -	LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookPhotoPanel"); // just in case it is already listening -	LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookPhotoPanel", boost::bind(&LLFacebookPhotoPanel::onFacebookConnectStateChange, this, _1)); -	 -	// Connect to Facebook if necessary and then post -	if (LLFacebookConnect::instance().isConnected()) -	{ -		sendPhoto(); -	} -	else -	{ -		LLFacebookConnect::instance().checkConnectionToFacebook(true); -	} +    LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookPhotoPanel"); // just in case it is already listening +    LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookPhotoPanel", boost::bind(&LLFacebookPhotoPanel::onFacebookConnectStateChange, this, _1)); + +    // Connect to Facebook if necessary and then post +    if (LLFacebookConnect::instance().isConnected()) +    { +        sendPhoto(); +    } +    else +    { +        LLFacebookConnect::instance().checkConnectionToFacebook(true); +    }  }  bool LLFacebookPhotoPanel::onFacebookConnectStateChange(const LLSD& data)  { -	switch (data.get("enum").asInteger()) -	{ -		case LLFacebookConnect::FB_CONNECTED: -			sendPhoto(); -			break; - -		case LLFacebookConnect::FB_POSTED: -			LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookPhotoPanel"); -			clearAndClose(); -			break; -	} - -	return false; +    switch (data.get("enum").asInteger()) +    { +    case LLFacebookConnect::FB_CONNECTED: +        sendPhoto(); +        break; + +    case LLFacebookConnect::FB_POSTED: +        LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookPhotoPanel"); +        clearAndClose(); +        break; +    } + +    return false;  }  void LLFacebookPhotoPanel::sendPhoto()  { -	// Get the caption -	std::string caption = mCaptionTextBox->getValue().asString(); +    // Get the caption +    std::string caption = mCaptionTextBox->getValue().asString(); -	// Get the image -	LLSnapshotLivePreview* previewp = getPreviewView(); -	 -	// Post to Facebook -	LLFacebookConnect::instance().sharePhoto(previewp->getFormattedImage(), caption); +    // Get the image +    LLSnapshotLivePreview* previewp = getPreviewView(); -	updateControls(); +    // Post to Facebook +    LLFacebookConnect::instance().sharePhoto(previewp->getFormattedImage(), caption); + +    updateControls();  }  void LLFacebookPhotoPanel::clearAndClose()  { -	mCaptionTextBox->setValue(""); +    mCaptionTextBox->setValue(""); -	LLFloater* floater = getParentByType<LLFloater>(); -	if (floater) -	{ -		floater->closeFloater(); +    LLFloater* floater = getParentByType<LLFloater>(); +    if (floater) +    { +        floater->closeFloater();          if (mBigPreviewFloater)          {              mBigPreviewFloater->closeOnFloaterOwnerClosing(floater);          } -	} +    }  }  void LLFacebookPhotoPanel::updateControls()  { -	LLSnapshotLivePreview* previewp = getPreviewView(); -	BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); -     -	// *TODO: Separate maximum size for Web images from postcards -	LL_DEBUGS() << "Is snapshot up-to-date? " << got_snap << LL_ENDL; -     -	updateResolution(FALSE); +    LLSnapshotLivePreview* previewp = getPreviewView(); +    BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); + +    // *TODO: Separate maximum size for Web images from postcards +    LL_DEBUGS() << "Is snapshot up-to-date? " << got_snap << LL_ENDL; + +    updateResolution(FALSE);  }  void LLFacebookPhotoPanel::updateResolution(BOOL do_update)  { -	LLComboBox* combobox = static_cast<LLComboBox *>(mResolutionComboBox); -	LLComboBox* filterbox = static_cast<LLComboBox *>(mFilterComboBox); +    LLComboBox* combobox = static_cast<LLComboBox *>(mResolutionComboBox); +    LLComboBox* filterbox = static_cast<LLComboBox *>(mFilterComboBox); -	std::string sdstring = combobox->getSelectedValue(); -	LLSD sdres; -	std::stringstream sstream(sdstring); -	LLSDSerialize::fromNotation(sdres, sstream, sdstring.size()); +    std::string sdstring = combobox->getSelectedValue(); +    LLSD sdres; +    std::stringstream sstream(sdstring); +    LLSDSerialize::fromNotation(sdres, sstream, sdstring.size()); -	S32 width = sdres[0]; -	S32 height = sdres[1]; +    S32 width = sdres[0]; +    S32 height = sdres[1];      // Note : index 0 of the filter drop down is assumed to be "No filter" in whichever locale      std::string filter_name = (filterbox->getCurrentIndex() ? filterbox->getSimple() : ""); -	LLSnapshotLivePreview * previewp = static_cast<LLSnapshotLivePreview *>(mPreviewHandle.get()); -	if (previewp && combobox->getCurrentIndex() >= 0) -	{ -		S32 original_width = 0 , original_height = 0 ; -		previewp->getSize(original_width, original_height) ; - -		if (width == 0 || height == 0) -		{ -			// take resolution from current window size -			LL_DEBUGS() << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << LL_ENDL; -			previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); -		} -		else -		{ -			// use the resolution from the selected pre-canned drop-down choice -			LL_DEBUGS() << "Setting preview res selected from combo: " << width << "x" << height << LL_ENDL; -			previewp->setSize(width, height); -		} - -		checkAspectRatio(width); - -		previewp->getSize(width, height); -         +    LLSnapshotLivePreview * previewp = static_cast<LLSnapshotLivePreview *>(mPreviewHandle.get()); +    if (previewp && combobox->getCurrentIndex() >= 0) +    { +        S32 original_width = 0, original_height = 0; +        previewp->getSize(original_width, original_height); + +        if (width == 0 || height == 0) +        { +            // take resolution from current window size +            LL_DEBUGS() << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << LL_ENDL; +            previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); +        } +        else +        { +            // use the resolution from the selected pre-canned drop-down choice +            LL_DEBUGS() << "Setting preview res selected from combo: " << width << "x" << height << LL_ENDL; +            previewp->setSize(width, height); +        } + +        checkAspectRatio(width); + +        previewp->getSize(width, height); +          // Recompute quality setting          mQuality = compute_jpeg_quality(width, height);          previewp->setSnapshotQuality(mQuality, false); -		 -		if (original_width != width || original_height != height) -		{ -			previewp->setSize(width, height); -			if (do_update) -			{ + +        if (original_width != width || original_height != height) +        { +            previewp->setSize(width, height); +            if (do_update) +            {                  previewp->updateSnapshot(TRUE); -				updateControls(); -			} -		} +                updateControls(); +            } +        }          // Get the old filter, compare to the current one "filter_name" and set if changed          std::string original_filter = previewp->getFilter(); -		if (original_filter != filter_name) -		{ +        if (original_filter != filter_name) +        {              previewp->setFilter(filter_name); -			if (do_update) -			{ +            if (do_update) +            {                  previewp->updateSnapshot(FALSE, TRUE); -				updateControls(); -			} -		} -	} +                updateControls(); +            } +        } +    }  }  void LLFacebookPhotoPanel::checkAspectRatio(S32 index)  { -	LLSnapshotLivePreview *previewp = getPreviewView() ; - -	BOOL keep_aspect = FALSE; - -	if (0 == index) // current window size -	{ -		keep_aspect = TRUE; -	} -	else // predefined resolution -	{ -		keep_aspect = FALSE; -	} - -	if (previewp) -	{ -		previewp->mKeepAspectRatio = keep_aspect; -	} +    LLSnapshotLivePreview *previewp = getPreviewView(); + +    BOOL keep_aspect = FALSE; + +    if (0 == index) // current window size +    { +        keep_aspect = TRUE; +    } +    else // predefined resolution +    { +        keep_aspect = FALSE; +    } + +    if (previewp) +    { +        previewp->mKeepAspectRatio = keep_aspect; +    }  }  LLUICtrl* LLFacebookPhotoPanel::getRefreshBtn()  { -	return mRefreshBtn; +    return mRefreshBtn;  }  //////////////////////// @@ -712,21 +712,21 @@ LLFacebookCheckinPanel::LLFacebookCheckinPanel() :      mMapUrl(""),      mReloadingMapTexture(false)  { -	mCommitCallbackRegistrar.add("SocialSharing.SendCheckin", boost::bind(&LLFacebookCheckinPanel::onSend, this)); +    mCommitCallbackRegistrar.add("SocialSharing.SendCheckin", boost::bind(&LLFacebookCheckinPanel::onSend, this));  }  BOOL LLFacebookCheckinPanel::postBuild()  {      // Keep pointers to widgets so we don't traverse the UI hierarchy too often -	mPostButton = getChild<LLUICtrl>("post_place_btn"); -	mCancelButton = getChild<LLUICtrl>("cancel_place_btn"); -	mMessageTextEditor = getChild<LLUICtrl>("place_caption"); +    mPostButton = getChild<LLUICtrl>("post_place_btn"); +    mCancelButton = getChild<LLUICtrl>("cancel_place_btn"); +    mMessageTextEditor = getChild<LLUICtrl>("place_caption");      mMapLoadingIndicator = getChild<LLUICtrl>("map_loading_indicator");      mMapPlaceholder = getChild<LLIconCtrl>("map_placeholder");      mMapDefault = getChild<LLIconCtrl>("map_default");      mMapCheckBox = getChild<LLCheckBoxCtrl>("add_place_view_cb"); -     -	return LLPanel::postBuild(); + +    return LLPanel::postBuild();  }  void LLFacebookCheckinPanel::draw() @@ -767,101 +767,101 @@ void LLFacebookCheckinPanel::draw()      // This will hide/show the loading indicator and/or tile underneath      mMapDefault->setVisible(!(mMapCheckBox->get())); -	LLPanel::draw(); +    LLPanel::draw();  }  void LLFacebookCheckinPanel::onSend()  { -	LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookCheckinPanel"); // just in case it is already listening -	LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookCheckinPanel", boost::bind(&LLFacebookCheckinPanel::onFacebookConnectStateChange, this, _1)); -	 -	// Connect to Facebook if necessary and then post -	if (LLFacebookConnect::instance().isConnected()) -	{ -		sendCheckin(); -	} -	else -	{ -		LLFacebookConnect::instance().checkConnectionToFacebook(true); -	} +    LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookCheckinPanel"); // just in case it is already listening +    LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookCheckinPanel", boost::bind(&LLFacebookCheckinPanel::onFacebookConnectStateChange, this, _1)); + +    // Connect to Facebook if necessary and then post +    if (LLFacebookConnect::instance().isConnected()) +    { +        sendCheckin(); +    } +    else +    { +        LLFacebookConnect::instance().checkConnectionToFacebook(true); +    }  }  bool LLFacebookCheckinPanel::onFacebookConnectStateChange(const LLSD& data)  { -	switch (data.get("enum").asInteger()) -	{ -		case LLFacebookConnect::FB_CONNECTED: -			sendCheckin(); -			break; - -		case LLFacebookConnect::FB_POSTED: -			LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookCheckinPanel"); -			clearAndClose(); -			break; -	} - -	return false; +    switch (data.get("enum").asInteger()) +    { +    case LLFacebookConnect::FB_CONNECTED: +        sendCheckin(); +        break; + +    case LLFacebookConnect::FB_POSTED: +        LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookCheckinPanel"); +        clearAndClose(); +        break; +    } + +    return false;  }  void LLFacebookCheckinPanel::sendCheckin()  { -	// Get the location SLURL -	LLSLURL slurl; -	LLAgentUI::buildSLURL(slurl); -	std::string slurl_string = slurl.getSLURLString(); - -	// Use a valid http:// URL if the scheme is secondlife://  -	LLURI slurl_uri(slurl_string); -	if (slurl_uri.scheme() == LLSLURL::SLURL_SECONDLIFE_SCHEME) -	{ -		slurl_string = DEFAULT_CHECKIN_LOCATION_URL; -	} - -	// Add query parameters so Google Analytics can track incoming clicks! -	slurl_string += DEFAULT_CHECKIN_QUERY_PARAMETERS; -     -	// Get the region name -	std::string region_name(""); +    // Get the location SLURL +    LLSLURL slurl; +    LLAgentUI::buildSLURL(slurl); +    std::string slurl_string = slurl.getSLURLString(); + +    // Use a valid http:// URL if the scheme is secondlife://  +    LLURI slurl_uri(slurl_string); +    if (slurl_uri.scheme() == LLSLURL::SLURL_SECONDLIFE_SCHEME) +    { +        slurl_string = DEFAULT_CHECKIN_LOCATION_URL; +    } + +    // Add query parameters so Google Analytics can track incoming clicks! +    slurl_string += DEFAULT_CHECKIN_QUERY_PARAMETERS; + +    // Get the region name +    std::string region_name("");      LLViewerRegion *regionp = gAgent.getRegion();      if (regionp)      {          region_name = regionp->getName();      } -     -	// Get the region description -	std::string description; -	LLAgentUI::buildLocationString(description, LLAgentUI::LOCATION_FORMAT_NORMAL_COORDS, gAgent.getPositionAgent()); -     -	// Optionally add the region map view -	bool add_map_view = mMapCheckBox->getValue().asBoolean(); + +    // Get the region description +    std::string description; +    LLAgentUI::buildLocationString(description, LLAgentUI::LOCATION_FORMAT_NORMAL_COORDS, gAgent.getPositionAgent()); + +    // Optionally add the region map view +    bool add_map_view = mMapCheckBox->getValue().asBoolean();      std::string map_url = (add_map_view ? get_map_url() : DEFAULT_CHECKIN_ICON_URL); -     -	// Get the caption -	std::string caption = mMessageTextEditor->getValue().asString(); -	// Post to Facebook -	LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption); +    // Get the caption +    std::string caption = mMessageTextEditor->getValue().asString(); + +    // Post to Facebook +    LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption);  }  void LLFacebookCheckinPanel::clearAndClose()  { -	mMessageTextEditor->setValue(""); +    mMessageTextEditor->setValue(""); -	LLFloater* floater = getParentByType<LLFloater>(); -	if (floater) -	{ -		floater->closeFloater(); -	} +    LLFloater* floater = getParentByType<LLFloater>(); +    if (floater) +    { +        floater->closeFloater(); +    }  }  ///////////////////////////  //LLFacebookFriendsPanel//////  /////////////////////////// -LLFacebookFriendsPanel::LLFacebookFriendsPanel() :  -mFriendsStatusCaption(NULL), -mSecondLifeFriends(NULL), -mSuggestedFriends(NULL) +LLFacebookFriendsPanel::LLFacebookFriendsPanel() : +    mFriendsStatusCaption(NULL), +    mSecondLifeFriends(NULL), +    mSuggestedFriends(NULL)  {  } @@ -872,55 +872,55 @@ LLFacebookFriendsPanel::~LLFacebookFriendsPanel()  BOOL LLFacebookFriendsPanel::postBuild()  { -	mFriendsStatusCaption = getChild<LLTextBox>("facebook_friends_status"); +    mFriendsStatusCaption = getChild<LLTextBox>("facebook_friends_status"); + +    mSecondLifeFriends = getChild<LLAvatarList>("second_life_friends"); +    mSecondLifeFriends->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu); -	mSecondLifeFriends = getChild<LLAvatarList>("second_life_friends"); -	mSecondLifeFriends->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu); -	 -	mSuggestedFriends = getChild<LLAvatarList>("suggested_friends"); -	mSuggestedFriends->setContextMenu(&LLPanelPeopleMenus::gSuggestedFriendsContextMenu); -	 -	setVisibleCallback(boost::bind(&LLFacebookFriendsPanel::updateFacebookList, this, _2)); +    mSuggestedFriends = getChild<LLAvatarList>("suggested_friends"); +    mSuggestedFriends->setContextMenu(&LLPanelPeopleMenus::gSuggestedFriendsContextMenu); + +    setVisibleCallback(boost::bind(&LLFacebookFriendsPanel::updateFacebookList, this, _2));      LLAvatarTracker::instance().addObserver(this); -     -	return LLPanel::postBuild(); + +    return LLPanel::postBuild();  }  bool LLFacebookFriendsPanel::updateSuggestedFriendList()  { -	const LLAvatarTracker& av_tracker = LLAvatarTracker::instance(); -	uuid_vec_t& second_life_friends = mSecondLifeFriends->getIDs(); -	second_life_friends.clear(); -	uuid_vec_t& suggested_friends = mSuggestedFriends->getIDs(); -	suggested_friends.clear(); - -	//Add suggested friends -	LLSD friends = LLFacebookConnect::instance().getContent(); -	for (LLSD::array_const_iterator i = friends.beginArray(); i != friends.endArray(); ++i) -	{ -		LLUUID agent_id = (*i).asUUID(); -		if (agent_id.notNull()) -		{ -			bool second_life_buddy = av_tracker.isBuddy(agent_id); -			if (second_life_buddy) -			{ -				second_life_friends.push_back(agent_id); -			} -			else -			{ -				//FB+SL but not SL friend -				suggested_friends.push_back(agent_id); -			} -		} -	} - -	//Force a refresh when there aren't any filter matches (prevent displaying content that shouldn't display) -	mSecondLifeFriends->setDirty(true, !mSecondLifeFriends->filterHasMatches()); -	mSuggestedFriends->setDirty(true, !mSuggestedFriends->filterHasMatches()); -	showFriendsAccordionsIfNeeded(); - -	return false; +    const LLAvatarTracker& av_tracker = LLAvatarTracker::instance(); +    uuid_vec_t& second_life_friends = mSecondLifeFriends->getIDs(); +    second_life_friends.clear(); +    uuid_vec_t& suggested_friends = mSuggestedFriends->getIDs(); +    suggested_friends.clear(); + +    //Add suggested friends +    LLSD friends = LLFacebookConnect::instance().getContent(); +    for (LLSD::array_const_iterator i = friends.beginArray(); i != friends.endArray(); ++i) +    { +        LLUUID agent_id = (*i).asUUID(); +        if (agent_id.notNull()) +        { +            bool second_life_buddy = av_tracker.isBuddy(agent_id); +            if (second_life_buddy) +            { +                second_life_friends.push_back(agent_id); +            } +            else +            { +                //FB+SL but not SL friend +                suggested_friends.push_back(agent_id); +            } +        } +    } + +    //Force a refresh when there aren't any filter matches (prevent displaying content that shouldn't display) +    mSecondLifeFriends->setDirty(true, !mSecondLifeFriends->filterHasMatches()); +    mSuggestedFriends->setDirty(true, !mSuggestedFriends->filterHasMatches()); +    showFriendsAccordionsIfNeeded(); + +    return false;  }  void LLFacebookFriendsPanel::showFriendsAccordionsIfNeeded() @@ -949,15 +949,15 @@ void LLFacebookFriendsPanel::showFriendsAccordionsIfNeeded()      {          // We have something in the lists, hide the explanatory text          mFriendsStatusCaption->setVisible(false); -         +          // Show the lists          LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("friends_accordion");          accordion->setVisible(true); -         +          // Expand and show accordions if needed, else - hide them          getChild<LLAccordionCtrlTab>("tab_second_life_friends")->setVisible(mSecondLifeFriends->filterHasMatches());          getChild<LLAccordionCtrlTab>("tab_suggested_friends")->setVisible(mSuggestedFriends->filterHasMatches()); -         +          // Rearrange accordions          accordion->arrange();      } @@ -965,56 +965,56 @@ void LLFacebookFriendsPanel::showFriendsAccordionsIfNeeded()  void LLFacebookFriendsPanel::changed(U32 mask)  { -	if (mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE)) -	{ +    if (mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE)) +    {          LLFacebookConnect::instance().loadFacebookFriends(); -		updateFacebookList(true); -	} +        updateFacebookList(true); +    }  }  void LLFacebookFriendsPanel::updateFacebookList(bool visible)  { -	if (visible) -	{ +    if (visible) +    {          // We want this to be called to fetch the friends list once a connection is established -		LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookFriendsPanel"); -		LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookFriendsPanel", boost::bind(&LLFacebookFriendsPanel::onConnectedToFacebook, this, _1)); -         +        LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookFriendsPanel"); +        LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookFriendsPanel", boost::bind(&LLFacebookFriendsPanel::onConnectedToFacebook, this, _1)); +          // We then want this to be called to update the displayed lists once the list of friends is received -		LLEventPumps::instance().obtain("FacebookConnectContent").stopListening("LLFacebookFriendsPanel"); // just in case it is already listening -		LLEventPumps::instance().obtain("FacebookConnectContent").listen("LLFacebookFriendsPanel", boost::bind(&LLFacebookFriendsPanel::updateSuggestedFriendList, this)); -         -		// Try to connect to Facebook +        LLEventPumps::instance().obtain("FacebookConnectContent").stopListening("LLFacebookFriendsPanel"); // just in case it is already listening +        LLEventPumps::instance().obtain("FacebookConnectContent").listen("LLFacebookFriendsPanel", boost::bind(&LLFacebookFriendsPanel::updateSuggestedFriendList, this)); + +        // Try to connect to Facebook          if ((LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_NOT_CONNECTED) ||              (LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_CONNECTION_FAILED))          {              LLFacebookConnect::instance().checkConnectionToFacebook();          } -		// Loads FB friends -		if (LLFacebookConnect::instance().isConnected()) -		{ -			LLFacebookConnect::instance().loadFacebookFriends(); -		} +        // Loads FB friends +        if (LLFacebookConnect::instance().isConnected()) +        { +            LLFacebookConnect::instance().loadFacebookFriends(); +        }          // Sort the FB friends and update the lists -		updateSuggestedFriendList(); -	} +        updateSuggestedFriendList(); +    }  }  bool LLFacebookFriendsPanel::onConnectedToFacebook(const LLSD& data)  { -	LLSD::Integer connection_state = data.get("enum").asInteger(); - -	if (connection_state == LLFacebookConnect::FB_CONNECTED) -	{ -		LLFacebookConnect::instance().loadFacebookFriends(); -	} -	else if (connection_state == LLFacebookConnect::FB_NOT_CONNECTED) -	{ -		updateSuggestedFriendList(); -	} - -	return false; +    LLSD::Integer connection_state = data.get("enum").asInteger(); + +    if (connection_state == LLFacebookConnect::FB_CONNECTED) +    { +        LLFacebookConnect::instance().loadFacebookFriends(); +    } +    else if (connection_state == LLFacebookConnect::FB_NOT_CONNECTED) +    { +        updateSuggestedFriendList(); +    } + +    return false;  }  //////////////////////// @@ -1027,7 +1027,7 @@ LLFloaterFacebook::LLFloaterFacebook(const LLSD& key) : LLFloater(key),      mStatusLoadingText(NULL),      mStatusLoadingIndicator(NULL)  { -	mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterFacebook::onCancel, this)); +    mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterFacebook::onCancel, this));  }  void LLFloaterFacebook::onClose(bool app_quitting) @@ -1037,7 +1037,7 @@ void LLFloaterFacebook::onClose(bool app_quitting)      {          big_preview_floater->closeOnFloaterOwnerClosing(this);      } -	LLFloater::onClose(app_quitting); +    LLFloater::onClose(app_quitting);  }  void LLFloaterFacebook::onCancel() @@ -1053,24 +1053,24 @@ void LLFloaterFacebook::onCancel()  BOOL LLFloaterFacebook::postBuild()  {      // Keep tab of the Photo Panel -	mFacebookPhotoPanel = static_cast<LLFacebookPhotoPanel*>(getChild<LLUICtrl>("panel_facebook_photo")); +    mFacebookPhotoPanel = static_cast<LLFacebookPhotoPanel*>(getChild<LLUICtrl>("panel_facebook_photo"));      // Connection status widgets      mStatusErrorText = getChild<LLTextBox>("connection_error_text");      mStatusLoadingText = getChild<LLTextBox>("connection_loading_text");      mStatusLoadingIndicator = getChild<LLUICtrl>("connection_loading_indicator"); -	return LLFloater::postBuild(); +    return LLFloater::postBuild();  }  void LLFloaterFacebook::showPhotoPanel()  { -	LLTabContainer* parent = dynamic_cast<LLTabContainer*>(mFacebookPhotoPanel->getParent()); -	if (!parent) -	{ -		LL_WARNS() << "Cannot find panel container" << LL_ENDL; -		return; -	} - -	parent->selectTabPanel(mFacebookPhotoPanel); +    LLTabContainer* parent = dynamic_cast<LLTabContainer*>(mFacebookPhotoPanel->getParent()); +    if (!parent) +    { +        LL_WARNS() << "Cannot find panel container" << LL_ENDL; +        return; +    } + +    parent->selectTabPanel(mFacebookPhotoPanel);  }  void LLFloaterFacebook::draw() @@ -1082,7 +1082,7 @@ void LLFloaterFacebook::draw()          mStatusLoadingIndicator->setVisible(false);          LLFacebookConnect::EConnectionState connection_state = LLFacebookConnect::instance().getConnectionState();          std::string status_text; -         +          switch (connection_state)          {          case LLFacebookConnect::FB_NOT_CONNECTED: @@ -1105,7 +1105,7 @@ void LLFloaterFacebook::draw()              status_text = LLTrans::getString("SocialFacebookPosting");              mStatusLoadingText->setValue(status_text);              mStatusLoadingIndicator->setVisible(true); -			break; +            break;          case LLFacebookConnect::FB_CONNECTION_FAILED:              // Error connecting to the service              mStatusErrorText->setVisible(true); @@ -1118,21 +1118,21 @@ void LLFloaterFacebook::draw()              status_text = LLTrans::getString("SocialFacebookErrorPosting");              mStatusErrorText->setValue(status_text);              break; -		case LLFacebookConnect::FB_DISCONNECTING: -			// Disconnecting loading indicator -			mStatusLoadingText->setVisible(true); -			status_text = LLTrans::getString("SocialFacebookDisconnecting"); -			mStatusLoadingText->setValue(status_text); -			mStatusLoadingIndicator->setVisible(true); -			break; -		case LLFacebookConnect::FB_DISCONNECT_FAILED: -			// Error disconnecting from the service -			mStatusErrorText->setVisible(true); -			status_text = LLTrans::getString("SocialFacebookErrorDisconnecting"); -			mStatusErrorText->setValue(status_text); -			break; +        case LLFacebookConnect::FB_DISCONNECTING: +            // Disconnecting loading indicator +            mStatusLoadingText->setVisible(true); +            status_text = LLTrans::getString("SocialFacebookDisconnecting"); +            mStatusLoadingText->setValue(status_text); +            mStatusLoadingIndicator->setVisible(true); +            break; +        case LLFacebookConnect::FB_DISCONNECT_FAILED: +            // Error disconnecting from the service +            mStatusErrorText->setVisible(true); +            status_text = LLTrans::getString("SocialFacebookErrorDisconnecting"); +            mStatusErrorText->setValue(status_text); +            break;          }      } -	LLFloater::draw(); +    LLFloater::draw();  } diff --git a/indra/newview/llfloaterflickr.cpp b/indra/newview/llfloaterflickr.cpp index 131df22956..15b7c7fafa 100644 --- a/indra/newview/llfloaterflickr.cpp +++ b/indra/newview/llfloaterflickr.cpp @@ -238,8 +238,8 @@ void LLFlickrPhotoPanel::onVisibilityChange(BOOL visible)  			mPreviewHandle = previewp->getHandle();              previewp->setContainer(this); -            previewp->setSnapshotType(LLPanelSnapshot::SNAPSHOT_WEB); -			previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG); +            previewp->setSnapshotType(LLSnapshotModel::SNAPSHOT_WEB); +            previewp->setSnapshotFormat(LLSnapshotModel::SNAPSHOT_FORMAT_PNG);              previewp->setThumbnailSubsampled(TRUE);     // We want the preview to reflect the *saved* image              previewp->setAllowRenderUI(FALSE);          // We do not want the rendered UI in our snapshots              previewp->setAllowFullScreenPreview(FALSE);  // No full screen preview in SL Share mode diff --git a/indra/newview/llfloateroutfitsnapshot.cpp b/indra/newview/llfloateroutfitsnapshot.cpp index 6d641613ff..4c4e9bcc48 100644 --- a/indra/newview/llfloateroutfitsnapshot.cpp +++ b/indra/newview/llfloateroutfitsnapshot.cpp @@ -42,7 +42,6 @@  #include "llresmgr.h"		// LLLocale  #include "llsdserialize.h"  #include "llsidetraypanelcontainer.h" -#include "llsnapshotlivepreview.h"  #include "llspinctrl.h"  #include "llviewercontrol.h"  #include "lltoolfocus.h" @@ -52,7 +51,6 @@  ///----------------------------------------------------------------------------  /// Local function declarations, constants, enums, and typedefs  ///---------------------------------------------------------------------------- -LLUICtrl* LLFloaterOutfitSnapshot::sThumbnailPlaceholder = NULL;  LLOutfitSnapshotFloaterView* gOutfitSnapshotFloaterView = NULL;  const F32 AUTO_SNAPSHOT_TIME_DELAY = 1.f; @@ -62,213 +60,32 @@ const S32 OUTFIT_SNAPSHOT_HEIGHT = 256;  static LLDefaultChildRegistry::Register<LLOutfitSnapshotFloaterView> r("snapshot_outfit_floater_view"); -  ///---------------------------------------------------------------------------- -/// Class LLFloaterSnapshot::Impl +/// Class LLFloaterOutfitSnapshot::Impl  ///---------------------------------------------------------------------------- - -class LLFloaterOutfitSnapshot::Impl -{ -	LOG_CLASS(LLFloaterOutfitSnapshot::Impl); -public: -	typedef enum e_status -	{ -		STATUS_READY, -		STATUS_WORKING, -		STATUS_FINISHED -	} EStatus; - -	Impl() -	:	mAvatarPauseHandles(), -		mLastToolset(NULL), -		mAspectRatioCheckOff(false), -		mNeedRefresh(false), -		mStatus(STATUS_READY) -	{ -	} -	~Impl() -	{ -		//unpause avatars -		mAvatarPauseHandles.clear(); - -	} -	static void onClickNewSnapshot(void* data); -	static void onClickAutoSnap(LLUICtrl *ctrl, void* data); -	static void onClickFilter(LLUICtrl *ctrl, void* data); -	//static void onClickAdvanceSnap(LLUICtrl *ctrl, void* data); -	static void onClickUICheck(LLUICtrl *ctrl, void* data); -	static void onClickHUDCheck(LLUICtrl *ctrl, void* data); -	static void updateResolution(void* data); -	static void onCommitFreezeFrame(LLUICtrl* ctrl, void* data); -	static void onCommitLayerTypes(LLUICtrl* ctrl, void*data); -	static void onSnapshotUploadFinished(bool status); -	static void onSendingPostcardFinished(bool status); - -	static LLPanelSnapshot* getActivePanel(LLFloaterOutfitSnapshot* floater, bool ok_if_not_found = true); -    static LLPanelSnapshot::ESnapshotType getActiveSnapshotType(LLFloaterOutfitSnapshot* floater); -	static LLFloaterOutfitSnapshot::ESnapshotFormat getImageFormat(LLFloaterOutfitSnapshot* floater); - -	static LLSnapshotLivePreview* getPreviewView(LLFloaterOutfitSnapshot *floater); -	static void updateControls(LLFloaterOutfitSnapshot* floater); -	static void updateLayout(LLFloaterOutfitSnapshot* floater); -	static void setStatus(EStatus status, bool ok = true, const std::string& msg = LLStringUtil::null); -	EStatus getStatus() const { return mStatus; } -	static void setNeedRefresh(LLFloaterOutfitSnapshot* floater, bool need); - -private: -	static LLViewerWindow::ESnapshotType getLayerType(LLFloaterOutfitSnapshot* floater); -	static void checkAutoSnapshot(LLSnapshotLivePreview* floater, BOOL update_thumbnail = FALSE); -	static void setWorking(LLFloaterOutfitSnapshot* floater, bool working); -	static void setFinished(LLFloaterOutfitSnapshot* floater, bool finished, bool ok = true, const std::string& msg = LLStringUtil::null); - - -public: -	std::vector<LLAnimPauseRequest> mAvatarPauseHandles; - -	LLToolset*	mLastToolset; -	LLHandle<LLView> mPreviewHandle; -	bool mAspectRatioCheckOff ; -	bool mNeedRefresh; -	EStatus mStatus; -}; - - - -// static -LLPanelSnapshot* LLFloaterOutfitSnapshot::Impl::getActivePanel(LLFloaterOutfitSnapshot* floater, bool ok_if_not_found) +// virtual +LLPanelSnapshot* LLFloaterOutfitSnapshot::Impl::getActivePanel(LLFloaterSnapshotBase* floater, bool ok_if_not_found)  {      LLPanel* panel = floater->getChild<LLPanel>("panel_outfit_snapshot_inventory"); -    //LLPanel* panel = panel_container->getCurrentPanel();      LLPanelSnapshot* active_panel = dynamic_cast<LLPanelSnapshot*>(panel); -	if (!ok_if_not_found) -	{ -		llassert_always(active_panel != NULL); -	} -	return active_panel; -} - -// static -LLPanelSnapshot::ESnapshotType LLFloaterOutfitSnapshot::Impl::getActiveSnapshotType(LLFloaterOutfitSnapshot* floater) -{ -    return LLPanelSnapshot::SNAPSHOT_TEXTURE; -} - -// static -LLFloaterOutfitSnapshot::ESnapshotFormat LLFloaterOutfitSnapshot::Impl::getImageFormat(LLFloaterOutfitSnapshot* floater) -{ -    return LLFloaterOutfitSnapshot::SNAPSHOT_FORMAT_PNG; -} - -// static -LLSnapshotLivePreview* LLFloaterOutfitSnapshot::Impl::getPreviewView(LLFloaterOutfitSnapshot *floater) -{ -	LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)floater->impl.mPreviewHandle.get(); -	return previewp; +    if (!ok_if_not_found) +    { +        llassert_always(active_panel != NULL); +    } +    return active_panel;  } -// static -LLViewerWindow::ESnapshotType LLFloaterOutfitSnapshot::Impl::getLayerType(LLFloaterOutfitSnapshot* floater) +// virtual +LLSnapshotModel::ESnapshotFormat LLFloaterOutfitSnapshot::Impl::getImageFormat(LLFloaterSnapshotBase* floater)  { -    return LLViewerWindow::SNAPSHOT_TYPE_COLOR; +    return LLSnapshotModel::SNAPSHOT_FORMAT_PNG;  } -//static  -void LLFloaterOutfitSnapshot::Impl::updateLayout(LLFloaterOutfitSnapshot* floaterp) +// virtual +LLSnapshotModel::ESnapshotLayerType LLFloaterOutfitSnapshot::Impl::getLayerType(LLFloaterSnapshotBase* floater)  { -	LLSnapshotLivePreview* previewp = getPreviewView(floaterp); - -	BOOL advanced = gSavedSettings.getBOOL("AdvanceSnapshot"); - -	//BD - Automatically calculate the size of our snapshot window to enlarge -	//     the snapshot preview to its maximum size, this is especially helpfull -	//     for pretty much every aspect ratio other than 1:1. -	F32 panel_width = 400.f * gViewerWindow->getWorldViewAspectRatio(); - -	//BD - Make sure we clamp at 700 here because 700 would be for 16:9 which we -	//     consider the maximum. Everything bigger will be clamped and will have -	//     a slightly smaller preview window which most likely won't fill up the -	//     whole snapshot floater as it should. -	if(panel_width > 700.f) -	{ -		panel_width = 700.f; -	} - -	S32 floater_width = 224.f; -	if(advanced) -	{ -		floater_width = floater_width + panel_width; -	} - -	LLUICtrl* thumbnail_placeholder = floaterp->getChild<LLUICtrl>("thumbnail_placeholder"); -	thumbnail_placeholder->setVisible(advanced); -	thumbnail_placeholder->reshape(panel_width, thumbnail_placeholder->getRect().getHeight()); -	floaterp->getChild<LLUICtrl>("image_res_text")->setVisible(advanced); -	floaterp->getChild<LLUICtrl>("file_size_label")->setVisible(advanced); -	if(!floaterp->isMinimized()) -	{ -		floaterp->reshape(floater_width, floaterp->getRect().getHeight()); -	} - -	bool use_freeze_frame = floaterp->getChild<LLUICtrl>("freeze_frame_check")->getValue().asBoolean(); - -	if (use_freeze_frame) -	{ -		// stop all mouse events at fullscreen preview layer -		floaterp->getParent()->setMouseOpaque(TRUE); -		 -		// shrink to smaller layout -		// *TODO: unneeded? -		floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getRect().getHeight()); - -		// can see and interact with fullscreen preview now -		if (previewp) -		{ -			previewp->setVisible(TRUE); -			previewp->setEnabled(TRUE); -		} - -		//RN: freeze all avatars -		LLCharacter* avatarp; -		for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); -			iter != LLCharacter::sInstances.end(); ++iter) -		{ -			avatarp = *iter; -			floaterp->impl.mAvatarPauseHandles.push_back(avatarp->requestPause()); -		} - -		// freeze everything else -		gSavedSettings.setBOOL("FreezeTime", TRUE); - -		if (LLToolMgr::getInstance()->getCurrentToolset() != gCameraToolset) -		{ -			floaterp->impl.mLastToolset = LLToolMgr::getInstance()->getCurrentToolset(); -			LLToolMgr::getInstance()->setCurrentToolset(gCameraToolset); -		} -	} -	else // turning off freeze frame mode -	{ -		floaterp->getParent()->setMouseOpaque(FALSE); -		// *TODO: unneeded? -		floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getRect().getHeight()); -		if (previewp) -		{ -			previewp->setVisible(FALSE); -			previewp->setEnabled(FALSE); -		} - -		//RN: thaw all avatars -		floaterp->impl.mAvatarPauseHandles.clear(); - -		// thaw everything else -		gSavedSettings.setBOOL("FreezeTime", FALSE); - -		// restore last tool (e.g. pie menu, etc) -		if (floaterp->impl.mLastToolset) -		{ -			LLToolMgr::getInstance()->setCurrentToolset(floaterp->impl.mLastToolset); -		} -	} +    return LLSnapshotModel::SNAPSHOT_TYPE_COLOR;  }  // This is the main function that keeps all the GUI controls in sync with the saved settings. @@ -277,788 +94,272 @@ void LLFloaterOutfitSnapshot::Impl::updateLayout(LLFloaterOutfitSnapshot* floate  // The basic pattern for programmatically changing the GUI settings is to first set the  // appropriate saved settings and then call this method to sync the GUI with them.  // FIXME: The above comment seems obsolete now. -// static -void LLFloaterOutfitSnapshot::Impl::updateControls(LLFloaterOutfitSnapshot* floater) -{ -    LLPanelSnapshot::ESnapshotType shot_type = getActiveSnapshotType(floater); -    LLFloaterSnapshotBase::ESnapshotFormat shot_format = (LLFloaterSnapshotBase::ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat"); -    LLViewerWindow::ESnapshotType layer_type = getLayerType(floater); -		 -	LLSnapshotLivePreview* previewp = getPreviewView(floater); -	BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); - -	// *TODO: Separate maximum size for Web images from postcards -	LL_DEBUGS() << "Is snapshot up-to-date? " << got_snap << LL_ENDL; - -	LLLocale locale(LLLocale::USER_LOCALE); -	std::string bytes_string; -	if (got_snap) -	{ -		LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); -	} - -	// Update displayed image resolution. -	LLTextBox* image_res_tb = floater->getChild<LLTextBox>("image_res_text"); -	image_res_tb->setVisible(got_snap); -	if (got_snap) -	{ -		image_res_tb->setTextArg("[WIDTH]", llformat("%d", previewp->getEncodedImageWidth())); -		image_res_tb->setTextArg("[HEIGHT]", llformat("%d", previewp->getEncodedImageHeight())); -	} - -	floater->getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown")); -	floater->getChild<LLUICtrl>("file_size_label")->setColor(LLUIColorTable::instance().getColor( "LabelTextColor" )); - -	updateResolution(floater); - -	if (previewp) -	{ -		previewp->setSnapshotType(shot_type); -		previewp->setSnapshotFormat(shot_format); -		previewp->setSnapshotBufferType(layer_type); -	} - -	LLPanelSnapshot* current_panel = Impl::getActivePanel(floater); -	if (current_panel) -	{ -		LLSD info; -		info["have-snapshot"] = got_snap; -		current_panel->updateControls(info); -	} -	LL_DEBUGS() << "finished updating controls" << LL_ENDL; -} - -// static -void LLFloaterOutfitSnapshot::Impl::setStatus(EStatus status, bool ok, const std::string& msg) +// virtual +void LLFloaterOutfitSnapshot::Impl::updateControls(LLFloaterSnapshotBase* floater)  { -	LLFloaterOutfitSnapshot* floater = LLFloaterOutfitSnapshot::getInstance(); -	switch (status) -	{ -	case STATUS_READY: -		setWorking(floater, false); -		setFinished(floater, false); -		break; -	case STATUS_WORKING: -		setWorking(floater, true); -		setFinished(floater, false); -		break; -	case STATUS_FINISHED: -		setWorking(floater, false); -		setFinished(floater, true, ok, msg); -		break; -	} - -	floater->impl.mStatus = status; -} +    LLSnapshotModel::ESnapshotType shot_type = getActiveSnapshotType(floater); +    LLSnapshotModel::ESnapshotFormat shot_format = (LLSnapshotModel::ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat"); +    LLSnapshotModel::ESnapshotLayerType layer_type = getLayerType(floater); -// static -void LLFloaterOutfitSnapshot::Impl::setNeedRefresh(LLFloaterOutfitSnapshot* floater, bool need) -{ -	if (!floater) return; +    LLSnapshotLivePreview* previewp = getPreviewView(); +    BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); -	// Don't display the "Refresh to save" message if we're in auto-refresh mode. -	if (gSavedSettings.getBOOL("AutoSnapshot")) -	{ -		need = false; -	} +    // *TODO: Separate maximum size for Web images from postcards +    LL_DEBUGS() << "Is snapshot up-to-date? " << got_snap << LL_ENDL; -	floater->mRefreshLabel->setVisible(need); -	floater->impl.mNeedRefresh = need; -} +    LLLocale locale(LLLocale::USER_LOCALE); +    std::string bytes_string; +    if (got_snap) +    { +        LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10); +    } -// static -void LLFloaterOutfitSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp, BOOL update_thumbnail) -{ -	if (previewp) -	{ -		BOOL autosnap = gSavedSettings.getBOOL("AutoSnapshot"); -		LL_DEBUGS() << "updating " << (autosnap ? "snapshot" : "thumbnail") << LL_ENDL; -		previewp->updateSnapshot(autosnap, update_thumbnail, autosnap ? AUTO_SNAPSHOT_TIME_DELAY : 0.f); -	} -} +    // Update displayed image resolution. +    LLTextBox* image_res_tb = floater->getChild<LLTextBox>("image_res_text"); +    image_res_tb->setVisible(got_snap); +    if (got_snap) +    { +        image_res_tb->setTextArg("[WIDTH]", llformat("%d", previewp->getEncodedImageWidth())); +        image_res_tb->setTextArg("[HEIGHT]", llformat("%d", previewp->getEncodedImageHeight())); +    } -// static -void LLFloaterOutfitSnapshot::Impl::onClickNewSnapshot(void* data) -{ -	LLSnapshotLivePreview* previewp = getPreviewView((LLFloaterOutfitSnapshot *)data); -	LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data; -	if (previewp && view) -	{ -		view->impl.setStatus(Impl::STATUS_READY); -		LL_DEBUGS() << "updating snapshot" << LL_ENDL; -		previewp->mForceUpdateSnapshot = TRUE; -	} -} +    floater->getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown")); +    floater->getChild<LLUICtrl>("file_size_label")->setColor(LLUIColorTable::instance().getColor("LabelTextColor")); -// static -void LLFloaterOutfitSnapshot::Impl::onClickAutoSnap(LLUICtrl *ctrl, void* data) -{ -	LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl; -	gSavedSettings.setBOOL( "AutoSnapshot", check->get() ); -	 -	LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data;		 -	if (view) -	{ -		checkAutoSnapshot(getPreviewView(view)); -		updateControls(view); -	} -} +    updateResolution(floater); -// static -void LLFloaterOutfitSnapshot::Impl::onClickFilter(LLUICtrl *ctrl, void* data) -{ -	LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data; -	if (view) -	{ -		updateControls(view); -        LLSnapshotLivePreview* previewp = getPreviewView(view); -        if (previewp) -        { -            checkAutoSnapshot(previewp); -            // Note : index 0 of the filter drop down is assumed to be "No filter" in whichever locale -            LLComboBox* filterbox = static_cast<LLComboBox *>(view->getChild<LLComboBox>("filters_combobox")); -            std::string filter_name = (filterbox->getCurrentIndex() ? filterbox->getSimple() : ""); -            previewp->setFilter(filter_name); -            previewp->updateSnapshot(TRUE); -        } -	} -} +    if (previewp) +    { +        previewp->setSnapshotType(shot_type); +        previewp->setSnapshotFormat(shot_format); +        previewp->setSnapshotBufferType(layer_type); +    } -// static -void LLFloaterOutfitSnapshot::Impl::onClickUICheck(LLUICtrl *ctrl, void* data) -{ -	LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl; -	gSavedSettings.setBOOL( "RenderUIInSnapshot", check->get() ); -	 -	LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data; -	if (view) -	{ -		LLSnapshotLivePreview* previewp = getPreviewView(view); -		if(previewp) -		{ -			previewp->updateSnapshot(TRUE, TRUE); -		} -		updateControls(view); -	} +    LLPanelSnapshot* current_panel = Impl::getActivePanel(floater); +    if (current_panel) +    { +        LLSD info; +        info["have-snapshot"] = got_snap; +        current_panel->updateControls(info); +    } +    LL_DEBUGS() << "finished updating controls" << LL_ENDL;  } -// static -void LLFloaterOutfitSnapshot::Impl::onClickHUDCheck(LLUICtrl *ctrl, void* data) +// virtual +std::string LLFloaterOutfitSnapshot::Impl::getSnapshotPanelPrefix()  { -	LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl; -	gSavedSettings.setBOOL( "RenderHUDInSnapshot", check->get() ); -	 -	LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data; -	if (view) -	{ -		LLSnapshotLivePreview* previewp = getPreviewView(view); -		if(previewp) -		{ -			previewp->updateSnapshot(TRUE, TRUE); -		} -		updateControls(view); -	} +    return "panel_outfit_snapshot_";  } -// static -void LLFloaterOutfitSnapshot::Impl::onCommitFreezeFrame(LLUICtrl* ctrl, void* data) +// Show/hide upload status message. +// virtual +void LLFloaterOutfitSnapshot::Impl::setFinished(bool finished, bool ok, const std::string& msg)  { -	LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl; -	LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data; -	LLSnapshotLivePreview* previewp = getPreviewView(view); -		 -	if (!view || !check_box || !previewp) -	{ -		return; -	} - -	gSavedSettings.setBOOL("UseFreezeFrame", check_box->get()); +    mFloater->setSuccessLabelPanelVisible(finished && ok); +    mFloater->setFailureLabelPanelVisible(finished && !ok); -	if (check_box->get()) -	{ -		previewp->prepareFreezeFrame(); -	} +    if (finished) +    { +        LLUICtrl* finished_lbl = mFloater->getChild<LLUICtrl>(ok ? "succeeded_lbl" : "failed_lbl"); +        std::string result_text = mFloater->getString(msg + "_" + (ok ? "succeeded_str" : "failed_str")); +        finished_lbl->setValue(result_text); -	updateLayout(view); +        LLPanel* snapshot_panel = mFloater->getChild<LLPanel>("panel_outfit_snapshot_inventory"); +        snapshot_panel->onOpen(LLSD()); +    }  } -// Show/hide upload progress indicators. -// static -void LLFloaterOutfitSnapshot::Impl::setWorking(LLFloaterOutfitSnapshot* floater, bool working) +void LLFloaterOutfitSnapshot::Impl::updateResolution(void* data)  { -	LLUICtrl* working_lbl = floater->getChild<LLUICtrl>("working_lbl"); -	working_lbl->setVisible(working); -	floater->getChild<LLUICtrl>("working_indicator")->setVisible(working); +    LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data; -	if (working) -	{ -		const std::string panel_name = getActivePanel(floater, false)->getName(); -		const std::string prefix = panel_name.substr(std::string("panel_outfit_snapshot_").size()); -		std::string progress_text = floater->getString(prefix + "_" + "progress_str"); -		working_lbl->setValue(progress_text); -	} - -	// All controls should be disabled while posting. -	floater->setCtrlsEnabled(!working); -	LLPanelSnapshot* active_panel = getActivePanel(floater); -	if (active_panel) -	{ -		active_panel->enableControls(!working); -	} -} +    if (!view) +    { +        llassert(view); +        return; +    } -// Show/hide upload status message. -// static -void LLFloaterOutfitSnapshot::Impl::setFinished(LLFloaterOutfitSnapshot* floater, bool finished, bool ok, const std::string& msg) -{ -	floater->mSucceessLblPanel->setVisible(finished && ok); -	floater->mFailureLblPanel->setVisible(finished && !ok); +    S32 width = OUTFIT_SNAPSHOT_WIDTH; +    S32 height = OUTFIT_SNAPSHOT_HEIGHT; -	if (finished) -	{ -		LLUICtrl* finished_lbl = floater->getChild<LLUICtrl>(ok ? "succeeded_lbl" : "failed_lbl"); -		std::string result_text = floater->getString(msg + "_" + (ok ? "succeeded_str" : "failed_str")); -		finished_lbl->setValue(result_text); +    LLSnapshotLivePreview* previewp = getPreviewView(); +    if (previewp) +    { +        S32 original_width = 0, original_height = 0; +        previewp->getSize(original_width, original_height); -		//LLSideTrayPanelContainer* panel_container = floater->getChild<LLSideTrayPanelContainer>("panel_container"); -		//panel_container->openPreviousPanel(); -		//panel_container->getCurrentPanel()->onOpen(LLSD()); -        LLPanel* snapshot_panel = floater->getChild<LLPanel>("panel_outfit_snapshot_inventory"); -        snapshot_panel->onOpen(LLSD()); -	} -} +        if (gSavedSettings.getBOOL("RenderUIInSnapshot") || gSavedSettings.getBOOL("RenderHUDInSnapshot")) +        { //clamp snapshot resolution to window size when showing UI or HUD in snapshot +            width = llmin(width, gViewerWindow->getWindowWidthRaw()); +            height = llmin(height, gViewerWindow->getWindowHeightRaw()); +        } -// Apply a new resolution selected from the given combobox. -// static -void LLFloaterOutfitSnapshot::Impl::updateResolution(void* data) -{ -	LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data; -		 -	if (!view) -	{ -		llassert(view); -		return; -	} -		 -	S32 width = OUTFIT_SNAPSHOT_WIDTH; -	S32 height = OUTFIT_SNAPSHOT_HEIGHT; -	 -	LLSnapshotLivePreview* previewp = getPreviewView(view); -	if (previewp) -	{ -		S32 original_width = 0 , original_height = 0 ; -		previewp->getSize(original_width, original_height) ; -		 -		if (gSavedSettings.getBOOL("RenderUIInSnapshot") || gSavedSettings.getBOOL("RenderHUDInSnapshot")) -		{ //clamp snapshot resolution to window size when showing UI or HUD in snapshot -			width = llmin(width, gViewerWindow->getWindowWidthRaw()); -			height = llmin(height, gViewerWindow->getWindowHeightRaw()); -		} -                  llassert(width > 0 && height > 0);          // use the resolution from the selected pre-canned drop-down choice          LL_DEBUGS() << "Setting preview res selected from combo: " << width << "x" << height << LL_ENDL;          previewp->setSize(width, height); -		 -		if(original_width != width || original_height != height) -		{ -			//previewp->setSize(width, height); -			// hide old preview as the aspect ratio could be wrong -			checkAutoSnapshot(previewp, FALSE); -			LL_DEBUGS() << "updating thumbnail" << LL_ENDL; +        if (original_width != width || original_height != height) +        { +            // hide old preview as the aspect ratio could be wrong +            checkAutoSnapshot(previewp, FALSE); +            LL_DEBUGS() << "updating thumbnail" << LL_ENDL;              previewp->updateSnapshot(TRUE); -		} -	} -} - -// static -void LLFloaterOutfitSnapshot::Impl::onCommitLayerTypes(LLUICtrl* ctrl, void*data) -{ -	LLComboBox* combobox = (LLComboBox*)ctrl; - -	LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data; -		 -	if (view) -	{ -		LLSnapshotLivePreview* previewp = getPreviewView(view); -		if (previewp) -		{ -			previewp->setSnapshotBufferType((LLViewerWindow::ESnapshotType)combobox->getCurrentIndex()); -		} -		checkAutoSnapshot(previewp, TRUE); -	} -} - -// static -void LLFloaterOutfitSnapshot::Impl::onSnapshotUploadFinished(bool status) -{ -	setStatus(STATUS_FINISHED, status, "profile"); -} - - -// static -void LLFloaterOutfitSnapshot::Impl::onSendingPostcardFinished(bool status) -{ -	setStatus(STATUS_FINISHED, status, "postcard"); +        } +    }  } -  ///---------------------------------------------------------------------------- -/// Class LLFloaterSnapshot +/// Class LLFloaterOutfitSnapshot  ///----------------------------------------------------------------------------  // Default constructor  LLFloaterOutfitSnapshot::LLFloaterOutfitSnapshot(const LLSD& key) -    : LLFloaterSnapshotBase(key), -	  mRefreshBtn(NULL), -	  mRefreshLabel(NULL), -	  mSucceessLblPanel(NULL), -	  mFailureLblPanel(NULL), -      mOutfitGallery(NULL), -	  impl (*(new Impl)) +: LLFloaterSnapshotBase(key), +mOutfitGallery(NULL)  { +    impl = new Impl(this);  } -// Destroys the object  LLFloaterOutfitSnapshot::~LLFloaterOutfitSnapshot()  { -	if (impl.mPreviewHandle.get()) impl.mPreviewHandle.get()->die(); - -	//unfreeze everything else -	gSavedSettings.setBOOL("FreezeTime", FALSE); - -	if (impl.mLastToolset) -	{ -		LLToolMgr::getInstance()->setCurrentToolset(impl.mLastToolset); -	} - -	delete &impl;  } - +// virtual  BOOL LLFloaterOutfitSnapshot::postBuild()  { -	mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn"); -	childSetAction("new_snapshot_btn", Impl::onClickNewSnapshot, this); -	mRefreshLabel = getChild<LLUICtrl>("refresh_lbl"); -	mSucceessLblPanel = getChild<LLUICtrl>("succeeded_panel"); -	mFailureLblPanel = getChild<LLUICtrl>("failed_panel"); +    mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn"); +    childSetAction("new_snapshot_btn", ImplBase::onClickNewSnapshot, this); +    mRefreshLabel = getChild<LLUICtrl>("refresh_lbl"); +    mSucceessLblPanel = getChild<LLUICtrl>("succeeded_panel"); +    mFailureLblPanel = getChild<LLUICtrl>("failed_panel"); -	childSetCommitCallback("ui_check", Impl::onClickUICheck, this); -	getChild<LLUICtrl>("ui_check")->setValue(gSavedSettings.getBOOL("RenderUIInSnapshot")); +    childSetCommitCallback("ui_check", ImplBase::onClickUICheck, this); +    getChild<LLUICtrl>("ui_check")->setValue(gSavedSettings.getBOOL("RenderUIInSnapshot")); -	childSetCommitCallback("hud_check", Impl::onClickHUDCheck, this); -	getChild<LLUICtrl>("hud_check")->setValue(gSavedSettings.getBOOL("RenderHUDInSnapshot")); +    childSetCommitCallback("hud_check", ImplBase::onClickHUDCheck, this); +    getChild<LLUICtrl>("hud_check")->setValue(gSavedSettings.getBOOL("RenderHUDInSnapshot")); -	getChild<LLUICtrl>("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame")); -	childSetCommitCallback("freeze_frame_check", Impl::onCommitFreezeFrame, this); +    getChild<LLUICtrl>("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame")); +    childSetCommitCallback("freeze_frame_check", ImplBase::onCommitFreezeFrame, this); -	getChild<LLUICtrl>("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot")); -	childSetCommitCallback("auto_snapshot_check", Impl::onClickAutoSnap, this); -     +    getChild<LLUICtrl>("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot")); +    childSetCommitCallback("auto_snapshot_check", ImplBase::onClickAutoSnap, this); -	// Filters -	LLComboBox* filterbox = getChild<LLComboBox>("filters_combobox"); + +    // Filters +    LLComboBox* filterbox = getChild<LLComboBox>("filters_combobox");      std::vector<std::string> filter_list = LLImageFiltersManager::getInstance()->getFiltersList();      for (U32 i = 0; i < filter_list.size(); i++)      {          filterbox->add(filter_list[i]);      } -    childSetCommitCallback("filters_combobox", Impl::onClickFilter, this); -     -	LLWebProfile::setImageUploadResultCallback(boost::bind(&LLFloaterOutfitSnapshot::Impl::onSnapshotUploadFinished, _1)); -	LLPostCard::setPostResultCallback(boost::bind(&LLFloaterOutfitSnapshot::Impl::onSendingPostcardFinished, _1)); - -	sThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder"); - -	// create preview window -	LLRect full_screen_rect = getRootView()->getRect(); -	LLSnapshotLivePreview::Params p; -	p.rect(full_screen_rect); -	LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); -	LLView* parent_view = gSnapshotFloaterView->getParent(); -	 -	parent_view->removeChild(gSnapshotFloaterView); -	// make sure preview is below snapshot floater -	parent_view->addChild(previewp); -	parent_view->addChild(gSnapshotFloaterView); -	 -	//move snapshot floater to special purpose snapshotfloaterview -	gFloaterView->removeChild(this); -	gSnapshotFloaterView->addChild(this); +    childSetCommitCallback("filters_combobox", ImplBase::onClickFilter, this); -	impl.mPreviewHandle = previewp->getHandle(); -    previewp->setContainer(this); -	impl.updateControls(this); -	impl.updateLayout(this); -	 -	previewp->mKeepAspectRatio = FALSE; -	previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect()); - -	return TRUE; -} +    LLWebProfile::setImageUploadResultCallback(boost::bind(&ImplBase::onSnapshotUploadFinished, this, _1)); -void LLFloaterOutfitSnapshot::draw() -{ -	LLSnapshotLivePreview* previewp = impl.getPreviewView(this); +    sThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder"); -	if (previewp && (previewp->isSnapshotActive() || previewp->getThumbnailLock())) -	{ -		// don't render snapshot window in snapshot, even if "show ui" is turned on -		return; -	} +    // create preview window +    LLRect full_screen_rect = getRootView()->getRect(); +    LLSnapshotLivePreview::Params p; +    p.rect(full_screen_rect); +    LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); +    LLView* parent_view = gSnapshotFloaterView->getParent(); -	LLFloater::draw(); +    parent_view->removeChild(gSnapshotFloaterView); +    // make sure preview is below snapshot floater +    parent_view->addChild(previewp); +    parent_view->addChild(gSnapshotFloaterView); -	if (previewp && !isMinimized() && sThumbnailPlaceholder->getVisible()) -	{		 -		if(previewp->getThumbnailImage()) -		{ -			bool working = impl.getStatus() == Impl::STATUS_WORKING; -			const LLRect& thumbnail_rect = getThumbnailPlaceholderRect(); -			const S32 thumbnail_w = previewp->getThumbnailWidth(); -			const S32 thumbnail_h = previewp->getThumbnailHeight(); +    //move snapshot floater to special purpose snapshotfloaterview +    gFloaterView->removeChild(this); +    gSnapshotFloaterView->addChild(this); -			// calc preview offset within the preview rect -			const S32 local_offset_x = (thumbnail_rect.getWidth() - thumbnail_w) / 2 ; -			const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2 ; // preview y pos within the preview rect - -			// calc preview offset within the floater rect -			S32 offset_x = thumbnail_rect.mLeft + local_offset_x; -			S32 offset_y = thumbnail_rect.mBottom + local_offset_y; - -			gGL.matrixMode(LLRender::MM_MODELVIEW); -			// Apply floater transparency to the texture unless the floater is focused. -			F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); -			LLColor4 color = working ? LLColor4::grey4 : LLColor4::white; -			gl_draw_scaled_image(offset_x, offset_y,  -					thumbnail_w, thumbnail_h, -					previewp->getThumbnailImage(), color % alpha); +    impl->mPreviewHandle = previewp->getHandle(); +    previewp->setContainer(this); +    impl->updateControls(this); +    impl->updateLayout(this); -			previewp->drawPreviewRect(offset_x, offset_y) ; +    previewp->mKeepAspectRatio = FALSE; +    previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect()); -			gGL.pushUIMatrix(); -			LLUI::translate((F32) thumbnail_rect.mLeft, (F32) thumbnail_rect.mBottom); -			sThumbnailPlaceholder->draw(); -			gGL.popUIMatrix(); -		} -	} -	impl.updateLayout(this); +    return TRUE;  } +// virtual  void LLFloaterOutfitSnapshot::onOpen(const LLSD& key)  { -	LLSnapshotLivePreview* preview = LLFloaterOutfitSnapshot::Impl::getPreviewView(this); -	if(preview) -	{ -		LL_DEBUGS() << "opened, updating snapshot" << LL_ENDL; -		preview->updateSnapshot(TRUE); -	} -	focusFirstItem(FALSE); -	gSnapshotFloaterView->setEnabled(TRUE); -	gSnapshotFloaterView->setVisible(TRUE); -	gSnapshotFloaterView->adjustToFitScreen(this, FALSE); +    LLSnapshotLivePreview* preview = getPreviewView(); +    if (preview) +    { +        LL_DEBUGS() << "opened, updating snapshot" << LL_ENDL; +        preview->updateSnapshot(TRUE); +    } +    focusFirstItem(FALSE); +    gSnapshotFloaterView->setEnabled(TRUE); +    gSnapshotFloaterView->setVisible(TRUE); +    gSnapshotFloaterView->adjustToFitScreen(this, FALSE); -	impl.updateControls(this); -	impl.updateLayout(this); +    impl->updateControls(this); +    impl->updateLayout(this); -	// Initialize default tab. -	//getChild<LLSideTrayPanelContainer>("panel_container")->getCurrentPanel()->onOpen(LLSD()); -    //parent->openPanel(panel_name);      LLPanel* snapshot_panel = getChild<LLPanel>("panel_outfit_snapshot_inventory");      snapshot_panel->onOpen(LLSD());      postPanelSwitch();  } -void LLFloaterOutfitSnapshot::onClose(bool app_quitting) -{ -	getParent()->setMouseOpaque(FALSE); - -	//unfreeze everything, hide fullscreen preview -	LLSnapshotLivePreview* previewp = LLFloaterOutfitSnapshot::Impl::getPreviewView(this); -	if (previewp) -	{ -		previewp->setVisible(FALSE); -		previewp->setEnabled(FALSE); -	} - -	gSavedSettings.setBOOL("FreezeTime", FALSE); -	impl.mAvatarPauseHandles.clear(); - -	if (impl.mLastToolset) -	{ -		LLToolMgr::getInstance()->setCurrentToolset(impl.mLastToolset); -	} -} - -// virtual -S32 LLFloaterOutfitSnapshot::notify(const LLSD& info) -{ -	if (info.has("set-ready")) -	{ -		impl.setStatus(Impl::STATUS_READY); -		return 1; -	} - -	if (info.has("set-working")) -	{ -		impl.setStatus(Impl::STATUS_WORKING); -		return 1; -	} - -	if (info.has("set-finished")) -	{ -		LLSD data = info["set-finished"]; -		impl.setStatus(Impl::STATUS_FINISHED, data["ok"].asBoolean(), data["msg"].asString()); -		return 1; -	} -     -	if (info.has("snapshot-updating")) -	{ -        // Disable the send/post/save buttons until snapshot is ready. -        impl.updateControls(this); -		return 1; -	} - -	if (info.has("snapshot-updated")) -	{ -        // Enable the send/post/save buttons. -        impl.updateControls(this); -        // We've just done refresh. -        impl.setNeedRefresh(this, false); -             -        // The refresh button is initially hidden. We show it after the first update, -        // i.e. when preview appears. -        if (!mRefreshBtn->getVisible()) -        { -            mRefreshBtn->setVisible(true); -        } -		return 1; -	}     -     -	return 0; -} - -//static  +// static   void LLFloaterOutfitSnapshot::update()  { -	LLFloaterOutfitSnapshot* inst = findInstance(); -	LLFloaterFacebook* floater_facebook = LLFloaterReg::findTypedInstance<LLFloaterFacebook>("facebook");  -	LLFloaterFlickr* floater_flickr = LLFloaterReg::findTypedInstance<LLFloaterFlickr>("flickr");  -	LLFloaterTwitter* floater_twitter = LLFloaterReg::findTypedInstance<LLFloaterTwitter>("twitter");  - -	if (!inst && !floater_facebook && !floater_flickr && !floater_twitter) -		return; -	 -	BOOL changed = FALSE; -	LL_DEBUGS() << "npreviews: " << LLSnapshotLivePreview::sList.size() << LL_ENDL; -	for (std::set<LLSnapshotLivePreview*>::iterator iter = LLSnapshotLivePreview::sList.begin(); -		 iter != LLSnapshotLivePreview::sList.end(); ++iter) -	{ -		changed |= LLSnapshotLivePreview::onIdle(*iter); -	} -     -	if (inst && changed) -	{ -		LL_DEBUGS() << "changed" << LL_ENDL; -		inst->impl.updateControls(inst); -	} +    LLFloaterOutfitSnapshot* inst = getInstance(); +    if (inst != NULL) +    { +        inst->impl->updateLivePreview(); +    }  }  // static  LLFloaterOutfitSnapshot* LLFloaterOutfitSnapshot::getInstance()  { -	return LLFloaterReg::getTypedInstance<LLFloaterOutfitSnapshot>("outfit_snapshot"); +    return LLFloaterReg::getTypedInstance<LLFloaterOutfitSnapshot>("outfit_snapshot");  } -// static -LLFloaterOutfitSnapshot* LLFloaterOutfitSnapshot::findInstance() -{ -	return LLFloaterReg::findTypedInstance<LLFloaterOutfitSnapshot>("outfit_snapshot"); -} - -// static +// virtual  void LLFloaterOutfitSnapshot::saveTexture()  { -	LL_DEBUGS() << "saveTexture" << LL_ENDL; +    LL_DEBUGS() << "saveTexture" << LL_ENDL; -	// FIXME: duplicated code -	LLFloaterOutfitSnapshot* instance = findInstance(); -	if (!instance) -	{ -		llassert(instance != NULL); -		return; -	} -	LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance); -	if (!previewp) -	{ -		llassert(previewp != NULL); -		return; -	} +    LLSnapshotLivePreview* previewp = getPreviewView(); +    if (!previewp) +    { +        llassert(previewp != NULL); +        return; +    } -    if (instance->mOutfitGallery) +    if (mOutfitGallery)      { -        instance->mOutfitGallery->onBeforeOutfitSnapshotSave(); +        mOutfitGallery->onBeforeOutfitSnapshotSave();      } -    previewp->saveTexture(TRUE, instance->getOutfitID().asString()); -    if (instance->mOutfitGallery) +    previewp->saveTexture(TRUE, getOutfitID().asString()); +    if (mOutfitGallery)      { -        instance->mOutfitGallery->onAfterOutfitSnapshotSave(); +        mOutfitGallery->onAfterOutfitSnapshotSave();      } -    instance->closeFloater(); -} - -// static -void LLFloaterOutfitSnapshot::postSave() -{ -	LLFloaterOutfitSnapshot* instance = findInstance(); -	if (!instance) -	{ -		llassert(instance != NULL); -		return; -	} - -	instance->impl.updateControls(instance); -	instance->impl.setStatus(Impl::STATUS_WORKING); -} - -// static -void LLFloaterOutfitSnapshot::postPanelSwitch() -{ -	LLFloaterOutfitSnapshot* instance = getInstance(); -	instance->impl.updateControls(instance); - -	// Remove the success/failure indicator whenever user presses a snapshot option button. -	instance->impl.setStatus(Impl::STATUS_READY); -} - -// static -LLPointer<LLImageFormatted> LLFloaterOutfitSnapshot::getImageData() -{ -	// FIXME: May not work for textures. - -	LLFloaterOutfitSnapshot* instance = findInstance(); -	if (!instance) -	{ -		llassert(instance != NULL); -		return NULL; -	} - -	LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance); -	if (!previewp) -	{ -		llassert(previewp != NULL); -		return NULL; -	} - -	LLPointer<LLImageFormatted> img = previewp->getFormattedImage(); -	if (!img.get()) -	{ -		LL_WARNS() << "Empty snapshot image data" << LL_ENDL; -		llassert(img.get() != NULL); -	} - -	return img; -} - -// static -const LLVector3d& LLFloaterOutfitSnapshot::getPosTakenGlobal() -{ -	LLFloaterOutfitSnapshot* instance = findInstance(); -	if (!instance) -	{ -		llassert(instance != NULL); -		return LLVector3d::zero; -	} - -	LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance); -	if (!previewp) -	{ -		llassert(previewp != NULL); -		return LLVector3d::zero; -	} - -	return previewp->getPosTakenGlobal(); +    closeFloater();  }  ///---------------------------------------------------------------------------- -/// Class LLSnapshotFloaterView +/// Class LLOutfitSnapshotFloaterView  ///---------------------------------------------------------------------------- -LLOutfitSnapshotFloaterView::LLOutfitSnapshotFloaterView (const Params& p) : LLFloaterView (p) +LLOutfitSnapshotFloaterView::LLOutfitSnapshotFloaterView(const Params& p) : LLFloaterView(p)  {  }  LLOutfitSnapshotFloaterView::~LLOutfitSnapshotFloaterView()  {  } - -BOOL LLOutfitSnapshotFloaterView::handleKey(KEY key, MASK mask, BOOL called_from_parent) -{ -	// use default handler when not in freeze-frame mode -	if(!gSavedSettings.getBOOL("FreezeTime")) -	{ -		return LLFloaterView::handleKey(key, mask, called_from_parent); -	} - -	if (called_from_parent) -	{ -		// pass all keystrokes down -		LLFloaterView::handleKey(key, mask, called_from_parent); -	} -	else -	{ -		// bounce keystrokes back down -		LLFloaterView::handleKey(key, mask, TRUE); -	} -	return TRUE; -} - -BOOL LLOutfitSnapshotFloaterView::handleMouseDown(S32 x, S32 y, MASK mask) -{ -	// use default handler when not in freeze-frame mode -	if(!gSavedSettings.getBOOL("FreezeTime")) -	{ -		return LLFloaterView::handleMouseDown(x, y, mask); -	} -	// give floater a change to handle mouse, else camera tool -	if (childrenHandleMouseDown(x, y, mask) == NULL) -	{ -		LLToolMgr::getInstance()->getCurrentTool()->handleMouseDown( x, y, mask ); -	} -	return TRUE; -} - -BOOL LLOutfitSnapshotFloaterView::handleMouseUp(S32 x, S32 y, MASK mask) -{ -	// use default handler when not in freeze-frame mode -	if(!gSavedSettings.getBOOL("FreezeTime")) -	{ -		return LLFloaterView::handleMouseUp(x, y, mask); -	} -	// give floater a change to handle mouse, else camera tool -	if (childrenHandleMouseUp(x, y, mask) == NULL) -	{ -		LLToolMgr::getInstance()->getCurrentTool()->handleMouseUp( x, y, mask ); -	} -	return TRUE; -} - -BOOL LLOutfitSnapshotFloaterView::handleHover(S32 x, S32 y, MASK mask) -{ -	// use default handler when not in freeze-frame mode -	if(!gSavedSettings.getBOOL("FreezeTime")) -	{ -		return LLFloaterView::handleHover(x, y, mask); -	}	 -	// give floater a change to handle mouse, else camera tool -	if (childrenHandleHover(x, y, mask) == NULL) -	{ -		LLToolMgr::getInstance()->getCurrentTool()->handleHover( x, y, mask ); -	} -	return TRUE; -} diff --git a/indra/newview/llfloateroutfitsnapshot.h b/indra/newview/llfloateroutfitsnapshot.h index 9a7b30ebd8..37e264b0e7 100644 --- a/indra/newview/llfloateroutfitsnapshot.h +++ b/indra/newview/llfloateroutfitsnapshot.h @@ -1,25 +1,25 @@ -/**  +/**   * @file llfloateroutfitsnapshot.h   * @brief Snapshot preview window for saving as an outfit thumbnail in visual outfit gallery   *   * $LicenseInfo:firstyear=2004&license=viewerlgpl$   * Second Life Viewer Source Code   * Copyright (C) 2016, 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$   */ @@ -30,71 +30,87 @@  #include "llfloater.h"  #include "llfloatersnapshot.h"  #include "lloutfitgallery.h" +#include "llsnapshotlivepreview.h" -class LLSpinCtrl; +///---------------------------------------------------------------------------- +/// Class LLFloaterOutfitSnapshot +///----------------------------------------------------------------------------  class LLFloaterOutfitSnapshot : public LLFloaterSnapshotBase  { -	LOG_CLASS(LLFloaterOutfitSnapshot); +    LOG_CLASS(LLFloaterOutfitSnapshot);  public: -	LLFloaterOutfitSnapshot(const LLSD& key); -	virtual ~LLFloaterOutfitSnapshot(); -     -	/*virtual*/ BOOL postBuild(); -	/*virtual*/ void draw(); -	/*virtual*/ void onOpen(const LLSD& key); -	/*virtual*/ void onClose(bool app_quitting); -	/*virtual*/ S32 notify(const LLSD& info); -	 -	static void update(); - -	// TODO: create a snapshot model instead -	static LLFloaterOutfitSnapshot* getInstance(); -	static LLFloaterOutfitSnapshot* findInstance(); -	static void saveTexture(); -	static void postSave(); -	static void postPanelSwitch(); -	static LLPointer<LLImageFormatted> getImageData(); -	static const LLVector3d& getPosTakenGlobal(); - -	static const LLRect& getThumbnailPlaceholderRect() { return sThumbnailPlaceholder->getRect(); } +    LLFloaterOutfitSnapshot(const LLSD& key); +    /*virtual*/ ~LLFloaterOutfitSnapshot(); + +    /*virtual*/ BOOL postBuild(); +    /*virtual*/ void onOpen(const LLSD& key); + +    static void update(); + +    static LLFloaterOutfitSnapshot* getInstance(); +    /*virtual*/ void saveTexture(); + +    static const LLRect& getThumbnailPlaceholderRect() { return sThumbnailPlaceholder->getRect(); }      void setOutfitID(LLUUID id) { mOutfitID = id; }      LLUUID getOutfitID() { return mOutfitID; }      void setGallery(LLOutfitGallery* gallery) { mOutfitGallery = gallery; } -private: -	static LLUICtrl* sThumbnailPlaceholder; -	LLUICtrl *mRefreshBtn, *mRefreshLabel; -	LLUICtrl *mSucceessLblPanel, *mFailureLblPanel; -	class Impl; -	Impl& impl; +    class Impl; +    friend Impl; +private:      LLUUID mOutfitID;      LLOutfitGallery* mOutfitGallery;  }; +///---------------------------------------------------------------------------- +/// Class LLFloaterOutfitSnapshot::Impl +///---------------------------------------------------------------------------- + +class LLFloaterOutfitSnapshot::Impl : public LLFloaterSnapshotBase::ImplBase +{ +    LOG_CLASS(LLFloaterOutfitSnapshot::Impl); +public: +    Impl(LLFloaterSnapshotBase* floater) +        : LLFloaterSnapshotBase::ImplBase(floater) +    {} +    ~Impl() +    {} +    void updateResolution(void* data); + +    /*virtual*/ LLPanelSnapshot* getActivePanel(LLFloaterSnapshotBase* floater, bool ok_if_not_found = true); +    /*virtual*/ LLSnapshotModel::ESnapshotFormat getImageFormat(LLFloaterSnapshotBase* floater); +    /*virtual*/ std::string getSnapshotPanelPrefix(); + +    /*virtual*/ void updateControls(LLFloaterSnapshotBase* floater); + +private: +    /*virtual*/ LLSnapshotModel::ESnapshotLayerType getLayerType(LLFloaterSnapshotBase* floater); +    /*virtual*/ void setFinished(bool finished, bool ok = true, const std::string& msg = LLStringUtil::null); +}; + +///---------------------------------------------------------------------------- +/// Class LLOutfitSnapshotFloaterView +///---------------------------------------------------------------------------- +  class LLOutfitSnapshotFloaterView : public LLFloaterView  {  public: -	struct Params  -	:	public LLInitParam::Block<Params, LLFloaterView::Params> -	{ -	}; +    struct Params +        : public LLInitParam::Block<Params, LLFloaterView::Params> +    { +    };  protected: -	LLOutfitSnapshotFloaterView (const Params& p); -	friend class LLUICtrlFactory; +    LLOutfitSnapshotFloaterView(const Params& p); +    friend class LLUICtrlFactory;  public: -	virtual ~LLOutfitSnapshotFloaterView(); - -	/*virtual*/	BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); -	/*virtual*/	BOOL handleMouseDown(S32 x, S32 y, MASK mask); -	/*virtual*/	BOOL handleMouseUp(S32 x, S32 y, MASK mask); -	/*virtual*/	BOOL handleHover(S32 x, S32 y, MASK mask); +    virtual ~LLOutfitSnapshotFloaterView();  };  extern LLOutfitSnapshotFloaterView* gOutfitSnapshotFloaterView; diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index e5a2bd03cd..2585c7c6a5 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -4,7 +4,7 @@   *   * $LicenseInfo:firstyear=2004&license=viewerlgpl$   * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2016, 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 @@ -28,7 +28,6 @@  #include "llfloatersnapshot.h" -#include "llagent.h"  #include "llfacebookconnect.h"  #include "llfloaterreg.h"  #include "llfloaterfacebook.h" @@ -51,7 +50,7 @@  ///----------------------------------------------------------------------------  /// Local function declarations, constants, enums, and typedefs  ///---------------------------------------------------------------------------- -LLUICtrl* LLFloaterSnapshot::sThumbnailPlaceholder = NULL; +LLUICtrl* LLFloaterSnapshotBase::sThumbnailPlaceholder = NULL;  LLSnapshotFloaterView* gSnapshotFloaterView = NULL;  const F32 AUTO_SNAPSHOT_TIME_DELAY = 1.f; @@ -61,101 +60,8 @@ const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512  static LLDefaultChildRegistry::Register<LLSnapshotFloaterView> r("snapshot_floater_view"); - -LLFloaterSnapshotBase::ImplBase::ImplBase() -{ -} - -LLFloaterSnapshotBase::ImplBase::~ImplBase() -{ -} - - -///---------------------------------------------------------------------------- -/// Class LLFloaterSnapshot::Impl -///---------------------------------------------------------------------------- - -class LLFloaterSnapshot::Impl : public LLFloaterSnapshotBase::ImplBase -{ -	LOG_CLASS(LLFloaterSnapshot::Impl); -public: -	typedef enum e_status -	{ -		STATUS_READY, -		STATUS_WORKING, -		STATUS_FINISHED -	} EStatus; - -	Impl() -	:	mAvatarPauseHandles(), -		mLastToolset(NULL), -		mAspectRatioCheckOff(false), -		mNeedRefresh(false), -		mStatus(STATUS_READY) -	{ -	} -	~Impl() -	{ -		//unpause avatars -		mAvatarPauseHandles.clear(); - -	} -	static void onClickNewSnapshot(void* data); -	static void onClickAutoSnap(LLUICtrl *ctrl, void* data); -	static void onClickFilter(LLUICtrl *ctrl, void* data); -	//static void onClickAdvanceSnap(LLUICtrl *ctrl, void* data); -	static void onClickUICheck(LLUICtrl *ctrl, void* data); -	static void onClickHUDCheck(LLUICtrl *ctrl, void* data); -	static void applyKeepAspectCheck(LLFloaterSnapshot* view, BOOL checked); -	static void updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update = TRUE); -	static void onCommitFreezeFrame(LLUICtrl* ctrl, void* data); -	static void onCommitLayerTypes(LLUICtrl* ctrl, void*data); -	static void onImageQualityChange(LLFloaterSnapshot* view, S32 quality_val); -	static void onImageFormatChange(LLFloaterSnapshot* view); -	static void applyCustomResolution(LLFloaterSnapshot* view, S32 w, S32 h); -	static void onSnapshotUploadFinished(bool status); -	static void onSendingPostcardFinished(bool status); -	static BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value); -	static void setImageSizeSpinnersValues(LLFloaterSnapshot *view, S32 width, S32 height) ; -	static void updateSpinners(LLFloaterSnapshot* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed); - -	static LLPanelSnapshot* getActivePanel(LLFloaterSnapshot* floater, bool ok_if_not_found = true); -    static LLPanelSnapshot::ESnapshotType getActiveSnapshotType(LLFloaterSnapshot* floater); -    static LLFloaterSnapshotBase::ESnapshotFormat getImageFormat(LLFloaterSnapshot* floater); -	static LLSpinCtrl* getWidthSpinner(LLFloaterSnapshot* floater); -	static LLSpinCtrl* getHeightSpinner(LLFloaterSnapshot* floater); -	static void enableAspectRatioCheckbox(LLFloaterSnapshot* floater, BOOL enable); -	static void setAspectRatioCheckboxValue(LLFloaterSnapshot* floater, BOOL checked); - -	static LLSnapshotLivePreview* getPreviewView(LLFloaterSnapshot *floater); -	static void setResolution(LLFloaterSnapshot* floater, const std::string& comboname); -	static void updateControls(LLFloaterSnapshot* floater); -	static void updateLayout(LLFloaterSnapshot* floater); -	static void setStatus(EStatus status, bool ok = true, const std::string& msg = LLStringUtil::null); -	EStatus getStatus() const { return mStatus; } -	static void setNeedRefresh(LLFloaterSnapshot* floater, bool need); - -private: -	static LLViewerWindow::ESnapshotType getLayerType(LLFloaterSnapshot* floater); -	static void comboSetCustom(LLFloaterSnapshot *floater, const std::string& comboname); -	static void checkAutoSnapshot(LLSnapshotLivePreview* floater, BOOL update_thumbnail = FALSE); -	static void checkAspectRatio(LLFloaterSnapshot *view, S32 index) ; -	static void setWorking(LLFloaterSnapshot* floater, bool working); -	static void setFinished(LLFloaterSnapshot* floater, bool finished, bool ok = true, const std::string& msg = LLStringUtil::null); - - -public: -	std::vector<LLAnimPauseRequest> mAvatarPauseHandles; - -	LLToolset*	mLastToolset; -	LLHandle<LLView> mPreviewHandle; -	bool mAspectRatioCheckOff ; -	bool mNeedRefresh; -	EStatus mStatus; -}; - -// static -LLPanelSnapshot* LLFloaterSnapshot::Impl::getActivePanel(LLFloaterSnapshot* floater, bool ok_if_not_found) +// virtual +LLPanelSnapshot* LLFloaterSnapshot::Impl::getActivePanel(LLFloaterSnapshotBase* floater, bool ok_if_not_found)  {  	LLSideTrayPanelContainer* panel_container = floater->getChild<LLSideTrayPanelContainer>("panel_container");  	LLPanelSnapshot* active_panel = dynamic_cast<LLPanelSnapshot*>(panel_container->getCurrentPanel()); @@ -166,63 +72,40 @@ LLPanelSnapshot* LLFloaterSnapshot::Impl::getActivePanel(LLFloaterSnapshot* floa  	return active_panel;  } -// static -LLPanelSnapshot::ESnapshotType LLFloaterSnapshot::Impl::getActiveSnapshotType(LLFloaterSnapshot* floater) +// virtual +LLSnapshotModel::ESnapshotType LLFloaterSnapshotBase::ImplBase::getActiveSnapshotType(LLFloaterSnapshotBase* floater)  { - //   LLPanelSnapshot::ESnapshotType type = LLPanelSnapshot::SNAPSHOT_WEB; -	//std::string name;  	LLPanelSnapshot* spanel = getActivePanel(floater); -	//if (spanel) -	//{ -	//	name = spanel->getName(); -	//} - -	//if (name == "panel_snapshot_postcard") -	//{ -	//	type = LLPanelSnapshot::SNAPSHOT_POSTCARD; -	//} -	//else if (name == "panel_snapshot_inventory") -	//{ -	//	type = LLSnapshotLivePreview::SNAPSHOT_TEXTURE; -	//} -	//else if (name == "panel_snapshot_local") -	//{ -	//	type = LLSnapshotLivePreview::SNAPSHOT_LOCAL; -	//} -  	//return type;      if (spanel)      {          return spanel->getSnapshotType();      } -    return LLPanelSnapshot::SNAPSHOT_WEB; +	return LLSnapshotModel::SNAPSHOT_WEB;  } -// static -LLFloaterSnapshotBase::ESnapshotFormat LLFloaterSnapshot::Impl::getImageFormat(LLFloaterSnapshot* floater) +// virtual +LLSnapshotModel::ESnapshotFormat LLFloaterSnapshot::Impl::getImageFormat(LLFloaterSnapshotBase* floater)  {  	LLPanelSnapshot* active_panel = getActivePanel(floater);  	// FIXME: if the default is not PNG, profile uploads may fail. -	return active_panel ? active_panel->getImageFormat() : LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG; +	return active_panel ? active_panel->getImageFormat() : LLSnapshotModel::SNAPSHOT_FORMAT_PNG;  } -// static -LLSpinCtrl* LLFloaterSnapshot::Impl::getWidthSpinner(LLFloaterSnapshot* floater) +LLSpinCtrl* LLFloaterSnapshot::Impl::getWidthSpinner(LLFloaterSnapshotBase* floater)  {  	LLPanelSnapshot* active_panel = getActivePanel(floater);  	return active_panel ? active_panel->getWidthSpinner() : floater->getChild<LLSpinCtrl>("snapshot_width");  } -// static -LLSpinCtrl* LLFloaterSnapshot::Impl::getHeightSpinner(LLFloaterSnapshot* floater) +LLSpinCtrl* LLFloaterSnapshot::Impl::getHeightSpinner(LLFloaterSnapshotBase* floater)  {  	LLPanelSnapshot* active_panel = getActivePanel(floater);  	return active_panel ? active_panel->getHeightSpinner() : floater->getChild<LLSpinCtrl>("snapshot_height");  } -// static -void LLFloaterSnapshot::Impl::enableAspectRatioCheckbox(LLFloaterSnapshot* floater, BOOL enable) +void LLFloaterSnapshot::Impl::enableAspectRatioCheckbox(LLFloaterSnapshotBase* floater, BOOL enable)  {  	LLPanelSnapshot* active_panel = getActivePanel(floater);  	if (active_panel) @@ -231,8 +114,7 @@ void LLFloaterSnapshot::Impl::enableAspectRatioCheckbox(LLFloaterSnapshot* float  	}  } -// static -void LLFloaterSnapshot::Impl::setAspectRatioCheckboxValue(LLFloaterSnapshot* floater, BOOL checked) +void LLFloaterSnapshot::Impl::setAspectRatioCheckboxValue(LLFloaterSnapshotBase* floater, BOOL checked)  {  	LLPanelSnapshot* active_panel = getActivePanel(floater);  	if (active_panel) @@ -241,38 +123,41 @@ void LLFloaterSnapshot::Impl::setAspectRatioCheckboxValue(LLFloaterSnapshot* flo  	}  } -// static -LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot *floater) +LLSnapshotLivePreview* LLFloaterSnapshotBase::getPreviewView() +{ +	return impl->getPreviewView(); +} + +LLSnapshotLivePreview* LLFloaterSnapshotBase::ImplBase::getPreviewView()  { -	LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)floater->impl.mPreviewHandle.get(); +	LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)mPreviewHandle.get();  	return previewp;  } -// static -LLViewerWindow::ESnapshotType LLFloaterSnapshot::Impl::getLayerType(LLFloaterSnapshot* floater) +// virtual +LLSnapshotModel::ESnapshotLayerType LLFloaterSnapshot::Impl::getLayerType(LLFloaterSnapshotBase* floater)  { -	LLViewerWindow::ESnapshotType type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; +	LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR;  	LLSD value = floater->getChild<LLUICtrl>("layer_types")->getValue();  	const std::string id = value.asString();  	if (id == "colors") -		type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; +		type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR;  	else if (id == "depth") -		type = LLViewerWindow::SNAPSHOT_TYPE_DEPTH; +		type = LLSnapshotModel::SNAPSHOT_TYPE_DEPTH;  	return type;  } -// static -void LLFloaterSnapshot::Impl::setResolution(LLFloaterSnapshot* floater, const std::string& comboname) +void LLFloaterSnapshot::Impl::setResolution(LLFloaterSnapshotBase* floater, const std::string& comboname)  {  	LLComboBox* combo = floater->getChild<LLComboBox>(comboname);  		combo->setVisible(TRUE);  	updateResolution(combo, floater, FALSE); // to sync spinners with combo  } -//static  -void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) +//virtual  +void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floaterp)  { -	LLSnapshotLivePreview* previewp = getPreviewView(floaterp); +	LLSnapshotLivePreview* previewp = getPreviewView();  	BOOL advanced = gSavedSettings.getBOOL("AdvanceSnapshot"); @@ -330,7 +215,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)  			iter != LLCharacter::sInstances.end(); ++iter)  		{  			avatarp = *iter; -			floaterp->impl.mAvatarPauseHandles.push_back(avatarp->requestPause()); +			floaterp->impl->mAvatarPauseHandles.push_back(avatarp->requestPause());  		}  		// freeze everything else @@ -338,7 +223,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)  		if (LLToolMgr::getInstance()->getCurrentToolset() != gCameraToolset)  		{ -			floaterp->impl.mLastToolset = LLToolMgr::getInstance()->getCurrentToolset(); +			floaterp->impl->mLastToolset = LLToolMgr::getInstance()->getCurrentToolset();  			LLToolMgr::getInstance()->setCurrentToolset(gCameraToolset);  		}  	} @@ -354,15 +239,15 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)  		}  		//RN: thaw all avatars -		floaterp->impl.mAvatarPauseHandles.clear(); +		floaterp->impl->mAvatarPauseHandles.clear();  		// thaw everything else  		gSavedSettings.setBOOL("FreezeTime", FALSE);  		// restore last tool (e.g. pie menu, etc) -		if (floaterp->impl.mLastToolset) +		if (floaterp->impl->mLastToolset)  		{ -			LLToolMgr::getInstance()->setCurrentToolset(floaterp->impl.mLastToolset); +			LLToolMgr::getInstance()->setCurrentToolset(floaterp->impl->mLastToolset);  		}  	}  } @@ -373,15 +258,15 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)  // The basic pattern for programmatically changing the GUI settings is to first set the  // appropriate saved settings and then call this method to sync the GUI with them.  // FIXME: The above comment seems obsolete now. -// static -void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) +// virtual +void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshotBase* floater)  { -	LLPanelSnapshot::ESnapshotType shot_type = getActiveSnapshotType(floater); -	ESnapshotFormat shot_format = (ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat"); -	LLViewerWindow::ESnapshotType layer_type = getLayerType(floater); +	LLSnapshotModel::ESnapshotType shot_type = getActiveSnapshotType(floater); +	LLSnapshotModel::ESnapshotFormat shot_format = (LLSnapshotModel::ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat"); +	LLSnapshotModel::ESnapshotLayerType layer_type = getLayerType(floater);  	floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat")); -	floater->getChildView("layer_types")->setEnabled(shot_type == LLPanelSnapshot::SNAPSHOT_LOCAL); +	floater->getChildView("layer_types")->setEnabled(shot_type == LLSnapshotModel::SNAPSHOT_LOCAL);  	LLPanelSnapshot* active_panel = getActivePanel(floater);  	if (active_panel) @@ -395,7 +280,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)  			S32 w = gViewerWindow->getWindowWidthRaw();  			LL_DEBUGS() << "Initializing width spinner (" << width_ctrl->getName() << "): " << w << LL_ENDL;  			width_ctrl->setValue(w); -			if(getActiveSnapshotType(floater) == LLPanelSnapshot::SNAPSHOT_TEXTURE) +			if (getActiveSnapshotType(floater) == LLSnapshotModel::SNAPSHOT_TEXTURE)  			{  				width_ctrl->setIncrement(w >> 1);  			} @@ -405,7 +290,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)  			S32 h = gViewerWindow->getWindowHeightRaw();  			LL_DEBUGS() << "Initializing height spinner (" << height_ctrl->getName() << "): " << h << LL_ENDL;  			height_ctrl->setValue(h); -			if(getActiveSnapshotType(floater) == LLPanelSnapshot::SNAPSHOT_TEXTURE) +			if (getActiveSnapshotType(floater) == LLSnapshotModel::SNAPSHOT_TEXTURE)  			{  				height_ctrl->setIncrement(h >> 1);  			} @@ -437,7 +322,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)  		}  	} -	LLSnapshotLivePreview* previewp = getPreviewView(floater); +	LLSnapshotLivePreview* previewp = getPreviewView();  	BOOL got_bytes = previewp && previewp->getDataSize() > 0;  	BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); @@ -462,35 +347,35 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)  	floater->getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown"));  	floater->getChild<LLUICtrl>("file_size_label")->setColor( -			shot_type == LLPanelSnapshot::SNAPSHOT_POSTCARD +			shot_type == LLSnapshotModel::SNAPSHOT_POSTCARD  			&& got_bytes  			&& previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" ));  	// Update the width and height spinners based on the corresponding resolution combos. (?)  	switch(shot_type)  	{ -	  case LLPanelSnapshot::SNAPSHOT_WEB: -		layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; +	  case LLSnapshotModel::SNAPSHOT_WEB: +		layer_type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR;  		floater->getChild<LLUICtrl>("layer_types")->setValue("colors");  		setResolution(floater, "profile_size_combo");  		break; -	  case LLPanelSnapshot::SNAPSHOT_POSTCARD: -		layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; +	  case LLSnapshotModel::SNAPSHOT_POSTCARD: +		layer_type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR;  		floater->getChild<LLUICtrl>("layer_types")->setValue("colors");  		setResolution(floater, "postcard_size_combo");  		break; -	  case LLPanelSnapshot::SNAPSHOT_TEXTURE: -		layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; +	  case LLSnapshotModel::SNAPSHOT_TEXTURE: +		layer_type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR;  		floater->getChild<LLUICtrl>("layer_types")->setValue("colors");  		setResolution(floater, "texture_size_combo");  		break; -	  case  LLPanelSnapshot::SNAPSHOT_LOCAL: +	  case  LLSnapshotModel::SNAPSHOT_LOCAL:  		setResolution(floater, "local_size_combo");  		break;  	  default:  		break;  	} -	setAspectRatioCheckboxValue(floater, !floater->impl.mAspectRatioCheckOff && gSavedSettings.getBOOL("KeepAspectForSnapshot")); +	setAspectRatioCheckboxValue(floater, !floater->impl->mAspectRatioCheckOff && gSavedSettings.getBOOL("KeepAspectForSnapshot"));  	if (previewp)  	{ @@ -509,33 +394,32 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)  	LL_DEBUGS() << "finished updating controls" << LL_ENDL;  } -// static -void LLFloaterSnapshot::Impl::setStatus(EStatus status, bool ok, const std::string& msg) +//virtual +void LLFloaterSnapshotBase::ImplBase::setStatus(EStatus status, bool ok, const std::string& msg)  { -	LLFloaterSnapshot* floater = LLFloaterSnapshot::getInstance();  	switch (status)  	{  	case STATUS_READY: -		setWorking(floater, false); -		setFinished(floater, false); +		setWorking(false); +		setFinished(false);  		break;  	case STATUS_WORKING: -		setWorking(floater, true); -		setFinished(floater, false); +		setWorking(true); +		setFinished(false);  		break;  	case STATUS_FINISHED: -		setWorking(floater, false); -		setFinished(floater, true, ok, msg); +		setWorking(false); +		setFinished(true, ok, msg);  		break;  	} -	floater->impl.mStatus = status; +	mStatus = status;  } -// static -void LLFloaterSnapshot::Impl::setNeedRefresh(LLFloaterSnapshot* floater, bool need) +// virtual +void LLFloaterSnapshotBase::ImplBase::setNeedRefresh(bool need)  { -	if (!floater) return; +	if (!mFloater) return;  	// Don't display the "Refresh to save" message if we're in auto-refresh mode.  	if (gSavedSettings.getBOOL("AutoSnapshot")) @@ -543,12 +427,12 @@ void LLFloaterSnapshot::Impl::setNeedRefresh(LLFloaterSnapshot* floater, bool ne  		need = false;  	} -	floater->mRefreshLabel->setVisible(need); -	floater->impl.mNeedRefresh = need; +	mFloater->setRefreshLabelVisible(need); +	mNeedRefresh = need;  } -// static -void LLFloaterSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp, BOOL update_thumbnail) +// virtual +void LLFloaterSnapshotBase::ImplBase::checkAutoSnapshot(LLSnapshotLivePreview* previewp, BOOL update_thumbnail)  {  	if (previewp)  	{ @@ -559,43 +443,43 @@ void LLFloaterSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp,  }  // static -void LLFloaterSnapshot::Impl::onClickNewSnapshot(void* data) +void LLFloaterSnapshotBase::ImplBase::onClickNewSnapshot(void* data)  { -	LLSnapshotLivePreview* previewp = getPreviewView((LLFloaterSnapshot *)data); -	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; -	if (previewp && view) +	LLFloaterSnapshotBase* floater = (LLFloaterSnapshotBase *)data; +	LLSnapshotLivePreview* previewp = floater->getPreviewView(); +	if (previewp)  	{ -		view->impl.setStatus(Impl::STATUS_READY); +		floater->impl->setStatus(ImplBase::STATUS_READY);  		LL_DEBUGS() << "updating snapshot" << LL_ENDL;  		previewp->mForceUpdateSnapshot = TRUE;  	}  }  // static -void LLFloaterSnapshot::Impl::onClickAutoSnap(LLUICtrl *ctrl, void* data) +void LLFloaterSnapshotBase::ImplBase::onClickAutoSnap(LLUICtrl *ctrl, void* data)  {  	LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;  	gSavedSettings.setBOOL( "AutoSnapshot", check->get() ); -	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;		 +	LLFloaterSnapshotBase *view = (LLFloaterSnapshotBase *)data;		  	if (view)  	{ -		checkAutoSnapshot(getPreviewView(view)); -		updateControls(view); +		view->impl->checkAutoSnapshot(view->getPreviewView()); +		view->impl->updateControls(view);  	}  }  // static -void LLFloaterSnapshot::Impl::onClickFilter(LLUICtrl *ctrl, void* data) +void LLFloaterSnapshotBase::ImplBase::onClickFilter(LLUICtrl *ctrl, void* data)  { -	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; +	LLFloaterSnapshotBase *view = (LLFloaterSnapshotBase *)data;  	if (view)  	{ -		updateControls(view); -        LLSnapshotLivePreview* previewp = getPreviewView(view); +		view->impl->updateControls(view); +		LLSnapshotLivePreview* previewp = view->getPreviewView();          if (previewp)          { -            checkAutoSnapshot(previewp); +			view->impl->checkAutoSnapshot(previewp);              // Note : index 0 of the filter drop down is assumed to be "No filter" in whichever locale              LLComboBox* filterbox = static_cast<LLComboBox *>(view->getChild<LLComboBox>("filters_combobox"));              std::string filter_name = (filterbox->getCurrentIndex() ? filterbox->getSimple() : ""); @@ -606,7 +490,7 @@ void LLFloaterSnapshot::Impl::onClickFilter(LLUICtrl *ctrl, void* data)  }  // static -void LLFloaterSnapshot::Impl::onClickUICheck(LLUICtrl *ctrl, void* data) +void LLFloaterSnapshotBase::ImplBase::onClickUICheck(LLUICtrl *ctrl, void* data)  {  	LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;  	gSavedSettings.setBOOL( "RenderUIInSnapshot", check->get() ); @@ -614,17 +498,17 @@ void LLFloaterSnapshot::Impl::onClickUICheck(LLUICtrl *ctrl, void* data)  	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;  	if (view)  	{ -		LLSnapshotLivePreview* previewp = getPreviewView(view); +		LLSnapshotLivePreview* previewp = view->getPreviewView();  		if(previewp)  		{  			previewp->updateSnapshot(TRUE, TRUE);  		} -		updateControls(view); +		view->impl->updateControls(view);  	}  }  // static -void LLFloaterSnapshot::Impl::onClickHUDCheck(LLUICtrl *ctrl, void* data) +void LLFloaterSnapshotBase::ImplBase::onClickHUDCheck(LLUICtrl *ctrl, void* data)  {  	LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;  	gSavedSettings.setBOOL( "RenderHUDInSnapshot", check->get() ); @@ -632,17 +516,16 @@ void LLFloaterSnapshot::Impl::onClickHUDCheck(LLUICtrl *ctrl, void* data)  	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;  	if (view)  	{ -		LLSnapshotLivePreview* previewp = getPreviewView(view); +		LLSnapshotLivePreview* previewp = view->getPreviewView();  		if(previewp)  		{  			previewp->updateSnapshot(TRUE, TRUE);  		} -		updateControls(view); +		view->impl->updateControls(view);  	}  } -// static -void LLFloaterSnapshot::Impl::applyKeepAspectCheck(LLFloaterSnapshot* view, BOOL checked) +void LLFloaterSnapshot::Impl::applyKeepAspectCheck(LLFloaterSnapshotBase* view, BOOL checked)  {  	gSavedSettings.setBOOL("KeepAspectForSnapshot", checked); @@ -655,7 +538,7 @@ void LLFloaterSnapshot::Impl::applyKeepAspectCheck(LLFloaterSnapshot* view, BOOL  			combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index  		} -		LLSnapshotLivePreview* previewp = getPreviewView(view) ; +		LLSnapshotLivePreview* previewp = getPreviewView() ;  		if(previewp)  		{  			previewp->mKeepAspectRatio = gSavedSettings.getBOOL("KeepAspectForSnapshot") ; @@ -673,11 +556,11 @@ void LLFloaterSnapshot::Impl::applyKeepAspectCheck(LLFloaterSnapshot* view, BOOL  }  // static -void LLFloaterSnapshot::Impl::onCommitFreezeFrame(LLUICtrl* ctrl, void* data) +void LLFloaterSnapshotBase::ImplBase::onCommitFreezeFrame(LLUICtrl* ctrl, void* data)  {  	LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl; -	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; -	LLSnapshotLivePreview* previewp = getPreviewView(view); +	LLFloaterSnapshotBase *view = (LLFloaterSnapshotBase *)data; +	LLSnapshotLivePreview* previewp = view->getPreviewView();  	if (!view || !check_box || !previewp)  	{ @@ -691,16 +574,15 @@ void LLFloaterSnapshot::Impl::onCommitFreezeFrame(LLUICtrl* ctrl, void* data)  		previewp->prepareFreezeFrame();  	} -	updateLayout(view); +	view->impl->updateLayout(view);  } -// static -void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 index) +void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshotBase *view, S32 index)  { -	LLSnapshotLivePreview *previewp = getPreviewView(view) ; +	LLSnapshotLivePreview *previewp = getPreviewView() ;  	// Don't round texture sizes; textures are commonly stretched in world, profiles, etc and need to be "squashed" during upload, not cropped here -	if(LLPanelSnapshot::SNAPSHOT_TEXTURE == getActiveSnapshotType(view)) +	if (LLSnapshotModel::SNAPSHOT_TEXTURE == getActiveSnapshotType(view))  	{  		previewp->mKeepAspectRatio = FALSE ;  		return ; @@ -724,7 +606,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde  		keep_aspect = FALSE;  	} -	view->impl.mAspectRatioCheckOff = !enable_cb; +	view->impl->mAspectRatioCheckOff = !enable_cb;  	if (previewp)  	{ @@ -733,51 +615,55 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde  }  // Show/hide upload progress indicators. -// static -void LLFloaterSnapshot::Impl::setWorking(LLFloaterSnapshot* floater, bool working) +void LLFloaterSnapshotBase::ImplBase::setWorking(bool working)  { -	LLUICtrl* working_lbl = floater->getChild<LLUICtrl>("working_lbl"); +	LLUICtrl* working_lbl = mFloater->getChild<LLUICtrl>("working_lbl");  	working_lbl->setVisible(working); -	floater->getChild<LLUICtrl>("working_indicator")->setVisible(working); +	mFloater->getChild<LLUICtrl>("working_indicator")->setVisible(working);  	if (working)  	{ -		const std::string panel_name = getActivePanel(floater, false)->getName(); -		const std::string prefix = panel_name.substr(std::string("panel_snapshot_").size()); -		std::string progress_text = floater->getString(prefix + "_" + "progress_str"); +		const std::string panel_name = getActivePanel(mFloater, false)->getName(); +		const std::string prefix = panel_name.substr(getSnapshotPanelPrefix().size()); +		std::string progress_text = mFloater->getString(prefix + "_" + "progress_str");  		working_lbl->setValue(progress_text);  	}  	// All controls should be disabled while posting. -	floater->setCtrlsEnabled(!working); -	LLPanelSnapshot* active_panel = getActivePanel(floater); +	mFloater->setCtrlsEnabled(!working); +	LLPanelSnapshot* active_panel = getActivePanel(mFloater);  	if (active_panel)  	{  		active_panel->enableControls(!working);  	}  } +//virtual +std::string LLFloaterSnapshot::Impl::getSnapshotPanelPrefix() +{ +	return "panel_snapshot_"; +} +  // Show/hide upload status message. -// static -void LLFloaterSnapshot::Impl::setFinished(LLFloaterSnapshot* floater, bool finished, bool ok, const std::string& msg) +// virtual +void LLFloaterSnapshot::Impl::setFinished(bool finished, bool ok, const std::string& msg)  { -	floater->mSucceessLblPanel->setVisible(finished && ok); -	floater->mFailureLblPanel->setVisible(finished && !ok); +	mFloater->setSuccessLabelPanelVisible(finished && ok); +	mFloater->setFailureLabelPanelVisible(finished && !ok);  	if (finished)  	{ -		LLUICtrl* finished_lbl = floater->getChild<LLUICtrl>(ok ? "succeeded_lbl" : "failed_lbl"); -		std::string result_text = floater->getString(msg + "_" + (ok ? "succeeded_str" : "failed_str")); +		LLUICtrl* finished_lbl = mFloater->getChild<LLUICtrl>(ok ? "succeeded_lbl" : "failed_lbl"); +		std::string result_text = mFloater->getString(msg + "_" + (ok ? "succeeded_str" : "failed_str"));  		finished_lbl->setValue(result_text); -		LLSideTrayPanelContainer* panel_container = floater->getChild<LLSideTrayPanelContainer>("panel_container"); +		LLSideTrayPanelContainer* panel_container = mFloater->getChild<LLSideTrayPanelContainer>("panel_container");  		panel_container->openPreviousPanel();  		panel_container->getCurrentPanel()->onOpen(LLSD());  	}  }  // Apply a new resolution selected from the given combobox. -// static  void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update)  {  	LLComboBox* combobox = (LLComboBox*)ctrl; @@ -797,7 +683,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL  	S32 width = sdres[0];  	S32 height = sdres[1]; -	LLSnapshotLivePreview* previewp = getPreviewView(view); +	LLSnapshotLivePreview* previewp = getPreviewView();  	if (previewp && combobox->getCurrentIndex() >= 0)  	{  		S32 original_width = 0 , original_height = 0 ; @@ -827,7 +713,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL  				new_height = spanel->getTypedPreviewHeight();  				// Limit custom size for inventory snapshots to 512x512 px. -				if (getActiveSnapshotType(view) == LLPanelSnapshot::SNAPSHOT_TEXTURE) +				if (getActiveSnapshotType(view) == LLSnapshotModel::SNAPSHOT_TEXTURE)  				{  					new_width = llmin(new_width, MAX_TEXTURE_SIZE);  					new_height = llmin(new_height, MAX_TEXTURE_SIZE); @@ -865,7 +751,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL  		{  			getWidthSpinner(view)->setValue(width);  			getHeightSpinner(view)->setValue(height); -			if (getActiveSnapshotType(view) == LLPanelSnapshot::SNAPSHOT_TEXTURE) +			if (getActiveSnapshotType(view) == LLSnapshotModel::SNAPSHOT_TEXTURE)  			{  				getWidthSpinner(view)->setIncrement(width >> 1);  				getHeightSpinner(view)->setIncrement(height >> 1); @@ -879,7 +765,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL  			// hide old preview as the aspect ratio could be wrong  			checkAutoSnapshot(previewp, FALSE);  			LL_DEBUGS() << "updating thumbnail" << LL_ENDL; -			getPreviewView(view)->updateSnapshot(TRUE); +			getPreviewView()->updateSnapshot(TRUE);  			if(do_update)  			{  				LL_DEBUGS() << "Will update controls" << LL_ENDL; @@ -898,40 +784,37 @@ void LLFloaterSnapshot::Impl::onCommitLayerTypes(LLUICtrl* ctrl, void*data)  	if (view)  	{ -		LLSnapshotLivePreview* previewp = getPreviewView(view); +		LLSnapshotLivePreview* previewp = view->getPreviewView();  		if (previewp)  		{ -			previewp->setSnapshotBufferType((LLViewerWindow::ESnapshotType)combobox->getCurrentIndex()); +			previewp->setSnapshotBufferType((LLSnapshotModel::ESnapshotLayerType)combobox->getCurrentIndex());  		} -		checkAutoSnapshot(previewp, TRUE); +		view->impl->checkAutoSnapshot(previewp, TRUE);  	}  } -// static -void LLFloaterSnapshot::Impl::onImageQualityChange(LLFloaterSnapshot* view, S32 quality_val) +void LLFloaterSnapshot::Impl::onImageQualityChange(LLFloaterSnapshotBase* view, S32 quality_val)  { -	LLSnapshotLivePreview* previewp = getPreviewView(view); +	LLSnapshotLivePreview* previewp = getPreviewView();  	if (previewp)  	{  		previewp->setSnapshotQuality(quality_val);  	}  } -// static -void LLFloaterSnapshot::Impl::onImageFormatChange(LLFloaterSnapshot* view) +void LLFloaterSnapshot::Impl::onImageFormatChange(LLFloaterSnapshotBase* view)  {  	if (view)  	{  		gSavedSettings.setS32("SnapshotFormat", getImageFormat(view));  		LL_DEBUGS() << "image format changed, updating snapshot" << LL_ENDL; -		getPreviewView(view)->updateSnapshot(TRUE); +		getPreviewView()->updateSnapshot(TRUE);  		updateControls(view);  	}  }  // Sets the named size combo to "custom" mode. -// static -void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const std::string& comboname) +void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshotBase* floater, const std::string& comboname)  {  	LLComboBox* combo = floater->getChild<LLComboBox>(comboname);  	combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index @@ -939,7 +822,6 @@ void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const s  }  // Update supplied width and height according to the constrain proportions flag; limit them by max_val. -//static  BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value)  {  	S32 w = width ; @@ -984,20 +866,18 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3  	return (w != width || h != height) ;  } -//static -void LLFloaterSnapshot::Impl::setImageSizeSpinnersValues(LLFloaterSnapshot *view, S32 width, S32 height) +void LLFloaterSnapshot::Impl::setImageSizeSpinnersValues(LLFloaterSnapshotBase* view, S32 width, S32 height)  {  	getWidthSpinner(view)->forceSetValue(width);  	getHeightSpinner(view)->forceSetValue(height); -	if (getActiveSnapshotType(view) == LLPanelSnapshot::SNAPSHOT_TEXTURE) +	if (getActiveSnapshotType(view) == LLSnapshotModel::SNAPSHOT_TEXTURE)  	{  		getWidthSpinner(view)->setIncrement(width >> 1);  		getHeightSpinner(view)->setIncrement(height >> 1);  	}  } -// static -void LLFloaterSnapshot::Impl::updateSpinners(LLFloaterSnapshot* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed) +void LLFloaterSnapshot::Impl::updateSpinners(LLFloaterSnapshotBase* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed)  {  	getWidthSpinner(view)->resetDirty();  	getHeightSpinner(view)->resetDirty(); @@ -1007,13 +887,12 @@ void LLFloaterSnapshot::Impl::updateSpinners(LLFloaterSnapshot* view, LLSnapshot  	}  } -// static -void LLFloaterSnapshot::Impl::applyCustomResolution(LLFloaterSnapshot* view, S32 w, S32 h) +void LLFloaterSnapshot::Impl::applyCustomResolution(LLFloaterSnapshotBase* view, S32 w, S32 h)  {  	LL_DEBUGS() << "applyCustomResolution(" << w << ", " << h << ")" << LL_ENDL;  	if (!view) return; -	LLSnapshotLivePreview* previewp = getPreviewView(view); +	LLSnapshotLivePreview* previewp = getPreviewView();  	if (previewp)  	{  		S32 curw,curh; @@ -1037,16 +916,15 @@ void LLFloaterSnapshot::Impl::applyCustomResolution(LLFloaterSnapshot* view, S32  }  // static -void LLFloaterSnapshot::Impl::onSnapshotUploadFinished(bool status) +void LLFloaterSnapshotBase::ImplBase::onSnapshotUploadFinished(LLFloaterSnapshotBase* floater, bool status)  { -	setStatus(STATUS_FINISHED, status, "profile"); +	floater->impl->setStatus(STATUS_FINISHED, status, "profile");  } -  // static -void LLFloaterSnapshot::Impl::onSendingPostcardFinished(bool status) +void LLFloaterSnapshot::Impl::onSendingPostcardFinished(LLFloaterSnapshotBase* floater, bool status)  { -	setStatus(STATUS_FINISHED, status, "postcard"); +	floater->impl->setStatus(STATUS_FINISHED, status, "postcard");  }  ///---------------------------------------------------------------------------- @@ -1055,12 +933,27 @@ void LLFloaterSnapshot::Impl::onSendingPostcardFinished(bool status)  // Default constructor  LLFloaterSnapshotBase::LLFloaterSnapshotBase(const LLSD& key) -    : LLFloater(key) +    : LLFloater(key), +	  mRefreshBtn(NULL), +	  mRefreshLabel(NULL), +	  mSucceessLblPanel(NULL), +	  mFailureLblPanel(NULL)  {  }  LLFloaterSnapshotBase::~LLFloaterSnapshotBase()  { +	if (impl->mPreviewHandle.get()) impl->mPreviewHandle.get()->die(); + +	//unfreeze everything else +	gSavedSettings.setBOOL("FreezeTime", FALSE); + +	if (impl->mLastToolset) +	{ +		LLToolMgr::getInstance()->setCurrentToolset(impl->mLastToolset); +	} + +	delete impl;  }  ///---------------------------------------------------------------------------- @@ -1069,57 +962,41 @@ LLFloaterSnapshotBase::~LLFloaterSnapshotBase()  // Default constructor  LLFloaterSnapshot::LLFloaterSnapshot(const LLSD& key) -    : LLFloaterSnapshotBase(key), -	  mRefreshBtn(NULL), -	  mRefreshLabel(NULL), -	  mSucceessLblPanel(NULL), -	  mFailureLblPanel(NULL), -	  impl (*(new Impl)) +    : LLFloaterSnapshotBase(key)  { +	impl = new Impl(this);  } -// Destroys the object  LLFloaterSnapshot::~LLFloaterSnapshot()  { -	if (impl.mPreviewHandle.get()) impl.mPreviewHandle.get()->die(); - -	//unfreeze everything else -	gSavedSettings.setBOOL("FreezeTime", FALSE); - -	if (impl.mLastToolset) -	{ -		LLToolMgr::getInstance()->setCurrentToolset(impl.mLastToolset); -	} - -	delete &impl;  } - +// virtual  BOOL LLFloaterSnapshot::postBuild()  {  	mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn"); -	childSetAction("new_snapshot_btn", Impl::onClickNewSnapshot, this); +	childSetAction("new_snapshot_btn", ImplBase::onClickNewSnapshot, this);  	mRefreshLabel = getChild<LLUICtrl>("refresh_lbl");  	mSucceessLblPanel = getChild<LLUICtrl>("succeeded_panel");  	mFailureLblPanel = getChild<LLUICtrl>("failed_panel"); -	childSetCommitCallback("ui_check", Impl::onClickUICheck, this); +	childSetCommitCallback("ui_check", ImplBase::onClickUICheck, this);  	getChild<LLUICtrl>("ui_check")->setValue(gSavedSettings.getBOOL("RenderUIInSnapshot")); -	childSetCommitCallback("hud_check", Impl::onClickHUDCheck, this); +	childSetCommitCallback("hud_check", ImplBase::onClickHUDCheck, this);  	getChild<LLUICtrl>("hud_check")->setValue(gSavedSettings.getBOOL("RenderHUDInSnapshot")); -	impl.setAspectRatioCheckboxValue(this, gSavedSettings.getBOOL("KeepAspectForSnapshot")); +	((Impl*)impl)->setAspectRatioCheckboxValue(this, gSavedSettings.getBOOL("KeepAspectForSnapshot"));  	childSetCommitCallback("layer_types", Impl::onCommitLayerTypes, this);  	getChild<LLUICtrl>("layer_types")->setValue("colors");  	getChildView("layer_types")->setEnabled(FALSE);  	getChild<LLUICtrl>("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame")); -	childSetCommitCallback("freeze_frame_check", Impl::onCommitFreezeFrame, this); +	childSetCommitCallback("freeze_frame_check", ImplBase::onCommitFreezeFrame, this);  	getChild<LLUICtrl>("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot")); -	childSetCommitCallback("auto_snapshot_check", Impl::onClickAutoSnap, this); +	childSetCommitCallback("auto_snapshot_check", ImplBase::onClickAutoSnap, this);  	// Filters @@ -1129,10 +1006,10 @@ BOOL LLFloaterSnapshot::postBuild()      {          filterbox->add(filter_list[i]);      } -    childSetCommitCallback("filters_combobox", Impl::onClickFilter, this); +    childSetCommitCallback("filters_combobox", ImplBase::onClickFilter, this); -	LLWebProfile::setImageUploadResultCallback(boost::bind(&LLFloaterSnapshot::Impl::onSnapshotUploadFinished, _1)); -	LLPostCard::setPostResultCallback(boost::bind(&LLFloaterSnapshot::Impl::onSendingPostcardFinished, _1)); +	LLWebProfile::setImageUploadResultCallback(boost::bind(&ImplBase::onSnapshotUploadFinished, this, _1)); +	LLPostCard::setPostResultCallback(boost::bind(&Impl::onSendingPostcardFinished, this, _1));  	sThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder"); @@ -1159,10 +1036,10 @@ BOOL LLFloaterSnapshot::postBuild()  	getChild<LLComboBox>("local_size_combo")->selectNthItem(8);  	getChild<LLComboBox>("local_format_combo")->selectNthItem(0); -	impl.mPreviewHandle = previewp->getHandle(); +	impl->mPreviewHandle = previewp->getHandle();      previewp->setContainer(this); -	impl.updateControls(this); -	impl.updateLayout(this); +	impl->updateControls(this); +	impl->updateLayout(this);  	previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect()); @@ -1170,9 +1047,10 @@ BOOL LLFloaterSnapshot::postBuild()  	return TRUE;  } -void LLFloaterSnapshot::draw() +// virtual +void LLFloaterSnapshotBase::draw()  { -	LLSnapshotLivePreview* previewp = impl.getPreviewView(this); +	LLSnapshotLivePreview* previewp = getPreviewView();  	if (previewp && (previewp->isSnapshotActive() || previewp->getThumbnailLock()))  	{ @@ -1186,7 +1064,7 @@ void LLFloaterSnapshot::draw()  	{		  		if(previewp->getThumbnailImage())  		{ -			bool working = impl.getStatus() == Impl::STATUS_WORKING; +			bool working = impl->getStatus() == ImplBase::STATUS_WORKING;  			const LLRect& thumbnail_rect = getThumbnailPlaceholderRect();  			const S32 thumbnail_w = previewp->getThumbnailWidth();  			const S32 thumbnail_h = previewp->getThumbnailHeight(); @@ -1215,12 +1093,13 @@ void LLFloaterSnapshot::draw()  			gGL.popUIMatrix();  		}  	} -	impl.updateLayout(this); +	impl->updateLayout(this);  } +//virtual  void LLFloaterSnapshot::onOpen(const LLSD& key)  { -	LLSnapshotLivePreview* preview = LLFloaterSnapshot::Impl::getPreviewView(this); +	LLSnapshotLivePreview* preview = getPreviewView();  	if(preview)  	{  		LL_DEBUGS() << "opened, updating snapshot" << LL_ENDL; @@ -1231,19 +1110,20 @@ void LLFloaterSnapshot::onOpen(const LLSD& key)  	gSnapshotFloaterView->setVisible(TRUE);  	gSnapshotFloaterView->adjustToFitScreen(this, FALSE); -	impl.updateControls(this); -	impl.updateLayout(this); +	impl->updateControls(this); +	impl->updateLayout(this);  	// Initialize default tab.  	getChild<LLSideTrayPanelContainer>("panel_container")->getCurrentPanel()->onOpen(LLSD());  } -void LLFloaterSnapshot::onClose(bool app_quitting) +//virtual +void LLFloaterSnapshotBase::onClose(bool app_quitting)  {  	getParent()->setMouseOpaque(FALSE);  	//unfreeze everything, hide fullscreen preview -	LLSnapshotLivePreview* previewp = LLFloaterSnapshot::Impl::getPreviewView(this); +	LLSnapshotLivePreview* previewp = getPreviewView();  	if (previewp)  	{  		previewp->setVisible(FALSE); @@ -1251,146 +1131,150 @@ void LLFloaterSnapshot::onClose(bool app_quitting)  	}  	gSavedSettings.setBOOL("FreezeTime", FALSE); -	impl.mAvatarPauseHandles.clear(); +	impl->mAvatarPauseHandles.clear(); -	if (impl.mLastToolset) +	if (impl->mLastToolset)  	{ -		LLToolMgr::getInstance()->setCurrentToolset(impl.mLastToolset); +		LLToolMgr::getInstance()->setCurrentToolset(impl->mLastToolset);  	}  }  // virtual -S32 LLFloaterSnapshot::notify(const LLSD& info) +S32 LLFloaterSnapshotBase::notify(const LLSD& info)  { -	// A child panel wants to change snapshot resolution. -	if (info.has("combo-res-change")) +	if (info.has("set-ready"))  	{ -		std::string combo_name = info["combo-res-change"]["control-name"].asString(); -		impl.updateResolution(getChild<LLUICtrl>(combo_name), this); +		impl->setStatus(ImplBase::STATUS_READY);  		return 1;  	} -	if (info.has("custom-res-change")) +	if (info.has("set-working"))  	{ -		LLSD res = info["custom-res-change"]; -		impl.applyCustomResolution(this, res["w"].asInteger(), res["h"].asInteger()); +		impl->setStatus(ImplBase::STATUS_WORKING);  		return 1;  	} -	if (info.has("keep-aspect-change")) +	if (info.has("set-finished"))  	{ -		impl.applyKeepAspectCheck(this, info["keep-aspect-change"].asBoolean()); +		LLSD data = info["set-finished"]; +		impl->setStatus(ImplBase::STATUS_FINISHED, data["ok"].asBoolean(), data["msg"].asString());  		return 1;  	} -	if (info.has("image-quality-change")) +	if (info.has("snapshot-updating"))  	{ -		impl.onImageQualityChange(this, info["image-quality-change"].asInteger()); +		// Disable the send/post/save buttons until snapshot is ready. +		impl->updateControls(this);  		return 1;  	} -	if (info.has("image-format-change")) +	if (info.has("snapshot-updated"))  	{ -		impl.onImageFormatChange(this); +		// Enable the send/post/save buttons. +		impl->updateControls(this); +		// We've just done refresh. +		impl->setNeedRefresh(false); + +		// The refresh button is initially hidden. We show it after the first update, +		// i.e. when preview appears. +		if (!mRefreshBtn->getVisible()) +		{ +			mRefreshBtn->setVisible(true); +		}  		return 1;  	} -	if (info.has("set-ready")) +	return 0; +} + +// virtual +S32 LLFloaterSnapshot::notify(const LLSD& info) +{ +	bool res = LLFloaterSnapshotBase::notify(info); +	if (res) +		return res; +	// A child panel wants to change snapshot resolution. +	if (info.has("combo-res-change"))  	{ -		impl.setStatus(Impl::STATUS_READY); +		std::string combo_name = info["combo-res-change"]["control-name"].asString(); +		((Impl*)impl)->updateResolution(getChild<LLUICtrl>(combo_name), this);  		return 1;  	} -	if (info.has("set-working")) +	if (info.has("custom-res-change"))  	{ -		impl.setStatus(Impl::STATUS_WORKING); +		LLSD res = info["custom-res-change"]; +		((Impl*)impl)->applyCustomResolution(this, res["w"].asInteger(), res["h"].asInteger());  		return 1;  	} -	if (info.has("set-finished")) +	if (info.has("keep-aspect-change"))  	{ -		LLSD data = info["set-finished"]; -		impl.setStatus(Impl::STATUS_FINISHED, data["ok"].asBoolean(), data["msg"].asString()); +		((Impl*)impl)->applyKeepAspectCheck(this, info["keep-aspect-change"].asBoolean());  		return 1;  	} -     -	if (info.has("snapshot-updating")) + +	if (info.has("image-quality-change"))  	{ -        // Disable the send/post/save buttons until snapshot is ready. -        impl.updateControls(this); +		((Impl*)impl)->onImageQualityChange(this, info["image-quality-change"].asInteger());  		return 1;  	} -	if (info.has("snapshot-updated")) +	if (info.has("image-format-change"))  	{ -        // Enable the send/post/save buttons. -        impl.updateControls(this); -        // We've just done refresh. -        impl.setNeedRefresh(this, false); -             -        // The refresh button is initially hidden. We show it after the first update, -        // i.e. when preview appears. -        if (!mRefreshBtn->getVisible()) -        { -            mRefreshBtn->setVisible(true); -        } +		((Impl*)impl)->onImageFormatChange(this);  		return 1; -	}     +	}  	return 0;  } -//static  -void LLFloaterSnapshot::update() +void LLFloaterSnapshotBase::ImplBase::updateLivePreview()  { -	LLFloaterSnapshot* inst = findInstance(); -	LLFloaterFacebook* floater_facebook = LLFloaterReg::findTypedInstance<LLFloaterFacebook>("facebook");  -	LLFloaterFlickr* floater_flickr = LLFloaterReg::findTypedInstance<LLFloaterFlickr>("flickr");  -	LLFloaterTwitter* floater_twitter = LLFloaterReg::findTypedInstance<LLFloaterTwitter>("twitter");  +	LLFloaterFacebook* floater_facebook = LLFloaterReg::findTypedInstance<LLFloaterFacebook>("facebook"); +	LLFloaterFlickr* floater_flickr = LLFloaterReg::findTypedInstance<LLFloaterFlickr>("flickr"); +	LLFloaterTwitter* floater_twitter = LLFloaterReg::findTypedInstance<LLFloaterTwitter>("twitter"); -	if (!inst && !floater_facebook && !floater_flickr && !floater_twitter) +	if (!mFloater && !floater_facebook && !floater_flickr && !floater_twitter)  		return; -	 +  	BOOL changed = FALSE;  	LL_DEBUGS() << "npreviews: " << LLSnapshotLivePreview::sList.size() << LL_ENDL;  	for (std::set<LLSnapshotLivePreview*>::iterator iter = LLSnapshotLivePreview::sList.begin(); -		 iter != LLSnapshotLivePreview::sList.end(); ++iter) +		iter != LLSnapshotLivePreview::sList.end(); ++iter)  	{  		changed |= LLSnapshotLivePreview::onIdle(*iter);  	} -     -	if (inst && changed) + +	if (mFloater && changed)  	{  		LL_DEBUGS() << "changed" << LL_ENDL; -		inst->impl.updateControls(inst); +		updateControls(mFloater);  	}  } -// static -LLFloaterSnapshot* LLFloaterSnapshot::getInstance() +//static  +void LLFloaterSnapshot::update()  { -	return LLFloaterReg::getTypedInstance<LLFloaterSnapshot>("snapshot"); +	LLFloaterSnapshot* inst = getInstance(); +	if (inst != NULL) +	{ +		inst->impl->updateLivePreview(); +	}  }  // static -LLFloaterSnapshot* LLFloaterSnapshot::findInstance() +LLFloaterSnapshot* LLFloaterSnapshot::getInstance()  { -	return LLFloaterReg::findTypedInstance<LLFloaterSnapshot>("snapshot"); +	return LLFloaterReg::getTypedInstance<LLFloaterSnapshot>("snapshot");  } -// static +// virtual  void LLFloaterSnapshot::saveTexture()  {  	LL_DEBUGS() << "saveTexture" << LL_ENDL; -	// FIXME: duplicated code -	LLFloaterSnapshot* instance = findInstance(); -	if (!instance) -	{ -		llassert(instance != NULL); -		return; -	} -	LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance); +	LLSnapshotLivePreview* previewp = getPreviewView();  	if (!previewp)  	{  		llassert(previewp != NULL); @@ -1400,18 +1284,10 @@ void LLFloaterSnapshot::saveTexture()  	previewp->saveTexture();  } -// static  BOOL LLFloaterSnapshot::saveLocal()  {  	LL_DEBUGS() << "saveLocal" << LL_ENDL; -	// FIXME: duplicated code -    LLFloaterSnapshot* instance = findInstance(); -	if (!instance) -	{ -		llassert(instance != NULL); -		return FALSE; -	} -	LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance); +	LLSnapshotLivePreview* previewp = getPreviewView();  	if (!previewp)  	{  		llassert(previewp != NULL); @@ -1421,43 +1297,26 @@ BOOL LLFloaterSnapshot::saveLocal()  	return previewp->saveLocal();  } -// static -void LLFloaterSnapshot::postSave() +void LLFloaterSnapshotBase::postSave()  { -	LLFloaterSnapshot* instance = findInstance(); -	if (!instance) -	{ -		llassert(instance != NULL); -		return; -	} - -	instance->impl.updateControls(instance); -	instance->impl.setStatus(Impl::STATUS_WORKING); +	impl->updateControls(this); +	impl->setStatus(ImplBase::STATUS_WORKING);  } -// static -void LLFloaterSnapshot::postPanelSwitch() +// virtual +void LLFloaterSnapshotBase::postPanelSwitch()  { -	LLFloaterSnapshot* instance = getInstance(); -	instance->impl.updateControls(instance); +	impl->updateControls(this);  	// Remove the success/failure indicator whenever user presses a snapshot option button. -	instance->impl.setStatus(Impl::STATUS_READY); +	impl->setStatus(ImplBase::STATUS_READY);  } -// static -LLPointer<LLImageFormatted> LLFloaterSnapshot::getImageData() +LLPointer<LLImageFormatted> LLFloaterSnapshotBase::getImageData()  {  	// FIXME: May not work for textures. -	LLFloaterSnapshot* instance = findInstance(); -	if (!instance) -	{ -		llassert(instance != NULL); -		return NULL; -	} - -	LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance); +	LLSnapshotLivePreview* previewp = getPreviewView();  	if (!previewp)  	{  		llassert(previewp != NULL); @@ -1474,17 +1333,9 @@ LLPointer<LLImageFormatted> LLFloaterSnapshot::getImageData()  	return img;  } -// static -const LLVector3d& LLFloaterSnapshot::getPosTakenGlobal() +const LLVector3d& LLFloaterSnapshotBase::getPosTakenGlobal()  { -	LLFloaterSnapshot* instance = findInstance(); -	if (!instance) -	{ -		llassert(instance != NULL); -		return LLVector3d::zero; -	} - -	LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance); +	LLSnapshotLivePreview* previewp = getPreviewView();  	if (!previewp)  	{  		llassert(previewp != NULL); @@ -1497,7 +1348,7 @@ const LLVector3d& LLFloaterSnapshot::getPosTakenGlobal()  // static  void LLFloaterSnapshot::setAgentEmail(const std::string& email)  { -	LLFloaterSnapshot* instance = findInstance(); +	LLFloaterSnapshot* instance = getInstance();  	if (instance)  	{  		LLSideTrayPanelContainer* panel_container = instance->getChild<LLSideTrayPanelContainer>("panel_container"); @@ -1518,6 +1369,7 @@ LLSnapshotFloaterView::~LLSnapshotFloaterView()  {  } +// virtual  BOOL LLSnapshotFloaterView::handleKey(KEY key, MASK mask, BOOL called_from_parent)  {  	// use default handler when not in freeze-frame mode @@ -1539,6 +1391,7 @@ BOOL LLSnapshotFloaterView::handleKey(KEY key, MASK mask, BOOL called_from_paren  	return TRUE;  } +// virtual  BOOL LLSnapshotFloaterView::handleMouseDown(S32 x, S32 y, MASK mask)  {  	// use default handler when not in freeze-frame mode @@ -1554,6 +1407,7 @@ BOOL LLSnapshotFloaterView::handleMouseDown(S32 x, S32 y, MASK mask)  	return TRUE;  } +// virtual  BOOL LLSnapshotFloaterView::handleMouseUp(S32 x, S32 y, MASK mask)  {  	// use default handler when not in freeze-frame mode @@ -1569,6 +1423,7 @@ BOOL LLSnapshotFloaterView::handleMouseUp(S32 x, S32 y, MASK mask)  	return TRUE;  } +// virtual  BOOL LLSnapshotFloaterView::handleHover(S32 x, S32 y, MASK mask)  {  	// use default handler when not in freeze-frame mode diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index 5f9857c8c5..431888d2d0 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -4,7 +4,7 @@   *   * $LicenseInfo:firstyear=2004&license=viewerlgpl$   * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2016, 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 @@ -27,36 +27,109 @@  #ifndef LL_LLFLOATERSNAPSHOT_H  #define LL_LLFLOATERSNAPSHOT_H +#include "llagent.h"  #include "llfloater.h" +#include "llpanelsnapshot.h" +#include "llsnapshotmodel.h"  class LLSpinCtrl; +class LLSnapshotLivePreview;  class LLFloaterSnapshotBase : public LLFloater  {      LOG_CLASS(LLFloaterSnapshotBase);  public: -    typedef enum e_snapshot_format -    { -        SNAPSHOT_FORMAT_PNG, -        SNAPSHOT_FORMAT_JPEG, -        SNAPSHOT_FORMAT_BMP -    } ESnapshotFormat;      LLFloaterSnapshotBase(const LLSD& key);      virtual ~LLFloaterSnapshotBase(); -    ///*virtual*/ S32 notify(const LLSD& info); +	/*virtual*/ void draw(); +	/*virtual*/ void onClose(bool app_quitting); +	virtual S32 notify(const LLSD& info); -    //static LLFloaterSnapshotBase* getInstance(); -    //static LLFloaterSnapshotBase* findInstance(); -    //static void saveTexture(); -    //static BOOL saveLocal(); -    //static void postSave(); +	// TODO: create a snapshot model instead +	virtual void saveTexture() = 0; +	void postSave(); +	virtual void postPanelSwitch(); +	LLPointer<LLImageFormatted> getImageData(); +	LLSnapshotLivePreview* getPreviewView(); +	const LLVector3d& getPosTakenGlobal(); + +	static const LLRect& getThumbnailPlaceholderRect() { return sThumbnailPlaceholder->getRect(); } + +	void setRefreshLabelVisible(bool value) { mRefreshLabel->setVisible(value); } +	void setSuccessLabelPanelVisible(bool value) { mSucceessLblPanel->setVisible(value); } +	void setFailureLabelPanelVisible(bool value) { mFailureLblPanel->setVisible(value); } + +	class ImplBase; +	friend ImplBase; +	ImplBase* impl;  protected: -    class ImplBase; -    //ImplBase& impl; +	static LLUICtrl* sThumbnailPlaceholder; +	LLUICtrl *mRefreshBtn, *mRefreshLabel; +	LLUICtrl *mSucceessLblPanel, *mFailureLblPanel; +}; + +class LLFloaterSnapshotBase::ImplBase +{ +public: +	typedef enum e_status +	{ +		STATUS_READY, +		STATUS_WORKING, +		STATUS_FINISHED +	} EStatus; + +	ImplBase(LLFloaterSnapshotBase* floater) : mAvatarPauseHandles(), +		mLastToolset(NULL), +		mAspectRatioCheckOff(false), +		mNeedRefresh(false), +		mStatus(STATUS_READY), +		mFloater(floater) +	{} +	virtual ~ImplBase() +	{ +		//unpause avatars +		mAvatarPauseHandles.clear(); +	} + +	static void onClickNewSnapshot(void* data); +	static void onClickAutoSnap(LLUICtrl *ctrl, void* data); +	static void onClickFilter(LLUICtrl *ctrl, void* data); +	static void onClickUICheck(LLUICtrl *ctrl, void* data); +	static void onClickHUDCheck(LLUICtrl *ctrl, void* data); +	static void onCommitFreezeFrame(LLUICtrl* ctrl, void* data); +	static void onSnapshotUploadFinished(LLFloaterSnapshotBase* floater, bool status); + +	virtual LLPanelSnapshot* getActivePanel(LLFloaterSnapshotBase* floater, bool ok_if_not_found = true) = 0; +	virtual LLSnapshotModel::ESnapshotType getActiveSnapshotType(LLFloaterSnapshotBase* floater); +	virtual LLSnapshotModel::ESnapshotFormat getImageFormat(LLFloaterSnapshotBase* floater) = 0; +	virtual std::string getSnapshotPanelPrefix() = 0; + +	LLSnapshotLivePreview* getPreviewView(); +	virtual void updateControls(LLFloaterSnapshotBase* floater) = 0; +	virtual void updateLayout(LLFloaterSnapshotBase* floater); +	virtual void updateLivePreview(); +	virtual void setStatus(EStatus status, bool ok = true, const std::string& msg = LLStringUtil::null); +	virtual EStatus getStatus() const { return mStatus; } +	virtual void setNeedRefresh(bool need); + +	virtual LLSnapshotModel::ESnapshotLayerType getLayerType(LLFloaterSnapshotBase* floater) = 0; +	virtual void checkAutoSnapshot(LLSnapshotLivePreview* floater, BOOL update_thumbnail = FALSE); +	void setWorking(bool working); +	virtual void setFinished(bool finished, bool ok = true, const std::string& msg = LLStringUtil::null) = 0; + +public: +	LLFloaterSnapshotBase* mFloater; +	std::vector<LLAnimPauseRequest> mAvatarPauseHandles; + +	LLToolset*	mLastToolset; +	LLHandle<LLView> mPreviewHandle; +	bool mAspectRatioCheckOff; +	bool mNeedRefresh; +	EStatus mStatus;  };  class LLFloaterSnapshot : public LLFloaterSnapshotBase @@ -64,51 +137,65 @@ class LLFloaterSnapshot : public LLFloaterSnapshotBase  	LOG_CLASS(LLFloaterSnapshot);  public: -	//typedef enum e_snapshot_format -	//{ -	//	SNAPSHOT_FORMAT_PNG, -	//	SNAPSHOT_FORMAT_JPEG, -	//	SNAPSHOT_FORMAT_BMP -	//} ESnapshotFormat; -  	LLFloaterSnapshot(const LLSD& key); -	virtual ~LLFloaterSnapshot(); +	/*virtual*/ ~LLFloaterSnapshot();  	/*virtual*/ BOOL postBuild(); -	/*virtual*/ void draw();  	/*virtual*/ void onOpen(const LLSD& key); -	/*virtual*/ void onClose(bool app_quitting);  	/*virtual*/ S32 notify(const LLSD& info);  	static void update(); -	// TODO: create a snapshot model instead  	static LLFloaterSnapshot* getInstance(); -	static LLFloaterSnapshot* findInstance(); -	static void saveTexture(); -	static BOOL saveLocal(); -	static void postSave(); -	static void postPanelSwitch(); -	static LLPointer<LLImageFormatted> getImageData(); -	static const LLVector3d& getPosTakenGlobal(); +	/*virtual*/ void saveTexture(); +	BOOL saveLocal();  	static void setAgentEmail(const std::string& email); -	static const LLRect& getThumbnailPlaceholderRect() { return sThumbnailPlaceholder->getRect(); } - -private: -	static LLUICtrl* sThumbnailPlaceholder; -	LLUICtrl *mRefreshBtn, *mRefreshLabel; -	LLUICtrl *mSucceessLblPanel, *mFailureLblPanel; -  	class Impl; -	Impl& impl; +	friend Impl;  }; -class LLFloaterSnapshotBase::ImplBase +///---------------------------------------------------------------------------- +/// Class LLFloaterSnapshot::Impl +///---------------------------------------------------------------------------- + +class LLFloaterSnapshot::Impl : public LLFloaterSnapshotBase::ImplBase  { +	LOG_CLASS(LLFloaterSnapshot::Impl);  public: -    ImplBase(); -    ~ImplBase(); +	Impl(LLFloaterSnapshotBase* floater) +		: LLFloaterSnapshotBase::ImplBase(floater) +	{} +	~Impl() +	{} + +	void applyKeepAspectCheck(LLFloaterSnapshotBase* view, BOOL checked); +	void updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update = TRUE); +	static void onCommitLayerTypes(LLUICtrl* ctrl, void*data); +	void onImageQualityChange(LLFloaterSnapshotBase* view, S32 quality_val); +	void onImageFormatChange(LLFloaterSnapshotBase* view); +	void applyCustomResolution(LLFloaterSnapshotBase* view, S32 w, S32 h); +	static void onSendingPostcardFinished(LLFloaterSnapshotBase* floater, bool status); +	BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value); +	void setImageSizeSpinnersValues(LLFloaterSnapshotBase *view, S32 width, S32 height); +	void updateSpinners(LLFloaterSnapshotBase* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed); + +	/*virtual*/ LLPanelSnapshot* getActivePanel(LLFloaterSnapshotBase* floater, bool ok_if_not_found = true); +	/*virtual*/ LLSnapshotModel::ESnapshotFormat getImageFormat(LLFloaterSnapshotBase* floater); +	LLSpinCtrl* getWidthSpinner(LLFloaterSnapshotBase* floater); +	LLSpinCtrl* getHeightSpinner(LLFloaterSnapshotBase* floater); +	void enableAspectRatioCheckbox(LLFloaterSnapshotBase* floater, BOOL enable); +	void setAspectRatioCheckboxValue(LLFloaterSnapshotBase* floater, BOOL checked); +	/*virtual*/ std::string getSnapshotPanelPrefix(); + +	void setResolution(LLFloaterSnapshotBase* floater, const std::string& comboname); +	/*virtual*/ void updateControls(LLFloaterSnapshotBase* floater); + +private: +	/*virtual*/ LLSnapshotModel::ESnapshotLayerType getLayerType(LLFloaterSnapshotBase* floater); +	void comboSetCustom(LLFloaterSnapshotBase *floater, const std::string& comboname); +	void checkAspectRatio(LLFloaterSnapshotBase *view, S32 index); +	void setFinished(bool finished, bool ok = true, const std::string& msg = LLStringUtil::null);  };  class LLSnapshotFloaterView : public LLFloaterView diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp index 984ba587ed..4bab89ace2 100644 --- a/indra/newview/llfloatertwitter.cpp +++ b/indra/newview/llfloatertwitter.cpp @@ -241,8 +241,8 @@ void LLTwitterPhotoPanel::onVisibilityChange(BOOL visible)  			mPreviewHandle = previewp->getHandle();              previewp->setContainer(this); -            previewp->setSnapshotType(LLPanelSnapshot::SNAPSHOT_WEB); -			previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); +            previewp->setSnapshotType(LLSnapshotModel::SNAPSHOT_WEB); +            previewp->setSnapshotFormat(LLSnapshotModel::SNAPSHOT_FORMAT_JPEG);              previewp->setThumbnailSubsampled(TRUE);     // We want the preview to reflect the *saved* image              previewp->setAllowRenderUI(FALSE);          // We do not want the rendered UI in our snapshots              previewp->setAllowFullScreenPreview(FALSE);  // No full screen preview in SL Share mode diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 7bd9c0bd94..f6af3d63f6 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -1115,8 +1115,12 @@ void LLOutfitGallery::onSelectPhoto(LLUUID selected_outfit_id)  void LLOutfitGallery::onTakeSnapshot(LLUUID selected_outfit_id)  {      LLFloaterReg::toggleInstanceOrBringToFront("outfit_snapshot"); -    LLFloaterOutfitSnapshot::getInstance()->setOutfitID(selected_outfit_id); -    LLFloaterOutfitSnapshot::getInstance()->setGallery(this); +    LLFloaterOutfitSnapshot* snapshot_floater = LLFloaterOutfitSnapshot::getInstance(); +    if (snapshot_floater) +    { +        snapshot_floater->setOutfitID(selected_outfit_id); +        snapshot_floater->getInstance()->setGallery(this); +    }  }  void LLOutfitGallery::onBeforeOutfitSnapshotSave() diff --git a/indra/newview/llpanelsnapshot.cpp b/indra/newview/llpanelsnapshot.cpp index e320c4ce8b..a17e3f9e78 100644 --- a/indra/newview/llpanelsnapshot.cpp +++ b/indra/newview/llpanelsnapshot.cpp @@ -29,6 +29,8 @@  // libs  #include "llcombobox.h" +#include "llfloater.h" +#include "llfloatersnapshot.h"  #include "llsliderctrl.h"  #include "llspinctrl.h"  #include "lltrans.h" @@ -50,6 +52,10 @@ S32 power_of_two(S32 sz, S32 upper)  	return res;  } +LLPanelSnapshot::LLPanelSnapshot() +	: mSnapshotFloater(NULL) +{} +  // virtual  BOOL LLPanelSnapshot::postBuild()  { @@ -67,6 +73,8 @@ BOOL LLPanelSnapshot::postBuild()          getChild<LLUICtrl>(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onKeepAspectRatioCommit, this, _1));      }  	updateControls(LLSD()); + +	mSnapshotFloater = getParentByType<LLFloaterSnapshotBase>();  	return TRUE;  } @@ -88,9 +96,9 @@ void LLPanelSnapshot::onOpen(const LLSD& key)  	}  } -LLFloaterSnapshotBase::ESnapshotFormat LLPanelSnapshot::getImageFormat() const +LLSnapshotModel::ESnapshotFormat LLPanelSnapshot::getImageFormat() const  { -	return LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG; +	return LLSnapshotModel::SNAPSHOT_FORMAT_JPEG;  }  void LLPanelSnapshot::enableControls(BOOL enable) @@ -228,7 +236,7 @@ void LLPanelSnapshot::onKeepAspectRatioCommit(LLUICtrl* ctrl)      getParentByType<LLFloater>()->notify(LLSD().with("keep-aspect-change", ctrl->getValue().asBoolean()));  } -LLPanelSnapshot::ESnapshotType LLPanelSnapshot::getSnapshotType() +LLSnapshotModel::ESnapshotType LLPanelSnapshot::getSnapshotType()  { -    return LLPanelSnapshot::SNAPSHOT_WEB; +	return LLSnapshotModel::SNAPSHOT_WEB;  } diff --git a/indra/newview/llpanelsnapshot.h b/indra/newview/llpanelsnapshot.h index 3868020cdf..55273797cc 100644 --- a/indra/newview/llpanelsnapshot.h +++ b/indra/newview/llpanelsnapshot.h @@ -27,9 +27,13 @@  #ifndef LL_LLPANELSNAPSHOT_H  #define LL_LLPANELSNAPSHOT_H -#include "llfloatersnapshot.h" +//#include "llfloatersnapshot.h" +#include "llpanel.h" +#include "llsnapshotmodel.h" +class LLSpinCtrl;  class LLSideTrayPanelContainer; +class LLFloaterSnapshotBase;  /**   * Snapshot panel base class. @@ -37,13 +41,7 @@ class LLSideTrayPanelContainer;  class LLPanelSnapshot: public LLPanel  {  public: -    enum ESnapshotType -    { -        SNAPSHOT_POSTCARD, -        SNAPSHOT_TEXTURE, -        SNAPSHOT_LOCAL, -        SNAPSHOT_WEB -    }; +	LLPanelSnapshot();  	/*virtual*/ BOOL postBuild();  	/*virtual*/ void onOpen(const LLSD& key); @@ -59,8 +57,8 @@ public:  	virtual LLSpinCtrl* getWidthSpinner();  	virtual LLSpinCtrl* getHeightSpinner();  	virtual void enableAspectRatioCheckbox(BOOL enable); -    virtual LLFloaterSnapshotBase::ESnapshotFormat getImageFormat() const; -    virtual ESnapshotType getSnapshotType(); +    virtual LLSnapshotModel::ESnapshotFormat getImageFormat() const; +	virtual LLSnapshotModel::ESnapshotType getSnapshotType();  	virtual void updateControls(const LLSD& info) = 0; ///< Update controls from saved settings  	void enableControls(BOOL enable); @@ -74,6 +72,8 @@ protected:  	void onCustomResolutionCommit();  	void onResolutionComboCommit(LLUICtrl* ctrl);  	void onKeepAspectRatioCommit(LLUICtrl* ctrl); + +	LLFloaterSnapshotBase* mSnapshotFloater;  };  #endif // LL_LLPANELSNAPSHOT_H diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp index 057e046e30..408eb8fbf3 100644 --- a/indra/newview/llpanelsnapshotinventory.cpp +++ b/indra/newview/llpanelsnapshotinventory.cpp @@ -32,7 +32,6 @@  #include "llspinctrl.h"  #include "llfloatersnapshot.h" // FIXME: replace with a snapshot storage model -#include "llfloateroutfitsnapshot.h"  #include "llpanelsnapshot.h"  #include "llsnapshotlivepreview.h"  #include "llviewercontrol.h" // gSavedSettings @@ -48,10 +47,10 @@ class LLPanelSnapshotInventoryBase  public:      LLPanelSnapshotInventoryBase(); +	/*virtual*/ BOOL postBuild();  protected: -    virtual void onSend() = 0; -    /*virtual*/ LLPanelSnapshot::ESnapshotType getSnapshotType(); - +    void onSend(); +    /*virtual*/ LLSnapshotModel::ESnapshotType getSnapshotType();  };  class LLPanelSnapshotInventory @@ -74,7 +73,6 @@ private:  	/*virtual*/ std::string getImageSizePanelName() const	{ return LLStringUtil::null; }  	/*virtual*/ void updateControls(const LLSD& info); -    /*virtual*/ void onSend();  };  class LLPanelOutfitSnapshotInventory @@ -95,7 +93,6 @@ private:      /*virtual*/ std::string getImageSizePanelName() const	{ return LLStringUtil::null; }      /*virtual*/ void updateControls(const LLSD& info); -    /*virtual*/ void onSend();      /*virtual*/ void cancel();  }; @@ -107,9 +104,14 @@ LLPanelSnapshotInventoryBase::LLPanelSnapshotInventoryBase()  {  } -LLPanelSnapshot::ESnapshotType LLPanelSnapshotInventoryBase::getSnapshotType() +BOOL LLPanelSnapshotInventoryBase::postBuild() +{ +    return LLPanelSnapshot::postBuild(); +} + +LLSnapshotModel::ESnapshotType LLPanelSnapshotInventoryBase::getSnapshotType()  { -    return LLPanelSnapshot::SNAPSHOT_TEXTURE; +    return LLSnapshotModel::SNAPSHOT_TEXTURE;  }  LLPanelSnapshotInventory::LLPanelSnapshotInventory() @@ -125,7 +127,7 @@ BOOL LLPanelSnapshotInventory::postBuild()  	getChild<LLSpinCtrl>(getHeightSpinnerName())->setAllowEdit(FALSE);  	getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onResolutionCommit, this, _1)); -	return LLPanelSnapshot::postBuild(); +	return LLPanelSnapshotInventoryBase::postBuild();  }  // virtual @@ -149,10 +151,13 @@ void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl)  	getChild<LLSpinCtrl>(getHeightSpinnerName())->setVisible(!current_window_selected);  } -void LLPanelSnapshotInventory::onSend() +void LLPanelSnapshotInventoryBase::onSend()  { -	LLFloaterSnapshot::saveTexture(); -	LLFloaterSnapshot::postSave(); +    if (mSnapshotFloater) +    { +        mSnapshotFloater->saveTexture(); +        mSnapshotFloater->postSave(); +    }  }  LLPanelOutfitSnapshotInventory::LLPanelOutfitSnapshotInventory() @@ -164,7 +169,7 @@ LLPanelOutfitSnapshotInventory::LLPanelOutfitSnapshotInventory()  // virtual  BOOL LLPanelOutfitSnapshotInventory::postBuild()  { -    return LLPanelSnapshot::postBuild(); +    return LLPanelSnapshotInventoryBase::postBuild();  }  // virtual @@ -181,13 +186,10 @@ void LLPanelOutfitSnapshotInventory::updateControls(const LLSD& info)      getChild<LLUICtrl>("save_btn")->setEnabled(have_snapshot);  } -void LLPanelOutfitSnapshotInventory::onSend() -{ -    LLFloaterOutfitSnapshot::saveTexture(); -    LLFloaterOutfitSnapshot::postSave(); -} -  void LLPanelOutfitSnapshotInventory::cancel()  { -    getParentByType<LLFloater>()->closeFloater(); +    if (mSnapshotFloater) +    { +        mSnapshotFloater->closeFloater(); +    }  } diff --git a/indra/newview/llpanelsnapshotlocal.cpp b/indra/newview/llpanelsnapshotlocal.cpp index 954eb63a28..3652c10586 100644 --- a/indra/newview/llpanelsnapshotlocal.cpp +++ b/indra/newview/llpanelsnapshotlocal.cpp @@ -56,9 +56,9 @@ private:  	/*virtual*/ std::string getAspectRatioCBName() const	{ return "local_keep_aspect_check"; }  	/*virtual*/ std::string getImageSizeComboName() const	{ return "local_size_combo"; }  	/*virtual*/ std::string getImageSizePanelName() const	{ return "local_image_size_lp"; } -    /*virtual*/ LLFloaterSnapshotBase::ESnapshotFormat getImageFormat() const; -    /*virtual*/ LLPanelSnapshot::ESnapshotType getSnapshotType(); -    /*virtual*/ void updateControls(const LLSD& info); +	/*virtual*/ LLSnapshotModel::ESnapshotFormat getImageFormat() const; +	/*virtual*/ LLSnapshotModel::ESnapshotType getSnapshotType(); +	/*virtual*/ void updateControls(const LLSD& info);  	S32 mLocalFormat; @@ -96,23 +96,23 @@ void LLPanelSnapshotLocal::onOpen(const LLSD& key)  }  // virtual -LLFloaterSnapshotBase::ESnapshotFormat LLPanelSnapshotLocal::getImageFormat() const +LLSnapshotModel::ESnapshotFormat LLPanelSnapshotLocal::getImageFormat() const  { -    LLFloaterSnapshotBase::ESnapshotFormat fmt = LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG; +	LLSnapshotModel::ESnapshotFormat fmt = LLSnapshotModel::SNAPSHOT_FORMAT_PNG;  	LLComboBox* local_format_combo = getChild<LLComboBox>("local_format_combo");  	const std::string id  = local_format_combo->getValue().asString();  	if (id == "PNG")  	{ -		fmt = LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG; +		fmt = LLSnapshotModel::SNAPSHOT_FORMAT_PNG;  	}  	else if (id == "JPEG")  	{ -		fmt = LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG; +		fmt = LLSnapshotModel::SNAPSHOT_FORMAT_JPEG;  	}  	else if (id == "BMP")  	{ -		fmt = LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP; +		fmt = LLSnapshotModel::SNAPSHOT_FORMAT_BMP;  	}  	return fmt; @@ -121,11 +121,11 @@ LLFloaterSnapshotBase::ESnapshotFormat LLPanelSnapshotLocal::getImageFormat() co  // virtual  void LLPanelSnapshotLocal::updateControls(const LLSD& info)  { -    LLFloaterSnapshotBase::ESnapshotFormat fmt = -        (LLFloaterSnapshotBase::ESnapshotFormat) gSavedSettings.getS32("SnapshotFormat"); +	LLSnapshotModel::ESnapshotFormat fmt = +		(LLSnapshotModel::ESnapshotFormat) gSavedSettings.getS32("SnapshotFormat");  	getChild<LLComboBox>("local_format_combo")->selectNthItem((S32) fmt); -	const bool show_quality_ctrls = (fmt == LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); +	const bool show_quality_ctrls = (fmt == LLSnapshotModel::SNAPSHOT_FORMAT_JPEG);  	getChild<LLUICtrl>("image_quality_slider")->setVisible(show_quality_ctrls);  	getChild<LLUICtrl>("image_quality_level")->setVisible(show_quality_ctrls); @@ -164,10 +164,10 @@ void LLPanelSnapshotLocal::onSaveFlyoutCommit(LLUICtrl* ctrl)  	LLFloaterSnapshot* floater = LLFloaterSnapshot::getInstance();  	floater->notify(LLSD().with("set-working", true)); -	BOOL saved = LLFloaterSnapshot::saveLocal(); +	BOOL saved = floater->saveLocal();  	if (saved)  	{ -		LLFloaterSnapshot::postSave(); +		mSnapshotFloater->postSave();  		goBack();  		floater->notify(LLSD().with("set-finished", LLSD().with("ok", true).with("msg", "local")));  	} @@ -177,7 +177,7 @@ void LLPanelSnapshotLocal::onSaveFlyoutCommit(LLUICtrl* ctrl)  	}  } -LLPanelSnapshot::ESnapshotType LLPanelSnapshotLocal::getSnapshotType() +LLSnapshotModel::ESnapshotType LLPanelSnapshotLocal::getSnapshotType()  { -    return LLPanelSnapshot::SNAPSHOT_LOCAL; +	return LLSnapshotModel::SNAPSHOT_LOCAL;  } diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 0fc9ceec83..269f16c5e4 100644 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -62,6 +62,8 @@ private:  	void onSendToFacebook();  	void onSendToTwitter();  	void onSendToFlickr(); + +	LLFloaterSnapshotBase* mSnapshotFloater;  };  static LLPanelInjector<LLPanelSnapshotOptions> panel_class("llpanelsnapshotoptions"); @@ -86,6 +88,7 @@ LLPanelSnapshotOptions::~LLPanelSnapshotOptions()  // virtual  BOOL LLPanelSnapshotOptions::postBuild()  { +	mSnapshotFloater = getParentByType<LLFloaterSnapshotBase>();  	return LLPanel::postBuild();  } @@ -112,7 +115,7 @@ void LLPanelSnapshotOptions::openPanel(const std::string& panel_name)  	parent->openPanel(panel_name);  	parent->getCurrentPanel()->onOpen(LLSD()); -	LLFloaterSnapshot::postPanelSwitch(); +	mSnapshotFloater->postPanelSwitch();  }  void LLPanelSnapshotOptions::onSaveToProfile() diff --git a/indra/newview/llpanelsnapshotpostcard.cpp b/indra/newview/llpanelsnapshotpostcard.cpp index dcd12a7a47..12adcdec8d 100644 --- a/indra/newview/llpanelsnapshotpostcard.cpp +++ b/indra/newview/llpanelsnapshotpostcard.cpp @@ -65,13 +65,13 @@ private:  	/*virtual*/ std::string getAspectRatioCBName() const	{ return "postcard_keep_aspect_check"; }  	/*virtual*/ std::string getImageSizeComboName() const	{ return "postcard_size_combo"; }  	/*virtual*/ std::string getImageSizePanelName() const	{ return "postcard_image_size_lp"; } -    /*virtual*/ LLFloaterSnapshotBase::ESnapshotFormat getImageFormat() const { return LLFloaterSnapshotBase::SNAPSHOT_FORMAT_JPEG; } -    /*virtual*/ LLPanelSnapshot::ESnapshotType getSnapshotType(); -    /*virtual*/ void updateControls(const LLSD& info); +	/*virtual*/ LLSnapshotModel::ESnapshotFormat getImageFormat() const { return LLSnapshotModel::SNAPSHOT_FORMAT_JPEG; } +	/*virtual*/ LLSnapshotModel::ESnapshotType getSnapshotType(); +	/*virtual*/ void updateControls(const LLSD& info);  	bool missingSubjMsgAlertCallback(const LLSD& notification, const LLSD& response); -    static void sendPostcardFinished(LLSD result); -    void sendPostcard(); +	static void sendPostcardFinished(LLSD result); +	void sendPostcard();  	void onMsgFormFocusRecieved();  	void onFormatComboCommit(LLUICtrl* ctrl); @@ -192,8 +192,8 @@ void LLPanelSnapshotPostcard::sendPostcard()              getChild<LLUICtrl>("to_form")->getValue().asString(),              getChild<LLUICtrl>("subject_form")->getValue().asString(),              getChild<LLUICtrl>("msg_form")->getValue().asString(), -            LLFloaterSnapshot::getPosTakenGlobal(), -            LLFloaterSnapshot::getImageData(), +            mSnapshotFloater->getPosTakenGlobal(), +            mSnapshotFloater->getImageData(),              boost::bind(&LLPanelSnapshotPostcard::sendPostcardFinished, _4)));          LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo); @@ -207,7 +207,7 @@ void LLPanelSnapshotPostcard::sendPostcard()      // Give user feedback of the event.      gViewerWindow->playSnapshotAnimAndSound(); -    LLFloaterSnapshot::postSave(); +    mSnapshotFloater->postSave();  }  void LLPanelSnapshotPostcard::onMsgFormFocusRecieved() @@ -267,7 +267,7 @@ void LLPanelSnapshotPostcard::onSend()  	sendPostcard();  } -LLPanelSnapshot::ESnapshotType LLPanelSnapshotPostcard::getSnapshotType() +LLSnapshotModel::ESnapshotType LLPanelSnapshotPostcard::getSnapshotType()  { -    return LLPanelSnapshot::SNAPSHOT_POSTCARD; +    return LLSnapshotModel::SNAPSHOT_POSTCARD;  } diff --git a/indra/newview/llpanelsnapshotprofile.cpp b/indra/newview/llpanelsnapshotprofile.cpp index b6fc45fb63..38dec78030 100644 --- a/indra/newview/llpanelsnapshotprofile.cpp +++ b/indra/newview/llpanelsnapshotprofile.cpp @@ -58,7 +58,7 @@ private:  	/*virtual*/ std::string getAspectRatioCBName() const	{ return "profile_keep_aspect_check"; }  	/*virtual*/ std::string getImageSizeComboName() const	{ return "profile_size_combo"; }  	/*virtual*/ std::string getImageSizePanelName() const	{ return "profile_image_size_lp"; } -    /*virtual*/ LLFloaterSnapshotBase::ESnapshotFormat getImageFormat() const { return LLFloaterSnapshotBase::SNAPSHOT_FORMAT_PNG; } +	/*virtual*/ LLSnapshotModel::ESnapshotFormat getImageFormat() const { return LLSnapshotModel::SNAPSHOT_FORMAT_PNG; }  	/*virtual*/ void updateControls(const LLSD& info);  	void onSend(); @@ -96,6 +96,6 @@ void LLPanelSnapshotProfile::onSend()  	std::string caption = getChild<LLUICtrl>("caption")->getValue().asString();  	bool add_location = getChild<LLUICtrl>("add_location_cb")->getValue().asBoolean(); -	LLWebProfile::uploadImage(LLFloaterSnapshot::getImageData(), caption, add_location); -	LLFloaterSnapshot::postSave(); +	LLWebProfile::uploadImage(mSnapshotFloater->getImageData(), caption, add_location); +	mSnapshotFloater->postSave();  } diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index 15aa62f5d3..049aae1336 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -86,13 +86,13 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLSnapshotLivePreview::Param  	mNeedsFlash(TRUE),  	mSnapshotQuality(gSavedSettings.getS32("SnapshotQuality")),  	mDataSize(0), -    mSnapshotType(LLPanelSnapshot::SNAPSHOT_POSTCARD), -    mSnapshotFormat(LLFloaterSnapshotBase::ESnapshotFormat(gSavedSettings.getS32("SnapshotFormat"))), +	mSnapshotType(LLSnapshotModel::SNAPSHOT_POSTCARD), +	mSnapshotFormat(LLSnapshotModel::ESnapshotFormat(gSavedSettings.getS32("SnapshotFormat"))),  	mSnapshotUpToDate(FALSE),  	mCameraPos(LLViewerCamera::getInstance()->getOrigin()),  	mCameraRot(LLViewerCamera::getInstance()->getQuaternion()),  	mSnapshotActive(FALSE), -	mSnapshotBufferType(LLViewerWindow::SNAPSHOT_TYPE_COLOR), +	mSnapshotBufferType(LLSnapshotModel::SNAPSHOT_TYPE_COLOR),      mFilterName(""),      mAllowRenderUI(TRUE),      mAllowFullScreenPreview(TRUE), @@ -737,7 +737,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )                  previewp->getWidth(),                  previewp->getHeight(),                  previewp->mKeepAspectRatio,//gSavedSettings.getBOOL("KeepAspectForSnapshot"), -                previewp->getSnapshotType() == LLPanelSnapshot::SNAPSHOT_TEXTURE, +                previewp->getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE,                  previewp->mAllowRenderUI && gSavedSettings.getBOOL("RenderUIInSnapshot"),                  FALSE,                  previewp->mSnapshotBufferType, @@ -813,7 +813,7 @@ void LLSnapshotLivePreview::prepareFreezeFrame()          mViewerImage[mCurImageIndex] = LLViewerTextureManager::getLocalTexture(scaled.get(), FALSE);          LLPointer<LLViewerTexture> curr_preview_image = mViewerImage[mCurImageIndex];          gGL.getTexUnit(0)->bind(curr_preview_image); -        curr_preview_image->setFilteringOption(getSnapshotType() == LLPanelSnapshot::SNAPSHOT_TEXTURE ? LLTexUnit::TFO_ANISOTROPIC : LLTexUnit::TFO_POINT); +        curr_preview_image->setFilteringOption(getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE ? LLTexUnit::TFO_ANISOTROPIC : LLTexUnit::TFO_POINT);          curr_preview_image->setAddressMode(LLTexUnit::TAM_CLAMP); @@ -827,7 +827,7 @@ void LLSnapshotLivePreview::prepareFreezeFrame()  S32 LLSnapshotLivePreview::getEncodedImageWidth() const  {      S32 width = getWidth(); -    if (getSnapshotType() == LLPanelSnapshot::SNAPSHOT_TEXTURE) +    if (getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE)      {          width = LLImageRaw::biasedDimToPowerOfTwo(width,MAX_TEXTURE_SIZE);      } @@ -836,7 +836,7 @@ S32 LLSnapshotLivePreview::getEncodedImageWidth() const  S32 LLSnapshotLivePreview::getEncodedImageHeight() const  {      S32 height = getHeight(); -    if (getSnapshotType() == LLPanelSnapshot::SNAPSHOT_TEXTURE) +    if (getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE)      {          height = LLImageRaw::biasedDimToPowerOfTwo(height,MAX_TEXTURE_SIZE);      } @@ -854,7 +854,7 @@ LLPointer<LLImageRaw> LLSnapshotLivePreview::getEncodedImage()              mPreviewImage->getHeight(),              mPreviewImage->getComponents()); -        if (getSnapshotType() == LLPanelSnapshot::SNAPSHOT_TEXTURE) +        if (getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE)  		{              // We don't store the intermediate formatted image in mFormattedImage in the J2C case   			LL_DEBUGS() << "Encoding new image of format J2C" << LL_ENDL; @@ -881,7 +881,7 @@ LLPointer<LLImageRaw> LLSnapshotLivePreview::getEncodedImage()  		{              // Update mFormattedImage if necessary              getFormattedImage(); -            if (getSnapshotFormat() == LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP) +            if (getSnapshotFormat() == LLSnapshotModel::SNAPSHOT_FORMAT_BMP)              {                  // BMP hack : copy instead of decode otherwise decode will crash.                  mPreviewImageEncoded->copy(mPreviewImage); @@ -903,23 +903,23 @@ void LLSnapshotLivePreview::estimateDataSize()      // Compression ratio      F32 ratio = 1.0; -    if (getSnapshotType() == LLPanelSnapshot::SNAPSHOT_TEXTURE) +    if (getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE)      {          ratio = 8.0;    // This is what we shoot for when compressing to J2C      }      else      { -        LLFloaterSnapshotBase::ESnapshotFormat format = getSnapshotFormat(); +        LLSnapshotModel::ESnapshotFormat format = getSnapshotFormat();          switch (format)          { -            case LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG: +            case LLSnapshotModel::SNAPSHOT_FORMAT_PNG:                  ratio = 3.0;    // Average observed PNG compression ratio                  break; -            case LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG: +            case LLSnapshotModel::SNAPSHOT_FORMAT_JPEG:                  // Observed from JPG compression tests                  ratio = (110 - mSnapshotQuality) / 2;                  break; -            case LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP: +            case LLSnapshotModel::SNAPSHOT_FORMAT_BMP:                  ratio = 1.0;    // No compression with BMP                  break;          } @@ -947,18 +947,18 @@ LLPointer<LLImageFormatted>	LLSnapshotLivePreview::getFormattedImage()          }          // Create the new formatted image of the appropriate format. -        LLFloaterSnapshotBase::ESnapshotFormat format = getSnapshotFormat(); +        LLSnapshotModel::ESnapshotFormat format = getSnapshotFormat();          LL_DEBUGS() << "Encoding new image of format " << format << LL_ENDL;          switch (format)          { -            case LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG: +		    case LLSnapshotModel::SNAPSHOT_FORMAT_PNG:                  mFormattedImage = new LLImagePNG();                  break; -            case LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG: +			case LLSnapshotModel::SNAPSHOT_FORMAT_JPEG:                  mFormattedImage = new LLImageJPEG(mSnapshotQuality);                  break; -            case LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP: +			case LLSnapshotModel::SNAPSHOT_FORMAT_BMP:                  mFormattedImage = new LLImageBMP();                  break;          } @@ -978,7 +978,7 @@ void LLSnapshotLivePreview::setSize(S32 w, S32 h)  	setHeight(h);  } -void LLSnapshotLivePreview::setSnapshotFormat(LLFloaterSnapshotBase::ESnapshotFormat format) +void LLSnapshotLivePreview::setSnapshotFormat(LLSnapshotModel::ESnapshotFormat format)  {      if (mSnapshotFormat != format)      { diff --git a/indra/newview/llsnapshotlivepreview.h b/indra/newview/llsnapshotlivepreview.h index b822707d29..b689c50320 100644 --- a/indra/newview/llsnapshotlivepreview.h +++ b/indra/newview/llsnapshotlivepreview.h @@ -27,7 +27,7 @@  #ifndef LL_LLSNAPSHOTLIVEPREVIEW_H  #define LL_LLSNAPSHOTLIVEPREVIEW_H -#include "llpanelsnapshot.h" +#include "llsnapshotmodel.h"  #include "llviewertexture.h"  #include "llviewerwindow.h" @@ -72,8 +72,8 @@ public:  	void setMaxImageSize(S32 size) ;  	S32  getMaxImageSize() {return mMaxImageSize ;} -    LLPanelSnapshot::ESnapshotType getSnapshotType() const { return mSnapshotType; } -    LLFloaterSnapshotBase::ESnapshotFormat getSnapshotFormat() const { return mSnapshotFormat; } +    LLSnapshotModel::ESnapshotType getSnapshotType() const { return mSnapshotType; } +    LLSnapshotModel::ESnapshotFormat getSnapshotFormat() const { return mSnapshotFormat; }  	BOOL getSnapshotUpToDate() const { return mSnapshotUpToDate; }  	BOOL isSnapshotActive() { return mSnapshotActive; }  	LLViewerTexture* getThumbnailImage() const { return mThumbnailImage ; } @@ -90,10 +90,10 @@ public:  	void setImageScaled(BOOL scaled) { mImageScaled[mCurImageIndex] = scaled; }  	const LLVector3d& getPosTakenGlobal() const { return mPosTakenGlobal; } -    void setSnapshotType(LLPanelSnapshot::ESnapshotType type) { mSnapshotType = type; } -    void setSnapshotFormat(LLFloaterSnapshotBase::ESnapshotFormat format); +    void setSnapshotType(LLSnapshotModel::ESnapshotType type) { mSnapshotType = type; } +    void setSnapshotFormat(LLSnapshotModel::ESnapshotFormat format);  	bool setSnapshotQuality(S32 quality, bool set_by_user = true); -	void setSnapshotBufferType(LLViewerWindow::ESnapshotType type) { mSnapshotBufferType = type; } +	void setSnapshotBufferType(LLSnapshotModel::ESnapshotLayerType type) { mSnapshotBufferType = type; }      void setAllowRenderUI(BOOL allow) { mAllowRenderUI = allow; }      void setAllowFullScreenPreview(BOOL allow) { mAllowFullScreenPreview = allow; }      void setFilter(std::string filter_name) { mFilterName = filter_name; } @@ -161,14 +161,14 @@ private:  	LLVector3d					mPosTakenGlobal;  	S32							mSnapshotQuality;  	S32							mDataSize; -    LLPanelSnapshot::ESnapshotType				mSnapshotType; -    LLFloaterSnapshotBase::ESnapshotFormat	mSnapshotFormat; +    LLSnapshotModel::ESnapshotType				mSnapshotType; +    LLSnapshotModel::ESnapshotFormat	mSnapshotFormat;  	BOOL						mSnapshotUpToDate;  	LLFrameTimer				mFallAnimTimer;  	LLVector3					mCameraPos;  	LLQuaternion				mCameraRot;  	BOOL						mSnapshotActive; -	LLViewerWindow::ESnapshotType mSnapshotBufferType; +	LLSnapshotModel::ESnapshotLayerType mSnapshotBufferType;      std::string                 mFilterName;  public: diff --git a/indra/newview/llsnapshotmodel.h b/indra/newview/llsnapshotmodel.h new file mode 100644 index 0000000000..71402fb5bc --- /dev/null +++ b/indra/newview/llsnapshotmodel.h @@ -0,0 +1,55 @@ +/** +* @file llsnapshotmodel.h +* @brief Snapshot model for storing snapshot data etc. +* +* $LicenseInfo:firstyear=2004&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2016, 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_LLSNAPSHOTMODEL_H +#define LL_LLSNAPSHOTMODEL_H + +class LLSnapshotModel +{ +public: +	enum ESnapshotType +	{ +		SNAPSHOT_POSTCARD, +		SNAPSHOT_TEXTURE, +		SNAPSHOT_LOCAL, +		SNAPSHOT_WEB +	}; + +	typedef enum e_snapshot_format +	{ +		SNAPSHOT_FORMAT_PNG, +		SNAPSHOT_FORMAT_JPEG, +		SNAPSHOT_FORMAT_BMP +	} ESnapshotFormat; + +	typedef enum +	{ +		SNAPSHOT_TYPE_COLOR, +		SNAPSHOT_TYPE_DEPTH +	} ESnapshotLayerType; +}; + +#endif // LL_LLSNAPSHOTMODEL_H diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index f0dafec240..f2b8a5ce06 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -779,12 +779,17 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti      if (uploadInfo->showUploadDialog())          LLUploadDialog::modalUploadFinished(); -    // Let the Snapshot floater know we have finished uploading a snapshot to inventory. +    // Let the Snapshot floater know we have finished uploading a snapshot to inventory      LLFloater* floater_snapshot = LLFloaterReg::findInstance("snapshot"); -    if (uploadInfo->getAssetType() == LLAssetType::AT_TEXTURE && floater_snapshot) +    if (uploadInfo->getAssetType() == LLAssetType::AT_TEXTURE && floater_snapshot && floater_snapshot->isShown())      {          floater_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", success).with("msg", "inventory")));      } +    LLFloater* floater_outfit_snapshot = LLFloaterReg::findInstance("outfit_snapshot"); +    if (uploadInfo->getAssetType() == LLAssetType::AT_TEXTURE && floater_outfit_snapshot && floater_outfit_snapshot->isShown()) +    { +        floater_outfit_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", success).with("msg", "inventory"))); +    }  }  //========================================================================= diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 0644e1b196..459397a0f7 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -37,6 +37,7 @@  #include "llfloatermap.h"  #include "llfloatermodelpreview.h"  #include "llfloatersnapshot.h" +#include "llfloateroutfitsnapshot.h"  #include "llimage.h"  #include "llimagebmp.h"  #include "llimagepng.h" @@ -507,9 +508,11 @@ class LLFileEnableCloseAllWindows : public view_listener_t  {  	bool handleEvent(const LLSD& userdata)  	{ -		LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance(); -		bool is_floater_snapshot_opened = floater_snapshot && floater_snapshot->isInVisibleChain(); -		bool open_children = gFloaterView->allChildrenClosed() && !is_floater_snapshot_opened; +		LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::getInstance(); +		LLFloaterOutfitSnapshot* floater_outfit_snapshot = LLFloaterOutfitSnapshot::getInstance(); +		bool is_floaters_snapshot_opened = floater_snapshot && floater_snapshot->isInVisibleChain() +			|| floater_outfit_snapshot && floater_outfit_snapshot->isInVisibleChain(); +		bool open_children = gFloaterView->allChildrenClosed() && !is_floaters_snapshot_opened;  		return !open_children;  	}  }; @@ -520,7 +523,12 @@ class LLFileCloseAllWindows : public view_listener_t  	{  		bool app_quitting = false;  		gFloaterView->closeAllChildren(app_quitting); -		LLFloaterSnapshot::getInstance()->closeFloater(app_quitting); +		LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::getInstance(); +		if (floater_snapshot) +			floater_snapshot->closeFloater(app_quitting); +		LLFloaterOutfitSnapshot* floater_outfit_snapshot = LLFloaterOutfitSnapshot::getInstance(); +		if (floater_outfit_snapshot) +			floater_outfit_snapshot->closeFloater(app_quitting);  		if (gMenuHolder) gMenuHolder->hideMenus();  		return true;  	} @@ -551,18 +559,18 @@ class LLFileTakeSnapshotToDisk : public view_listener_t  		{  			gViewerWindow->playSnapshotAnimAndSound();  			LLPointer<LLImageFormatted> formatted; -            LLFloaterSnapshotBase::ESnapshotFormat fmt = (LLFloaterSnapshotBase::ESnapshotFormat) gSavedSettings.getS32("SnapshotFormat"); +            LLSnapshotModel::ESnapshotFormat fmt = (LLSnapshotModel::ESnapshotFormat) gSavedSettings.getS32("SnapshotFormat");  			switch (fmt)  			{ -			case LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG: +			case LLSnapshotModel::SNAPSHOT_FORMAT_JPEG:  				formatted = new LLImageJPEG(gSavedSettings.getS32("SnapshotQuality"));  				break;  			default:  				LL_WARNS() << "Unknown local snapshot format: " << fmt << LL_ENDL; -			case LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG: +			case LLSnapshotModel::SNAPSHOT_FORMAT_PNG:  				formatted = new LLImagePNG;  				break; -			case LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP: +			case LLSnapshotModel::SNAPSHOT_FORMAT_BMP:  				formatted = new LLImageBMP;  				break;  			} diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index c17c50fd88..cd9ab3e672 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4364,7 +4364,7 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height)  	}  } -BOOL LLViewerWindow::saveSnapshot( const std::string& filepath, S32 image_width, S32 image_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) +BOOL LLViewerWindow::saveSnapshot(const std::string& filepath, S32 image_width, S32 image_height, BOOL show_ui, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type)  {  	LL_INFOS() << "Saving snapshot to: " << filepath << LL_ENDL; @@ -4403,7 +4403,7 @@ void LLViewerWindow::playSnapshotAnimAndSound()  	send_sound_trigger(LLUUID(gSavedSettings.getString("UISndSnapshot")), 1.0f);  } -BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) +BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type)  {  	return rawSnapshot(raw, preview_width, preview_height, FALSE, FALSE, show_ui, do_rebuild, type);  } @@ -4412,7 +4412,7 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p  // Since the required size might be bigger than the available screen, this method rerenders the scene in parts (called subimages) and copy  // the results over to the final raw image.  BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height,  -								 BOOL keep_window_aspect, BOOL is_texture, BOOL show_ui, BOOL do_rebuild, ESnapshotType type, S32 max_size) +	BOOL keep_window_aspect, BOOL is_texture, BOOL show_ui, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type, S32 max_size)  {  	if (!raw)  	{ @@ -4620,7 +4620,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei  						LLAppViewer::instance()->pingMainloopTimeout("LLViewerWindow::rawSnapshot");  					} -					if (type == SNAPSHOT_TYPE_COLOR) +					if (type == LLSnapshotModel::SNAPSHOT_TYPE_COLOR)  					{  						glReadPixels(  									 subimage_x_offset, out_y + subimage_y_offset, @@ -4629,7 +4629,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei  									 raw->getData() + output_buffer_offset  									 );  					} -					else // SNAPSHOT_TYPE_DEPTH +					else // LLSnapshotModel::SNAPSHOT_TYPE_DEPTH  					{  						LLPointer<LLImageRaw> depth_line_buffer = new LLImageRaw(read_width, 1, sizeof(GL_FLOAT)); // need to store floating point values  						glReadPixels( diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index ad06f00234..cdf5b686a7 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -46,6 +46,7 @@  #include "llhandle.h"  #include "llinitparam.h"  #include "lltrace.h" +#include "llsnapshotmodel.h"  #include <boost/function.hpp>  #include <boost/signals2.hpp> @@ -342,15 +343,11 @@ public:  	// snapshot functionality.  	// perhaps some of this should move to llfloatershapshot?  -MG -	typedef enum -	{ -		SNAPSHOT_TYPE_COLOR, -		SNAPSHOT_TYPE_DEPTH -	} ESnapshotType; -	BOOL			saveSnapshot(const std::string&  filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR); + +	BOOL			saveSnapshot(const std::string&  filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR);  	BOOL			rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect = TRUE, BOOL is_texture = FALSE, -								BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_SNAPSHOT_IMAGE_SIZE ); -	BOOL			thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) ; +		BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_SNAPSHOT_IMAGE_SIZE); +	BOOL			thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type);  	BOOL			isSnapshotLocSet() const { return ! sSnapshotDir.empty(); }  	void			resetSnapshotLoc() const { sSnapshotDir.clear(); }  	BOOL		    saveImageNumbered(LLImageFormatted *image, bool force_picker = false); diff --git a/indra/newview/llviewerwindowlistener.cpp b/indra/newview/llviewerwindowlistener.cpp index 1fe5fc9800..97b405c1d0 100644 --- a/indra/newview/llviewerwindowlistener.cpp +++ b/indra/newview/llviewerwindowlistener.cpp @@ -65,9 +65,9 @@ LLViewerWindowListener::LLViewerWindowListener(LLViewerWindow* llviewerwindow):  void LLViewerWindowListener::saveSnapshot(const LLSD& event) const  { -    typedef std::map<LLSD::String, LLViewerWindow::ESnapshotType> TypeMap; +    typedef std::map<LLSD::String, LLSnapshotModel::ESnapshotLayerType> TypeMap;      TypeMap types; -#define tp(name) types[#name] = LLViewerWindow::SNAPSHOT_TYPE_##name +#define tp(name) types[#name] = LLSnapshotModel::SNAPSHOT_TYPE_##name      tp(COLOR);      tp(DEPTH);  #undef  tp @@ -84,7 +84,7 @@ void LLViewerWindowListener::saveSnapshot(const LLSD& event) const      if (event.has("showui"))          showui = event["showui"].asBoolean();      bool rebuild(event["rebuild"]); // defaults to false -    LLViewerWindow::ESnapshotType type(LLViewerWindow::SNAPSHOT_TYPE_COLOR); +    LLSnapshotModel::ESnapshotLayerType type(LLSnapshotModel::SNAPSHOT_TYPE_COLOR);      if (event.has("type"))      {          TypeMap::const_iterator found = types.find(event["type"]); | 
