2015-10-27 19:07:41 +00:00
|
|
|
/* dialog.h
|
|
|
|
* PCSX2 Dev Team
|
2015-10-17 16:57:28 +00:00
|
|
|
* Copyright (C) 2015
|
|
|
|
*
|
|
|
|
* 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; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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 for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#ifndef __DIALOG_H__
|
|
|
|
#define __DIALOG_H__
|
|
|
|
|
|
|
|
#include <wx/wx.h>
|
|
|
|
#include <wx/notebook.h>
|
|
|
|
#include <wx/frame.h>
|
|
|
|
#include <wx/button.h>
|
|
|
|
#include <wx/panel.h>
|
|
|
|
#include <wx/effects.h>
|
|
|
|
#include <wx/rawbmp.h>
|
|
|
|
#include <wx/graphics.h>
|
|
|
|
#include <wx/timer.h>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
#include "GamePad.h"
|
|
|
|
#include "keyboard.h"
|
|
|
|
#include "onepad.h"
|
|
|
|
#include "opPanel.h"
|
|
|
|
|
|
|
|
#include "GamepadConfiguration.h"
|
|
|
|
#include "JoystickConfiguration.h"
|
|
|
|
|
|
|
|
// Allow to found quickly button id
|
|
|
|
// e.g L2 → 0, triangle → 4, ...
|
|
|
|
// see onepad.h for more details about gamepad button id
|
|
|
|
|
|
|
|
enum gui_buttons {
|
|
|
|
Analog = PAD_R_LEFT+1, // Analog button (not yet supported ?)
|
|
|
|
JoyL_config, // Left Joystick Configuration
|
|
|
|
JoyR_config, // Right Joystick Configuration
|
|
|
|
Gamepad_config, // Gamepad Configuration
|
2015-10-27 19:07:41 +00:00
|
|
|
Set_all, // Set all buttons
|
2015-10-17 16:57:28 +00:00
|
|
|
Apply, // Apply modifications without exit
|
|
|
|
Ok, // Apply modifications and exit
|
|
|
|
Cancel // Exit without apply modificatons
|
|
|
|
};
|
|
|
|
|
2015-10-27 19:07:41 +00:00
|
|
|
#define BUTTONS_LENGHT 32 // numbers of buttons on the gamepad
|
2015-10-17 16:57:28 +00:00
|
|
|
#define UPDATE_TIME 5
|
2015-11-29 14:42:42 +00:00
|
|
|
#define DEFAULT_WIDTH 1000
|
|
|
|
#define DEFAULT_HEIGHT 740
|
2015-10-17 16:57:28 +00:00
|
|
|
|
2016-07-20 08:06:29 +00:00
|
|
|
class Dialog : public wxDialog
|
2015-10-17 16:57:28 +00:00
|
|
|
{
|
|
|
|
// Panels
|
2015-11-29 14:42:42 +00:00
|
|
|
opPanel* m_pan_tabs[GAMEPAD_NUMBER]; // Gamepad Tabs box
|
2015-10-17 16:57:28 +00:00
|
|
|
// Notebooks
|
2015-11-29 14:42:42 +00:00
|
|
|
wxNotebook* m_tab_gamepad; // Joysticks Tabs
|
2015-10-17 16:57:28 +00:00
|
|
|
// Buttons
|
2015-11-29 14:42:42 +00:00
|
|
|
wxButton* m_bt_gamepad[GAMEPAD_NUMBER][BUTTONS_LENGHT]; // Joystick button use to modify the button mapping
|
2015-10-17 16:57:28 +00:00
|
|
|
// Contain all simulated key
|
2015-11-29 14:42:42 +00:00
|
|
|
u32 m_simulatedKeys[GAMEPAD_NUMBER][MAX_KEYS];
|
2015-10-17 16:57:28 +00:00
|
|
|
// Timer
|
2015-11-29 14:42:42 +00:00
|
|
|
wxTimer m_time_update_gui;
|
2015-10-17 16:57:28 +00:00
|
|
|
// Check if the gui must display feddback image
|
2015-11-29 14:42:42 +00:00
|
|
|
bool m_pressed[GAMEPAD_NUMBER][NB_IMG];
|
2015-10-17 16:57:28 +00:00
|
|
|
// Map the key pressed with the feedback image id
|
2015-11-29 14:42:42 +00:00
|
|
|
std::map<u32,int> m_map_images[GAMEPAD_NUMBER];
|
2015-10-17 16:57:28 +00:00
|
|
|
|
|
|
|
// methods
|
|
|
|
void config_key(int, int);
|
|
|
|
void clear_key(int, int);
|
|
|
|
void repopulate();
|
|
|
|
|
|
|
|
// Events
|
|
|
|
void OnButtonClicked(wxCommandEvent&);
|
2016-04-27 07:47:03 +00:00
|
|
|
void JoystickEvent(wxTimerEvent&);
|
2015-10-17 16:57:28 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
Dialog();
|
|
|
|
void InitDialog();
|
|
|
|
void show();
|
|
|
|
};
|
|
|
|
|
|
|
|
extern void DisplayDialog(); // Main function
|
|
|
|
|
|
|
|
#endif // __DIALOG_H__
|