private void OnProjectLoaded(
			object sender,
			ProjectEventArgs e)
        {
            // Remove the child, if we have one.
            if (Child != null)
            {
                Remove(Child);
            }

            // Create a tree model for this project.
            var store = new TreeStore(typeof (string));

            TreeIter iter = store.AppendValues("Project");
            store.AppendValues(iter, "Chapter");

            // Create the view for the tree.
            var treeView = new TreeView
            {
                Model = store,
                HeadersVisible = false,
            };

            treeView.AppendColumn("Name", new CellRendererText(), "text", 0);

            // We need to wrap this in a scroll bar since the list might become
            // too larger.
            var scrolledWindow = new ScrolledWindow();
            scrolledWindow.Add(treeView);
            Add(scrolledWindow);

            // Show our components to the user.
            ShowAll();
        }
        private void OnProjectUnloaded(
			object sender,
			ProjectEventArgs e)
        {
            // Remove the child, if we have one.
            if (Child != null)
            {
                Remove(Child);
            }

            // Add a label to indicate we don't have a loaded project.
            var label = new Label("No Project Loaded");
            Add(label);
        }
        /// <summary>
        /// Called when a project is unloaded.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="ProjectEventArgs"/> instance containing the event data.</param>
        private void OnProjectUnloaded(
			object sender,
			ProjectEventArgs e)
        {
            // Dispose of the project because we need to disconnect from
            // events.
            if (commandController.ProjectLineBuffer != null)
            {
                commandController.ProjectLineBuffer.Dispose();
            }

            // Remove the line buffer.
            commandController.ProjectLineBuffer = null;
            commandController.Project = null;
            editorView.ClearLineBuffer();

            // Update the GUI state elements.
            UpdateGuiState();
        }
        /// <summary>
        /// Called when a project is loaded.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="ProjectEventArgs"/> instance containing the event data.</param>
        private void OnProjectLoaded(
			object sender,
			ProjectEventArgs e)
        {
            // Set up the line buffer for the loaded project.
            var projectLineBuffer = new ProjectLineBuffer(e.Project, editorView);
            editorView.SetLineBuffer(projectLineBuffer);
            commandController.Project = e.Project;
            commandController.ProjectLineBuffer = projectLineBuffer;

            // Update the GUI element.
            UpdateGuiState();
        }
        /// <summary>
        /// Raises the project is unloaded.
        /// </summary>
        /// <param name="project">The project.</param>
        protected void RaiseProjectUnloaded(Project project)
        {
            EventHandler<ProjectEventArgs> listeners = ProjectUnloaded;

            if (listeners != null)
            {
                var args = new ProjectEventArgs(project);
                listeners(this, args);
            }
        }