1
0
mirror of git://projects.qi-hardware.com/nn-usb-fpga.git synced 2025-04-21 12:27:27 +03:00

First functional example, ADC an Framebuffer Test

This commit is contained in:
Juan64Bits
2010-12-04 15:12:02 -05:00
parent 62d0edf217
commit 8d95564253
138 changed files with 14826 additions and 538 deletions

View File

@@ -0,0 +1,45 @@
<!--File for SIE Code Generator. Custmos Blocks-->
<CustomItem BlockName="ADC Eight">
<Polygon>
<Point x="-80" y="20"/>
<Point x="-60" y="-60"/>
<Point x="30" y="-60"/>
<Point x="30" y="100"/>
<Point x="110" y="100"/>
<Point x="110" y="-60"/>
<Point x="30" y="-60"/>
<Point x="110" y="-60"/>
<Point x="110" y="100"/>
<Point x="-60" y="100"/>
</Polygon>
<TextItems>
<TextItem myStyleIO="0" posOffset-y="-70" editableItem="1" ID="10" text="255" posOffset-x="-20"/>
<TextItem myStyleIO="0" posOffset-y="-50" editableItem="0" ID="9" text="Clock Divisor" posOffset-x="-20"/>
<TextItem myStyleIO="10" posOffset-y="-90" editableItem="0" ID="8" text="CH7 UShort" posOffset-x="110"/>
<TextItem myStyleIO="10" posOffset-y="-70" editableItem="0" ID="7" text="CH6 UShort" posOffset-x="110"/>
<TextItem myStyleIO="10" posOffset-y="-50" editableItem="0" ID="6" text="CH5 UShort" posOffset-x="110"/>
<TextItem myStyleIO="10" posOffset-y="-30" editableItem="0" ID="5" text="CH4 UShort" posOffset-x="110"/>
<TextItem myStyleIO="10" posOffset-y="-10" editableItem="0" ID="4" text="CH3 UShort" posOffset-x="110"/>
<TextItem myStyleIO="10" posOffset-y="10" editableItem="0" ID="3" text="CH2 UShort" posOffset-x="110"/>
<TextItem myStyleIO="10" posOffset-y="30" editableItem="0" ID="2" text="CH1 UShort" posOffset-x="110"/>
<TextItem myStyleIO="10" posOffset-y="50" editableItem="0" ID="1" text="CH0 UShort" posOffset-x="110"/>
<TextItem myStyleIO="0" posOffset-y="10" editableItem="0" ID="0" text="ADC 8 Channels" posOffset-x="-20"/>
</TextItems><![CDATA[]]><![CDATA[
ADC_SPI_CLKDIV=value_10;
ADC_BUFFER_LEN=8;
ADC_MUX_CHANNELS=7;
]]><![CDATA[
JZ_REG * ADC_DATA = ADCTakeSamples(ADCBuffer,0);
unsigned int sampleData = ADC_DATA[0];
out_1 = (sampleData>>16)&0xFFFF;
out_2 = sampleData&0xFFFF;
sampleData = ADC_DATA[1];
out_3 = (sampleData>>16)&0xFFFF;
out_4 = sampleData&0xFFFF;
sampleData = ADC_DATA[2];
out_5 = (sampleData>>16)&0xFFFF;
out_6 = sampleData&0xFFFF;
sampleData = ADC_DATA[3];
out_7 = (sampleData>>16)&0xFFFF;
out_8 = sampleData&0xFFFF;
]]><![CDATA[]]></CustomItem>

36
Software/sie_cg/block_editor/adc_single.die Normal file → Executable file
View File

@@ -1,23 +1,31 @@
<!--File for SIE Code Generator. Custmos Blocks-->
<CustomItem BlockName="ADC Single">
<Polygon>
<Point x="-80" y="0"/>
<Point x="-80" y="-10"/>
<Point x="-60" y="-40"/>
<Point x="110" y="-40"/>
<Point x="110" y="20"/>
<Point x="60" y="20"/>
<Point x="60" y="-40"/>
<Point x="60" y="40"/>
<Point x="110" y="40"/>
<Point x="60" y="20"/>
<Point x="110" y="20"/>
<Point x="110" y="-40"/>
<Point x="60" y="-40"/>
<Point x="110" y="-40"/>
<Point x="110" y="40"/>
<Point x="-60" y="40"/>
<Point x="60" y="20"/>
<Point x="-60" y="20"/>
</Polygon>
<TextItems>
<TextItem myStyleIO="7" posOffset-y="-20" editableItem="0" ID="7" text=" Long" posOffset-x="110"/>
<TextItem myStyleIO="0" posOffset-y="-20" editableItem="1" ID="9" text="255" posOffset-x="20"/>
<TextItem myStyleIO="0" posOffset-y="-20" editableItem="0" ID="6" text="SP:" posOffset-x="-20"/>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="0" ID="5" text="CH:" posOffset-x="-20"/>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="4" text="0" posOffset-x="20"/>
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="3" text="ADC Single Channel" posOffset-x="0"/>
</TextItems>
</CustomItem>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="0" ID="3" text="Clock Div." posOffset-x="-30"/>
<TextItem myStyleIO="0" posOffset-y="30" editableItem="0" ID="1" text="ADC Single Channel" posOffset-x="0"/>
<TextItem myStyleIO="0" posOffset-y="10" editableItem="1" ID="0" text="0" posOffset-x="30"/>
<TextItem myStyleIO="10" posOffset-y="10" editableItem="0" ID="2" text="UShort" posOffset-x="110"/>
<TextItem myStyleIO="0" posOffset-y="10" editableItem="0" ID="5" text="Channel:" posOffset-x="-30"/>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="1" ID="4" text="255" posOffset-x="30"/>
</TextItems><![CDATA[]]><![CDATA[
ADC_SPI_CLKDIV=value_4;
ADC_BUFFER_LEN=2;
ADC_MUX_CHANNELS=0;
]]><![CDATA[
JZ_REG * ADC_DATA = ADCTakeSamples(ADCBuffer,value_0);
out_2 = ADC_DATA[0]&0x03FF;
]]><![CDATA[]]></CustomItem>

1
Software/sie_cg/block_editor/arrow.cpp Normal file → Executable file
View File

@@ -271,6 +271,7 @@ void Arrow::setVisibleCorners(bool visible)
{
foreach (lineItem *line, myCLines) {
line->setVisible(visible);
line->setZValue(2000.0);
}
if(myOwnerScene->items().indexOf(SECLine)!=-1)
{

0
Software/sie_cg/block_editor/arrow.h Normal file → Executable file
View File

25
Software/sie_cg/block_editor/constant.die Normal file → Executable file
View File

@@ -1,14 +1,21 @@
<!--File for SIE Code Generator. Custmos Blocks-->
<CustomItem BlockName="Constant">
<CustomItem BlockName="Constant Char">
<Polygon>
<Point x="-50" y="-10"/>
<Point x="-50" y="30"/>
<Point x="30" y="30"/>
<Point x="30" y="-10"/>
<Point x="-50" y="10"/>
<Point x="20" y="10"/>
<Point x="20" y="-10"/>
<Point x="-50" y="-10"/>
<Point x="100" y="-10"/>
<Point x="100" y="10"/>
<Point x="20" y="10"/>
<Point x="100" y="10"/>
<Point x="100" y="-10"/>
</Polygon>
<TextItems>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="1" text="1" posOffset-x="10"/>
<TextItem myStyleIO="3" posOffset-y="-20" editableItem="0" ID="15" text="OUT Integer" posOffset-x="30"/>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="0" ID="0" text="Value" posOffset-x="-30"/>
</TextItems>
</CustomItem>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="0" ID="0" text="Const" posOffset-x="-30"/>
<TextItem myStyleIO="8" posOffset-y="-0" editableItem="0" ID="2" text="OUT UChar" posOffset-x="100"/>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="1" text="1" posOffset-x="0"/>
</TextItems><![CDATA[]]><![CDATA[]]><![CDATA[
out_2=value_1;
]]><![CDATA[]]></CustomItem>

View File

@@ -0,0 +1,21 @@
<!--File for SIE Code Generator. Custmos Blocks-->
<CustomItem BlockName="Constant Bool">
<Polygon>
<Point x="-50" y="-10"/>
<Point x="-50" y="10"/>
<Point x="20" y="10"/>
<Point x="20" y="-10"/>
<Point x="-50" y="-10"/>
<Point x="100" y="-10"/>
<Point x="100" y="10"/>
<Point x="20" y="10"/>
<Point x="100" y="10"/>
<Point x="100" y="-10"/>
</Polygon>
<TextItems>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="0" ID="0" text="Const" posOffset-x="-30"/>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="1" text="1" posOffset-x="0"/>
<TextItem myStyleIO="1" posOffset-y="-0" editableItem="0" ID="3" text="OUT Bool" posOffset-x="100"/>
</TextItems><![CDATA[]]><![CDATA[]]><![CDATA[
out_3=value_1;
]]><![CDATA[]]></CustomItem>

170
Software/sie_cg/block_editor/diagramscene.cpp Normal file → Executable file
View File

@@ -62,23 +62,12 @@ DiagramScene::DiagramScene(QMenu *itemMenu, MainWindow *ownerWindow,
myCorners=0;
TitleText = new DiagramTextItem(0,0,1,0xFFF,255,"BLOCK NAME HERE not visible",
QPointF(500,370));
QPointF(500,420));
TitleText->setZValue(1000);
addItem(TitleText);
}
void DiagramScene::editorLostFocus(DiagramTextItem *item)
{
QTextCursor cursor = item->textCursor();
cursor.clearSelection();
item->setTextCursor(cursor);
if (item->toPlainText().isEmpty()) {
removeItem(item);
item->deleteLater();
}
}
void DiagramScene::drawBackground(QPainter *p, const QRectF &r)
{
p -> save();
@@ -148,7 +137,7 @@ QString DiagramScene::createPrototype()
functionPrototype += "char ";
break;
case 3:
functionPrototype += "integer ";
functionPrototype += "int ";
break;
case 4:
functionPrototype += "double ";
@@ -157,10 +146,10 @@ QString DiagramScene::createPrototype()
functionPrototype += "float ";
break;
case 6:
functionPrototype += "short ";
functionPrototype += "short int ";
break;
case 7:
functionPrototype += "long ";
functionPrototype += "long int ";
break;
case 8:
functionPrototype += "unsigned char ";
@@ -169,10 +158,10 @@ QString DiagramScene::createPrototype()
functionPrototype += "unsigned integer ";
break;
case 10:
functionPrototype += "unsigned short ";
functionPrototype += "unsigned short int ";
break;
case 11:
functionPrototype += "unsigned long ";
functionPrototype += "unsigned long int ";
break;
default:;
}
@@ -189,34 +178,6 @@ QString DiagramScene::createPrototype()
void DiagramScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
doSnapToGrid(mouseEvent);
foreach (QGraphicsItem *item, this->items(mouseEvent->scenePos())) {
if (item->type() == DiagramTextItem::Type) {
if(qgraphicsitem_cast<DiagramTextItem *>(item)->styleIO()<256)
{
myOwnerWindow->statusBar->showMessage(
qgraphicsitem_cast<DiagramTextItem *>(item)->toPlainText() +
tr("\t : Input/Output text label -> {ID = ") +
QString::number(qgraphicsitem_cast<DiagramTextItem *>
(item)->textID()) + tr("}"));
}
else if(qgraphicsitem_cast<DiagramTextItem *>(item)->styleIO()==256)
{
myOwnerWindow->statusBar->showMessage(
qgraphicsitem_cast<DiagramTextItem *>(item)->toPlainText() +
tr("\t : Text label -> {ID = ") +
QString::number(qgraphicsitem_cast<DiagramTextItem *>
(item)->textID()) + tr("}"));
}
else if(qgraphicsitem_cast<DiagramTextItem *>(item)->styleIO()==257)
{
myOwnerWindow->statusBar->showMessage(
qgraphicsitem_cast<DiagramTextItem *>(item)->toPlainText() +
tr("\t : Editable text label -> {ID = ") +
QString::number(qgraphicsitem_cast<DiagramTextItem *>
(item)->textID()) + tr("}"));
}
}
}
myOwnerWindow->updateProt();
QString Text;
@@ -243,8 +204,6 @@ void DiagramScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
if(addResult!=-1)
{
textItem->setZValue(1000.0);
connect(textItem, SIGNAL(lostFocus(DiagramTextItem*)),
this, SLOT(editorLostFocus(DiagramTextItem*)));
addItem(textItem);
textItem->setTextID(addResult);
}
@@ -252,7 +211,7 @@ void DiagramScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
delete(textItem);
QMessageBox::warning(0,"Full","The block can only have "
"255 text items");
"255 labels/IOs.");
}
emit textInserted(textItem);
break;
@@ -301,8 +260,40 @@ void DiagramScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent)
QLineF newLine(line->line().p1(), mouseEvent->scenePos());
line->setLine(newLine);
}
QGraphicsScene::mouseMoveEvent(mouseEvent);
QPointF mousePos = mouseEvent->scenePos();
mousePos.setX(mousePos.x()-500);
mousePos.setY(-(mousePos.y()-500));
QGraphicsScene::mouseMoveEvent(mouseEvent);
QString barMesg= QString("X[%1] Y[%2]").arg(QString::number(mousePos.x()))
.arg(QString::number(mousePos.y()));
foreach (QGraphicsItem *item, this->items(mouseEvent->scenePos())) {
if (item->type() == DiagramTextItem::Type) {
if(qgraphicsitem_cast<DiagramTextItem *>(item)->styleIO()<256)
{
barMesg +=
tr(" ** Over In/Out text label with {ID = ") +
QString::number(qgraphicsitem_cast<DiagramTextItem *>
(item)->textID()) + tr("}");
}
else if(qgraphicsitem_cast<DiagramTextItem *>(item)->styleIO()==256)
{
barMesg +=
tr(" ** Over text label with {ID = ") +
QString::number(qgraphicsitem_cast<DiagramTextItem *>
(item)->textID()) + tr("}");
}
else if(qgraphicsitem_cast<DiagramTextItem *>(item)->styleIO()==257)
{
barMesg +=
tr(" ** Over editable text label with {ID = ") +
QString::number(qgraphicsitem_cast<DiagramTextItem *>
(item)->textID()) + tr("}");
}
}
}
myOwnerWindow->statusBar->showMessage(barMesg);
}
@@ -351,9 +342,11 @@ QDomDocument DiagramScene::toXmlFormat()
QDomComment initialComments=document.createComment(
"File for SIE Code Generator. Custmos Blocks");
document.appendChild(initialComments);
QDomElement diagram = document.createElement("CustomItem");
diagram.setAttribute("BlockName",TitleText->toPlainText());
document.appendChild(diagram);
//Lists of items
QList<DiagramTextItem *> Items;
QList<Arrow *> Arrows;
@@ -368,7 +361,8 @@ QDomDocument DiagramScene::toXmlFormat()
if(Arrows.count()>1) {printf("Something is wrong.\n"); fflush(stdout);}
//Create the XML structure
diagram.appendChild(myPolygonPath->toXml(document));
if(myPolygonPath!=0)
diagram.appendChild(myPolygonPath->toXml(document));
QDomElement element;
if(Items.count()>0)
@@ -386,6 +380,26 @@ QDomDocument DiagramScene::toXmlFormat()
diagram.appendChild(textItems);
}
//Add the code as CDATA sections
//Order: Header Code, Init Code, Block Code and Extra Code.
QDomCDATASection headerCode=document.createCDATASection(
myOwnerWindow->headerTextEdit->toPlainText());
diagram.appendChild(headerCode);
QDomCDATASection initCode=document.createCDATASection(
myOwnerWindow->initTextEdit->toPlainText());
diagram.appendChild(initCode);
QDomCDATASection blockCode=document.createCDATASection(
myOwnerWindow->blockTextEdit->toPlainText());
diagram.appendChild(blockCode);
QDomCDATASection extraCode=document.createCDATASection(
myOwnerWindow->extraTextEdit->toPlainText());
diagram.appendChild(extraCode);
return(document);
}
@@ -401,11 +415,39 @@ int DiagramScene::fromXmlFormat(QDomDocument document)
TitleText->setPlainText("Please set Block Name");
else
TitleText->setPlainText(customItem.attribute("BlockName"));
TitleText->updatePosition();
int codeIdx = 0;
for (QDomNode node = customItem.firstChild() ;
!node.isNull() ;
node = node.nextSibling())
{
{
if(node.isCDATASection())
{
QDomCDATASection Code = node.toCDATASection();
switch(codeIdx)
{
case 0:
myOwnerWindow->headerTextEdit->setPlainText(Code.data());
break;
case 1:
myOwnerWindow->initTextEdit->setPlainText(Code.data());
break;
case 2:
myOwnerWindow->blockTextEdit->setPlainText(Code.data());
break;
case 3:
myOwnerWindow->extraTextEdit->setPlainText(Code.data());
break;
default:
QMessageBox::warning(0,"Parsing XML", tr("Extra CDATA found in")
+tr(" file, this section will be ignored."));
}
codeIdx++;
}
else
{
QDomElement element = node.toElement();
if(element.tagName()=="Polygon")
{
@@ -446,6 +488,7 @@ int DiagramScene::fromXmlFormat(QDomDocument document)
int myStyleIO = textItemE.attribute("myStyleIO").toInt();
int myID = textItemE.attribute("ID").toInt();
bool editableItem = textItemE.attribute("editableItem").toInt();
QPointF posOffset=
QPointF((QPointF(textItemE.attribute("posOffset-x")
@@ -465,12 +508,23 @@ int DiagramScene::fromXmlFormat(QDomDocument document)
DiagramTextItem * newTextItem =
new DiagramTextItem(0,0,1,myStyleIO,myID,itemString,posOffset);
newTextItem->setZValue(1000.0);
connect(newTextItem, SIGNAL(lostFocus(DiagramTextItem*)),
this, SLOT(editorLostFocus(DiagramTextItem*)));
addItem(newTextItem);
textItemsByID.insert(myID,newTextItem);
if(textItemsByID.find(myID)!=textItemsByID.end())
{
int result=addTextItem(newTextItem);
QMessageBox::warning(0,"ID Problems",
tr("Label with ID[")+QString::number(myID)+
tr("] already exists, this will be reasigned to [")+
QString::number(result)+
tr("] for prevent problems."));
newTextItem->setTextID(result);
}
else
textItemsByID.insert(myID,newTextItem);
}
}
}
}
myOwnerWindow->updateProt();
return 1;
@@ -501,13 +555,15 @@ void DiagramScene::cleanScene()
removeItem(myPolygonPath);
delete(myPolygonPath);
}
TitleText->setPlainText("BLOCK NAME HERE (not visible)");
TitleText->setPlainText("BLOCK NAME HERE not visible");
TitleText->updatePosition();
this->addItem(TitleText);
textItemsByID.clear();
}
int DiagramScene::addTextItem(DiagramTextItem * textItem)
{
for(int i=0; i<255; i++)
for(int i=0; i<256; i++)
{
QHash<int,DiagramTextItem *>::iterator iter= textItemsByID.find(i);
if(iter==textItemsByID.end())

8
Software/sie_cg/block_editor/diagramscene.h Normal file → Executable file
View File

@@ -83,11 +83,12 @@ public:
int addTextItem(DiagramTextItem * textItem);
void removeTextItem(DiagramTextItem * textItem);
Arrow *myPolygonPath;
QString createPrototype();
public slots:
void setMode(Mode mode){myMode=mode;}
void editorLostFocus(DiagramTextItem *item);
void setMode(Mode mode){myMode=mode;}
signals:
void textInserted(QGraphicsTextItem *item);
@@ -108,8 +109,7 @@ private:
QString myTypeString;
bool leftButtonDown;
QPointF startPoint;
QGraphicsLineItem *line;
Arrow *myPolygonPath;
QGraphicsLineItem *line;
QFont myFont;
DiagramTextItem *textItem;
DiagramTextItem *TitleText;

0
Software/sie_cg/block_editor/diagramscene.pro Normal file → Executable file
View File

28
Software/sie_cg/block_editor/diagramscene.pro.user Normal file → Executable file
View File

@@ -76,7 +76,7 @@
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-i0TevybO0n,guid=8b93acbaab2ecdba6bb7d4064ce7e29f</value>
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-mvXjaDjNgc,guid=2d86690d9bd83b6a69b540554cf6e2bd</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value>
@@ -84,7 +84,7 @@
<value type="QString">GDM_KEYBOARD_LAYOUT=es</value>
<value type="QString">GDM_LANG=en_US.utf8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-7RmeU0</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-tlrgjl</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/juan64bits</value>
<value type="QString">LANG=en_US.utf8</value>
@@ -95,17 +95,17 @@
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/juan64bits</value>
<value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1244,unix/Maximus:/tmp/.ICE-unix/1244</value>
<value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1257,unix/Maximus:/tmp/.ICE-unix/1257</value>
<value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=7560</value>
<value type="QString">SSH_AGENT_PID=1408</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-7RmeU0/ssh</value>
<value type="QString">SSH_AGENT_PID=1393</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-tlrgjl/ssh</value>
<value type="QString">USER=juan64bits</value>
<value type="QString">USERNAME=juan64bits</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-W3dU0B/database</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-UYZHqR/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1290265246.859440-43205519</value>
<value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1291248314.906440-791960316</value>
</valuelist>
<valuelist key="abstractProcess.arguments" type="QVariantList">
<value type="QString">/home/juan64bits/ebd/ECB/nn-usb-fpga/Software/sie_cg/block_editor/diagramscene.pro</value>
@@ -124,7 +124,7 @@
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-i0TevybO0n,guid=8b93acbaab2ecdba6bb7d4064ce7e29f</value>
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-mvXjaDjNgc,guid=2d86690d9bd83b6a69b540554cf6e2bd</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value>
@@ -132,7 +132,7 @@
<value type="QString">GDM_KEYBOARD_LAYOUT=es</value>
<value type="QString">GDM_LANG=en_US.utf8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-7RmeU0</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-tlrgjl</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/juan64bits</value>
<value type="QString">LANG=en_US.utf8</value>
@@ -143,17 +143,17 @@
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/juan64bits</value>
<value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1244,unix/Maximus:/tmp/.ICE-unix/1244</value>
<value type="QString">SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/1257,unix/Maximus:/tmp/.ICE-unix/1257</value>
<value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=7560</value>
<value type="QString">SSH_AGENT_PID=1408</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-7RmeU0/ssh</value>
<value type="QString">SSH_AGENT_PID=1393</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-tlrgjl/ssh</value>
<value type="QString">USER=juan64bits</value>
<value type="QString">USERNAME=juan64bits</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-W3dU0B/database</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-juan64bits-UYZHqR/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1290265246.859440-43205519</value>
<value type="QString">XDG_SESSION_COOKIE=b9a7fbc4d869fc15bd6cdd474bcc9a28-1291248314.906440-791960316</value>
</valuelist>
<value key="abstractProcess.IgnoreReturnValue" type="bool">false</value>
<valuelist key="abstractProcess.arguments" type="QVariantList">

0
Software/sie_cg/block_editor/diagramscene.qrc Normal file → Executable file
View File

77
Software/sie_cg/block_editor/diagramtextitem.cpp Normal file → Executable file
View File

@@ -56,14 +56,19 @@ DiagramTextItem::DiagramTextItem(
editableItem=editable;
setPlainText(defaultText);
posOffset=offset;
//setFlag(QGraphicsItem::ItemIsMovable,0);
if(editable)
setFlag(QGraphicsItem::ItemIsSelectable,1);
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true);
if(myStyleIO==0xFFF)
setFlag(QGraphicsItem::ItemIsMovable,false);
else
setFlag(QGraphicsItem::ItemIsFocusable,0);
setFlag(QGraphicsItem::ItemIsMovable,true);
setFlag(QGraphicsItem::ItemIsSelectable,true);
editorOpened=0;
updatePosition();
moving=0;
}
void DiagramTextItem::updatePosition()
@@ -81,22 +86,25 @@ void DiagramTextItem::updatePosition()
QVariant DiagramTextItem::itemChange(GraphicsItemChange change,
const QVariant &value)
{
if (change == QGraphicsItem::ItemSelectedHasChanged)
emit selectedChange(this);
return value;
}
void DiagramTextItem::focusOutEvent(QFocusEvent *event)
{
if(editableItem)
{
if(toPlainText()=="") setPlainText("?");
//updatePosition();
setTextInteractionFlags(Qt::NoTextInteraction);
emit lostFocus(this);
QGraphicsTextItem::focusOutEvent(event);
}
setPlainText(toPlainText().trimmed());
if(toPlainText()=="") setPlainText("?");
setTextInteractionFlags(Qt::NoTextInteraction);
if(myStyleIO!=0xFFF)
setFlag(QGraphicsItem::ItemIsMovable,true);
QTextCursor cursor = textCursor();
cursor.clearSelection();
setTextCursor(cursor);
QGraphicsTextItem::focusOutEvent(event);
editorOpened=0;
updatePosition();
}
void DiagramTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
@@ -105,36 +113,47 @@ void DiagramTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
if (textInteractionFlags() == Qt::NoTextInteraction)
setTextInteractionFlags(Qt::TextEditorInteraction);
setSelected(1);
setFocus(Qt::MouseFocusReason);
setFlag(QGraphicsItem::ItemIsMovable,false);
editorOpened=1;
}
QGraphicsTextItem::mouseDoubleClickEvent(event);
QGraphicsTextItem::mouseDoubleClickEvent(event);
}
void DiagramTextItem::snapToGrid(QGraphicsSceneMouseEvent *event)
{
if(myStyleIO!=0xFFF)
setOffset(event->scenePos());
updatePosition();
setOffset(event->scenePos());
}
void DiagramTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
moving=1;
//snapToGrid(event);
QGraphicsTextItem::mousePressEvent(event);
if(editorOpened==0)
{
printf("StyleIO:[%x]",myStyleIO); fflush(stdout);
snapToGrid(event);
QGraphicsTextItem::mousePressEvent(event);
}
}
void DiagramTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
moving=0;
QGraphicsTextItem::mouseReleaseEvent(event);
{
if(editorOpened==0 && myStyleIO!=0xFFF)
{
snapToGrid(event);
QGraphicsTextItem::mouseReleaseEvent(event);
}
}
void DiagramTextItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if(moving)
snapToGrid(event);
QGraphicsTextItem::mouseMoveEvent(event);
if(editorOpened==0 && myStyleIO!=0xFFF)
{
snapToGrid(event);
QGraphicsTextItem::mouseMoveEvent(event);
updatePosition();
}
}
QDomElement DiagramTextItem::toXml(QDomDocument &document) const

