[Rojav-commits] rocgui/impl item.cpp,1.30,1.31 planpanel.cpp,1.20,1.21
Brought to you by:
robvrs
|
From: rob v. <ro...@us...> - 2005-11-29 20:39:26
|
Update of /cvsroot/rojav/rocgui/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17089 Modified Files: item.cpp planpanel.cpp Log Message: turntable in progress Index: item.cpp =================================================================== RCS file: /cvsroot/rojav/rocgui/impl/item.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** item.cpp 28 Nov 2005 20:22:07 -0000 1.30 --- item.cpp 29 Nov 2005 20:39:17 -0000 1.31 *************** *** 58,61 **** --- 58,63 ---- #include "rocrail/wrapper/public/Feedback.h" + #include <math.h> + enum { *************** *** 125,128 **** --- 127,131 ---- int c = getSize(); int cx = 1; + int cy = 1; if( StrOp.equals( wBlock.name(), NodeOp.getName( m_Props ) ) ) { *************** *** 153,160 **** updateLabel(); } ! else if( StrOp.equals( wSwitch.name(), NodeOp.getName( m_Props ) ) ) { } ! SetSize( x*c, y*c, c*cx, c ); SetBackgroundColour( *wxWHITE ); --- 156,165 ---- updateLabel(); } ! else if( StrOp.equals( wTurntable.name(), NodeOp.getName( m_Props ) ) ) { ! cx = 5; ! cy = 5; } ! SetSize( x*c, y*c, c*cx, c*cy ); SetBackgroundColour( *wxWHITE ); *************** *** 214,223 **** int c = getSize(); int cx = 1; if( StrOp.equals( wBlock.name(), NodeOp.getName( m_Props ) ) ) { cx = 4; } dc.DrawLine( 0, 0, c*cx, 0 ); ! dc.DrawLine( 0, 0, 0, c ); dc.SetUserScale( m_PlanPanel->getScale(), m_PlanPanel->getScale() ); --- 219,233 ---- int c = getSize(); int cx = 1; + int cy = 1; if( StrOp.equals( wBlock.name(), NodeOp.getName( m_Props ) ) ) { cx = 4; } + else if( StrOp.equals( wTurntable.name(), NodeOp.getName( m_Props ) ) ) { + cx = 5; + cy = 5; + } dc.DrawLine( 0, 0, c*cx, 0 ); ! dc.DrawLine( 0, 0, 0, c*cy ); dc.SetUserScale( m_PlanPanel->getScale(), m_PlanPanel->getScale() ); *************** *** 328,333 **** wxCursor cursor = wxCursor(wxCURSOR_HAND); SetCursor( cursor ); ! SetBackgroundColour( CRjBase::getYellow() ); ! Refresh(); } else if( StrOp.equals( wBlock.name(), NodeOp.getName( m_Props ) ) ) { --- 338,343 ---- wxCursor cursor = wxCursor(wxCURSOR_HAND); SetCursor( cursor ); ! //SetBackgroundColour( CRjBase::getYellow() ); ! //Refresh(); } else if( StrOp.equals( wBlock.name(), NodeOp.getName( m_Props ) ) ) { *************** *** 338,343 **** wxCursor cursor = wxCursor(wxCURSOR_HAND); SetCursor( cursor ); ! SetBackgroundColour( CRjBase::getYellow() ); ! Refresh(); } } --- 348,353 ---- wxCursor cursor = wxCursor(wxCURSOR_HAND); SetCursor( cursor ); ! //SetBackgroundColour( CRjBase::getYellow() ); ! //Refresh(); } } *************** *** 793,798 **** wxPoint* ARjItem::rotateShape( wxPoint* poly, int cnt, const char* oriStr ) { static wxPoint p[32]; ! double cos[3] = {0,-1,0}; ! double sin[3] = {1,0,-1}; enum { north=0, east, south }; int ori = east; --- 803,808 ---- wxPoint* ARjItem::rotateShape( wxPoint* poly, int cnt, const char* oriStr ) { static wxPoint p[32]; ! double __cos[3] = {0,-1,0}; ! double __sin[3] = {1,0,-1}; enum { north=0, east, south }; int ori = east; *************** *** 819,824 **** x = x - 15.5; y = 15.5 - y; ! x1 = (x * cos[ori]) - (y * sin[ori]); ! y1 = (x * sin[ori]) + (y * cos[ori]); p[i].x = (int)(x1 + 15.5); p[i].y = (int)(15.5 - y1); --- 829,834 ---- x = x - 15.5; y = 15.5 - y; ! x1 = (x * __cos[ori]) - (y * __sin[ori]); ! y1 = (x * __sin[ori]) + (y * __cos[ori]); p[i].x = (int)(x1 + 15.5); p[i].y = (int)(15.5 - y1); *************** *** 830,843 **** void ARjItem::drawShape( wxPaintDC& dc ) { - // TurnTable - static wxPoint tt1[] = { - wxPoint( 0,13),wxPoint(31,13),wxPoint(31,18),wxPoint( 0,18) - }; - static wxPoint tt2[] = { - wxPoint( 0,5),wxPoint(5,10),wxPoint(26,10),wxPoint(31,5) - }; - static wxPoint tt3[] = { - wxPoint( 0,26),wxPoint( 5,21),wxPoint(26,21),wxPoint(31,26) - }; // Track: straight static wxPoint tk_straight[] = { --- 840,843 ---- *************** *** 1067,1073 **** } else if( StrOp.equals( wTurntable.name(), nodeName ) ) { ! dc.DrawPolygon( 4, rotateShape( tt1, 4, ori ) ); ! dc.DrawPolygon( 4, rotateShape( tt2, 4, ori ) ); ! dc.DrawPolygon( 4, rotateShape( tt3, 4, ori ) ); } --- 1067,1118 ---- } 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; ! pen->SetStyle(wxSHORT_DASH); ! dc.SetPen( *pen ); ! ! dc.DrawCircle( 79, 79, 79 ); ! 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); ! ! dc.DrawCircle( 79, 79, 36 ); ! dc.DrawCircle( 79, 79, 32 ); ! dc.DrawPolygon( 4, bridge ); ! } Index: planpanel.cpp =================================================================== RCS file: /cvsroot/rojav/rocgui/impl/planpanel.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** planpanel.cpp 23 Nov 2005 20:33:56 -0000 1.20 --- planpanel.cpp 29 Nov 2005 20:39:17 -0000 1.21 *************** *** 408,413 **** TraceOp.trc( "plan", TRCLEVEL_INFO, __LINE__, 9999, "removing item id=%s from table...", id ); m_ChildTable->Delete( id ); ! //item->Show( false ); ! //item->Destroy(); Refresh(); char* text = StrOp.fmt( "%d items", m_ChildTable->GetCount() ); --- 408,413 ---- TraceOp.trc( "plan", TRCLEVEL_INFO, __LINE__, 9999, "removing item id=%s from table...", id ); m_ChildTable->Delete( id ); ! item->Show( false ); ! item->Destroy(); Refresh(); char* text = StrOp.fmt( "%d items", m_ChildTable->GetCount() ); |