- Converting dialog windows to use wxWidgets instead of win32.
- Currently only the about box is converted.
- The debug versions in windows will not compile yet.
- If you want to use the old version, remove #define USE_WXWIDGETS in nJoy.h



git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@85 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Laurence Muller
2008-07-26 12:28:17 +00:00
parent d522d8ad86
commit 82137a0ee9
8 changed files with 4339 additions and 35 deletions

View File

@ -0,0 +1,102 @@
//////////////////////////////////////////////////////////////////////////////////////////
// Project description
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Name: nJoy
// Description: A Dolphin Compatible Input Plugin
//
// Author: Falcon4ever (nJoy@falcon4ever.com)
// Site: www.multigesture.net
// Copyright (C) 2003-2008 Dolphin Project.
//
//////////////////////////////////////////////////////////////////////////////////////////
//
// Licensetype: GNU General Public License (GPL)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
//
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
//
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//
//////////////////////////////////////////////////////////////////////////////////////////
#include "AboutBox.h"
#include "../nJoy.h"
#include "Images/njoy.xpm"
BEGIN_EVENT_TABLE(AboutBox,wxDialog)
EVT_CLOSE(AboutBox::OnClose)
EVT_BUTTON(ID_OK, AboutBox::OKClick)
END_EVENT_TABLE()
AboutBox::AboutBox(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style)
{
CreateGUIControls();
}
AboutBox::~AboutBox()
{
// empty
}
void AboutBox::CreateGUIControls()
{
SetTitle(wxT("About: nJoy Input Plugin"));
SetIcon(wxNullIcon);
SetSize(8,8,206,399);
Center();
m_thankyoutext = new wxStaticText(this, ID_THANKYOU, wxT(THANKYOU), wxPoint(18,196), wxDefaultSize, 0, wxT(THANKYOU));
m_thankyoutext->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_thankyoutext->Wrap(167);
m_specialthanks = new wxStaticText(this, ID_SPECIALTHANKS, wxT("F|RES and ector."), wxPoint(18,153), wxDefaultSize, 0, wxT("F|RES and ector."));
m_specialthanks->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_pluginversion = new wxStaticText(this, ID_PLUGINVERSION, wxT("nJoy v"INPUT_VERSION" by Falcon4ever\n" "Release: "RELDAY"/"RELMONTH"/"RELYEAR"\n" "www.multigesture.net"), wxPoint(18,80), wxDefaultSize, 0, wxT("nJoy v"INPUT_VERSION" by Falcon4ever\n" "Release: "RELDAY"/"RELMONTH"/"RELYEAR"\n" "www.multigesture.net"));
m_pluginversion->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_OK = new wxButton(this, ID_OK, wxT("OK"), wxPoint(108,337), wxSize(75,25), 0, wxDefaultValidator, wxT("OK"));
m_OK->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_version = new wxStaticText(this, ID_STATUSV, wxT("PUBLIC RELEASE"), wxPoint(14,343), wxDefaultSize, 0, wxT("PUBLIC RELEASE"));
m_version->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_thankyougroup = new wxStaticBox(this, IDG_THANKYOU, wxT("Greetings to:"), wxPoint(10,180), wxSize(180,154));
m_thankyougroup->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_specialthanksgroup = new wxStaticBox(this, IDG_SPECIALTHANKS, wxT("Special thanks to:"), wxPoint(10,135), wxSize(180,39));
m_specialthanksgroup->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_pluginversiongroup = new wxStaticBox(this, IDG_PLUGINVERSION, wxT("Plugin info:"), wxPoint(10,61), wxSize(180,68));
m_pluginversiongroup->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
wxBitmap WxStaticBitmap1_BITMAP(AboutBox_WxStaticBitmap1_XPM);
m_njoylogo = new wxStaticBitmap(this, ID_AWESOMEPICTURE, WxStaticBitmap1_BITMAP, wxPoint(-1,-2), wxSize(200,60));
m_njoylogo->Enable(false);
m_njoylogo->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
}
void AboutBox::OnClose(wxCloseEvent& /*event*/)
{
EndModal(0);
}
void AboutBox::OKClick(wxCommandEvent& event)
{
if (event.GetId() == ID_OK)
{
Close();
}
}

View File

