summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2025-02-12 17:18:31 +0200
committerGitHub <noreply@github.com>2025-02-12 17:18:31 +0200
commit23ac8f603ea2e590b47598edf0fd6824f168fc0b (patch)
treec3d9eb897785b59e30fd53adb8b511767f158881 /indra/llui
parent5029f0322f264e17f7509952f7bf9812db17a9ec (diff)
parentad7dee8aa08bb6207f95a50c8d1eeb55e8e0d81e (diff)
Merge pull request #3535 from secondlife/marchcat/lua_editor
Lua editor: initial PR to start the project viewer
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llcombobox.cpp17
-rw-r--r--indra/llui/llcombobox.h5
-rw-r--r--indra/llui/llkeywords.cpp6
-rw-r--r--indra/llui/llscrolllistctrl.cpp13
-rw-r--r--indra/llui/llscrolllistctrl.h3
5 files changed, 40 insertions, 4 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index f3876ef695..17e583b868 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -251,11 +251,26 @@ void LLComboBox::resetDirty()
}
}
-bool LLComboBox::itemExists(const std::string& name)
+bool LLComboBox::itemExists(const std::string& name) const
{
return mList->getItemByLabel(name);
}
+bool LLComboBox::valueExists(const std::string& value) const
+{
+ return mList->getItemByValue(value);
+}
+
+LLScrollListItem* LLComboBox::findItemByValue(const std::string& value) const
+{
+ return mList->getItemByValue(value);
+}
+
+std::vector<LLScrollListItem*> LLComboBox::getAllData() const
+{
+ return mList->getAllData();
+}
+
// add item "name" to menu
LLScrollListItem* LLComboBox::add(const std::string& name, EAddPosition pos, bool enabled)
{
diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h
index 8be3eb57e4..be18cdba48 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -143,7 +143,10 @@ public:
LLScrollListItem* addSeparator(EAddPosition pos = ADD_BOTTOM);
bool remove( S32 index ); // remove item by index, return true if found and removed
void removeall() { clearRows(); }
- bool itemExists(const std::string& name);
+ bool itemExists(const std::string& name) const;
+ bool valueExists(const std::string& value) const;
+ LLScrollListItem* findItemByValue(const std::string& value) const;
+ std::vector<LLScrollListItem*> getAllData() const;
void sortByName(bool ascending = true); // Sort the entries in the combobox by name
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp
index 7bf43c22c1..bc2247e7e9 100644
--- a/indra/llui/llkeywords.cpp
+++ b/indra/llui/llkeywords.cpp
@@ -239,6 +239,10 @@ void LLKeywords::processTokens()
addToken(LLKeywordToken::TT_TWO_SIDED_DELIMITER, "/*", LLUIColorTable::instance().getColor("SyntaxLslComment"), "Comment (multi-line)\nNon-functional commentary or disabled code", "*/" );
addToken(LLKeywordToken::TT_DOUBLE_QUOTATION_MARKS, "\"", LLUIColorTable::instance().getColor("SyntaxLslStringLiteral"), "String literal", "\"" );
+ // Lua-style comments
+ addToken(LLKeywordToken::TT_ONE_SIDED_DELIMITER, "--", LLUIColorTable::instance().getColor("SyntaxLslComment"), "Comment (Lua-style single-line)\nNon-functional commentary or disabled code", delimiter);
+ addToken(LLKeywordToken::TT_TWO_SIDED_DELIMITER, "--[[", LLUIColorTable::instance().getColor("SyntaxLslComment"), "Comment (Lua-style multi-line)\nNon-functional commentary or disabled code", "]]");
+
LLSD::map_iterator itr = mSyntax.beginMap();
for ( ; itr != mSyntax.endMap(); ++itr)
{
@@ -627,7 +631,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
if( *cur )
{
- cur += cur_delimiter->getLengthHead();
+ cur += cur_delimiter->getLengthTail();
seg_end = seg_start + between_delimiters + cur_delimiter->getLengthHead() + cur_delimiter->getLengthTail();
}
else
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 93bd3c6bed..deaf2fe188 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -1281,6 +1281,19 @@ LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, boo
return NULL;
}
+LLScrollListItem* LLScrollListCtrl::getItemByValue(const std::string& value)
+{
+ for (LLScrollListItem* item : mItemList)
+ {
+ if (item->getValue().asString() == value)
+ {
+ return item;
+ }
+ }
+
+ return NULL;
+}
+
LLScrollListItem* LLScrollListCtrl::getItemByIndex(S32 index)
{
if (index >= 0 && index < (S32)mItemList.size())
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index c24784338a..70d4a75fb5 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -263,7 +263,8 @@ public:
bool selectItemByLabel(const std::string& item, bool case_sensitive = true, S32 column = 0); // false if item not found
bool selectItemByPrefix(const std::string& target, bool case_sensitive = true, S32 column = -1);
bool selectItemByPrefix(const LLWString& target, bool case_sensitive = true, S32 column = -1);
- LLScrollListItem* getItemByLabel(const std::string& item, bool case_sensitive = true, S32 column = 0);
+ LLScrollListItem* getItemByLabel(const std::string& label, bool case_sensitive = true, S32 column = 0);
+ LLScrollListItem* getItemByValue(const std::string& value);
LLScrollListItem* getItemByIndex(S32 index);
std::string getSelectedItemLabel(S32 column = 0) const;
LLSD getSelectedValue();