/// <summary> /// Cammans needed before a File is saved /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BeforeFileSave(LoadedPackage sender, FileNameEventArg e) { if (!resloader.Flush()) { e.Cancel = true; } }
/// <summary> /// Commands called before a File is loaded /// </summary> void BeforeFileLoad(LoadedPackage sender, FileNameEventArg e) { if (!ClosePackage()) { e.Cancel = true; } }
/// <summary> /// Fired when a Resource was changed by a ToolPlugin and the Enabled state needs to be changed /// </summary> public void ChangeEnabledStateEventHandler(object sender, SimPe.Events.ResourceEventArgs e) { lp = e.LoadedPackage; ll.Enabled = tool.ChangeEnabledStateEventHandler(sender, e); //if (bi!=null) mi.Enabled = ll.Enabled; lasteventarg = e; }
/// <summary> /// Commands neede after a File Save /// </summary> /// <param name="sender"></param> private void AfterFileSave(LoadedPackage sender) { UpdateFileInfo(); package.UpdateProviders(); /*if (lasttreeview!=null) * { * System.Windows.Forms.TreeViewEventArgs tvea = new TreeViewEventArgs(this.lasttreeview.SelectedNode, TreeViewAction.ByMouse); * SelectResourceNode(this.lasttreeview, tvea); * }*/ }
/// <summary> /// Create a new Instance /// </summary> /// <param name="dc">The document Container that receives the Plugins</param> /// <param name="lp">The Container for the currently loaded package</param> public ResourceLoader(TD.SandDock.TabControl dc, LoadedPackage lp) { this.dc = dc; pkg = lp; loaded = new Hashtable(); single = new Hashtable(); if (srl == null) { srl = this; } }
internal PluginManager( ToolStripMenuItem toolmenu, ToolStrip tootoolbar, TD.SandDock.TabControl dc, LoadedPackage lp, SteepValley.Windows.Forms.ThemedControls.XPTaskBox defaultactiontaskbox, ContextMenuStrip defaultactionmenu, SteepValley.Windows.Forms.ThemedControls.XPTaskBox toolactiontaskbox, SteepValley.Windows.Forms.ThemedControls.XPTaskBox extactiontaskbox, ToolStrip actiontoolbar, Ambertation.Windows.Forms.DockContainer docktooldc, ToolStripMenuItem helpmenu, SimPe.Windows.Forms.ResourceListViewExt lv ) : base(true) { Splash.Screen.SetMessage("Loading Type Registry"); SimPe.PackedFiles.TypeRegistry tr = new SimPe.PackedFiles.TypeRegistry(); FileTable.ProviderRegistry = tr; FileTable.ToolRegistry = tr; FileTable.WrapperRegistry = tr; FileTable.CommandLineRegistry = tr; FileTable.HelpTopicRegistry = tr; FileTable.SettingsRegistry = tr; wloader = new LoadFileWrappersExt(); this.LoadDynamicWrappers(); this.LoadStaticWrappers(); this.LoadMenuItems(toolmenu, tootoolbar); Splash.Screen.SetMessage("Loading Listeners"); wloader.AddListeners(ref ChangedGuiResourceEvent); //dc.ActiveDocumentChanged += new TD.SandDock.ActiveDocumentEventHandler(wloader.ActiveDocumentChanged); //lp.AfterFileLoad += new SimPe.Events.PackageFileLoadedEvent(wloader.ChangedPackage); Splash.Screen.SetMessage("Loading Default Actions"); LoadActionTools(defaultactiontaskbox, actiontoolbar, defaultactionmenu, GetDefaultActions(lv)); Splash.Screen.SetMessage("Loading External Tools"); LoadActionTools(toolactiontaskbox, actiontoolbar, defaultactionmenu, LoadExternalTools()); Splash.Screen.SetMessage("Loading Default Tools"); LoadActionTools(extactiontaskbox, actiontoolbar, null, null); Splash.Screen.SetMessage("Loading Docks"); LoadDocks(docktooldc, lp); Splash.Screen.SetMessage("Loading Help Topics"); lht = new LoadHelpTopics(helpmenu); Splash.Screen.SetMessage("Loaded Help Topics"); }
internal RemoteHandler(System.Windows.Forms.Form form, LoadedPackage lp, ResourceLoader rl, System.Windows.Forms.ToolStripMenuItem docmenu) { this.lp = lp; this.rl = rl; docs = docmenu; this.plugger = null; RemoteControl.OpenPackageFkt = new SimPe.RemoteControl.OpenPackageDelegate(OpenPackage); RemoteControl.OpenPackedFileFkt = new SimPe.RemoteControl.OpenPackedFileDelegate(OpenPackedFile); RemoteControl.OpenMemoryPackageFkt = new SimPe.RemoteControl.OpenMemPackageDelegate(OpenMemPackage); RemoteControl.ShowDockFkt = new SimPe.RemoteControl.ShowDockDelegate(ShowDock); RemoteControl.ApplicationForm = form; }
void LoadDocks(Ambertation.Windows.Forms.DockContainer dc, LoadedPackage lp) { foreach (SimPe.Interfaces.IDockableTool idt in FileTable.ToolRegistry.Docks) { Ambertation.Windows.Forms.DockPanel dctrl = idt.GetDockableControl(); if (dctrl != null) { dctrl.Name = "dc." + idt.GetType().Namespace + "." + idt.GetType().Name; dctrl.Manager = dc.Manager; dc.Controls.Add(dctrl); //dctrl.DockNextTo(dc); ChangedGuiResourceEvent += new SimPe.Events.ChangedResourceEvent(idt.RefreshDock); dctrl.Tag = idt.Shortcut; idt.RefreshDock(this, new SimPe.Events.ResourceEventArgs(lp)); } } }
private void SetupMainForm() { SimPe.Splash.Screen.SetMessage(SimPe.Localization.GetString("Creating GUI")); if (Helper.DebugMode) { ToolStripButton tbDebug = new ToolStripButton(); tbDebug.Text = "Debug docks"; toolBar1.Items.Add(tbDebug); tbDebug.Click += new EventHandler(tbDebug_Click); } manager.Visible = false; tbContainer.Visible = false; createdmenus = false; Wait.Bar = this.waitControl1; package = new LoadedPackage(); package.BeforeFileLoad += new PackageFileLoadEvent(BeforeFileLoad); package.AfterFileLoad += new PackageFileLoadedEvent(AfterFileLoad); package.BeforeFileSave += new PackageFileSaveEvent(BeforeFileSave); package.AfterFileSave += new PackageFileSavedEvent(AfterFileSave); package.IndexChanged += new EventHandler(ChangedActiveIndex); //package.AddedResource += new EventHandler(AddedRemovedIndexResource); //package.RemovedResource += new EventHandler(AddedRemovedIndexResource); SimPe.Splash.Screen.SetMessage(SimPe.Localization.GetString("Building View Filter")); filter = new ViewFilter(); SimPe.Splash.Screen.SetMessage(SimPe.Localization.GetString("Starting Resource Loader")); resloader = new ResourceLoader(dc, package); SimPe.Splash.Screen.SetMessage(SimPe.Localization.GetString("Enabling RemoteControl")); remote = new RemoteHandler(this, package, resloader, miWindow); SimPe.Splash.Screen.SetMessage(SimPe.Localization.GetString("Loading Plugins...")); plugger = new PluginManager( miTools, tbTools, dc, package, tbDefaultAction, miAction, tbExtAction, tbPlugAction, tbAction, dockBottom, this.mbiTopics, lv ); SimPe.Splash.Screen.SetMessage(SimPe.Localization.GetString("Loaded Plugins")); plugger.ClosedToolPlugin += new ToolMenuItemExt.ExternalToolNotify(ClosedToolPlugin); remote.SetPlugger(plugger); remote.LoadedResource += new ChangedResourceEvent(rh_LoadedResource); package.UpdateRecentFileMenu(this.miRecent); InitTheme(); dockBottom.Height = ((this.Height * 3) / 4); this.Text += " (Version " + Helper.SimPeVersion.ProductVersion + ")"; TD.SandDock.SandDockManager sdm2 = new TD.SandDock.SandDockManager(); sdm2.OwnerForm = this; ThemeManager.Global.AddControl(sdm2); this.dc.Manager = sdm2; InitMenuItems(); this.dcPlugin.Open(); Ambertation.Windows.Forms.ToolStripRuntimeDesigner.Add(tbContainer); Ambertation.Windows.Forms.ToolStripRuntimeDesigner.LineUpToolBars(tbContainer); this.menuBar1.ContextMenuStrip = tbContainer.TopToolStripPanel.ContextMenuStrip; Ambertation.Windows.Forms.Serializer.Global.Register(tbContainer); Ambertation.Windows.Forms.Serializer.Global.Register(manager); manager.NoCleanup = false; manager.ForceCleanUp(); //this.dcResource.BringToFront(); //this.dcResourceList.BringToFront(); lv.Filter = filter; waitControl1.ShowProgress = false; waitControl1.Progress = 0; waitControl1.Message = ""; waitControl1.Visible = Helper.WindowsRegistry.ShowWaitBarPermanent; }
/// <summary> /// Commands that are called after the load /// </summary> /// <param name="sender"></param> void AfterFileLoad(LoadedPackage sender) { sender.UpdateProviders(); ShowNewFile(true); }