diff options
Diffstat (limited to 'linden/indra/newview/llfloatersettingsdebug.cpp')
-rw-r--r-- | linden/indra/newview/llfloatersettingsdebug.cpp | 69 |
1 files changed, 58 insertions, 11 deletions
diff --git a/linden/indra/newview/llfloatersettingsdebug.cpp b/linden/indra/newview/llfloatersettingsdebug.cpp index 0aa0607..9e4a04c 100644 --- a/linden/indra/newview/llfloatersettingsdebug.cpp +++ b/linden/indra/newview/llfloatersettingsdebug.cpp | |||
@@ -36,6 +36,8 @@ | |||
36 | #include "lluictrlfactory.h" | 36 | #include "lluictrlfactory.h" |
37 | #include "llfirstuse.h" | 37 | #include "llfirstuse.h" |
38 | #include "llcombobox.h" | 38 | #include "llcombobox.h" |
39 | #include "lllineeditor.h" | ||
40 | #include "llscrolllistctrl.h" | ||
39 | #include "llspinctrl.h" | 41 | #include "llspinctrl.h" |
40 | #include "llcolorswatch.h" | 42 | #include "llcolorswatch.h" |
41 | #include "llviewercontrol.h" | 43 | #include "llviewercontrol.h" |
@@ -58,7 +60,8 @@ LLFloaterSettingsDebug::~LLFloaterSettingsDebug() | |||
58 | 60 | ||
59 | BOOL LLFloaterSettingsDebug::postBuild() | 61 | BOOL LLFloaterSettingsDebug::postBuild() |
60 | { | 62 | { |
61 | LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo"); | 63 | mSettingsNames.clear(); |
64 | mComboNames = getChild<LLComboBox>("settings_combo"); | ||
62 | 65 | ||
63 | struct f : public LLControlGroup::ApplyFunctor | 66 | struct f : public LLControlGroup::ApplyFunctor |
64 | { | 67 | { |
@@ -71,16 +74,16 @@ BOOL LLFloaterSettingsDebug::postBuild() | |||
71 | combo->add(name, (void*)control); | 74 | combo->add(name, (void*)control); |
72 | } | 75 | } |
73 | } | 76 | } |
74 | } func(settings_combo); | 77 | } func(mComboNames); |
75 | 78 | ||
76 | gSavedSettings.applyToAll(&func); | 79 | gSavedSettings.applyToAll(&func); |
77 | gSavedPerAccountSettings.applyToAll(&func); | 80 | gSavedPerAccountSettings.applyToAll(&func); |
78 | gColors.applyToAll(&func); | 81 | gColors.applyToAll(&func); |
79 | 82 | ||
80 | settings_combo->sortByName(); | 83 | mComboNames->sortByName(); |
81 | settings_combo->setCommitCallback(onSettingSelect); | 84 | mComboNames->setCommitCallback(onSettingSelect); |
82 | settings_combo->setCallbackUserData(this); | 85 | mComboNames->setCallbackUserData(this); |
83 | settings_combo->updateSelection(); | 86 | //mComboNames->updateSelection(); |
84 | 87 | ||
85 | childSetCommitCallback("val_spinner_1", onCommitSettings); | 88 | childSetCommitCallback("val_spinner_1", onCommitSettings); |
86 | childSetUserData("val_spinner_1", this); | 89 | childSetUserData("val_spinner_1", this); |
@@ -98,14 +101,23 @@ BOOL LLFloaterSettingsDebug::postBuild() | |||
98 | childSetUserData("color_swatch", this); | 101 | childSetUserData("color_swatch", this); |
99 | childSetAction("default_btn", onClickDefault, this); | 102 | childSetAction("default_btn", onClickDefault, this); |
100 | mComment = getChild<LLTextEditor>("comment_text"); | 103 | mComment = getChild<LLTextEditor>("comment_text"); |
104 | |||
105 | getChild<LLSearchEditor>("control_search")->setSearchCallback(onSearchEdit, this); | ||
106 | |||
107 | // There really are many better ways to do this, but laziness... she is powerful... -- MC | ||
108 | mComboNames->getAllData(mSettingsNames); | ||
109 | getChild<LLSearchEditor>("control_search")->setEnabled(!(mSettingsNames.empty())); | ||
110 | |||
101 | return TRUE; | 111 | return TRUE; |
102 | } | 112 | } |
103 | 113 | ||
104 | void LLFloaterSettingsDebug::draw() | 114 | void LLFloaterSettingsDebug::draw() |
105 | { | 115 | { |
106 | LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo"); | 116 | if (mComboNames) |
107 | LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata(); | 117 | { |
108 | updateControl(controlp); | 118 | LLControlVariable* controlp = (LLControlVariable*)mComboNames->getCurrentUserdata(); |
119 | updateControl(controlp); | ||
120 | } | ||
109 | 121 | ||
110 | LLFloater::draw(); | 122 | LLFloater::draw(); |
111 | } | 123 | } |
@@ -134,11 +146,46 @@ void LLFloaterSettingsDebug::onSettingSelect(LLUICtrl* ctrl, void* user_data) | |||
134 | } | 146 | } |
135 | 147 | ||
136 | //static | 148 | //static |
149 | void LLFloaterSettingsDebug::onSearchEdit(const std::string& search_string, void* user_data) | ||
150 | { | ||
151 | if (search_string.empty()) | ||
152 | { | ||
153 | return; | ||
154 | } | ||
155 | |||
156 | LLFloaterSettingsDebug* self = (LLFloaterSettingsDebug*)user_data; | ||
157 | if (!self || !self->mComboNames) | ||
158 | { | ||
159 | return; | ||
160 | } | ||
161 | |||
162 | std::string search_text = search_string; | ||
163 | LLStringUtil::trim(search_text); | ||
164 | LLStringUtil::toUpper(search_text); | ||
165 | |||
166 | std::string settings_name(""); | ||
167 | size_t found; | ||
168 | for (std::vector<LLScrollListItem*>::iterator vIt = self->mSettingsNames.begin(); | ||
169 | vIt != self->mSettingsNames.end(); ++vIt) | ||
170 | { | ||
171 | settings_name = (*vIt)->getValue().asString(); | ||
172 | LLStringUtil::toUpper(settings_name); | ||
173 | found = settings_name.find(search_text); | ||
174 | if (found != std::string::npos) | ||
175 | { | ||
176 | // search and update combo on partial matches | ||
177 | self->mComboNames->selectByValue((*vIt)->getValue()); | ||
178 | break; | ||
179 | } | ||
180 | } | ||
181 | } | ||
182 | |||
183 | //static | ||
137 | void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data) | 184 | void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data) |
138 | { | 185 | { |
139 | LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; | 186 | LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; |
140 | 187 | ||
141 | LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo"); | 188 | LLComboBox* settings_combo = floaterp->mComboNames; |
142 | LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata(); | 189 | LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata(); |
143 | 190 | ||
144 | LLVector3 vector; | 191 | LLVector3 vector; |
@@ -212,7 +259,7 @@ void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data) | |||
212 | void LLFloaterSettingsDebug::onClickDefault(void* user_data) | 259 | void LLFloaterSettingsDebug::onClickDefault(void* user_data) |
213 | { | 260 | { |
214 | LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; | 261 | LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; |
215 | LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo"); | 262 | LLComboBox* settings_combo = floaterp->mComboNames; |
216 | LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata(); | 263 | LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata(); |
217 | 264 | ||
218 | if (controlp) | 265 | if (controlp) |