FIRE-13888: Add copy function to bumps list
parent
6dcc55b725
commit
7d79ee75b9
|
|
@ -35,6 +35,10 @@
|
|||
#include "lluictrlfactory.h"
|
||||
#include "llviewermessage.h"
|
||||
|
||||
#include "fsscrolllistctrl.h"
|
||||
#include "llclipboard.h"
|
||||
#include "llfloaterreg.h"
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
/// Class LLFloaterBump
|
||||
///----------------------------------------------------------------------------
|
||||
|
|
@ -51,6 +55,16 @@ LLFloaterBump::~LLFloaterBump()
|
|||
{
|
||||
}
|
||||
|
||||
// <FS:Ansariel> FIRE-13888: Add copy function to bumps list
|
||||
BOOL LLFloaterBump::postBuild()
|
||||
{
|
||||
FSScrollListCtrl* list = getChild<FSScrollListCtrl>("bump_list");
|
||||
list->setContextMenu(&gFSBumpListMenu);
|
||||
|
||||
return LLFloater::postBuild();
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
|
||||
// virtual
|
||||
void LLFloaterBump::onOpen(const LLSD& key)
|
||||
{
|
||||
|
|
@ -126,3 +140,57 @@ void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd)
|
|||
row["columns"][0]["font"] = "SansSerifBold";
|
||||
list->addElement(row);
|
||||
}
|
||||
|
||||
// <FS:Ansariel> FIRE-13888: Add copy function to bumps list
|
||||
LLContextMenu* FSBumpListMenu::createMenu()
|
||||
{
|
||||
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
|
||||
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
|
||||
|
||||
registrar.add("BumpList.Action", boost::bind(&FSBumpListMenu::onContextMenuItemClick, this, _2));
|
||||
enable_registrar.add("BumpList.Enable", boost::bind(&FSBumpListMenu::onContextMenuItemEnable, this, _2));
|
||||
|
||||
return createFromFile("menu_fs_bump_list.xml");
|
||||
}
|
||||
|
||||
void FSBumpListMenu::onContextMenuItemClick(const LLSD& userdata)
|
||||
{
|
||||
std::string item = userdata.asString();
|
||||
|
||||
if (item == "copy")
|
||||
{
|
||||
LLFloaterBump* floater = LLFloaterReg::findTypedInstance<LLFloaterBump>("bumps");
|
||||
if (floater && !gMeanCollisionList.empty() && !mUUIDs.empty())
|
||||
{
|
||||
std::string bumps_text;
|
||||
FSScrollListCtrl* list = floater->getChild<FSScrollListCtrl>("bump_list");
|
||||
|
||||
std::vector<LLScrollListItem*> selected = list->getAllSelected();
|
||||
for (std::vector<LLScrollListItem*>::iterator it = selected.begin(); it != selected.end(); ++it)
|
||||
{
|
||||
bumps_text += ( (bumps_text.empty() ? "" : "\n") + (*it)->getColumn(0)->getValue().asString() );
|
||||
}
|
||||
|
||||
if (!bumps_text.empty())
|
||||
{
|
||||
LLClipboard::instance().copyToClipboard(utf8str_to_wstring(bumps_text), 0, bumps_text.size() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool FSBumpListMenu::onContextMenuItemEnable(const LLSD& userdata)
|
||||
{
|
||||
std::string item = userdata.asString();
|
||||
|
||||
if (item == "can_copy")
|
||||
{
|
||||
LLFloaterBump* floater = LLFloaterReg::findTypedInstance<LLFloaterBump>("bumps");
|
||||
return (floater && !gMeanCollisionList.empty() && !mUUIDs.empty());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
FSBumpListMenu gFSBumpListMenu;
|
||||
// </FS:Ansariel>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#define LL_LLFLOATERBUMP_H
|
||||
|
||||
#include "llfloater.h"
|
||||
#include "lllistcontextmenu.h"
|
||||
|
||||
class LLMeanCollisionData;
|
||||
class LLScrollListCtrl;
|
||||
|
|
@ -42,6 +43,8 @@ protected:
|
|||
|
||||
public:
|
||||
/*virtual*/ void onOpen(const LLSD& key);
|
||||
// <FS:Ansariel> FIRE-13888: Add copy function to bumps list
|
||||
BOOL postBuild();
|
||||
|
||||
private:
|
||||
|
||||
|
|
@ -49,4 +52,16 @@ private:
|
|||
virtual ~LLFloaterBump();
|
||||
};
|
||||
|
||||
// <FS:Ansariel> FIRE-13888: Add copy function to bumps list
|
||||
class FSBumpListMenu : public LLListContextMenu
|
||||
{
|
||||
public:
|
||||
/*virtual*/ LLContextMenu* createMenu();
|
||||
private:
|
||||
void onContextMenuItemClick(const LLSD& userdata);
|
||||
bool onContextMenuItemEnable(const LLSD& userdata);
|
||||
};
|
||||
|
||||
extern FSBumpListMenu gFSBumpListMenu;
|
||||
// </FS:Ansariel>
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<context_menu name="Bump List Context Menu">
|
||||
<menu_item_call label="Kopieren" name="Copy"/>
|
||||
</context_menu>
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
name="timeStr">
|
||||
[[hour,datetime,slt]:[min,datetime,slt]]
|
||||
</floater.string>
|
||||
<scroll_list
|
||||
<fs_scroll_list
|
||||
draw_border="false"
|
||||
follows="left|top|right|bottom"
|
||||
height="152"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<context_menu
|
||||
name="Bump List Context Menu">
|
||||
<menu_item_call
|
||||
enabled="false"
|
||||
label="Copy"
|
||||
name="Copy">
|
||||
<on_click
|
||||
function="BumpList.Action"
|
||||
parameter="copy"/>
|
||||
<on_enable
|
||||
function="BumpList.Enable"
|
||||
parameter="can_copy"/>
|
||||
</menu_item_call>
|
||||
</context_menu>
|
||||
Loading…
Reference in New Issue