diff --git a/Content/UniversalEditor.Content.PlatformIndependent/Editors/RIFF/Dialogs/RIFFChunkPropertiesDialog.glade b/Content/UniversalEditor.Content.PlatformIndependent/Editors/RIFF/Dialogs/RIFFChunkPropertiesDialog.glade index c0eaa040..6e85c33a 100644 --- a/Content/UniversalEditor.Content.PlatformIndependent/Editors/RIFF/Dialogs/RIFFChunkPropertiesDialog.glade +++ b/Content/UniversalEditor.Content.PlatformIndependent/Editors/RIFF/Dialogs/RIFFChunkPropertiesDialog.glade @@ -2,6 +2,26 @@ + + True + False + 8 + 8 + 8 + 8 + gtk-open + 3 + + + True + False + 8 + 8 + 8 + 8 + gtk-save + 3 + @@ -185,7 +205,10 @@ True True True + image1 + none True + True False @@ -194,12 +217,15 @@ - + Export... True True True + image2 + none True + True False diff --git a/Libraries/UniversalEditor.UserInterface/Editors/RIFF/Dialogs/RIFFChunkPropertiesDialog.cs b/Libraries/UniversalEditor.UserInterface/Editors/RIFF/Dialogs/RIFFChunkPropertiesDialog.cs index f6e1cde7..af78e6cc 100644 --- a/Libraries/UniversalEditor.UserInterface/Editors/RIFF/Dialogs/RIFFChunkPropertiesDialog.cs +++ b/Libraries/UniversalEditor.UserInterface/Editors/RIFF/Dialogs/RIFFChunkPropertiesDialog.cs @@ -24,6 +24,7 @@ using System; using MBS.Framework.UserInterface; using MBS.Framework.UserInterface.Controls; using MBS.Framework.UserInterface.Controls.HexEditor; +using MBS.Framework.UserInterface.Dialogs; using UniversalEditor.ObjectModels.Chunked; namespace UniversalEditor.Editors.RIFF.Dialogs @@ -45,8 +46,6 @@ namespace UniversalEditor.Editors.RIFF.Dialogs { base.OnCreated(e); - cboChunkType.Changed += cboChunkType_Changed; - Buttons[0].ResponseValue = (int)DialogResult.None; Buttons[0].Click += cmdOK_Click; DefaultButton = Buttons[0]; @@ -88,7 +87,8 @@ namespace UniversalEditor.Editors.RIFF.Dialogs this.Close(); } - void cboChunkType_Changed(object sender, EventArgs e) + [EventHandler("cboChunkType", "Changed")] + private void cboChunkType_Changed(object sender, EventArgs e) { if (cboChunkType.SelectedItem == (cboChunkType.Model as DefaultTreeModel).Rows[0]) { @@ -106,5 +106,28 @@ namespace UniversalEditor.Editors.RIFF.Dialogs } } + [EventHandler("cmdImportData", "Click")] + private void cmdImportData_Click(object sender, EventArgs e) + { + FileDialog dlg = new FileDialog(); + dlg.Mode = FileDialogMode.Open; + if (dlg.ShowDialog() == DialogResult.OK) + { + hexData.Data = System.IO.File.ReadAllBytes(dlg.SelectedFileName); + } + } + + [EventHandler("cmdExportData", "Click")] + private void cmdExportData_Click(object sender, EventArgs e) + { + FileDialog dlg = new FileDialog(); + dlg.Mode = FileDialogMode.Save; + dlg.SelectedFileName = txtChunkID.Text; + if (dlg.ShowDialog() == DialogResult.OK) + { + System.IO.File.WriteAllBytes(dlg.SelectedFileName, hexData.Data); + } + } + } }