Exemple #1
0
        void EhAdvancedPlotGroupControlRequired(object sender, EventArgs e)
        {
            _plotGroupView.AdvancedPlotGroupControl -= EhAdvancedPlotGroupControlRequired;
            ApplyPlotGroupView();
            _plotGroupView = null;
            if (_groupStyles != null)
            {
                _plotGroupController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _groupStyles }, typeof(IMVCAController));
                // remove the tabs 1.., leaving only the style and data tab
                if (_dataController == null)
                {
                    RemoveTabRange(0, TabCount);
                }
                else
                {
                    RemoveTabRange(1, TabCount - 1);
                }

                AddTab("Grouping", _plotGroupController, _plotGroupController.ViewObject);
                AddTab("Styles", _styleCollectionController, _styleCollectionController.ViewObject);

                InitializeStyles();

                BringTabToFront(_dataController == null ? 0 : 1);
            }
        }
Exemple #2
0
        private void ShowPropertyValueDialog(string propertyKey, string propertyName, object propertyValue)
        {
            IMVCAController controller = null;
            var             pk         = PropertyKeyBase.GetPropertyKey(propertyKey);

            if (null != pk && pk.CanCreateEditingController)
            {
                controller = pk.CreateEditingController(propertyValue);
            }

            if (null == controller)
            {
                controller = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { propertyValue }, typeof(IMVCAController), UseDocument.Copy);
            }

            if (null == controller)
            {
                Current.Gui.ErrorMessageBox("Sorry! Didn't find a Gui controller to edit this property value!");
                ;
                return;
            }

            if (Current.Gui.ShowDialog(controller, "Edit property " + propertyName, false))
            {
                var newValue = controller.ModelObject;
                _doc.TopmostBag.SetValue(propertyKey, newValue);
                InitializeExistingPropertyValuesList();
                if (null != _view)
                {
                    _view.PropertyValueList = _propertyList;
                }
            }
        }
        protected override void Initialize(bool initData)
        {
            base.Initialize(initData);

            if (initData)
            {
                // try to find a controller for the underlying function
                _functionController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _doc.Function }, typeof(IMVCAController), UseDocument.Directly);
            }
            if (_view != null)
            {
                bool   editable = null != _functionController;
                string text;
                if (_doc.Function is Altaxo.Scripting.IScriptText)
                {
                    text = ((Altaxo.Scripting.IScriptText)_doc.Function).ScriptText;
                }
                else
                {
                    text = _doc.Function.ToString();
                }

                _view.InitializeFunctionText(text, editable);
            }
        }
Exemple #4
0
        public void InitDetailController(bool bInit)
        {
            if (bInit)
            {
                object providerObject = _doc;

                if (_detailController is IMVCANDController)
                {
                    ((IMVCANDController)_detailController).MadeDirty -= EhDetailsChanged;
                }

                _detailController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { providerObject }, typeof(IMVCANController), UseDocument.Directly);

                if (null != _detailController && GetType() == _detailController.GetType()) // the returned controller is of this common type here -> thus no specialized controller seems to exist for this type of color provider
                {
                    _detailController.Dispose();
                    _detailController = null;
                }

                if (_detailController is IMVCANDController)
                {
                    ((IMVCANDController)_detailController).MadeDirty += EhDetailsChanged;
                }
            }
            if (null != _view)
            {
                _detailView = null == _detailController ? null : _detailController.ViewObject;
                _view.SetDetailView(_detailView);
            }
        }
Exemple #5
0
        void Initialize(bool bInit)
        {
            if (_view != null)
            {
                // look for coordinate system types
                Type[] subtypes = Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(G2DCoordinateSystem));

                ListNodeList list = new ListNodeList();
                foreach (Type t in subtypes)
                {
                    list.Add(new ListNode(Current.Gui.GetUserFriendlyClassName(t), t));
                }

                // look for a controller-control
                _view.TypeLabel = "Type";
                _view.InitializeTypeNames(list, list.IndexOfObject(_tempdoc.GetType()));

                // To avoid looping when a dedicated controller is unavailable, we first instantiate the controller alone and compare the types
                _instanceController = (IMVCAController)Current.Gui.GetController(new object[] { _tempdoc }, typeof(IMVCAController));
                if (_instanceController != null && (_instanceController.GetType() != this.GetType()))
                {
                    Current.Gui.FindAndAttachControlTo(_instanceController);
                    if (_instanceController.ViewObject != null)
                    {
                        _view.SetInstanceControl(_instanceController.ViewObject);
                    }
                }
                else
                {
                    _instanceController = null;
                    _view.SetInstanceControl(null);
                }
            }
        }
        public void SetElements(bool bInit)
        {
            System.Collections.ArrayList arr = new System.Collections.ArrayList();

            if (bInit)
            {
                if (_doc.AxisLineStyle != null)
                {
                    _axisLineStyleController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _doc.AxisLineStyle }, typeof(IMVCAController), UseDocument.Directly);
                }
                else
                {
                    _axisLineStyleController = null;
                }
            }

            if (m_View != null)
            {
                m_View.AxisTitle       = _doc.TitleText;
                m_View.ShowAxisLine    = _doc.ShowAxisLine;
                m_View.ShowMajorLabels = _doc.ShowMajorLabels;
                m_View.ShowMinorLabels = _doc.ShowMinorLabels;
                m_View.LineStyleView   = _axisLineStyleController == null ? null : _axisLineStyleController.ViewObject;
            }
        }
Exemple #7
0
 private void AttachController(IMVCAController ctrl)
 {
     if (ctrl is IMVCANDController)
     {
         (ctrl as IMVCANDController).MadeDirty += EhMadeDirty;
     }
 }
    void Initialize(bool bInit)
    {
      if (_view != null)
      {
        // look for coordinate system types
        Type[] subtypes = Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(G2DCoordinateSystem));

        ListNodeList list = new ListNodeList();
        foreach(Type t in subtypes)
          list.Add(new ListNode(Current.Gui.GetUserFriendlyClassName(t), t));

        // look for a controller-control
        _view.TypeLabel="Type";
        _view.InitializeTypeNames(list, list.IndexOfObject(_tempdoc.GetType()));

        // To avoid looping when a dedicated controller is unavailable, we first instantiate the controller alone and compare the types
        _instanceController = (IMVCAController)Current.Gui.GetController(new object[] { _tempdoc }, typeof(IMVCAController));
        if (_instanceController != null && (_instanceController.GetType() != this.GetType()))
        {
          Current.Gui.FindAndAttachControlTo(_instanceController);
          if (_instanceController.ViewObject != null)
            _view.SetInstanceControl(_instanceController.ViewObject);
        }
        else
        {
          _instanceController = null;
          _view.SetInstanceControl(null);
        }
      }
    }
Exemple #9
0
        private IMVCAController GetControllerFor(Property prop)
        {
            IMVCAController ctrl = null;

            var att = prop.Attributes.OfType <System.ComponentModel.EditorAttribute>().FirstOrDefault();

            if (null != att)
            {
                var ctrlType = Type.GetType(att.EditorTypeName, false);
                if (ctrlType != null)
                {
                    try
                    {
                        var controller = Activator.CreateInstance(ctrlType) as IMVCANController;
                        controller.InitializeDocument(prop.Value);
                        Current.Gui.FindAndAttachControlTo(controller);
                        ctrl = controller;
                    }
                    catch (Exception)
                    {
                    }
                }
            }

            if (null == ctrl)
            {
                ctrl = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { prop.Value }, typeof(IMVCAController), UseDocument.Directly);
            }

            return(ctrl);
        }
Exemple #10
0
        public override void Dispose(bool isDisposing)
        {
            _lastControllerApplied = null;
            _currentController     = null;
            _listOfUniqueItem      = null;

            base.Dispose(isDisposing);
        }
 private void EhShowAxisLineChanged(object sender, EventArgs e)
 {
     if (m_View.ShowAxisLine && null == _doc.AxisLineStyle)
     {
         _doc.ShowAxisLine             = true;
         this._axisLineStyleController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _doc.AxisLineStyle }, typeof(IMVCAController));
         m_View.LineStyleView          = _axisLineStyleController.ViewObject;
     }
 }
