1 #include <msp/strings/format.h>
12 Zone::Zone(Layout &l):
24 void Zone::set_name(const string &g, const string &q, unsigned n)
30 signal_name_changed.emit(group, qualifier, number);
33 string Zone::get_name() const
35 string result = group;
36 if(!qualifier.empty())
42 result += format(" %d", number);
46 void Zone::save(list<DataFile::Statement> &st) const
48 st.push_back((DataFile::Statement("group"), group));
49 if(!qualifier.empty())
50 st.push_back((DataFile::Statement("qualifier"), qualifier));
52 st.push_back((DataFile::Statement("number"), number));
54 set<unsigned> block_ids;
55 for(TrackSet::const_iterator i=tracks.begin(); i!=tracks.end(); ++i)
56 block_ids.insert((*i)->get_block().get_id());
58 for(set<unsigned>::const_iterator i=block_ids.begin(); i!=block_ids.end(); ++i)
59 st.push_back((DataFile::Statement("block"), *i));
63 Zone::Loader::Loader(Zone &z):
64 DataFile::ObjectLoader<Zone>(z)
66 add("block", &Loader::block);
67 add("group", &Zone::group);
68 add("number", &Zone::number);
69 add("qualifier", &Zone::qualifier);
72 void Zone::Loader::block(unsigned b)
74 Block &blk = obj.layout.get_block(b);
75 const set<Track *> &btracks = blk.get_tracks();
76 obj.tracks.insert(btracks.begin(), btracks.end());