From 7941ba111cac53f21eafdeeeed6b543c3a2ba610 Mon Sep 17 00:00:00 2001
From: Robert Roebling <robert@roebling.de>
Date: Wed, 1 Dec 1999 14:08:42 +0000
Subject: [PATCH]   Applied patch for multiple file selection, documented.  
 Fixed some compilation warnings,   Minor change to OpenGL code.   Documented
 wxImageHandler::GetImageCount() and related.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4784 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/filedlg.tex               |   2 +-
 docs/latex/wx/function.tex              |   2 +-
 docs/latex/wx/image.tex                 |  29 +++-
 include/wx/generic/filedlgg.h           |   9 +-
 samples/help/doc/wxhelp.map             |   2 +-
 src/generic/filedlgg.cpp                |  50 ++++++-
 src/gtk/app.cpp                         |  17 ++-
 src/gtk/dataobj.cpp                     |   2 +-
 src/gtk/font.cpp                        |   2 +-
 src/gtk/mdi.cpp                         |   2 +-
 src/gtk/minifram.cpp                    |   2 +-
 src/gtk/win_gtk.c                       |   2 +-
 src/gtk1/app.cpp                        |  17 ++-
 src/gtk1/dataobj.cpp                    |   2 +-
 src/gtk1/font.cpp                       |   2 +-
 src/gtk1/mdi.cpp                        |   2 +-
 src/gtk1/minifram.cpp                   |   2 +-
 src/gtk1/win_gtk.c                      |   2 +-
 utils/glcanvas/gtk/glcanvas.cpp         |  23 +++
 utils/glcanvas/samples/cube/Makefile    |   6 +-
 utils/glcanvas/samples/cube/cube.cpp    | 191 ++++++++++++------------
 utils/glcanvas/samples/penguin/Makefile |   8 +-
 22 files changed, 248 insertions(+), 128 deletions(-)

diff --git a/docs/latex/wx/filedlg.tex b/docs/latex/wx/filedlg.tex
index e46490205f..f6fe6531e1 100644
--- a/docs/latex/wx/filedlg.tex
+++ b/docs/latex/wx/filedlg.tex
@@ -26,7 +26,7 @@ If path is ``", the current directory will be used. If filename is ``",
 no default filename will be supplied. The wildcard determines what files
 are displayed in the file selector, and file extension supplies a type
 extension for the required filename. Flags may be a combination of wxOPEN,
-wxSAVE, wxOVERWRITE\_PROMPT, wxHIDE\_READONLY, or 0.
+wxSAVE, wxOVERWRITE\_PROMPT, wxHIDE\_READONLY, wxMULTIPLE or 0.
 
 Both the X and Windows versions implement a wildcard filter. Typing a
 filename containing wildcards (*, ?) in the filename text item, and
diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex
index e3deb8d61a..f522dc3be3 100644
--- a/docs/latex/wx/function.tex
+++ b/docs/latex/wx/function.tex
@@ -481,7 +481,7 @@ If path is empty, the current directory will be used. If filename is empty,
 no default filename will be supplied. The wildcard determines what files
 are displayed in the file selector, and file extension supplies a type
 extension for the required filename. Flags may be a combination of wxOPEN,
-wxSAVE, wxOVERWRITE\_PROMPT, wxHIDE\_READONLY, or 0.
+wxSAVE, wxOVERWRITE\_PROMPT, wxHIDE\_READONLY, wxMULTIPLE or 0.
 
 Both the Unix and Windows versions implement a wildcard filter. Typing a
 filename containing wildcards (*, ?) in the filename text item, and
diff --git a/docs/latex/wx/image.tex b/docs/latex/wx/image.tex
index 8578e0f634..bb30df8ff8 100644
--- a/docs/latex/wx/image.tex
+++ b/docs/latex/wx/image.tex
@@ -625,6 +625,20 @@ Gets the name of this handler.
 
 Gets the file extension associated with this handler.
 
