Пример #1
0
        public GlobalDetailsDefinitor(EntityEditEngine EditEngine, IdeaDefinition DefinitorSource, DetailDesignator InitialDesignatorToEdit = null)
            : this()
        {
            this.DefinitorSource = DefinitorSource;
            this.VisualGlobalDetailDefsSource = DetailDefinitionCard.GenerateGlobalDetailsForDefinitor(this.DefinitorSource);

            this.GlobalDetailDefsMaintainer.SetDetailDefinitionsSource(EditEngine, this.DefinitorSource, this.VisualGlobalDetailDefsSource,
                                                                       true, InitialDesignatorToEdit);
        }
Пример #2
0
        CreateMarker(EntityEditEngine Engine, MarkerDefinition Definitor, View TargetView, VisualRepresentation TargetRepresentator = null)
        {
            General.ContractRequiresNotNull(Engine, Definitor, TargetView);

            Engine.StartCommandVariation("Create Marker");

            var NewMarker = CreateMarkerAssignment(Engine, Definitor);

            if (NewMarker != null)
            {
                var RedisplayView = false;

                if (!TargetView.ShowMarkers)

                /* if (Display.DialogMessage("Attention", "View is not currently showing Markers.\nDo you want to show them?",
                 *                        EMessageType.Question, MessageBoxButton.YesNo, MessageBoxResult.Yes) == MessageBoxResult.Yes) */
                {
                    TargetView.ShowMarkers = true;
                    RedisplayView          = true;
                }

                if (TargetRepresentator == null)
                {
                    foreach (var Representator in TargetView.SelectedRepresentations)
                    {
                        Representator.RepresentedIdea.Markings.Add(NewMarker);
                        if (!RedisplayView)
                        {
                            Representator.Render();
                        }
                    }
                }
                else
                {
                    TargetRepresentator.RepresentedIdea.Markings.Add(NewMarker);
                    if (!RedisplayView)
                    {
                        TargetRepresentator.Render();
                    }
                }

                if (RedisplayView)
                {
                    TargetView.ShowAll();
                }
            }

            if (TargetRepresentator != null)
            {
                TargetRepresentator.RepresentedIdea.UpdateVersion();
            }

            Engine.CompleteCommandVariation();

            return(OperationResult.Success(NewMarker));
        }
Пример #3
0
        // ---------------------------------------------------------------------------------------------------------------------------------------------------------
        public static MarkerAssignment CreateMarkerAssignment(EntityEditEngine Engine, MarkerDefinition Definitor)
        {
            var Result = new MarkerAssignment(Engine, Definitor);

            var EditOnCreationConfigured = AppExec.GetConfiguration <bool>("IdeaEditing", "MarkerEditing.EditOnCreation", false);
            var EditOnCreationExplicit   = (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl));

            if (EditOnCreationConfigured || EditOnCreationExplicit)
            {
                if (!EditMarkerAssignmentDescriptor(Engine, Result))
                {
                    return(null);
                }
            }

            return(Result);
        }