Exemple #12
0
        public override IEnumerable <ControllerAndSetNullMethod> GetSubControllers()
        {
            yield return(new ControllerAndSetNullMethod(_entireTableQueryController, () => _entireTableQueryController = null));

            yield return(new ControllerAndSetNullMethod(_queryDesignerController, () => _queryDesignerController = null));

            yield return(new ControllerAndSetNullMethod(_arbitrarySqlQueryController, () => _arbitrarySqlQueryController = null));

            yield return(new ControllerAndSetNullMethod(null, () => _currentlySelectedController = null));
        }
        public override System.Collections.Generic.IEnumerable <ControllerAndSetNullMethod> GetSubControllers()
        {
            yield return(new ControllerAndSetNullMethod(_scaleController, () => _scaleController = null));

            yield return(new ControllerAndSetNullMethod(_rescalingController, () => _rescalingController = null));

            yield return(new ControllerAndSetNullMethod(_tickSpacingController, () => _tickSpacingController = null));

            yield return(new ControllerAndSetNullMethod(_linkedScaleParameterController, () => _linkedScaleParameterController = null));
        }
    public NonlinearFitController(NonlinearFitDocument doc)
    {
      _doc = doc;
      _parameterController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _doc.CurrentParameters }, typeof(IMVCAController));
      _fitEnsembleController = (IFitEnsembleController)Current.Gui.GetControllerAndControl(new object[] { _doc.FitEnsemble }, typeof(IFitEnsembleController));

      _funcselController = new FitFunctionSelectionController(_doc.FitEnsemble.Count == 0 ? null : _doc.FitEnsemble[0].FitFunction);
      Current.Gui.FindAndAttachControlTo(_funcselController);

      _doc.FitEnsemble.Changed += new EventHandler(EhFitEnsemble_Changed);
    }
Exemple #15
0
        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;
            }
        }
        void SetInterpolationDetailController(IMVCAController ctrl)
        {
            IMVCAController oldController = this._interpolationDetailController;

            this._interpolationDetailController = ctrl;

            if (_view != null)
            {
                _view.SetDetailControl(ctrl == null ? null : ctrl.ViewObject);
            }
        }
Exemple #17
0
 private void DetachController(IMVCAController ctrl)
 {
     if (ctrl is IMVCANDController)
     {
         (ctrl as IMVCANDController).MadeDirty -= EhMadeDirty;
         if (ctrl is IDisposable)
         {
             ctrl.Dispose();
         }
     }
 }
 public void InitScaleController(bool initData)
 {
     if (initData)
     {
         _scaleController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { ScaleToEdit }, typeof(IMVCAController), UseDocument.Directly);
     }
     if (null != _view)
     {
         _view.SetScaleView(null == _scaleController ? null : _scaleController.ViewObject);
     }
 }
Exemple #19
0
 private Property GetPropertyForController(IMVCAController ctrl)
 {
     foreach (var entry in _controllerList.Values)
     {
         if (object.ReferenceEquals(ctrl, entry.Value))
         {
             return(entry.Key);
         }
     }
     return(null);
 }
        private void EhInitializationFinished(object sender, EventArgs e)
        {
            ControlViewElement[] childs = new ControlViewElement[_doc.Count];
            for (int i = 0; i < childs.Length; i++)
            {
                IMVCAController ctrl = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _doc[i] }, typeof(IParameterSetElementController));
                childs[i] = new ControlViewElement(null, ctrl, ctrl.ViewObject);
            }

            base.Initialize(childs, false);
        }
        public NonlinearFitController(NonlinearFitDocument doc)
        {
            _doc = doc;
            _parameterController   = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _doc.CurrentParameters }, typeof(IMVCAController));
            _fitEnsembleController = (IFitEnsembleController)Current.Gui.GetControllerAndControl(new object[] { _doc.FitEnsemble }, typeof(IFitEnsembleController));

            _funcselController = new FitFunctionSelectionController(_doc.FitEnsemble.Count == 0 ? null : _doc.FitEnsemble[0].FitFunction);
            Current.Gui.FindAndAttachControlTo(_funcselController);

            _doc.FitEnsemble.Changed += new EventHandler(EhFitEnsemble_Changed);
        }
Exemple #22
0
 public void InitScaleController(bool bInit)
 {
     if (bInit)
     {
         object scaleObject = _doc;
         _scaleController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { scaleObject }, typeof(IMVCAController), UseDocument.Directly);
     }
     if (null != _view)
     {
         _view.SetScaleView(null == _scaleController ? null : _scaleController.ViewObject);
     }
 }
Exemple #23
0
 public void SetScaleController(bool bInit)
 {
     if (bInit)
     {
         object scaleObject = _tempAxis;
         m_ScaleController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { scaleObject }, typeof(IMVCAController));
     }
     if (null != View)
     {
         View.SetScaleView(null == m_ScaleController ? null : m_ScaleController.ViewObject);
     }
 }
Exemple #24
0
        private void EhShowAxisLineChanged()
        {
            var oldValue = _doc.IsAxisLineEnabled;

            if (_view.ShowAxisLine && null == _doc.AxisLineStyle)
            {
                _doc.ShowAxisLine(_context);
                _axisLineStyleController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _doc.AxisLineStyle }, typeof(IMVCAController), UseDocument.Directly);
                _view.LineStyleView      = _axisLineStyleController.ViewObject;
            }
            if (oldValue != _doc.IsAxisLineEnabled)
            {
                OnMadeDirty();
            }
        }
        protected override void Initialize(bool initData)
        {
            base.Initialize(initData);

            if (initData)
            {
                // look for coordinate system types
                if (null == _cosSubTypes)
                {
                    _cosSubTypes = ReflectionService.GetNonAbstractSubclassesOf(typeof(G3DCoordinateSystem));
                }

                if (null == _choiceList)
                {
                    _choiceList = new SelectableListNodeList();
                }
                _choiceList.Clear();
                foreach (Type t in _cosSubTypes)
                {
                    _choiceList.Add(new SelectableListNode(Current.Gui.GetUserFriendlyClassName(t), t, t == _doc.GetType()));
                }
            }

            if (_view != null)
            {
                // look for a controller-control
                _view.TypeLabel = "Type:";
                _view.InitializeTypeNames(_choiceList);

                // To avoid looping when a dedicated controller is unavailable, we first instantiate the controller alone and compare the types
                _instanceController = (IMVCAController)Current.Gui.GetController(new object[] { _doc }, typeof(IMVCAController), UseDocument.Directly);
                if (_instanceController != null && (_instanceController.GetType() != GetType()))
                {
                    Current.Gui.FindAndAttachControlTo(_instanceController);
                    if (_instanceController.ViewObject != null)
                    {
                        _view.SetInstanceControl(_instanceController.ViewObject);
                    }
                }
                else
                {
                    _instanceController = null;
                    _view.SetInstanceControl(null);
                }
            }
        }
 public void InitTickSpacingController(bool bInit)
 {
     if (bInit)
     {
         if (_doc != null)
         {
             _tickSpacingController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _doc }, typeof(IMVCAController), UseDocument.Directly);
         }
         else
         {
             _tickSpacingController = null;
         }
     }
     if (null != _view)
     {
         _view.SetTickSpacingView(null != _tickSpacingController ? _tickSpacingController.ViewObject : null);
     }
 }
Exemple #27
0
        void Initialize(bool bInit)
        {
            if (bInit)
            {
                _grid1 = new XYGridStyleController(_doc.GridStyleFirst);
                Current.Gui.FindAndAttachControlTo(_grid1);
                ControlViewElement c1 = new ControlViewElement("Grid1", _grid1, _grid1.ViewObject);

                _grid2 = new XYGridStyleController(_doc.GridStyleSecond);
                Current.Gui.FindAndAttachControlTo(_grid2);
                ControlViewElement c2 = new ControlViewElement("Grid2", _grid2, _grid2.ViewObject);

                _background = new BrushControllerSimple(_doc.Background);
                Current.Gui.FindAndAttachControlTo(_background);
                ControlViewElement c3 = new ControlViewElement("Background", _background, _background.ViewObject);

                base.Initialize(new ControlViewElement[] { c1, c2, c3 }, false);
            }
        }
        public void InitRescalingController(bool bInit)
        {
            if (bInit)
            {
                if (null != ScaleToEdit.RescalingObject && null == ScaleLinkedTo)
                {
                    _rescalingController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { ScaleToEdit.RescalingObject, ScaleToEdit }, typeof(IMVCAController), UseDocument.Directly);
                }
                else
                {
                    DisposeAndSetToNull(ref _rescalingController);
                }
            }

            if (null != _view)
            {
                _view.SetRescalingView(null != _rescalingController ? _rescalingController.ViewObject : null);
            }
        }
