diff options
Diffstat (limited to 'indra/newview/llpreviewscript.cpp')
-rw-r--r-- | indra/newview/llpreviewscript.cpp | 184 |
1 files changed, 92 insertions, 92 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 11892933d8..80996bee2f 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -339,7 +339,7 @@ LLScriptEdCore::LLScriptEdCore( const std::string& sample, const LLHandle<LLFloater>& floater_handle, void (*load_callback)(void*), - void (*save_callback)(void*, BOOL), + void (*save_callback)(void*, bool), void (*search_replace_callback) (void* userdata), void* userdata, bool live, @@ -352,19 +352,19 @@ LLScriptEdCore::LLScriptEdCore( mSaveCallback( save_callback ), mSearchReplaceCallback( search_replace_callback ), mUserdata( userdata ), - mForceClose( FALSE ), + mForceClose( false ), mLastHelpToken(NULL), mLiveHelpHistorySize(0), - mEnableSave(FALSE), + mEnableSave(false), mLiveFile(NULL), mLive(live), mContainer(container), - mHasScriptData(FALSE), - mScriptRemoved(FALSE), - mSaveDialogShown(FALSE) + mHasScriptData(false), + mScriptRemoved(false), + mSaveDialogShown(false) { setFollowsAll(); - setBorderVisible(FALSE); + setBorderVisible(false); setXMLFilename("panel_script_ed.xml"); llassert_always(mContainer != NULL); @@ -394,7 +394,7 @@ void LLLiveLSLEditor::experienceChanged() if(mScriptEd->getAssociatedExperience() != mExperiences->getSelectedValue().asUUID()) { mScriptEd->enableSave(getIsModifiable()); - //getChildView("Save_btn")->setEnabled(TRUE); + //getChildView("Save_btn")->setEnabled(true); mScriptEd->setAssociatedExperience(mExperiences->getSelectedValue().asUUID()); updateExperiencePanel(); } @@ -449,7 +449,7 @@ bool LLScriptEdCore::postBuild() mEditor = getChild<LLScriptEditor>("Script Editor"); childSetCommitCallback("lsl errors", &LLScriptEdCore::onErrorList, this); - childSetAction("Save_btn", boost::bind(&LLScriptEdCore::doSave,this,FALSE)); + childSetAction("Save_btn", boost::bind(&LLScriptEdCore::doSave,this,false)); childSetAction("Edit_btn", boost::bind(&LLScriptEdCore::openInExternalEditor, this)); initMenu(); @@ -504,7 +504,7 @@ void LLScriptEdCore::initMenu() LLMenuItemCallGL* menuItem; menuItem = getChild<LLMenuItemCallGL>("Save"); - menuItem->setClickCallback(boost::bind(&LLScriptEdCore::doSave, this, FALSE)); + menuItem->setClickCallback(boost::bind(&LLScriptEdCore::doSave, this, false)); menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::hasChanged, this)); menuItem = getChild<LLMenuItemCallGL>("Revert All Changes"); @@ -557,7 +557,7 @@ void LLScriptEdCore::initMenu() menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::enableSaveToFileMenu, this)); } -void LLScriptEdCore::setScriptText(const std::string& text, BOOL is_valid) +void LLScriptEdCore::setScriptText(const std::string& text, bool is_valid) { if (mEditor) { @@ -662,14 +662,14 @@ bool LLScriptEdCore::hasChanged() void LLScriptEdCore::draw() { - BOOL script_changed = hasChanged(); + bool script_changed = hasChanged(); getChildView("Save_btn")->setEnabled(script_changed && !mScriptRemoved); if( mEditor->hasFocus() ) { S32 line = 0; S32 column = 0; - mEditor->getCurrentLineAndColumn( &line, &column, FALSE ); // don't include wordwrap + mEditor->getCurrentLineAndColumn( &line, &column, false ); // don't include wordwrap LLStringUtil::format_map_t args; std::string cursor_pos; args["[LINE]"] = llformat ("%d", line); @@ -687,7 +687,7 @@ void LLScriptEdCore::draw() LLPanel::draw(); } -void LLScriptEdCore::updateDynamicHelp(BOOL immediate) +void LLScriptEdCore::updateDynamicHelp(bool immediate) { LLFloater* help_floater = mLiveHelpHandle.get(); if (!help_floater) return; @@ -838,21 +838,21 @@ void LLScriptEdCore::addHelpItemToHistory(const std::string& help_string) mLiveHelpHistorySize++; } -BOOL LLScriptEdCore::canClose() +bool LLScriptEdCore::canClose() { if(mForceClose || !hasChanged() || mScriptRemoved) { - return TRUE; + return true; } else { if(!mSaveDialogShown) { - mSaveDialogShown = TRUE; + mSaveDialogShown = true; // Bring up view-modal dialog: Save changes? Yes, No, Cancel LLNotificationsUtil::add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLScriptEdCore::handleSaveChangesDialog, this, _1, _2)); } - return FALSE; + return false; } } @@ -864,17 +864,17 @@ void LLScriptEdCore::setEnableEditing(bool enable) bool LLScriptEdCore::handleSaveChangesDialog(const LLSD& notification, const LLSD& response ) { - mSaveDialogShown = FALSE; + mSaveDialogShown = false; S32 option = LLNotificationsUtil::getSelectedOption(notification, response); switch( option ) { case 0: // "Yes" // close after saving - doSave( TRUE ); + doSave( true ); break; case 1: // "No" - mForceClose = TRUE; + mForceClose = true; // This will close immediately because mForceClose is true, so we won't // infinite loop with these dialogs. JC ((LLFloater*) getParent())->closeFloater(); @@ -899,7 +899,7 @@ void LLScriptEdCore::onBtnDynamicHelp() LLFloater* parent = dynamic_cast<LLFloater*>(getParent()); llassert(parent); if (parent) - parent->addDependentFloater(live_help_floater, TRUE); + parent->addDependentFloater(live_help_floater, true); live_help_floater->childSetCommitCallback("lock_check", onCheckLock, this); live_help_floater->getChild<LLUICtrl>("lock_check")->setValue(gSavedSettings.getBOOL("ScriptHelpFollowsCursor")); live_help_floater->childSetCommitCallback("history_combo", onHelpComboCommit, this); @@ -907,7 +907,7 @@ void LLScriptEdCore::onBtnDynamicHelp() live_help_floater->childSetAction("fwd_btn", onClickForward, this); LLMediaCtrl* browser = live_help_floater->getChild<LLMediaCtrl>("lsl_guide_html"); - browser->setAlwaysRefresh(TRUE); + browser->setAlwaysRefresh(true); LLComboBox* help_combo = live_help_floater->getChild<LLComboBox>("history_combo"); LLKeywordToken *token; @@ -927,12 +927,12 @@ void LLScriptEdCore::onBtnDynamicHelp() mLiveHelpHistorySize = 0; } - BOOL visible = TRUE; - BOOL take_focus = TRUE; + bool visible = true; + bool take_focus = true; live_help_floater->setVisible(visible); live_help_floater->setFrontmost(take_focus); - updateDynamicHelp(TRUE); + updateDynamicHelp(true); } //static @@ -1016,11 +1016,11 @@ void LLScriptEdCore::onBtnInsertFunction(LLUICtrl *ui, void* userdata) { self->mEditor->insertText(self->mFunctions->getSimple()); } - self->mEditor->setFocus(TRUE); + self->mEditor->setFocus(true); self->setHelpPage(self->mFunctions->getSimple()); } -void LLScriptEdCore::doSave( BOOL close_after_save ) +void LLScriptEdCore::doSave( bool close_after_save ) { add(LLStatViewer::LSL_SAVES, 1); @@ -1116,7 +1116,7 @@ void LLScriptEdCore::onErrorList(LLUICtrl*, void* user_data) //LL_INFOS() << "LLScriptEdCore::onErrorList() - " << row << ", " //<< column << LL_ENDL; self->mEditor->setCursor(row, column); - self->mEditor->setFocus(TRUE); + self->mEditor->setFocus(true); } } @@ -1128,7 +1128,7 @@ bool LLScriptEdCore::handleReloadFromServerDialog(const LLSD& notification, cons case 0: // "Yes" if( mLoadCallback ) { - setScriptText(getString("loading"), FALSE); + setScriptText(getString("loading"), false); mLoadCallback(mUserdata); } break; @@ -1182,7 +1182,7 @@ bool LLScriptEdCore::handleKeyHere(KEY key, MASK mask) if(mSaveCallback) { // don't close after saving - mSaveCallback(mUserdata, FALSE); + mSaveCallback(mUserdata, false); } return true; @@ -1258,7 +1258,7 @@ void LLScriptEdCore::saveScriptToFile(const std::vector<std::string>& filenames, llofstream fout(filename.c_str()); fout << (scriptText); fout.close(); - self->mSaveCallback(self->mUserdata, FALSE); + self->mSaveCallback(self->mUserdata, false); } } @@ -1272,7 +1272,7 @@ bool LLScriptEdCore::canLoadOrSaveToFile( void* userdata ) bool LLScriptEdCore::enableSaveToFileMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return FALSE; + if (!self || !self->mEditor) return false; return self->mEditor->canLoadOrSaveToFile(); } @@ -1280,7 +1280,7 @@ bool LLScriptEdCore::enableSaveToFileMenu(void* userdata) bool LLScriptEdCore::enableLoadFromFileMenu(void* userdata) { LLScriptEdCore* self = (LLScriptEdCore*)userdata; - return (self && self->mEditor) ? self->mEditor->canLoadOrSaveToFile() : FALSE; + return (self && self->mEditor) ? self->mEditor->canLoadOrSaveToFile() : false; } LLUUID LLScriptEdCore::getAssociatedExperience()const @@ -1299,26 +1299,26 @@ void LLLiveLSLEditor::updateExperiencePanel() { if(mScriptEd->getAssociatedExperience().isNull()) { - mExperienceEnabled->set(FALSE); - mExperiences->setVisible(FALSE); + mExperienceEnabled->set(false); + mExperiences->setVisible(false); if(mExperienceIds.size()>0) { - mExperienceEnabled->setEnabled(TRUE); + mExperienceEnabled->setEnabled(true); mExperienceEnabled->setToolTip(getString("add_experiences")); } else { - mExperienceEnabled->setEnabled(FALSE); + mExperienceEnabled->setEnabled(false); mExperienceEnabled->setToolTip(getString("no_experiences")); } - getChild<LLButton>("view_profile")->setVisible(FALSE); + getChild<LLButton>("view_profile")->setVisible(false); } else { mExperienceEnabled->setToolTip(getString("experience_enabled")); mExperienceEnabled->setEnabled(getIsModifiable()); - mExperiences->setVisible(TRUE); - mExperienceEnabled->set(TRUE); + mExperiences->setVisible(true); + mExperienceEnabled->set(true); getChild<LLButton>("view_profile")->setToolTip(getString("show_experience_profile")); buildExperienceList(); } @@ -1375,20 +1375,20 @@ void LLLiveLSLEditor::buildExperienceList() item=mExperiences->add(getString("loading"), associated, ADD_TOP); last = associated; } - item->setEnabled(FALSE); + item->setEnabled(false); } if(last.notNull()) { - mExperiences->setEnabled(FALSE); + mExperiences->setEnabled(false); LLExperienceCache::instance().get(last, boost::bind(&LLLiveLSLEditor::buildExperienceList, this)); } else { - mExperiences->setEnabled(TRUE); - mExperiences->sortByName(TRUE); + mExperiences->setEnabled(true); + mExperiences->sortByName(true); mExperiences->setCurrentByIndex(mExperiences->getCurrentIndex()); - getChild<LLButton>("view_profile")->setVisible(TRUE); + getChild<LLButton>("view_profile")->setVisible(true); } } @@ -1541,7 +1541,7 @@ void LLPreviewLSL::draw() if(!item) { setTitle(LLTrans::getString("ScriptWasDeleted")); - mScriptEd->setItemRemoved(TRUE); + mScriptEd->setItemRemoved(true); } LLPreview::draw(); @@ -1581,7 +1581,7 @@ void LLPreviewLSL::loadAsset() // then it might be part of the inventory library. If it's in the // library, then you can see the script, but not modify it. const LLInventoryItem* item = gInventory.getItem(mItemUUID); - BOOL is_library = item + bool is_library = item && !gInventory.isObjectDescendentOf(mItemUUID, gInventory.getRootFolderID()); if(!item) @@ -1591,9 +1591,9 @@ void LLPreviewLSL::loadAsset() } if(item) { - BOOL is_copyable = gAgent.allowOperation(PERM_COPY, + bool is_copyable = gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE); - BOOL is_modifiable = gAgent.allowOperation(PERM_MODIFY, + bool is_modifiable = gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE); if (gAgent.isGodlike() || (is_copyable && (is_modifiable || is_library))) { @@ -1608,14 +1608,14 @@ void LLPreviewLSL::loadAsset() item->getType(), &LLPreviewLSL::onLoadComplete, (void*)new_uuid, - TRUE); + true); mAssetStatus = PREVIEW_ASSET_LOADING; } else { - mScriptEd->setScriptText(mScriptEd->getString("can_not_view"), FALSE); + mScriptEd->setScriptText(mScriptEd->getString("can_not_view"), false); mScriptEd->mEditor->makePristine(); - mScriptEd->mFunctions->setEnabled(FALSE); + mScriptEd->mFunctions->setEnabled(false); mAssetStatus = PREVIEW_ASSET_LOADED; } getChildView("lock")->setVisible( !is_modifiable); @@ -1623,8 +1623,8 @@ void LLPreviewLSL::loadAsset() } else { - mScriptEd->setScriptText(std::string(HELLO_LSL), TRUE); - mScriptEd->setEnableEditing(TRUE); + mScriptEd->setScriptText(std::string(HELLO_LSL), true); + mScriptEd->setEnableEditing(true); mAssetStatus = PREVIEW_ASSET_LOADED; } } @@ -1661,7 +1661,7 @@ void LLPreviewLSL::onLoad(void* userdata) } // static -void LLPreviewLSL::onSave(void* userdata, BOOL close_after_save) +void LLPreviewLSL::onSave(void* userdata, bool close_after_save) { LLPreviewLSL* self = (LLPreviewLSL*)userdata; self->mCloseAfterSave = close_after_save; @@ -1778,12 +1778,12 @@ void LLPreviewLSL::onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType t // put a EOS at the end buffer[file_length] = 0; - preview->mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), TRUE); + preview->mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), true); preview->mScriptEd->mEditor->makePristine(); std::string script_name = DEFAULT_SCRIPT_NAME; LLInventoryItem* item = gInventory.getItem(*item_uuid); - BOOL is_modifiable = FALSE; + bool is_modifiable = false; if (item) { if (!item->getName().empty()) @@ -1792,7 +1792,7 @@ void LLPreviewLSL::onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType t } if (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE)) { - is_modifiable = TRUE; + is_modifiable = true; } } preview->mScriptEd->setScriptName(script_name); @@ -1850,13 +1850,13 @@ void* LLLiveLSLEditor::createScriptEdPanel(void* userdata) LLLiveLSLEditor::LLLiveLSLEditor(const LLSD& key) : LLScriptEdContainer(key), - mAskedForRunningInfo(FALSE), - mHaveRunningInfo(FALSE), - mCloseAfterSave(FALSE), + mAskedForRunningInfo(false), + mHaveRunningInfo(false), + mCloseAfterSave(false), mPendingUploads(0), - mIsModifiable(FALSE), + mIsModifiable(false), mIsNew(false), - mIsSaving(FALSE) + mIsSaving(false) { mFactoryMap["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this); } @@ -1898,7 +1898,7 @@ void LLLiveLSLEditor::callbackLSLCompileSucceeded(const LLUUID& task_id, mScriptEd->mErrorList->setCommentText(LLTrans::getString("CompileSuccessful")); mScriptEd->mErrorList->setCommentText(LLTrans::getString("SaveComplete")); getChild<LLCheckBoxCtrl>("running")->set(is_script_running); - mIsSaving = FALSE; + mIsSaving = false; closeIfNeeded(); } @@ -1919,7 +1919,7 @@ void LLLiveLSLEditor::callbackLSLCompileFailed(const LLSD& compile_errors) mScriptEd->mErrorList->addElement(row); } mScriptEd->selectFirstError(); - mIsSaving = FALSE; + mIsSaving = false; closeIfNeeded(); } @@ -1951,9 +1951,9 @@ void LLLiveLSLEditor::loadAsset() if(!isGodlike && (!copyManipulate || !mIsModifiable)) { mItem = new LLViewerInventoryItem(item); - mScriptEd->setScriptText(getString("not_allowed"), FALSE); + mScriptEd->setScriptText(getString("not_allowed"), false); mScriptEd->mEditor->makePristine(); - mScriptEd->enableSave(FALSE); + mScriptEd->enableSave(false); mAssetStatus = PREVIEW_ASSET_LOADED; } else if(copyManipulate || isGodlike) @@ -1972,24 +1972,24 @@ void LLLiveLSLEditor::loadAsset() item->getType(), &LLLiveLSLEditor::onLoadComplete, (void*)user_data, - TRUE); + true); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_GetScriptRunning); msg->nextBlockFast(_PREHASH_Script); msg->addUUIDFast(_PREHASH_ObjectID, mObjectUUID); msg->addUUIDFast(_PREHASH_ItemID, mItemUUID); msg->sendReliable(object->getRegion()->getHost()); - mAskedForRunningInfo = TRUE; + mAskedForRunningInfo = true; mAssetStatus = PREVIEW_ASSET_LOADING; } } if(mItem.isNull()) { - mScriptEd->setScriptText(LLStringUtil::null, FALSE); + mScriptEd->setScriptText(LLStringUtil::null, false); mScriptEd->mEditor->makePristine(); mAssetStatus = PREVIEW_ASSET_LOADED; - mIsModifiable = FALSE; + mIsModifiable = false; } refreshFromItem(); @@ -2011,8 +2011,8 @@ void LLLiveLSLEditor::loadAsset() } else { - mScriptEd->setScriptText(std::string(HELLO_LSL), TRUE); - mScriptEd->enableSave(FALSE); + mScriptEd->setScriptText(std::string(HELLO_LSL), true); + mScriptEd->enableSave(false); LLPermissions perm; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, gAgent.getGroupID()); perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, PERM_MOVE | PERM_TRANSFER); @@ -2049,7 +2049,7 @@ void LLLiveLSLEditor::onLoadComplete(const LLUUID& asset_id, if( LL_ERR_NOERR == status ) { instance->loadScriptText(asset_id, type); - instance->mScriptEd->setEnableEditing(TRUE); + instance->mScriptEd->setEnableEditing(true); instance->mAssetStatus = PREVIEW_ASSET_LOADED; instance->mScriptEd->setAssetID(asset_id); } @@ -2090,7 +2090,7 @@ void LLLiveLSLEditor::loadScriptText(const LLUUID &uuid, LLAssetType::EType type buffer[file_length] = '\0'; - mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), TRUE); + mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), true); mScriptEd->makeEditorPristine(); std::string script_name = DEFAULT_SCRIPT_NAME; @@ -2109,7 +2109,7 @@ void LLLiveLSLEditor::onRunningCheckboxClicked( LLUICtrl*, void* userdata ) LLLiveLSLEditor* self = (LLLiveLSLEditor*) userdata; LLViewerObject* object = gObjectList.findObject( self->mObjectUUID ); LLCheckBoxCtrl* runningCheckbox = self->getChild<LLCheckBoxCtrl>("running"); - BOOL running = runningCheckbox->get(); + bool running = runningCheckbox->get(); //self->mRunningCheckbox->get(); if( object ) { @@ -2168,14 +2168,14 @@ void LLLiveLSLEditor::draw() else { runningCheckbox->setLabel(getString("public_objects_can_not_run")); - runningCheckbox->setEnabled(FALSE); + runningCheckbox->setEnabled(false); // *FIX: Set it to false so that the ui is correct for // a box that is released to public. It could be // incorrect after a release/claim cycle, but will be // correct after clicking on it. - runningCheckbox->set(FALSE); - mMonoCheckbox->set(FALSE); + runningCheckbox->set(false); + mMonoCheckbox->set(false); } } else if(!object) @@ -2183,10 +2183,10 @@ void LLLiveLSLEditor::draw() // HACK: Display this information in the title bar. // Really ought to put in main window. setTitle(LLTrans::getString("ObjectOutOfRange")); - runningCheckbox->setEnabled(FALSE); - mMonoCheckbox->setEnabled(FALSE); + runningCheckbox->setEnabled(false); + mMonoCheckbox->setEnabled(false); // object may have fallen out of range. - mHaveRunningInfo = FALSE; + mHaveRunningInfo = false; } LLPreview::draw(); @@ -2203,15 +2203,15 @@ void LLLiveLSLEditor::onSearchReplace(void* userdata) struct LLLiveLSLSaveData { - LLLiveLSLSaveData(const LLUUID& id, const LLViewerInventoryItem* item, BOOL active); + LLLiveLSLSaveData(const LLUUID& id, const LLViewerInventoryItem* item, bool active); LLUUID mSaveObjectID; LLPointer<LLViewerInventoryItem> mItem; - BOOL mActive; + bool mActive; }; LLLiveLSLSaveData::LLLiveLSLSaveData(const LLUUID& id, const LLViewerInventoryItem* item, - BOOL active) : + bool active) : mSaveObjectID(id), mActive(active) { @@ -2284,7 +2284,7 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) mPendingUploads = 0; // save the script - mScriptEd->enableSave(FALSE); + mScriptEd->enableSave(false); mScriptEd->mEditor->makePristine(); mScriptEd->mErrorList->deleteAllItems(); mScriptEd->mEditor->makePristine(); @@ -2340,7 +2340,7 @@ void LLLiveLSLEditor::onLoad(void* userdata) } // static -void LLLiveLSLEditor::onSave(void* userdata, BOOL close_after_save) +void LLLiveLSLEditor::onSave(void* userdata, bool close_after_save) { LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata; if(self) @@ -2366,7 +2366,7 @@ void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**) LLLiveLSLEditor* instance = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", floater_key); if(instance) { - instance->mHaveRunningInfo = TRUE; + instance->mHaveRunningInfo = true; bool running; msg->getBOOLFast(_PREHASH_Script, _PREHASH_Running, running); LLCheckBoxCtrl* runningCheckbox = instance->getChild<LLCheckBoxCtrl>("running"); @@ -2387,13 +2387,13 @@ void LLLiveLSLEditor::onMonoCheckboxClicked(LLUICtrl*, void* userdata) self->mScriptEd->enableSave(self->getIsModifiable()); } -BOOL LLLiveLSLEditor::monoChecked() const +bool LLLiveLSLEditor::monoChecked() const { if(NULL != mMonoCheckbox) { - return mMonoCheckbox->getValue()? TRUE : FALSE; + return mMonoCheckbox->getValue()? true : false; } - return FALSE; + return false; } void LLLiveLSLEditor::setAssociatedExperience( LLHandle<LLLiveLSLEditor> editor, const LLSD& experience ) |