Class: Watobo::Gui::ResponseViewer
- Inherits:
-
FXVerticalFrame
- Object
- FXVerticalFrame
- Watobo::Gui::ResponseViewer
- Includes:
- Utils
- Defined in:
- lib/watobo/gui/chatviewer_frame.rb
Instance Attribute Summary collapse
-
#auto_filter ⇒ Object
Returns the value of attribute auto_filter.
-
#max_len ⇒ Object
Returns the value of attribute max_len.
Instance Method Summary collapse
- #getText ⇒ Object
- #highlight(pattern) ⇒ Object
-
#initialize(owner, opts) ⇒ ResponseViewer
constructor
A new instance of ResponseViewer.
- #setFontSize(size) ⇒ Object
- #setText(text, prefs = {}) ⇒ Object
Methods included from Utils
#addDecoder, #addEncoder, #addStringInfo, #cleanupHTTP, load_plugins, #removeTags, #replace_text
Constructor Details
#initialize(owner, opts) ⇒ ResponseViewer
Returns a new instance of ResponseViewer.
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
# File 'lib/watobo/gui/chatviewer_frame.rb', line 389 def initialize(owner, opts) super(owner, opts) @tabbook = nil @viewers = [] @text = '' @max_len = 5000 @auto_filter = false @tabBook = FXTabBook.new(self, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT) @tabBook.connect(SEL_COMMAND) { begin getApp().beginWaitCursor() setText(@text) ensure getApp().endWaitCursor() end } @text_dt = FXDataTarget.new('') textviewer_tab = FXTabItem.new(@tabBook, "Text", nil) tab_frame = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED) @textviewer = TextViewer.new(tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0) # @textviewer = TextView2.new( tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0) @textviewer.style = 2 @textviewer.editable = false # @textviewer.target = @text_dt # @textviewer.selector = FXDataTarget::ID_VALUE @viewers << @textviewer taglessviewer_tab = FXTabItem.new(@tabBook, "Tagless", nil) tab_frame = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED) tagless_frame = FXVerticalFrame.new(tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0) #text_view_header = FXHorizontalFrame.new(tagless_frame, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM) @taglessviewer = TaglessViewer.new(tagless_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0) @viewers << @taglessviewer FXTabItem.new(@tabBook, "Hex", nil) tab_frame = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED) @hexViewer = HexViewer.new(tab_frame) @viewers << @hexViewer FXTabItem.new(@tabBook, "HTML", nil) @html_viewer = HTMLViewerFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED) @viewers << @html_viewer FXTabItem.new(@tabBook, "Custom", nil) @viewers << CustomViewer.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED) FXTabItem.new(@tabBook, "JSON", nil) @viewers << JsonViewer.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED) end |
Instance Attribute Details
#auto_filter ⇒ Object
Returns the value of attribute auto_filter.
358 359 360 |
# File 'lib/watobo/gui/chatviewer_frame.rb', line 358 def auto_filter @auto_filter end |
#max_len ⇒ Object
Returns the value of attribute max_len.
358 359 360 |
# File 'lib/watobo/gui/chatviewer_frame.rb', line 358 def max_len @max_len end |
Instance Method Details
#getText ⇒ Object
376 377 378 379 |
# File 'lib/watobo/gui/chatviewer_frame.rb', line 376 def getText index = @tabBook.current @viewers[index].getText() end |
#highlight(pattern) ⇒ Object
381 382 383 384 385 386 387 |
# File 'lib/watobo/gui/chatviewer_frame.rb', line 381 def highlight(pattern) begin index = @tabBook.current @viewers[index].highlight(pattern) rescue end end |
#setFontSize(size) ⇒ Object
372 373 374 |
# File 'lib/watobo/gui/chatviewer_frame.rb', line 372 def setFontSize(size) @textviewer.setFont(nil, size) end |
#setText(text, prefs = {}) ⇒ Object
360 361 362 363 364 365 366 367 368 369 370 |
# File 'lib/watobo/gui/chatviewer_frame.rb', line 360 def setText(text, prefs={}) @text = text @textviewer.max_len = @max_len index = @tabBook.current @viewers[index].setText(text) # @viewers.map{|v| v.setText(text)} # @textviewer.applyFilter if cp[:filter] == true end |