+\membersection{wxImageHandler::GetImageCount}\label{wximagehandlergetimagecount}
+
+\func{int}{GetImageCount}{\param{wxInputStream\&}{ stream}}
+
+If the image file contains more than one image and the image handler is capable 
+of retrieving these individually, this function will return the number of
+available images.
+
+\docparam{stream}{Opened input stream for reading image file.}
+
+\wxheading{Return value}
+
+Number of available images. For most image handles, this defaults to 1.
+
 \membersection{wxImageHandler::GetType}
 
 \constfunc{long}{GetType}{\void}
@@ -639,16 +653,21 @@ Gets the MIME type associated with this handler.
 
 \membersection{wxImageHandler::LoadFile}\label{wximagehandlerloadfile}
 
-\func{bool}{LoadFile}{\param{wxImage* }{image}, \param{wxInputStream\&}{ stream}}
+\func{bool}{LoadFile}{\param{wxImage* }{image}, \param{wxInputStream\&}{ stream}, \param{bool}{ verbose=TRUE}, \param{int}{ index=0}}
 
-Loads a image from a stream, putting the resulting data into {\it image}.
+Loads a image from a stream, putting the resulting data into {\it image}. If the image file contains
+more than one image and the image handler is capable of retrieving these individually, {\it index}
+indicates which image to read from the stream.
 
 \wxheading{Parameters}
 
 \docparam{image}{The image object which is to be affected by this operation.}
 
-\docparam{stream}{Opened input stream.
-The meaning of {\it stream} is determined by the {\it type} parameter.}
+\docparam{stream}{Opened input stream for reading images.}
+
+\docparam{verbose}{If set to TRUE, errors reported by the image handler will produce wxLogMessages.}
+
+\docparam{index}{The index of the image in the file (starting from zero).}
 
 \wxheading{Return value}
 
@@ -670,7 +689,7 @@ Saves a image in the output stream.
 
 \docparam{image}{The image object which is to be affected by this operation.}
 
-\docparam{stream}{A stream. The meaning of {\it stream} is determined by the {\it type} parameter.}
+\docparam{stream}{An opened stream for writing images.}
 
 \wxheading{Return value}
 
diff --git a/include/wx/generic/filedlgg.h b/include/wx/generic/filedlgg.h
index 59f717de5c..2fc5b07319 100644
--- a/include/wx/generic/filedlgg.h
+++ b/include/wx/generic/filedlgg.h
@@ -154,7 +154,11 @@ public:
     wxString GetFilename() const { return m_fileName; }
     wxString GetWildcard() const { return m_wildCard; }
     long GetStyle() const { return m_dialogStyle; }
-    int GetFilterIndex() const { return m_filterIndex ; }
+    int GetFilterIndex() const { return m_filterIndex; }
+    
+    // for multiple file selection
+    void GetPaths(wxArrayString& paths) const;
+    void GetFilenames(wxArrayString& files) const;
 
     void OnSelected( wxListEvent &event );
     void OnActivated( wxListEvent &event );
@@ -195,7 +199,8 @@ enum
     wxSAVE = 2,
     wxOVERWRITE_PROMPT = 4,
     wxHIDE_READONLY = 8,
-    wxFILE_MUST_EXIST = 16
+    wxFILE_MUST_EXIST = 16,
+    wxMULTIPLE = 32
 };
 
 // File selector - backward compatibility
diff --git a/samples/help/doc/wxhelp.map b/samples/help/doc/wxhelp.map
index 3fdaa8f48d..33f7b9d5f2 100644
--- a/samples/help/doc/wxhelp.map
+++ b/samples/help/doc/wxhelp.map
@@ -5,7 +5,7 @@
 ; First, some wxWindows documentation files:
 ;
 0 wx.html                  ;wxWindows: Help index; additional keywords like overview
-1 wx34.htm#classref           ;  wxWindows Class References
+1 wxwin.htm           ;  wxWindows Class References
 2 wx204.htm#functions         ;  wxWindows Function References; methods
 ;
 ; Some doc++ generated files:
diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp
index cd53a8017f..5a6f3fe328 100644
--- a/src/generic/filedlgg.cpp
+++ b/src/generic/filedlgg.cpp
@@ -574,6 +574,10 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
 
     m_message = message;
     m_dialogStyle = style;
+    
+    if ((m_dialogStyle & wxMULTIPLE ) && !(m_dialogStyle & wxOPEN))
+        m_dialogStyle &= ~wxMULTIPLE;
+    
     m_dir = defaultDir;
     if (m_dir.IsEmpty())
     {
@@ -657,8 +661,12 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
     staticsizer->Add( m_static, 1 );
     mainsizer->Add( staticsizer, 0, wxEXPAND | wxLEFT|wxRIGHT|wxBOTTOM, 10 );
 
-    m_list = new wxFileCtrl( this, ID_LIST_CTRL, m_dir, firstWild, wxDefaultPosition, wxSize(440,180),
-      wxLC_LIST | wxSUNKEN_BORDER | wxLC_SINGLE_SEL );
+    if (m_dialogStyle & wxMULTIPLE)
+        m_list = new wxFileCtrl( this, ID_LIST_CTRL, m_dir, firstWild, wxDefaultPosition, 
+	                         wxSize(440,180), wxLC_LIST | wxSUNKEN_BORDER );
+    else
+        m_list = new wxFileCtrl( this, ID_LIST_CTRL, m_dir, firstWild, wxDefaultPosition, 
+	                         wxSize(440,180), wxLC_LIST | wxSUNKEN_BORDER | wxLC_SINGLE_SEL );
     mainsizer->Add( m_list, 1, wxEXPAND | wxLEFT|wxRIGHT, 10 );
 
     wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL );
@@ -890,6 +898,44 @@ void wxFileDialog::SetPath( const wxString& path )
     }
 }
 
+void wxFileDialog::GetPaths( wxArrayString& paths ) const
+{
+    paths.Empty();
+    paths.Alloc( m_list->GetSelectedItemCount() );
+
+    wxString dir;
+    m_list->GetDir( dir );
+    if (dir != wxT("/")) dir += wxT("/");
+
+    wxListItem item;
+    item.m_mask = wxLIST_MASK_TEXT;
+
+    item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
+    while ( item.m_itemId != -1 ) {
+        m_list->GetItem( item );
+        paths.Add( dir + item.m_text );
+        item.m_itemId = m_list->GetNextItem( item.m_itemId + 1,
+            wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
+    }
+}
+
+void wxFileDialog::GetFilenames(wxArrayString& files) const
+{
+    files.Empty();
+    files.Alloc( m_list->GetSelectedItemCount() );
+
+    wxListItem item;
+    item.m_mask = wxLIST_MASK_TEXT;
+
+    item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
+    while ( item.m_itemId != -1 ) {
+        m_list->GetItem( item );
+        files.Add( item.m_text );
+        item.m_itemId = m_list->GetNextItem( item.m_itemId + 1,
+            wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
+    }
+}
+
 // ----------------------------------------------------------------------------
 // global functions
 // ----------------------------------------------------------------------------
diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp
index 26a9ea36e6..e399efa119 100644
--- a/src/gtk/app.cpp
+++ b/src/gtk/app.cpp
@@ -226,12 +226,25 @@ void wxapp_install_idle_handler()
 {
     wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") );
 
-    /* this routine gets called by all event handlers
-       indicating that the idle is over. */
+    /* This routine gets called by all event handlers
+       indicating that the idle is over. It may also
+       get called from other thread for sending events
+       to the main thread (and processing these in
+       idle time). */
+
+#if wxUSE_THREADS
+    if (!wxThread::IsMain())
+        GDK_THREADS_ENTER ();
+#endif
 
     wxTheApp->m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
 
     g_isIdle = FALSE;
+    
+#if wxUSE_THREADS
+    if (!wxThread::IsMain())
+        GDK_THREADS_LEAVE ();
+#endif
 }
 
 #if wxUSE_THREADS
diff --git a/src/gtk/dataobj.cpp b/src/gtk/dataobj.cpp
index e901b6ea57..bde950fbb6 100644
--- a/src/gtk/dataobj.cpp
+++ b/src/gtk/dataobj.cpp
@@ -204,7 +204,7 @@ size_t wxFileDataObject::GetDataSize() const
     return res + 1;
 }
 
-bool wxFileDataObject::SetData(size_t size, const void *buf)
+bool wxFileDataObject::SetData(size_t WXUNUSED(size), const void *buf)
 {
     // VZ: old format
 #if 0
diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp
index 6cd4c22b1c..a957f4f68a 100644
--- a/src/gtk/font.cpp
+++ b/src/gtk/font.cpp
@@ -188,7 +188,7 @@ wxFont::wxFont( const wxString& fontname, const wxFontData& fontdata )
 
     tmp = tn.GetNextToken();                     // pointsize
     long num = wxStrtol (tmp.c_str(), (wxChar **) NULL, 10);
-    M_FONTDATA->m_pointSize = num / 10;
+    M_FONTDATA->m_pointSize = (int)(num / 10);
 
     tn.GetNextToken();                           // x-res
     tn.GetNextToken();                           // y-res
diff --git a/src/gtk/mdi.cpp b/src/gtk/mdi.cpp
index 8c29530da5..3fa7de98fd 100644
--- a/src/gtk/mdi.cpp
+++ b/src/gtk/mdi.cpp
@@ -48,7 +48,7 @@ extern wxList wxPendingDelete;
 //-----------------------------------------------------------------------------
 
 static void 
-gtk_mdi_page_change_callback( GtkNotebook *widget,
+gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
                               GtkNotebookPage *page,
 			      gint WXUNUSED(page_num),
 			      wxMDIParentFrame *parent )
diff --git a/src/gtk/minifram.cpp b/src/gtk/minifram.cpp
index 47acb2a6f0..36217adb2a 100644
--- a/src/gtk/minifram.cpp
+++ b/src/gtk/minifram.cpp
@@ -179,7 +179,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
                           GDK_BUTTON1_MOTION_MASK),
                       (GdkWindow *) NULL,
                       (GdkCursor *) NULL,
-                      GDK_CURRENT_TIME );
+                      (unsigned int) GDK_CURRENT_TIME );
                      
     win->m_diffX = (int)gdk_event->x;
     win->m_diffY = (int)gdk_event->y;
