"insert parameter" and "user parameter" buttons now work.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@271 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-04-21 01:10:32 +00:00
parent fef99c78e3
commit 5327520646
10 changed files with 102 additions and 42 deletions
+6 -3
View File
@@ -69,11 +69,11 @@ class ValueEditor {
/// This editor can be pasted to right now
/** this function should also check the data on the clipboard has the right format */
virtual bool canPaste() const { return false; }
// Copies from this field editor, returns success
/// Copies from this field editor, returns success
virtual bool doCopy() { return false; }
// Deletes the selection from this field editor, cut = copy + delete, returns success
/// Deletes the selection from this field editor, cut = copy + delete, returns success
virtual bool doDelete() { return false; }
// Cuts the selection from this field editor
/// Cuts the selection from this field editor
bool doCut() { return doCopy() && doDelete(); }
/// Initiate pasting in this field editor,
/** should again check if pasting is possible and fail silently if not, returns success */
@@ -96,6 +96,9 @@ class ValueEditor {
virtual size_t selectionStart() const { return 0; }
virtual size_t selectionEnd() const { return 0; }
/// Insert the given text (replacing the current selection)
virtual void insert(const String& text, const String& action_name) {};
// --------------------------------------------------- : Search / replace
/// Do a search or replace action for the given FindInfo
+5 -2
View File
@@ -218,8 +218,8 @@ void TextValueEditor::onLoseFocus() {
assert(caret);
if (caret->IsVisible()) caret->Hide();
// hide selection
selection_start = selection_end = 0;
selection_start_i = selection_end_i = 0;
//selection_start = selection_end = 0;
//selection_start_i = selection_end_i = 0;
}
bool TextValueEditor::onContextMenu(IconMenu& m, wxContextMenuEvent& ev) {
@@ -478,6 +478,9 @@ void TextValueEditor::showCaret() {
if (!caret->IsVisible()) caret->Show();
}
void TextValueEditor::insert(const String& text, const String& action_name) {
replaceSelection(text, action_name);
}
void TextValueEditor::replaceSelection(const String& replacement, const String& name) {
if (replacement.empty() && selection_start == selection_end) {
// no text selected, nothing to delete
+2
View File
@@ -92,6 +92,8 @@ class TextValueEditor : public TextValueViewer, public ValueEditor {
virtual size_t selectionStart() const { return selection_start; }
virtual size_t selectionEnd() const { return selection_end; }
virtual void insert(const String& text, const String& action_name);
// --------------------------------------------------- : Other
virtual wxCursor cursor() const;