//
        // Called during late stage toolset deinitialization.
        //

        virtual public void Shutdown(INWN2PluginHost Host)
        {
            if (Plugin == this)
            {
                Plugin = null;
            }
        }
        //
        // Called during early stage toolset deinitialization.
        //

        virtual public void Unload(INWN2PluginHost Host)
        {
            ListView Lv;

            //
            // Early toolset teardown; deinitialize the script compiler hook so
            // that we may unload cleanly.
            //

            Lv = PluginUI.GetVerifyOutputListView();

            if (Lv != null)
            {
                Lv.ItemActivate -= this.OnVerifyOutputListViewItemActivated;
            }

            UnhookScriptCompiler();

            if (NWN2ToolsetMainForm.VersionControlManager.Preferences != null)
            {
                if (NWN2ToolsetMainForm.VersionControlManager.Preferences.ActiveProvider == this)
                {
                    NWN2ToolsetMainForm.VersionControlManager.Preferences.ActiveProvider = m_OriginalVCPlugin;
                }

                m_OriginalVCPlugin = null;
            }

            m_SettingsManager = null;
        }
Beispiel #3
0
        public void Unload(INWN2PluginHost cHost)
        {
            UI.MultiForm form = UI.MultiForm.makeMultiForm();
            form.Dispose();

            m_cMenuItem.Dispose();
            m_cMenuItem = null;
        }
Beispiel #4
0
 /// <summary>
 /// Performs setup operations.
 /// Called by the toolset when it has finished loading.
 /// </summary>
 /// <param name="cHost">A plugin host component which
 /// manages the plugins currently loaded into the toolset.</param>
 public void Load(INWN2PluginHost cHost)
 {
     try {
         InitialiseFlip();
     }
     catch (Exception x) {
         MessageBox.Show("Something went wrong when initialising Flip.\n\n" + x);
     }
 }
Beispiel #5
0
        public void Startup(INWN2PluginHost cHost)
        {
            m_cMenuItem           = cHost.GetMenuForPlugin(this);
            m_cMenuItem.Activate += new EventHandler(this.HandlePluginLaunch);

            buildToolbars();

            //    NWN2ToolsetMainForm.App.KeyPreview = true;
            //   NWN2ToolsetMainForm.App.KeyDown += new System.Windows.Forms.KeyEventHandler(NWN2BrushSaver);
        }
        //
        // Called during early stage toolset initialization.
        //

        virtual public void Startup(INWN2PluginHost Host)
        {
            //
            // Spin up the plugin menu UI.
            //

            Plugin = this;

            m_MenuItem           = Host.GetMenuForPlugin(this);
            m_MenuItem.Activate += new EventHandler(this.OnPluginMenuActivated);
        }
        //
        // Standard INWN2Plugin methods.
        //

        //
        // Called during late stage toolset initialization.
        //

        virtual public void Load(INWN2PluginHost Host)
        {
            ListView Lv;

            m_SettingsManager = new SettingsManager();
            m_SettingsManager.NeedSettingsLoad = true;

            //
            // By the time Load is invoked, the compiler is present.  Install
            // the compiler hook now.
            //

            m_CompilerField = GetMainFormCompilerField();

            m_ResourceAccessor = new ResourceAccessor(this);

            HookScriptCompiler();

            //
            // Hook the version control system for resource change notification
            // distribution if preferences were available at this point.
            //
            // Otherwise, wait for a change notification to install the hook.
            //
            //

            if (NWN2ToolsetMainForm.VersionControlManager.Preferences != null)
            {
                m_OriginalVCPlugin = NWN2ToolsetMainForm.VersionControlManager.Preferences.ActiveProvider;

                if (m_OriginalVCPlugin == this)
                {
                    m_OriginalVCPlugin = null;
                }

                NWN2ToolsetMainForm.VersionControlManager.Preferences.ActiveProvider = this;
            }
            else
            {
                NWN2Toolset.Plugins.NWN2VersionControlManagerPreferences.PreferencesChanged += this.OnVersionControlManagerPrefsChanged;
            }

            Lv = PluginUI.GetVerifyOutputListView();

            if (Lv != null)
            {
                Lv.ItemActivate += this.OnVerifyOutputListViewItemActivated;
            }
        }
