Пример #1
0
        protected override void Initialize(bool initData)
        {
            base.Initialize(initData);

            if (initData)
            {
                _srcSize     = _doc.GetImageSizePt();
                _docScale    = new PointD2D(_doc.Size.X / _srcSize.X, _doc.Size.Y / _srcSize.Y);
                _docLocation = new ItemLocationDirect();
                _docLocation.CopyFrom(_doc.Location);
                _docLocation.Scale  = new PointD2D(_doc.Size.X / _srcSize.X, _doc.Size.Y / _srcSize.Y);
                _locationController = new ItemLocationDirectController()
                {
                    UseDocumentCopy = UseDocument.Directly
                };
                _locationController.InitializeDocument(new object[] { _docLocation });
                Current.Gui.FindAndAttachControlTo(_locationController);

                _locationController.SizeXChanged  += EhLocController_SizeXChanged;
                _locationController.SizeYChanged  += EhLocController_SizeYChanged;
                _locationController.ScaleXChanged += EhLocController_ScaleXChanged;
                _locationController.ScaleYChanged += EhLocController_ScaleYChanged;
                _locationController.ShowSizeElements(true, !_doc.IsSizeCalculationBasedOnSourceSize);
                _locationController.ShowScaleElements(true, _doc.IsSizeCalculationBasedOnSourceSize);
            }
            if (_view != null)
            {
                _view.SourceSize       = _srcSize;
                _view.AspectPreserving = _doc.AspectRatioPreserving;
                _view.IsSizeCalculationBasedOnSourceSize = _doc.IsSizeCalculationBasedOnSourceSize;
                _view.LocationView = _locationController.ViewObject;
            }
        }
Пример #2
0
 public override IEnumerable <ControllerAndSetNullMethod> GetSubControllers()
 {
     yield return(new ControllerAndSetNullMethod(_locationController, () => _locationController = null));
 }