]> git.saurik.com Git - wxWidgets.git/commitdiff
Added emulator utility.
authorJulian Smart <julian@anthemion.co.uk>
Sun, 10 Mar 2002 13:30:16 +0000 (13:30 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sun, 10 Mar 2002 13:30:16 +0000 (13:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14538 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

14 files changed:
utils/configure.in
utils/emulator/Makefile.in [new file with mode: 0644]
utils/emulator/docs/readme.txt [new file with mode: 0644]
utils/emulator/src/Makefile.in [new file with mode: 0644]
utils/emulator/src/emulator.cpp [new file with mode: 0644]
utils/emulator/src/emulator.dsp [new file with mode: 0644]
utils/emulator/src/emulator.dsw [new file with mode: 0644]
utils/emulator/src/emulator.h [new file with mode: 0644]
utils/emulator/src/emulator.rc [new file with mode: 0644]
utils/emulator/src/ipaq01.jpg [new file with mode: 0644]
utils/emulator/src/makefile.g95 [new file with mode: 0644]
utils/emulator/src/makefile.vc [new file with mode: 0644]
utils/emulator/src/mondrian.ico [new file with mode: 0644]
utils/emulator/src/mondrian.xpm [new file with mode: 0644]

index ff794a4c5c24b153ed3bd530c9ffd05c0924cfdc..46288258bb90effd3d20beda6c7e52cdd7c1f2b6 100644 (file)
@@ -16,4 +16,6 @@ AC_OUTPUT([
             hhp2cached/Makefile
             dialoged/Makefile
             dialoged/src/Makefile
+            emulator/Makefile
+            emulator/src/Makefile
          ])
diff --git a/utils/emulator/Makefile.in b/utils/emulator/Makefile.in
new file mode 100644 (file)
index 0000000..6d36395
--- /dev/null
@@ -0,0 +1,7 @@
+
+all:
+       cd src; $(MAKE)
+
+clean:
+       cd src; $(MAKE) clean
+
diff --git a/utils/emulator/docs/readme.txt b/utils/emulator/docs/readme.txt
new file mode 100644 (file)
index 0000000..42e8cff
--- /dev/null
@@ -0,0 +1,87 @@
+wxWindows PDA/Embedded System Emulator
+======================================
+
+This is a simple display emulator for embedded
+applications (wxWindows or other) that use
+an X server. The Familiar Linux distribution
+is one such environment, using Tiny-X.
+
+wxEmulator uses Xnest, which is the XFree86
+X server compiled to show a virtual X desktop
+in a window. wxEmulator hijacks the Xnest
+window by reparenting its window, and shows
+this window with appropriate PDA-style decorations
+surrounding it.
+
+No real emulation is done, apart from the work
+that Xnest does. You compile your apps on your
+host as usual and test them out with the emulator
+to get an idea of the constraints of the embedded
+system display. Then compile the apps for your
+target system with a suitable cross-compiler,
+or if you have the luxury of lots of space on
+your target device, compile natively on the
+target.
+
+It is intended to create a tarball of the
+emulator, wxX11 and maybe some other useful
+components such as a simple window manager so that
+people can quickly start developing embedded
+GUI applications without the need for actual
+target hardware.
+
+Running wxEmulator
+==================
+
+Make sure Xnest is in your PATH. You can download
+a binary from the XFree86 ftp server or a mirror,
+or you can compile Xnest from source -- but this
+downloading XFree86 source in its entirety and
+compiling it. Say goodbye to half a gig of disk
+space if you take this option.
+
+Then run wxEmulator:
+
+% emulator &
+
+After a brief flicker in which wxEmulator steals
+Xnest's window, you should see an emulated iPAQ with
+a checked screen that indicates raw X with nothing else
+running.
+
+Running any X applications with the Xnest display
+number (currently 100) will show those applications
+in the emulator window instead of the normal desktop.
+
+For example:
+
+% xeyes -display :100 &
+
+Before running any other programs, run a window
+manager such as twm:
+
+% twm -display :100 &
+
+If the X program or WM you want to run doesn't support the
+-display argument, try exporting the DISPLAY variable
+before running it. E.g.:
+
+% export DISPLAY=:100
+% xterm &
+
+Eventually the emulator will support configurable
+skins, complete with buttons as on the actual device.
+For now, it just pretends to be an iPAQ.
+
+Compiling wxEmulator
+====================
+
+You need to use wxX11 -- no other port is supported.
+Configure and make wxX11 in the usual way (see docs/x11/install.txt
+at the wxWindows top level), then compile wxEmulator
+using the makefile that configure created.
+
+Have fun!
+
+Julian Smart, March 2002
+
diff --git a/utils/emulator/src/Makefile.in b/utils/emulator/src/Makefile.in
new file mode 100644 (file)
index 0000000..314b59a
--- /dev/null
@@ -0,0 +1,23 @@
+#
+# File:                Makefile.in
+# Author:      Julian Smart
+# Created:     2002
+# Updated:     
+# Copyright:   (c) 2002 Julian Smart
+#
+# "%W% %G%"
+#
+# Makefile for PDA emulator
+
+top_srcdir = @top_srcdir@/..
+top_builddir = ../../..
+program_dir = utils/emulator/src
+
+PROGRAM=emulator
+
+OBJECTS =$(PROGRAM).o
+DEPFILES=$(PROGRAM).d
+
+include ../../../src/makeprog.env
+
+@IF_GNU_MAKE@-include $(DEPFILES)
diff --git a/utils/emulator/src/emulator.cpp b/utils/emulator/src/emulator.cpp
new file mode 100644 (file)
index 0000000..2740f75
--- /dev/null
@@ -0,0 +1,345 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        emulator.cpp
+// Purpose:     Emulator wxWindows sample
+// Author:      Julian Smart
+// Modified by:
+// Created:     04/01/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+#ifdef __GNUG__
+    #pragma implementation "emulator.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+// for all others, include the necessary headers (this file is usually all you
+// need because it includes almost all "standard" wxWindows headers)
+#ifndef WX_PRECOMP
+    #include "wx/wx.h"
+#endif
+
+#include "emulator.h"
+
+#ifdef __WXX11__    
+#include "wx/x11/reparent.h"
+#endif
+
+// ----------------------------------------------------------------------------
+// resources
+// ----------------------------------------------------------------------------
+
+// the application icon (under Windows and OS/2 it is in resources)
+#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__)
+    #include "mondrian.xpm"
+#endif
+
+// ----------------------------------------------------------------------------
+// event tables and other macros for wxWindows
+// ----------------------------------------------------------------------------
+
+// the event tables connect the wxWindows events with the functions (event
+// handlers) which process them. It can be also done at run-time, but for the
+// simple menu events like this the static method is much simpler.
+BEGIN_EVENT_TABLE(wxEmulatorFrame, wxFrame)
+    EVT_MENU(Emulator_Quit,  wxEmulatorFrame::OnQuit)
+    EVT_MENU(Emulator_About, wxEmulatorFrame::OnAbout)
+END_EVENT_TABLE()
+
+// Create a new application object: this macro will allow wxWindows to create
+// the application object during program execution (it's better than using a
+// static object for many reasons) and also declares the accessor function
+// wxGetApp() which will return the reference of the right type (i.e. wxEmulatorApp and
+// not wxApp)
+IMPLEMENT_APP(wxEmulatorApp)
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// the application class
+// ----------------------------------------------------------------------------
+
+wxEmulatorApp::wxEmulatorApp()
+{
+    m_xnestWindow = NULL;
+    m_containerWindow = NULL;
+}
+
+// 'Main program' equivalent: the program execution "starts" here
+bool wxEmulatorApp::OnInit()
+{
+    wxInitAllImageHandlers();
+
+    // create the main application window
+    wxEmulatorFrame *frame = new wxEmulatorFrame(_T("wxEmulator"),
+                                 wxPoint(50, 50), wxSize(450, 340));
+                                
+    m_containerWindow = new wxEmulatorContainer(frame, -1);
+
+    // Load the emulation info
+    if (!LoadEmulator())
+    {
+        frame->Destroy();
+        wxMessageBox(wxT("Sorry, could not load this emulator. Please check bitmaps are valid."));
+        return FALSE;        
+    }
+    
+    if (m_emulatorInfo.m_emulatorBackgroundBitmap.Ok())
+        frame->SetClientSize(m_emulatorInfo.m_emulatorBackgroundBitmap.GetWidth(),
+                             m_emulatorInfo.m_emulatorBackgroundBitmap.GetHeight());
+    
+    // and show it (the frames, unlike simple controls, are not shown when
+    // created initially)
+    frame->Show(TRUE);
+    
+#ifdef __WXX11__    
+    m_xnestWindow = new wxAdoptedWindow;
+
+    wxString cmd;
+    cmd.Printf(wxT("Xnest :100 -geometry %dx%d+50+50"),
+        (int) m_emulatorScreenSize.x, (int) m_emulatorScreenSize.y);
+
+    // Asynchronously executes Xnest    
+    if (0 == wxExecute(cmd))
+    {
+        frame->Destroy();
+        wxMessageBox(wxT("Sorry, could not run Xnest. Please check your PATH."));
+        return FALSE;
+    }
+    
+    wxReparenter reparenter;
+    if (!reparenter.WaitAndReparent(m_containerWindow, m_xnestWindow, wxT("Xnest")))
+    {
+        wxMessageBox(wxT("Sorry, could not reparent Xnest.."));
+        frame->Destroy();
+        return FALSE;
+    }
+#endif
+
+    // success: wxApp::OnRun() will be called which will enter the main message
+    // loop and the application will run. If we returned FALSE here, the
+    // application would exit immediately.
+    return TRUE;
+}
+
+// Load the specified emulator.
+// For now, hard-wired. TODO: make this configurable
+bool wxEmulatorApp::LoadEmulator()
+{
+    m_emulatorInfo.m_emulatorTitle = wxT("iPAQ Emulator");
+
+    m_emulatorInfo.m_emulatorDescription = wxT("No description yet");
+
+    // The offset from the top-left of the main emulator
+    // bitmap and the virtual screen (where Xnest is
+    // positioned)
+    m_emulatorInfo.m_emulatorScreenPosition = wxPoint(45, 57);
+
+    // The emulated screen size
+    m_emulatorInfo.m_emulatorScreenSize = wxSize(240, 320);
+
+    m_emulatorInfo.m_emulatorBackgroundBitmapName = wxT("ipaq01.jpg");
+
+    m_emulatorInfo.m_emulatorBackgroundColour = * wxBLACK;
+    
+    return m_emulatorInfo.Load();
+}
+
+// ----------------------------------------------------------------------------
+// main frame
+// ----------------------------------------------------------------------------
+
+// frame constructor
+wxEmulatorFrame::wxEmulatorFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
+       : wxFrame(NULL, -1, title, pos, size)
+{
+    // set the frame icon
+    SetIcon(wxICON(mondrian));
+
+#if wxUSE_MENUS
+    // create a menu bar
+    wxMenu *menuFile = new wxMenu;
+
+    // the "About" item should be in the help menu
+    wxMenu *helpMenu = new wxMenu;
+    helpMenu->Append(Emulator_About, _T("&About...\tF1"), _T("Show about dialog"));
+
+    menuFile->Append(Emulator_Quit, _T("E&xit\tAlt-X"), _T("Quit this program"));
+
+    // now append the freshly created menu to the menu bar...
+    wxMenuBar *menuBar = new wxMenuBar();
+    menuBar->Append(menuFile, _T("&File"));
+    menuBar->Append(helpMenu, _T("&Help"));
+
+    // ... and attach this menu bar to the frame
+    SetMenuBar(menuBar);
+#endif // wxUSE_MENUS
+
+#if wxUSE_STATUSBAR
+    // create a status bar just for fun (by default with 1 pane only)
+    CreateStatusBar(2);
+    SetStatusText(_T("Welcome to wxWindows!"));
+#endif // wxUSE_STATUSBAR
+}
+
+
+// event handlers
+
+void wxEmulatorFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
+{
+    // TRUE is to force the frame to close
+    Close(TRUE);
+}
+
+void wxEmulatorFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
+{
+    wxString msg;
+    msg.Printf( _T("wxEmulator is an environment for testing embedded X11 apps.\n"));
+
+    wxMessageBox(msg, _T("About wxEmulator"), wxOK | wxICON_INFORMATION, this);
+}
+
+IMPLEMENT_CLASS(wxEmulatorContainer, wxWindow)
+
+BEGIN_EVENT_TABLE(wxEmulatorContainer, wxWindow)
+    EVT_SIZE(wxEmulatorContainer::OnSize)
+    EVT_PAINT(wxEmulatorContainer::OnPaint)
+    EVT_ERASE_BACKGROUND(wxEmulatorContainer::OnEraseBackground)
+END_EVENT_TABLE()
+
+wxEmulatorContainer::wxEmulatorContainer(wxWindow* parent, wxWindowID id):
+    wxWindow(parent, id, wxDefaultPosition, wxDefaultSize)
+{
+}
+
+void wxEmulatorContainer::OnSize(wxSizeEvent& event)
+{
+    wxSize sz = GetClientSize();
+    if (wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.Ok() &&
+        wxGetApp().m_xnestWindow)
+    {
+        int bitmapWidth = wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.GetWidth();
+        int bitmapHeight = wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.GetHeight();
+        
+        int x = wxMax(0, (sz.x - bitmapWidth)/2.0);
+        int y = wxMax(0, (sz.y - bitmapHeight)/2.0);
+        
+        x += wxGetApp().m_emulatorInfo.m_emulatorScreenPosition.x;
+        y += wxGetApp().m_emulatorInfo.m_emulatorScreenPosition.y;
+        
+        wxGetApp().m_xnestWindow->Move(x, y);
+    }
+    Refresh();
+}
+
+void wxEmulatorContainer::OnPaint(wxPaintEvent& event)
+{
+    wxPaintDC dc(this);
+    
+    wxSize sz = GetClientSize();
+    if (wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.Ok())
+    {
+        int bitmapWidth = wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.GetWidth();
+        int bitmapHeight = wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.GetHeight();
+        
+        int x = wxMax(0, (sz.x - bitmapWidth)/2.0);
+        int y = wxMax(0, (sz.y - bitmapHeight)/2.0);
+        
+        dc.DrawBitmap(wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap, x, y);
+    }
+}
+
+void wxEmulatorContainer::OnEraseBackground(wxEraseEvent& event)
+{
+    wxDC* dc = NULL;
+    
+    if (event.GetDC())
+    {
+        dc = event.GetDC();
+    }
+    else
+    {
+        dc = new wxClientDC(this);
+    }
+    
+    dc->SetBackground(wxBrush(wxGetApp().m_emulatorInfo.m_emulatorBackgroundColour, wxSOLID));
+    dc->Clear();
+    
+    if (!event.GetDC())
+        delete dc;
+}
+
+// Information about the emulator decorations
+
+void wxEmulatorInfo::Copy(const wxEmulatorInfo& info)
+{
+    m_emulatorTitle = info.m_emulatorTitle;
+    m_emulatorDescription = info.m_emulatorDescription;
+    m_emulatorScreenPosition = info.m_emulatorScreenPosition;
+    m_emulatorScreenSize = info.m_emulatorScreenSize;
+    m_emulatorBackgroundBitmap = info.m_emulatorBackgroundBitmap;
+    m_emulatorBackgroundBitmapName = info.m_emulatorBackgroundBitmapName;
+    m_emulatorBackgroundColour = info.m_emulatorBackgroundColour;
+}
+
+// Initialisation
+void wxEmulatorInfo::Init()
+{
+}
+
+// Loads bitmaps
+bool wxEmulatorInfo::Load()
+{
+    if (m_emulatorBackgroundBitmapName.IsEmpty())
+        return FALSE;
+
+    // TODO: prepend current directory if relative name
+    int type = wxDetermineImageType(m_emulatorBackgroundBitmapName);
+    if (type == -1)
+        return FALSE;
+    
+    return m_emulatorBackgroundBitmap.LoadFile(m_emulatorBackgroundBitmapName, type);
+}
+
+// Returns the image type, or -1, determined from the extension.
+int wxDetermineImageType(const wxString& filename)
+{
+    wxString path, name, ext;
+
+    wxSplitPath(filename, & path, & name, & ext);
+
+    ext.MakeLower();
+    if (ext == "jpg" || ext == "jpeg")
+        return wxBITMAP_TYPE_JPEG;
+    else if (ext == "gif")
+        return wxBITMAP_TYPE_GIF;
+    else if (ext == "bmp")
+        return wxBITMAP_TYPE_BMP;
+    else if (ext == "png")
+        return wxBITMAP_TYPE_PNG;
+    else if (ext == "pcx")
+        return wxBITMAP_TYPE_PCX;
+    else if (ext == "tif" || ext == "tiff")
+        return wxBITMAP_TYPE_TIF;
+    else
+        return -1;
+}
+
+
diff --git a/utils/emulator/src/emulator.dsp b/utils/emulator/src/emulator.dsp
new file mode 100644 (file)
index 0000000..e722286
--- /dev/null
@@ -0,0 +1,159 @@
+# Microsoft Developer Studio Project File - Name="emulator" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=emulator - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "emulator.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "emulator.mak" CFG="emulator - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "emulator - Win32 Release DLL" (based on "Win32 (x86) Application")
+!MESSAGE "emulator - Win32 Debug DLL" (based on "Win32 (x86) Application")
+!MESSAGE "emulator - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE "emulator - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "emulator - Win32 Release DLL"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "ReleaseDll"
+# PROP BASE Intermediate_Dir "ReleaseDll"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "ReleaseDll"
+# PROP Intermediate_Dir "ReleaseDll"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W4 /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /YX /FD /c
+# ADD CPP /nologo /MD /W4 /O2 /I "../../../include" /I "..\..\lib\mswdll" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "WXUSINGDLL" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+# ADD BASE RSC /l 0x409 /i "../../../include" /d "NDEBUG"
+# ADD RSC /l 0x409 /i "../../../include" /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib ..\..\lib\wxmsw233.lib /nologo /subsystem:windows /machine:I386
+
+!ELSEIF  "$(CFG)" == "emulator - Win32 Debug DLL"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "DebugDll"
+# PROP BASE Intermediate_Dir "DebugDll"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "DebugDll"
+# PROP Intermediate_Dir "DebugDll"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W4 /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /YX /FD /c
+# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../../../include" /I "..\..\lib\mswdlld" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "__WXDEBUG__" /D WXDEBUG=1 /D "WXUSINGDLL" /YX /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+# ADD BASE RSC /l 0x409 /i "../../../include" /d "_DEBUG"
+# ADD RSC /l 0x409 /i "../../../include" /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib ..\..\lib\wxmsw233d.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+
+!ELSEIF  "$(CFG)" == "emulator - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W4 /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /YX /FD /c
+# ADD CPP /nologo /MD /W4 /O2 /I "../../../include" /I "..\..\..\lib\msw" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+# ADD BASE RSC /l 0x409 /i "../../../include" /d "NDEBUG"
+# ADD RSC /l 0x409 /i "../../../include" /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib ..\..\..\lib\zlib.lib ..\..\..\lib\regex.lib ..\..\..\lib\png.lib ..\..\..\lib\jpeg.lib ..\..\..\lib\tiff.lib ..\..\..\lib\wxmsw.lib /nologo /subsystem:windows /machine:I386
+
+!ELSEIF  "$(CFG)" == "emulator - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W4 /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /YX /FD /c
+# ADD CPP /nologo /MDd /W4 /Zi /Od /I "../../../include" /I "..\..\..\lib\mswd" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "__WXDEBUG__" /D WXDEBUG=1 /YX /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+# ADD BASE RSC /l 0x409 /i "../../../include" /d "_DEBUG"
+# ADD RSC /l 0x409 /i "../../../include" /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib ..\..\..\lib\zlibd.lib ..\..\..\lib\regexd.lib ..\..\..\lib\pngd.lib ..\..\..\lib\jpegd.lib ..\..\..\lib\tiffd.lib ..\..\..\lib\wxmswd.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+
+!ENDIF 
+
+# Begin Target
+
+# Name "emulator - Win32 Release DLL"
+# Name "emulator - Win32 Debug DLL"
+# Name "emulator - Win32 Release"
+# Name "emulator - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\emulator.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\emulator.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\emulator.rc
+# End Source File
+# End Target
+# End Project
diff --git a/utils/emulator/src/emulator.dsw b/utils/emulator/src/emulator.dsw
new file mode 100644 (file)
index 0000000..506e0eb
--- /dev/null
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "emulator"=.\emulator.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/utils/emulator/src/emulator.h b/utils/emulator/src/emulator.h
new file mode 100644 (file)
index 0000000..34f5d7a
--- /dev/null
@@ -0,0 +1,137 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        emulator.h
+// Purpose:     wxX11-based PDA emulator classes
+// Author:      Julian Smart
+// Modified by:
+// Created:     2002-03-10
+// RCS-ID:      $Id$
+// Copyright:   (c) wxWindows team
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_EMULATOR_H_
+#define _WX_EMULATOR_H_
+
+#ifdef __GNUG__
+    #pragma interface "emulator.h"
+#endif
+
+// Information about the emulator decorations
+class wxEmulatorInfo: public wxObject
+{
+public:
+
+    wxEmulatorInfo() { Init(); }
+    wxEmulatorInfo(const wxEmulatorInfo& info) { Init(); Copy(info); }
+
+    void operator= (const wxEmulatorInfo& info) { Copy(info); }
+    void Copy(const wxEmulatorInfo& info);
+
+    // Initialisation
+    void Init();
+
+    // Loads bitmaps
+    bool Load();
+
+    // Emulator title
+    wxString m_emulatorTitle;
+
+    // Emulator description
+    wxString m_emulatorDescription;
+
+    // The offset from the top-left of the main emulator
+    // bitmap and the virtual screen (where Xnest is
+    // positioned)
+    wxPoint m_emulatorScreenPosition;
+
+    // The emulated screen size, e.g. 320x240
+    wxSize m_emulatorScreenSize;
+
+    // The bitmap used for drawing the main emulator
+    // decorations
+    wxBitmap m_emulatorBackgroundBitmap;
+    wxString m_emulatorBackgroundBitmapName;
+
+    // The intended background colour (for filling in
+    // areas of the window not covered by the bitmap)
+    wxColour m_emulatorBackgroundColour;
+
+    // TODO: an array of bitmaps and ids for custom buttons
+};
+
+// Emulator app class
+class wxEmulatorContainer;
+class wxEmulatorApp : public wxApp
+{
+public:
+    wxEmulatorApp();
+    virtual bool OnInit();
+
+    // Load the specified emulator
+    bool LoadEmulator();
+
+public:
+    wxEmulatorInfo          m_emulatorInfo;
+#ifdef __WXX11__
+    wxAdoptedWindow*        m_xnestWindow;
+#else
+    wxWindow*               m_xnestWindow;
+#endif
+    wxEmulatorContainer*    m_containerWindow;
+};
+
+// The container for the Xnest window. The decorations
+// will be drawn on this window.
+class wxEmulatorContainer: public wxWindow
+{
+public:
+
+    wxEmulatorContainer(wxWindow* parent, wxWindowID id);
+
+    void OnSize(wxSizeEvent& event);
+    void OnPaint(wxPaintEvent& event);
+    void OnEraseBackground(wxEraseEvent& event);
+
+DECLARE_CLASS(wxEmulatorContainer)
+DECLARE_EVENT_TABLE()
+
+};
+
+// Frame class
+class wxEmulatorFrame : public wxFrame
+{
+public:
+    // ctor(s)
+    wxEmulatorFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
+
+    // event handlers (these functions should _not_ be virtual)
+    void OnQuit(wxCommandEvent& event);
+    void OnAbout(wxCommandEvent& event);
+
+private:
+    // any class wishing to process wxWindows events must use this macro
+    DECLARE_EVENT_TABLE()
+};
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// IDs for the controls and the menu commands
+enum
+{
+    // menu items
+    Emulator_Quit = 1,
+
+    // it is important for the id corresponding to the "About" command to have
+    // this standard value as otherwise it won't be handled properly under Mac
+    // (where it is special and put into the "Apple" menu)
+    Emulator_About = wxID_ABOUT
+};
+
+// Returns the image type, or -1, determined from the extension.
+int wxDetermineImageType(const wxString& filename);
+
+#endif
+    // _WX_EMULATOR_H_
+
diff --git a/utils/emulator/src/emulator.rc b/utils/emulator/src/emulator.rc
new file mode 100644 (file)
index 0000000..7655c62
--- /dev/null
@@ -0,0 +1,3 @@
+mondrian ICON "mondrian.ico"
+#include "wx/msw/wx.rc"
+
diff --git a/utils/emulator/src/ipaq01.jpg b/utils/emulator/src/ipaq01.jpg
new file mode 100644 (file)
index 0000000..4366e72
Binary files /dev/null and b/utils/emulator/src/ipaq01.jpg differ
diff --git a/utils/emulator/src/makefile.g95 b/utils/emulator/src/makefile.g95
new file mode 100644 (file)
index 0000000..6bea432
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# File:         makefile.g95
+# Author:       Julian Smart
+# Created:      1999
+# Updated:
+# Copyright:    (c) Julian Smart, 1999
+#
+# Makefile for emulator (Cygwin/Mingw32).
+
+WXDIR = ../../..
+
+TARGET=emulator
+OBJECTS = $(TARGET).o
+
+include $(WXDIR)/src/makeprog.g95
+
diff --git a/utils/emulator/src/makefile.vc b/utils/emulator/src/makefile.vc
new file mode 100644 (file)
index 0000000..8753e07
--- /dev/null
@@ -0,0 +1,18 @@
+#
+# File:                makefile.vc
+# Author:      Julian Smart
+# Created:     1999
+# Updated:     
+# Copyright:   (c) Julian Smart
+#
+# Makefile : Builds emulator (VC++, WIN32)
+# Use FINAL=1 argument to nmake to build final version with no debug info.
+
+# Set WXDIR for your system
+WXDIR = $(WXWIN)
+
+PROGRAM=emulator
+OBJECTS = $(PROGRAM).obj
+
+!include $(WXDIR)\src\makeprog.vc
+
diff --git a/utils/emulator/src/mondrian.ico b/utils/emulator/src/mondrian.ico
new file mode 100644 (file)
index 0000000..2310c5d
Binary files /dev/null and b/utils/emulator/src/mondrian.ico differ
diff --git a/utils/emulator/src/mondrian.xpm b/utils/emulator/src/mondrian.xpm
new file mode 100644 (file)
index 0000000..409f27a
--- /dev/null
@@ -0,0 +1,44 @@
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+"  c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+"                                ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+"                                ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++      ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++                    ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+"                                "
+};