diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 48 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.h | 2 | ||||
-rw-r--r-- | indra/newview/llpreviewtexture.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llpreviewtexture.h | 3 | ||||
-rw-r--r-- | indra/newview/llviewermenufile.cpp | 26 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_preview_texture.xml | 9 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 9 |
7 files changed, 53 insertions, 53 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 21627e84ff..8f71c6f1ee 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -863,7 +863,6 @@ void LLPanelMainInventory::initListCommandsHandlers() mEnableCallbackRegistrar.add("Inventory.GearDefault.Enable", boost::bind(&LLPanelMainInventory::isActionEnabled, this, _2)); mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); mMenuAdd = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_add.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - } void LLPanelMainInventory::updateListCommands() @@ -909,6 +908,22 @@ void LLPanelMainInventory::onClipboardAction(const LLSD& userdata) getActivePanel()->getRootFolder()->doToSelected(getActivePanel()->getModel(),command_name); } +void LLPanelMainInventory::saveTexture(const LLSD& userdata) +{ + LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); + if (!current_item) + { + return; + } + + const LLUUID& item_id = current_item->getListener()->getUUID(); + LLPreviewTexture* preview_texture = LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", LLSD(item_id), TAKE_FOCUS_YES); + if (preview_texture) + { + preview_texture->openToSave(); + } +} + void LLPanelMainInventory::onCustomAction(const LLSD& userdata) { if (!isActionEnabled(userdata)) @@ -953,18 +968,7 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata) } if (command_name == "save_texture") { - LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); - if (!current_item) - { - return; - } - - const LLUUID& item_id = current_item->getListener()->getUUID(); - LLPreviewTexture* preview_texture = LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", LLSD(item_id), TAKE_FOCUS_YES); - if (preview_texture) - { - preview_texture->openToSave(); - } + saveTexture(userdata); } // This doesn't currently work, since the viewer can't change an assetID an item. if (command_name == "regenerate_link") @@ -1008,6 +1012,17 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata) } } +bool LLPanelMainInventory::isSaveTextureEnabled(const LLSD& userdata) +{ + LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); + if (current_item) + { + LLInventoryType::EType curr_type = current_item->getListener()->getInventoryType(); + return (curr_type == LLInventoryType::IT_TEXTURE || curr_type == LLInventoryType::IT_SNAPSHOT); + } + return false; +} + BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) { const std::string command_name = userdata.asString(); @@ -1035,12 +1050,7 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) } if (command_name == "save_texture") { - LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); - if (current_item) - { - return (current_item->getListener()->getInventoryType() == LLInventoryType::IT_TEXTURE); - } - return FALSE; + return isSaveTextureEnabled(userdata); } if (command_name == "find_original") { diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index ae78d3bec8..92443df369 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -110,6 +110,8 @@ protected: void doCreate(const LLSD& userdata); void resetFilters(); void setSortBy(const LLSD& userdata); + void saveTexture(const LLSD& userdata); + bool isSaveTextureEnabled(const LLSD& userdata); private: LLFloaterInventoryFinder* getFinder(); diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 698f6152b4..8fa147f201 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -145,6 +145,8 @@ BOOL LLPreviewTexture::postBuild() childSetVisible("Discard", false); } + childSetAction("save_tex_btn", LLPreviewTexture::onSaveAsBtn, this); + if (!mCopyToInv) { const LLInventoryItem* item = getItem(); @@ -164,6 +166,13 @@ BOOL LLPreviewTexture::postBuild() return LLPreview::postBuild(); } +// static +void LLPreviewTexture::onSaveAsBtn(void* data) +{ + LLPreviewTexture* self = (LLPreviewTexture*)data; + self->saveAs(); +} + void LLPreviewTexture::draw() { if (mUpdateDimensions) diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h index 9b3c91d831..980aecee6d 100644 --- a/indra/newview/llpreviewtexture.h +++ b/indra/newview/llpreviewtexture.h @@ -58,7 +58,6 @@ public: virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); virtual void onFocusReceived(); - static void saveToFile(void* userdata); static void onFileLoadedForSave( BOOL success, LLViewerFetchedTexture *src_vi, @@ -68,6 +67,8 @@ public: BOOL final, void* userdata ); void openToSave(); + + static void onSaveAsBtn(void* data); protected: void init(); /* virtual */ BOOL postBuild(); diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 4b0dc8f668..a1c3806b27 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -71,15 +71,6 @@ // system libraries #include <boost/tokenizer.hpp> -class LLFileEnableSaveAs : public view_listener_t -{ - bool handleEvent(const LLSD& userdata) - { - bool new_value = gFloaterView->getFrontmost() && gFloaterView->getFrontmost()->canSaveAs(); - return new_value; - } -}; - class LLFileEnableUpload : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -386,19 +377,6 @@ class LLFileCloseAllWindows : public view_listener_t } }; -class LLFileSaveTexture : public view_listener_t -{ - bool handleEvent(const LLSD& userdata) - { - LLFloater* top = gFloaterView->getFrontmost(); - if (top) - { - top->saveAs(); - } - return true; - } -}; - class LLFileTakeSnapshotToDisk : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -1050,10 +1028,10 @@ void init_menu_file() view_listener_t::addCommit(new LLFileCloseAllWindows(), "File.CloseAllWindows"); view_listener_t::addEnable(new LLFileEnableCloseWindow(), "File.EnableCloseWindow"); view_listener_t::addEnable(new LLFileEnableCloseAllWindows(), "File.EnableCloseAllWindows"); - view_listener_t::addCommit(new LLFileSaveTexture(), "File.SaveTexture"); view_listener_t::addCommit(new LLFileTakeSnapshotToDisk(), "File.TakeSnapshotToDisk"); view_listener_t::addCommit(new LLFileQuit(), "File.Quit"); view_listener_t::addEnable(new LLFileEnableUpload(), "File.EnableUpload"); - view_listener_t::addEnable(new LLFileEnableSaveAs(), "File.EnableSaveAs"); + + // "File.SaveTexture" moved to llpanelmaininventory so that it can be properly handled. } diff --git a/indra/newview/skins/default/xui/en/floater_preview_texture.xml b/indra/newview/skins/default/xui/en/floater_preview_texture.xml index 52a19ac6b3..054f3be70a 100644 --- a/indra/newview/skins/default/xui/en/floater_preview_texture.xml +++ b/indra/newview/skins/default/xui/en/floater_preview_texture.xml @@ -61,6 +61,15 @@ name="Discard" top_delta="0" width="100" /> + <button + follows="left|bottom" + height="22" + label="Save As" + layout="topleft" + left_pad="5" + name="save_tex_btn" + top_delta="0" + width="100" /> <text type="string" length="1" diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 861b0de2cf..5da88ff171 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1200,15 +1200,6 @@ function="ToggleControl" parameter="CompressSnapshotsToDisk" /> </menu_item_check> - <menu_item_call - label="Save Texture As" - layout="topleft" - name="Save Texture As"> - <menu_item_call.on_click - function="File.SaveTexture" /> - <menu_item_call.on_enable - function="File.EnableSaveAs" /> - </menu_item_call> <menu_item_separator layout="topleft" /> <menu |