diff options
| author | brad kittenbrink <brad@lindenlab.com> | 2009-07-01 19:03:31 -0400 | 
|---|---|---|
| committer | brad kittenbrink <brad@lindenlab.com> | 2009-07-01 19:03:31 -0400 | 
| commit | 8b3cd39a45e288b8383a5e7953f68458637cb719 (patch) | |
| tree | c96e28df4ca81d65e8982245f1c1327d488de511 | |
| parent | f94d959e84cdcc552f6f5a39ee08a85c1e52d858 (diff) | |
| parent | 7e35f971442e5667c0f8732db31a8b8189f0f9f4 (diff) | |
Merged in windows LL_COMMON_API dll linkage fixes.
| -rw-r--r-- | indra/llcommon/lleventdispatcher.h | 2 | ||||
| -rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | indra/newview/llappviewerlistener.cpp | 13 | ||||
| -rw-r--r-- | indra/newview/llappviewerlistener.h | 1 | ||||
| -rw-r--r-- | indra/newview/llviewerwindow.cpp | 8 | ||||
| -rw-r--r-- | indra/newview/llviewerwindow.h | 4 | ||||
| -rw-r--r-- | indra/newview/llviewerwindowlistener.cpp | 78 | ||||
| -rw-r--r-- | indra/newview/llviewerwindowlistener.h | 34 | 
8 files changed, 127 insertions, 15 deletions
| diff --git a/indra/llcommon/lleventdispatcher.h b/indra/llcommon/lleventdispatcher.h index 155fe0648f..ef83ebabc1 100644 --- a/indra/llcommon/lleventdispatcher.h +++ b/indra/llcommon/lleventdispatcher.h @@ -114,6 +114,8 @@ class LL_COMMON_API LLDispatchListener: public LLEventDispatcher  public:
      LLDispatchListener(const std::string& pumpname, const std::string& key);
 +    std::string getPumpName() const { return mPump.getName(); }
 +
  private:
      bool process(const LLSD& event);
 diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 20c59faae0..53a59031ed 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -415,6 +415,7 @@ set(viewer_SOURCE_FILES      llviewerthrottle.cpp      llviewervisualparam.cpp      llviewerwindow.cpp +    llviewerwindowlistener.cpp      llvlcomposition.cpp      llvlmanager.cpp      llvoavatar.cpp @@ -835,6 +836,7 @@ set(viewer_HEADER_FILES      llviewerthrottle.h      llviewervisualparam.h      llviewerwindow.h +    llviewerwindowlistener.h      llvlcomposition.h      llvlmanager.h      llvoavatar.h diff --git a/indra/newview/llappviewerlistener.cpp b/indra/newview/llappviewerlistener.cpp index befebae88e..a8c98b17a7 100644 --- a/indra/newview/llappviewerlistener.cpp +++ b/indra/newview/llappviewerlistener.cpp @@ -18,7 +18,6 @@  // external library headers  // other Linden headers  #include "llappviewer.h" -#include "llviewercontrol.h"  LLAppViewerListener::LLAppViewerListener(const std::string& pumpname, LLAppViewer* llappviewer):      LLDispatchListener(pumpname, "op"), @@ -26,21 +25,9 @@ LLAppViewerListener::LLAppViewerListener(const std::string& pumpname, LLAppViewe  {      // add() every method we want to be able to invoke via this event API.      add("requestQuit", &LLAppViewerListener::requestQuit); -    add("setSetting", &LLAppViewerListener::setSetting);  }  void LLAppViewerListener::requestQuit(const LLSD& event) const  {      mAppViewer->requestQuit();  } - -void LLAppViewerListener::setSetting(const LLSD & event) const -{ -	std::string control_name = event["name"].asString(); -	if (gSavedSettings.controlExists(control_name)) -	{ -		LLControlVariable* control = gSavedSettings.getControl(control_name); - -		control->set(event["value"]); -	} -} diff --git a/indra/newview/llappviewerlistener.h b/indra/newview/llappviewerlistener.h index ff63b69c13..ab17dd1d90 100644 --- a/indra/newview/llappviewerlistener.h +++ b/indra/newview/llappviewerlistener.h @@ -27,7 +27,6 @@ public:  private:      void requestQuit(const LLSD& event) const; -    void setSetting(const LLSD & event) const;      LLAppViewer* mAppViewer;  }; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 5c9f8af216..dcd37d85da 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -30,6 +30,10 @@   * $/LicenseInfo$   */ +#if defined(LL_WINDOWS) +#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally +#endif +  #include "llviewerprecompiledheaders.h"  // system library includes @@ -189,6 +193,7 @@  #include "llfloaternotificationsconsole.h"  #include "llnearbychathistory.h" +#include "llviewerwindowlistener.h"  #if LL_WINDOWS  #include <tchar.h> // For Unicode conversion methods @@ -1262,7 +1267,8 @@ LLViewerWindow::LLViewerWindow(  	mResDirty(false),  	mStatesDirty(false),  	mIsFullscreenChecked(false), -	mCurrResolutionIndex(0) +	mCurrResolutionIndex(0), +    mViewerWindowListener(new LLViewerWindowListener("LLViewerWindow", this))  {  	LLNotificationChannel::buildChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alert"));  	LLNotificationChannel::buildChannel("VW_alertmodal", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alertmodal")); diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index eae1bf0343..b729889631 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -50,6 +50,7 @@  #include "llnotifications.h"  #include "llmousehandler.h"  #include "llcursortypes.h" +#include <boost/scoped_ptr.hpp>  class LLView;  class LLViewerObject; @@ -62,6 +63,7 @@ class LLImageRaw;  class LLHUDIcon;  class LLWindow;  class LLRootView; +class LLViewerWindowListener;  #define PICK_HALF_WIDTH 5  #define PICK_DIAMETER (2 * PICK_HALF_WIDTH + 1) @@ -450,6 +452,8 @@ protected:  	bool			mIsFullscreenChecked; // Did the user check the fullscreen checkbox in the display settings  	U32			mCurrResolutionIndex; +    boost::scoped_ptr<LLViewerWindowListener> mViewerWindowListener; +  protected:  	static std::string sSnapshotBaseName;  	static std::string sSnapshotDir; diff --git a/indra/newview/llviewerwindowlistener.cpp b/indra/newview/llviewerwindowlistener.cpp new file mode 100644 index 0000000000..ad90b1d2ab --- /dev/null +++ b/indra/newview/llviewerwindowlistener.cpp @@ -0,0 +1,78 @@ +/** + * @file   llviewerwindowlistener.cpp + * @author Nat Goodspeed + * @date   2009-06-30 + * @brief  Implementation for llviewerwindowlistener. + *  + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +// Precompiled header +#include "llviewerprecompiledheaders.h" +// associated header +#include "llviewerwindowlistener.h" +// STL headers +#include <map> +// std headers +// external library headers +// other Linden headers +#include "llviewerwindow.h" + +LLViewerWindowListener::LLViewerWindowListener(const std::string& pumpname, LLViewerWindow* llviewerwindow): +    LLDispatchListener(pumpname, "op"), +    mViewerWindow(llviewerwindow) +{ +    // add() every method we want to be able to invoke via this event API. +    LLSD saveSnapshotArgs; +    saveSnapshotArgs["filename"] = LLSD::String(); +    saveSnapshotArgs["reply"] = LLSD::String(); +    // The following are optional, so don't build them into required prototype. +//  saveSnapshotArgs["width"] = LLSD::Integer(); +//  saveSnapshotArgs["height"] = LLSD::Integer(); +//  saveSnapshotArgs["showui"] = LLSD::Boolean(); +//  saveSnapshotArgs["rebuild"] = LLSD::Boolean(); +//  saveSnapshotArgs["type"] = LLSD::String(); +    add("saveSnapshot", &LLViewerWindowListener::saveSnapshot, saveSnapshotArgs); +} + +void LLViewerWindowListener::saveSnapshot(const LLSD& event) const +{ +    LLReqID reqid(event); +    typedef std::map<LLSD::String, LLViewerWindow::ESnapshotType> TypeMap; +    TypeMap types; +#define tp(name) types[#name] = LLViewerWindow::SNAPSHOT_TYPE_##name +    tp(COLOR); +    tp(DEPTH); +    tp(OBJECT_ID); +#undef  tp +    // Our add() call should ensure that the incoming LLSD does in fact +    // contain our required arguments. Deal with the optional ones. +    S32 width (mViewerWindow->getWindowDisplayWidth()); +    S32 height(mViewerWindow->getWindowDisplayHeight()); +    if (event.has("width")) +        width = event["width"].asInteger(); +    if (event.has("height")) +        height = event["height"].asInteger(); +    // showui defaults to true, requiring special treatment +    bool showui = true; +    if (event.has("showui")) +        showui = event["showui"].asBoolean(); +    bool rebuild(event["rebuild"]); // defaults to false +    LLViewerWindow::ESnapshotType type(LLViewerWindow::SNAPSHOT_TYPE_COLOR); +    if (event.has("type")) +    { +        TypeMap::const_iterator found = types.find(event["type"]); +        if (found == types.end()) +        { +            LL_ERRS("LLViewerWindowListener") << "LLViewerWindowListener::saveSnapshot(): " +                                              << "unrecognized type " << event["type"] << LL_ENDL; +        } +        type = found->second; +    } +    bool ok = mViewerWindow->saveSnapshot(event["filename"], width, height, showui, rebuild, type); +    LLSD response(reqid.makeResponse()); +    response["ok"] = ok; +    LLEventPumps::instance().obtain(event["reply"]).post(response); +} diff --git a/indra/newview/llviewerwindowlistener.h b/indra/newview/llviewerwindowlistener.h new file mode 100644 index 0000000000..f756a5310f --- /dev/null +++ b/indra/newview/llviewerwindowlistener.h @@ -0,0 +1,34 @@ +/** + * @file   llviewerwindowlistener.h + * @author Nat Goodspeed + * @date   2009-06-30 + * @brief  Event API for subset of LLViewerWindow methods + *  + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLVIEWERWINDOWLISTENER_H) +#define LL_LLVIEWERWINDOWLISTENER_H + +#include "lleventdispatcher.h" + +class LLViewerWindow; +class LLSD; + +/// Listen on an LLEventPump with specified name for LLViewerWindow request events. +class LLViewerWindowListener: public LLDispatchListener +{ +public: +    /// Specify the pump name on which to listen, and bind the LLViewerWindow +    /// instance to use (e.g. gViewerWindow). +    LLViewerWindowListener(const std::string& pumpname, LLViewerWindow* llviewerwindow); + +private: +    void saveSnapshot(const LLSD& event) const; + +    LLViewerWindow* mViewerWindow; +}; + +#endif /* ! defined(LL_LLVIEWERWINDOWLISTENER_H) */ | 
