paragui-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paragui-cvs] CVS: paragui/test factory.cpp,NONE,1.5.2.1 stress1.cpp,NON


From: Teunis Peters <address@hidden>
Subject: [paragui-cvs] CVS: paragui/test factory.cpp,NONE,1.5.2.1 stress1.cpp,NONE,1.2.2.1 stress2.cpp,NONE,1.2.2.1 writefile.cpp,NONE,1.2.2.1 xmlloader.cpp,NONE,1.3.2.1 Makefile.am,1.6.2.3,1.6.2.4 animation.cpp,1.2.2.2,1.2.2.3 dblbuffer.cpp,1.4.2.3,1.4.2.4 dropdown.cpp,1.1.2.1,1.1.2.2 gltest.cpp,1.1.2.1,1.1.2.2 layouttest.cpp,1.1.1.1.2.1,1.1.1.1.2.2 list.cpp,1.1.2.1,1.1.2.2 paratest.cpp,1.9.2.3,1.9.2.4 pokus.xml,1.1.1.1,1.1.1.1.2.1 tabbar.cpp,1.4.2.1,1.4.2.2 windowtest.cpp,1.1.1.1.2.2,1.1.1.1.2.3
Date: Sat, 31 Aug 2002 00:01:28 -0400

Update of /cvsroot/paragui/paragui/test
In directory subversions:/tmp/cvs-serv4328/test

Modified Files:
      Tag: devel-opengl
        Makefile.am animation.cpp dblbuffer.cpp dropdown.cpp 
        gltest.cpp layouttest.cpp list.cpp paratest.cpp pokus.xml 
        tabbar.cpp windowtest.cpp 
Added Files:
      Tag: devel-opengl
        factory.cpp stress1.cpp stress2.cpp writefile.cpp 
        xmlloader.cpp 
Log Message:
massive changes - updates from main trunk and various bugfixes


--- NEW FILE ---
#include "paragui.h"
#include "pgapplication.h"
#include "pgthemewidget.h"
#include "pgbutton.h"
#include "pgwindow.h"
#include "pglabel.h"
#include "pgfactory.h"

int main( int argc, char **argv ) {

        typedef PG_FactoryHolder<unsigned long> MyFactory;

    PG_Application& app = PG_Application::GetInstance();

    app.LoadTheme( "default" );
    app.InitScreen( 640, 480, 0 );
    app.SetEmergencyQuit(true);

    PG_Factory::RegisterClass<PG_ThemeWidget, PG_Widget>("themewidget");
    PG_Factory::RegisterClass<PG_Button, PG_Widget>("button");
    PG_Factory::RegisterClass<PG_Window, PG_Widget>("window");
    PG_Factory::RegisterClass<PG_Label, PG_Widget>("label");

    MyFactory::RegisterClass<PG_Label, PG_Widget>(1);
    
    PG_Widget* w = PG_Factory::CreateObject("themewidget");
    
    w->MoveWidget(PG_Rect(10,10,300,200));
    w->Show();
        
    PG_Button* b = static_cast<PG_Button*>(PG_Factory::CreateObject("button"));
    
    b->MoveWidget(PG_Rect(150,150,150,30));
    b->SetText("Factory");
    b->Show();

    PG_Window* wnd = 
static_cast<PG_Window*>(PG_Factory::CreateObject("window"));

        wnd->MoveWidget(PG_Rect(100,100,200,300));
        wnd->SetTitle("Window");
        
    PG_Label* l = static_cast<PG_Label*>(MyFactory::CreateObject(1, wnd));
        l->MoveWidget(PG_Rect(50,50,100,20));
        l->SetText("Label");
        
        wnd->Show();
        
    app.Run();

    return 0;
}

--- NEW FILE ---
#include "paragui.h"

#include "pgapplication.h"
#include "pgbutton.h"
#include "pgwidgetlist.h"
#include "pglabel.h"
#include "pgwindow.h"
#include "pgmaskedit.h"
#include "pgscrollbar.h"
#include "pgprogressbar.h"
#include "pgradiobutton.h"
#include "pgthemewidget.h"
#include "pgcheckbutton.h"
#include "pgslider.h"
#include "pglistbox.h"
#include "pgcolumnitem.h"
#include "pgdropdown.h"
#include "pgpopupmenu.h"
#include "pgspinnerbox.h"
#include "pglog.h"
#include "pgmenubar.h"
#include "pgtheme.h"

#define RESX 800
#define RESY 600

int main(int argc, char* argv[]) {
        char theme[20];

        strcpy(theme, "default");
        
        // initial flags for screensurface
        Uint32 flags = SDL_SWSURFACE;
        int bpp = 0;

        int resx = RESX, resy = RESY;
        
        // construct the application object
        PG_Application& app = PG_Application::GetInstance();
        app.SetEmergencyQuit(true);
                
        for(int c=1; c<argc; c++) {

                if(argv[c][0] != '-') {
                        strcpy(theme, argv[c]);
                }

                if(strcmp(argv[c], "-f") == 0) {
                        flags |= SDL_FULLSCREEN;
                }

                if(strcmp(argv[c], "-bpp") == 0) {
                        bpp = atoi(argv[++c]);
                }
                
                if(strcmp(argv[c], "-x") == 0) {
                        resx = atoi(argv[++c]);
                }
                
                if(strcmp(argv[c], "-y") == 0) {
                        resy = atoi(argv[++c]);
                }
        }

        Uint32 start_ticks = SDL_GetTicks();
        
        if(!app.LoadTheme(theme)) {
            PG_LogERR("Unable to load theme \"%s\"", theme);
            return -1;
        }

        PG_LogMSG("Loaded theme in %i ms", SDL_GetTicks() - start_ticks);

        if(!app.InitScreen(resx, resy, bpp, flags)){
                printf("Resolution %dx%d not supported\n", resx, resy);
                exit(-1);
        }

        PG_LogMSG("screen initialized after %i ms", SDL_GetTicks() - 
start_ticks);

        app.SetCursor(app.GetTheme()->FindSurface("Pointer", "Pointer", 
"normal"));

        int xw = resx/32;
        int yw = resy/32;
        
        PG_ThemeWidget* b = NULL;
        
        for(int x=0; x<33; x++) {
                for(int y=0; y<33; y++) {
                        b = new PG_ThemeWidget(NULL, PG_Rect(x*xw, y*yw, xw, 
yw));
                        b->Show();
                }
        }
        
        PG_LogMSG("app ready after %i ms", SDL_GetTicks() - start_ticks);
        app.ShowCursor(PG_CURSOR_SOFTWARE);

        // Enter main loop 
        app.Run();

        return EXIT_SUCCESS;
}

--- NEW FILE ---
#include "paragui.h"

#include "pgapplication.h"
#include "pgbutton.h"
#include "pgwidgetlist.h"
#include "pglabel.h"
#include "pgwindow.h"
#include "pgmaskedit.h"
#include "pgscrollbar.h"
#include "pgprogressbar.h"
#include "pgradiobutton.h"
#include "pgthemewidget.h"
#include "pgcheckbutton.h"
#include "pgslider.h"
#include "pglistbox.h"
#include "pgcolumnitem.h"
#include "pgdropdown.h"
#include "pgpopupmenu.h"
#include "pgspinnerbox.h"
#include "pglog.h"
#include "pgmenubar.h"
#include "pgtheme.h"

#define RESX 800
#define RESY 600

int main(int argc, char* argv[]) {
        char theme[20];

        strcpy(theme, "default");
        
        // initial flags for screensurface
        Uint32 flags = SDL_SWSURFACE;
        int bpp = 0;

        int resx = RESX, resy = RESY;
        
        // construct the application object
        PG_Application& app = PG_Application::GetInstance();
        app.SetEmergencyQuit(true);
                
        for(int c=1; c<argc; c++) {

                if(argv[c][0] != '-') {
                        strcpy(theme, argv[c]);
                }

                if(strcmp(argv[c], "-f") == 0) {
                        flags |= SDL_FULLSCREEN;
                }

                if(strcmp(argv[c], "-bpp") == 0) {
                        bpp = atoi(argv[++c]);
                }
                
                if(strcmp(argv[c], "-x") == 0) {
                        resx = atoi(argv[++c]);
                }
                
                if(strcmp(argv[c], "-y") == 0) {
                        resy = atoi(argv[++c]);
                }
        }

        Uint32 start_ticks = SDL_GetTicks();
        
        if(!app.LoadTheme(theme)) {
            PG_LogERR("Unable to load theme \"%s\"", theme);
            return -1;
        }

        PG_LogMSG("Loaded theme in %i ms", SDL_GetTicks() - start_ticks);

        if(!app.InitScreen(resx, resy, bpp, flags)){
                printf("Resolution %dx%d not supported\n", resx, resy);
                exit(-1);
        }

        PG_LogMSG("screen initialized after %i ms", SDL_GetTicks() - 
start_ticks);

        app.SetCursor(app.GetTheme()->FindSurface("Pointer", "Pointer", 
"normal"));

        int xw = resx/32;
        int yw = resy/32;

        PG_Widget container(NULL, PG_Rect(0,0,resx,resy));      
        PG_ThemeWidget* b = NULL;
        
        for(int x=0; x<33; x++) {
                for(int y=0; y<33; y++) {
                        b = new PG_ThemeWidget(&container, PG_Rect(x*xw, y*yw, 
xw, yw));
                }
        }

        container.Show();
                
        PG_LogMSG("app ready after %i ms", SDL_GetTicks() - start_ticks);
        app.ShowCursor(PG_CURSOR_SOFTWARE);

        // Enter main loop 
        app.Run();

        return EXIT_SUCCESS;
}

--- NEW FILE ---
/**********************************************************
This is a simple PG_File demo that writes 2 ints to a file
Roger D. Vargas
**********************************************************/
#include <pgfilearchive.h>
#include <pgfile.h>
#include <pglog.h>
#include <string>

int main() {
        PG_FileArchive *Arc;
        PG_File *wf;

        int v1=23444,v2=44566;

        // Create the FileArchive object
        Arc = new PG_FileArchive();

        // Set the base app dir as write dir
        Arc->SetWriteDir(PG_FileArchive::GetUserDir());

        // Now open a file for writing
        PG_LogMSG("creating writeable file ...");
        wf = Arc->OpenFile("pgtestfile", PG_OPEN_WRITE);

        // Write a line of text (CR will be added)
        wf->putline("test");

        //Now write a couple of ints
        wf->write(&v1,sizeof(v1));
        wf->write(&v2,sizeof(v2));

        // close file
        delete wf;

        // Open created file for reading
        PG_LogMSG("checking file ...");
        wf = Arc->OpenFile("pgtestfile", PG_OPEN_READ);

        // read and check the line of text
        std::string text = wf->getline();
        if(text != "test") {
                PG_LogERR("File corrupted (reading text failed)");
        }

        // read and check the ints
        int i=0;
        wf->read(&i, sizeof(i));
        if(i != v1) {
                PG_LogERR("File corrupted (reading int v1)");
        }

        wf->read(&i, sizeof(i));
        if(i != v2) {
                PG_LogERR("File corrupted (reading int v2)");
        }

        PG_LogMSG("check passed");

        // close file & archive
        delete wf;
        delete Arc;
}

--- NEW FILE ---
#include "paragui.h"
#include "pgapplication.h"
#include "pgxmllayoutloader.h"
#include "pgfactory.h"

#include "pgthemewidget.h"
#include "pgbutton.h"
#include "pgwindow.h"
#include "pglabel.h"
#include "pglistbox.h"
#include "pglistboxitem.h"
#include "pgwidgetlist.h"

int main() {

        // construct the application object
        PG_Application& app = PG_Application::GetInstance();

        app.EnableBackground(true);
        app.LoadTheme("default");
        
        // init 1024x768
        if(!app.InitScreen(800,600, 0, SDL_SWSURFACE)){
                printf("Resolution not supported\n");
                exit(-1);
        }

        PG_Factory::RegisterClass<PG_Button, PG_Widget>("button");
        PG_Factory::RegisterClass<PG_Window, PG_Widget>("window");
        PG_Factory::RegisterClass<PG_Label, PG_Widget>("label");
        PG_Factory::RegisterClass<PG_ThemeWidget, PG_Widget>("gradientwidget");
        PG_Factory::RegisterClass<PG_ThemeWidget, PG_Widget>("themewidget");
        PG_Factory::RegisterClass<PG_ListBox, PG_Widget>("listbox");
        PG_Factory::RegisterClass<PG_ListBoxItem, PG_ListBox>("listboxitem");
        PG_Factory::RegisterClass<PG_WidgetList, PG_Widget>("widgetlist");
        
        PG_XMLLayoutLoader xmlloader;
        xmlloader.Load(NULL, "pokus.xml");

        // Enter main loop 
        app.Run();

        return EXIT_SUCCESS;
}

Index: Makefile.am
===================================================================
RCS file: /cvsroot/paragui/paragui/test/Makefile.am,v
retrieving revision 1.6.2.3
retrieving revision 1.6.2.4
diff -C2 -r1.6.2.3 -r1.6.2.4
*** Makefile.am 26 Jun 2002 08:47:51 -0000      1.6.2.3
--- Makefile.am 31 Aug 2002 04:01:25 -0000      1.6.2.4
***************
*** 1,50 ****
  AUTOMAKE_OPTIONS = foreign
  
! noinst_PROGRAMS = listbox tabbar animation dropdown paratest dblbuffer 
navtest windowtest layouttest windowresize gltest
  
  listbox_SOURCES = list.cpp
! listbox_LDADD = ../src/libparagui2.la -lfreetype
  
  tabbar_SOURCES = tabbar.cpp
! tabbar_LDADD = ../src/libparagui2.la -lfreetype
  
  windowresize_SOURCES = windowresize.cpp
! windowresize_LDADD = ../src/libparagui2.la -lfreetype
  
  dropdown_SOURCES = dropdown.cpp
! dropdown_LDADD = ../src/libparagui2.la -lfreetype
  
  animation_SOURCES = animation.cpp
! animation_LDADD = ../src/libparagui2.la -lfreetype
  
  dblbuffer_SOURCES = dblbuffer.cpp
! dblbuffer_LDADD = ../src/libparagui2.la -lfreetype
  
  paratest_SOURCES = paratest.cpp
! paratest_LDADD = ../src/libparagui2.la -lfreetype
  
  navtest_SOURCES = navtest.cpp
! navtest_LDADD = ../src/libparagui2.la -lfreetype
  
  windowtest_SOURCES = windowtest.cpp
! windowtest_LDADD = ../src/libparagui2.la -lfreetype
  
! layouttest_SOURCES = layouttest.cpp
! layouttest_LDADD = ../src/libparagui2.la -lfreetype
  
  gltest_SOURCES = gltest.cpp
! gltest_LDADD = ../src/libparagui2.la -lfreetype
  
! INCLUDES = \
!       $(SDL_CFLAGS) \
!       $(SIGC_CFLAGS) \
!       $(EXPAT_INCLUDE) \
!       $(FREETYPE_CFLAGS) \
!       -I../include \
!       -I$(top_srcdir)/include
  
  $(PACKAGE)-$(VERSION).tar.gz: dist
  
  EXTRA_DIST = \
        pokus.xml \
        icon.bmp
--- 1,68 ----
  AUTOMAKE_OPTIONS = foreign
  
! bin_PROGRAMS = writefile stress1 stress2 tabbar xmlloader listbox factory 
animation dropdown paratest dblbuffer navtest windowresize gltest windowtest
! # windowtest obsolete...
! 
! xmlloader_SOURCES = xmlloader.cpp
! xmlloader_LDADD = $(PARAGUI_LIBS)
! 
! factory_SOURCES = factory.cpp
! factory_LDADD = $(PARAGUI_LIBS)
  
  listbox_SOURCES = list.cpp
! listbox_LDADD = $(PARAGUI_LIBS)
  
  tabbar_SOURCES = tabbar.cpp
! tabbar_LDADD = $(PARAGUI_LIBS)
! 
! writefile_SOURCES = writefile.cpp
! writefile_LDADD = -L../src $(PARAGUI_LIBS)
! 
! stress1_SOURCES = stress1.cpp
! stress1_LDADD = -L../src $(PARAGUI_LIBS)
! 
! stress2_SOURCES = stress2.cpp
! stress2_LDADD = -L../src $(PARAGUI_LIBS)
  
  windowresize_SOURCES = windowresize.cpp
! windowresize_LDADD = -L../src $(PARAGUI_LIBS)
  
  dropdown_SOURCES = dropdown.cpp
! dropdown_LDADD = -L../src $(PARAGUI_LIBS)
  
  animation_SOURCES = animation.cpp
! animation_LDADD = -L../src $(PARAGUI_LIBS)
  
  dblbuffer_SOURCES = dblbuffer.cpp
! dblbuffer_LDADD = -L../src $(PARAGUI_LIBS)
  
  paratest_SOURCES = paratest.cpp
! paratest_LDADD = -L../src $(PARAGUI_LIBS)
  
  navtest_SOURCES = navtest.cpp
! navtest_LDADD = -L../src $(PARAGUI_LIBS)
  
  windowtest_SOURCES = windowtest.cpp
! windowtest_LDADD = -L../src $(PARAGUI_LIBS)
  
! # layouttest_SOURCES = layouttest.cpp
! # layouttest_LDADD = -L../src $(PARAGUI_LIBS)
  
  gltest_SOURCES = gltest.cpp
! gltest_LDADD = -L../src $(PARAGUI_LIBS)
  
! #INCLUDES = \
! #     $(SDL_CFLAGS) \
! #     $(SIGC_CFLAGS) \
! #     $(EXPAT_INCLUDE) \
! #     $(FREETYPE_CFLAGS) \
! #     -I../include \
! #     -I$(top_srcdir)/include
! INCLUDES = $(PARAGUI_CFLAGS) -I$(top_srcdir)/include
  
  $(PACKAGE)-$(VERSION).tar.gz: dist
  
  EXTRA_DIST = \
+       dblbuffer.xml \
        pokus.xml \
        icon.bmp

Index: animation.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/test/animation.cpp,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -C2 -r1.2.2.2 -r1.2.2.3
*** animation.cpp       26 Jun 2002 03:25:04 -0000      1.2.2.2
--- animation.cpp       31 Aug 2002 04:01:25 -0000      1.2.2.3
***************
*** 11,20 ****
  */
  
! #include <pgapplication.h>
! #include <pgpopupmenu.h> 
! #include <pgbutton.h>
! #include <pgmenubar.h> 
! #include <pgscrollbar.h> 
! #include <pgdraw.h>
  
  #define ID_APP_EXIT           1
--- 11,22 ----
  */
  
! #include "pgapplication.h"
! #include "pgpopupmenu.h"
! #include "pgbutton.h"
! #include "pgmenubar.h"
! #include "pgscrollbar.h"
! #include "pgtimerobject.h"
! #include "pglog.h"
! #include "pgdraw.h"
  
  #define ID_APP_EXIT           1
***************
*** 22,25 ****
--- 24,28 ----
  bool exit_handler(PG_Button* button) {
  
+       // exit the application eventloop
        PG_Application::GetInstance().Quit();
  
***************
*** 40,44 ****
  }
  
! class PlayField : public PG_ThemeWidget {
  public:
  
--- 43,47 ----
  }
  
! class PlayField : public PG_ThemeWidget, public PG_TimerObject {
  public:
  
***************
*** 49,53 ****
        ~PlayField();
  
!       void timer_callback(void);
  
  protected:
--- 52,56 ----
        ~PlayField();
  
!       Uint32 eventTimer(PG_TimerID id, Uint32 interval);
  
  protected:
***************
*** 113,134 ****
                        1
                        );
        }
        else if (tickstate == 1) {
                DrawHLine(0, my_height/2, my_width-1, my_color.r, my_color.g, 
my_color.b);
        }
  }
  
! void PlayField::timer_callback(void) {
! 
!       int prev_tickstate = tickstate;
! 
!       tickstate = (SDL_GetTicks()/1000)%3;
! 
!       if (tickstate != prev_tickstate) {
!               Update();
!       }
  }
  
! class PlayField2 : public PG_ThemeWidget
  {
  public:
--- 116,133 ----
                        1
                        );
+               tickstate = 1;
        }
        else if (tickstate == 1) {
                DrawHLine(0, my_height/2, my_width-1, my_color.r, my_color.g, 
my_color.b);
+               tickstate = 0;
        }
  }
  
! Uint32 PlayField::eventTimer(PG_TimerID id, Uint32 interval) {
!       Update();
!       PG_TimerObject::eventTimer(id, interval);
  }
  
! class PlayField2 : public PG_ThemeWidget, public PG_TimerObject
  {
  public:
***************
*** 140,144 ****
        ~PlayField2();
  
!       void timer_callback(void);
  
  protected:
--- 139,143 ----
        ~PlayField2();
  
!       Uint32 eventTimer(PG_TimerID id, Uint32 interval);
  
  protected:
***************
*** 211,233 ****
  }
  
! void PlayField2::timer_callback(void) {
! 
!       int prev_tickstate = tickstate;
! 
!       tickstate = (SDL_GetTicks()%1000)/25;
! 
!       if (tickstate != prev_tickstate) {
!               Update();
        }
- }
  
! Uint32 timer_callback(Uint32 interval, void* parameter) {
!       ((PlayField2 *)parameter)->timer_callback();
!       return interval;
! }
! 
! bool appidle_handler(PG_MessageObject* object, PG_Pointer* data) {
!       ((PlayField *)data)->timer_callback();
!       return true;
  }
  
--- 210,224 ----
  }
  
! Uint32 PlayField2::eventTimer(PG_TimerID id, Uint32 interval) {
!       tickstate++;
!       
!       PG_LogDBG("eventTimer(%i, %i)", id, interval);
!       
!       if(tickstate >= 40) {
!               tickstate = 0;
        }
  
!       Update();
!       PG_TimerObject::eventTimer(id, interval);
  }
  
***************
*** 241,246 ****
        
        // every application needs a theme (the look & feel of the widgets)
!       //app.LoadTheme("default");
!       app.LoadTheme("simple");
  
        // we must initialize the screen where we want to draw on
--- 232,237 ----
        
        // every application needs a theme (the look & feel of the widgets)
!       app.LoadTheme("default");
!       //app.LoadTheme("simple");
  
        // we must initialize the screen where we want to draw on
***************
*** 310,313 ****
--- 301,305 ----
                );
  
+       anim_test.AddTimer(400);
        // show me your .... lines ;-)
  
***************
*** 318,328 ****
          PG_Rect(260, 300, 120, 100)
          );
        anim_test2.Show();
- 
-       SDL_Init(SDL_INIT_TIMER);
-       SDL_AddTimer(20, timer_callback, (void *)&anim_test2);
- 
-       app.sigAppIdle.connect(slot(appidle_handler), &anim_test);
-       app.EnableAppIdleCalls();
  
        app.Run();
--- 310,317 ----
          PG_Rect(260, 300, 120, 100)
          );
+         
+       anim_test2.AddTimer(40);
+       anim_test2.AddTimer(20);
        anim_test2.Show();
  
        app.Run();

Index: dblbuffer.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/test/dblbuffer.cpp,v
retrieving revision 1.4.2.3
retrieving revision 1.4.2.4
diff -C2 -r1.4.2.3 -r1.4.2.4
*** dblbuffer.cpp       26 Jun 2002 03:25:04 -0000      1.4.2.3
--- dblbuffer.cpp       31 Aug 2002 04:01:25 -0000      1.4.2.4
***************
*** 16,20 ****
  #define MAX_SPEED     1
  