Exemple #29
0
        /// <summary>
        /// Shows a configuration dialog for an object.
        /// </summary>
        /// <param name="args">Hierarchy of objects. Args[0] contain the object for which the configuration dialog is searched.
        /// args[1].. can contain the parents of this object (in most cases this is not necessary.
        /// If the return value is true, args[0] contains the configured object. </param>
        /// <param name="title">The title of the dialog to show.</param>
        /// <param name="showApplyButton">If true, the apply button is shown also.</param>
        /// <returns>True if the object was successfully configured, false otherwise.</returns>
        /// <remarks>The presumtions to get this function working are:
        /// <list>
        /// <item>A controller which implements <see cref="IMVCAController" /> has to exist.</item>
        /// <item>A <see cref="UserControllerForObjectAttribute" /> has to be assigned to that controller, and the argument has to be the type of the object you want to configure.</item>
        /// <item>A GUI control (Windows Forms: UserControl) must exist, to which an <see cref="UserControlForControllerAttribute" /> is assigned to, and the argument of that attribute has to be the type of the controller.</item>
        /// </list>
        /// </remarks>
        public bool ShowDialog(object[] args, string title, bool showApplyButton)
        {
            IMVCAController controller = (IMVCAController)Current.Gui.GetControllerAndControl(args, typeof(IMVCAController));

            if (null == controller)
            {
                return(false);
            }

            if (ShowDialog(controller, title, showApplyButton))
            {
                args[0] = controller.ModelObject;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #30
0
 public void InitRescalingController(bool bInit)
 {
     if (bInit)
     {
         object rescalingObject = _doc.RescalingObject;
         if (rescalingObject != null)
         {
             _rescalingController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { rescalingObject, _doc }, typeof(IMVCAController), UseDocument.Directly);
         }
         else
         {
             _rescalingController = null;
         }
     }
     if (null != _view)
     {
         _view.SetRescalingView(null != _rescalingController ? _rescalingController.ViewObject : null);
     }
 }
Exemple #31
0
 public void SetBoundaryController(bool bInit)
 {
     if (bInit)
     {
         object rescalingObject = _tempAxis.RescalingObject;
         if (rescalingObject != null)
         {
             m_BoundaryController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { rescalingObject, _tempAxis }, typeof(IMVCAController));
         }
         else
         {
             m_BoundaryController = null;
         }
     }
     if (null != View)
     {
         View.SetBoundaryView(null != m_BoundaryController ? m_BoundaryController.ViewObject : null);
     }
 }
    void Initialize(bool bInit)
    {
      if(bInit)
      {
      _grid1 = new XYGridStyleController(_doc.GridStyleFirst);
      Current.Gui.FindAndAttachControlTo(_grid1);
      ControlViewElement c1 = new ControlViewElement("Grid1", _grid1, _grid1.ViewObject);

      _grid2 = new XYGridStyleController(_doc.GridStyleSecond);
      Current.Gui.FindAndAttachControlTo(_grid2);
      ControlViewElement c2 = new ControlViewElement("Grid2", _grid2, _grid2.ViewObject);

      _background = new BrushControllerSimple(_doc.Background);
      Current.Gui.FindAndAttachControlTo(_background);
      ControlViewElement c3 = new ControlViewElement("Background", _background, _background.ViewObject);
      
        base.Initialize(new ControlViewElement[] { c1, c2, c3 }, false);
      }
    }
Exemple #33
0
        public override bool Apply(bool disposeController)
        {
            bool result = false;

            var node = _tabItemList.FirstSelectedNode;

            _currentlySelectedController = node == null ? null : node.Tag as IMVCAController;

            if (null != _currentlySelectedController)
            {
                result = _currentlySelectedController.Apply(disposeController);
            }

            if (result)
            {
                if (_currentlySelectedController == _entireTableQueryController)
                {
                    SelectionStatement = _entireTableQueryController.SelectionStatement;
                }
                else if (_currentlySelectedController == _queryDesignerController)
                {
                    SelectionStatement = _queryDesignerController.SelectionStatement;
                }
                else if (_currentlySelectedController == _arbitrarySqlQueryController)
                {
                    SelectionStatement = _arbitrarySqlQueryController.SelectionStatement;
                }
            }
            else
            {
                return(false);
            }

            if (_connectionStringValidIndicator.IsConnectionStringValid)
            {
                InsertConnectionStringAtBeginningOfList(_staticConnectionStringList, ConnectionString);
            }

            bool isValid = null != _doc.ConnectionString && !_doc.ConnectionString.IsEmpty && !string.IsNullOrEmpty(_doc.SelectionStatement);

            return(ApplyEnd(isValid, disposeController));
        }
    void Initialize(bool initDoc)
    {
      if (initDoc)
      {
        // try to find a controller for the underlying function
        _functionController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _doc.Function }, typeof(IMVCAController), UseDocument.Directly);
      }
      if (_view != null)
      {
        bool editable = null != _functionController;
        string text;
        if (_doc.Function is Altaxo.Scripting.IScriptText)
          text = ((Altaxo.Scripting.IScriptText)_doc.Function).ScriptText;
        else
          text = _doc.Function.ToString();
      
        _view.InitializeFunctionText(text,editable);

      }

    }
    /// <summary>
    /// Shows a configuration dialog for an object.
    /// </summary>
    /// <param name="controller">The controller to show in the dialog</param>
    /// <param name="title">The title of the dialog to show.</param>
    /// <param name="showApplyButton">If true, the "Apply" button is visible on the dialog.</param>
    /// <returns>True if the object was successfully configured, false otherwise.</returns>
    public override bool ShowDialog(IMVCAController controller, string title, bool showApplyButton)
    {

      if (controller.ViewObject == null)
      {
        FindAndAttachControlTo(controller);
      }

      if (controller.ViewObject == null)
        throw new ArgumentException("Can't find a view object for controller of type " + controller.GetType());

      if (controller is Altaxo.Gui.Scripting.IScriptController)
      {
        System.Windows.Forms.Form dlgctrl = new Altaxo.Gui.Scripting.ScriptExecutionDialogWin((Altaxo.Gui.Scripting.IScriptController)controller);
        return (System.Windows.Forms.DialogResult.OK == dlgctrl.ShowDialog(MainWindow));
      }
      else
      {
        DialogShellView dlgview = new DialogShellView((System.Windows.Forms.UserControl)controller.ViewObject);
        DialogShellController dlgctrl = new DialogShellController(dlgview, controller, title, showApplyButton);
        return DialogResult.OK == dlgview.ShowDialog(MainWindow);
      }
    }
    public void SetElements(bool bInit)
    {
      System.Collections.ArrayList arr = new System.Collections.ArrayList();

      if (bInit)
      {
        if (_doc.AxisLineStyle != null)
          _axisLineStyleController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _doc.AxisLineStyle }, typeof(IMVCAController), UseDocument.Directly);
        else
        {
          _axisLineStyleController = null;
        }

      }

      if (m_View != null)
      {
        m_View.AxisTitle = _doc.TitleText;
        m_View.ShowAxisLine = _doc.ShowAxisLine;
        m_View.ShowMajorLabels = _doc.ShowMajorLabels;
        m_View.ShowMinorLabels = _doc.ShowMinorLabels;
        m_View.LineStyleView = _axisLineStyleController == null ? null : _axisLineStyleController.ViewObject;
      }
    }
Exemple #37
0
		public void Initialize(IMVCAController[] childs, bool horizontalLayout)
		{
			_childController = new ControlViewElement[childs.Length];
			for (int i = 0; i < childs.Length; i++)
			{
				_childController[i] = new ControlViewElement(string.Empty, childs[i]);
			}
			_horizontalLayout = horizontalLayout;
			Initialize();
		}
Exemple #38
0
		public MultiChildController(IMVCAController[] childs)
		{
			Initialize(childs, false);
		}
Exemple #39
0
		public MultiChildController(IMVCAController[] childs, bool horizontalLayout)
		{
			Initialize(childs, horizontalLayout);
		}
    void InitializePlotGroupView()
    {
      bool bStandard = true;
      bool bSerial = false;
      bool color = false;
      bool linestyle = false;
      bool symbol = false;

      if (_groupStyles != null)
      {
        color = _groupStyles.ContainsType(typeof(ColorGroupStyle));
        linestyle = _groupStyles.ContainsType(typeof(LineStyleGroupStyle));
        symbol = _groupStyles.ContainsType(typeof(SymbolShapeStyleGroupStyle));

        if (_groupStyles.Count != (color ? 1 : 0) + (linestyle ? 1 : 0) + (symbol ? 1 : 0))
          bStandard = false;

        if(color && linestyle && typeof(LineStyleGroupStyle)==_groupStyles.GetChildTypeOf(typeof(ColorGroupStyle)))
        {
          bSerial = true;
        }
        if((linestyle && symbol) && typeof(SymbolShapeStyleGroupStyle)==_groupStyles.GetChildTypeOf(typeof(LineStyleGroupStyle)))
        {
          if (color && !bSerial)
            bStandard = false;
          else
            bSerial = true;
        }

        if (color && !((ColorGroupStyle)_groupStyles.GetPlotGroupStyle(typeof(ColorGroupStyle))).IsStepEnabled)
          bStandard = false;
        if (linestyle && !((LineStyleGroupStyle)_groupStyles.GetPlotGroupStyle(typeof(LineStyleGroupStyle))).IsStepEnabled)
          bStandard = false;
        if (symbol && !((SymbolShapeStyleGroupStyle)_groupStyles.GetPlotGroupStyle(typeof(SymbolShapeStyleGroupStyle))).IsStepEnabled)
          bStandard = false;
        if (_groupStyles.CoordinateTransformingStyle != null)
          bStandard = false;
      }

      if (bStandard && _groupStyles!=null)
      {
        _plotGroupView = (IXYPlotGroupView)Current.Gui.FindAndAttachControlTo(this, typeof(IXYPlotGroupView));
        _plotGroupView.InitializePlotGroupConditions(
            color,
            linestyle,
            symbol,
            !bSerial, //_parentPlotGroup.ChangeStylesConcurrently,
            PlotGroupStrictness.Normal //_parentPlotGroup.ChangeStylesStrictly
            );
        _plotGroupView.AdvancedPlotGroupControl += EhAdvancedPlotGroupControlRequired;
      }
      else if (_groupStyles != null)
      {
        _plotGroupController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _groupStyles }, typeof(IMVCAController));
      }
    }
Exemple #41
0
		public ControllerAndSetNullMethod(IMVCAController doc, Action setMemberToNullAction)
		{
			_doc = doc;
			_setMemberToNullAction = setMemberToNullAction;
		}
 public void SetBoundaryController(bool bInit)
 {
   if(bInit)
   {
     object rescalingObject = _tempAxis.RescalingObject;
     if (rescalingObject != null)
       m_BoundaryController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { rescalingObject, _tempAxis }, typeof(IMVCAController));
     else
       m_BoundaryController = null;
   }
   if(null!=View)
   {
     View.SetBoundaryView(null!=m_BoundaryController ? m_BoundaryController.ViewObject : null);
   }
 }
    void SetInterpolationDetailController(IMVCAController ctrl)
    {
      IMVCAController oldController = this._interpolationDetailController;
      this._interpolationDetailController = ctrl;

      if(_view!=null)
      {
        _view.SetDetailControl(ctrl==null ? null : ctrl.ViewObject);
      }

    }
 public ControlViewElement(string title, IMVCAController controller)
   : base(title,controller.ViewObject)
 {
   this.Controller = controller;
 }
    void EhAdvancedPlotGroupControlRequired(object sender, EventArgs e)
    {
      _plotGroupView.AdvancedPlotGroupControl -= EhAdvancedPlotGroupControlRequired;
      ApplyPlotGroupView();
      _plotGroupView = null;
      if (_groupStyles != null)
      {
        _plotGroupController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _groupStyles }, typeof(IMVCAController));
        // remove the tabs 1.., leaving only the style and data tab
        if (_dataController == null)
          RemoveTabRange(0, TabCount);
        else
          RemoveTabRange(1, TabCount - 1);

        AddTab("Grouping", _plotGroupController, _plotGroupController.ViewObject);
        AddTab("Styles", _styleCollectionController, _styleCollectionController.ViewObject);

        InitializeStyles();

        BringTabToFront(_dataController == null ? 0 : 1);
      }
    }
 private void EhShowAxisLineChanged(object sender, EventArgs e)
 {
   if (m_View.ShowAxisLine && null==_doc.AxisLineStyle)
   {
     _doc.ShowAxisLine = true;
     this._axisLineStyleController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _doc.AxisLineStyle }, typeof(IMVCAController));
     m_View.LineStyleView = _axisLineStyleController.ViewObject;
   }
 }
    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;

      }
    }
		/// <summary>
		/// Shows a configuration dialog for an object.
		/// </summary>
		/// <param name="controller">The controller to show in the dialog</param>
		/// <param name="title">The title of the dialog to show.</param>
		/// <param name="showApplyButton">If true, the "Apply" button is visible on the dialog.</param>
		/// <returns>True if the object was successfully configured, false otherwise.</returns>
		public override bool ShowDialog(IMVCAController controller, string title, bool showApplyButton)
		{
			return Evaluate(InternalShowDialog, controller, title, showApplyButton);
		}
 public void SetScaleController(bool bInit)
 {
   if (bInit)
   {
     object scaleObject = _tempAxis;
     m_ScaleController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { scaleObject }, typeof(IMVCAController));
   }
   if (null != View)
   {
     View.SetScaleView(null==m_ScaleController ? null : m_ScaleController.ViewObject);
   }
 }
		/// <summary>
		/// Shows a configuration dialog for an object.
		/// </summary>
		/// <param name="controller">The controller to show in the dialog</param>
		/// <param name="title">The title of the dialog to show.</param>
		/// <param name="showApplyButton">If true, the "Apply" button is visible on the dialog.</param>
		/// <returns>True if the object was successfully configured, false otherwise.</returns>
		private bool InternalShowDialog(IMVCAController controller, string title, bool showApplyButton)
		{
			if (controller.ViewObject == null)
			{
				FindAndAttachControlTo(controller);
			}

			if (controller.ViewObject == null)
				throw new ArgumentException("Can't find a view object for controller of type " + controller.GetType());

			if (controller is Altaxo.Gui.Scripting.IScriptController)
			{
				var dlgctrl = new Altaxo.Gui.Scripting.ScriptExecutionDialog((Altaxo.Gui.Scripting.IScriptController)controller);
				dlgctrl.Owner = TopmostModalWindow;
				dlgctrl.WindowStartupLocation = System.Windows.WindowStartupLocation.Manual;
				dlgctrl.Top = TopmostModalWindow.Top;
				dlgctrl.Left = TopmostModalWindow.Left;
				return (true == InternalShowModalWindow(dlgctrl));
			}
			else if (controller.ViewObject is System.Windows.UIElement)
			{
				var dlgview = new DialogShellViewWpf((System.Windows.UIElement)controller.ViewObject);
				dlgview.Owner = TopmostModalWindow;
				dlgview.WindowStartupLocation = System.Windows.WindowStartupLocation.Manual;
				dlgview.Top = TopmostModalWindow.Top;
				dlgview.Left = TopmostModalWindow.Left;

				var dlgctrl = new DialogShellController(dlgview, controller, title, showApplyButton);
				return true == InternalShowModalWindow(dlgview);
			}
			else
			{
				throw new NotSupportedException("This type of UIElement is not supported: " + controller.ViewObject.GetType().ToString());
				/*
				DialogShellView dlgview = new DialogShellView((System.Windows.Forms.UserControl)controller.ViewObject);
				DialogShellController dlgctrl = new DialogShellController(dlgview, controller, title, showApplyButton);
				return System.Windows.Forms.DialogResult.OK == dlgview.ShowDialog(MainWindow);
				*/
			}
		}
 /// <summary>
 /// Shows a configuration dialog for an object (without "Apply" button).
 /// </summary>
 /// <param name="controller">The controller to show in the dialog</param>
 /// <param name="title">The title of the dialog to show.</param>
 /// <returns>True if the object was successfully configured, false otherwise.</returns>
 public bool ShowDialog(IMVCAController controller, string title)
 {
   return ShowDialog(controller, title, false);
 }
    void InitializeCollectionAndData()
    {
      _dataController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _tempdoc.DataObject, _tempdoc }, typeof(IMVCAController));
      if (_dataController != null)
        AddTab("Data", _dataController, _dataController.ViewObject);



      InitializePlotGroupView();

      if (_plotGroupController != null)
      {
        AddTab("Grouping", _plotGroupController, _plotGroupController.ViewObject);
      }


      _styleCollectionController = (IXYPlotStyleCollectionController)Current.Gui.GetControllerAndControl(new object[] { _tempdoc.Style }, typeof(IXYPlotStyleCollectionController));
      AddTab("Styles", _styleCollectionController, _styleCollectionController.ViewObject);
      _styleCollectionController.CollectionChangeCommit += new EventHandler(_styleCollectionController_CollectionChangeCommit);
    }