From 46ce6b78d479a0da264f933a694cb84b00a6c6c8 Mon Sep 17 00:00:00 2001
From: Patrick Sapinski
Date: Tue, 24 Aug 2010 21:19:42 -0400
Subject: added autocorrect functionality and floater
---
linden/indra/newview/CMakeLists.txt | 4 +
linden/indra/newview/app_settings/settings.xml | 13 +-
linden/indra/newview/chatbar_as_cmdline.cpp | 6 +-
linden/indra/newview/lggautocorrectfloater.cpp | 444 +++++++++++++++++++++
linden/indra/newview/lggautocorrectfloater.h | 40 ++
linden/indra/newview/llprefsadvanced.cpp | 77 ++++
linden/indra/newview/llprefsadvanced.h | 21 +
linden/indra/newview/llstartup.cpp | 4 +
.../default/xui/en-us/floater_autocorrect.xml | 83 ++++
.../xui/en-us/panel_preferences_advanced.xml | 2 +
10 files changed, 690 insertions(+), 4 deletions(-)
create mode 100644 linden/indra/newview/lggautocorrectfloater.cpp
create mode 100644 linden/indra/newview/lggautocorrectfloater.h
create mode 100644 linden/indra/newview/skins/default/xui/en-us/floater_autocorrect.xml
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(
)
set(viewer_SOURCE_FILES
+ lggautocorrectfloater.cpp
lggautocorrect.cpp
lgghunspell_wrapper.cpp
lggdicdownload.cpp
aoremotectrl.cpp
+ chatbar_as_cmdline.cpp
emeraldboobutils.cpp
floaterao.cpp
floaterbusy.cpp
@@ -508,6 +510,7 @@ set(viewer_HEADER_FILES
CMakeLists.txt
ViewerInstall.cmake
aoremotectrl.h
+ chatbar_as_cmdline.h
emeraldboobutils.h
floaterao.h
floaterbusy.h
@@ -522,6 +525,7 @@ set(viewer_HEADER_FILES
jcfloater_animation_list.h
jcfloaterareasearch.h
lightshare.h
+ lggautocorrectfloater.h
lggautocorrect.h
lggdicdownload.h
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 @@
Value
0
+ EmeraldAutoCorrectCount
+
EmeraldTranslateReplace
-
+
RestrainedLife
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 @@
#include "audioengine.h"
#include "llviewerparcelmediaautoplay.h"
#include "lloverlaybar.h"
-//KOW #include "lggautocorrectfloater.h"
+#include "lggautocorrectfloater.h"
#include "lggautocorrect.h"
//#define JC_PROFILE_GSAVED
@@ -623,13 +623,13 @@ bool cmd_line_chat(std::string revised_text, EChatType type)
cmdline_tp2name(name);
}
return false;
- } /*
+ }
else if(revised_text == "/ac")
{
lggAutoCorrectFloaterStart::show(TRUE,NULL);
cmdline_printchat("Displaying AutoCorrection Floater.");
return false;
- } */
+ }
else if(command == *sEmeraldCmdLineAutocorrect)
{
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 @@
+/* Copyright (c) 2009
+*
+* Greg Hendrickson (LordGregGreg Back). All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or
+* without modification, are permitted provided that the following
+* conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* 3. Neither the name Modular Systems nor the names of its contributors
+* may be used to endorse or promote products derived from this
+* software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY MODULAR SYSTEMS AND CONTRIBUTORS "AS IS"
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MODULAR SYSTEMS OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+* THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "llviewerprecompiledheaders.h"
+
+#include "lggautocorrectfloater.h"
+
+#include "llagentdata.h"
+#include "llcommandhandler.h"
+#include "llfloater.h"
+#include "lluictrlfactory.h"
+#include "llagent.h"
+#include "llpanel.h"
+#include "llbutton.h"
+#include "llcolorswatch.h"
+#include "llcombobox.h"
+#include "llview.h"
+#include "llprefsadvanced.h"
+#include "llhttpclient.h"
+#include "llbufferstream.h"
+#include "llcheckboxctrl.h"
+#include "llviewercontrol.h"
+
+#include "llui.h"
+#include "llcontrol.h"
+#include "llscrolllistctrl.h"
+#include "llscrollingpanellist.h"
+#include "lggautocorrect.h"
+#include "llfilepicker.h"
+#include "llfile.h"
+#include "llsdserialize.h"
+#include "llfloaterchat.h"
+#include "llchat.h"
+#include "llviewerinventory.h"
+#include "llinventorymodel.h"
+#include "llhost.h"
+#include "llassetstorage.h"
+#include "roles_constants.h"
+#include "llviewertexteditor.h"
+#include
+
+#include
+
+class lggAutoCorrectFloater;
+class lggAutoCorrectFloater : public LLFloater, public LLFloaterSingleton
+{
+public:
+ lggAutoCorrectFloater(const LLSD& seed);
+ virtual ~lggAutoCorrectFloater();
+ BOOL postBuild(void);
+ void setData(void * data);
+ void updateEnabledStuff();
+ void updateNamesList();
+ void updateListControlsEnabled(BOOL selected);
+ void updateItemsList();
+
+
+ LLScrollListCtrl *namesList;
+
+ LLScrollListCtrl *entryList;
+ LLPrefsAdvanced * empanel;
+private:
+ static lggAutoCorrectFloater* sInstance;
+ static JCInvDropTarget* mNotecardDropTarget;
+ static void onBoxCommitEnabled(LLUICtrl* caller, void* user_data);
+ static void onEntrySettingChange(LLUICtrl* caller, void* user_data);
+ static void onSelectName(LLUICtrl* caller, void* user_data);
+ static void ResponseItemDrop(LLViewerInventoryItem* item);
+ static void onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLAssetType::EType type,void* user_data, S32 status, LLExtStat ext_status);
+
+
+ static void deleteEntry(void* data);
+ static void addEntry(void* data);
+ static void exportList(void* data);
+ static void removeList(void* data);
+ static void loadList(void* data);
+
+};
+
+
+
+JCInvDropTarget * lggAutoCorrectFloater::mNotecardDropTarget;
+lggAutoCorrectFloater* lggAutoCorrectFloater::sInstance;
+
+lggAutoCorrectFloater::~lggAutoCorrectFloater()
+{
+ sInstance = NULL;
+ delete mNotecardDropTarget;
+ mNotecardDropTarget = NULL;
+}
+lggAutoCorrectFloater::lggAutoCorrectFloater(const LLSD& seed)
+{
+ LLUICtrlFactory::getInstance()->buildFloater(this, "floater_autocorrect.xml");
+
+ if (getRect().mLeft == 0
+ && getRect().mBottom == 0)
+ {
+ center();
+ }
+ if(sInstance)delete sInstance;
+ sInstance = this;
+
+}
+
+BOOL lggAutoCorrectFloater::postBuild(void)
+{
+
+ namesList = getChild("em_ac_list_name");
+ entryList = getChild("em_ac_list_entry");
+
+ childSetCommitCallback("em_ac_enable",onBoxCommitEnabled);
+
+ childSetCommitCallback("em_ac_list_enabled",onEntrySettingChange);
+ childSetCommitCallback("em_ac_list_show",onEntrySettingChange);
+ childSetCommitCallback("em_ac_list_style",onEntrySettingChange);
+ childSetCommitCallback("em_ac_priority",onEntrySettingChange);
+
+
+
+ updateEnabledStuff();
+ updateNamesList();
+
+
+ namesList->setCommitOnSelectionChange(TRUE);
+ childSetCommitCallback("em_ac_list_name", onSelectName, this);
+
+ childSetAction("em_ac_deletelist",removeList,this);
+ childSetAction("em_ac_rementry",deleteEntry,this);
+ childSetAction("em_ac_exportlist",exportList,this);
+ childSetAction("em_ac_addentry",addEntry,this);
+ childSetAction("em_ac_loadlist",loadList,this);
+
+ LLView *target_view = getChild("em_ac_notecard_target");
+ if(target_view)
+ {
+ if (mNotecardDropTarget)//shouldn't happen
+ {
+ delete mNotecardDropTarget;
+ }
+ mNotecardDropTarget = new JCInvDropTarget("drop target", target_view->getRect(), ResponseItemDrop);//, mAvatarID);
+ addChild(mNotecardDropTarget);
+ }
+ return true;
+}
+void lggAutoCorrectFloater::ResponseItemDrop(LLViewerInventoryItem* item)
+{
+ if(item)
+ {
+ if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike())
+ {
+ if(!item->getAssetUUID().isNull())
+ gAssetStorage->getInvItemAsset(LLHost::invalid,
+ gAgent.getID(),
+ gAgent.getSessionID(),
+ item->getPermissions().getOwner(),
+ LLUUID::null,
+ item->getUUID(),
+ item->getAssetUUID(),
+ item->getType(),
+ &onNotecardLoadComplete,
+ (void*)item,
+ TRUE);
+ gSavedSettings.setBOOL("EmeraldEnableAutoCorrect",true);
+
+ }
+ }
+}
+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;
+ }
+}
+
+
+void lggAutoCorrectFloater::onSelectName(LLUICtrl* ctrl, void* user_data)
+{
+ sInstance->updateItemsList();
+}
+void lggAutoCorrectFloater::updateItemsList()
+{
+ entryList->deleteAllItems();
+ if((namesList->getAllSelected().size())<=0)
+ {
+
+ updateListControlsEnabled(FALSE);
+ return;
+ }
+
+ updateListControlsEnabled(TRUE);
+ std::string listName= namesList->getFirstSelected()->getColumn(0)->getValue().asString();
+
+ LLSD listData = LGGAutoCorrect::getInstance()->getAutoCorrectEntries(listName);
+ childSetValue("em_ac_list_enabled",listData["enabled"].asBoolean());
+ childSetValue("em_ac_list_style",listData["wordStyle"].asBoolean());
+ childSetValue("em_ac_list_show",listData["announce"].asBoolean());
+ childSetValue("em_ac_text_name",listName);
+ childSetValue("em_ac_text_author",listData["author"]);
+ childSetValue("em_ac_priority",listData["priority"]);
+ static S32 *countAuto= rebind_llcontrol("EmeraldAutoCorrectCount", &gSavedSettings, true);
+ childSetValue("em_ac_stats",*countAuto);
+
+ LLSD autoCorrects = listData["data"];
+ LLSD::map_const_iterator loc_it = autoCorrects.beginMap();
+ LLSD::map_const_iterator loc_end = autoCorrects.endMap();
+ for ( ; loc_it != loc_end; ++loc_it)
+ {
+ const std::string& wrong = (*loc_it).first;
+ const std::string& right = (*loc_it).second;
+
+ //std::string lentry(wrong+"=>"+right);
+
+ LLSD element;
+ element["id"] = wrong;
+ LLSD& s_column = element["columns"][0];
+ s_column["column"] = "Search";
+ s_column["value"] = wrong;
+ s_column["font"] = "SANSSERIF";
+ LLSD& r_column = element["columns"][1];
+ r_column["column"] = "Replace";
+ r_column["value"] = right;
+ r_column["font"] = "SANSSERIF";
+
+ entryList->addElement(element, ADD_BOTTOM);
+ }
+
+}
+void lggAutoCorrectFloater::updateNamesList()
+{
+ namesList->deleteAllItems();
+ static BOOL *enabledd = rebind_llcontrol("EmeraldEnableAutoCorrect", &gSavedSettings, true);
+ if(!(*enabledd))
+ {
+ updateItemsList();
+ return;
+ }
+ static S32 *countAuto= rebind_llcontrol("EmeraldAutoCorrectCount", &gSavedSettings, true);
+ childSetValue("em_ac_stats",*countAuto);
+ LLSD autoCorrects = LGGAutoCorrect::getInstance()->getAutoCorrects();
+ LLSD::map_const_iterator loc_it = autoCorrects.beginMap();
+ LLSD::map_const_iterator loc_end = autoCorrects.endMap();
+ for ( ; loc_it != loc_end; ++loc_it)
+ {
+ const std::string& listName = (*loc_it).first;
+
+ LLSD element;
+ element["id"] = listName;
+ LLSD& friend_column = element["columns"][0];
+ friend_column["column"] = "Entries";
+ friend_column["value"] = listName;
+ friend_column["font"] = "SANSSERIF";
+ const LLSD& loc_map = (*loc_it).second;
+ if(loc_map["enabled"].asBoolean())
+ friend_column["font-style"] = "BOLD";
+ else
+ friend_column["font-style"] = "NORMAL";
+ if(namesList)
+ namesList->addElement(element, ADD_BOTTOM);
+ }
+ updateItemsList();
+}
+void lggAutoCorrectFloater::updateListControlsEnabled(BOOL selected)
+{
+
+ childSetEnabled("em_ac_text1",selected);
+ childSetEnabled("em_ac_text2",selected);
+ childSetEnabled("em_ac_text_name",selected);
+ childSetEnabled("em_ac_text_author",selected);
+ childSetEnabled("em_ac_list_enabled",selected);
+ childSetEnabled("em_ac_list_show",selected);
+ childSetEnabled("em_ac_list_style",selected);
+ childSetEnabled("em_ac_deletelist",selected);
+ childSetEnabled("em_ac_exportlist",selected);
+ childSetEnabled("em_ac_addentry",selected);
+ childSetEnabled("em_ac_rementry",selected);
+ childSetEnabled("em_ac_priority",selected);
+
+}
+void lggAutoCorrectFloater::updateEnabledStuff()
+{
+ static BOOL *enabledd = rebind_llcontrol("EmeraldEnableAutoCorrect", &gSavedSettings, true);
+ if(!(*enabledd))
+ {
+ getChild("em_ac_enable")->setEnabledColor(LLColor4(1.0f,0.0f,0.0f,1.0f));
+ }else
+ {
+ getChild("em_ac_enable")->setEnabledColor(LLUI::sColorsGroup->getColor( "LabelTextColor" ));
+ }
+
+ childSetEnabled("em_ac_list_name",*enabledd);
+ childSetEnabled("em_ac_list_entry",*enabledd);
+ updateListControlsEnabled(*enabledd);
+ updateNamesList();
+ LGGAutoCorrect::getInstance()->save();
+
+}
+void lggAutoCorrectFloater::setData(void * data)
+{
+ empanel = (LLPrefsAdvanced*)data;
+}
+void lggAutoCorrectFloater::onBoxCommitEnabled(LLUICtrl* caller, void* user_data)
+{
+ sInstance->updateEnabledStuff();
+}
+void lggAutoCorrectFloater::onEntrySettingChange(LLUICtrl* caller, void* user_data)
+{
+ std::string listName= sInstance->namesList->getFirstSelected()->getColumn(0)->getValue().asString();
+ LGGAutoCorrect::getInstance()->setListEnabled(listName,sInstance->childGetValue("em_ac_list_enabled").asBoolean());
+ LGGAutoCorrect::getInstance()->setListAnnounceeState(listName,sInstance->childGetValue("em_ac_list_show").asBoolean());
+ LGGAutoCorrect::getInstance()->setListStyle(listName,sInstance->childGetValue("em_ac_list_style").asBoolean());
+ LGGAutoCorrect::getInstance()->setListPriority(listName,sInstance->childGetValue("em_ac_priority").asInteger());
+
+ //sInstance->updateEnabledStuff();
+ sInstance->updateItemsList();
+ LGGAutoCorrect::getInstance()->save();
+}
+void lggAutoCorrectFloater::deleteEntry(void* data)
+{
+ std::string listName= sInstance->namesList->getFirstSelected()->getColumn(0)->getValue().asString();
+
+ if((sInstance->entryList->getAllSelected().size())>0)
+ {
+ std::string wrong= sInstance->entryList->getFirstSelected()->getColumn(0)->getValue().asString();
+ LGGAutoCorrect::getInstance()->removeEntryFromList(wrong,listName);
+ sInstance->updateItemsList();
+ LGGAutoCorrect::getInstance()->save();
+ }
+}
+void lggAutoCorrectFloater::loadList(void* data)
+{
+ LLFilePicker& picker = LLFilePicker::instance();
+
+ if(!picker.getOpenFile( LLFilePicker::FFLOAD_XML) )
+ {return;
+ }
+ llifstream file;
+ file.open(picker.getFirstFile().c_str());
+ LLSD blankllsd;
+ if (file.is_open())
+ {
+ LLSDSerialize::fromXMLDocument(blankllsd, file);
+ }
+ file.close();
+ gSavedSettings.setBOOL("EmeraldEnableAutoCorrect",true);
+ LGGAutoCorrect::getInstance()->addCorrectionList(blankllsd);
+ sInstance->updateEnabledStuff();
+}
+void lggAutoCorrectFloater::removeList(void* data)
+{
+ std::string listName= sInstance->namesList->getFirstSelected()->getColumn(0)->getValue().asString();
+ LGGAutoCorrect::getInstance()->removeCorrectionList(listName);
+ sInstance->updateEnabledStuff();
+
+}
+void lggAutoCorrectFloater::exportList(void *data)
+{
+ std::string listName= sInstance->namesList->getFirstSelected()->getColumn(0)->getValue().asString();
+
+ LLFilePicker& picker = LLFilePicker::instance();
+
+ if(!picker.getSaveFile( LLFilePicker::FFSAVE_XML) )
+ {return;
+ }
+ llofstream file;
+ file.open(picker.getFirstFile().c_str());
+ LLSDSerialize::toPrettyXML(LGGAutoCorrect::getInstance()->exportList(listName), file);
+ file.close();
+}
+void lggAutoCorrectFloater::addEntry(void* data)
+{
+ std::string listName= sInstance->namesList->getFirstSelected()->getColumn(0)->getValue().asString();
+ LLChat chat;
+ chat.mText = "To add an entry, please type in chat \""+gSavedSettings.getString("EmeraldCmdLineAutocorrect")+" "+listName+"|wrongWord|rightWord\"";
+ chat.mSourceType = CHAT_SOURCE_SYSTEM;
+ LLFloaterChat::addChat(chat, FALSE, FALSE);
+}
+
+void lggAutoCorrectFloaterStart::show(BOOL showin,void * data)
+{
+ if(showin)
+ {
+ lggAutoCorrectFloater* dic_floater = lggAutoCorrectFloater::showInstance();
+ dic_floater->setData(data);
+ }
+}
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 @@
+/* Copyright (c) 2009
+*
+* Greg Hendrickson (LordGregGreg Back). All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or
+* without modification, are permitted provided that the following
+* conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* 3. Neither the name Modular Systems nor the names of its contributors
+* may be used to endorse or promote products derived from this
+* software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY MODULAR SYSTEMS AND CONTRIBUTORS "AS IS"
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MODULAR SYSTEMS OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+* THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#include "llview.h"
+#include "llviewerinventory.h"
+
+
+class lggAutoCorrectFloaterStart
+{
+ public:
+ static void show( BOOL showw , void * data);
+};
+
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 @@
#include "llviewermenu.h"
#include "llvoavatar.h"
#include "lgghunspell_wrapper.h"
+#include "lggautocorrectfloater.h"
#include "llcombobox.h"
#include "lluictrlfactory.h"
+////////begin drop utility/////////////
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class JCInvDropTarget
+//
+// This handy class is a simple way to drop something on another
+// view. It handles drop events, always setting itself to the size of
+// its parent.
+//
+// altered to support a callback so i can slap it in things and it just return the item to a func of my choice
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+
+
+
+JCInvDropTarget::JCInvDropTarget(const std::string& name, const LLRect& rect,
+ void (*callback)(LLViewerInventoryItem*)) :
+LLView(name, rect, NOT_MOUSE_OPAQUE, FOLLOWS_ALL),
+mDownCallback(callback)
+{
+}
+
+JCInvDropTarget::~JCInvDropTarget()
+{
+}
+
+void JCInvDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data)
+{
+ llinfos << "JCInvDropTarget::doDrop()" << llendl;
+}
+
+BOOL JCInvDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg)
+{
+ BOOL handled = FALSE;
+ if(getParent())
+ {
+ handled = TRUE;
+ // check the type
+ //switch(cargo_type)
+ //{
+ //case DAD_ANIMATION:
+ //{
+ LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
+ if(gInventory.getItem(inv_item->getUUID()))
+ {
+ *accept = ACCEPT_YES_COPY_SINGLE;
+ if(drop)
+ {
+ //printchat("accepted");
+ mDownCallback(inv_item);
+ }
+ }
+ else
+ {
+ *accept = ACCEPT_NO;
+ }
+ // break;
+ //}
+ //default:
+ // *accept = ACCEPT_NO;
+ // break;
+ //}
+ }
+ return handled;
+}
+////////end drop utility///////////////
+
LLPrefsAdvanced* LLPrefsAdvanced::sInstance;
LLPrefsAdvanced::LLPrefsAdvanced()
@@ -118,6 +189,7 @@ BOOL LLPrefsAdvanced::postBuild()
getChild("EmSpell_Add")->setClickedCallback(onSpellAdd, this);
getChild("EmSpell_Remove")->setClickedCallback(onSpellRemove, this);
+ getChild("ac_button")->setClickedCallback(onAutoCorrectButton,this);
initHelpBtn("EmeraldHelp_SpellCheck", "EmeraldHelp_SpellCheck");
@@ -338,4 +410,9 @@ void LLPrefsAdvanced::onSpellBaseComboBoxCommit(LLUICtrl* ctrl, void* userdata)
}
//LLPanelEmerald* panel = (LLPanelEmerald*)userdata;
//if(panel)panel->refresh();
+}
+
+void LLPrefsAdvanced::onAutoCorrectButton(void * data)
+{
+ lggAutoCorrectFloaterStart::show(TRUE,data);
}
\ 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 @@
#define LLPREFSADVANCED_H
#include "llpanel.h"
+#include "llviewerinventory.h"
+
+class JCInvDropTarget : public LLView
+{
+public:
+ JCInvDropTarget(const std::string& name, const LLRect& rect, void (*callback)(LLViewerInventoryItem*));
+ ~JCInvDropTarget();
+
+ void doDrop(EDragAndDropType cargo_type, void* cargo_data);
+
+ //
+ // LLView functionality
+ virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg);
+protected:
+ void (*mDownCallback)(LLViewerInventoryItem*);
+};
class LLPrefsAdvanced : public LLPanel
{
@@ -60,6 +80,7 @@ private:
static void onSpellGetMore(void* data);
static void onSpellEditCustom(void* data);
static void onSpellBaseComboBoxCommit(LLUICtrl* ctrl, void* userdata);
+ static void onAutoCorrectButton(void * data);
protected:
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 @@
#include "hippoGridManager.h"
#include "hippoLimits.h"
+
+#include "lggautocorrect.h"
//
// exported globals
//
@@ -403,6 +405,8 @@ bool idle_startup()
glggHunSpell->initSettings();
+ LGGAutoCorrect::getInstance()->loadFromDisk();
+
// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.1d
if ( (gSavedSettings.controlExists(RLV_SETTING_MAIN)) && (gSavedSettings.getBOOL(RLV_SETTING_MAIN)) )
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 @@
+
+
+
+
+
+
+ Drop a Notecard here
+ to load from it.
+
+
+ List Name List Entries
+
+
+
+
+
+ List Name
+ Author:
+
+ Author Name
+
+
+
+
+
+
+
+
+
+
+ Words automatically corrected:
+
+ Count
+
+
+
\ 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 @@
To spellcheck, right click a misspelled word
(red or not) and click on its replacement
+
--
cgit v1.1