Commit e7dd3209 authored by twanvl's avatar twanvl

Added filter box for keywords

parent 17681ad2
......@@ -413,9 +413,10 @@ tooltip:
label:
# Cards tab
card notes: Card notes:
search cards: Search for cards
search cards: Search for cards...
# Keywords tab
search keywords: Search for keywords...
keyword: Keyword
match: Matches
mode: Mode
......
......@@ -55,41 +55,6 @@ String Card::identification() const {
}
}
/// Does the given object match the quick search query?
template <typename T>
bool match_quicksearch_query(String const& query, T const& object) {
bool need_match = true;
// iterate over the components of the query
for (size_t i = 0 ; i < query.size() ; ) {
if (query.GetChar(i) == _(' ')) {
// skip spaces
i++;
} else if (query.GetChar(i) == _('-')) {
// negate the next query, i.e. match only if it is not on the card
need_match = !need_match;
i++;
} else {
size_t end, next;
if (query.GetChar(i) == _('"')) {
// quoted string, match exactly
i++;
end =query.find_first_of(_('"'),i);
next = min(end,query.size()) + 1;
} else {
// single word
next = end = query.find_first_of(_(' '),i);
}
bool match = object.contains(query.substr(i,end-i));
if (match != need_match) {
return false;
}
need_match = true; // next word is no longer negated
i = next;
}
}
return true;
}
bool Card::contains(String const& query) const {
FOR_EACH_CONST(v, data) {
if (find_i(v->toString(),query) != String::npos) return true;
......@@ -97,9 +62,6 @@ bool Card::contains(String const& query) const {
if (find_i(notes,query) != String::npos) return true;
return false;
}
bool Card::contains_words(String const& query) const {
return match_quicksearch_query(query,*this);
}
IndexMap<FieldP, ValueP>& Card::extraDataFor(const StyleSheet& stylesheet) {
return extra_data.get(stylesheet.name(), stylesheet.extra_card_fields);
......
......@@ -80,6 +80,14 @@ void read_compat(Reader& tag, Keyword* k) {
}
}
bool Keyword::contains(String const& query) const {
if (find_i(keyword,query) != String::npos) return true;
if (find_i(rules,query) != String::npos) return true;
if (find_i(match,query) != String::npos) return true;
if (find_i(reminder.get(),query) != String::npos) return true;
return false;
}
IMPLEMENT_REFLECTION(Keyword) {
REFLECT(keyword);
read_compat(tag, this);
......
......@@ -116,6 +116,9 @@ class Keyword : public IntrusivePtrVirtualBase {
*/
void prepare(const vector<KeywordParamP>& param_types, bool force = false);
/// Does the keyword contain the given query word?
bool contains(String const& word) const;
DECLARE_REFLECTION();
};
......
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2010 Twan van Laarhoven and Sean Hunt |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <gui/control/filter_ctrl.hpp>
#include <gui/about_window.hpp> // for HoverButton
#include <gui/drop_down_list.hpp>
// ----------------------------------------------------------------------------- : DropDownMRUList
/// A drop down list of recent choices, for autocomplete
class DropDownMRUList : public DropDownList {
public:
DropDownMRUList(Window* parent, vector<String> const& choices)
: DropDownList(parent)
, choices(choices)
{}
vector<String> choices;
protected:
virtual size_t selection() const { return NO_SELECTION; }
virtual size_t itemCount() const { return choices.size(); }
virtual String itemText(size_t item) const { return choices.at(item); }
virtual void select(size_t item);
};
// ----------------------------------------------------------------------------- : FilterControl
/// Text control that forwards focus events to the parent
class TextCtrlWithFocus : public wxTextCtrl {
public:
DECLARE_EVENT_TABLE();
void forwardFocusEvent(wxFocusEvent&);
void forwardKeyEvent(wxKeyEvent&);
};
FilterCtrl::FilterCtrl(wxWindow* parent, int id, String const& placeholder)
: wxControl(parent, id, wxDefaultPosition, wxSize(160,41), wxSTATIC_BORDER)
, changing(false)
, placeholder(placeholder)
{
wxColour bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
SetBackgroundColour(bg);
SetCursor(wxCURSOR_IBEAM);
filter_ctrl = new TextCtrlWithFocus();
filter_ctrl->Create(this, wxID_ANY, _(""), wxDefaultPosition, wxSize(130,-1), wxNO_BORDER);
clear_button = new HoverButton(this, wxID_ANY, _("btn_clear_filter"), bg, false);
clear_button->SetCursor(*wxSTANDARD_CURSOR);
onSize();
update();
}
void FilterCtrl::setFilter(const String& new_value, bool event) {
if (this->value == new_value) return;
// update ui
this->value = new_value;
update();
// send event
if (event) {
wxCommandEvent ev(wxEVT_COMMAND_TEXT_UPDATED, GetId());
GetParent()->HandleWindowEvent(ev);
}
}
void FilterCtrl::update() {
changing = true;
if (!value.empty() || hasFocus()) {
filter_ctrl->SetValue(value);
wxColour fg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
filter_ctrl->SetDefaultStyle(wxTextAttr(fg));
filter_ctrl->SetForegroundColour(fg);
wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
filter_ctrl->SetFont(font);
} else {
filter_ctrl->SetValue(placeholder);
wxColour fg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
wxColour bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
filter_ctrl->SetDefaultStyle(wxTextAttr(lerp(fg,bg,0.5)));
filter_ctrl->SetForegroundColour(lerp(fg,bg,0.5));
wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
font.SetStyle(wxFONTSTYLE_ITALIC);
filter_ctrl->SetFont(font);
}
clear_button->Show(!value.empty());
changing = false;
}
void FilterCtrl::onChangeEvent(wxCommandEvent&) {
if (!changing) {
setFilter(filter_ctrl->GetValue(),true);
}
}
void FilterCtrl::onChar(wxKeyEvent& ev) {
if (ev.GetKeyCode() == WXK_ESCAPE) {
// escape clears the filter box
clearFilter(true);
} else {
ev.Skip();
}
}
void FilterCtrl::onClear(wxCommandEvent&) {
clearFilter(true);
}
void FilterCtrl::onSizeEvent(wxSizeEvent&) {
onSize();
}
void FilterCtrl::onSize() {
wxSize s = GetClientSize();
wxSize fs = filter_ctrl->GetBestSize();
wxSize cs = clear_button->GetBestSize();
int margin = 2;
filter_ctrl ->SetSize(margin, max(margin,(s.y-fs.y)/2), s.x - cs.x - 3*margin, fs.y);
clear_button->SetSize(s.x - cs.x - margin, (s.y-cs.y)/2, cs.x, cs.y);
}
void FilterCtrl::onSetFocus(wxFocusEvent&) {
filter_ctrl->SetFocus();
update();
}
void FilterCtrl::onKillFocus(wxFocusEvent&) {
update();
}
bool FilterCtrl::hasFocus() {
wxWindow* focus = wxWindow::FindFocus();
return focus == this || focus == filter_ctrl || focus == clear_button;
}
BEGIN_EVENT_TABLE(FilterCtrl, wxControl)
EVT_BUTTON (wxID_ANY, FilterCtrl::onClear)
EVT_TEXT (wxID_ANY, FilterCtrl::onChangeEvent)
EVT_SIZE (FilterCtrl::onSizeEvent)
EVT_SET_FOCUS (FilterCtrl::onSetFocus)
EVT_KILL_FOCUS(FilterCtrl::onKillFocus)
EVT_CHAR (FilterCtrl::onChar)
END_EVENT_TABLE()
// ----------------------------------------------------------------------------- : TextCtrlWithFocus
void TextCtrlWithFocus::forwardFocusEvent(wxFocusEvent& ev) {
GetParent()->HandleWindowEvent(ev);
}
void TextCtrlWithFocus::forwardKeyEvent(wxKeyEvent& ev) {
GetParent()->HandleWindowEvent(ev);
}
BEGIN_EVENT_TABLE(TextCtrlWithFocus, wxTextCtrl)
EVT_SET_FOCUS (TextCtrlWithFocus::forwardFocusEvent)
EVT_KILL_FOCUS(TextCtrlWithFocus::forwardFocusEvent)
EVT_CHAR (TextCtrlWithFocus::forwardKeyEvent)
END_EVENT_TABLE()
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2010 Twan van Laarhoven and Sean Hunt |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_GUI_CONTROL_FILTER_CTRL
#define HEADER_GUI_CONTROL_FILTER_CTRL
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <data/filter.hpp>
class HoverButton;
class TextCtrlWithFocus;
// ----------------------------------------------------------------------------- : FilterCtrl
/// A search/filter textbox
class FilterCtrl : public wxControl {
public:
FilterCtrl(wxWindow* parent, int id, String const& placeholder);
/// Set the filter text
void setFilter(const String& filter, bool send_event = false);
void clearFilter(bool send_event = false) { setFilter(String(),send_event); }
bool hasFilter() const { return !value.empty(); }
String const& getFilterString() const { return value; }
template <typename T>
intrusive_ptr<Filter<T> > getFilter() const {
if (hasFilter()) {
return intrusive(new QuickFilter<T>(getFilterString()));
} else {
return intrusive_ptr<Filter<T> >();
}
}
private:
DECLARE_EVENT_TABLE();
bool changing;
String value;
String placeholder;
TextCtrlWithFocus* filter_ctrl;
HoverButton* clear_button;
void update();
bool hasFocus();
// wxWidgets appears to have developed an overload allergy
void onChangeEvent(wxCommandEvent&);
void onClear(wxCommandEvent&);
void onSizeEvent(wxSizeEvent&);
void onChar(wxKeyEvent&);
void onSize();
void onSetFocus(wxFocusEvent&);
void onKillFocus(wxFocusEvent&);
};
// ----------------------------------------------------------------------------- : EOF
#endif
......@@ -33,18 +33,3 @@ void FilteredCardList::getItems(vector<VoidP>& out) const {
filter->getItems(set->cards,out);
}
}
// ----------------------------------------------------------------------------- : CardListFilter
void CardListFilter::getItems(const vector<CardP>& cards, vector<VoidP>& out) const {
FOR_EACH_CONST(c, cards) {
if (keep(c)) {
out.push_back(c);
}
}
}
bool QueryCardListFilter::keep(const CardP& card) const {
return card->contains_words(query);
}
......@@ -11,29 +11,9 @@
#include <util/prec.hpp>
#include <gui/control/card_list.hpp>
#include <data/filter.hpp>
DECLARE_POINTER_TYPE(CardListFilter);
// ----------------------------------------------------------------------------- : CardListFilter
/// A filter function to determine which items are shown in a card list
class CardListFilter : public IntrusivePtrVirtualBase {
public:
virtual ~CardListFilter() {}
/// Should a card be shown in the list?
virtual bool keep(const CardP& card) const { return false; }
/// Select cards from a card list
virtual void getItems(const vector<CardP>& cards, vector<VoidP>& out) const;
};
/// A filter function that searches for cards containing a string
class QueryCardListFilter : public CardListFilter {
public:
QueryCardListFilter(String const& query) : query(query) {}
virtual bool keep(const CardP& card) const;
private:
String query;
};
typedef intrusive_ptr<Filter<Card> > CardListFilterP;
// ----------------------------------------------------------------------------- : FilteredCardList
......
......@@ -56,6 +56,11 @@ void KeywordList::onChangeSet() {
refreshList();
}
void KeywordList::setFilter(const KeywordListFilterP& filter) {
this->filter = filter;
refreshList();
}
void KeywordList::onAction(const Action& action, bool undone) {
TYPE_CASE(action, AddKeywordAction) {
if (action.action.adding != undone) {
......@@ -151,11 +156,15 @@ String match_string(const Keyword& a) {
void KeywordList::getItems(vector<VoidP>& out) const {
FOR_EACH(k, set->keywords) {
k->fixed = false;
out.push_back(k);
if (!filter || filter->keep(*k)) {
out.push_back(k);
}
}
FOR_EACH(k, set->game->keywords) {
k->fixed = true;
out.push_back(k);
if (!filter || filter->keep(*k)) {
out.push_back(k);
}
}
}
void KeywordList::sendEvent() {
......
......@@ -12,8 +12,11 @@
#include <util/prec.hpp>
#include <gui/control/item_list.hpp>
#include <data/keyword.hpp>
#include <data/filter.hpp>
#include <data/set.hpp>
typedef intrusive_ptr<Filter<Keyword> > KeywordListFilterP;
// ----------------------------------------------------------------------------- : Events
DECLARE_EVENT_TYPE(EVENT_KEYWORD_SELECT, <not used>)
......@@ -51,6 +54,9 @@ class KeywordList : public ItemList, public SetView {
inline KeywordP getKeyword() const { return static_pointer_cast<Keyword>(selected_item); }
inline void setKeyword(const KeywordP& kw) { selectItem(kw, true, false); }
/// Change the filter to use, can be null
void setFilter(const KeywordListFilterP& filter);
// --------------------------------------------------- : Clipboard
bool canDelete() const;
......@@ -87,6 +93,7 @@ class KeywordList : public ItemList, public SetView {
void storeColumns();
mutable wxListItemAttr item_attr; // for OnGetItemAttr
KeywordListFilterP filter; ///< Which keywords to show?
/// How often is a keyword used in the set?
int usage(const Keyword&) const;
......
......@@ -11,10 +11,10 @@
#include <gui/control/image_card_list.hpp>
#include <gui/control/card_editor.hpp>
#include <gui/control/text_ctrl.hpp>
#include <gui/control/filter_ctrl.hpp>
#include <gui/about_window.hpp> // for HoverButton
#include <gui/update_checker.hpp>
#include <gui/icon_menu.hpp>
#include <gui/drop_down_list.hpp>
#include <gui/util.hpp>
#include <data/set.hpp>
#include <data/game.hpp>
......@@ -35,177 +35,6 @@ DECLARE_TYPEOF_COLLECTION(AddCardsScriptP);
#define HAVE_TOOLBAR_DROPDOWN_MENU 1
#endif
// ----------------------------------------------------------------------------- : DropDownMRUList
/// A drop down list of recent choices, for autocomplete
class DropDownMRUList : public DropDownList {
public:
DropDownMRUList(Window* parent, vector<String> const& choices)
: DropDownList(parent)
, choices(choices)
{}
vector<String> choices;
protected:
virtual size_t selection() const { return NO_SELECTION; }
virtual size_t itemCount() const { return choices.size(); }
virtual String itemText(size_t item) const { return choices.at(item); }
virtual void select(size_t item);
};
// ----------------------------------------------------------------------------- : FilterControl
/// Text control that forwards focus events to the parent
class TextCtrlWithFocus : public wxTextCtrl {
public:
DECLARE_EVENT_TABLE();
void forwardFocusEvent(wxFocusEvent&);
void forwardKeyEvent(wxKeyEvent&);
};
/// A search/filter textbox
class FilterCtrl : public wxControl {
public:
FilterCtrl(wxWindow* parent, int id);
/// Set the filter text
void setFilter(const String& filter, bool event = false);
void clearFilter(bool event = false) { setFilter(String(),event); }
bool hasFilter() const { return !value.empty(); }
String const& getFilter() const { return value; }
//bool AcceptsFocus() const { return false; }
private:
DECLARE_EVENT_TABLE();
bool changing;
wxString value;
TextCtrlWithFocus* filter_ctrl;
HoverButton* clear_button;
void update();
bool hasFocus();
// wxWidgets appears to have developed an overload allergy
void onChange();
void onChangeEvent(wxCommandEvent&);
void onClear(wxCommandEvent&);
void onSizeEvent(wxSizeEvent&);
void onChar(wxKeyEvent&);
void onSize();
public:
void onSetFocus(wxFocusEvent&);
void onKillFocus(wxFocusEvent&);
};
FilterCtrl::FilterCtrl(wxWindow* parent, int id)
: wxControl(parent, id, wxDefaultPosition, wxSize(160,41), wxSTATIC_BORDER)
, changing(false)
{
wxColour bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
SetBackgroundColour(bg);
SetCursor(wxCURSOR_IBEAM);
filter_ctrl = new TextCtrlWithFocus();
filter_ctrl->Create(this, wxID_ANY, _(""), wxDefaultPosition, wxSize(130,-1), wxNO_BORDER);
clear_button = new HoverButton(this, wxID_ANY, _("btn_clear_filter"), bg, false);
clear_button->SetCursor(*wxSTANDARD_CURSOR);
onSize();
update();
}
void FilterCtrl::setFilter(const String& new_value, bool event) {
if (this->value == new_value) return;
// update ui
this->value = new_value;
update();
// send event
if (event) {
wxCommandEvent ev(wxEVT_COMMAND_TEXT_UPDATED, GetId());
GetParent()->HandleWindowEvent(ev);
}
}
void FilterCtrl::update() {
changing = true;
if (!value.empty() || hasFocus()) {
filter_ctrl->SetValue(value);
wxColour fg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
filter_ctrl->SetDefaultStyle(wxTextAttr(fg));
filter_ctrl->SetForegroundColour(fg);
} else {
filter_ctrl->SetValue(_LABEL_("search cards"));
wxColour fg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
wxColour bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
filter_ctrl->SetDefaultStyle(wxTextAttr(lerp(fg,bg,0.5)));
filter_ctrl->SetForegroundColour(lerp(fg,bg,0.5));
}
clear_button->Show(!value.empty());
changing = false;
}
void FilterCtrl::onChangeEvent(wxCommandEvent&) {
if (!changing) {
setFilter(filter_ctrl->GetValue(),true);
}
}
void FilterCtrl::onChar(wxKeyEvent& ev) {
if (ev.GetKeyCode() == WXK_ESCAPE) {
// escape clears the filter box
clearFilter(true);
} else {
ev.Skip();
}
}
void FilterCtrl::onClear(wxCommandEvent&) {
clearFilter(true);
}
void FilterCtrl::onSizeEvent(wxSizeEvent&) {
onSize();
}
void FilterCtrl::onSize() {
wxSize s = GetClientSize();
wxSize fs = filter_ctrl->GetBestSize();
wxSize cs = clear_button->GetBestSize();
int margin = 2;
filter_ctrl ->SetSize(margin, max(margin,(s.y-fs.y)/2), s.x - cs.x - 3*margin, fs.y);
clear_button->SetSize(s.x - cs.x - margin, (s.y-cs.y)/2, cs.x, cs.y);
}
void FilterCtrl::onSetFocus(wxFocusEvent&) {
filter_ctrl->SetFocus();
update();
}
void FilterCtrl::onKillFocus(wxFocusEvent&) {
update();
}
bool FilterCtrl::hasFocus() {
wxWindow* focus = wxWindow::FindFocus();
return focus == this || focus == filter_ctrl || focus == clear_button;
}
BEGIN_EVENT_TABLE(FilterCtrl, wxControl)
EVT_BUTTON (wxID_ANY, FilterCtrl::onClear)
EVT_TEXT (wxID_ANY, FilterCtrl::onChangeEvent)
EVT_SIZE (FilterCtrl::onSizeEvent)
EVT_SET_FOCUS (FilterCtrl::onSetFocus)
EVT_KILL_FOCUS(FilterCtrl::onKillFocus)
EVT_CHAR (FilterCtrl::onChar)
END_EVENT_TABLE()
void TextCtrlWithFocus::forwardFocusEvent(wxFocusEvent& ev) {
GetParent()->HandleWindowEvent(ev);
}
void TextCtrlWithFocus::forwardKeyEvent(wxKeyEvent& ev) {
GetParent()->HandleWindowEvent(ev);
}
BEGIN_EVENT_TABLE(TextCtrlWithFocus, wxTextCtrl)
EVT_SET_FOCUS (TextCtrlWithFocus::forwardFocusEvent)
EVT_KILL_FOCUS(TextCtrlWithFocus::forwardFocusEvent)
EVT_CHAR (TextCtrlWithFocus::forwardKeyEvent)
END_EVENT_TABLE()
// ----------------------------------------------------------------------------- : CardsPanel
CardsPanel::CardsPanel(Window* parent, int id)
......@@ -387,7 +216,7 @@ void CardsPanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
#endif
// Filter/search textbox
tb->AddSeparator();
if (!filter) filter = new FilterCtrl(tb, ID_CARD_FILTER);
if (!filter) filter = new FilterCtrl(tb, ID_CARD_FILTER, _LABEL_("search cards"));
tb->AddControl(filter);
tb->Realize();
// Menus
......@@ -518,11 +347,7 @@ void CardsPanel::onCommand(int id) {
}
case ID_CARD_FILTER: {
// card filter has changed, update the card list
if (filter->hasFilter()) {
card_list->setFilter(intrusive(new QueryCardListFilter(filter->getFilter())));
} else {
card_list->setFilter(CardListFilterP());
}
card_list->setFilter(filter->getFilter<Card>());
break;
}
default: {
......
......@@ -49,6 +49,7 @@ void KeywordsPanel::initControls() {
ref_param = new wxButton(panel, ID_KEYWORD_REF_PARAM, _BUTTON_("refer parameter"));
rules = new TextCtrl(panel, ID_RULES, true);
errors = new wxStaticText(panel, wxID_ANY, _(""));
filter = nullptr;
errors->SetForegroundColour(*wxRED);
// warning about fixed keywords
fixedL = new wxStaticText(panel, wxID_ANY, _(""));
......@@ -132,6 +133,10 @@ void KeywordsPanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
// Toolbar
tb->AddTool(ID_KEYWORD_ADD, _(""), load_resource_tool_image(_("keyword_add")), wxNullBitmap, wxITEM_NORMAL,_TOOLTIP_("add keyword"), _HELP_("add keyword"));
tb->AddTool(ID_KEYWORD_REMOVE, _(""), load_resource_tool_image(_("keyword_del")), wxNullBitmap, wxITEM_NORMAL,_TOOLTIP_("remove keyword"),_HELP_("remove keyword"));
// Filter/search textbox
tb->AddSeparator();
if (!filter) filter = new FilterCtrl(tb, ID_KEYWORD_FILTER, _LABEL_("search keywords"));
tb->AddControl(filter);
tb->Realize();
// Menus
mb->Insert(2, menuKeyword, _MENU_("keywords"));
......@@ -141,6 +146,9 @@ void KeywordsPanel::destroyUI(wxToolBar* tb, wxMenuBar* mb) {
// Toolbar
tb->DeleteTool(ID_KEYWORD_ADD);
tb->DeleteTool(ID_KEYWORD_REMOVE);
tb->DeleteTool(filter->GetId()); filter = nullptr;
// HACK: hardcoded size of rest of toolbar
tb->DeleteToolByPos(12); // delete separator
// Menus
mb->Remove(2);
......@@ -203,6 +211,11 @@ void KeywordsPanel::onCommand(int id) {
ref_param->PopupMenu(&ref_menu, 0, ref_param->GetSize().y);
break;
}
case ID_KEYWORD_FILTER: {
// keyword filter has changed, update the list
list->setFilter(filter->getFilter<Keyword>());
break;
}
default:
if (id >= ID_PARAM_TYPE_MIN && id < ID_PARAM_TYPE_MAX) {
// add parameter
......
......@@ -11,12 +11,14 @@
#include <util/prec.hpp>
#include <gui/set/panel.hpp>
#include <gui/control/filter_ctrl.hpp>
class wxSplitterWindow;
class KeywordList;
class TextCtrl;
class IconMenu;
struct KeywordSelectEvent;
class FilterCtrl;
// ----------------------------------------------------------------------------- : KeywordsPanel
......@@ -69,6 +71,7 @@ class KeywordsPanel : public SetWindowPanel {
wxChoice* mode;
wxButton* add_param;
wxButton* ref_param;
FilterCtrl* filter;
// --------------------------------------------------- : Events
void onKeywordSelect(KeywordSelectEvent& ev);
......
......@@ -530,7 +530,7 @@ void StatsPanel::onGraphSelect(wxCommandEvent&) {
// ----------------------------------------------------------------------------- : Filtering card list
class StatsFilter : public CardListFilter {
class StatsFilter : public Filter<Card> {
public:
StatsFilter(GraphData& data, const vector<int> match) {
data.indices(match, indices);
......
......@@ -622,6 +622,12 @@
<Filter
Name="control"
Filter="">
<File
RelativePath=".\gui\control\filter_ctrl.cpp">
</File>
<File
RelativePath=".\gui\control\filter_ctrl.hpp">
</File>
<File
RelativePath=".\gui\control\gallery_list.cpp">
</File>
......@@ -1884,6 +1890,9 @@
<File
RelativePath=".\data\export_template.hpp">
</File>
<File
RelativePath=".\data\filter.hpp">
</File>
<File
RelativePath=".\data\font.cpp">
<FileConfiguration
......
# This file contains the keys expected to be in MSE locales
# It was automatically generated by tools/locale/locale.pl
# Generated on Thu Jan 6 13:04:27 2011
action:
add control point: 0
add item: 1
add symmetry: 0
auto replace: 0
backspace: 0
change: 1
change combine mode: 0
change shape name: 0
change symmetry copies: 0
change symmetry type: 0
convert to curve: 0
convert to line: 0
correct: 0
cut: 0
delete: 0
delete point: 0
delete points: 0
duplicate: 1
enter: 0
group parts: 0
insert symbol: 0
lock point: 0
move: 1
move curve: 0
move handle: 0
move symmetry center: 0
move symmetry handle: 0
paste: 0
remove item: 1
reorder parts: 0
rotate: 1
scale: 1
shear: 1
soft line break: 0
typing: 0
ungroup parts: 0
button:
add custom pack: 0
add item: 0
always: 0
browse: 0
check now: 0
check updates: 0
close: 0
defaults: 0
don't install package: 0
edit symbol: 0
enabled: 0
export custom cards selection: 0
export entire set: 0
export generated packs: 0
fixed seed: 0
generate pack: 0
hide: 0
high quality: 0
if internet connection exists: 0
insert parameter: 0
install group: optional, 0
install package: 0
keep old: 0
keep package: 0
last opened set: 0
move down: 0
move up: 0
never: 0
new set: 0
number: 0
number overwrite: 0
open set: 0
open sets in new window: 0
overwrite: 0
random seed: 0
refer parameter: 0
reinstall package: 0
remove group: optional, 0
remove item: 0
remove package: 0
select: optional, 0
select all: 0
select cards: 0
select none: 0
show: 0
show editing hints: 0
show lines: 0
spellcheck enabled: 0
symbol gallery: optional, 0
upgrade group: optional, 0
upgrade package: 0
use auto replace: 0
use custom styling options: 0
use for all cards: 0
whole word: 0
zoom export: 0
error:
aborting parsing: 0
can't convert: 2
can't convert value: 3
can't download installer: 2
cannot create file: 1
change packages successful: 1
checking updates failed: 0
coordinates for blending overlap: 0
dependency not given: 4
dimension not found: 1
downloading updates: 0
expected key: 1
file not found: 2
file not found package like: 2
file parse error: 2
has no member: 2
has no member value: 2
images used for blending must have the same size: 0
in function: 2
in keyword reminder: 2
in parameter: 2
install packages successful: 1
installing updates: 0
newer version: 2
no game specified: 1
no stylesheet specified for the set: 0
no updates: 0
pack type duplicate name: 1
pack type not found: 1
package not found: 1
package out of date: 3
package too new: 4
remove packages: 1
remove packages modified: 2
remove packages successful: 1
stylesheet and set refer to different game: 0
successful install: optional, 2
unable to open output file: 0
unable to store file: 0
unrecognized value: 2
unsupported field type: 1
unsupported fill type: 1
unsupported format: 1
word list type not found: 1
help:
about: 0
add card: 0
add cards: 0
add keyword: 0
add symmetry: 0
add to dictionary: optional, 0
app language: 0
auto replace: 0
bar: 0
basic shapes: 0
bold: 0
border: 0
card list columns: 0
cards tab: 0
check updates: 0
click to select shape: 0
close symbol editor: 0
collapse notes: 0
copies: 0
copy: 0
copy card: 0
copy keyword: 0
curve segment: 0
cut: 0
cut card: 0
cut keyword: 0
difference: 0
drag to draw shape: 0
drag to move curve: 0
drag to move line: 0
drag to move point: 0
drag to resize: 1
drag to rotate: 1
drag to shear: 1
draw ellipse: 0
draw polygon: 0
draw rectangle: 0
draw star: 0
duplicate: 0
edit pack type: 0
ellipse: 0
exit: 0
expand notes: 0
export: 0
export apprentice: 0
export html: 0
export image: 0
export images: 0
export mws: 0
filename format: 0
find: 0
find next: 0
fixed seed: 0
free point: 0
grid: 0
group: 0
index: 0
intersect: 0
italic: 0
keywords tab: 0
last opened set: 1
line segment: 0
merge: 0
new set: 0
new symbol: 0
new window: 0
next card: 0
next keyword: 0
no spelling suggestions: 0
number of packs: 1
open set: 0
open symbol: 0
orientation: 0
overlap: 0
paint: 0
paste: 0
paste card: 0
paste keyword: 0
pie: 0
points: 0
polygon: 0
preferences: 0
previous card: 0
previous keyword: 0
print: 0
print preview: 0
random pack tab: 0
random seed: 0
rectangle: 0
redo: 0
reflection: 0
reload data: 0
reminder text: 0
remove card: 0
remove keyword: 0
remove symmetry: 0
replace: 0
rotate: 0
rotate 0: 0
rotate 180: 0
rotate 270: 0
rotate 90: 0
rotate card: 0
rotation: 0
save set: 0
save set as: 0
save symbol: 0
save symbol as: 0
scatter: 0
scatter pie: 0
seed: 0
select: 0
set code: 0
set info tab: 0
show profiler: 0
sides: 0
smooth point: 0
snap: 0
stack: 0
star: 0
stats tab: 0
store symbol: 0
style tab: 0
subtract: 0
symbols: 0
symmetric point: 0
symmetry: 0
undo: 0
ungroup: 0
website: 0
welcome: 0
zoom export: 0
label:
app language: 0
apprentice: 0
apprentice exe: 0
apprentice export cancelled: 0
auto match: 0
auto replace: 0
card display: 0
card notes: 0
check at startup: 0
checking requires internet: 0
columns: 0
custom size: 0
export filenames: 0
external programs: 0
filename conflicts: 0
filename format: 0
filename is ignored: 0
filter: 0
fix aspect ratio: 0
force to fit: 0
game type: 0
html export options: 0
html template: 0
install package: 0
installable version: 0
installed version: 0
installer size: optional, 0
installer status: optional, 0
keyword: 0
language: 0
magic set editor package: optional, 0
match: 0
mode: 0
no version: 0
original: 0
original size: 0
pack name: 0
pack selection: 0
pack totals: 0
package action: 0
package conflicts: 0
package installable: 0
package installed: 0
package modified: 0
package name: 0
package status: 0
package updates: 0
percent of normal: 0
reinstall package: 0
reminder: 0
remove package: 0
result: 0
rules: 0
save changes: 1
search cards: 0
seed: 0
select cards: 0
select cards print: optional, 0
select columns: 0
selected card count: 1
selection: 0
selection height: 0
selection left: 0
selection top: 0
selection width: 0
set code: 0
sharpen filter: 0
sides: optional, 0
size: 0
size to fit: 0
standard keyword: 1
style type: 0
stylesheet not found: 1
styling options: 0
total cards: 0
upgrade package: 0
uses: 0
windows: 0
zoom: 0
zoom %: 0
zoom amount: 0
zoom amount x: 0
zoom amount y: 0
menu:
about: 0
add card: 0
add cards: 0
add keyword: 0
add to dictionary: optional, 0
auto replace: 0
bar: 0
basic shapes: 0
bold: 0
card list columns: 0
cards: 0
cards tab: 0
check updates: 0
close symbol editor: 0
copy: 0
cut: 0
duplicate: 0
edit: 0
exit: 0
export: 0
export apprentice: 0
export html: 0
export image: 0
export images: 0
export mws: 0
file: 0
find: 0
find next: 0
format: 0
graph: 0
group: 0
help: 0
index: 0
insert symbol: 0
italic: 0
keywords: 0
keywords tab: 0
new set: 0
new symbol: 0
new window: 0
next card: 0
next keyword: 0
no spelling suggestions: 0
open set: 0
open symbol: 0
orientation: 0
paint: 0
paste: 0
pie: 0
points: 0
preferences: 0
previous card: 0
previous keyword: 0
print: 0
print preview: 0
random pack tab: 0
redo: 1
reload data: 0
reminder text: 0
remove card: 0
remove keyword: 0
replace: 0
rotate: 0
rotate 0: 0
rotate 180: 0
rotate 270: 0
rotate 90: 0
save set: 0
save set as: 0
save symbol: 0
save symbol as: 0
scatter: 0
scatter pie: 0
select: 0
set info tab: 0
show profiler: 0
stack: 0
stats tab: 0
store symbol: 0
style tab: 0
symbols: 0
symmetry: 0
tool: 0
undo: 1
ungroup: 0
website: 0
window: 0
title:
%s - magic set editor: 1
about: 0
auto replaces: 0
cannot create file: 0
custom pack: 0
directories: 0
display: 0
export cancelled: 0
export html: 0
export images: 0
global: 0
installing updates: 0
locate apprentice: 0
magic set editor: 0
new set: 0
open set: 0
packages window: 0
preferences: 0
print preview: 0
save changes: 0
save html: 0
save image: 0
save set: 0
select cards: 0
select cards export: 0
select columns: 0
select stylesheet: 0
slice image: 0
symbol editor: 0
untitled: 0
update check: 0
updates: 0
updates available: 0
tool:
add symmetry: 0
basic shapes: 0
border: 0
cards tab: 0
curve segment: 0
difference: 0
ellipse: 0
free point: 0
grid: 0
intersect: 0
keywords tab: 0
line segment: 0
merge: 0
overlap: 0
paint: optional, 0
points: 0
polygon: 0
random pack tab: 0
rectangle: 0
redo: 0
reflection: 0
remove symmetry: 0
rotate: 0
rotation: 0
select: 0
set info tab: 0
smooth point: 0
snap: 0
star: 0
stats tab: 0
store symbol: 0
style tab: 0
subtract: 0
symmetric point: 0
symmetry: 0
undo: 0
tooltip:
add card: 0
add keyword: 0
add symmetry: 0
bar: 0
basic shapes: 0
bold: 0
border: 0
cards tab: 0
copy: 0
curve segment: 0
cut: 0
difference: 0
ellipse: 0
export: 0
free point: 0
grid: 0
intersect: 0
italic: 0
keywords tab: 0
line segment: 0
merge: 0
new set: 0
open set: 0
overlap: 0
paint: optional, 0
paste: 0
pie: 0
points: 0
polygon: 0
random pack tab: 0
rectangle: 0
redo: 1
reflection: 0
reminder text: 0
remove card: 0
remove keyword: 0
remove symmetry: 0
rotate: 0
rotate card: 0
rotation: 0
save set: 0
scatter: 0
scatter pie: 0
select: 0
set info tab: 0
smooth point: 0
snap: 0
stack: 0
star: 0
stats tab: 0
store symbol: 0
style tab: 0
subtract: 0
symbols: 0
symmetric point: 0
symmetry: 0
undo: 1
type:
boolean: 0
card: 0
cards: 0
circle: 0
collection: 0
collection of: 1
color: 0
date: 0
double: 0
ellipse: 0
export template: 0
field: 0
function: 0
game: 0
group: 0
hexagon: 0
image: 0
integer: 0
keyword: 0
keywords: 0
locale: optional, 0
nil: 0
object: 0
pack: 0
package: optional, 0
pentagon: 0
point: 0
points: 0
polygon: 0
rectangle: 0
reflection: 0
rhombus: 0
rotation: 0
set: 0
shape: 0
shapes: 0
square: 0
star: 0
string: 0
style: 0
stylesheet: 0
symbol: 0
triangle: 0
value: 0
# This file contains the keys expected to be in MSE locales
# It was automatically generated by tools/locale/locale.pl
# Generated on Sun Jan 16 14:30:12 2011
action:
add control point: 0
add item: 1
add symmetry: 0
auto replace: 0
backspace: 0
change: 1
change combine mode: 0
change shape name: 0
change symmetry copies: 0
change symmetry type: 0
convert to curve: 0
convert to line: 0
correct: 0
cut: 0
delete: 0
delete point: 0
delete points: 0
duplicate: 1
enter: 0
group parts: 0
insert symbol: 0
lock point: 0
move: 1
move curve: 0
move handle: 0
move symmetry center: 0
move symmetry handle: 0
paste: 0
remove item: 1
reorder parts: 0
rotate: 1
scale: 1
shear: 1
soft line break: 0
typing: 0
ungroup parts: 0
button:
add custom pack: 0
add item: 0
always: 0
browse: 0
check now: 0
check updates: 0
close: 0
defaults: 0
don't install package: 0
edit symbol: 0
enabled: 0
export custom cards selection: 0
export entire set: 0
export generated packs: 0
fixed seed: 0
generate pack: 0
hide: 0
high quality: 0
if internet connection exists: 0
insert parameter: 0
install group: optional, 0
install package: 0
keep old: 0
keep package: 0
last opened set: 0
move down: 0
move up: 0
never: 0
new set: 0
number: 0
number overwrite: 0
open set: 0
open sets in new window: 0
overwrite: 0
random seed: 0
refer parameter: 0
reinstall package: 0
remove group: optional, 0
remove item: 0
remove package: 0
select: optional, 0
select all: 0
select cards: 0
select none: 0
show: 0
show editing hints: 0
show lines: 0
spellcheck enabled: 0
symbol gallery: optional, 0
upgrade group: optional, 0
upgrade package: 0
use auto replace: 0
use custom styling options: 0
use for all cards: 0
whole word: 0
zoom export: 0
error:
aborting parsing: 0
can't convert: 2
can't convert value: 3
can't download installer: 2
cannot create file: 1
change packages successful: 1
checking updates failed: 0
coordinates for blending overlap: 0
dependency not given: 4
dimension not found: 1
downloading updates: 0
expected key: 1
file not found: 2
file not found package like: 2
file parse error: 2
has no member: 2
has no member value: 2
images used for blending must have the same size: 0
in function: 2
in keyword reminder: 2
in parameter: 2
install packages successful: 1
installing updates: 0
newer version: 2
no game specified: 1
no stylesheet specified for the set: 0
no updates: 0
pack type duplicate name: 1
pack type not found: 1
package not found: 1
package out of date: 3
package too new: 4
remove packages: 1
remove packages modified: 2
remove packages successful: 1
stylesheet and set refer to different game: 0
successful install: optional, 2
unable to open output file: 0
unable to store file: 0
unrecognized value: 2
unsupported field type: 1
unsupported fill type: 1
unsupported format: 1
word list type not found: 1
help:
about: 0
add card: 0
add cards: 0
add keyword: 0
add symmetry: 0
add to dictionary: optional, 0
app language: 0
auto replace: 0
bar: 0
basic shapes: 0
bold: 0
border: 0
card list columns: 0
cards tab: 0
check updates: 0
click to select shape: 0
close symbol editor: 0
collapse notes: 0
copies: 0
copy: 0
copy card: 0
copy keyword: 0
curve segment: 0
cut: 0
cut card: 0
cut keyword: 0
difference: 0
drag to draw shape: 0
drag to move curve: 0
drag to move line: 0
drag to move point: 0
drag to resize: 1
drag to rotate: 1
drag to shear: 1
draw ellipse: 0
draw polygon: 0
draw rectangle: 0
draw star: 0
duplicate: 0
edit pack type: 0
ellipse: 0
exit: 0
expand notes: 0
export: 0
export apprentice: 0
export html: 0
export image: 0
export images: 0
export mws: 0
filename format: 0
find: 0
find next: 0
fixed seed: 0
free point: 0
grid: 0
group: 0
index: 0
intersect: 0
italic: 0
keywords tab: 0
last opened set: 1
line segment: 0
merge: 0
new set: 0
new symbol: 0
new window: 0
next card: 0
next keyword: 0
no spelling suggestions: 0
number of packs: 1
open set: 0
open symbol: 0
orientation: 0
overlap: 0
paint: 0
paste: 0
paste card: 0
paste keyword: 0
pie: 0
points: 0
polygon: 0
preferences: 0
previous card: 0
previous keyword: 0
print: 0
print preview: 0
random pack tab: 0
random seed: 0
rectangle: 0
redo: 0
reflection: 0
reload data: 0
reminder text: 0
remove card: 0
remove keyword: 0
remove symmetry: 0
replace: 0
rotate: 0
rotate 0: 0
rotate 180: 0
rotate 270: 0
rotate 90: 0
rotate card: 0
rotation: 0
save set: 0
save set as: 0
save symbol: 0
save symbol as: 0
scatter: 0
scatter pie: 0
seed: 0
select: 0
set code: 0
set info tab: 0
show profiler: 0
sides: 0
smooth point: 0
snap: 0
stack: 0
star: 0
stats tab: 0
store symbol: 0
style tab: 0
subtract: 0
symbols: 0
symmetric point: 0
symmetry: 0
undo: 0
ungroup: 0
website: 0
welcome: 0
zoom export: 0
label:
app language: 0
apprentice: 0
apprentice exe: 0
apprentice export cancelled: 0
auto match: 0
auto replace: 0
card display: 0
card notes: 0
check at startup: 0
checking requires internet: 0
columns: 0
custom size: 0
export filenames: 0
external programs: 0
filename conflicts: 0
filename format: 0
filename is ignored: 0
filter: 0
fix aspect ratio: 0
force to fit: 0
game type: 0
html export options: 0
html template: 0
install package: 0
installable version: 0
installed version: 0
installer size: optional, 0
installer status: optional, 0
keyword: 0
language: 0
magic set editor package: optional, 0
match: 0
mode: 0
no version: 0
original: 0
original size: 0
pack name: 0
pack selection: 0
pack totals: 0
package action: 0
package conflicts: 0
package installable: 0
package installed: 0
package modified: 0
package name: 0
package status: 0
package updates: 0
percent of normal: 0
reinstall package: 0
reminder: 0
remove package: 0
result: 0
rules: 0
save changes: 1
search cards: 0
search keywords: 0
seed: 0
select cards: 0
select cards print: optional, 0
select columns: 0
selected card count: 1
selection: 0
selection height: 0
selection left: 0
selection top: 0
selection width: 0
set code: 0
sharpen filter: 0
sides: optional, 0
size: 0
size to fit: 0
standard keyword: 1
style type: 0
stylesheet not found: 1
styling options: 0
total cards: 0
upgrade package: 0
uses: 0
windows: 0
zoom: 0
zoom %: 0
zoom amount: 0
zoom amount x: 0
zoom amount y: 0
menu:
about: 0
add card: 0
add cards: 0
add keyword: 0
add to dictionary: optional, 0
auto replace: 0
bar: 0
basic shapes: 0
bold: 0
card list columns: 0
cards: 0
cards tab: 0
check updates: 0
close symbol editor: 0
copy: 0
cut: 0
duplicate: 0
edit: 0
exit: 0
export: 0
export apprentice: 0
export html: 0
export image: 0
export images: 0
export mws: 0
file: 0
find: 0
find next: 0
format: 0
graph: 0
group: 0
help: 0
index: 0
insert symbol: 0
italic: 0
keywords: 0
keywords tab: 0
new set: 0
new symbol: 0
new window: 0
next card: 0
next keyword: 0
no spelling suggestions: 0
open set: 0
open symbol: 0
orientation: 0
paint: 0
paste: 0
pie: 0
points: 0
preferences: 0
previous card: 0
previous keyword: 0
print: 0
print preview: 0
random pack tab: 0
redo: 1
reload data: 0
reminder text: 0
remove card: 0
remove keyword: 0
replace: 0
rotate: 0
rotate 0: 0
rotate 180: 0
rotate 270: 0
rotate 90: 0
save set: 0
save set as: 0
save symbol: 0
save symbol as: 0
scatter: 0
scatter pie: 0
select: 0
set info tab: 0
show profiler: 0
stack: 0
stats tab: 0
store symbol: 0
style tab: 0
symbols: 0
symmetry: 0
tool: 0
undo: 1
ungroup: 0
website: 0
window: 0
title:
%s - magic set editor: 1
about: 0
auto replaces: 0
cannot create file: 0
custom pack: 0
directories: 0
display: 0
export cancelled: 0
export html: 0
export images: 0
global: 0
installing updates: 0
locate apprentice: 0
magic set editor: 0
new set: 0
open set: 0
packages window: 0
preferences: 0
print preview: 0
save changes: 0
save html: 0
save image: 0
save set: 0
select cards: 0
select cards export: 0
select columns: 0
select stylesheet: 0
slice image: 0
symbol editor: 0
untitled: 0
update check: 0
updates: 0
updates available: 0
tool:
add symmetry: 0
basic shapes: 0
border: 0
cards tab: 0
curve segment: 0
difference: 0
ellipse: 0
free point: 0
grid: 0
intersect: 0
keywords tab: 0
line segment: 0
merge: 0
overlap: 0
paint: optional, 0
points: 0
polygon: 0
random pack tab: 0
rectangle: 0
redo: 0
reflection: 0
remove symmetry: 0
rotate: 0
rotation: 0
select: 0
set info tab: 0
smooth point: 0
snap: 0
star: 0
stats tab: 0
store symbol: 0
style tab: 0
subtract: 0
symmetric point: 0
symmetry: 0
undo: 0
tooltip:
add card: 0
add keyword: 0
add symmetry: 0
bar: 0
basic shapes: 0
bold: 0
border: 0
cards tab: 0
copy: 0
curve segment: 0
cut: 0
difference: 0
ellipse: 0
export: 0
free point: 0
grid: 0
intersect: 0
italic: 0
keywords tab: 0
line segment: 0
merge: 0
new set: 0
open set: 0
overlap: 0
paint: optional, 0
paste: 0
pie: 0
points: 0
polygon: 0
random pack tab: 0
rectangle: 0
redo: 1
reflection: 0
reminder text: 0
remove card: 0
remove keyword: 0
remove symmetry: 0
rotate: 0
rotate card: 0
rotation: 0
save set: 0
scatter: 0
scatter pie: 0
select: 0
set info tab: 0
smooth point: 0
snap: 0
stack: 0
star: 0
stats tab: 0
store symbol: 0
style tab: 0
subtract: 0
symbols: 0
symmetric point: 0
symmetry: 0
undo: 1
type:
boolean: 0
card: 0
cards: 0
circle: 0
collection: 0
collection of: 1
color: 0
date: 0
double: 0
ellipse: 0
export template: 0
field: 0
function: 0
game: 0
group: 0
hexagon: 0
image: 0
integer: 0
keyword: 0
keywords: 0
locale: optional, 0
nil: 0
object: 0
pack: 0
package: optional, 0
pentagon: 0
point: 0
points: 0
polygon: 0
rectangle: 0
reflection: 0
rhombus: 0
rotation: 0
set: 0
shape: 0
shapes: 0
square: 0
star: 0
string: 0
style: 0
stylesheet: 0
symbol: 0
triangle: 0
value: 0
......@@ -105,7 +105,6 @@ enum ChildMenuID {
, ID_CARD_ROTATE_90
, ID_CARD_ROTATE_180
, ID_CARD_ROTATE_270
, ID_CARD_FILTER
// CardList
, ID_SELECT_COLUMNS
......@@ -181,6 +180,7 @@ enum ChildMenuID {
// On cards panel
, ID_COLLAPSE_NOTES = 8001
, ID_CARD_FILTER
// Style panel
, ID_STYLE_USE_FOR_ALL = 8011
......@@ -190,6 +190,7 @@ enum ChildMenuID {
, ID_KEYWORD_ADD_PARAM = 8021
, ID_KEYWORD_REF_PARAM
, ID_KEYWORD_MODE
, ID_KEYWORD_FILTER
, ID_PARAM_TYPE_MIN = 8101
, ID_PARAM_TYPE_MAX = 8200
, ID_PARAM_REF_MIN = 8201
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment