aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/lllineeditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llui/lllineeditor.cpp')
-rw-r--r--linden/indra/llui/lllineeditor.cpp122
1 files changed, 82 insertions, 40 deletions
diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp
index a21ad5d..1d998be 100644
--- a/linden/indra/llui/lllineeditor.cpp
+++ b/linden/indra/llui/lllineeditor.cpp
@@ -55,17 +55,24 @@
55#include "llui.h" 55#include "llui.h"
56#include "lluictrlfactory.h" 56#include "lluictrlfactory.h"
57#include "llclipboard.h" 57#include "llclipboard.h"
58#include "llmemberlistener.h"
58 59
59#include "../newview/lgghunspell_wrapper.h" 60#include "../newview/lgghunspell_wrapper.h"
60#include "../newview/lltranslate.h" 61#include "../newview/lltranslate.h"
61#include "../newview/llviewercontrol.h" 62#include "../newview/llviewercontrol.h"
62#include "../newview/lggautocorrect.h" 63#include "../newview/lggautocorrect.h"
63 64
65
64// 66//
65// Imported globals 67// Imported globals
66// 68//
67 69
68// 70//
71// Globals
72
73
74
75//
69// Constants 76// Constants
70// 77//
71 78
@@ -90,6 +97,8 @@ static LLRegisterWidget<LLLineEditor> r1("line_editor");
90 97
91/* static */ LLPointer<LLUIImage> LLLineEditor::sImage; 98/* static */ LLPointer<LLUIImage> LLLineEditor::sImage;
92 99
100typedef LLMemberListener<LLView> text_edit_listener_t;
101
93// 102//
94// Member functions 103// Member functions
95// 104//
@@ -214,46 +223,18 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect,
214 } 223 }
215 mImage = sImage; 224 mImage = sImage;
216 225
217 // make the popup menu available 226
218 //LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_texteditor.xml", parent_view); 227 LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_rightclick_text.xml",this);
219 LLMenuGL* menu = new LLMenuGL("wot"); 228 if (!menu)
220 /*if (!menu) 229 {
221 { 230 menu = new LLMenuGL(LLStringUtil::null);
222 menu = new LLMenuGL(LLStringUtil::null); 231 }
223 }*/ 232
224 233 defineMenuCallbacks(menu);
225 menu->append(new LLMenuItemCallGL("Cut", context_cut, context_enable_cut, this));
226 menu->append(new LLMenuItemCallGL("Copy", context_copy, context_enable_copy, this));
227 menu->append(new LLMenuItemCallGL("Paste", context_paste, context_enable_paste, this));
228 menu->append(new LLMenuItemCallGL("Delete", context_delete, context_enable_delete, this));
229 menu->append(new LLMenuItemCallGL("Select All", context_selectall, context_enable_selectall, this));
230
231 menu->appendSeparator("Transep");
232 LLMenuGL* translatemenu = new LLMenuGL("Translate To");
233 translatemenu->setCanTearOff(FALSE);
234 translatemenu->append(new LLMenuItemCallGL("en", "English", context_translate, context_enable_translate, this));
235 translatemenu->append(new LLMenuItemCallGL("da", "Danish", context_translate, context_enable_translate, this));
236 translatemenu->append(new LLMenuItemCallGL("de", "Deutsch(German)", context_translate, context_enable_translate, this));
237 translatemenu->append(new LLMenuItemCallGL("es", "Spanish", context_translate, context_enable_translate, this));
238 translatemenu->append(new LLMenuItemCallGL("fr", "French", context_translate, context_enable_translate, this));
239 translatemenu->append(new LLMenuItemCallGL("it", "Italian", context_translate, context_enable_translate, this));
240 translatemenu->append(new LLMenuItemCallGL("hu", "Hungarian", context_translate, context_enable_translate, this));
241 translatemenu->append(new LLMenuItemCallGL("nl", "Dutch", context_translate, context_enable_translate, this));
242 translatemenu->append(new LLMenuItemCallGL("pl", "Polish", context_translate, context_enable_translate, this));
243 translatemenu->append(new LLMenuItemCallGL("pt", "Portugese", context_translate, context_enable_translate, this));
244 translatemenu->append(new LLMenuItemCallGL("ru", "Russian", context_translate, context_enable_translate, this));
245 translatemenu->append(new LLMenuItemCallGL("tr", "Turkish", context_translate, context_enable_translate, this));
246 translatemenu->append(new LLMenuItemCallGL("uk", "Ukrainian", context_translate, context_enable_translate, this));
247 translatemenu->append(new LLMenuItemCallGL("zh", "Chinese", context_translate, context_enable_translate, this));
248 translatemenu->append(new LLMenuItemCallGL("ja", "Japanese", context_translate, context_enable_translate, this));
249 translatemenu->append(new LLMenuItemCallGL("ko", "Korean", context_translate, context_enable_translate, this));
250
251 menu->appendMenu(translatemenu);
252 menu->appendSeparator("Spelsep");
253 //menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor"));
254 menu->setCanTearOff(FALSE);
255 menu->setVisible(FALSE);
256 mPopupMenuHandle = menu->getHandle(); 234 mPopupMenuHandle = menu->getHandle();
235 menu->setBorderColor(gColors.getColor("MenuItemDisabledColor"));
236 menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor"));
237
257} 238}
258 239
259 240
@@ -556,7 +537,7 @@ void LLLineEditor::context_translate(void * data)
556{ 537{
557 LLLineEditor* line = (LLLineEditor*)data; 538 LLLineEditor* line = (LLLineEditor*)data;
558 LLMenuGL* menu = line ? (LLMenuGL*)(line->mPopupMenuHandle.get()) : NULL; 539 LLMenuGL* menu = line ? (LLMenuGL*)(line->mPopupMenuHandle.get()) : NULL;
559 LLMenuGL* translate_menu = menu ? menu->getChildMenuByName("Translate To", TRUE) : NULL; 540 LLMenuGL* translate_menu = menu ? menu->getChildMenuByName("Translation Options", TRUE) : NULL;
560 if (!translate_menu) 541 if (!translate_menu)
561 { 542 {
562 return; 543 return;
@@ -1318,6 +1299,67 @@ BOOL LLLineEditor::canCut() const
1318 return !mReadOnly && !mDrawAsterixes && hasSelection(); 1299 return !mReadOnly && !mDrawAsterixes && hasSelection();
1319} 1300}
1320 1301
1302// method to define the associated callbacks
1303void LLLineEditor::defineMenuCallbacks(LLMenuGL* menu) {
1304
1305 menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_ENABLE,
1306 "Cut Text",
1307 this,
1308 (void*)context_enable_cut);
1309 menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_CLICK,
1310 "Cut Text",
1311 this,
1312 (void*)context_cut);
1313
1314 menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_ENABLE,
1315 "Copy Text",
1316 this,
1317 (void*)context_enable_copy);
1318 menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_CLICK,
1319 "Copy Text",
1320 this,
1321 (void*)context_copy);
1322
1323 menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_ENABLE,
1324 "Paste Text",
1325 this,
1326 (void*)context_enable_paste);
1327 menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_CLICK,
1328 "Paste Text",
1329 this,
1330 (void*)context_paste);
1331
1332 menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_ENABLE,
1333 "Delete Text",
1334 this,
1335 (void*)context_enable_delete);
1336 menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_CLICK,
1337 "Delete Text",
1338 this,
1339 (void*)context_delete);
1340
1341 menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_ENABLE,
1342 "Select All Text",
1343 this,
1344 (void*)context_enable_selectall);
1345 menu->setCtrlResponse(1+LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_CLICK,
1346 "Select All Text",
1347 this,
1348 (void*)context_selectall);
1349
1350 menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_ENABLE,
1351 "Translate Text",
1352 this,
1353 (void*)context_enable_translate);
1354 menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_TRANSLATE,
1355 "Translate Text",
1356 this,
1357 (void*)context_translate);
1358
1359
1360
1361}
1362
1321// cut selection to clipboard 1363// cut selection to clipboard
1322void LLLineEditor::cut() 1364void LLLineEditor::cut()
1323{ 1365{