aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra')
-rw-r--r--linden/indra/newview/CMakeLists.txt4
-rw-r--r--linden/indra/newview/app_settings/settings.xml13
-rw-r--r--linden/indra/newview/chatbar_as_cmdline.cpp6
-rw-r--r--linden/indra/newview/lggautocorrectfloater.cpp444
-rw-r--r--linden/indra/newview/lggautocorrectfloater.h40
-rw-r--r--linden/indra/newview/llprefsadvanced.cpp77
-rw-r--r--linden/indra/newview/llprefsadvanced.h21
-rw-r--r--linden/indra/newview/llstartup.cpp4
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/floater_autocorrect.xml83
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml2
10 files changed, 690 insertions, 4 deletions
diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt
index e50318e..1a900c4 100644
--- a/linden/indra/newview/CMakeLists.txt
+++ b/linden/indra/newview/CMakeLists.txt
@@ -69,10 +69,12 @@ include_directories(
69 ) 69 )
70 70
71set(viewer_SOURCE_FILES 71set(viewer_SOURCE_FILES
72 lggautocorrectfloater.cpp
72 lggautocorrect.cpp 73 lggautocorrect.cpp
73 lgghunspell_wrapper.cpp 74 lgghunspell_wrapper.cpp
74 lggdicdownload.cpp 75 lggdicdownload.cpp
75 aoremotectrl.cpp 76 aoremotectrl.cpp
77 chatbar_as_cmdline.cpp
76 emeraldboobutils.cpp 78 emeraldboobutils.cpp
77 floaterao.cpp 79 floaterao.cpp
78 floaterbusy.cpp 80 floaterbusy.cpp
@@ -508,6 +510,7 @@ set(viewer_HEADER_FILES
508 CMakeLists.txt 510 CMakeLists.txt
509 ViewerInstall.cmake 511 ViewerInstall.cmake
510 aoremotectrl.h 512 aoremotectrl.h
513 chatbar_as_cmdline.h
511 emeraldboobutils.h 514 emeraldboobutils.h
512 floaterao.h 515 floaterao.h
513 floaterbusy.h 516 floaterbusy.h
@@ -522,6 +525,7 @@ set(viewer_HEADER_FILES
522 jcfloater_animation_list.h 525 jcfloater_animation_list.h
523 jcfloaterareasearch.h 526 jcfloaterareasearch.h
524 lightshare.h 527 lightshare.h
528 lggautocorrectfloater.h
525 lggautocorrect.h 529 lggautocorrect.h
526 lggdicdownload.h 530 lggdicdownload.h
527 lgghunspell_wrapper.h 531 lgghunspell_wrapper.h
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index 42565b3..9f6362f 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -1537,6 +1537,17 @@
1537 <key>Value</key> 1537 <key>Value</key>
1538 <integer>0</integer> 1538 <integer>0</integer>
1539 </map> 1539 </map>
1540 <key>EmeraldAutoCorrectCount</key>
1541 <map>
1542 <key>Comment</key>
1543 <string>How many words have been auto replaced.</string>
1544 <key>Persist</key>
1545 <integer>1</integer>
1546 <key>Type</key>
1547 <string>S32</string>
1548 <key>Value</key>
1549 <integer>0</integer>
1550 </map>
1540 <key>EmeraldTranslateReplace</key> 1551 <key>EmeraldTranslateReplace</key>
1541 <map> 1552 <map>
1542 <key>Comment</key> 1553 <key>Comment</key>
@@ -1581,7 +1592,7 @@
1581 <key>Value</key> 1592 <key>Value</key>
1582 <string>English (United States of America)</string> 1593 <string>English (United States of America)</string>
1583 </map> 1594 </map>
1584 1595
1585 <!-- End: Spellcheck & Translation --> 1596 <!-- End: Spellcheck & Translation -->
1586 1597
1587 <key>RestrainedLife</key> 1598 <key>RestrainedLife</key>
diff --git a/linden/indra/newview/chatbar_as_cmdline.cpp b/linden/indra/newview/chatbar_as_cmdline.cpp
index 3e1d817..61e4ef4 100644
--- a/linden/indra/newview/chatbar_as_cmdline.cpp
+++ b/linden/indra/newview/chatbar_as_cmdline.cpp
@@ -72,7 +72,7 @@
72#include "audioengine.h" 72#include "audioengine.h"
73#include "llviewerparcelmediaautoplay.h" 73#include "llviewerparcelmediaautoplay.h"
74#include "lloverlaybar.h" 74#include "lloverlaybar.h"
75//KOW #include "lggautocorrectfloater.h" 75#include "lggautocorrectfloater.h"
76#include "lggautocorrect.h" 76#include "lggautocorrect.h"
77 77
78//#define JC_PROFILE_GSAVED 78//#define JC_PROFILE_GSAVED
@@ -623,13 +623,13 @@ bool cmd_line_chat(std::string revised_text, EChatType type)
623 cmdline_tp2name(name); 623 cmdline_tp2name(name);
624 } 624 }
625 return false; 625 return false;
626 } /* 626 }
627 else if(revised_text == "/ac") 627 else if(revised_text == "/ac")
628 { 628 {
629 lggAutoCorrectFloaterStart::show(TRUE,NULL); 629 lggAutoCorrectFloaterStart::show(TRUE,NULL);
630 cmdline_printchat("Displaying AutoCorrection Floater."); 630 cmdline_printchat("Displaying AutoCorrection Floater.");
631 return false; 631 return false;
632 } */ 632 }
633 else if(command == *sEmeraldCmdLineAutocorrect) 633 else if(command == *sEmeraldCmdLineAutocorrect)
634 { 634 {
635 if (revised_text.length() <= command.length() + 1) //KOW: verify that we have params 635 if (revised_text.length() <= command.length() + 1) //KOW: verify that we have params
diff --git a/linden/indra/newview/lggautocorrectfloater.cpp b/linden/indra/newview/lggautocorrectfloater.cpp
new file mode 100644
index 0000000..9d68b25
--- /dev/null
+++ b/linden/indra/newview/lggautocorrectfloater.cpp
@@ -0,0 +1,444 @@
1/* Copyright (c) 2009
2*
3* Greg Hendrickson (LordGregGreg Back). All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or
6* without modification, are permitted provided that the following
7* conditions are met:
8*
9* 1. Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* 2. Redistributions in binary form must reproduce the above
12* copyright notice, this list of conditions and the following
13* disclaimer in the documentation and/or other materials provided
14* with the distribution.
15* 3. Neither the name Modular Systems nor the names of its contributors
16* may be used to endorse or promote products derived from this
17* software without specific prior written permission.
18*
19* THIS SOFTWARE IS PROVIDED BY MODULAR SYSTEMS AND CONTRIBUTORS "AS IS"
20* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MODULAR SYSTEMS OR CONTRIBUTORS
23* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29* THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32#include "llviewerprecompiledheaders.h"
33
34#include "lggautocorrectfloater.h"
35
36#include "llagentdata.h"
37#include "llcommandhandler.h"
38#include "llfloater.h"
39#include "lluictrlfactory.h"
40#include "llagent.h"
41#include "llpanel.h"
42#include "llbutton.h"
43#include "llcolorswatch.h"
44#include "llcombobox.h"
45#include "llview.h"
46#include "llprefsadvanced.h"
47#include "llhttpclient.h"
48#include "llbufferstream.h"
49#include "llcheckboxctrl.h"
50#include "llviewercontrol.h"
51
52#include "llui.h"
53#include "llcontrol.h"
54#include "llscrolllistctrl.h"
55#include "llscrollingpanellist.h"
56#include "lggautocorrect.h"
57#include "llfilepicker.h"
58#include "llfile.h"
59#include "llsdserialize.h"
60#include "llfloaterchat.h"
61#include "llchat.h"
62#include "llviewerinventory.h"
63#include "llinventorymodel.h"
64#include "llhost.h"
65#include "llassetstorage.h"
66#include "roles_constants.h"
67#include "llviewertexteditor.h"
68#include <boost/tokenizer.hpp>
69
70#include <iosfwd>
71
72class lggAutoCorrectFloater;
73class lggAutoCorrectFloater : public LLFloater, public LLFloaterSingleton<lggAutoCorrectFloater>
74{
75public:
76 lggAutoCorrectFloater(const LLSD& seed);
77 virtual ~lggAutoCorrectFloater();
78 BOOL postBuild(void);
79 void setData(void * data);
80 void updateEnabledStuff();
81 void updateNamesList();
82 void updateListControlsEnabled(BOOL selected);
83 void updateItemsList();
84
85
86 LLScrollListCtrl *namesList;
87
88 LLScrollListCtrl *entryList;
89 LLPrefsAdvanced * empanel;
90private:
91 static lggAutoCorrectFloater* sInstance;
92 static JCInvDropTarget* mNotecardDropTarget;
93 static void onBoxCommitEnabled(LLUICtrl* caller, void* user_data);
94 static void onEntrySettingChange(LLUICtrl* caller, void* user_data);
95 static void onSelectName(LLUICtrl* caller, void* user_data);
96 static void ResponseItemDrop(LLViewerInventoryItem* item);
97 static void onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLAssetType::EType type,void* user_data, S32 status, LLExtStat ext_status);
98
99
100 static void deleteEntry(void* data);
101 static void addEntry(void* data);
102 static void exportList(void* data);
103 static void removeList(void* data);
104 static void loadList(void* data);
105
106};
107
108
109
110JCInvDropTarget * lggAutoCorrectFloater::mNotecardDropTarget;
111lggAutoCorrectFloater* lggAutoCorrectFloater::sInstance;
112
113lggAutoCorrectFloater::~lggAutoCorrectFloater()
114{
115 sInstance = NULL;
116 delete mNotecardDropTarget;
117 mNotecardDropTarget = NULL;
118}
119lggAutoCorrectFloater::lggAutoCorrectFloater(const LLSD& seed)
120{
121 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_autocorrect.xml");
122
123 if (getRect().mLeft == 0
124 && getRect().mBottom == 0)
125 {
126 center();
127 }
128 if(sInstance)delete sInstance;
129 sInstance = this;
130
131}
132
133BOOL lggAutoCorrectFloater::postBuild(void)
134{
135
136 namesList = getChild<LLScrollListCtrl>("em_ac_list_name");
137 entryList = getChild<LLScrollListCtrl>("em_ac_list_entry");
138
139 childSetCommitCallback("em_ac_enable",onBoxCommitEnabled);
140
141 childSetCommitCallback("em_ac_list_enabled",onEntrySettingChange);
142 childSetCommitCallback("em_ac_list_show",onEntrySettingChange);
143 childSetCommitCallback("em_ac_list_style",onEntrySettingChange);
144 childSetCommitCallback("em_ac_priority",onEntrySettingChange);
145
146
147
148 updateEnabledStuff();
149 updateNamesList();
150
151
152 namesList->setCommitOnSelectionChange(TRUE);
153 childSetCommitCallback("em_ac_list_name", onSelectName, this);
154
155 childSetAction("em_ac_deletelist",removeList,this);
156 childSetAction("em_ac_rementry",deleteEntry,this);
157 childSetAction("em_ac_exportlist",exportList,this);
158 childSetAction("em_ac_addentry",addEntry,this);
159 childSetAction("em_ac_loadlist",loadList,this);
160
161 LLView *target_view = getChild<LLView>("em_ac_notecard_target");
162 if(target_view)
163 {
164 if (mNotecardDropTarget)//shouldn't happen
165 {
166 delete mNotecardDropTarget;
167 }
168 mNotecardDropTarget = new JCInvDropTarget("drop target", target_view->getRect(), ResponseItemDrop);//, mAvatarID);
169 addChild(mNotecardDropTarget);
170 }
171 return true;
172}
173void lggAutoCorrectFloater::ResponseItemDrop(LLViewerInventoryItem* item)
174{
175 if(item)
176 {
177 if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike())
178 {
179 if(!item->getAssetUUID().isNull())
180 gAssetStorage->getInvItemAsset(LLHost::invalid,
181 gAgent.getID(),
182 gAgent.getSessionID(),
183 item->getPermissions().getOwner(),
184 LLUUID::null,
185 item->getUUID(),
186 item->getAssetUUID(),
187 item->getType(),
188 &onNotecardLoadComplete,
189 (void*)item,
190 TRUE);
191 gSavedSettings.setBOOL("EmeraldEnableAutoCorrect",true);
192
193 }
194 }
195}
196void lggAutoCorrectFloater::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLAssetType::EType type,void* user_data, S32 status, LLExtStat ext_status)
197{
198 if(status == LL_ERR_NOERR)
199 {
200 S32 size = vfs->getSize(asset_uuid, type);
201 U8* buffer = new U8[size];
202 vfs->getData(asset_uuid, type, buffer, 0, size);
203
204 if(type == LLAssetType::AT_NOTECARD)
205 {
206 LLViewerTextEditor* edit = new LLViewerTextEditor("",LLRect(0,0,0,0),S32_MAX,"");
207 if(edit->importBuffer((char*)buffer, (S32)size))
208 {
209 llinfos << "decode success" << llendl;
210 std::string card = edit->getText();
211 edit->die();
212 LLSD info;
213 std::istringstream ins; // Declare an input string stream.
214 ins.str(card); // Specify string to read.
215
216 LLSDSerialize::fromXML(info,ins);
217
218 LGGAutoCorrect::getInstance()->addCorrectionList(info);
219 llinfos << "read success" << llendl;
220 sInstance->updateEnabledStuff();
221 }
222 else
223 {
224 llinfos << "decode error" << llendl;
225 }
226 }
227 }
228 else
229 {
230 llinfos << "read error" << llendl;
231 }
232}
233
234
235void lggAutoCorrectFloater::onSelectName(LLUICtrl* ctrl, void* user_data)
236{
237 sInstance->updateItemsList();
238}
239void lggAutoCorrectFloater::updateItemsList()
240{
241 entryList->deleteAllItems();
242 if((namesList->getAllSelected().size())<=0)
243 {
244
245 updateListControlsEnabled(FALSE);
246 return;
247 }
248
249 updateListControlsEnabled(TRUE);
250 std::string listName= namesList->getFirstSelected()->getColumn(0)->getValue().asString();
251
252 LLSD listData = LGGAutoCorrect::getInstance()->getAutoCorrectEntries(listName);
253 childSetValue("em_ac_list_enabled",listData["enabled"].asBoolean());
254 childSetValue("em_ac_list_style",listData["wordStyle"].asBoolean());
255 childSetValue("em_ac_list_show",listData["announce"].asBoolean());
256 childSetValue("em_ac_text_name",listName);
257 childSetValue("em_ac_text_author",listData["author"]);
258 childSetValue("em_ac_priority",listData["priority"]);
259 static S32 *countAuto= rebind_llcontrol<S32>("EmeraldAutoCorrectCount", &gSavedSettings, true);
260 childSetValue("em_ac_stats",*countAuto);
261
262 LLSD autoCorrects = listData["data"];
263 LLSD::map_const_iterator loc_it = autoCorrects.beginMap();
264 LLSD::map_const_iterator loc_end = autoCorrects.endMap();
265 for ( ; loc_it != loc_end; ++loc_it)
266 {
267 const std::string& wrong = (*loc_it).first;
268 const std::string& right = (*loc_it).second;
269
270 //std::string lentry(wrong+"=>"+right);
271
272 LLSD element;
273 element["id"] = wrong;
274 LLSD& s_column = element["columns"][0];
275 s_column["column"] = "Search";
276 s_column["value"] = wrong;
277 s_column["font"] = "SANSSERIF";
278 LLSD& r_column = element["columns"][1];
279 r_column["column"] = "Replace";
280 r_column["value"] = right;
281 r_column["font"] = "SANSSERIF";
282
283 entryList->addElement(element, ADD_BOTTOM);
284 }
285
286}
287void lggAutoCorrectFloater::updateNamesList()
288{
289 namesList->deleteAllItems();
290 static BOOL *enabledd = rebind_llcontrol<BOOL>("EmeraldEnableAutoCorrect", &gSavedSettings, true);
291 if(!(*enabledd))
292 {
293 updateItemsList();
294 return;
295 }
296 static S32 *countAuto= rebind_llcontrol<S32>("EmeraldAutoCorrectCount", &gSavedSettings, true);
297 childSetValue("em_ac_stats",*countAuto);
298 LLSD autoCorrects = LGGAutoCorrect::getInstance()->getAutoCorrects();
299 LLSD::map_const_iterator loc_it = autoCorrects.beginMap();
300 LLSD::map_const_iterator loc_end = autoCorrects.endMap();
301 for ( ; loc_it != loc_end; ++loc_it)
302 {
303 const std::string& listName = (*loc_it).first;
304
305 LLSD element;
306 element["id"] = listName;
307 LLSD& friend_column = element["columns"][0];
308 friend_column["column"] = "Entries";
309 friend_column["value"] = listName;
310 friend_column["font"] = "SANSSERIF";
311 const LLSD& loc_map = (*loc_it).second;
312 if(loc_map["enabled"].asBoolean())
313 friend_column["font-style"] = "BOLD";
314 else
315 friend_column["font-style"] = "NORMAL";
316 if(namesList)
317 namesList->addElement(element, ADD_BOTTOM);
318 }
319 updateItemsList();
320}
321void lggAutoCorrectFloater::updateListControlsEnabled(BOOL selected)
322{
323
324 childSetEnabled("em_ac_text1",selected);
325 childSetEnabled("em_ac_text2",selected);
326 childSetEnabled("em_ac_text_name",selected);
327 childSetEnabled("em_ac_text_author",selected);
328 childSetEnabled("em_ac_list_enabled",selected);
329 childSetEnabled("em_ac_list_show",selected);
330 childSetEnabled("em_ac_list_style",selected);
331 childSetEnabled("em_ac_deletelist",selected);
332 childSetEnabled("em_ac_exportlist",selected);
333 childSetEnabled("em_ac_addentry",selected);
334 childSetEnabled("em_ac_rementry",selected);
335 childSetEnabled("em_ac_priority",selected);
336
337}
338void lggAutoCorrectFloater::updateEnabledStuff()
339{
340 static BOOL *enabledd = rebind_llcontrol<BOOL>("EmeraldEnableAutoCorrect", &gSavedSettings, true);
341 if(!(*enabledd))
342 {
343 getChild<LLCheckBoxCtrl>("em_ac_enable")->setEnabledColor(LLColor4(1.0f,0.0f,0.0f,1.0f));
344 }else
345 {
346 getChild<LLCheckBoxCtrl>("em_ac_enable")->setEnabledColor(LLUI::sColorsGroup->getColor( "LabelTextColor" ));
347 }
348
349 childSetEnabled("em_ac_list_name",*enabledd);
350 childSetEnabled("em_ac_list_entry",*enabledd);
351 updateListControlsEnabled(*enabledd);
352 updateNamesList();
353 LGGAutoCorrect::getInstance()->save();
354
355}
356void lggAutoCorrectFloater::setData(void * data)
357{
358 empanel = (LLPrefsAdvanced*)data;
359}
360void lggAutoCorrectFloater::onBoxCommitEnabled(LLUICtrl* caller, void* user_data)
361{
362 sInstance->updateEnabledStuff();
363}
364void lggAutoCorrectFloater::onEntrySettingChange(LLUICtrl* caller, void* user_data)
365{
366 std::string listName= sInstance->namesList->getFirstSelected()->getColumn(0)->getValue().asString();
367 LGGAutoCorrect::getInstance()->setListEnabled(listName,sInstance->childGetValue("em_ac_list_enabled").asBoolean());
368 LGGAutoCorrect::getInstance()->setListAnnounceeState(listName,sInstance->childGetValue("em_ac_list_show").asBoolean());
369 LGGAutoCorrect::getInstance()->setListStyle(listName,sInstance->childGetValue("em_ac_list_style").asBoolean());
370 LGGAutoCorrect::getInstance()->setListPriority(listName,sInstance->childGetValue("em_ac_priority").asInteger());
371
372 //sInstance->updateEnabledStuff();
373 sInstance->updateItemsList();
374 LGGAutoCorrect::getInstance()->save();
375}
376void lggAutoCorrectFloater::deleteEntry(void* data)
377{
378 std::string listName= sInstance->namesList->getFirstSelected()->getColumn(0)->getValue().asString();
379
380 if((sInstance->entryList->getAllSelected().size())>0)
381 {
382 std::string wrong= sInstance->entryList->getFirstSelected()->getColumn(0)->getValue().asString();
383 LGGAutoCorrect::getInstance()->removeEntryFromList(wrong,listName);
384 sInstance->updateItemsList();
385 LGGAutoCorrect::getInstance()->save();
386 }
387}
388void lggAutoCorrectFloater::loadList(void* data)
389{
390 LLFilePicker& picker = LLFilePicker::instance();
391
392 if(!picker.getOpenFile( LLFilePicker::FFLOAD_XML) )
393 {return;
394 }
395 llifstream file;
396 file.open(picker.getFirstFile().c_str());
397 LLSD blankllsd;
398 if (file.is_open())
399 {
400 LLSDSerialize::fromXMLDocument(blankllsd, file);
401 }
402 file.close();
403 gSavedSettings.setBOOL("EmeraldEnableAutoCorrect",true);
404 LGGAutoCorrect::getInstance()->addCorrectionList(blankllsd);
405 sInstance->updateEnabledStuff();
406}
407void lggAutoCorrectFloater::removeList(void* data)
408{
409 std::string listName= sInstance->namesList->getFirstSelected()->getColumn(0)->getValue().asString();
410 LGGAutoCorrect::getInstance()->removeCorrectionList(listName);
411 sInstance->updateEnabledStuff();
412
413}
414void lggAutoCorrectFloater::exportList(void *data)
415{
416 std::string listName= sInstance->namesList->getFirstSelected()->getColumn(0)->getValue().asString();
417
418 LLFilePicker& picker = LLFilePicker::instance();
419
420 if(!picker.getSaveFile( LLFilePicker::FFSAVE_XML) )
421 {return;
422 }
423 llofstream file;
424 file.open(picker.getFirstFile().c_str());
425 LLSDSerialize::toPrettyXML(LGGAutoCorrect::getInstance()->exportList(listName), file);
426 file.close();
427}
428void lggAutoCorrectFloater::addEntry(void* data)
429{
430 std::string listName= sInstance->namesList->getFirstSelected()->getColumn(0)->getValue().asString();
431 LLChat chat;
432 chat.mText = "To add an entry, please type in chat \""+gSavedSettings.getString("EmeraldCmdLineAutocorrect")+" "+listName+"|wrongWord|rightWord\"";
433 chat.mSourceType = CHAT_SOURCE_SYSTEM;
434 LLFloaterChat::addChat(chat, FALSE, FALSE);
435}
436
437void lggAutoCorrectFloaterStart::show(BOOL showin,void * data)
438{
439 if(showin)
440 {
441 lggAutoCorrectFloater* dic_floater = lggAutoCorrectFloater::showInstance();
442 dic_floater->setData(data);
443 }
444}
diff --git a/linden/indra/newview/lggautocorrectfloater.h b/linden/indra/newview/lggautocorrectfloater.h
new file mode 100644
index 0000000..fbb7abb
--- /dev/null
+++ b/linden/indra/newview/lggautocorrectfloater.h
@@ -0,0 +1,40 @@
1/* Copyright (c) 2009
2*
3* Greg Hendrickson (LordGregGreg Back). All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or
6* without modification, are permitted provided that the following
7* conditions are met:
8*
9* 1. Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* 2. Redistributions in binary form must reproduce the above
12* copyright notice, this list of conditions and the following
13* disclaimer in the documentation and/or other materials provided
14* with the distribution.
15* 3. Neither the name Modular Systems nor the names of its contributors
16* may be used to endorse or promote products derived from this
17* software without specific prior written permission.
18*
19* THIS SOFTWARE IS PROVIDED BY MODULAR SYSTEMS AND CONTRIBUTORS "AS IS"
20* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MODULAR SYSTEMS OR CONTRIBUTORS
23* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29* THE POSSIBILITY OF SUCH DAMAGE.
30*/
31#include "llview.h"
32#include "llviewerinventory.h"
33
34
35class lggAutoCorrectFloaterStart
36{
37 public:
38 static void show( BOOL showw , void * data);
39};
40
diff --git a/linden/indra/newview/llprefsadvanced.cpp b/linden/indra/newview/llprefsadvanced.cpp
index 3c4af02..a3efa38 100644
--- a/linden/indra/newview/llprefsadvanced.cpp
+++ b/linden/indra/newview/llprefsadvanced.cpp
@@ -38,10 +38,81 @@
38#include "llviewermenu.h" 38#include "llviewermenu.h"
39#include "llvoavatar.h" 39#include "llvoavatar.h"
40#include "lgghunspell_wrapper.h" 40#include "lgghunspell_wrapper.h"
41#include "lggautocorrectfloater.h"
41#include "llcombobox.h" 42#include "llcombobox.h"
42 43
43#include "lluictrlfactory.h" 44#include "lluictrlfactory.h"
44 45
46////////begin drop utility/////////////
47//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48// Class JCInvDropTarget
49//
50// This handy class is a simple way to drop something on another
51// view. It handles drop events, always setting itself to the size of
52// its parent.
53//
54// altered to support a callback so i can slap it in things and it just return the item to a func of my choice
55//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56
57
58
59
60JCInvDropTarget::JCInvDropTarget(const std::string& name, const LLRect& rect,
61 void (*callback)(LLViewerInventoryItem*)) :
62LLView(name, rect, NOT_MOUSE_OPAQUE, FOLLOWS_ALL),
63mDownCallback(callback)
64{
65}
66
67JCInvDropTarget::~JCInvDropTarget()
68{
69}
70
71void JCInvDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data)
72{
73 llinfos << "JCInvDropTarget::doDrop()" << llendl;
74}
75
76BOOL JCInvDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
77 EDragAndDropType cargo_type,
78 void* cargo_data,
79 EAcceptance* accept,
80 std::string& tooltip_msg)
81{
82 BOOL handled = FALSE;
83 if(getParent())
84 {
85 handled = TRUE;
86 // check the type
87 //switch(cargo_type)
88 //{
89 //case DAD_ANIMATION:
90 //{
91 LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
92 if(gInventory.getItem(inv_item->getUUID()))
93 {
94 *accept = ACCEPT_YES_COPY_SINGLE;
95 if(drop)
96 {
97 //printchat("accepted");
98 mDownCallback(inv_item);
99 }
100 }
101 else
102 {
103 *accept = ACCEPT_NO;
104 }
105 // break;
106 //}
107 //default:
108 // *accept = ACCEPT_NO;
109 // break;
110 //}
111 }
112 return handled;
113}
114////////end drop utility///////////////
115
45LLPrefsAdvanced* LLPrefsAdvanced::sInstance; 116LLPrefsAdvanced* LLPrefsAdvanced::sInstance;
46 117
47LLPrefsAdvanced::LLPrefsAdvanced() 118LLPrefsAdvanced::LLPrefsAdvanced()
@@ -118,6 +189,7 @@ BOOL LLPrefsAdvanced::postBuild()
118 getChild<LLButton>("EmSpell_Add")->setClickedCallback(onSpellAdd, this); 189 getChild<LLButton>("EmSpell_Add")->setClickedCallback(onSpellAdd, this);
119 getChild<LLButton>("EmSpell_Remove")->setClickedCallback(onSpellRemove, this); 190 getChild<LLButton>("EmSpell_Remove")->setClickedCallback(onSpellRemove, this);
120 191
192 getChild<LLButton>("ac_button")->setClickedCallback(onAutoCorrectButton,this);
121 193
122 initHelpBtn("EmeraldHelp_SpellCheck", "EmeraldHelp_SpellCheck"); 194 initHelpBtn("EmeraldHelp_SpellCheck", "EmeraldHelp_SpellCheck");
123 195
@@ -338,4 +410,9 @@ void LLPrefsAdvanced::onSpellBaseComboBoxCommit(LLUICtrl* ctrl, void* userdata)
338 } 410 }
339 //LLPanelEmerald* panel = (LLPanelEmerald*)userdata; 411 //LLPanelEmerald* panel = (LLPanelEmerald*)userdata;
340 //if(panel)panel->refresh(); 412 //if(panel)panel->refresh();
413}
414
415void LLPrefsAdvanced::onAutoCorrectButton(void * data)
416{
417 lggAutoCorrectFloaterStart::show(TRUE,data);
341} \ No newline at end of file 418} \ No newline at end of file
diff --git a/linden/indra/newview/llprefsadvanced.h b/linden/indra/newview/llprefsadvanced.h
index f5fba10..6a15fba 100644
--- a/linden/indra/newview/llprefsadvanced.h
+++ b/linden/indra/newview/llprefsadvanced.h
@@ -32,6 +32,26 @@
32#define LLPREFSADVANCED_H 32#define LLPREFSADVANCED_H
33 33
34#include "llpanel.h" 34#include "llpanel.h"
35#include "llviewerinventory.h"
36
37class JCInvDropTarget : public LLView
38{
39public:
40 JCInvDropTarget(const std::string& name, const LLRect& rect, void (*callback)(LLViewerInventoryItem*));
41 ~JCInvDropTarget();
42
43 void doDrop(EDragAndDropType cargo_type, void* cargo_data);
44
45 //
46 // LLView functionality
47 virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
48 EDragAndDropType cargo_type,
49 void* cargo_data,
50 EAcceptance* accept,
51 std::string& tooltip_msg);
52protected:
53 void (*mDownCallback)(LLViewerInventoryItem*);
54};
35 55
36class LLPrefsAdvanced : public LLPanel 56class LLPrefsAdvanced : public LLPanel
37{ 57{
@@ -60,6 +80,7 @@ private:
60 static void onSpellGetMore(void* data); 80 static void onSpellGetMore(void* data);
61 static void onSpellEditCustom(void* data); 81 static void onSpellEditCustom(void* data);
62 static void onSpellBaseComboBoxCommit(LLUICtrl* ctrl, void* userdata); 82 static void onSpellBaseComboBoxCommit(LLUICtrl* ctrl, void* userdata);
83 static void onAutoCorrectButton(void * data);
63 84
64protected: 85protected:
65 void initHelpBtn(const std::string& name, const std::string& xml_alert); 86 void initHelpBtn(const std::string& name, const std::string& xml_alert);
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp
index a514e53..b76c5be 100644
--- a/linden/indra/newview/llstartup.cpp
+++ b/linden/indra/newview/llstartup.cpp
@@ -204,6 +204,8 @@
204 204
205#include "hippoGridManager.h" 205#include "hippoGridManager.h"
206#include "hippoLimits.h" 206#include "hippoLimits.h"
207
208#include "lggautocorrect.h"
207// 209//
208// exported globals 210// exported globals
209// 211//
@@ -403,6 +405,8 @@ bool idle_startup()
403 405
404 glggHunSpell->initSettings(); 406 glggHunSpell->initSettings();
405 407
408 LGGAutoCorrect::getInstance()->loadFromDisk();
409
406// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.1d 410// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.1d
407 if ( (gSavedSettings.controlExists(RLV_SETTING_MAIN)) && (gSavedSettings.getBOOL(RLV_SETTING_MAIN)) ) 411 if ( (gSavedSettings.controlExists(RLV_SETTING_MAIN)) && (gSavedSettings.getBOOL(RLV_SETTING_MAIN)) )
408 rlv_handler_t::setEnabled(TRUE); 412 rlv_handler_t::setEnabled(TRUE);
diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_autocorrect.xml b/linden/indra/newview/skins/default/xui/en-us/floater_autocorrect.xml
new file mode 100644
index 0000000..d11b5ed
--- /dev/null
+++ b/linden/indra/newview/skins/default/xui/en-us/floater_autocorrect.xml
@@ -0,0 +1,83 @@
1<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
2<floater border="true" can_close="true" can_minimize="true" bottom="400" left="300" can_resize="false" height="430" width="400"
3 name="em_ac_floater" title="Autocorrect Settings">
4 <check_box bottom_delta="-50" left_delta="5" height="16" width="100" enabled="true" follows="left|top"
5 font="SansSerifSmall" mouse_opaque="true" radio_style="false" label="Enable Autocorrect"
6 control_name="EmeraldEnableAutoCorrect" name="em_ac_enable" tool_tip="You must have this check box enabled to use any of these settings,
7 it will search your writable text entry, and replace any of the search entries with their replacement"/>
8 <button bottom_delta="-2" left_delta="150" height="22" width="80" enabled="true" follows="left|top"
9 font="SansSerif" mouse_opaque="true" halign="center" scale_image="true"
10 name="em_ac_loadlist" label="Load List.." tool_tip="Click this to load a previously exported list from a file"/>
11 <view_border bottom_delta="-10" left_delta="100" height="40" width="120" follows="left|top"
12 bevel_style="in" mouse_opaque="false" name="em_ac_notecard_target"/>
13 <text bottom_delta="18" left_delta="0" height="16" width="120" follows="left|top" halign="center"
14 font="SansSerifSmall" mouse_opaque="true" name="em_ac_notecard"
15 >
16 Drop a Notecard here
17 to load from it.
18 </text>
19 <view_border bottom="-70" left="2" height="0" width="396" follows="left|top"
20 bevel_style="none" border_thickness="1" mouse_opaque="false" name="em_divisor1"/>
21 <text bottom_delta="-20" left_delta="0" height="16" width="400" follows="left|top" halign="center"
22 font="SansSerifSmall" mouse_opaque="true" name="em_ac_text1"
23 >List Name List Entries</text>
24 <scroll_list bottom_delta="-280" left_delta="0" height="280" width="199" follows="left|top"
25 column_padding="0" draw_heading="true" multi_select="false"
26 name="em_ac_list_name" search_column="1">
27 </scroll_list>
28 <scroll_list bottom_delta="100" left_delta="199" height="180" width="198" follows="left|top"
29 column_padding="0" draw_heading="true" multi_select="false"
30 name="em_ac_list_entry" search_column="1">
31 </scroll_list>
32 <view_border bottom_delta="-20" left_delta="10" height="16" width="180" follows="left|top"
33 bevel_style="in" mouse_opaque="false" name="em_ac_box1"/>
34 <text bottom_delta="0" left_delta="0" height="16" width="180" follows="left|top" halign="center"
35 font="SansSerifSmall" mouse_opaque="true" name="em_ac_text_name"
36 >List Name</text>
37 <text bottom_delta="-20" left_delta="-2" height="16" width="40" follows="left|top" halign="center"
38 font="SansSerifSmall" mouse_opaque="true" name="em_ac_text2"
39 >Author:</text>
40 <view_border bottom_delta="-0" left_delta="42" height="16" width="140" follows="left|top"
41 bevel_style="in" mouse_opaque="false" name="em_ac_box2"/>
42 <text bottom_delta="0" left_delta="0" height="16" width="140" follows="left|top" halign="center"
43 font="SansSerifSmall" mouse_opaque="true" name="em_ac_text_author"
44 >Author Name</text>
45 <check_box bottom_delta="-20" left_delta="-32" height="16" width="100" enabled="true" follows="left|top"
46 font="SansSerifSmall" mouse_opaque="true" radio_style="false" label="Enabled, priority:"
47 control_name="em_ac_enabled" name="em_ac_list_enabled" tool_tip="Whether or not you with to use this particular list"/>
48 <spinner bottom_delta="-0" left_delta="120" height="16" width="50" follows="left|top"
49 decimal_digits="0" increment="1" min_val="0" max_val="10" mouse_opaque="true"
50 label="" label_width="0" name="em_ac_priority" tool_tip="This number determine what order your list will be used to replace words. A higher priority means it will be used before lower priority lists"/>
51 <check_box bottom_delta="-20" left_delta="-120" height="16" width="100" enabled="true" follows="left|top"
52 font="SansSerifSmall" mouse_opaque="true" radio_style="false" label="Show Notifications"
53 control_name="em_ac_list_show" name="em_ac_list_show" tool_tip="having this enabled will make a notification pop up every time a word is replaced"/>
54 <check_box bottom_delta="-20" left_delta="-0" height="16" width="100" enabled="true" follows="left|top"
55 font="SansSerifSmall" mouse_opaque="true" radio_style="false" label="Word Style"
56 control_name="em_ac_list_style" name="em_ac_list_style" tool_tip="having this checked means the list is for full words that should be replaced, unchecked means that it will look within words contents as well"/>
57 <view_border bottom="-405" left="201" height="40" width="0" follows="left|top"
58 bevel_style="none" border_thickness="1" mouse_opaque="false" name="em_divisor2"/>
59 <view_border bottom_delta="-0" left="2" height="0" width="396" follows="left|top"
60 bevel_style="none" border_thickness="1" mouse_opaque="false" name="em_divisor3"/>
61 <button bottom="-400" left="5" height="22" width="90" enabled="true" follows="left|top"
62 font="SansSerif" mouse_opaque="true" halign="center" scale_image="true"
63 name="em_ac_deletelist" label="Delete List" tool_tip="This will delete the entire list of words and their replacements, it is not undoable"/>
64 <button bottom_delta="-0" left_delta="95" height="22" width="90" enabled="true" follows="left|top"
65 font="SansSerif" mouse_opaque="true" halign="center" scale_image="true"
66 name="em_ac_exportlist" label="Export List" tool_tip="This will save your current list to a file so you can share it with your friends or edit it"/>
67 <button bottom_delta="0" left_delta="110" height="22" width="90" enabled="true" follows="left|top"
68 font="SansSerif" mouse_opaque="true" halign="center" scale_image="true"
69 name="em_ac_addentry" label="Add Entry"/>
70 <button bottom_delta="0" left_delta="95" height="22" width="90" enabled="true" follows="left|top"
71 font="SansSerif" mouse_opaque="true" halign="center" scale_image="true"
72 name="em_ac_rementry" label="Remove Entry"/>
73 <text bottom_delta="-25" left_delta="-240" height="16" width="170" follows="left|top" halign="center"
74 font="SansSerifSmall" mouse_opaque="true" name="em_ac_text3"
75 >Words automatically corrected:</text>
76 <view_border bottom_delta="-0" left_delta="180" height="16" width="70" follows="left|top"
77 bevel_style="in" mouse_opaque="false" name="em_ac_statsbox"/>
78 <text bottom_delta="0" left_delta="0" height="16" width="70" follows="left|top" halign="center"
79 font="SansSerifSmall" mouse_opaque="true" name="em_ac_stats"
80 >Count</text>
81
82
83</floater> \ No newline at end of file
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml
index d0a0c21..bf261c6 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml
@@ -270,6 +270,8 @@
270 To spellcheck, right click a misspelled word 270 To spellcheck, right click a misspelled word
271 (red or not) and click on its replacement 271 (red or not) and click on its replacement
272 </text> 272 </text>
273 <button name="ac_button" label="AutoCorrect Options…" halign="center" tool_tip="Modify the AutoCorrect word list and settings" left="5"
274 bottom_delta="-64" width="180" height="20" font="SansSerifSmall" follows="left|top"/>
273 </panel> 275 </panel>
274 </tab_container> 276 </tab_container>
275</panel> 277</panel>