aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpreviewnotecard.cpp
diff options
context:
space:
mode:
authorMcCabe Maxsted2010-03-04 15:42:11 -0700
committerJacek Antonelli2010-03-11 19:13:49 -0600
commit1e0089c27a40a138bee5b33f4ec9cff63d388119 (patch)
tree4498718d79f31f25b88339a4aeab81e6684a788b /linden/indra/newview/llpreviewnotecard.cpp
parentUpdated .gitignore to exclude some 1.3 files and folders on Windows. (diff)
downloadmeta-impy-1e0089c27a40a138bee5b33f4ec9cff63d388119.zip
meta-impy-1e0089c27a40a138bee5b33f4ec9cff63d388119.tar.gz
meta-impy-1e0089c27a40a138bee5b33f4ec9cff63d388119.tar.bz2
meta-impy-1e0089c27a40a138bee5b33f4ec9cff63d388119.tar.xz
Added menus from BetterNotecardFloater Cool Viewer patch.
Patch by Henri Beauchamp. (slviewer-0-v12350-BetterNotecardFloater.patch)
Diffstat (limited to 'linden/indra/newview/llpreviewnotecard.cpp')
-rw-r--r--linden/indra/newview/llpreviewnotecard.cpp221
1 files changed, 221 insertions, 0 deletions
diff --git a/linden/indra/newview/llpreviewnotecard.cpp b/linden/indra/newview/llpreviewnotecard.cpp
index 04f8004..4260434 100644
--- a/linden/indra/newview/llpreviewnotecard.cpp
+++ b/linden/indra/newview/llpreviewnotecard.cpp
@@ -60,6 +60,7 @@
60#include "llviewercontrol.h" // gSavedSettings 60#include "llviewercontrol.h" // gSavedSettings
61#include "llappviewer.h" // app_abort_quit() 61#include "llappviewer.h" // app_abort_quit()
62#include "lllineeditor.h" 62#include "lllineeditor.h"
63#include "llmenugl.h"
63#include "lluictrlfactory.h" 64#include "lluictrlfactory.h"
64 65
65///---------------------------------------------------------------------------- 66///----------------------------------------------------------------------------
@@ -146,6 +147,8 @@ LLPreviewNotecard::LLPreviewNotecard(const std::string& name,
146 editor->setSourceID(item_id); 147 editor->setSourceID(item_id);
147 editor->setHandleEditKeysDirectly(TRUE); 148 editor->setHandleEditKeysDirectly(TRUE);
148 } 149 }
150
151 initMenu();
149} 152}
150 153
151LLPreviewNotecard::~LLPreviewNotecard() 154LLPreviewNotecard::~LLPreviewNotecard()
@@ -659,4 +662,222 @@ LLTextEditor* LLPreviewNotecard::getEditor()
659 return getChild<LLViewerTextEditor>("Notecard Editor"); 662 return getChild<LLViewerTextEditor>("Notecard Editor");
660} 663}
661 664
665void LLPreviewNotecard::initMenu()
666{
667 LLMenuItemCallGL* menuItem = getChild<LLMenuItemCallGL>("Undo");
668 menuItem->setMenuCallback(onUndoMenu, this);
669 menuItem->setEnabledCallback(enableUndoMenu);
670
671 menuItem = getChild<LLMenuItemCallGL>("Redo");
672 menuItem->setMenuCallback(onRedoMenu, this);
673 menuItem->setEnabledCallback(enableRedoMenu);
674
675 menuItem = getChild<LLMenuItemCallGL>("Cut");
676 menuItem->setMenuCallback(onCutMenu, this);
677 menuItem->setEnabledCallback(enableCutMenu);
678
679 menuItem = getChild<LLMenuItemCallGL>("Copy");
680 menuItem->setMenuCallback(onCopyMenu, this);
681 menuItem->setEnabledCallback(enableCopyMenu);
682
683 menuItem = getChild<LLMenuItemCallGL>("Paste");
684 menuItem->setMenuCallback(onPasteMenu, this);
685 menuItem->setEnabledCallback(enablePasteMenu);
686
687 menuItem = getChild<LLMenuItemCallGL>("Select All");
688 menuItem->setMenuCallback(onSelectAllMenu, this);
689 menuItem->setEnabledCallback(enableSelectAllMenu);
690
691 menuItem = getChild<LLMenuItemCallGL>("Deselect");
692 menuItem->setMenuCallback(onDeselectMenu, this);
693 menuItem->setEnabledCallback(enableDeselectMenu);
694
695 menuItem = getChild<LLMenuItemCallGL>("Search / Replace...");
696 menuItem->setMenuCallback(onSearchMenu, this);
697 menuItem->setEnabledCallback(NULL);
698}
699
700// static
701void LLPreviewNotecard::onSearchMenu(void* userdata)
702{
703 LLPreviewNotecard* self = (LLPreviewNotecard*)userdata;
704 if (self)
705 {
706 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("Notecard Editor");
707 if (editor)
708 {
709 LLFloaterSearchReplace::show(editor);
710 }
711 }
712}
713
714// static
715void LLPreviewNotecard::onUndoMenu(void* userdata)
716{
717 LLPreviewNotecard* self = (LLPreviewNotecard*)userdata;
718 if (self)
719 {
720 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("Notecard Editor");
721 if (editor)
722 {
723 editor->undo();
724 }
725 }
726}
727
728// static
729void LLPreviewNotecard::onRedoMenu(void* userdata)
730{
731 LLPreviewNotecard* self = (LLPreviewNotecard*)userdata;
732 if (self)
733 {
734 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("Notecard Editor");
735 if (editor)
736 {
737 editor->redo();
738 }
739 }
740}
741
742// static
743void LLPreviewNotecard::onCutMenu(void* userdata)
744{
745 LLPreviewNotecard* self = (LLPreviewNotecard*)userdata;
746 if (self)
747 {
748 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("Notecard Editor");
749 if (editor)
750 {
751 editor->cut();
752 }
753 }
754}
755
756// static
757void LLPreviewNotecard::onCopyMenu(void* userdata)
758{
759 LLPreviewNotecard* self = (LLPreviewNotecard*)userdata;
760 if (self)
761 {
762 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("Notecard Editor");
763 if (editor)
764 {
765 editor->copy();
766 }
767 }
768}
769
770// static
771void LLPreviewNotecard::onPasteMenu(void* userdata)
772{
773 LLPreviewNotecard* self = (LLPreviewNotecard*)userdata;
774 if (self)
775 {
776 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("Notecard Editor");
777 if (editor)
778 {
779 editor->paste();
780 }
781 }
782}
783
784// static
785void LLPreviewNotecard::onSelectAllMenu(void* userdata)
786{
787 LLPreviewNotecard* self = (LLPreviewNotecard*)userdata;
788 if (self)
789 {
790 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("Notecard Editor");
791 if (editor)
792 {
793 editor->selectAll();
794 }
795 }
796}
797
798// static
799void LLPreviewNotecard::onDeselectMenu(void* userdata)
800{
801 LLPreviewNotecard* self = (LLPreviewNotecard*)userdata;
802 if (self)
803 {
804 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("Notecard Editor");
805 if (editor)
806 {
807 editor->deselect();
808 }
809 }
810}
811
812// static
813BOOL LLPreviewNotecard::enableUndoMenu(void* userdata)
814{
815 LLPreviewNotecard* self = (LLPreviewNotecard*)userdata;
816 if (!self) return FALSE;
817 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("Notecard Editor");
818 if (!editor) return FALSE;
819 return editor->canUndo();
820}
821
822// static
823BOOL LLPreviewNotecard::enableRedoMenu(void* userdata)
824{
825 LLPreviewNotecard* self = (LLPreviewNotecard*)userdata;
826 if (!self) return FALSE;
827 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("Notecard Editor");
828 if (!editor) return FALSE;
829 return editor->canRedo();
830}
831
832// static
833BOOL LLPreviewNotecard::enableCutMenu(void* userdata)
834{
835 LLPreviewNotecard* self = (LLPreviewNotecard*)userdata;
836 if (!self) return FALSE;
837 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("Notecard Editor");
838 if (!editor) return FALSE;
839 return editor->canCut();
840}
841
842// static
843BOOL LLPreviewNotecard::enableCopyMenu(void* userdata)
844{
845 LLPreviewNotecard* self = (LLPreviewNotecard*)userdata;
846 if (!self) return FALSE;
847 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("Notecard Editor");
848 if (!editor) return FALSE;
849 return editor->canCopy();
850}
851
852// static
853BOOL LLPreviewNotecard::enablePasteMenu(void* userdata)
854{
855 LLPreviewNotecard* self = (LLPreviewNotecard*)userdata;
856 if (!self) return FALSE;
857 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("Notecard Editor");
858 if (!editor) return FALSE;
859 return editor->canPaste();
860}
861
862// static
863BOOL LLPreviewNotecard::enableSelectAllMenu(void* userdata)
864{
865 LLPreviewNotecard* self = (LLPreviewNotecard*)userdata;
866 if (!self) return FALSE;
867 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("Notecard Editor");
868 if (!editor) return FALSE;
869 return editor->canSelectAll();
870}
871
872// static
873BOOL LLPreviewNotecard::enableDeselectMenu(void* userdata)
874{
875 LLPreviewNotecard* self = (LLPreviewNotecard*)userdata;
876 if (!self) return FALSE;
877 LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("Notecard Editor");
878 if (!editor) return FALSE;
879 return editor->canDeselect();
880}
881
882
662// EOF 883// EOF