[Rojav-commits] rocgui/impl item.cpp,1.31,1.32 planpanel.cpp,1.21,1.22
Brought to you by:
robvrs
|
From: rob v. <ro...@us...> - 2005-11-30 20:46:15
|
Update of /cvsroot/rojav/rocgui/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28830 Modified Files: item.cpp planpanel.cpp Log Message: turntable modifications Index: item.cpp =================================================================== RCS file: /cvsroot/rojav/rocgui/impl/item.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** item.cpp 29 Nov 2005 20:39:17 -0000 1.31 --- item.cpp 30 Nov 2005 20:46:00 -0000 1.32 *************** *** 55,58 **** --- 55,59 ---- #include "rocrail/wrapper/public/Track.h" #include "rocrail/wrapper/public/Turntable.h" + #include "rocrail/wrapper/public/TTTrack.h" #include "rocrail/wrapper/public/Loc.h" #include "rocrail/wrapper/public/Feedback.h" *************** *** 61,64 **** --- 62,67 ---- + static double PI25DT = 3.141592653589793238462643; + enum { // menu items *************** *** 159,162 **** --- 162,172 ---- cx = 5; cy = 5; + bridgepos = 0.0; + iONode track = wTurntable.gettrack( m_Props ); + while( track != NULL ) { + m_PlanPanel->addItem( wTTTrack.getposfb( track ), this ); + track = wTurntable.nexttrack( m_Props, track ); + } + } *************** *** 719,722 **** --- 729,751 ---- } + const char* id = wItem.getid( node ); + if( !StrOp.equals( id, wItem.getid( m_Props ) ) ) { + if( StrOp.equals( wTurntable.name(), NodeOp.getName( m_Props ) ) ) { + // Could be a turntable (invisible) feedback... + iONode track = wTurntable.gettrack( m_Props ); + while( track != NULL ) { + if( StrOp.equals( id, wTTTrack.getposfb( track ) ) ) { + TraceOp.trc( "item", TRCLEVEL_INFO, __LINE__, 9999, "posfb \"%s\" for nr %d = %s", + id, wTTTrack.getnr( track ), + wFeedback.isstate( node ) ? "ON":"OFF" ); + wTTTrack.setstate( track, wFeedback.isstate( node ) ); + } + track = wTurntable.nexttrack( m_Props, track ); + } + } + Refresh(); + return; + } + const char* type = wItem.gettype( node ); if( type != NULL ) { *************** *** 1067,1073 **** } else if( StrOp.equals( wTurntable.name(), nodeName ) ) { - wxPoint bridge[] = { - wxPoint( 64+12,16+32),wxPoint(64+12,16+96),wxPoint(64+19,16+96),wxPoint( 64+19,16+32) - }; wxPen* pen = wxLIGHT_GREY_PEN; --- 1096,1099 ---- *************** *** 1078,1111 **** pen->SetStyle(wxSOLID); ! pen = wxGREY_PEN; ! pen->SetWidth(5); ! dc.SetPen(*pen); ! ! double PI25DT = 3.141592653589793238462643; ! double a = (60.0*2*PI25DT)/360; ! double xa = cos(a) * 79.0; ! double ya = sin(a) * 79.0; ! int x = 79 + (int)xa; ! int y = 79 - (int)ya; ! dc.DrawLine( 79, 79, x, y ); ! a = (120.0*2*PI25DT)/360; ! xa = cos(a) * 79.0; ! ya = sin(a) * 79.0; ! x = 79 + (int)xa; ! y = 79 - (int)ya; ! dc.DrawLine( 79, 79, x, y ); ! pen = wxBLACK_PEN; ! pen->SetWidth(5); ! dc.SetPen(*pen); ! a = (90.0*2*PI25DT)/360; ! xa = cos(a) * 79.0; ! ya = sin(a) * 79.0; ! x = 79 + (int)xa; ! y = 79 - (int)ya; ! dc.DrawLine( 79, 79, x, y ); pen->SetWidth(1); dc.SetPen(*pen); --- 1104,1134 ---- pen->SetStyle(wxSOLID); ! iONode track = wTurntable.gettrack( m_Props ); ! while( track != NULL ) { ! double degr = 7.5 * wTTTrack.getnr( track ); ! double a = (degr*2*PI25DT)/360; ! double xa = cos(a) * 79.0; ! double ya = sin(a) * 79.0; ! int x = 79 + (int)xa; ! int y = 79 - (int)ya; ! if( wTTTrack.isstate( track ) ) { ! pen = wxBLACK_PEN; ! pen->SetWidth(5); ! dc.SetPen(*pen); ! bridgepos = degr; ! } ! else { ! pen = wxGREY_PEN; ! pen->SetWidth(5); ! dc.SetPen(*pen); ! } ! dc.DrawLine( 79, 79, x, y ); ! track = wTurntable.nexttrack( m_Props, track ); ! } + pen = wxBLACK_PEN; pen->SetWidth(1); dc.SetPen(*pen); *************** *** 1113,1117 **** dc.DrawCircle( 79, 79, 36 ); dc.DrawCircle( 79, 79, 32 ); ! dc.DrawPolygon( 4, bridge ); } --- 1136,1140 ---- dc.DrawCircle( 79, 79, 36 ); dc.DrawCircle( 79, 79, 32 ); ! dc.DrawPolygon( 5, rotateBridge( bridgepos ) ); } *************** *** 1120,1121 **** --- 1143,1167 ---- } + wxPoint* ARjItem::rotateBridge( double ori ) { + static wxPoint p[5]; + double bp[4] = { 10.0, 170.0, 190.0, 350.0 }; + + for( int i = 0; i < 4; i++ ) { + double angle = ori+bp[i]; + if( angle > 360.0 ) + angle = angle -360.0; + double a = (angle*2*PI25DT)/360; + double xa = cos(a) * 32.0; + double ya = sin(a) * 32.0; + p[i].x = 79 + (int)xa; + p[i].y = 79 - (int)ya; + if( i == 0 ) { + // end point to close the polygon + p[4].x = p[i].x; + p[4].y = p[i].y; + } + } + return p; + } + + Index: planpanel.cpp =================================================================== RCS file: /cvsroot/rojav/rocgui/impl/planpanel.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** planpanel.cpp 29 Nov 2005 20:39:17 -0000 1.21 --- planpanel.cpp 30 Nov 2005 20:46:00 -0000 1.22 *************** *** 359,366 **** ARjItem* item = new ARjItem( (CRjPlanPanel*)this, child ); m_ChildTable->Put( wItem.getid( child ), item ); ! char* text = StrOp.fmt( "%d items", m_ChildTable->GetCount() ); ! wxGetApp().getFrame()->setInfoText( text ); ! freeMem( text ); } } --- 359,370 ---- ARjItem* item = new ARjItem( (CRjPlanPanel*)this, child ); m_ChildTable->Put( wItem.getid( child ), item ); + } + } + } ! void CRjPlanPanel::addItem( const char* id, wxWindow* item ) { ! if( id != NULL ) { ! if( m_ChildTable->Get( id ) == NULL ) { ! m_ChildTable->Put( id, item ); } } *************** *** 369,372 **** --- 373,383 ---- void CRjPlanPanel::addMultipleItem(wxCommandEvent& event) { iONode node = (iONode)event.GetClientData(); + + if( StrOp.equals( NodeOp.getName( node ), wModelCmd.name() ) ) { + wxGetApp().sendToRocrail( node ); + NodeOp.base.del( node ); + return; + } + int cnt = NodeOp.getChildCnt( node ); for( int i = 0; i < cnt; i++ ) { *************** *** 374,377 **** --- 385,391 ---- addItem( child ); } + char* text = StrOp.fmt( "%d items", m_ChildTable->GetCount() ); + wxGetApp().getFrame()->setInfoText( text ); + freeMem( text ); } *************** *** 450,453 **** --- 464,473 ---- } else { + if( StrOp.equals( NodeOp.getName( node ), wModelCmd.name() ) ) { + wxGetApp().sendToRocrail( node ); + NodeOp.base.del( node ); + return; + } + int cnt = NodeOp.getChildCnt( node ); for( int i = 0; i < cnt; i++ ) { *************** *** 494,500 **** iONode cmd = NodeOp.inst( wModelCmd.name(), NULL, ELEMENT_NODE ); wModelCmd.setcmd( cmd, wModelCmd.fstat ); ! ThreadOp.sleep( 1000 ); ! wxGetApp().sendToRocrail( cmd ); ! cmd->base.del( cmd ); } --- 514,518 ---- iONode cmd = NodeOp.inst( wModelCmd.name(), NULL, ELEMENT_NODE ); wModelCmd.setcmd( cmd, wModelCmd.fstat ); ! o->addItems( cmd ); } |