aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpreview.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llpreview.h
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llpreview.h158
1 files changed, 158 insertions, 0 deletions
diff --git a/linden/indra/newview/llpreview.h b/linden/indra/newview/llpreview.h
new file mode 100644
index 0000000..418c797
--- /dev/null
+++ b/linden/indra/newview/llpreview.h
@@ -0,0 +1,158 @@
1/**
2 * @file llpreview.h
3 * @brief LLPreview class definition
4 *
5 * Copyright (c) 2002-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#ifndef LL_LLPREVIEW_H
29#define LL_LLPREVIEW_H
30
31#include "llfloater.h"
32#include "llresizehandle.h"
33#include "llmap.h"
34#include "lluuid.h"
35#include "llviewerinventory.h"
36#include "lltabcontainer.h"
37#include "lllineeditor.h"
38
39class LLLineEditor;
40class LLRadioGroup;
41class LLPreview;
42
43class LLMultiPreview : public LLMultiFloater
44{
45public:
46 LLMultiPreview(const LLRect& rect);
47
48 /*virtual*/void open();
49 /*virtual*/void tabOpen(LLFloater* opened_floater, bool from_click);
50};
51
52class LLPreview : public LLFloater
53{
54public:
55 typedef enum e_asset_status
56 {
57 PREVIEW_ASSET_ERROR,
58 PREVIEW_ASSET_UNLOADED,
59 PREVIEW_ASSET_LOADING,
60 PREVIEW_ASSET_LOADED
61 } EAssetStatus;
62public:
63 // Used for XML-based construction.
64 LLPreview(const std::string& name);
65 LLPreview(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_uuid, const LLUUID& object_uuid, BOOL allow_resize = FALSE, S32 min_width = 0, S32 min_height = 0 );
66 virtual ~LLPreview();
67
68 void setItemID(const LLUUID& item_id);
69 void setObjectID(const LLUUID& object_id);
70 void setSourceID(const LLUUID& source_id);
71 LLViewerInventoryItem* getItem() const;
72
73 static LLPreview* find(const LLUUID& item_uuid);
74 static LLPreview* show(const LLUUID& item_uuid, BOOL take_focus = TRUE );
75 static void hide(const LLUUID& item_uuid);
76 static void rename(const LLUUID& item_uuid, const std::string& new_name);
77 static bool save(const LLUUID& item_uuid, LLPointer<LLInventoryItem>* itemptr);
78
79 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
80 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
81 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
82 virtual void open();
83 virtual bool saveItem(LLPointer<LLInventoryItem>* itemptr);
84
85 void setAuxItem( const LLInventoryItem* item )
86 {
87 if ( mAuxItem )
88 mAuxItem->copy(item);
89 }
90
91 static void onBtnCopyToInv(void* userdata);
92
93 void addKeepDiscardButtons();
94 static void onKeepBtn(void* data);
95 static void onDiscardBtn(void* data);
96
97 virtual void loadAsset() { mAssetStatus = PREVIEW_ASSET_LOADED; }
98 virtual EAssetStatus getAssetStatus() { return mAssetStatus;}
99
100 static LLPreview* getFirstPreviewForSource(const LLUUID& source_id);
101 void setNotecardInfo(const LLUUID& notecard_inv_id, const LLUUID& object_id)
102 { mNotecardInventoryID = notecard_inv_id; mObjectID = object_id; }
103
104protected:
105 virtual void onCommit();
106
107 void addDescriptionUI();
108
109 static void onText(LLUICtrl*, void* userdata);
110 static void onRadio(LLUICtrl*, void* userdata);
111
112
113protected:
114 LLUUID mItemUUID;
115 LLUUID mSourceID;
116
117 // mObjectID will have a value if it is associated with a task in
118 // the world, and will be == LLUUID::null if it's in the agent
119 // inventory.
120 LLUUID mObjectUUID;
121
122 LLRect mClientRect;
123
124 LLPointer<LLInventoryItem> mAuxItem; // HACK!
125 LLButton* mCopyToInvBtn;
126
127 // Close without saving changes
128 BOOL mForceClose;
129
130 // When closing springs a "Want to save?" dialog, we want
131 // to keep the preview open until the save completes.
132 BOOL mCloseAfterSave;
133
134 EAssetStatus mAssetStatus;
135
136 typedef std::map<LLUUID, LLPreview*> preview_map_t;
137 typedef std::multimap<LLUUID, LLViewHandle> preview_multimap_t;
138
139 static preview_multimap_t sPreviewsBySource;
140 static preview_map_t sInstances;
141 LLUUID mNotecardInventoryID;
142 LLUUID mObjectID;
143};
144
145
146const S32 PREVIEW_BORDER = 4;
147const S32 PREVIEW_PAD = 5;
148const S32 PREVIEW_BUTTON_WIDTH = 100;
149
150const S32 PREVIEW_LINE_HEIGHT = 19;
151const S32 PREVIEW_CLOSE_BOX_SIZE = 16;
152const S32 PREVIEW_BORDER_WIDTH = 2;
153const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PREVIEW_BORDER_WIDTH;
154const S32 PREVIEW_VPAD = 2;
155const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE;
156const S32 PREVIEW_HEADER_SIZE = 2*PREVIEW_LINE_HEIGHT + 2 * PREVIEW_VPAD;
157
158#endif // LL_LLPREVIEW_H