Пример #4
0
        public void SetDetailDefinitionsSource(EntityEditEngine EditEngine, IdeaDefinition SourceDefinitor, IList <DetailDefinitionCard> Source,
                                               bool IsGlobal, DetailDesignator InitialDesignatorToEdit = null)
        {
            this.SourceDefinitor         = SourceDefinitor;
            this.SourceEngine            = EditEngine;
            this.DetailsSource           = Source;
            this.DetailsSourceIsGlobal   = IsGlobal;
            this.InitialDesignatorToEdit = InitialDesignatorToEdit;

            this.DetailsListBox.ItemsSource     = Source;
            this.DetailsToolPanel.TargetListBox = this.DetailsListBox;

            // Notice that selection is made (see applied style), but focus highlight is only applied when it happens.
            if (this.DetailsSource.Count > 0)
            {
                this.DetailsListBox.SelectedIndex = 0;
            }
        }
        public void Initialize(EntityEditEngine Engine, string SourceName, string SourcePropertyTechName, string TextTitle,
                               Func <string> Reader, Action <string> Writer, bool ShowWindowButtons = false,
                               params Tuple <string, ImageSource, string, Action <string> >[] ExtraButtons)
        {
            this.SourcePropertyTechName = SourcePropertyTechName;

            this.Reader = Reader;
            this.Writer = Writer;

            this.Engine       = Engine;
            this.ExtraButtons = ExtraButtons;

            this.TextEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("TcTemplate");    // "C#");
            this.TextEditor.ShowLineNumbers    = true;

            // Bad idea: this.TextEditor.LostFocus += ((sender, args) => this.WriteTextToSource());

            this.TextEditor.TextArea.MouseRightButtonDown +=
                ((sender, args) =>
            {
                var position = this.TextEditor.GetPositionFromPoint(args.GetPosition(this.TextEditor));
                if (position.HasValue)
                {
                    this.TextEditor.TextArea.Caret.Position = position.Value;
                }
            });

            this.BtnOK.SetVisible(ShowWindowButtons);
            this.BtnCancel.SetVisible(ShowWindowButtons);

            if (this.ExtraButtons != null && this.ExtraButtons.Length > 0)
            {
                foreach (var Extra in ExtraButtons)
                {
                    var LocalExtra = Extra;
                    var NewButton  = new PaletteButton(LocalExtra.Item1, LocalExtra.Item2, Summary: LocalExtra.Item3);
                    NewButton.Click += ((sdr, args) => LocalExtra.Item4(this.TextEditor.Text));

                    this.PnlExtraButtons.Children.Add(NewButton);
                }
            }
        }
Пример #6
0
        public static bool EditMarkerAssignmentDescriptor(EntityEditEngine Engine, MarkerAssignment Target)
        {
            var Descriptor = Target.Descriptor.NullDefault(new SimplePresentationElement("", ""));
            var EditResult = ((CompositionEngine)Engine).EditSimplePresentationElement(Descriptor, "Edit '" + Target.Definitor.Name + "' marker");

            if (EditResult)
            {
                // NOTE: In the future, this should also attach the descriptor if any new editable property is populated
                if (Descriptor.AutoPopulate() || Descriptor.Pictogram != null)
                {
                    Target.Descriptor = Descriptor;
                }
                else
                {
                    Target.Descriptor = null;
                }
            }

            // Indicate applied or cancelled
            return(EditResult);
        }
Пример #7
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="EntityEditor">Edit engine constructing this Composition.</param>
        /// <param name="MainDefinitor">Main domain defining the Composition.</param>
        /// <param name="Name">Name of the Composition.</param>
        /// <param name="Tech-Name">Technical Name of the Composition.</param>
        /// <param name="Summary">Summary of the Composition.</param>
        /// <param name="Pictogram">Image representing the Composition.</param>
        public Composition(EntityEditEngine EntityEditor, Domain MainDefinitor, string Name, string TechName, string Summary = "", ImageSource Pictogram = null)
            : base(null, MainDefinitor, Name, TechName, Summary, Pictogram)
        {
            General.ContractRequiresNotNull(EntityEditor, MainDefinitor);

            this.EditEngine = EntityEditor;

            this.GlobalId = EntityEditor.GlobalId;

            this.CompositionDefinitor = MainDefinitor;
            this.ConceptDefinitor     = MainDefinitor.Assign <ConceptDefinition>();
            this.ConceptType          = EConceptType.Individual;

            this.UsedDomains = new EditableList <Domain>(__UsedDomains.TechName, this);
            this.UsedDomains.AddNew(MainDefinitor);

            this.RegisteredIdeas = new EditableList <Idea>(__RegisteredIdeas.TechName, this);

            this.Version = new VersionCard();

            // MIME-Type: "application/x-instrumind-thinkcomposer-composition"
            this.Classification = new ClassificationCard(FileDataType.FileTypeComposition.MimeType);
        }
Пример #8
0
 /// <summary>
 /// Constructor
 /// </summary>
 public MarkerAssignment(EntityEditEngine Engine, MarkerDefinition Definitor, SimplePresentationElement Descriptor = null)
 {
     this.Definitor  = Definitor;
     this.Descriptor = Descriptor;
 }
Пример #9
0
 public static GlobalDetailsDefinitor CreateGlobalDetailsDefinitor(EntityEditEngine EditEngine, IdeaDefinition DefinitorSource,
                                                                   DetailDesignator InitialDesignatorToEdit = null)
 {
     return(new GlobalDetailsDefinitor(EditEngine, DefinitorSource, InitialDesignatorToEdit));
 }