예제 #1
0
        public static void EditDefaults(GraphEditorForm form)
        {
            OptionHandler handler = CreateHandler(form);

            handler.I18nFactory = i18NFactory;
            EditorForm editorForm = editorFactory.CreateEditor(handler, true, true, true);

            editorForm.Owner = form;
            if (editorForm.ShowDialog(form) == DialogResult.OK)
            {
                CommitValuesToForm(handler, form);
            }
        }
예제 #2
0
        /// <summary>
        /// modelに対応するeditorを生成し,子に追加する.
        /// Controllerへの通知も行う.
        /// </summary>
        internal Editor InsertChild(object childModel, int index)
        {
            var containerCtrl = Controller as IContainerController;

            Contract.Requires(containerCtrl != null);
            //Require.Argument(containerCtrl.CanCreateChild(childModel), "childModel");

            var childEditor = EditorFactory.CreateEditor(childModel, Site.ControllerFactory);

            /// InsertChildEditorしてからcontainerCtrl.InsertChild()しないと
            /// PropertyChangedでcontrolからRefresh()が呼ばれて子editorが二重登録される.
            /// なので必ずInsertChildEditor(),containerCtrl.InsertChild()の順に呼ぶ.
            InsertChildEditor(childEditor, index);
            containerCtrl.InsertChild(childModel, index);

            return(childEditor);
        }
예제 #3
0
        public void RebuildChildren()
        {
            if (Figure == null || Controller == null)
            {
                return;
            }
            var container = Controller as IContainerController;

            if (container == null)
            {
                return;
            }

            /// Editorの子構造とModelの子構造を同期
            using (Figure.DirtManager.BeginDirty()) {
                /// ModelにはあるけどEditorにない子のEditorを作成
                foreach (var cChild in container.Children)
                {
                    var found = Children.Find(childEditor => childEditor.Model == cChild);
                    if (found == null)
                    {
                        var childEditor = EditorFactory.CreateEditor(cChild, Site.ControllerFactory);
                        AddChildEditor(childEditor);
                        childEditor.Enable();
                    }
                }

                /// EditorにはあるけどModelにはない子のEditorを削除
                var removeds = new List <Editor>();
                if (_structure.HasChildren)
                {
                    foreach (var childEditor in Children)
                    {
                        var found = container.Children.Find(child => childEditor.Model == child);
                        if (found == null)
                        {
                            removeds.Add(childEditor);
                            childEditor.Disable();
                        }
                    }
                }
                removeds.ForEach(e => RemoveChildEditor(e));
            }
        }
예제 #4
0
        public IEditorForm OpenEditor(string editorType) //System.Type editorType)
        {
            IEditorForm editor = null;

            if (editorType == "CamControl")
            {
                if (this.CamControl == null)
                {
                    this.CamControl                    = (ILocScaleRotEdit)EditorFactory.CreateEditor("LocScaleRotEdit");
                    this.CamControl.EditSprite         = Stage.Camera;
                    this.CamControl.AutoswitchToSprite = false;
                    this.CamControl.Disposed          += new EventHandler(editor_Disposed);
                }
                editor = this.CamControl;
            }
            else
            {
                editor           = EditorFactory.CreateEditor(editorType);
                editor.Disposed += new EventHandler(editor_Disposed);
            }

            this.ShowEditor(editor);
            return(editor);
        }