2
Software/sie_cg/block_editor/diagramtextitem.h Normal file → Executable file
View File

@@ -112,7 +112,7 @@ private:
int myStyleIO;
unsigned char myID;
QGraphicsScene *myOwnerScene;
bool moving;
bool editorOpened;
};
#endif

View File

@@ -0,0 +1,35 @@
<!--File for SIE Code Generator. Custmos Blocks-->
<CustomItem BlockName="Divider Int">
<Polygon>
<Point x="-60" y="-10"/>
<Point x="-60" y="10"/>
<Point x="20" y="10"/>
<Point x="20" y="-10"/>
<Point x="60" y="-10"/>
<Point x="60" y="10"/>
<Point x="20" y="10"/>
<Point x="60" y="10"/>
<Point x="60" y="-10"/>
<Point x="-20" y="-10"/>
<Point x="-40" y="10"/>
<Point x="-20" y="10"/>
<Point x="-20" y="10"/>
<Point x="-30" y="10"/>
<Point x="-40" y="10"/>
<Point x="-40" y="10"/>
<Point x="-20" y="-10"/>
<Point x="-40" y="-10"/>
<Point x="-40" y="-10"/>
<Point x="-20" y="-10"/>
<Point x="-20" y="-10"/>
<Point x="-20" y="-10"/>
</Polygon>
<TextItems>
<TextItem myStyleIO="131" posOffset-y="-0" editableItem="0" ID="0" text="IN" posOffset-x="-60"/>
<TextItem myStyleIO="3" posOffset-y="-0" editableItem="0" ID="1" text="OUT" posOffset-x="60"/>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="2" text="1" posOffset-x="0"/>
</TextItems><![CDATA[]]><![CDATA[
]]><![CDATA[
out_1 = in_o / value_2;
]]><![CDATA[]]></CustomItem>

View File

@@ -0,0 +1,64 @@
<!--File for SIE Code Generator. Custmos Blocks-->
<CustomItem BlockName="FB Draw HLine">
<Polygon>
<Point x="-80" y="-70"/>
<Point x="100" y="-70"/>
<Point x="100" y="-50"/>
<Point x="-80" y="-50"/>
<Point x="-80" y="10"/>
<Point x="100" y="10"/>
<Point x="100" y="-50"/>
<Point x="100" y="10"/>
<Point x="-20" y="10"/>
<Point x="-20" y="-50"/>
<Point x="100" y="-50"/>
<Point x="100" y="-30"/>
<Point x="-20" y="-30"/>
<Point x="60" y="-30"/>
<Point x="60" y="-50"/>
<Point x="100" y="-50"/>
<Point x="100" y="-30"/>
<Point x="100" y="-10"/>
<Point x="-20" y="-10"/>
<Point x="60" y="-10"/>
<Point x="60" y="-30"/>
<Point x="100" y="-30"/>
<Point x="100" y="-10"/>
<Point x="100" y="10"/>
<Point x="100" y="-10"/>
<Point x="60" y="-10"/>
<Point x="60" y="10"/>
<Point x="-20" y="10"/>
<Point x="-80" y="10"/>
<Point x="-80" y="-10"/>
<Point x="-60" y="-10"/>
<Point x="-20" y="-10"/>
<Point x="-60" y="-10"/>
<Point x="-60" y="-30"/>
<Point x="-20" y="-30"/>
<Point x="-80" y="-30"/>
<Point x="-60" y="-30"/>
<Point x="-60" y="-30"/>
<Point x="-60" y="-50"/>
<Point x="-80" y="-50"/>
</Polygon>
<TextItems>
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="11" text="Y" posOffset-x="-70"/>
<TextItem myStyleIO="0" posOffset-y="40" editableItem="0" ID="10" text="X" posOffset-x="-70"/>
<TextItem myStyleIO="0" posOffset-y="40" editableItem="1" ID="1" text="0" posOffset-x="-40"/>
<TextItem myStyleIO="0" posOffset-y="20" editableItem="1" ID="2" text="0" posOffset-x="-40"/>
<TextItem myStyleIO="0" posOffset-y="20" editableItem="1" ID="7" text="255" posOffset-x="80"/>
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="4" text="Maximum" posOffset-x="20"/>
<TextItem myStyleIO="0" posOffset-y="40" editableItem="1" ID="9" text="8" posOffset-x="80"/>
<TextItem myStyleIO="0" posOffset-y="40" editableItem="0" ID="8" text="Bar width" posOffset-x="20"/>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="5" text="3" posOffset-x="80"/>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="0" ID="6" text="Color Idx" posOffset-x="20"/>
<TextItem myStyleIO="0" posOffset-y="60" editableItem="0" ID="0" text="Frame Buffer Draw HBar" posOffset-x="10"/>
<TextItem myStyleIO="138" posOffset-y="-0" editableItem="0" ID="3" text="IN UShort" posOffset-x="-80"/>
</TextItems><![CDATA[]]><![CDATA[]]><![CDATA[ if(!firstLoop) // do nothing in first loop
{
fillrect(value_1,value_2,value_1+value_7,value_2+value_9,0); //Black Rect
rect(value_1,value_2,value_1+value_7,value_2+value_9,value_5); //Extern Rect
fillrect(value_1,value_2,value_1+(in_3%(value_7+1)),value_2+value_9,value_5);
}
]]><![CDATA[]]></CustomItem>

View File

@@ -0,0 +1,60 @@
<!--File for SIE Code Generator. Custmos Blocks-->
<CustomItem BlockName="FB Print Line">
<Polygon>
<Point x="-140" y="-30"/>
<Point x="-140" y="30"/>
<Point x="160" y="30"/>
<Point x="160" y="-10"/>
<Point x="160" y="10"/>
<Point x="120" y="10"/>
<Point x="160" y="10"/>
<Point x="160" y="30"/>
<Point x="120" y="30"/>
<Point x="120" y="10"/>
<Point x="60" y="10"/>
<Point x="20" y="10"/>
<Point x="60" y="10"/>
<Point x="60" y="30"/>
<Point x="20" y="30"/>
<Point x="20" y="10"/>
<Point x="0" y="10"/>
<Point x="-40" y="10"/>
<Point x="0" y="10"/>
<Point x="0" y="30"/>
<Point x="-40" y="30"/>
<Point x="-40" y="10"/>
<Point x="-60" y="10"/>
<Point x="-60" y="30"/>
<Point x="-80" y="30"/>
<Point x="-80" y="10"/>
<Point x="-60" y="10"/>
<Point x="-80" y="10"/>
<Point x="-140" y="10"/>
<Point x="-140" y="30"/>
<Point x="-140" y="-10"/>
<Point x="160" y="-10"/>
<Point x="160" y="-30"/>
</Polygon>
<TextItems>
<TextItem myStyleIO="0" posOffset-y="-20" editableItem="1" ID="9" text="1" posOffset-x="140"/>
<TextItem myStyleIO="0" posOffset-y="-20" editableItem="0" ID="8" text="Color idx" posOffset-x="90"/>
<TextItem myStyleIO="0" posOffset-y="-20" editableItem="1" ID="7" text="0" posOffset-x="40"/>
<TextItem myStyleIO="0" posOffset-y="-20" editableItem="0" ID="6" text="Y" posOffset-x="10"/>
<TextItem myStyleIO="0" posOffset-y="-20" editableItem="1" ID="5" text="0" posOffset-x="-20"/>
<TextItem myStyleIO="0" posOffset-y="-20" editableItem="0" ID="4" text="X" posOffset-x="-50"/>
<TextItem myStyleIO="0" posOffset-y="-20" editableItem="1" ID="3" text="1" posOffset-x="-70"/>
<TextItem myStyleIO="0" posOffset-y="-20" editableItem="0" ID="2" text="Center" posOffset-x="-110"/>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="1" text="&lt;Insert Text to Show MAX 40>" posOffset-x="0"/>
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="0" text="Frame Buffer Print Line" posOffset-x="0"/>
</TextItems><![CDATA[]]><![CDATA[
]]><![CDATA[
if(value_3)
{
put_string_center (value_5,value_7,"value_1", value_9);
}
else
{
put_string (value_5,value_7,"value_1", value_9%5);
}
]]><![CDATA[]]></CustomItem>

View File

@@ -0,0 +1,53 @@
<!--File for SIE Code Generator. Custmos Blocks-->
<CustomItem BlockName="FB Put Int">
<Polygon>
<Point x="-100" y="-40"/>
<Point x="100" y="-40"/>
<Point x="100" y="-20"/>
<Point x="-100" y="-20"/>
<Point x="-100" y="-40"/>
<Point x="-100" y="20"/>
<Point x="60" y="20"/>
<Point x="60" y="0"/>
<Point x="100" y="0"/>
<Point x="100" y="20"/>
<Point x="60" y="20"/>
<Point x="100" y="20"/>
<Point x="100" y="0"/>
<Point x="100" y="0"/>
<Point x="100" y="-20"/>
<Point x="100" y="-20"/>
<Point x="100" y="-20"/>
<Point x="100" y="-20"/>
<Point x="100" y="-20"/>
<Point x="100" y="-20"/>
<Point x="100" y="-20"/>
<Point x="100" y="0"/>
<Point x="60" y="0"/>
<Point x="60" y="-20"/>
<Point x="40" y="-20"/>
<Point x="40" y="0"/>
<Point x="60" y="0"/>
<Point x="0" y="0"/>
<Point x="0" y="-20"/>
<Point x="-20" y="-20"/>
<Point x="-20" y="0"/>
<Point x="0" y="0"/>
<Point x="-20" y="0"/>
<Point x="-20" y="20"/>
<Point x="-100" y="20"/>
<Point x="-100" y="20"/>
<Point x="-100" y="-20"/>
</Polygon>
<TextItems>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="1" ID="7" text="0" posOffset-x="80"/>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="0" ID="6" text="Color idx" posOffset-x="20"/>
<TextItem myStyleIO="0" posOffset-y="30" editableItem="0" ID="0" text="Frame Buffer Print Integer" posOffset-x="0"/>
<TextItem myStyleIO="131" posOffset-y="-0" editableItem="0" ID="1" text="IN Integer" posOffset-x="-100"/>
<TextItem myStyleIO="0" posOffset-y="10" editableItem="0" ID="2" text="X" posOffset-x="-10"/>
<TextItem myStyleIO="0" posOffset-y="10" editableItem="1" ID="3" text="0" posOffset-x="20"/>
<TextItem myStyleIO="0" posOffset-y="10" editableItem="0" ID="4" text="Y" posOffset-x="50"/>
<TextItem myStyleIO="0" posOffset-y="10" editableItem="1" ID="5" text="0" posOffset-x="80"/>
</TextItems><![CDATA[]]><![CDATA[]]><![CDATA[
put_int(value_3,value_5,in_1,value_7);
]]><![CDATA[]]></CustomItem>

48
Software/sie_cg/block_editor/left_shift.die Normal file → Executable file
View File

@@ -1,18 +1,40 @@
<!--File for SIE Code Generator. Custmos Blocks-->
<CustomItem BlockName="Left Shift">
<Polygon>
<Point x="-70" y="-30"/>
<Point x="-70" y="20"/>
<Point x="60" y="20"/>
<Point x="60" y="-30"/>
<Point x="-50" y="-30"/>
<Point x="-70" y="-30"/>
<Point x="-50" y="0"/>
<Point x="-50" y="20"/>
<Point x="-20" y="20"/>
<Point x="-30" y="10"/>
<Point x="-20" y="0"/>
<Point x="-20" y="0"/>
<Point x="-30" y="10"/>
<Point x="-20" y="20"/>
<Point x="-20" y="20"/>
<Point x="-10" y="20"/>
<Point x="-20" y="10"/>
<Point x="-10" y="0"/>
<Point x="0" y="0"/>
<Point x="-10" y="10"/>
<Point x="0" y="20"/>
<Point x="-10" y="20"/>
<Point x="10" y="20"/>
<Point x="50" y="20"/>
<Point x="0" y="20"/>
<Point x="-10" y="10"/>
<Point x="0" y="0"/>
<Point x="40" y="0"/>
<Point x="40" y="20"/>
<Point x="80" y="20"/>
<Point x="40" y="20"/>
<Point x="40" y="0"/>
<Point x="80" y="0"/>
<Point x="80" y="20"/>
<Point x="80" y="0"/>
<Point x="40" y="0"/>
<Point x="-20" y="0"/>
</Polygon>
<TextItems>
<TextItem myStyleIO="131" posOffset-y="-0" editableItem="0" ID="0" text="IN" posOffset-x="-70"/>
<TextItem myStyleIO="3" posOffset-y="-0" editableItem="0" ID="1" text="OUT" posOffset-x="60"/>
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="5" text="Bitwise Shift" posOffset-x="-10"/>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="0" ID="10" text="&lt;&lt;" posOffset-x="-20"/>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="1" ID="11" text="1" posOffset-x="10"/>
</TextItems>
</CustomItem>
<TextItem myStyleIO="131" posOffset-y="-10" editableItem="0" ID="0" text="IN" posOffset-x="-50"/>
<TextItem myStyleIO="3" posOffset-y="-10" editableItem="0" ID="1" text="OUT" posOffset-x="80"/>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="1" ID="11" text="1" posOffset-x="20"/>
</TextItems><![CDATA[]]><![CDATA[]]><![CDATA[]]><![CDATA[]]></CustomItem>

0
Software/sie_cg/block_editor/lineitem.cpp Normal file → Executable file
View File

0
Software/sie_cg/block_editor/lineitem.h Normal file → Executable file
View File

0
Software/sie_cg/block_editor/main.cpp Normal file → Executable file
View File

36
Software/sie_cg/block_editor/mainwindow.cpp Normal file → Executable file
View File

@@ -64,6 +64,9 @@ MainWindow::MainWindow()
headerTextEdit = new QTextEdit;
headerTextEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
headerTextEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
initTextEdit = new QTextEdit;
initTextEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
initTextEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
blockTextEdit = new QTextEdit;
blockTextEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
blockTextEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
@@ -72,26 +75,36 @@ MainWindow::MainWindow()
extraTextEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
prototypeLabel = new QLabel;
prototypeLabel->setText("\nvoid BLOCK_NAME () {");
QFont proFont = prototypeLabel->font(); proFont.setBold(true);
prototypeLabel->setFont(proFont);
prototypeLabel->setMaximumWidth(1280);
initLabel = new QLabel;
initLabel->setText("Code For Initialization Section Here");
proFont = initLabel->font(); proFont.setItalic(true);;
initLabel->setFont(proFont);
headerLabel = new QLabel;
headerLabel->setText("Code for Header Section Here");
headerLabel->setText("Code For Header Section Here");
headerLabel->setFont(proFont);
extraLabel = new QLabel;
extraLabel->setText("}\n\nCode for Extra Section Here");
extraLabel->setText("}\n\nCode For Extra Section Here");
extraLabel->setFont(proFont);
/* Create central widget */
QGridLayout *layout = new QGridLayout;
layout->addWidget(toolBox,0,0,7,1);
layout->addWidget(toolBox,0,0,9,1);
view = new QGraphicsView(scene);
layout->addWidget(view,0,1,1,1);
layout->addWidget(headerLabel,1,1,1,1);
layout->addWidget(headerTextEdit,2,1,1,1);
layout->addWidget(prototypeLabel,3,1,1,1);
layout->addWidget(blockTextEdit,4,1,1,1);
layout->addWidget(extraLabel,5,1,1,1);
layout->addWidget(extraTextEdit,6,1,1,1);
layout->addWidget(initLabel,3,1,1,1);
layout->addWidget(initTextEdit,4,1,1,1);
layout->addWidget(prototypeLabel,5,1,1,1);
layout->addWidget(blockTextEdit,6,1,1,1);
layout->addWidget(extraLabel,7,1,1,1);
layout->addWidget(extraTextEdit,8,1,1,1);
QWidget *widget = new QWidget;
widget->setLayout(layout);
setCentralWidget(widget);
setWindowTitle(tr("SIE Code Generator (Block Editor)"));
setUnifiedTitleAndToolBarOnMac(true);
@@ -110,6 +123,9 @@ void MainWindow::deleteItem()
if (item->type() == Arrow::Type) {
qgraphicsitem_cast<Arrow *>(item)->removeLines();
scene->removeItem(item);
if(qgraphicsitem_cast<Arrow *>(item)==scene->myPolygonPath)
scene->myPolygonPath=0;
delete(item);
}
//If line is deleted then is romoved from the arrow owner
@@ -376,6 +392,10 @@ bool MainWindow::newDiagram(QString filePath)
{
saveIfNeeded();
scene->cleanScene();
this->headerTextEdit->clear();
this->initTextEdit->clear();
this->blockTextEdit->clear();
this->extraTextEdit->clear();
prototypeLabel->setText("\nvoid BLOCK_NAME () {");
myFilePath="";

17
Software/sie_cg/block_editor/mainwindow.h Normal file → Executable file
View File

@@ -85,6 +85,15 @@ public:
QStatusBar *statusBar;
QLabel * headerLabel;
QTextEdit * headerTextEdit;
QLabel * initLabel;
QTextEdit * initTextEdit;
QLabel * prototypeLabel;
QTextEdit * blockTextEdit;
QLabel * extraLabel;
QTextEdit * extraTextEdit;
private slots:
void deleteItem();
void sceneScaleChanged(const QString &scale);
@@ -131,14 +140,6 @@ private:
QButtonGroup *buttonGroup;
QLabel * headerLabel;
QTextEdit * headerTextEdit;
QLabel * prototypeLabel;
QTextEdit * blockTextEdit;
QLabel * extraLabel;
QTextEdit * extraTextEdit;
int selectedButton;
QString myFilePath;

View File

@@ -0,0 +1,35 @@
<!--File for SIE Code Generator. Custmos Blocks-->
<CustomItem BlockName="Multiplier Int">
<Polygon>
<Point x="-60" y="-10"/>
<Point x="-60" y="10"/>
<Point x="20" y="10"/>
<Point x="20" y="-10"/>
<Point x="60" y="-10"/>
<Point x="60" y="10"/>
<Point x="20" y="10"/>
<Point x="60" y="10"/>
<Point x="60" y="-10"/>
<Point x="-20" y="-10"/>
<Point x="-30" y="0"/>
<Point x="-20" y="10"/>
<Point x="-20" y="10"/>
<Point x="-30" y="0"/>
<Point x="-40" y="10"/>
<Point x="-40" y="10"/>
<Point x="-30" y="0"/>
<Point x="-40" y="-10"/>
<Point x="-40" y="-10"/>
<Point x="-30" y="0"/>
<Point x="-20" y="-10"/>
<Point x="-20" y="-10"/>
</Polygon>
<TextItems>
<TextItem myStyleIO="131" posOffset-y="-0" editableItem="0" ID="0" text="IN" posOffset-x="-60"/>
<TextItem myStyleIO="3" posOffset-y="-0" editableItem="0" ID="1" text="OUT" posOffset-x="60"/>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="2" text="1" posOffset-x="0"/>
</TextItems><![CDATA[]]><![CDATA[
]]><![CDATA[
out_1 = in_o * value_2;
]]><![CDATA[]]></CustomItem>

View File

@@ -0,0 +1,29 @@
<!--File for SIE Code Generator. Custmos Blocks-->
<CustomItem BlockName="Plus Int">
<Polygon>
<Point x="-60" y="-10"/>
<Point x="-60" y="10"/>
<Point x="-30" y="10"/>
<Point x="-30" y="-10"/>
<Point x="-30" y="0"/>
<Point x="-20" y="0"/>
<Point x="-40" y="0"/>
<Point x="-40" y="0"/>
<Point x="-30" y="0"/>
<Point x="-30" y="10"/>
<Point x="60" y="10"/>
<Point x="60" y="-10"/>
<Point x="60" y="10"/>
<Point x="20" y="10"/>
<Point x="20" y="-10"/>
<Point x="60" y="-10"/>
</Polygon>
<TextItems>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="1" ID="2" text="1" posOffset-x="0"/>
<TextItem myStyleIO="3" posOffset-y="10" editableItem="0" ID="1" text="OUT" posOffset-x="60"/>
<TextItem myStyleIO="131" posOffset-y="-10" editableItem="0" ID="0" text="IN" posOffset-x="-60"/>
</TextItems><![CDATA[]]><![CDATA[
]]><![CDATA[
out_1 = in_o + value_2;
]]><![CDATA[]]></CustomItem>

View File

@@ -0,0 +1,24 @@
<!--File for SIE Code Generator. Custmos Blocks-->
<CustomItem BlockName="Printf Int">
<Polygon>
<Point x="-60" y="-20"/>
<Point x="70" y="-20"/>
<Point x="70" y="0"/>
<Point x="70" y="0"/>
<Point x="-130" y="0"/>
<Point x="-130" y="0"/>
<Point x="-60" y="0"/>
<Point x="-60" y="-20"/>
<Point x="-130" y="-20"/>
<Point x="-130" y="0"/>
<Point x="-130" y="-20"/>
</Polygon>
<TextItems>
<TextItem myStyleIO="131" posOffset-y="10" editableItem="0" ID="3" text="IN Integer" posOffset-x="-130"/>
<TextItem myStyleIO="0" posOffset-y="10" editableItem="1" ID="0" text="&quot;[%04X]&quot;" posOffset-x="30"/>
<TextItem myStyleIO="0" posOffset-y="10" editableItem="0" ID="1" text="printf" posOffset-x="-40"/>
</TextItems><![CDATA[]]><![CDATA[]]><![CDATA[
printf(value_0, in_3);
fflush(stdout);
]]><![CDATA[]]></CustomItem>

0
Software/sie_cg/block_editor/pwm_single.die Normal file → Executable file
View File

45
Software/sie_cg/block_editor/right_shift.die Normal file → Executable file
View File

@@ -1,18 +1,39 @@
<!--File for SIE Code Generator. Custmos Blocks-->
<CustomItem BlockName="Right Shift">
<Polygon>
<Point x="-70" y="-30"/>
<Point x="-70" y="20"/>
<Point x="60" y="20"/>
<Point x="60" y="-30"/>
<Point x="-50" y="-30"/>
<Point x="-70" y="-30"/>
<Point x="-60" y="0"/>
<Point x="-60" y="20"/>
<Point x="-40" y="20"/>
<Point x="-30" y="10"/>
<Point x="-40" y="0"/>
<Point x="-40" y="0"/>
<Point x="-30" y="10"/>
<Point x="-40" y="20"/>
<Point x="-40" y="20"/>
<Point x="-30" y="20"/>
<Point x="-20" y="10"/>
<Point x="-30" y="0"/>
<Point x="-20" y="0"/>
<Point x="-10" y="10"/>
<Point x="-20" y="20"/>
<Point x="-30" y="20"/>
<Point x="-20" y="20"/>
<Point x="-10" y="10"/>
<Point x="-20" y="0"/>
<Point x="30" y="0"/>
<Point x="30" y="20"/>
<Point x="-20" y="20"/>
<Point x="20" y="20"/>
<Point x="70" y="20"/>
<Point x="30" y="20"/>
<Point x="30" y="0"/>
<Point x="70" y="0"/>
<Point x="70" y="20"/>
<Point x="70" y="0"/>
</Polygon>
<TextItems>
<TextItem myStyleIO="2" posOffset-y="-0" editableItem="0" ID="3" text="OUT" posOffset-x="60"/>
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="5" text="Bitwise Shift" posOffset-x="-10"/>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="0" ID="10" text=">>" posOffset-x="-20"/>
<TextItem myStyleIO="131" posOffset-y="-0" editableItem="0" ID="2" text="IN" posOffset-x="-70"/>
<TextItem myStyleIO="131" posOffset-y="-10" editableItem="0" ID="0" text="IN" posOffset-x="-60"/>
<TextItem myStyleIO="3" posOffset-y="-10" editableItem="0" ID="1" text="OUT" posOffset-x="70"/>
<TextItem myStyleIO="0" posOffset-y="-10" editableItem="1" ID="11" text="1" posOffset-x="10"/>
</TextItems>
</CustomItem>
</TextItems><![CDATA[]]><![CDATA[]]><![CDATA[
out_1 = in_0 >> value_11;]]><![CDATA[]]></CustomItem>

0
Software/sie_cg/block_editor/test_block1.die Normal file → Executable file
View File

0
Software/sie_cg/block_editor/test_block2.die Normal file → Executable file
View File

0
Software/sie_cg/block_editor/test_block3.die Normal file → Executable file
View File

57
Software/sie_cg/block_editor/test_block4.die Normal file → Executable file
View File

@@ -1,29 +1,38 @@
<!--File for SIE Code Generator. Custmos Blocks-->
<CustomItem BlockName="BLOCK NAME HERE (not visible)">
<CustomItem BlockName="All IOs">
<Polygon>
<Point x="-60" y="100"/>
<Point x="100" y="100"/>
<Point x="100" y="60"/>
<Point x="50" y="60"/>
<Point x="50" y="20"/>
<Point x="100" y="20"/>
<Point x="100" y="-10"/>
<Point x="100" y="-20"/>
<Point x="50" y="-20"/>
<Point x="-160" y="-40"/>
<Point x="-160" y="270"/>
<Point x="-80" y="270"/>
<Point x="-80" y="120"/>
<Point x="-20" y="270"/>
<Point x="50" y="270"/>
<Point x="50" y="-40"/>
<Point x="50" y="-60"/>
<Point x="100" y="-60"/>
<Point x="100" y="-100"/>
<Point x="-60" y="-100"/>
<Point x="-60" y="-20"/>
<Point x="-100" y="-20"/>
<Point x="-100" y="20"/>
<Point x="-60" y="20"/>
<Point x="-30" y="-40"/>
<Point x="-80" y="120"/>
<Point x="-80" y="-40"/>
</Polygon>
<TextItems>
<TextItem myStyleIO="1" posOffset-y="-80" editableItem="0" ID="8" text="OUT Bool" posOffset-x="100"/>
<TextItem myStyleIO="1" posOffset-y="-0" editableItem="0" ID="1" text="OUT Bool" posOffset-x="100"/>
<TextItem myStyleIO="1" posOffset-y="80" editableItem="0" ID="6" text="OUT Bool" posOffset-x="100"/>
<TextItem myStyleIO="130" posOffset-y="-0" editableItem="0" ID="5" text="IN Bool" posOffset-x="-100"/>
</TextItems>
</CustomItem>
<TextItem myStyleIO="129" posOffset-y="-20" editableItem="0" ID="0" text="IN Bool" posOffset-x="-160"/>
<TextItem myStyleIO="130" posOffset-y="-40" editableItem="0" ID="1" text="IN Char" posOffset-x="-160"/>
<TextItem myStyleIO="131" posOffset-y="-60" editableItem="0" ID="2" text="IN Integer" posOffset-x="-160"/>
<TextItem myStyleIO="132" posOffset-y="-80" editableItem="0" ID="3" text="IN Double" posOffset-x="-160"/>
<TextItem myStyleIO="133" posOffset-y="-100" editableItem="0" ID="4" text="IN Float" posOffset-x="-160"/>
<TextItem myStyleIO="134" posOffset-y="-120" editableItem="0" ID="5" text="IN Short" posOffset-x="-160"/>
<TextItem myStyleIO="135" posOffset-y="-140" editableItem="0" ID="6" text="IN Long" posOffset-x="-160"/>
<TextItem myStyleIO="136" posOffset-y="-160" editableItem="0" ID="7" text="IN UChar" posOffset-x="-160"/>
<TextItem myStyleIO="137" posOffset-y="-180" editableItem="0" ID="8" text="IN UInt" posOffset-x="-160"/>
<TextItem myStyleIO="138" posOffset-y="-200" editableItem="0" ID="9" text="IN UShort" posOffset-x="-160"/>
<TextItem myStyleIO="139" posOffset-y="-220" editableItem="0" ID="10" text="IN ULong" posOffset-x="-160"/>
<TextItem myStyleIO="1" posOffset-y="-20" editableItem="0" ID="11" text="OUT Bool" posOffset-x="50"/>
<TextItem myStyleIO="2" posOffset-y="-40" editableItem="0" ID="12" text="OUT Char" posOffset-x="50"/>
<TextItem myStyleIO="3" posOffset-y="-60" editableItem="0" ID="13" text="OUT Integer" posOffset-x="50"/>
<TextItem myStyleIO="4" posOffset-y="-80" editableItem="0" ID="14" text="OUT Double" posOffset-x="50"/>
<TextItem myStyleIO="5" posOffset-y="-100" editableItem="0" ID="15" text="OUT Float" posOffset-x="50"/>
<TextItem myStyleIO="6" posOffset-y="-120" editableItem="0" ID="16" text="OUT Short" posOffset-x="50"/>
<TextItem myStyleIO="7" posOffset-y="-140" editableItem="0" ID="17" text="OUT Long" posOffset-x="50"/>
<TextItem myStyleIO="8" posOffset-y="-160" editableItem="0" ID="18" text="OUT UChar" posOffset-x="50"/>
<TextItem myStyleIO="9" posOffset-y="-180" editableItem="0" ID="19" text="OUT UInt" posOffset-x="50"/>
<TextItem myStyleIO="10" posOffset-y="-200" editableItem="0" ID="20" text="OUT UShort" posOffset-x="50"/>
<TextItem myStyleIO="11" posOffset-y="-220" editableItem="0" ID="21" text="OUT ULong" posOffset-x="50"/>
</TextItems><![CDATA[]]><![CDATA[]]><![CDATA[]]><![CDATA[]]></CustomItem>

0
Software/sie_cg/block_editor/timer.die Normal file → Executable file
View File

48
Software/sie_cg/block_editor/while.die Normal file → Executable file
View File

@@ -1,29 +1,35 @@
<!--File for SIE Code Generator. Custmos Blocks-->
<CustomItem BlockName="System While">
<Polygon>
<Point x="-50" y="-30"/>
<Point x="50" y="-30"/>
<Point x="50" y="-10"/>
<Point x="-50" y="-10"/>
<Point x="-50" y="30"/>
<Point x="0" y="30"/>
<Point x="0" y="0"/>
<Point x="40" y="0"/>
<Point x="40" y="20"/>
<Point x="20" y="20"/>
<Point x="20" y="10"/>
<Point x="50" y="-10"/>
<Point x="50" y="10"/>
<Point x="-50" y="10"/>
<Point x="0" y="10"/>
<Point x="10" y="20"/>
<Point x="0" y="30"/>
<Point x="20" y="30"/>
<Point x="20" y="20"/>
<Point x="20" y="30"/>
<Point x="50" y="30"/>
<Point x="50" y="-10"/>
<Point x="50" y="30"/>
<Point x="-50" y="30"/>
<Point x="-50" y="-10"/>
<Point x="20" y="50"/>
<Point x="-10" y="50"/>
<Point x="-10" y="40"/>
<Point x="0" y="40"/>
<Point x="-20" y="20"/>
<Point x="-40" y="40"/>
<Point x="-30" y="40"/>
<Point x="-30" y="70"/>
<Point x="40" y="70"/>
<Point x="40" y="10"/>
<Point x="50" y="10"/>
<Point x="50" y="80"/>
<Point x="-50" y="80"/>
<Point x="-50" y="10"/>
</Polygon>
<TextItems>
<TextItem myStyleIO="129" posOffset-y="-10" editableItem="0" ID="6" text="IN Bool" posOffset-x="-50"/>
<TextItem myStyleIO="0" posOffset-y="20" editableItem="0" ID="23" text="System While" posOffset-x="0"/>
</TextItems>
</CustomItem>
<TextItem myStyleIO="0" posOffset-y="-0" editableItem="0" ID="23" text="System While" posOffset-x="0"/>
<TextItem myStyleIO="129" posOffset-y="-20" editableItem="0" ID="6" text="IN" posOffset-x="-50"/>
</TextItems><![CDATA[/* DON'T CARE */]]><![CDATA[/* DON'T CARE */]]><![CDATA[
do
{
/***![SYSTEM WHILE]***/
firstLoop=0;
}while(in_6);]]><![CDATA[/* DON'T CARE */]]></CustomItem>