From: <and...@us...> - 2009-11-19 13:45:45
|
Revision: 10615 http://plplot.svn.sourceforge.net/plplot/?rev=10615&view=rev Author: andrewross Date: 2009-11-19 13:45:35 +0000 (Thu, 19 Nov 2009) Log Message: ----------- At core code to ensure that plwindow is always set. Setting the plwindow option overrides any defaults. In the absence of that, the program name, or PLplot, is used. Update xwin, qt, xcairo and wxwidgets drivers to honour the new plwindow settings. Note wxwidgets still adds additional driver information onto the end of the title and cairo no longer prompts to press return / mouse button. Modified Paths: -------------- trunk/drivers/cairo.c trunk/drivers/qt.cpp trunk/drivers/wxwidgets.cpp trunk/drivers/xwin.c trunk/src/plcore.c Modified: trunk/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2009-11-19 12:08:54 UTC (rev 10614) +++ trunk/drivers/cairo.c 2009-11-19 13:45:35 UTC (rev 10615) @@ -1490,7 +1490,6 @@ void plD_init_xcairo( PLStream *pls ) { - char plotTitle[40]; PLCairo *aStream; /* Setup the PLStream and the font lookup table. */ @@ -1506,9 +1505,6 @@ } else { - /* Initialize plot title */ - sprintf( plotTitle, "PLplot" ); - /* X Windows setup */ aStream->XDisplay = NULL; aStream->XDisplay = XOpenDisplay( NULL ); @@ -1522,7 +1518,7 @@ aStream->XWindow = XCreateSimpleWindow( aStream->XDisplay, rootWindow, 0, 0, pls->xlength, pls->ylength, 1, BlackPixel( aStream->XDisplay, XScreen ), BlackPixel( aStream->XDisplay, XScreen )); - XStoreName( aStream->XDisplay, aStream->XWindow, plotTitle ); + XStoreName( aStream->XDisplay, aStream->XWindow, pls->plwindow); XSelectInput( aStream->XDisplay, aStream->XWindow, NoEventMask ); XMapWindow( aStream->XDisplay, aStream->XWindow ); aStream->xdrawable_mode = 0; @@ -1562,9 +1558,6 @@ if ( aStream->xdrawable_mode ) return; - /* Be sure the window title is set appropriately. */ - XStoreName( aStream->XDisplay, aStream->XWindow, "PLplot" ); - XFlush( aStream->XDisplay ); } @@ -1583,6 +1576,8 @@ XComposeStatus cs; XEvent event; PLCairo *aStream; + char helpmsg[] = " - Press Enter or right-click to continue"; + char *plotTitle; aStream = (PLCairo *) pls->dev; @@ -1597,8 +1592,6 @@ /* Only pause if nopause is unset. */ if ( pls->nopause ) aStream->exit_event_loop = 1; - else - XStoreName( aStream->XDisplay, aStream->XWindow, "PLplot - Press Enter or right-click to continue" ); /* Loop, handling selected events, till the user elects to close the plot. */ event_mask = ButtonPressMask | KeyPressMask | ExposureMask; Modified: trunk/drivers/qt.cpp =================================================================== --- trunk/drivers/qt.cpp 2009-11-19 12:08:54 UTC (rev 10614) +++ trunk/drivers/qt.cpp 2009-11-19 13:45:35 UTC (rev 10615) @@ -1146,18 +1146,8 @@ widget->resize( plsc->xlength, plsc->ylength ); widget->move( plsc->xoffset, plsc->yoffset ); - if ( pls->plwindow ) /* allow -plwindow to specify wm decoration name */ - { - widget->setWindowTitle( pls->plwindow ); - } - else if ( pls->program ) - { - widget->setWindowTitle( pls->program ); - } - else - widget->setWindowTitle( "Plplot" ); + widget->setWindowTitle( pls->plwindow ); - qApp->connect( &handler, SIGNAL( MasterChangedPage()), widget, SLOT( nextPage())); qApp->connect( &handler, SIGNAL( MasterClosed()), widget, SLOT( close())); } Modified: trunk/drivers/wxwidgets.cpp =================================================================== --- trunk/drivers/wxwidgets.cpp 2009-11-19 12:08:54 UTC (rev 10614) +++ trunk/drivers/wxwidgets.cpp 2009-11-19 13:45:35 UTC (rev 10615) @@ -1270,17 +1270,17 @@ } - wxString title = wxT( "wxWidgets PLplot App" ); + wxString title( pls->plwindow, *wxConvCurrent ); switch ( dev->backend ) { case wxBACKEND_DC: - title += wxT( " (basic)" ); + title += wxT( " - wxWidgets (basic)" ); break; case wxBACKEND_GC: - title += wxT( " (wxGC)" ); + title += wxT( " - wxWidgets (wxGC)" ); break; case wxBACKEND_AGG: - title += wxT( " (AGG)" ); + title += wxT( " - wxWidgets (AGG)" ); break; default: break; Modified: trunk/drivers/xwin.c =================================================================== --- trunk/drivers/xwin.c 2009-11-19 12:08:54 UTC (rev 10614) +++ trunk/drivers/xwin.c 2009-11-19 13:45:35 UTC (rev 10615) @@ -112,8 +112,6 @@ #define ROMAP_CMAP1_COLORS 50 #define TC_CMAP1_COLORS 200 -#define HEADER_LEN 1024 - /* Variables to hold RGB components of given colormap. */ /* Used in an ugly hack to get past some X11R5 and TK limitations. */ @@ -1124,7 +1122,6 @@ XSizeHints hint; int x, y; U_INT width, height, border, depth; - char header[HEADER_LEN]; dbug_enter( "InitMain" ); @@ -1167,20 +1164,6 @@ hint.y = 0; } -/* Window title */ - - if ( pls->plwindow ) /* allow -plwindow to specify wm decoration name */ - { - strncpy( header, pls->plwindow, HEADER_LEN ); - } - else if ( pls->program ) - { - strncpy( header, pls->program, HEADER_LEN ); /* else program name */ - } - else - strncpy( header, "Plplot", HEADER_LEN ); - header[HEADER_LEN - 1] = '\0'; - /* Window creation */ dev->window = @@ -1191,7 +1174,7 @@ InputOutput, xwd->visual, 0, NULL ); - XSetStandardProperties( xwd->display, dev->window, header, header, + XSetStandardProperties( xwd->display, dev->window, pls->plwindow, pls->plwindow, None, 0, 0, &hint ); } Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2009-11-19 12:08:54 UTC (rev 10614) +++ trunk/src/plcore.c 2009-11-19 13:45:35 UTC (rev 10615) @@ -1980,6 +1980,27 @@ plstrm_init(); +/* Set title for window to a sensible default if not defined */ + if ( plsc->plwindow == NULL ) + { + if ( plsc->program ) + { + if (( plsc->plwindow = (char *) malloc((size_t) ( 1 + strlen( plsc->program )) * sizeof ( char ))) == NULL ) + { + plexit( "plinit: Insufficient memory" ); + } + strcpy( plsc->plwindow, plsc->program ); + } + else + { + if (( plsc->plwindow = (char *) malloc((size_t) 7 * sizeof ( char ))) == NULL ) + { + plexit( "plinit: Insufficient memory" ); + } + strcpy( plsc->plwindow, "PLplot" ); + } + } + /* Initialize device & first page */ plP_init(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |