// Who When What
// --- ---------- -----------------------------------------------------------
// JLH 05/28/2010 Added this text. :-)
+// JLH 09/09/2010 Removed implementation from header (where it DOESN'T
+// belong) and moved it here (where it DOES)
//
#include "clipboard.h"
+
#include "block.h"
#include "layer.h"
#include "entity.h"
-RS_Clipboard* RS_Clipboard::uniqueInstance = NULL;
-
-
+Clipboard * Clipboard::uniqueInstance = NULL;
-void RS_Clipboard::clear() {
+void Clipboard::clear()
+{
graphic.clear();
graphic.clearBlocks();
graphic.clearLayers();
graphic.clearVariables();
}
+void Clipboard::addBlock(Block * b)
+{
+ if (b)
+ graphic.addBlock(b, false);
+}
+bool Clipboard::hasBlock(const QString & name)
+{
+ return (graphic.findBlock(name) != NULL);
+}
+void Clipboard::addLayer(Layer * l)
+{
+ if (l)
+ graphic.addLayer(l);
+}
+bool Clipboard::hasLayer(const QString & name)
+{
+ return (graphic.findLayer(name) != NULL);
+}
-void RS_Clipboard::addBlock(RS_Block* b) {
- if (b!=NULL) {
- graphic.addBlock(b, false);
+void Clipboard::addEntity(Entity * e)
+{
+ if (e)
+ {
+ graphic.addEntity(e);
+ e->reparent(&graphic);
}
}
+/**
+ * Dumps the clipboard contents to stdout.
+ */
+std::ostream & operator<<(std::ostream & os, Clipboard & cb)
+{
+ os << "Clipboard: " << cb.graphic << "\n";
+ return os;
+}
-bool RS_Clipboard::hasBlock(const QString& name) {
- return (graphic.findBlock(name)!=NULL);
+Clipboard::Clipboard()
+{
}
+/**
+ * @return Instance to the unique clipboard object.
+ */
+/*static*/ Clipboard * Clipboard::instance()
+{
+ if (uniqueInstance == NULL)
+ uniqueInstance = new Clipboard();
-void RS_Clipboard::addLayer(RS_Layer* l) {
- if (l!=NULL) {
- //graphic.addLayer(l->clone());
- graphic.addLayer(l);
- }
+ return uniqueInstance;
}
+int Clipboard::countBlocks()
+{
+ return graphic.countBlocks();
+}
+Block * Clipboard::blockAt(int i)
+{
+ return graphic.blockAt(i);
+}
-bool RS_Clipboard::hasLayer(const QString& name) {
- return (graphic.findLayer(name)!=NULL);
+int Clipboard::countLayers()
+{
+ return graphic.countLayers();
}
+Layer * Clipboard::layerAt(int i)
+{
+ return graphic.layerAt(i);
+}
+uint Clipboard::count()
+{
+ return graphic.count();
+}
-void RS_Clipboard::addEntity(RS_Entity* e) {
- if (e!=NULL) {
- //graphic.addEntity(e->clone());
- graphic.addEntity(e);
- e->reparent(&graphic);
- }
+Entity * Clipboard::entityAt(uint i)
+{
+ return graphic.entityAt(i);
}
-/**
- * Dumps the clipboard contents to stdout.
- */
-std::ostream& operator << (std::ostream& os, RS_Clipboard& cb) {
- os << "Clipboard: " << cb.graphic << "\n";
+Entity * Clipboard::firstEntity()
+{
+ return graphic.firstEntity();
+}
- return os;
+Entity * Clipboard::nextEntity()
+{
+ return graphic.nextEntity();
}
+Drawing * Clipboard::getGraphic()
+{
+ return &graphic;
+}