diff --git a/src/gtk/win_gtk.c b/src/gtk/win_gtk.c
index 2097a2db33..164a855b49 100644
--- a/src/gtk/win_gtk.c
+++ b/src/gtk/win_gtk.c
@@ -201,7 +201,7 @@ gtk_pizza_new ()
     return GTK_WIDGET (pizza);
 }
 
-void  
+static void  
 gtk_pizza_scroll_set_adjustments (GtkPizza     *pizza,
 				    GtkAdjustment  *hadj,
 				    GtkAdjustment  *vadj)
diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp
index 26a9ea36e6..e399efa119 100644
--- a/src/gtk1/app.cpp
+++ b/src/gtk1/app.cpp
@@ -226,12 +226,25 @@ void wxapp_install_idle_handler()
 {
     wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") );
 
-    /* this routine gets called by all event handlers
-       indicating that the idle is over. */
+    /* This routine gets called by all event handlers
+       indicating that the idle is over. It may also
+       get called from other thread for sending events
+       to the main thread (and processing these in
+       idle time). */
+
+#if wxUSE_THREADS
+    if (!wxThread::IsMain())
+        GDK_THREADS_ENTER ();
+#endif
 
     wxTheApp->m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
 
     g_isIdle = FALSE;
+    
+#if wxUSE_THREADS
+    if (!wxThread::IsMain())
+        GDK_THREADS_LEAVE ();
+#endif
 }
 
 #if wxUSE_THREADS
diff --git a/src/gtk1/dataobj.cpp b/src/gtk1/dataobj.cpp
index e901b6ea57..bde950fbb6 100644
--- a/src/gtk1/dataobj.cpp
+++ b/src/gtk1/dataobj.cpp
@@ -204,7 +204,7 @@ size_t wxFileDataObject::GetDataSize() const
     return res + 1;
 }
 
