[Plib-cvs] plib/demos/p-guide/src LoadSave.cxx,NONE,1.1 Makefile.am,1.1,1.2 StatusWindow.cxx,1.1,1.2
Brought to you by:
sjbaker
From: James J. <pu...@us...> - 2002-07-12 03:05:21
|
Update of /cvsroot/plib/plib/demos/p-guide/src In directory usw-pr-cvs1:/tmp/cvs-serv13361 Modified Files: Makefile.am StatusWindow.cxx WidgetWindow.cxx WriteCode.cxx pGuide.cxx pGuide.dsp Added Files: LoadSave.cxx Log Message: Added XML saving and loading, misc. bugfixes, and SpinBoxes. --- NEW FILE: LoadSave.cxx --- /* P-GUIDE - PUI-based Graphical User Interface Designer Copyright (C) 2002 John F. Fay This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ [...486 lines suppressed...] } } if (strstr(tag, "/savefile")) { static int mouse_x ; static int mouse_y ; glutSetWindow ( main_window ) ; glutSetWindowTitle ( window_name->getStringValue() ) ; mouse_x = 999 ; mouse_y = 999 ; glutReshapeWindow ( window_size_x->getValue(), window_size_y->getValue() ) ; glutSetWindow ( status_window ) ; } buffer[0] = '\0'; } fclose (in); } Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/demos/p-guide/src/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.am 8 May 2002 22:49:55 -0000 1.1 +++ Makefile.am 12 Jul 2002 03:05:17 -0000 1.2 @@ -1,7 +1,7 @@ bin_PROGRAMS = pguide pguide_SOURCES = CreateWidget.cxx pGuide.cxx StatusWindow.cxx WidgetList.h \ - WidgetWindow.cxx WriteCode.cxx + WidgetWindow.cxx WriteCode.cxx LoadSave.cxx EXTRA_DIST = pGuide.dsp Index: StatusWindow.cxx =================================================================== RCS file: /cvsroot/plib/plib/demos/p-guide/src/StatusWindow.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- StatusWindow.cxx 8 May 2002 22:49:55 -0000 1.1 +++ StatusWindow.cxx 12 Jul 2002 03:05:17 -0000 1.2 @@ -30,10 +30,13 @@ extern WidgetList *active_widget ; extern puObject *active_object ; +extern char pguide_current_directory [ PUSTRING_MAX ] ; + extern bool main_window_changed ; // Status window parameters int status_window = 0 ; // Window handle +extern int main_window ; [...341 lines suppressed...] - window_color_b = new puInput ( 200, 260, 240, 280 ) ; + + window_color_b = new puSpinBox ( 370, 285, 420, 305 ) ; + window_color_b->setMinValue(0.0); + window_color_b->setMaxValue(1.0); + window_color_b->setStepSize(0.05); + window_color_b->setLabel ( "Blue" ) ; + window_color_b->setLabelPlace ( PUPLACE_TOP_CENTERED ) ; window_color_b->setValuator ( &main_window_color_b ) ; - window_color_a = new puInput ( 240, 260, 280, 280 ) ; + window_color_a = new puSpinBox ( 420, 285, 470, 305 ) ; + window_color_a->setMinValue(0.0); + window_color_a->setMaxValue(1.0); + window_color_a->setStepSize(0.05); + window_color_a->setLabel ( "Alpha" ) ; + window_color_a->setLabelPlace ( PUPLACE_TOP_CENTERED ) ; window_color_a->setValuator ( &main_window_color_a ) ; status_group->close () ; Index: WidgetWindow.cxx =================================================================== RCS file: /cvsroot/plib/plib/demos/p-guide/src/WidgetWindow.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- WidgetWindow.cxx 8 May 2002 22:49:55 -0000 1.1 +++ WidgetWindow.cxx 12 Jul 2002 03:05:17 -0000 1.2 @@ -128,8 +128,6 @@ active_button = (puButton *)ob ; } - - void input_cb ( puObject *ob ) { selected_object_sticky = ( glutGetModifiers () & GLUT_ACTIVE_CTRL ) ? 1 : 0 ; Index: WriteCode.cxx =================================================================== RCS file: /cvsroot/plib/plib/demos/p-guide/src/WriteCode.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- WriteCode.cxx 8 May 2002 22:49:55 -0000 1.1 +++ WriteCode.cxx 12 Jul 2002 03:05:17 -0000 1.2 @@ -55,6 +55,18 @@ // Get the file name and open the file char* filename ; file_selector -> getValue ( &filename ) ; + if (filename[0] == '\0') + { + puDeleteObject ( file_selector ) ; + file_selector = (puFileSelector *)NULL ; + glutHideWindow () ; + glutSetWindow ( status_window ) ; + return ; + } + + /* If they didn't give an extension, then tack ".cxx" onto the end. */ + if(!strstr(filename, ".")) + sprintf(filename, "%s.cxx", filename); FILE *out = fopen ( filename, "wt" ) ; if ( !out ) @@ -273,8 +285,8 @@ fprintf ( out, " \n" ) ; - wid = wid->next ; } + wid = wid->next ; } } Index: pGuide.cxx =================================================================== RCS file: /cvsroot/plib/plib/demos/p-guide/src/pGuide.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pGuide.cxx 8 May 2002 22:49:55 -0000 1.1 +++ pGuide.cxx 12 Jul 2002 03:05:17 -0000 1.2 @@ -17,6 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#define VERSION = "0.1a" + // Program to allow the user to build a PUI Graphical User Interface #include <plib/pu.h> @@ -45,14 +47,17 @@ main_window_color_b = 1.0, main_window_color_a = 1.0 ; bool main_window_changed = false ; +bool currently_loading = false ; static int ctrl_key_down = 0 ; static int mouse_x = 0 ; static int mouse_y = 0 ; +char pguide_current_directory [ PUSTRING_MAX ] ; + // Widget count -static int widget_number = 0 ; +int widget_number = 0 ; // From the status window: @@ -233,6 +238,12 @@ mouse_x = x ; mouse_y = y ; + if ( puActiveWidget() && ( active_object != puActiveWidget() ) ) + { + puActiveWidget() -> invokeDownCallback () ; + puDeactivateWidget () ; + } + ctrl_key_down = ( glutGetModifiers () & GLUT_ACTIVE_CTRL ) ; // Downclick: Place a new widget, activate an existing widget, or deactivate widget @@ -346,8 +357,9 @@ main_window_changed = true ; - if ( ( mouse_x < main_window_width/2 ) || // Grabbed the left edge ... - ( mouse_y < main_window_height/2 ) ) // or the bottom edge, move the widgets + if ( ( !currently_loading ) && ( + ( mouse_x < main_window_width/2 ) || // Grabbed the left edge ... + ( mouse_y < main_window_height/2 ) ) ) // or the bottom edge, move the widgets { WidgetList *wid = widgets ; int deltax = 0 ; @@ -371,11 +383,14 @@ window_size_x->setValue ( w ) ; window_size_y->setValue ( h ) ; + + currently_loading = false ; } static void main_window_displayfn ( void ) { /* Clear the screen */ + glutSetWindow ( main_window ) ; glClearColor ( main_window_color_r, main_window_color_g, main_window_color_b, main_window_color_a ) ; glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ; @@ -439,6 +454,7 @@ { extern int define_widget_window () ; extern int define_status_window () ; + int i = 0; strcpy ( main_window_name, "PUI GUI Builder" ) ; @@ -456,6 +472,14 @@ glutReshapeFunc ( main_window_reshapefn ) ; glutIdleFunc ( main_window_displayfn ) ; + strcpy (pguide_current_directory, argv[0]+2); + i = strlen(pguide_current_directory); + while (pguide_current_directory[i] != '\\') { + if (i>0) i-- ; + else break ; + } + //pguide_current_directory[0] = '\\'; + pguide_current_directory[i+1] = '\0'; puInit () ; #ifdef VOODOO Index: pGuide.dsp =================================================================== RCS file: /cvsroot/plib/plib/demos/p-guide/src/pGuide.dsp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pGuide.dsp 5 Jun 2002 18:23:09 -0000 1.2 +++ pGuide.dsp 12 Jul 2002 03:05:18 -0000 1.3 @@ -48,8 +48,8 @@ # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 !ELSEIF "$(CFG)" == "pGuide - Win32 Debug" @@ -64,16 +64,17 @@ # PROP Intermediate_Dir "pGuide___Win32_Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "c:\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "c:\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 pui_d.lib sg_d.lib fnt_d.lib ul_d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"c:\plib" +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 pui_d.lib sg_d.lib fnt_d.lib ul_d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"LIBCMTD" /pdbtype:sept /libpath:"c:\plib" +# SUBTRACT LINK32 /pdb:none !ENDIF @@ -84,6 +85,10 @@ # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\LoadSave.cxx +# End Source File # Begin Source File SOURCE=.\pGuide.cxx |