! SDL_Surface *sprite;
  int numsprites;
  SDL_Rect *sprite_rects;
--- 16,20 ----
  #define MAX_SPEED     1
  
! PG_Draw::PG_DrawableSurface *sprite;
  int numsprites;
  SDL_Rect *sprite_rects;
***************
*** 35,44 ****
  }
  
! int LoadSprite(PG_Draw::PG_DrawableSurface *screen, char *file)
! {
!       SDL_Surface *temp;
  
        /* Load the sprite image */
!       sprite = SDL_LoadBMP(file);
        if ( sprite == NULL ) {
                PG_LogMSG( "Couldn't load %s: %s", file, SDL_GetError());
--- 35,43 ----
  }
  
! int LoadSprite(PG_Draw::PG_DrawableSurface *screen, char *file) {
!         // SDL_Surface *temp;
  
        /* Load the sprite image */
!       sprite = PG_FileArchive::LoadSurface(file, false);
        if ( sprite == NULL ) {
                PG_LogMSG( "Couldn't load %s: %s", file, SDL_GetError());
***************
*** 47,55 ****
  
        /* Set transparent pixel as the pixel at (0,0) */
!       if ( sprite->format->palette ) {
!               SDL_SetColorKey(sprite, (SDL_SRCCOLORKEY|SDL_RLEACCEL),
!                                               *(Uint8 *)sprite->pixels);
        }
  
        /* Convert sprite to video format */
        temp = SDL_DisplayFormat(sprite);
--- 46,55 ----
  
        /* Set transparent pixel as the pixel at (0,0) */
!       if ( sprite->getScreen()->format->palette ) {
!               sprite->SetColorKey((SDL_SRCCOLORKEY|SDL_RLEACCEL),
!                                   *(Uint8 *)sprite->getScreen()->pixels);
        }
  
+ #if 0 /* removed... */
        /* Convert sprite to video format */
        temp = SDL_DisplayFormat(sprite);
***************
*** 61,65 ****
        }
        sprite = temp;
! 
        /* We're ready to roll. :) */
        return(0);
--- 61,65 ----
        }
        sprite = temp;
! #endif
        /* We're ready to roll. :) */
        return(0);
***************
*** 74,77 ****
--- 74,79 ----
        nupdates = 0;
  
+       sprite->SetAlpha(0, 0);
+ 
        /* Move the sprite, bounce at the wall, and draw */
        for ( i=0; i<numsprites; ++i ) {
***************
*** 145,149 ****
  
        numsprites = NUM_SPRITES;
!       videoflags = SDL_SWSURFACE | SDL_DOUBLEBUF;
        width = 640;
        height = 480;
--- 147,151 ----
  
        numsprites = NUM_SPRITES;
!       videoflags = SDL_SWSURFACE|SDL_DOUBLEBUF | SDL_ANYFORMAT;
        width = 640;
        height = 480;
***************
*** 199,202 ****
--- 201,206 ----
        }
  
+       PG_LogConsole::SetConsoleKey((SDLKey)0);
+       
        app.SetBulkMode(true);
        app.LoadTheme("default");
***************
*** 237,241 ****
        mem = (Uint8 *)malloc(4*sizeof(SDL_Rect)*numsprites);
        if ( mem == NULL ) {
!               SDL_FreeSurface(sprite);
                PG_LogMSG("Out of memory!");
                exit(2);
--- 241,245 ----
        mem = (Uint8 *)malloc(4*sizeof(SDL_Rect)*numsprites);
        if ( mem == NULL ) {
!               /* delete sprite? SDL_FreeSurface(sprite); */
                PG_LogMSG("Out of memory!");
                exit(2);
***************
*** 250,255 ****
                positions[i].x = rand()%screen->getScreen()->w;
                positions[i].y = rand()%screen->getScreen()->h;
!               positions[i].w = sprite->w;
!               positions[i].h = sprite->h;
                velocities[i].x = 0;
                velocities[i].y = 0;
--- 254,259 ----
                positions[i].x = rand()%screen->getScreen()->w;
                positions[i].y = rand()%screen->getScreen()->h;
!               positions[i].w = sprite->getScreen()->w;
!               positions[i].h = sprite->getScreen()->h;
                velocities[i].x = 0;
                velocities[i].y = 0;
***************
*** 271,275 ****
                PG_LogMSG("Screen has double-buffering enabled");
        }
!       if ( (sprite->flags & SDL_HWSURFACE) == SDL_HWSURFACE ) {
                PG_LogMSG("Sprite is in video memory");
        } else {
--- 275,279 ----
                PG_LogMSG("Screen has double-buffering enabled");
        }
!       if ( (sprite->getScreen()->flags & SDL_HWSURFACE) == SDL_HWSURFACE ) {
                PG_LogMSG("Sprite is in video memory");
        } else {
***************
*** 277,288 ****
        }
        /* Run a sample blit to trigger blit acceleration */
!       { PG_Rect dst = PG_Rect(0,0,sprite->w,sprite->h);
                screen->BlitSurface(sprite, PG_Rect(), dst);
                screen->FillRect(dst, background);
        }
!       if ( (sprite->flags & SDL_HWACCEL) == SDL_HWACCEL ) {
                PG_LogMSG("Sprite blit uses hardware acceleration");
        }
!       if ( (sprite->flags & SDL_RLEACCEL) == SDL_RLEACCEL ) {
                PG_LogMSG("Sprite blit uses RLE acceleration");
        }
--- 281,292 ----
        }
        /* Run a sample blit to trigger blit acceleration */
!       { PG_Rect dst = 
PG_Rect(0,0,sprite->getScreen()->w,sprite->getScreen()->h);
                screen->BlitSurface(sprite, PG_Rect(), dst);
                screen->FillRect(dst, background);
        }
!       if ( (sprite->getScreen()->flags & SDL_HWACCEL) == SDL_HWACCEL ) {
                PG_LogMSG("Sprite blit uses hardware acceleration");
        }
!       if ( (sprite->getScreen()->flags & SDL_RLEACCEL) == SDL_RLEACCEL ) {
                PG_LogMSG("Sprite blit uses RLE acceleration");
        }
***************
*** 293,299 ****
--- 297,305 ----
        done = 0;
        sprites_visible = 0;
+ 
        while ( !done ) {
                /* Check for events */
                ++frames;
+ 
                while ( SDL_PollEvent(&event) ) {
                        /*
***************
*** 314,318 ****
                                fps->SetTextFormat("%2.2f FPS",  
((double)frames*1000)/(now-then));
  
!                               if((now-then) > 2000) {
                                        then = now;
                                        frames=0;
--- 320,324 ----
                                fps->SetTextFormat("%2.2f FPS",  
((double)frames*1000)/(now-then));
  
!                               if((now-then) > 1000) {
                                        then = now;
                                        frames=0;
***************
*** 333,336 ****
--- 339,343 ----
                        PG_Widget::BulkBlit();
                }
+ 
                PG_Application::GetDrawingEnvironment()->Flip();
  #if 0
***************
*** 349,353 ****
  #endif
        }
!       SDL_FreeSurface(sprite);
        free(mem);
  
--- 356,360 ----
  #endif
        }
!       /* delete sprite; SDL_FreeSurface(sprite); // ??? */
        free(mem);
  

Index: dropdown.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/test/dropdown.cpp,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** dropdown.cpp        26 Jun 2002 03:25:04 -0000      1.1.2.1
--- dropdown.cpp        31 Aug 2002 04:01:25 -0000      1.1.2.2
***************
*** 11,14 ****
--- 11,15 ----
  {
     PG_Application& app = PG_Application::GetInstance();
+    
     app.LoadTheme( "default" );
     app.InitScreen( 640, 480 );

Index: gltest.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/test/Attic/gltest.cpp,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** gltest.cpp  26 Jun 2002 08:47:51 -0000      1.1.2.1
--- gltest.cpp  31 Aug 2002 04:01:25 -0000      1.1.2.2
***************
*** 39,52 ****
    listbox.sigSelectItem.connect(slot(handleListBoxItem));
    
!   listbox.AddItem(new PG_ListBoxItem(25, "Item1"));
!   listbox.AddItem(new PG_ListBoxItem(25, "Item2"));
!   listbox.AddItem(new PG_ListBoxItem(25, "Item3"));
!   listbox.AddItem(new PG_ListBoxItem(25, "Item4"));
!   listbox.AddItem(new PG_ListBoxItem(25, "Item5"));
!   listbox.AddItem(new PG_ListBoxItem(25, "Item6"));
!   listbox.AddItem(new PG_ListBoxItem(25, "Item7"));
!   listbox.AddItem(new PG_ListBoxItem(25, "Item8"));
!   listbox.AddItem(new PG_ListBoxItem(25, "Item9"));
!   listbox.AddItem(new PG_ListBoxItem(25, "Item10"));
    listbox.Show();
    
--- 39,52 ----
    listbox.sigSelectItem.connect(slot(handleListBoxItem));
    
!   new PG_ListBoxItem(&listbox, 25, "Item1");
!   new PG_ListBoxItem(&listbox, 25, "Item2");
!   new PG_ListBoxItem(&listbox, 25, "Item3");
!   new PG_ListBoxItem(&listbox, 25, "Item4");
!   new PG_ListBoxItem(&listbox, 25, "Item5");
!   new PG_ListBoxItem(&listbox, 25, "Item6");
!   new PG_ListBoxItem(&listbox, 25, "Item7");
!   new PG_ListBoxItem(&listbox, 25, "Item8");
!   new PG_ListBoxItem(&listbox, 25, "Item9");
!   new PG_ListBoxItem(&listbox, 25, "Item10");
    listbox.Show();
    

Index: layouttest.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/test/layouttest.cpp,v
retrieving revision 1.1.1.1.2.1
retrieving revision 1.1.1.1.2.2
diff -C2 -r1.1.1.1.2.1 -r1.1.1.1.2.2
*** layouttest.cpp      26 Jun 2002 03:25:04 -0000      1.1.1.1.2.1
--- layouttest.cpp      31 Aug 2002 04:01:25 -0000      1.1.1.1.2.2
***************
*** 1,10 ****
  #include "paragui.h"
- #include <iostream>
  #include "pgapplication.h"
  
  int main() {
  
        // construct the application object
!         PG_Application& app = PG_Application::GetInstance();
  
        app.EnableBackground(true);
--- 1,10 ----
  #include "paragui.h"
  #include "pgapplication.h"
+ #include "pgwindow.h"
  
  int main() {
  
        // construct the application object
!       PG_Application& app = PG_Application::GetInstance();
  
        app.EnableBackground(true);
***************
*** 17,22 ****
        }
  
!       app.LoadLayout("pokus.xml");
  
        // Enter main loop 
        app.Run();
--- 17,26 ----
        }
  
!       PG_Window wnd(NULL, PG_Rect(0,0,400,300), "Test");
!       wnd.LoadLayout("pokus.xml");
  
+       SDL_Delay(2000);
+       wnd.Show();
+       
        // Enter main loop 
        app.Run();

Index: list.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/test/list.cpp,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** list.cpp    26 Jun 2002 03:25:04 -0000      1.1.2.1
--- list.cpp    31 Aug 2002 04:01:25 -0000      1.1.2.2
***************
*** 19,42 ****
        PG_Application& app = PG_Application::GetInstance();
        
        app.LoadTheme( "default" );
        
        app.InitScreen( 640, 480, 0 );
        app.SetEmergencyQuit(true);
        
        PG_ListBox listbox(NULL, PG_Rect(10,10,300,100));
        listbox.sigSelectItem.connect(slot(handleListBoxItem));
        
-       listbox.AddItem(new PG_ListBoxItem(25, "Item1"));
-       listbox.AddItem(new PG_ListBoxItem(25, "Item2"));
-       listbox.AddItem(new PG_ListBoxItem(25, "Item3"));
-       listbox.AddItem(new PG_ListBoxItem(25, "Item4"));
-       listbox.AddItem(new PG_ListBoxItem(25, "Item5"));
-       listbox.AddItem(new PG_ListBoxItem(25, "Item6"));
-       listbox.AddItem(new PG_ListBoxItem(25, "Item7"));
-       listbox.AddItem(new PG_ListBoxItem(25, "Item8"));
-       listbox.AddItem(new PG_ListBoxItem(25, "Item9"));
-       listbox.AddItem(new PG_ListBoxItem(25, "Item10"));
        listbox.Show();
!       
  
        app.Run();
--- 19,51 ----
        PG_Application& app = PG_Application::GetInstance();
        
+   fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
        app.LoadTheme( "default" );
        
+   fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
        app.InitScreen( 640, 480, 0 );
+   fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
        app.SetEmergencyQuit(true);
        
+   fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
        PG_ListBox listbox(NULL, PG_Rect(10,10,300,100));
+   fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
        listbox.sigSelectItem.connect(slot(handleListBoxItem));
+   fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
        
        listbox.Show();
!   fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
! 
!       new PG_ListBoxItem(&listbox, 25, "Item1");
!   fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
!       new PG_ListBoxItem(&listbox, 25, "Item2");
!       new PG_ListBoxItem(&listbox, 25, "Item3");
!       new PG_ListBoxItem(&listbox, 25, "Item4");
!       new PG_ListBoxItem(&listbox, 25, "Item5");
!       new PG_ListBoxItem(&listbox, 25, "Item6");
!       new PG_ListBoxItem(&listbox, 25, "Item7");
!       new PG_ListBoxItem(&listbox, 25, "Item8");
!       new PG_ListBoxItem(&listbox, 25, "Item9");
!       new PG_ListBoxItem(&listbox, 25, "Item10");
!   fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
  
        app.Run();

Index: paratest.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/test/paratest.cpp,v
retrieving revision 1.9.2.3
retrieving revision 1.9.2.4
diff -C2 -r1.9.2.3 -r1.9.2.4
*** paratest.cpp        26 Jun 2002 16:24:58 -0000      1.9.2.3
--- paratest.cpp        31 Aug 2002 04:01:25 -0000      1.9.2.4
***************
*** 29,34 ****
  void Splash() {
      PG_ThemeWidget splash(NULL, PG_Rect(100,100,600,400), true);
      splash.Show();
!     SDL_Delay(1000);
      splash.Hide();
  }
--- 29,39 ----
  void Splash() {
      PG_ThemeWidget splash(NULL, PG_Rect(100,100,600,400), true);
+     PG_ThemeWidget splash1(&splash, PG_Rect(10,10,580,380));
+     PG_ThemeWidget splash2(&splash1, PG_Rect(10,10,560,340));
+     PG_Label l(&splash2, PG_Rect(10,10,540,320), "I'm a splash screen");
+     l.SetAlignment(PG_TA_CENTER);
+         
      splash.Show();
!     SDL_Delay(5000);
      splash.Hide();
  }
***************
*** 43,47 ****
  
  bool handle_exit() {
!         PG_Application& app = PG_Application::GetInstance();
        app.Quit();
        return true;
--- 48,52 ----
  
  bool handle_exit() {
!       PG_Application& app = PG_Application::GetInstance();
        app.Quit();
        return true;
***************
*** 72,76 ****
  
        /** a new style callback member */
!       bool handle_show_window(PG_Button* button) {
                Show(true);
                return true;
--- 77,81 ----
  
        /** a new style callback member */
!       bool handle_show_window() {
                Show(true);
                return true;
***************
*** 80,83 ****
--- 85,89 ----
        bool handle_slide_btntrans(PG_Slider* slider, long pos, PG_Pointer* 
data) {
                PG_Button* b = static_cast<PG_Button*>(data);
+               
                // set transparency of passed in button
                b->SetTransparency((Uint8)pos, (Uint8)pos, (Uint8)pos);
***************
*** 111,136 ****
        WidgetList->SetBackground("default/wnd_close.bmp", BKMODE_TILE, 0xFF);
        WidgetList->SetBackgroundBlend(0);
        WidgetList->EnableScrollBar(true, PG_SB_VERTICAL);
        WidgetList->EnableScrollBar(true, PG_SB_HORIZONTAL);
        PG_Button* add = new PG_Button(this, 100, PG_Rect(260,130,110,30), "<< 
ADD");
        add->sigButtonClick.connect(slot(*this, &TestWindow::handleButton));
        PG_Button* remove = new PG_Button(this, 101, PG_Rect(260,165,110,30), 
">> REMOVE");
        remove->sigButtonClick.connect(slot(*this, &TestWindow::handleButton));
!       PG_Button* b = new PG_Button(NULL, BTN_ID_YES, PG_Rect(0,0, 400,50), 
"YES");
        b->SetTransparency(128,128,128);
        b->SetFontName("qnx/font.ttf");
!       WidgetList->AddWidget(b);
!       PG_Slider* s = new PG_Slider(NULL, 20, PG_Rect(0, 0, 200,20), 
PG_SB_HORIZONTAL);
        s->SetRange(0,255);
        s->SetTransparency(200);
        s->SetPosition(50);
-       s->sigSlide.connect(slot(*this, &TestWindow::handle_slide_btntrans), b);
  
!       WidgetList->AddWidget(s);
                
!       WidgetList->AddWidget(new PG_LineEdit(NULL, PG_Rect(0,0,80,30)));
  
!       PG_CheckButton* check = new PG_CheckButton(NULL, 10, 
PG_Rect(0,0,200,25), "CheckButton 2");
!       WidgetList->AddWidget(check);
  
        progress = new PG_ProgressBar(this, PG_Rect(260, 90, 150, 25));
--- 117,144 ----
        WidgetList->SetBackground("default/wnd_close.bmp", BKMODE_TILE, 0xFF);
        WidgetList->SetBackgroundBlend(0);
+                       
        WidgetList->EnableScrollBar(true, PG_SB_VERTICAL);
        WidgetList->EnableScrollBar(true, PG_SB_HORIZONTAL);
+               
        PG_Button* add = new PG_Button(this, 100, PG_Rect(260,130,110,30), "<< 
ADD");
        add->sigButtonClick.connect(slot(*this, &TestWindow::handleButton));
+       
        PG_Button* remove = new PG_Button(this, 101, PG_Rect(260,165,110,30), 
">> REMOVE");
        remove->sigButtonClick.connect(slot(*this, &TestWindow::handleButton));
!       
!       PG_Button* b = new PG_Button(WidgetList, BTN_ID_YES, PG_Rect(0,0, 
400,50), "YES");
        b->SetTransparency(128,128,128);
        b->SetFontName("qnx/font.ttf");
! 
!       PG_Slider* s = new PG_Slider(WidgetList, 20, PG_Rect(0, 0, 200,20), 
PG_SB_HORIZONTAL);
        s->SetRange(0,255);
        s->SetTransparency(200);
        s->SetPosition(50);
  
!       s->sigSlide.connect(slot(*this, &TestWindow::handle_slide_btntrans), b);
                
!       new PG_LineEdit(WidgetList, PG_Rect(0,0,80,30));
  
!       PG_CheckButton* check = new PG_CheckButton(WidgetList, 10, 
PG_Rect(0,0,200,25), "CheckButton 2");
  
        progress = new PG_ProgressBar(this, PG_Rect(260, 90, 150, 25));
***************
*** 163,166 ****
--- 171,175 ----
  bool TestWindow::handleScrollPos(PG_ScrollBar* widget, long pos){
        int id = widget->GetID();
+       
        if(id == 1){
                progress->SetProgress(pos);
***************
*** 179,182 ****
--- 188,192 ----
  bool TestWindow::handleScrollTrack(PG_ScrollBar* widget, long pos) {
        int id = widget->GetID();
+       
        if(id == 1){
                progress->SetProgress(pos);
***************
*** 195,203 ****
  bool TestWindow::handleButton(PG_Button* widget) {
        static int label=0;
        if(widget->GetID() == 100) {
!               PG_Label* l = new PG_Label(NULL, PG_Rect(0,0,220,25), "");
                l->SetAlignment(PG_TA_CENTER);
                l->SetTextFormat("Label %i", ++label);
-               WidgetList->AddWidget(l);
        
                return true;
--- 205,213 ----
  bool TestWindow::handleButton(PG_Button* widget) {
        static int label=0;
+ 
        if(widget->GetID() == 100) {
!               PG_Label* l = new PG_Label(WidgetList, PG_Rect(0,0,220,25), "");
                l->SetAlignment(PG_TA_CENTER);
                l->SetTextFormat("Label %i", ++label);
        
                return true;
***************
*** 280,284 ****
        // construct the application object
        PG_Application& app = PG_Application::GetInstance();
!       
        for(int c=1; c<argc; c++) {
  
--- 290,294 ----
        // construct the application object
        PG_Application& app = PG_Application::GetInstance();
! 
        for(int c=1; c<argc; c++) {
  
***************
*** 294,297 ****
--- 304,313 ----
                        bTestMode = true;
                }
+ 
+               if(strcmp(argv[c], "-hw") == 0) {
+                       flags |= SDL_HWSURFACE;
+                       flags ^= SDL_SWSURFACE;
+               }
+ 
                
                if(strcmp(argv[c], "-bpp") == 0) {
***************
*** 326,329 ****
--- 342,347 ----
        app.SetCursor(app.GetTheme()->FindSurface("Pointer", "Pointer", 
"normal"));
  
+       //Splash();
+       
        SDL_Color color;
        color.r = 255;
***************
*** 332,335 ****
--- 350,354 ----
  
        PG_LogMSG("creating 'wnd' after %i ms", SDL_GetTicks() - start_ticks);
+ 
        // create the testwindow
        TestWindow wnd(NULL, PG_Rect(100,100,500,300), "My first Testwindow");
***************
*** 339,346 ****
--- 358,367 ----
        
        PG_LogMSG("creating 'wnd1' after %i ms", SDL_GetTicks() - start_ticks);
+ 
        TestWindow wnd1(NULL, PG_Rect(50,50,500,300), "My 2nd Testwindow");
        wnd1.SetTransparency(0);
        wnd1.SetName("WindowTwo");
        wnd1.SetID(101);
+ 
        //PG_Draw::DrawLine(0,0, app.GetScreenWidth()-1, 
app.GetScreenHeight()-1, color,1, app.GetScreen());
        
***************
*** 349,361 ****
--- 370,387 ----
        PG_RadioButton radio2(NULL, 2, PG_Rect(50,25,200,25), "RadioButton 2", 
&radio1);
        PG_RadioButton radio3(NULL, 3, PG_Rect(50,50,200,25), "RadioButton 3", 
&radio1);
+       radio1.SetAlignment(PG_TA_RIGHT);
+       
        PG_RadioButton radio4(NULL, 4, PG_Rect(50,90,200,25), "RadioButton 4");
        PG_RadioButton radio5(NULL, 5, PG_Rect(50,115,200,25), "RadioButton 5", 
&radio4);
        PG_RadioButton radio6(NULL, 6, PG_Rect(50,140,200,25), "RadioButton 6", 
&radio4);
+ 
        PG_CheckButton check1(NULL, 7, PG_Rect(300,140,180,25), "CheckButton 
1");
        PG_PopupMenu   popmenu(NULL, 425, 140, "My Menu");
        PG_PopupMenu   submenu(NULL, 425, 140, "My SubMenu");
        PG_PopupMenu   subsubmenu(NULL, 425, 140, "");
+       
        submenu.sigMenuItemSelect.connect(slot(handle_menu_click));
        subsubmenu.sigMenuItemSelect.connect(slot(handle_menu_click));
+ 
        subsubmenu.addMenuItem("Mordor", 1).
            addMenuItem("Minas Morgul", 2).
***************
*** 366,369 ****
--- 392,396 ----
                addMenuItem("Hrothgar", 3).
          addMenuItem("Long ago", &subsubmenu);
+               
      popmenu.addMenuItem("Tasty", 1, slot(handle_menu_click)).
          addMenuItem("Even tastier", 2, slot(handle_menu_click)).
***************
*** 376,381 ****
--- 403,410 ----
      
        popmenu.disableItem(2);
+       
        PG_MenuBar menubar(NULL, PG_Rect(resx-300, 0, 300, 30));
        menubar.Add("PopMe 2", &popmenu);
+ 
        PG_PopupMenu editmenu(NULL, 0 ,0, NULL);
        editmenu.addMenuItem("Cut", 1);
***************
*** 383,386 ****
--- 412,416 ----
        editmenu.addMenuItem("Paste", 3);
        menubar.Add("Edit", &editmenu);
+ 
        menubar.Show();
        
***************
*** 394,397 ****
--- 424,428 ----
  
        check1.Show();
+ 
        PG_ScrollBar scroll(NULL, 10, PG_Rect(50, 200, 300, 20), 
PG_SB_HORIZONTAL );
        scroll.Show();
***************
*** 401,419 ****
--- 432,456 ----
        edit.SetValidKeys("1234567890");
        edit.Show();
+       
        // our new label with the callback member
        MySliderLabel slider_label(NULL, PG_Rect(360, 250, 50,20), "5");
        slider_label.Show();
+ 
        // create the slider
        PG_Slider slider(NULL, 11, PG_Rect(50, 250, 300,20), PG_SB_HORIZONTAL);
        slider.SetRange(5,20);
+ 
        // connect the "MSG_SLIDE" event with "handler_slider" of slider_label 
(see macro above, just for testing)
        slider.sigSlide.connect(slot(slider_label, 
&MySliderLabel::handle_slide));
        
        slider.Show();
+ 
        PG_Button popbtn(NULL, 20, PG_Rect(430, 250,100,25), "Pop me");
        popbtn.sigButtonClick.connect(slot(handle_popup), &popmenu);
        popbtn.Show();
+ 
        PG_SpinnerBox spin(NULL, PG_Rect(550,250,130,25));
        spin.Show();
+ 
        PG_DropDown drop(NULL, 14, PG_Rect(50, 280, 300,25));
        drop.SetIndent(5);
***************
*** 426,455 ****
        drop.AddItem("Item 6");
        drop.Show();
        PG_Button list(NULL, BTN_ID_OK, PG_Rect(400,450,100,30), "List");
        list.sigButtonClick.connect(slot(handle_list));
        list.Show();
        PG_Button quit(NULL, BTN_ID_CLOSE, PG_Rect(600,450,100,30), "Quit");
        quit.sigButtonClick.connect(slot(handle_exit));
        quit.Show();
        PG_Button show_wnd(NULL, BTN_ID_APPLY, PG_Rect(500,450,100,30), 
"Window");
        show_wnd.sigButtonClick.connect(slot(wnd, 
&TestWindow::handle_show_window));
        show_wnd.Show();
!         // show the testwindow
        wnd.Show();
!         wnd1.Show();
        PG_LogMSG("app ready after %i ms", SDL_GetTicks() - start_ticks);
        app.ShowCursor(PG_CURSOR_SOFTWARE);
        PG_LogMSG("testing the widget finding methods");
        PG_Widget *tmp;
        tmp = PG_Application::GetWidgetByName("WindowOne");
        if (tmp)
            PG_LogMSG("'WindowOne' found by name (id %d)", tmp->GetID());
        tmp = PG_Application::GetWidgetById(100);
        if (tmp)
            PG_LogMSG("'100' found by ID (name '%s')", tmp->GetName());
            
!       tmp = PG_Application::GetWidgetByName("WindowTwo");
!       if (tmp)
!           PG_LogMSG("'WindowTwo' found by name (id %d)", tmp->GetID());
            
        tmp = PG_Application::GetWidgetById(101);
--- 463,501 ----
        drop.AddItem("Item 6");
        drop.Show();
+ 
        PG_Button list(NULL, BTN_ID_OK, PG_Rect(400,450,100,30), "List");
        list.sigButtonClick.connect(slot(handle_list));
        list.Show();
+ 
        PG_Button quit(NULL, BTN_ID_CLOSE, PG_Rect(600,450,100,30), "Quit");
        quit.sigButtonClick.connect(slot(handle_exit));
        quit.Show();
+ 
        PG_Button show_wnd(NULL, BTN_ID_APPLY, PG_Rect(500,450,100,30), 
"Window");
        show_wnd.sigButtonClick.connect(slot(wnd, 
&TestWindow::handle_show_window));
+ 
        show_wnd.Show();
! 
!       // show the testwindow
        wnd.Show();
!       wnd1.Show();
!       
        PG_LogMSG("app ready after %i ms", SDL_GetTicks() - start_ticks);
        app.ShowCursor(PG_CURSOR_SOFTWARE);
+ 
        PG_LogMSG("testing the widget finding methods");
        PG_Widget *tmp;
+       
        tmp = PG_Application::GetWidgetByName("WindowOne");
        if (tmp)
            PG_LogMSG("'WindowOne' found by name (id %d)", tmp->GetID());
+           
        tmp = PG_Application::GetWidgetById(100);
        if (tmp)
            PG_LogMSG("'100' found by ID (name '%s')", tmp->GetName());
            
!       PG_Window* tempw = 
PG_Application::GetWidgetByName<PG_Window>("WindowTwo");
!       if (tempw)
!           PG_LogMSG("'WindowTwo' found by name (id %d)", tempw->GetID());
            
        tmp = PG_Application::GetWidgetById(101);
***************
*** 467,481 ****
--- 513,533 ----
                      tmp->GetName());
  
+ 
        if(!bTestMode) {
            app.Run();
            return EXIT_SUCCESS;
        }
+       
        start_ticks = SDL_GetTicks();
        int iter = 100;
+       
        for(int i=0; i<iter; i++) {
                PG_Widget::UpdateScreen();
        }
+ 
        int ticks = SDL_GetTicks() - start_ticks;
        PG_LogMSG("did %i iterations in %i ms", iter, ticks);
+       PG_LogMSG("~%2.2fms per iteration", (float)ticks/(float)iter);
+       
        return EXIT_SUCCESS;    
  }

Index: pokus.xml
===================================================================
RCS file: /cvsroot/paragui/paragui/test/pokus.xml,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -C2 -r1.1.1.1 -r1.1.1.1.2.1
*** pokus.xml   15 Apr 2002 13:22:29 -0000      1.1.1.1
--- pokus.xml   31 Aug 2002 04:01:25 -0000      1.1.1.1.2.1
***************
*** 26,30 ****
                </dropdown>
  
!               <label pos="300,50,200,30" text="Label" fsize="20" fstyle="7" 
indent="20" align="left" icon="icon.bmp"/>
                
                <image pos="300,90" iimage="icon.bmp"/>
--- 26,30 ----
                </dropdown>
  
!               <label pos="300,50,200,30" text="Label" fsize="10" fstyle="7" 
indent="20" align="left" icon="icon.bmp"/>
                
                <image pos="300,90" iimage="icon.bmp"/>
***************
*** 41,59 ****
                
                <window pos="20%,20%,60%,60%" title="Experimental window" 
titlecolor="0,0,255" flags="2">
!                       <label pos="20%,20%,60%,60%" text="Close this window 
!!!" align="center" textcolor="255,0,0"/>
                </window>
                
                <widgetlist pos="250,500,100,90" scrollbar="1">
                        <label pos="0,0,100,30" text="hepci !" align="left"/>
                </widgetlist>
  
                <listbox pos="360,500,100,90" multisel="0">
!                       <listboxitem height="15" ltext="First" select="1"/>
!                       <listboxitem height="15" ltext="Second"/>
!                       <listboxitem height="15" ltext="Third" select="1"/>
!                       <listboxitem height="15" ltext="Fouth" select="1"/>
!                       <listboxitem height="15" ltext="Fifth"/>
!                       <listboxitem height="15" ltext="Sixth"/>
!                       <listboxitem height="15" ltext="Seventh"/>
                </listbox>
  
--- 41,75 ----
                
                <window pos="20%,20%,60%,60%" title="Experimental window" 
titlecolor="0,0,255" flags="2">
!                       <label pos="20%,20%,60%,20%" text="Close this window 
!!!" align="center" textcolor="255,0,0"/>
!                       <label pos="20%,40%,60%,20%" text="Label2" 
align="center" textcolor="255,0,0"/>
                </window>
                
                <widgetlist pos="250,500,100,90" scrollbar="1">
                        <label pos="0,0,100,30" text="hepci !" align="left"/>
+                       <label pos="0,0,100,30" text="hepci !" align="left"/>
+                       <label pos="0,0,100,30" text="hepci !" align="left"/>
+                       <label pos="0,0,100,30" text="hepci !" align="left"/>
+                       <label pos="0,0,100,30" text="hepci !" align="left"/>
+                       <label pos="0,0,100,30" text="hepci !" align="left"/>
+                       <label pos="0,0,100,30" text="hepci !" align="left"/>
+                       <label pos="0,0,100,30" text="hepci !" align="left"/>
+                       <label pos="0,0,100,30" text="hepci !" align="left"/>
+                       <label pos="0,0,100,30" text="hepci !" align="left"/>
+                       <label pos="0,0,100,30" text="hepci !" align="left"/>
+                       <label pos="0,0,100,30" text="hepci !" align="left"/>
+                       <label pos="0,0,100,30" text="hepci !" align="left"/>
+                       <label pos="0,0,100,30" text="hepci !" align="left"/>
+                       <label pos="0,0,100,30" text="hepci !" align="left"/>
+                       <label pos="0,0,100,30" text="hepci !" align="left"/>
                </widgetlist>
  
                <listbox pos="360,500,100,90" multisel="0">
!                       <listboxitem height="15" text="First" select="1"/>
!                       <listboxitem height="15" text="Second"/>
!                       <listboxitem height="15" text="Third" select="1"/>
!                       <listboxitem height="15" text="Fouth" select="1"/>
!                       <listboxitem height="15" text="Fifth"/>
!                       <listboxitem height="15" text="Sixth"/>
!                       <listboxitem height="15" text="Seventh"/>
                </listbox>
  

Index: tabbar.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/test/tabbar.cpp,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -C2 -r1.4.2.1 -r1.4.2.2
*** tabbar.cpp  26 Jun 2002 03:25:04 -0000      1.4.2.1
--- tabbar.cpp  31 Aug 2002 04:01:25 -0000      1.4.2.2
***************
*** 84,97 ****
        
        PG_ListBox listpage(NULL, PG_Rect(0,0,300,100));
!       listpage.AddItem(new PG_ListBoxItem(25, "Item1"));
!       listpage.AddItem(new PG_ListBoxItem(25, "Item2"));
!       listpage.AddItem(new PG_ListBoxItem(25, "Item3"));
!       listpage.AddItem(new PG_ListBoxItem(25, "Item4"));
!       listpage.AddItem(new PG_ListBoxItem(25, "Item5"));
!       listpage.AddItem(new PG_ListBoxItem(25, "Item6"));
!       listpage.AddItem(new PG_ListBoxItem(25, "Item7"));
!       listpage.AddItem(new PG_ListBoxItem(25, "Item8"));
!       listpage.AddItem(new PG_ListBoxItem(25, "Item9"));
!       listpage.AddItem(new PG_ListBoxItem(25, "Item10"));
        listpage.SetID(3);
        
--- 84,97 ----
        
        PG_ListBox listpage(NULL, PG_Rect(0,0,300,100));
!       new PG_ListBoxItem(&listpage, 25, "Item1");
!       new PG_ListBoxItem(&listpage, 25, "Item2");
!       new PG_ListBoxItem(&listpage, 25, "Item3");
!       new PG_ListBoxItem(&listpage, 25, "Item4");
!       new PG_ListBoxItem(&listpage, 25, "Item5");
!       new PG_ListBoxItem(&listpage, 25, "Item6");
!       new PG_ListBoxItem(&listpage, 25, "Item7");
!       new PG_ListBoxItem(&listpage, 25, "Item8");
!       new PG_ListBoxItem(&listpage, 25, "Item9");
!       new PG_ListBoxItem(&listpage, 25, "Item10");
        listpage.SetID(3);
        

Index: windowtest.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/test/windowtest.cpp,v
retrieving revision 1.1.1.1.2.2
retrieving revision 1.1.1.1.2.3
diff -C2 -r1.1.1.1.2.2 -r1.1.1.1.2.3
*** windowtest.cpp      26 Jun 2002 03:25:04 -0000      1.1.1.1.2.2
--- windowtest.cpp      31 Aug 2002 04:01:25 -0000      1.1.1.1.2.3
***************
*** 13,17 ****
  };
  
! CMyWindow::CMyWindow(PG_Widget *parent,const PG_Rect& r,char *text,Uint32 
flags,const char* style = "Window") : PG_Window(parent,r,text,flags,style)
  
  {
--- 13,17 ----
  };
  
! CMyWindow::CMyWindow(PG_Widget *parent,const PG_Rect& r,char *text,Uint32 
flags,const char* style) : PG_Window(parent,r,text,flags,style)
  
  {
***************
*** 40,48 ****
        CMyWidget *mywidget;
        PG_MessageBox *msgbox;
  
!       PG_Application& app = PG_Application::GetInstance();
!       app.SetEmergencyQuit(true);
!       app.LoadTheme("default");
!       app.InitScreen(800,600,16,SDL_SWSURFACE);
  
        mywidget=new CMyWidget(NULL,PG_Rect(200,200,350,250));
--- 40,51 ----
        CMyWidget *mywidget;
        PG_MessageBox *msgbox;
+       PG_Application* app;
  
!       PG_Application& app1 = PG_Application::GetInstance();
!       app = &app1;
!       // app = new PG_Application();
!       app->SetEmergencyQuit(true);
!       app->LoadTheme("default");
!       app->InitScreen(800,600,16,SDL_SWSURFACE);
  
        mywidget=new CMyWidget(NULL,PG_Rect(200,200,350,250));
***************
*** 56,60 ****
                "Ok",
                PG_TA_CENTER);
! 
        PG_DropDown* drop = new PG_DropDown(msgbox, 15, PG_Rect(5, 60, 200,25));
        drop->SetIndent(5);
--- 59,63 ----
                "Ok",
                PG_TA_CENTER);
!               
        PG_DropDown* drop = new PG_DropDown(msgbox, 15, PG_Rect(5, 60, 200,25));
        drop->SetIndent(5);
***************
*** 66,80 ****
        msgbox->Show();
        msgbox->WaitForClick();
  
        // Get rid of mywidget, msgbox, and app buttons and context
        delete mywidget;
        delete msgbox;
        
        // Start the process over exactly the same
        // Crash happens here in physfs.c
        // app=new PG_Application();
!       // app.SetEmergencyQuit(true);
!       app.LoadTheme("simple");
!       app.InitScreen(800,600,0,SDL_SWSURFACE);
  
        mywidget=new CMyWidget(NULL,PG_Rect(200,200,350,250));
--- 69,88 ----
        msgbox->Show();
        msgbox->WaitForClick();
+       msgbox->Hide();
+       
+       app->Run();
+       
  
        // Get rid of mywidget, msgbox, and app buttons and context
        delete mywidget;
        delete msgbox;
+       // delete app;
        
        // Start the process over exactly the same
        // Crash happens here in physfs.c
        // app=new PG_Application();
!       // app->SetEmergencyQuit(true);
!       app->LoadTheme("simple");
!       app->InitScreen(800,600,0,SDL_SWSURFACE);
  
        mywidget=new CMyWidget(NULL,PG_Rect(200,200,350,250));
***************
*** 95,98 ****
--- 103,107 ----
        delete mywidget;
        delete msgbox;
+       // delete app;
                
        return 0;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]