diff options
| author | Rye <rye@alchemyviewer.org> | 2025-08-27 22:36:55 -0400 | 
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-09-02 19:50:57 +0300 | 
| commit | 0fe641a3f20997c970112df7d188510993733338 (patch) | |
| tree | 6ccdecb536a1f2059dd9b550f9ce59ec81a9ae40 | |
| parent | db69b09d82e29ea98c216d84d394f602a72b8f93 (diff) | |
Changes to support dullahan 1.21 undo/redo/delete/select all edit handlers
| -rw-r--r-- | indra/llplugin/llpluginclassmedia.cpp | 50 | ||||
| -rw-r--r-- | indra/llplugin/llpluginclassmedia.h | 18 | ||||
| -rw-r--r-- | indra/media_plugins/cef/media_plugin_cef.cpp | 59 | ||||
| -rw-r--r-- | indra/newview/llmediactrl.cpp | 10 | ||||
| -rw-r--r-- | indra/newview/llmediactrl.h | 1 | ||||
| -rw-r--r-- | indra/newview/llviewermedia.cpp | 80 | ||||
| -rw-r--r-- | indra/newview/llviewermedia.h | 12 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/menu_media_ctrl.xml | 8 | 
8 files changed, 236 insertions, 2 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index 8a356da93a..77a4b08af5 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -132,9 +132,13 @@ void LLPluginClassMedia::reset()      mLastMouseY = 0;      mStatus = LLPluginClassMediaOwner::MEDIA_NONE;      mSleepTime = 1.0f / 100.0f; +    mCanUndo = false; +    mCanRedo = false;      mCanCut = false;      mCanCopy = false;      mCanPaste = false; +    mCanDoDelete = false; +    mCanSelectAll = false;      mMediaName.clear();      mMediaDescription.clear();      mBackgroundColor = LLColor4(1.0f, 1.0f, 1.0f, 1.0f); @@ -907,6 +911,18 @@ void LLPluginClassMedia::sendAuthResponse(bool ok, const std::string &username,      sendMessage(message);  } +void LLPluginClassMedia::undo() +{ +    LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "edit_undo"); +    sendMessage(message); +} + +void LLPluginClassMedia::redo() +{ +    LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "edit_redo"); +    sendMessage(message); +} +  void LLPluginClassMedia::cut()  {      LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "edit_cut"); @@ -925,6 +941,24 @@ void LLPluginClassMedia::paste()      sendMessage(message);  } +void LLPluginClassMedia::doDelete() +{ +    LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "edit_delete"); +    sendMessage(message); +} + +void LLPluginClassMedia::selectAll() +{ +    LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "edit_select_all"); +    sendMessage(message); +} + +void LLPluginClassMedia::showPageSource() +{ +    LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "edit_show_source"); +    sendMessage(message); +} +  void LLPluginClassMedia::setUserDataPath(const std::string &user_data_path_cache,                                           const std::string &username,                                           const std::string &user_data_path_cef_log) @@ -1178,6 +1212,14 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)          }          else if(message_name == "edit_state")          { +            if(message.hasValue("undo")) +            { +                mCanUndo = message.getValueBoolean("undo"); +            } +            if(message.hasValue("redo")) +            { +                mCanRedo = message.getValueBoolean("redo"); +            }              if(message.hasValue("cut"))              {                  mCanCut = message.getValueBoolean("cut"); @@ -1190,6 +1232,14 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)              {                  mCanPaste = message.getValueBoolean("paste");              } +            if (message.hasValue("delete")) +            { +                mCanDoDelete = message.getValueBoolean("delete"); +            } +            if (message.hasValue("select_all")) +            { +                mCanSelectAll = message.getValueBoolean("select_all"); +            }          }          else if(message_name == "name_text")          { diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index d74b790d8f..292d934419 100644 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -201,6 +201,12 @@ public:      LLPluginClassMediaOwner::EMediaStatus getStatus() const { return mStatus; } +    void    undo(); +    bool    canUndo() const { return mCanUndo; }; + +    void    redo(); +    bool    canRedo() const { return mCanRedo; }; +      void    cut();      bool    canCut() const { return mCanCut; }; @@ -210,6 +216,14 @@ public:      void    paste();      bool    canPaste() const { return mCanPaste; }; +    void    doDelete(); +    bool    canDoDelete() const { return mCanDoDelete; }; + +    void    selectAll(); +    bool    canSelectAll() const { return mCanSelectAll; }; + +    void    showPageSource(); +      // These can be called before init(), and they will be queued and sent before the media init message.      void    setUserDataPath(const std::string &user_data_path_cache, const std::string &username, const std::string &user_data_path_cef_log);      void    setLanguageCode(const std::string &language_code); @@ -419,9 +433,13 @@ protected:      F64             mSleepTime; +    bool            mCanUndo; +    bool            mCanRedo;      bool            mCanCut;      bool            mCanCopy;      bool            mCanPaste; +    bool            mCanDoDelete; +    bool            mCanSelectAll;      std::string     mMediaName;      std::string     mMediaDescription; diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp index 52df4a9685..caf804f915 100644 --- a/indra/media_plugins/cef/media_plugin_cef.cpp +++ b/indra/media_plugins/cef/media_plugin_cef.cpp @@ -106,9 +106,13 @@ private:      std::string mAuthUsername;      std::string mAuthPassword;      bool mAuthOK; +    bool mCanUndo; +    bool mCanRedo;      bool mCanCut;      bool mCanCopy;      bool mCanPaste; +    bool mCanDelete; +    bool mCanSelectAll;      std::string mRootCachePath;      std::string mCefLogFile;      bool mCefLogVerbose; @@ -144,9 +148,13 @@ MediaPluginBase(host_send_func, host_user_data)      mAuthUsername = "";      mAuthPassword = "";      mAuthOK = false; +    mCanUndo = false; +    mCanRedo = false;      mCanCut = false;      mCanCopy = false;      mCanPaste = false; +    mCanDelete = false; +    mCanSelectAll = false;      mCefLogFile = "";      mCefLogVerbose = false;      mPickedFiles.clear(); @@ -940,6 +948,14 @@ void MediaPluginCEF::receiveMessage(const char* message_string)              {                  authResponse(message_in);              } +            if (message_name == "edit_undo") +            { +                mCEFLib->editUndo(); +            } +            if (message_name == "edit_redo") +            { +                mCEFLib->editRedo(); +            }              if (message_name == "edit_cut")              {                  mCEFLib->editCut(); @@ -952,6 +968,18 @@ void MediaPluginCEF::receiveMessage(const char* message_string)              {                  mCEFLib->editPaste();              } +            if (message_name == "edit_delete") +            { +                mCEFLib->editDelete(); +            } +            if (message_name == "edit_select_all") +            { +                mCEFLib->editSelectAll(); +            } +            if (message_name == "edit_show_source") +            { +                mCEFLib->viewSource(); +            }          }          else if (message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER)          { @@ -1103,14 +1131,31 @@ void MediaPluginCEF::unicodeInput(std::string event, LLSD native_key_data = LLSD  //  void MediaPluginCEF::checkEditState()  { +    bool can_undo = mCEFLib->editCanUndo(); +    bool can_redo = mCEFLib->editCanRedo();      bool can_cut = mCEFLib->editCanCut();      bool can_copy = mCEFLib->editCanCopy();      bool can_paste = mCEFLib->editCanPaste(); +    bool can_delete = mCEFLib->editCanDelete(); +    bool can_select_all = mCEFLib->editCanSelectAll(); -    if ((can_cut != mCanCut) || (can_copy != mCanCopy) || (can_paste != mCanPaste)) +    if ((can_undo != mCanUndo) || (can_redo != mCanRedo) || (can_cut != mCanCut) || (can_copy != mCanCopy) +        || (can_paste != mCanPaste) || (can_delete != mCanDelete) || (can_select_all != mCanSelectAll))      {          LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "edit_state"); +        if (can_undo != mCanUndo) +        { +            mCanUndo = can_undo; +            message.setValueBoolean("undo", can_undo); +        } + +        if (can_redo != mCanRedo) +        { +            mCanRedo = can_redo; +            message.setValueBoolean("redo", can_redo); +        } +          if (can_cut != mCanCut)          {              mCanCut = can_cut; @@ -1129,6 +1174,18 @@ void MediaPluginCEF::checkEditState()              message.setValueBoolean("paste", can_paste);          } +        if (can_delete != mCanDelete) +        { +            mCanDelete = can_delete; +            message.setValueBoolean("delete", can_delete); +        } + +        if (can_select_all != mCanSelectAll) +        { +            mCanSelectAll = can_select_all; +            message.setValueBoolean("select_all", can_select_all); +        } +          sendMessage(message);      }  } diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 202008f7f9..c7b60b2fd5 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -347,6 +347,7 @@ bool LLMediaCtrl::handleRightMouseDown( S32 x, S32 y, MASK mask )      {          LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registar;          registar.add("Open.WebInspector", boost::bind(&LLMediaCtrl::onOpenWebInspector, this)); +        registar.add("Open.ShowSource", boost::bind(&LLMediaCtrl::onShowSource, this));          // stinson 05/05/2014 : use this as the parent of the context menu if the static menu          // container has yet to be created @@ -364,8 +365,9 @@ bool LLMediaCtrl::handleRightMouseDown( S32 x, S32 y, MASK mask )      {          // hide/show debugging options          bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging"); +        menu->setItemVisible("debug_separator", media_plugin_debugging_enabled);          menu->setItemVisible("open_webinspector", media_plugin_debugging_enabled ); -        menu->setItemVisible("debug_separator", media_plugin_debugging_enabled ); +        menu->setItemVisible("show_page_source", media_plugin_debugging_enabled);          menu->show(x, y);          LLMenuGL::showPopup(this, menu, x, y); @@ -444,6 +446,12 @@ void LLMediaCtrl::onOpenWebInspector()          mMediaSource->getMediaPlugin()->showWebInspector( true );  } +void LLMediaCtrl::onShowSource() +{ +    if (mMediaSource && mMediaSource->hasMedia()) +        mMediaSource->getMediaPlugin()->showPageSource(); +} +  ////////////////////////////////////////////////////////////////////////////////  //  bool LLMediaCtrl::handleKeyHere( KEY key, MASK mask ) diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h index 9f9564af46..a644ef3071 100644 --- a/indra/newview/llmediactrl.h +++ b/indra/newview/llmediactrl.h @@ -171,6 +171,7 @@ public:          // right click debugging item          void onOpenWebInspector(); +        void onShowSource();          LLUUID getTextureID() {return mMediaTextureID;} diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index c6bc252efd..89861d74bc 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -3511,6 +3511,46 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla  ////////////////////////////////////////////////////////////////////////////////  // virtual  void +LLViewerMediaImpl::undo() +{ +    if (mMediaSource) +        mMediaSource->undo(); +} + +//////////////////////////////////////////////////////////////////////////////// +// virtual +bool +LLViewerMediaImpl::canUndo() const +{ +    if (mMediaSource) +        return mMediaSource->canUndo(); +    else +        return FALSE; +} + +//////////////////////////////////////////////////////////////////////////////// +// virtual +void +LLViewerMediaImpl::redo() +{ +    if (mMediaSource) +        mMediaSource->redo(); +} + +//////////////////////////////////////////////////////////////////////////////// +// virtual +bool +LLViewerMediaImpl::canRedo() const +{ +    if (mMediaSource) +        return mMediaSource->canRedo(); +    else +        return FALSE; +} + +//////////////////////////////////////////////////////////////////////////////// +// virtual +void  LLViewerMediaImpl::cut()  {      if (mMediaSource) @@ -3568,6 +3608,46 @@ LLViewerMediaImpl::canPaste() const          return false;  } +//////////////////////////////////////////////////////////////////////////////// +// virtual +void +LLViewerMediaImpl::doDelete() +{ +    if (mMediaSource) +        mMediaSource->doDelete(); +} + +//////////////////////////////////////////////////////////////////////////////// +// virtual +bool +LLViewerMediaImpl::canDoDelete() const +{ +    if (mMediaSource) +        return mMediaSource->canDoDelete(); +    else +        return FALSE; +} + +//////////////////////////////////////////////////////////////////////////////// +// virtual +void +LLViewerMediaImpl::selectAll() +{ +    if (mMediaSource) +        mMediaSource->selectAll(); +} + +//////////////////////////////////////////////////////////////////////////////// +// virtual +bool +LLViewerMediaImpl::canSelectAll() const +{ +    if (mMediaSource) +        return mMediaSource->canSelectAll(); +    else +        return FALSE; +} +  void LLViewerMediaImpl::setUpdated(bool updated)  {      mIsUpdated = updated ; diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 5753615a43..c17cf59815 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -341,6 +341,12 @@ public:      /*virtual*/ void handleMediaEvent(LLPluginClassMedia* plugin, LLPluginClassMediaOwner::EMediaEvent);      // LLEditMenuHandler overrides +    /*virtual*/ void    undo(); +    /*virtual*/ bool    canUndo() const; + +    /*virtual*/ void    redo(); +    /*virtual*/ bool    canRedo() const; +      /*virtual*/ void    cut();      /*virtual*/ bool    canCut() const; @@ -350,6 +356,12 @@ public:      /*virtual*/ void    paste();      /*virtual*/ bool    canPaste() const; +    /*virtual*/ void    doDelete(); +    /*virtual*/ bool    canDoDelete() const; + +    /*virtual*/ void    selectAll(); +    /*virtual*/ bool    canSelectAll() const; +      void addObject(LLVOVolume* obj) ;      void removeObject(LLVOVolume* obj) ;      const std::list< LLVOVolume* >* getObjectList() const ; diff --git a/indra/newview/skins/default/xui/en/menu_media_ctrl.xml b/indra/newview/skins/default/xui/en/menu_media_ctrl.xml index f9864637a0..e687ae93e8 100644 --- a/indra/newview/skins/default/xui/en/menu_media_ctrl.xml +++ b/indra/newview/skins/default/xui/en/menu_media_ctrl.xml @@ -40,4 +40,12 @@      <menu_item_call.on_click       function="Open.WebInspector" />    </menu_item_call> +  <menu_item_call +   label="Show Source" +   layout="topleft" +   name="show_page_source" +   visible="false"> +    <menu_item_call.on_click +     function="Open.ShowSource" /> +  </menu_item_call>  </context_menu>  | 
