From: <ju...@us...> - 2006-07-28 21:41:36
|
Revision: 667 Author: julienq Date: 2006-07-27 08:47:59 -0700 (Thu, 27 Jul 2006) ViewCVS: http://svn.sourceforge.net/urakawa/?rev=667&view=rev Log Message: ----------- Starting to add assets. Not much there yet. Modified Paths: -------------- trunk/urakawa/application/Obi/Obi/Events/Node/NodeEventArgs.cs trunk/urakawa/application/Obi/Obi/Obi.csproj trunk/urakawa/application/Obi/Obi/ObiForm.Designer.cs trunk/urakawa/application/Obi/Obi/ObiForm.cs trunk/urakawa/application/Obi/Obi/Project.cs trunk/urakawa/application/Obi/Obi/UserControls/ProjectPanel.cs trunk/urakawa/application/Obi/Obi/UserControls/SectionStrip.Designer.cs trunk/urakawa/application/Obi/Obi/UserControls/StripManagerPanel.Designer.cs trunk/urakawa/application/Obi/Obi/UserControls/StripManagerPanel.cs Added Paths: ----------- trunk/urakawa/application/Obi/Obi/Events/Strip/ImportAssetEventArgs.cs Modified: trunk/urakawa/application/Obi/Obi/Events/Node/NodeEventArgs.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/Events/Node/NodeEventArgs.cs 2006-07-27 10:08:09 UTC (rev 666) +++ trunk/urakawa/application/Obi/Obi/Events/Node/NodeEventArgs.cs 2006-07-27 15:47:59 UTC (rev 667) @@ -14,7 +14,6 @@ public delegate void RequestToMoveNodeUpHandler(object sender, NodeEventArgs e); public delegate void RequestToMoveNodeDownHandler(object sender, NodeEventArgs e); - public delegate void IncreasedNodeLevelHandler(object sender, NodeEventArgs e); public delegate void DecreasedNodeLevelHandler(object sender, NodeEventArgs e); public delegate void DeletedNodeHandler(object sender, NodeEventArgs e); Added: trunk/urakawa/application/Obi/Obi/Events/Strip/ImportAssetEventArgs.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/Events/Strip/ImportAssetEventArgs.cs (rev 0) +++ trunk/urakawa/application/Obi/Obi/Events/Strip/ImportAssetEventArgs.cs 2006-07-27 15:47:59 UTC (rev 667) @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using urakawa.core; + +namespace Obi.Events.Strip +{ + public delegate void RequestToImportAssetHandler(object sender, ImportAssetEventArgs e); + + // TODO: position of the phrase in this asset + public class ImportAssetEventArgs + { + private CoreNode mSectionNode; // the section in which the phrase is to be added + private string mAssetPath; // the path of the asset to add + + public CoreNode SectionNode + { + get + { + return mSectionNode; + } + } + + public string AssetPath + { + get + { + return mAssetPath; + } + } + + public ImportAssetEventArgs(CoreNode sectionNode, string assetPath) + { + mSectionNode = sectionNode; + mAssetPath = assetPath; + } + } +} Modified: trunk/urakawa/application/Obi/Obi/Obi.csproj =================================================================== --- trunk/urakawa/application/Obi/Obi/Obi.csproj 2006-07-27 10:08:09 UTC (rev 666) +++ trunk/urakawa/application/Obi/Obi/Obi.csproj 2006-07-27 15:47:59 UTC (rev 667) @@ -47,9 +47,9 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="Commands, Version=1.0.2392.27219, Culture=neutral"> + <Reference Include="Commands, Version=1.0.2399.28565, Culture=neutral"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\Commands\bin\Debug\Commands.dll</HintPath> + <HintPath>..\..\VirtualAudioBackend\bin\Debug\Commands.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> @@ -66,6 +66,10 @@ <SpecificVersion>False</SpecificVersion> <HintPath>..\..\UrakawaApplicationBackend\obj\Debug\UrakawaApplicationBackend.dll</HintPath> </Reference> + <Reference Include="VirtualAudioBackend, Version=1.0.2399.28607, Culture=neutral"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\VirtualAudioBackend\bin\Debug\VirtualAudioBackend.dll</HintPath> + </Reference> </ItemGroup> <ItemGroup> <Compile Include="Commands\CommandManager.cs" /> @@ -101,6 +105,7 @@ <Compile Include="Events\Node\RenameNodeEventArgs.cs" /> <Compile Include="Events\Project\CommandCreatedEventArgs.cs" /> <Compile Include="Events\Project\StateChangedEventArgs.cs" /> + <Compile Include="Events\Strip\ImportAssetEventArgs.cs" /> <Compile Include="Events\Strip\SelectedEventArgs.cs" /> <Compile Include="Events\Node\AddedSectionNodeEventArgs.cs" /> <Compile Include="Localizer.cs" /> Modified: trunk/urakawa/application/Obi/Obi/ObiForm.Designer.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/ObiForm.Designer.cs 2006-07-27 10:08:09 UTC (rev 666) +++ trunk/urakawa/application/Obi/Obi/ObiForm.Designer.cs 2006-07-27 15:47:59 UTC (rev 667) @@ -43,6 +43,9 @@ this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.mUndoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.mRedoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.metadataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.touchProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.mTocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -62,9 +65,8 @@ this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.mProjectPanel = new Obi.UserControls.ProjectPanel(); - this.mUndoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.mRedoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); + this.importAssetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); @@ -193,17 +195,38 @@ this.editToolStripMenuItem.Size = new System.Drawing.Size(37, 20); this.editToolStripMenuItem.Text = "&Edit"; // + // mUndoToolStripMenuItem + // + this.mUndoToolStripMenuItem.Name = "mUndoToolStripMenuItem"; + this.mUndoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z))); + this.mUndoToolStripMenuItem.Size = new System.Drawing.Size(140, 22); + this.mUndoToolStripMenuItem.Text = "&Undo"; + this.mUndoToolStripMenuItem.Click += new System.EventHandler(this.mUndoToolStripMenuItem_Click); + // + // mRedoToolStripMenuItem + // + this.mRedoToolStripMenuItem.Name = "mRedoToolStripMenuItem"; + this.mRedoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y))); + this.mRedoToolStripMenuItem.Size = new System.Drawing.Size(140, 22); + this.mRedoToolStripMenuItem.Text = "&Redo"; + this.mRedoToolStripMenuItem.Click += new System.EventHandler(this.mRedoToolStripMenuItem_Click); + // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + this.toolStripSeparator4.Size = new System.Drawing.Size(137, 6); + // // metadataToolStripMenuItem // this.metadataToolStripMenuItem.Name = "metadataToolStripMenuItem"; - this.metadataToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.metadataToolStripMenuItem.Size = new System.Drawing.Size(140, 22); this.metadataToolStripMenuItem.Text = "&Metadata"; this.metadataToolStripMenuItem.Click += new System.EventHandler(this.metadataToolStripMenuItem_Click); // // touchProjectToolStripMenuItem // this.touchProjectToolStripMenuItem.Name = "touchProjectToolStripMenuItem"; - this.touchProjectToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.touchProjectToolStripMenuItem.Size = new System.Drawing.Size(140, 22); this.touchProjectToolStripMenuItem.Text = "&Touch project"; this.touchProjectToolStripMenuItem.Click += new System.EventHandler(this.touchProjectToolStripMenuItem_Click); // @@ -267,7 +290,9 @@ // this.mStripsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mAddStripToolStripMenuItem, - this.renameStripToolStripMenuItem}); + this.renameStripToolStripMenuItem, + this.toolStripSeparator5, + this.importAssetToolStripMenuItem}); this.mStripsToolStripMenuItem.Name = "mStripsToolStripMenuItem"; this.mStripsToolStripMenuItem.Size = new System.Drawing.Size(47, 20); this.mStripsToolStripMenuItem.Text = "Strips"; @@ -275,13 +300,13 @@ // mAddStripToolStripMenuItem // this.mAddStripToolStripMenuItem.Name = "mAddStripToolStripMenuItem"; - this.mAddStripToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.mAddStripToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.mAddStripToolStripMenuItem.Text = "&Add strip"; // // renameStripToolStripMenuItem // this.renameStripToolStripMenuItem.Name = "renameStripToolStripMenuItem"; - this.renameStripToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.renameStripToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.renameStripToolStripMenuItem.Text = "&Rename strip"; // // toolsToolStripMenuItem @@ -336,27 +361,17 @@ this.mProjectPanel.Size = new System.Drawing.Size(767, 450); this.mProjectPanel.TabIndex = 4; // - // mUndoToolStripMenuItem + // toolStripSeparator5 // - this.mUndoToolStripMenuItem.Name = "mUndoToolStripMenuItem"; - this.mUndoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z))); - this.mUndoToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.mUndoToolStripMenuItem.Text = "&Undo"; - this.mUndoToolStripMenuItem.Click += new System.EventHandler(this.mUndoToolStripMenuItem_Click); + this.toolStripSeparator5.Name = "toolStripSeparator5"; + this.toolStripSeparator5.Size = new System.Drawing.Size(149, 6); // - // mRedoToolStripMenuItem + // importAssetToolStripMenuItem // - this.mRedoToolStripMenuItem.Name = "mRedoToolStripMenuItem"; - this.mRedoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y))); - this.mRedoToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.mRedoToolStripMenuItem.Text = "&Redo"; - this.mRedoToolStripMenuItem.Click += new System.EventHandler(this.mRedoToolStripMenuItem_Click); + this.importAssetToolStripMenuItem.Name = "importAssetToolStripMenuItem"; + this.importAssetToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.importAssetToolStripMenuItem.Text = "&Import asset"; // - // toolStripSeparator4 - // - this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6); - // // ObiForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -419,6 +434,8 @@ private System.Windows.Forms.ToolStripMenuItem mUndoToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem mRedoToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; + private System.Windows.Forms.ToolStripMenuItem importAssetToolStripMenuItem; } Modified: trunk/urakawa/application/Obi/Obi/ObiForm.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/ObiForm.cs 2006-07-27 10:08:09 UTC (rev 666) +++ trunk/urakawa/application/Obi/Obi/ObiForm.cs 2006-07-27 15:47:59 UTC (rev 667) @@ -329,6 +329,8 @@ new EventHandler(mProjectPanel.StripManager.addStripToolStripMenuItem_Click); renameStripToolStripMenuItem.Click += new EventHandler(mProjectPanel.StripManager.renameStripToolStripMenuItem_Click); + importAssetToolStripMenuItem.Click += + new EventHandler(mProjectPanel.StripManager.importAssetToolStripMenuItem_Click); } private void StripManager_Selected(object sender, Events.Strip.SelectedEventArgs e) Modified: trunk/urakawa/application/Obi/Obi/Project.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/Project.cs 2006-07-27 10:08:09 UTC (rev 666) +++ trunk/urakawa/application/Obi/Obi/Project.cs 2006-07-27 15:47:59 UTC (rev 667) @@ -1,10 +1,12 @@ using System; using System.Collections; using System.Collections.Generic; +using System.IO; using System.Text; using urakawa.core; using urakawa.media; +using VirtualAudioBackend; namespace Obi { @@ -25,6 +27,9 @@ private Channel mTextChannel; // handy pointer to the text channel private Channel mAnnotationChannel; // handy pointer to the annotation channel + private AssetManager mAssManager; // the asset manager + private string mAssPath; // the path to the asset manager directory + private bool mUnsaved; // saved flag private string mXUKPath; // path to the project XUK file private string mLastPath; // last path to which the project was saved (see save as) @@ -98,6 +103,7 @@ public Project() : base() { + mAssManager = null; mUnsaved = false; mXUKPath = null; } @@ -114,6 +120,8 @@ public void Create(string xukPath, string title, string id, UserProfile userProfile, bool createTitle) { mXUKPath = xukPath; + mAssPath = GetAssetDirectory(xukPath); + mAssManager = new AssetManager(mAssPath); mMetadata = CreateMetadata(title, id, userProfile); mAudioChannel = getPresentation().getChannelFactory().createChannel(AudioChannel); getPresentation().getChannelsManager().addChannel(mAudioChannel); @@ -132,6 +140,18 @@ } /// <summary> + /// Get a suitable directory name to store the assets. + /// </summary> + /// <param name="xukPath"></param> + /// <returns></returns> + private string GetAssetDirectory(string path) + { + string assetdir = Path.GetDirectoryName(path) + @"\" + Path.GetFileNameWithoutExtension(path) + "_assets"; + System.Diagnostics.Debug.Print("Directory for assets: {0}", assetdir); + return assetdir; + } + + /// <summary> /// Open a project from a XUK file. /// Throw an exception if the file could not be read. /// </summary> @@ -166,10 +186,19 @@ case "dc:Publisher": mMetadata.Publisher = meta.getContent(); break; + case "obi:assetsdir": + mAssPath = meta.getContent(); + break; default: break; } } + if (mAssPath == null) + { + mAssPath = GetAssetDirectory(mXUKPath); + AddMetadata("obi:assetsdir", mAssPath); + } + mAssManager = new AssetManager(mAssPath); StateChanged(this, new Events.Project.StateChangedEventArgs(Events.Project.StateChange.Opened)); } else @@ -210,6 +239,7 @@ urakawa.project.Metadata metaDate = AddMetadata("dc:Date", DateTime.Today.ToString("yyyy-MM-dd")); if (metaDate != null) metaDate.setScheme("YYYY-MM-DD"); AddMetadata("xuk:generator", "Obi+Urakawa toolkit; let's share the blame."); + AddMetadata("obi:assetsdir", mAssPath); return metadata; } @@ -350,7 +380,7 @@ StateChanged(this, new Events.Project.StateChangedEventArgs(Events.Project.StateChange.Modified)); Commands.TOC.AddSection command = new Commands.TOC.AddSection(this, sibling, parent, parent.indexOf(sibling), visitor.Position); - //MED CommandCreated(this, new Events.Project.CommandCreatedEventArgs(command)); + CommandCreated(this, new Events.Project.CommandCreatedEventArgs(command)); } public void CreateSiblingSectionRequested(object sender, Events.Node.NodeEventArgs e) @@ -374,7 +404,7 @@ StateChanged(this, new Events.Project.StateChangedEventArgs(Events.Project.StateChange.Modified)); Commands.TOC.AddSection command = new Commands.TOC.AddSection(this, child, parent, parent.indexOf(child), visitor.Position); - //MEDCommandCreated(this, new Events.Project.CommandCreatedEventArgs(command)); + CommandCreated(this, new Events.Project.CommandCreatedEventArgs(command)); } public void CreateChildSectionRequested(object sender, Events.Node.NodeEventArgs e) @@ -667,7 +697,7 @@ RenamedNode(this, new Events.Node.RenameNodeEventArgs(origin, node, label)); mUnsaved = true; StateChanged(this, new Events.Project.StateChangedEventArgs(Events.Project.StateChange.Modified)); - //MEDif (command != null) CommandCreated(this, new Events.Project.CommandCreatedEventArgs(command)); + if (command != null) CommandCreated(this, new Events.Project.CommandCreatedEventArgs(command)); } public void RenameNodeRequested(object sender, Events.Node.RenameNodeEventArgs e) @@ -675,6 +705,21 @@ RenameNode(sender, e.Node, e.Label); } + /// <summary> + /// Create a new phrase node and add it to the section node. + /// (Well it's not added yet because otherwise it would create all sorts of problems.) + /// </summary> + public void ImportPhraseRequested(object sender, Events.Strip.ImportAssetEventArgs e) + { + ArrayList list = new ArrayList(1); + list.Add(new AudioClip(e.AssetPath)); + AudioMediaAsset asset = mAssManager.NewAudioMediaAsset(list); + CoreNode node = CreatePhraseNode(asset); + // e.SectionNode.appendChild(node); + mUnsaved = true; + StateChanged(this, new Events.Project.StateChangedEventArgs(Events.Project.StateChange.Modified)); + // notify the strip panel + } #endregion @@ -687,13 +732,37 @@ { CoreNode node = getPresentation().getCoreNodeFactory().createNode(); ChannelsProperty prop = (ChannelsProperty)node.getProperty(typeof(ChannelsProperty)); - TextMedia text = (TextMedia)getPresentation().getMediaFactory().createMedia(MediaType.TEXT); + TextMedia text = (TextMedia)getPresentation().getMediaFactory().createMedia(urakawa.media.MediaType.TEXT); text.setText(Localizer.Message("default_section_label")); prop.setMedia(mTextChannel, text); return node; } /// <summary> + /// Create a new phrase node from an asset. + /// Add a default annotation with the name of the file (should be the original name, not the internal one.) + /// Add a seq media object with the clips of the audio asset. Do not forget to set begin/end time explicitely. + /// </summary> + /// <param name="asset">The asset for the phrase.</param> + /// <returns>The created node.</returns> + private CoreNode CreatePhraseNode(AudioMediaAsset asset) + { + CoreNode node = getPresentation().getCoreNodeFactory().createNode(); + ChannelsProperty prop = (ChannelsProperty)node.getProperty(typeof(ChannelsProperty)); + TextMedia annotation = (TextMedia)getPresentation().getMediaFactory().createMedia(urakawa.media.MediaType.TEXT); + annotation.setText(asset.Name); + prop.setMedia(mAnnotationChannel, annotation); + SequenceMedia seq = + (SequenceMedia)getPresentation().getMediaFactory().createMedia(urakawa.media.MediaType.EMPTY_SEQUENCE); + AudioMedia audio = (AudioMedia)getPresentation().getMediaFactory().createMedia(urakawa.media.MediaType.AUDIO); + AudioClip clip = (AudioClip)asset.m_alClipList[0]; // should be clip = asset.Clip(0); or better: foreach clip... + audio.setLocation(new MediaLocation(clip.Path)); + seq.appendItem(audio); + prop.setMedia(mAudioChannel, seq); + return node; + } + + /// <summary> /// Get the text media of a core node. The result can then be used to get or set the text of a node. /// Original comments: A helper function to get the text from the given <see cref="CoreNode"/>. /// The text channel which contains the desired text will be named so that we know Modified: trunk/urakawa/application/Obi/Obi/UserControls/ProjectPanel.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/UserControls/ProjectPanel.cs 2006-07-27 10:08:09 UTC (rev 666) +++ trunk/urakawa/application/Obi/Obi/UserControls/ProjectPanel.cs 2006-07-27 15:47:59 UTC (rev 667) @@ -58,7 +58,10 @@ mProject.DeletedNode -= new Events.Node.DeletedNodeHandler(mTOCPanel.SyncDeletedNode); //comment: this used to say += but I think it was a typo + //reply: yes it was. -= is the way to go. mProject.DeletedNode -= new Events.Node.DeletedNodeHandler(mStripManagerPanel.SyncDeletedNode); + + mStripManagerPanel.ImportPhrase -= new Events.Strip.RequestToImportAssetHandler(mProject.ImportPhraseRequested); } // Set up the handlers for the new project if (value != null) @@ -91,6 +94,8 @@ mTOCPanel.RequestToDeleteSection += new Events.Node.RequestToDeleteNodeHandler(value.RemoveNodeRequested); value.DeletedNode += new Events.Node.DeletedNodeHandler(mTOCPanel.SyncDeletedNode); value.DeletedNode += new Events.Node.DeletedNodeHandler(mStripManagerPanel.SyncDeletedNode); + + mStripManagerPanel.ImportPhrase += new Events.Strip.RequestToImportAssetHandler(value.ImportPhraseRequested); } mProject = value; mSplitContainer.Visible = mProject != null; Modified: trunk/urakawa/application/Obi/Obi/UserControls/SectionStrip.Designer.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/UserControls/SectionStrip.Designer.cs 2006-07-27 10:08:09 UTC (rev 666) +++ trunk/urakawa/application/Obi/Obi/UserControls/SectionStrip.Designer.cs 2006-07-27 15:47:59 UTC (rev 667) @@ -68,7 +68,6 @@ this.mTextBox.Size = new System.Drawing.Size(235, 16); this.mTextBox.TabIndex = 2; this.mTextBox.Visible = false; - this.mTextBox.Leave += new System.EventHandler(this.mTextBox_Leave); this.mTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.mTextBox_KeyDown); // // SectionStrip Modified: trunk/urakawa/application/Obi/Obi/UserControls/StripManagerPanel.Designer.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/UserControls/StripManagerPanel.Designer.cs 2006-07-27 10:08:09 UTC (rev 666) +++ trunk/urakawa/application/Obi/Obi/UserControls/StripManagerPanel.Designer.cs 2006-07-27 15:47:59 UTC (rev 667) @@ -34,6 +34,8 @@ this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.addStripToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.renameStripToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.importAssetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.contextMenuStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -66,25 +68,39 @@ // this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addStripToolStripMenuItem, - this.renameStripToolStripMenuItem}); + this.renameStripToolStripMenuItem, + this.toolStripSeparator1, + this.importAssetToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.ShowImageMargin = false; - this.contextMenuStrip1.Size = new System.Drawing.Size(114, 48); + this.contextMenuStrip1.Size = new System.Drawing.Size(128, 98); // // addStripToolStripMenuItem // this.addStripToolStripMenuItem.Name = "addStripToolStripMenuItem"; - this.addStripToolStripMenuItem.Size = new System.Drawing.Size(113, 22); + this.addStripToolStripMenuItem.Size = new System.Drawing.Size(127, 22); this.addStripToolStripMenuItem.Text = "&Add strip"; this.addStripToolStripMenuItem.Click += new System.EventHandler(this.addStripToolStripMenuItem_Click); // // renameStripToolStripMenuItem // this.renameStripToolStripMenuItem.Name = "renameStripToolStripMenuItem"; - this.renameStripToolStripMenuItem.Size = new System.Drawing.Size(113, 22); + this.renameStripToolStripMenuItem.Size = new System.Drawing.Size(127, 22); this.renameStripToolStripMenuItem.Text = "&Rename strip"; this.renameStripToolStripMenuItem.Click += new System.EventHandler(this.renameStripToolStripMenuItem_Click); // + // importAssetToolStripMenuItem + // + this.importAssetToolStripMenuItem.Name = "importAssetToolStripMenuItem"; + this.importAssetToolStripMenuItem.Size = new System.Drawing.Size(127, 22); + this.importAssetToolStripMenuItem.Text = "&Import asset"; + this.importAssetToolStripMenuItem.Click += new System.EventHandler(this.importAssetToolStripMenuItem_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(124, 6); + // // StripManagerPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -106,5 +122,7 @@ private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.ToolStripMenuItem addStripToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem renameStripToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem importAssetToolStripMenuItem; } } Modified: trunk/urakawa/application/Obi/Obi/UserControls/StripManagerPanel.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/UserControls/StripManagerPanel.cs 2006-07-27 10:08:09 UTC (rev 666) +++ trunk/urakawa/application/Obi/Obi/UserControls/StripManagerPanel.cs 2006-07-27 15:47:59 UTC (rev 667) @@ -20,6 +20,7 @@ public event Events.Node.RequestToAddSiblingNodeHandler AddSiblingSection; public event Events.Node.RequestToRenameNodeHandler RenameSection; + public event Events.Strip.RequestToImportAssetHandler ImportPhrase; public event Events.Strip.SelectedHandler SelectedStrip; public CoreNode SelectedNode @@ -157,6 +158,20 @@ } } + internal void importAssetToolStripMenuItem_Click(object sender, EventArgs e) + { + if (SelectedNode != null) + { + OpenFileDialog dialog = new OpenFileDialog(); + dialog.Filter = "WAVE file (*.wav)|*.wav|Any file|*.*"; + dialog.ShowDialog(); + if (dialog.ShowDialog() == DialogResult.OK) + { + ImportPhrase(this, new Events.Strip.ImportAssetEventArgs(mSelectedNode, dialog.FileName)); + } + } + } + #endregion /// <summary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |