private void CreateSubController() { if (_doc is ItemLocationDirect) { ItemLocationDirectController ctrl; _subController = ctrl = new ItemLocationDirectController() { UseDocumentCopy = UseDocument.Directly }; if (IsRootLayerPosition) { ctrl.ShowAnchorElements(false, false); ctrl.ShowPositionElements(false, false); } _subController.InitializeDocument(_doc, _layer.ParentLayerSize); } else if (_doc is ItemLocationByGrid) { if (null == _layer.ParentLayer) { throw new InvalidOperationException("This should not be happen; the calling routine must ensure that ItemLocationDirect is used when no parent layer is present"); } _layer.ParentLayer.CreateGridIfNullOrEmpty(); _subController = new ItemLocationByGridController() { UseDocumentCopy = UseDocument.Directly }; _subController.InitializeDocument(_doc, _layer.ParentLayer.Grid); } Current.Gui.FindAndAttachControlTo(_subController); }
protected override void Initialize(bool initData) { base.Initialize(initData); if (initData) { _dataController = new DecomposeByColumnContentDataController() { UseDocumentCopy = UseDocument.Directly }; _dataController.InitializeDocument(_doc.Data); _optionsController = new DecomposeByColumnContentOptionsController { UseDocumentCopy = UseDocument.Directly }; _optionsController.InitializeDocument(_doc.Options); Current.Gui.FindAndAttachControlTo(_dataController); Current.Gui.FindAndAttachControlTo(_optionsController); } if (null != _view) { _view.SetDataControl(_dataController.ViewObject); _view.SetOptionsControl(_optionsController.ViewObject); } }
protected override void Initialize(bool initData) { base.Initialize(initData); if (initData) { _scaleController = new DensityScaleController(newScale => _doc.ColorScale = (NumericalScale)newScale) { UseDocumentCopy = UseDocument.Directly }; _scaleController.InitializeDocument(_doc.ColorScale ?? new LinearScale()); _colorProviderController = new ColorProviderController(newColorProvider => _doc.ColorProvider = newColorProvider) { UseDocumentCopy = UseDocument.Directly }; _colorProviderController.InitializeDocument(_doc.ColorProvider); _materialController = new MaterialController() { UseDocumentCopy = UseDocument.Directly }; _materialController.InitializeDocument(_doc.Material); } if (_view != null) { _scaleController.ViewObject = _view.ColorScaleView; _view.IsCustomColorScaleUsed = null != _doc.ColorScale; _colorProviderController.ViewObject = _view.ColorProviderView; if (null == _materialController.ViewObject) _materialController.ViewObject = _view.MaterialViewObject; _view.ClipToLayer = _doc.ClipToLayer; } }
protected override void Initialize(bool initData) { base.Initialize(initData); if (initData) { _scaleController = new DensityScaleController(newScale => _doc.Scale = (NumericalScale)newScale) { UseDocumentCopy = UseDocument.Directly }; _scaleController.InitializeDocument(_doc.Scale); _colorProviderController = new ColorProviderController(newColorProvider => _doc.ColorProvider = newColorProvider) { UseDocumentCopy = UseDocument.Directly }; _colorProviderController.InitializeDocument(_doc.ColorProvider); } if (_view != null) { _scaleController.ViewObject = _view.DensityScaleView; _colorProviderController.ViewObject = _view.ColorProviderView; _view.ClipToLayer = _doc.ClipToLayer; } }
protected override void Initialize(bool initData) { base.Initialize(initData); if (initData) { _dataSourceOptionsController = (IMVCANController)Current.Gui.GetControllerAndControl(new object[] { _doc.ImportOptions }, typeof(IMVCANController), UseDocument.Directly); _processOptionsController = (IMVCANController)Current.Gui.GetControllerAndControl(new object[] { _doc.DataSourceOptions }, typeof(IMVCANController), UseDocument.Directly); _processDataController = new ConvertXYVToMatrixDataController() { UseDocumentCopy = UseDocument.Directly }; _processDataController.InitializeDocument(_doc.InputData); Current.Gui.FindAndAttachControlTo(_processDataController); } if (null != _view) { _view.SetImportOptionsControl(_dataSourceOptionsController.ViewObject); _view.SetProcessOptionsControl(_processOptionsController.ViewObject); if (null != _processDataController) { _view.SetProcessDataControl(_processDataController.ViewObject); } } }
private void InitializeDataView() { _dataController = new XYZMeshedColumnPlotDataController { UseDocumentCopy = UseDocument.Directly }; _dataController.InitializeDocument(_doc.Data); Current.Gui.FindAndAttachControlTo(_dataController); _innerController.AddTab("Data", _dataController, _dataController.ViewObject); }
private void InitializeOptionView() { _optionsController = new Gdi.Plot.DensityImagePlotItemOptionController() { UseDocumentCopy = UseDocument.Directly }; _optionsController.InitializeDocument(_doc); Current.Gui.FindAndAttachControlTo(_optionsController); _innerController.AddTab("Options", _optionsController, _optionsController.ViewObject); }
private void SetCurrentTabController(bool pageChanged) { switch (_currentPageName) { case "GraphicItems": if (pageChanged) { _view.SelectTab(_currentPageName); } if (null == _layerGraphItemsController) { _layerGraphItemsController = (IMVCANController)Current.Gui.GetControllerAndControl(new object[] { _doc.GraphObjects }, typeof(IMVCANController), UseDocument.Directly); } _currentController = _layerGraphItemsController; _view.CurrentContent = _currentController.ViewObject; break; case "Position": if (pageChanged) { _view.SelectTab(_currentPageName); } if (null == _layerPositionController) { _layerPositionController = new LayerPositionController() { UseDocumentCopy = UseDocument.Directly }; _layerPositionController.InitializeDocument(_doc.Location, _doc); Current.Gui.FindAndAttachControlTo(_layerPositionController); } _currentController = _layerPositionController; _view.CurrentContent = _layerPositionController.ViewObject; break; case "HostGrid": if (pageChanged) { _view.SelectTab(_currentPageName); } if (null == _layerGridController) { _layerGridController = new GridPartitioningController() { UseDocumentCopy = UseDocument.Directly }; _layerGridController.InitializeDocument(_doc.Grid, _doc); Current.Gui.FindAndAttachControlTo(_layerGridController); } _currentController = _layerGridController; _view.CurrentContent = _layerGridController.ViewObject; break; } }
private void Initialize(bool initData) { if (initData) { _dataController = new MasterCurveCreationDataController(); _dataController.InitializeDocument(_doc.ColumnGroups); Current.Gui.FindAndAttachControlTo(_dataController); } if (null != _view) { _view.InitializeDataTab(_dataController.ViewObject); } }
private void Initialize(bool initData) { if (initData) { _dataController = new MasterCurveCreationDataController(); _dataController.InitializeDocument(_doc.ColumnGroups); Current.Gui.FindAndAttachControlTo(_dataController); } if (null != _view) { _view.InitializeDataTab(_dataController.ViewObject); } }
/// <summary> /// This distributes changes made to one of the sub plot styles to all other plot styles. Additionally, the controller /// for this styles are also updated. /// </summary> /// <param name="pivotelement"></param> void DistributeStyleChange(int pivotelement) { IPlotArea layer = Main.DocumentPath.GetRootNodeImplementing <IPlotArea>(_doc); _tempdoc.Style.DistributeSubStyleChange(pivotelement, layer, _doc.GetRangesAndPoints(layer)); // now all style controllers must be updated for (int i = 0; i < _styleControllerList.Count; i++) { _styleControllerList[i].InitializeDocument(_tempdoc.Style[i]); } if (_additionalPlotStyle != null && _additionalPlotStyleController != null) { _tempdoc.Style.PrepareNewSubStyle(_additionalPlotStyle, layer, _doc.GetRangesAndPoints(layer)); _additionalPlotStyleController.InitializeDocument(_additionalPlotStyle); } }
protected override void Initialize(bool initData) { base.Initialize(initData); if (initData) { _grid1 = new XYGridStyleController() { UseDocumentCopy = UseDocument.Directly }; _grid1.InitializeDocument(_doc.GridStyleFirst ?? new GridStyle() { ShowGrid = false }); Current.Gui.FindAndAttachControlTo(_grid1); var c1 = new ControlViewElement(GridName(_doc.PlaneID.InPlaneAxisNumber1), _grid1, _grid1.ViewObject); _grid2 = new XYGridStyleController() { UseDocumentCopy = UseDocument.Directly }; _grid2.InitializeDocument(_doc.GridStyleSecond ?? new GridStyle() { ShowGrid = false }); Current.Gui.FindAndAttachControlTo(_grid2); var c2 = new ControlViewElement(GridName(_doc.PlaneID.InPlaneAxisNumber2), _grid2, _grid2.ViewObject); _background = new BrushControllerAdvanced() { UseDocumentCopy = UseDocument.Directly }; _background.InitializeDocument(_doc.Background ?? BrushX.Empty); Current.Gui.FindAndAttachControlTo(_background); var c3 = new ControlViewElement("Background", _background, _background.ViewObject); _innerController = new MultiChildController(new ControlViewElement[] { c1, c2, c3 }, false); } }
/// <summary> /// Gets an <see cref="IMVCController" /> for a given document type. /// </summary> /// <param name="creationArgs">The argument list. The first element args[0] is the document for which the controller is searched. The following elements are /// optional, and are usually the parents of this document.</param> /// <param name="overrideArg0Type">If this parameter is not null, this given type is used instead of determining the type of the <c>arg[0]</c> argument.</param> /// <param name="expectedControllerType">Type of controller that you expect to return.</param> /// <param name="copyDocument">Determines wether to use the document directly or use a clone of the document.</param> /// <returns>The controller for that document when found.</returns> public IMVCController GetController(object[] creationArgs, System.Type overrideArg0Type, System.Type expectedControllerType, UseDocument copyDocument) { if (!ReflectionService.IsSubClassOfOrImplements(expectedControllerType, typeof(IMVCController))) { throw new ArgumentException("Expected controller type has to be IMVCController or a subclass or derived class of this"); } object result = null; // 1st search for all classes that wear the UserControllerForObject attribute ReflectionService.IAttributeForClassList list = ReflectionService.GetAttributeInstancesAndClassTypesForClass(typeof(UserControllerForObjectAttribute), creationArgs[0], overrideArg0Type); foreach (Type definedType in list.Types) { if (ReflectionService.IsSubClassOfOrImplements(definedType, typeof(IMVCANController))) { IMVCANController mvcan = (IMVCANController)Activator.CreateInstance(definedType); mvcan.UseDocumentCopy = copyDocument; if (mvcan.InitializeDocument(creationArgs)) { result = mvcan; } } else { result = ReflectionService.CreateInstanceFromList(list, new Type[] { expectedControllerType }, creationArgs); } if (result is IMVCController) { break; } } return((IMVCController)result); }
private void SetCurrentTabController(bool pageChanged) { switch (_currentPageName) { case "GraphicItems": if (pageChanged) { _view.SelectTab(_currentPageName); } if (null == _layerGraphItemsController) { _layerGraphItemsController = (IMVCANController)Current.Gui.GetControllerAndControl(new object[] { _doc.GraphObjects }, typeof(IMVCANController), UseDocument.Directly); } _currentController = _layerGraphItemsController; _view.CurrentContent = _currentController.ViewObject; break; case "Contents": if (pageChanged) { _view.SelectTab(_currentPageName); SetSecondaryChoiceToUnique(); } if (null == _layerContentsController) { _layerContentsController = (IMVCANController)Current.Gui.GetControllerAndControl(new object[] { _doc.PlotItems }, typeof(IMVCANController), UseDocument.Directly); } _currentController = _layerContentsController; _view.CurrentContent = _currentController.ViewObject; break; case "Position": if (pageChanged) { _view.SelectTab(_currentPageName); SetSecondaryChoiceToUnique(); } if (null == _layerPositionController) { _layerPositionController = new LayerPositionController() { UseDocumentCopy = UseDocument.Directly }; _layerPositionController.InitializeDocument(_doc.Location, _doc); Current.Gui.FindAndAttachControlTo(_layerPositionController); } _currentController = _layerPositionController; _view.CurrentContent = _layerPositionController.ViewObject; break; case "Scale": if (pageChanged) { _view.SelectTab(_currentPageName); SetSecondaryChoiceToScales(); } if (_axisScaleController[_currentScale] == null) { var ctrl = new ScaleWithTicksController(scale => _doc.Scales[_currentScale] = scale, false); ctrl.InitializeDocument(_doc.Scales[_currentScale]); _axisScaleController[_currentScale] = ctrl; Current.Gui.FindAndAttachControlTo(_axisScaleController[_currentScale]); } _currentController = _axisScaleController[_currentScale]; _view.CurrentContent = _currentController.ViewObject; break; case "CS": if (pageChanged) { _view.SelectTab(_currentPageName); SetSecondaryChoiceToUnique(); } if (null == _coordinateController) { _coordinateController = new Altaxo.Gui.Graph.Gdi.CoordinateSystemController() { UseDocumentCopy = UseDocument.Directly }; _coordinateController.InitializeDocument(_doc.CoordinateSystem); Current.Gui.FindAndAttachControlTo(_coordinateController); } _currentController = _coordinateController; _view.CurrentContent = _coordinateController.ViewObject; break; case "GridStyle": if (pageChanged) { _view.SelectTab(_currentPageName); SetSecondaryChoiceToPlanes(); } if (!_GridStyleController.ContainsKey(_currentPlaneID)) { GridPlane p = _doc.GridPlanes.Contains(_currentPlaneID) ? _doc.GridPlanes[_currentPlaneID] : new GridPlane(_currentPlaneID); var ctrl = new GridPlaneController() { UseDocumentCopy = UseDocument.Directly }; ctrl.InitializeDocument(p); Current.Gui.FindAndAttachControlTo(ctrl); _GridStyleController.Add(_currentPlaneID, ctrl); } _currentController = _GridStyleController[_currentPlaneID]; _view.CurrentContent = _currentController.ViewObject; break; case "TitleAndFormat": if (pageChanged) { _view.SelectTab(_currentPageName); SetSecondaryChoiceToAxes(); } _view.CurrentContent = _axisControl[_currentAxisID].AxisStyleCondView; _currentController = _axisControl[_currentAxisID].AxisStyleCondController; break; case "MajorLabels": if (pageChanged) { _view.SelectTab(_currentPageName); SetSecondaryChoiceToAxes(); } _view.CurrentContent = _axisControl[_currentAxisID].MajorLabelCondView; _currentController = _axisControl[_currentAxisID].MajorLabelCondController; break; case "MinorLabels": if (pageChanged) { _view.SelectTab(_currentPageName); SetSecondaryChoiceToAxes(); } _view.CurrentContent = _axisControl[_currentAxisID].MinorLabelCondView; _currentController = _axisControl[_currentAxisID].MinorLabelCondController; break; } }
private void SetCurrentTabController(bool pageChanged) { switch (_currentPageName) { case "CS": if (pageChanged) { _view.SelectTab(_currentPageName); SetSecondaryChoiceToUnique(); } if (null == _coordinateController) { _coordinateController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _doc.CoordinateSystem }, typeof(IMVCAController), UseDocument.Directly); } _currentController = _coordinateController; _view.CurrentContent = _coordinateController.ViewObject; break; case "Position": if (pageChanged) { _view.SelectTab(_currentPageName); } if (null == _layerPositionController) { _layerPositionController = new ItemLocationDirectController() { UseDocumentCopy = UseDocument.Directly }; _layerPositionController.InitializeDocument(_doc.Location); Current.Gui.FindAndAttachControlTo(_layerPositionController); } _currentController = _layerPositionController; _view.CurrentContent = _layerPositionController.ViewObject; break; case "Scale": if (pageChanged) { _view.SelectTab(_currentPageName); SetSecondaryChoiceToScales(); } if (_axisScaleController == null) { _axisScaleController = new ScaleWithTicksController(null, true) { UseDocumentCopy = UseDocument.Directly }; _axisScaleController.InitializeDocument(_doc.ScaleWithTicks); Current.Gui.FindAndAttachControlTo(_axisScaleController); } _currentController = _axisScaleController; _view.CurrentContent = _currentController.ViewObject; break; case "TitleAndFormat": if (pageChanged) { _view.SelectTab(_currentPageName); SetSecondaryChoiceToAxes(); } _view.CurrentContent = _axisControl[_currentAxisID].AxisStyleCondView; _currentController = _axisControl[_currentAxisID].AxisStyleCondController; break; case "MajorLabels": if (pageChanged) { _view.SelectTab(_currentPageName); SetSecondaryChoiceToAxes(); } _view.CurrentContent = _axisControl[_currentAxisID].MajorLabelCondView; _currentController = _axisControl[_currentAxisID].MajorLabelCondController; break; case "MinorLabels": if (pageChanged) { _view.SelectTab(_currentPageName); SetSecondaryChoiceToAxes(); } _view.CurrentContent = _axisControl[_currentAxisID].MinorLabelCondView; _currentController = _axisControl[_currentAxisID].MinorLabelCondController; break; } }