Class: Watobo::Gui::HTMLViewer

Inherits:
FXScintilla
  • Object
show all
Defined in:
lib/watobo/gui/html_viewer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner, opts) ⇒ HTMLViewer

Returns a new instance of HTMLViewer.



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
# File 'lib/watobo/gui/html_viewer.rb', line 25

def initialize(owner, opts)
  super(owner, nil, 0, opts)
  self.setLexer FXScintilla::SCLEX_HTML
  self.setCodePage(FXScintilla::SC_CP_UTF8)
  self.styleSetFont(FXScintilla::STYLE_DEFAULT, "fixed")
  self.styleSetSize(FXScintilla::STYLE_DEFAULT, 9)
  self.styleClearAll
  self.styleSetFore(FXScintilla::SCE_P_DEFAULT, FXRGB(0x80, 0x80, 0x80) & 0xffffff)
  self.styleSetFore(FXScintilla::SCE_P_COMMENTLINE, FXRGB(0x00, 0x7f, 0x00) & 0xffffff)
  self.styleSetFore(FXScintilla::SCE_P_NUMBER, FXRGB(0x00, 0x7f, 0x7f) & 0xffffff)
  self.styleSetFore(FXScintilla::SCE_P_STRING, FXRGB(0x7f, 0x00, 0x7f) & 0xffffff)
  self.styleSetFore(FXScintilla::SCE_P_CHARACTER, FXRGB(0x7f, 0x00, 0x7f) & 0xffffff)
  self.styleSetFore(FXScintilla::SCE_P_WORD, FXRGB(0x00, 0x00, 0x7f) & 0xffffff)
  self.styleSetBold(FXScintilla::SCE_P_WORD, true)
  self.styleSetFore(FXScintilla::SCE_P_TRIPLE, FXRGB(0x7f, 0x00, 0x00) & 0xffffff)
  self.styleSetFore(FXScintilla::SCE_P_TRIPLEDOUBLE, FXRGB(0x7f, 0x00, 0x00) & 0xffffff)
  self.styleSetFore(FXScintilla::SCE_P_CLASSNAME, FXRGB(0x00, 0x00, 0xff) & 0xffffff)
  self.styleSetBold(FXScintilla::SCE_P_CLASSNAME, true)
  self.styleSetFore(FXScintilla::SCE_P_DEFNAME, FXRGB(0x00, 0x7f, 0x7f) & 0xffffff)
  self.styleSetBold(FXScintilla::SCE_P_DEFNAME, true)
  self.styleSetBold(FXScintilla::SCE_P_OPERATOR, true)
  self.styleSetFore(FXScintilla::SCE_P_IDENTIFIER, FXRGB(0x7f, 0x7f, 0x7f) & 0xffffff)
  self.styleSetFore(FXScintilla::SCE_P_COMMENTBLOCK, FXRGB(0x7f, 0x7f, 0x7f) & 0xffffff)
  self.styleSetFore(FXScintilla::SCE_P_STRINGEOL, FXRGB(0x00, 0x00, 0x00) & 0xffffff)
  self.styleSetBack(FXScintilla::SCE_P_STRINGEOL, FXRGB(0xe0, 0xc0, 0xe0) & 0xffffff)
  self.styleSetEOLFilled(FXScintilla::SCE_P_STRINGEOL, true)
  self.styleSetFore(34, FXRGB(0x00, 0x00, 0xff) & 0xffffff)
  self.styleSetBold(34, true)
  self.styleSetFore(35, FXRGB(0xff, 0x00, 0x00) & 0xffffff)
  self.styleSetBold(35, true)
  @max_len = 0
end

Instance Attribute Details

#max_lenObject

Returns the value of attribute max_len.



7
8
9
# File 'lib/watobo/gui/html_viewer.rb', line 7

def max_len
  @max_len
end

Instance Method Details

#search_text(text, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/watobo/gui/html_viewer.rb', line 9

def search_text(text, &block)
  matches = []
  setTargetStart 0
  setTargetEnd getLength
  while searchInTarget(text.length, text) >= 0
   pos = getTargetStart
   setTargetStart pos+1
  setTargetEnd getLength
  yield pos if block_given?
  matches << pos
   end
   
   matches
end