Ejemplo n.º 1
0
 public void UpdateOffsetOnNotes()
 {
     byte[] flag = NotesBrowser.getJPGFromImageControl(Properties.Resources.noteFlag);
     for (int i = ParentControl.NotesBrowser.Notes.Count - 1; i >= 0; i--)
     {
         var note = ParentControl.NotesBrowser.Notes.ElementAt(i);
         var a    = SuperTextRedactor.TestRange(note.Value.Range);
         note.Value.Range.ApplyPropertyValue(TextElement.BackgroundProperty, null);
         for (TextPointer position = note.Value.Range.Start;
              position != null && position.CompareTo(note.Value.Range.End) != 1;
              position = position.GetNextContextPosition(LogicalDirection.Forward))
         {
             InlineUIContainer element = position.Parent as InlineUIContainer;
             if (element != null && element.Child is System.Windows.Controls.Image)
             {
                 var image = element.Child as System.Windows.Controls.Image;
                 if (image == null)
                 {
                     continue;
                 }
                 var imageSourse = image.Source as System.Windows.Media.ImageSource;
                 if (imageSourse == null)
                 {
                     continue;
                 }
                 byte[] byt = NotesBrowser.getJPGFromImageControl(imageSourse);
                 //сравнивает картинки
                 if (byt.Length == flag.Length)
                 {
                     bool isflag = true;
                     for (int t = 0; t < byt.Length; t++)
                     {
                         if (byt[t] != flag[t])
                         {
                             isflag = false;
                             break;
                         }
                     }
                     if (!isflag)
                     {
                         continue;
                     }
                     element.Unloaded -= Element_Unloaded;
                     element.SiblingInlines.Remove(element);
                     break;
                 }
             }
         }
         note.Value.OffsetStart =
             ParentControl.TextBox.MainControl.Document.ContentStart.GetOffsetToPosition(note.Value.Range.Start);
         note.Value.OffsetEnd =
             ParentControl.TextBox.MainControl.Document.ContentStart.GetOffsetToPosition(note.Value.Range.End);
     }
     if (ParentControl.searchPanel != null)
     {
         ParentControl.searchPanel.ClearSearch();
     }
 }
Ejemplo n.º 2
0
        public void AddNote(TextSelection range, string name)
        {
            int    startOffset = TextBox.MainControl.Document.ContentStart.GetOffsetToPosition(range.Start); // new TextRange(TextBox.MainControl.Document.ContentStart, TextBox.MainControl.Selection.Start).Text.Length;
            int    endOffset   = TextBox.MainControl.Document.ContentStart.GetOffsetToPosition(range.End);   //new TextRange(TextBox.MainControl.Document.ContentStart, TextBox.MainControl.Selection.End).Text.Length;
            string text        = range.Text;
            var    pointer     = AddFlag(range, name);

            NotesBrowser.AddItem(new Note(name, text, new TextRange(pointer, range.End), startOffset, endOffset));
            NotesBrowser.CloseNotes(BrowseProject.LoadedFile);
        }
Ejemplo n.º 3
0
        void ButtonAddNote_MouseUp(object sender, MouseButtonEventArgs e)
        {
            var    range = TextBox.MainControl.Selection;
            string name  = NotesBrowser.GenerateName("Note");

            //   range.ApplyPropertyValue(TextElement.BackgroundProperty, Brushes.PaleGreen);


            AddNote(range, name);
            NotesBrowser.MainControl.Items.Refresh();
        }
Ejemplo n.º 4
0
 private void ProjectAndNotes()
 {
     if (ShowNotes.Visibility == Visibility.Visible)
     {
         NotesBrowser.Show();
     }
     if (ShowProject.Visibility == Visibility.Visible)
     {
         BrowseProject.Show();
     }
 }
Ejemplo n.º 5
0
 private void OnlyProject()
 {
     if (ShowNotes.Visibility == Visibility.Hidden)
     {
         NotesBrowser.Hide();
     }
     if (ShowProject.Visibility == Visibility.Visible)
     {
         BrowseProject.Show();
     }
 }
Ejemplo n.º 6
0
        private void updageTagOnFlag(Note note)
        {
            byte[] flag = NotesBrowser.getJPGFromImageControl(Properties.Resources.noteFlag);
            for (TextPointer position = note.Range.Start; position != null && position.CompareTo(note.Range.End) != 1; position = position.GetNextContextPosition(LogicalDirection.Forward))
            {
                InlineUIContainer element = position.Parent as InlineUIContainer;
                if (element != null && element.Child is System.Windows.Controls.Image)
                {
                    var image = element.Child as System.Windows.Controls.Image;
                    if (image == null)
                    {
                        continue;
                    }
                    var imageSourse = image.Source as System.Windows.Media.ImageSource;
                    if (imageSourse == null)
                    {
                        continue;
                    }
                    byte[] byt = NotesBrowser.getJPGFromImageControl(imageSourse);
                    //сравнивает картинки
                    if (byt.Length == flag.Length)
                    {
                        bool isflag = true;
                        for (int t = 0; t < byt.Length; t++)
                        {
                            if (byt[t] != flag[t])
                            {
                                isflag = false; break;
                            }
                        }
                        if (!isflag)
                        {
                            continue;
                        }

                        image.Tag = note.Name;
                    }
                }
            }
        }
Ejemplo n.º 7
0
 private void ShowNotes_MouseUp(object sender, MouseButtonEventArgs e)
 {
     NotesBrowser.Show();
 }
Ejemplo n.º 8
0
 private void HidenNotes_MouseUp(object sender, MouseButtonEventArgs e)
 {
     NotesBrowser.Hide();
 }
Ejemplo n.º 9
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.MainContainer = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.BrowseProject = ((UILayer.BrowseProject)(target));
                return;

            case 3:
                this.RedactorConteiner = ((System.Windows.Controls.Border)(target));
                return;

            case 4:
                this.MenuAddPr = ((System.Windows.Controls.MenuItem)(target));

            #line 48 "..\..\SuperTextRedactor.xaml"
                this.MenuAddPr.Click += new System.Windows.RoutedEventHandler(this.MenuAddPr_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.MenuSearch = ((System.Windows.Controls.MenuItem)(target));

            #line 49 "..\..\SuperTextRedactor.xaml"
                this.MenuSearch.Click += new System.Windows.RoutedEventHandler(this.MenuSearch_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.MenuOptions = ((System.Windows.Controls.MenuItem)(target));

            #line 51 "..\..\SuperTextRedactor.xaml"
                this.MenuOptions.Click += new System.Windows.RoutedEventHandler(this.MenuOptions_Click);

            #line default
            #line hidden
                return;

            case 7:
                this.MenuFullScr = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 8:

            #line 63 "..\..\SuperTextRedactor.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.AboutInformationOnClick);

            #line default
            #line hidden
                return;

            case 9:
                this.TextBox = ((UILayer.SuperRichTextBox)(target));
                return;

            case 10:
                this.Format = ((UILayer.FormatPanel)(target));
                return;

            case 11:
                this.ShowProject = ((System.Windows.Controls.Label)(target));

            #line 69 "..\..\SuperTextRedactor.xaml"
                this.ShowProject.MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.ShowProject_MouseUp);

            #line default
            #line hidden
                return;

            case 12:
                this.ShowNotes = ((System.Windows.Controls.Label)(target));

            #line 72 "..\..\SuperTextRedactor.xaml"
                this.ShowNotes.MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.ShowNotes_MouseUp);

            #line default
            #line hidden
                return;

            case 13:
                this.Container = ((System.Windows.Controls.Border)(target));
                return;

            case 14:
                this.NotesBrowser = ((UILayer.NotesBrowser)(target));
                return;
            }
            this._contentLoaded = true;
        }