Beispiel #8
0
        /// <summary>
        /// Performs teardown operations.
        /// Called by the toolset when it is about to finish shutting down.
        /// </summary>
        /// <param name="cHost">A plugin host component which
        /// manages the plugins currently loaded into the toolset.</param>
        public void Shutdown(INWN2PluginHost cHost)
        {
            // Stop logging Flip actions:
            try {
                LogWriter.StopRecording();
                //ActivityLog.StopLog();
            }
            catch (Exception x) {
                MessageBox.Show("Something went wrong when closing Flip activity log.\n\n" + x);
            }

            try {
                service.Stop();
            }
            catch (Exception x) {
                MessageBox.Show("Something went wrong when stopping the service.\n\n" + x);
            }
        }
Beispiel #9
0
        public void Startup(INWN2PluginHost cHost)
        {
            m_cMenuItem = cHost.GetMenuForPlugin(this);
            m_cMenuItem.Activate += new EventHandler(this.HandlePluginLaunch);

            buildToolbars();

            //    NWN2ToolsetMainForm.App.KeyPreview = true;
            //   NWN2ToolsetMainForm.App.KeyDown += new System.Windows.Forms.KeyEventHandler(NWN2BrushSaver);
        }
 public void Unload(INWN2PluginHost host)
 {
 }
 public void Shutdown(INWN2PluginHost host)
 {
 }
 public void Startup(INWN2PluginHost host)
 {
     PluginMenuItem           = host.GetMenuForPlugin(this);
     PluginMenuItem.Activate += launch;
 }
 public void Load(INWN2PluginHost host)
 {
 }
Beispiel #14
0
 public void Startup(INWN2PluginHost cHost)
 {
     m_cMenuItem           = cHost.GetMenuForPlugin(this);
     m_cMenuItem.Activate += new EventHandler(this.HandlePluginLaunch);
 }
Beispiel #15
0
 public void Startup(INWN2PluginHost cHost)
 {
     m_cMenuItem = cHost.GetMenuForPlugin(this);
     m_cMenuItem.Activate += new EventHandler(this.HandlePluginLaunch);
     // Add the following line of code to the end of the function
     buildToolbars();
     NWN2ToolsetMainForm.App.KeyPreview = true;
     NWN2ToolsetMainForm.App.KeyDown += new System.Windows.Forms.KeyEventHandler(NWN2BrushSaver);
 }
Beispiel #16
0
 public void Load(INWN2PluginHost cHost)
 {
 }
 public void Startup(INWN2PluginHost cHost)
 {
     m_cMenuItem = cHost.GetMenuForPlugin(this);
     m_cMenuItem.Activate += new EventHandler(this.HandlePluginLaunch);
 }
Beispiel #18
0
        public void Unload(INWN2PluginHost cHost)
        {
            UI.MultiForm form = UI.MultiForm.makeMultiForm();
            form.Dispose();

            m_cMenuItem.Dispose();
            m_cMenuItem = null;
        }
