diff options
author | Eric M. Tulla (BigPapi) <tulla@lindenlab.com> | 2009-12-09 16:27:39 -0500 |
---|---|---|
committer | Eric M. Tulla (BigPapi) <tulla@lindenlab.com> | 2009-12-09 16:27:39 -0500 |
commit | dc8365ff00c5ae33f31d779efa23f7872ec368a7 (patch) | |
tree | 2168a36bff46b61344489bf0155ad6b8fdb7bcfd /indra/newview | |
parent | ed0596cfc7150021fdb37faa77fdf1b51859bc4b (diff) |
Fix for EXT-2703 & EXT-2708 - save texture as issues
Added save as to texture preview floater. Fixed behavior of save as (was only working for textures, not snapshots).
Removed advanced menu entry for save texture as (refused to work after multiple implementations).
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 46 | ||||
-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, 52 insertions, 52 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 74c1420cf3..4cebe68152 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,19 +968,19 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata) } if (command_name == "save_texture") { - LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); - if (!current_item) - { - return; - } + saveTexture(userdata); + } +} - 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(); - } +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) @@ -994,12 +1009,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); } return TRUE; } 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 ae8a1599a9..07e509d993 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1189,15 +1189,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 |