find/replace working better (but not done yet)

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@300 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-04-23 23:02:38 +00:00
parent 89ce208198
commit c8f5b8c4a2
4 changed files with 37 additions and 7 deletions
+9 -4
View File
@@ -271,7 +271,7 @@ void CardsPanel::doPaste() { CUT_COPY_PASTE(doPaste, ;) }
class CardsPanel::SearchFindInfo : public FindInfo {
public:
SearchFindInfo(CardsPanel& panel, wxFindReplaceData& what) : FindInfo(what), panel(panel) {}
virtual bool handle(const CardP& card, const TextValueP& value, size_t pos) {
virtual bool handle(const CardP& card, const TextValueP& value, size_t pos, bool was_selection) {
// Select the card
panel.card_list->setCard(card);
return true;
@@ -283,13 +283,18 @@ class CardsPanel::SearchFindInfo : public FindInfo {
class CardsPanel::ReplaceFindInfo : public FindInfo {
public:
ReplaceFindInfo(CardsPanel& panel, wxFindReplaceData& what) : FindInfo(what), panel(panel) {}
virtual bool handle(const CardP& card, const TextValueP& value, size_t pos) {
virtual bool handle(const CardP& card, const TextValueP& value, size_t pos, bool was_selection) {
// Select the card
panel.card_list->setCard(card);
// Replace
panel.editor->insert(escape(what.GetReplaceString()), _("Replace"));
return true;
if (was_selection) {
panel.editor->insert(escape(what.GetReplaceString()), _("Replace"));
return false;
} else {
return true;
}
}
virtual bool searchSelection() const { return true; }
private:
CardsPanel& panel;
};