sevenseg.cpp

00001 /***************************************************************************
00002  *   Copyright (C) 2003 by David Saxton                                    *
00003  *   david@bluehaze.org                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  ***************************************************************************/
00010 
00011 #include "sevenseg.h"
00012 
00013 #include "libraryitem.h"
00014 #include "flowcode.h"
00015 
00016 #include <klocale.h>
00017 
00018 Item* SevenSeg::construct( ItemDocument *itemDocument, bool newItem, const char *id )
00019 {
00020         return new SevenSeg( (ICNDocument*)itemDocument, newItem, id );
00021 }
00022 
00023 
00024 LibraryItem* SevenSeg::libraryItem()
00025 {
00026         return new LibraryItem(
00027                 "flow/sevenseg",
00028                 i18n("Seven Segment"),
00029                 "Functions",
00030                 "seven_segment.png",
00031                 LibraryItem::lit_flowpart,
00032                 SevenSeg::construct
00033                         );
00034 }
00035 
00036 
00037 SevenSeg::SevenSeg( ICNDocument *icnDocument, bool newItem, const char *id )
00038         : FlowPart( icnDocument, newItem, id ? id : "sevenseg" )
00039 {
00040         m_name = i18n("SevenSeg");
00041         m_desc = i18n("Output to a Seven Segment display.");
00042         initProcessSymbol();
00043         createStdInput();
00044         createStdOutput();
00045         
00046         createProperty( "expression", Variant::Type::Combo );
00047         property("expression")->setValue("x");
00048         property("expression")->setCaption( i18n("Variable") );
00049         
00050         createProperty( "sevenseg", Variant::Type::SevenSegment );
00051         property("sevenseg")->setCaption( i18n("Pin map") );
00052 }
00053 
00054 
00055 SevenSeg::~SevenSeg()
00056 {
00057 }
00058 
00059 
00060 void SevenSeg::dataChanged()
00061 {
00062         setCaption( i18n("Display %1 on %2").arg( dataString("expression") ).arg( dataString("sevenseg") ) );
00063 }
00064 
00065 
00066 void SevenSeg::generateMicrobe( FlowCode *code )
00067 {
00068         code->addCode( QString("%1 = %2").arg( dataString("sevenseg") ).arg( dataString("expression") ) );
00069         code->addCodeBranch( outputPart("stdoutput") );
00070 }
00071 

Generated on Tue May 8 17:05:32 2007 for KTechLab by  doxygen 1.5.1