diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llui/lltexteditor.cpp | 111 |
1 files changed, 74 insertions, 37 deletions
diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp index 004d063..0cafd4b 100644 --- a/linden/indra/llui/lltexteditor.cpp +++ b/linden/indra/llui/lltexteditor.cpp | |||
@@ -385,43 +385,18 @@ LLTextEditor::LLTextEditor( | |||
385 | mHTML.clear(); | 385 | mHTML.clear(); |
386 | 386 | ||
387 | // make the popup menu available | 387 | // make the popup menu available |
388 | //LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_texteditor.xml", parent_view); | 388 | |
389 | LLMenuGL* menu = new LLMenuGL("wot"); | 389 | LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_rightclick_text.xml",this); |
390 | /*if (!menu) | 390 | if (!menu) |
391 | { | 391 | { |
392 | menu = new LLMenuGL(LLStringUtil::null); | 392 | menu = new LLMenuGL(LLStringUtil::null); |
393 | }*/ | 393 | } |
394 | menu->append(new LLMenuItemCallGL("Cut", context_cut, context_enable_cut, this)); | 394 | |
395 | menu->append(new LLMenuItemCallGL("Copy", context_copy, context_enable_copy, this)); | 395 | defineMenuCallbacks(menu); |
396 | menu->append(new LLMenuItemCallGL("Paste", context_paste, context_enable_paste, this)); | ||
397 | menu->append(new LLMenuItemCallGL("Delete", context_delete, context_enable_delete, this)); | ||
398 | menu->append(new LLMenuItemCallGL("Select All", context_selectall, context_enable_selectall, this)); | ||
399 | menu->appendSeparator("Transep"); | ||
400 | LLMenuGL* translatemenu = new LLMenuGL("Translate To"); | ||
401 | translatemenu->setCanTearOff(FALSE); | ||
402 | translatemenu->append(new LLMenuItemCallGL("en", "English", context_translate, context_enable_translate, this)); | ||
403 | translatemenu->append(new LLMenuItemCallGL("da", "Danish", context_translate, context_enable_translate, this)); | ||
404 | translatemenu->append(new LLMenuItemCallGL("de", "Deutsch(German)", context_translate, context_enable_translate, this)); | ||
405 | translatemenu->append(new LLMenuItemCallGL("es", "Spanish", context_translate, context_enable_translate, this)); | ||
406 | translatemenu->append(new LLMenuItemCallGL("fr", "French", context_translate, context_enable_translate, this)); | ||
407 | translatemenu->append(new LLMenuItemCallGL("it", "Italian", context_translate, context_enable_translate, this)); | ||
408 | translatemenu->append(new LLMenuItemCallGL("hu", "Hungarian", context_translate, context_enable_translate, this)); | ||
409 | translatemenu->append(new LLMenuItemCallGL("nl", "Dutch", context_translate, context_enable_translate, this)); | ||
410 | translatemenu->append(new LLMenuItemCallGL("pl", "Polish", context_translate, context_enable_translate, this)); | ||
411 | translatemenu->append(new LLMenuItemCallGL("pt", "Portugese", context_translate, context_enable_translate, this)); | ||
412 | translatemenu->append(new LLMenuItemCallGL("ru", "Russian", context_translate, context_enable_translate, this)); | ||
413 | translatemenu->append(new LLMenuItemCallGL("tr", "Turkish", context_translate, context_enable_translate, this)); | ||
414 | translatemenu->append(new LLMenuItemCallGL("uk", "Ukrainian", context_translate, context_enable_translate, this)); | ||
415 | translatemenu->append(new LLMenuItemCallGL("zh", "Chinese", context_translate, context_enable_translate, this)); | ||
416 | translatemenu->append(new LLMenuItemCallGL("ja", "Japanese", context_translate, context_enable_translate, this)); | ||
417 | translatemenu->append(new LLMenuItemCallGL("ko", "Korean", context_translate, context_enable_translate, this)); | ||
418 | |||
419 | menu->appendMenu(translatemenu); | ||
420 | menu->appendSeparator("Spelsep"); | ||
421 | //menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); | ||
422 | menu->setCanTearOff(FALSE); | ||
423 | menu->setVisible(FALSE); | ||
424 | mPopupMenuHandle = menu->getHandle(); | 396 | mPopupMenuHandle = menu->getHandle(); |
397 | menu->setBorderColor(gColors.getColor("MenuItemDisabledColor")); | ||
398 | menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); | ||
399 | |||
425 | } | 400 | } |
426 | 401 | ||
427 | LLTextEditor::~LLTextEditor() | 402 | LLTextEditor::~LLTextEditor() |
@@ -476,7 +451,7 @@ void LLTextEditor::context_translate(void * data) | |||
476 | { | 451 | { |
477 | LLTextEditor* line = (LLTextEditor*)data; | 452 | LLTextEditor* line = (LLTextEditor*)data; |
478 | LLMenuGL* menu = line ? (LLMenuGL*)(line->mPopupMenuHandle.get()) : NULL; | 453 | LLMenuGL* menu = line ? (LLMenuGL*)(line->mPopupMenuHandle.get()) : NULL; |
479 | LLMenuGL* translate_menu = menu ? menu->getChildMenuByName("Translate To", TRUE) : NULL; | 454 | LLMenuGL* translate_menu = menu ? menu->getChildMenuByName("Translation Options", TRUE) : NULL; |
480 | if (!translate_menu) | 455 | if (!translate_menu) |
481 | { | 456 | { |
482 | return; | 457 | return; |
@@ -615,6 +590,68 @@ void LLTextEditor::context_selectall(void* data) | |||
615 | if(line)line->selectAll(); | 590 | if(line)line->selectAll(); |
616 | } | 591 | } |
617 | 592 | ||
593 | // method to define the associated callbacks | ||
594 | void LLTextEditor::defineMenuCallbacks(LLMenuGL* menu) { | ||
595 | |||
596 | menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_ENABLE, | ||
597 | "Cut Text", | ||
598 | this, | ||
599 | (void*)context_enable_cut); | ||
600 | menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_CLICK, | ||
601 | "Cut Text", | ||
602 | this, | ||
603 | (void*)context_cut); | ||
604 | |||
605 | menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_ENABLE, | ||
606 | "Copy Text", | ||
607 | this, | ||
608 | (void*)context_enable_copy); | ||
609 | menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_CLICK, | ||
610 | "Copy Text", | ||
611 | this, | ||
612 | (void*)context_copy); | ||
613 | |||
614 | menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_ENABLE, | ||
615 | "Paste Text", | ||
616 | this, | ||
617 | (void*)context_enable_paste); | ||
618 | menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_CLICK, | ||
619 | "Paste Text", | ||
620 | this, | ||
621 | (void*)context_paste); | ||
622 | |||
623 | menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_ENABLE, | ||
624 | "Delete Text", | ||
625 | this, | ||
626 | (void*)context_enable_delete); | ||
627 | menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_CLICK, | ||
628 | "Delete Text", | ||
629 | this, | ||
630 | (void*)context_delete); | ||
631 | |||
632 | menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_ENABLE, | ||
633 | "Select All Text", | ||
634 | this, | ||
635 | (void*)context_enable_selectall); | ||
636 | menu->setCtrlResponse(1+LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_CLICK, | ||
637 | "Select All Text", | ||
638 | this, | ||
639 | (void*)context_selectall); | ||
640 | |||
641 | menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_ON_ENABLE, | ||
642 | "Translate Text", | ||
643 | this, | ||
644 | (void*)context_enable_translate); | ||
645 | menu->setCtrlResponse(LLCallbackInformation::LL_MENU_ITEM_CALL_GL_TRANSLATE, | ||
646 | "Translate Text", | ||
647 | this, | ||
648 | (void*)context_translate); | ||
649 | |||
650 | |||
651 | |||
652 | } | ||
653 | |||
654 | |||
618 | void LLTextEditor::setTrackColor( const LLColor4& color ) | 655 | void LLTextEditor::setTrackColor( const LLColor4& color ) |
619 | { | 656 | { |
620 | mScrollbar->setTrackColor(color); | 657 | mScrollbar->setTrackColor(color); |