-bool wxFileDataObject::SetData(size_t size, const void *buf)
+bool wxFileDataObject::SetData(size_t WXUNUSED(size), const void *buf)
 {
     // VZ: old format
 #if 0
diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp
index 6cd4c22b1c..a957f4f68a 100644
--- a/src/gtk1/font.cpp
+++ b/src/gtk1/font.cpp
@@ -188,7 +188,7 @@ wxFont::wxFont( const wxString& fontname, const wxFontData& fontdata )
 
     tmp = tn.GetNextToken();                     // pointsize
     long num = wxStrtol (tmp.c_str(), (wxChar **) NULL, 10);
-    M_FONTDATA->m_pointSize = num / 10;
+    M_FONTDATA->m_pointSize = (int)(num / 10);
 
     tn.GetNextToken();                           // x-res
     tn.GetNextToken();                           // y-res
diff --git a/src/gtk1/mdi.cpp b/src/gtk1/mdi.cpp
index 8c29530da5..3fa7de98fd 100644
--- a/src/gtk1/mdi.cpp
+++ b/src/gtk1/mdi.cpp
@@ -48,7 +48,7 @@ extern wxList wxPendingDelete;
 //-----------------------------------------------------------------------------
 
 static void 
-gtk_mdi_page_change_callback( GtkNotebook *widget,
+gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
                               GtkNotebookPage *page,
 			      gint WXUNUSED(page_num),
 			      wxMDIParentFrame *parent )
diff --git a/src/gtk1/minifram.cpp b/src/gtk1/minifram.cpp
index 47acb2a6f0..36217adb2a 100644
--- a/src/gtk1/minifram.cpp
+++ b/src/gtk1/minifram.cpp
@@ -179,7 +179,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
                           GDK_BUTTON1_MOTION_MASK),
                       (GdkWindow *) NULL,
                       (GdkCursor *) NULL,
-                      GDK_CURRENT_TIME );
+                      (unsigned int) GDK_CURRENT_TIME );
                      
     win->m_diffX = (int)gdk_event->x;
     win->m_diffY = (int)gdk_event->y;
diff --git a/src/gtk1/win_gtk.c b/src/gtk1/win_gtk.c
index 2097a2db33..164a855b49 100644
--- a/src/gtk1/win_gtk.c
+++ b/src/gtk1/win_gtk.c
@@ -201,7 +201,7 @@ gtk_pizza_new ()
     return GTK_WIDGET (pizza);
 }
 
-void  
+static void  
 gtk_pizza_scroll_set_adjustments (GtkPizza     *pizza,
 				    GtkAdjustment  *hadj,
 				    GtkAdjustment  *vadj)
diff --git a/utils/glcanvas/gtk/glcanvas.cpp b/utils/glcanvas/gtk/glcanvas.cpp
index 811c0fcb80..71d8228192 100644
--- a/utils/glcanvas/gtk/glcanvas.cpp
+++ b/utils/glcanvas/gtk/glcanvas.cpp
@@ -154,6 +154,26 @@ gtk_glwindow_realized_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win )
     return FALSE;
 }
 
+//-----------------------------------------------------------------------------
+// "map" from m_wxwindow
+//-----------------------------------------------------------------------------
+
+static gint
+gtk_glwindow_map_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win )
+{
+    if (win->m_glContext/* && win->m_exposed*/)
+    {
+        wxPaintEvent event( win->GetId() );
+        event.SetEventObject( win );
+        win->GetEventHandler()->ProcessEvent( event );
+
+        win->m_exposed = FALSE;
+        win->GetUpdateRegion().Clear();
+    }
+
+    return FALSE;
+}
+
 //-----------------------------------------------------------------------------
 // "expose_event" of m_wxwindow
 //-----------------------------------------------------------------------------
@@ -314,6 +334,9 @@ bool wxGLCanvas::Create( wxWindow *parent,
     gtk_signal_connect( GTK_OBJECT(m_wxwindow), "realize",
                             GTK_SIGNAL_FUNC(gtk_glwindow_realized_callback), (gpointer) this );
 
+    gtk_signal_connect( GTK_OBJECT(m_wxwindow), "map",
+                            GTK_SIGNAL_FUNC(gtk_glwindow_map_callback), (gpointer) this );
+
     gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
         GTK_SIGNAL_FUNC(gtk_glwindow_expose_callback), (gpointer)this );
 
