From: <ju...@us...> - 2006-07-21 10:59:39
|
Revision: 628 Author: julienq Date: 2006-07-21 03:59:22 -0700 (Fri, 21 Jul 2006) ViewCVS: http://svn.sourceforge.net/urakawa/?rev=628&view=rev Log Message: ----------- Added strip manager view; needs the new Node class to maintain more easily. Changed back to the main toolkit. Got rid of the ICoreTreeView interface. Save the "CreateTitleSection" preference from New Project dialog. Modified Paths: -------------- trunk/urakawa/application/Obi/Obi/Dialogs/NewProject.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/Settings.cs trunk/urakawa/application/Obi/Obi/UserControls/ProjectPanel.Designer.cs trunk/urakawa/application/Obi/Obi/UserControls/ProjectPanel.cs trunk/urakawa/application/Obi/Obi/UserControls/StripManagerPanel.Designer.cs trunk/urakawa/application/Obi/Obi/UserControls/StripManagerPanel.cs trunk/urakawa/application/Obi/Obi/UserControls/TOCPanel.Designer.cs trunk/urakawa/application/Obi/Obi/UserControls/TOCPanel.cs Removed Paths: ------------- trunk/urakawa/application/Obi/Obi/UserControls/ICoreTreeView.cs Modified: trunk/urakawa/application/Obi/Obi/Dialogs/NewProject.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/Dialogs/NewProject.cs 2006-07-21 09:11:20 UTC (rev 627) +++ trunk/urakawa/application/Obi/Obi/Dialogs/NewProject.cs 2006-07-21 10:59:22 UTC (rev 628) @@ -40,6 +40,10 @@ { return mAutoTitleCheckBox.Checked; } + set + { + mAutoTitleCheckBox.Checked = value; + } } /// <summary> Modified: trunk/urakawa/application/Obi/Obi/Obi.csproj =================================================================== --- trunk/urakawa/application/Obi/Obi/Obi.csproj 2006-07-21 09:11:20 UTC (rev 627) +++ trunk/urakawa/application/Obi/Obi/Obi.csproj 2006-07-21 10:59:22 UTC (rev 628) @@ -57,9 +57,9 @@ <Reference Include="System.Runtime.Serialization.Formatters.Soap" /> <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> - <Reference Include="urakawa, Version=1.0.2392.27158, Culture=neutral, processorArchitecture=MSIL"> + <Reference Include="urakawa, Version=1.0.2393.35010, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\..\branches\port-implementation-to-VS2005\implementation\UrakawaToolkit\bin\Debug\urakawa.dll</HintPath> + <HintPath>..\..\..\implementation\UrakawaToolkit\bin\Debug\urakawa.dll</HintPath> </Reference> <Reference Include="UrakawaApplicationBackend, Version=1.0.2368.31351, Culture=neutral"> <SpecificVersion>False</SpecificVersion> @@ -93,7 +93,6 @@ <Compile Include="Dialogs\UserProfile.Designer.cs"> <DependentUpon>UserProfile.cs</DependentUpon> </Compile> - <Compile Include="Events\Node\CreateEventArgs.cs" /> <Compile Include="Events\Node\DeleteSectionEventArgs.cs" /> <Compile Include="Events\Node\ExpandViewToAllDepthsEventArgs.cs" /> <Compile Include="Events\Node\AddChildSectionEventArgs.cs" /> @@ -159,6 +158,10 @@ <SubType>Designer</SubType> <DependentUpon>ProjectPanel.cs</DependentUpon> </EmbeddedResource> + <EmbeddedResource Include="UserControls\SectionStrip.resx"> + <SubType>Designer</SubType> + <DependentUpon>SectionStrip.cs</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="UserControls\StripManagerPanel.resx"> <SubType>Designer</SubType> <DependentUpon>StripManagerPanel.cs</DependentUpon> @@ -184,13 +187,20 @@ </Compile> <Compile Include="Settings.cs" /> <Compile Include="SimpleMetadata.cs" /> - <Compile Include="UserControls\ICoreTreeView.cs" /> + <Compile Include="Strips\SectionStrip.cs" /> + <Compile Include="Strips\Strip.cs" /> <Compile Include="UserControls\ProjectPanel.cs"> <SubType>UserControl</SubType> </Compile> <Compile Include="UserControls\ProjectPanel.Designer.cs"> <DependentUpon>ProjectPanel.cs</DependentUpon> </Compile> + <Compile Include="UserControls\SectionStrip.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="UserControls\SectionStrip.Designer.cs"> + <DependentUpon>SectionStrip.cs</DependentUpon> + </Compile> <Compile Include="UserControls\StripManagerPanel.cs"> <SubType>UserControl</SubType> </Compile> Modified: trunk/urakawa/application/Obi/Obi/ObiForm.Designer.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/ObiForm.Designer.cs 2006-07-21 09:11:20 UTC (rev 627) +++ trunk/urakawa/application/Obi/Obi/ObiForm.Designer.cs 2006-07-21 10:59:22 UTC (rev 628) @@ -46,9 +46,6 @@ this.metadataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.touchProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.addSectionAtSameLevelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.addSubsectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.deleteSectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tableOfContentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -57,6 +54,7 @@ this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.mProjectPanel = new Obi.UserControls.ProjectPanel(); + this.mAddSectionAtSameLevelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); @@ -185,45 +183,25 @@ // 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); // // tocToolStripMenuItem // this.tocToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.addSectionAtSameLevelToolStripMenuItem, - this.addSubsectionToolStripMenuItem, - this.deleteSectionToolStripMenuItem}); + this.mAddSectionAtSameLevelToolStripMenuItem}); this.tocToolStripMenuItem.Name = "tocToolStripMenuItem"; this.tocToolStripMenuItem.Size = new System.Drawing.Size(40, 20); this.tocToolStripMenuItem.Text = "TO&C"; // - // addSectionAtSameLevelToolStripMenuItem - // - this.addSectionAtSameLevelToolStripMenuItem.Name = "addSectionAtSameLevelToolStripMenuItem"; - this.addSectionAtSameLevelToolStripMenuItem.Size = new System.Drawing.Size(204, 22); - this.addSectionAtSameLevelToolStripMenuItem.Text = "Add §ion at same level"; - // - // addSubsectionToolStripMenuItem - // - this.addSubsectionToolStripMenuItem.Name = "addSubsectionToolStripMenuItem"; - this.addSubsectionToolStripMenuItem.Size = new System.Drawing.Size(204, 22); - this.addSubsectionToolStripMenuItem.Text = "&Add sub-section"; - // - // deleteSectionToolStripMenuItem - // - this.deleteSectionToolStripMenuItem.Name = "deleteSectionToolStripMenuItem"; - this.deleteSectionToolStripMenuItem.Size = new System.Drawing.Size(204, 22); - this.deleteSectionToolStripMenuItem.Text = "&Delete section"; - // // viewToolStripMenuItem // this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -291,6 +269,12 @@ this.mProjectPanel.Size = new System.Drawing.Size(767, 450); this.mProjectPanel.TabIndex = 4; // + // mAddSectionAtSameLevelToolStripMenuItem + // + this.mAddSectionAtSameLevelToolStripMenuItem.Name = "mAddSectionAtSameLevelToolStripMenuItem"; + this.mAddSectionAtSameLevelToolStripMenuItem.Size = new System.Drawing.Size(204, 22); + this.mAddSectionAtSameLevelToolStripMenuItem.Text = "&Add section at same level"; + // // ObiForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -341,9 +325,7 @@ private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem tableOfContentsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem tocToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem addSubsectionToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem addSectionAtSameLevelToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem deleteSectionToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem mAddSectionAtSameLevelToolStripMenuItem; } Modified: trunk/urakawa/application/Obi/Obi/ObiForm.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/ObiForm.cs 2006-07-21 09:11:20 UTC (rev 627) +++ trunk/urakawa/application/Obi/Obi/ObiForm.cs 2006-07-21 10:59:22 UTC (rev 628) @@ -47,6 +47,7 @@ private void mNewProjectToolStripMenuItem_Click(object sender, EventArgs e) { Dialogs.NewProject dialog = new Dialogs.NewProject(mSettings.DefaultPath); + dialog.CreateTitleSection = mSettings.CreateTitleSection; if (dialog.ShowDialog() == DialogResult.OK) { if (ClosedProject()) @@ -55,6 +56,7 @@ mProject.StateChanged += new Obi.Events.Project.StateChangedHandler(mProject_StateChanged); mProject.Create(dialog.Path, dialog.Title, mSettings.IdTemplate, mSettings.UserProfile, dialog.CreateTitleSection); + mSettings.CreateTitleSection = dialog.CreateTitleSection; } else { @@ -285,20 +287,12 @@ FormUpdateModifiedProject(); break; case Obi.Events.Project.StateChange.Opened: - FormUpdateOpenedProject(); mProjectPanel.Project = mProject; mProjectPanel.Clear(); mProjectPanel.SynchronizeWithCoreTree(mProject.getPresentation().getRootNode()); - /*tableOfContentsToolStripMenuItem.Enabled = true; - addSubsectionToolStripMenuItem.Click += - new System.EventHandler(mProjectPanel.TOCPanel.addSubSectionToolStripMenuItem_Click); - addSectionAtSameLevelToolStripMenuItem.Click += + mAddSectionAtSameLevelToolStripMenuItem.Click += new System.EventHandler(mProjectPanel.TOCPanel.addSectionAtSameLevelToolStripMenuItem_Click); - moveSectionupToolStripMenuItem.Click += - new System.EventHandler(mProjectPanel.TOCPanel.moveUpToolStripMenuItem_Click); - deleteSectionToolStripMenuItem.Click += - new System.EventHandler(mProjectPanel.TOCPanel.deleteSectionToolStripMenuItem_Click); - FormUpdateShowHideTOC();*/ + FormUpdateOpenedProject(); break; case Obi.Events.Project.StateChange.Saved: FormUpdateSavedProject(); @@ -405,10 +399,10 @@ private void FormUpdateClosedProject() { this.Text = Localizer.Message("obi"); - mSaveProjectToolStripMenuItem.Enabled = false; // cannot save - mSaveProjectasToolStripMenuItem.Enabled = false; // cannot save as - mDiscardChangesToolStripMenuItem.Enabled = false; // cannot discard changes - mCloseProjectToolStripMenuItem.Enabled = false; // cannot close + mSaveProjectToolStripMenuItem.Enabled = false; // cannot save + mSaveProjectasToolStripMenuItem.Enabled = false; // cannot save as + mDiscardChangesToolStripMenuItem.Enabled = false; // cannot discard changes + mCloseProjectToolStripMenuItem.Enabled = false; // cannot close foreach (ToolStripItem item in editToolStripMenuItem.DropDownItems) // cannot do any edit { item.Enabled = false; @@ -433,23 +427,29 @@ } /// <summary> - /// Update the form to reflect enabled/disabled actions when no project is opened. + /// Update the form to reflect enabled/disabled actions when a project is opened. /// </summary> private void FormUpdateOpenedProject() { - FormUpdateSavedProject(); + this.Text = String.Format("{0} - {1}", mProject.Metadata.Title, Localizer.Message("obi")); + mSaveProjectToolStripMenuItem.Enabled = false; mSaveProjectasToolStripMenuItem.Enabled = true; + mDiscardChangesToolStripMenuItem.Enabled = false; mCloseProjectToolStripMenuItem.Enabled = true; - FormUpdateShowHideTOC(); - foreach (ToolStripItem item in editToolStripMenuItem.DropDownItems) // cannot do any edit + foreach (ToolStripItem item in editToolStripMenuItem.DropDownItems) // can do edits { item.Enabled = true; } - foreach (ToolStripItem item in viewToolStripMenuItem.DropDownItems) // cannot change view + foreach (ToolStripItem item in tocToolStripMenuItem.DropDownItems) // can modify the TOC { item.Enabled = true; } - mProjectPanel.Project = null; + foreach (ToolStripItem item in viewToolStripMenuItem.DropDownItems) // can change view + { + item.Enabled = true; + } + FormUpdateShowHideTOC(); + toolStripStatusLabel1.Text = String.Format(Localizer.Message("opened_project"), mProject.XUKPath); } /// <summary> @@ -464,7 +464,7 @@ } /// <summary> - /// Update the form to reflect enabled/disabled actions when the project is unsaved. + /// Update the form to reflect enabled/disabled actions when the project is modified. /// </summary> private void FormUpdateModifiedProject() { Modified: trunk/urakawa/application/Obi/Obi/Project.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/Project.cs 2006-07-21 09:11:20 UTC (rev 627) +++ trunk/urakawa/application/Obi/Obi/Project.cs 2006-07-21 10:59:22 UTC (rev 628) @@ -30,9 +30,9 @@ private string mLastPath; // last path to which the project was saved (see save as) private SimpleMetadata mMetadata; // metadata for this project - public static readonly string AUDIO_CHANNEL = "obi.audio"; // canonical name of the audio channel - public static readonly string TEXT_CHANNEL = "obi.text"; // canonical name of the text channel - public static readonly string ANNOTATION_CHANNEL = "obi.annotation"; // canonical name of the annotation channel + public static readonly string AudioChannel = "obi.audio"; // canonical name of the audio channel + public static readonly string TextChannel = "obi.text"; // canonical name of the text channel + public static readonly string AnnotationChannel = "obi.annotation"; // canonical name of the annotation channel public event Events.Project.StateChangedHandler StateChanged; // the state of the project changed (modified, saved...) public event Events.Sync.AddedChildNodeHandler AddedChildNode; // a new child node was added to the presentation @@ -111,11 +111,11 @@ { mXUKPath = xukPath; mMetadata = CreateMetadata(title, id, userProfile); - mAudioChannel = getPresentation().getChannelFactory().createChannel(AUDIO_CHANNEL); + mAudioChannel = getPresentation().getChannelFactory().createChannel(AudioChannel); getPresentation().getChannelsManager().addChannel(mAudioChannel); - mTextChannel = getPresentation().getChannelFactory().createChannel(TEXT_CHANNEL); + mTextChannel = getPresentation().getChannelFactory().createChannel(TextChannel); getPresentation().getChannelsManager().addChannel(mTextChannel); - mAnnotationChannel = getPresentation().getChannelFactory().createChannel(ANNOTATION_CHANNEL); + mAnnotationChannel = getPresentation().getChannelFactory().createChannel(AnnotationChannel); getPresentation().getChannelsManager().addChannel(mAnnotationChannel); if (createTitle) { @@ -138,9 +138,9 @@ { mUnsaved = false; mXUKPath = xukPath; - mAudioChannel = FindChannel(AUDIO_CHANNEL); - mTextChannel = FindChannel(TEXT_CHANNEL); - mAnnotationChannel = FindChannel(ANNOTATION_CHANNEL); + mAudioChannel = FindChannel(AudioChannel); + mTextChannel = FindChannel(TextChannel); + mAnnotationChannel = FindChannel(AnnotationChannel); mMetadata = new SimpleMetadata(); foreach (object o in getMetadataList()) { @@ -368,21 +368,6 @@ } /// <summary> - /// Create a new section node with a default text label. The node is not attached to anything. - /// TODO: this should be a constructor/factory method for our derived node class. - /// </summary> - /// <returns>The created node.</returns> - private CoreNode CreateSectionNode() - { - CoreNode node = getPresentation().getCoreNodeFactory().createNode(); - ChannelsProperty prop = (ChannelsProperty)node.getProperty(typeof(ChannelsProperty)); - TextMedia text = (TextMedia)getPresentation().getMediaFactory().createMedia(MediaType.TEXT); - text.setText(Localizer.Message("default_section_label")); - prop.setMedia(mTextChannel, text); - return node; - } - - /// <summary> /// Remove a node from the core tree (simply detach it, and synchronize the views.) /// </summary> public void RemoveNode(object origin, CoreNode node) @@ -432,6 +417,21 @@ #endregion /// <summary> + /// Create a new section node with a default text label. The node is not attached to anything. + /// TODO: this should be a constructor/factory method for our derived node class. + /// </summary> + /// <returns>The created node.</returns> + private CoreNode CreateSectionNode() + { + CoreNode node = getPresentation().getCoreNodeFactory().createNode(); + ChannelsProperty prop = (ChannelsProperty)node.getProperty(typeof(ChannelsProperty)); + TextMedia text = (TextMedia)getPresentation().getMediaFactory().createMedia(MediaType.TEXT); + text.setText(Localizer.Message("default_section_label")); + prop.setMedia(mTextChannel, text); + 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 @@ -452,7 +452,7 @@ for (int i = 0; i < channelsList.Count; i++) { string channelName = ((IChannel)channelsList[i]).getName(); - if (channelName == Project.TEXT_CHANNEL) + if (channelName == Project.TextChannel) { textChannel = (Channel)channelsList[i]; return (TextMedia)channelsProp.getMedia(textChannel); Modified: trunk/urakawa/application/Obi/Obi/Settings.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/Settings.cs 2006-07-21 09:11:20 UTC (rev 627) +++ trunk/urakawa/application/Obi/Obi/Settings.cs 2006-07-21 10:59:22 UTC (rev 628) @@ -15,6 +15,7 @@ /// (this is probably overkill, but it's available.) /// </summary> /// <remarks>It seems that the recent list is not saved, have to investigate...</remarks> + /// <remarks>It also seems that making a change in the class resets the existing settings?</remarks> [Serializable()] public class Settings { @@ -22,6 +23,7 @@ public UserProfile UserProfile; // the user profile public string IdTemplate; // identifier template public string DefaultPath; // default location + public bool CreateTitleSection; // defaulf for "create title section" in new project public static readonly string SettingsFileName = "obi_settings.xml"; // settings file name Deleted: trunk/urakawa/application/Obi/Obi/UserControls/ICoreTreeView.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/UserControls/ICoreTreeView.cs 2006-07-21 09:11:20 UTC (rev 627) +++ trunk/urakawa/application/Obi/Obi/UserControls/ICoreTreeView.cs 2006-07-21 10:59:22 UTC (rev 628) @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -using urakawa.core; - -namespace Obi.UserControls -{ - /// <summary> - /// Views of the core tree (table of contents tree view and strip view) - /// implement this interface which keeps them in sync with the core tree. - /// </summary> - public interface ICoreTreeView - { - /// <summary> - /// Clear the view: remove all nodes, strips, etc. - /// </summary> - void Clear(); - - /// <summary> - /// Synchronize the view with the core tree. - /// </summary> - void SynchronizeWithCoreTree(CoreNode root); - - /// <summary> - /// A new section node has been added in the core tree. - /// </summary> - /// <param name="newNode">The newly created node.</param> - /// <param name="relNode">Its preceding sibling node.</param> - //void AddNewSiblingSection(CoreNode newNode, CoreNode relNode); - - /// <summary> - /// Add a new heading as a child of the relative node. - /// </summary> - /// <param name="newNode">The new heading to add to the tree</param> - /// <param name="relNode">The parent node for the new heading</param> - //void AddNewChildSection(CoreNode newNode, CoreNode relNode); - - void MoveCurrentSectionUp(); - - /// <summary> - /// Delete a section node. - /// </summary> - /// <param name="node">The node that was removed from the core tree.</param> - void DeleteSectionNode(CoreNode node); - - /// <summary> - /// Edit the label of the currently selected heading. - /// </summary> - //void BeginEditingNodeLabel(CoreNode node); - } -} Modified: trunk/urakawa/application/Obi/Obi/UserControls/ProjectPanel.Designer.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/UserControls/ProjectPanel.Designer.cs 2006-07-21 09:11:20 UTC (rev 627) +++ trunk/urakawa/application/Obi/Obi/UserControls/ProjectPanel.Designer.cs 2006-07-21 10:59:22 UTC (rev 628) @@ -31,7 +31,7 @@ this.label1 = new System.Windows.Forms.Label(); this.mSplitContainer = new System.Windows.Forms.SplitContainer(); this.mTOCPanel = new Obi.UserControls.TOCPanel(); - this.stripManagerPanel1 = new Obi.UserControls.StripManagerPanel(); + this.mStripManagerPanel = new Obi.UserControls.StripManagerPanel(); this.mSplitContainer.Panel1.SuspendLayout(); this.mSplitContainer.Panel2.SuspendLayout(); this.mSplitContainer.SuspendLayout(); @@ -64,7 +64,7 @@ // mSplitContainer.Panel2 // this.mSplitContainer.Panel2.BackColor = System.Drawing.Color.Transparent; - this.mSplitContainer.Panel2.Controls.Add(this.stripManagerPanel1); + this.mSplitContainer.Panel2.Controls.Add(this.mStripManagerPanel); this.mSplitContainer.Size = new System.Drawing.Size(631, 330); this.mSplitContainer.SplitterDistance = 210; this.mSplitContainer.TabIndex = 1; @@ -77,14 +77,14 @@ this.mTOCPanel.Size = new System.Drawing.Size(210, 330); this.mTOCPanel.TabIndex = 0; // - // stripManagerPanel1 + // mStripManagerPanel // - this.stripManagerPanel1.BackColor = System.Drawing.Color.Transparent; - this.stripManagerPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.stripManagerPanel1.Location = new System.Drawing.Point(0, 0); - this.stripManagerPanel1.Name = "stripManagerPanel1"; - this.stripManagerPanel1.Size = new System.Drawing.Size(417, 330); - this.stripManagerPanel1.TabIndex = 0; + this.mStripManagerPanel.BackColor = System.Drawing.Color.Transparent; + this.mStripManagerPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.mStripManagerPanel.Location = new System.Drawing.Point(0, 0); + this.mStripManagerPanel.Name = "mStripManagerPanel"; + this.mStripManagerPanel.Size = new System.Drawing.Size(417, 330); + this.mStripManagerPanel.TabIndex = 0; // // ProjectPanel // @@ -107,7 +107,7 @@ private System.Windows.Forms.Label label1; private System.Windows.Forms.SplitContainer mSplitContainer; - private StripManagerPanel stripManagerPanel1; + private StripManagerPanel mStripManagerPanel; private TOCPanel mTOCPanel; } Modified: trunk/urakawa/application/Obi/Obi/UserControls/ProjectPanel.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/UserControls/ProjectPanel.cs 2006-07-21 09:11:20 UTC (rev 627) +++ trunk/urakawa/application/Obi/Obi/UserControls/ProjectPanel.cs 2006-07-21 10:59:22 UTC (rev 628) @@ -30,14 +30,19 @@ mSplitContainer.Panel1Collapsed = false; if (mProject != null) { + mTOCPanel.AddSiblingSection += new Events.Node.AddSiblingSectionHandler(mProject.CreateSiblingSectionRequested); + mProject.AddedSiblingNode += new Events.Sync.AddedSiblingNodeHandler(mTOCPanel.SyncAddedSiblingNode); + mProject.AddedSiblingNode += new Events.Sync.AddedSiblingNodeHandler(mStripManagerPanel.SyncAddedSiblingNode); mTOCPanel.AddChildSection += new Events.Node.AddChildSectionHandler(mProject.CreateChildSectionRequested); mProject.AddedChildNode += new Events.Sync.AddedChildNodeHandler(mTOCPanel.SyncAddedChildNode); - mTOCPanel.AddSiblingSection += new Events.Node.AddSiblingSectionHandler(mProject.CreateSiblingSectionRequested); - mProject.AddedSiblingNode += new Events.Sync.AddedSiblingNodeHandler(mTOCPanel.SyncAddedSiblingNode); + mProject.AddedChildNode += new Events.Sync.AddedChildNodeHandler(mStripManagerPanel.SyncAddedChildNode); + mTOCPanel.MoveSectionUp += new Events.Node.MoveSectionUpHandler(mProject.MoveNodeUpRequested); mTOCPanel.DeleteSection += new Events.Node.DeleteSectionHandler(mProject.RemoveNodeRequested); + mTOCPanel.RenameSection += new Events.Node.RenameSectionHandler(mProject.RenameNodeRequested); mProject.RenamedNode += new Events.Sync.RenamedNodeHandler(mTOCPanel.SyncRenamedNode); + mProject.RenamedNode += new Events.Sync.RenamedNodeHandler(mStripManagerPanel.SyncRenamedNode); } } } @@ -54,7 +59,7 @@ { get { - return stripManagerPanel1; + return mStripManagerPanel; } } @@ -97,6 +102,7 @@ public void SynchronizeWithCoreTree(CoreNode root) { mTOCPanel.SynchronizeWithCoreTree(root); + mStripManagerPanel.SynchronizeWithCoreTree(root); } } } Modified: trunk/urakawa/application/Obi/Obi/UserControls/StripManagerPanel.Designer.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/UserControls/StripManagerPanel.Designer.cs 2006-07-21 09:11:20 UTC (rev 627) +++ trunk/urakawa/application/Obi/Obi/UserControls/StripManagerPanel.Designer.cs 2006-07-21 10:59:22 UTC (rev 628) @@ -44,6 +44,7 @@ // // mFlowLayoutPanel // + this.mFlowLayoutPanel.BackColor = System.Drawing.Color.Transparent; this.mFlowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.mFlowLayoutPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.mFlowLayoutPanel.Location = new System.Drawing.Point(0, 0); Modified: trunk/urakawa/application/Obi/Obi/UserControls/StripManagerPanel.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/UserControls/StripManagerPanel.cs 2006-07-21 09:11:20 UTC (rev 627) +++ trunk/urakawa/application/Obi/Obi/UserControls/StripManagerPanel.cs 2006-07-21 10:59:22 UTC (rev 628) @@ -6,13 +6,88 @@ using System.Text; using System.Windows.Forms; +using urakawa.core; + namespace Obi.UserControls { - public partial class StripManagerPanel : UserControl //, ICoreTreeView + /// <summary> + /// This control is a view of all the contents of a project + /// </summary> + public partial class StripManagerPanel : UserControl, ICoreNodeVisitor { + private Dictionary<CoreNode, SectionStrip> mNodeMap; + public StripManagerPanel() { InitializeComponent(); + mNodeMap = new Dictionary<CoreNode, SectionStrip>(); } + + /// <summary> + /// Synchronize the strips view with the core tree. + /// Since we need priviledged access to the class for synchronization, + /// we make it implement ICoreNodeVisitor directly. + /// </summary> + public void SynchronizeWithCoreTree(CoreNode root) + { + mNodeMap.Clear(); + mFlowLayoutPanel.Controls.Clear(); + root.acceptDepthFirst(this); + } + + #region Synchronization visitor + + /// <summary> + /// Do nothing. + /// </summary> + /// <param name="node">The node to do nothing with.</param> + public void postVisit(ICoreNode node) + { + } + + /// <summary> + /// Create a new strip for every core node. Skip the root node. + /// </summary> + /// <param name="node">The node to add to the tree.</param> + /// <returns>True.</returns> + public bool preVisit(ICoreNode node) + { + if (node.getParent() != null) + { + SectionStrip strip = new SectionStrip(); + strip.Label = Project.GetTextMedia((CoreNode)node).getText(); + mNodeMap[(CoreNode)node] = strip; + mFlowLayoutPanel.Controls.Add(strip); + } + return true; + } + + #endregion + + #region Sync event handlers + + internal void SyncAddedSiblingNode(object sender, Events.Sync.AddedSiblingNodeEventArgs e) + { + SectionStrip strip = new SectionStrip(); + strip.Label = Project.GetTextMedia(e.Node).getText(); + mNodeMap[e.Node] = strip; + mFlowLayoutPanel.Controls.Add(strip); + } + + internal void SyncAddedChildNode(object sender, Events.Sync.AddedChildNodeEventArgs e) + { + SectionStrip strip = new SectionStrip(); + strip.Label = Project.GetTextMedia(e.Node).getText(); + mNodeMap[e.Node] = strip; + mFlowLayoutPanel.Controls.Add(strip); + } + + internal void SyncRenamedNode(object sender, Events.Sync.RenamedNodeEventArgs e) + { + SectionStrip strip = mNodeMap[e.Node]; + strip.Label = e.Label; + } + + #endregion } } Modified: trunk/urakawa/application/Obi/Obi/UserControls/TOCPanel.Designer.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/UserControls/TOCPanel.Designer.cs 2006-07-21 09:11:20 UTC (rev 627) +++ trunk/urakawa/application/Obi/Obi/UserControls/TOCPanel.Designer.cs 2006-07-21 10:59:22 UTC (rev 628) @@ -38,7 +38,6 @@ this.increaseLevelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.editLabelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.decreaseLevelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.deleteSectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip1.SuspendLayout(); this.SuspendLayout(); @@ -65,10 +64,9 @@ this.increaseLevelToolStripMenuItem, this.editLabelToolStripMenuItem, this.decreaseLevelToolStripMenuItem, - this.toolStripSeparator1, this.deleteSectionToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(205, 208); + this.contextMenuStrip1.Size = new System.Drawing.Size(205, 202); this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening); // // addSectionAtSameLevelToolStripMenuItem @@ -120,11 +118,6 @@ this.decreaseLevelToolStripMenuItem.Text = "Decrease level"; this.decreaseLevelToolStripMenuItem.Click += new System.EventHandler(this.decreaseLevelToolStripMenuItem_Click); // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(201, 6); - // // deleteSectionToolStripMenuItem // this.deleteSectionToolStripMenuItem.Name = "deleteSectionToolStripMenuItem"; @@ -155,7 +148,6 @@ private System.Windows.Forms.ToolStripMenuItem increaseLevelToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem decreaseLevelToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem editLabelToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem deleteSectionToolStripMenuItem; } } Modified: trunk/urakawa/application/Obi/Obi/UserControls/TOCPanel.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/UserControls/TOCPanel.cs 2006-07-21 09:11:20 UTC (rev 627) +++ trunk/urakawa/application/Obi/Obi/UserControls/TOCPanel.cs 2006-07-21 10:59:22 UTC (rev 628) @@ -17,11 +17,10 @@ /// change the label, etc. of headings.) /// This control implements the CoreTreeView interface so that it can be synchronized with the core tree. /// </summary> - public partial class TOCPanel : UserControl, ICoreTreeView, ICoreNodeVisitor + public partial class TOCPanel : UserControl, ICoreNodeVisitor { public event Events.Node.AddSiblingSectionHandler AddSiblingSection; public event Events.Node.AddChildSectionHandler AddChildSection; - public event Events.Node.DeleteSectionHandler DeleteSection; public event Events.Node.BeginEditingSectionHeadingLabelHandler BeginEditingLabel; public event Events.Node.DecreaseSectionLevelHandler DecreaseSectionLevel; public event Events.Node.IncreaseSectionLevelHandler IncreaseSectionLevel; @@ -29,6 +28,7 @@ public event Events.Node.MoveSectionDownHandler MoveSectionDown; public event Events.Node.MoveSectionUpHandler MoveSectionUp; public event Events.Node.RenameSectionHandler RenameSection; + public event Events.Node.DeleteSectionHandler DeleteSection; /// <summary> /// Test whether a node is currently selected or not. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |