/*private void SetTabPageTitle(VD2Data inDataDoc)
         * {
         *  if (inDataDoc != null)
         *  {
         *      string savestring = "";
         *      if (inDataDoc.Unsaved)
         *      {
         *          savestring = "*";
         *      }
         *
         *      string rwstring = "";
         *      string sourcestring = "";
         *
         *      if (inDataDoc.Source != null)
         *      {
         *          sourcestring = inDataDoc.Source.ShortName;
         *          if (inDataDoc.Source.WriteAccess)
         *          {
         *              rwstring = "[RW]";
         *          }
         *          else
         *          {
         *              rwstring = "[R]";
         *          }
         *      }
         *      string filename = System.IO.Path.GetFileNameWithoutExtension(inDataDoc.FilePath);
         *      SetTabPageTitle("(" + sourcestring + rwstring + ") " + savestring + filename + "     ");
         *  }
         * }*/

        void SetTabPageIcon(string inKey)
        {
            if (Parent is TabPage)
            {
                TabPage parentpage = (TabPage)Parent;
                parentpage.ImageKey = inKey;
                if (parentpage.Parent is DocumentTabControl)
                {
                    DocumentTabControl grandparenttabcontrol = (DocumentTabControl)parentpage.Parent;
                    grandparenttabcontrol.Repos();
                }
            }
        }
 private void SetTabPageTitle(string inTitle)
 {
     if (Parent is TabPage)
     {
         TabPage parentpage = (TabPage)Parent;
         parentpage.Text = inTitle;
         if (parentpage.Parent is DocumentTabControl)
         {
             DocumentTabControl grandparenttabcontrol = (DocumentTabControl)parentpage.Parent;
             grandparenttabcontrol.Repos();
         }
     }
 }
Exemple #3
0
        private void DocumentTab_CloseClick(object sender, CancelEventArgs e)
        {
            if (sender is Button)
            {
                Control            c            = this;
                DocumentTabControl mytabcontrol = null;
                TabPage            mytabpage    = null;
                while (c.Parent != null)
                {
                    if (c.Parent is TabPage)
                    {
                        mytabpage = (TabPage)c.Parent;
                    }
                    if (c.Parent is DocumentTabControl)
                    {
                        mytabcontrol = (DocumentTabControl)c.Parent;
                        break;//if we reached the tab control we're done
                    }
                    c = c.Parent;
                }
                if ((mytabpage != null) && (mytabcontrol != null))
                {
                    if (mytabpage == mytabcontrol.TabPageByCloseButton((Button)sender))
                    {
                        if (DataFile.Unsaved)
                        {
                            EditorSaveDocumentDialog dialog = new EditorSaveDocumentDialog();
                            DialogResult             result = dialog.ShowDialog();
                            switch (result)
                            {
                            case DialogResult.Yes:
                                DataFile.TrySaveData();
                                break;

                            case DialogResult.No:
                                DataFile.LoadDataFromXML();
                                break;

                            case DialogResult.Cancel:
                                e.Cancel = true;
                                break;
                            }
                        }
                    }
                }
            }
        }
Exemple #4
0
        private void DataDocumentControl_ParentChanged(object sender, EventArgs e)
        {
            Control            c            = this;
            DocumentTabControl mytabcontrol = null;

            while (c.Parent != null)
            {
                if (c.Parent is DocumentTabControl)
                {
                    mytabcontrol = (DocumentTabControl)c.Parent;
                    break;//if we reached the tab control we're done
                }
                c = c.Parent;
            }
            if (mytabcontrol != null)
            {
                mytabcontrol.CloseClick += DocumentTab_CloseClick;
            }
        }