コード例 #1
0
        private static void ApplyTextLayer(ref string text, ITextLayer layer)
        {
            if (layer == null)
            {
                return;
            }

            text = layer.GetText();
        }
コード例 #2
0
        //@Static
        /// <summary>
        /// Copy a font-layer with self.
        /// </summary>
        /// <param name="source"> The source ITextLayer. </param>
        /// <param name="destination"> The destination ITextLayer. </param>
        public static void FontCopyWith(ITextLayer destination, ITextLayer source)
        {
            destination.FontText   = source.FontText;
            destination.FontSize   = source.FontSize;
            destination.FontFamily = source.FontFamily;

            destination.FontAlignment = source.FontAlignment;
            destination.FontStyle     = source.FontStyle;
            destination.FontWeight    = source.FontWeight;
        }
コード例 #3
0
        //@Static
        /// <summary>
        /// Copy a font-layer with self.
        /// </summary>
        /// <param name="source"> The source <see cref="ITextLayer"/>. </param>
        /// <param name="destination"> The destination <see cref="ITextLayer"/>. </param>
        public static ITextLayer FontCopyWith(ITextLayer source, ITextLayer destination)
        {
            destination.FontText   = source.FontText;
            destination.FontSize   = source.FontSize;
            destination.FontFamily = source.FontFamily;

            destination.HorizontalAlignment = source.HorizontalAlignment;
            destination.Direction           = source.Direction;

            destination.Underline  = source.Underline;
            destination.FontStyle  = source.FontStyle;
            destination.FontWeight = source.FontWeight;

            return(destination);
        }
コード例 #4
0
        /// <summary>
        /// Change T type for ITextLayer, save history, invalidate canvas.
        /// </summary>
        /// <typeparam name="T"> The T type property. </typeparam>
        /// <param name="set"> The sets of T. </param>
        /// <param name="historyTitle"> The history title. </param>
        /// <param name="getHistory"> The gets of history T. </param>
        /// <param name="setHistory"> The sets of history T. </param>
        public void ITextLayerChanged <T>
        (
            Action <ITextLayer> set,
            string historyTitle, Func <ITextLayer, T> getHistory, Action <ITextLayer, T> setHistory
        )
        {
            //History
            LayersPropertyHistory history = new LayersPropertyHistory(historyTitle);

            //Selection
            this.SetValue((layerage) =>
            {
                ILayer layer = layerage.Self;

                if (layer.Type.IsText())
                {
                    ITextLayer textLayer = (ITextLayer)layer;

                    var previous        = getHistory(textLayer);
                    history.UndoAction += () =>
                    {
                        //Refactoring
                        layer.IsRefactoringRender     = true;
                        layer.IsRefactoringIconRender = true;
                        setHistory(textLayer, previous);
                    };

                    //Refactoring
                    layer.IsRefactoringRender     = true;
                    layer.IsRefactoringIconRender = true;
                    layerage.RefactoringParentsRender();
                    layerage.RefactoringParentsIconRender();
                    set(textLayer);
                }
            });

            //History
            this.HistoryPush(history);

            this.Invalidate();//Invalidate
        }