Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
dd478d76
Commit
dd478d76
authored
Apr 24, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Forgot to add find_replace.hpp
parent
59b414df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
2 deletions
+49
-2
src/gui/value/text.cpp
src/gui/value/text.cpp
+1
-2
src/util/find_replace.hpp
src/util/find_replace.hpp
+48
-0
No files found.
src/gui/value/text.cpp
View file @
dd478d76
...
...
@@ -702,8 +702,7 @@ bool TextValueEditor::search(FindInfo& find, bool from_start) {
size_t
selection_max
=
index_to_untagged
(
value
().
value
(),
max
(
selection_start_i
,
selection_end_i
));
if
(
find
.
forward
())
{
size_t
start
=
min
(
v
.
size
(),
find
.
searchSelection
()
?
selection_min
:
selection_max
);
size_t
end
=
max
(
0
,
(
int
)
v
.
size
()
-
(
int
)
find
.
findString
().
size
());
for
(
size_t
i
=
start
;
i
<=
end
;
++
i
)
{
for
(
size_t
i
=
start
;
i
+
find
.
findString
().
size
())
<=
v
.
size
()
;
++
i
)
{
if
(
matchSubstr
(
v
,
i
,
find
))
return
true
;
}
}
else
{
...
...
src/util/find_replace.hpp
0 → 100644
View file @
dd478d76
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2007 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_UTIL_FIND_REPLACE
#define HEADER_UTIL_FIND_REPLACE
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <wx/fdrepdlg.h>
DECLARE_POINTER_TYPE
(
Card
);
DECLARE_POINTER_TYPE
(
TextValue
);
// ----------------------------------------------------------------------------- : Search/replace
/// Information for search/replace
class
FindInfo
{
public:
FindInfo
(
wxFindReplaceData
&
what
)
:
what
(
what
)
{}
virtual
~
FindInfo
()
{}
/// Handle that a match was found.
/** Returns true if we are done and searching should be ended. */
virtual
bool
handle
(
const
CardP
&
card
,
const
TextValueP
&
value
,
size_t
pos
,
bool
was_selection
)
=
0
;
/// Should the found text be selected?
virtual
bool
select
()
const
{
return
true
;
}
/// Should the current selection also be searched?
virtual
bool
searchSelection
()
const
{
return
false
;
}
/// Searching forward?
inline
bool
forward
()
const
{
return
what
.
GetFlags
()
&
wxFR_DOWN
;
}
/// Match whole words?
inline
bool
wholeWord
()
const
{
return
what
.
GetFlags
()
&
wxFR_WHOLEWORD
;
}
/// Case sensitive?
inline
bool
caseSensitive
()
const
{
return
what
.
GetFlags
()
&
wxFR_MATCHCASE
;
}
/// String to look for
inline
const
String
&
findString
()
const
{
return
what
.
GetFindString
();
}
protected:
wxFindReplaceData
&
what
;
///< What to search for, the direction to search in
};
// ----------------------------------------------------------------------------- : EOF
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment