]> Shamusworld >> Repos - architektonas/blobdiff - src/widgets/blockwidget.cpp
Phase two of adding polyline functionality...
[architektonas] / src / widgets / blockwidget.cpp
index ff518bd7bc1616bd80109b047190241644621e92..a6b2e47df5c4247c9b223fdd6a897c5ffdf875d4 100644 (file)
 #include "blockwidget.h"
 
 #include "actionhandler.h"
-#include "rs_block.h"
-#include "rs_blocklist.h"
-#include "rs_debug.h"
+#include "block.h"
+#include "blocklist.h"
+#include "debug.h"
 
 /**
  * Constructor.
  */
-QG_BlockWidget::QG_BlockWidget(QG_ActionHandler * ah, QWidget * parent, const char * name, Qt::WFlags f):
+BlockWidget::BlockWidget(ActionHandler * ah, QWidget * parent, const char * name, Qt::WFlags f):
 //     QWidget(parent, name, f),
        QWidget(parent, f),
        pxmVisible(":/res/visibleblock.xpm"),
@@ -150,18 +150,18 @@ QG_BlockWidget::QG_BlockWidget(QG_ActionHandler * ah, QWidget * parent, const ch
 /**
  * Destructor
  */
-QG_BlockWidget::~QG_BlockWidget()
+BlockWidget::~BlockWidget()
 {
        delete listBox;
 }
 
-void QG_BlockWidget::setBlockList(RS_BlockList * blockList)
+void BlockWidget::setBlockList(BlockList * blockList)
 {
        this->blockList = blockList;
        update();
 }
 
-RS_BlockList * QG_BlockWidget::getBlockList()
+BlockList * BlockWidget::getBlockList()
 {
        return blockList;
 }
@@ -169,14 +169,14 @@ RS_BlockList * QG_BlockWidget::getBlockList()
 /**
  * Updates the block box from the blocks in the graphic.
  */
-void QG_BlockWidget::update()
+void BlockWidget::update()
 {
-       RS_DEBUG->print("QG_BlockWidget::update()");
+       DEBUG->print("BlockWidget::update()");
 
 #warning "!!!"
 //     int yPos = listBox->contentsY();
 
-       RS_Block * activeBlock = NULL;
+       Block * activeBlock = NULL;
 
        if (blockList)
                activeBlock = blockList->getActive();
@@ -185,13 +185,13 @@ void QG_BlockWidget::update()
 
        if (!blockList)
        {
-               RS_DEBUG->print("QG_BlockWidget::update(): blockList is NULL");
+               DEBUG->print("BlockWidget::update(): blockList is NULL");
                return;
        }
 
        for(uint i=0; i<blockList->count(); ++i)
        {
-               RS_Block * blk = blockList->at(i);
+               Block * blk = blockList->at(i);
 
                if (!blk->isFrozen())
 //                     listBox->insertItem(pxmVisible, blk->getName());
@@ -204,7 +204,7 @@ void QG_BlockWidget::update()
 //     listBox->sort();
        listBox->sortItems(Qt::AscendingOrder);
 
-       RS_Block * b = lastBlock;
+       Block * b = lastBlock;
        highlightBlock(activeBlock);
        lastBlock = b;
 #warning "!!!"
@@ -212,16 +212,16 @@ void QG_BlockWidget::update()
 
        //highlightBlock(blockList->getActiveBlock());
        //listBox->setContentsPos(0, yPos);
-       RS_DEBUG->print("QG_BlockWidget::update() done");
+       DEBUG->print("BlockWidget::update() done");
 }
 
 /**
  * Highlights (activates) the given block and makes it
  * the active block in the blocklist.
  */
-void QG_BlockWidget::highlightBlock(RS_Block * block)
+void BlockWidget::highlightBlock(Block * block)
 {
-       RS_DEBUG->print("QG_BlockWidget::highlightBlock()");
+       DEBUG->print("BlockWidget::highlightBlock()");
 
        if (!block || !listBox)
                return;
@@ -241,22 +241,22 @@ void QG_BlockWidget::highlightBlock(RS_Block * block)
        }
 }
 
-/*virtual*/ void QG_BlockWidget::blockAdded(RS_Block *)
+/*virtual*/ void BlockWidget::blockAdded(Block *)
 {
        update();
 }
 
-/*virtual*/ void QG_BlockWidget::blockEdited(RS_Block *)
+/*virtual*/ void BlockWidget::blockEdited(Block *)
 {
        update();
 }
 
-/*virtual*/ void QG_BlockWidget::blockRemoved(RS_Block *)
+/*virtual*/ void BlockWidget::blockRemoved(Block *)
 {
        update();
 }
 
-/*virtual*/ void QG_BlockWidget::blockToggled(RS_Block *)
+/*virtual*/ void BlockWidget::blockToggled(Block *)
 {
        update();
 }
@@ -266,15 +266,15 @@ void QG_BlockWidget::highlightBlock(RS_Block * block)
  * an item is double clicked.
  */
 /*
-void QG_BlockWidget::slotToggleView(QListBoxItem* item) {
-    RS_DEBUG->print("QG_BlockWidget::slotToggleView()");
+void BlockWidget::slotToggleView(QListBoxItem* item) {
+    DEBUG->print("BlockWidget::slotToggleView()");
 
     if (item==NULL || blockList==NULL) {
         return;
     }
 
     int index = listBox->index(item);
-    RS_Block* block = blockList->find(item->text());
+    Block* block = blockList->find(item->text());
 
     if (block!=NULL) {
         blockList->toggleBlock(item->text());
@@ -291,11 +291,11 @@ void QG_BlockWidget::slotToggleView(QListBoxItem* item) {
 /**
  * Called when the user activates (highlights) a block.
  */
-//void QG_BlockWidget::slotActivated(const QString & blockName)
-void QG_BlockWidget::slotActivated(void)
+//void BlockWidget::slotActivated(const QString & blockName)
+void BlockWidget::slotActivated(void)
 {
        QString blockName = listBox->currentItem()->text();
-       RS_DEBUG->print("QG_BlockWidget::slotActivated(): %s", blockName.toLatin1().data());
+       DEBUG->print("BlockWidget::slotActivated(): %s", blockName.toLatin1().data());
 
        if (!blockList)
                return;
@@ -307,12 +307,13 @@ void QG_BlockWidget::slotActivated(void)
 /**
  * Called for every mouse click.
  */
-//void QG_BlockWidget::slotMouseButtonClicked(int /*button*/, Q3ListBoxItem* item, const QPoint& pos)
-void QG_BlockWidget::slotMouseButtonClicked(QListWidgetItem * item)
+//void BlockWidget::slotMouseButtonClicked(int /*button*/, Q3ListBoxItem* item, const QPoint& pos)
+void BlockWidget::slotMouseButtonClicked(QListWidgetItem * item)
 {
        QPoint p = mapFromGlobal(QCursor::pos());
-       RS_Block * b = lastBlock;
+       Block * b = lastBlock;
 
+//This is crap. We need to fix this so it's not so shitty.
        if (p.x() < 23)
        {
                actionHandler->slotBlocksToggleView();
@@ -328,7 +329,7 @@ void QG_BlockWidget::slotMouseButtonClicked(QListWidgetItem * item)
 /**
  * Shows a context menu for the block widget. Launched with a right click.
  */
-void QG_BlockWidget::contextMenuEvent(QContextMenuEvent * e)
+void BlockWidget::contextMenuEvent(QContextMenuEvent * e)
 {
 #if 0
        //QListBoxItem* item = listBox->selectedItem();
@@ -359,7 +360,7 @@ void QG_BlockWidget::contextMenuEvent(QContextMenuEvent * e)
 /**
  * Escape releases focus.
  */
-void QG_BlockWidget::keyPressEvent(QKeyEvent * e)
+void BlockWidget::keyPressEvent(QKeyEvent * e)
 {
        switch (e->key())
        {