Beispiel #1
0
        void ReadOptions()
        {
            // start undo/redo transaction
            undoRedoArea.Start("set options");

            ProgramOptions options = new ProgramOptions();
            // MainForm options
            SetBounds(options.FormRect.Left, options.FormRect.Top, options.FormRect.Width, options.FormRect.Height);
            if (options.FormWindowState != FormWindowState.Minimized)
                WindowState = options.FormWindowState;
            SidebarSide = options.SidebarSide;
            SidebarWidth = options.SidebarWidth;
            // dvEditor options
            dvEditor.AntiAlias = options.AntiAlias;
            if (options.Zoom == Zoom.Custom)
                dvEditor.Scale = options.Scale;
            else
                dvEditor.Zoom = options.Zoom;
            // toolbar options
            editToolStripMenuItem1.Checked = options.EditToolbar;
            personalToolStripMenuItem.Checked = options.PersonalToolbar;
            modeSelectToolStripMenuItem.Checked = options.EngineStateToolbar;
            propertySelectToolStripMenuItem.Checked = options.PropertyStateToolbar;
            pageNavigationToolStripMenuItem.Checked = options.PageNavigationToolbar;
            toolsToolStripMenuItem1.Checked = options.ToolsToolbar;
            UpdateToolbars();
            // misc
            highlightSelection = options.HighlightSelection;
            PageTools.SetDefaultSizeMM(options.DefaultPageSize);
            NewPageSize = PageTools.FormatToSize(PageFormat.Default);
            if (options.AutoSaveInterval >= 1)
                autoSaveTimer.Interval = options.AutoSaveInterval;
            else
                autoSaveTimer.Tick -= autoSaveTimer_Tick;
            WorkBookUtils.AutoRotateSnap = options.AutoRotateSnap;
            WorkBookUtils.AutoLockAspectRatio = options.AutoLockAspectRatio;
            // grid options
            gridSize = options.GridSize;
            showGrid = options.ShowGrid;
            gridSnapPosition = options.GridSnapPosition;
            gridSnapResize = options.GridSnapResize;
            gridSnapLines = options.GridSnapLines;
            // load recent docs
            LoadRecentDocuments(options);
            // load personal toolbar
            PtUtils.LoadPersonalTools(tsPersonal);
            // load figure toolbar
            FigureToolStrip.LoadFigureTools();

            // commit undo redo
            undoRedoArea.Commit();
            undoRedoArea.ClearHistory();
        }
Beispiel #2
0
 void WriteOptions()
 {
     ProgramOptions options = new ProgramOptions();
     // MainForm options
     if (WindowState != FormWindowState.Normal)
         options.FormRect = RestoreBounds;
     else
         options.FormRect = new Rectangle(Left, Top, Width, Height);
     options.FormWindowState = WindowState;
     options.SidebarSide = SidebarSide;
     options.SidebarWidth = SidebarWidth;
     // dvEditor options
     options.Zoom = dvEditor.Zoom;
     options.Scale = dvEditor.Scale;
     options.AntiAlias = dvEditor.AntiAlias;
     // toolbar options
     options.EditToolbar = tsEdit.Visible;
     options.PersonalToolbar = tsPersonal.Visible;
     options.EngineStateToolbar = tsEngineState.Visible;
     options.PropertyStateToolbar = tsPropState.Visible;
     options.PageNavigationToolbar = tsPageManage.Visible;
     options.ToolsToolbar = tsTools.Visible;
     // misc
     options.HighlightSelection = highlightSelection;
     // grid options
     options.GridSize = gridSize;
     options.ShowGrid = showGrid;
     options.GridSnapPosition = gridSnapPosition;
     options.GridSnapResize = gridSnapResize;
     options.GridSnapLines = gridSnapLines;
     // write to file
     options.WriteIni();
     // save personal toolbar
     PtUtils.SavePersonalTools(tsPersonal);
     // save figure toolbar
     FigureToolStrip.SaveFigureTools();
 }
Beispiel #3
0
 void LoadRecentDocuments(ProgramOptions options)
 {
     recentDocumentsToolStripMenuItem.DropDown.Items.Clear();
     List<string> recentDocs = options.GetRecentDocuments();
     if (recentDocs.Count > 0)
     {
         recentDocumentsToolStripMenuItem.Enabled = true;
         int n = 1;
         foreach (string doc in recentDocs)
         {
             ToolStripItem t = recentDocumentsToolStripMenuItem.DropDown.Items.Add(
                 string.Format("{0}: {1}", n, Path.GetFileNameWithoutExtension(doc)));
             n++;
             t.Tag = doc;
             t.Click += new EventHandler(recentDoc_Click);
         }
     }
     else
         recentDocumentsToolStripMenuItem.Enabled = false;
 }