Exemple #1
0
        void SetCurrentTabController(bool pageChanged)
        {
            switch (_currentPageName)
            {
            case "Contents":
                if (pageChanged)
                {
                    View.SelectTab(_currentPageName);
                    SetLayerSecondaryChoice();
                }
                if (null == _layerContentsController)
                {
                    _layerContentsController = (ILineScatterLayerContentsController)Current.Gui.GetControllerAndControl(new object[] { _doc.PlotItems }, typeof(ILineScatterLayerContentsController), UseDocument.Directly);
                }
                _currentController  = _layerContentsController;
                View.CurrentContent = _currentController.ViewObject;
                break;

            case "Position":
                if (pageChanged)
                {
                    View.SelectTab(_currentPageName);
                    SetLayerSecondaryChoice();
                }
                if (null == _layerPositionController)
                {
                    _layerPositionController            = new LayerPositionController(_doc);
                    _layerPositionController.ViewObject = new LayerPositionControl();
                }
                _currentController  = _layerPositionController;
                View.CurrentContent = _layerPositionController.ViewObject;
                break;


            case "Scale":
                if (pageChanged)
                {
                    View.SelectTab(_currentPageName);
                    SetHorzVertSecondaryChoice();
                }
                if (_axisScaleController[_currentScale] == null)
                {
                    _axisScaleController[_currentScale]            = new AxisScaleController(_doc, _currentScale);
                    _axisScaleController[_currentScale].ViewObject = new AxisScaleControl();
                }
                _currentController  = _axisScaleController[_currentScale];
                View.CurrentContent = _currentController.ViewObject;
                break;

            case "CS":
                if (pageChanged)
                {
                    View.SelectTab(_currentPageName);
                    SetLayerSecondaryChoice();
                }
                if (null == this._coordinateController)
                {
                    this._coordinateController = new Altaxo.Gui.Graph.CoordinateSystemController(_doc.CoordinateSystem);
                    Current.Gui.FindAndAttachControlTo(this._coordinateController);
                }
                _currentController  = this._coordinateController;
                View.CurrentContent = this._coordinateController.ViewObject;
                break;

            case "GridStyle":
                if (pageChanged)
                {
                    View.SelectTab(_currentPageName);
                    SetPlaneSecondaryChoice();
                }

                if (!_GridStyleController.ContainsKey(_currentPlaneID))
                {
                    GridPlane           p    = _doc.GridPlanes.Contains(_currentPlaneID) ? _doc.GridPlanes[_currentPlaneID] : new GridPlane(_currentPlaneID);
                    GridPlaneController ctrl = new GridPlaneController(p);
                    Current.Gui.FindAndAttachControlTo(ctrl);
                    _GridStyleController.Add(_currentPlaneID, ctrl);
                }
                _currentController  = _GridStyleController[_currentPlaneID];
                View.CurrentContent = this._currentController.ViewObject;


                break;

            case "TitleAndFormat":
                if (pageChanged)
                {
                    View.SelectTab(_currentPageName);
                    SetEdgeSecondaryChoice();
                }

                if (!_TitleFormatController.ContainsKey(_currentAxisID))
                {
                    AxisStyle ast = _doc.AxisStyles.Contains(_currentAxisID) ? _doc.AxisStyles[_currentAxisID] : null;

                    if (null != ast)
                    {
                        _TitleFormatController.Add(_currentAxisID, (IMVCANController)Current.Gui.GetControllerAndControl(new object[] { ast }, typeof(IMVCANController), UseDocument.Directly));
                    }
                }

                _currentController = _TitleFormatController.ContainsKey(_currentAxisID) ? _TitleFormatController[_currentAxisID] : null;
                if (null != _currentController && null == _currentController.ViewObject)
                {
                    _currentController.ViewObject = new TitleFormatLayerControl();
                }


                View.SetCurrentContentWithEnable(
                    _currentController == null ? null : _currentController.ViewObject,
                    _currentController != null && _enableAxisStyle[_currentAxisID],
                    "Enable axis style");


                break;

            case "MajorLabels":
                if (pageChanged)
                {
                    View.SelectTab(_currentPageName);
                    SetEdgeSecondaryChoice();
                }

                if (!_enableAxisStyle[_currentAxisID])
                {
                    View.CurrentContent = null; // disable all, dont show any content
                }
                else // the axis style for this axis is at least activated
                {
                    if (!_MajorLabelController.ContainsKey(_currentAxisID))
                    {
                        AxisLabelStyle als = (AxisLabelStyle)_doc.AxisStyles[_currentAxisID].MajorLabelStyle;
                        if (null != als)
                        {
                            _MajorLabelController.Add(_currentAxisID, (IXYAxisLabelStyleController)Current.Gui.GetControllerAndControl(new object[] { als }, typeof(IXYAxisLabelStyleController), UseDocument.Directly));
                        }
                    }

                    _currentController = _MajorLabelController.ContainsKey(_currentAxisID)? _MajorLabelController[_currentAxisID] : null;

                    View.SetCurrentContentWithEnable(
                        _currentController == null ? null : _currentController.ViewObject,
                        _currentController != null && _enableMajorLabels[_currentAxisID],
                        "Enable major labels");
                }
                break;

            case "MinorLabels":
                if (pageChanged)
                {
                    View.SelectTab(_currentPageName);
                    SetEdgeSecondaryChoice();
                }

                if (!_enableAxisStyle[_currentAxisID])
                {
                    View.CurrentContent = null; // disable all, dont show any content
                }
                else // the axis style for this axis is at least activated
                {
                    if (!_MinorLabelController.ContainsKey(_currentAxisID))
                    {
                        AxisLabelStyle als = (AxisLabelStyle)_doc.AxisStyles[_currentAxisID].MinorLabelStyle;
                        if (null != als)
                        {
                            _MinorLabelController.Add(_currentAxisID, (IXYAxisLabelStyleController)Current.Gui.GetControllerAndControl(new object[] { als }, typeof(IXYAxisLabelStyleController), UseDocument.Directly));
                        }
                    }


                    _currentController = _MinorLabelController.ContainsKey(_currentAxisID) ? _MinorLabelController[_currentAxisID] : null;

                    View.SetCurrentContentWithEnable(
                        _currentController == null ? null : _currentController.ViewObject,
                        _currentController != null && _enableMinorLabels[_currentAxisID],
                        "Enable minor labels");
                }
                break;
            }
        }
    void SetCurrentTabController(bool pageChanged)
    {
      switch (_currentPageName)
      {
        case "Contents":
          if (pageChanged)
          {
            View.SelectTab(_currentPageName);
            SetLayerSecondaryChoice();
          }
          if (null == _layerContentsController)
          {
            _layerContentsController = (ILineScatterLayerContentsController)Current.Gui.GetControllerAndControl(new object[] { _doc.PlotItems }, typeof(ILineScatterLayerContentsController), UseDocument.Directly);
          }
          _currentController = _layerContentsController;
          View.CurrentContent = _currentController.ViewObject;
          break;
        case "Position":
          if (pageChanged)
          {
            View.SelectTab(_currentPageName);
            SetLayerSecondaryChoice();
          }
          if (null == _layerPositionController)
          {
            _layerPositionController = new LayerPositionController(_doc);
            _layerPositionController.ViewObject = new LayerPositionControl();
          }
          _currentController = _layerPositionController;
          View.CurrentContent = _layerPositionController.ViewObject;
          break;


        case "Scale":
          if (pageChanged)
          {
            View.SelectTab(_currentPageName);
            SetHorzVertSecondaryChoice();
          }
          if (_axisScaleController[_currentScale] == null)
          {
            _axisScaleController[_currentScale] = new AxisScaleController(_doc, _currentScale);
            _axisScaleController[_currentScale].ViewObject = new AxisScaleControl();
          }
          _currentController = _axisScaleController[_currentScale];
          View.CurrentContent = _currentController.ViewObject;
          break;

        case "CS":
          if (pageChanged)
          {
            View.SelectTab(_currentPageName);
            SetLayerSecondaryChoice();
          }
          if (null == this._coordinateController)
          {
            this._coordinateController = new Altaxo.Gui.Graph.CoordinateSystemController(_doc.CoordinateSystem);
            Current.Gui.FindAndAttachControlTo(this._coordinateController);
          }
          _currentController = this._coordinateController;
          View.CurrentContent = this._coordinateController.ViewObject;
          break;

        case "GridStyle":
          if (pageChanged)
          {
            View.SelectTab(_currentPageName);
            SetPlaneSecondaryChoice();
          }

          if (!_GridStyleController.ContainsKey(_currentPlaneID))
          {
            GridPlane p = _doc.GridPlanes.Contains(_currentPlaneID) ? _doc.GridPlanes[_currentPlaneID] : new GridPlane(_currentPlaneID);
            GridPlaneController ctrl = new GridPlaneController(p);
            Current.Gui.FindAndAttachControlTo(ctrl);
            _GridStyleController.Add(_currentPlaneID, ctrl);
          }
          _currentController = _GridStyleController[_currentPlaneID];
          View.CurrentContent = this._currentController.ViewObject;


          break;

        case "TitleAndFormat":
          if (pageChanged)
          {
            View.SelectTab(_currentPageName);
            SetEdgeSecondaryChoice();
          }

          if (!_TitleFormatController.ContainsKey(_currentAxisID))
          {
            AxisStyle ast = _doc.AxisStyles.Contains(_currentAxisID) ? _doc.AxisStyles[_currentAxisID] : null;

            if (null != ast)
            {
              _TitleFormatController.Add(_currentAxisID, (IMVCANController)Current.Gui.GetControllerAndControl(new object[]{ast},typeof(IMVCANController),UseDocument.Directly));
            }
          }

          _currentController = _TitleFormatController.ContainsKey(_currentAxisID) ? _TitleFormatController[_currentAxisID] : null;
          if (null != _currentController && null == _currentController.ViewObject)
            _currentController.ViewObject = new TitleFormatLayerControl();


          View.SetCurrentContentWithEnable(
            _currentController == null ? null : _currentController.ViewObject,
            _currentController != null && _enableAxisStyle[_currentAxisID],
            "Enable axis style");


          break;
        case "MajorLabels":
          if (pageChanged)
          {
            View.SelectTab(_currentPageName);
            SetEdgeSecondaryChoice();
          }

          if (!_enableAxisStyle[_currentAxisID])
          {
            View.CurrentContent = null; // disable all, dont show any content
          }
          else // the axis style for this axis is at least activated
          {
            if (!_MajorLabelController.ContainsKey(_currentAxisID))
            {
              AxisLabelStyle als = (AxisLabelStyle)_doc.AxisStyles[_currentAxisID].MajorLabelStyle;
              if (null != als)
              {
                _MajorLabelController.Add(_currentAxisID, (IXYAxisLabelStyleController)Current.Gui.GetControllerAndControl(new object[] { als }, typeof(IXYAxisLabelStyleController), UseDocument.Directly));
              }
            }

            _currentController = _MajorLabelController.ContainsKey(_currentAxisID)? _MajorLabelController[_currentAxisID] : null;

            View.SetCurrentContentWithEnable(
              _currentController == null ? null : _currentController.ViewObject,
              _currentController != null && _enableMajorLabels[_currentAxisID],
              "Enable major labels");
          }
          break;
        case "MinorLabels":
          if (pageChanged)
          {
            View.SelectTab(_currentPageName);
            SetEdgeSecondaryChoice();
          }

          if (!_enableAxisStyle[_currentAxisID])
          {
            View.CurrentContent = null; // disable all, dont show any content
          }
          else // the axis style for this axis is at least activated
          {
            if (!_MinorLabelController.ContainsKey(_currentAxisID))
            {
              AxisLabelStyle als = (AxisLabelStyle)_doc.AxisStyles[_currentAxisID].MinorLabelStyle;
              if (null != als)
              {
                _MinorLabelController.Add(_currentAxisID, (IXYAxisLabelStyleController)Current.Gui.GetControllerAndControl(new object[]{als},typeof(IXYAxisLabelStyleController),UseDocument.Directly));
              }
            }


            _currentController = _MinorLabelController.ContainsKey(_currentAxisID) ? _MinorLabelController[_currentAxisID] : null;

            View.SetCurrentContentWithEnable(
              _currentController == null ? null : _currentController.ViewObject,
              _currentController != null && _enableMinorLabels[_currentAxisID],
              "Enable minor labels");
          }
          break;

      }
    }