{
list<FilterStatement> st;
st.push_back(FilterStatement());
+ st.back().set_show(i->show);
i->appearance.add_lines(st.back());
i->category->create_statements(st);
for(list<FilterStatement>::const_iterator j=st.begin(); j!=st.end(); ++j)
j->write(out);
}
-
- out.write("# unmatched\nHide\n");
}
return c1->get_order()<c2->get_order();
}
-void Filter::Loader::hide(const string &name)
-{
- list<const Category *> categs;
- if(name.find('*')!=string::npos)
- {
- poe.find_categories(glob_to_re(name), categs);
-
- if(categs.empty())
- throw key_error(name);
- }
- else
- categs.push_back(&poe.get_category(name));
-
- for(list<const Category *>::const_iterator i=categs.begin(); i!=categs.end(); ++i)
- for(list<Block>::iterator j=obj.blocks.begin(); j!=obj.blocks.end(); ++j)
- if(j->category==*i)
- {
- obj.blocks.erase(j);
- break;
- }
-}
-
-void Filter::Loader::include(const string &name)
-{
- const Filter &base = poe.get_filter(name);
- obj.blocks.insert(obj.blocks.end(), base.blocks.begin(), base.blocks.end());
-}
-
-void Filter::Loader::show(const string &name)
+void Filter::Loader::add_categories(const string &name, bool show)
{
list<const Category *> categs;
if(name.find('*')!=string::npos)
if(!found)
{
Block blk;
+ blk.show = show;
blk.category = *i;
blk.appearance = (*i)->get_appearance();
if(const Appearance *app = poe.get_theme().find_appearance((*i)->get_name()))
}
}
}
+
+void Filter::Loader::cancel(const string &name)
+{
+ list<const Category *> categs;
+ if(name.find('*')!=string::npos)
+ {
+ poe.find_categories(glob_to_re(name), categs);
+
+ if(categs.empty())
+ throw key_error(name);
+ }
+ else
+ categs.push_back(&poe.get_category(name));
+
+ for(list<const Category *>::const_iterator i=categs.begin(); i!=categs.end(); ++i)
+ for(list<Block>::iterator j=obj.blocks.begin(); j!=obj.blocks.end(); ++j)
+ if(j->category==*i)
+ {
+ obj.blocks.erase(j);
+ break;
+ }
+}
+
+void Filter::Loader::hide(const string &name)
+{
+ add_categories(name, false);
+}
+
+void Filter::Loader::include(const string &name)
+{
+ const Filter &base = poe.get_filter(name);
+ obj.blocks.insert(obj.blocks.end(), base.blocks.begin(), base.blocks.end());
+}
+
+void Filter::Loader::show(const string &name)
+{
+ add_categories(name, true);
+}
private:
static std::string glob_to_re(const std::string &);
static bool category_order(const Category *, const Category *);
+ void add_categories(const std::string &, bool);
+ void cancel(const std::string &);
void hide(const std::string &);
void include(const std::string &);
void show(const std::string &);
private:
struct Block
{
+ bool show;
const Category *category;
Appearance appearance;
};