* If so, the blocks will be deleted when the block
* list is deleted.
*/
-RS_BlockList::RS_BlockList(bool owner)
+BlockList::BlockList(bool owner)
{
this->owner = owner;
//blocks.setAutoDelete(owner);
setModified(false);
}
-/*virtual*/ RS_BlockList::~RS_BlockList()
+/*virtual*/ BlockList::~BlockList()
{
}
/**
* Removes all blocks in the blocklist.
*/
-void RS_BlockList::clear()
+void BlockList::clear()
{
blocks.clear();
setModified(true);
/**
* @return Number of blocks available.
*/
-uint RS_BlockList::count()
+uint BlockList::count()
{
return blocks.count();
}
/**
* @return Block at given position or NULL if i is out of range.
*/
-RS_Block * RS_BlockList::at(uint i)
+Block * BlockList::at(uint i)
{
return blocks.at(i);
}
* Activates the given block.
* Listeners are notified.
*/
-void RS_BlockList::activate(const QString & name)
+void BlockList::activate(const QString & name)
{
- RS_DEBUG->print("RS_BlockList::activateBlock");
+ DEBUG->print("BlockList::activateBlock");
activate(find(name));
}
* Activates the given block.
* Listeners are notified.
*/
-void RS_BlockList::activate(RS_Block * block)
+void BlockList::activate(Block * block)
{
- RS_DEBUG->print("RS_BlockList::activateBlock");
+ DEBUG->print("BlockList::activateBlock");
activeBlock = block;
/*
for (uint i=0; i<blockListListeners.count(); ++i) {
- RS_BlockListListener* l = blockListListeners.at(i);
+ BlockListListener* l = blockListListeners.at(i);
if (l!=NULL) {
l->blockActivated(activeBlock);
}
}
//! @return The active block of NULL if no block is activated.
-RS_Block * RS_BlockList::getActive()
+Block * BlockList::getActive()
{
return activeBlock;
}
*
* @return false: block already existed and was deleted.
*/
-bool RS_BlockList::add(RS_Block * block, bool notify)
+bool BlockList::add(Block * block, bool notify)
{
- RS_DEBUG->print("RS_BlockList::add()");
+ DEBUG->print("BlockList::add()");
if (block == NULL)
return false;
// check if block already exists:
- RS_Block * b = find(block->getName());
+ Block * b = find(block->getName());
if (b == NULL)
{
* used after adding a lot of blocks without auto-update or simply
* to force an update of GUI blocklists.
*/
-void RS_BlockList::addNotification()
+void BlockList::addNotification()
{
#if 0
for(int i=0; i<blockListListeners.count(); ++i)
{
- RS_BlockListListener * l = blockListListeners.at(i);
+ BlockListListener * l = blockListListeners.at(i);
l->blockAdded(NULL);
}
#endif
* Listeners are notified after the block was removed from
* the list but before it gets deleted.
*/
-void RS_BlockList::remove(RS_Block * block)
+void BlockList::remove(Block * block)
{
- RS_DEBUG->print("RS_BlockList::removeBlock()");
+ DEBUG->print("BlockList::removeBlock()");
// here the block is removed from the list but not deleted
// blocks.remove(block);
#if 0
for(int i=0; i<blockListListeners.count(); ++i)
{
- RS_BlockListListener * l = blockListListeners.at(i);
+ BlockListListener * l = blockListListeners.at(i);
l->blockRemoved(block);
}
#endif
* @retval true block was successfully renamed.
* @retval false block couldn't be renamed.
*/
-bool RS_BlockList::rename(RS_Block * block, const QString & name)
+bool BlockList::rename(Block * block, const QString & name)
{
if (block != NULL)
{
* Listeners are notified.
*/
/*
-void RS_BlockList::editBlock(RS_Block* block, const RS_Block& source) {
+void BlockList::editBlock(Block* block, const Block& source) {
*block = source;
for (uint i=0; i<blockListListeners.count(); ++i) {
- RS_BlockListListener* l = blockListListeners.at(i);
+ BlockListListener* l = blockListListeners.at(i);
l->blockEdited(block);
}
* @return Pointer to the block with the given name or
* \p NULL if no such block was found.
*/
-RS_Block * RS_BlockList::find(const QString & name)
+Block * BlockList::find(const QString & name)
{
- //RS_DEBUG->print("RS_BlockList::find");
+ //DEBUG->print("BlockList::find");
for(uint i=0; i<count(); i++)
{
- RS_Block * b = at(i);
+ Block * b = at(i);
if (b->getName() == name)
return b;
*
* @param suggestion Suggested name the new name will be based on.
*/
-QString RS_BlockList::newName(const QString & suggestion)
+QString BlockList::newName(const QString & suggestion)
{
QString name;
* Switches on / off the given block.
* Listeners are notified.
*/
-void RS_BlockList::toggle(const QString & name)
+void BlockList::toggle(const QString & name)
{
toggle(find(name));
}
* Switches on / off the given block.
* Listeners are notified.
*/
-void RS_BlockList::toggle(RS_Block * block)
+void BlockList::toggle(Block * block)
{
if (block == NULL)
return;
// Notify listeners:
for(int i=0; i<blockListListeners.count(); ++i)
{
- RS_BlockListListener * l = blockListListeners.at(i);
+ BlockListListener * l = blockListListeners.at(i);
l->blockToggled(block);
}
*
* @param freeze true: freeze, false: defreeze
*/
-void RS_BlockList::freezeAll(bool freeze)
+void BlockList::freezeAll(bool freeze)
{
for(uint l=0; l<count(); l++)
at(l)->freeze(freeze);
#if 0
for(int i=0; i<blockListListeners.count(); ++i)
{
- RS_BlockListListener * l = blockListListeners.at(i);
+ BlockListListener * l = blockListListeners.at(i);
l->blockToggled(NULL);
}
#endif
* Listeners are notified.
*/
/*
-void RS_BlockList::toggleBlock(const QString& name) {
- RS_Block* block = findBlock(name);
+void BlockList::toggleBlock(const QString& name) {
+ Block* block = findBlock(name);
block->toggle();
// Notify listeners:
for (uint i=0; i<blockListListeners.count(); ++i) {
- RS_BlockListListener* l = blockListListeners.at(i);
+ BlockListListener* l = blockListListeners.at(i);
l->blockToggled(block);
}
* are notified when the block list changes.
*/
#if 0
-void RS_BlockList::addListener(RS_BlockListListener * listener)
+void BlockList::addListener(BlockListListener * listener)
{
blockListListeners.append(listener);
}
/**
* removes a BlockListListener from the list of listeners.
*/
-void RS_BlockList::removeListener(RS_BlockListListener * listener)
+void BlockList::removeListener(BlockListListener * listener)
{
blockListListeners.removeAll(listener);
}
/**
* Sets the layer lists modified status to 'm'.
*/
-void RS_BlockList::setModified(bool m)
+void BlockList::setModified(bool m)
{
modified = m;
}
* @retval true The layer list has been modified.
* @retval false The layer list has not been modified.
*/
-/*virtual*/ bool RS_BlockList::isModified() const
+/*virtual*/ bool BlockList::isModified() const
{
return modified;
}
/**
* Dumps the blocks to stdout.
*/
-std::ostream & operator<<(std::ostream & os, RS_BlockList & b)
+std::ostream & operator<<(std::ostream & os, BlockList & b)
{
os << "Blocklist: \n";
for(uint i=0; i<b.count(); ++i)
{
- RS_Block * blk = b.at(i);
+ Block * blk = b.at(i);
os << *blk << "\n";
}