File: highlight.h

package info (click to toggle)
bibledit-gtk 4.6-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 31,668 kB
  • ctags: 11,053
  • sloc: xml: 289,607; sql: 160,978; cpp: 86,450; sh: 3,316; makefile: 609; ansic: 398; perl: 143; python: 36
file content (78 lines) | stat: -rw-r--r-- 3,074 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
** Copyright (©) 2003-2012 Teus Benschop.
**  
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 3 of the License, or
** (at your option) any later version.
**  
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**  
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
**  
*/


#ifndef INCLUDED_HIGHLIGHT_H
#define INCLUDED_HIGHLIGHT_H


#include "libraries.h"
#include <glib.h>
#include <gtk/gtk.h>
#include "editor_aids.h"
#include "htmlwriter2.h"


class Highlight
{
public:
  Highlight (GtkTextBuffer * buffer, 
             GtkWidget * textview, 
             const ustring& project, 
             GtkTextTag * tag,
             const ustring& verse);
  ~Highlight ();
  void determine_locations ();
  bool locations_ready;
  void highlight ();
private:
  bool interrupt_thread;
  GtkTextTag * mytag;
  GtkTextBuffer * maintextbuffer;
  GtkTextView * maintextview;
  gint main_start_offset;
  gint main_end_offset;
  vector <gint> highlightwordstarts;
  vector <gint> highlightwordends;
  vector <GtkTextBuffer *> highlightbuffers;
  vector <GtkTextView *> highlightviews;
  void searchwords (GtkTextBuffer * textbuffer, GtkTextView * textview, gint startoffset, gint endoffset);
  void searchwords_find_fast (GtkTextBuffer * textbuffer, 
                              GtkTextIter * beginbound, GtkTextIter * endbound,
                              const ustring & searchword, bool casesensitive,
                              vector <GtkTextIter>& wordstart, vector<GtkTextIter>& wordend);
  void searchwords_find_slow (GtkTextBuffer * textbuffer, 
                              GtkTextIter * beginbound, GtkTextIter * endbound,
                              const ustring & searchword,
                              bool casesensitive, bool globbing, bool matchbegin, bool matchend,
                              vector <GtkTextIter>& wordstart, vector<GtkTextIter>& wordend);
  void searchwords_in_area (GtkTextBuffer * textbuffer, 
                            vector <GtkTextIter>& start, vector<GtkTextIter>& end,
                            bool area_id, bool area_intro, bool area_heading, bool area_chapter, 
                            bool area_study, bool area_notes, bool area_xref, bool area_verse);
  void remove_previous_highlights (GtkTextBuffer * textbuffer);
};


bool searchwords_find_fast (const ustring& text, 
                            const vector <ustring>& searchwords, const vector <bool>& wholewords, const vector <bool>& casesensitives, 
                            vector <size_t>& startpositions, vector <size_t>& lengths);


#endif