Beispiel #19
0
        /// <summary>
        /// Performs setup operations.
        /// Called by the toolset when it is started.
        /// </summary>
        /// <param name="cHost">A plugin host component which
        /// manages the plugins currently loaded into the toolset.</param>
        public void Startup(INWN2PluginHost cHost)
        {
            // Start providing useful NWN2 functions as a service to the test suite (obsolete):
            try {
                service.Start();
            }
            catch (Exception) { }

            // Ensure flip_functions.nss is in the Override directory of NWN2 - otherwise scripts won't compile:
            //ProvideSpecialFunctionsScriptFile();

            // Modify the user interface:
            ToolsetUIModifier UI = new ToolsetUIModifier(new ToolsetUIModifier.AddScriptToConversation(UseConversationLineAsTrigger),
                                                         new ToolsetUIModifier.AddScriptToConversation(AddConditionToConversationLine),
                                                         new ToolsetUIModifier.CreateBlockFromBlueprintDelegate(CreateInstanceBlocksFromBlueprints),
                                                         new ToolsetUIModifier.UpdateBlockWhenTagChangesDelegate(UpdateBlockWithNewTag));

            try {
                UI.ModifyUI();
            }
            catch (Exception x) {
                MessageBox.Show("Something went wrong when modifying the user interface.\n\n" + x);
            }

            try {
                TD.SandBar.ButtonItem flipButton = UI.AddFlipButton();
                if (flipButton != null)
                {
                    flipButton.Activate += delegate
                    {
                        LaunchFlip();
                        //ActivityLog.Write(new Activity("LaunchedFlip","LaunchedFrom","Toolbar"));
                        Log.WriteAction(LogAction.launched, "flip", "from toolbar");
                    };
                }
            }
            catch (Exception x) {
                MessageBox.Show("Something went wrong when adding Flip button to toolbar.\n\n" + x);
            }

            // Set up plugin menu items:
            pluginMenuItem           = cHost.GetMenuForPlugin(this);
            pluginMenuItem.Activate += PluginActivated;

            TD.SandBar.MenuButtonItem scriptAccessMenuItem = new TD.SandBar.MenuButtonItem("Enable script access");
            scriptAccessMenuItem.Checked   = UI.AllowScriptAccess;
            scriptAccessMenuItem.Activate += delegate
            {
                try {
                    if (UI.AllowScriptAccess)
                    {
                        foreach (INWN2Viewer viewer in NWN2ToolsetMainForm.App.GetAllViewers())
                        {
                            if (viewer is NWN2ScriptViewer)
                            {
                                System.Windows.MessageBox.Show("All scripts must be closed before script access can be disabled.",
                                                               "Close all scripts",
                                                               System.Windows.MessageBoxButton.OK,
                                                               System.Windows.MessageBoxImage.Exclamation);
                                return;
                            }
                        }
                    }

                    UI.AllowScriptAccess         = !UI.AllowScriptAccess;
                    scriptAccessMenuItem.Checked = UI.AllowScriptAccess;
                }
                catch (Exception x) {
                    MessageBox.Show("Something went wrong when changing script access settings.\n\n" + x);
                }
            };

            pluginMenuItem.Items.Add(scriptAccessMenuItem);

            TD.SandBar.MenuButtonItem launchFlip = new TD.SandBar.MenuButtonItem("Flip");
            launchFlip.Activate += delegate
            {
                try {
                    LaunchFlip();
                    //ActivityLog.Write(new Activity("LaunchedFlip","LaunchedFrom","Menu"));
                    Log.WriteAction(LogAction.launched, "flip", "from plugin menu");
                }
                catch (Exception x) {
                    MessageBox.Show("Something went wrong when trying to launch Flip.\n\n" + x);
                }
            };

            pluginMenuItem.Items.Add(launchFlip);

            //StartLogging();
        }
        /// <summary>
        /// 
        /// </summary>
        public void Startup(INWN2PluginHost cHost)
        {
            m_cMenuItem = cHost.GetMenuForPlugin(this);
            m_cMenuItem.Items.Add("Validate Module", ValidateModule);

            // Get common views, forms, and controls.
            NWN2BlueprintView blueprintView = (NWN2BlueprintView)ToolsetHelper.GetControlOfFieldType(typeof(NWN2BlueprintView));

            // Create our toolbar.
            toolBar = ToolsetHelper.GenerateToolBar("acrToolBar");
            ToolsetHelper.GetControl(typeof(ToolBarContainer), "topSandBarDock").Controls.Add(toolBar);

            // Populate it with some buttons.
            toolBar.Items.Add(ToolsetHelper.GenerateButtonItem("Creature", OpenCreatureEditor));
            toolBar.Items.Add(ToolsetHelper.GenerateButtonItem("Trigger", OpenTriggerEditor));
            toolBar.Items.Add(ToolsetHelper.GenerateButtonItem("Waypoint", OpenWaypointEditor));

            // Handle blueprint view selection changes.
            blueprintView.SelectionChanged += delegate(object sender, BlueprintSelectionChangedEventArgs e)
            {
                if (e.Selection.Length > 0 && e.Selection != e.OldSelection)
                {
                    INWN2Blueprint blueprint = (INWN2Blueprint)e.Selection[0];
                    switch ( blueprint.ObjectType )
                    {
                        case NWN2ObjectType.Creature:
                            creatureEditor.setFocus((NWN2CreatureBlueprint)blueprint);
                            break;
                        case NWN2ObjectType.Waypoint:
                            waypointEditor.setFocus((NWN2WaypointBlueprint)blueprint);
                            break;
                        case NWN2ObjectType.Trigger:
                            triggerEditor.setFocus((NWN2TriggerBlueprint)blueprint);
                            break;
                    }
                }
            };

        }