diff --git a/utils/glcanvas/samples/cube/Makefile b/utils/glcanvas/samples/cube/Makefile
index 6e852b2dd4..2b48e8478a 100644
--- a/utils/glcanvas/samples/cube/Makefile
+++ b/utils/glcanvas/samples/cube/Makefile
@@ -12,12 +12,10 @@
 # on your system.
 #
 
-CC = g++
+CC = gcc
 
 cube: cube.o glcanvas.o
-	$(CC) -o cube \
-	cube.o glcanvas.o \
-	`wx-config --libs` -lMesaGL -lMesaGLU
+	$(CC) -o cube cube.o glcanvas.o `wx-config --libs` -lMesaGL -lMesaGLU
 
 cube.o: cube.cpp
 	$(CC) `wx-config --cflags` -I../../gtk -c cube.cpp
diff --git a/utils/glcanvas/samples/cube/cube.cpp b/utils/glcanvas/samples/cube/cube.cpp
index ccc6834c1f..be5d196b33 100644
--- a/utils/glcanvas/samples/cube/cube.cpp
+++ b/utils/glcanvas/samples/cube/cube.cpp
@@ -76,6 +76,7 @@ void ScanCodeCtrl::OnKeyDown( wxKeyEvent& event )
 /*------------------------------------------------------------------
  Dialog for defining a keypress
 -------------------------------------------------------------------*/
+
 class ScanCodeDialog : public wxDialog
 {
 public:
@@ -85,16 +86,8 @@ public:
 private:
   ScanCodeCtrl       *m_ScanCode;
   wxTextCtrl         *m_Description;
-// any class wishing to process wxWindows events must use this macro
-  DECLARE_EVENT_TABLE()
 };
 
-BEGIN_EVENT_TABLE( ScanCodeDialog, wxDialog )
-//
-END_EVENT_TABLE()
-
-/* ---------------------------------------------------------------- */
-
 ScanCodeDialog::ScanCodeDialog( wxWindow* parent, wxWindowID id, 
                const int code, const wxString &descr, const wxString& title )
           : wxDialog( parent, id, title, wxPoint(-1, -1), wxSize(96*2,76*2) )
@@ -172,46 +165,49 @@ TestGLCanvas::TestGLCanvas(wxWindow *parent, wxWindowID id,
     const wxPoint& pos, const wxSize& size, long style, const wxString& name):
   wxGLCanvas(parent, NULL, id, pos, size, style, name )
 {
-  m_init = FALSE;
-  m_gllist = 0;
-  m_rleft = WXK_LEFT;
-  m_rright = WXK_RIGHT;
+    m_init = FALSE;
+    m_gllist = 0;
+    m_rleft = WXK_LEFT;
+    m_rright = WXK_RIGHT;
 }
+
 TestGLCanvas::TestGLCanvas(wxWindow *parent, const TestGLCanvas &other, 
     wxWindowID id, const wxPoint& pos, const wxSize& size, long style,
     const wxString& name ) :
       wxGLCanvas(parent, other.GetContext(), id, pos, size, style, name  )
 {
-  m_init = FALSE;
-  m_gllist = other.m_gllist;    /* share display list */
-  m_rleft = WXK_LEFT;
-  m_rright = WXK_RIGHT;
+    m_init = FALSE;
+    m_gllist = other.m_gllist;    /* share display list */
+    m_rleft = WXK_LEFT;
+    m_rright = WXK_RIGHT;
 }
-TestGLCanvas::~TestGLCanvas(void)
+
+TestGLCanvas::~TestGLCanvas()
 {
 }
 
-void TestGLCanvas::Render( void  )
+void TestGLCanvas::Render()
 {
-  wxPaintDC dc(this);
+    wxPaintDC dc(this);
 
 #ifndef __WXMOTIF__
-  if (!GetContext()) return;
+    if (!GetContext()) return;
 #endif
-  SetCurrent();
-  /* init OpenGL once, but after SetCurrent */
-  if (!m_init)
-  {
-    InitGL();
-    m_init = TRUE;
-  }
-  /* clear color and depth buffers */
-  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+    SetCurrent();
+    /* init OpenGL once, but after SetCurrent */
+    if (!m_init)
+    {
+        InitGL();
+        m_init = TRUE;
+    }
+    
+    /* clear color and depth buffers */
+    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
   if( m_gllist == 0 )
   {
     m_gllist = glGenLists( 1 );
-    printf( "List=%d\n", m_gllist );
     glNewList( m_gllist, GL_COMPILE_AND_EXECUTE );        
     /* draw six faces of a cube */
     glBegin(GL_QUADS);
@@ -251,26 +247,26 @@ void TestGLCanvas::Render( void  )
 
 void TestGLCanvas::OnEnterWindow( wxMouseEvent& event )
 {
-  SetFocus();
+    SetFocus();
 }
 
 void TestGLCanvas::OnPaint( wxPaintEvent& event )
 {
-  Render();
+    Render();
 }
 
 void TestGLCanvas::OnSize(wxSizeEvent& event)
 {
-  int width, height;
-  GetClientSize(& width, & height);
+    int width, height;
+    GetClientSize(& width, & height);
 
 #ifndef __WXMOTIF__
-  if (GetContext())
+    if (GetContext())
 #endif
-  {
-    SetCurrent();
-    glViewport(0, 0, width, height);
-  }
+    {
+        SetCurrent();
+        glViewport(0, 0, width, height);
+    }
 }
 
 void TestGLCanvas::OnEraseBackground(wxEraseEvent& event)
@@ -278,25 +274,25 @@ void TestGLCanvas::OnEraseBackground(wxEraseEvent& event)
   // Do nothing, to avoid flashing.
 }
 
-void TestGLCanvas::InitGL(void)
+void TestGLCanvas::InitGL()
 {
-  SetCurrent();
+    SetCurrent();
     
-  /* set viewing projection */
-  glMatrixMode(GL_PROJECTION);
-  glFrustum(-0.5F, 0.5F, -0.5F, 0.5F, 1.0F, 3.0F);
+    /* set viewing projection */
+    glMatrixMode(GL_PROJECTION);
+    glFrustum(-0.5F, 0.5F, -0.5F, 0.5F, 1.0F, 3.0F);
 
-  /* position viewer */
-  glMatrixMode(GL_MODELVIEW);
-  glTranslatef(0.0F, 0.0F, -2.0F);
+    /* position viewer */
+    glMatrixMode(GL_MODELVIEW);
+    glTranslatef(0.0F, 0.0F, -2.0F);
 
-  /* position object */
-  glRotatef(30.0F, 1.0F, 0.0F, 0.0F);
-  glRotatef(30.0F, 0.0F, 1.0F, 0.0F);
+    /* position object */
+    glRotatef(30.0F, 1.0F, 0.0F, 0.0F);
+    glRotatef(30.0F, 0.0F, 1.0F, 0.0F);
 
-  glEnable(GL_DEPTH_TEST);
-  glEnable(GL_LIGHTING);
-  glEnable(GL_LIGHT0);
+    glEnable(GL_DEPTH_TEST);
+    glEnable(GL_LIGHTING);
+    glEnable(GL_LIGHT0);
 }
 
 GLfloat TestGLCanvas::CalcRotateSpeed( unsigned long acceltime )
@@ -314,65 +310,74 @@ GLfloat TestGLCanvas::CalcRotateSpeed( unsigned long acceltime )
 
   return(v);
 }
+
 GLfloat TestGLCanvas::CalcRotateAngle( unsigned long lasttime,
                                   unsigned long acceltime )
 {
-  GLfloat t,s1,s2;
+    GLfloat t,s1,s2;
 
-  t = ((GLfloat)(acceltime - lasttime)) / 1000.0f;
-  s1 = CalcRotateSpeed( lasttime );
-  s2 = CalcRotateSpeed( acceltime );
-  return( t * (s1 + s2) * 135.0f );
+    t = ((GLfloat)(acceltime - lasttime)) / 1000.0f;
+    s1 = CalcRotateSpeed( lasttime );
+    s2 = CalcRotateSpeed( acceltime );
+    
+    return( t * (s1 + s2) * 135.0f );
 }
