mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
"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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user