X-Git-Url: http://git.tdb.fi/?p=poefilter.git;a=blobdiff_plain;f=source%2Fcategory.cpp;h=4ceed1883df32f7e971bd8dcb594795f64fa831c;hp=8b0d442ea8d572c016fe4f01fb9c891109b23ffd;hb=0388bdcffe5c2c3e720afa9aa911268eac9c32de;hpb=74086c211f082f6f47c3d038dd308a257a81e006 diff --git a/source/category.cpp b/source/category.cpp index 8b0d442..4ceed18 100644 --- a/source/category.cpp +++ b/source/category.cpp @@ -8,12 +8,14 @@ using namespace std; using namespace Msp; -Category::Category(): +Category::Category(const string &n): + name(n), condition(0), order(0) { } Category::Category(const Category &other): + name(other.name), condition(other.condition ? other.condition->clone() : 0), order(other.order), appearance(other.appearance) @@ -22,6 +24,7 @@ Category::Category(const Category &other): Category &Category::operator=(const Category &other) { delete condition; + name = other.name; condition = (other.condition ? other.condition->clone() : 0); order = other.order; appearance = other.appearance; @@ -35,24 +38,8 @@ Category::~Category() void Category::create_statements(list &st) const { - st.clear(); - st.push_back(FilterStatement()); - st.back().add_line(format("SetFontSize %d", appearance.get_font_size())); - - const Color &bg_color = appearance.get_background_color(); - if(bg_color.defined) - st.back().add_line(format("SetBackgroundColor %d %d %d", bg_color.r, bg_color.g, bg_color.b)); - - const Color &brd_color = appearance.get_border_color(); - if(brd_color.defined) - st.back().add_line(format("SetBorderColor %d %d %d", brd_color.r, brd_color.g, brd_color.b)); - - const Color &txt_color = appearance.get_text_color(); - if(txt_color.defined) - st.back().add_line(format("SetTextColor %d %d %d", txt_color.r, txt_color.g, txt_color.b)); - - if(appearance.get_sound_type()) - st.back().add_line(format("PlayAlertSound %d %d", appearance.get_sound_type(), appearance.get_sound_volume())); + if(st.empty()) + st.push_back(FilterStatement()); if(condition) condition->add_lines(st); @@ -63,10 +50,9 @@ Category::Loader::Loader(Category &c, const PoeFilter &p, CompoundCondition *n): DataFile::ObjectLoader(c), poe(p), compound(n), - app_loader(c.appearance, p.get_theme()) + app_loader(c.appearance) { add("and", &Loader::and_); - add("appearance", &Loader::appearance); add("base_type", &Loader::condition); add("class", &Loader::condition); add_range("drop_level"); @@ -116,11 +102,6 @@ void Category::Loader::and_() add_condition(cond.release()); } -void Category::Loader::appearance(const std::string &name) -{ - obj.appearance = poe.get_theme().get_appearance(name); -} - template void Category::Loader::condition(typename T::Type value) {