From: <ju...@us...> - 2006-05-29 06:11:22
|
Revision: 390 Author: julienq Date: 2006-05-28 23:10:56 -0700 (Sun, 28 May 2006) ViewCVS: http://svn.sourceforge.net/urakawa/?rev=390&view=rev Log Message: ----------- Added events to Obi Modified Paths: -------------- 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/messages.Designer.cs trunk/urakawa/application/Obi/Obi/messages.resx Added Paths: ----------- trunk/urakawa/application/Obi/Obi/Events/ trunk/urakawa/application/Obi/Obi/Events/Project/ trunk/urakawa/application/Obi/Obi/Events/Project/StateChangedEventArgs.cs Removed Paths: ------------- trunk/urakawa/application/Obi/Obi/ProjectManager.cs Added: trunk/urakawa/application/Obi/Obi/Events/Project/StateChangedEventArgs.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/Events/Project/StateChangedEventArgs.cs (rev 0) +++ trunk/urakawa/application/Obi/Obi/Events/Project/StateChangedEventArgs.cs 2006-05-29 06:10:56 UTC (rev 390) @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Obi.Events.Project +{ + public enum StateChange { Closed, Created, Modified, Opened, Reverted, Saved }; + + public delegate void StateChangedHandler(object sender, StateChangedEventArgs e); + + public class StateChangedEventArgs: EventArgs + { + private Obi.Project mProject; + private StateChange mChange; + + public Obi.Project Project { get { return mProject; } } + public StateChange Change { get { return mChange; } } + + public StateChangedEventArgs(Obi.Project project, StateChange change) + { + mProject = project; + mChange = change; + } + } +} Property changes on: trunk/urakawa/application/Obi/Obi/Events/Project/StateChangedEventArgs.cs ___________________________________________________________________ Name: svn:executable + * Modified: trunk/urakawa/application/Obi/Obi/Obi.csproj =================================================================== --- trunk/urakawa/application/Obi/Obi/Obi.csproj 2006-05-29 02:04:07 UTC (rev 389) +++ trunk/urakawa/application/Obi/Obi/Obi.csproj 2006-05-29 06:10:56 UTC (rev 390) @@ -38,6 +38,7 @@ <ItemGroup> <Compile Include="Command.cs" /> <Compile Include="Commands.cs" /> + <Compile Include="Events\Project\StateChangedEventArgs.cs" /> <Compile Include="Localizer.cs" /> <Compile Include="messages.Designer.cs"> <AutoGen>True</AutoGen> @@ -52,7 +53,6 @@ </Compile> <Compile Include="Program.cs" /> <Compile Include="Project.cs" /> - <Compile Include="ProjectManager.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <EmbeddedResource Include="messages.resx"> <SubType>Designer</SubType> Modified: trunk/urakawa/application/Obi/Obi/ObiForm.Designer.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/ObiForm.Designer.cs 2006-05-29 02:04:07 UTC (rev 389) +++ trunk/urakawa/application/Obi/Obi/ObiForm.Designer.cs 2006-05-29 06:10:56 UTC (rev 390) @@ -32,13 +32,23 @@ this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.createNewProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openrecentProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this.clearListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.closeProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.saveProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveProjectasToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.revertToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + 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.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.touchProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); - this.metadataPanel1 = new Obi.UserControls.MetadataPanel(); this.menuStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); @@ -59,6 +69,13 @@ this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.createNewProjectToolStripMenuItem, this.openProjectToolStripMenuItem, + this.openrecentProjectToolStripMenuItem, + this.toolStripSeparator2, + this.saveProjectToolStripMenuItem, + this.saveProjectasToolStripMenuItem, + this.revertToolStripMenuItem, + this.closeProjectToolStripMenuItem, + this.toolStripSeparator3, this.exitToolStripMenuItem}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Size = new System.Drawing.Size(36, 20); @@ -67,21 +84,76 @@ // createNewProjectToolStripMenuItem // this.createNewProjectToolStripMenuItem.Name = "createNewProjectToolStripMenuItem"; - this.createNewProjectToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.createNewProjectToolStripMenuItem.Size = new System.Drawing.Size(171, 22); this.createNewProjectToolStripMenuItem.Text = "&New project"; this.createNewProjectToolStripMenuItem.Click += new System.EventHandler(this.createNewProjectToolStripMenuItem_Click); // // openProjectToolStripMenuItem // this.openProjectToolStripMenuItem.Name = "openProjectToolStripMenuItem"; - this.openProjectToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.openProjectToolStripMenuItem.Size = new System.Drawing.Size(171, 22); this.openProjectToolStripMenuItem.Text = "&Open project"; this.openProjectToolStripMenuItem.Click += new System.EventHandler(this.openProjectToolStripMenuItem_Click); // + // openrecentProjectToolStripMenuItem + // + this.openrecentProjectToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripSeparator4, + this.clearListToolStripMenuItem}); + this.openrecentProjectToolStripMenuItem.Name = "openrecentProjectToolStripMenuItem"; + this.openrecentProjectToolStripMenuItem.Size = new System.Drawing.Size(171, 22); + this.openrecentProjectToolStripMenuItem.Text = "Open &recent project"; + // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + this.toolStripSeparator4.Size = new System.Drawing.Size(114, 6); + // + // clearListToolStripMenuItem + // + this.clearListToolStripMenuItem.Name = "clearListToolStripMenuItem"; + this.clearListToolStripMenuItem.Size = new System.Drawing.Size(117, 22); + this.clearListToolStripMenuItem.Text = "Clear list"; + // + // closeProjectToolStripMenuItem + // + this.closeProjectToolStripMenuItem.Name = "closeProjectToolStripMenuItem"; + this.closeProjectToolStripMenuItem.Size = new System.Drawing.Size(171, 22); + this.closeProjectToolStripMenuItem.Text = "&Close project"; + this.closeProjectToolStripMenuItem.Click += new System.EventHandler(this.closeProjectToolStripMenuItem_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(168, 6); + // + // saveProjectToolStripMenuItem + // + this.saveProjectToolStripMenuItem.Name = "saveProjectToolStripMenuItem"; + this.saveProjectToolStripMenuItem.Size = new System.Drawing.Size(171, 22); + this.saveProjectToolStripMenuItem.Text = "&Save project"; + // + // saveProjectasToolStripMenuItem + // + this.saveProjectasToolStripMenuItem.Name = "saveProjectasToolStripMenuItem"; + this.saveProjectasToolStripMenuItem.Size = new System.Drawing.Size(171, 22); + this.saveProjectasToolStripMenuItem.Text = "Save project &as"; + // + // revertToolStripMenuItem + // + this.revertToolStripMenuItem.Name = "revertToolStripMenuItem"; + this.revertToolStripMenuItem.Size = new System.Drawing.Size(171, 22); + this.revertToolStripMenuItem.Text = "&Discard changes"; + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(168, 6); + // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(171, 22); this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -89,7 +161,9 @@ // this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mUndoToolStripMenuItem, - this.mRedoToolStripMenuItem}); + this.mRedoToolStripMenuItem, + this.toolStripSeparator1, + this.touchProjectToolStripMenuItem}); this.editToolStripMenuItem.Name = "editToolStripMenuItem"; this.editToolStripMenuItem.Size = new System.Drawing.Size(37, 20); this.editToolStripMenuItem.Text = "&Edit"; @@ -99,7 +173,7 @@ this.mUndoToolStripMenuItem.Enabled = false; 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(133, 22); + this.mUndoToolStripMenuItem.Size = new System.Drawing.Size(140, 22); this.mUndoToolStripMenuItem.Text = "&Undo"; this.mUndoToolStripMenuItem.Click += new System.EventHandler(this.mUndoToolStripMenuItem_Click); // @@ -108,10 +182,22 @@ this.mRedoToolStripMenuItem.Enabled = false; 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(133, 22); + this.mRedoToolStripMenuItem.Size = new System.Drawing.Size(140, 22); this.mRedoToolStripMenuItem.Text = "&Redo"; this.mRedoToolStripMenuItem.Click += new System.EventHandler(this.mRedoToolStripMenuItem_Click); // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(137, 6); + // + // touchProjectToolStripMenuItem + // + this.touchProjectToolStripMenuItem.Name = "touchProjectToolStripMenuItem"; + this.touchProjectToolStripMenuItem.Size = new System.Drawing.Size(140, 22); + this.touchProjectToolStripMenuItem.Text = "&Touch project"; + this.touchProjectToolStripMenuItem.Click += new System.EventHandler(this.touchProjectToolStripMenuItem_Click); + // // statusStrip1 // this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -126,27 +212,13 @@ // toolStripStatusLabel1 // this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; - this.toolStripStatusLabel1.Size = new System.Drawing.Size(37, 17); - this.toolStripStatusLabel1.Text = "Ready"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(0, 17); // - // metadataPanel1 - // - this.metadataPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.metadataPanel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); - this.metadataPanel1.Location = new System.Drawing.Point(0, 24); - this.metadataPanel1.Margin = new System.Windows.Forms.Padding(0); - this.metadataPanel1.Name = "metadataPanel1"; - this.metadataPanel1.Padding = new System.Windows.Forms.Padding(3); - this.metadataPanel1.Size = new System.Drawing.Size(775, 60); - this.metadataPanel1.TabIndex = 4; - // // ObiForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(775, 502); - this.Controls.Add(this.metadataPanel1); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.menuStrip1); this.MainMenuStrip = this.menuStrip1; @@ -171,9 +243,19 @@ private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; - private Obi.UserControls.MetadataPanel metadataPanel1; private System.Windows.Forms.ToolStripMenuItem createNewProjectToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem openProjectToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveProjectToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveProjectasToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem closeProjectToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem touchProjectToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openrecentProjectToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripMenuItem revertToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; + private System.Windows.Forms.ToolStripMenuItem clearListToolStripMenuItem; } Modified: trunk/urakawa/application/Obi/Obi/ObiForm.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/ObiForm.cs 2006-05-29 02:04:07 UTC (rev 389) +++ trunk/urakawa/application/Obi/Obi/ObiForm.cs 2006-05-29 06:10:56 UTC (rev 390) @@ -12,7 +12,29 @@ { public partial class ObiForm : Form { + private Project mProject; // the project currently being authored + private UndoRedoStack mUndoStack; // the undo stack for this project [should belong to the project; saved together] + + private event Events.Project.StateChangedHandler ProjectStateChanged; + /// <summary> + /// Initialize a new form. No project is opened at creation time. + /// </summary> + public ObiForm() + { + InitializeComponent(); + + mProject = null; + ProjectStateChanged += new Events.Project.StateChangedHandler(mProject_StateChanged); + GUIUpdateNoProject(); + + mUndoStack = new UndoRedoStack(); + undo_label = mUndoToolStripMenuItem.Text; + redo_label = mRedoToolStripMenuItem.Text; + UndoStackChanged += new UndoStackChangedHandler(mUndoStack_UndoStackChanged); + } + + /// <summary> /// Create a new project if the correct one was closed properly. /// </summary> /// <param name="sender"></param> @@ -21,11 +43,12 @@ { if (ClosedProject()) { - ProjectManager.Instance.CreateProject(); + mProject = new Project(); + OnProjectCreated(); } else { - Console.WriteLine(Localizer.Message("cancelled") + "."); + Ready(); } } @@ -43,14 +66,28 @@ DialogResult result = dialog.ShowDialog(); if (result == DialogResult.OK) { - ProjectManager.Instance.OpenXUK(dialog.FileName); + mProject = new Project(dialog.FileName); + OnProjectOpened(); return; } } - Console.WriteLine(Localizer.Message("cancelled") + "."); + Ready(); } /// <summary> + /// Close the current project. + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void closeProjectToolStripMenuItem_Click(object sender, EventArgs e) + { + if (ClosedProject()) + { + mProject = null; + } + } + + /// <summary> /// Exit if and only if the currently open project was saved correctly. /// </summary> /// <param name="sender"></param> @@ -63,7 +100,7 @@ } else { - Console.WriteLine(Localizer.Message("cancelled") + "."); + Ready(); } } @@ -73,44 +110,162 @@ /// <returns>True if there is no open project or the currently open project could be closed.</returns> private bool ClosedProject() { - if (ProjectManager.Instance.Unsaved) + if (mProject != null && mProject.Unsaved) { DialogResult result = MessageBox.Show(Localizer.Message("closed_project_text"), Localizer.Message("close_project_caption"), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (result == DialogResult.Yes) { - // save the project + mProject.Save(); + OnProjectSaved(); } - return result != DialogResult.Cancel; + if (result == DialogResult.Cancel) + { + Ready(); + return false; + } + else + { + OnProjectClosed(); + return true; + } } else { + Ready(); return true; } } + /// <summary> + /// Touch the project so that it seems that it was modified (used for debugging.) + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void touchProjectToolStripMenuItem_Click(object sender, EventArgs e) + { + mProject.Touch(); + OnProjectModified(); + } + private void OnProjectClosed() + { + ProjectStateChanged(this, new Events.Project.StateChangedEventArgs(mProject, Obi.Events.Project.StateChange.Closed)); + } + + private void OnProjectCreated() + { + ProjectStateChanged(this, new Events.Project.StateChangedEventArgs(mProject, Obi.Events.Project.StateChange.Created)); + } + + private void OnProjectModified() + { + ProjectStateChanged(this, new Events.Project.StateChangedEventArgs(mProject, Obi.Events.Project.StateChange.Modified)); + } + + private void OnProjectOpened() + { + ProjectStateChanged(this, new Events.Project.StateChangedEventArgs(mProject, Obi.Events.Project.StateChange.Opened)); + } + + private void OnProjectSaved() + { + ProjectStateChanged(this, new Events.Project.StateChangedEventArgs(mProject, Obi.Events.Project.StateChange.Saved)); + } + + private void mProject_StateChanged(object sender, Events.Project.StateChangedEventArgs e) + { + switch (e.Change) + { + case Obi.Events.Project.StateChange.Closed: + GUIUpdateNoProject(); + break; + case Obi.Events.Project.StateChange.Created: + GUIUpdateSavedProject(); + Debug(Localizer.Message("debug_created_project")); + break; + case Obi.Events.Project.StateChange.Modified: + GUIUpdateUnsavedProject(); + Debug(Localizer.Message("debug_touched_project")); + break; + case Obi.Events.Project.StateChange.Opened: + GUIUpdateSavedProject(); + Debug(String.Format(Localizer.Message("debug_opened_project"), e.Project.XUKPath)); + break; + case Obi.Events.Project.StateChange.Saved: + GUIUpdateSavedProject(); + Debug(String.Format(Localizer.Message("debug_saved_project"), e.Project.XUKPath)); + break; + default: + Debug("******"); + break; + } + } + + /// <summary> + /// Utility method that prints to the console and outputs to the status bar. + /// </summary> + /// <param name="message">The message to print.</param> + private void Debug(string message) + { + Console.WriteLine(message); + toolStripStatusLabel1.Text = message; + } + + /// <summary> + /// Update the GUI to reflect enabled/disabled actions when no project is opened. + /// </summary> + private void GUIUpdateNoProject() + { + closeProjectToolStripMenuItem.Enabled = false; + saveProjectToolStripMenuItem.Enabled = false; + saveProjectasToolStripMenuItem.Enabled = false; + touchProjectToolStripMenuItem.Enabled = false; + revertToolStripMenuItem.Enabled = false; + Ready(); + } + + /// <summary> + /// Update the GUI to reflect enabled/disabled actions when the project is saved. + /// </summary> + private void GUIUpdateSavedProject() + { + closeProjectToolStripMenuItem.Enabled = true; + saveProjectToolStripMenuItem.Enabled = false; + saveProjectasToolStripMenuItem.Enabled = true; + touchProjectToolStripMenuItem.Enabled = true; + revertToolStripMenuItem.Enabled = false; + } + + /// <summary> + /// Update the GUI to reflect enabled/disabled actions when the project is unsaved. + /// </summary> + private void GUIUpdateUnsavedProject() + { + closeProjectToolStripMenuItem.Enabled = true; + saveProjectToolStripMenuItem.Enabled = true; + saveProjectasToolStripMenuItem.Enabled = true; + touchProjectToolStripMenuItem.Enabled = true; + revertToolStripMenuItem.Enabled = true; + Ready(); + } + + private void Ready() + { + toolStripStatusLabel1.Text = Localizer.Message("ready"); + } + + - - - private UndoRedoStack mUndoStack; + + private string undo_label; private string redo_label; private delegate void UndoStackChangedHandler(object sender, EventArgs e); private event UndoStackChangedHandler UndoStackChanged; - public ObiForm() - { - InitializeComponent(); - //mStrip.Resized += new EmptyStrip.ResizedHandler(mStrip_Resized); - UndoStackChanged += new UndoStackChangedHandler(mUndoStack_UndoStackChanged); - mUndoStack = new UndoRedoStack(); - undo_label = mUndoToolStripMenuItem.Text; - redo_label = mRedoToolStripMenuItem.Text; - } - private void mStrip_Resized(object sender, ResizedEventArgs e) { PushUndo(new ResizeStripCommand((EmptyStrip)sender, e.Before, e.After)); Modified: trunk/urakawa/application/Obi/Obi/Project.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/Project.cs 2006-05-29 02:04:07 UTC (rev 389) +++ trunk/urakawa/application/Obi/Obi/Project.cs 2006-05-29 06:10:56 UTC (rev 390) @@ -30,7 +30,7 @@ /// </summary> public Project() { - mUnsaved = true; + mUnsaved = false; } /// <summary> @@ -47,5 +47,10 @@ { mUnsaved = false; } + + public void Touch() + { + mUnsaved = true; + } } } Deleted: trunk/urakawa/application/Obi/Obi/ProjectManager.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/ProjectManager.cs 2006-05-29 02:04:07 UTC (rev 389) +++ trunk/urakawa/application/Obi/Obi/ProjectManager.cs 2006-05-29 06:10:56 UTC (rev 390) @@ -1,63 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Obi -{ - public class ProjectManager - { - private static readonly ProjectManager mInstance = new ProjectManager(); - private Project mProject; - - public static ProjectManager Instance - { - get - { - return mInstance; - } - } - - public Project Project - { - get - { - return mProject; - } - } - - /// <summary> - /// True if there are unsaved changes in the project. - /// </summary> - public bool Unsaved - { - get - { - return mProject != null && mProject.Unsaved; - } - } - - private ProjectManager() - { - mProject = null; - } - - /// <summary> - /// Create a new project and replace the old one with the new one. - /// </summary> - public void CreateProject() - { - mProject = new Project(); - } - - /// <summary> - /// Open a XUK file and create a new project object from it. - /// Throw an exception if there is an error reading the file. - /// </summary> - /// <param name="path">Complete path of the XUK file.</param> - public void OpenXUK(string path) - { - mProject = new Project(path); - Console.WriteLine("Open XUK file {0}.", path); - } - } -} \ No newline at end of file Modified: trunk/urakawa/application/Obi/Obi/messages.Designer.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/messages.Designer.cs 2006-05-29 02:04:07 UTC (rev 389) +++ trunk/urakawa/application/Obi/Obi/messages.Designer.cs 2006-05-29 06:10:56 UTC (rev 390) @@ -79,7 +79,9 @@ } /// <summary> - /// Looks up a localized string similar to You are about to close a project with unsaved modifications. Do you want to save these modifications before closing the project? You may also press Cancel to not close the project.. + /// Looks up a localized string similar to You are about to close a project with unsaved modifications. + ///Do you want to save these modifications before closing the project? + ///You may also press Cancel to not close the project.. /// </summary> internal static string closed_project_text { get { @@ -88,6 +90,42 @@ } /// <summary> + /// Looks up a localized string similar to [DEBUG] Created project. + /// </summary> + internal static string debug_created_project { + get { + return ResourceManager.GetString("debug_created_project", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to [DEBUG] Opened project from XUK file {0}. + /// </summary> + internal static string debug_opened_project { + get { + return ResourceManager.GetString("debug_opened_project", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to [DEBUG] Saved project. + /// </summary> + internal static string debug_saved_project { + get { + return ResourceManager.GetString("debug_saved_project", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to [DEBUG] Touched project. + /// </summary> + internal static string debug_touched_project { + get { + return ResourceManager.GetString("debug_touched_project", resourceCulture); + } + } + + /// <summary> /// Looks up a localized string similar to New strip. /// </summary> internal static string new_strip_label { @@ -97,6 +135,24 @@ } /// <summary> + /// Looks up a localized string similar to No project is currently open.. + /// </summary> + internal static string no_open_project { + get { + return ResourceManager.GetString("no_open_project", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to Ready.. + /// </summary> + internal static string ready { + get { + return ResourceManager.GetString("ready", resourceCulture); + } + } + + /// <summary> /// Looks up a localized string similar to {0} {1}. /// </summary> internal static string redo_label { Modified: trunk/urakawa/application/Obi/Obi/messages.resx =================================================================== --- trunk/urakawa/application/Obi/Obi/messages.resx 2006-05-29 02:04:07 UTC (rev 389) +++ trunk/urakawa/application/Obi/Obi/messages.resx 2006-05-29 06:10:56 UTC (rev 390) @@ -124,11 +124,31 @@ <value>Closing a modified project</value> </data> <data name="closed_project_text" xml:space="preserve"> - <value>You are about to close a project with unsaved modifications. Do you want to save these modifications before closing the project? You may also press Cancel to not close the project.</value> + <value>You are about to close a project with unsaved modifications. +Do you want to save these modifications before closing the project? +You may also press Cancel to not close the project.</value> </data> + <data name="debug_created_project" xml:space="preserve"> + <value>[DEBUG] Created project</value> + </data> + <data name="debug_opened_project" xml:space="preserve"> + <value>[DEBUG] Opened project from XUK file {0}</value> + </data> + <data name="debug_saved_project" xml:space="preserve"> + <value>[DEBUG] Saved project</value> + </data> + <data name="debug_touched_project" xml:space="preserve"> + <value>[DEBUG] Touched project</value> + </data> <data name="new_strip_label" xml:space="preserve"> <value>New strip</value> </data> + <data name="no_open_project" xml:space="preserve"> + <value>No project is currently open.</value> + </data> + <data name="ready" xml:space="preserve"> + <value>Ready.</value> + </data> <data name="redo_label" xml:space="preserve"> <value>{0} {1}</value> </data> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |