[Sofaswitch-svn] [commit] r138 - sofaswitch/trunk/callflow/src
Author: derek Date: Wed Sep 27 21:34:43 2006 New Revision: 138 Added: sofaswitch/trunk/callflow/src/death.cpp sofaswitch/trunk/callflow/src/death.h Log: Add these source files. Added: sofaswitch/trunk/callflow/src/death.cpp ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/death.cpp Wed Sep 27 21:34:43 2006 @@ -0,0 +1,76 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif +#include <wx/textfile.h> +#include <wx/tokenzr.h> +#include "shapelist.h" + +#include "death.h" +#include "bitmaps/death.xpm" + +///////////////////////////////////////////////////////////////////////////// +DndShapeDeath::DndShapeDeath() + : DndShape(Death) +{ + wxSize newSize(50, 40); + SetSize(newSize); + + relInputPoints.Add(25, 0); + AdjustIoPoints(); + + skullBitmap = wxBitmap(death); +} + +void DndShapeDeath::Draw(wxDC& dc) +{ + DrawCompileError(dc); + dc.SetPen(*wxBLACK_PEN); + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); + + wxPoint p1(m_rect.GetPosition()); + wxPoint pA(p1.x + 25, p1.y + 15); + wxPoint pB(p1.x + 25, p1.y + 0); + wxPoint pC(p1.x + 25, p1.y + 10); + dc.DrawLine(pA, pB); + DrawArrow(dc, pC, ArrowDown, InputPointConnected(0) ? Connected : Loose); + + dc.DrawBitmap(skullBitmap, p1.x + 13, p1.y + 15, true); + + DndShape::Draw(dc); +} + +bool DndShapeDeath::WriteSystemCode(wxTextFile & file) +{ + file.AddLine(" def Death(self, sTuple): "); + file.AddLine(" \"\"\"Terminate processing of this flow chart, by closing this whole thing down "); + file.AddLine(" \"\"\" "); + file.AddLine(" a,b,c = sTuple "); + file.AddLine(" #print \"end of processing at \", a "); + file.AddLine(" return None "); + file.AddLine(" "); + + return true; +} + +bool DndShapeDeath::WriteThisShapeInfo(wxTextFile & file) +{ + file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str())); + + wxNode *inputNode = (wxNode *)GetInputPoints().GetFirst(); + const wxString & inputLabel = ((LabelledPoint *)inputNode->GetData())->GetFullLabel(); + + file.AddLine(wxString::Format(" \"Input\" : ")); + file.AddLine(wxString::Format(" %s, ", inputLabel.c_str())); + + file.AddLine(wxString::Format(" },")); + + return true; +} + Added: sofaswitch/trunk/callflow/src/death.h ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/death.h Wed Sep 27 21:34:43 2006 @@ -0,0 +1,35 @@ +#ifndef DEATH_H + +#define DEATH_H + + +#include "dnd.h" + + +////////////////////////////////////////////////////////////////////////////////////////////// +/**Define a shape to indicate the end of processing completely. This instance + has the ability to draw this shape to a specified location on the canvas */ +class DndShapeDeath : public DndShape +{ +public: + /**Construtor, Define this shape in terms of size and points etc */ + DndShapeDeath(); + + /**Draw this particular shape to the screen..*/ + virtual void Draw(wxDC& dc); + + /** Used to report the name of this particular class. */ + static wxString GetKindName() { return wxString("Death"); } + + /**Write the code generic to this Death shape */ + virtual bool WriteSystemCode(wxTextFile & file); + + /**Write the dictionary containing relevant points for this shape */ + virtual bool WriteThisShapeInfo(wxTextFile & file); + + private: + /**The bitmap describing the image to draw */ + wxBitmap skullBitmap; +}; + +#endif
participants (1)
-
SofaSWITCH SVN