Beispiel #21
0
 public void Startup(INWN2PluginHost cHost)
 {
     m_cMenuItem = cHost.GetMenuForPlugin(this);
     m_cMenuItem.Activate += new EventHandler(this.HandlePluginLaunch);
     NWN2ToolsetMainForm.App.KeyPreview = true;
     NWN2ToolsetMainForm.App.KeyDown += new KeyEventHandler(NWN2BrushSaver);
 }
        //
        // Standard INWN2Plugin methods.
        //
        //
        // Called during late stage toolset initialization.
        //
        public virtual void Load(INWN2PluginHost Host)
        {
            ListView Lv;

            m_SettingsManager = new SettingsManager();
            m_SettingsManager.NeedSettingsLoad = true;

            //
            // By the time Load is invoked, the compiler is present.  Install
            // the compiler hook now.
            //

            m_CompilerField = GetMainFormCompilerField();

            m_ResourceAccessor = new ResourceAccessor(this);

            HookScriptCompiler();

            //
            // Hook the version control system for resource change notification
            // distribution if preferences were available at this point.
            //
            // Otherwise, wait for a change notification to install the hook.
            //
            //

            if (NWN2ToolsetMainForm.VersionControlManager.Preferences != null)
            {
                m_OriginalVCPlugin = NWN2ToolsetMainForm.VersionControlManager.Preferences.ActiveProvider;

                if (m_OriginalVCPlugin == this)
                    m_OriginalVCPlugin = null;

                NWN2ToolsetMainForm.VersionControlManager.Preferences.ActiveProvider = this;
            }
            else
            {
                NWN2Toolset.Plugins.NWN2VersionControlManagerPreferences.PreferencesChanged += this.OnVersionControlManagerPrefsChanged;
            }

            Lv = PluginUI.GetVerifyOutputListView();

            if (Lv != null)
                Lv.ItemActivate += this.OnVerifyOutputListViewItemActivated;
        }
 //
 // Called during late stage toolset deinitialization.
 //
 public virtual void Shutdown(INWN2PluginHost Host)
 {
     if (Plugin == this)
         Plugin = null;
 }
 public void Startup(INWN2PluginHost Host)
 {
     this.menuItem = Host.GetMenuForPlugin(this);
     this.menuItem.Activate += new EventHandler(this.TerrainImporter_Activate);
 }
        //
        // Called during early stage toolset initialization.
        //
        public virtual void Startup(INWN2PluginHost Host)
        {
            //
            // Spin up the plugin menu UI.
            //

            Plugin = this;

            m_MenuItem = Host.GetMenuForPlugin(this);
            m_MenuItem.Activate += new EventHandler(this.OnPluginMenuActivated);
        }
Beispiel #26
0
 public void Shutdown(INWN2PluginHost cHost)
 {
 }
        //
        // Called during early stage toolset deinitialization.
        //
        public virtual void Unload(INWN2PluginHost Host)
        {
            ListView Lv;

            //
            // Early toolset teardown; deinitialize the script compiler hook so
            // that we may unload cleanly.
            //

            Lv = PluginUI.GetVerifyOutputListView();

            if (Lv != null)
                Lv.ItemActivate -= this.OnVerifyOutputListViewItemActivated;

            UnhookScriptCompiler();

            if (NWN2ToolsetMainForm.VersionControlManager.Preferences != null)
            {
                if (NWN2ToolsetMainForm.VersionControlManager.Preferences.ActiveProvider == this)
                    NWN2ToolsetMainForm.VersionControlManager.Preferences.ActiveProvider = m_OriginalVCPlugin;

                m_OriginalVCPlugin = null;
            }

            m_SettingsManager = null;
        }
Beispiel #28
0
 public void Unload(INWN2PluginHost cHost)
 {
 }
 public void Startup(INWN2PluginHost cHost)
 {
     m_cMenuItem = cHost.GetMenuForPlugin(this);
     m_cMenuItem.Items.Add("Maximize all creature HP", new EventHandler(this.MaxHp));
     m_cMenuItem.Items.Add("Halve all creature HP", new EventHandler(this.HalfHp));
     m_cMenuItem.Items.Add("Average all creature HP", new EventHandler(this.AverageHp));
 }