@ -0,0 +1,92 @@
//////////////////////////////////////////////////////////////////////////////////////////
// Project description
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Name: nJoy
// Description: A Dolphin Compatible Input Plugin
//
// Author: Falcon4ever (nJoy@falcon4ever.com)
// Site: www.multigesture.net
// Copyright (C) 2003-2008 Dolphin Project.
//
//////////////////////////////////////////////////////////////////////////////////////////
//
// Licensetype: GNU General Public License (GPL)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
//
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
//
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//
//////////////////////////////////////////////////////////////////////////////////////////
#ifndef __ABOUTBOX_h__
#define __ABOUTBOX_h__
#ifndef WX_PRECOMP
#include <wx/wx.h>
#include <wx/dialog.h>
#else
#include <wx/wxprec.h>
#endif
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/statbox.h>
#include <wx/statbmp.h>
#undef AboutBox_STYLE
#define AboutBox_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class AboutBox : public wxDialog
{
private:
DECLARE_EVENT_TABLE();
public:
AboutBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("About: nJoy Input Plugin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = AboutBox_STYLE);
virtual ~AboutBox();
void OKClick(wxCommandEvent& event);
private:
wxStaticText *m_thankyoutext;
wxStaticText *m_specialthanks;
wxStaticText *m_pluginversion;
wxButton *m_OK;
wxStaticText *m_version;
wxStaticBox *m_thankyougroup;
wxStaticBox *m_specialthanksgroup;
wxStaticBox *m_pluginversiongroup;
wxStaticBitmap *m_njoylogo;
private:
enum
{
ID_THANKYOU = 1009,
ID_SPECIALTHANKS = 1008,
ID_PLUGINVERSION = 1007,
ID_OK = 1006,
ID_STATUSV = 1005,
IDG_THANKYOU = 1004,
IDG_SPECIALTHANKS = 1003,
IDG_PLUGINVERSION = 1002,
ID_AWESOMEPICTURE = 1001,
ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
};
private:
void OnClose(wxCloseEvent& event);
void CreateGUIControls();
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
Import('env')
output = "../../../../Binary/linux/Plugins/Plugin_nJoy_SDL.so"
files = ["nJoy.cpp"
]
padenv=env.Copy(CXXFLAGS = " `pkg-config --cflags sdl`", LINKFLAGS = " `pkg-config --libs sdl`")
files = [ "nJoy.cpp",
"GUI/AboutDlg.cpp",
]
padenv=env.Copy(CXXFLAGS = " `wx-config --cppflags` `pkg-config --cflags sdl`", LINKFLAGS = "`wx-config --libs` `pkg-config --libs sdl` ")
padenv.SharedLibrary(output, files, LIBS=["common"])

View File

@ -42,6 +42,22 @@ CONTROLLER_STATE joystate[4];
CONTROLLER_MAPPING joysticks[4];
bool emulator_running = FALSE;
//////////////////////////////////////////////////////////////////////////////////////////
// wxWidgets
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#ifdef USE_WXWIDGETS
class wxDLLApp : public wxApp
{
bool OnInit()
{
return true;
}
};
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
#endif
//////////////////////////////////////////////////////////////////////////////////////////
// DllMain
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -52,6 +68,31 @@ BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
{
InitCommonControls();
#ifdef USE_WXWIDGETS
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
{
//use wxInitialize() if you don't want GUI instead of the following 12 lines
wxSetInstance((HINSTANCE)hinstDLL);
int argc = 0;
char **argv = NULL;
wxEntryStart(argc, argv);
if ( !wxTheApp || !wxTheApp->CallOnInit() )
return FALSE;
}
break;
case DLL_PROCESS_DETACH:
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
break;
default:
break;
}
#endif
nJoy_hInst = hinstDLL;
return TRUE;
}
@ -79,9 +120,27 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void DllAbout(HWND _hParent)
{
#ifdef _WIN32
OpenAbout(nJoy_hInst, _hParent);
#endif
#ifdef USE_WXWIDGETS
#ifdef _WIN32
wxWindow win;
win.SetHWND((WXHWND)_hParent);
win.Enable(false);
AboutBox frame(&win);
frame.ShowModal();
win.Enable(true);
win.SetHWND(0);
#else
AboutBox frame(NULL);
frame.ShowModal();
#endif
#else
#ifdef _WIN32
OpenAbout(nJoy_hInst, _hParent);
#endif
#endif
}
// Call config dialog

View File

@ -29,6 +29,10 @@
//
//////////////////////////////////////////////////////////////////////////////////////////
// Set this if you want to use the new wxWidgets GUI
#define USE_WXWIDGETS
#ifdef _WIN32
#define _CRT_SECURE_NO_WARNINGS
@ -36,6 +40,10 @@
#include <tchar.h>
#endif
#ifdef USE_WXWIDGETS
#include "GUI/AboutBox.h"
#endif
#include <vector>
#include <stdio.h>
#include <time.h>