本文整理汇总了C++中LLViewerTextEditor类的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerTextEditor类的具体用法?C++ LLViewerTextEditor怎么用?C++ LLViewerTextEditor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLViewerTextEditor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void LLPreviewNotecard::draw()
{
//childSetFocus("Save", FALSE);
LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
BOOL script_changed = !editor->isPristine();
childSetEnabled("Save", script_changed && getEnabled());
LLPreview::draw();
}
示例2: setEnabled
void LLPreviewNotecard::setEnabled( BOOL enabled )
{
LLViewerTextEditor* editor = findChild<LLViewerTextEditor>("Notecard Editor");
if (editor)
editor->setEnabled(enabled);
if (LLUICtrl* ctrl = findChild<LLUICtrl>("lock"))
ctrl->setVisible(!enabled);
if (LLUICtrl* ctrl = findChild<LLUICtrl>("desc"))
ctrl->setEnabled(enabled);
if (LLUICtrl* ctrl = findChild<LLUICtrl>("Save"))
ctrl->setEnabled(enabled && editor && !editor->isPristine());
}
示例3: onClickSend
void LLFloaterLuaConsole::onClickSend(void *data)
{
LLFloaterLuaConsole *self = (LLFloaterLuaConsole *)data;
LLLineEditor *editor = self->getChild<LLLineEditor>("Lua Editor", TRUE);
if(editor->getLength())
{
LLColor4 text_color = gSavedSettings.getColor4("llOwnerSayChatColor");
LLViewerTextEditor *out = self->getChild<LLViewerTextEditor>("Lua Output Editor");
out->appendColoredText("] "+editor->getText(), false, true, text_color); //echo command, like a proper console.
FLLua::callCommand(editor->getText());
editor->updateHistory();
editor->clear();
}
}
示例4: canClose
// virtual
BOOL LLPreviewNotecard::canClose()
{
LLViewerTextEditor* editor = findChild<LLViewerTextEditor>("Notecard Editor");
if (mForceClose || (editor && editor->isPristine()))
{
return TRUE;
}
else
{
// Bring up view-modal dialog: Save changes? Yes, No, Cancel
LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLPreviewNotecard::handleSaveChangesDialog,this, _1, _2));
return FALSE;
}
}
示例5: canClose
// virtual
BOOL LLPreviewNotecard::canClose()
{
LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Notecard Editor");
if(mForceClose || editor->isPristine())
{
return TRUE;
}
else
{
// Bring up view-modal dialog: Save changes? Yes, No, Cancel
gViewerWindow->alertXml("SaveChanges",
&LLPreviewNotecard::handleSaveChangesDialog,
this);
return FALSE;
}
}
示例6: addOutput
void LLFloaterLuaConsole::addOutput(std::string output, bool error)
{
LLFloaterLuaConsole *self = sInstance;
if(!self) //open but hidden
{
self=getInstance();
self->setVisible(FALSE);
}
LLColor4 text_color;
if(error)
text_color = gSavedSettings.getColor4("ScriptErrorColor");
else
text_color = gSavedSettings.getColor4("ObjectChatColor");
LLViewerTextEditor *editor = self->getChild<LLViewerTextEditor>("Lua Output Editor");
editor->setParseHTML(TRUE);
editor->setParseHighlights(TRUE);
editor->appendColoredText(output, false, true, text_color);
}
示例7: onClickGetItems
// <edit>
// static
void LLPreviewNotecard::onClickGetItems(void* user_data)
{
LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data;
if(preview)
{
LLViewerTextEditor* editor = preview->getChild<LLViewerTextEditor>("Notecard Editor");
if(editor)
{
std::vector<LLPointer<LLInventoryItem>> items = editor->getEmbeddedItems();
if(items.size())
{
const BOOL use_caps = FALSE;
std::vector<LLPointer<LLInventoryItem>>::iterator iter = items.begin();
std::vector<LLPointer<LLInventoryItem>>::iterator end = items.end();
for( ; iter != end; ++iter)
{
LLInventoryItem* item = static_cast<LLInventoryItem*>(*iter);
if(use_caps)
{
copy_inventory_from_notecard(preview->getObjectID(), preview->getNotecardItemID(), item, 0);
}
else
{
// Only one item per message actually works
gMessageSystem->newMessageFast(_PREHASH_CopyInventoryFromNotecard);
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
gMessageSystem->nextBlockFast(_PREHASH_NotecardData);
gMessageSystem->addUUIDFast(_PREHASH_NotecardItemID, preview->getNotecardItemID());
gMessageSystem->addUUIDFast(_PREHASH_ObjectID, preview->getObjectID());
gMessageSystem->nextBlockFast(_PREHASH_InventoryData);
gMessageSystem->addUUIDFast(_PREHASH_ItemID, item->getUUID());
gMessageSystem->addUUIDFast(_PREHASH_FolderID, gInventory.findCategoryUUIDForType(item->getType()));
gAgent.sendReliableMessage();
}
}
}
}
}
}
示例8: saveAs_continued
void LLPreviewNotecard::saveAs_continued(AIFilePicker* filepicker)
{
if (!filepicker->hasFilename())
return;
LLViewerTextEditor* editor = findChild<LLViewerTextEditor>("Notecard Editor");
std::string buffer;
if (editor && !editor->exportBuffer(buffer))
{
// FIXME: Notify the user!
return;
}
S32 size = buffer.length();
std::string filename = filepicker->getFilename();
std::ofstream export_file(filename.c_str(), std::ofstream::binary);
export_file.write(buffer.c_str(), size);
export_file.close();
}
示例9: LLViewerTextEditor
void lggAutoCorrectFloater::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLAssetType::EType type,void* user_data, S32 status, LLExtStat ext_status)
{
if(status == LL_ERR_NOERR)
{
S32 size = vfs->getSize(asset_uuid, type);
U8* buffer = new U8[size];
vfs->getData(asset_uuid, type, buffer, 0, size);
if(type == LLAssetType::AT_NOTECARD)
{
LLViewerTextEditor* edit = new LLViewerTextEditor("",LLRect(0,0,0,0),S32_MAX,"");
if(edit->importBuffer((char*)buffer, (S32)size))
{
llinfos << "decode success" << llendl;
std::string card = edit->getText();
edit->die();
LLSD info;
std::istringstream ins; // Declare an input string stream.
ins.str(card); // Specify string to read.
LLSDSerialize::fromXML(info,ins);
LGGAutoCorrect::getInstance()->addCorrectionList(info);
llinfos << "read success" << llendl;
sInstance->updateEnabledStuff();
}
else
{
llinfos << "decode error" << llendl;
}
}
}
else
{
llinfos << "read error" << llendl;
}
}
示例10: updateFloaterCovenantText
void LLFloaterBuyLandUI::updateFloaterCovenantText(const std::string &string, const LLUUID& asset_id)
{
LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("covenant_editor");
editor->setText(string);
LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant");
LLTextBox* box = getChild<LLTextBox>("covenant_text");
if (asset_id.isNull())
{
check->set(true);
check->setEnabled(false);
refreshUI();
// remove the line stating that you must agree
box->setVisible(FALSE);
}
else
{
check->setEnabled(true);
// remove the line stating that you must agree
box->setVisible(TRUE);
}
}
示例11: postBuild
BOOL LLPreviewNotecard::postBuild()
{
LLViewerTextEditor *ed = getChild<LLViewerTextEditor>("Notecard Editor");
ed->setNotecardInfo(mItemUUID, mObjectID, getKey());
ed->makePristine();
childSetAction("Save", onClickSave, this);
getChildView("lock")->setVisible( FALSE);
childSetAction("Delete", onClickDelete, this);
getChildView("Delete")->setEnabled(false);
const LLInventoryItem* item = getItem();
childSetCommitCallback("desc", LLPreview::onText, this);
if (item)
{
getChild<LLUICtrl>("desc")->setValue(item->getDescription());
getChildView("Delete")->setEnabled(true);
}
getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
return LLPreview::postBuild();
}
示例12: onOpen
void onOpen()
{
LLViewerTextEditor* pEditor = dynamic_cast<LLViewerTextEditor*>(&mEditor);
if (pEditor)
pEditor->openEmbeddedItem(mItem, pEditor->getWText()[pEditor->getCursorPos()]);
}
示例13: onInputEditorGainFocus
void LLFloaterLuaConsole::onInputEditorGainFocus( LLFocusableElement* caller, void* userdata )
{
LLFloaterLuaConsole *self = (LLFloaterLuaConsole *)userdata;
LLViewerTextEditor *editor = self->getChild<LLViewerTextEditor>("Lua Output Editor");
editor->setCursorAndScrollToEnd();
}
示例14: onCopyToInventory
void onCopyToInventory()
{
LLViewerTextEditor* pEditor = dynamic_cast<LLViewerTextEditor*>(&mEditor);
if (pEditor)
pEditor->showCopyToInvDialog(mItem, pEditor->getWText()[pEditor->getCursorPos()]);
}
示例15: file
// static
void LLPreviewNotecard::onLoadComplete(LLVFS *vfs,
const LLUUID& asset_uuid,
LLAssetType::EType type,
void* user_data, S32 status, LLExtStat ext_status)
{
llinfos << "LLPreviewNotecard::onLoadComplete()" << llendl;
LLUUID* item_id = (LLUUID*)user_data;
LLPreviewNotecard* preview = LLPreviewNotecard::getInstance(*item_id);
if( preview )
{
if(0 == status)
{
LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
S32 file_length = file.getSize();
char* buffer = new char[file_length+1];
file.read((U8*)buffer, file_length); /*Flawfinder: ignore*/
// put a EOS at the end
buffer[file_length] = 0;
LLViewerTextEditor* previewEditor = LLViewerUICtrlFactory::getViewerTextEditorByName(preview, "Notecard Editor");
if( (file_length > 19) && !strncmp( buffer, "Linden text version", 19 ) )
{
if( !previewEditor->importBuffer( buffer ) )
{
llwarns << "Problem importing notecard" << llendl;
}
}
else
{
// Version 0 (just text, doesn't include version number)
previewEditor->setText(LLStringExplicit(buffer));
}
previewEditor->makePristine();
const LLInventoryItem* item = preview->getItem();
BOOL modifiable = item && gAgent.allowOperation(PERM_MODIFY,
item->getPermissions(), GP_OBJECT_MANIPULATE);
preview->setEnabled(modifiable);
delete[] buffer;
preview->mAssetStatus = PREVIEW_ASSET_LOADED;
}
else
{
if( gViewerStats )
{
gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED );
}
if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
LL_ERR_FILE_EMPTY == status)
{
LLNotifyBox::showXml("NotecardMissing");
}
else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
{
LLNotifyBox::showXml("NotecardNoPermissions");
}
else
{
LLNotifyBox::showXml("UnableToLoadNotecard");
}
llwarns << "Problem loading notecard: " << status << llendl;
preview->mAssetStatus = PREVIEW_ASSET_ERROR;
}
}
delete item_id;
}