86 const std::set<GUIGlID>&
152 throw ProcessError(
"Unkown object in GUISelectedStorage::toggleSelection (id=" +
toString(
id) +
").");
165 const std::set<GUIGlID>&
171 const std::set<GUIGlID>&
179 for (std::map<GUIGlObjectType, SingleTypeSelections>::iterator it =
mySelections.begin(); it !=
mySelections.end(); it++) {
191 std::set<GUIGlID> result;
192 std::ostringstream msg;
193 std::ifstream strm(filename.c_str());
197 msgOut =
"Could not open '" + filename +
"'.\n";
200 while (strm.good()) {
203 if (line.length() == 0) {
211 if (numIgnored + numMissing <= maxErrors) {
212 msg <<
"Ignoring item '" << line <<
"' because of invalid type " <<
toString(object->
getType()) <<
"\n";
215 result.insert(object->
getGlID());
219 if (numIgnored + numMissing <= maxErrors) {
220 msg <<
"Item '" + line +
"' not found\n";
226 if (numIgnored + numMissing > maxErrors) {
227 msg <<
"...\n" << numIgnored <<
" objects ignored, " << numMissing <<
" objects not found\n";
237 const std::set<GUIGlID> ids =
loadIDs(filename, errors, type);
238 for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
275 for (std::set<GUIGlID>::const_iterator i = ids.begin(); i != ids.end(); ++i) {
virtual void selectionUpdated()=0
called when selection is updated
void close()
Closes the device and removes it from the dictionary.
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
~GUISelectedStorage()
Destructor.
std::set< GUIGlID > mySelected
The list of selected ids.
void toggleSelection(GUIGlID id)
Toggles selection of an object.
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
void remove2Update()
Removes the dialog to be updated.
std::set< GUIGlID > myAllSelected
List of selected objects.
void clear()
Clears the list of selected objects.
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
void save(const std::string &filename)
Saves the list of selected objects to a file named as given.
std::map< GUIGlObjectType, SingleTypeSelections > mySelections
map with the selections
std::set< GUIGlID > loadIDs(const std::string &filename, std::string &msgOut, GUIGlObjectType type=GLO_MAX, int maxErrors=16)
Loads a selection list (optionally with restricted type) and returns the ids of all active objects...
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
void select(GUIGlID id)
Adds the object with the given id to the list of selected objects.
std::string load(const std::string &filename, GUIGlObjectType type=GLO_MAX)
Loads a selection list (optionally with restricted type)
SingleTypeSelections()
Constructor.
~SingleTypeSelections()
Destructor.
void deselect(GUIGlID id)
Deselects the object with the given id from the list of selected objects.
const std::set< GUIGlID > & getSelected() const
Returns the list of selected ids.
void deselect(GUIGlID id)
Deselects the object with the given id.
void add2Update(UpdateTarget *updateTarget)
Adds a dialog to be updated.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
void clear()
Clears the list of selected objects.
GUIGlID getGlID() const
Returns the numerical id of the object.
Static storage of an output device and its base (abstract) implementation.
bool isSelected(GUIGlID id)
Returns the information whether the object with the given id is qithin the selection.
void unblockObject(GUIGlID id)
Marks an object as unblocked.
const std::string & getFullName() const
GUISelectedStorage()
Constructor.
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
void save(GUIGlObjectType type, const std::string &filename)
Saves a selection list.
UpdateTarget * myUpdateTarget
The dialog to be updated.