Plugin.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //-----------------------------------------------------------------------------
  2. // Verve
  3. // Copyright (C) - Violent Tulip
  4. //-----------------------------------------------------------------------------
  5. // Verve Editor
  6. new ScriptObject( VerveEditorPlugin )
  7. {
  8. SuperClass = "EditorPlugin";
  9. };
  10. //-----------------------------------------------------------------------------
  11. function VerveEditorPlugin::onWorldEditorStartup( %this )
  12. {
  13. //----------------------------------------------------------------------
  14. //
  15. // Editor Toggles
  16. //
  17. //----------------------------------------------------------------------
  18. // Add ourselves to the window menu.
  19. %accel = EditorGui.addToEditorsMenu( "Verve Editor", "", VerveEditorPlugin );
  20. // Add ourselves to the ToolsToolbar
  21. %tooltip = "Verve Editor (" @ %accel @ ")";
  22. // Add ourselves to the ToolsToolbar
  23. EditorGui.addToToolsToolbar( "VerveEditorPlugin", "VerveEditorPluginPalette", expandFilename( "tools/VerveEditor/GUI/Images/btn_Palette" ), %tooltip );
  24. // Find and Store the Button.
  25. %this.ToolbarButton = ToolsToolbarArray.findObjectByInternalName( "VerveEditorPluginPalette", false );
  26. %this.ToolbarButton.ButtonType = "ToggleButton";
  27. // Extend Width.
  28. %extent = EWToolsToolbar.getExtent();
  29. EWToolsToolbar.setExtent( ( getWord( %extent, 0 ) + 33 ) SPC getWord( %extent, 1 ) );
  30. }
  31. function VerveEditorPlugin::setEditorFunction( %this )
  32. {
  33. if ( %this.ToolbarButton.getValue() )
  34. {
  35. // Launch Editor.
  36. VerveEditor::LaunchEditor();
  37. }
  38. else
  39. {
  40. VerveEditorWindow.onWindowClose();
  41. }
  42. // Maintain Last Editor.
  43. return false;
  44. }
  45. function VerveEditorPlugin::onDeactivated( %this )
  46. {
  47. // Unchecked Box?
  48. if ( %this.ToolbarButton.getValue() )
  49. {
  50. return;
  51. }
  52. }