[Sofaswitch-svn] [commit] r68 - in sofaswitch/trunk/callflow: . bitmaps
Author: derek Date: Fri Sep 1 00:58:20 2006 New Revision: 68 Added: sofaswitch/trunk/callflow/bitmaps/RequestNode.xpm Modified: sofaswitch/trunk/callflow/callflow.cpp sofaswitch/trunk/callflow/callflow.h sofaswitch/trunk/callflow/config.log sofaswitch/trunk/callflow/dnd.cpp sofaswitch/trunk/callflow/dnd.h sofaswitch/trunk/callflow/drawshape.cpp sofaswitch/trunk/callflow/drawshape.h Log: Add a structure for requesting a worker node. This structure will send off the request, nothing more. Added: sofaswitch/trunk/callflow/bitmaps/RequestNode.xpm ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/bitmaps/RequestNode.xpm Fri Sep 1 00:58:20 2006 @@ -0,0 +1,23 @@ +/* XPM */ +static char *RequestNode[]={ +"16 15 5 1", +". c None", +"# c #00c000", +"b c #303030", +"c c #585858", +"a c #ffc0c0", +"................", +"....#.###.......", +"....##aaa#......", +"....#aaaaa#.....", +"....##aaa#......", +"...##.###..b##b.", +"...##......##c#b", +"...#.#....c#...b", +"...#.#....#...#b", +"..#...#......#b.", +"..#....#.....#c.", +"..#.........#c..", +"..#.........c...", +".#..........c...", +"............#..."}; Modified: sofaswitch/trunk/callflow/callflow.cpp ============================================================================== --- sofaswitch/trunk/callflow/callflow.cpp (original) +++ sofaswitch/trunk/callflow/callflow.cpp Fri Sep 1 00:58:20 2006 @@ -28,8 +28,8 @@ #include "bitmaps/HelpAbout.xpm" //#include "bitmaps/newshape.xpm" -#include "bitmaps/EditCut.xpm" #include "bitmaps/EditCopy.xpm" +#include "bitmaps/EditCut.xpm" #include "bitmaps/EditPaste.xpm" #include "bitmaps/FileNew.xpm" #include "bitmaps/FileOpen.xpm" @@ -37,6 +37,7 @@ #include "bitmaps/FileSave__As.xpm" #include "bitmaps/JoinObjects.xpm" #include "bitmaps/Python.xpm" +#include "bitmaps/RequestNode.xpm" #include "bitmaps/compile.xpm" class MyFrame ; @@ -58,31 +59,32 @@ #include "callflow.h" BEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_MENU ( wxH_EDITPASTE, MyFrame::OnEditPaste) - EVT_MENU ( wxH_EDITCOPY, MyFrame::OnEditCopy) - EVT_MENU ( wxH_EDITCUT, MyFrame::OnEditCut) - EVT_MENU ( wxH_HELPABOUT, MyFrame::OnHelpAbout) - EVT_MENU ( wxH_HELPMANUAL, MyFrame::OnHelpManual) - EVT_MENU ( wxH_CONTROLSMAKE_PLAY_HRECORD, MyFrame::OnControlsmake_play_Hrecord) - EVT_MENU ( wxH_CONTROLSJOIN_PLAY_HRECORD, MyFrame::OnControlsjoin_play_Hrecord) - EVT_MENU ( wxH_CONTROLSMAKE_CONFERENCE, MyFrame::OnControlsmake_conference) - EVT_MENU ( wxH_CONTROLSJOIN_CONFERENCE, MyFrame::OnControlsjoin_conference) - EVT_MENU ( wxH_CONTROLSMAKE_CALL, MyFrame::OnControlsmake_call) - EVT_MENU ( wxH_CONTROLSPYTHON, MyFrame::OnControlspython) - EVT_MENU ( wxH_CONTROLSEND_FOR, MyFrame::OnControlsend_for) - EVT_MENU ( wxH_CONTROLSFOR, MyFrame::OnControlsfor) - EVT_MENU ( wxH_CONTROLSIF, MyFrame::OnControlsif) - EVT_MENU ( wxH_CONTROLSEND, MyFrame::OnControlsend) - EVT_MENU ( wxH_CONTROLSSTARTHERE, MyFrame::OnControlsstarthere) - EVT_MENU ( wxH_CONTROLSENDHERE, MyFrame::OnControlsendhere) - EVT_MENU ( wxH_CONTROLSCONNECT_OBJECTS, MyFrame::OnControlsConnectObjects) - EVT_MENU ( wxH_CONTROLSCOMPILE, MyFrame::OnCompile) - EVT_MENU ( wxH_FILEE_XIT, MyFrame::OnFileE_xit) - EVT_MENU ( wxH_FILESAVE__AS, MyFrame::OnFileSave__As) - EVT_MENU ( wxH_FILESAVE, MyFrame::OnFileSave) - EVT_MENU ( wxH_FILEOPEN, MyFrame::OnFileOpen) - EVT_MENU ( wxH_FILENEW, MyFrame::OnFileNew) - EVT_CLOSE(MyFrame::OnClose) + EVT_MENU ( wxH_EDITPASTE, MyFrame::OnEditPaste) + EVT_MENU ( wxH_EDITCOPY, MyFrame::OnEditCopy) + EVT_MENU ( wxH_EDITCUT, MyFrame::OnEditCut) + EVT_MENU ( wxH_HELPABOUT, MyFrame::OnHelpAbout) + EVT_MENU ( wxH_HELPMANUAL, MyFrame::OnHelpManual) + EVT_MENU ( wxH_CONTROLSMAKE_PLAY_HRECORD, MyFrame::OnControlsmake_play_Hrecord) + EVT_MENU ( wxH_CONTROLSJOIN_PLAY_HRECORD, MyFrame::OnControlsjoin_play_Hrecord) + EVT_MENU ( wxH_CONTROLSMAKE_CONFERENCE, MyFrame::OnControlsmake_conference) + EVT_MENU ( wxH_CONTROLSJOIN_CONFERENCE, MyFrame::OnControlsjoin_conference) + EVT_MENU ( wxH_CONTROLSMAKE_CALL, MyFrame::OnControlsmake_call) + EVT_MENU ( wxH_CONTROLSREQUESTNODE, MyFrame::OnControlsrequestnode) + EVT_MENU ( wxH_CONTROLSPYTHON, MyFrame::OnControlspython) + EVT_MENU ( wxH_CONTROLSEND_FOR, MyFrame::OnControlsend_for) + EVT_MENU ( wxH_CONTROLSFOR, MyFrame::OnControlsfor) + EVT_MENU ( wxH_CONTROLSIF, MyFrame::OnControlsif) + EVT_MENU ( wxH_CONTROLSEND, MyFrame::OnControlsend) + EVT_MENU ( wxH_CONTROLSSTARTHERE, MyFrame::OnControlsstarthere) + EVT_MENU ( wxH_CONTROLSENDHERE, MyFrame::OnControlsendhere) + EVT_MENU ( wxH_CONTROLSCONNECT_OBJECTS, MyFrame::OnControlsConnectObjects) + EVT_MENU ( wxH_CONTROLSCOMPILE, MyFrame::OnCompile) + EVT_MENU ( wxH_FILEE_XIT, MyFrame::OnFileE_xit) + EVT_MENU ( wxH_FILESAVE__AS, MyFrame::OnFileSave__As) + EVT_MENU ( wxH_FILESAVE, MyFrame::OnFileSave) + EVT_MENU ( wxH_FILEOPEN, MyFrame::OnFileOpen) + EVT_MENU ( wxH_FILENEW, MyFrame::OnFileNew) + EVT_CLOSE(MyFrame::OnClose) END_EVENT_TABLE() ; @@ -130,6 +132,7 @@ File_menu -> Append ( wxH_FILEE_XIT, wxT("E&xit"), wxT("")); Controls_menu -> Append ( wxH_CONTROLSSTARTHERE, wxT("start here"), wxT("")); Controls_menu -> Append ( wxH_CONTROLSENDHERE, wxT("end here"), wxT("")); + Controls_menu -> Append ( wxH_CONTROLSREQUESTNODE, wxT("request node"), wxT("")); Controls_menu -> Append ( wxH_CONTROLSEND, wxT("end"), wxT("")); Controls_menu -> Append ( wxH_CONTROLSIF, wxT("if"), wxT("")); Controls_menu -> Append ( wxH_CONTROLSFOR, wxT("for"), wxT("")); @@ -280,7 +283,7 @@ toolBar->AddTool(wxH_CONTROLSSTARTHERE, wxBitmap ( Controlsstart ), wxT("Start processing")); toolBar->AddTool(wxH_CONTROLSENDHERE, wxBitmap ( ControlsEndHere ), wxT("End processing")); - + toolBar->AddTool(wxH_CONTROLSREQUESTNODE, wxBitmap (RequestNode ), wxT("Query Supervisor for worker")); toolBar->AddTool(wxH_CONTROLSIF, wxBitmap ( ControlsIf_xpm ), wxT("Test a condition")); toolBar->AddTool(wxH_CONTROLSFOR, wxBitmap ( Controlsfor_xpm ), wxT("Start a for loop")); @@ -309,7 +312,13 @@ canvas->SetEditingMode(MyCanvas::PlaceOneShape); } +void MyFrame::OnControlsrequestnode (wxCommandEvent & WXUNUSED(event)) +{ + imageTypeForPlacing = DndShape::RequestNode; + canvas->SetEditingMode(MyCanvas::PlaceOneShape); +} + void MyFrame::OnControlsend (wxCommandEvent & WXUNUSED(event)) { imageTypeForPlacing = DndShape::EndCall; @@ -451,4 +460,3 @@ file.Close(); } - Modified: sofaswitch/trunk/callflow/callflow.h ============================================================================== --- sofaswitch/trunk/callflow/callflow.h (original) +++ sofaswitch/trunk/callflow/callflow.h Fri Sep 1 00:58:20 2006 @@ -17,6 +17,7 @@ wxH_FILEE_XIT, wxH_CONTROLSSTARTHERE, wxH_CONTROLSENDHERE, + wxH_CONTROLSREQUESTNODE, wxH_CONTROLSEND, wxH_CONTROLSIF, wxH_CONTROLSFOR, @@ -62,6 +63,7 @@ void InitToolBar(wxToolBar* toolBar); void OnControlsstarthere (wxCommandEvent & event); void OnControlsendhere (wxCommandEvent & event); + void OnControlsrequestnode (wxCommandEvent & event); void OnControlsend (wxCommandEvent & event); void OnControlsif (wxCommandEvent & event); void OnControlsfor (wxCommandEvent & event); Modified: sofaswitch/trunk/callflow/config.log ============================================================================== --- sofaswitch/trunk/callflow/config.log (original) +++ sofaswitch/trunk/callflow/config.log Fri Sep 1 00:58:20 2006 @@ -4,13 +4,13 @@ It was created by configure, which was generated by GNU Autoconf 2.57. Invocation command line was - $ ./configure --with-wxWINDIR=/usr/local/src/wxWidgets-2.6.3 + $ ./configure ## --------- ## ## Platform. ## ## --------- ## -hostname = dhcp22 +hostname = kauri uname -m = x86_64 uname -r = 2.6.16.13-4-smp uname -s = Linux @@ -46,21 +46,11 @@ configure:1196: Configuring callflow... configure:1198: Checking for wxWidgets (formerly wxWindows) library... -configure:1221: checking for /usr/local/src/wxWidgets-2.6.3 -configure:1236: result: yes -configure:1252: checking for /usr/local/src/wxWidgets-2.6.3/wx-config -configure:1267: result: yes -configure:1270: essential wxWidgets file - wx-config - found -configure:1282: checking for /wx-config.in -configure:1297: result: no -configure:1304: checking for /usr/local/src/wxWidgets-2.6.3/wx-config.in -configure:1319: result: yes -configure:1362: Checking if wxWidgets library is < 2.4.3 -configure:1402: required wxWidgets version (>2.5.0) found -configure:1408: Checking if wxWidgets library has been built -configure:1411: wxWidgets has been built -configure:1423: using configuration from wxWidgets config.status -configure:1431: Makefile timestamp is +configure:1221: checking for +configure:1236: result: no +configure:1243: error: directory passed on command line - + - does not exist!! + Did you type the command line --with-wxWINDIR=DIR correctly ?? ## ---------------- ## ## Cache variables. ## @@ -72,10 +62,7 @@ ac_cv_env_host_alias_value= ac_cv_env_target_alias_set= ac_cv_env_target_alias_value= -ac_cv_file__usr_local_src_wxWidgets_2_6_3=yes -ac_cv_file__usr_local_src_wxWidgets_2_6_3_wx_config=yes -ac_cv_file__usr_local_src_wxWidgets_2_6_3_wx_config_in=yes -ac_cv_file__wx_config_in=no +ac_cv_file_=no ## ----------------- ## ## Output variables. ## @@ -122,4 +109,4 @@ #define PACKAGE_TARNAME "" #define PACKAGE_VERSION "" -configure: exit 0 +configure: exit 1 Modified: sofaswitch/trunk/callflow/dnd.cpp ============================================================================== --- sofaswitch/trunk/callflow/dnd.cpp (original) +++ sofaswitch/trunk/callflow/dnd.cpp Fri Sep 1 00:58:20 2006 @@ -333,6 +333,9 @@ if (thisKind == EndHere) return DndShapeEndHere::GetKindName(); + if (thisKind == RequestNode) + return DndShapeRequestNode::GetKindName(); + if (thisKind == StartFor) return DndShapeStartFor::GetKindName(); @@ -447,6 +450,9 @@ if (shapeRequired == EndHere) return new DndShapeEndHere(); + if (shapeRequired == RequestNode) + return new DndShapeRequestNode(); + if (shapeRequired == EndCall) return new DndShapeEndCall(); Modified: sofaswitch/trunk/callflow/dnd.h ============================================================================== --- sofaswitch/trunk/callflow/dnd.h (original) +++ sofaswitch/trunk/callflow/dnd.h Fri Sep 1 00:58:20 2006 @@ -250,6 +250,7 @@ /* 8 */ Select /**Used to indicate the rectangle on the screen we are selecting */, /* 9 */ JoinBlocks /**The multi line segment shape which joins two structures on the screen */, /* 10*/ Python /**The user can enter arbitary python here */, + /* 11*/ RequestNode /**Query a supervisor for a node to use to talk on*/, /* 11*/ KnownShapes /**Indicates the number of known shapes we can manage */ }; Modified: sofaswitch/trunk/callflow/drawshape.cpp ============================================================================== --- sofaswitch/trunk/callflow/drawshape.cpp (original) +++ sofaswitch/trunk/callflow/drawshape.cpp Fri Sep 1 00:58:20 2006 @@ -79,12 +79,9 @@ DrawBox(dc, 30, 15, 20, 20); dc.DrawLine(pA, pB); + DrawArrow(dc, pB, ArrowDown, OutputPointConnected(0) ? Connected : Loose); + - if (OutputPointConnected(0)) - DrawArrow(dc, pB, ArrowDown, Connected); - else - DrawArrow(dc, pB, ArrowDown, Loose); - DndShape::Draw(dc); // dc.SetBrush(wxBrush(m_col, wxSOLID)); // dc.FloodFill(GetCentre(), m_col, wxFLOOD_BORDER); @@ -139,12 +136,8 @@ DrawBox(dc, 30, 15, 20, 20); dc.DrawLine(pA, pB); + DrawArrow(dc, pA, ArrowDown, InputPointConnected(0) ? Connected : Loose); - if (InputPointConnected(0)) - DrawArrow(dc, pA, ArrowDown, Connected); - else - DrawArrow(dc, pA, ArrowDown, Loose); - DndShape::Draw(dc); // dc.SetBrush(wxBrush(m_col, wxSOLID)); // dc.FloodFill(GetCentre(), m_col, wxFLOOD_BORDER); @@ -176,6 +169,87 @@ return true; } + +///////////////////////////////////////////////////////////////////////////// + + +DndShapeRequestNode::DndShapeRequestNode() + : DndShape(RequestNode) +{ + wxSize newSize(50, 50); + SetSize(newSize); + + displayData[displayData.size()] = + InformationSection(wxT("request node from "), wxT("voip")); + + relInputPoints.Add(25, 0); + relOutputPoints.Add(25, 50); + AdjustIoPoints(); +} + +void DndShapeRequestNode::Draw(wxDC& dc) +{ + DrawCompileError(dc); + dc.SetPen(*wxBLACK_PEN); + + wxPoint p1(m_rect.GetPosition()); + wxPoint pA(p1.x + 25, p1.y + 0); + wxPoint pB(p1.x + 25, p1.y + 50); + + + dc.DrawLine(pA, pB); + + wxString text("R ?"); + wxFont f = wxFont(*wxITALIC_FONT); + f.SetPointSize(20); + dc.SetFont(f);//*wxITALIC_FONT); + wxCoord w, h; + dc.GetTextExtent(text, &w, &h); + + int xPos = m_rect.x + 0 + ((50 - w)/2); + int yPos = m_rect.y + 10 + ((21 - h)/2); + dc.DrawText(text, xPos, yPos); + + DrawArrow(dc, pA, ArrowDown, InputPointConnected(0) ? Connected : Loose); + DrawArrow(dc, pB, ArrowDown, OutputPointConnected(0) ? Connected : Loose); + + DndShape::Draw(dc); + // dc.SetBrush(wxBrush(m_col, wxSOLID)); + // dc.FloodFill(GetCentre(), m_col, wxFLOOD_BORDER); +} + +bool DndShapeRequestNode::WriteSystemCode(wxTextFile & file) +{ + file.AddLine(" def Request_Node(self, aTuple): "); + file.AddLine(" id,y,z = aTuple"); + file.AddLine(" return data[id][\"Output\"]"); + file.AddLine(""); + return true; +} + +bool DndShapeRequestNode::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())); + + wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst(); + const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel(); + file.AddLine(wxString::Format(" \"Output\" : ")); + file.AddLine(wxString::Format(" %s, ", outputLabel.c_str())); + + + file.AddLine(wxString::Format(" \"request node from\" : ")); + file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str())); + + file.AddLine(wxString::Format(" },")); + + return true; +} + ///////////////////////////////////////////////////////////////////////////// DndShapePython::DndShapePython() Modified: sofaswitch/trunk/callflow/drawshape.h ============================================================================== --- sofaswitch/trunk/callflow/drawshape.h (original) +++ sofaswitch/trunk/callflow/drawshape.h Fri Sep 1 00:58:20 2006 @@ -86,6 +86,36 @@ virtual bool WriteThisShapeInfo(wxTextFile & file); }; + +////////////////////////////////////////////////////////////////////////////////////////////// +/**Define a request node shape. This code will return almost immediately, and we leave it to + the timer object to recover from if there was an answer, or noting + Store values for size, location, input & output points. + This instance has the ability to draw this shape to a specified location on the canvas */ +class DndShapeRequestNode : public DndShape +{ +public: + /**Construtor, Define this shape in terms of size and points etc */ + DndShapeRequestNode(); + + /**Destroy this shape, and log it */ + virtual ~DndShapeRequestNode() + { + } + + /**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("Request Node"); } + + /**Write the code generic to this StartHere shape */ + virtual bool WriteSystemCode(wxTextFile & file); + + /**Write the dictionary containing relevant points for this shape */ + virtual bool WriteThisShapeInfo(wxTextFile & file); +}; + ////////////////////////////////////////////////////////////////////////////////////////////// /**Define a shape to indicate the start of a foor loop. Store values for size, location, input & output points. This instance has the
participants (1)
-
SofaSWITCH SVN