Class: Cosmos::FindReplaceDialog
- Inherits:
-
Qt::Dialog
- Object
- Qt::Dialog
- Cosmos::FindReplaceDialog
- Includes:
- Singleton
- Defined in:
- lib/cosmos/gui/dialogs/find_replace_dialog.rb
Overview
Provides a Qt::Dialog which implements Find and optionally Replace functionality for a Qt::PlainTextEdit.
Class Method Summary collapse
- .find_next(parent) ⇒ Object
- .find_previous(parent) ⇒ Object
-
.show_find(parent) ⇒ Object
Displays a Find dialog.
-
.show_replace(parent) ⇒ Object
Displays a Find/Replace dialog.
Instance Method Summary collapse
- #find_next(parent) ⇒ Object
- #find_previous(parent) ⇒ Object
- #show_find(parent) ⇒ Object
- #show_replace(parent) ⇒ Object
Methods inherited from Qt::Dialog
Class Method Details
.find_next(parent) ⇒ Object
47 48 49 |
# File 'lib/cosmos/gui/dialogs/find_replace_dialog.rb', line 47 def self.find_next(parent) self.instance.find_next(parent) end |
.find_previous(parent) ⇒ Object
64 65 66 |
# File 'lib/cosmos/gui/dialogs/find_replace_dialog.rb', line 64 def self.find_previous(parent) self.instance.find_previous(parent) end |
.show_find(parent) ⇒ Object
Displays a Find dialog
24 25 26 |
# File 'lib/cosmos/gui/dialogs/find_replace_dialog.rb', line 24 def self.show_find(parent) self.instance.show_find(parent) end |
.show_replace(parent) ⇒ Object
Displays a Find/Replace dialog
36 37 38 |
# File 'lib/cosmos/gui/dialogs/find_replace_dialog.rb', line 36 def self.show_replace(parent) self.instance.show_replace(parent) end |
Instance Method Details
#find_next(parent) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/cosmos/gui/dialogs/find_replace_dialog.rb', line 50 def find_next(parent) flags = find_flags() flags &= ~Qt::TextDocument::FindBackward.to_i found = parent.search_text.find(find_text(), flags) if not found and wrap_around? cursor = parent.search_text.textCursor cursor.movePosition(Qt::TextCursor::Start) parent.search_text.setTextCursor(cursor) parent.search_text.find(find_text(), flags) end end |
#find_previous(parent) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/cosmos/gui/dialogs/find_replace_dialog.rb', line 67 def find_previous(parent) flags = find_flags() flags |= Qt::TextDocument::FindBackward.to_i found = parent.search_text.find(find_text(), flags) if not found and wrap_around? cursor = parent.search_text.textCursor cursor.movePosition(Qt::TextCursor::End) parent.search_text.setTextCursor(cursor) parent.search_text.find(find_text(), flags) end end |
#show_find(parent) ⇒ Object
27 28 29 30 31 |
# File 'lib/cosmos/gui/dialogs/find_replace_dialog.rb', line 27 def show_find(parent) @parent = parent disable_replace show_dialog end |
#show_replace(parent) ⇒ Object
39 40 41 42 43 |
# File 'lib/cosmos/gui/dialogs/find_replace_dialog.rb', line 39 def show_replace(parent) @parent = parent enable_replace show_dialog end |