+
 void TestGLCanvas::Action( long code, unsigned long lasttime,
                            unsigned long acceltime )
 {
-  GLfloat angle = CalcRotateAngle( lasttime, acceltime );
+    GLfloat angle = CalcRotateAngle( lasttime, acceltime );
 
-  if( code == m_rleft ) Rotate( angle );
-  else if( code == m_rright ) Rotate( -angle );
+    if (code == m_rleft) 
+        Rotate( angle );
+    else if (code == m_rright) 
+            Rotate( -angle );
 }
 
 void TestGLCanvas::OnKeyDown( wxKeyEvent& event )
 {
-  long evkey = event.KeyCode();
-  if( evkey == 0 ) return;
-
-  if( !m_TimeInitialized )
-  {
-    m_TimeInitialized = 1;
-    m_xsynct = event.m_timeStamp;
-    m_gsynct = wxStopWatch(&m_secbase);
-
-    m_Key = evkey;
-    m_StartTime = 0;
-    m_LastTime = 0;
-    m_LastRedraw = 0;
-  }
-
-  unsigned long currTime = event.m_timeStamp - m_xsynct;
+    long evkey = event.KeyCode();
+    if (evkey == 0) return;
+
+    if (!m_TimeInitialized)
+    {
+        m_TimeInitialized = 1;
+        m_xsynct = event.m_timeStamp;
+        m_gsynct = wxStopWatch(&m_secbase);
+
+        m_Key = evkey;
+        m_StartTime = 0;
+        m_LastTime = 0;
+        m_LastRedraw = 0;
+    }
+
+    unsigned long currTime = event.m_timeStamp - m_xsynct;
   
-  if( evkey != m_Key )
-  {
-    m_Key = evkey;
-    m_LastRedraw = m_StartTime = m_LastTime = currTime;
-  }
-
-  if( currTime >= m_LastRedraw )      // Redraw:
-  {
-    Action( m_Key, m_LastTime-m_StartTime, currTime-m_StartTime );
+    if (evkey != m_Key)
+    {
+        m_Key = evkey;
+        m_LastRedraw = m_StartTime = m_LastTime = currTime;
+    }
+
+    if (currTime >= m_LastRedraw)      // Redraw:
+    {
+        Action( m_Key, m_LastTime-m_StartTime, currTime-m_StartTime );
                   
-    m_LastRedraw = wxStopWatch(&m_secbase) - m_gsynct;
-    m_LastTime = currTime;
-  }
+        m_LastRedraw = wxStopWatch(&m_secbase) - m_gsynct;
+        m_LastTime = currTime;
+    }
+    
+    event.Skip();
 }
 
 void TestGLCanvas::OnKeyUp( wxKeyEvent& event )
 {
-  m_Key = 0;
-  m_StartTime = 0;
-  m_LastTime = 0;
-  m_LastRedraw = 0;
+    m_Key = 0;
+    m_StartTime = 0;
+    m_LastTime = 0;
+    m_LastRedraw = 0;
+    
+    event.Skip();
 }
 
 void TestGLCanvas::Rotate( GLfloat deg )
diff --git a/utils/glcanvas/samples/penguin/Makefile b/utils/glcanvas/samples/penguin/Makefile
index 8e02865f70..340df1537f 100644
--- a/utils/glcanvas/samples/penguin/Makefile
+++ b/utils/glcanvas/samples/penguin/Makefile
@@ -12,16 +12,14 @@
 # on your system.
 #
 
-CPP = g++
+CPP = gcc
 CC = gcc
 
 Penguin: penguin.o trackball.o lw.o glcanvas.o
-	$(CPP) -o Penguin \
-	penguin.o trackball.o lw.o glcanvas.o \
-	`wx-config --libs` -lMesaGL -lMesaGLU
+	$(CPP) -o Penguin penguin.o trackball.o lw.o glcanvas.o `wx-config --libs` -lMesaGL -lMesaGLU
 
 penguin.o: penguin.cpp
-	$(CPP) `wx-config --cflags` -g -I../../gtk -c penguin.cpp
+	$(CPP) `wx-config --cflags` -I../../gtk -c penguin.cpp
 
 lw.o: lw.cpp
 	$(CPP) `wx-config --cflags` -I../../gtk -c lw.cpp
-- 
2.50.0

