diff options
author | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
commit | ce28e056c20bf2723f565bbf464b87781ec248a2 (patch) | |
tree | ef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llpreviewnotecard.cpp | |
parent | Second Life viewer sources 1.19.1.4b (diff) | |
download | meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2 meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz |
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/llpreviewnotecard.cpp')
-rw-r--r-- | linden/indra/newview/llpreviewnotecard.cpp | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/linden/indra/newview/llpreviewnotecard.cpp b/linden/indra/newview/llpreviewnotecard.cpp index 6d7884b..9e4272f 100644 --- a/linden/indra/newview/llpreviewnotecard.cpp +++ b/linden/indra/newview/llpreviewnotecard.cpp | |||
@@ -58,7 +58,7 @@ | |||
58 | #include "llviewercontrol.h" // gSavedSettings | 58 | #include "llviewercontrol.h" // gSavedSettings |
59 | #include "llappviewer.h" // app_abort_quit() | 59 | #include "llappviewer.h" // app_abort_quit() |
60 | #include "lllineeditor.h" | 60 | #include "lllineeditor.h" |
61 | #include "llvieweruictrlfactory.h" | 61 | #include "lluictrlfactory.h" |
62 | 62 | ||
63 | ///---------------------------------------------------------------------------- | 63 | ///---------------------------------------------------------------------------- |
64 | /// Local function declarations, constants, enums, and typedefs | 64 | /// Local function declarations, constants, enums, and typedefs |
@@ -99,13 +99,13 @@ LLPreviewNotecard::LLPreviewNotecard(const std::string& name, | |||
99 | 99 | ||
100 | if (show_keep_discard) | 100 | if (show_keep_discard) |
101 | { | 101 | { |
102 | gUICtrlFactory->buildFloater(this,"floater_preview_notecard_keep_discard.xml"); | 102 | LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_notecard_keep_discard.xml"); |
103 | childSetAction("Keep",onKeepBtn,this); | 103 | childSetAction("Keep",onKeepBtn,this); |
104 | childSetAction("Discard",onDiscardBtn,this); | 104 | childSetAction("Discard",onDiscardBtn,this); |
105 | } | 105 | } |
106 | else | 106 | else |
107 | { | 107 | { |
108 | gUICtrlFactory->buildFloater(this,"floater_preview_notecard.xml"); | 108 | LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_notecard.xml"); |
109 | childSetAction("Save",onClickSave,this); | 109 | childSetAction("Save",onClickSave,this); |
110 | 110 | ||
111 | if( mAssetID.isNull() ) | 111 | if( mAssetID.isNull() ) |
@@ -136,7 +136,7 @@ LLPreviewNotecard::LLPreviewNotecard(const std::string& name, | |||
136 | 136 | ||
137 | setTitle(title); | 137 | setTitle(title); |
138 | 138 | ||
139 | LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Notecard Editor"); | 139 | LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); |
140 | 140 | ||
141 | if (editor) | 141 | if (editor) |
142 | { | 142 | { |
@@ -154,7 +154,7 @@ LLPreviewNotecard::~LLPreviewNotecard() | |||
154 | 154 | ||
155 | BOOL LLPreviewNotecard::postBuild() | 155 | BOOL LLPreviewNotecard::postBuild() |
156 | { | 156 | { |
157 | LLViewerTextEditor *ed = (LLViewerTextEditor *)gUICtrlFactory->getTextEditorByName(this, "Notecard Editor"); | 157 | LLViewerTextEditor *ed = getChild<LLViewerTextEditor>("Notecard Editor"); |
158 | if (ed) | 158 | if (ed) |
159 | { | 159 | { |
160 | ed->setNotecardInfo(mNotecardItemID, mObjectID); | 160 | ed->setNotecardInfo(mNotecardItemID, mObjectID); |
@@ -181,7 +181,7 @@ bool LLPreviewNotecard::saveItem(LLPointer<LLInventoryItem>* itemptr) | |||
181 | void LLPreviewNotecard::setEnabled( BOOL enabled ) | 181 | void LLPreviewNotecard::setEnabled( BOOL enabled ) |
182 | { | 182 | { |
183 | 183 | ||
184 | LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Notecard Editor"); | 184 | LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); |
185 | 185 | ||
186 | childSetEnabled("Notecard Editor", enabled); | 186 | childSetEnabled("Notecard Editor", enabled); |
187 | childSetVisible("lock", !enabled); | 187 | childSetVisible("lock", !enabled); |
@@ -197,7 +197,7 @@ void LLPreviewNotecard::draw() | |||
197 | 197 | ||
198 | //childSetFocus("Save", FALSE); | 198 | //childSetFocus("Save", FALSE); |
199 | 199 | ||
200 | LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Notecard Editor"); | 200 | LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); |
201 | BOOL script_changed = !editor->isPristine(); | 201 | BOOL script_changed = !editor->isPristine(); |
202 | 202 | ||
203 | childSetEnabled("Save", script_changed && getEnabled()); | 203 | childSetEnabled("Save", script_changed && getEnabled()); |
@@ -206,24 +206,21 @@ void LLPreviewNotecard::draw() | |||
206 | } | 206 | } |
207 | 207 | ||
208 | // virtual | 208 | // virtual |
209 | BOOL LLPreviewNotecard::handleKeyHere(KEY key, MASK mask, | 209 | BOOL LLPreviewNotecard::handleKeyHere(KEY key, MASK mask) |
210 | BOOL called_from_parent) | ||
211 | { | 210 | { |
212 | if(getVisible() && getEnabled()) | 211 | if(('S' == key) && (MASK_CONTROL == (mask & MASK_CONTROL))) |
213 | { | 212 | { |
214 | if(('S' == key) && (MASK_CONTROL == (mask & MASK_CONTROL))) | 213 | saveIfNeeded(); |
215 | { | 214 | return TRUE; |
216 | saveIfNeeded(); | ||
217 | return TRUE; | ||
218 | } | ||
219 | } | 215 | } |
220 | return LLPreview::handleKeyHere(key, mask, called_from_parent); | 216 | |
217 | return LLPreview::handleKeyHere(key, mask); | ||
221 | } | 218 | } |
222 | 219 | ||
223 | // virtual | 220 | // virtual |
224 | BOOL LLPreviewNotecard::canClose() | 221 | BOOL LLPreviewNotecard::canClose() |
225 | { | 222 | { |
226 | LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Notecard Editor"); | 223 | LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); |
227 | 224 | ||
228 | if(mForceClose || editor->isPristine()) | 225 | if(mForceClose || editor->isPristine()) |
229 | { | 226 | { |
@@ -242,7 +239,7 @@ BOOL LLPreviewNotecard::canClose() | |||
242 | 239 | ||
243 | const LLInventoryItem* LLPreviewNotecard::getDragItem() | 240 | const LLInventoryItem* LLPreviewNotecard::getDragItem() |
244 | { | 241 | { |
245 | LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Notecard Editor"); | 242 | LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); |
246 | 243 | ||
247 | if(editor) | 244 | if(editor) |
248 | { | 245 | { |
@@ -254,9 +251,7 @@ const LLInventoryItem* LLPreviewNotecard::getDragItem() | |||
254 | bool LLPreviewNotecard::hasEmbeddedInventory() | 251 | bool LLPreviewNotecard::hasEmbeddedInventory() |
255 | { | 252 | { |
256 | LLViewerTextEditor* editor = NULL; | 253 | LLViewerTextEditor* editor = NULL; |
257 | editor = LLViewerUICtrlFactory::getViewerTextEditorByName( | 254 | editor = getChild<LLViewerTextEditor>("Notecard Editor"); |
258 | this, | ||
259 | "Notecard Editor"); | ||
260 | if (!editor) return false; | 255 | if (!editor) return false; |
261 | return editor->hasEmbeddedInventory(); | 256 | return editor->hasEmbeddedInventory(); |
262 | } | 257 | } |
@@ -271,7 +266,7 @@ void LLPreviewNotecard::loadAsset() | |||
271 | { | 266 | { |
272 | // request the asset. | 267 | // request the asset. |
273 | const LLInventoryItem* item = getItem(); | 268 | const LLInventoryItem* item = getItem(); |
274 | LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Notecard Editor"); | 269 | LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); |
275 | 270 | ||
276 | if (!editor) | 271 | if (!editor) |
277 | return; | 272 | return; |
@@ -377,7 +372,7 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, | |||
377 | buffer[file_length] = 0; | 372 | buffer[file_length] = 0; |
378 | 373 | ||
379 | 374 | ||
380 | LLViewerTextEditor* previewEditor = LLViewerUICtrlFactory::getViewerTextEditorByName(preview, "Notecard Editor"); | 375 | LLViewerTextEditor* previewEditor = preview->getChild<LLViewerTextEditor>("Notecard Editor"); |
381 | 376 | ||
382 | if( (file_length > 19) && !strncmp( buffer, "Linden text version", 19 ) ) | 377 | if( (file_length > 19) && !strncmp( buffer, "Linden text version", 19 ) ) |
383 | { | 378 | { |
@@ -403,10 +398,7 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, | |||
403 | } | 398 | } |
404 | else | 399 | else |
405 | { | 400 | { |
406 | if( gViewerStats ) | 401 | LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); |
407 | { | ||
408 | gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); | ||
409 | } | ||
410 | 402 | ||
411 | if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || | 403 | if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || |
412 | LL_ERR_FILE_EMPTY == status) | 404 | LL_ERR_FILE_EMPTY == status) |
@@ -475,7 +467,7 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem) | |||
475 | } | 467 | } |
476 | 468 | ||
477 | 469 | ||
478 | LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Notecard Editor"); | 470 | LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); |
479 | 471 | ||
480 | if(!editor->isPristine()) | 472 | if(!editor->isPristine()) |
481 | { | 473 | { |
@@ -592,7 +584,7 @@ void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data | |||
592 | // Perform item copy to inventory | 584 | // Perform item copy to inventory |
593 | if (info->mCopyItem.notNull()) | 585 | if (info->mCopyItem.notNull()) |
594 | { | 586 | { |
595 | LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(info->mSelf, "Notecard Editor"); | 587 | LLViewerTextEditor* editor = info->mSelf->getChild<LLViewerTextEditor>("Notecard Editor"); |
596 | if (editor) | 588 | if (editor) |
597 | { | 589 | { |
598 | editor->copyInventory(info->mCopyItem); | 590 | editor->copyInventory(info->mCopyItem); |