private void lblRefLevel_Click(object sender, EventArgs e) { if (_tool.ReferenceLevel == null) { WadActions.LoadReferenceLevel(_tool, this); } }
public FormMain(WadToolClass tool) { InitializeComponent(); Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); // Only how debug menu when a debugger is attached... debugToolStripMenuItem.Visible = Debugger.IsAttached; _tool = tool; panel3D.Configuration = tool.Configuration; panel3D.InitializeRendering(DeviceManager.DefaultDeviceManager.Device, tool.Configuration.RenderingItem_Antialias); tool.EditorEventRaised += Tool_EditorEventRaised; Tool_EditorEventRaised(new InitEvent()); // Load window size Configuration.LoadWindowProperties(this, _tool.Configuration); // Try to load reference project on start-up, if specified in config if (!string.IsNullOrEmpty(tool.Configuration.Tool_ReferenceProject) && File.Exists(tool.Configuration.Tool_ReferenceProject)) { WadActions.LoadReferenceLevel(tool, this, tool.Configuration.Tool_ReferenceProject); } }
private void ConvertSourceToTR5MainToolStripMenuItem_Click(object sender, EventArgs e) { Wad2 dest = WadActions.ConvertWad2ToTR5Main(_tool, this, _tool.SourceWad); Wad2Writer.SaveToFile(dest, "F:\\temp.wad2"); WadActions.LoadWad(_tool, this, true, "F:\\temp.wad2"); }
private void newSpriteSequenceToolStripMenuItem_Click(object sender, EventArgs e) { var result = WadActions.CreateObject(_tool, this, new WadSpriteSequence(new WadSpriteSequenceId())); if (result != null) { treeDestWad.Select(result); } }
private void treeDestWad_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Delete: WadActions.DeleteObjects(_tool, this, WadArea.Destination, treeDestWad.SelectedWadObjectIds.ToList()); break; } }
private void butChangeSlot_Click(object sender, EventArgs e) { var result = WadActions.ChangeSlot(_tool, this); if (result != null) { treeDestWad.Select(result); } }
private void TryMakeNewWad() { var result = CheckIfSaved(); if (result == DialogResult.Yes) { WadActions.SaveWad(_tool, this, _tool.DestinationWad, false); } else if (result == DialogResult.Cancel) { return; } WadActions.CreateNewWad(_tool, this); }
private void TryOpenDestWad() { var result = CheckIfSaved(); if (result == DialogResult.Yes) { WadActions.SaveWad(_tool, this, _tool.DestinationWad, false); } else if (result == DialogResult.Cancel) { return; } WadActions.LoadWadOpenFileDialog(_tool, this, true); }
private void CopyObject(bool otherSlot) { var result = WadActions.CopyObject(_tool, this, treeSourceWad.SelectedWadObjectIds.ToList(), otherSlot); if (result != null) { if (result.Count > 0) { treeDestWad.Select(result); } else { _tool.SendMessage("No objects were copied because they are already in different slots.", PopupType.Warning); } } else { _tool.SendMessage("No objects were copied.", PopupType.Info); } }
protected override void OnFormClosing(FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing || e.CloseReason == CloseReason.None) { var result = CheckIfSaved(); if (result == DialogResult.Yes) { WadActions.SaveWad(_tool, this, _tool.DestinationWad, false); } else if (result == DialogResult.Cancel) { e.Cancel = true; return; } Configuration.SaveWindowProperties(this, _tool.Configuration); _tool.Configuration.SaveTry(); } base.OnFormClosing(e); }
private void butCloseRefLevel_Click(object sender, EventArgs e) { WadActions.UnloadReferenceLevel(_tool); }
private void openReferenceLevelToolStripMenuItem_Click(object sender, EventArgs e) { WadActions.LoadReferenceLevel(_tool, this); }
private void butOpenRefLevel_Click(object sender, EventArgs e) { WadActions.LoadReferenceLevel(_tool, this); }
private void treeSourceWad_ClickOnEmpty(object sender, EventArgs e) { WadActions.LoadWadOpenFileDialog(_tool, this, false); }
private void butEditSpriteSequence_Click(object sender, EventArgs e) { WadActions.EditObject(_tool, this, DeviceManager.DefaultDeviceManager); }
private void butEditStaticModel_Click(object sender, EventArgs e) { WadActions.EditObject(_tool, this, DeviceManager.DefaultDeviceManager); }
private void editAnimationsToolStripMenuItem_Click(object sender, EventArgs e) { WadActions.EditObject(_tool, this, DeviceManager.DefaultDeviceManager); }
private void importModelAsStaticMeshToolStripMenuItem_Click(object sender, EventArgs e) { WadActions.ImportModelAsStaticMesh(_tool, this); }
private void butSaveAs_Click(object sender, EventArgs e) { WadActions.SaveWad(_tool, this, _tool.DestinationWad, true); }
private void butOpenSourceWad_Click(object sender, EventArgs e) { WadActions.LoadWadOpenFileDialog(_tool, this, false); }
private void closeReferenceLevelToolStripMenuItem_Click(object sender, EventArgs e) { WadActions.UnloadReferenceLevel(_tool); }
private void butEditSkeleton_Click(object sender, EventArgs e) { WadActions.EditSkeletion(_tool, this); }
private void editSkeletonToolStripMenuItem_Click(object sender, EventArgs e) { WadActions.EditSkeletion(_tool, this); }
public static void Main(string[] args) { // Load configuration var initialEvents = new List <LogEventInfo>(); var configuration = new Configuration().LoadOrUseDefault <Configuration>(initialEvents); // Update DarkUI configuration Colors.Brightness = configuration.UI_FormColor_Brightness / 100.0f; // Setup logging using (var log = new Logging(configuration.Log_MinLevel, configuration.Log_WriteToFile, configuration.Log_ArchiveN, initialEvents)) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.ThreadException += (sender, e) => { log.HandleException(e.Exception); using (var dialog = new ThreadExceptionDialog(e.Exception)) if (dialog.ShowDialog() == DialogResult.Abort) { Environment.Exit(1); } }; // Show startup help if (configuration.StartUpHelp_Show) { var help = new FormStartupHelp(); Application.Run(help); switch (help.DialogResult) { case DialogResult.Cancel: return; case DialogResult.OK: configuration.StartUpHelp_Show = false; break; } } configuration.SaveTry(); // Run if (!File.Exists(Application.StartupPath + "\\Catalogs\\TrCatalog.xml")) { MessageBox.Show("TrCatalog.xml is missing.\nMake sure you have TrCatalog.xml in /Catalogs/ subfolder."); Environment.Exit(1); } TrCatalog.LoadCatalog(Application.StartupPath + "\\Catalogs\\TRCatalog.xml"); Application.AddMessageFilter(new ControlScrollFilter()); SynchronizationContext.SetSynchronizationContext(new WindowsFormsSynchronizationContext()); using (WadToolClass tool = new WadToolClass(configuration)) { string startWad = null; string refLevel = null; if (args.Length > 0) { bool loadAsRefLevel = false; foreach (var arg in args) { if (arg.Equals("-r", StringComparison.InvariantCultureIgnoreCase)) { loadAsRefLevel = true; } else { if (!File.Exists(arg)) { continue; // No file and no valid argument, don't even try to load anything } if (loadAsRefLevel) { if (arg.EndsWith("prj2", StringComparison.InvariantCultureIgnoreCase)) { refLevel = arg; } } else { startWad = arg; } loadAsRefLevel = false; // Reset arg mode if no expected path was found next to it } } } using (FormMain form = new FormMain(tool)) { form.Show(); if (!string.IsNullOrEmpty(refLevel)) { WadActions.LoadReferenceLevel(tool, form, refLevel); } if (!string.IsNullOrEmpty(startWad)) { WadActions.LoadWad(tool, form, true, startWad); } Application.Run(form); } } } }