Revision: 6630
http://playerstage.svn.sourceforge.net/playerstage/?rev=6630&view=rev
Author: jeremy_asher
Date: 2008-06-17 14:29:13 -0700 (Tue, 17 Jun 2008)
Log Message:
-----------
Added view menu toggle item and hotkey for status flag (currently stall icon
and speech bubbles), enabled by default
Modified Paths:
--------------
code/stage/trunk/libstage/canvas.cc
code/stage/trunk/libstage/model.cc
code/stage/trunk/libstage/stage.hh
code/stage/trunk/libstage/worldgui.cc
Modified: code/stage/trunk/libstage/canvas.cc
===================================================================
--- code/stage/trunk/libstage/canvas.cc 2008-06-17 20:54:06 UTC (rev 6629)
+++ code/stage/trunk/libstage/canvas.cc 2008-06-17 21:29:13 UTC (rev 6630)
@@ -45,7 +45,7 @@
dragging = false;
rotating = false;
- showflags = STG_SHOW_CLOCK | STG_SHOW_BLOCKS | STG_SHOW_GRID |
STG_SHOW_DATA;
+ showflags = STG_SHOW_CLOCK | STG_SHOW_BLOCKS | STG_SHOW_GRID |
STG_SHOW_DATA | STG_SHOW_STATUS;
// // start the timer that causes regular redraws
Fl::add_timeout( ((double)interval/1000),
@@ -260,14 +260,10 @@
return 1;
case 3:
{
- puts( "button 3" );
startx = Fl::event_x();
starty = Fl::event_y();
if( Select( startx, starty ) )
- {
- printf( "rotating" );
rotating = true;
- }
return 1;
}
default:
Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc 2008-06-17 20:54:06 UTC (rev 6629)
+++ code/stage/trunk/libstage/model.cc 2008-06-17 21:29:13 UTC (rev 6630)
@@ -946,58 +946,61 @@
if( blinkenlights )
DrawBlinkenlights();
- // draw speech bubble
- if( say_string && flags & STG_SHOW_STATUS )
- {
- float stheta = -dtor( canvas->camera.getPitch() );
- float sphi = dtor( canvas->camera.getYaw() );
- float scale = canvas->camera.getScale();
+
+ if ( flags & STG_SHOW_STATUS ) {
+ // draw speech bubble
+ if( say_string )
+ {
+ float stheta = -dtor( canvas->camera.getPitch() );
+ float sphi = dtor( canvas->camera.getYaw() );
+ float scale = canvas->camera.getScale();
- glPushMatrix();
+ glPushMatrix();
- // move above the robot
- glTranslatef( 0, 0, 0.5 );
+ // move above the robot
+ glTranslatef( 0, 0, 0.5 );
- // rotate to face screen
- glRotatef( -rtod(global_pose.a + sphi), 0,0,1 );
- glRotatef( rtod(stheta), 1,0,0 );
+ // rotate to face screen
+ glRotatef( -rtod(global_pose.a + sphi), 0,0,1 );
+ glRotatef( rtod(stheta), 1,0,0 );
- const float m = 4 / scale; // margin
- float w = gl_width( this->say_string ) / scale; // scaled text
width
- float h = gl_height() / scale; // scaled text height
+ const float m = 4 / scale; // margin
+ float w = gl_width( this->say_string ) / scale; //
scaled text width
+ float h = gl_height() / scale; // scaled text height
- // draw inside of bubble
- PushColor( BUBBLE_FILL );
- glPushAttrib( GL_POLYGON_BIT | GL_LINE_BIT );
- glPolygonMode( GL_FRONT, GL_FILL );
- glEnable( GL_POLYGON_OFFSET_FILL );
- glPolygonOffset( 1.0, 1.0 );
- gl_draw_octagon( w, h, m );
- glDisable( GL_POLYGON_OFFSET_FILL );
- PopColor();
- // draw outline of bubble
- PushColor( BUBBLE_BORDER );
- glLineWidth( 1 );
- glEnable( GL_LINE_SMOOTH );
- glPolygonMode( GL_FRONT, GL_LINE );
- gl_draw_octagon( w, h, m );
- glPopAttrib();
- PopColor();
+ // draw inside of bubble
+ PushColor( BUBBLE_FILL );
+ glPushAttrib( GL_POLYGON_BIT | GL_LINE_BIT );
+ glPolygonMode( GL_FRONT, GL_FILL );
+ glEnable( GL_POLYGON_OFFSET_FILL );
+ glPolygonOffset( 1.0, 1.0 );
+ gl_draw_octagon( w, h, m );
+ glDisable( GL_POLYGON_OFFSET_FILL );
+ PopColor();
+ // draw outline of bubble
+ PushColor( BUBBLE_BORDER );
+ glLineWidth( 1 );
+ glEnable( GL_LINE_SMOOTH );
+ glPolygonMode( GL_FRONT, GL_LINE );
+ gl_draw_octagon( w, h, m );
+ glPopAttrib();
+ PopColor();
- // draw text
- PushColor( BUBBLE_TEXT );
- glTranslatef( 0, 0, 0.1 ); // draw text forwards of bubble
- gl_draw_string( m, m, 0.0, this->say_string );
- PopColor();
+ // draw text
+ PushColor( BUBBLE_TEXT );
+ glTranslatef( 0, 0, 0.1 ); // draw text forwards of
bubble
+ gl_draw_string( m, m, 0.0, this->say_string );
+ PopColor();
- glPopMatrix();
- }
+ glPopMatrix();
+ }
- if( stall )
- {
- DrawImage( TextureManager::getInstance()._stall_texture_id,
canvas, 0.85 );
+ if( stall )
+ {
+ DrawImage(
TextureManager::getInstance()._stall_texture_id, canvas, 0.85 );
+ }
}
// shift up the CS to the top of this model
@@ -1115,7 +1118,7 @@
glPopMatrix(); // drop out of local coords
}
-void StgModel::BuildDisplayList( int flags )
+void StgModel::BuildDisplayList( uint32_t flags )
{
glNewList( displaylist, GL_COMPILE );
DrawBlocks();
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2008-06-17 20:54:06 UTC (rev 6629)
+++ code/stage/trunk/libstage/stage.hh 2008-06-17 21:29:13 UTC (rev 6630)
@@ -1398,7 +1398,7 @@
int displaylist;
/** Compile the display list for this model */
- void BuildDisplayList( int flags );
+ void BuildDisplayList( uint32_t flags );
stg_model_type_t type;
Modified: code/stage/trunk/libstage/worldgui.cc
===================================================================
--- code/stage/trunk/libstage/worldgui.cc 2008-06-17 20:54:06 UTC (rev
6629)
+++ code/stage/trunk/libstage/worldgui.cc 2008-06-17 21:29:13 UTC (rev
6630)
@@ -118,6 +118,7 @@
static const char* MITEM_VIEW_BLOCKSRISING = "&View/T&rails/&Blocks rising";
static const char* MITEM_VIEW_ARROWS = "&View/T&rails/&Arrows rising";
static const char* MITEM_VIEW_TRAILS = "&View/&Trail";
+static const char* MITEM_VIEW_STATUS = "&View/&Status";
static const char* MITEM_VIEW_PERSPECTIVE = "&View/Perspective camera";
// this should be set by CMake
@@ -175,6 +176,9 @@
mbar->add( MITEM_VIEW_TRAILS, 't', (Fl_Callback*)view_toggle_cb,
(void*)canvas,
FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_TRAILS ?
FL_MENU_VALUE : 0 ));
+
+ mbar->add( MITEM_VIEW_STATUS, 's', (Fl_Callback*)view_toggle_cb,
(void*)canvas,
+ FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_STATUS
? FL_MENU_VALUE : 0 ));
mbar->add( MITEM_VIEW_FOOTPRINTS, FL_CTRL+'f',
(Fl_Callback*)view_toggle_cb, (void*)canvas,
FL_MENU_TOGGLE| (canvas->showflags & STG_SHOW_FOOTPRINT
? FL_MENU_VALUE : 0 ));
@@ -293,9 +297,10 @@
uint32_t trailsrising = wf->ReadInt(wf_section, "show_trails_rising",
flags & STG_SHOW_TRAILRISE ) ? STG_SHOW_TRAILRISE : 0;
uint32_t arrows = wf->ReadInt(wf_section, "show_arrows", flags &
STG_SHOW_ARROWS ) ? STG_SHOW_ARROWS : 0;
uint32_t footprints = wf->ReadInt(wf_section, "show_footprints", flags
& STG_SHOW_FOOTPRINT ) ? STG_SHOW_FOOTPRINT : 0;
+ uint32_t status = wf->ReadInt(wf_section, "show_status", flags &
STG_SHOW_STATUS ) ? STG_SHOW_STATUS : 0;
canvas->SetShowFlags( grid | data | follow | blocks | quadtree | clock
- | trails | arrows | footprints | trailsrising );
+ | trails | arrows | footprints | trailsrising | status
);
canvas->invalidate(); // we probably changed something
// fix the GUI menu checkboxes to match
@@ -321,6 +326,10 @@
item = (Fl_Menu_Item*)mbar->find_item( MITEM_VIEW_QUADTREE );
(flags & STG_SHOW_QUADTREE) ? item->check() : item->clear();
+ item = (Fl_Menu_Item*)mbar->find_item( MITEM_VIEW_STATUS );
+ (flags & STG_SHOW_STATUS) ? item->check() : item->clear();
+
+
// TODO - per model visualizations load
}
@@ -483,6 +492,7 @@
else if( strcmp(picked, MITEM_VIEW_ARROWS ) == 0 ) canvas->InvertView(
STG_SHOW_ARROWS );
else if( strcmp(picked, MITEM_VIEW_TRAILS ) == 0 ) canvas->InvertView(
STG_SHOW_TRAILS );
else if( strcmp(picked, MITEM_VIEW_BLOCKSRISING ) == 0 )
canvas->InvertView( STG_SHOW_TRAILRISE );
+ else if( strcmp(picked, MITEM_VIEW_STATUS ) == 0 ) canvas->InvertView(
STG_SHOW_STATUS );
else if( strcmp(picked, MITEM_VIEW_PERSPECTIVE ) == 0 ) {
canvas->use_perspective_camera = ! canvas->use_perspective_camera;
canvas->invalidate(); }
else PRINT_ERR1( "Unrecognized menu item \"%s\" not handled", picked );
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit