Example #1
0
        public WordGlyph InsertNewWordGlyph(Word word)
        {
            var wordGlyph = new WordGlyph(word)
            {
                Config = ParentVectorRedactor.WordConfig
            };

            InsertChild(wordGlyph);
            return(wordGlyph);
        }
Example #2
0
 public void InsertChild(WordGlyph glyph)
 {
     glyph.Parent               = this;
     glyph.MainGlyph            = MainGlyph;
     glyph.Redactor             = Redactor;
     glyph.ParentVectorRedactor = ParentVectorRedactor;
     Childs.Add(glyph);
     if (!Line.Words.Contains(glyph.Word))
     {
         Line.AddWord(glyph.Word);
     }
     ParentVectorRedactor.Layout.AddFigure(glyph.Figure);
 }
Example #3
0
        /// <summary>
        /// Завершает добавление нового слова
        /// </summary>
        private void CompleteCreatingWord()
        {
            var figure = Figure as UnclosedPathFigure;

            if (figure == null)
            {
                throw new ArgumentNullException();
            }

            GraphicsPath path = figure.GeneratePath();

            var word = new Word();

            if (ParentVectorRedactor.Mode == RedactorModes.AddPolygon)
            {
                word = Redactor.Word;
            }

            var polygon = new Polygon();

            polygon.LoadPointList(figure.Points);
            word.AddPolygon(polygon);


            var number = 1;

            if (Redactor.Line.Words.Count > 0)
            {
                number = (from dbWord in Redactor.Line.Words orderby dbWord.Number descending select dbWord.Number).ToList()[0] + 1;
            }
            word.Number = number;

            if (ParentVectorRedactor.Mode == RedactorModes.AddPolygon)
            {
                Redactor.Line.AddWord(word);
            }

            var wordGlyph = new WordGlyph(word)
            {
                Figure = new SolidFigure(path), Config = ParentVectorRedactor.WordConfig
            };

            if (!Redactor.Line.Words.Contains(word))
            {
                Redactor.Line.AddWord(word);
            }

            Parent.InsertChild(wordGlyph);

            ParentVectorRedactor.ActiveGlyph = wordGlyph;
        }
Example #4
0
File: Glyphs.cs Project: ernado/Owl
        /// <summary>
        /// Завершает добавление нового слова
        /// </summary>
        private void CompleteCreatingWord()
        {
            var figure = Figure as UnclosedPathFigure;

            if (figure == null)
                throw new ArgumentNullException();

            GraphicsPath path = figure.GeneratePath();

            var word = new Word();
            if (ParentVectorRedactor.Mode == RedactorModes.AddPolygon)
                word = Redactor.Word;

            var polygon = new Polygon();
            polygon.LoadPointList(figure.Points);
            word.AddPolygon(polygon);

            var number = 1;
            if (Redactor.Line.Words.Count > 0)
                number = (from dbWord in Redactor.Line.Words orderby dbWord.Number descending select dbWord.Number).ToList()[0] + 1;
            word.Number = number;

            if (ParentVectorRedactor.Mode == RedactorModes.AddPolygon)
                Redactor.Line.AddWord(word);

            var wordGlyph = new WordGlyph(word)
                                {Figure = new SolidFigure(path), Config = ParentVectorRedactor.WordConfig};

            if (!Redactor.Line.Words.Contains(word))
            {
                Redactor.Line.AddWord(word);
            }

            Parent.InsertChild(wordGlyph);

            ParentVectorRedactor.ActiveGlyph = wordGlyph;
        }
Example #5
0
File: Glyphs.cs Project: ernado/Owl
 public WordGlyph InsertNewWordGlyph(Word word)
 {
     var wordGlyph = new WordGlyph(word) {Config = ParentVectorRedactor.WordConfig};
     InsertChild(wordGlyph);
     return wordGlyph;
 }
Example #6
0
File: Glyphs.cs Project: ernado/Owl
 public void InsertChild(WordGlyph glyph)
 {
     glyph.Parent = this;
     glyph.MainGlyph = MainGlyph;
     glyph.Redactor = Redactor;
     glyph.ParentVectorRedactor = ParentVectorRedactor;
     Childs.Add(glyph);
     if (!Line.Words.Contains(glyph.Word))
         Line.AddWord(glyph.Word);
     ParentVectorRedactor.Layout.AddFigure(glyph.Figure);
 }