Esempio n. 1
0
        //---------------------------------------------------------------------
        // Create a new picture and window
        //---------------------------------------------------------------------
        public void CreateNewPicture()
        {
            // Launch a dialogue to ask the user for the properties of the new picture
            NewPictureForm newPictureForm = new NewPictureForm();

            newPictureForm.Owner = this;
            newPictureForm.ShowDialog();

            // Check if the user hit OK or Cancel
            if (newPictureForm.DialogResult == DialogResult.OK)
            {
                // Create a new form to hold the picture
                CanvasWindow newMDIChild = new CanvasWindow(newPictureForm.canvasWidth, newPictureForm.canvasHeight, newPictureForm.canvasName);

                // Set the parent form the main form
                newMDIChild.MdiParent = this;

                // Make the form visible
                newMDIChild.Show();

                // Put the form on top of the others
                newMDIChild.BringToFront();

                //when a canvas is selected we want to update the toolbars and such!
                newMDIChild.GotFocus += (object sender, EventArgs e) => {
                    CanvasWindow cw = sender as CanvasWindow;
                    SetCurrentCanvasSession(cw.m_session);
                };

                //when a canvas is shut down we need to disable the toolbar if there are no other canvases left
                newMDIChild.HandleDestroyed += (object sender, EventArgs args) => {
                    if (m_currentCanvasSession != null && sender == m_currentCanvasSession.canvasWindow)
                    {
                        SetCurrentCanvasSession(null);
                    }
                };

                //create a new canvas session to go with the canvasWindow
                CanvasSession newSession = new CanvasSession(this, newMDIChild, layerControlForm);
                m_canvasSessions.Add(newSession);
                SetCurrentCanvasSession(newSession);
            }
        }
Esempio n. 2
0
        //---------------------------------------------------------------------
        // Create a new picture and window
        //---------------------------------------------------------------------
        public void CreateNewPicture()
        {
            // Launch a dialogue to ask the user for the properties of the new picture
            NewPictureForm newPictureForm = new NewPictureForm();
            newPictureForm.Owner = this;
            newPictureForm.ShowDialog();

            // Check if the user hit OK or Cancel
            if (newPictureForm.DialogResult == DialogResult.OK) {
                // Create a new form to hold the picture
                CanvasWindow newMDIChild = new CanvasWindow(newPictureForm.canvasWidth, newPictureForm.canvasHeight, newPictureForm.canvasName);

                // Set the parent form the main form
                newMDIChild.MdiParent = this;

                // Make the form visible
                newMDIChild.Show();

                // Put the form on top of the others
                newMDIChild.BringToFront();

                //when a canvas is selected we want to update the toolbars and such!
                newMDIChild.GotFocus += (object sender, EventArgs e) =>{
                    CanvasWindow cw = sender as CanvasWindow;
                    SetCurrentCanvasSession(cw.m_session);
                };

                //when a canvas is shut down we need to disable the toolbar if there are no other canvases left
                newMDIChild.HandleDestroyed += (object sender, EventArgs args) => {
                    if (m_currentCanvasSession != null && sender == m_currentCanvasSession.canvasWindow) {
                        SetCurrentCanvasSession(null);
                    }
                };

                //create a new canvas session to go with the canvasWindow
                CanvasSession newSession = new CanvasSession(this, newMDIChild, layerControlForm);
                m_canvasSessions.Add(newSession);
                SetCurrentCanvasSession(newSession);
            }
        }
        //---------------------------------------------------------------------
        // Create a new picture and window
        //---------------------------------------------------------------------
        public void CreateNewPicture()
        {
            // Launch a dialogue to ask the user for the properties of the new picture
            NewPictureForm newPictureForm = new NewPictureForm();

            newPictureForm.Owner = this;
            newPictureForm.ShowDialog();

            // Check if the user hit OK or Cancel
            if (newPictureForm.DialogResult == DialogResult.OK)
            {
                // Create a new form to hold the picture
                CanvasWindow newMDIChild = new CanvasWindow(newPictureForm.canvasWidth, newPictureForm.canvasHeight, newPictureForm.canvasName);

                // Set the parent form the main form
                newMDIChild.MdiParent = this;

                // Make the form visible
                newMDIChild.Show();

                // Put the form on top of the others
                newMDIChild.BringToFront();

                newMDIChild.GotFocus += OnCanvasWindowGotFocus;

                // Add new picture to the base application
                SetCurrentCanvasSession(new CanvasSession(this, newMDIChild));
                m_canvasSessions.Add(m_currentCanvasSession);

                // Set up the workspace - the side pannel mostly
                // TODO: this stuff could probably be done in a seperate function that is called eveytime the canvas count changes.
                toolPanelTop.Visible = true;
                rightPanel.Visible   = true;
                rightPanel.Enabled   = true;

                // Set the picture as the focus of the side bar
                layerControlForm.ChangePictureFocus(newMDIChild.GetPicture());
            }
        }
        //---------------------------------------------------------------------
        // Create a new picture and window
        //---------------------------------------------------------------------
        public void CreateNewPicture()
        {
            // Launch a dialogue to ask the user for the properties of the new picture
            NewPictureForm newPictureForm = new NewPictureForm();
            newPictureForm.Owner = this;
            newPictureForm.ShowDialog();

            // Check if the user hit OK or Cancel
            if (newPictureForm.DialogResult == DialogResult.OK) {
                // Create a new form to hold the picture
                CanvasWindow newMDIChild = new CanvasWindow(newPictureForm.canvasWidth, newPictureForm.canvasHeight, newPictureForm.canvasName);

                // Set the parent form the main form
                newMDIChild.MdiParent = this;

                // Make the form visible
                newMDIChild.Show();

                // Put the form on top of the others
                newMDIChild.BringToFront();

                newMDIChild.GotFocus += OnCanvasWindowGotFocus;

                // Add new picture to the base application
                SetCurrentCanvasSession(new CanvasSession(this, newMDIChild));
                m_canvasSessions.Add(m_currentCanvasSession);

                // Set up the workspace - the side pannel mostly
                // TODO: this stuff could probably be done in a seperate function that is called eveytime the canvas count changes.
                toolPanelTop.Visible = true;
                rightPanel.Visible = true;
                rightPanel.Enabled = true;

                // Set the picture as the focus of the side bar
                layerControlForm.ChangePictureFocus(newMDIChild.GetPicture());
            }
        }