=== modified file 'common/base_screen.cpp'
--- common/base_screen.cpp	2010-10-04 12:58:07 +0000
+++ common/base_screen.cpp	2010-10-26 18:25:06 +0000
@@ -12,6 +12,7 @@
 #include "sch_item_struct.h"
 #include "class_base_screen.h"
 #include "id.h"
+#include "kicad_events.h"
 
 /* Implement wxSize array for grid list implementation. */
 #include <wx/arrimpl.cpp>
@@ -21,8 +22,11 @@
 
 #define CURSOR_SIZE 12  /* size of the cross cursor. */
 
+/* 
+ * parent is the window where post events 
+ */
 
-BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType )
+BASE_SCREEN::BASE_SCREEN( KICAD_T aType, wxWindow* parent) : EDA_BaseStruct( aType )
 {
     EEDrawList         = NULL;   /* Schematic items list */
     m_UndoRedoCountMax = 10;     /* undo/Redo command Max depth, 10 is a
@@ -39,8 +43,10 @@
     m_IsPrinting       = false;
     m_ScrollPixelsPerUnitX = 1;
     m_ScrollPixelsPerUnitY = 1;
+    m_parent = parent;
 
     InitDatas();
+    SEND_SCREEN_INIT(this);
 }
 
 
@@ -102,6 +108,7 @@
 
     m_CurrentSheetDesc->m_Size.x = (int) ((double)aPageSize.x * 1000 / internal_units);
     m_CurrentSheetDesc->m_Size.y = (int) ((double)aPageSize.y * 1000 / internal_units);
+    SEND_SCREEN_INIT(this);
 }
 
 
@@ -257,12 +264,14 @@
         if( m_Zoom != m_ZoomScalar )
         {
             m_Zoom = m_ZoomScalar;
+            SEND_SCREEN_ZOOM(this);
             return true;
         }
     }
     else if( m_Zoom != m_ZoomList[0] )
     {
         m_Zoom = m_ZoomList[0];
+        SEND_SCREEN_ZOOM(this);
         return true;
     }
 
@@ -285,7 +294,7 @@
 
     if( m_Zoom < 1 )
         m_Zoom = 1;
-
+    SEND_SCREEN_ZOOM(this);
     return true;
 }
 
@@ -302,6 +311,7 @@
         if( m_Zoom < m_ZoomList[i] )
         {
             m_Zoom = m_ZoomList[i];
+            SEND_SCREEN_ZOOM(this);
             return true;
         }
     }
@@ -322,6 +332,7 @@
         if( m_Zoom > m_ZoomList[i - 1] )
         {
             m_Zoom = m_ZoomList[i - 1];
+            SEND_SCREEN_ZOOM(this);
             return true;
         }
     }
@@ -336,6 +347,7 @@
         return false;
 
     m_Zoom = m_ZoomList.Last();
+    SEND_SCREEN_ZOOM(this);
     return true;
 }
 
@@ -346,6 +358,7 @@
         m_GridList.Clear();
 
     m_GridList = gridlist;
+    SEND_SCREEN_GRID(this);
 }
 
 
@@ -362,6 +375,7 @@
         if( m_GridList[i].m_Size == size )
         {
             m_Grid = m_GridList[i];
+            SEND_SCREEN_GRID(this);
             return;
         }
 
@@ -375,6 +389,7 @@
     wxLogWarning( wxT( "Grid size( %f, %f ) not in grid list, falling back " ) \
                   wxT( "to grid size( %f, %f )." ),
                   size.x, size.y, m_Grid.m_Size.x, m_Grid.m_Size.y );
+    SEND_SCREEN_GRID(this);
 }
 
 
@@ -390,6 +405,7 @@
         if( m_GridList[i].m_Id == id )
         {
             m_Grid = m_GridList[i];
+            SEND_SCREEN_GRID(this);
             return;
         }
     }
@@ -399,6 +415,7 @@
     wxLogWarning( wxT( "Grid ID %d not in grid list, falling back to " ) \
                   wxT( "grid size( %g, %g )." ), id, m_Grid.m_Size.x,
                   m_Grid.m_Size.y );
+    SEND_SCREEN_GRID(this);
 }
 
 
@@ -541,6 +558,15 @@
     return m_RedoList.PopCommand( );
 }
 
+/********************************************************/
+/* Set the parent, where to post events                 */
+/********************************************************/
+
+void BASE_SCREEN::SetParent(wxWindow* parent)
+{
+    m_parent = parent;
+    SEND_SCREEN_INIT(screen);
+}
 
 #if defined(DEBUG)
 /**

=== modified file 'include/class_base_screen.h'
--- include/class_base_screen.h	2010-10-20 20:24:26 +0000
+++ include/class_base_screen.h	2010-10-25 19:31:57 +0000
@@ -120,6 +120,7 @@
     wxString        m_Commentaire4;
 
 private:
+    wxWindow*       m_parent;
     char            m_FlagRefreshReq;       /* indicates that the screen should
                                              * be redrawn */
     char            m_FlagModified;         // indicates current drawing has
@@ -140,13 +141,13 @@
     bool       m_IsPrinting;
 
 public:
-    BASE_SCREEN( KICAD_T aType = SCREEN_STRUCT_TYPE );
+    BASE_SCREEN( KICAD_T aType = SCREEN_STRUCT_TYPE, wxWindow* parent = NULL );
     ~BASE_SCREEN();
 
     BASE_SCREEN* Next() const { return (BASE_SCREEN*) Pnext; }
     BASE_SCREEN* Back() const { return (BASE_SCREEN*) Pback; }
 
-
+    
     /**
      * Function setCurItem
      * sets the currently selected object, m_CurrentItem.
@@ -156,6 +157,7 @@
     EDA_BaseStruct* GetCurItem() const { return m_CurrentItem; }
 
     void         InitDatas();
+    void         SetParent(wxWindow* parent);
 
     void         SetPageSize( wxSize& aPageSize );
     wxSize       ReturnPageSize( void );

=== modified file 'include/class_pcb_screen.h'
--- include/class_pcb_screen.h	2010-01-31 20:01:46 +0000
+++ include/class_pcb_screen.h	2010-10-25 17:30:59 +0000
@@ -14,7 +14,7 @@
     int m_Route_Layer_BOTTOM;
 
 public:
-    PCB_SCREEN();
+    PCB_SCREEN(wxWindow* parent = NULL);
     ~PCB_SCREEN();
 
     PCB_SCREEN* Next() { return (PCB_SCREEN*) Pnext; }

=== added file 'include/kicad_events.h'
--- include/kicad_events.h	1970-01-01 00:00:00 +0000
+++ include/kicad_events.h	2010-10-25 21:59:49 +0000
@@ -0,0 +1,91 @@
+#include <wx/event.h>
+#include <wx/debug.h>
+#include "class_base_screen.h"
+
+#ifndef KICAD_EVENTS.H
+#define KICAD_EVENTS 1
+
+DECLARE_EVENT_TYPE(wxKICAD_SCREEN_EVENT, wxID_ANY )
+DEFINE_EVENT_TYPE(wxKICAD_SCREEN_EVENT)
+
+class KicadScreenEvent : public wxEvent 
+{
+public:
+    int           subject;
+    wxWindow*     m_parent;
+    int           m_NumberOfScreen;
+    int           m_ScreenNumber;
+    int           m_Zoom;
+    int           m_ZoomScalar;
+    GridArray     m_GridList;
+    GRID_TYPE     m_Grid;
+ 
+    // Subjects of the Event
+    static const int SCREEN_INIT = 0;
+    static const int SCREEN_GRID = 1;
+    static const int SCREEN_ZOOM = 2;
+
+    KicadScreenEvent(int winid = wxID_ANY,wxEventType eventType = wxKICAD_SCREEN_EVENT):
+        wxEvent(winid, eventType)
+    {
+    subject=-1;
+    };
+
+    KicadScreenEvent(const KicadScreenEvent &evt):
+       wxEvent(evt.GetId(), evt.GetEventType())
+    {
+    subject = evt.subject;
+    m_NumberOfScreen = evt.m_NumberOfScreen;
+    m_ScreenNumber = evt.m_ScreenNumber;
+    m_Zoom = evt.m_Zoom;
+    m_ZoomScalar = evt.m_ZoomScalar;
+    m_GridList = evt.m_GridList;
+    m_Grid = evt.m_Grid;
+    };
+
+    virtual wxEvent *Clone() const { return new KicadScreenEvent(*this); }
+    DECLARE_DYNAMIC_CLASS(KicadScreenEvent);
+};
+
+wxDECLARE_EVENT(SCREEN_EVENT, KicadScreenEvent);
+wxDEFINE_EVENT(SCREEN_EVENT, KicadScreenEvent);
+IMPLEMENT_DYNAMIC_CLASS( KicadScreenEvent, wxEvent )
+
+#define SEND_SCREEN_INIT(screen) \
+        { \
+        KicadScreenEvent evt; \
+        evt.m_parent = m_parent; \
+        evt.subject = evt.SCREEN_INIT; \
+        evt.m_NumberOfScreen = m_NumberOfScreen; \
+        evt.m_ScreenNumber = m_ScreenNumber; \
+        evt.m_Zoom = m_Zoom; \
+        evt.m_ZoomScalar = m_ZoomScalar; \
+        evt.m_GridList = m_GridList; \
+        evt.m_Grid = m_Grid; \
+        if(m_parent != NULL ) \
+            m_parent->GetEventHandler()->QueueEvent(evt.Clone()); \
+        }
+
+#define SEND_SCREEN_GRID(screen) \
+        { \
+        KicadScreenEvent evt; \
+        evt.m_parent = m_parent; \
+        evt.subject = evt.SCREEN_GRID; \
+        evt.m_GridList = m_GridList; \
+        evt.m_Grid = m_Grid; \
+        if(m_parent != NULL ) \
+            m_parent->GetEventHandler()->QueueEvent(evt.Clone()); \
+        }
+
+#define SEND_SCREEN_ZOOM(screen) \
+        { \
+        KicadScreenEvent evt; \
+        evt.m_parent = m_parent; \
+        evt.subject = evt.SCREEN_ZOOM; \
+        evt.m_Zoom = m_Zoom; \
+        evt.m_ZoomScalar = m_ZoomScalar; \
+        if(m_parent != NULL ) \
+            m_parent->GetEventHandler()->QueueEvent(evt.Clone()); \
+        }
+
+#endif // KICAD_EVENTS.H

=== modified file 'pcbnew/classpcb.cpp'
--- pcbnew/classpcb.cpp	2010-03-20 19:57:59 +0000
+++ pcbnew/classpcb.cpp	2010-10-25 18:12:18 +0000
@@ -68,7 +68,8 @@
 /*******************************************************************/
 /* Class PCB_SCREEN: class to handle parametres to display a board */
 /********************************************************************/
-PCB_SCREEN::PCB_SCREEN() : BASE_SCREEN( TYPE_SCREEN )
+PCB_SCREEN::PCB_SCREEN(wxWindow* parent) : 
+    BASE_SCREEN( TYPE_SCREEN , parent)
 {
     size_t i;
 

=== modified file 'pcbnew/moduleframe.cpp'
--- pcbnew/moduleframe.cpp	2010-08-10 18:34:26 +0000
+++ pcbnew/moduleframe.cpp	2010-10-25 22:22:02 +0000
@@ -173,7 +173,7 @@
     GetBoard()->m_PcbFrame = this;
 
     if( s_screenModule == NULL )
-        s_screenModule = new PCB_SCREEN();
+        s_screenModule = new PCB_SCREEN(this);
     SetBaseScreen( s_screenModule );
     ActiveScreen = GetScreen();
     GetBoard()->SetBoardDesignSettings( &s_ModuleEditorDesignSetting );

=== modified file 'pcbnew/pcbnew.cpp'
--- pcbnew/pcbnew.cpp	2010-09-03 17:39:57 +0000
+++ pcbnew/pcbnew.cpp	2010-10-25 19:28:29 +0000
@@ -142,6 +142,8 @@
     frame = new WinEDA_PcbFrame( NULL, wxT( "PcbNew" ), wxPoint( 0, 0 ), wxSize( 600, 400 ) );
     frame->SetTitle( GetTitle() + wxT( " " ) + GetBuildVersion() );
 
+    ScreenPcb->SetParent(frame);
+
     SetTopWindow( frame );
     frame->Show( true );
 

